[CMake] CMAKE_<LANG>_FLAGS added to link rule

Verweij, Arjen VerweijA at tass-safe.com
Mon Jul 12 13:25:12 EDT 2010


Brad,

Can you comment on what other stuff ends up in <FLAGS>? If it's just CMAKE_<LANG>_FLAGS, I guess redefining CMAKE_<LANG>_LINK_EXECUTABLE would be a viable workaround.

Thanks,
Arjen

>-----Original Message-----
>From: Brad King [mailto:brad.king at kitware.com]
>Sent: maandag 12 juli 2010 19:20
>To: Verweij, Arjen
>Cc: cmake at cmake.org
>Subject: Re: [CMake] CMAKE_<LANG>_FLAGS added to link rule
>
>On 07/12/2010 01:12 PM, Verweij, Arjen wrote:
>> As a follow-up: redefining CMAKE_Fortran_LINK_EXECUTABLE to not
>include
>> <FLAGS> gets rid of the CMAKE_Fortran_FLAGS.. but perhaps other
>(useful)
>> stuff as well? As a sidetrack I'm starting to wonder what the purpose
>of
>> CMAKE_<LANG>_FLAGS is. The book lists it as cmake's counterpart of the
>> environment variable, e.g. CMAKE_CXX_FLAGS and CXXFLAGS from the
>shell,
>> which means it doesn't make sense to include it when linking. Am I
>> overlooking something here J
>
>AFAIK no one designed it this way, it "just happened" over time during
>development.  My guess is that people wanted compile flags like "-m64"
>to be passed when the compiler is used as a front-end to the linker.
>Since it's been in the default rules for years we cannot change it
>without breaking compatibility.
>
>All of this was developed before CMake supported Fortran.  I've seen
>very few C and C++ compilers that do not accept/ignore all of their
>compiler flags even when used as a linking front-end.  That's likely
>why this wasn't caught at the beginning.
>
>-Brad


More information about the CMake mailing list