[Cmake-commits] CMake branch, next, updated. v3.8.0-rc4-630-gbaa8c9c

Kitware Robot kwrobot at kitware.com
Thu Mar 30 18:15:04 EDT 2017


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  baa8c9c3568c808b6217c6548a1d927cf85475ab (commit)
       via  d1dac1acc502af2f2b766cc9b262a4f1294be39b (commit)
       via  d02709d7f76624d9ec5e178d79cf3658d551f197 (commit)
       via  013ffe76e7d67fdb05fe29c82421b0a000feb468 (commit)
       via  32e9d0ca233439c0381abc5acee8a5acd30be494 (commit)
      from  83fb3398df43d9ea22fcc462ff56c60ac2be4d87 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=baa8c9c3568c808b6217c6548a1d927cf85475ab
commit baa8c9c3568c808b6217c6548a1d927cf85475ab
Merge: 83fb339 d1dac1a
Author:     Gregor Jasny <gjasny at googlemail.com>
AuthorDate: Thu Mar 30 22:06:14 2017 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Thu Mar 30 18:06:26 2017 -0400

    Stage topic '16733-bundle-genex'
    
    Topic-id: 23316
    Topic-url: https://gitlab.kitware.com/cmake/cmake/merge_requests/635


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d1dac1acc502af2f2b766cc9b262a4f1294be39b
commit d1dac1acc502af2f2b766cc9b262a4f1294be39b
Author:     Gregor Jasny <gjasny at googlemail.com>
AuthorDate: Fri Mar 24 12:28:57 2017 +0100
Commit:     Gregor Jasny <gjasny at googlemail.com>
CommitDate: Thu Mar 30 22:24:54 2017 +0200

    Xcode: Execute RunCMake.Framework also for Xcode generator

diff --git a/Tests/RunCMake/Framework/FrameworkLayout.cmake b/Tests/RunCMake/Framework/FrameworkLayout.cmake
index dcfbd2d..3d62a8a 100644
--- a/Tests/RunCMake/Framework/FrameworkLayout.cmake
+++ b/Tests/RunCMake/Framework/FrameworkLayout.cmake
@@ -1,6 +1,9 @@
 cmake_minimum_required(VERSION 3.4)
 enable_language(C)
 
+set(CMAKE_CONFIGURATION_TYPES "Debug" CACHE INTERNAL "Supported configuration types")
+set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}) # get rid of ${EFFECTIVE_PLATFORM_NAME}
+
 add_library(Framework ${FRAMEWORK_TYPE}
             foo.c
             foo.h
@@ -18,3 +21,5 @@ set_source_files_properties(some.txt PROPERTIES MACOSX_PACKAGE_LOCATION somedir)
 
 add_custom_command(TARGET Framework POST_BUILD
                    COMMAND /usr/bin/file $<TARGET_FILE:Framework>)
+
+file(GENERATE OUTPUT FrameworkName.cmake CONTENT "set(framework-dir \"$<TARGET_BUNDLE_DIR:Framework>\")\n")
diff --git a/Tests/RunCMake/Framework/OSXFrameworkLayout-build-check.cmake b/Tests/RunCMake/Framework/OSXFrameworkLayout-build-check.cmake
index 1a543d8..eb71394 100644
--- a/Tests/RunCMake/Framework/OSXFrameworkLayout-build-check.cmake
+++ b/Tests/RunCMake/Framework/OSXFrameworkLayout-build-check.cmake
@@ -1,4 +1,4 @@
-set(framework-dir "${RunCMake_TEST_BINARY_DIR}/Framework.framework")
+include("${RunCMake_TEST_BINARY_DIR}/FrameworkName.cmake")
 set(framework-resources "${framework-dir}/Resources")
 set(framework-resource-file "${framework-resources}/res.txt")
 set(framework-flat-resource-file "${framework-resources}/flatresource.txt")
diff --git a/Tests/RunCMake/Framework/RunCMakeTest.cmake b/Tests/RunCMake/Framework/RunCMakeTest.cmake
index e64892d..4fc83f8 100644
--- a/Tests/RunCMake/Framework/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Framework/RunCMakeTest.cmake
@@ -13,13 +13,10 @@ function(framework_layout_test Name Toolchain Type)
   run_cmake_command(${Name} ${CMAKE_COMMAND} --build .)
 endfunction()
 
-# build check cannot cope with multi-configuration generators directory layout
-if(NOT RunCMake_GENERATOR STREQUAL "Xcode")
-  framework_layout_test(iOSFrameworkLayout-build ios SHARED)
-  framework_layout_test(iOSFrameworkLayout-build ios STATIC)
-  framework_layout_test(OSXFrameworkLayout-build osx SHARED)
-  framework_layout_test(OSXFrameworkLayout-build osx STATIC)
-endif()
+framework_layout_test(iOSFrameworkLayout-build ios SHARED)
+framework_layout_test(iOSFrameworkLayout-build ios STATIC)
+framework_layout_test(OSXFrameworkLayout-build osx SHARED)
+framework_layout_test(OSXFrameworkLayout-build osx STATIC)
 
 function(framework_type_test Toolchain Type)
   set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${Toolchain}${Type}FrameworkType-build)
diff --git a/Tests/RunCMake/Framework/iOSFrameworkLayout-build-check.cmake b/Tests/RunCMake/Framework/iOSFrameworkLayout-build-check.cmake
index e068a3a..2da60d2 100644
--- a/Tests/RunCMake/Framework/iOSFrameworkLayout-build-check.cmake
+++ b/Tests/RunCMake/Framework/iOSFrameworkLayout-build-check.cmake
@@ -1,4 +1,4 @@
-set(framework-dir "${RunCMake_TEST_BINARY_DIR}/Framework.framework")
+include("${RunCMake_TEST_BINARY_DIR}/FrameworkName.cmake")
 set(framework-resources "${framework-dir}/Resources")
 set(framework-resource-file "${framework-dir}/res.txt")
 set(framework-flat-resource-file "${framework-dir}/flatresource.txt")

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d02709d7f76624d9ec5e178d79cf3658d551f197
commit d02709d7f76624d9ec5e178d79cf3658d551f197
Author:     Gregor Jasny <gjasny at googlemail.com>
AuthorDate: Mon Mar 27 20:54:22 2017 +0200
Commit:     Gregor Jasny <gjasny at googlemail.com>
CommitDate: Thu Mar 30 22:24:54 2017 +0200

    Genex: Add `TARGET_BUNDLE_[CONTENT_]_DIR` generator expressions
    
    Closes #16733

diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst
index 3a225ad..645be1d 100644
--- a/Help/manual/cmake-generator-expressions.7.rst
+++ b/Help/manual/cmake-generator-expressions.7.rst
@@ -205,6 +205,15 @@ Available informational expressions are:
   Name of the linker generated program database file (.pdb).
 ``$<TARGET_PDB_FILE_DIR:tgt>``
   Directory of the linker generated program database file (.pdb).
+``$<TARGET_BUNDLE_DIR:tgt>``
+  Full path to the bundle directory (``my.app``, ``my.framework``, or
+  ``my.bundle``) where ``tgt`` is the name of a target.
+``$<TARGET_BUNDLE_CONTENT_DIR:tgt>``
+  Full path to the bundle content directory where ``tgt`` is the name of a
+  target. For the macOS SDK it leads to ``my.app/Contents``, ``my.framework``,
+  or ``my.bundle/Contents``. For all other SDKs (e.g. iOS) it leads to
+  ``my.app``, ``my.framework``, or ``my.bundle`` due to the flat bundle
+  structure.
 ``$<TARGET_PROPERTY:tgt,prop>``
   Value of the property ``prop`` on the target ``tgt``.
 
diff --git a/Help/release/dev/bundle-genex.rst b/Help/release/dev/bundle-genex.rst
new file mode 100644
index 0000000..e79b84c
--- /dev/null
+++ b/Help/release/dev/bundle-genex.rst
@@ -0,0 +1,12 @@
+bundle-genex
+------------
+
+* Two new informational generator expressions to retrieve Apple Bundle
+  directories have been added. The first one ``$<TARGET_BUNDLE_DIR:tgt>``
+  outputs the full path to the Bundle directory, the other one
+  ``$<TARGET_BUNDLE_CONTENT_DIR:tgt>`` outputs the full path to the
+  ``Contents`` directory of macOS Bundles and App Bundles. For all other
+  bundle types and SDKs it is identical with ``$<TARGET_BUNDLE_DIR:tgt>``.
+
+  Those new expressions are helpful to query Bundle locations independent of
+  the different Bundle types and layouts on macOS and iOS.
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index 66202df..4443499 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -1504,6 +1504,8 @@ class ArtifactNameTag;
 class ArtifactPathTag;
 class ArtifactPdbTag;
 class ArtifactSonameTag;
+class ArtifactBundleDirTag;
+class ArtifactBundleContentDirTag;
 
 template <typename ArtifactT>
 struct TargetFilesystemArtifactResultCreator
@@ -1600,6 +1602,56 @@ struct TargetFilesystemArtifactResultCreator<ArtifactLinkerTag>
 };
 
 template <>
+struct TargetFilesystemArtifactResultCreator<ArtifactBundleDirTag>
+{
+  static std::string Create(cmGeneratorTarget* target,
+                            cmGeneratorExpressionContext* context,
+                            const GeneratorExpressionContent* content)
+  {
+    if (target->IsImported()) {
+      ::reportError(context, content->GetOriginalExpression(),
+                    "TARGET_BUNDLE_DIR not allowed for IMPORTED targets.");
+      return std::string();
+    }
+    if (!target->IsBundleOnApple()) {
+      ::reportError(context, content->GetOriginalExpression(),
+                    "TARGET_BUNDLE_DIR is allowed only for Bundle targets.");
+      return std::string();
+    }
+
+    std::string outpath = target->GetDirectory(context->Config) + '/';
+    return target->BuildBundleDirectory(outpath, context->Config,
+                                        cmGeneratorTarget::BundleDirLevel);
+  }
+};
+
+template <>
+struct TargetFilesystemArtifactResultCreator<ArtifactBundleContentDirTag>
+{
+  static std::string Create(cmGeneratorTarget* target,
+                            cmGeneratorExpressionContext* context,
+                            const GeneratorExpressionContent* content)
+  {
+    if (target->IsImported()) {
+      ::reportError(
+        context, content->GetOriginalExpression(),
+        "TARGET_BUNDLE_CONTENT_DIR not allowed for IMPORTED targets.");
+      return std::string();
+    }
+    if (!target->IsBundleOnApple()) {
+      ::reportError(
+        context, content->GetOriginalExpression(),
+        "TARGET_BUNDLE_CONTENT_DIR is allowed only for Bundle targets.");
+      return std::string();
+    }
+
+    std::string outpath = target->GetDirectory(context->Config) + '/';
+    return target->BuildBundleDirectory(outpath, context->Config,
+                                        cmGeneratorTarget::ContentLevel);
+  }
+};
+
+template <>
 struct TargetFilesystemArtifactResultCreator<ArtifactNameTag>
 {
   static std::string Create(cmGeneratorTarget* target,
@@ -1716,6 +1768,13 @@ static const TargetFilesystemArtifactNodeGroup<ArtifactSonameTag>
 static const TargetFilesystemArtifactNodeGroup<ArtifactPdbTag>
   targetPdbNodeGroup;
 
+static const TargetFilesystemArtifact<ArtifactBundleDirTag, ArtifactPathTag>
+  targetBundleDirNode;
+
+static const TargetFilesystemArtifact<ArtifactBundleContentDirTag,
+                                      ArtifactPathTag>
+  targetBundleContentDirNode;
+
 static const struct ShellPathNode : public cmGeneratorExpressionNode
 {
   ShellPathNode() {}
@@ -1772,6 +1831,8 @@ const cmGeneratorExpressionNode* cmGeneratorExpressionNode::GetNode(
     nodeMap["TARGET_LINKER_FILE_DIR"] = &targetLinkerNodeGroup.FileDir;
     nodeMap["TARGET_SONAME_FILE_DIR"] = &targetSoNameNodeGroup.FileDir;
     nodeMap["TARGET_PDB_FILE_DIR"] = &targetPdbNodeGroup.FileDir;
+    nodeMap["TARGET_BUNDLE_DIR"] = &targetBundleDirNode;
+    nodeMap["TARGET_BUNDLE_CONTENT_DIR"] = &targetBundleContentDirNode;
     nodeMap["STREQUAL"] = &strEqualNode;
     nodeMap["EQUAL"] = &equalNode;
     nodeMap["LOWER_CASE"] = &lowerCaseNode;
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 2938fde..7797508 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -1493,6 +1493,12 @@ static bool shouldAddFullLevel(cmGeneratorTarget::BundleDirectoryLevel level)
   return level == cmGeneratorTarget::FullLevel;
 }
 
+static bool shouldAddContentLevel(
+  cmGeneratorTarget::BundleDirectoryLevel level)
+{
+  return level == cmGeneratorTarget::ContentLevel || shouldAddFullLevel(level);
+}
+
 std::string cmGeneratorTarget::GetAppBundleDirectory(
   const std::string& config, BundleDirectoryLevel level) const
 {
@@ -1503,7 +1509,7 @@ std::string cmGeneratorTarget::GetAppBundleDirectory(
     ext = "app";
   }
   fpath += ext;
-  if (!this->Makefile->PlatformIsAppleIos()) {
+  if (shouldAddContentLevel(level) && !this->Makefile->PlatformIsAppleIos()) {
     fpath += "/Contents";
     if (shouldAddFullLevel(level)) {
       fpath += "/MacOS";
@@ -1533,7 +1539,7 @@ std::string cmGeneratorTarget::GetCFBundleDirectory(
     }
   }
   fpath += ext;
-  if (!this->Makefile->PlatformIsAppleIos()) {
+  if (shouldAddContentLevel(level) && !this->Makefile->PlatformIsAppleIos()) {
     fpath += "/Contents";
     if (shouldAddFullLevel(level)) {
       fpath += "/MacOS";
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 07a59ae..7ceaab6 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -163,6 +163,7 @@ public:
   /** What hierarchy level should the reported directory contain */
   enum BundleDirectoryLevel
   {
+    BundleDirLevel,
     ContentLevel,
     FullLevel
   };
diff --git a/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_BUNDLE_CONTENT_DIR-result.txt b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_BUNDLE_CONTENT_DIR-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_BUNDLE_CONTENT_DIR-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_BUNDLE_CONTENT_DIR-stderr.txt b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_BUNDLE_CONTENT_DIR-stderr.txt
new file mode 100644
index 0000000..854447f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_BUNDLE_CONTENT_DIR-stderr.txt
@@ -0,0 +1,8 @@
+CMake Error at ImportedTarget-TARGET_BUNDLE_CONTENT_DIR.cmake:[0-9]* \(add_custom_target\):
+  Error evaluating generator expression:
+
+    \$<TARGET_BUNDLE_CONTENT_DIR:empty>
+
+  TARGET_BUNDLE_CONTENT_DIR not allowed for IMPORTED targets.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:[0-9]* \(include\)
diff --git a/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_BUNDLE_CONTENT_DIR.cmake b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_BUNDLE_CONTENT_DIR.cmake
new file mode 100644
index 0000000..ac2d3ce
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_BUNDLE_CONTENT_DIR.cmake
@@ -0,0 +1,2 @@
+add_library(empty UNKNOWN IMPORTED)
+add_custom_target(custom COMMAND echo $<TARGET_BUNDLE_CONTENT_DIR:empty>)
diff --git a/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_BUNDLE_DIR-result.txt b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_BUNDLE_DIR-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_BUNDLE_DIR-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_BUNDLE_DIR-stderr.txt b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_BUNDLE_DIR-stderr.txt
new file mode 100644
index 0000000..9b97df1
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_BUNDLE_DIR-stderr.txt
@@ -0,0 +1,8 @@
+CMake Error at ImportedTarget-TARGET_BUNDLE_DIR.cmake:[0-9]* \(add_custom_target\):
+  Error evaluating generator expression:
+
+    \$<TARGET_BUNDLE_DIR:empty>
+
+  TARGET_BUNDLE_DIR not allowed for IMPORTED targets.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:[0-9]* \(include\)
diff --git a/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_BUNDLE_DIR.cmake b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_BUNDLE_DIR.cmake
new file mode 100644
index 0000000..17c8128
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_BUNDLE_DIR.cmake
@@ -0,0 +1,2 @@
+add_library(empty UNKNOWN IMPORTED)
+add_custom_target(custom COMMAND echo $<TARGET_BUNDLE_DIR:empty>)
diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_BUNDLE_CONTENT_DIR-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_BUNDLE_CONTENT_DIR-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_BUNDLE_CONTENT_DIR-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_BUNDLE_CONTENT_DIR-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_BUNDLE_CONTENT_DIR-stderr.txt
new file mode 100644
index 0000000..03c02d9
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_BUNDLE_CONTENT_DIR-stderr.txt
@@ -0,0 +1,8 @@
+CMake Error at NonValidTarget-TARGET_BUNDLE_CONTENT_DIR.cmake:[0-9]* \(file\):
+  Error evaluating generator expression:
+
+    \$<TARGET_BUNDLE_CONTENT_DIR:empty>
+
+  TARGET_BUNDLE_CONTENT_DIR is allowed only for Bundle targets.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:[0-9]* \(include\)
diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_BUNDLE_CONTENT_DIR.cmake b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_BUNDLE_CONTENT_DIR.cmake
new file mode 100644
index 0000000..63b3b1b
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_BUNDLE_CONTENT_DIR.cmake
@@ -0,0 +1,9 @@
+
+enable_language(C)
+
+add_library(empty STATIC empty.c)
+
+file(GENERATE
+  OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt"
+  CONTENT "[$<TARGET_BUNDLE_CONTENT_DIR:empty>]"
+)
diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_BUNDLE_DIR-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_BUNDLE_DIR-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_BUNDLE_DIR-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_BUNDLE_DIR-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_BUNDLE_DIR-stderr.txt
new file mode 100644
index 0000000..f895c88
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_BUNDLE_DIR-stderr.txt
@@ -0,0 +1,8 @@
+CMake Error at NonValidTarget-TARGET_BUNDLE_DIR.cmake:[0-9]* \(file\):
+  Error evaluating generator expression:
+
+    \$<TARGET_BUNDLE_DIR:empty>
+
+  TARGET_BUNDLE_DIR is allowed only for Bundle targets.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:[0-9]* \(include\)
diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_BUNDLE_DIR.cmake b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_BUNDLE_DIR.cmake
new file mode 100644
index 0000000..19f333a
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_BUNDLE_DIR.cmake
@@ -0,0 +1,9 @@
+
+enable_language(C)
+
+add_library(empty STATIC empty.c)
+
+file(GENERATE
+  OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt"
+  CONTENT "[$<TARGET_BUNDLE_DIR:empty>]"
+)
diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
index 084b5c3..63cd2da 100644
--- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
@@ -17,6 +17,8 @@ run_cmake(NonValidTarget-C_COMPILER_ID)
 run_cmake(NonValidTarget-CXX_COMPILER_ID)
 run_cmake(NonValidTarget-C_COMPILER_VERSION)
 run_cmake(NonValidTarget-CXX_COMPILER_VERSION)
+run_cmake(NonValidTarget-TARGET_BUNDLE_DIR)
+run_cmake(NonValidTarget-TARGET_BUNDLE_CONTENT_DIR)
 run_cmake(NonValidTarget-TARGET_PROPERTY)
 run_cmake(NonValidTarget-TARGET_POLICY)
 run_cmake(COMPILE_LANGUAGE-add_custom_target)
@@ -32,6 +34,8 @@ run_cmake(OUTPUT_NAME-recursion)
 run_cmake(TARGET_PROPERTY-LOCATION)
 run_cmake(LINK_ONLY-not-linking)
 
+run_cmake(ImportedTarget-TARGET_BUNDLE_DIR)
+run_cmake(ImportedTarget-TARGET_BUNDLE_CONTENT_DIR)
 run_cmake(ImportedTarget-TARGET_PDB_FILE)
 if(LINKER_SUPPORTS_PDB)
   run_cmake(NonValidTarget-TARGET_PDB_FILE)
diff --git a/Tests/RunCMake/XcodeProject/XcodeBundles.cmake b/Tests/RunCMake/XcodeProject/XcodeBundles.cmake
index 833eb85..0b854d8 100644
--- a/Tests/RunCMake/XcodeProject/XcodeBundles.cmake
+++ b/Tests/RunCMake/XcodeProject/XcodeBundles.cmake
@@ -58,6 +58,10 @@ if(NOT TEST_IOS OR NOT XCODE_VERSION VERSION_LESS 6)
 
   add_custom_target(SharedFrameworkTest ALL
     COMMAND ${CMAKE_COMMAND} -E copy
+      "$<TARGET_BUNDLE_DIR:SharedFramework>" "$<TARGET_BUNDLE_DIR:SharedFramework>.old"
+    COMMAND ${CMAKE_COMMAND} -E copy
+      "$<TARGET_BUNDLE_CONTENT_DIR:SharedFramework>" "$<TARGET_BUNDLE_CONTENT_DIR:SharedFramework>.old"
+    COMMAND ${CMAKE_COMMAND} -E copy
       "$<TARGET_FILE:SharedFramework>" "$<TARGET_FILE:SharedFramework>.old")
 
   add_dependencies(SharedFrameworkTest SharedFramework)
@@ -71,6 +75,10 @@ if(NOT TEST_IOS OR NOT XCODE_VERSION VERSION_LESS 6)
 
   add_custom_target(SharedFrameworkExtTest ALL
     COMMAND ${CMAKE_COMMAND} -E copy
+      "$<TARGET_BUNDLE_DIR:SharedFrameworkExt>" "$<TARGET_BUNDLE_DIR:SharedFrameworkExt>.old"
+    COMMAND ${CMAKE_COMMAND} -E copy
+      "$<TARGET_BUNDLE_CONTENT_DIR:SharedFrameworkExt>" "$<TARGET_BUNDLE_CONTENT_DIR:SharedFrameworkExt>.old"
+    COMMAND ${CMAKE_COMMAND} -E copy
       "$<TARGET_FILE:SharedFrameworkExt>" "$<TARGET_FILE:SharedFrameworkExt>.old")
 
   add_dependencies(SharedFrameworkExtTest SharedFrameworkExt)
@@ -84,6 +92,10 @@ if(NOT XCODE_VERSION VERSION_LESS 6)
 
   add_custom_target(StaticFrameworkTest ALL
     COMMAND ${CMAKE_COMMAND} -E copy
+      "$<TARGET_BUNDLE_DIR:StaticFramework>" "$<TARGET_BUNDLE_DIR:StaticFramework>.old"
+    COMMAND ${CMAKE_COMMAND} -E copy
+      "$<TARGET_BUNDLE_CONTENT_DIR:StaticFramework>" "$<TARGET_BUNDLE_CONTENT_DIR:StaticFramework>.old"
+    COMMAND ${CMAKE_COMMAND} -E copy
       "$<TARGET_FILE:StaticFramework>" "$<TARGET_FILE:StaticFramework>.old")
 
   add_dependencies(StaticFrameworkTest StaticFramework)
@@ -97,6 +109,10 @@ if(NOT XCODE_VERSION VERSION_LESS 6)
 
   add_custom_target(StaticFrameworkExtTest ALL
     COMMAND ${CMAKE_COMMAND} -E copy
+      "$<TARGET_BUNDLE_DIR:StaticFrameworkExt>" "$<TARGET_BUNDLE_DIR:StaticFrameworkExt>.old"
+    COMMAND ${CMAKE_COMMAND} -E copy
+      "$<TARGET_BUNDLE_CONTENT_DIR:StaticFrameworkExt>" "$<TARGET_BUNDLE_CONTENT_DIR:StaticFrameworkExt>.old"
+    COMMAND ${CMAKE_COMMAND} -E copy
       "$<TARGET_FILE:StaticFrameworkExt>" "$<TARGET_FILE:StaticFrameworkExt>.old")
 
   add_dependencies(StaticFrameworkExtTest StaticFrameworkExt)
@@ -110,6 +126,10 @@ if(NOT CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE)
 
   add_custom_target(BundleTest ALL
     COMMAND ${CMAKE_COMMAND} -E copy
+      "$<TARGET_BUNDLE_DIR:Bundle>" "$<TARGET_BUNDLE_DIR:Bundle>.old"
+    COMMAND ${CMAKE_COMMAND} -E copy
+      "$<TARGET_BUNDLE_CONTENT_DIR:Bundle>" "$<TARGET_BUNDLE_CONTENT_DIR:Bundle>.old"
+    COMMAND ${CMAKE_COMMAND} -E copy
       "$<TARGET_FILE:Bundle>" "$<TARGET_FILE:Bundle>.old")
 
   add_dependencies(BundleTest Bundle)
@@ -123,6 +143,10 @@ if(NOT CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE)
 
   add_custom_target(BundleExtTest ALL
     COMMAND ${CMAKE_COMMAND} -E copy
+      "$<TARGET_BUNDLE_DIR:BundleExt>" "$<TARGET_BUNDLE_DIR:BundleExt>.old"
+    COMMAND ${CMAKE_COMMAND} -E copy
+      "$<TARGET_BUNDLE_CONTENT_DIR:BundleExt>" "$<TARGET_BUNDLE_CONTENT_DIR:BundleExt>.old"
+    COMMAND ${CMAKE_COMMAND} -E copy
       "$<TARGET_FILE:BundleExt>" "$<TARGET_FILE:BundleExt>.old")
 
   add_dependencies(BundleExtTest BundleExt)

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=013ffe76e7d67fdb05fe29c82421b0a000feb468
commit 013ffe76e7d67fdb05fe29c82421b0a000feb468
Author:     Gregor Jasny <gjasny at googlemail.com>
AuthorDate: Tue Mar 28 09:49:40 2017 +0200
Commit:     Gregor Jasny <gjasny at googlemail.com>
CommitDate: Thu Mar 30 22:24:54 2017 +0200

    cmGeneratorTarget: Call GetFrameworkDirectory in GetFullNameInternal

diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 95f447f..2938fde 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -3222,13 +3222,7 @@ void cmGeneratorTarget::GetFullNameInternal(const std::string& config,
   // frameworks have directory prefix but no suffix
   std::string fw_prefix;
   if (this->IsFrameworkOnApple()) {
-    fw_prefix = this->GetOutputName(config, false);
-    fw_prefix += ".";
-    const char* ext = this->GetProperty("BUNDLE_EXTENSION");
-    if (!ext) {
-      ext = "framework";
-    }
-    fw_prefix += ext;
+    fw_prefix = this->GetFrameworkDirectory(config, ContentLevel);
     fw_prefix += "/";
     targetPrefix = fw_prefix.c_str();
     targetSuffix = CM_NULLPTR;

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=32e9d0ca233439c0381abc5acee8a5acd30be494
commit 32e9d0ca233439c0381abc5acee8a5acd30be494
Author:     Gregor Jasny <gjasny at googlemail.com>
AuthorDate: Tue Mar 28 09:43:38 2017 +0200
Commit:     Gregor Jasny <gjasny at googlemail.com>
CommitDate: Thu Mar 30 22:24:54 2017 +0200

    cmGeneratorTarget: Use enum to describe bundle directory query level

diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index f78a933..95f447f 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -858,7 +858,7 @@ const char* cmGeneratorTarget::GetLocationForBuild() const
   }
 
   if (this->IsAppBundleOnApple()) {
-    std::string macdir = this->BuildMacContentDirectory("", "", false);
+    std::string macdir = this->BuildBundleDirectory("", "", FullLevel);
     if (!macdir.empty()) {
       location += "/";
       location += macdir;
@@ -1488,8 +1488,13 @@ std::string cmGeneratorTarget::GetSOName(const std::string& config) const
   return soName;
 }
 
-std::string cmGeneratorTarget::GetAppBundleDirectory(const std::string& config,
-                                                     bool contentOnly) const
+static bool shouldAddFullLevel(cmGeneratorTarget::BundleDirectoryLevel level)
+{
+  return level == cmGeneratorTarget::FullLevel;
+}
+
+std::string cmGeneratorTarget::GetAppBundleDirectory(
+  const std::string& config, BundleDirectoryLevel level) const
 {
   std::string fpath = this->GetFullName(config, false);
   fpath += ".";
@@ -1500,7 +1505,7 @@ std::string cmGeneratorTarget::GetAppBundleDirectory(const std::string& config,
   fpath += ext;
   if (!this->Makefile->PlatformIsAppleIos()) {
     fpath += "/Contents";
-    if (!contentOnly) {
+    if (shouldAddFullLevel(level)) {
       fpath += "/MacOS";
     }
   }
@@ -1513,8 +1518,8 @@ bool cmGeneratorTarget::IsBundleOnApple() const
     this->IsCFBundleOnApple();
 }
 
-std::string cmGeneratorTarget::GetCFBundleDirectory(const std::string& config,
-                                                    bool contentOnly) const
+std::string cmGeneratorTarget::GetCFBundleDirectory(
+  const std::string& config, BundleDirectoryLevel level) const
 {
   std::string fpath;
   fpath += this->GetOutputName(config, false);
@@ -1530,15 +1535,15 @@ std::string cmGeneratorTarget::GetCFBundleDirectory(const std::string& config,
   fpath += ext;
   if (!this->Makefile->PlatformIsAppleIos()) {
     fpath += "/Contents";
-    if (!contentOnly) {
+    if (shouldAddFullLevel(level)) {
       fpath += "/MacOS";
     }
   }
   return fpath;
 }
 
-std::string cmGeneratorTarget::GetFrameworkDirectory(const std::string& config,
-                                                     bool rootDir) const
+std::string cmGeneratorTarget::GetFrameworkDirectory(
+  const std::string& config, BundleDirectoryLevel level) const
 {
   std::string fpath;
   fpath += this->GetOutputName(config, false);
@@ -1548,7 +1553,7 @@ std::string cmGeneratorTarget::GetFrameworkDirectory(const std::string& config,
     ext = "framework";
   }
   fpath += ext;
-  if (!rootDir && !this->Makefile->PlatformIsAppleIos()) {
+  if (shouldAddFullLevel(level) && !this->Makefile->PlatformIsAppleIos()) {
     fpath += "/Versions/";
     fpath += this->GetFrameworkVersion();
   }
@@ -1863,18 +1868,19 @@ void cmGeneratorTarget::GetFullNameComponents(std::string& prefix,
   this->GetFullNameInternal(config, implib, prefix, base, suffix);
 }
 
-std::string cmGeneratorTarget::BuildMacContentDirectory(
-  const std::string& base, const std::string& config, bool contentOnly) const
+std::string cmGeneratorTarget::BuildBundleDirectory(
+  const std::string& base, const std::string& config,
+  BundleDirectoryLevel level) const
 {
   std::string fpath = base;
   if (this->IsAppBundleOnApple()) {
-    fpath += this->GetAppBundleDirectory(config, contentOnly);
+    fpath += this->GetAppBundleDirectory(config, level);
   }
   if (this->IsFrameworkOnApple()) {
-    fpath += this->GetFrameworkDirectory(config, contentOnly);
+    fpath += this->GetFrameworkDirectory(config, level);
   }
   if (this->IsCFBundleOnApple()) {
-    fpath += this->GetCFBundleDirectory(config, contentOnly);
+    fpath += this->GetCFBundleDirectory(config, level);
   }
   return fpath;
 }
@@ -1885,13 +1891,13 @@ std::string cmGeneratorTarget::GetMacContentDirectory(
   // Start with the output directory for the target.
   std::string fpath = this->GetDirectory(config, implib);
   fpath += "/";
-  bool contentOnly = true;
+  BundleDirectoryLevel level = ContentLevel;
   if (this->IsFrameworkOnApple()) {
     // additional files with a framework go into the version specific
     // directory
-    contentOnly = false;
+    level = FullLevel;
   }
-  fpath = this->BuildMacContentDirectory(fpath, config, contentOnly);
+  fpath = this->BuildBundleDirectory(fpath, config, level);
   return fpath;
 }
 
@@ -2932,7 +2938,7 @@ std::string cmGeneratorTarget::NormalGetFullPath(const std::string& config,
   std::string fpath = this->GetDirectory(config, implib);
   fpath += "/";
   if (this->IsAppBundleOnApple()) {
-    fpath = this->BuildMacContentDirectory(fpath, config, false);
+    fpath = this->BuildBundleDirectory(fpath, config, FullLevel);
     fpath += "/";
   }
 
@@ -3229,7 +3235,7 @@ void cmGeneratorTarget::GetFullNameInternal(const std::string& config,
   }
 
   if (this->IsCFBundleOnApple()) {
-    fw_prefix = this->GetCFBundleDirectory(config, false);
+    fw_prefix = this->GetCFBundleDirectory(config, FullLevel);
     fw_prefix += "/";
     targetPrefix = fw_prefix.c_str();
     targetSuffix = CM_NULLPTR;
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index d60ad24..07a59ae 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -160,9 +160,16 @@ public:
                                 bool realname) const;
   std::string NormalGetRealName(const std::string& config) const;
 
+  /** What hierarchy level should the reported directory contain */
+  enum BundleDirectoryLevel
+  {
+    ContentLevel,
+    FullLevel
+  };
+
   /** @return the Mac App directory without the base */
   std::string GetAppBundleDirectory(const std::string& config,
-                                    bool contentOnly) const;
+                                    BundleDirectoryLevel level) const;
 
   /** Return whether this target is an executable Bundle, a framework
       or CFBundle on Apple.  */
@@ -175,7 +182,7 @@ public:
 
   /** @return the Mac framework directory without the base. */
   std::string GetFrameworkDirectory(const std::string& config,
-                                    bool rootDir) const;
+                                    BundleDirectoryLevel level) const;
 
   /** Return the framework version string.  Undefined if
       IsFrameworkOnApple returns false.  */
@@ -183,7 +190,7 @@ public:
 
   /** @return the Mac CFBundle directory without the base */
   std::string GetCFBundleDirectory(const std::string& config,
-                                   bool contentOnly) const;
+                                   BundleDirectoryLevel level) const;
 
   /** Return the install name directory for the target in the
     * build tree.  For example: "\@rpath/", "\@loader_path/",
@@ -218,10 +225,11 @@ public:
                              const std::string& config = "",
                              bool implib = false) const;
 
-  /** Append to @a base the mac content directory and return it. */
-  std::string BuildMacContentDirectory(const std::string& base,
-                                       const std::string& config = "",
-                                       bool contentOnly = true) const;
+  /** Append to @a base the bundle directory hierarchy up to a certain @a level
+   * and return it. */
+  std::string BuildBundleDirectory(const std::string& base,
+                                   const std::string& config,
+                                   BundleDirectoryLevel level) const;
 
   /** @return the mac content directory for this target. */
   std::string GetMacContentDirectory(const std::string& config = CM_NULLPTR,
diff --git a/Source/cmOSXBundleGenerator.cxx b/Source/cmOSXBundleGenerator.cxx
index 8139be4..c9f6ceb 100644
--- a/Source/cmOSXBundleGenerator.cxx
+++ b/Source/cmOSXBundleGenerator.cxx
@@ -42,7 +42,8 @@ void cmOSXBundleGenerator::CreateAppBundle(const std::string& targetName,
   // Compute bundle directory names.
   std::string out = outpath;
   out += "/";
-  out += this->GT->GetAppBundleDirectory(this->ConfigName, false);
+  out += this->GT->GetAppBundleDirectory(this->ConfigName,
+                                         cmGeneratorTarget::FullLevel);
   cmSystemTools::MakeDirectory(out.c_str());
   this->Makefile->AddCMakeOutputFile(out);
 
@@ -52,7 +53,8 @@ void cmOSXBundleGenerator::CreateAppBundle(const std::string& targetName,
   // to be set.
   std::string plist = outpath;
   plist += "/";
-  plist += this->GT->GetAppBundleDirectory(this->ConfigName, true);
+  plist += this->GT->GetAppBundleDirectory(this->ConfigName,
+                                           cmGeneratorTarget::ContentLevel);
   plist += "/Info.plist";
   this->LocalGenerator->GenerateAppleInfoPList(this->GT, targetName,
                                                plist.c_str());
@@ -70,12 +72,14 @@ void cmOSXBundleGenerator::CreateFramework(const std::string& targetName,
   assert(this->MacContentFolders);
 
   // Compute the location of the top-level foo.framework directory.
-  std::string contentdir =
-    outpath + "/" + this->GT->GetFrameworkDirectory(this->ConfigName, true);
+  std::string contentdir = outpath + "/" +
+    this->GT->GetFrameworkDirectory(this->ConfigName,
+                                    cmGeneratorTarget::ContentLevel);
   contentdir += "/";
 
-  std::string newoutpath =
-    outpath + "/" + this->GT->GetFrameworkDirectory(this->ConfigName, false);
+  std::string newoutpath = outpath + "/" +
+    this->GT->GetFrameworkDirectory(this->ConfigName,
+                                    cmGeneratorTarget::FullLevel);
 
   std::string frameworkVersion = this->GT->GetFrameworkVersion();
 
@@ -170,14 +174,16 @@ void cmOSXBundleGenerator::CreateCFBundle(const std::string& targetName,
   // Compute bundle directory names.
   std::string out = root;
   out += "/";
-  out += this->GT->GetCFBundleDirectory(this->ConfigName, false);
+  out += this->GT->GetCFBundleDirectory(this->ConfigName,
+                                        cmGeneratorTarget::FullLevel);
   cmSystemTools::MakeDirectory(out.c_str());
   this->Makefile->AddCMakeOutputFile(out);
 
   // Configure the Info.plist file.  Note that it needs the executable name
   // to be set.
-  std::string plist =
-    root + "/" + this->GT->GetCFBundleDirectory(this->ConfigName, true);
+  std::string plist = root + "/" +
+    this->GT->GetCFBundleDirectory(this->ConfigName,
+                                   cmGeneratorTarget::ContentLevel);
   plist += "/Info.plist";
   std::string name = cmSystemTools::GetFilenameName(targetName);
   this->LocalGenerator->GenerateAppleInfoPList(this->GT, name, plist.c_str());

-----------------------------------------------------------------------

Summary of changes:
 Help/manual/cmake-generator-expressions.7.rst      |    9 +++
 Help/release/dev/bundle-genex.rst                  |   12 ++++
 Source/cmGeneratorExpressionNode.cxx               |   61 +++++++++++++++++++
 Source/cmGeneratorTarget.cxx                       |   64 +++++++++++---------
 Source/cmGeneratorTarget.h                         |   23 ++++---
 Source/cmOSXBundleGenerator.cxx                    |   24 +++++---
 Tests/RunCMake/Framework/FrameworkLayout.cmake     |    5 ++
 .../Framework/OSXFrameworkLayout-build-check.cmake |    2 +-
 Tests/RunCMake/Framework/RunCMakeTest.cmake        |   11 ++--
 .../Framework/iOSFrameworkLayout-build-check.cmake |    2 +-
 ...tedTarget-TARGET_BUNDLE_CONTENT_DIR-result.txt} |    0
 ...rtedTarget-TARGET_BUNDLE_CONTENT_DIR-stderr.txt |    8 +++
 .../ImportedTarget-TARGET_BUNDLE_CONTENT_DIR.cmake |    2 +
 .../ImportedTarget-TARGET_BUNDLE_DIR-result.txt}   |    0
 .../ImportedTarget-TARGET_BUNDLE_DIR-stderr.txt    |    8 +++
 .../ImportedTarget-TARGET_BUNDLE_DIR.cmake         |    2 +
 ...lidTarget-TARGET_BUNDLE_CONTENT_DIR-result.txt} |    0
 ...alidTarget-TARGET_BUNDLE_CONTENT_DIR-stderr.txt |    8 +++
 ...NonValidTarget-TARGET_BUNDLE_CONTENT_DIR.cmake} |    2 +-
 .../NonValidTarget-TARGET_BUNDLE_DIR-result.txt}   |    0
 .../NonValidTarget-TARGET_BUNDLE_DIR-stderr.txt    |    8 +++
 ...make => NonValidTarget-TARGET_BUNDLE_DIR.cmake} |    2 +-
 .../GeneratorExpression/RunCMakeTest.cmake         |    4 ++
 Tests/RunCMake/XcodeProject/XcodeBundles.cmake     |   24 ++++++++
 24 files changed, 225 insertions(+), 56 deletions(-)
 create mode 100644 Help/release/dev/bundle-genex.rst
 copy Tests/RunCMake/{Android/BadSYSROOT-result.txt => GeneratorExpression/ImportedTarget-TARGET_BUNDLE_CONTENT_DIR-result.txt} (100%)
 create mode 100644 Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_BUNDLE_CONTENT_DIR-stderr.txt
 create mode 100644 Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_BUNDLE_CONTENT_DIR.cmake
 copy Tests/RunCMake/{Android/BadSYSROOT-result.txt => GeneratorExpression/ImportedTarget-TARGET_BUNDLE_DIR-result.txt} (100%)
 create mode 100644 Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_BUNDLE_DIR-stderr.txt
 create mode 100644 Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_BUNDLE_DIR.cmake
 copy Tests/RunCMake/{Android/BadSYSROOT-result.txt => GeneratorExpression/NonValidTarget-TARGET_BUNDLE_CONTENT_DIR-result.txt} (100%)
 create mode 100644 Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_BUNDLE_CONTENT_DIR-stderr.txt
 copy Tests/RunCMake/GeneratorExpression/{NonValidCompiler-TARGET_PDB_FILE.cmake => NonValidTarget-TARGET_BUNDLE_CONTENT_DIR.cmake} (71%)
 copy Tests/RunCMake/{Android/BadSYSROOT-result.txt => GeneratorExpression/NonValidTarget-TARGET_BUNDLE_DIR-result.txt} (100%)
 create mode 100644 Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_BUNDLE_DIR-stderr.txt
 copy Tests/RunCMake/GeneratorExpression/{NonValidCompiler-TARGET_PDB_FILE.cmake => NonValidTarget-TARGET_BUNDLE_DIR.cmake} (74%)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list