summaryrefslogtreecommitdiff
path: root/runtimes
diff options
context:
space:
mode:
authorPetr Hosek <phosek@chromium.org>2019-02-12 02:11:25 +0000
committerPetr Hosek <phosek@chromium.org>2019-02-12 02:11:25 +0000
commit0f056ecd63f49cd3ef08299b3372db3dd9091483 (patch)
treeb0ef590f9b12bbf000da6a9febd0f3a173c42e80 /runtimes
parent57909365e7d48ce2be07102138e5cfe0747e86b4 (diff)
downloadllvm-0f056ecd63f49cd3ef08299b3372db3dd9091483.tar.gz
[CMake] Don't override required compiler flags in the runtimes build
Ensure that HandleLLVMOptions adds all necessary required flags, including -Wno-error when building with LLVM_ENABLE_WERROR enabled. Differential Revision: https://reviews.llvm.org/D58092 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353790 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'runtimes')
-rw-r--r--runtimes/CMakeLists.txt18
1 files changed, 5 insertions, 13 deletions
diff --git a/runtimes/CMakeLists.txt b/runtimes/CMakeLists.txt
index a6fe5e35089c..98f7f0c8581b 100644
--- a/runtimes/CMakeLists.txt
+++ b/runtimes/CMakeLists.txt
@@ -93,23 +93,15 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
set(LLVM_ENABLE_LIBCXX ON CACHE BOOL "")
endif()
- set(SAFE_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
- set(SAFE_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
-
include(CheckLibraryExists)
include(CheckCCompilerFlag)
- check_library_exists(c fopen "" LLVM_HAS_C_LIB)
- check_c_compiler_flag(-nodefaultlibs LLVM_HAS_NODEFAULTLIBS_FLAG)
- if(LLVM_HAS_NODEFAULTLIBS_FLAG)
- set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nodefaultlibs")
- if(LLVM_HAS_C_LIB)
- list(APPEND CMAKE_REQUIRED_LIBRARIES c)
- endif()
- endif()
+ # We don't have libc++ (yet).
+ set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nostdlib++")
# Avoid checking whether the compiler is working.
set(LLVM_COMPILER_CHECKED ON)
+ # Mark the compiler as compatible with GCC.
# Enable warnings, otherwise -w gets added to the cflags by HandleLLVMOptions
# resulting in unjustified successes by check_cxx_compiler_flag.
set(LLVM_ENABLE_WARNINGS ON)
@@ -119,8 +111,8 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
include(HandleLLVMOptions)
include(FindPythonInterp)
- set(CMAKE_REQUIRED_FLAGS ${SAFE_CMAKE_REQUIRED_FLAGS})
- set(CMAKE_REQUIRED_LIBRARIES ${SAFE_CMAKE_REQUIRED_LIBRARIES})
+ # Remove the -nostdlib++ option we've added earlier.
+ string(REPLACE "-nostdlib++" "" CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
# This can be used to detect whether we're in the runtimes build.
set(RUNTIMES_BUILD ON)