cmake: honor OPENSPACE_HAVE_TESTS at more places (#3503)

- Don't build the codegen unit tests if the OpenSpace unit tests are
  disabled;
- Dropagate the value of this option to Ghoul's corresponding option,
  unless Ghoul's option value has been forced;
This commit is contained in:
David Wagner
2025-01-31 08:27:38 +01:00
committed by GitHub
parent 3d3580fa65
commit 8a5d57a441
3 changed files with 12 additions and 5 deletions

View File

@@ -183,11 +183,6 @@ add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/modules")
end_header("End: Configuring Modules")
add_subdirectory(support/coding/codegen/tests)
set_target_properties(run_test_codegen PROPERTIES FOLDER "Unit Tests/support")
set_target_properties(codegentest PROPERTIES FOLDER "Unit Tests")
begin_header("Configuring Applications")
add_subdirectory(apps)
end_header("End: Configuring Applications")
@@ -200,6 +195,10 @@ endif ()
option(OPENSPACE_HAVE_TESTS "Activate the OpenSpace unit tests" ON)
if (OPENSPACE_HAVE_TESTS)
add_subdirectory(support/coding/codegen/tests)
set_target_properties(run_test_codegen PROPERTIES FOLDER "Unit Tests/support")
set_target_properties(codegentest PROPERTIES FOLDER "Unit Tests")
begin_header("Generating OpenSpace unit test")
add_subdirectory(tests)
end_header()

View File

@@ -116,6 +116,10 @@ set(SGCT_DEP_INCLUDE_FMT OFF CACHE BOOL "" FORCE)
set(SGCT_DEP_INCLUDE_SCN OFF CACHE BOOL "" FORCE)
set(SGCT_DEP_INCLUDE_CATCH2 OFF CACHE BOOL "" FORCE)
if (NOT OPENSPACE_HAVE_TESTS)
# Unless overriden, disable sgct tests if OpenSpace tests are disabled
set(SGCT_BUILD_TESTS FALSE CACHE BOOL "Enable ghoul unit tests")
endif()
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/ext/sgct)
target_link_libraries(OpenSpace PRIVATE sgct)

View File

@@ -45,6 +45,10 @@ if (APPLE)
endif ()
# Ghoul
if (NOT OPENSPACE_HAVE_TESTS)
# Unless overriden, disable ghoul tests if OpenSpace tests are disabled
set(GHOUL_HAVE_TESTS FALSE CACHE BOOL "Enable ghoul unit tests")
endif()
add_subdirectory(ghoul)
if (TARGET GhoulTest)
set_target_properties(GhoulTest PROPERTIES FOLDER "Unit Tests")