cmake/Tests/RunCMake/option/CMP0077-NEW.cmake

15 lines
481 B
CMake
Raw Normal View History

2018-10-28 12:09:07 +01:00
#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()