1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-01 21:54:55 -04:00

CMake: Make compiler flags selection and detection more flexible.

- Fix for RelWithDebInfo and MinSizeRel build types
- Use -march=native instead of handcrafted detection when possible
- Refactor whole thing to reduce code duplication
This commit is contained in:
Kacper Michajłow
2020-11-09 03:33:18 +01:00
parent c44ae9f1e9
commit 305c97fc0e
7 changed files with 230 additions and 298 deletions
+5
View File
@@ -68,6 +68,7 @@ elseif (LINUX)
)
endif ()
list(APPEND COMMON_CMAKE_ARGS -DCMAKE_POLICY_DEFAULT_CMP0069:STRING=NEW)
if(CMAKE_MSVC_RUNTIME_LIBRARY)
list(APPEND COMMON_CMAKE_ARGS -DCMAKE_POLICY_DEFAULT_CMP0091:STRING=NEW)
list(APPEND COMMON_CMAKE_ARGS -DCMAKE_MSVC_RUNTIME_LIBRARY=${CMAKE_MSVC_RUNTIME_LIBRARY})
@@ -77,6 +78,10 @@ if(CMAKE_BUILD_TYPE)
list(APPEND COMMON_CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE})
endif()
if(CMAKE_INTERPROCEDURAL_OPTIMIZATION)
list(APPEND COMMON_CMAKE_ARGS -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=${CMAKE_INTERPROCEDURAL_OPTIMIZATION})
endif()
list(APPEND COMMON_CMAKE_ARGS -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD})
list(APPEND COMMON_CMAKE_ARGS -DCMAKE_CXX_STANDARD_REQUIRED=${CMAKE_CXX_STANDARD_REQUIRED})
list(APPEND COMMON_CMAKE_ARGS -DCMAKE_CXX_EXTENSIONS=${CMAKE_CXX_EXTENSIONS})