[llvm] r287220 - [cmake] Move LLVM_BUILD_STATIC check to an earlier point
Pavel Labath via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 17 03:22:24 PST 2016
Author: labath
Date: Thu Nov 17 05:22:23 2016
New Revision: 287220
URL: http://llvm.org/viewvc/llvm-project?rev=287220&view=rev
Log:
[cmake] Move LLVM_BUILD_STATIC check to an earlier point
Summary:
The motivation for this is to enable correct detection of dlopen() on Android.
Android does not provide a static version of libdl, so if we add the -static flag
after performing the check, it will succeed even though subsequent link steps
will fail. With this change we correctly detect the absence of libdl in a
LLVM_BUILD_STATIC build on Android.
The link itself still does not succeed because the code does not check the result
of this check properly, but I plan to fix that in a separate change.
Reviewers: beanz
Subscribers: danalbert, mgorny, srhines, tberghammer, llvm-commits
Differential Revision: https://reviews.llvm.org/D26463
Modified:
llvm/trunk/CMakeLists.txt
llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
Modified: llvm/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=287220&r1=287219&r2=287220&view=diff
==============================================================================
--- llvm/trunk/CMakeLists.txt (original)
+++ llvm/trunk/CMakeLists.txt Thu Nov 17 05:22:23 2016
@@ -554,6 +554,10 @@ if (LLVM_BUILD_INSTRUMENTED OR LLVM_BUIL
endif()
endif()
+if (LLVM_BUILD_STATIC)
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
+endif()
+
# All options referred to from HandleLLVMOptions have to be specified
# BEFORE this include, otherwise options will not be correctly set on
# first cmake run
Modified: llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/HandleLLVMOptions.cmake?rev=287220&r1=287219&r2=287220&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/HandleLLVMOptions.cmake (original)
+++ llvm/trunk/cmake/modules/HandleLLVMOptions.cmake Thu Nov 17 05:22:23 2016
@@ -180,10 +180,6 @@ if( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT
endif( LLVM_BUILD_32_BITS )
endif( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32 )
-if (LLVM_BUILD_STATIC)
- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
-endif()
-
if( XCODE )
# For Xcode enable several build settings that correspond to
# many warnings that are on by default in Clang but are
More information about the llvm-commits
mailing list