From 36206182e12bb2728f88eaebf3082eb66d637635 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Sun, 8 Nov 2009 00:34:22 +0000 Subject: [PATCH] Prevent warning spew about -fPIC when using CMake generated Xcode project files. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86427 91177308-0d34-0410-b5e6-96231b3b80d8 --- CMakeLists.txt | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5b30309bf33..794e8e951c6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -164,13 +164,19 @@ option(LLVM_ENABLE_PIC "Build Position-Independent Code" ON) set(ENABLE_PIC 0) if( LLVM_ENABLE_PIC ) - 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() + 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 ) + 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() endif() set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_TOOLS_BINARY_DIR} ) -- 2.11.0