MantisBT - CMake
View Issue Details
0015338CMakeCMakepublic2015-01-06 10:232015-06-01 08:38
Matthias Maier 
Stephen Kelly 
normalminoralways
closedfixed 
CMake 3.1 
CMake 3.1.1CMake 3.1.1 
0015338: Querying for (deprecated) LOCATION property prevents expansion of TARGET_OBJECTS generator expression
Consider the following minimal project:

foo.cc
    int main () {}

CMakeLists.txt$<TARGET_OBJECTS:foo>
    add_library(foo OBJECT foo.cc)
    add_executable(bar $<TARGET_OBJECTS:foo>)
    get_target_property(location bar LOCATION)

Starting with CMake 3.1 above example fails with an error message ("CMake Error: CMake can not determine linker language for target: bar") because the generator expression "$<TARGET_OBJECTS:foo>" does not get expanded and thus the final link line is empty.

Not querying for the LOCATION property fixes this.
This bug is not present in CMake 3.0.* or 2.8.*.
No tags attached.
Issue History
2015-01-06 10:23Matthias MaierNew Issue
2015-01-08 12:42Brad KingAssigned To => Stephen Kelly
2015-01-08 12:42Brad KingStatusnew => assigned
2015-01-11 13:17Stephen KellyNote Added: 0037663
2015-01-12 20:09Stephen KellyNote Added: 0037674
2015-01-12 20:09Stephen KellyStatusassigned => resolved
2015-01-12 20:09Stephen KellyFixed in Version => CMake 3.1.1
2015-01-12 20:09Stephen KellyResolutionopen => fixed
2015-01-13 16:07Brad KingNote Added: 0037679
2015-01-13 16:07Brad KingTarget Version => CMake 3.1.1
2015-06-01 08:38Robert MaynardNote Added: 0038836
2015-06-01 08:38Robert MaynardStatusresolved => closed

Notes
(0037663)
Stephen Kelly   
2015-01-11 13:17   
I bisected this to commit v3.1.0-rc1~297^2~5 (cmTarget: Drop 'head' argument from GetSourceFiles, 2014-07-10), but I don't have a fix yet.

The relevant difference before and after that patch is the value of the this->LinkImplementationLanguageIsContextDependent in cmTarget::GetSourceFiles.
(0037674)
Stephen Kelly   
2015-01-12 20:09   
Fixed with

 http://www.cmake.org/gitweb?p=cmake.git;a=commitdiff;h=990175e4 [^]
 cmTarget: Compute link language of OBJECT_TARGETS with CMP0026 OLD (0015338)
(0037679)
Brad King   
2015-01-13 16:07   
Revised commit:

 cmTarget: Compute link language of TARGET_OBJECTS with CMP0026 OLD
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=23f3798c [^]
(0038836)
Robert Maynard   
2015-06-01 08:38   
Closing resolved issues that have not been updated in more than 4 months.