Enable CMake project folders for better target organization

Closes #2917
This commit is contained in:
Martin Hořeňovský 2024-10-27 23:07:51 +01:00
parent e260288807
commit 9c5a4cf44e
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A
2 changed files with 6 additions and 2 deletions

View File

@ -8,6 +8,8 @@ else()
set(NOT_SUBPROJECT OFF) set(NOT_SUBPROJECT OFF)
endif() endif()
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
option(CATCH_INSTALL_DOCS "Install documentation alongside library" ON) option(CATCH_INSTALL_DOCS "Install documentation alongside library" ON)
option(CATCH_INSTALL_EXTRAS "Install extras (CMake scripts, debugger helpers) alongside library" ON) option(CATCH_INSTALL_EXTRAS "Install extras (CMake scripts, debugger helpers) alongside library" ON)
option(CATCH_DEVELOPMENT_BUILD "Build tests, enable warnings, enable Werror, etc" OFF) option(CATCH_DEVELOPMENT_BUILD "Build tests, enable warnings, enable Werror, etc" OFF)
@ -41,7 +43,6 @@ project(Catch2
DESCRIPTION "A modern, C++-native, unit test framework." DESCRIPTION "A modern, C++-native, unit test framework."
) )
# Provide path for scripts. We first add path to the scripts we don't use, # Provide path for scripts. We first add path to the scripts we don't use,
# but projects including us might, and set the path up to parent scope. # but projects including us might, and set the path up to parent scope.
# Then we also add path that we use to configure the project, but is of # Then we also add path that we use to configure the project, but is of
@ -86,18 +87,22 @@ if (BUILD_TESTING AND CATCH_BUILD_TESTING AND NOT_SUBPROJECT)
if (NOT PYTHONINTERP_FOUND) if (NOT PYTHONINTERP_FOUND)
message(FATAL_ERROR "Python not found, but required for tests") message(FATAL_ERROR "Python not found, but required for tests")
endif() endif()
set(CMAKE_FOLDER "tests")
add_subdirectory(tests) add_subdirectory(tests)
endif() endif()
if(CATCH_BUILD_EXAMPLES) if(CATCH_BUILD_EXAMPLES)
set(CMAKE_FOLDER "Examples")
add_subdirectory(examples) add_subdirectory(examples)
endif() endif()
if(CATCH_BUILD_EXTRA_TESTS) if(CATCH_BUILD_EXTRA_TESTS)
set(CMAKE_FOLDER "tests/ExtraTests")
add_subdirectory(tests/ExtraTests) add_subdirectory(tests/ExtraTests)
endif() endif()
if(CATCH_BUILD_FUZZERS) if(CATCH_BUILD_FUZZERS)
set(CMAKE_FOLDER "fuzzing")
add_subdirectory(fuzzing) add_subdirectory(fuzzing)
endif() endif()

View File

@ -8,7 +8,6 @@ project( Catch2ExtraTests LANGUAGES CXX )
message( STATUS "Extra tests included" ) message( STATUS "Extra tests included" )
add_test( add_test(
NAME TestShardingIntegration NAME TestShardingIntegration
COMMAND ${PYTHON_EXECUTABLE} ${CATCH_DIR}/tests/TestScripts/testSharding.py $<TARGET_FILE:SelfTest> COMMAND ${PYTHON_EXECUTABLE} ${CATCH_DIR}/tests/TestScripts/testSharding.py $<TARGET_FILE:SelfTest>