diff --git a/CMakeLists.txt b/CMakeLists.txt index 57a22ed..b382ec6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,8 +19,8 @@ include(cmake/check_avx.cmake) # GIT VARIABLES -execute_process(COMMAND bash "-c" "git rev-parse HEAD" OUTPUT_VARIABLE GIT_HASH OUTPUT_STRIP_TRAILING_WHITESPACE) -execute_process(COMMAND bash "-c" "git rev-parse --abbrev-ref HEAD" OUTPUT_VARIABLE GIT_BRANCH OUTPUT_STRIP_TRAILING_WHITESPACE) +execute_process(COMMAND bash "-c" "git rev-parse HEAD" OUTPUT_VARIABLE GIT_HASH OUTPUT_STRIP_TRAILING_WHITESPACE WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) +execute_process(COMMAND bash "-c" "git rev-parse --abbrev-ref HEAD" OUTPUT_VARIABLE GIT_BRANCH OUTPUT_STRIP_TRAILING_WHITESPACE WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) # BUILD VERSION STRING @@ -74,23 +74,32 @@ if(NOT ${SCALAR_BUILD}) endif() endif() -# CHECK LIBRARIES : GTest - +# CHECK LIBRARIES message(STATUS "check for libraries") -find_package( GTest REQUIRED ) -if(GTest_FOUND) - include_directories(${GTEST_INCLUDE_DIRS}) + +if(DEFINED ENABLE_TESTS) + set(ENABLE_TESTS ${ENABLE_hdf5} CACHE BOOL "enable tests") else() - message(FATAL_ERROR "GTest not found") + set(ENABLE_TESTS TRUE CACHE BOOL "enable tests") endif() -# CHECK LIBRARIES : Threads +if(ENABLE_TESTS) + # CHECK LIBRARIES : GTest + find_package( GTest REQUIRED ) + if(GTest_FOUND) + include_directories(${GTEST_INCLUDE_DIRS}) + else() + message(FATAL_ERROR "GTest not found") + endif() -find_package(Threads REQUIRED) -if(Threads_FOUND) - #include_directories(${Threads_INCLUDE_DIRS}) -else() - message(FATAL_ERROR "Threads not found") + # CHECK LIBRARIES : Threads + + find_package(Threads REQUIRED) + if(Threads_FOUND) + #include_directories(${Threads_INCLUDE_DIRS}) + else() + message(FATAL_ERROR "Threads not found") + endif() endif() # CHECK LIBRARIES : hdf5 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2a3f1c5..d9128dc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,6 +1,8 @@ include_directories(${CMAKE_SOURCE_DIR}/src/include) -add_subdirectory(tests) +if(ENABLE_TESTS) + add_subdirectory(tests) +endif() add_subdirectory(lib) add_subdirectory(bin) diff --git a/src/opt/cereal/CMakeLists.txt b/src/opt/cereal/CMakeLists.txt index fbedba0..a0ea9d3 100644 --- a/src/opt/cereal/CMakeLists.txt +++ b/src/opt/cereal/CMakeLists.txt @@ -1,6 +1,8 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) -add_subdirectory(tests) +if(ENABLE_TESTS) + add_subdirectory(tests) +endif() install(DIRECTORY include/ DESTINATION ${INSTALL_PATH}/include/cnorxz/cereal) diff --git a/src/opt/hdf5/CMakeLists.txt b/src/opt/hdf5/CMakeLists.txt index b0f1a98..8731379 100644 --- a/src/opt/hdf5/CMakeLists.txt +++ b/src/opt/hdf5/CMakeLists.txt @@ -11,6 +11,8 @@ set(HDF5_LIBS ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARIES}) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) add_subdirectory(lib) -add_subdirectory(tests) +if(ENABLE_TESTS) + add_subdirectory(tests) +endif() install(DIRECTORY include/ DESTINATION ${INSTALL_PATH}/include/cnorxz/hdf5) diff --git a/src/opt/hdf5_mpi/CMakeLists.txt b/src/opt/hdf5_mpi/CMakeLists.txt index 0540c3c..4d1947c 100644 --- a/src/opt/hdf5_mpi/CMakeLists.txt +++ b/src/opt/hdf5_mpi/CMakeLists.txt @@ -23,7 +23,9 @@ if(HDF5_IS_PARALLEL) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) add_subdirectory(lib) - add_subdirectory(tests) + if(ENABLE_TESTS) + add_subdirectory(tests) + endif() install(DIRECTORY include/ DESTINATION ${INSTALL_PATH}/include/cnorxz/hdf5_mpi) install(CODE "execute_process(COMMAND sed -i \"s|CXZ_H5_MPI_BUILD_MODE 1|CXZ_H5_MPI_BUILD_MODE 0|g;\" ${INSTALL_PATH}/include/cnorxz/hdf5_mpi/h5_mpi_base.h)") diff --git a/src/opt/mpi/CMakeLists.txt b/src/opt/mpi/CMakeLists.txt index 699f331..0c891cd 100644 --- a/src/opt/mpi/CMakeLists.txt +++ b/src/opt/mpi/CMakeLists.txt @@ -11,6 +11,8 @@ set(MPI_LIBS ${MPI_LIBRARIES}) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) add_subdirectory(lib) -add_subdirectory(tests) - +if(ENABLE_TESTS) + add_subdirectory(tests) +endif() + install(DIRECTORY include/ DESTINATION ${INSTALL_PATH}/include/cnorxz/mpi)