summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorShoaib Meenai <smeenai@fb.com>2017-10-31 01:30:46 +0000
committerShoaib Meenai <smeenai@fb.com>2017-10-31 01:30:46 +0000
commit6c2f3c2761722e13d7e19ec703efe3feaa7c7540 (patch)
tree28fd13e72e557da3a99b57a644cfa2377c8cfffb /CMakeLists.txt
parent417fd3fcbfc4685e3e4b875be7b6c62d2fcda0b0 (diff)
[cmake] Make check_linker_flags operate via linker flags
`check_linker_flags` currently sets the *compiler* flags (via `CMAKE_REQUIRED_FLAGS`), and thus implicitly relies on cmake's default behavior of passing the compiler flags to the linker. This breaks when cmake's build rules have been altered to not pollute the link line with compiler flags (which can be desirable for build cleanliness). Instead, set `CMAKE_EXE_LINKER_FLAGS` explicitly and use `CMP0056` to ensure the linker flags are passed along. Additionally, since we're inside a function, we can just alter the variable directly (as the alteration will be limited to the scope of the function) rather than saving and restoring the old value. Differential Revision: https://reviews.llvm.org/D39431 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316972 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt4
1 files changed, 4 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1435859851a..90847d2c0d1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,6 +15,10 @@ if (POLICY CMP0051)
cmake_policy(SET CMP0051 OLD)
endif()
+if(POLICY CMP0056)
+ cmake_policy(SET CMP0056 NEW)
+endif()
+
if(POLICY CMP0057)
cmake_policy(SET CMP0057 NEW)
endif()