diff --git a/CMakeLists.txt b/CMakeLists.txt index 317177d..851c1e9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -267,6 +267,7 @@ set_target_properties( SOVERSION "${PROJECT_VERSION_MAJOR}" EXPORT_NAME "cpptrace" OUTPUT_NAME "cpptrace" + POSITION_INDEPENDENT_CODE ${CPPTRACE_POSITION_INDEPENDENT_CODE} ) # Header files generated by CMake diff --git a/README.md b/README.md index 66b7c11..ccfb0ed 100644 --- a/README.md +++ b/README.md @@ -898,6 +898,7 @@ Other useful configurations: the fault of your project. Defaults to On. - `CPPTRACE_INSTALL_CMAKEDIR`: Override for the installation path for the cmake configs. - `CPPTRACE_USE_EXTERNAL_LIBDWARF=On/Off`: Get libdwarf from `find_package` rather than `FetchContent`. +- `CPPTRACE_POSITION_INDEPENDENT_CODE=On/Off`: Compile the library as a position independent code (PIE). Defaults to On. Testing: - `CPPTRACE_BUILD_TESTING` Build small demo and test program diff --git a/cmake/OptionVariables.cmake b/cmake/OptionVariables.cmake index 022bfd8..5589a8d 100644 --- a/cmake/OptionVariables.cmake +++ b/cmake/OptionVariables.cmake @@ -164,6 +164,7 @@ option(CPPTRACE_CONAN "" OFF) option(CPPTRACE_VCPKG "" OFF) option(CPPTRACE_SANITIZER_BUILD "" OFF) option(CPPTRACE_WERROR_BUILD "" OFF) +option(CPPTRACE_POSITION_INDEPENDENT_CODE "" ON) mark_as_advanced( CPPTRACE_BACKTRACE_PATH