Den ons 24 sep. 2025 kl 14:54 skrev Graf László <[email protected]>:

> Hi,
> I am working on an APR based project, built using GNU make.
> But now, besides feature and bug issues, I have one to introduce a CMake
> based build. This needs a dedicated package finder for APR.
>
> And here comes the serf, it has one for ARP. Reading the CMakeLists.txt I
> noticed that it is enough to set APR_HOME and it will use the installed APR
> library.
>
> But, unfortunately, even with APR_ROOT set, I get errors during the build.
>

What are the exact error messages you get and what does your install layout
look like?


>
> Checking the FindAPRE.cmake, I can see that it gets the directory of the
> set APR_ROOT but it doesn't use it later (ex. in _apru_find_win_version.
> etc).
>

Since r1926254 we don't explicitly rely on APR_ROOT: "Instead, rely on
CMake's find_package default behaviour" (quoted from svn log).

The CMake documentation[1] states that, from version 3.12,
<PackageName>_ROOT CMake variable is the first default search path of
find_path(). So it seems to me that CMake would include APR_ROOT
automatically.


> In my opinion, all those functions, where find_path is called, should add
> this APR_ROOT as an additional search path, in case of a defined APR_ROOT:
>
> find_path(${_include_varname} "${_header_basename}.h"
>     PATHS
>         "${APR_ROOT}"
>     PATH_SUFFIXES
>         "include"
>         "${CMAKE_INSTALL_INCLUDEDIR}"
>         "include/apr-2"
>         "${CMAKE_INSTALL_INCLUDEDIR}/apr-2"
>         "include/apr-1"
>         "${CMAKE_INSTALL_INCLUDEDIR}/apr-1"
> )
>
> Remais one single, maybe rhetorical, question. Why does serf define this
> package finder and not the APR itself?
>

Because APR doesn't include a Find-module yet. Personally, I'd love to see
it included there instead.


>
> Best regards,
> Laszlo Graf
>

Cheers,
Daniel

[1] https://cmake.org/cmake/help/v3.31/command/find_path.html

Reply via email to