Skip to content

Commit f122ea4

Browse files
committed
Config archives use -fPIC when supporting BUILD_SHARED_LIBS
1 parent ede8a10 commit f122ea4

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

cmake/API.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,10 @@ function(fprime_add_config_build_target)
431431
append_list_property("${INTERNAL_MODULE_NAME}" GLOBAL PROPERTY "FPRIME_CONFIG_MODULES")
432432
set_property(TARGET "${INTERNAL_MODULE_NAME}" PROPERTY FPRIME_CONFIGURATION TRUE)
433433
set_property(TARGET "${FPRIME__INTERNAL_CONFIG_TARGET_NAME}" PROPERTY FPRIME_CONFIGURATION TRUE)
434-
434+
# Static libraries must be position independent when building shared libraries
435+
if (BUILD_SHARED_LIBS AND CONFIG_LIBRARY_TYPE STREQUAL "STATIC")
436+
target_compile_options(${INTERNAL_MODULE_NAME} PRIVATE -fPIC)
437+
endif()
435438
# Clear the historical variables and set up autocode
436439
clear_historical_variables()
437440
fprime_attach_custom_targets("${INTERNAL_MODULE_NAME}")

0 commit comments

Comments
 (0)