mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-11-28 22:57:37 +00:00
64 lines
2.6 KiB
Diff
64 lines
2.6 KiB
Diff
diff --git a/cmake/compilerFlags.cmake b/cmake/compilerFlags.cmake
|
|
index 0418aa61..ae18583f 100644
|
|
--- a/cmake/compilerFlags.cmake
|
|
+++ b/cmake/compilerFlags.cmake
|
|
@@ -1,4 +1,5 @@
|
|
# These flags applies to exiv2lib, the applications, and to the xmp code
|
|
+include(CheckCCompilerFlag)
|
|
|
|
if ( MINGW OR UNIX OR MSYS ) # MINGW, Linux, APPLE, CYGWIN
|
|
if (${CMAKE_CXX_COMPILER_ID} STREQUAL GNU)
|
|
@@ -23,22 +24,25 @@ if ( MINGW OR UNIX OR MSYS ) # MINGW, Linux, APPLE, CYGWIN
|
|
|
|
if (COMPILER_IS_GCC OR COMPILER_IS_CLANG)
|
|
|
|
- # This fails under Fedora, MinGW GCC 8.3.0 and CYGWIN/MSYS 9.3.0
|
|
- if (NOT (MINGW OR CMAKE_HOST_SOLARIS OR CYGWIN OR MSYS) )
|
|
- if (COMPILER_IS_GCC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)
|
|
- add_compile_options(-fstack-clash-protection -fcf-protection)
|
|
+ # This fails under Fedora - MinGW - Gcc 8.3
|
|
+ if (NOT MINGW)
|
|
+ check_c_compiler_flag(-fstack-clash-protection HAS_FSTACK_CLASH_PROTECTION)
|
|
+ check_c_compiler_flag(-fcf-protection HAS_FCF_PROTECTION)
|
|
+ check_c_compiler_flag(-fstack-protector-strong HAS_FSTACK_PROTECTOR_STRONG)
|
|
+ if(HAS_FSTACK_CLASH_PROTECTION)
|
|
+ add_compile_options(-fstack-clash-protection)
|
|
endif()
|
|
-
|
|
- if( (COMPILER_IS_GCC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 5.0) # Not in GCC 4.8
|
|
- OR (COMPILER_IS_CLANG AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 3.7) # Not in Clang 3.4.2
|
|
- )
|
|
+ if(GCC_HAS_FCF_PROTECTION)
|
|
+ add_compile_options(-fcf-protection)
|
|
+ endif()
|
|
+ if(GCC_HAS_FSTACK_PROTECTOR_STRONG)
|
|
add_compile_options(-fstack-protector-strong)
|
|
endif()
|
|
endif()
|
|
|
|
add_compile_options(-Wp,-D_GLIBCXX_ASSERTIONS)
|
|
|
|
- if (CMAKE_BUILD_TYPE STREQUAL Release AND NOT APPLE AND NOT MSYS)
|
|
+ if (CMAKE_BUILD_TYPE STREQUAL Release AND NOT APPLE)
|
|
add_compile_options(-Wp,-D_FORTIFY_SOURCE=2) # Requires to compile with -O2
|
|
endif()
|
|
|
|
@@ -90,7 +94,6 @@ endif ()
|
|
|
|
# http://stackoverflow.com/questions/10113017/setting-the-msvc-runtime-in-cmake
|
|
if(MSVC)
|
|
-
|
|
find_program(CLCACHE name clcache.exe
|
|
PATHS ENV CLCACHE_PATH
|
|
PATH_SUFFIXES Scripts clcache-4.1.0
|
|
@@ -137,10 +140,4 @@ if(MSVC)
|
|
# Object Level Parallelism
|
|
add_compile_options(/MP)
|
|
add_definitions(-DNOMINMAX -DWIN32_LEAN_AND_MEAN)
|
|
-
|
|
- # https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/
|
|
- if (MSVC_VERSION GREATER_EQUAL "1910") # VS2017 and up
|
|
- add_compile_options("/Zc:__cplusplus")
|
|
- endif()
|
|
-
|
|
endif()
|