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

J Decker d3ck0r at gmail.com
Thu Aug 19 03:03:24 EDT 2010


Two properties
  DEFINE_SYMBOL - defines a one-shot define that get's -D appropriately
  COMIPLE_FLAGS - add whatever other flags you want - use quotes
around the value




SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES

                  DEFINE_SYMBOL <some single defined value># optional
- useful for like ${PROJECT_NAME}_SOURCE to indicate this is built as
part of the library

                  COMPILE_FLAGS  "-DTARGET_LABEL=${PROJECT_NAME}
${ExtraFlags} -DTARGETNAME=\"\\\"${CMAKE_SHARED_LIBRARY_PREFIX}${PROJECT_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}\\\"\"
${ExtraRenderFlags}"
)


On Wed, Aug 18, 2010 at 1:47 PM, Brian Davis <bitminer at gmail.com> wrote:
> 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?
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>


More information about the CMake mailing list