From 8756a0bcadb490383a6fb2b96aa83806471eda3c Mon Sep 17 00:00:00 2001 From: Kevin Albertson Date: Mon, 29 Sep 2025 13:16:33 -0400 Subject: [PATCH] do not propagate `-fPIC` --- CMakeLists.txt | 2 +- kms-message/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a85e97a44..c7fbfcfc8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -305,7 +305,7 @@ add_library (mongocrypt_static STATIC ${MONGOCRYPT_SOURCES}) # the common case that users are setting -DCMAKE_C_FLAGS='-fPIC' string (FIND "${CMAKE_C_FLAGS}" "-fPIC" FPIC_LOCATION) if (NOT WIN32 AND ENABLE_PIC AND "${FPIC_LOCATION}" EQUAL "-1") - target_compile_options (mongocrypt_static PUBLIC -fPIC) + set_property (TARGET mongocrypt_static PROPERTY POSITION_INDEPENDENT_CODE TRUE) message ("Adding -fPIC to compilation of mongocrypt_static components") endif () target_include_directories ( diff --git a/kms-message/CMakeLists.txt b/kms-message/CMakeLists.txt index ff210d4fc..7313cb107 100644 --- a/kms-message/CMakeLists.txt +++ b/kms-message/CMakeLists.txt @@ -100,7 +100,7 @@ add_library ( string(FIND "${CMAKE_C_FLAGS}" "-fPIC" FPIC_LOCATION) if (NOT WIN32 AND ENABLE_PIC AND "${FPIC_LOCATION}" EQUAL "-1") - target_compile_options (kms_message_static PUBLIC -fPIC) + set_property (TARGET kms_message_static PROPERTY POSITION_INDEPENDENT_CODE TRUE) message ("Adding -fPIC to compilation of kms_message_static components") endif ()