Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrii Verbytskyi committed Aug 18, 2022
1 parent cf65c19 commit 2b3b6a6
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down

0 comments on commit 2b3b6a6

Please sign in to comment.