summaryrefslogtreecommitdiffstats
path: root/CompileFlags.cmake
diff options
context:
space:
mode:
authorAlexander Grund <alexander.grund@tu-dresden.de>2019-12-09 08:42:40 (GMT)
committerBrad King <brad.king@kitware.com>2019-12-09 16:37:40 (GMT)
commit958f858ad815024550b22eeaac02f183f8d646fd (patch)
treebc7f997717889ad688b637db6c6cb609c11a8fff /CompileFlags.cmake
parent8c7b7df788851358392e4a00faf00bc2a674c3a6 (diff)
downloadCMake-958f858ad815024550b22eeaac02f183f8d646fd.zip
CMake-958f858ad815024550b22eeaac02f183f8d646fd.tar.gz
CMake-958f858ad815024550b22eeaac02f183f8d646fd.tar.bz2
Check for support before adding bigtoc linker flag
Fixes: #20076
Diffstat (limited to 'CompileFlags.cmake')
-rw-r--r--CompileFlags.cmake12
1 files changed, 10 insertions, 2 deletions
diff --git a/CompileFlags.cmake b/CompileFlags.cmake
index 91f2adf..053259f 100644
--- a/CompileFlags.cmake
+++ b/CompileFlags.cmake
@@ -54,12 +54,20 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "^parisc")
endif()
# Workaround for TOC Overflow on ppc64
+set(bigTocFlag "")
if(CMAKE_SYSTEM_NAME STREQUAL "AIX" AND
CMAKE_SYSTEM_PROCESSOR MATCHES "powerpc")
- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-bbigtoc")
+ set(bigTocFlag "-Wl,-bbigtoc")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND
CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64")
- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-multi-toc")
+ set(bigTocFlag "-Wl,--no-multi-toc")
+endif()
+if(bigTocFlag)
+ include(CheckCXXLinkerFlag)
+ check_cxx_linker_flag(${bigTocFlag} BIG_TOC_FLAG_SUPPORTED)
+ if(BIG_TOC_FLAG_SUPPORTED)
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${bigTocFlag}")
+ endif()
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL SunPro AND