Skip to content
Snippets Groups Projects
Commit 6e04e06e authored by Brad King's avatar Brad King Committed by Kitware Robot
Browse files

Merge topic 'CMakeDependentOption-revert-parens' into release-3.21


d777ca12 CMakeDependentOption: Revert "Allow parentheses in the depends string"

Acked-by: default avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !6368
parents 797aa4c4 d777ca12
No related branches found
No related tags found
No related merge requests found
......@@ -42,10 +42,7 @@ macro(CMAKE_DEPENDENT_OPTION option doc default depends force)
if(${option}_ISSET MATCHES "^${option}_ISSET$")
set(${option}_AVAILABLE 1)
foreach(d ${depends})
string(REPLACE "(" " ( " _CMAKE_CDO_DEP "${d}")
string(REPLACE ")" " ) " _CMAKE_CDO_DEP "${_CMAKE_CDO_DEP}")
string(REGEX REPLACE " +" ";" CMAKE_DEPENDENT_OPTION_DEP "${_CMAKE_CDO_DEP}")
unset(_CMAKE_CDO_DEP)
string(REGEX REPLACE " +" ";" CMAKE_DEPENDENT_OPTION_DEP "${d}")
if(${CMAKE_DEPENDENT_OPTION_DEP})
else()
set(${option}_AVAILABLE 0)
......
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)
set(FOO "lower")
cmake_dependent_option(USE_FOO "Use Foo" ON "FOO MATCHES (UPPER|lower)" OFF)
message(STATUS "USE_FOO='${USE_FOO}'")
include(RunCMake)
run_cmake_script(Parentheses)
run_cmake_script(Regex)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment