Better handle PIC / static linking

This commit is contained in:
Jeremy 2023-10-04 10:27:03 -04:00
parent b236da4a0b
commit bbcd8db054
No known key found for this signature in database
GPG Key ID: 3E11861CB34E158C
2 changed files with 3 additions and 6 deletions

View File

@ -202,8 +202,6 @@ endif()
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(
sources
src/cpptrace.cpp
@ -228,6 +226,7 @@ if(CPPTRACE_STATIC)
add_library(cpptrace STATIC ${sources} include/cpptrace/cpptrace.hpp)
else()
add_library(cpptrace SHARED ${sources} include/cpptrace/cpptrace.hpp)
set_property(TARGET cpptrace PROPERTY POSITION_INDEPENDENT_CODE ON)
endif()
target_include_directories(

View File

@ -421,12 +421,10 @@ set(
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
### libassert uses relocs, -fpic has to be used to allow shared libs to link libassert as a static library.
##set(CMAKE_POSITION_INDEPENDENT_CODE ON)
include(GNUInstallDirs)
add_library(dwarf STATIC ${libdwarf_sources} ${libdwarf_headers})
add_library(dwarf OBJECT ${libdwarf_sources} ${libdwarf_headers})
set_property(TARGET dwarf PROPERTY POSITION_INDEPENDENT_CODE ON)
target_compile_definitions(dwarf PUBLIC LIBDWARF_BUILD)