llvm.org GIT mirror llvm / e40169c
[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 Don Hinton 1 year, 9 months ago
3 changed file(s) with 3 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
1616
1717 if( UNIX AND NOT (BEOS OR HAIKU) )
1818 # Used by check_symbol_exists:
19 set(CMAKE_REQUIRED_LIBRARIES m)
19 list(APPEND CMAKE_REQUIRED_LIBRARIES "m")
2020 endif()
2121 # x86_64 FreeBSD 9.2 requires libcxxrt to be specified explicitly.
2222 if( CMAKE_SYSTEM MATCHES "FreeBSD-9.2-RELEASE" AND
77
88 function(check_working_cxx_atomics varname)
99 set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
10 set(CMAKE_REQUIRED_FLAGS "-std=c++11")
10 set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++11")
1111 CHECK_CXX_SOURCE_COMPILES("
1212 #include
1313 std::atomic x;
2727 # bug in libstdc++4.6 that is fixed in libstdc++4.7.
2828 set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
2929 set(OLD_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
30 set(CMAKE_REQUIRED_FLAGS "-std=c++0x")
30 set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++0x")
3131 check_cxx_source_compiles("
3232 #include
3333 std::atomic x(0.0f);