Skip to content

Commit 4ebcbff

Browse files
feat: add support for installing private header files
1 parent 41548b7 commit 4ebcbff

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

library/src/main/cpp/CMakeLists.txt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ set(CMAKE_CXX_VISIBILITY_PRESET hidden)
1313
set(CMAKE_C_VISIBILITY_PRESET hidden)
1414
set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)
1515

16+
option(FAKELINKER_INSTALL_PRIVATE_HEADERS "Install private header files for static linking" OFF)
17+
1618
if(NOT ${CMAKE_BUILD_TYPE} STREQUAL "Debug")
1719
set(CMAKE_BUILD_TYPE "Release")
1820
endif()
@@ -99,7 +101,6 @@ target_include_directories(fakelinker_static PUBLIC
99101
)
100102
target_link_libraries(fakelinker_static ${log-lib})
101103

102-
103104
add_library(fakelinker SHARED
104105
linker/linker_dynamic.cpp
105106
)
@@ -117,7 +118,6 @@ set_target_properties(fakelinker PROPERTIES
117118
"${LINK_FLAGS} -Wl,--gc-sections,-s,--version-script=\"${CMAKE_CURRENT_SOURCE_DIR}/symbol.map.txt\""
118119
)
119120

120-
121121
install(TARGETS fakelinker fakelinker_static
122122
EXPORT fakelinker
123123
)
@@ -126,6 +126,13 @@ install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/
126126
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/fakelinker/fakelinker
127127
)
128128

129+
if(FAKELINKER_INSTALL_PRIVATE_HEADERS)
130+
install(DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/linker"
131+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/fakelinker/fakelinker
132+
FILES_MATCHING PATTERN "*.h"
133+
)
134+
endif()
135+
129136
install(EXPORT fakelinker
130137
FILE fakelinker-config.cmake
131138
NAMESPACE fakelinker::

0 commit comments

Comments
 (0)