summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/prop_tgt/XCODE_EMBED_type.rst6
-rw-r--r--Help/prop_tgt/XCODE_EMBED_type_PATH.rst3
-rw-r--r--Help/release/dev/xcode-embed-xpc-services6
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx10
-rw-r--r--Source/cmGlobalXCodeGenerator.h1
-rw-r--r--Tests/RunCMake/XcodeProject-Embed/EmbedXPCServices-macOS-check.cmake3
-rw-r--r--Tests/RunCMake/XcodeProject-Embed/EmbedXPCServices-macOS.cmake1
-rw-r--r--Tests/RunCMake/XcodeProject-Embed/EmbedXPCServices.cmake17
-rw-r--r--Tests/RunCMake/XcodeProject-Embed/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/XcodeProject-Embed/XPCService.Info.plist.in24
10 files changed, 72 insertions, 0 deletions
diff --git a/Help/prop_tgt/XCODE_EMBED_type.rst b/Help/prop_tgt/XCODE_EMBED_type.rst
index e27d905..0f71ead 100644
--- a/Help/prop_tgt/XCODE_EMBED_type.rst
+++ b/Help/prop_tgt/XCODE_EMBED_type.rst
@@ -43,6 +43,12 @@ The supported values for ``<type>`` are:
The specified items will be added to the ``Embed Resources`` build phase.
They must be CMake target names or folder paths.
+``XPC_SERVICES``
+ .. versionadded:: 3.29
+
+ The specified items will be added to the ``Embed XPC Services`` build phase.
+ They must be CMake target names.
+
See also :prop_tgt:`XCODE_EMBED_<type>_PATH`,
:prop_tgt:`XCODE_EMBED_<type>_REMOVE_HEADERS_ON_COPY` and
:prop_tgt:`XCODE_EMBED_<type>_CODE_SIGN_ON_COPY`.
diff --git a/Help/prop_tgt/XCODE_EMBED_type_PATH.rst b/Help/prop_tgt/XCODE_EMBED_type_PATH.rst
index ef04d14..255aa68 100644
--- a/Help/prop_tgt/XCODE_EMBED_type_PATH.rst
+++ b/Help/prop_tgt/XCODE_EMBED_type_PATH.rst
@@ -25,3 +25,6 @@ The supported values for ``<type>`` are:
``RESOURCES``
.. versionadded:: 3.28
+
+``XPC_SERVICES``
+ .. versionadded:: 3.29
diff --git a/Help/release/dev/xcode-embed-xpc-services b/Help/release/dev/xcode-embed-xpc-services
new file mode 100644
index 0000000..f758285
--- /dev/null
+++ b/Help/release/dev/xcode-embed-xpc-services
@@ -0,0 +1,6 @@
+xcode-embed-xpc-services
+------------------------
+
+* The :prop_tgt:`XCODE_EMBED_XPC_SERVICES <XCODE_EMBED_<type>>` target property
+ was added to tell the :generator:`Xcode` generator what targets to put in
+ the ``Embed XPC Resources`` build phase.
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 89c94e2..b51af0b 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -4299,6 +4299,15 @@ void cmGlobalXCodeGenerator::AddEmbeddedResources(cmXCodeObject* target)
dstSubfolderSpec, NoActionOnCopyByDefault);
}
+void cmGlobalXCodeGenerator::AddEmbeddedXPCServices(cmXCodeObject* target)
+{
+ static const auto dstSubfolderSpec = "16";
+
+ this->AddEmbeddedObjects(
+ target, "Embed XPC Services", "XCODE_EMBED_XPC_SERVICES", dstSubfolderSpec,
+ NoActionOnCopyByDefault, "$(CONTENTS_FOLDER_PATH)/XPCServices");
+}
+
bool cmGlobalXCodeGenerator::CreateGroups(
std::vector<cmLocalGenerator*>& generators)
{
@@ -4712,6 +4721,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
this->AddEmbeddedAppExtensions(t);
this->AddEmbeddedExtensionKitExtensions(t);
this->AddEmbeddedResources(t);
+ this->AddEmbeddedXPCServices(t);
// Inherit project-wide values for any target-specific search paths.
this->InheritBuildSettingAttribute(t, "HEADER_SEARCH_PATHS");
this->InheritBuildSettingAttribute(t, "SYSTEM_HEADER_SEARCH_PATHS");
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index da0a4ea..12a5cad 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -225,6 +225,7 @@ private:
void AddEmbeddedAppExtensions(cmXCodeObject* target);
void AddEmbeddedExtensionKitExtensions(cmXCodeObject* target);
void AddEmbeddedResources(cmXCodeObject* target);
+ void AddEmbeddedXPCServices(cmXCodeObject* target);
void AddPositionIndependentLinkAttribute(cmGeneratorTarget* target,
cmXCodeObject* buildSettings,
const std::string& configName);
diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedXPCServices-macOS-check.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedXPCServices-macOS-check.cmake
new file mode 100644
index 0000000..706add5
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject-Embed/EmbedXPCServices-macOS-check.cmake
@@ -0,0 +1,3 @@
+include(${CMAKE_CURRENT_LIST_DIR}/findAttribute.cmake)
+
+findAttribute(${test} "Embed XPC Services" TRUE)
diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedXPCServices-macOS.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedXPCServices-macOS.cmake
new file mode 100644
index 0000000..5ad0436
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject-Embed/EmbedXPCServices-macOS.cmake
@@ -0,0 +1 @@
+include(${CMAKE_CURRENT_LIST_DIR}/EmbedXPCServices.cmake)
diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedXPCServices.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedXPCServices.cmake
new file mode 100644
index 0000000..877a685
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject-Embed/EmbedXPCServices.cmake
@@ -0,0 +1,17 @@
+add_executable(xpc_service MACOSX_BUNDLE main.m)
+set_target_properties(xpc_service PROPERTIES
+ BUNDLE_EXTENSION "xpc"
+ XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO"
+ XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY ""
+ MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/XPCService.Info.plist.in"
+ MACOSX_BUNDLE_GUI_IDENTIFIER "com.example.app.xpc_service"
+)
+
+add_executable(app MACOSX_BUNDLE main.m)
+add_dependencies(app xpc_service)
+set_target_properties(app PROPERTIES
+ XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO"
+ XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY ""
+ XCODE_EMBED_XPC_SERVICES xpc_service
+ MACOSX_BUNDLE_GUI_IDENTIFIER "com.example.app"
+)
diff --git a/Tests/RunCMake/XcodeProject-Embed/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject-Embed/RunCMakeTest.cmake
index 3798ddc..77ac63f 100644
--- a/Tests/RunCMake/XcodeProject-Embed/RunCMakeTest.cmake
+++ b/Tests/RunCMake/XcodeProject-Embed/RunCMakeTest.cmake
@@ -122,4 +122,5 @@ if(XCODE_VERSION VERSION_GREATER_EQUAL 14.1)
TestEmbedCommon(Resources macOS)
TestEmbedCommon(Resources iOS)
TestEmbedCommon(PlugIns macOS)
+ TestEmbedCommon(XPCServices macOS)
endif()
diff --git a/Tests/RunCMake/XcodeProject-Embed/XPCService.Info.plist.in b/Tests/RunCMake/XcodeProject-Embed/XPCService.Info.plist.in
new file mode 100644
index 0000000..abc8db2
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject-Embed/XPCService.Info.plist.in
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>$(DEVELOPMENT_LANGUAGE)</string>
+ <key>CFBundleDisplayName</key>
+ <string>SomeExtension</string>
+ <key>CFBundleExecutable</key>
+ <string>$(EXECUTABLE_NAME)</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.example.app.xpc_service</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>example_app_xpc_service</string>
+ <key>CFBundlePackageType</key>
+ <string>XPC!</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0.0</string>
+ <key>CFBundleVersion</key>
+ <string>1.0.0</string>
+</dict>
+</plist>