if(TNG_BUILD_COMPRESSION_TESTS) add_subdirectory(compression) endif() link_directories(${TNG_IO_BINARY_DIR}/src/lib) set(EXAMPLE_FILES_DIR ${CMAKE_BINARY_DIR}/example_files/ CACHE STRING "Directory where to find input test files and save output files.") configure_file(${TNG_IO_SOURCE_DIR}/include/tng_io_testing.h.in ${CMAKE_BINARY_DIR}/generated/tng_io_testing.h) include_directories(${CMAKE_BINARY_DIR}/generated/) if(TNG_BUILD_TEST) add_executable(tng_testing tng_io_testing.c) target_link_libraries(tng_testing tng_io) if(UNIX) target_link_libraries(tng_testing m) endif() if(HAVE_INTTYPES_H) set_target_properties(tng_testing PROPERTIES COMPILE_DEFINITIONS USE_STD_INTTYPES_H=1) endif() set_property(TARGET tng_testing PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/tests) endif() if(TNG_BUILD_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) add_executable(md_openmp_util md_openmp_util.c) target_link_libraries(md_openmp_util tng_io ${OpenMP_LIBS}) if(UNIX) target_link_libraries(md_openmp_util m) endif() set_property(TARGET md_openmp_util PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/examples) 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) add_executable(tng_io_read_pos_util tng_io_read_pos_util.c) target_link_libraries(tng_io_read_pos_util tng_io) if(UNIX) target_link_libraries(tng_io_read_pos_util m) endif() set_property(TARGET tng_io_read_pos_util PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/examples) 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() set_property(TARGET tng_parallel_read PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/examples) if(TNG_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()