[libcxx] r299711 - [CMake][libcxx] Use check_c_compiler_flag to check for nodefaultlibs

Petr Hosek via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 6 14:06:33 PDT 2017


Author: phosek
Date: Thu Apr  6 16:06:33 2017
New Revision: 299711

URL: http://llvm.org/viewvc/llvm-project?rev=299711&view=rev
Log:
[CMake][libcxx] Use check_c_compiler_flag to check for nodefaultlibs

We're using -nodefaultlibs to avoid the dependency on C++ library
when using check_cxx_compiler_flag, and as such we cannot use
check_cxx_compiler_flag to check the availability of -nodefaultlibs
itself.

Modified:
    libcxx/trunk/cmake/config-ix.cmake

Modified: libcxx/trunk/cmake/config-ix.cmake
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/config-ix.cmake?rev=299711&r1=299710&r2=299711&view=diff
==============================================================================
--- libcxx/trunk/cmake/config-ix.cmake (original)
+++ libcxx/trunk/cmake/config-ix.cmake Thu Apr  6 16:06:33 2017
@@ -1,4 +1,5 @@
 include(CheckLibraryExists)
+include(CheckCCompilerFlag)
 include(CheckCXXCompilerFlag)
 
 if(WIN32 AND NOT MINGW)
@@ -24,7 +25,7 @@ endif()
 # required during compilation (which has the -nodefaultlibs). libc is
 # required for the link to go through. We remove sanitizers from the
 # configuration checks to avoid spurious link errors.
-check_cxx_compiler_flag(-nodefaultlibs LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG)
+check_c_compiler_flag(-nodefaultlibs LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG)
 if (LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG)
   set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nodefaultlibs")
   if (LIBCXX_HAS_C_LIB)




More information about the cfe-commits mailing list