View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0016029CMakeCMakepublic2016-03-22 10:292016-06-10 14:21
Reporterstw_sesa 
Assigned Togeoffviola 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
Platformx86_64OSWindowsOS Version7
Product VersionCMake 3.5 
Target VersionCMake 3.6Fixed in VersionCMake 3.6 
Summary0016029: GHS Generator does not support LINK_FLAGS property
DescriptionThe GHS Generator ignores the LINK_FLAGS property of targets.

It can be set with:
set_target_properties(<target> PROPERTIES LINK_FLAGS <link_flags>)


I did not test it, but other target properties are probably ignored as well. See https://cmake.org/cmake/help/v3.5/manual/cmake-properties.7.html#target-properties [^] for a complete list (for all Generators).
Steps To Reproduceadd_executable(MyExampleApp main.cpp)
set_target_properties(MyExampleApp PROPERTIES LINK_FLAGS "--myflag")

The option "--myflag" is ignored and not added in the project file (MyExampleApp.gpj).
Additional InformationI've attached a patch that implements the functionality, but I'm sure it needs some generalization and optimization to integrate it.
TagsNo tags attached.
Attached Filespatch file icon 0001-LINK_FLAGS-property-implementation.patch [^] (1,017 bytes) 2016-03-22 10:29 [Show Content]
zip file icon LinkFlags.zip [^] (447 bytes) 2016-03-26 19:38
patch file icon 0001-Grenn-Hills-MULTI-linker-flags-implementation.patch [^] (1,026 bytes) 2016-03-26 19:39 [Show Content]
zip file icon LinkFlags2.zip [^] (704 bytes) 2016-03-26 23:31
patch file icon 0001-GHS-MULTI-lflags-and-dirs-for-non-target-groups.patch [^] (5,284 bytes) 2016-03-26 23:32 [Show Content]

 Relationships

  Notes
(0040743)
Brad King (manager)
2016-03-22 10:49

The other generators have several places that they use to collect link flags. See cmLocalGenerator::GetTargetFlags and its call sites. Also see cmMakefileExecutableTargetGenerator::WriteExecutableRule and cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules.
(0040749)
stw_sesa (reporter)
2016-03-22 12:40

(Just saw I accidentally included an additional quotation mark in the patch, which shouldn't be there; remove: << "\"")
(0040760)
geoffviola (developer)
2016-03-26 19:42

I tested out the above code with a small Green Hills MULTI CMake project. See LinkFlags.zip. The patch looked close. I adjusted the whitespace, removed the extra quote, and added a const to the pointer. The new patch is 0001-Grenn-Hills-MULTI-linker-flags-implementation.patch.
(0040761)
geoffviola (developer)
2016-03-26 23:44

I went through the code that Brad mentioned. The GetTargetFlags method seemed useful. It has the advantage of interpreting LINK_FLAGS_<CMAKE_BUILD_TYPE>. Also, it makes adding link directories easy to add.

Unfortunately, GetTargetFlags had some limitations. Unlike link directories, There are no extensions for prepending and appending to generated library names. So the previous implementation of linking to libraries was left. Also, since the Green Hills unique target groups concept is considered a cmState::EXECUTABLE, it would warn the user that there is no linker language, because the only files that it would see are .bsp and .int files. So the target groups do not get link directories or link flags.

LinkFlags2.zip was attached to show a build setup that exercises LINK_FLAGS, link_directories, and LINK_FLAGS_RELEASE. The patch is named 0001-GHS-MULTI-lflags-and-dirs-for-non-target-groups.patch.
(0040762)
Brad King (manager)
2016-03-28 10:36

Thanks Geoff. Once the conclusion here is that one of the patches is ready for integration please bring it to the dev list as usual.
(0040763)
Brad King (manager)
2016-03-28 13:27

http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/16121 [^]
(0040767)
Brad King (manager)
2016-03-29 09:21

Patch applied (split in two pieces):

GHS: Factor out compiler information shared among languages
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=230d50ed [^]

GHS: Implement link flags and dirs for non-target groups
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=36ad8dd4 [^]
(0041211)
Kitware Robot (administrator)
2016-06-10 14:21

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2016-03-22 10:29 stw_sesa New Issue
2016-03-22 10:29 stw_sesa File Added: 0001-LINK_FLAGS-property-implementation.patch
2016-03-22 10:34 Brad King Assigned To => geoffviola
2016-03-22 10:34 Brad King Status new => assigned
2016-03-22 10:49 Brad King Note Added: 0040743
2016-03-22 12:40 stw_sesa Note Added: 0040749
2016-03-26 19:38 geoffviola File Added: LinkFlags.zip
2016-03-26 19:39 geoffviola File Added: 0001-Grenn-Hills-MULTI-linker-flags-implementation.patch
2016-03-26 19:42 geoffviola Note Added: 0040760
2016-03-26 23:31 geoffviola File Added: LinkFlags2.zip
2016-03-26 23:32 geoffviola File Added: 0001-GHS-MULTI-lflags-and-dirs-for-non-target-groups.patch
2016-03-26 23:44 geoffviola Note Added: 0040761
2016-03-28 10:36 Brad King Note Added: 0040762
2016-03-28 13:27 Brad King Note Added: 0040763
2016-03-29 09:21 Brad King Note Added: 0040767
2016-03-29 09:22 Brad King Status assigned => resolved
2016-03-29 09:22 Brad King Resolution open => fixed
2016-03-29 09:22 Brad King Fixed in Version => CMake 3.6
2016-03-29 09:22 Brad King Target Version => CMake 3.6
2016-06-10 14:21 Kitware Robot Note Added: 0041211
2016-06-10 14:21 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team