On 11. 6. 25 00:00, rin...@apache.org wrote:
Author: rinrab
Date: Tue Jun 10 22:00:42 2025
New Revision: 1926349

URL:http://svn.apache.org/viewvc?rev=1926349&view=rev
Log:
cmake: Support apr-2.

* build/cmake/FindAPR.cmake
   (APR_INCLUDE_DIR): Also check apr-2 directory.
   (version): Read it just after include dir and default it to 1.0.0 version
    file not found.
   (APR_LIBRARY_SHARED, APR_LIBRARY_STATIC, APR_DLL): Use APR_MAJOR_VERSION
    to determine suffix.
* build/cmake/FindSerf.cmake: Look for apr-util only if apr version is not '2'.
* CMakeLists.txt
   (APR): Merge apr and apr-util sections, support apr-2 (which also ignores
    apr-util library). In pkg-config branch we check for different names of
    the config, while module branch adds apr-util only if apr version is
    not '2'.

Modified:
     subversion/trunk/CMakeLists.txt
     subversion/trunk/build/cmake/FindAPR.cmake
     subversion/trunk/build/cmake/FindSerf.cmake

Modified: subversion/trunk/CMakeLists.txt
URL:http://svn.apache.org/viewvc/subversion/trunk/CMakeLists.txt?rev=1926349&r1=1926348&r2=1926349&view=diff
==============================================================================
--- subversion/trunk/CMakeLists.txt (original)
+++ subversion/trunk/CMakeLists.txt Tue Jun 10 22:00:42 2025
@@ -260,24 +260,33 @@ if(SVN_USE_PKG_CONFIG)
    find_package(PkgConfig REQUIRED)
  endif()
-### APR
+### APR and APR-Util
if(SVN_USE_PKG_CONFIG)
-  pkg_check_modules(apr-1 REQUIRED IMPORTED_TARGET apr-1)
-  add_library(external-apr ALIAS PkgConfig::apr-1)
+  pkg_check_modules(apr IMPORTED_TARGET apr-1)
+
+  if(apr_FOUND)
+    # apr-1
+    add_library(external-apr ALIAS PkgConfig::apr)
+
+    pkg_check_modules(aprutil-1 REQUIRED IMPORTED_TARGET apr-util-1)
+    add_library(external-aprutil ALIAS PkgConfig::aprutil-1)
+  else()
+    # apr-2
+    pkg_check_modules(apr REQUIRED IMPORTED_TARGET apr-2)
+    add_library(external-apr ALIAS PkgConfig::apr)
+    add_library(external-aprutil ALIAS PkgConfig::apr)
+  endif()
  else()
    find_package(APR REQUIRED)
    add_library(external-apr ALIAS apr::apr)
-endif()
-### APR-Util
-
-if(SVN_USE_PKG_CONFIG)
-  pkg_check_modules(aprutil-1 REQUIRED IMPORTED_TARGET apr-util-1)
-  add_library(external-aprutil ALIAS PkgConfig::aprutil-1)
-else()
-  find_package(APRUtil REQUIRED)
-  add_library(external-aprutil ALIAS apr::aprutil)
+  if(APR_MAJOR_VERSION EQUAL 2)
+    add_library(external-aprutil ALIAS apr::apr)


Should be "major version greater than 1"


[...]

The more I look at this, the more I'm convinced that if we use serf, we should also use the same apr and apr-util as Serf does. It's an edge case, though.

-- Brane

Reply via email to