From 7ecac703cec8bde71f8d11c1a8fa34bfa077edee Mon Sep 17 00:00:00 2001 From: Gregor Jasny Date: Sat, 3 Dec 2016 23:46:15 +0100 Subject: Xcode: Add target property to override productType --- Help/manual/cmake-properties.7.rst | 1 + Help/prop_tgt/XCODE_PRODUCT_TYPE.rst | 6 ++++++ Source/cmGlobalXCodeGenerator.cxx | 4 ++++ 3 files changed, 11 insertions(+) create mode 100644 Help/prop_tgt/XCODE_PRODUCT_TYPE.rst diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index e55524c..292a85b 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -294,6 +294,7 @@ Properties on Targets /prop_tgt/WIN32_EXECUTABLE /prop_tgt/WINDOWS_EXPORT_ALL_SYMBOLS /prop_tgt/XCODE_ATTRIBUTE_an-attribute + /prop_tgt/XCODE_PRODUCT_TYPE /prop_tgt/XCTEST .. _`Test Properties`: diff --git a/Help/prop_tgt/XCODE_PRODUCT_TYPE.rst b/Help/prop_tgt/XCODE_PRODUCT_TYPE.rst new file mode 100644 index 0000000..1fbf001 --- /dev/null +++ b/Help/prop_tgt/XCODE_PRODUCT_TYPE.rst @@ -0,0 +1,6 @@ +XCODE_PRODUCT_TYPE +------------------ + +Set the Xcode ``productType`` attribute on its reference to a +target. CMake computes a default based on target type but +can be told explicitly with this property. diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 50197c9..82ca7a8 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -2340,6 +2340,10 @@ const char* cmGlobalXCodeGenerator::GetTargetFileType( const char* cmGlobalXCodeGenerator::GetTargetProductType( cmGeneratorTarget* target) { + if (const char* e = target->GetProperty("XCODE_PRODUCT_TYPE")) { + return e; + } + switch (target->GetType()) { case cmStateEnums::OBJECT_LIBRARY: case cmStateEnums::STATIC_LIBRARY: -- cgit v0.12