Have you tried the various string commands?

https://cmake.org/cmake/help/v3.7/command/string.html

I’ve done something similar to replace default linker flags with ones of my own 
choosing. I bet you could use something like string(REGEX REPLACE …) to 
essentially remove the unwanted linker flags in each of the 5 projects that 
needs it. You might even be able to do this once, in a separate .cmake file, as 
either a function or macro, and then simply include() that .cmake file in each 
of the 5 projects for better maintenance.

 

Parag Chandra
Technical Lead, Mobile Team
Mobile: +1.919.824.1410

Ionic Security Inc.
1170 Peachtree St. NE STE 400, Atlanta, GA 30309
 

On 1/12/17, 12:49 AM, "CMake on behalf of Paul Smith" <cmake-boun...@cmake.org 
on behalf of p...@mad-scientist.net> wrote:

    I have a CMake-based build that creates about 170 binaries (most of them
    are individual unit test programs).
    
    I have set the CMAKE_EXE_LINKER_FLAGS to a set of flags I wanted on all
    the binaries.
    
    Now it turns out that I need to remove, or not set, one specific flag on
    a small number (like 5) of these binaries, but I still want it set on
    all the others.  Unfortunately for this flag there's no "turn it off"
    extra flag I can add to the end of the list of flags: I have to actually
    remove the flag itself.
    
    What's the cleanest/simplest way to accomplish this?  I don't really
    want to modify my cmake files to add an explicit set_target_property()
    to all 165 binaries that I _do_ want to have this flag set on, just so I
    can avoid calling it on the 5 binaries I don't.  I want to add something
    particular to the 5 "oddball" binaries, instead, to override these
    values.
    
    But I can't seem to come up with a way to remove a flag from a global
    list like this, just for one (or a few) targets.
    
    
    Any hints?
    -- 
    
    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