From 9c5a4cf44e494bbd2e5dac151c400b3f4a4c9cbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Sun, 27 Oct 2024 23:07:51 +0100 Subject: [PATCH] Enable CMake project folders for better target organization Closes #2917 --- CMakeLists.txt | 7 ++++++- tests/ExtraTests/CMakeLists.txt | 1 - 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7bad26c3..6c24e1d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,8 @@ else() set(NOT_SUBPROJECT OFF) endif() +set_property(GLOBAL PROPERTY USE_FOLDERS 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_DEVELOPMENT_BUILD "Build tests, enable warnings, enable Werror, etc" OFF) @@ -41,7 +43,6 @@ project(Catch2 DESCRIPTION "A modern, C++-native, unit test framework." ) - # 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. # 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) message(FATAL_ERROR "Python not found, but required for tests") endif() + set(CMAKE_FOLDER "tests") add_subdirectory(tests) endif() if(CATCH_BUILD_EXAMPLES) + set(CMAKE_FOLDER "Examples") add_subdirectory(examples) endif() if(CATCH_BUILD_EXTRA_TESTS) + set(CMAKE_FOLDER "tests/ExtraTests") add_subdirectory(tests/ExtraTests) endif() if(CATCH_BUILD_FUZZERS) + set(CMAKE_FOLDER "fuzzing") add_subdirectory(fuzzing) endif() diff --git a/tests/ExtraTests/CMakeLists.txt b/tests/ExtraTests/CMakeLists.txt index 9f6d8173..a7268e54 100644 --- a/tests/ExtraTests/CMakeLists.txt +++ b/tests/ExtraTests/CMakeLists.txt @@ -8,7 +8,6 @@ project( Catch2ExtraTests LANGUAGES CXX ) message( STATUS "Extra tests included" ) - add_test( NAME TestShardingIntegration COMMAND ${PYTHON_EXECUTABLE} ${CATCH_DIR}/tests/TestScripts/testSharding.py $