summaryrefslogtreecommitdiff
path: root/CMake
diff options
context:
space:
mode:
authorOatmealDome <julian@oatmealdome.me>2024-12-04 23:25:26 -0500
committerOatmealDome <julian@oatmealdome.me>2024-12-05 14:56:08 -0500
commite05b033dd2825b23ca4d78c552caea52442dfd17 (patch)
tree2dd9573855061d529ac131fa37e47e256cf4f18d /CMake
parent3c27c38e7152078c9505504684d27886f12aab5e (diff)
ScmRevGen: Don't generate Info.plist files directly
Some generators (like Unix Makefiles and Xcode) copy an app's Info.plist at configure time. This causes a problem when we need to generate the Info.plist at build time, like how we currently do it with ScmRevGen. Instead of generating the Info.plist directly in ScmRevGen, provide an Info.plist without any version information to CMake at configure time, have ScmRevGen generate a separate plist file with the version information at build time, and then merge the two together to create the final Info.plist.
Diffstat (limited to 'CMake')
-rw-r--r--CMake/DolphinInjectVersionInfo.cmake24
-rw-r--r--CMake/ScmRevGen.cmake3
2 files changed, 25 insertions, 2 deletions
diff --git a/CMake/DolphinInjectVersionInfo.cmake b/CMake/DolphinInjectVersionInfo.cmake
new file mode 100644
index 0000000000..94d9b43873
--- /dev/null
+++ b/CMake/DolphinInjectVersionInfo.cmake
@@ -0,0 +1,24 @@
+function(dolphin_inject_version_info target)
+ set(INFO_PLIST_PATH "$<TARGET_BUNDLE_DIR:${target}>/Contents/Info.plist")
+ add_custom_command(TARGET ${target}
+ POST_BUILD
+
+ COMMAND /usr/libexec/PlistBuddy -c
+ "Delete :CFBundleShortVersionString"
+ "${INFO_PLIST_PATH}"
+ || true
+
+ COMMAND /usr/libexec/PlistBuddy -c
+ "Delete :CFBundleLongVersionString"
+ "${INFO_PLIST_PATH}"
+ || true
+
+ COMMAND /usr/libexec/PlistBuddy -c
+ "Delete :CFBundleVersion"
+ "${INFO_PLIST_PATH}"
+ || true
+
+ COMMAND /usr/libexec/PlistBuddy -c
+ "Merge '${CMAKE_BINARY_DIR}/Source/Core/VersionInfo.plist'"
+ "${INFO_PLIST_PATH}")
+endfunction()
diff --git a/CMake/ScmRevGen.cmake b/CMake/ScmRevGen.cmake
index 751e8b78c2..d314d044e3 100644
--- a/CMake/ScmRevGen.cmake
+++ b/CMake/ScmRevGen.cmake
@@ -65,6 +65,5 @@ endfunction()
configure_source_file("Source/Core/Common/scmrev.h")
if(APPLE)
- configure_source_file("Source/Core/DolphinQt/Info.plist")
- configure_source_file("Source/Core/MacUpdater/Info.plist")
+ configure_source_file("Source/Core/VersionInfo.plist")
endif()