[CMake] Setting CMAKE_CXX_FLAGS..., CMAKE_C_FLAGS... and CMAKE_C_STANDARD_LIBRARIES_INIT and friends on a per target basis

Verweij, Arjen VerweijA at tass-safe.com
Thu Aug 19 02:56:50 EDT 2010


Hi Brian,

We override the standard CMAKE_<LANG>_FLAGS (C CXX Fortran) and use it as a baseline. Then, for individual source files it is possible to override them in a separate file using:

set_source_files_properties(${CMAKE_BINARY_DIR}/path/to/file.f PROPERTIES GENERATED TRUE COMPILE_FLAGS "${FFLAG_OPT}")

These override files are included OPTIONALly and the directives executed when applicable.

Regards,
Arjen

From: cmake-bounces at cmake.org [mailto:cmake-bounces at cmake.org] On Behalf Of Brian Davis
Sent: woensdag 18 augustus 2010 22:48
To: cmake Mailing List
Subject: [CMake] Setting CMAKE_CXX_FLAGS..., CMAKE_C_FLAGS... and CMAKE_C_STANDARD_LIBRARIES_INIT and friends on a per target basis

CMAKE_CXX_FLAGS..., CMAKE_C_FLAGS... and CMAKE_C_STANDARD_LIBRARIES_INIT and friends are seemingly global variables.  Is there a way to override (all of) these on a per target basis?  A method which is not tied to the directory (properties). One that does not simply append such as COMPILE_FLAGS, but blasts away and makes it what I specify? Basically all the goop in Windows-icl.cmake, Windows-cl.cmake, etc.  Possibly involving set_target_properties?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100819/21ca6d0d/attachment.htm>


More information about the CMake mailing list