diff --git a/library/src/main/cpp/CMakeLists.txt b/library/src/main/cpp/CMakeLists.txt index 7ea4583..691fd4d 100644 --- a/library/src/main/cpp/CMakeLists.txt +++ b/library/src/main/cpp/CMakeLists.txt @@ -13,6 +13,8 @@ set(CMAKE_CXX_VISIBILITY_PRESET hidden) set(CMAKE_C_VISIBILITY_PRESET hidden) set(CMAKE_VISIBILITY_INLINES_HIDDEN ON) +option(FAKELINKER_INSTALL_PRIVATE_HEADERS "Install private header files for static linking" OFF) + if(NOT ${CMAKE_BUILD_TYPE} STREQUAL "Debug") set(CMAKE_BUILD_TYPE "Release") endif() @@ -99,7 +101,6 @@ target_include_directories(fakelinker_static PUBLIC ) target_link_libraries(fakelinker_static ${log-lib}) - add_library(fakelinker SHARED linker/linker_dynamic.cpp ) @@ -117,7 +118,6 @@ set_target_properties(fakelinker PROPERTIES "${LINK_FLAGS} -Wl,--gc-sections,-s,--version-script=\"${CMAKE_CURRENT_SOURCE_DIR}/symbol.map.txt\"" ) - install(TARGETS fakelinker fakelinker_static EXPORT fakelinker ) @@ -126,6 +126,13 @@ install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/fakelinker/fakelinker ) +if(FAKELINKER_INSTALL_PRIVATE_HEADERS) + install(DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/linker" + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/fakelinker/fakelinker + FILES_MATCHING PATTERN "*.h" + ) +endif() + install(EXPORT fakelinker FILE fakelinker-config.cmake NAMESPACE fakelinker::