[CMake] LINK_FLAGS works incorrectly,
Michael Wild
themiwi at gmail.com
Mon Apr 18 09:40:25 EDT 2011
On 04/18/2011 03:25 PM, Łukasz Tasz wrote:
> Hi all,
>
> I got a simple question,
>
> What is idea behind target property LINK_FLAGS?
>
> When I add linker flag e.g --no-undefined then cmake is not alligning
> it to real linker that will be used during linking.
>
> for example --no-undefined is a valid ld switch, but when I specify it
> LINK_FLAGS it will not reach linker since cmake is deciding to use g++
> and is forgeting about adding -Wl, at the begining.
>
> In my opoinion it should be in a way:
> 1. User is specyfing:
> set_property(TARGET TEST property LINK_FLAGS "--no-undefined")
> 2. cmake is coosing g++ as a linker, then variable CMAKE_SHARED_LINKING_FLAGS
> should be extended with -Wl,--noundefined
> 3. during make ld is called via g++ with passed flags --no-undefined.
>
> thanks in advance for your help
>
> Lukasz Tasz
>
>
Thing is, with that property you can pass *everything* on the link-line,
so it would be pretty bad if CMake just prefixed everything with -Wl,.
Just do it yourself. And please, put it in a conditional
block where you test for CMAKE_COMPILER_IS_GNUCXX).
Michael
More information about the CMake
mailing list