Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMartin Hořeňovský2022-04-27 23:28:31 +0200
committerMartin Hořeňovský2022-04-28 10:52:16 +0200
commit07dfb4b070c0d2ff5f88f685220a5a95154f61dc (patch)
treec61e57a7bca70f06096b82c7c9cd8929e7acf0e8
parent5e86ead366befa2b551e64aecaf777dd2db85b3a (diff)
downloadcatch3-07dfb4b070c0d2ff5f88f685220a5a95154f61dc.tar.gz
Update PARENT_SCOPE cmake module path with path to extras/
This allows projects including us directly to do e.g. `include(Catch)` and get access to the test autoregistration CMake scripts. Note that this inclusion can be done directly through `add_subdirectory`, or indirectly via `FetchContent`. Closes #1805 Closes #2026 Closes #2130
-rw-r--r--CMakeLists.txt10
1 files changed, 9 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 99826404..6160c050 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -38,8 +38,16 @@ endif()
project(Catch2 LANGUAGES CXX VERSION 3.0.0)
-# Provide path for scripts
+# 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
+# no use to top level projects.
+list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/extras")
+if (NOT NOT_SUBPROJECT)
+ set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" PARENT_SCOPE)
+endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMake")
+
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
include(CatchConfigOptions)