From f9ac94b1f1c7b8416cf6f24e4e0a890ddcaa34f5 Mon Sep 17 00:00:00 2001 From: Clifford Yapp <238416+starseeker@users.noreply.github.com> Date: Wed, 7 Dec 2022 11:35:10 -0500 Subject: [PATCH] Conditional PIC building for indirect_prediciates Preliminary testing suggests that Position Independent Code will be needed for a shared library version of IRMB, which propagates to the indirect_predicates build. If CMAKE_POSITION_INDEPENDENT_CODE is active, use an alternative approach to FetchContent_MakeAvailable that allows us to specify this setting for the indirectPredicates target. --- arrangements/external/Cinolib/cinolib-config.cmake | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arrangements/external/Cinolib/cinolib-config.cmake b/arrangements/external/Cinolib/cinolib-config.cmake index 9efbeb3e..944fba40 100644 --- a/arrangements/external/Cinolib/cinolib-config.cmake +++ b/arrangements/external/Cinolib/cinolib-config.cmake @@ -87,7 +87,13 @@ endif() if(CINOLIB_USES_INDIRECT_PREDICATES) message("CINOLIB OPTIONAL MODULE: Indirect Predicates") FetchContent_Declare(indirect_predicates GIT_REPOSITORY "https://github.com/cinolib-dev-team/Indirect_Predicates.git") - FetchContent_MakeAvailable(indirect_predicates) + if(CMAKE_POSITION_INDEPENDENT_CODE) + FetchContent_Populate(indirect_predicates) + add_subdirectory(${indirect_predicates_SOURCE_DIR} ${indirect_predicates_BINARY_DIR}) + set_property(TARGET indirectPredicates PROPERTY POSITION_INDEPENDENT_CODE ON) + else() + FetchContent_MakeAvailable(indirect_predicates) + endif() target_link_libraries(cinolib INTERFACE indirectPredicates) target_compile_definitions(cinolib INTERFACE CINOLIB_USES_INDIRECT_PREDICATES) endif()