Skip to content

Commit dd57ef4

Browse files
authored
[Backport 9.8] CMake: handle deprecated SQLite::SQLite3 target (#4694)
- CMake >= 4.3 deprecates the `SQLite::SQLite3` target (see [FindSQLite3.html](https://cmake.org/cmake/help/latest/module/FindSQLite3.html)) - using today's CMake 4.3.0-rc2, with Visual Studio, and PROJ master, gives the following warnings: ``` CMake Warning (dev) at src/lib_proj.cmake:596 (target_link_libraries): The library that is being linked to, SQLite::SQLite3, is marked as being deprecated by the owner. The message provided by the developer is: The target name SQLite::SQLite3 is deprecated. Please use SQLite3::SQLite3 instead. ```
1 parent d447c26 commit dd57ef4

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,11 @@ endif()
240240

241241
find_package(SQLite3 REQUIRED)
242242

243+
if(NOT TARGET SQLite3::SQLite3) # CMake < 4.3
244+
set_target_properties(SQLite::SQLite3 PROPERTIES IMPORTED_GLOBAL TRUE)
245+
add_library(SQLite3::SQLite3 ALIAS SQLite::SQLite3)
246+
endif()
247+
243248
# Would build and run with older versions, but with horrible performance
244249
# See https://github.com/OSGeo/PROJ/issues/1718
245250
if(SQLite3_VERSION VERSION_LESS "3.11")

src/lib_proj.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ if(Threads_FOUND AND CMAKE_USE_PTHREADS_INIT)
593593
target_link_libraries(proj PRIVATE ${CMAKE_THREAD_LIBS_INIT})
594594
endif()
595595

596-
target_link_libraries(proj PRIVATE SQLite::SQLite3)
596+
target_link_libraries(proj PRIVATE SQLite3::SQLite3)
597597

598598
if(NLOHMANN_JSON STREQUAL "external")
599599
target_compile_definitions(proj PRIVATE EXTERNAL_NLOHMANN_JSON)

test/unit/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ set_property(SOURCE ${PROJ_TEST_CPP_API_SOURCES} PROPERTY SKIP_UNITY_BUILD_INCLU
179179

180180
target_link_libraries(proj_test_cpp_api
181181
PRIVATE GTest::gtest
182-
PRIVATE SQLite::SQLite3
182+
PRIVATE SQLite3::SQLite3
183183
PRIVATE ${PROJ_LIBRARIES})
184184
add_test(NAME proj_test_cpp_api COMMAND proj_test_cpp_api)
185185
set_property(TEST proj_test_cpp_api
@@ -218,7 +218,7 @@ if(CURL_ENABLED)
218218
endif()
219219
target_link_libraries(test_network
220220
PRIVATE GTest::gtest
221-
PRIVATE SQLite::SQLite3
221+
PRIVATE SQLite3::SQLite3
222222
PRIVATE ${PROJ_LIBRARIES})
223223
if(TIFF_ENABLED)
224224
add_test(NAME test_network COMMAND test_network)

0 commit comments

Comments
 (0)