CMake: Option for building with -fPIC.
authorOscar Fuentes <ofv@wanadoo.es>
Thu, 20 Nov 2008 19:13:51 +0000 (19:13 +0000)
committerOscar Fuentes <ofv@wanadoo.es>
Thu, 20 Nov 2008 19:13:51 +0000 (19:13 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59739 91177308-0d34-0410-b5e6-96231b3b80d8

CMakeLists.txt

index 940326e732d3fcf07081b9cdf38654a3e9490cfb..2072c703715d959407d318c2375df69433179fd1 100644 (file)
@@ -104,6 +104,17 @@ endif( EXISTS ${LLVM_TOOLS_BINARY_DIR}/llvm-config )
 
 include(config-ix)
 
+option(LLVM_ENABLE_PIC "Build Position-Independent Code" OFF)
+
+if( LLVM_ENABLE_PIC )
+  if( SUPPORTS_FPIC_FLAG )
+    message(STATUS "Building with -fPIC")
+    add_definitions(-fPIC)
+  else( SUPPORTS_FPIC_FLAG )
+    message(STATUS "Warning: -fPIC not supported.")
+  endif()
+endif()
+
 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 )