[CMake] Release flags on one target in debug build type
Michael Ellery
mellery451 at gmail.com
Fri May 5 16:22:11 EDT 2017
> On May 5, 2017, at 11:45 AM, Konstantin Tokarev <annulen at yandex.ru> wrote:
>
> Hello,
>
> Is there any clear way to build specific target in "Debug" mode with flags that it would have in "Release"?
>
> In particular, build this specific target without effect of CMAKE_CXX_FLAGS_DEBUG and CMAKE_C_FLAGS_DEBUG, while preserving flags added by target_compile_options
>
> --
> Regards,
> Konstantin
> --
>
> 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
Does RelWithDebInfo do what you want? I have in the past taken one of the “alternative targets” (RelWithDebInfo or MinSIzeRel) and adjusted the flags for that target until it suited my specific needs, but I don’t necessarily claim that is the right way to go in all cases. Also be aware that the default optimization level can differ slightly with each of these build types. In the end, it’s probably best to survey the current settings for each build type and see if one is close to what you want.
-Mike
More information about the CMake
mailing list