[cmake-developers] [CMake 0015478]: As of CMake 3.1 Properties cannot be set to ""

Mantis Bug Tracker mantis at public.kitware.com
Thu Mar 26 15:25:20 EDT 2015


The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=15478 
====================================================================== 
Reported By:                Walter Gray
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15478
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2015-03-26 15:25 EDT
Last Modified:              2015-03-26 15:25 EDT
====================================================================== 
Summary:                    As of CMake 3.1 Properties cannot be set to ""
Description: 
As of CMake 3.0.2, it was completely legal to set a target property to "". This
was in fact a very helpful feature for me in some cases since it meant that if I
knew I'd set a property to a list (even an empty one), when I read it back later
and passed it into a foreach I didn't have to also use an if to check if it
existed. This functionality was broken in 3.1, and there is neither a policy
setting about it, nor any documentation I can find that indicates this was an
intended change.

Steps to Reproduce: 
Run the following cmake script. In CMake <= 3.0.2, prop1 will be an empty
string.  In CMake >= 3.1, it will be prop1-NOTFOUND

cmake_minimum_required(VERSION 3.0)
cmake_policy(VERSION 3.0.2)

project(cmaketestproject)

add_executable(testexe test.cpp)

set(emptylist "")

set_target_properties(testexe PROPERTIES INTERFACE_PROP_1 "${emptylist}"
INTERFACE_PROP_2 "thing")
get_target_property(prop1 testexe INTERFACE_PROP_1)
get_target_property(prop2 testexe INTERFACE_PROP_2)
get_target_property(prop3 testexe INTERFACE_PROP_3)

message(prop1=${prop1})
message(prop2=${prop2})
message(prop3=${prop3})
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2015-03-26 15:25 Walter Gray    New Issue                                    
======================================================================



More information about the cmake-developers mailing list