Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
27 changes: 11 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -234,34 +234,29 @@ endif()
################################################################################################
# Canonical dependency targets
################################################################################################
if(TARGET SQLite3::SQLite3 AND NOT TARGET SQLite::SQLite3)
add_library(SQLite::SQLite3 ALIAS SQLite3::SQLite3)
if(TARGET SQLite::SQLite3 AND NOT TARGET SQLite3::SQLite3)
matsdk_add_interface_dependency(SQLite3::SQLite3 SQLite::SQLite3)
endif()
if(MATSDK_SQLITE_PROVIDER_RESOLVED STREQUAL "SYSTEM" AND NOT TARGET SQLite::SQLite3)
if(MATSDK_SQLITE_PROVIDER_RESOLVED STREQUAL "SYSTEM" AND NOT TARGET SQLite3::SQLite3)
if(APPLE AND NOT MATSDK_USING_VCPKG)
matsdk_add_apple_system_library(SQLite::SQLite3 sqlite3)
matsdk_add_apple_system_library(SQLite3::SQLite3 sqlite3)
else()
find_package(SQLite3 QUIET)
if(NOT TARGET SQLite::SQLite3 AND MATSDK_USING_VCPKG)
if(NOT TARGET SQLite3::SQLite3 AND TARGET SQLite::SQLite3)
matsdk_add_interface_dependency(SQLite3::SQLite3 SQLite::SQLite3)
endif()
if(NOT TARGET SQLite3::SQLite3 AND MATSDK_USING_VCPKG)
find_package(unofficial-sqlite3 CONFIG REQUIRED)
matsdk_add_interface_dependency(
SQLite::SQLite3 unofficial::sqlite3::sqlite3)
SQLite3::SQLite3 unofficial::sqlite3::sqlite3)
endif()
if(NOT TARGET SQLite::SQLite3)
if(NOT TARGET SQLite3::SQLite3)
message(FATAL_ERROR
"MATSDK_SQLITE_PROVIDER=SYSTEM requires SQLite::SQLite3. Install SQLite, "
"MATSDK_SQLITE_PROVIDER=SYSTEM requires SQLite3::SQLite3. Install SQLite, "
"define the canonical target before adding 1DS, or choose MINIMAL/VENDORED.")
endif()
endif()
endif()
if(TARGET SQLite::SQLite3 AND NOT TARGET SQLite3::SQLite3)
get_target_property(_matsdk_sqlite_target SQLite::SQLite3 ALIASED_TARGET)
if(_matsdk_sqlite_target)
add_library(SQLite3::SQLite3 ALIAS ${_matsdk_sqlite_target})
else()
add_library(SQLite3::SQLite3 ALIAS SQLite::SQLite3)
endif()
endif()

if(MATSDK_ZLIB_PROVIDER_RESOLVED STREQUAL "SYSTEM" AND NOT TARGET ZLIB::ZLIB)
if(APPLE AND NOT MATSDK_USING_VCPKG)
Expand Down
2 changes: 1 addition & 1 deletion cmake/MSTelemetryConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if(@MATSDK_CONFIG_STATIC_PACKAGE@)
endif()
matsdk_add_package_system_dependency(
MSTelemetry::sqlite_dependency
SQLite::SQLite3
SQLite3::SQLite3
"@MATSDK_SQLITE_PROVIDER_RESOLVED@"
SQLite3
${_matsdk_package_sqlite_args})
Expand Down
4 changes: 4 additions & 0 deletions cmake/MatsdkDependencyTargets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ function(matsdk_add_package_system_dependency dependency_target canonical_target
elseif(NOT TARGET "${canonical_target}")
find_dependency(${package_name})
endif()
if(NOT TARGET "${canonical_target}")
message(FATAL_ERROR
"${package_name} did not create the required ${canonical_target} target.")
endif()

matsdk_add_interface_dependency("${dependency_target}" "${canonical_target}")
endfunction()
2 changes: 1 addition & 1 deletion cmake/MatsdkOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ string(TOUPPER "${MATSDK_ZLIB_PROVIDER}" MATSDK_ZLIB_PROVIDER_RESOLVED)
if(MATSDK_SQLITE_PROVIDER_RESOLVED STREQUAL "AUTO")
if(MATSDK_ANDROID_USE_ROOM AND CMAKE_SYSTEM_NAME STREQUAL "Android")
set(MATSDK_SQLITE_PROVIDER_RESOLVED NONE)
elseif(TARGET SQLite::SQLite3 OR TARGET SQLite3::SQLite3)
elseif(TARGET SQLite3::SQLite3 OR TARGET SQLite::SQLite3)
set(MATSDK_SQLITE_PROVIDER_RESOLVED SYSTEM)
elseif(NOT MATSDK_USING_VCPKG
AND (WIN32 OR CMAKE_SYSTEM_NAME STREQUAL "Android"))
Expand Down
10 changes: 5 additions & 5 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -560,8 +560,8 @@ if(MATSDK_BUNDLE_SQLITE AND NOT TARGET sqlite3_bundled)
$<$<NOT:$<C_COMPILER_ID:AppleClang>>:-fdata-sections>)
endif()
endif()
if(MATSDK_BUNDLE_SQLITE AND NOT TARGET SQLite::SQLite3)
add_library(SQLite::SQLite3 ALIAS sqlite3_bundled)
if(MATSDK_BUNDLE_SQLITE AND NOT TARGET SQLite3::SQLite3)
add_library(SQLite3::SQLite3 ALIAS sqlite3_bundled)
endif()

if(MATSDK_BUNDLE_ZLIB AND NOT TARGET zlib_bundled)
Expand Down Expand Up @@ -609,9 +609,9 @@ if(MATSDK_BUNDLE_ZLIB AND NOT TARGET ZLIB::ZLIB)
endif()

if(NOT MATSDK_SQLITE_PROVIDER_RESOLVED STREQUAL "NONE"
AND NOT TARGET SQLite::SQLite3)
AND NOT TARGET SQLite3::SQLite3)
message(FATAL_ERROR
"SQLite::SQLite3 was not resolved for provider ${MATSDK_SQLITE_PROVIDER_RESOLVED}.")
"SQLite3::SQLite3 was not resolved for provider ${MATSDK_SQLITE_PROVIDER_RESOLVED}.")
endif()
if(NOT TARGET ZLIB::ZLIB)
message(FATAL_ERROR
Expand All @@ -624,7 +624,7 @@ elseif(MATSDK_BUNDLE_SQLITE)
target_link_libraries(mat PRIVATE sqlite3_bundled)
else()
matsdk_add_interface_dependency(
matsdk_sqlite_dependency SQLite::SQLite3)
matsdk_sqlite_dependency SQLite3::SQLite3)
target_link_libraries(mat PRIVATE
"$<BUILD_INTERFACE:matsdk_sqlite_dependency>"
"$<INSTALL_INTERFACE:MSTelemetry::sqlite_dependency>")
Expand Down
2 changes: 1 addition & 1 deletion lib/android_build/app/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ target_link_libraries( # Specifies the target library.
native-lib
mat
matsdk_internal_config
SQLite::SQLite3
SQLite3::SQLite3
ZLIB::ZLIB
# Links the target library to the log library
# included in the NDK.
Expand Down
4 changes: 2 additions & 2 deletions tests/embedding/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ if(MATSDK_EMBEDDING_PRELOAD_CURL)
endif()

option(MATSDK_EMBEDDING_PRELOAD_STORAGE_DEPS
"Pre-create SQLite::SQLite3/ZLIB::ZLIB and disable later discovery" OFF)
"Pre-create SQLite3::SQLite3 and ZLIB::ZLIB targets" OFF)
if(MATSDK_EMBEDDING_PRELOAD_STORAGE_DEPS)
find_path(MATSDK_TEST_SQLITE_INCLUDE_DIR sqlite3.h)
find_library(MATSDK_TEST_SQLITE_LIBRARY NAMES sqlite3)
Expand All @@ -49,7 +49,7 @@ if(MATSDK_EMBEDDING_PRELOAD_STORAGE_DEPS)
"${MATSDK_TEST_SQLITE_INCLUDE_DIR}")
target_link_libraries(matsdk_test_sqlite INTERFACE
"${MATSDK_TEST_SQLITE_LIBRARY}")
add_library(SQLite::SQLite3 ALIAS matsdk_test_sqlite)
add_library(SQLite3::SQLite3 ALIAS matsdk_test_sqlite)
add_library(matsdk_test_zlib INTERFACE)
target_include_directories(matsdk_test_zlib INTERFACE
"${MATSDK_TEST_ZLIB_INCLUDE_DIR}")
Expand Down
2 changes: 1 addition & 1 deletion tests/functests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ target_link_libraries(FuncTests PRIVATE
gtest
gmock)
if(NOT MATSDK_SQLITE_PROVIDER_RESOLVED STREQUAL "NONE")
target_link_libraries(FuncTests PRIVATE SQLite::SQLite3)
target_link_libraries(FuncTests PRIVATE SQLite3::SQLite3)
endif()
if(TARGET nlohmann_json::nlohmann_json)
target_link_libraries(FuncTests PRIVATE nlohmann_json::nlohmann_json)
Expand Down
2 changes: 1 addition & 1 deletion tests/unittests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ target_link_libraries(UnitTests PRIVATE
gtest
gmock)
if(NOT MATSDK_SQLITE_PROVIDER_RESOLVED STREQUAL "NONE")
target_link_libraries(UnitTests PRIVATE SQLite::SQLite3)
target_link_libraries(UnitTests PRIVATE SQLite3::SQLite3)
endif()
if(TARGET nlohmann_json::nlohmann_json)
target_link_libraries(UnitTests PRIVATE nlohmann_json::nlohmann_json)
Expand Down
7 changes: 0 additions & 7 deletions tools/ports/cpp-client-telemetry/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,6 @@ if(VCPKG_TARGET_IS_OSX OR VCPKG_TARGET_IS_IOS)
set(MATSDK_BUILD_APPLE_HTTP ON)
endif()

# iOS build options
set(MATSDK_BUILD_IOS_LEGACY OFF)
if(VCPKG_TARGET_IS_IOS)
set(MATSDK_BUILD_IOS_LEGACY ON)
endif()

set(MATSDK_APPLE_DEPLOYMENT_OPTIONS)
if(VCPKG_TARGET_IS_IOS)
list(APPEND MATSDK_APPLE_DEPLOYMENT_OPTIONS
Expand Down Expand Up @@ -170,7 +164,6 @@ vcpkg_cmake_configure(
-DBUILD_SWIFT_WRAPPER=OFF
-DBUILD_PACKAGE=OFF
-DBUILD_APPLE_HTTP=${MATSDK_BUILD_APPLE_HTTP}
-DBUILD_IOS=${MATSDK_BUILD_IOS_LEGACY}
${MATSDK_APPLE_DEPLOYMENT_OPTIONS}
)

Expand Down
Loading