aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2022-01-12 12:00:42 -0800
committerA Wireshark GitLab Utility <gerald+gitlab-utility@wireshark.org>2022-01-13 09:11:24 +0000
commita6e24a623416ca08fc8c3bb339b4f275a6aa9c3d (patch)
tree12d4168d992879fda42e8b0992af02a691072ddd
parent5074b4d71791b6240829b53cf80c66c9f8ca7835 (diff)
macOS: Require Sparkle 1 for now.
The Sparkle project recently released Sparkle 2.0.0, which deprecates the version 1 API. Add version discovery to FindSparkle.cmake and require version 1 until we add support for the new API. Ping #17861.
-rw-r--r--CMakeLists.txt2
-rw-r--r--cmake/modules/FindSparkle.cmake21
2 files changed, 21 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3b33d7ae79..9a04eb5b54 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1244,7 +1244,7 @@ if(BUILD_wireshark)
endif()
set(QT_FOUND ON)
if(APPLE)
- ws_find_package(Sparkle ENABLE_SPARKLE HAVE_SOFTWARE_UPDATE)
+ ws_find_package(Sparkle ENABLE_SPARKLE HAVE_SOFTWARE_UPDATE 1 EXACT)
endif()
if(Qt${qtver}Multimedia_FOUND)
set(QT_MULTIMEDIA_LIB 1)
diff --git a/cmake/modules/FindSparkle.cmake b/cmake/modules/FindSparkle.cmake
index 5c14080d08..a06ebdc2be 100644
--- a/cmake/modules/FindSparkle.cmake
+++ b/cmake/modules/FindSparkle.cmake
@@ -5,6 +5,7 @@
# SPARKLE_FOUND - True if we found Sparkle
# SPARKLE_INCLUDE_DIRS - Path to Sparkle.h, empty if not found
# SPARKLE_LIBRARIES - Path to Sparkle.framework, empty if not found
+# SPARKLE_VERSION - Sparkle framework bundle version
include(FindPackageHandleStandardArgs)
@@ -18,7 +19,25 @@ find_library(SPARKLE_LIBRARY NAMES Sparkle
HINTS ${USR_LOCAL_HINT} ${HOMEBREW_HINT}
)
-find_package_handle_standard_args(Sparkle DEFAULT_MSG SPARKLE_INCLUDE_DIR SPARKLE_LIBRARY)
+# https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/FrameworkAnatomy.html
+find_file(_info_plist Info.plist
+ ${SPARKLE_LIBRARY}/Resources
+ ${SPARKLE_LIBRARY}/Versions/Current/Resources
+ ${SPARKLE_LIBRARY}/Versions/A/Resources
+ NO_DEFAULT_PATH
+)
+
+if(_info_plist)
+ execute_process(COMMAND defaults read ${_info_plist} CFBundleVersion
+ OUTPUT_VARIABLE SPARKLE_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+endif()
+
+find_package_handle_standard_args(Sparkle
+ REQUIRED_VARS SPARKLE_INCLUDE_DIR SPARKLE_LIBRARY
+ VERSION_VAR SPARKLE_VERSION
+)
if(SPARKLE_FOUND)
set(SPARKLE_LIBRARIES ${SPARKLE_LIBRARY} )