summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorDon Hinton <hintonda@gmail.com>2017-12-25 01:23:09 +0000
committerDon Hinton <hintonda@gmail.com>2017-12-25 01:23:09 +0000
commite40169c7eaeef2a524a8da808e5c23d8cda7bd93 (patch)
tree05f332592013ebc27724092bc16a35ca56be567e /cmake
parent72533673e22a60a959968189a1b2902071ca546e (diff)
[cmake] Always respect existing CMAKE_REQUIRED_FLAGS when adding additional ones.
Summary: Always respect existing CMAKE_REQUIRED_FLAGS when adding additional ones. This is important when cross compiling where --sysroot and -target were already added. In particular, this is needed when cross compiling from Darwin to Linux, since --sysroot is required to find headers and libraries. Cmake has a similar bug in check_include_file[_cxx] where CMAKE_REQUIRED_LIBRARIES isn't passed, which causes try_compile to fail. (please see https://gitlab.kitware.com/cmake/cmake/merge_requests/1620) Reviewers: compnerd, silvas, beanz, brad.king Reviewed By: compnerd Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D41568 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321434 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake')
-rw-r--r--cmake/config-ix.cmake2
-rw-r--r--cmake/modules/CheckAtomic.cmake2
-rw-r--r--cmake/modules/CheckCompilerVersion.cmake2
3 files changed, 3 insertions, 3 deletions
diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake
index 42597c871ea..c6be957b0e4 100644
--- a/cmake/config-ix.cmake
+++ b/cmake/config-ix.cmake
@@ -17,7 +17,7 @@ include(HandleLLVMStdlib)
if( UNIX AND NOT (BEOS OR HAIKU) )
# Used by check_symbol_exists:
- set(CMAKE_REQUIRED_LIBRARIES m)
+ list(APPEND CMAKE_REQUIRED_LIBRARIES "m")
endif()
# x86_64 FreeBSD 9.2 requires libcxxrt to be specified explicitly.
if( CMAKE_SYSTEM MATCHES "FreeBSD-9.2-RELEASE" AND
diff --git a/cmake/modules/CheckAtomic.cmake b/cmake/modules/CheckAtomic.cmake
index 11f0366bc85..9a4cdf12a62 100644
--- a/cmake/modules/CheckAtomic.cmake
+++ b/cmake/modules/CheckAtomic.cmake
@@ -8,7 +8,7 @@ INCLUDE(CheckLibraryExists)
function(check_working_cxx_atomics varname)
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
- set(CMAKE_REQUIRED_FLAGS "-std=c++11")
+ set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++11")
CHECK_CXX_SOURCE_COMPILES("
#include <atomic>
std::atomic<int> x;
diff --git a/cmake/modules/CheckCompilerVersion.cmake b/cmake/modules/CheckCompilerVersion.cmake
index 2e8f5445781..adf500ad53a 100644
--- a/cmake/modules/CheckCompilerVersion.cmake
+++ b/cmake/modules/CheckCompilerVersion.cmake
@@ -28,7 +28,7 @@ if(NOT DEFINED LLVM_COMPILER_CHECKED)
# bug in libstdc++4.6 that is fixed in libstdc++4.7.
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
set(OLD_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
- set(CMAKE_REQUIRED_FLAGS "-std=c++0x")
+ set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++0x")
check_cxx_source_compiles("
#include <atomic>
std::atomic<float> x(0.0f);