Skip to content

Commit

Permalink
Enable CMake project folders for better target organization
Browse files Browse the repository at this point in the history
Closes #2917
  • Loading branch information
horenmar committed Oct 27, 2024
1 parent e260288 commit 9c5a4cf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()

Expand Down
1 change: 0 additions & 1 deletion tests/ExtraTests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 $<TARGET_FILE:SelfTest>
Expand Down

0 comments on commit 9c5a4cf

Please sign in to comment.