[libc++] Guard cxx_experimental settings behind LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY
authorAlex Langford <apl@fb.com>
Fri, 4 Oct 2019 23:08:20 +0000 (23:08 +0000)
committerAlex Langford <apl@fb.com>
Fri, 4 Oct 2019 23:08:20 +0000 (23:08 +0000)
If you explicitly set LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY to OFF, your
project will fail to configure because the cxx_experimental target
doesn't exist.

llvm-svn: 373809

libcxx/src/CMakeLists.txt

index 1b18850..03bc126 100644 (file)
@@ -395,14 +395,14 @@ if (LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY)
       COMPILE_FLAGS "${LIBCXX_COMPILE_FLAGS}"
       OUTPUT_NAME   "c++experimental"
   )
+  cxx_add_common_build_flags(cxx_experimental)
+  # Overwrite the previously-set Standard flag with -std=c++14 if supported
+  check_flag_supported(-std=c++14)
+  if (NOT MSVC AND LIBCXX_SUPPORTS_STD_EQ_CXX14_FLAG)
+    target_compile_options(cxx_experimental PRIVATE "-std=c++14")
+  endif()
 endif()
-cxx_add_common_build_flags(cxx_experimental)
 
-# Overwrite the previously-set Standard flag with -std=c++14 if supported
-check_flag_supported(-std=c++14)
-if (NOT MSVC AND LIBCXX_SUPPORTS_STD_EQ_CXX14_FLAG)
-  target_compile_options(cxx_experimental PRIVATE "-std=c++14")
-endif()
 
 if (LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY)
   file(GLOB LIBCXX_EXTERNAL_THREADING_SUPPORT_SOURCES ../test/support/external_threads.cpp)