[PATCH] D31942: [CMake][runtimes] Use -nodefaultlibs for the runtimes build
Petr Hosek via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 13 14:41:51 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL300260: [CMake][runtimes] Use -nodefaultlibs for the runtimes build (authored by phosek).
Changed prior to commit:
https://reviews.llvm.org/D31942?vs=94835&id=95215#toc
Repository:
rL LLVM
https://reviews.llvm.org/D31942
Files:
llvm/trunk/runtimes/CMakeLists.txt
Index: llvm/trunk/runtimes/CMakeLists.txt
===================================================================
--- llvm/trunk/runtimes/CMakeLists.txt
+++ llvm/trunk/runtimes/CMakeLists.txt
@@ -29,7 +29,7 @@
# CMake module path.
list(INSERT CMAKE_MODULE_PATH 0
"${CMAKE_CURRENT_SOURCE_DIR}/../cmake"
- "${CMAKE_CURRENT_SOURCE_DIR}/../cmake/Modules"
+ "${CMAKE_CURRENT_SOURCE_DIR}/../cmake/modules"
"${LLVM_BINARY_DIR}/lib/cmake/llvm"
)
@@ -65,10 +65,28 @@
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()
+
# Handle common options used by all runtimes.
include(AddLLVM)
include(HandleLLVMOptions)
+ set(CMAKE_REQUIRED_FLAGS ${SAFE_CMAKE_REQUIRED_FLAGS})
+ set(CMAKE_REQUIRED_LIBRARIES ${SAFE_CMAKE_REQUIRED_LIBRARIES})
+
foreach(entry ${runtimes})
get_filename_component(projName ${entry} NAME)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31942.95215.patch
Type: text/x-patch
Size: 1364 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170413/8b911e92/attachment.bin>
More information about the llvm-commits
mailing list