[CMake] Global linker/library flag specification

Nicholas Yue yue.nicholas at gmail.com
Fri Jul 18 23:23:16 EDT 2008


Hi,

  There is a ADD_DEFINITIONS tag to add compiler flags globally.

  Is there an equivalent for linker flags (i.e. not target specific
but all target)

  I have the following scenario.

  I am trying to write a custom configuration file so that all target
build in "Debug" build type will automatically link to the gcov
library and also gets the "-pg" linker flag.

  I am trying to make it easier for my developers to compile their
projects with coverage/profiling information and also for valgrind to
get better information.

  I want to reduce the requirements on the developer part to specify
the right flags combination.

  My current attempt at a workaround is to specify the flags as e.g.

  cmake -DCMAKE_EXE_LINK_FLAGS

  but that is only useful for the "-pg", I still need a way to specify
the "-lgcov" globally.

  specifying it as an option to cmake is not ideal as I want to move
it outside of the command line and into an in-house custom
configuration which all developer use thus reducing their workload.

Regards
-- 
Nicholas Yue BSc (Hons) MACM
Graphics - RenderMan, RIB, Visualization, OpenGL, netCDF
Custom Dev - C++ porting, OSX, Linux, Windows


More information about the CMake mailing list