diff options
author | Magnus Lundborg <lundborg.magnus@gmail.com> | 2013-05-22 12:58:40 (GMT) |
---|---|---|
committer | Magnus Lundborg <lundborg.magnus@gmail.com> | 2013-05-22 12:58:40 (GMT) |
commit | 98900c813d6b037a3931c60836a1df0405e1d6c5 (patch) | |
tree | ced597db7d76115d99dd5159b78aef1bbe33a645 /src/tests/CMakeLists.txt | |
parent | 74c11f5f2026bb02385763fd96d41d1d6a5f989c (diff) |
Added building options and bin subdirectories
Options to determine whether to build examples (on) and compression
tests (off).
Place binaries in subdirectories.
Diffstat (limited to 'src/tests/CMakeLists.txt')
-rw-r--r-- | src/tests/CMakeLists.txt | 70 |
1 files changed, 40 insertions, 30 deletions
diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 303035e..bee72c9 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -1,4 +1,6 @@ -add_subdirectory(compression) +if(BUILD_COMPRESSION_TESTS) + add_subdirectory(compression) +endif() if(NOT OPENMP_FOUND) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") @@ -21,37 +23,45 @@ if(HAVE_INTTYPES_H) set_target_properties(tng_testing PROPERTIES COMPILE_DEFINITIONS USE_STD_INTTYPES_H=1) endif() -if(OPENMP_FOUND) - add_executable(md_openmp md_openmp.c) - target_link_libraries(md_openmp tng_io ${OpenMP_LIBS}) - if(UNIX) - target_link_libraries(md_openmp m) - endif() -endif() +set_property(TARGET tng_testing PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/tests) -add_executable(tng_io_read_pos tng_io_read_pos.c) -target_link_libraries(tng_io_read_pos tng_io) -if(UNIX) -target_link_libraries(tng_io_read_pos m) -endif() +if(BUILD_TNG_EXAMPLES) + if(OPENMP_FOUND) + add_executable(md_openmp md_openmp.c) + target_link_libraries(md_openmp tng_io ${OpenMP_LIBS}) + if(UNIX) + target_link_libraries(md_openmp m) + endif() + set_property(TARGET md_openmp PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/examples) + endif() -add_executable(tng_parallel_read tng_parallel_read.c) -target_link_libraries(tng_parallel_read tng_io) -if(UNIX) -target_link_libraries(tng_parallel_read m) -endif() + add_executable(tng_io_read_pos tng_io_read_pos.c) + target_link_libraries(tng_io_read_pos tng_io) + if(UNIX) + target_link_libraries(tng_io_read_pos m) + endif() + set_property(TARGET tng_io_read_pos PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/examples) -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") + add_executable(tng_parallel_read tng_parallel_read.c) + target_link_libraries(tng_parallel_read tng_io) + if(UNIX) + target_link_libraries(tng_parallel_read m) endif() - if(OPENMP_FOUND) - add_executable(md_openmp_f md_openmp.f) - target_link_libraries(md_openmp_f tng_io ${OpenMP_LIBS}) + set_property(TARGET tng_parallel_read PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/examples) + + 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() + if(OPENMP_FOUND) + add_executable(md_openmp_f md_openmp.f) + target_link_libraries(md_openmp_f tng_io ${OpenMP_LIBS}) + endif() + endif() + set_property(TARGET md_openmp_f PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/examples) endif() - endif() -endif() +endif()
\ No newline at end of file |