From 7a6c8e4a30664b6310749de62a6dadbd6bce9da8 Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Thu, 24 Jun 2021 10:38:45 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA?= =?UTF-8?q?=D0=B0=20=D1=84=D0=BB=D0=B0=D0=B3=D0=BE=D0=B2=20=D1=82=D0=BE?= =?UTF-8?q?=D0=BB=D1=8C=D0=BA=D0=BE=20=D0=B2=20=D0=BE=D1=82=D0=BB=D0=B0?= =?UTF-8?q?=D0=B4=D0=BE=D1=87=D0=BD=D0=BE=D0=BC=20=D1=80=D0=B5=D0=B6=D0=B8?= =?UTF-8?q?=D0=BC=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMLibCompilerFlags.cmake | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/CMLibCompilerFlags.cmake b/CMLibCompilerFlags.cmake index 9023444..d500308 100644 --- a/CMLibCompilerFlags.cmake +++ b/CMLibCompilerFlags.cmake @@ -18,18 +18,20 @@ macro(CHECK_ENABLE_CXX_FLAG flag) endmacro() macro(CHECK_ENABLE_DEBUG_CXX_FLAG flag) - set(CMAKE_REQUIRED_QUIET TRUE) - check_cxx_compiler_flag("${flag}" CHECK_CXX_FLAG_DEBUG) - unset(CMAKE_REQUIRED_QUIET) + if(CMAKE_BUILD_TYPE STREQUAL "Debug") + set(CMAKE_REQUIRED_QUIET TRUE) + check_cxx_compiler_flag("${flag}" CHECK_CXX_FLAG_DEBUG) + unset(CMAKE_REQUIRED_QUIET) - if(CHECK_CXX_FLAG_DEBUG) - message(STATUS "'${flag}': debug flag is supported.") - string(CONCAT _CMLIB_DETECTED_CXX_FLAGS_DEBUG "${_CMLIB_DETECTED_CXX_FLAGS_DEBUG} ${flag}") - else() - message(STATUS "'${flag}': debug flag is NOT supported.") + if(CHECK_CXX_FLAG_DEBUG) + message(STATUS "'${flag}': debug flag is supported.") + string(CONCAT _CMLIB_DETECTED_CXX_FLAGS_DEBUG "${_CMLIB_DETECTED_CXX_FLAGS_DEBUG} ${flag}") + else() + message(STATUS "'${flag}': debug flag is NOT supported.") + endif() + # NOTE: check_cxx_compiler stores variables in the cache. + unset(CHECK_CXX_FLAG_DEBUG CACHE) endif() - # NOTE: check_cxx_compiler stores variables in the cache. - unset(CHECK_CXX_FLAG_DEBUG CACHE) endmacro() function(cmlib_set_cxx_standard version)