View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015478CMakeCMakepublic2015-03-26 15:252015-11-02 09:13
ReporterWalter Gray 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionduplicate 
PlatformAllOSOS Version
Product VersionCMake 3.2.1 
Target VersionFixed in Version 
Summary0015478: As of CMake 3.1 Properties cannot be set to ""
DescriptionAs 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 ReproduceRun 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})
TagsNo tags attached.
Attached Files

 Relationships
duplicate of 0015333closedBen Boeckel Behaviour change with 3.1 - target properies set to empty string returned as -NOTFOUND 

  Notes
(0038334)
Walter Gray (reporter)
2015-03-26 15:29
edited on: 2015-03-26 15:30

When I say "", I mean an empty string, not the literal ""

(0038335)
Brad King (manager)
2015-03-26 15:37

This was broken in 3.1.0 only. It was fixed in 3.1.1 and later.

From your example:

cmake 3.0.0:

 prop1=
 prop2=thing
 prop3=prop3-NOTFOUND

cmake 3.1.0:

 prop1=prop1-NOTFOUND
 prop2=thing
 prop3=prop3-NOTFOUND

cmake 3.1.3:

 prop1=
 prop2=thing
 prop3=prop3-NOTFOUND

cmake 3.2.1:

 prop1=
 prop2=thing
 prop3=prop3-NOTFOUND
(0038336)
Brad King (manager)
2015-03-26 15:40

You could also use the get_property command instead:

 http://www.cmake.org/cmake/help/v3.2/command/get_property.html [^]

It returns the empty string for properties that are set to "" or not set at all, and has separate options to query whether the property is SET.
(0038337)
Brad King (manager)
2015-03-26 15:41

See 0015333:0037662 for information about what was fixed in 3.1.1.
(0039747)
Robert Maynard (manager)
2015-11-02 09:13

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2015-03-26 15:25 Walter Gray New Issue
2015-03-26 15:29 Walter Gray Note Added: 0038334
2015-03-26 15:30 Walter Gray Note Edited: 0038334
2015-03-26 15:36 Brad King Relationship added duplicate of 0015333
2015-03-26 15:37 Brad King Note Added: 0038335
2015-03-26 15:40 Brad King Note Added: 0038336
2015-03-26 15:41 Brad King Status new => resolved
2015-03-26 15:41 Brad King Resolution open => duplicate
2015-03-26 15:41 Brad King Note Added: 0038337
2015-11-02 09:13 Robert Maynard Note Added: 0039747
2015-11-02 09:13 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team