Skip to content

Commit 5ffd721

Browse files
committed
Fixed aliasing an imported target on CMake versions older than 3.18.
1 parent 560be40 commit 5ffd721

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,15 @@ endif()
241241
find_package(SQLite3 3.11 REQUIRED)
242242

243243
if(NOT TARGET SQLite3::SQLite3) # CMake < 4.3
244+
# Remove after CMake version bump to 3.18+
245+
get_target_property(IS_SQLITE3_IMPORTED SQLite::SQLite3 IMPORTED)
246+
if(IS_SQLITE3_IMPORTED AND CMAKE_VERSION VERSION_LESS "3.18")
247+
set_target_properties(SQLite::SQLite3 PROPERTIES IMPORTED_GLOBAL TRUE)
248+
message(DEPRECATION "If your project consumes PROJ as a subdirectory \
249+
and also uses either the SQLite3::SQLite3 or SQLite::SQLite3 target, \
250+
make sure you have your own call to find_package.\nThese targets \
251+
will no longer be available to the global CMake scope once PROJ bumps to CMake v3.18+.")
252+
endif()
244253
add_library(SQLite3::SQLite3 ALIAS SQLite::SQLite3)
245254
endif()
246255

0 commit comments

Comments
 (0)