diff options
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CMakeOnly/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Tests/CMakeOnly/option/CMakeLists.txt | 16 |
2 files changed, 17 insertions, 0 deletions
diff --git a/Tests/CMakeOnly/CMakeLists.txt b/Tests/CMakeOnly/CMakeLists.txt index 204d54c..8a3a83b 100644 --- a/Tests/CMakeOnly/CMakeLists.txt +++ b/Tests/CMakeOnly/CMakeLists.txt @@ -49,6 +49,7 @@ add_CMakeOnly_test(TargetScope) add_CMakeOnly_test(find_library) add_CMakeOnly_test(find_path) +add_CMakeOnly_test(option) add_test(CMakeOnly.ProjectInclude ${CMAKE_CMAKE_COMMAND} -DTEST=ProjectInclude diff --git a/Tests/CMakeOnly/option/CMakeLists.txt b/Tests/CMakeOnly/option/CMakeLists.txt new file mode 100644 index 0000000..d040fb5 --- /dev/null +++ b/Tests/CMakeOnly/option/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required (VERSION 2.8) +project(OptionTest NONE) + +#Verify that normal variable take precedence over cache variables +option(OPT_LOCAL_VAR1 "TEST_VAR" ON) +set(OPT_LOCAL_VAR1 FALSE) +if(OPT_LOCAL_VAR1) + message(FATAL_ERROR "local variable didn't take precedence over cache variable") +endif() + +#Verify that option overwrites existing normal variable +set(OPT_LOCAL_VAR2 FALSE) +option(OPT_LOCAL_VAR2 "TEST_VAR" ON) +if(NOT OPT_LOCAL_VAR2) + message(FATAL_ERROR "option failed to overwrite existing normal variable") +endif() |