Re: [CMake] LINK_FLAGS directory property

2016-05-02 Thread Matthew Keeler
I am doing that for some things but it gets quite cumbersome as I have to 
override those for several different configurations. I guess that is the only 
way to do it currently. 

-- 
Matt Keeler


On May 2, 2016 at 03:48:59, Attila Krasznahorkay 
(attila.krasznahor...@gmail.com) wrote:

Hi Matt,  

Have you tried using the  

CMAKE_EXE_LINKER_FLAGS  
CMAKE_SHARED_LINKER_FLAGS  
CMAKE_MODULE_LINKER_FLAGS  

cache variables? These actually set these flags globally, and not just for one 
directory, but on the directory level they are easy to override. You can just 
do something like this in a subdirectory:  

string( REPLACE "-Wl,--as-needed" "" CMAKE_SHARED_LINKER_FLAGS 
"${CMAKE_SHARED_LINKER_FLAGS}" )  

Cheers,  
Attila  

> On 27 Apr 2016, at 17:57, Matthew Keeler  wrote:  
>  
> Is there an equivalent directory property for the target level LINK_FLAGS 
> property. I can’t see anything according to the documentation but was hoping 
> there was an oversight and something actually existed.  
>  
> What I am trying to do is pass extra flags to the linker for every target in 
> my project and I didn’t want to have to set it per target. I tried using the 
> link_libraries command but the flags I am adding are msvc specific and start 
> with ‘/‘ and cmake seems to be turning these into ‘\’ when its passed to the 
> linker. Then the linker thinks its trying to link in another file and 
> everything blows up.  
>  
> Also a secondary question is what does the INTERPROCEDURAL_OPTIMIZATIONS 
> property at the directory level do. I assume on Windows it passes /GL to the 
> compiler but will this also add /LCTG to the linker flags and prevent 
> incremental linking. If I turn this property on will it also do it for debug 
> configurations or just optimized configurations?  
>  
> --  
> Matt Keeler  
>  
> --  
>  
> 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

Re: [CMake] LINK_FLAGS directory property

2016-05-02 Thread Attila Krasznahorkay
Hi Matt,

Have you tried using the

CMAKE_EXE_LINKER_FLAGS
CMAKE_SHARED_LINKER_FLAGS
CMAKE_MODULE_LINKER_FLAGS

cache variables? These actually set these flags globally, and not just for one 
directory, but on the directory level they are easy to override. You can just 
do something like this in a subdirectory:

string( REPLACE "-Wl,--as-needed" "" CMAKE_SHARED_LINKER_FLAGS 
"${CMAKE_SHARED_LINKER_FLAGS}" )

Cheers,
Attila

> On 27 Apr 2016, at 17:57, Matthew Keeler  wrote:
> 
> Is there an equivalent directory property for the target level LINK_FLAGS 
> property. I can’t see anything according to the documentation but was hoping 
> there was an oversight and something actually existed.
> 
> What I am trying to do is pass extra flags to the linker for every target in 
> my project and I didn’t want to have to set it per target. I tried using the 
> link_libraries command but the flags I am adding are msvc specific and start 
> with ‘/‘ and cmake seems to be turning these into ‘\’ when its passed to the 
> linker. Then the linker thinks its trying to link in another file and 
> everything blows up.
> 
> Also a secondary question is what does the INTERPROCEDURAL_OPTIMIZATIONS 
> property at the directory level do. I assume on Windows it passes /GL to the 
> compiler but will this also add /LCTG to the linker flags and prevent 
> incremental linking. If I turn this property on will it also do it for debug 
> configurations or just optimized configurations?
> 
> -- 
> Matt Keeler
> 
> -- 
> 
> 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

[CMake] LINK_FLAGS directory property

2016-04-27 Thread Matthew Keeler
Is there an equivalent directory property for the target level LINK_FLAGS 
property. I can’t see anything according to the documentation but was hoping 
there was an oversight and something actually existed.

What I am trying to do is pass extra flags to the linker for every target in my 
project and I didn’t want to have to set it per target. I tried using the 
link_libraries command but the flags I am adding are msvc specific and start 
with ‘/‘ and cmake seems to be turning these into ‘\’ when its passed to the 
linker. Then the linker thinks its trying to link in another file and 
everything blows up.

Also a secondary question is what does the INTERPROCEDURAL_OPTIMIZATIONS 
property at the directory level do. I assume on Windows it passes /GL to the 
compiler but will this also add /LCTG to the linker flags and prevent 
incremental linking. If I turn this property on will it also do it for debug 
configurations or just optimized configurations?

-- 
Matt Keeler

-- 

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