View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0013171CMakeCMakepublic2012-04-26 14:152012-09-03 16:02
Reporterbungeman 
Assigned ToBrad King 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionnot fixable 
PlatformLinuxOSUbuntuOS Version12.04
Product VersionCMake 2.8.8 
Target VersionFixed in Version 
Summary0013171: Default target LINKER_LANGUAGE un-gettable.
DescriptionThis was first reported on the mailing list here

http://www.cmake.org/pipermail/cmake/2009-May/029570.html [^]

but apparently it never made it to the bug tracker as was suggested in the reply. However, I recently ran into this issue. The basic problem is that the defaults of many properties cannot be retrieved. CMake obviously knows what the values are, but will not expose them.
Steps To ReproducePut something like the following into a CMakeLists.txt

add_executable(target
  target.c
)
get_target_property(TARGET_LINKER_LANGUAGE target LINKER_LANGUAGE)
message("TARGET_LINKER_LANGUAGE = ${TARGET_LINKER_LANGUAGE}")
if(${TARGET_LINKER_LANGUAGE} EQUAL "CXX")
set_property(TARGET target APPEND PROPERTIES COMPILE_FLAGS "-fno-rtti -fno-threadsafe-statics -fvisibility-inlines-hidden -Wno-deprecated ")
endif()
unset(TARGET_LINKER_LANGUAGE)

The output looks like

TARGET_LINKER_LANGUAGE = TARGET_LINKER_LANGUAGE-NOTFOUND

and of course the 'if' will never evaluate to true.
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0029350)
Brad King (manager)
2012-04-26 14:21

The properties do not document that they can be retrieved. They document that the project can SET them explicitly. Most of the time the default is NOT known while the CMakeLists.txt files are being processed. The value is not computed until the *generate* step. In this case especially there is not sufficient information available until the generate step to compute the final default value.

Your project will have to keep track by itself whether it adds C++ sources or not. Alternatively it can just put the flags in CMAKE_CXX_FLAGS and they will be used for compiling C++ sources but not C. Ask for more detail on the mailing list if you need further help.
(0030897)
David Cole (manager)
2012-09-03 16:02

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

 Issue History
Date Modified Username Field Change
2012-04-26 14:15 bungeman New Issue
2012-04-26 14:21 Brad King Note Added: 0029350
2012-04-26 14:21 Brad King Status new => resolved
2012-04-26 14:21 Brad King Resolution open => not fixable
2012-04-26 14:21 Brad King Assigned To => Brad King
2012-09-03 16:02 David Cole Note Added: 0030897
2012-09-03 16:02 David Cole Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team