From 2b3b6a64e5dc8bf77b43eb6dfa10f8dd160866a9 Mon Sep 17 00:00:00 2001 From: Andrii Verbytskyi Date: Thu, 18 Aug 2022 17:40:47 +0200 Subject: [PATCH] Cleanup --- CMakeLists.txt | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 78d6b91..010d4da 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,29 +22,31 @@ set(CMAKE_CXX_EXTENSIONS OFF) set(VERSION 2.0.9) include(CheckCXXCompilerFlag) if (${CMAKE_CXX_COMPILER_ID} MATCHES "GNU") - set(CMAKE_CXX_FLAGS_TO_CHECK "-Wall -Wextra -march=nocona -mtune=haswell -fvisibility-inlines-hidden -fmessage-length=0 -ftree-vectorize -fstack-protector-strong -O2 -pipe -fext-numeric-literals") - set(CMAKE_CXX_FLAGS_DEBUG_TO_CHECK "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address ${CMAKE_CXX_FLAGS_TO_CHECK}) - set(CMAKE_EXE_LINKER_FLAGS_DEBUG "-fsanitize=address" CACHE STRING "debug linker flags" FORCE) + set(CXX_FLAGS_TO_CHECK "-Wall -Wextra -march=nocona -mtune=haswell -fvisibility-inlines-hidden -fmessage-length=0 -ftree-vectorize -fstack-protector-strong -O2 -pipe -fext-numeric-literals") + set(CXX_FLAGS_DEBUG_TO_CHECK "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address ${CMAKE_CXX_FLAGS_TO_CHECK}") + set(CMAKE_EXE_LINKER_FLAGS_DEBUG "-fsanitize=address") else() - set(CMAKE_CXX_FLAGS_TO_CHECK "-Wall -Wextra") - set(CMAKE_CXX_FLAGS_DEBUG_TO_CHECK "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address ${CMAKE_CXX_FLAGS_TO_CHECK}) + set(CXX_FLAGS_TO_CHECK "-Wall -Wextra") + set(CXX_FLAGS_DEBUG_TO_CHECK "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address ${CMAKE_CXX_FLAGS_TO_CHECK}") endif() -set(CMAKE_CXX_FLAGS_PASSED ) -set(CMAKE_CXX_FLAGS_DEBUG_PASSED ) +set(CXX_FLAGS_PASSED ) +set(CXX_FLAGS_DEBUG_PASSED ) foreach(fl ${CXX_FLAGS_TO_CHECK}) CHECK_CXX_COMPILER_FLAG(${fl} COMPILER_SUPPORTS_${fl}) if(COMPILER_SUPPORTS_${fl}) - set(CMAKE_CXX_FLAGS_PASSED "${CMAKE_CXX_FLAGS_PASSED} ${fl}" ) + set(CXX_FLAGS_PASSED "${CXX_FLAGS_PASSED} ${fl}" ) endif() endforeach() foreach(fl ${CXX_FLAGS_DEBUG_TO_CHECK}) CHECK_CXX_COMPILER_FLAG(${fl} COMPILER_SUPPORTS_${fl}) if(COMPILER_SUPPORTS_${fl}) - set(CMAKE_CXX_FLAGS_DEBUG_PASSED "${CMAKE_CXX_FLAGS_DEBUG_PASSED} ${fl}" ) + set(CXX_FLAGS_DEBUG_PASSED "${CXX_FLAGS_DEBUG_PASSED} ${fl}" ) endif() endforeach() -set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS_PASSED}) -set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG_PASSED}) +set(CMAKE_CXX_FLAGS ${CXX_FLAGS_PASSED}) +set(CMAKE_CXX_FLAGS_DEBUG ${CXX_FLAGS_DEBUG_PASSED}) +message(STATUS "CMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}") +message(STATUS "CMAKE_CXX_FLAGS_DEBUG=${CMAKE_CXX_FLAGS_DEBUG}") set(prefix ${CMAKE_INSTALL_PREFIX}) set(exec_prefix ${CMAKE_INSTALL_PREFIX}) set(includedir "${CMAKE_INSTALL_INCLUDE_DIR}")