[CMake] printing CMAKE_CXX_FLAGS_* based on build type

Zdenko Podobny zdenop at gmail.com
Fri Sep 27 18:14:39 EDT 2019


Yes, build type is known (e.g   value of ${CMAKE_BUILD_TYPE}  is shown in
output).  I use command like this:
cmake .. -G Ninja  -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR%
-DCMAKE_PREFIX_PATH=%INSTALL_DIR% -DCMAKE_BUILD_TYPE=Release


Zdenko


pi 27. 9. 2019 o 23:54 fdk17 <fdk17 at ftml.net> napísal(a):

> Are you using a generator that uses CMAKE_BUILD_TYPE and has it set to a
> known value?  Build type doesn’t have to be set and multi-config generators
> don’t use it.
>
> On Fri, Sep 27, 2019, at 4:18 PM, Zdenko Podobny wrote:
>
> Hello,
>
> I try to print  CMAKE_CXX_FLAGS_DEBUG/CMAKE_CXX_FLAGS_RELEASE as one line
> statement but is does not work for me:
>
> message( STATUS "CXX compiler ${CMAKE_BUILD_TYPE} build options:
> ${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}}")
>
> Produce empy result, but
> message( STATUS "CXX compiler  Release build options:
> ${CMAKE_CXX_FLAGS_RELEASE}")
> works as expected.
> Is it possible to do it in one line or I have to use if/elseif ?
>
> Zdenko
> --
>
> 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:
> https://cmake.org/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:
> https://cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20190928/f8f3482d/attachment.html>


More information about the CMake mailing list