[llvm-commits] [llvm] r123119 - in /llvm/trunk: CMakeLists.txt cmake/config-ix.cmake include/llvm/Config/config.h.cmake
Oscar Fuentes
ofv at wanadoo.es
Sun Jan 9 06:34:39 PST 2011
Author: ofv
Date: Sun Jan 9 08:34:39 2011
New Revision: 123119
URL: http://llvm.org/viewvc/llvm-project?rev=123119&view=rev
Log:
Rewrite handling of LLVM_ENABLE_PIC. It was being processed after
config.h was generated, so it had no effect on it.
Thanks to arrowdodger for pointing out this and a tentative patch.
Modified:
llvm/trunk/CMakeLists.txt
llvm/trunk/cmake/config-ix.cmake
llvm/trunk/include/llvm/Config/config.h.cmake
Modified: llvm/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=123119&r1=123118&r2=123119&view=diff
==============================================================================
--- llvm/trunk/CMakeLists.txt (original)
+++ llvm/trunk/CMakeLists.txt Sun Jan 9 08:34:39 2011
@@ -195,27 +195,29 @@
endif(UNIX)
endif(WIN32)
-include(config-ix)
-
option(LLVM_ENABLE_PIC "Build Position-Independent Code" ON)
-set(ENABLE_PIC 0)
if( LLVM_ENABLE_PIC )
- if( XCODE )
- # Xcode has -mdynamic-no-pic on by default, which overrides -fPIC. I don't
- # know how to disable this, so just force ENABLE_PIC off for now.
- message(STATUS "Warning: -fPIC not supported with Xcode.")
- else( XCODE )
- if( SUPPORTS_FPIC_FLAG )
+ if( XCODE )
+ # Xcode has -mdynamic-no-pic on by default, which overrides -fPIC. I don't
+ # know how to disable this, so just force ENABLE_PIC off for now.
+ message(WARNING "-fPIC not supported with Xcode.")
+ elseif( WIN32 )
+ # On Windows all code is PIC. MinGW warns if -fPIC is used.
+ else()
+ include(CheckCXXCompilerFlag)
+ check_cxx_compiler_flag("-fPIC" SUPPORTS_FPIC_FLAG)
+ if( SUPPORTS_FPIC_FLAG )
message(STATUS "Building with -fPIC")
- add_llvm_definitions(-fPIC)
- set(ENABLE_PIC 1)
- else( SUPPORTS_FPIC_FLAG )
- message(STATUS "Warning: -fPIC not supported.")
- endif()
- endif()
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
+ else( SUPPORTS_FPIC_FLAG )
+ message(WARNING "-fPIC not supported.")
+ endif()
+ endif()
endif()
+include(config-ix)
+
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_TOOLS_BINARY_DIR} )
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib )
set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib )
Modified: llvm/trunk/cmake/config-ix.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/config-ix.cmake?rev=123119&r1=123118&r2=123119&view=diff
==============================================================================
--- llvm/trunk/cmake/config-ix.cmake (original)
+++ llvm/trunk/cmake/config-ix.cmake Sun Jan 9 08:34:39 2011
@@ -162,12 +162,9 @@
# Define LLVM_MULTITHREADED if gcc atomic builtins exists.
include(CheckAtomic)
+set(ENABLE_PIC ${LLVM_ENABLE_PIC})
+
include(CheckCXXCompilerFlag)
-# On windows all code is position-independent and mingw warns if -fPIC
-# is in the command-line.
-if( NOT WIN32 )
- check_cxx_compiler_flag("-fPIC" SUPPORTS_FPIC_FLAG)
-endif()
check_cxx_compiler_flag("-Wno-variadic-macros" SUPPORTS_NO_VARIADIC_MACROS_FLAG)
Modified: llvm/trunk/include/llvm/Config/config.h.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Config/config.h.cmake?rev=123119&r1=123118&r2=123119&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Config/config.h.cmake (original)
+++ llvm/trunk/include/llvm/Config/config.h.cmake Sun Jan 9 08:34:39 2011
@@ -31,7 +31,7 @@
#define CXX_INCLUDE_64BIT_DIR "${CXX_INCLUDE_64BIT_DIR}"
/* Define if position independent code is enabled */
-#cmakedefine ENABLE_PIC ${ENABLE_PIC}
+#cmakedefine ENABLE_PIC
/* Define if threads enabled */
#cmakedefine ENABLE_THREADS ${ENABLE_THREADS}
More information about the llvm-commits
mailing list