diff --git a/CMakeLists.txt b/CMakeLists.txt index c943472a8aa..1c7798238fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,6 +58,8 @@ else() # PROJECT_IS_TOP_LEVEL find_package(CUDAToolkit REQUIRED) endif() # PROJECT_IS_TOP_LEVEL +add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/lib/dynamic_type) + # TODO: fix MSVC if(NOT MSVC) find_library(LIBNVTOOLSEXT libnvToolsExt.so PATHS ${CUDA_TOOLKIT_ROOT_DIR}/lib64/) diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake index ce17fc615fc..343c52387b8 100644 --- a/cmake/Dependencies.cmake +++ b/cmake/Dependencies.cmake @@ -12,8 +12,6 @@ set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libs" FORCE) set(INSTALL_GTEST OFF CACHE BOOL "Install gtest." FORCE) set(BUILD_GMOCK ON CACHE BOOL "Build gmock." FORCE) -add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../lib/dynamic_type) - # Add googletest subdirectory but make sure our INCLUDE_DIRECTORIES do not bleed into it. # This is because libraries installed into the root conda env (e.g. MKL) add a global /opt/conda/include directory, # and if there is gtest installed in conda, the third_party/googletest/**.cc source files would try to include headers diff --git a/lib/dynamic_type/CMakeLists.txt b/lib/dynamic_type/CMakeLists.txt index 283db2a8993..7cbd565ca74 100644 --- a/lib/dynamic_type/CMakeLists.txt +++ b/lib/dynamic_type/CMakeLists.txt @@ -5,30 +5,32 @@ add_library(dynamic_type INTERFACE) target_include_directories(dynamic_type INTERFACE src) -function(add_test_for_standard std_version) - set(target test_dynamic_type_${std_version}) - add_executable(${target} - test/ForAllTypes.cpp - test/assignment.cpp - test/binary_ops.cpp - test/container.cpp - test/examples.cpp - test/hash.cpp - test/member.cpp - test/move.cpp - test/null.cpp - test/opcheck.cpp - test/print.cpp - test/typing.cpp - test/unary_ops.cpp - ) - target_include_directories(${target} PUBLIC src) - target_link_libraries(${target} PRIVATE gtest_main gmock_main) - set_property(TARGET ${target} PROPERTY CXX_STANDARD ${std_version}) -endfunction() +if(BUILD_TEST) + function(add_test_for_standard std_version) + set(target test_dynamic_type_${std_version}) + add_executable(${target} + test/ForAllTypes.cpp + test/assignment.cpp + test/binary_ops.cpp + test/container.cpp + test/examples.cpp + test/hash.cpp + test/member.cpp + test/move.cpp + test/null.cpp + test/opcheck.cpp + test/print.cpp + test/typing.cpp + test/unary_ops.cpp + ) + target_include_directories(${target} PUBLIC src) + target_link_libraries(${target} PRIVATE gtest_main gmock_main) + set_property(TARGET ${target} PROPERTY CXX_STANDARD ${std_version}) + endfunction() -add_test_for_standard(17) + add_test_for_standard(17) -# add_test_for_standard(20) -# add_test_for_standard(23) -# add_test_for_standard(26) + # add_test_for_standard(20) + # add_test_for_standard(23) + # add_test_for_standard(26) +endif()