From 28bcb2ac21b5d1941ce453256539f5166289dd25 Mon Sep 17 00:00:00 2001 From: Denis Rouzaud Date: Fri, 22 Mar 2024 07:18:55 +0100 Subject: [PATCH] fix auth method + vcpkg patch --- cmake/{32200.patch => 36556.patch} | 185 ++++++++++++++++++-- cmake/VcpkgToolchain.cmake | 2 +- src/auth/apiheader/CMakeLists.txt | 36 ++-- src/auth/awss3/CMakeLists.txt | 42 +++-- src/auth/esritoken/CMakeLists.txt | 28 +-- src/auth/identcert/CMakeLists.txt | 30 ++-- src/auth/maptiler_hmacsha256/CMakeLists.txt | 38 ++-- src/auth/oauth2/CMakeLists.txt | 59 +++---- src/auth/pkipaths/CMakeLists.txt | 40 ++--- src/auth/pkipkcs12/CMakeLists.txt | 40 ++--- 10 files changed, 320 insertions(+), 180 deletions(-) rename cmake/{32200.patch => 36556.patch} (70%) diff --git a/cmake/32200.patch b/cmake/36556.patch similarity index 70% rename from cmake/32200.patch rename to cmake/36556.patch index 81a9f2a4f28e..ebbeba10ac6b 100644 --- a/cmake/32200.patch +++ b/cmake/36556.patch @@ -1,7 +1,7 @@ -From 4fefba48aebc88b3619d2c34e6328ec598a406fb Mon Sep 17 00:00:00 2001 +From 0300f4f8d9fa7021e717551f68ad22a924af3d74 Mon Sep 17 00:00:00 2001 From: liviaerxin <1yue8haogaoqi@gmail.com> Date: Sat, 24 Jun 2023 22:10:03 +0800 -Subject: [PATCH 1/3] Fixup install name and rpath after building dynamic +Subject: [PATCH 1/7] Fixup install name and rpath after building dynamic libraries on osx --- @@ -13,7 +13,7 @@ Subject: [PATCH 1/3] Fixup install name and rpath after building dynamic diff --git a/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake b/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake new file mode 100644 -index 000000000000..46510168cfe5 +index 0000000000000..46510168cfe56 --- /dev/null +++ b/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake @@ -0,0 +1,404 @@ @@ -377,13 +377,13 @@ index 000000000000..46510168cfe5 + + # Iterate over the filtered dependencies and fix their install names + foreach(dep_install_name IN LISTS dep_install_names) -+ string(REGEX MATCH "[^/]+(.dylib|.so)" dep_install_short_name "${dep_install_name}") ++ string(REGEX MATCH "[^/]+(.dylib|.so)" dep_install_name "${dep_install_name}") + message(DEBUG "dep_install_name: ${dep_install_name}") + + if(type EQUAL 2) -+ file(GLOB_RECURSE dep_files LIST_DIRECTORIES FALSE "${CURRENT_PACKAGES_DIR}/lib/${dep_install_short_name}") ++ file(GLOB_RECURSE dep_files LIST_DIRECTORIES FALSE "${CURRENT_PACKAGES_DIR}/lib/${dep_install_name}") + else() -+ file(GLOB_RECURSE dep_files LIST_DIRECTORIES FALSE "${folder}/${dep_install_short_name}") ++ file(GLOB_RECURSE dep_files LIST_DIRECTORIES FALSE "${folder}/${dep_install_name}") + endif() + + if(NOT dep_files) @@ -423,12 +423,12 @@ index 000000000000..46510168cfe5 +z_vcpkg_fixup_install_name_rpath_in_dir() \ No newline at end of file diff --git a/scripts/ports.cmake b/scripts/ports.cmake -index ac0b64e6eb45..05ff31b15db0 100644 +index c6746a6662686..267ad325f7702 100644 --- a/scripts/ports.cmake +++ b/scripts/ports.cmake -@@ -149,6 +149,9 @@ if(CMD STREQUAL "BUILD") - if(VCPKG_FIXUP_ELF_RPATH) - include("${SCRIPTS}/cmake/z_vcpkg_fixup_rpath.cmake") +@@ -178,6 +178,9 @@ if(CMD STREQUAL "BUILD") + if(VCPKG_FIXUP_ELF_RPATH OR (VCPKG_TARGET_IS_LINUX AND NOT DEFINED VCPKG_FIXUP_ELF_RPATH)) + z_vcpkg_fixup_rpath_in_dir() endif() + if(VCPKG_FIXUP_MACHO_RPATH) + include("${SCRIPTS}/cmake/z_vcpkg_fixup_install_name_rpath.cmake") @@ -437,7 +437,7 @@ index ac0b64e6eb45..05ff31b15db0 100644 endif() elseif(CMD STREQUAL "CREATE") diff --git a/triplets/community/arm64-osx-dynamic.cmake b/triplets/community/arm64-osx-dynamic.cmake -index c9b1243c92cf..8f37d4024377 100644 +index c9b1243c92cfa..8f37d40243770 100644 --- a/triplets/community/arm64-osx-dynamic.cmake +++ b/triplets/community/arm64-osx-dynamic.cmake @@ -4,3 +4,5 @@ set(VCPKG_LIBRARY_LINKAGE dynamic) @@ -448,17 +448,17 @@ index c9b1243c92cf..8f37d4024377 100644 +set(VCPKG_FIXUP_MACHO_RPATH ON) \ No newline at end of file -From 2df07eac5d0efb6edfa698cc4cd4e9e1bf187843 Mon Sep 17 00:00:00 2001 +From fc41a9a218dfedee5f9e6b4a37cfc7ea57c96b3d Mon Sep 17 00:00:00 2001 From: liviaerxin <1yue8haogaoqi@gmail.com> Date: Sat, 24 Jun 2023 23:39:48 +0800 -Subject: [PATCH 2/3] Update comments +Subject: [PATCH 2/7] Update comments --- scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake b/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake -index 46510168cfe5..38fb716b3c22 100644 +index 46510168cfe56..38fb716b3c223 100644 --- a/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake +++ b/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake @@ -217,14 +217,14 @@ endfunction() @@ -481,17 +481,17 @@ index 46510168cfe5..38fb716b3c22 100644 find_program( install_name_tool_cmd -From b94dc25d372b8269095f3aff73fd344b6c96f207 Mon Sep 17 00:00:00 2001 +From 2f51fcee81cd2b8c30843805b6fe13efc7135839 Mon Sep 17 00:00:00 2001 From: liviaerxin <1yue8haogaoqi@gmail.com> Date: Mon, 26 Jun 2023 21:32:14 +0800 -Subject: [PATCH 3/3] chore: do fixup if necessary tools found +Subject: [PATCH 3/7] chore: do fixup if necessary tools found --- .../z_vcpkg_fixup_install_name_rpath.cmake | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake b/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake -index 38fb716b3c22..2f07720938ec 100644 +index 38fb716b3c223..2f07720938ece 100644 --- a/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake +++ b/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake @@ -229,10 +229,25 @@ function(z_vcpkg_fixup_install_name_rpath_in_dir) @@ -521,3 +521,154 @@ index 38fb716b3c22..2f07720938ec 100644 message(DEBUG "Start fix install name and rpath for Mach-O files") # Iterate over the folders. DON'T change order! + +From 20255d645e1a4e27b2e3c4a891aa7cfe9035baf8 Mon Sep 17 00:00:00 2001 +From: Matthias Kuhn +Date: Sat, 3 Feb 2024 16:11:03 +0100 +Subject: [PATCH 4/7] Fail if rpath fixups cannot be applied + +--- + .../z_vcpkg_fixup_install_name_rpath.cmake | 20 ++++++------------- + 1 file changed, 6 insertions(+), 14 deletions(-) + +diff --git a/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake b/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake +index 2f07720938ece..f72927ad8a624 100644 +--- a/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake ++++ b/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake +@@ -230,24 +230,16 @@ function(z_vcpkg_fixup_install_name_rpath_in_dir) + install_name_tool_cmd + NAMES install_name_tool + DOC "Absolute path of install_name_tool cmd" ++ REQUIRED + ) + +- if(NOT install_name_tool_cmd) +- message(WARNING " install_name_tool not found!") +- return() +- endif() +- + find_program( + otool_cmd + NAMES otool + DOC "Absolute path of otool cmd" ++ REQUIRED + ) + +- if(NOT otool_cmd) +- message(WARNING "otool not found!") +- return() +- endif() +- + message(DEBUG "Start fix install name and rpath for Mach-O files") + + # Iterate over the folders. DON'T change order! +@@ -331,7 +323,7 @@ function(z_vcpkg_fixup_install_name_rpath_in_dir) + ) + + if(NOT set_install_name_rv EQUAL 0) +- message(WARNING "Failed, install_name_tool -id ${id_name} ${file}, \n${set_install_name_ov}") ++ message(FATAL_ERROR "Failed, install_name_tool -id ${id_name} ${file}, \n${set_install_name_ov}") + continue() + endif() + endif() +@@ -346,7 +338,7 @@ function(z_vcpkg_fixup_install_name_rpath_in_dir) + ) + + if(NOT set_rpath_rv EQUAL 0) +- message(WARNING "Failed, install_name_tool -add_rpath ${rpath} ${file}, \n${set_rpath_ov}") ++ message(FATAL_ERROR "Failed, install_name_tool -add_rpath ${rpath} ${file}, \n${set_rpath_ov}") + continue() + endif() + +@@ -400,7 +392,7 @@ function(z_vcpkg_fixup_install_name_rpath_in_dir) + ) + + if(NOT change_dep_install_name_rv EQUAL 0) +- message(WARNING "Failed, install_name_tool -change ${dep_install_name} ${id_name} ${file}, \n${change_dep_install_name_ov}") ++ message(FATAL_ERROR "Failed, install_name_tool -change ${dep_install_name} ${id_name} ${file}, \n${change_dep_install_name_ov}") + continue() + else() + message(DEBUG "Fix ${file}: ${dep_install_name} to ${id_name}") +@@ -416,4 +408,4 @@ function(z_vcpkg_fixup_install_name_rpath_in_dir) + endforeach() + endfunction() + +-z_vcpkg_fixup_install_name_rpath_in_dir() +\ No newline at end of file ++z_vcpkg_fixup_install_name_rpath_in_dir() + +From 7619e9e2e08317e3151e03f9947776c156a7dc3e Mon Sep 17 00:00:00 2001 +From: Matthias Kuhn +Date: Sat, 3 Feb 2024 16:11:53 +0100 +Subject: [PATCH 5/7] Remove extra function call + +--- + scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake b/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake +index f72927ad8a624..33e062efe18c8 100644 +--- a/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake ++++ b/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake +@@ -407,5 +407,3 @@ function(z_vcpkg_fixup_install_name_rpath_in_dir) + endforeach() + endforeach() + endfunction() +- +-z_vcpkg_fixup_install_name_rpath_in_dir() + +From 4fe55167a9218b69980e843d035265a7a9df1962 Mon Sep 17 00:00:00 2001 +From: Matthias Kuhn +Date: Sat, 3 Feb 2024 17:11:20 +0100 +Subject: [PATCH 6/7] Use original dep install name for fixup + +--- + scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake b/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake +index 33e062efe18c8..74a8691667ca1 100644 +--- a/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake ++++ b/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake +@@ -364,9 +364,9 @@ function(z_vcpkg_fixup_install_name_rpath_in_dir) + list(FILTER dep_install_names EXCLUDE REGEX "^/System/Library/.*(dylib|so)$") + + # Iterate over the filtered dependencies and fix their install names +- foreach(dep_install_name IN LISTS dep_install_names) +- string(REGEX MATCH "[^/]+(.dylib|.so)" dep_install_name "${dep_install_name}") +- message(DEBUG "dep_install_name: ${dep_install_name}") ++ foreach(orig_dep_install_name IN LISTS dep_install_names) ++ string(REGEX MATCH "[^/]+(.dylib|.so)" dep_install_name "${orig_dep_install_name}") ++ message(DEBUG "dep_install_name: ${dep_install_name} (${orig_dep_install_name})") + + if(type EQUAL 2) + file(GLOB_RECURSE dep_files LIST_DIRECTORIES FALSE "${CURRENT_PACKAGES_DIR}/lib/${dep_install_name}") +@@ -386,7 +386,7 @@ function(z_vcpkg_fixup_install_name_rpath_in_dir) + message(DEBUG "${dep_install_name} match with ${dep_file} of install name ${id_name}") + + execute_process( +- COMMAND "${install_name_tool_cmd}" -change "${dep_install_name}" "${id_name}" "${file}" ++ COMMAND "${install_name_tool_cmd}" -change "${orig_dep_install_name}" "${id_name}" "${file}" + OUTPUT_VARIABLE change_dep_install_name_ov + RESULT_VARIABLE change_dep_install_name_rv + ) + +From 3c48d0602efab400be375067a4160583628dd09d Mon Sep 17 00:00:00 2001 +From: Matthias Kuhn +Date: Tue, 12 Mar 2024 07:58:50 +0100 +Subject: [PATCH 7/7] Run fixups + +--- + scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake b/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake +index 74a8691667ca1..226d820ea7b28 100644 +--- a/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake ++++ b/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake +@@ -407,3 +407,5 @@ function(z_vcpkg_fixup_install_name_rpath_in_dir) + endforeach() + endforeach() + endfunction() ++ ++z_vcpkg_fixup_install_name_rpath_in_dir() diff --git a/cmake/VcpkgToolchain.cmake b/cmake/VcpkgToolchain.cmake index 74da5c01e19c..594a7ef4c564 100644 --- a/cmake/VcpkgToolchain.cmake +++ b/cmake/VcpkgToolchain.cmake @@ -15,7 +15,7 @@ if(NOT VCPKG_TAG STREQUAL VCPKG_INSTALLED_VERSION) FetchContent_Declare(vcpkg GIT_REPOSITORY https://github.com/microsoft/vcpkg.git GIT_TAG ${VCPKG_TAG} -# PATCH_COMMAND git apply --ignore-whitespace "${CMAKE_CURRENT_LIST_DIR}/32200.patch" + PATCH_COMMAND git apply --ignore-whitespace "${CMAKE_CURRENT_LIST_DIR}/36556.patch" ) FetchContent_MakeAvailable(vcpkg) else() diff --git a/src/auth/apiheader/CMakeLists.txt b/src/auth/apiheader/CMakeLists.txt index 35bb52c345e8..13a7879b3fed 100644 --- a/src/auth/apiheader/CMakeLists.txt +++ b/src/auth/apiheader/CMakeLists.txt @@ -25,26 +25,26 @@ endif() # static library -add_library(authmethod_apiheader_a STATIC ${AUTH_APIHEADER_SRCS} ${AUTH_APIHEADER_HDRS} ${AUTH_APIHEADER_UIS_H}) - -target_include_directories(authmethod_apiheader_a PUBLIC ${CMAKE_SOURCE_DIR}/src/auth/apiheader/core) - -# require c++17 -target_compile_features(authmethod_apiheader_a PRIVATE cxx_std_17) - -target_link_libraries(authmethod_apiheader_a qgis_core) - -if (WITH_GUI) - target_include_directories(authmethod_apiheader_a PRIVATE - ${CMAKE_SOURCE_DIR}/src/auth/apiheader/gui - ${CMAKE_BINARY_DIR}/src/auth/apiheader - ) - target_link_libraries (authmethod_apiheader_a qgis_gui) -endif() +if (FORCE_STATIC_LIBS) + add_library(authmethod_apiheader_a STATIC ${AUTH_APIHEADER_SRCS} ${AUTH_APIHEADER_HDRS} ${AUTH_APIHEADER_UIS_H}) -target_compile_definitions(authmethod_apiheader_a PRIVATE "-DQT_NO_FOREACH") + target_include_directories(authmethod_apiheader_a PUBLIC ${CMAKE_SOURCE_DIR}/src/auth/apiheader/core) + + # require c++17 + target_compile_features(authmethod_apiheader_a PRIVATE cxx_std_17) + + target_link_libraries(authmethod_apiheader_a qgis_core) + + if (WITH_GUI) + target_include_directories(authmethod_apiheader_a PRIVATE + ${CMAKE_SOURCE_DIR}/src/auth/apiheader/gui + ${CMAKE_BINARY_DIR}/src/auth/apiheader + ) + target_link_libraries (authmethod_apiheader_a qgis_gui) + endif() + + target_compile_definitions(authmethod_apiheader_a PRIVATE "-DQT_NO_FOREACH") -if (FORCE_STATIC_LIBS) # for (external) mobile apps to be able to pick up provider for linking install (TARGETS authmethod_apiheader_a ARCHIVE DESTINATION ${QGIS_PLUGIN_DIR}) else() diff --git a/src/auth/awss3/CMakeLists.txt b/src/auth/awss3/CMakeLists.txt index 47ba61a9e52e..99a33dcbedc4 100644 --- a/src/auth/awss3/CMakeLists.txt +++ b/src/auth/awss3/CMakeLists.txt @@ -25,29 +25,27 @@ endif() # static library -add_library(authmethod_awss3_a STATIC ${AUTH_AWSS3_SRCS} ${AUTH_AWSS3_HDRS} ${AUTH_AWSS3_UIS_H}) - -target_include_directories(authmethod_awss3_a PUBLIC ${CMAKE_SOURCE_DIR}/src/auth/awss3/core) - -# require c++17 -target_compile_features(authmethod_awss3_a PRIVATE cxx_std_17) - -target_link_libraries(authmethod_awss3_a qgis_core) - -if (WITH_GUI) - target_include_directories(authmethod_awss3_a PRIVATE - ${CMAKE_SOURCE_DIR}/src/auth/awss3/gui - ${CMAKE_BINARY_DIR}/src/auth/awss3 - ) - - target_link_libraries (authmethod_awss3_a qgis_gui) -endif() - -target_compile_definitions(authmethod_awss3_a PRIVATE "-DQT_NO_FOREACH") - - - if (FORCE_STATIC_LIBS) + add_library(authmethod_awss3_a STATIC ${AUTH_AWSS3_SRCS} ${AUTH_AWSS3_HDRS} ${AUTH_AWSS3_UIS_H}) + + target_include_directories(authmethod_awss3_a PUBLIC ${CMAKE_SOURCE_DIR}/src/auth/awss3/core) + + # require c++17 + target_compile_features(authmethod_awss3_a PRIVATE cxx_std_17) + + target_link_libraries(authmethod_awss3_a qgis_core) + + if (WITH_GUI) + target_include_directories(authmethod_awss3_a PRIVATE + ${CMAKE_SOURCE_DIR}/src/auth/awss3/gui + ${CMAKE_BINARY_DIR}/src/auth/awss3 + ) + + target_link_libraries (authmethod_awss3_a qgis_gui) + endif() + + target_compile_definitions(authmethod_awss3_a PRIVATE "-DQT_NO_FOREACH") + # for (external) mobile apps to be able to pick up provider for linking install (TARGETS authmethod_awss3_a ARCHIVE DESTINATION ${QGIS_PLUGIN_DIR}) else() diff --git a/src/auth/esritoken/CMakeLists.txt b/src/auth/esritoken/CMakeLists.txt index 5bc3f1fb681b..895f4d5db388 100644 --- a/src/auth/esritoken/CMakeLists.txt +++ b/src/auth/esritoken/CMakeLists.txt @@ -25,26 +25,26 @@ endif() # static library -add_library(authmethod_esritoken_a STATIC ${AUTH_ESRITOKEN_SRCS} ${AUTH_ESRITOKEN_HDRS} ${AUTH_ESRITOKEN_UIS_H}) +if (FORCE_STATIC_LIBS) + add_library(authmethod_esritoken_a STATIC ${AUTH_ESRITOKEN_SRCS} ${AUTH_ESRITOKEN_HDRS} ${AUTH_ESRITOKEN_UIS_H}) -target_include_directories(authmethod_esritoken_a PUBLIC ${CMAKE_SOURCE_DIR}/src/auth/esritoken/core) + target_include_directories(authmethod_esritoken_a PUBLIC ${CMAKE_SOURCE_DIR}/src/auth/esritoken/core) -# require c++17 -target_compile_features(authmethod_esritoken_a PRIVATE cxx_std_17) + # require c++17 + target_compile_features(authmethod_esritoken_a PRIVATE cxx_std_17) -target_link_libraries(authmethod_esritoken_a qgis_core) + target_link_libraries(authmethod_esritoken_a qgis_core) -if (WITH_GUI) - target_include_directories(authmethod_esritoken_a PRIVATE - ${CMAKE_SOURCE_DIR}/src/auth/esritoken/gui - ${CMAKE_BINARY_DIR}/src/auth/esritoken - ) - target_link_libraries (authmethod_esritoken_a qgis_gui) -endif() + if (WITH_GUI) + target_include_directories(authmethod_esritoken_a PRIVATE + ${CMAKE_SOURCE_DIR}/src/auth/esritoken/gui + ${CMAKE_BINARY_DIR}/src/auth/esritoken + ) + target_link_libraries (authmethod_esritoken_a qgis_gui) + endif() -target_compile_definitions(authmethod_esritoken_a PRIVATE "-DQT_NO_FOREACH") + target_compile_definitions(authmethod_esritoken_a PRIVATE "-DQT_NO_FOREACH") -if (FORCE_STATIC_LIBS) # for (external) mobile apps to be able to pick up provider for linking install (TARGETS authmethod_esritoken_a ARCHIVE DESTINATION ${QGIS_PLUGIN_DIR}) else() diff --git a/src/auth/identcert/CMakeLists.txt b/src/auth/identcert/CMakeLists.txt index f6dda60f06c7..81b95024dfb5 100644 --- a/src/auth/identcert/CMakeLists.txt +++ b/src/auth/identcert/CMakeLists.txt @@ -25,28 +25,26 @@ endif() # static library -add_library(authmethod_identcert_a STATIC ${AUTH_IDENTCERT_SRCS} ${AUTH_IDENTCERT_HDRS} ${AUTH_IDENTCERT_UIS_H}) - -target_include_directories(authmethod_identcert_a PUBLIC ${CMAKE_SOURCE_DIR}/src/auth/identcert/core) - -# require c++17 -target_compile_features(authmethod_identcert_a PRIVATE cxx_std_17) +if (FORCE_STATIC_LIBS) + add_library(authmethod_identcert_a STATIC ${AUTH_IDENTCERT_SRCS} ${AUTH_IDENTCERT_HDRS} ${AUTH_IDENTCERT_UIS_H}) -target_link_libraries(authmethod_identcert_a qgis_core) + target_include_directories(authmethod_identcert_a PUBLIC ${CMAKE_SOURCE_DIR}/src/auth/identcert/core) -if (WITH_GUI) - target_include_directories(authmethod_identcert_a PRIVATE - ${CMAKE_SOURCE_DIR}/src/auth/identcert/gui - ${CMAKE_BINARY_DIR}/src/auth/identcert - ) - target_link_libraries (authmethod_identcert_a qgis_gui) -endif() + # require c++17 + target_compile_features(authmethod_identcert_a PRIVATE cxx_std_17) -target_compile_definitions(authmethod_identcert_a PRIVATE "-DQT_NO_FOREACH") + target_link_libraries(authmethod_identcert_a qgis_core) + if (WITH_GUI) + target_include_directories(authmethod_identcert_a PRIVATE + ${CMAKE_SOURCE_DIR}/src/auth/identcert/gui + ${CMAKE_BINARY_DIR}/src/auth/identcert + ) + target_link_libraries (authmethod_identcert_a qgis_gui) + endif() + target_compile_definitions(authmethod_identcert_a PRIVATE "-DQT_NO_FOREACH") -if (FORCE_STATIC_LIBS) # for (external) mobile apps to be able to pick up provider for linking install (TARGETS authmethod_identcert_a ARCHIVE DESTINATION ${QGIS_PLUGIN_DIR}) else() diff --git a/src/auth/maptiler_hmacsha256/CMakeLists.txt b/src/auth/maptiler_hmacsha256/CMakeLists.txt index 5e7b988f82b2..37ea1c271c5a 100644 --- a/src/auth/maptiler_hmacsha256/CMakeLists.txt +++ b/src/auth/maptiler_hmacsha256/CMakeLists.txt @@ -25,26 +25,26 @@ endif() # static library -add_library(authmethod_maptilerhmacsha256_a STATIC ${AUTH_MAPTILER_HMACSHA256_SRCS} ${AUTH_MAPTILER_HMACSHA256_HDRS} ${AUTH_MAPTILER_HMACSHA256_UIS_H}) - -target_include_directories(authmethod_maptilerhmacsha256_a PUBLIC ${CMAKE_SOURCE_DIR}/src/auth/hmacsha256/core) - -# require c++17 -target_compile_features(authmethod_maptilerhmacsha256_a PRIVATE cxx_std_17) - -target_link_libraries(authmethod_maptilerhmacsha256_a qgis_core) - -if (WITH_GUI) - target_include_directories(authmethod_maptilerhmacsha256_a PRIVATE - ${CMAKE_SOURCE_DIR}/src/auth/maptiler_hmacsha256/gui - ${CMAKE_BINARY_DIR}/src/auth/maptiler_hmacsha256 - ) - target_link_libraries (authmethod_maptilerhmacsha256_a qgis_gui) -endif() - -target_compile_definitions(authmethod_maptilerhmacsha256_a PRIVATE "-DQT_NO_FOREACH") - if (FORCE_STATIC_LIBS) + add_library(authmethod_maptilerhmacsha256_a STATIC ${AUTH_MAPTILER_HMACSHA256_SRCS} ${AUTH_MAPTILER_HMACSHA256_HDRS} ${AUTH_MAPTILER_HMACSHA256_UIS_H}) + + target_include_directories(authmethod_maptilerhmacsha256_a PUBLIC ${CMAKE_SOURCE_DIR}/src/auth/hmacsha256/core) + + # require c++17 + target_compile_features(authmethod_maptilerhmacsha256_a PRIVATE cxx_std_17) + + target_link_libraries(authmethod_maptilerhmacsha256_a qgis_core) + + if (WITH_GUI) + target_include_directories(authmethod_maptilerhmacsha256_a PRIVATE + ${CMAKE_SOURCE_DIR}/src/auth/maptiler_hmacsha256/gui + ${CMAKE_BINARY_DIR}/src/auth/maptiler_hmacsha256 + ) + target_link_libraries (authmethod_maptilerhmacsha256_a qgis_gui) + endif() + + target_compile_definitions(authmethod_maptilerhmacsha256_a PRIVATE "-DQT_NO_FOREACH") + # for (external) mobile apps to be able to pick up provider for linking install (TARGETS authmethod_maptilerhmacsha256_a ARCHIVE DESTINATION ${QGIS_PLUGIN_DIR}) else() diff --git a/src/auth/oauth2/CMakeLists.txt b/src/auth/oauth2/CMakeLists.txt index 15b3fb2588dc..419fcfe19694 100644 --- a/src/auth/oauth2/CMakeLists.txt +++ b/src/auth/oauth2/CMakeLists.txt @@ -98,42 +98,39 @@ if(WITH_INTERNAL_O2 AND CMAKE_GENERATOR MATCHES "Ninja") endif() # static library -add_library(authmethod_oauth2_a STATIC ${AUTH_OAUTH2_SRCS} ${AUTH_OAUTH2_HDRS} ${AUTH_OAUTH2_RCCS} ${AUTH_OAUTH2_UIS_H}) - -target_include_directories(authmethod_oauth2_a PUBLIC ${CMAKE_SOURCE_DIR}/src/auth/oauth2/core) - -# require c++17 -target_compile_features(authmethod_oauth2_a PRIVATE cxx_std_17) -target_compile_definitions(authmethod_oauth2_a PRIVATE "CMAKE_SOURCE_DIR=\"${CMAKE_SOURCE_DIR}\"") - -target_link_libraries(authmethod_oauth2_a qgis_core) - -if(WITH_INTERNAL_O2) - target_include_directories(authmethod_oauth2_a SYSTEM PUBLIC ${O2_INCLUDE_DIR}) -else() - if(NOT "${O2_LIBRARY}" STREQUAL "") - # prefer dynamic linking - target_link_libraries(authmethod_oauth2_a ${O2_LIBRARY}) +if (FORCE_STATIC_LIBS) + add_library(authmethod_oauth2_a STATIC ${AUTH_OAUTH2_SRCS} ${AUTH_OAUTH2_HDRS} ${AUTH_OAUTH2_RCCS} ${AUTH_OAUTH2_UIS_H}) + + target_include_directories(authmethod_oauth2_a PUBLIC ${CMAKE_SOURCE_DIR}/src/auth/oauth2/core) + + # require c++17 + target_compile_features(authmethod_oauth2_a PRIVATE cxx_std_17) + + target_link_libraries(authmethod_oauth2_a qgis_core) + + if(WITH_INTERNAL_O2) + target_include_directories(authmethod_oauth2_a SYSTEM PUBLIC ${O2_INCLUDE_DIR}) else() - target_link_libraries(authmethod_oauth2_a ${O2_LIBRARY_STATIC}) + if(NOT "${O2_LIBRARY}" STREQUAL "") + # prefer dynamic linking + target_link_libraries(authmethod_oauth2_a ${O2_LIBRARY}) + else() + target_link_libraries(authmethod_oauth2_a ${O2_LIBRARY_STATIC}) + endif() endif() -endif() - -target_include_directories(authmethod_oauth2_a PRIVATE - ${CMAKE_SOURCE_DIR}/external/qjsonwrapper - ${CMAKE_SOURCE_DIR}/src/auth/oauth2/core -) -if (WITH_GUI) + target_include_directories(authmethod_oauth2_a PRIVATE - ${CMAKE_SOURCE_DIR}/src/auth/oauth2/gui - ${CMAKE_BINARY_DIR}/src/auth/oauth2 + ${CMAKE_SOURCE_DIR}/external/qjsonwrapper + ${CMAKE_SOURCE_DIR}/src/auth/oauth2/core ) - target_link_libraries (authmethod_oauth2_a qgis_gui) -endif() - - + if (WITH_GUI) + target_include_directories(authmethod_oauth2_a PRIVATE + ${CMAKE_SOURCE_DIR}/src/auth/oauth2/gui + ${CMAKE_BINARY_DIR}/src/auth/oauth2 + ) + target_link_libraries (authmethod_oauth2_a qgis_gui) + endif() -if (FORCE_STATIC_LIBS) # for (external) mobile apps to be able to pick up provider for linking install (TARGETS authmethod_oauth2_a ARCHIVE DESTINATION ${QGIS_PLUGIN_DIR}) else() diff --git a/src/auth/pkipaths/CMakeLists.txt b/src/auth/pkipaths/CMakeLists.txt index 8878344dc590..c49c4fb3840f 100644 --- a/src/auth/pkipaths/CMakeLists.txt +++ b/src/auth/pkipaths/CMakeLists.txt @@ -24,28 +24,26 @@ if (WITH_GUI) endif() # static library -add_library(authmethod_pkipaths_a STATIC ${AUTH_PKIPATHS_SRCS} ${AUTH_PKIPATHS_HDRS} ${AUTH_PKIPATHS_UIS_H}) - -target_include_directories(authmethod_pkipaths_a PUBLIC ${CMAKE_SOURCE_DIR}/src/auth/pkipaths/core) - -# require c++17 -target_compile_features(authmethod_pkipaths_a PRIVATE cxx_std_17) - -target_link_libraries(authmethod_pkipaths_a qgis_core) - -if (WITH_GUI) - target_include_directories(authmethod_pkipaths_a PRIVATE - ${CMAKE_SOURCE_DIR}/src/auth/pkipaths/gui - ${CMAKE_BINARY_DIR}/src/auth/pkipaths - ) - target_link_libraries (authmethod_pkipaths_a qgis_gui) -endif() - -target_compile_definitions(authmethod_pkipaths_a PRIVATE "-DQT_NO_FOREACH") - - - if (FORCE_STATIC_LIBS) + add_library(authmethod_pkipaths_a STATIC ${AUTH_PKIPATHS_SRCS} ${AUTH_PKIPATHS_HDRS} ${AUTH_PKIPATHS_UIS_H}) + + target_include_directories(authmethod_pkipaths_a PUBLIC ${CMAKE_SOURCE_DIR}/src/auth/pkipaths/core) + + # require c++17 + target_compile_features(authmethod_pkipaths_a PRIVATE cxx_std_17) + + target_link_libraries(authmethod_pkipaths_a qgis_core) + + if (WITH_GUI) + target_include_directories(authmethod_pkipaths_a PRIVATE + ${CMAKE_SOURCE_DIR}/src/auth/pkipaths/gui + ${CMAKE_BINARY_DIR}/src/auth/pkipaths + ) + target_link_libraries (authmethod_pkipaths_a qgis_gui) + endif() + + target_compile_definitions(authmethod_pkipaths_a PRIVATE "-DQT_NO_FOREACH") + # for (external) mobile apps to be able to pick up provider for linking install (TARGETS authmethod_pkipaths_a ARCHIVE DESTINATION ${QGIS_PLUGIN_DIR}) else() diff --git a/src/auth/pkipkcs12/CMakeLists.txt b/src/auth/pkipkcs12/CMakeLists.txt index 3e0b8e9e6ce1..47d808c4a3e9 100644 --- a/src/auth/pkipkcs12/CMakeLists.txt +++ b/src/auth/pkipkcs12/CMakeLists.txt @@ -24,28 +24,26 @@ if (WITH_GUI) endif() # static library -add_library(authmethod_pkcs12_a STATIC ${AUTH_PKCS12_SRCS} ${AUTH_PKCS12_HDRS} ${AUTH_PKCS12_UIS_H}) - -target_include_directories(authmethod_pkcs12_a PUBLIC ${CMAKE_SOURCE_DIR}/src/auth/pkipkcs12/core) - -# require c++17 -target_compile_features(authmethod_pkcs12_a PRIVATE cxx_std_17) - -target_link_libraries(authmethod_pkcs12_a qgis_core) - -if (WITH_GUI) - target_include_directories(authmethod_pkcs12_a PRIVATE - ${CMAKE_SOURCE_DIR}/src/auth/pkipkcs12/gui - ${CMAKE_BINARY_DIR}/src/auth/pkipkcs12 - ) - target_link_libraries (authmethod_pkcs12_a qgis_gui) -endif() - -target_compile_definitions(authmethod_pkcs12_a PRIVATE "-DQT_NO_FOREACH") - - - if (FORCE_STATIC_LIBS) + add_library(authmethod_pkcs12_a STATIC ${AUTH_PKCS12_SRCS} ${AUTH_PKCS12_HDRS} ${AUTH_PKCS12_UIS_H}) + + target_include_directories(authmethod_pkcs12_a PUBLIC ${CMAKE_SOURCE_DIR}/src/auth/pkipkcs12/core) + + # require c++17 + target_compile_features(authmethod_pkcs12_a PRIVATE cxx_std_17) + + target_link_libraries(authmethod_pkcs12_a qgis_core) + + if (WITH_GUI) + target_include_directories(authmethod_pkcs12_a PRIVATE + ${CMAKE_SOURCE_DIR}/src/auth/pkipkcs12/gui + ${CMAKE_BINARY_DIR}/src/auth/pkipkcs12 + ) + target_link_libraries (authmethod_pkcs12_a qgis_gui) + endif() + + target_compile_definitions(authmethod_pkcs12_a PRIVATE "-DQT_NO_FOREACH") + # for (external) mobile apps to be able to pick up provider for linking install (TARGETS authmethod_pkcs12_a ARCHIVE DESTINATION ${QGIS_PLUGIN_DIR}) else()