summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/NinjaMultiConfig/ExcludeFromAll.cmake
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2020-07-16 08:15:04 (GMT)
committerJoerg Bornemann <joerg.bornemann@qt.io>2020-07-21 15:16:26 (GMT)
commit2cdaf43d966f8407f0fb75ceb131fdca16617915 (patch)
tree15e3284091c62ca73b22fa15ea1a93770c97305d /Tests/RunCMake/NinjaMultiConfig/ExcludeFromAll.cmake
parentc7b7547d8da6b9a4225d111440d0cf6c2f55914d (diff)
downloadCMake-2cdaf43d966f8407f0fb75ceb131fdca16617915.zip
CMake-2cdaf43d966f8407f0fb75ceb131fdca16617915.tar.gz
CMake-2cdaf43d966f8407f0fb75ceb131fdca16617915.tar.bz2
Allow generator expressions in the EXCLUDE_FROM_ALL target property
This allows for setting EXCLUDE_FROM_ALL, conditional on the build configuration. However, only the Ninja Multi-Config generator supports different property values per config. All other multi-config generators will yield an error in that situation. Fixes: #20923
Diffstat (limited to 'Tests/RunCMake/NinjaMultiConfig/ExcludeFromAll.cmake')
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/ExcludeFromAll.cmake12
1 files changed, 12 insertions, 0 deletions
diff --git a/Tests/RunCMake/NinjaMultiConfig/ExcludeFromAll.cmake b/Tests/RunCMake/NinjaMultiConfig/ExcludeFromAll.cmake
new file mode 100644
index 0000000..52f84ea
--- /dev/null
+++ b/Tests/RunCMake/NinjaMultiConfig/ExcludeFromAll.cmake
@@ -0,0 +1,12 @@
+enable_language(C)
+
+set(CMAKE_CONFIGURATION_TYPES "Release;Debug" CACHE STRING "")
+set(CMAKE_DEFAULT_BUILD_TYPE "Release" CACHE STRING "")
+set(CMAKE_CROSS_CONFIGS "all" CACHE STRING "")
+set(CMAKE_DEFAULT_CONFIGS "all" CACHE STRING "")
+
+add_executable(release_only_tool main.c)
+set_property(TARGET release_only_tool PROPERTY EXCLUDE_FROM_ALL "$<NOT:$<CONFIG:Release>>")
+
+include(${CMAKE_CURRENT_LIST_DIR}/Common.cmake)
+generate_output_files(release_only_tool)