This is an automated email from the ASF dual-hosted git repository.
swebb2066 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git
The following commit(s) were added to refs/heads/master by this push:
new f1512107 Restore ability to statically link apr and apr-util libraries
(#136)
f1512107 is described below
commit f1512107532bd72d3eed49dcd474f1aaa1bc5407
Author: Stephen Webb <[email protected]>
AuthorDate: Sun Oct 2 13:24:25 2022 +1100
Restore ability to statically link apr and apr-util libraries (#136)
* Restores the documented behaviour of APR_STATIC and APU_STATIC
---
src/cmake/FindAPR-Util.cmake | 9 ++++++++-
src/cmake/FindAPR.cmake | 14 +++++++++++++-
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/src/cmake/FindAPR-Util.cmake b/src/cmake/FindAPR-Util.cmake
index ccc5e945..47e5ed64 100644
--- a/src/cmake/FindAPR-Util.cmake
+++ b/src/cmake/FindAPR-Util.cmake
@@ -27,15 +27,22 @@ macro(_apu_invoke _varname)
endif(_apr_failed)
endmacro(_apu_invoke)
+if(NOT APU_STATIC) # apu-1-config does not yet support --static used in
FindPkgConfig.cmake
find_package(PkgConfig)
pkg_check_modules(APR_UTIL apr-util-1)
+endif()
if(APR_UTIL_FOUND)
find_path(APR_UTIL_INCLUDE_DIR
NAMES apu.h
HINTS ${APR_UTIL_INCLUDE_DIRS}
PATH_SUFFIXES apr-1)
- set(APR_UTIL_LIBRARIES ${APR_UTIL_LINK_LIBRARIES})
+ if (APU_STATIC OR NOT BUILD_SHARED_LIBS)
+ set(APR_UTIL_COMPILE_DEFINITIONS APU_DECLARE_STATIC)
+ set(APR_UTIL_LIBRARIES ${APR_UTIL_STATIC_LINK_LIBRARIES})
+ else()
+ set(APR_UTIL_LIBRARIES ${APR_UTIL_LINK_LIBRARIES})
+ endif()
else()
find_program(APR_UTIL_CONFIG_EXECUTABLE
apu-1-config
diff --git a/src/cmake/FindAPR.cmake b/src/cmake/FindAPR.cmake
index 84560a70..e3f4c98f 100644
--- a/src/cmake/FindAPR.cmake
+++ b/src/cmake/FindAPR.cmake
@@ -25,15 +25,27 @@ macro(_apr_invoke _varname)
endif(_apr_failed)
endmacro(_apr_invoke)
+if(NOT APR_STATIC) # apr-1-config does not support --static used in
FindPkgConfig.cmake
find_package(PkgConfig)
pkg_check_modules(APR apr-1)
+endif()
if(APR_FOUND)
find_path(APR_INCLUDE_DIR
NAMES apr.h
HINTS ${APR_INCLUDE_DIRS}
PATH_SUFFIXES apr-1)
- set(APR_LIBRARIES ${APR_LINK_LIBRARIES})
+ if (APR_STATIC OR NOT BUILD_SHARED_LIBS)
+ set(APR_COMPILE_DEFINITIONS APR_DECLARE_STATIC)
+ set(APR_LIBRARIES ${APR_STATIC_LINK_LIBRARIES})
+ if(WIN32)
+ set(APR_SYSTEM_LIBS ws2_32 mswsock rpcrt4)
+ else()
+ set(APR_SYSTEM_LIBS pthread)
+ endif()
+ else()
+ set(APR_LIBRARIES ${APR_LINK_LIBRARIES})
+ endif()
else()
find_program(APR_CONFIG_EXECUTABLE
apr-1-config