Am 19.11.19 um 12:09 schrieb Stéphane Ancelot:

Hi,

I have a particular target (using swig / jni) that must not have -O3 -NDEBUG flags from Relase build type

How can I overload this target flags ?

Since CMAKE_<lang>_FLAGS_RELEASE does not map to a user-visible target property, you cannot override it directly (anything added to the COMPILE_FLAGS property is appended to the command line and does not replace any of the compiler flags CMake sets by itself). However, you can redefine this variable before you create your special target(s), and then restore it so that other targets are not affected:

set(_CMAKE_CXX_FLAGS_RELEASE_SAVE ${CMAKE_CXX_FLAGS_RELEASE})
set(CMAKE_CXX_FLAGS_RELEASE)
< add your target(s) here >
set(CMAKE_CXX_FLAGS_RELEASE ${_CMAKE_CXX_FLAGS_RELEASE_SAVE})

This assumes your target is C++; if it is C, simply replace the _CXX_ with _C_.

--

*Dr. Eric Dönges*
Senior Software Engineer

MVTec Software GmbH | Arnulfstr. 205 | 80634 Munich | Germany
doen...@mvtec.com <mailto:musterm...@mvtec.com> | Tel: +49 89 457 695-0 | www.mvtec.com <http://www.mvtec.com>

Find our privacy policy here <https://www.mvtec.com/imprint>.

Sign up <https://www.mvtec.com/newsletter> for our MVTec Newsletter!

Geschäftsführer: Dr. Wolfgang Eckstein, Dr. Olaf Munkelt
Amtsgericht München HRB 114695

MVTec Software GmbH Logo
-- 

Powered by kitware.com/cmake

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

Visit other Kitware open-source projects at https://www.kitware.com/platforms

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake

This mailing list is deprecated in favor of https://discourse.cmake.org

Reply via email to