On 2026/03/20 6:06, [email protected] wrote:
> Author: rinrab
> Date: Thu Mar 19 21:06:44 2026
> New Revision: 1932395
> 
> Log:
> cmake: Use newer sqlite targets due to deprecation.
> 
> In cmake 4.3, the standard module to locate the sqlite library, changed names
> of its exported targets. I have a lot to say, but I would prefer to stay quite
> about that.
> 
> Fixed by updating target that we use, with a code to handle older cmake
> versions.
> 
> * CMakeLists.txt
>   (sqlite): Use new targets.
> 
> Modified:
>    subversion/trunk/CMakeLists.txt
> 
> Modified: subversion/trunk/CMakeLists.txt
> ==============================================================================
> --- subversion/trunk/CMakeLists.txt   Thu Mar 19 20:57:55 2026        
> (r1932394)
> +++ subversion/trunk/CMakeLists.txt   Thu Mar 19 21:06:44 2026        
> (r1932395)
> @@ -360,7 +360,14 @@ else()
>    find_package(SQLite3)
>  
>    if(SQLite3_FOUND)
> -    add_library(external-sqlite ALIAS SQLite::SQLite3)
> +    # Support for CMake < 4.3
> +    # In prior versions of cmake, the sqlite targets were exported in the
> +    # SQLite namespace, which was then changed to SQLite3.
> +    if(NOT TARGET SQLite3::SQLite3)
> +      add_library(SQLite3::SQLite3 ALIAS SQLite::SQLite3)
> +    endif()
> +
> +    add_library(external-sqlite ALIAS SQLite3::SQLite3)
>    else()
>      find_package(SQLiteAmalgamation REQUIRED)
>      add_library(external-sqlite ALIAS SQLite::SQLite3Amalgamation)
> 

After r1932395, builds using cmake on Windows are failing due to the
following error [1]:

[[[
-- Found SQLite3: C:/vcpkg/installed/x64-windows/include (found version 
"3.51.2")
CMake Error at C:/vcpkg/scripts/buildsystems/vcpkg.cmake:653 (_add_library):
  _add_library cannot create ALIAS target "external-sqlite" because target
  "SQLite3::SQLite3" is itself an ALIAS.
Call Stack (most recent call first):
  CMakeLists.txt:370 (add_library)
]]]

CMake on windows-latest image (windows-2025) is 3.31.6, however the
changes are not working as expected.

Proposed fix:

[[[
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f71c95337..a920cbc9a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -349,12 +349,12 @@ else()
   if(SQLite3_FOUND)
     # Support for CMake < 4.3
     # In prior versions of cmake, the sqlite targets were exported in the
-    # SQLite namespace, which was then changed to SQLite3.
-    if(NOT TARGET SQLite3::SQLite3)
-      add_library(SQLite3::SQLite3 ALIAS SQLite::SQLite3)
+    # SQLite namespace.
+    if(TARGET SQLite3::SQLite3)
+      add_library(external-sqlite ALIAS SQLite3::SQLite3)
+    else()
+      add_library(external-sqlite ALIAS SQLite::SQLite3)
     endif()
-
-    add_library(external-sqlite ALIAS SQLite3::SQLite3)
   else()
     find_package(SQLiteAmalgamation REQUIRED)
     add_library(external-sqlite ALIAS SQLite::SQLite3Amalgamation)
]]]


[1] 
https://github.com/apache/subversion/actions/runs/23316955539/job/67819718566#step:12:205

-- 
Jun Omae <[email protected]> (大前 潤)

Reply via email to