Skip to content

Commit ba7ae83

Browse files
committed
Build: improve support for linking against static version of libxapian
1 parent 402fef1 commit ba7ae83

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ option(use_sys_spdlog "Use system spdlog library instead of the one bundled." O
3030
option(use_sys_fmt "Use system fmt library instead of the one bundled." OFF)
3131
option(use_sys_sqlite3 "Use system sqlite3 library instead of the one bundled." OFF)
3232
option(static_libclang "Link to a statically compiled version of LLVM/libclang." OFF)
33+
option(static_libxapian "Link to a statically compiled version of libxapian." OFF)
3334
option(win_static "Link with /MT in stead of /MD on windows" OFF)
3435
option(enable_console "Enable that executables on Windows get the CONSOLE bit set for the doxywizard executable [development]" OFF)
3536
option(enable_coverage "Enable coverage reporting for gcc/clang [development]" OFF)
@@ -219,6 +220,10 @@ if(POLICY CMP0063)
219220
cmake_policy(SET CMP0063 NEW)
220221
endif()
221222

223+
if(POLICY CMP0116)
224+
cmake_policy(SET CMP0116 NEW)
225+
endif()
226+
222227
# when using mutrace comment the next 3 lines and uncomment the last 2
223228
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
224229
set(CMAKE_C_VISIBILITY_PRESET hidden)

addon/doxysearch/CMakeLists.txt

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
find_package(xapian REQUIRED)
1+
find_package(XAPIAN REQUIRED)
22
find_package(ZLIB REQUIRED)
33

4-
if (WIN32)
5-
set(WIN_EXTRA_LIBS uuid rpcrt4 ws2_32)
4+
if(WIN32)
5+
set(EXTRA_LIBS uuid rpcrt4 ws2_32)
6+
elseif(static_libxapian)
7+
set(EXTRA_LIBS uuid)
8+
if(UUID_LIB)
9+
add_library(uuid STATIC IMPORTED)
10+
set_target_properties(uuid PROPERTIES IMPORTED_LOCATION "${UUID_LIB}")
11+
endif()
612
endif()
713

814
include_directories(
@@ -17,9 +23,10 @@ add_executable(doxyindexer
1723
)
1824

1925
target_link_libraries(doxyindexer
26+
PRIVATE
2027
${XAPIAN_LIBRARIES}
2128
${ZLIB_LIBRARIES}
22-
${WIN_EXTRA_LIBS}
29+
${EXTRA_LIBS}
2330
${COVERAGE_LINKER_FLAGS}
2431
doxygen_version
2532
xml
@@ -31,10 +38,11 @@ add_executable(doxysearch.cgi
3138
)
3239

3340
target_link_libraries(doxysearch.cgi
41+
PRIVATE
3442
doxygen_version
3543
${XAPIAN_LIBRARIES}
3644
${ZLIB_LIBRARIES}
37-
${WIN_EXTRA_LIBS}
45+
${EXTRA_LIBS}
3846
)
3947

4048
include(ApplyEditbin)

0 commit comments

Comments
 (0)