Author: rinrab
Date: Wed Jul 10 22:05:02 2024
New Revision: 1919108

URL: http://svn.apache.org/viewvc?rev=1919108&view=rev
Log:
On the 'cmake' branch: Install executable targets.

* build/generator/gen_cmake.py
  (cmake_target): Add the install_target field.
  (Generator.write): Initialize the install_target variable and pass it to
   the ezt template.

* build/generator/templates/targets.cmake.ezt
  (libs): Remove install; instead it is added globally under condition.
  (): Install target if install_target is true.

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

Modified: subversion/branches/cmake/build/generator/gen_cmake.py
URL: 
http://svn.apache.org/viewvc/subversion/branches/cmake/build/generator/gen_cmake.py?rev=1919108&r1=1919107&r2=1919108&view=diff
==============================================================================
--- subversion/branches/cmake/build/generator/gen_cmake.py (original)
+++ subversion/branches/cmake/build/generator/gen_cmake.py Wed Jul 10 22:05:02 
2024
@@ -33,7 +33,7 @@ class cmake_target():
   def __init__(self, name: str, type: str, sources,
                libs, msvc_libs, msvc_objects, msvc_export,
                enable_condition, group: str, build_type: str,
-               description: str, srcdir: str):
+               description: str, srcdir: str, install_target: bool):
     self.name = name
     self.type = type
     self.sources = sources
@@ -52,6 +52,7 @@ class cmake_target():
     self.build_type = build_type
     self.description = description
     self.srcdir = srcdir
+    self.install_target = ezt.boolean(install_target)
 
 def get_target_type(target: gen_base.Target):
   if isinstance(target, gen_base.TargetExe):
@@ -186,6 +187,11 @@ class Generator(gen_base.GeneratorBase):
           else:
             msvc_libs.append(lib)
 
+        if isinstance(target, gen_base.TargetLib) or target.install == "bin":
+          install_target = True
+        else:
+          install_target = False
+
         new_target = cmake_target(
           name = target.name,
           type = target_type,
@@ -199,6 +205,7 @@ class Generator(gen_base.GeneratorBase):
           build_type = build_type,
           description = target.desc,
           srcdir = target.path,
+          install_target = install_target,
         )
 
         targets.append(new_target)

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=1919108&r1=1919107&r2=1919108&view=diff
==============================================================================
--- subversion/branches/cmake/build/generator/templates/targets.cmake.ezt 
(original)
+++ subversion/branches/cmake/build/generator/templates/targets.cmake.ezt Wed 
Jul 10 22:05:02 2024
@@ -32,7 +32,6 @@ if ([targets.enable_condition])[is targe
     "${CMAKE_CURRENT_SOURCE_DIR}/subversion/include"
   )[if-any targets.group]
   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]
     [targets.sources][end]
@@ -57,6 +56,7 @@ if ([targets.enable_condition])[is targe
   )
   if (WIN32)
     target_sources([targets.name] PRIVATE build/win32/svn.rc)
-  endif()
+  endif()[if-any targets.install_target]
+  install(TARGETS [targets.name])[end]
 endif()
 [end]


Reply via email to