Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ add_library(sqlite_orm INTERFACE)
add_library(sqlite_orm::sqlite_orm ALIAS sqlite_orm)

find_package(SQLite3 REQUIRED)
target_link_libraries(sqlite_orm INTERFACE SQLite::SQLite3)
if(NOT TARGET SQLite3::SQLite3)
add_library(SQLite3::SQLite3 ALIAS SQLite::SQLite3)
endif()
target_link_libraries(sqlite_orm INTERFACE SQLite3::SQLite3)

target_sources(sqlite_orm INTERFACE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/sqlite_orm/sqlite_orm.h>)

Expand Down
3 changes: 3 additions & 0 deletions cmake/SqliteOrmConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
include(CMakeFindDependencyMacro)
find_dependency(SQLite3)
if(NOT TARGET SQLite3::SQLite3) # CMake < 4.3

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't need this in the import target cmake file. It's not sqlite_orm's responsibility to alias SQLite3 for consumers of sqlite_orm.

add_library(SQLite3::SQLite3 ALIAS SQLite::SQLite3)
endif()

include(${CMAKE_CURRENT_LIST_DIR}/SqliteOrmTargets.cmake)