On 8. 6. 25 10:26, br...@apache.org wrote:
Author: brane
Date: Sun Jun  8 08:26:12 2025
New Revision: 1926244

URL:http://svn.apache.org/viewvc?rev=1926244&view=rev
Log:
Teach the CMake build to find serf-2, and use the paths defined in the
GNUInstallDirs module, because that's where Serf's CMake build installs
the build artefacts.

* build/cmake/FindSerf.cmake: Include and use GNUInstallDirs.
   (Serf_INCLUDE_DIR): Look for headers in the serf-2 subdirectory.
   (Serf_LIBRARY): Look for the serf-2 library first.

Modified:
     subversion/trunk/build/cmake/FindSerf.cmake

Modified: subversion/trunk/build/cmake/FindSerf.cmake
URL:http://svn.apache.org/viewvc/subversion/trunk/build/cmake/FindSerf.cmake?rev=1926244&r1=1926243&r2=1926244&view=diff
==============================================================================
--- subversion/trunk/build/cmake/FindSerf.cmake (original)
+++ subversion/trunk/build/cmake/FindSerf.cmake Sun Jun  8 08:26:12 2025
@@ -19,16 +19,22 @@
  # FindSerf.cmake -- CMake module for Serf library
  #
+include(GNUInstallDirs)
+
  find_path(Serf_INCLUDE_DIR
    NAMES serf.h
    PATH_SUFFIXES
      include
+    "${CMAKE_INSTALL_INCLUDEDIR}"
+    include/serf-2
+    "${CMAKE_INSTALL_INCLUDEDIR}/serf-2"
      include/serf-1
+    "${CMAKE_INSTALL_INCLUDEDIR}/serf-1"
  )
find_library(Serf_LIBRARY
-  NAMES serf-1
-  PATH_SUFFIXES lib
+  NAMES serf-2 serf-1
+  PATH_SUFFIXES lib "${CMAKE_INSTALL_LIBDIR}"
  )


So, it turns out that the CMake build is fundamentally broken, due to the way that CMake gloms include directories onto (imported) targets. I was testing this change against an installed serf-2 on macOS, and parts of the build kept failing due to a missing apr_xlate.h header. But it had found apr-util...

The reason, it turned out, was that on macOS with Homebrew, apr-util's include path is different from apr's.

We're including apr_xlate.h for a couple of macros in subversion/include/svn_utf.h, we need /only/ the header, not the whole library. But CMake in its wisdom doesn't make the include path available unless the target its building /links/ with apr-util. This is just plain (censored) and wrong. Sure we can patch build.conf to make this issue go away; but we won't. See below, I had to do this to get even a minimal build working; none of the targets I had to add the apr-util dependency to actually uses anything from libaprutil. Such a change is therefore not acceptable.

I suggest the only correct way to fix this is to add the include paths of all our dependencies to include_directories(), just like the autotools build does (and the gen-make.py-based Visual Studio build does, too). Either that, or declare that for CMake, you must have all dependencies installed in the same prefix; but then what's the use of having a CMake build in the first place?

-- Brane


P.S.: At least the (finally) built svn with serf-2, both built with CMake, actually works on https://svn.apache.org/repos/asf/.

--

Index: ./build.conf
===================================================================
--- ./build.conf        (revision 1926243)
+++ ./build.conf        (working copy)
@@ -147,7 +147,7 @@
 type = exe
 path = subversion/svn
 libs = libsvn_client libsvn_wc libsvn_ra libsvn_delta libsvn_diff libsvn_subr
-       apriconv apr
+       aprutil apriconv apr
 manpages = subversion/svn/svn.1
 install = bin
 msvc-libs = wsetargv.obj
@@ -159,7 +159,7 @@
 path = subversion/svnadmin
 install = bin
 manpages = subversion/svnadmin/svnadmin.1
-libs = libsvn_repos libsvn_fs libsvn_delta libsvn_subr apriconv apr
+libs = libsvn_repos libsvn_fs libsvn_delta libsvn_subr aprutil apriconv apr
 msvc-libs = wsetargv.obj
# The subversion repository dump filtering tool
@@ -169,7 +169,7 @@
 path = subversion/svndumpfilter
 install = bin
 manpages = subversion/svndumpfilter/svndumpfilter.1
-libs = libsvn_repos libsvn_fs libsvn_delta libsvn_subr apriconv apr
+libs = libsvn_repos libsvn_fs libsvn_delta libsvn_subr aprutil apriconv apr
# The subversion repository inspection tool
 [svnlook]
@@ -178,7 +178,8 @@
 path = subversion/svnlook
 install = bin
 manpages = subversion/svnlook/svnlook.1
-libs = libsvn_repos libsvn_fs libsvn_delta libsvn_diff libsvn_subr apriconv apr
+libs = libsvn_repos libsvn_fs libsvn_delta libsvn_diff libsvn_subr
+       aprutil apriconv apr
[svnserve]
 description = Subversion Server
@@ -187,7 +188,7 @@
 install = bin
 manpages = subversion/svnserve/svnserve.8 subversion/svnserve/svnserve.conf.5
 libs = libsvn_repos libsvn_fs libsvn_delta libsvn_subr libsvn_ra_svn
-       apriconv apr aprutil sasl
+       aprutil apriconv apr sasl
 msvc-libs = advapi32.lib ws2_32.lib
[svnsync]
@@ -194,7 +195,7 @@
 description = Subversion repository replicator
 type = exe
 path = subversion/svnsync
-libs = libsvn_ra libsvn_delta libsvn_subr apr
+libs = libsvn_ra libsvn_delta libsvn_subr aprutil apr
 install = bin
 manpages = subversion/svnsync/svnsync.1
@@ -202,7 +203,7 @@
 description = Subversion Revision Extractor
 type = exe
 path = subversion/svnversion
-libs = libsvn_wc libsvn_subr apriconv apr
+libs = libsvn_wc libsvn_subr aprutil apriconv apr
 install = bin
 manpages = subversion/svnversion/svnversion.1
@@ -210,7 +211,8 @@
 description = Subversion remote repository dumper and loader
 type = exe
 path = subversion/svnrdump
-libs = libsvn_client libsvn_ra libsvn_repos libsvn_delta libsvn_subr aprutil 
apr
+libs = libsvn_client libsvn_ra libsvn_repos libsvn_delta libsvn_subr
+       aprutil apriconv apr
 install = bin
 manpages = subversion/svnrdump/svnrdump.1
@@ -218,7 +220,8 @@
 description = Subversion Multiple URL Command Client
 type = exe
 path = subversion/svnmucc
-libs = libsvn_client libsvn_ra libsvn_subr libsvn_delta apriconv apr
+libs = libsvn_client libsvn_ra libsvn_subr libsvn_delta
+       aprutil apriconv apr
 install = bin
 manpages = subversion/svnmucc/svnmucc.1
@@ -244,7 +247,7 @@
 description = Subversion Client Library
 type = lib
 path = subversion/libsvn_client
-libs = libsvn_wc libsvn_ra libsvn_delta libsvn_diff libsvn_subr apriconv apr
+libs = libsvn_wc libsvn_ra libsvn_delta libsvn_diff libsvn_subr aprutil 
apriconv apr
 install = lib
 msvc-export = svn_client.h private/svn_client_mtcc.h 
private/svn_client_private.h
               private/svn_client_shelf.h private/svn_client_shelf2.h
@@ -264,7 +267,7 @@
 description = Subversion Diff Library
 type = lib
 path = subversion/libsvn_diff
-libs = libsvn_subr apriconv apr zlib
+libs = libsvn_subr aprutil apriconv apr zlib
 install = lib
 msvc-export = svn_diff.h private/svn_diff_private.h private/svn_diff_tree.h
@@ -383,7 +386,7 @@
 type = lib
 path = subversion/libsvn_repos
 install = ramod-lib
-libs = libsvn_fs libsvn_delta libsvn_subr apriconv apr
+libs = libsvn_fs libsvn_delta libsvn_subr aprutil apriconv apr
 msvc-export = svn_repos.h  private/svn_repos_private.h ../libsvn_repos/authz.h
# Low-level grab bag of utilities
@@ -466,7 +469,7 @@
 type = exe
 path = subversion/svnfsfs
 install = bin
-libs = libsvn_repos libsvn_fs libsvn_delta libsvn_subr apriconv apr
+libs = libsvn_repos libsvn_fs libsvn_delta libsvn_subr aprutil apriconv apr
 msvc-libs = ws2_32.lib
# ----------------------------------------------------------------------------
@@ -1667,7 +1670,7 @@
 path = tools/diff
 sources = diff.c
 install = tools
-libs = libsvn_diff libsvn_subr apriconv apr
+libs = libsvn_diff libsvn_subr aprutil apriconv apr
[diff3]
 type = exe
@@ -1674,7 +1677,7 @@
 path = tools/diff
 sources = diff3.c
 install = tools
-libs = libsvn_diff libsvn_subr apriconv apr
+libs = libsvn_diff libsvn_subr aprutil apriconv apr
[diff4]
 type = exe
@@ -1681,7 +1684,7 @@
 path = tools/diff
 sources = diff4.c
 install = tools
-libs = libsvn_diff libsvn_subr apriconv apr
+libs = libsvn_diff libsvn_subr aprutil apriconv apr
[svnbench]
 description = Benchmarking and diagnostics tool for the network layer
@@ -1689,7 +1692,7 @@
 path = subversion/svnbench
 install = bin
 libs = libsvn_client libsvn_wc libsvn_ra libsvn_subr libsvn_delta
-       apriconv apr
+       aprutil apriconv apr
[svnauthz]
 description = Authz config file tool

Reply via email to