[CMake] add_target_properties( tgt COMPILE_FLAGS_${CONF} "abc" )
"Sören Textor [Ditec-GmbH]"
s.textor at ditec-gmbh.de
Wed Jun 26 03:07:44 EDT 2013
okay, it seems that there's a missunderstanding.
The thing I want to do is this:
add_target_properties( ${tgt} COMPILE_FLAGS_DEBUG "/GA" )
add_target_properties( ${tgt} COMPILE_FLAGS_RELEASE "/GB" )
add_target_properties( ${tgt} COMPILE_FLAGS_MYCONFIG1 "/GC" )
add_target_properties( ${tgt} COMPILE_FLAGS_MYCONFIG1 "/GD" )
like I do already:
add_target_properties( ${tgt} LINK_FLAGS_DEBUG "/Libpath:xxx1" )
add_target_properties( ${tgt} LINK_FLAGS_RELEASE "/Libpath:xxx2" )
add_target_properties( ${tgt} LINK_FLAGS_MYCONFIG1 "/Libpath:xxx3" )
add_target_properties( ${tgt} LINK_FLAGS_MYCONFIG1 "/Libpath:xxx4" )
The latter orks fine. Thus why it's not possible to obtain the same functionaltity for compile flags?
SirAnn
protective rights.
Am 26.06.2013 00:39, schrieb Leek, Jim:
> I was just messing around with this yesterday. On minGW I had to pass the link flag -static-libgcc to my binary. There were two ways to do this:
>
> 1) To add a flag to all link lines:
> Shared Libraries:
>
> SET (CMAKE_SHARED_LINKER_FLAGS "abc"
> CACHE STRING "Flags used by the linker during the creation of dll's.")
>
> module linker flags:
> SET (CMAKE_MODULE_LINKER_FLAGS "abc"
> CACHE STRING "Flags used by the linker during the creation of modules.")
>
> binary linker flags:
> SET (CMAKE_EXE_LINKER_FLAGS "abc"
> CACHE STRING "Flags used by the linker during the creation of binaries.")
>
> 2) To add a flag to just a single target:
> SET_TARGET_PROPERTIES( <target name>
> PROPERTIES
> LINK_FLAGS "abc")
>
> If just used if statement to decide if how the link flags should be set. There may be a better way to do that.
>
> To see how to do configuration based compile flags, see this page:
> http://www.cmake.org/Wiki/CMake_Useful_Variables
>
> I added a TESTING build type, and all I had to do was define these variables:
> SET(CMAKE_CXX_FLAGS_TESTING "-mfpmath=sse -msse2")
> SET(CMAKE_C_FLAGS_TESTING "-mfpmath=sse -msse2")
> SET(CMAKE_Fortran_FLAGS_TESTING "-mfpmath=sse -msse2")
>
> -----Original Message-----
> From: cmake-bounces at cmake.org [mailto:cmake-bounces at cmake.org] On Behalf Of Miller Henry
> Sent: Tuesday, June 25, 2013 8:41 AM
> To: "Sören Textor [Ditec-GmbH]"; cmake at cmake.org
> Subject: Re: [CMake] add_target_properties( tgt COMPILE_FLAGS_${CONF} "abc" )
>
> TARGET_LINK_LIBRARIES(${tgt} stdc++)
>
> Should do the trick
>
> -----Original Message-----
> From: cmake-bounces at cmake.org [mailto:cmake-bounces at cmake.org] On Behalf Of "Sören Textor [Ditec-GmbH]"
> Sent: Tuesday, June 25, 2013 10:15 AM
> To: cmake at cmake.org
> Subject: [CMake] add_target_properties( tgt COMPILE_FLAGS_${CONF} "abc" )
>
> Hello
> Is it meanwhile possible to add configuration specfic compiler flags analouge to link flags?
>
> add_target_properties( ${tgt} COMPILE_FLAGS_${CONF} "abc" )
>
> add_target_properties( ${tgt} LINK_FLAGS_${CONF} "abc" )
>
> Best regards
> SirAnn
>
>
> --
>
> 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
> --
>
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130626/b6df6315/attachment.htm>
More information about the CMake
mailing list