Author: rinrab
Date: Wed Jul 10 17:33:48 2024
New Revision: 1919103

URL: http://svn.apache.org/viewvc?rev=1919103&view=rev
Log:
On the 'cmake' branch: Use fake targets instead of variables for linking
against entire list of FS and RA modules instead of variables.

In CMake, there is a possibility to create a target and without compiling
it. This kind of targets is called `interface targets' and declared with
the INTERFACE keyword.

Previously, for the module targets the system with adding them to CMake
variables (SVN_RA_MODULES and SVN_FS_MODULES) was used. However with the
interface targets it is possible to create a library with the list of the
modules and then simply link against  them by using the
`target_link_libraries(<target_name> [fs|ra]-libs)` command. The additional
feature of them is to declare libraries in any order.

In this commit, the libraries for the modules will be introduced and the FS
and RA modules will be linked into them as INTERFACE. Additionally, the
libraries which use the modules, will link against `**-libs` targets instead
of the lists of the modules.

* build/generator/gen_cmake.py
  (Generator.write): Use **-libs instead of SVN_**_MODULES for the FS and RA
   modules.

* build/generator/templates/targets.cmake.ezt
  (lib targets): Link the modules into **-libs targets as INTERFACE, remove
   previous code for appending the name into list.

* CMakeLists.txt
  (): Create empty ra-libs and fs-libs interface targets.

Modified:
    subversion/branches/cmake/CMakeLists.txt
    subversion/branches/cmake/build/generator/gen_cmake.py
    subversion/branches/cmake/build/generator/templates/targets.cmake.ezt

Modified: subversion/branches/cmake/CMakeLists.txt
URL: 
http://svn.apache.org/viewvc/subversion/branches/cmake/CMakeLists.txt?rev=1919103&r1=1919102&r2=1919103&view=diff
==============================================================================
--- subversion/branches/cmake/CMakeLists.txt (original)
+++ subversion/branches/cmake/CMakeLists.txt Wed Jul 10 17:33:48 2024
@@ -304,6 +304,9 @@ if (NOT EXISTS "${CMAKE_SOURCE_DIR}/buil
   )
 endif()
 
+add_library(ra-libs INTERFACE)
+add_library(fs-libs INTERFACE)
+
 include("build/cmake/targets.cmake")
 
 if (SVN_BUILD_SVNXX)

Modified: subversion/branches/cmake/build/generator/gen_cmake.py
URL: 
http://svn.apache.org/viewvc/subversion/branches/cmake/build/generator/gen_cmake.py?rev=1919103&r1=1919102&r2=1919103&view=diff
==============================================================================
--- subversion/branches/cmake/build/generator/gen_cmake.py (original)
+++ subversion/branches/cmake/build/generator/gen_cmake.py Wed Jul 10 17:33:48 
2024
@@ -127,11 +127,11 @@ class Generator(gen_base.GeneratorBase):
           enable_condition.append("NOT BUILD_SHARED_LIBS")
       elif isinstance(target, gen_base.TargetRaModule):
         enable_condition.append("SVN_BUILD_" + get_module_name(target.name));
-        group = "SVN_RA_MODULES"
+        group = "ra-libs"
         build_type = "${SVN_RA_BUILD_TYPE}"
       elif isinstance(target, gen_base.TargetFsModule):
         enable_condition.append("SVN_BUILD_" + get_module_name(target.name));
-        group = "SVN_FS_MODULES"
+        group = "fs-libs"
         build_type = "${SVN_FS_BUILD_TYPE}"
       elif isinstance(target, gen_base.TargetApacheMod):
         pass
@@ -153,9 +153,9 @@ class Generator(gen_base.GeneratorBase):
         if isinstance(dep, gen_base.TargetLinked):
           if dep.external_lib:
             if dep.name == "ra-libs":
-              libs.append("${SVN_RA_MODULES}")
+              libs.append("ra-libs")
             elif dep.name == "fs-libs":
-              libs.append("${SVN_FS_MODULES}")
+              libs.append("fs-libs")
             elif dep.name in ["apriconv",
                               "apr_memcache",
                               "magic",

Modified: subversion/branches/cmake/build/generator/templates/targets.cmake.ezt
URL: 
http://svn.apache.org/viewvc/subversion/branches/cmake/build/generator/templates/targets.cmake.ezt?rev=1919103&r1=1919102&r2=1919103&view=diff
==============================================================================
--- subversion/branches/cmake/build/generator/templates/targets.cmake.ezt 
(original)
+++ subversion/branches/cmake/build/generator/templates/targets.cmake.ezt Wed 
Jul 10 17:33:48 2024
@@ -31,7 +31,7 @@ if ([targets.enable_condition])[is targe
   target_include_directories([targets.name] PUBLIC
     "${CMAKE_CURRENT_SOURCE_DIR}/subversion/include"
   )[if-any targets.group]
-  list(APPEND [targets.group] [targets.name])[end]
+  target_link_libraries([targets.group] INTERFACE [targets.name])[end]
   install(TARGETS [targets.name])
   [end][is targets.type "exe"]
   add_executable([targets.name][for targets.sources]


Reply via email to