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

Brad King brad.king at kitware.com
Mon Jul 12 13:20:19 EDT 2010


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