Author: rinrab
Date: Fri Jul  5 15:20:08 2024
New Revision: 1918943

URL: http://svn.apache.org/viewvc?rev=1918943&view=rev
Log:
On the 'cmake' branch: Use more correct way to setup include directories.

Before, the include directories were setting up by using the
SVN_INCLUDE_DIRECTORIES variable, which had a list of them to add
to each target.

This approach is not correct, because the targets also have private
include directories publicly set. The better way is to add the private include
directories globally for all targets using include_directories() command
and setup public include directories for each library target using the
target_include_directories() command with PUBLIC keyword. Also, in feature
the targets will be exported as CMake configs and they should not contain
private headers.

Private include directories is a directory with svn_private_config.h
file. This file is configured directly to binary directory.

* build/generator/templates/targets.cmake.ezt
  (include directories): Use ./subversion/include as include directory instead
   of using the SVN_INCLUDE_DIRECTORIES variable for them.

* CMakeLists.txt
  (SVN_INCLUDE_DIRECTORIES): Remove variable.
  (include directories): Add ${CMAKE_CURRENT_BINARY_DIR} to theirs global
   and private list.
                
           
           

Modified:
    subversion/branches/cmake/CMakeLists.txt
    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=1918943&r1=1918942&r2=1918943&view=diff
==============================================================================
--- subversion/branches/cmake/CMakeLists.txt (original)
+++ subversion/branches/cmake/CMakeLists.txt Fri Jul  5 15:20:08 2024
@@ -178,10 +178,7 @@ function(target_exports target_name)
   endif()
 endfunction()
 
-set(SVN_INCLUDE_DIRECTORIES
-  "${CMAKE_CURRENT_SOURCE_DIR}/subversion/include"
-  "${CMAKE_CURRENT_BINARY_DIR}"
-)
+include_directories(PRIVATE "${CMAKE_CURRENT_BINARY_DIR}")
 
 if (WIN32)
   add_compile_definitions(

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=1918943&r1=1918942&r2=1918943&view=diff
==============================================================================
--- subversion/branches/cmake/build/generator/templates/targets.cmake.ezt 
(original)
+++ subversion/branches/cmake/build/generator/templates/targets.cmake.ezt Fri 
Jul  5 15:20:08 2024
@@ -28,7 +28,9 @@ if ([targets.enable_condition])[is targe
   target_exports([targets.name][for targets.msvc_export]
     [targets.msvc_export][end]
   )[end]
-  target_include_directories([targets.name] PUBLIC 
${SVN_INCLUDE_DIRECTORIES})[if-any targets.group]
+  target_include_directories([targets.name] PUBLIC
+    "${CMAKE_CURRENT_SOURCE_DIR}/subversion/include"
+  )[if-any targets.group]
   list(APPEND [targets.group] [targets.name])[end]
   [end][is targets.type "exe"]
   add_executable([targets.name][for targets.sources]


Reply via email to