From 38b873d1bac121821a55fb568d0f48e3d5e9bb4f Mon Sep 17 00:00:00 2001 From: Robin Christ Date: Tue, 24 Dec 2019 15:46:11 +0100 Subject: [PATCH] Add FMT_FPIC flag --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0b4ec0a7..09af0f96 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,6 +33,7 @@ if (MASTER_PROJECT AND NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release CACHE STRING ${doc}) endif () +option(FMT_FPIC "If ON, force FMT to be built as position independent code" OFF) option(FMT_PEDANTIC "Enable extra warnings and expensive tests." OFF) option(FMT_WERROR "Halt the compilation with an error on compiler warnings." OFF) @@ -161,6 +162,9 @@ if (HAVE_STRTOD_L) target_compile_definitions(fmt PUBLIC FMT_LOCALE) endif () +if(FMT_FPIC) + set_target_properties(fmt PROPERTIES POSITION_INDEPENDENT_CODE ON) +endif() if (FMT_WERROR) target_compile_options(fmt PRIVATE ${WERROR_FLAG}) endif ()