Verified Commit d1fba71f authored by Lars Bilke's avatar Lars Bilke
Browse files

[CMake] Do not build vtkdiff or gtest when BUILD_TESTING=OFF

parent 3c484e09
......@@ -272,7 +272,7 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/spdlog/include)
# vtkdiff
if(EXISTS ${PROJECT_SOURCE_DIR}/ThirdParty/vtkdiff/CMakeLists.txt)
if(EXISTS ${PROJECT_SOURCE_DIR}/ThirdParty/vtkdiff/CMakeLists.txt AND BUILD_TESTING)
add_subdirectory(ThirdParty/vtkdiff)
install(PROGRAMS $<TARGET_FILE:vtkdiff> DESTINATION bin COMPONENT ogs_extras)
endif()
......
add_subdirectory(spdlog)
set(DISABLE_WARNINGS_TARGETS spdlog)
set(gtest_force_shared_crt ON CACHE INTERNAL "") # Use dynamic MSVC runtime
set(INSTALL_GTEST OFF CACHE INTERNAL "")
add_subdirectory(googletest)
if(BUILD_TESTING)
set(gtest_force_shared_crt ON CACHE INTERNAL "") # Use dynamic MSVC runtime
set(INSTALL_GTEST OFF CACHE INTERNAL "")
add_subdirectory(googletest)
endif()
# This is a workaround for Travis builds.
option(OGS_USE_OPTIONAL_SUBMODULES "Option for enabling optional submodules" OFF)
......
......@@ -18,9 +18,11 @@ set(REQUIRED_SUBMODULES
ThirdParty/spdlog
ThirdParty/tclap
ThirdParty/tetgen
ThirdParty/vtkdiff
${OGS_ADDITIONAL_SUBMODULES_TO_CHECKOUT}
)
if(BUILD_TESTING)
list(APPEND REQUIRED_SUBMODULES ThirdParty/vtkdiff)
endif()
if(OGS_BUILD_UTILS)
# Required by the partmesh tool, which is build with utils only.
list(APPEND REQUIRED_SUBMODULES ThirdParty/metis)
......
function (OgsTest)
if(NOT OGS_BUILD_CLI)
if(NOT OGS_BUILD_CLI OR NOT BUILD_TESTING)
return()
endif()
set(options LARGE)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment