Skip to content

Commit 84121a9

Browse files
committed
CMake: modify qtkeychain in android
1 parent 1e73368 commit 84121a9

1 file changed

Lines changed: 18 additions & 6 deletions

File tree

Src/CMakeLists.txt

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,21 @@ endif()
294294
option(WITH_QtKEYCHAIN "With qtkeychain" ON)
295295
if(WITH_QtKEYCHAIN)
296296
find_package(Qt${QT_VERSION_MAJOR}Keychain)
297-
if(Qt${QT_VERSION_MAJOR}Keychain_FOUND)
297+
if(NOT Qt${QT_VERSION_MAJOR}Keychain_FOUND)
298+
# Fetch qtkeychain from GitHub
299+
include(FetchContent)
300+
FetchContent_Declare(
301+
qtkeychain
302+
GIT_REPOSITORY https://github.com/frankosterfeld/qtkeychain.git
303+
GIT_TAG 0.15.0 # or specify a specific version/tag
304+
)
305+
# Configure qtkeychain build options before making it available
306+
if(QT_VERSION_MAJOR GREATER_EQUAL 6)
307+
set(BUILD_WITH_QT6 ON CACHE BOOL "" FORCE)
308+
endif()
309+
FetchContent_MakeAvailable(qtkeychain)
310+
endif()
311+
#if(Qt${QT_VERSION_MAJOR}Keychain_FOUND)
298312
list(APPEND PLUGIN_PRIVATE_DEFINITIONS HAVE_QTKEYCHAIN)
299313
list(APPEND PLUGIN_PRIVATE_LIBS Qt${QT_VERSION_MAJOR}Keychain::Qt${QT_VERSION_MAJOR}Keychain)
300314
list(APPEND PLUGIN_INCLUDE_DIRS $<BUILD_INTERFACE:${QTKEYCHAIN_INCLUDE_DIRS}/qt${QT_VERSION_MAJOR}keychain>)
@@ -306,7 +320,7 @@ if(WITH_QtKEYCHAIN)
306320
DESTINATION "${CMAKE_INSTALL_DATADIR}"
307321
COMPONENT DependLibraries)
308322
endif()
309-
endif()
323+
#endif()
310324
endif()
311325

312326
list(APPEND PLUGIN_QT_COMPONENTS Core Gui Widgets Network Multimedia MultimediaWidgets)
@@ -351,8 +365,6 @@ ADD_TARGET(NAME ${PROJECT_NAME}
351365
)
352366

353367
if(ANDROID)
354-
if(INSTALL_QTKEYCHAIN)
355-
set_target_properties(${PROJECT_NAME} PROPERTIES
356-
QT_ANDROID_EXTRA_LIBS $<TARGET_SONAME_FILE:Qt${QT_VERSION_MAJOR}Keychain::Qt${QT_VERSION_MAJOR}Keychain>)
357-
endif()
368+
set_target_properties(${PROJECT_NAME} PROPERTIES
369+
QT_ANDROID_EXTRA_LIBS $<TARGET_SONAME_FILE:Qt${QT_VERSION_MAJOR}Keychain::Qt${QT_VERSION_MAJOR}Keychain>)
358370
endif()

0 commit comments

Comments
 (0)