diff options
| author | Brian Cain <bcain@quicinc.com> | 2019-05-02 03:49:50 +0000 |
|---|---|---|
| committer | Brian Cain <bcain@quicinc.com> | 2019-05-02 03:49:50 +0000 |
| commit | 9d744bcde993dffe05149be51a9c69178f7a6887 (patch) | |
| tree | 074977ce1abe8c0d838654340fae2c1a1a246729 /libcxx | |
| parent | f2baae0abb54cfcc2cc36192d0110dd5c022f033 (diff) | |
| download | bcm5719-llvm-9d744bcde993dffe05149be51a9c69178f7a6887.tar.gz bcm5719-llvm-9d744bcde993dffe05149be51a9c69178f7a6887.zip | |
[libcxx] cmake - guard list remove
REMOVE_ITEM fails if CMAKE_REQUIRED_LIBRARIES is empty on some
versions of cmake.
llvm-svn: 359755
Diffstat (limited to 'libcxx')
| -rw-r--r-- | libcxx/cmake/Modules/CheckLibcxxAtomic.cmake | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libcxx/cmake/Modules/CheckLibcxxAtomic.cmake b/libcxx/cmake/Modules/CheckLibcxxAtomic.cmake index 1e6e5e63766..7fe5a627829 100644 --- a/libcxx/cmake/Modules/CheckLibcxxAtomic.cmake +++ b/libcxx/cmake/Modules/CheckLibcxxAtomic.cmake @@ -34,10 +34,12 @@ endfunction(check_cxx_atomics) # Perform the check for 64bit atomics without libatomic. It may have been # added to the required libraries during in the configuration of LLVM, which # would cause the check for CXX atomics without libatomic to incorrectly pass. -set(OLD_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) -list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES "atomic") -check_cxx_atomics(LIBCXX_HAVE_CXX_ATOMICS_WITHOUT_LIB) -set(CMAKE_REQUIRED_LIBRARIES ${OLD_CMAKE_REQUIRED_LIBRARIES}) +if (CMAKE_REQUIRED_LIBRARIES) + set(OLD_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) + list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES "atomic") + check_cxx_atomics(LIBCXX_HAVE_CXX_ATOMICS_WITHOUT_LIB) + set(CMAKE_REQUIRED_LIBRARIES ${OLD_CMAKE_REQUIRED_LIBRARIES}) +endif() check_library_exists(atomic __atomic_fetch_add_8 "" LIBCXX_HAS_ATOMIC_LIB) # If not, check if the library exists, and atomics work with it. |

