diff options
-rw-r--r-- | CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/tests/CMakeLists.txt | 17 |
2 files changed, 13 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c36dcb8..18f8d90 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,8 @@ project(TRAJECTORY) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) +option(BUILD_FORTRAN "Build Fortran examples" OFF) + option(USE_OPENMP "Try to use the OpenMP library (if available)" ON) if(USE_OPENMP) FIND_PACKAGE(OpenMP) @@ -36,4 +38,4 @@ if(BUILD_DOCUMENTATION) SOURCES ${PROJECT_BINARY_DIR}/Doxyfile) # IF you do NOT want the documentation to be generated EVERY time you build the project # then leave out the 'ALL' keyword from the above command. -endif() +endif()
\ No newline at end of file diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index aa0289d..de39fbe 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -19,12 +19,15 @@ target_link_libraries(md_openmp tng_io ${OpenMP_LIBS} m) add_executable(tng_io_read_pos tng_io_read_pos.c) target_link_libraries(tng_io_read_pos tng_io) -enable_language(Fortran OPTIONAL) -if(${CMAKE_Fortran_COMPILER_WORKS}) - get_filename_component (Fortran_COMPILER_NAME ${CMAKE_Fortran_COMPILER} NAME) - if (Fortran_COMPILER_NAME STREQUAL "gfortran") - set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fcray-pointer ${OpenMP_C_FLAGS} -std=legacy") +if(BUILD_FORTRAN) + # This does not work due to a bug in CMake. Remove lines below if no fortran compiler is found. + enable_language(Fortran OPTIONAL) + if(${CMAKE_Fortran_COMPILER_WORKS}) + get_filename_component (Fortran_COMPILER_NAME ${CMAKE_Fortran_COMPILER} NAME) + if (Fortran_COMPILER_NAME STREQUAL "gfortran") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fcray-pointer ${OpenMP_C_FLAGS} -std=legacy") + endif() + add_executable(md_openmp_f md_openmp.f) + target_link_libraries(md_openmp_f tng_io ${OpenMP_LIBS}) endif() - add_executable(md_openmp_f md_openmp.f) - target_link_libraries(md_openmp_f tng_io ${OpenMP_LIBS}) endif() |