summaryrefslogtreecommitdiff
path: root/Tests/RunCMake/option/CMP0077-NEW.cmake
blob: d4c518b1e2c4f061be6fc69d1c45e2220d7504b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14

#Verify that option DOESN'T overwrite existing normal variable when the policy
#is set to NEW
cmake_policy(SET CMP0077 NEW)
set(OPT_LOCAL_VAR FALSE)
option(OPT_LOCAL_VAR "TEST_VAR" ON)
if(OPT_LOCAL_VAR)
  message(FATAL_ERROR "option failed to overwrite existing normal variable")
endif()

get_property(_exists_in_cache CACHE OPT_LOCAL_VAR PROPERTY VALUE SET)
if(_exists_in_cache)
  message(FATAL_ERROR "value should not exist in cache as it was already a local variable")
endif()