diff --git a/double-conversion/CMakeLists.txt b/double-conversion/CMakeLists.txt index 4a87b3e3652fd44e2263e6543dfb74af330c21e6..d8ec02ad6d5f9ea91e55c7f73f861c7cdb2c64af 100644 --- a/double-conversion/CMakeLists.txt +++ b/double-conversion/CMakeLists.txt @@ -1,4 +1,3 @@ - set(headers bignum.h cached-powers.h @@ -25,6 +24,14 @@ ${headers} target_include_directories(double-conversion PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>) +# Add fPIC on x86_64 when supported. +include(CheckCXXCompilerFlag) +check_cxx_compiler_flag(-fPIC CXX_HAS_FPIC) + +if(CXX_HAS_FPIC AND CMAKE_SYSTEM_PROCESSOER STREQUAL "x86_64") + set_target_properties(double-conversion PROPERTIES COMPILE_FLAGS "-fPIC") +endif() + # # associates the list of headers with the library # for the purposes of installation/import into other projects