--- a/FORTRAN/CMakeLists.txt
+++ b/FORTRAN/CMakeLists.txt
@@ -8,11 +8,13 @@
   set(_DEPENDENCY_ALL "EXCLUDE_FROM_ALL")
 endif()
 
+if(enable_examples)
 # targets to build examples
 add_dependencies(examples
                  dfexm
                  zfexm
                  test_omp)
+endif()
 
 set(sources "")
 list(APPEND sources c_fortran_dgssv.c c_fortran_zgssv.c)
