[libcxx-commits] [libcxx] r359755 - [libcxx] cmake - guard list remove
Brian Cain via libcxx-commits
libcxx-commits at lists.llvm.org
Wed May 1 20:49:50 PDT 2019
Author: bcain
Date: Wed May 1 20:49:50 2019
New Revision: 359755
URL: http://llvm.org/viewvc/llvm-project?rev=359755&view=rev
Log:
[libcxx] cmake - guard list remove
REMOVE_ITEM fails if CMAKE_REQUIRED_LIBRARIES is empty on some
versions of cmake.
Modified:
libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake
Modified: libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake?rev=359755&r1=359754&r2=359755&view=diff
==============================================================================
--- libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake (original)
+++ libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake Wed May 1 20:49:50 2019
@@ -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.
More information about the libcxx-commits
mailing list