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