mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 04:30:23 +00:00
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
This commit is contained in:
parent
6be2ee431f
commit
148d245c32
@ -52,6 +52,9 @@ check_symbol_exists(mallinfo malloc.h HAVE_MALLINFO)
|
||||
check_symbol_exists(pthread_mutex_lock pthread.h HAVE_PTHREAD_MUTEX_LOCK)
|
||||
check_symbol_exists(strtoll stdlib.h HAVE_STRTOLL)
|
||||
|
||||
include(CheckCXXCompilerFlag)
|
||||
check_cxx_compiler_flag("-fPIC" SUPPORTS_FPIC_FLAG)
|
||||
|
||||
include(GetTargetTriple)
|
||||
get_target_triple(LLVM_HOSTTRIPLE)
|
||||
message(STATUS "LLVM_HOSTTRIPLE: ${LLVM_HOSTTRIPLE}")
|
||||
|
@ -17,6 +17,9 @@ macro(add_partially_linked_object lib)
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/temp_lib)
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/temp_lib)
|
||||
llvm_process_sources( ALL_FILES ${ARGN} )
|
||||
if( BUILD_SHARED_LIBS AND SUPPORTS_FPIC_FLAG )
|
||||
add_definitions(-fPIC)
|
||||
endif()
|
||||
add_library( ${lib} STATIC ${ALL_FILES})
|
||||
if( LLVM_COMMON_DEPENDS )
|
||||
add_dependencies( ${lib} ${LLVM_COMMON_DEPENDS} )
|
||||
|
Loading…
Reference in New Issue
Block a user