llvm.org GIT mirror llvm / 148d245
CMake: when building shared libraries, use -fPIC for compiling partially linked objects. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59699 91177308-0d34-0410-b5e6-96231b3b80d8 Oscar Fuentes 10 years ago
2 changed file(s) with 6 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
5050 check_symbol_exists(mallinfo malloc.h HAVE_MALLINFO)
5151 check_symbol_exists(pthread_mutex_lock pthread.h HAVE_PTHREAD_MUTEX_LOCK)
5252 check_symbol_exists(strtoll stdlib.h HAVE_STRTOLL)
53
54 include(CheckCXXCompilerFlag)
55 check_cxx_compiler_flag("-fPIC" SUPPORTS_FPIC_FLAG)
5356
5457 include(GetTargetTriple)
5558 get_target_triple(LLVM_HOSTTRIPLE)
1616 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/temp_lib)
1717 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/temp_lib)
1818 llvm_process_sources( ALL_FILES ${ARGN} )
19 if( BUILD_SHARED_LIBS AND SUPPORTS_FPIC_FLAG )
20 add_definitions(-fPIC)
21 endif()
1922 add_library( ${lib} STATIC ${ALL_FILES})
2023 if( LLVM_COMMON_DEPENDS )
2124 add_dependencies( ${lib} ${LLVM_COMMON_DEPENDS} )