[CMake] printing CMAKE_CXX_FLAGS_* based on build type

fdk17 fdk17 at ftml.net
Fri Sep 27 17:54:29 EDT 2019


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
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20190927/e67d386c/attachment-0001.html>


More information about the CMake mailing list