Build with -fPIC so libfmt.a can be linked into shared libraries
This commit is contained in:
parent
02553d13a0
commit
b592f952d6
@ -1,3 +1,5 @@
|
||||
include(CheckCXXCompilerFlag)
|
||||
|
||||
# Define the fmt library, its includes and the needed defines.
|
||||
# *.cc are added to FMT_HEADERS for the header-only configuration.
|
||||
set(FMT_HEADERS format.h format.cc ostream.h ostream.cc printf.h printf.cc
|
||||
@ -21,6 +23,11 @@ if (FMT_PEDANTIC)
|
||||
target_compile_options(fmt PRIVATE ${PEDANTIC_COMPILE_FLAGS})
|
||||
endif ()
|
||||
|
||||
check_cxx_compiler_flag(-fPIC FMT_HAS_FPIC_FLAG)
|
||||
if (FMT_HAS_FPIC_FLAG)
|
||||
target_compile_options(fmt PRIVATE -fPIC)
|
||||
endif()
|
||||
|
||||
target_include_directories(fmt PUBLIC
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
|
||||
$<INSTALL_INTERFACE:include>)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user