summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/CMakeDependentOption
diff options
context:
space:
mode:
authorDaniel Schürmann <daschuer@mixxx.org>2021-06-13 21:50:47 (GMT)
committerBrad King <brad.king@kitware.com>2021-06-14 17:45:49 (GMT)
commit0665d9092e5099c581e47f3be5360d711d176c2d (patch)
tree0febf359df361d81a8323c027c260653b1129103 /Tests/RunCMake/CMakeDependentOption
parent0d3ddb17049afc660ac2a11c13013c940d9fc04c (diff)
downloadCMake-0665d9092e5099c581e47f3be5360d711d176c2d.zip
CMake-0665d9092e5099c581e47f3be5360d711d176c2d.tar.gz
CMake-0665d9092e5099c581e47f3be5360d711d176c2d.tar.bz2
CMakeDependentOption: Allow parentheses in the depends string
`if()` takes the condition as a list of arguments. Parentheses need to be separated as well. Fixes: #22303
Diffstat (limited to 'Tests/RunCMake/CMakeDependentOption')
-rw-r--r--Tests/RunCMake/CMakeDependentOption/Parentheses-stdout.txt1
-rw-r--r--Tests/RunCMake/CMakeDependentOption/Parentheses.cmake7
-rw-r--r--Tests/RunCMake/CMakeDependentOption/RunCMakeTest.cmake3
3 files changed, 11 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMakeDependentOption/Parentheses-stdout.txt b/Tests/RunCMake/CMakeDependentOption/Parentheses-stdout.txt
new file mode 100644
index 0000000..15b56a1
--- /dev/null
+++ b/Tests/RunCMake/CMakeDependentOption/Parentheses-stdout.txt
@@ -0,0 +1 @@
+-- USE_FOO='ON'
diff --git a/Tests/RunCMake/CMakeDependentOption/Parentheses.cmake b/Tests/RunCMake/CMakeDependentOption/Parentheses.cmake
new file mode 100644
index 0000000..c2951f1
--- /dev/null
+++ b/Tests/RunCMake/CMakeDependentOption/Parentheses.cmake
@@ -0,0 +1,7 @@
+include(CMakeDependentOption)
+
+set(A 1)
+set(B 1)
+set(C 0)
+cmake_dependent_option(USE_FOO "Use Foo" ON "A AND (B OR C)" OFF)
+message(STATUS "USE_FOO='${USE_FOO}'")
diff --git a/Tests/RunCMake/CMakeDependentOption/RunCMakeTest.cmake b/Tests/RunCMake/CMakeDependentOption/RunCMakeTest.cmake
new file mode 100644
index 0000000..bbdd3e5
--- /dev/null
+++ b/Tests/RunCMake/CMakeDependentOption/RunCMakeTest.cmake
@@ -0,0 +1,3 @@
+include(RunCMake)
+
+run_cmake_script(Parentheses)