Hi Decker,

On Tuesday, May 26, 2015 11:22 AM, CMake wrote:
> SET_TARGET_PROPERTIES( <target> PROPERTIES
>                   COMPILE_FLAGS  "${ExtraFlags}"
>                   COMPILE_DEFINITIONS
> "SIMPLE_FLAG;DEFINED_SYMBOL=xxxx;DEFINED_STRING=\"string value\""
>  )

I'm not sure if this was meant as a solution, but I doubt the above works; 
these simply *add* to the compile flags, they don't allow for completely 
replacing/resetting them...

Thanks,
-David

> On Tue, May 26, 2015 at 11:07 AM, Murali Paluru <[email protected]>
> wrote:
> 
> 
>       Hi David,
> 
>       The project that I am working on has similar needs of having 
> different flags for each target. I have placed the different targets 
> in different sub- folders and set the CMAKE_*_FLAGS. This approach 
> seems to work fine as you mentioned.
> 
>       From my understanding, a new add_subdirectory creates a new scope of 
> variables.
> 
>       I feel that having different targets in different directories is a 
> good logical separation. So if that's working for you, why not use it?
> I am not sure if there is a better way, but I hope someone will comment.
> 
>       Regards,
>       Murali.
> 
>       On Mon, May 25, 2015 at 1:04 PM, David Hauck <[email protected]>
> wrote:
> 
> 
>               Hi,
> 
>               I've been searching for a definitive discussion of this but 
> haven't 
> been successful finding it. I have a (Unix Makefile) CMakeLists.txt 
> project sub-directory that defines several (3) targets (for executable 
> and shared targets). I'm trying to reset/redefine the CMAKE_C??_FLAGS 
> (specifically CMAKE_C_FLAGS) property on one of the targets via the 
> following statement in the CMakeLists.txt file:
> 
>               set_property(TARGET <target_name> PROPERTY CMAKE_C_FLAGS "-Wall
> -shared")             set_property(TARGET <target_name> PROPERTY
> CMAKE_C_FLAGS_DEBUG "-g")             set_property(TARGET <target_name> 
> PROPERTY
> CMAKE_C_FLAGS_RELEASE "-O3")
> 
>               However, this isn't working and the resulting target 
> compilation is 
> using the directory's value for these properties. Other redefinitions 
> of per-target properties (e.g., INCLUDE_DIRECTORIES) do seem to take 
> so I'm wondering if certain properties are per-directory only and 
> aren't meaningful with the "set_property(TARGET ...)"
> construct?
> 
>               If I move the target to its own sub-directory and use the 
> following 
> CMakeLists.txt commands instead the compile flags are properly (re)set:
> 
>               SET (CMAKE_C_FLAGS "-Wall -shared")
>               SET (CMAKE_C_FLAGS_DEBUG "-g")
>               SET (CMAKE_C_FLAGS_RELEASE "-O3")
> 
>               Oddly the aforementioned "set_property(TARGET..."
> constructs in place of the above "SET(CMAKE..." constructs also fail 
> to reset the flags in this new directory so this doesn't seem related 
> to the sub- directory CMakeLists.txt file when multiple targets are defined.
> 
>               I must have missed something obvious related to this in the 
> documentation and/or the mailing list/Google. Any ideas?
> 
>               Thanks,
>               -David
> 
>               --
> 
>               Powered by www.kitware.com
> 
>               Please keep messages on-topic and check the CMake FAQ
> at: http://www.cmake.org/Wiki/CMake_FAQ
> 
>               Kitware offers various services to support the CMake community. 
> For 
> more information on each offering, please visit:
> 
>               CMake Support: http://cmake.org/cmake/help/support.html         
>         CMake
> Consulting: http://cmake.org/cmake/help/consulting.html               CMake 
> Training
> Courses: http://cmake.org/cmake/help/training.html
> 
>               Visit other Kitware open-source projects at 
> http://www.kitware.com/opensource/opensource.html
> 
>               Follow this link to subscribe/unsubscribe:
>               http://public.kitware.com/mailman/listinfo/cmake
> 
> 
> 
> 
>       --
> 
>       Powered by www.kitware.com
> 
>       Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
> 
>       Kitware offers various services to support the CMake community.
> For more information on each offering, please visit:
> 
>       CMake Support: http://cmake.org/cmake/help/support.html         CMake
> Consulting: http://cmake.org/cmake/help/consulting.html       CMake Training
> Courses: http://cmake.org/cmake/help/training.html
> 
>       Visit other Kitware open-source projects at 
> http://www.kitware.com/opensource/opensource.html
> 
>       Follow this link to subscribe/unsubscribe:
>       http://public.kitware.com/mailman/listinfo/cmake
> 
>
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to