From 99e51d782e63a623edfba9cf9a0b3598292b8e46 Mon Sep 17 00:00:00 2001 From: Charles Giessen Date: Wed, 27 Mar 2024 11:22:13 -0500 Subject: [PATCH] Enable PIC dependent on BUILD_SHARED_LIBS While vk-bootstrap is a static library, it needs to have PIC enabled if BUILD_SHARED_LIBS is on so it can work with shared libraries. --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 43bc5cd..4a9bfa5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -98,6 +98,9 @@ target_link_libraries(vk-bootstrap ${CMAKE_DL_LIBS}) target_compile_features(vk-bootstrap PUBLIC cxx_std_17) +option(VK_BOOTSTRAP_POSITION_INDEPENDENT_CODE "Default value is the value of BUILD_SHARED_LIBS" ${BUILD_SHARED_LIBS}) +set_target_properties(vk-bootstrap PROPERTIES POSITION_INDEPENDENT_CODE ${VK_BOOTSTRAP_POSITION_INDEPENDENT_CODE}) + if(VK_BOOTSTRAP_TEST) enable_testing() add_subdirectory(ext)