summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@crascit.com>2023-09-26 12:35:33 (GMT)
committerKitware Robot <kwrobot@kitware.com>2023-09-26 12:35:45 (GMT)
commit8a90ae92afd53a89cb223082778adad5c696d80f (patch)
treed0d500ab10f40a1be500907d5bd4ff4accbd32c9 /Tests/RunCMake
parent3330869964f527a984bbdee25134b1af3dd2ab21 (diff)
parent5f77807f1cc5b73eea00c55fdacc261cb3b0d3bb (diff)
downloadCMake-8a90ae92afd53a89cb223082778adad5c696d80f.zip
CMake-8a90ae92afd53a89cb223082778adad5c696d80f.tar.gz
CMake-8a90ae92afd53a89cb223082778adad5c696d80f.tar.bz2
Merge topic 'FetchContent-EXCLUDE_FROM_ALL'
5f77807f1c FetchContent: Add support for EXCLUDE_FROM_ALL Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !8822
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r--Tests/RunCMake/FetchContent/ExcludeFromAll.cmake11
-rw-r--r--Tests/RunCMake/FetchContent/ExcludeFromAll/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/FetchContent/ExcludeFromAll/error.c1
-rw-r--r--Tests/RunCMake/FetchContent/RunCMakeTest.cmake12
4 files changed, 25 insertions, 0 deletions
diff --git a/Tests/RunCMake/FetchContent/ExcludeFromAll.cmake b/Tests/RunCMake/FetchContent/ExcludeFromAll.cmake
new file mode 100644
index 0000000..376f2eb
--- /dev/null
+++ b/Tests/RunCMake/FetchContent/ExcludeFromAll.cmake
@@ -0,0 +1,11 @@
+enable_language(C)
+
+include(FetchContent)
+
+FetchContent_Declare(
+ ExcludeFromAll
+ SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/ExcludeFromAll
+ EXCLUDE_FROM_ALL
+)
+
+FetchContent_MakeAvailable(ExcludeFromAll)
diff --git a/Tests/RunCMake/FetchContent/ExcludeFromAll/CMakeLists.txt b/Tests/RunCMake/FetchContent/ExcludeFromAll/CMakeLists.txt
new file mode 100644
index 0000000..08ffb33
--- /dev/null
+++ b/Tests/RunCMake/FetchContent/ExcludeFromAll/CMakeLists.txt
@@ -0,0 +1 @@
+add_library(broken STATIC error.c)
diff --git a/Tests/RunCMake/FetchContent/ExcludeFromAll/error.c b/Tests/RunCMake/FetchContent/ExcludeFromAll/error.c
new file mode 100644
index 0000000..f10e687
--- /dev/null
+++ b/Tests/RunCMake/FetchContent/ExcludeFromAll/error.c
@@ -0,0 +1 @@
+#error "This should not be compiled"
diff --git a/Tests/RunCMake/FetchContent/RunCMakeTest.cmake b/Tests/RunCMake/FetchContent/RunCMakeTest.cmake
index 3781089..d0790eb 100644
--- a/Tests/RunCMake/FetchContent/RunCMakeTest.cmake
+++ b/Tests/RunCMake/FetchContent/RunCMakeTest.cmake
@@ -64,3 +64,15 @@ run_cmake_command(ScriptMode
-DCMAKE_MAKE_PROGRAM=${RunCMake_MAKE_PROGRAM}
-P ${CMAKE_CURRENT_LIST_DIR}/ScriptMode.cmake
)
+
+function(run_FetchContent_ExcludeFromAll)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/ExcludeFromAll-build)
+ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+
+ run_cmake(ExcludeFromAll)
+
+ set(RunCMake_TEST_NO_CLEAN 1)
+ run_cmake_command(ExcludeFromAll-build ${CMAKE_COMMAND} --build .)
+endfunction()
+run_FetchContent_ExcludeFromAll()