[Cmake-commits] CMake branch, next, updated. v2.8.12.1-5570-g7c2c374

Stephen Kelly steveire at gmail.com
Wed Nov 20 19:36:42 EST 2013


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  7c2c3741568795e99273170c5189ff3445e92b0e (commit)
       via  7d0964a96e5cd7a1fd6045201fd43ecd0d52c199 (commit)
       via  50697af2d7f24c6b8bc0d9cbee080875193b7b0d (commit)
       via  2fad001fdae5d25f84c08f392469234b71b29134 (commit)
       via  993d501bd3537d48e63d5d97a9fe16f079898978 (commit)
       via  e32a3bb1ed46276f9a01bbc0625689bdee8b4f6e (commit)
       via  f6844a49c27f792ca7a2c499f43802fa3d5e73c7 (commit)
       via  3e14f3296e2fd0c2e1057d56fb2aca3372a6ee16 (commit)
       via  ece9e6589ecc1ee3886eafffd9a5974c9a0b00c7 (commit)
       via  9a3272b42e981b8b54ffbb3841602b6b889129dd (commit)
       via  b21b1a9ff8fff2b98d5a799cc20185301f68ed2a (commit)
      from  e40142dd8207213dadd035f687b229f9adbe779b (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 -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7c2c3741568795e99273170c5189ff3445e92b0e
commit 7c2c3741568795e99273170c5189ff3445e92b0e
Merge: e40142d 7d0964a
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Nov 20 19:36:29 2013 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Nov 20 19:36:29 2013 -0500

    Merge topic 'INTERFACE_AUTOUIC_OPTIONS' into next
    
    7d0964a QtAutoUic: Add INTERFACE_AUTOUIC_OPTIONS target property.
    50697af QtAutoUic: Handle new -include command line parameter.
    2fad001 Genex: Add LOWER_CASE and MAKE_C_IDENTIFIER string manipulators.
    993d501 Help: Reformat the generator expression documentation.
    e32a3bb Base the target_compile_features command on cmTargetPropCommandBase.
    f6844a4 cmTargetPropCommandBase: Change the interface to return bool.
    3e14f32 cmTarget: Transitively evaluate compiler features.
    ece9e65 cmTarget: Allow populating COMPILE_FEATURES using generator expressions.
    9a3272b cmTarget: Make COMPILE_FEATURES available as a target property.
    b21b1a9 Add target_compile_features command.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7d0964a96e5cd7a1fd6045201fd43ecd0d52c199
commit 7d0964a96e5cd7a1fd6045201fd43ecd0d52c199
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Nov 20 14:54:39 2013 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Thu Nov 21 01:35:59 2013 +0100

    QtAutoUic: Add INTERFACE_AUTOUIC_OPTIONS target property.
    
    Transitively consume the property from linked dependents.
    
    Implement configuration-specific support by following the pattern
    set out for compile definitions and includes in cmQtAutoGenerators.
    
    Implement support for origin-tracking with CMAKE_DEBUG_TARGET_PROPERTIES.
    
    This is motivated by the needs of KDE, which provides a separate
    translation system based on gettext instead of the Qt linguist
    translation system. The Qt uic tool provides command line options
    for configuring the method used to translate text, and to add an
    include directive to the generated file to provide the method.
    
     http://thread.gmane.org/gmane.comp.kde.devel.frameworks/7930/focus=7992
    
    Implement the interface to provide the uic options as a usage-requirement
    on the KI18n target, as designed for KDE.

diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index e3a4cf8..7caf73d 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -141,6 +141,7 @@ Properties on Targets
    /prop_tgt/INSTALL_NAME_DIR
    /prop_tgt/INSTALL_RPATH
    /prop_tgt/INSTALL_RPATH_USE_LINK_PATH
+   /prop_tgt/INTERFACE_AUTOUIC_OPTIONS
    /prop_tgt/INTERFACE_COMPILE_DEFINITIONS
    /prop_tgt/INTERFACE_COMPILE_OPTIONS
    /prop_tgt/INTERFACE_INCLUDE_DIRECTORIES
diff --git a/Help/prop_tgt/AUTOUIC_OPTIONS.rst b/Help/prop_tgt/AUTOUIC_OPTIONS.rst
index c6cf885..aeec38b 100644
--- a/Help/prop_tgt/AUTOUIC_OPTIONS.rst
+++ b/Help/prop_tgt/AUTOUIC_OPTIONS.rst
@@ -15,3 +15,7 @@ This property is initialized by the value of the variable
 
 The options set on the target may be overridden by :prop_sf:`AUTOUIC_OPTIONS` set
 on the .ui source file.
+
+This property may use "generator expressions" with the syntax "$<...>".
+See the :manual:`cmake-generator-expressions(7)` manual for available
+expressions.
diff --git a/Help/prop_tgt/INTERFACE_AUTOUIC_OPTIONS.rst b/Help/prop_tgt/INTERFACE_AUTOUIC_OPTIONS.rst
new file mode 100644
index 0000000..1f63f00
--- /dev/null
+++ b/Help/prop_tgt/INTERFACE_AUTOUIC_OPTIONS.rst
@@ -0,0 +1,12 @@
+INTERFACE_AUTOUIC_OPTIONS
+-------------------------
+
+List of interface options to pass to uic.
+
+Targets may populate this property to publish the options
+required to use when invoking uic.  Consuming targets can add entries to their
+own :prop_tgt:`AUTOUIC_OPTIONS` property such as $<TARGET_PROPERTY:foo,INTERFACE_AUTOUIC_OPTIONS>
+to use the uic options specified in the interface of ``foo``.
+
+This property supports generator expressions.  See the
+:manual:`cmake-generator-expressions(7)` manual for available expressions.
diff --git a/Help/variable/CMAKE_DEBUG_TARGET_PROPERTIES.rst b/Help/variable/CMAKE_DEBUG_TARGET_PROPERTIES.rst
index 2ded823..6b17f6e 100644
--- a/Help/variable/CMAKE_DEBUG_TARGET_PROPERTIES.rst
+++ b/Help/variable/CMAKE_DEBUG_TARGET_PROPERTIES.rst
@@ -6,6 +6,6 @@ Enables tracing output for target properties.
 This variable can be populated with a list of properties to generate
 debug output for when evaluating target properties.  Currently it can
 only be used when evaluating the INCLUDE_DIRECTORIES,
-COMPILE_DEFINITIONS and COMPILE_OPTIONS target properties.  In that
-case, it outputs a backtrace for each entry in the target property.
+COMPILE_DEFINITIONS, COMPILE_OPTIONS and AUTOUIC_OPTIONS target properties.
+In that case, it outputs a backtrace for each entry in the target property.
 Default is unset.
diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx
index cfcaa70..76fd3ae 100644
--- a/Source/cmGeneratorExpressionDAGChecker.cxx
+++ b/Source/cmGeneratorExpressionDAGChecker.cxx
@@ -218,3 +218,11 @@ bool cmGeneratorExpressionDAGChecker::EvaluatingCompileFeatures() const
   return (strcmp(prop, "COMPILE_FEATURES") == 0
        || strcmp(prop, "INTERFACE_COMPILE_FEATURES") == 0);
 }
+
+//----------------------------------------------------------------------------
+bool cmGeneratorExpressionDAGChecker::EvaluatingAutoUicOptions() const
+{
+  const char *prop = this->Property.c_str();
+  return (strcmp(prop, "AUTOUIC_OPTIONS") == 0
+       || strcmp(prop, "INTERFACE_AUTOUIC_OPTIONS") == 0 );
+}
diff --git a/Source/cmGeneratorExpressionDAGChecker.h b/Source/cmGeneratorExpressionDAGChecker.h
index 0502430..eb2529e 100644
--- a/Source/cmGeneratorExpressionDAGChecker.h
+++ b/Source/cmGeneratorExpressionDAGChecker.h
@@ -21,14 +21,16 @@
   F(EvaluatingSystemIncludeDirectories) \
   F(EvaluatingCompileDefinitions) \
   F(EvaluatingCompileOptions) \
-  F(EvaluatingCompileFeatures)
+  F(EvaluatingCompileFeatures) \
+  F(EvaluatingAutoUicOptions)
 
 #define CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(F) \
   F(INCLUDE_DIRECTORIES) \
   F(SYSTEM_INCLUDE_DIRECTORIES) \
   F(COMPILE_DEFINITIONS) \
   F(COMPILE_OPTIONS) \
-  F(COMPILE_FEATURES)
+  F(COMPILE_FEATURES) \
+  F(AUTOUIC_OPTIONS)
 
 //----------------------------------------------------------------------------
 struct cmGeneratorExpressionDAGChecker
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index 437678a..2786860 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -360,6 +360,7 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget* target)
 
   std::map<std::string, std::string> configIncludes;
   std::map<std::string, std::string> configDefines;
+  std::map<std::string, std::string> configUicOptions;
 
   if (target->GetPropertyAsBool("AUTOMOC"))
     {
@@ -368,7 +369,7 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget* target)
     }
   if (target->GetPropertyAsBool("AUTOUIC"))
     {
-    this->SetupAutoUicTarget(target);
+    this->SetupAutoUicTarget(target, configUicOptions);
     }
   if (target->GetPropertyAsBool("AUTORCC"))
     {
@@ -383,7 +384,9 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget* target)
   makefile->ConfigureFile(inputFile.c_str(), outputFile.c_str(),
                           false, true, false);
 
-  if (!configDefines.empty() || !configIncludes.empty())
+  if (!configDefines.empty()
+      || !configIncludes.empty()
+      || !configUicOptions.empty())
     {
     std::ofstream infoFile(outputFile.c_str(), std::ios::app);
     if ( !infoFile )
@@ -414,6 +417,16 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget* target)
           " " << it->second << ")\n";
         }
       }
+    if (!configUicOptions.empty())
+      {
+      for (std::map<std::string, std::string>::iterator
+            it = configUicOptions.begin(), end = configUicOptions.end();
+            it != end; ++it)
+        {
+        infoFile << "set(AM_UIC_TARGET_OPTIONS_" << it->first <<
+          " " << it->second << ")\n";
+        }
+      }
     }
 }
 
@@ -596,7 +609,25 @@ void cmQtAutoGenerators::MergeUicOptions(std::vector<std::string> &opts,
   opts.insert(opts.end(), extraOpts.begin(), extraOpts.end());
 }
 
-void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget* target)
+static void GetUicOpts(cmTarget *target, const char * config,
+                       std::string &optString)
+{
+  std::vector<std::string> opts;
+  target->GetAutoUicOptions(opts, config);
+
+  const char* sep = "";
+  for(std::vector<std::string>::const_iterator optIt = opts.begin();
+      optIt != opts.end();
+      ++optIt)
+    {
+    optString += sep;
+    sep = ";";
+    optString += *optIt;
+    }
+}
+
+void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget* target,
+                          std::map<std::string, std::string> &configUicOptions)
 {
   cmMakefile *makefile = target->GetMakefile();
 
@@ -645,10 +676,30 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget* target)
 
   const char *qtVersion = makefile->GetDefinition("_target_qt_version");
 
-  if (const char* opts = target->GetProperty("AUTOUIC_OPTIONS"))
+  std::string _uic_opts;
+  std::vector<std::string> configs;
+  const char *config = makefile->GetConfigurations(configs);
+  GetUicOpts(target, config, _uic_opts);
+
+  if (!_uic_opts.empty())
+    {
+    _uic_opts = cmLocalGenerator::EscapeForCMake(_uic_opts.c_str());
+    makefile->AddDefinition("_uic_target_options", _uic_opts.c_str());
+    }
+  for (std::vector<std::string>::const_iterator li = configs.begin();
+       li != configs.end(); ++li)
     {
-    makefile->AddDefinition("_uic_target_options",
-                            cmLocalGenerator::EscapeForCMake(opts).c_str());
+    std::string config_uic_opts;
+    GetUicOpts(target, li->c_str(), config_uic_opts);
+    if (config_uic_opts != _uic_opts)
+      {
+      configUicOptions["_uic_target_options_" + *li] =
+                    cmLocalGenerator::EscapeForCMake(config_uic_opts.c_str());
+      if(_uic_opts.empty())
+        {
+        _uic_opts = config_uic_opts;
+        }
+      }
     }
 
   for(std::vector<cmSourceFile*>::const_iterator fileIt =
@@ -967,9 +1018,19 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(cmMakefile* makefile,
   {
   const char *uicOptionsFiles
                         = makefile->GetSafeDefinition("AM_UIC_OPTIONS_FILES");
+  std::string uicOptionsPropOrig = "AM_UIC_TARGET_OPTIONS";
+  std::string uicOptionsProp = uicOptionsPropOrig;
+  if(config)
+    {
+    uicOptionsProp += "_";
+    uicOptionsProp += config;
+    }
   const char *uicTargetOptions
-                        = makefile->GetSafeDefinition("AM_UIC_TARGET_OPTIONS");
-  cmSystemTools::ExpandListArgument(uicTargetOptions, this->UicTargetOptions);
+                        = makefile->GetSafeDefinition(uicOptionsProp.c_str());
+  cmSystemTools::ExpandListArgument(
+      uicTargetOptions ? uicTargetOptions
+                       : makefile->GetSafeDefinition(includesPropOrig.c_str()),
+    this->UicTargetOptions);
   const char *uicOptionsOptions
                       = makefile->GetSafeDefinition("AM_UIC_OPTIONS_OPTIONS");
   std::vector<std::string> uicFilesVec;
diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h
index 116f174..e877f7d 100644
--- a/Source/cmQtAutoGenerators.h
+++ b/Source/cmQtAutoGenerators.h
@@ -31,7 +31,8 @@ private:
                           const std::string &autogenTargetName,
                           std::map<std::string, std::string> &configIncludes,
                           std::map<std::string, std::string> &configDefines);
-  void SetupAutoUicTarget(cmTarget* target);
+  void SetupAutoUicTarget(cmTarget* target,
+                        std::map<std::string, std::string> &configUicOptions);
   void SetupAutoRccTarget(cmTarget* target);
 
   cmGlobalGenerator* CreateGlobalGenerator(cmake* cm,
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 6008840..55828c6 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -136,6 +136,7 @@ public:
   std::vector<TargetPropertyEntry*> IncludeDirectoriesEntries;
   std::vector<TargetPropertyEntry*> CompileOptionsEntries;
   std::vector<TargetPropertyEntry*> CompileFeaturesEntries;
+  std::vector<TargetPropertyEntry*> AutoUicOptionsEntries;
   std::vector<TargetPropertyEntry*> CompileDefinitionsEntries;
   std::vector<cmValueWithOrigin> LinkInterfacePropertyEntries;
 
@@ -144,6 +145,8 @@ public:
   mutable std::map<std::string, std::vector<TargetPropertyEntry*> >
                                 CachedLinkInterfaceCompileOptionsEntries;
   mutable std::map<std::string, std::vector<TargetPropertyEntry*> >
+                                CachedLinkInterfaceAutoUicOptionsEntries;
+  mutable std::map<std::string, std::vector<TargetPropertyEntry*> >
                                 CachedLinkInterfaceCompileDefinitionsEntries;
   mutable std::map<std::string, std::vector<TargetPropertyEntry*> >
                                 CachedLinkInterfaceCompileFeaturesEntries;
@@ -152,6 +155,7 @@ public:
   mutable std::map<std::string, bool> CacheLinkInterfaceCompileDefinitionsDone;
   mutable std::map<std::string, bool> CacheLinkInterfaceCompileOptionsDone;
   mutable std::map<std::string, bool> CacheLinkInterfaceCompileFeaturesDone;
+  mutable std::map<std::string, bool> CacheLinkInterfaceAutoUicOptionsDone;
 };
 
 //----------------------------------------------------------------------------
@@ -187,6 +191,7 @@ cmTargetInternals::~cmTargetInternals()
   deleteAndClear(this->CachedLinkInterfaceIncludeDirectoriesEntries);
   deleteAndClear(this->CachedLinkInterfaceCompileOptionsEntries);
   deleteAndClear(this->CachedLinkInterfaceCompileFeaturesEntries);
+  deleteAndClear(this->CachedLinkInterfaceAutoUicOptionsEntries);
   deleteAndClear(this->CachedLinkInterfaceCompileDefinitionsEntries);
 }
 
@@ -1423,6 +1428,17 @@ void cmTarget::SetProperty(const char* prop, const char* value)
                           new cmTargetInternals::TargetPropertyEntry(cge));
     return;
     }
+  if(strcmp(prop,"AUTOUIC_OPTIONS") == 0)
+    {
+    cmListFileBacktrace lfbt;
+    this->Makefile->GetBacktrace(lfbt);
+    cmGeneratorExpression ge(lfbt);
+    deleteAndClear(this->Internal->AutoUicOptionsEntries);
+    cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value);
+    this->Internal->AutoUicOptionsEntries.push_back(
+                          new cmTargetInternals::TargetPropertyEntry(cge));
+    return;
+    }
   if(strcmp(prop,"COMPILE_DEFINITIONS") == 0)
     {
     cmListFileBacktrace lfbt;
@@ -1497,6 +1513,15 @@ void cmTarget::AppendProperty(const char* prop, const char* value,
               new cmTargetInternals::TargetPropertyEntry(ge.Parse(value)));
     return;
     }
+  if(strcmp(prop,"AUTOUIC_OPTIONS") == 0)
+    {
+    cmListFileBacktrace lfbt;
+    this->Makefile->GetBacktrace(lfbt);
+    cmGeneratorExpression ge(lfbt);
+    this->Internal->AutoUicOptionsEntries.push_back(
+              new cmTargetInternals::TargetPropertyEntry(ge.Parse(value)));
+    return;
+    }
   if(strcmp(prop,"COMPILE_DEFINITIONS") == 0)
     {
     cmListFileBacktrace lfbt;
@@ -1993,6 +2018,106 @@ static void processCompileOptions(cmTarget const* tgt,
 }
 
 //----------------------------------------------------------------------------
+void cmTarget::GetAutoUicOptions(std::vector<std::string> &result,
+                                 const char *config) const
+{
+  std::set<std::string> uniqueOptions;
+  cmListFileBacktrace lfbt;
+
+  cmGeneratorExpressionDAGChecker dagChecker(lfbt,
+                                              this->GetName(),
+                                              "AUTOUIC_OPTIONS", 0, 0);
+
+  std::vector<std::string> debugProperties;
+  const char *debugProp =
+              this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
+  if (debugProp)
+    {
+    cmSystemTools::ExpandListArgument(debugProp, debugProperties);
+    }
+
+  bool debugOptions = !this->DebugCompileOptionsDone
+                    && std::find(debugProperties.begin(),
+                                 debugProperties.end(),
+                                 "AUTOUIC_OPTIONS")
+                        != debugProperties.end();
+
+  if (this->Makefile->IsGeneratingBuildSystem())
+    {
+    this->DebugAutoUicOptionsDone = true;
+    }
+
+  processCompileOptions(this,
+                            this->Internal->AutoUicOptionsEntries,
+                            result,
+                            uniqueOptions,
+                            &dagChecker,
+                            config,
+                            debugOptions);
+
+  std::string configString = config ? config : "";
+  if (!this->Internal->CacheLinkInterfaceAutoUicOptionsDone[configString])
+    {
+    for (std::vector<cmValueWithOrigin>::const_iterator
+        it = this->Internal->LinkInterfacePropertyEntries.begin(),
+        end = this->Internal->LinkInterfacePropertyEntries.end();
+        it != end; ++it)
+      {
+      if (!cmGeneratorExpression::IsValidTargetName(it->Value)
+          && cmGeneratorExpression::Find(it->Value) == std::string::npos)
+        {
+        continue;
+        }
+      {
+      cmGeneratorExpression ge(lfbt);
+      cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
+                                                        ge.Parse(it->Value);
+      std::string targetResult = cge->Evaluate(this->Makefile, config,
+                                        false, this, 0, 0);
+      if (!this->Makefile->FindTargetToUse(targetResult.c_str()))
+        {
+        continue;
+        }
+      }
+      std::string optionGenex = "$<TARGET_PROPERTY:" +
+                              it->Value + ",INTERFACE_AUTOUIC_OPTIONS>";
+      if (cmGeneratorExpression::Find(it->Value) != std::string::npos)
+        {
+        // Because it->Value is a generator expression, ensure that it
+        // evaluates to the non-empty string before being used in the
+        // TARGET_PROPERTY expression.
+        optionGenex = "$<$<BOOL:" + it->Value + ">:" + optionGenex + ">";
+        }
+      cmGeneratorExpression ge(it->Backtrace);
+      cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(
+                                                                optionGenex);
+
+      this->Internal
+        ->CachedLinkInterfaceAutoUicOptionsEntries[configString].push_back(
+                        new cmTargetInternals::TargetPropertyEntry(cge,
+                                                              it->Value));
+      }
+    }
+
+  processCompileOptions(this,
+    this->Internal->CachedLinkInterfaceAutoUicOptionsEntries[configString],
+                            result,
+                            uniqueOptions,
+                            &dagChecker,
+                            config,
+                            debugOptions);
+
+  if (!this->Makefile->IsGeneratingBuildSystem())
+    {
+    deleteAndClear(this->Internal->CachedLinkInterfaceAutoUicOptionsEntries);
+    }
+  else
+    {
+    this->Internal->CacheLinkInterfaceAutoUicOptionsDone[configString] = true;
+    }
+}
+
+//----------------------------------------------------------------------------
 void cmTarget::GetCompileOptions(std::vector<std::string> &result,
                                  const char *config) const
 {
@@ -2822,6 +2947,24 @@ const char *cmTarget::GetProperty(const char* prop,
       }
     return output.c_str();
     }
+  if(strcmp(prop,"AUTOUIC_OPTIONS") == 0)
+    {
+    static std::string output;
+    output = "";
+    std::string sep;
+    typedef cmTargetInternals::TargetPropertyEntry
+                                TargetPropertyEntry;
+    for (std::vector<TargetPropertyEntry*>::const_iterator
+        it = this->Internal->AutoUicOptionsEntries.begin(),
+        end = this->Internal->AutoUicOptionsEntries.end();
+        it != end; ++it)
+      {
+      output += sep;
+      output += (*it)->ge->GetInput();
+      sep = ";";
+      }
+    return output.c_str();
+    }
   if(strcmp(prop,"COMPILE_DEFINITIONS") == 0)
     {
     static std::string output;
@@ -6025,6 +6168,7 @@ cmTargetInternalPointer::~cmTargetInternalPointer()
   deleteAndClear(this->Pointer->IncludeDirectoriesEntries);
   deleteAndClear(this->Pointer->CompileOptionsEntries);
   deleteAndClear(this->Pointer->CompileFeaturesEntries);
+  deleteAndClear(this->Pointer->AutoUicOptionsEntries);
   deleteAndClear(this->Pointer->CompileDefinitionsEntries);
   delete this->Pointer;
 }
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 0dc90a4..1dd3620 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -526,6 +526,8 @@ public:
                          const char *config) const;
   void GetCompileFeatures(std::vector<std::string> &result,
                            const char *config) const;
+  void GetAutoUicOptions(std::vector<std::string> &result,
+                         const char *config) const;
 
   bool IsNullImpliedByLinkLibraries(const std::string &p) const;
   bool IsLinkInterfaceDependentBoolProperty(const std::string &p,
@@ -683,6 +685,7 @@ private:
   bool IsImportedTarget;
   mutable bool DebugIncludesDone;
   mutable bool DebugCompileOptionsDone;
+  mutable bool DebugAutoUicOptionsDone;
   mutable bool DebugCompileDefinitionsDone;
   mutable bool DebugCompileFeaturesDone;
   mutable std::set<std::string> LinkImplicitNullProperties;
diff --git a/Tests/QtAutoUicInterface/CMakeLists.txt b/Tests/QtAutoUicInterface/CMakeLists.txt
new file mode 100644
index 0000000..155cb67
--- /dev/null
+++ b/Tests/QtAutoUicInterface/CMakeLists.txt
@@ -0,0 +1,50 @@
+
+cmake_minimum_required(VERSION 2.8.12)
+
+project(QtAutoUicInterface)
+
+find_package(Qt5Widgets 5.3 REQUIRED)
+
+set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTOUIC ON)
+
+# BEGIN Upstream
+
+add_library(KI18n klocalizedstring.cpp)
+target_link_libraries(KI18n Qt5::Core)
+
+set(autouic_options
+  -include klocalizedstring.h
+  -tr tr2$<$<NOT:$<BOOL:$<TARGET_PROPERTY:NO_KUIT_SEMANTIC>>>:x>i18n
+)
+set_property(TARGET KI18n APPEND PROPERTY
+  INTERFACE_AUTOUIC_OPTIONS ${autouic_options}
+)
+
+set(domainProp $<TARGET_PROPERTY:TRANSLATION_DOMAIN>)
+set(nameLower $<LOWER_CASE:$<MAKE_C_IDENTIFIER:$<TARGET_PROPERTY:NAME>>>)
+set(domain_logic
+  $<$<BOOL:${domainProp}>:${domainProp}>$<$<NOT:$<BOOL:${domainProp}>>:${nameLower}>
+)
+set_property(TARGET KI18n APPEND PROPERTY
+  INTERFACE_COMPILE_DEFINITIONS "TRANSLATION_DOMAIN=${domain_logic}"
+)
+
+# END upstream
+
+add_library(LibWidget libwidget.cpp)
+target_link_libraries(LibWidget KI18n Qt5::Widgets)
+set_property(TARGET LibWidget PROPERTY NO_KUIT_SEMANTIC ON)
+set_property(TARGET LibWidget PROPERTY TRANSLATION_DOMAIN customdomain)
+
+add_library(MyWidget mywidget.cpp)
+target_link_libraries(MyWidget KI18n Qt5::Widgets)
+
+add_executable(QtAutoUicInterface main.cpp)
+target_compile_definitions(QtAutoUicInterface
+  PRIVATE
+    UI_LIBWIDGET_H="${CMAKE_CURRENT_BINARY_DIR}/ui_libwidget.h"
+    UI_MYWIDGET_H="${CMAKE_CURRENT_BINARY_DIR}/ui_mywidget.h"
+)
diff --git a/Tests/QtAutoUicInterface/klocalizedstring.cpp b/Tests/QtAutoUicInterface/klocalizedstring.cpp
new file mode 100644
index 0000000..b1c4523
--- /dev/null
+++ b/Tests/QtAutoUicInterface/klocalizedstring.cpp
@@ -0,0 +1,12 @@
+
+#include "klocalizedstring.h"
+
+QString tr2xi18n(const char *text, const char *)
+{
+  return QStringLiteral("TranslatedX") + QString::fromLatin1(text);
+}
+
+QString tr2i18n(const char *text, const char *)
+{
+  return QStringLiteral("Translated") + QString::fromLatin1(text);
+}
diff --git a/Tests/QtAutoUicInterface/klocalizedstring.h b/Tests/QtAutoUicInterface/klocalizedstring.h
new file mode 100644
index 0000000..559058f
--- /dev/null
+++ b/Tests/QtAutoUicInterface/klocalizedstring.h
@@ -0,0 +1,17 @@
+
+#ifndef KLOCALIZEDSTRING_H
+#define KLOCALIZEDSTRING_H
+
+#include <QString>
+
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+QString tr2xi18n(const char *text, const char *comment = 0);
+
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+QString tr2i18n(const char *text, const char *comment = 0);
+
+#endif
diff --git a/Tests/QtAutoUicInterface/libwidget.cpp b/Tests/QtAutoUicInterface/libwidget.cpp
new file mode 100644
index 0000000..8a921b3
--- /dev/null
+++ b/Tests/QtAutoUicInterface/libwidget.cpp
@@ -0,0 +1,9 @@
+
+#include "libwidget.h"
+
+LibWidget::LibWidget(QWidget *parent)
+  : QWidget(parent),
+    ui(new Ui::LibWidget)
+{
+  ui->setupUi(this);
+}
diff --git a/Tests/QtAutoUicInterface/libwidget.h b/Tests/QtAutoUicInterface/libwidget.h
new file mode 100644
index 0000000..96ffda3
--- /dev/null
+++ b/Tests/QtAutoUicInterface/libwidget.h
@@ -0,0 +1,19 @@
+
+#ifndef LIBWIDGET_H
+#define LIBWIDGET_H
+
+#include <QWidget>
+
+#include "ui_libwidget.h"
+
+class LibWidget : public QWidget
+{
+  Q_OBJECT
+public:
+  explicit LibWidget(QWidget *parent = 0);
+
+private:
+  QScopedPointer<Ui::LibWidget> ui;
+};
+
+#endif
diff --git a/Tests/QtAutoUicInterface/libwidget.ui b/Tests/QtAutoUicInterface/libwidget.ui
new file mode 100644
index 0000000..897371e
--- /dev/null
+++ b/Tests/QtAutoUicInterface/libwidget.ui
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>LibWidget</class>
+ <widget class="QWidget" name="LibWidget">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <widget class="QLabel" name="label">
+   <property name="geometry">
+    <rect>
+     <x>180</x>
+     <y>60</y>
+     <width>57</width>
+     <height>15</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>LibLabel</string>
+   </property>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/Tests/QtAutoUicInterface/main.cpp b/Tests/QtAutoUicInterface/main.cpp
new file mode 100644
index 0000000..bf11f90
--- /dev/null
+++ b/Tests/QtAutoUicInterface/main.cpp
@@ -0,0 +1,73 @@
+
+#include <fstream>
+#include <iostream>
+#include <string>
+
+int main(int argc, char **argv)
+{
+  std::ifstream f;
+  f.open(UI_LIBWIDGET_H);
+  if (!f.is_open())
+    {
+    return -1;
+    }
+
+  {
+  bool gotTr2i18n = false;
+
+  while (!f.eof())
+    {
+    std::string output;
+    getline(f, output);
+    if (!gotTr2i18n)
+      {
+      gotTr2i18n = output.find("tr2i18n") != std::string::npos;
+      }
+    if (output.find("tr2xi18n") != std::string::npos)
+      {
+      std::cout << "ui_libwidget,h uses tr2xi18n, though it should not." << std::endl;
+      return -1;
+      }
+    }
+
+  if (!gotTr2i18n)
+    {
+    std::cout << "Did not find tr2i18n in ui_libwidget.h" << std::endl;
+    return -1;
+    }
+  }
+
+  f.close();
+  f.open(UI_MYWIDGET_H);
+  if (!f.is_open())
+    {
+    return -1;
+    }
+
+  {
+  bool gotTr2xi18n = false;
+
+  while (!f.eof())
+    {
+    std::string output;
+    getline(f, output);
+    if (!gotTr2xi18n)
+      {
+      gotTr2xi18n = output.find("tr2xi18n") != std::string::npos;
+      }
+    if (output.find("tr2i18n") != std::string::npos)
+      {
+      std::cout << "ui_mywidget,h uses tr2i18n, though it should not." << std::endl;
+      return -1;
+      }
+    }
+  if (!gotTr2xi18n)
+    {
+    std::cout << "Did not find tr2xi18n in ui_mywidget.h" << std::endl;
+    return -1;
+    }
+  }
+  f.close();
+
+  return 0;
+}
diff --git a/Tests/QtAutoUicInterface/mywidget.cpp b/Tests/QtAutoUicInterface/mywidget.cpp
new file mode 100644
index 0000000..b528b1a
--- /dev/null
+++ b/Tests/QtAutoUicInterface/mywidget.cpp
@@ -0,0 +1,9 @@
+
+#include "mywidget.h"
+
+MyWidget::MyWidget(QWidget *parent)
+  : QWidget(parent),
+    ui(new Ui::MyWidget)
+{
+  ui->setupUi(this);
+}
diff --git a/Tests/QtAutoUicInterface/mywidget.h b/Tests/QtAutoUicInterface/mywidget.h
new file mode 100644
index 0000000..4f31a39
--- /dev/null
+++ b/Tests/QtAutoUicInterface/mywidget.h
@@ -0,0 +1,19 @@
+
+#ifndef MYWIDGET_H
+#define MYWIDGET_H
+
+#include <QWidget>
+
+#include "ui_mywidget.h"
+
+class MyWidget : public QWidget
+{
+  Q_OBJECT
+public:
+  explicit MyWidget(QWidget *parent = 0);
+
+private:
+  QScopedPointer<Ui::MyWidget> ui;
+};
+
+#endif
diff --git a/Tests/QtAutoUicInterface/mywidget.ui b/Tests/QtAutoUicInterface/mywidget.ui
new file mode 100644
index 0000000..b2b9cc5
--- /dev/null
+++ b/Tests/QtAutoUicInterface/mywidget.ui
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MyWidget</class>
+ <widget class="QWidget" name="MyWidget">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <widget class="QPushButton" name="pushButton">
+   <property name="geometry">
+    <rect>
+     <x>110</x>
+     <y>40</y>
+     <width>81</width>
+     <height>23</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Special button</string>
+   </property>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=50697af2d7f24c6b8bc0d9cbee080875193b7b0d
commit 50697af2d7f24c6b8bc0d9cbee080875193b7b0d
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Nov 20 23:17:13 2013 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Thu Nov 21 01:35:59 2013 +0100

    QtAutoUic: Handle new -include command line parameter.

diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index 36cb368..437678a 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -560,6 +560,7 @@ void cmQtAutoGenerators::MergeUicOptions(std::vector<std::string> &opts,
     "translate",
     "postfix",
     "generator",
+    "include", // Since Qt 5.3
     "g"
   };
   std::vector<std::string> extraOpts;

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2fad001fdae5d25f84c08f392469234b71b29134
commit 2fad001fdae5d25f84c08f392469234b71b29134
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Nov 20 21:40:29 2013 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Thu Nov 21 01:35:59 2013 +0100

    Genex: Add LOWER_CASE and MAKE_C_IDENTIFIER string manipulators.

diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst
index c7d2ed2..886f073 100644
--- a/Help/manual/cmake-generator-expressions.7.rst
+++ b/Help/manual/cmake-generator-expressions.7.rst
@@ -177,3 +177,7 @@ $<BUILD_INTERFACE:...>
   Content of ``...`` when the property is exported using :command:`export`, or
   when the target is used by another target in the same buildsystem. Expands to
   the empty string otherwise.
+$<LOWER_CASE:...>
+  Content of ``...`` converted to lower case.
+$<MAKE_C_IDENTIFIER:...>
+  Content of ``...`` converted to a C identifier.
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index 2ae5a22..6a4ed37 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -199,6 +199,34 @@ static const struct StrEqualNode : public cmGeneratorExpressionNode
 } strEqualNode;
 
 //----------------------------------------------------------------------------
+static const struct LowerCaseNode : public cmGeneratorExpressionNode
+{
+  LowerCaseNode() {}
+
+  std::string Evaluate(const std::vector<std::string> &parameters,
+                       cmGeneratorExpressionContext *,
+                       const GeneratorExpressionContent *,
+                       cmGeneratorExpressionDAGChecker *) const
+  {
+    return cmSystemTools::LowerCase(parameters.front());
+  }
+} lowerCaseNode;
+
+//----------------------------------------------------------------------------
+static const struct MakeCIdentifierNode : public cmGeneratorExpressionNode
+{
+  MakeCIdentifierNode() {}
+
+  std::string Evaluate(const std::vector<std::string> &parameters,
+                       cmGeneratorExpressionContext *,
+                       const GeneratorExpressionContent *,
+                       cmGeneratorExpressionDAGChecker *) const
+  {
+    return cmSystemTools::MakeCidentifier(parameters.front().c_str());
+  }
+} makeCIdentifierNode;
+
+//----------------------------------------------------------------------------
 static const struct Angle_RNode : public cmGeneratorExpressionNode
 {
   Angle_RNode() {}
@@ -1441,6 +1469,10 @@ cmGeneratorExpressionNode* GetNode(const std::string &identifier)
     return &targetSoNameFileDirNode;
   else if (identifier == "STREQUAL")
     return &strEqualNode;
+  else if (identifier == "LOWER_CASE")
+    return &lowerCaseNode;
+  else if (identifier == "MAKE_C_IDENTIFIER")
+    return &makeCIdentifierNode;
   else if (identifier == "BOOL")
     return &boolNode;
   else if (identifier == "ANGLE-R")

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=993d501bd3537d48e63d5d97a9fe16f079898978
commit 993d501bd3537d48e63d5d97a9fe16f079898978
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Nov 20 22:01:41 2013 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Thu Nov 21 01:35:59 2013 +0100

    Help: Reformat the generator expression documentation.
    
    Use description lists instead of a preformatted block to enumerate
    the genex documentation.
    
    Consistently capitalize the description.
    
    Use ``...`` to format genex parameters in the description.
    
    Turn references to commands into links.
    
    Add high level documentation about the motivation for generator
    expressions.
    
    Regroup expressions into subsections for different genex types. Add
    a high-level description and example of the expressions in each
    section.
    
    Explode the documentation for filesystem artifacts, instead of only
    referring to the variations.

diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst
index ddde183..c7d2ed2 100644
--- a/Help/manual/cmake-generator-expressions.7.rst
+++ b/Help/manual/cmake-generator-expressions.7.rst
@@ -10,77 +10,170 @@ cmake-generator-expressions(7)
 Generator Expressions
 =====================
 
-Generator expressions are evaluated during build
-system generation to produce information specific to each build
-configuration.  Valid expressions are:
-
-::
-
-  $<0:...>                  = empty string (ignores "...")
-  $<1:...>                  = content of "..."
-  $<CONFIG:cfg>             = '1' if config is "cfg", else '0'
-  $<CONFIGURATION>          = configuration name
-  $<BOOL:...>               = '1' if the '...' is true, else '0'
-  $<STREQUAL:a,b>           = '1' if a is STREQUAL b, else '0'
-  $<ANGLE-R>                = A literal '>'. Used to compare strings which contain a '>' for example.
-  $<COMMA>                  = A literal ','. Used to compare strings which contain a ',' for example.
-  $<SEMICOLON>              = A literal ';'. Used to prevent list expansion on an argument with ';'.
-  $<JOIN:list,...>          = joins the list with the content of "..."
-  $<TARGET_NAME:...>        = Marks ... as being the name of a target.  This is required if exporting targets to multiple dependent export sets.  The '...' must be a literal name of a target- it may not contain generator expressions.
-  $<INSTALL_INTERFACE:...>  = content of "..." when the property is exported using install(EXPORT), and empty otherwise.
-  $<BUILD_INTERFACE:...>    = content of "..." when the property is exported using export(), or when the target is used by another target in the same buildsystem. Expands to the empty string otherwise.
-  $<PLATFORM_ID>            = The CMake-id of the platform   $<PLATFORM_ID:comp>       = '1' if the The CMake-id of the platform matches comp, otherwise '0'.
-  $<C_COMPILER_ID>          = The CMake-id of the C compiler used.
-  $<C_COMPILER_ID:comp>     = '1' if the CMake-id of the C compiler matches comp, otherwise '0'.
-  $<CXX_COMPILER_ID>        = The CMake-id of the CXX compiler used.
-  $<CXX_COMPILER_ID:comp>   = '1' if the CMake-id of the CXX compiler matches comp, otherwise '0'.
-  $<VERSION_GREATER:v1,v2>  = '1' if v1 is a version greater than v2, else '0'.
-  $<VERSION_LESS:v1,v2>     = '1' if v1 is a version less than v2, else '0'.
-  $<VERSION_EQUAL:v1,v2>    = '1' if v1 is the same version as v2, else '0'.
-  $<C_COMPILER_VERSION>     = The version of the C compiler used.
-  $<C_COMPILER_VERSION:ver> = '1' if the version of the C compiler matches ver, otherwise '0'.
-  $<CXX_COMPILER_VERSION>   = The version of the CXX compiler used.
-  $<CXX_COMPILER_VERSION:ver> = '1' if the version of the CXX compiler matches ver, otherwise '0'.
-  $<TARGET_FILE:tgt>        = main file (.exe, .so.1.2, .a)
-  $<TARGET_LINKER_FILE:tgt> = file used to link (.a, .lib, .so)
-  $<TARGET_SONAME_FILE:tgt> = file with soname (.so.3)
-
-where "tgt" is the name of a target.  Target file expressions produce
-a full path, but _DIR and _NAME versions can produce the directory and
-file name components:
-
-::
-
-  $<TARGET_FILE_DIR:tgt>/$<TARGET_FILE_NAME:tgt>
-  $<TARGET_LINKER_FILE_DIR:tgt>/$<TARGET_LINKER_FILE_NAME:tgt>
-  $<TARGET_SONAME_FILE_DIR:tgt>/$<TARGET_SONAME_FILE_NAME:tgt>
-
-
-
-::
-
-  $<TARGET_PROPERTY:tgt,prop>   = The value of the property prop on the target tgt.
-
-Note that tgt is not added as a dependency of the target this
-expression is evaluated on.
-
-::
-
-  $<TARGET_POLICY:pol>          = '1' if the policy was NEW when the 'head' target was created, else '0'.  If the policy was not set, the warning message for the policy will be emitted.  This generator expression only works for a subset of policies.
-  $<INSTALL_PREFIX>         = Content of the install prefix when the target is exported via INSTALL(EXPORT) and empty otherwise.
-
-Boolean expressions:
-
-::
-
-  $<AND:?[,?]...>           = '1' if all '?' are '1', else '0'
-  $<OR:?[,?]...>            = '0' if all '?' are '0', else '1'
-  $<NOT:?>                  = '0' if '?' is '1', else '1'
-
-where '?' is always either '0' or '1'.
-
-Expressions with an implicit 'this' target:
-
-::
-
-  $<TARGET_PROPERTY:prop>   = The value of the property prop on the target on which the generator expression is evaluated.
+Generator expressions are evaluated during build system generation to produce
+information specific to each build configuration.
+
+Generator expressions are allowed in the context of many target properties,
+such as :prop_tgt:`LINK_LIBRARIES`, :prop_tgt:`INCLUDE_DIRECTORIES`,
+:prop_tgt:`COMPILE_DEFINITIONS` and others.  They may also be used when using
+commands to populate those properties, such as :command:`target_link_libraries`,
+:command:`target_include_directories`, :command:`target_compile_definitions`
+and others.
+
+This means that they enable conditional linking, conditional
+definitions used when compiling, and conditional include directories and
+more.  The conditions may be based on the build configuration, target
+properties, platform information or any other queryable information.
+
+Logical expressions
+-------------------
+
+Logical expressions are used to create conditional output.  The basic
+expressions are the ``0`` and ``1`` expressions.  Because other logical
+expressions evaluate to either ``0`` or ``1``, they can be composed to
+create conditional output::
+
+  $<$<CONFIG:Debug>:DEBUG_MODE>
+
+expands to ``DEBUG_MODE`` when the ``Debug`` configuration is used, and
+otherwise expands to nothing.
+
+$<0:...>
+  Empty string (ignores ``...``)
+$<1:...>
+  Content of ``...``
+$<BOOL:...>
+  '1' if the ``...`` is true, else '0'
+$<AND:?[,?]...>
+  '1' if all ``?`` are '1', else '0'
+
+  The ``?`` must always be either '0' or '1' in boolean expressions.
+
+$<OR:?[,?]...>
+  '0' if all ``?`` are '0', else '1'
+$<NOT:?>
+  '0' if ``?`` is '1', else '1'
+$<STREQUAL:a,b>
+  '1' if ``a`` is STREQUAL ``b``, else '0'
+$<CONFIG:cfg>
+  '1' if config is ``cfg``, else '0'. This is a case-insensitive comparison.
+  The mapping in :prop_tgt:`MAP_IMPORTED_CONFIG_<CONFIG>` is also considered by
+  this expression when it is evaluated on a property on an :prop_tgt:`IMPORTED`
+  target.
+$<PLATFORM_ID:comp>
+  '1' if the CMake-id of the platform matches ``comp``, otherwise '0'.
+$<C_COMPILER_ID:comp>
+  '1' if the CMake-id of the C compiler matches ``comp``, otherwise '0'.
+$<CXX_COMPILER_ID:comp>
+  '1' if the CMake-id of the CXX compiler matches ``comp``, otherwise '0'.
+$<VERSION_GREATER:v1,v2>
+  '1' if ``v1`` is a version greater than ``v2``, else '0'.
+$<VERSION_LESS:v1,v2>
+  '1' if ``v1`` is a version less than ``v2``, else '0'.
+$<VERSION_EQUAL:v1,v2>
+  '1' if ``v1`` is the same version as ``v2``, else '0'.
+$<C_COMPILER_VERSION:ver>
+  '1' if the version of the C compiler matches ``ver``, otherwise '0'.
+$<CXX_COMPILER_VERSION:ver>
+  '1' if the version of the CXX compiler matches ``ver``, otherwise '0'.
+$<TARGET_POLICY:pol>
+  '1' if the policy ``pol`` was NEW when the 'head' target was created,
+  else '0'.  If the policy was not set, the warning message for the policy
+  will be emitted. This generator expression only works for a subset of
+  policies.
+
+Informational expressions
+-------------------------
+
+These expressions expand to some information. The information may be used
+directly, eg::
+
+  include_directories(/usr/include/$<CXX_COMPILER_ID>/)
+
+expands to ``/usr/include/GNU/`` or ``/usr/include/Clang/`` etc, depending on
+the Id of the compiler.
+
+These expressions may also may be combined with logical expressions::
+
+  $<$<VERSION_LESS:$<CXX_COMPILER_VERSION>,4.2.0>:OLD_COMPILER>
+
+expands to ``OLD_COMPILER`` if the :variable:`CMAKE_<LANG>_COMPILER_VERSION` is
+less than 4.2.0.
+
+$<CONFIGURATION>
+  Configuration name
+$<PLATFORM_ID>
+  The CMake-id of the platform
+$<C_COMPILER_ID>
+  The CMake-id of the C compiler used.
+$<CXX_COMPILER_ID>
+  The CMake-id of the CXX compiler used.
+$<C_COMPILER_VERSION>
+  The version of the C compiler used.
+$<CXX_COMPILER_VERSION>
+  The version of the CXX compiler used.
+$<TARGET_FILE:tgt>
+  Full path to main file (.exe, .so.1.2, .a) where ``tgt`` is the name of a target.
+$<TARGET_FILE_NAME:tgt>
+  Name of main file (.exe, .so.1.2, .a).
+$<TARGET_FILE_DIR:tgt>
+  Directory of main file (.exe, .so.1.2, .a).
+$<TARGET_LINKER_FILE:tgt>
+  File used to link (.a, .lib, .so) where ``tgt`` is the name of a target.
+$<TARGET_LINKER_FILE_NAME:tgt>
+  Name of file used to link (.a, .lib, .so).
+$<TARGET_LINKER_FILE_DIR:tgt>
+  Directory of file used to link (.a, .lib, .so).
+$<TARGET_SONAME_FILE:tgt>
+  File with soname (.so.3) where ``tgt`` is the name of a target.
+$<TARGET_SONAME_FILE_NAME:tgt>
+  Name of file with soname (.so.3).
+$<TARGET_SONAME_FILE_DIR:tgt>
+  Directory of with soname (.so.3).
+$<TARGET_PROPERTY:tgt,prop>
+  Value of the property ``prop`` on the target ``tgt``.
+
+  Note that ``tgt`` is not added as a dependency of the target this
+  expression is evaluated on.
+$<TARGET_PROPERTY:prop>
+  Value of the property ``prop`` on the target on which the generator
+  expression is evaluated.
+$<INSTALL_PREFIX>
+  Content of the install prefix when the target is exported via
+  :command:`install` (EXPORT) and empty otherwise.
+
+Output expressions
+------------------
+
+These expressions generate output, in some cases depending on an input. These
+expressions may be combined with other expressions for information or logical
+comparison::
+
+  -I$<JOIN:$<TARGET_PROPERTY:INCLUDE_DIRECTORIES>, -I>
+
+generates a string of the entries in the :prop_tgt:`INCLUDE_DIRECTORIES` target
+property with each entry preceeded by ``-I``. Note that a more-complete use
+in this situation would be require first checking if the INCLUDE_DIRECTORIES
+property is non-empty::
+
+  $<$<BOOL:$<TARGET_PROPERTY:INCLUDE_DIRECTORIES>>:-I$<JOIN:$<TARGET_PROPERTY:INCLUDE_DIRECTORIES>, -I>>
+
+$<JOIN:list,...>
+  Joins the list with the content of ``...``
+$<ANGLE-R>
+  A literal '>'. Used to compare strings which contain a '>' for example.
+$<COMMA>
+  A literal ','. Used to compare strings which contain a ',' for example.
+$<SEMICOLON>
+  A literal ';'. Used to prevent list expansion on an argument with ';'.
+$<TARGET_NAME:...>
+  Marks ``...`` as being the name of a target.  This is required if exporting
+  targets to multiple dependent export sets.  The ``...`` must be a literal
+  name of a target- it may not contain generator expressions.
+$<INSTALL_INTERFACE:...>
+  Content of ``...`` when the property is exported using :command:`install` (EXPORT),
+  and empty otherwise.
+$<BUILD_INTERFACE:...>
+  Content of ``...`` when the property is exported using :command:`export`, or
+  when the target is used by another target in the same buildsystem. Expands to
+  the empty string otherwise.

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e32a3bb1ed46276f9a01bbc0625689bdee8b4f6e
commit e32a3bb1ed46276f9a01bbc0625689bdee8b4f6e
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Oct 30 21:13:44 2013 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Thu Nov 21 01:35:58 2013 +0100

    Base the target_compile_features command on cmTargetPropCommandBase.
    
    This gives us 'free' handling of IMPORTED, ALIAS, INTERFACE,
    non-compilable and missing targets.

diff --git a/Source/cmTargetCompileFeaturesCommand.cxx b/Source/cmTargetCompileFeaturesCommand.cxx
index 8b48ce3..8a7e5f8 100644
--- a/Source/cmTargetCompileFeaturesCommand.cxx
+++ b/Source/cmTargetCompileFeaturesCommand.cxx
@@ -15,49 +15,56 @@ bool cmTargetCompileFeaturesCommand::InitialPass(
   std::vector<std::string> const& args,
   cmExecutionStatus &)
 {
-  if (args.size() < 3)
-    {
-      this->SetError("called with wrong number of arguments.");
-      return false;
-    }
-  cmTarget *target = this->Makefile->FindTargetToUse(args[0].c_str());
+  return this->HandleArguments(args, "COMPILE_FEATURES", NO_FLAGS);
+}
 
-  if(!target)
-    {
-    this->SetError("specified invalid target.");
-    return false;
-    }
+void cmTargetCompileFeaturesCommand
+::HandleImportedTarget(const std::string &tgt)
+{
+  cmOStringStream e;
+  e << "Cannot specify compile features for imported target \""
+    << tgt << "\".";
+  this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
+}
 
-  if(target->IsImported())
-    {
-    this->SetError("may not be used with an IMPORTED target.");
-    return false;
-    }
+void cmTargetCompileFeaturesCommand
+::HandleMissingTarget(const std::string &name)
+{
+  cmOStringStream e;
+  e << "Cannot specify compile features for target \"" << name << "\" "
+       "which is not built by this project.";
+  this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
+}
 
-  const bool interfaceOnly = args[1] == "INTERFACE";
-  if(args[1] != "PRIVATE" && args[1] != "PUBLIC" && !interfaceOnly)
+//----------------------------------------------------------------------------
+std::string cmTargetCompileFeaturesCommand
+::Join(const std::vector<std::string> &content)
+{
+  std::string defs;
+  std::string sep;
+  for(std::vector<std::string>::const_iterator it = content.begin();
+    it != content.end(); ++it)
     {
-    this->SetError("called with invalid arguments.");
-    return false;
+    defs += sep + *it;
+    sep = ";";
     }
+  return defs;
+}
 
-  for (size_t i = 2; i < args.size(); ++i)
+//----------------------------------------------------------------------------
+bool cmTargetCompileFeaturesCommand
+::HandleDirectContent(cmTarget *tgt, const std::vector<std::string> &content,
+                                   bool, bool)
+{
+  for(std::vector<std::string>::const_iterator it = content.begin();
+    it != content.end(); ++it)
     {
-    std::string feature = args[i];
-
-    if (!interfaceOnly)
-      {
-      if (!this->Makefile->AddRequiredTargetFeature(target, feature.c_str()))
-        {
-        cmOStringStream e;
-        e << "specified unknown feature \"" << feature << "\".";
-        this->SetError(e.str().c_str());
-        return false;
-        }
-      }
-    if (interfaceOnly || args[1] == "PUBLIC")
+    if(!this->Makefile->AddRequiredTargetFeature(tgt, it->c_str()))
       {
-      target->AppendProperty("INTERFACE_COMPILE_FEATURES", feature.c_str());
+      cmOStringStream e;
+      e << "specified unknown feature \"" << *it << "\".";
+      this->SetError(e.str().c_str());
+      return false;
       }
     }
   return true;
diff --git a/Source/cmTargetCompileFeaturesCommand.h b/Source/cmTargetCompileFeaturesCommand.h
index 63beeca..97a61ba 100644
--- a/Source/cmTargetCompileFeaturesCommand.h
+++ b/Source/cmTargetCompileFeaturesCommand.h
@@ -12,9 +12,9 @@
 #ifndef cmTargetCompileFeaturesCommand_h
 #define cmTargetCompileFeaturesCommand_h
 
-#include "cmCommand.h"
+#include "cmTargetPropCommandBase.h"
 
-class cmTargetCompileFeaturesCommand : public cmCommand
+class cmTargetCompileFeaturesCommand : public cmTargetPropCommandBase
 {
   virtual cmCommand* Clone()
     {
@@ -26,7 +26,16 @@ class cmTargetCompileFeaturesCommand : public cmCommand
 
   virtual const char* GetName() const { return "target_compile_features";}
 
-  cmTypeMacro(cmTargetCompileFeaturesCommand, cmCommand);
+  cmTypeMacro(cmTargetCompileFeaturesCommand, cmTargetPropCommandBase);
+
+private:
+  virtual void HandleImportedTarget(const std::string &tgt);
+  virtual void HandleMissingTarget(const std::string &name);
+
+  virtual bool HandleDirectContent(cmTarget *tgt,
+                                   const std::vector<std::string> &content,
+                                   bool prepend, bool system);
+  virtual std::string Join(const std::vector<std::string> &content);
 };
 
 #endif
diff --git a/Tests/RunCMake/target_compile_features/RunCMakeTest.cmake b/Tests/RunCMake/target_compile_features/RunCMakeTest.cmake
index 28341c9..f2abef7 100644
--- a/Tests/RunCMake/target_compile_features/RunCMakeTest.cmake
+++ b/Tests/RunCMake/target_compile_features/RunCMakeTest.cmake
@@ -1,4 +1,11 @@
 include(RunCMake)
 
+run_cmake(not_enough_args)
+run_cmake(alias_target)
+run_cmake(utility_target)
+run_cmake(invalid_args)
+run_cmake(invalid_args_on_interface)
+run_cmake(imported_target)
+run_cmake(no_target)
 run_cmake(not_a_cxx_feature)
 run_cmake(no_matching_cxx_feature)
diff --git a/Tests/RunCMake/target_compile_features/alias_target-result.txt b/Tests/RunCMake/target_compile_features/alias_target-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/target_compile_features/alias_target-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/target_compile_features/alias_target-stderr.txt b/Tests/RunCMake/target_compile_features/alias_target-stderr.txt
new file mode 100644
index 0000000..3321e3f
--- /dev/null
+++ b/Tests/RunCMake/target_compile_features/alias_target-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at alias_target.cmake:4 \(target_compile_features\):
+  target_compile_features can not be used on an ALIAS target.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:4 \(include\)
diff --git a/Tests/RunCMake/target_compile_features/alias_target.cmake b/Tests/RunCMake/target_compile_features/alias_target.cmake
new file mode 100644
index 0000000..d35ddba
--- /dev/null
+++ b/Tests/RunCMake/target_compile_features/alias_target.cmake
@@ -0,0 +1,4 @@
+
+add_executable(main empty.cpp)
+add_executable(Alias::Main ALIAS main)
+target_compile_features(Alias::Main PRIVATE cxx_delegating_constructors)
diff --git a/Tests/RunCMake/target_compile_features/imported_target-result.txt b/Tests/RunCMake/target_compile_features/imported_target-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/target_compile_features/imported_target-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/target_compile_features/imported_target-stderr.txt b/Tests/RunCMake/target_compile_features/imported_target-stderr.txt
new file mode 100644
index 0000000..95431b4
--- /dev/null
+++ b/Tests/RunCMake/target_compile_features/imported_target-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at imported_target.cmake:3 \(target_compile_features\):
+  Cannot specify compile features for imported target "main".
+Call Stack \(most recent call first\):
+  CMakeLists.txt:4 \(include\)
diff --git a/Tests/RunCMake/target_compile_features/imported_target.cmake b/Tests/RunCMake/target_compile_features/imported_target.cmake
new file mode 100644
index 0000000..e248c2f
--- /dev/null
+++ b/Tests/RunCMake/target_compile_features/imported_target.cmake
@@ -0,0 +1,3 @@
+
+add_library(main INTERFACE IMPORTED)
+target_compile_features(main INTERFACE cxx_delegating_constructors)
diff --git a/Tests/RunCMake/target_compile_features/invalid_args-result.txt b/Tests/RunCMake/target_compile_features/invalid_args-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/target_compile_features/invalid_args-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/target_compile_features/invalid_args-stderr.txt b/Tests/RunCMake/target_compile_features/invalid_args-stderr.txt
new file mode 100644
index 0000000..1242730
--- /dev/null
+++ b/Tests/RunCMake/target_compile_features/invalid_args-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at invalid_args.cmake:3 \(target_compile_features\):
+  target_compile_features called with invalid arguments
+Call Stack \(most recent call first\):
+  CMakeLists.txt:4 \(include\)
diff --git a/Tests/RunCMake/target_compile_features/invalid_args.cmake b/Tests/RunCMake/target_compile_features/invalid_args.cmake
new file mode 100644
index 0000000..1a7fb37
--- /dev/null
+++ b/Tests/RunCMake/target_compile_features/invalid_args.cmake
@@ -0,0 +1,3 @@
+
+add_executable(main empty.cpp)
+target_compile_features(main INVALID cxx_delegating_constructors)
diff --git a/Tests/RunCMake/target_compile_features/invalid_args_on_interface-result.txt b/Tests/RunCMake/target_compile_features/invalid_args_on_interface-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/target_compile_features/invalid_args_on_interface-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/target_compile_features/invalid_args_on_interface-stderr.txt b/Tests/RunCMake/target_compile_features/invalid_args_on_interface-stderr.txt
new file mode 100644
index 0000000..d7f48b1
--- /dev/null
+++ b/Tests/RunCMake/target_compile_features/invalid_args_on_interface-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at invalid_args_on_interface.cmake:3 \(target_compile_features\):
+  target_compile_features may only be set INTERFACE properties on INTERFACE
+  targets
+Call Stack \(most recent call first\):
+  CMakeLists.txt:4 \(include\)
diff --git a/Tests/RunCMake/target_compile_features/invalid_args_on_interface.cmake b/Tests/RunCMake/target_compile_features/invalid_args_on_interface.cmake
new file mode 100644
index 0000000..324d0f3
--- /dev/null
+++ b/Tests/RunCMake/target_compile_features/invalid_args_on_interface.cmake
@@ -0,0 +1,3 @@
+
+add_library(main INTERFACE)
+target_compile_features(main PRIVATE cxx_delegating_constructors)
diff --git a/Tests/RunCMake/target_compile_features/no_target-result.txt b/Tests/RunCMake/target_compile_features/no_target-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/target_compile_features/no_target-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/target_compile_features/no_target-stderr.txt b/Tests/RunCMake/target_compile_features/no_target-stderr.txt
new file mode 100644
index 0000000..9cd5e6b
--- /dev/null
+++ b/Tests/RunCMake/target_compile_features/no_target-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at no_target.cmake:2 \(target_compile_features\):
+  Cannot specify compile features for target "main" which is not built by
+  this project.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:4 \(include\)
diff --git a/Tests/RunCMake/target_compile_features/no_target.cmake b/Tests/RunCMake/target_compile_features/no_target.cmake
new file mode 100644
index 0000000..3f0afe2
--- /dev/null
+++ b/Tests/RunCMake/target_compile_features/no_target.cmake
@@ -0,0 +1,2 @@
+
+target_compile_features(main INTERFACE cxx_delegating_constructors)
diff --git a/Tests/RunCMake/target_compile_features/not_enough_args-result.txt b/Tests/RunCMake/target_compile_features/not_enough_args-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/target_compile_features/not_enough_args-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/target_compile_features/not_enough_args-stderr.txt b/Tests/RunCMake/target_compile_features/not_enough_args-stderr.txt
new file mode 100644
index 0000000..0f27a9c
--- /dev/null
+++ b/Tests/RunCMake/target_compile_features/not_enough_args-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at not_enough_args.cmake:3 \(target_compile_features\):
+  target_compile_features called with incorrect number of arguments
+Call Stack \(most recent call first\):
+  CMakeLists.txt:4 \(include\)
diff --git a/Tests/RunCMake/target_compile_features/not_enough_args.cmake b/Tests/RunCMake/target_compile_features/not_enough_args.cmake
new file mode 100644
index 0000000..9561230
--- /dev/null
+++ b/Tests/RunCMake/target_compile_features/not_enough_args.cmake
@@ -0,0 +1,3 @@
+
+add_executable(main empty.cpp)
+target_compile_features(main)
diff --git a/Tests/RunCMake/target_compile_features/utility_target-result.txt b/Tests/RunCMake/target_compile_features/utility_target-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/target_compile_features/utility_target-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/target_compile_features/utility_target-stderr.txt b/Tests/RunCMake/target_compile_features/utility_target-stderr.txt
new file mode 100644
index 0000000..96b0bd7
--- /dev/null
+++ b/Tests/RunCMake/target_compile_features/utility_target-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at utility_target.cmake:4 \(target_compile_features\):
+  target_compile_features called with non-compilable target type
+Call Stack \(most recent call first\):
+  CMakeLists.txt:4 \(include\)
diff --git a/Tests/RunCMake/target_compile_features/utility_target.cmake b/Tests/RunCMake/target_compile_features/utility_target.cmake
new file mode 100644
index 0000000..8919056
--- /dev/null
+++ b/Tests/RunCMake/target_compile_features/utility_target.cmake
@@ -0,0 +1,4 @@
+
+add_custom_target(utility)
+
+target_compile_features(utility PRIVATE cxx_delegating_constructors)

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f6844a49c27f792ca7a2c499f43802fa3d5e73c7
commit f6844a49c27f792ca7a2c499f43802fa3d5e73c7
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sat Nov 9 00:18:35 2013 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Thu Nov 21 01:35:58 2013 +0100

    cmTargetPropCommandBase: Change the interface to return bool.
    
    This is needed for the target_compile_features command, which
    may fail at configure time if an invalid feature is specified.

diff --git a/Source/cmTargetCompileDefinitionsCommand.cxx b/Source/cmTargetCompileDefinitionsCommand.cxx
index 46c9666..2ad2405 100644
--- a/Source/cmTargetCompileDefinitionsCommand.cxx
+++ b/Source/cmTargetCompileDefinitionsCommand.cxx
@@ -58,9 +58,10 @@ std::string cmTargetCompileDefinitionsCommand
 }
 
 //----------------------------------------------------------------------------
-void cmTargetCompileDefinitionsCommand
+bool cmTargetCompileDefinitionsCommand
 ::HandleDirectContent(cmTarget *tgt, const std::vector<std::string> &content,
                                    bool, bool)
 {
   tgt->AppendProperty("COMPILE_DEFINITIONS", this->Join(content).c_str());
+  return true;
 }
diff --git a/Source/cmTargetCompileDefinitionsCommand.h b/Source/cmTargetCompileDefinitionsCommand.h
index 7405e90..eedcfbf 100644
--- a/Source/cmTargetCompileDefinitionsCommand.h
+++ b/Source/cmTargetCompileDefinitionsCommand.h
@@ -44,7 +44,7 @@ private:
   virtual void HandleImportedTarget(const std::string &tgt);
   virtual void HandleMissingTarget(const std::string &name);
 
-  virtual void HandleDirectContent(cmTarget *tgt,
+  virtual bool HandleDirectContent(cmTarget *tgt,
                                    const std::vector<std::string> &content,
                                    bool prepend, bool system);
   virtual std::string Join(const std::vector<std::string> &content);
diff --git a/Source/cmTargetCompileOptionsCommand.cxx b/Source/cmTargetCompileOptionsCommand.cxx
index 254acc7..18499fd 100644
--- a/Source/cmTargetCompileOptionsCommand.cxx
+++ b/Source/cmTargetCompileOptionsCommand.cxx
@@ -51,7 +51,7 @@ std::string cmTargetCompileOptionsCommand
 }
 
 //----------------------------------------------------------------------------
-void cmTargetCompileOptionsCommand
+bool cmTargetCompileOptionsCommand
 ::HandleDirectContent(cmTarget *tgt, const std::vector<std::string> &content,
                                    bool, bool)
 {
@@ -59,4 +59,5 @@ void cmTargetCompileOptionsCommand
   this->Makefile->GetBacktrace(lfbt);
   cmValueWithOrigin entry(this->Join(content), lfbt);
   tgt->InsertCompileOption(entry);
+  return true;
 }
diff --git a/Source/cmTargetCompileOptionsCommand.h b/Source/cmTargetCompileOptionsCommand.h
index 3713e5a..4376ba7 100644
--- a/Source/cmTargetCompileOptionsCommand.h
+++ b/Source/cmTargetCompileOptionsCommand.h
@@ -44,7 +44,7 @@ private:
   virtual void HandleImportedTarget(const std::string &tgt);
   virtual void HandleMissingTarget(const std::string &name);
 
-  virtual void HandleDirectContent(cmTarget *tgt,
+  virtual bool HandleDirectContent(cmTarget *tgt,
                                    const std::vector<std::string> &content,
                                    bool prepend, bool system);
   virtual std::string Join(const std::vector<std::string> &content);
diff --git a/Source/cmTargetIncludeDirectoriesCommand.cxx b/Source/cmTargetIncludeDirectoriesCommand.cxx
index e7b906c..af7fe77 100644
--- a/Source/cmTargetIncludeDirectoriesCommand.cxx
+++ b/Source/cmTargetIncludeDirectoriesCommand.cxx
@@ -64,7 +64,7 @@ std::string cmTargetIncludeDirectoriesCommand
 }
 
 //----------------------------------------------------------------------------
-void cmTargetIncludeDirectoriesCommand
+bool cmTargetIncludeDirectoriesCommand
 ::HandleDirectContent(cmTarget *tgt, const std::vector<std::string> &content,
                       bool prepend, bool system)
 {
@@ -76,6 +76,7 @@ void cmTargetIncludeDirectoriesCommand
     {
     tgt->AddSystemIncludeDirectories(content);
     }
+  return true;
 }
 
 //----------------------------------------------------------------------------
diff --git a/Source/cmTargetIncludeDirectoriesCommand.h b/Source/cmTargetIncludeDirectoriesCommand.h
index 6863ee5..bb0efcd 100644
--- a/Source/cmTargetIncludeDirectoriesCommand.h
+++ b/Source/cmTargetIncludeDirectoriesCommand.h
@@ -45,7 +45,7 @@ private:
   virtual void HandleImportedTarget(const std::string &tgt);
   virtual void HandleMissingTarget(const std::string &name);
 
-  virtual void HandleDirectContent(cmTarget *tgt,
+  virtual bool HandleDirectContent(cmTarget *tgt,
                                    const std::vector<std::string> &content,
                                    bool prepend, bool system);
   virtual void HandleInterfaceContent(cmTarget *tgt,
diff --git a/Source/cmTargetPropCommandBase.cxx b/Source/cmTargetPropCommandBase.cxx
index e7b6999..2470b28 100644
--- a/Source/cmTargetPropCommandBase.cxx
+++ b/Source/cmTargetPropCommandBase.cxx
@@ -131,29 +131,31 @@ bool cmTargetPropCommandBase
         || args[i] == "PRIVATE"
         || args[i] == "INTERFACE" )
       {
-      this->PopulateTargetProperies(scope, content, prepend, system);
-      return true;
+      return this->PopulateTargetProperies(scope, content, prepend, system);
       }
     content.push_back(args[i]);
     }
-  this->PopulateTargetProperies(scope, content, prepend, system);
-  return true;
+  return this->PopulateTargetProperies(scope, content, prepend, system);
 }
 
 //----------------------------------------------------------------------------
-void cmTargetPropCommandBase
+bool cmTargetPropCommandBase
 ::PopulateTargetProperies(const std::string &scope,
                           const std::vector<std::string> &content,
                           bool prepend, bool system)
 {
   if (scope == "PRIVATE" || scope == "PUBLIC")
     {
-    this->HandleDirectContent(this->Target, content, prepend, system);
+    if (!this->HandleDirectContent(this->Target, content, prepend, system))
+      {
+      return false;
+      }
     }
   if (scope == "INTERFACE" || scope == "PUBLIC")
     {
     this->HandleInterfaceContent(this->Target, content, prepend, system);
     }
+  return true;
 }
 
 //----------------------------------------------------------------------------
diff --git a/Source/cmTargetPropCommandBase.h b/Source/cmTargetPropCommandBase.h
index c402836..67a8596 100644
--- a/Source/cmTargetPropCommandBase.h
+++ b/Source/cmTargetPropCommandBase.h
@@ -43,7 +43,7 @@ private:
   virtual void HandleImportedTarget(const std::string &tgt) = 0;
   virtual void HandleMissingTarget(const std::string &name) = 0;
 
-  virtual void HandleDirectContent(cmTarget *tgt,
+  virtual bool HandleDirectContent(cmTarget *tgt,
                                    const std::vector<std::string> &content,
                                    bool prepend, bool system) = 0;
 
@@ -51,7 +51,7 @@ private:
 
   bool ProcessContentArgs(std::vector<std::string> const& args,
                           unsigned int &argIndex, bool prepend, bool system);
-  void PopulateTargetProperies(const std::string &scope,
+  bool PopulateTargetProperies(const std::string &scope,
                                const std::vector<std::string> &content,
                                bool prepend, bool system);
 };

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3e14f3296e2fd0c2e1057d56fb2aca3372a6ee16
commit 3e14f3296e2fd0c2e1057d56fb2aca3372a6ee16
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Oct 22 01:40:47 2013 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Thu Nov 21 01:35:58 2013 +0100

    cmTarget: Transitively evaluate compiler features.
    
    Extend the interface of the target_compile_features command with
    PUBLIC and INTERFACE keywords. Populate the INTERFACE_COMPILER_FEATURES
    target property if they are set. Consume the INTERFACE_COMPILER_FEATURES
    target property from linked dependent targets to determine the final
    required compiler features and the compile flag, if needed.

diff --git a/Help/command/target_compile_features.rst b/Help/command/target_compile_features.rst
index ebd9611..e33ba4e 100644
--- a/Help/command/target_compile_features.rst
+++ b/Help/command/target_compile_features.rst
@@ -5,7 +5,7 @@ Add expected compiler features to a target.
 
 ::
 
-  target_compile_features(<target> PRIVATE <feature> [...])
+  target_compile_features(<target> <PRIVATE|PUBLIC|INTERFACE> <feature> [...])
 
 Specify compiler features required when compiling a given target.  If the
 feature is not listed in the :variable:`CMAKE_CXX_COMPILE_FEATURES` variable,
@@ -13,6 +13,12 @@ then an error will be reported by CMake.  If the use of the feature requires
 an additional compiler flag, such as --std=c++11, the flag will be added
 automatically.
 
+The INTERFACE, PUBLIC and PRIVATE keywords are required to specify the
+scope of the features.  PRIVATE and PUBLIC items will
+populate the :prop_tgt:`COMPILE_FEATURES` property of <target>.  PUBLIC and
+INTERFACE items will populate the :prop_tgt:`INTERFACE_COMPILE_FEATURES` property
+of <target>.  Repeated calls for the same <target> append items in the order called.
+
 The named <target> must have been created by a command such as
 add_executable or add_library and must not be an IMPORTED target.
 
diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx
index 92dc054..cfcaa70 100644
--- a/Source/cmGeneratorExpressionDAGChecker.cxx
+++ b/Source/cmGeneratorExpressionDAGChecker.cxx
@@ -210,3 +210,11 @@ bool cmGeneratorExpressionDAGChecker::EvaluatingCompileOptions() const
   return (strcmp(prop, "COMPILE_OPTIONS") == 0
        || strcmp(prop, "INTERFACE_COMPILE_OPTIONS") == 0 );
 }
+
+//----------------------------------------------------------------------------
+bool cmGeneratorExpressionDAGChecker::EvaluatingCompileFeatures() const
+{
+  const char *prop = this->Property.c_str();
+  return (strcmp(prop, "COMPILE_FEATURES") == 0
+       || strcmp(prop, "INTERFACE_COMPILE_FEATURES") == 0);
+}
diff --git a/Source/cmGeneratorExpressionDAGChecker.h b/Source/cmGeneratorExpressionDAGChecker.h
index c8594e7..0502430 100644
--- a/Source/cmGeneratorExpressionDAGChecker.h
+++ b/Source/cmGeneratorExpressionDAGChecker.h
@@ -20,13 +20,15 @@
   F(EvaluatingIncludeDirectories) \
   F(EvaluatingSystemIncludeDirectories) \
   F(EvaluatingCompileDefinitions) \
-  F(EvaluatingCompileOptions)
+  F(EvaluatingCompileOptions) \
+  F(EvaluatingCompileFeatures)
 
 #define CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(F) \
   F(INCLUDE_DIRECTORIES) \
   F(SYSTEM_INCLUDE_DIRECTORIES) \
   F(COMPILE_DEFINITIONS) \
-  F(COMPILE_OPTIONS)
+  F(COMPILE_OPTIONS) \
+  F(COMPILE_FEATURES)
 
 //----------------------------------------------------------------------------
 struct cmGeneratorExpressionDAGChecker
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 08b9e86..a44ce49 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1386,6 +1386,13 @@ void cmLocalGenerator::AddCompileOptions(
       this->AppendFlagEscape(flags, i->c_str());
       }
     }
+  std::vector<std::string> features;
+  target->GetCompileFeatures(features, config);
+  for(std::vector<std::string>::const_iterator it = features.begin();
+      it != features.end(); ++it)
+    {
+    this->Makefile->AddRequiredTargetFeature(target, it->c_str());
+    }
   this->AddCompilerRequirementFlag(flags, target, lang);
 }
 
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index d6a985d..6008840 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -145,10 +145,13 @@ public:
                                 CachedLinkInterfaceCompileOptionsEntries;
   mutable std::map<std::string, std::vector<TargetPropertyEntry*> >
                                 CachedLinkInterfaceCompileDefinitionsEntries;
+  mutable std::map<std::string, std::vector<TargetPropertyEntry*> >
+                                CachedLinkInterfaceCompileFeaturesEntries;
 
   mutable std::map<std::string, bool> CacheLinkInterfaceIncludeDirectoriesDone;
   mutable std::map<std::string, bool> CacheLinkInterfaceCompileDefinitionsDone;
   mutable std::map<std::string, bool> CacheLinkInterfaceCompileOptionsDone;
+  mutable std::map<std::string, bool> CacheLinkInterfaceCompileFeaturesDone;
 };
 
 //----------------------------------------------------------------------------
@@ -183,6 +186,7 @@ cmTargetInternals::~cmTargetInternals()
 {
   deleteAndClear(this->CachedLinkInterfaceIncludeDirectoriesEntries);
   deleteAndClear(this->CachedLinkInterfaceCompileOptionsEntries);
+  deleteAndClear(this->CachedLinkInterfaceCompileFeaturesEntries);
   deleteAndClear(this->CachedLinkInterfaceCompileDefinitionsEntries);
 }
 
@@ -205,6 +209,7 @@ cmTarget::cmTarget()
   this->BuildInterfaceIncludesAppended = false;
   this->DebugIncludesDone = false;
   this->DebugCompileOptionsDone = false;
+  this->DebugCompileFeaturesDone = false;
   this->DebugCompileDefinitionsDone = false;
 }
 
@@ -2218,6 +2223,121 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list,
 }
 
 //----------------------------------------------------------------------------
+static void processCompileFeatures(cmTarget const* tgt,
+      const std::vector<cmTargetInternals::TargetPropertyEntry*> &entries,
+      std::vector<std::string> &options,
+      std::set<std::string> &uniqueOptions,
+      cmGeneratorExpressionDAGChecker *dagChecker,
+      const char *config, bool debugOptions)
+{
+  processCompileOptionsInternal(tgt, entries, options, uniqueOptions,
+                                dagChecker, config, debugOptions, "features");
+}
+
+//----------------------------------------------------------------------------
+void cmTarget::GetCompileFeatures(std::vector<std::string> &result,
+                                 const char *config) const
+{
+  std::set<std::string> uniqueFeatures;
+  cmListFileBacktrace lfbt;
+
+  cmGeneratorExpressionDAGChecker dagChecker(lfbt,
+                                             this->GetName(),
+                                             "COMPILE_FEATURES",
+                                             0, 0);
+
+  std::vector<std::string> debugProperties;
+  const char *debugProp =
+              this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
+  if (debugProp)
+    {
+    cmSystemTools::ExpandListArgument(debugProp, debugProperties);
+    }
+
+  bool debugFeatures = !this->DebugCompileFeaturesDone
+                    && std::find(debugProperties.begin(),
+                                 debugProperties.end(),
+                                 "COMPILE_FEATURES")
+                        != debugProperties.end();
+
+  if (this->Makefile->IsGeneratingBuildSystem())
+    {
+    this->DebugCompileFeaturesDone = true;
+    }
+
+  processCompileFeatures(this,
+                            this->Internal->CompileFeaturesEntries,
+                            result,
+                            uniqueFeatures,
+                            &dagChecker,
+                            config,
+                            debugFeatures);
+
+  std::string configString = config ? config : "";
+  if (!this->Internal->CacheLinkInterfaceCompileFeaturesDone[configString])
+    {
+
+    for (std::vector<cmValueWithOrigin>::const_iterator
+        it = this->Internal->LinkInterfacePropertyEntries.begin(),
+        end = this->Internal->LinkInterfacePropertyEntries.end();
+        it != end; ++it)
+      {
+      if (!cmGeneratorExpression::IsValidTargetName(it->Value)
+          && cmGeneratorExpression::Find(it->Value) == std::string::npos)
+        {
+        continue;
+        }
+      {
+      cmGeneratorExpression ge(lfbt);
+      cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
+                                                        ge.Parse(it->Value);
+      std::string targetResult = cge->Evaluate(this->Makefile, config,
+                                        false, this, 0, 0);
+      if (!this->Makefile->FindTargetToUse(targetResult.c_str()))
+        {
+        continue;
+        }
+      }
+      std::string featureGenex = "$<TARGET_PROPERTY:" +
+                              it->Value + ",INTERFACE_COMPILE_FEATURES>";
+      if (cmGeneratorExpression::Find(it->Value) != std::string::npos)
+        {
+        // Because it->Value is a generator expression, ensure that it
+        // evaluates to the non-empty string before being used in the
+        // TARGET_PROPERTY expression.
+        featureGenex = "$<$<BOOL:" + it->Value + ">:" + featureGenex + ">";
+        }
+      cmGeneratorExpression ge(it->Backtrace);
+      cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(
+                                                                featureGenex);
+
+      this->Internal
+        ->CachedLinkInterfaceCompileFeaturesEntries[configString].push_back(
+                        new cmTargetInternals::TargetPropertyEntry(cge,
+                                                              it->Value));
+      }
+    }
+
+  processCompileFeatures(this,
+    this->Internal->CachedLinkInterfaceCompileFeaturesEntries[configString],
+                            result,
+                            uniqueFeatures,
+                            &dagChecker,
+                            config,
+                            debugFeatures);
+
+  if (!this->Makefile->IsGeneratingBuildSystem())
+    {
+    deleteAndClear(this->Internal->CachedLinkInterfaceCompileFeaturesEntries);
+    }
+  else
+    {
+    this->Internal->CacheLinkInterfaceCompileFeaturesDone[configString]
+                                                                      = true;
+    }
+}
+
+//----------------------------------------------------------------------------
 void cmTarget::MaybeInvalidatePropertyCache(const char* prop)
 {
   // Wipe out maps caching information affected by this property.
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index b516a0a..0dc90a4 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -524,6 +524,8 @@ public:
 
   void GetCompileOptions(std::vector<std::string> &result,
                          const char *config) const;
+  void GetCompileFeatures(std::vector<std::string> &result,
+                           const char *config) const;
 
   bool IsNullImpliedByLinkLibraries(const std::string &p) const;
   bool IsLinkInterfaceDependentBoolProperty(const std::string &p,
@@ -682,6 +684,7 @@ private:
   mutable bool DebugIncludesDone;
   mutable bool DebugCompileOptionsDone;
   mutable bool DebugCompileDefinitionsDone;
+  mutable bool DebugCompileFeaturesDone;
   mutable std::set<std::string> LinkImplicitNullProperties;
   bool BuildInterfaceIncludesAppended;
 
diff --git a/Source/cmTargetCompileFeaturesCommand.cxx b/Source/cmTargetCompileFeaturesCommand.cxx
index f89e075..8b48ce3 100644
--- a/Source/cmTargetCompileFeaturesCommand.cxx
+++ b/Source/cmTargetCompileFeaturesCommand.cxx
@@ -34,7 +34,8 @@ bool cmTargetCompileFeaturesCommand::InitialPass(
     return false;
     }
 
-  if(args[1] != "PRIVATE")
+  const bool interfaceOnly = args[1] == "INTERFACE";
+  if(args[1] != "PRIVATE" && args[1] != "PUBLIC" && !interfaceOnly)
     {
     this->SetError("called with invalid arguments.");
     return false;
@@ -44,12 +45,19 @@ bool cmTargetCompileFeaturesCommand::InitialPass(
     {
     std::string feature = args[i];
 
-    if (!this->Makefile->AddRequiredTargetFeature(target, feature.c_str()))
+    if (!interfaceOnly)
       {
-      cmOStringStream e;
-      e << "specified unknown feature \"" << feature << "\".";
-      this->SetError(e.str().c_str());
-      return false;
+      if (!this->Makefile->AddRequiredTargetFeature(target, feature.c_str()))
+        {
+        cmOStringStream e;
+        e << "specified unknown feature \"" << feature << "\".";
+        this->SetError(e.str().c_str());
+        return false;
+        }
+      }
+    if (interfaceOnly || args[1] == "PUBLIC")
+      {
+      target->AppendProperty("INTERFACE_COMPILE_FEATURES", feature.c_str());
       }
     }
   return true;
diff --git a/Tests/CMakeCommands/target_compile_features/CMakeLists.txt b/Tests/CMakeCommands/target_compile_features/CMakeLists.txt
index c26ddbd..7276935 100644
--- a/Tests/CMakeCommands/target_compile_features/CMakeLists.txt
+++ b/Tests/CMakeCommands/target_compile_features/CMakeLists.txt
@@ -21,3 +21,11 @@ add_executable(target_compile_features main.cpp)
 target_compile_features(target_compile_features
   PRIVATE cxx_delegating_constructors
 )
+
+add_library(lib_delegating_constructors lib_delegating_constructors.cpp)
+target_compile_features(lib_delegating_constructors
+  PUBLIC cxx_delegating_constructors
+)
+
+add_executable(lib_user lib_user.cpp)
+target_link_libraries(lib_user lib_delegating_constructors)
diff --git a/Tests/CMakeCommands/target_compile_features/lib_delegating_constructors.cpp b/Tests/CMakeCommands/target_compile_features/lib_delegating_constructors.cpp
new file mode 100644
index 0000000..e597acd
--- /dev/null
+++ b/Tests/CMakeCommands/target_compile_features/lib_delegating_constructors.cpp
@@ -0,0 +1,8 @@
+
+#include "lib_delegating_constructors.h"
+
+Foo::Foo(int i)
+  : m_i(i)
+{
+
+}
diff --git a/Tests/CMakeCommands/target_compile_features/lib_delegating_constructors.h b/Tests/CMakeCommands/target_compile_features/lib_delegating_constructors.h
new file mode 100644
index 0000000..75be701
--- /dev/null
+++ b/Tests/CMakeCommands/target_compile_features/lib_delegating_constructors.h
@@ -0,0 +1,17 @@
+
+#include <cstring>
+
+class Foo
+{
+public:
+  Foo(int i);
+
+  Foo(const char *a)
+    : Foo(strlen(a))
+  {
+
+  }
+
+private:
+  int m_i;
+};
diff --git a/Tests/CMakeCommands/target_compile_features/lib_user.cpp b/Tests/CMakeCommands/target_compile_features/lib_user.cpp
new file mode 100644
index 0000000..83ad51e
--- /dev/null
+++ b/Tests/CMakeCommands/target_compile_features/lib_user.cpp
@@ -0,0 +1,27 @@
+
+#include "lib_delegating_constructors.h"
+
+class Bar
+{
+  Bar(int i)
+    :m_i(i)
+  {
+
+  }
+
+  Bar(const char *a)
+    : Bar(strlen(a))
+  {
+
+  }
+
+private:
+  int m_i;
+};
+
+int main(int argc, char **argv)
+{
+  Foo f("hello");
+  Foo b("world");
+  return 0;
+}

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ece9e6589ecc1ee3886eafffd9a5974c9a0b00c7
commit ece9e6589ecc1ee3886eafffd9a5974c9a0b00c7
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Oct 22 15:05:49 2013 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Thu Nov 21 01:35:58 2013 +0100

    cmTarget: Allow populating COMPILE_FEATURES using generator expressions.

diff --git a/Help/command/target_compile_features.rst b/Help/command/target_compile_features.rst
index aa438b2..ebd9611 100644
--- a/Help/command/target_compile_features.rst
+++ b/Help/command/target_compile_features.rst
@@ -15,3 +15,8 @@ automatically.
 
 The named <target> must have been created by a command such as
 add_executable or add_library and must not be an IMPORTED target.
+
+Arguments to target_compile_features may use "generator expressions"
+with the syntax "$<...>".
+See the :manual:`cmake-generator-expressions(7)` manual for available
+expressions.
diff --git a/Help/prop_tgt/COMPILE_FEATURES.rst b/Help/prop_tgt/COMPILE_FEATURES.rst
index b2c6145..3ef743c 100644
--- a/Help/prop_tgt/COMPILE_FEATURES.rst
+++ b/Help/prop_tgt/COMPILE_FEATURES.rst
@@ -5,3 +5,7 @@ Compiler features enabled for this target.
 
 The list of features in this property are a subset of the features listed
 in the :variable:`CMAKE_CXX_COMPILE_FEATURES` variable.
+
+Contents of COMPILE_FEATURES may use "generator expressions" with the
+syntax "$<...>".  See the :manual:`cmake-generator-expressions(7)` manual for
+available expressions.
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index e97c5a7..17ce8ee 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -4454,6 +4454,11 @@ static const char * const CXX_STANDARDS[] = {
 bool cmMakefile::
 AddRequiredTargetFeature(cmTarget *target, const char *feature) const
 {
+  if (cmGeneratorExpression::Find(feature) != std::string::npos)
+    {
+    target->AppendProperty("COMPILE_FEATURES", feature);
+    return true;
+    }
   bool isCxxFeature = std::find_if(cmArrayBegin(CXX_FEATURES) + 1,
               cmArrayEnd(CXX_FEATURES), cmStrCmp(feature))
               != cmArrayEnd(CXX_FEATURES);

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9a3272b42e981b8b54ffbb3841602b6b889129dd
commit 9a3272b42e981b8b54ffbb3841602b6b889129dd
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Oct 22 14:58:21 2013 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Thu Nov 21 01:35:58 2013 +0100

    cmTarget: Make COMPILE_FEATURES available as a target property.

diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index 55a1de2..e3a4cf8 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -96,6 +96,7 @@ Properties on Targets
    /prop_tgt/COMPILE_DEFINITIONS
    /prop_tgt/COMPILE_FLAGS
    /prop_tgt/COMPILE_OPTIONS
+   /prop_tgt/COMPILE_FEATURES
    /prop_tgt/CONFIG_OUTPUT_NAME
    /prop_tgt/CONFIG_POSTFIX
    /prop_tgt/CXX_STANDARD
diff --git a/Help/prop_tgt/COMPILE_FEATURES.rst b/Help/prop_tgt/COMPILE_FEATURES.rst
new file mode 100644
index 0000000..b2c6145
--- /dev/null
+++ b/Help/prop_tgt/COMPILE_FEATURES.rst
@@ -0,0 +1,7 @@
+COMPILE_FEATURES
+----------------
+
+Compiler features enabled for this target.
+
+The list of features in this property are a subset of the features listed
+in the :variable:`CMAKE_CXX_COMPILE_FEATURES` variable.
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 0bd50f2..e97c5a7 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -4486,6 +4486,8 @@ AddRequiredTargetFeature(cmTarget *target, const char *feature) const
     return false;
     }
 
+  target->AppendProperty("COMPILE_FEATURES", feature);
+
   bool needCxx98 = true;
   bool needCxx11 = false;
   bool needCxxExt = false;
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index ff6216b..d6a985d 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -135,6 +135,7 @@ public:
   };
   std::vector<TargetPropertyEntry*> IncludeDirectoriesEntries;
   std::vector<TargetPropertyEntry*> CompileOptionsEntries;
+  std::vector<TargetPropertyEntry*> CompileFeaturesEntries;
   std::vector<TargetPropertyEntry*> CompileDefinitionsEntries;
   std::vector<cmValueWithOrigin> LinkInterfacePropertyEntries;
 
@@ -1406,6 +1407,17 @@ void cmTarget::SetProperty(const char* prop, const char* value)
                           new cmTargetInternals::TargetPropertyEntry(cge));
     return;
     }
+  if(strcmp(prop,"COMPILE_FEATURES") == 0)
+    {
+    cmListFileBacktrace lfbt;
+    this->Makefile->GetBacktrace(lfbt);
+    cmGeneratorExpression ge(lfbt);
+    deleteAndClear(this->Internal->CompileFeaturesEntries);
+    cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value);
+    this->Internal->CompileFeaturesEntries.push_back(
+                          new cmTargetInternals::TargetPropertyEntry(cge));
+    return;
+    }
   if(strcmp(prop,"COMPILE_DEFINITIONS") == 0)
     {
     cmListFileBacktrace lfbt;
@@ -1471,6 +1483,15 @@ void cmTarget::AppendProperty(const char* prop, const char* value,
               new cmTargetInternals::TargetPropertyEntry(ge.Parse(value)));
     return;
     }
+  if(strcmp(prop,"COMPILE_FEATURES") == 0)
+    {
+    cmListFileBacktrace lfbt;
+    this->Makefile->GetBacktrace(lfbt);
+    cmGeneratorExpression ge(lfbt);
+    this->Internal->CompileFeaturesEntries.push_back(
+              new cmTargetInternals::TargetPropertyEntry(ge.Parse(value)));
+    return;
+    }
   if(strcmp(prop,"COMPILE_DEFINITIONS") == 0)
     {
     cmListFileBacktrace lfbt;
@@ -2663,6 +2684,24 @@ const char *cmTarget::GetProperty(const char* prop,
       }
     return output.c_str();
     }
+  if(strcmp(prop,"COMPILE_FEATURES") == 0)
+    {
+    static std::string output;
+    output = "";
+    std::string sep;
+    typedef cmTargetInternals::TargetPropertyEntry
+                                TargetPropertyEntry;
+    for (std::vector<TargetPropertyEntry*>::const_iterator
+        it = this->Internal->CompileFeaturesEntries.begin(),
+        end = this->Internal->CompileFeaturesEntries.end();
+        it != end; ++it)
+      {
+      output += sep;
+      output += (*it)->ge->GetInput();
+      sep = ";";
+      }
+    return output.c_str();
+    }
   if(strcmp(prop,"COMPILE_DEFINITIONS") == 0)
     {
     static std::string output;
@@ -5865,6 +5904,7 @@ cmTargetInternalPointer::~cmTargetInternalPointer()
 {
   deleteAndClear(this->Pointer->IncludeDirectoriesEntries);
   deleteAndClear(this->Pointer->CompileOptionsEntries);
+  deleteAndClear(this->Pointer->CompileFeaturesEntries);
   deleteAndClear(this->Pointer->CompileDefinitionsEntries);
   delete this->Pointer;
 }

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b21b1a9ff8fff2b98d5a799cc20185301f68ed2a
commit b21b1a9ff8fff2b98d5a799cc20185301f68ed2a
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Oct 13 14:25:08 2013 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Thu Nov 21 01:35:58 2013 +0100

    Add target_compile_features command.
    
    This can be used to set the compiler features required by particular
    targets. An error is issued at CMake time if the compiler does not
    support the required feature. If a language dialect flag is required
    by the features used, that will be added automatically.

diff --git a/Help/command/target_compile_features.rst b/Help/command/target_compile_features.rst
new file mode 100644
index 0000000..aa438b2
--- /dev/null
+++ b/Help/command/target_compile_features.rst
@@ -0,0 +1,17 @@
+target_compile_features
+-----------------------
+
+Add expected compiler features to a target.
+
+::
+
+  target_compile_features(<target> PRIVATE <feature> [...])
+
+Specify compiler features required when compiling a given target.  If the
+feature is not listed in the :variable:`CMAKE_CXX_COMPILE_FEATURES` variable,
+then an error will be reported by CMake.  If the use of the feature requires
+an additional compiler flag, such as --std=c++11, the flag will be added
+automatically.
+
+The named <target> must have been created by a command such as
+add_executable or add_library and must not be an IMPORTED target.
diff --git a/Help/manual/cmake-commands.7.rst b/Help/manual/cmake-commands.7.rst
index fb0d2b5..1294873 100644
--- a/Help/manual/cmake-commands.7.rst
+++ b/Help/manual/cmake-commands.7.rst
@@ -91,6 +91,7 @@ These commands may be used freely in CMake projects.
    /command/source_group
    /command/string
    /command/target_compile_definitions
+   /command/target_compile_features
    /command/target_compile_options
    /command/target_include_directories
    /command/target_link_libraries
diff --git a/Help/variable/CMAKE_CXX_COMPILE_FEATURES.rst b/Help/variable/CMAKE_CXX_COMPILE_FEATURES.rst
index 6be0124..386f5c0 100644
--- a/Help/variable/CMAKE_CXX_COMPILE_FEATURES.rst
+++ b/Help/variable/CMAKE_CXX_COMPILE_FEATURES.rst
@@ -6,3 +6,6 @@ List of features known to the C++ compiler
 These features are known to be available for use with the C++ compiler. This
 list is a subset of the features listed in the :variable:`CMAKE_CXX_KNOWN_FEATURES`
 variable.
+
+The features listed here may be used with the :command:`target_compile_features`
+command.
diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx
index 1e2a85c..8f89fd9 100644
--- a/Source/cmCommands.cxx
+++ b/Source/cmCommands.cxx
@@ -32,6 +32,7 @@
 #include "cmSubdirDependsCommand.cxx"
 #include "cmTargetCompileDefinitionsCommand.cxx"
 #include "cmTargetCompileOptionsCommand.cxx"
+#include "cmTargetCompileFeaturesCommand.cxx"
 #include "cmTargetIncludeDirectoriesCommand.cxx"
 #include "cmTargetPropCommandBase.cxx"
 #include "cmUseMangledMesaCommand.cxx"
@@ -77,6 +78,7 @@ void GetPredefinedCommands(std::list<cmCommand*>&
   commands.push_back(new cmTargetIncludeDirectoriesCommand);
   commands.push_back(new cmTargetCompileDefinitionsCommand);
   commands.push_back(new cmTargetCompileOptionsCommand);
+  commands.push_back(new cmTargetCompileFeaturesCommand);
   commands.push_back(new cmUseMangledMesaCommand);
   commands.push_back(new cmUtilitySourceCommand);
   commands.push_back(new cmVariableRequiresCommand);
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index d66a812..0bd50f2 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -4438,3 +4438,139 @@ void cmMakefile::RecordPolicies(cmPolicies::PolicyMap& pm)
     pm[pid] = this->GetPolicyStatus(pid);
     }
 }
+
+#define FEATURE_STRING(F) , #F
+
+static const char * const CXX_FEATURES[] = {
+  0
+  FOR_EACH_CXX_FEATURE(FEATURE_STRING)
+};
+
+static const char * const CXX_STANDARDS[] = {
+    "98"
+  , "11"
+};
+
+bool cmMakefile::
+AddRequiredTargetFeature(cmTarget *target, const char *feature) const
+{
+  bool isCxxFeature = std::find_if(cmArrayBegin(CXX_FEATURES) + 1,
+              cmArrayEnd(CXX_FEATURES), cmStrCmp(feature))
+              != cmArrayEnd(CXX_FEATURES);
+  if (!isCxxFeature)
+    {
+    return false;
+    }
+
+  const char* cxxFeaturesKnown =
+    this->GetDefinition("CMAKE_CXX_COMPILE_FEATURES");
+
+  if (!cxxFeaturesKnown)
+    {
+    // We know of no features for the compiler at all.
+    return true;
+    }
+
+  std::vector<std::string> availableFeatures;
+  cmSystemTools::ExpandListArgument(cxxFeaturesKnown, availableFeatures);
+  if (std::find(availableFeatures.begin(),
+                availableFeatures.end(),
+                feature) == availableFeatures.end())
+    {
+    cmOStringStream e;
+    e << "The compiler feature \"" << feature
+      << "\" is not known to compiler\n\""
+      << this->GetDefinition("CMAKE_CXX_COMPILER_ID") << "\"\nversion "
+      << this->GetDefinition("CMAKE_CXX_COMPILER_VERSION") << ".";
+    this->IssueMessage(cmake::FATAL_ERROR, e.str().c_str());
+    return false;
+    }
+
+  bool needCxx98 = true;
+  bool needCxx11 = false;
+  bool needCxxExt = false;
+
+  if (const char *propCxx98 =
+                        this->GetDefinition("CMAKE_CXX98_COMPILE_FEATURES"))
+    {
+    std::vector<std::string> props;
+    cmSystemTools::ExpandListArgument(propCxx98, props);
+    needCxx98 = std::find(props.begin(), props.end(), feature) != props.end();
+    }
+  if (const char *propCxx11 =
+          this->GetDefinition("CMAKE_CXX11_COMPILE_FEATURES"))
+    {
+    std::vector<std::string> props;
+    cmSystemTools::ExpandListArgument(propCxx11, props);
+    needCxx11 = std::find(props.begin(), props.end(), feature) != props.end();
+    }
+
+  if (const char *propCxx98ext =
+          this->GetDefinition("CMAKE_CXX98_COMPILER_EXTENSIONS"))
+    {
+    std::vector<std::string> props;
+    cmSystemTools::ExpandListArgument(propCxx98ext, props);
+    needCxxExt = std::find(props.begin(), props.end(), feature) != props.end();
+    }
+  if (const char *propCxx11ext =
+          this->GetDefinition("CMAKE_CXX11_COMPILER_EXTENSIONS"))
+    {
+    std::vector<std::string> props;
+    cmSystemTools::ExpandListArgument(propCxx11ext, props);
+    bool needCxx11Ext = std::find(props.begin(), props.end(), feature)
+                      != props.end();
+    needCxx11 = needCxx11Ext;
+    needCxxExt = needCxxExt || needCxx11Ext;
+    }
+
+  const char *existingCxxStandard = target->GetProperty("CXX_STANDARD");
+  if (existingCxxStandard)
+    {
+    if (std::find_if(cmArrayBegin(CXX_STANDARDS), cmArrayEnd(CXX_STANDARDS),
+                  cmStrCmp(existingCxxStandard)) == cmArrayEnd(CXX_STANDARDS))
+      {
+      cmOStringStream e;
+      e << "The CXX_STANDARD property on target \"" << target->GetName()
+        << "\" contained an invalid value: \"" << existingCxxStandard << "\".";
+      this->IssueMessage(cmake::FATAL_ERROR, e.str().c_str());
+      return false;
+      }
+    }
+  const char * const *existingCxxIt = existingCxxStandard
+                                    ? std::find_if(cmArrayBegin(CXX_STANDARDS),
+                                      cmArrayEnd(CXX_STANDARDS),
+                                      cmStrCmp(existingCxxStandard))
+                                    : cmArrayEnd(CXX_STANDARDS);
+
+  bool setCxx11 = needCxx11 && !existingCxxStandard;
+  bool setCxx98 = needCxx98 && !existingCxxStandard;
+  if (existingCxxStandard && existingCxxIt <
+                                    std::find_if(cmArrayBegin(CXX_STANDARDS),
+                                      cmArrayEnd(CXX_STANDARDS),
+                                      cmStrCmp("11")))
+    {
+    setCxx11 = true;
+    }
+  else if(existingCxxStandard && existingCxxIt <
+                                    std::find_if(cmArrayBegin(CXX_STANDARDS),
+                                      cmArrayEnd(CXX_STANDARDS),
+                                      cmStrCmp("98")))
+    {
+    setCxx98 = true;
+    }
+
+  if (setCxx11)
+    {
+    target->SetProperty("CXX_STANDARD", "11");
+    }
+  else if (setCxx98)
+    {
+    target->SetProperty("CXX_STANDARD", "98");
+    }
+  bool existingCxxExt = target->GetPropertyAsBool("CXX_EXTENSIONS");
+  if (needCxxExt && !existingCxxExt)
+    {
+    target->SetProperty("CXX_EXTENSIONS", "1");
+    }
+  return true;
+}
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 76958ca..4aeffdf 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -883,6 +883,8 @@ public:
   std::set<cmStdString> const & GetSystemIncludeDirectories() const
     { return this->SystemIncludeDirectories; }
 
+  bool AddRequiredTargetFeature(cmTarget *target, const char *feature) const;
+
 protected:
   // add link libraries and directories to the target
   void AddGlobalLinkInformation(const char* name, cmTarget& target);
diff --git a/Source/cmTargetCompileFeaturesCommand.cxx b/Source/cmTargetCompileFeaturesCommand.cxx
new file mode 100644
index 0000000..f89e075
--- /dev/null
+++ b/Source/cmTargetCompileFeaturesCommand.cxx
@@ -0,0 +1,56 @@
+/*============================================================================
+  CMake - Cross Platform Makefile Generator
+  Copyright 2013 Stephen Kelly <steveire at gmail.com>
+
+  Distributed under the OSI-approved BSD License (the "License");
+  see accompanying file Copyright.txt for details.
+
+  This software is distributed WITHOUT ANY WARRANTY; without even the
+  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+  See the License for more information.
+============================================================================*/
+#include "cmTargetCompileFeaturesCommand.h"
+
+bool cmTargetCompileFeaturesCommand::InitialPass(
+  std::vector<std::string> const& args,
+  cmExecutionStatus &)
+{
+  if (args.size() < 3)
+    {
+      this->SetError("called with wrong number of arguments.");
+      return false;
+    }
+  cmTarget *target = this->Makefile->FindTargetToUse(args[0].c_str());
+
+  if(!target)
+    {
+    this->SetError("specified invalid target.");
+    return false;
+    }
+
+  if(target->IsImported())
+    {
+    this->SetError("may not be used with an IMPORTED target.");
+    return false;
+    }
+
+  if(args[1] != "PRIVATE")
+    {
+    this->SetError("called with invalid arguments.");
+    return false;
+    }
+
+  for (size_t i = 2; i < args.size(); ++i)
+    {
+    std::string feature = args[i];
+
+    if (!this->Makefile->AddRequiredTargetFeature(target, feature.c_str()))
+      {
+      cmOStringStream e;
+      e << "specified unknown feature \"" << feature << "\".";
+      this->SetError(e.str().c_str());
+      return false;
+      }
+    }
+  return true;
+}
diff --git a/Source/cmTargetCompileFeaturesCommand.h b/Source/cmTargetCompileFeaturesCommand.h
new file mode 100644
index 0000000..63beeca
--- /dev/null
+++ b/Source/cmTargetCompileFeaturesCommand.h
@@ -0,0 +1,32 @@
+/*============================================================================
+  CMake - Cross Platform Makefile Generator
+  Copyright 2013 Stephen Kelly <steveire at gmail.com>
+
+  Distributed under the OSI-approved BSD License (the "License");
+  see accompanying file Copyright.txt for details.
+
+  This software is distributed WITHOUT ANY WARRANTY; without even the
+  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+  See the License for more information.
+============================================================================*/
+#ifndef cmTargetCompileFeaturesCommand_h
+#define cmTargetCompileFeaturesCommand_h
+
+#include "cmCommand.h"
+
+class cmTargetCompileFeaturesCommand : public cmCommand
+{
+  virtual cmCommand* Clone()
+    {
+    return new cmTargetCompileFeaturesCommand;
+    }
+
+  virtual bool InitialPass(std::vector<std::string> const& args,
+                           cmExecutionStatus &status);
+
+  virtual const char* GetName() const { return "target_compile_features";}
+
+  cmTypeMacro(cmTargetCompileFeaturesCommand, cmCommand);
+};
+
+#endif
diff --git a/Tests/CMakeCommands/target_compile_features/CMakeLists.txt b/Tests/CMakeCommands/target_compile_features/CMakeLists.txt
new file mode 100644
index 0000000..c26ddbd
--- /dev/null
+++ b/Tests/CMakeCommands/target_compile_features/CMakeLists.txt
@@ -0,0 +1,23 @@
+cmake_minimum_required(VERSION 2.8.12)
+cmake_policy(SET CMP0025 NEW)
+project(target_compile_features)
+
+if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU|Clang")
+  add_executable(gnuxx_typeof_test gnuxx_typeof_test.cpp)
+endif()
+if (("${CMAKE_CXX_COMPILER}" MATCHES "MSVC"
+      AND NOT MSVC_VERSION VERSION_LESS 1400)
+    OR ("${CMAKE_CXX_COMPILER}" STREQUAL "Clang"
+      AND "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC"))
+  add_executable(msvcxx_sealed_test msvcxx_sealed_test.cpp)
+endif()
+
+if (NOT ";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ";cxx_delegating_constructors;")
+  add_executable(target_compile_features dummy.cpp)
+  return()
+endif()
+
+add_executable(target_compile_features main.cpp)
+target_compile_features(target_compile_features
+  PRIVATE cxx_delegating_constructors
+)
diff --git a/Tests/CMakeCommands/target_compile_features/dummy.cpp b/Tests/CMakeCommands/target_compile_features/dummy.cpp
new file mode 100644
index 0000000..341aaaf
--- /dev/null
+++ b/Tests/CMakeCommands/target_compile_features/dummy.cpp
@@ -0,0 +1,5 @@
+
+int main(int, char **)
+{
+  return 0;
+}
diff --git a/Tests/CMakeCommands/target_compile_features/gnuxx_typeof_test.cpp b/Tests/CMakeCommands/target_compile_features/gnuxx_typeof_test.cpp
new file mode 100644
index 0000000..3b8532e
--- /dev/null
+++ b/Tests/CMakeCommands/target_compile_features/gnuxx_typeof_test.cpp
@@ -0,0 +1,6 @@
+
+int main(int argc, char **argv)
+{
+  typeof(argc) ret = 0;
+  return ret;
+}
diff --git a/Tests/CMakeCommands/target_compile_features/main.cpp b/Tests/CMakeCommands/target_compile_features/main.cpp
new file mode 100644
index 0000000..77671b0
--- /dev/null
+++ b/Tests/CMakeCommands/target_compile_features/main.cpp
@@ -0,0 +1,25 @@
+
+#include <cstring>
+
+class Foo
+{
+  Foo(int i)
+    :m_i(i)
+  {
+
+  }
+
+  Foo(const char *a)
+    : Foo(strlen(a))
+  {
+
+  }
+
+private:
+  int m_i;
+};
+
+int main(int, char **)
+{
+  return 0;
+}
diff --git a/Tests/CMakeCommands/target_compile_features/msvcxx_sealed_test.cpp b/Tests/CMakeCommands/target_compile_features/msvcxx_sealed_test.cpp
new file mode 100644
index 0000000..0127937
--- /dev/null
+++ b/Tests/CMakeCommands/target_compile_features/msvcxx_sealed_test.cpp
@@ -0,0 +1,8 @@
+
+class A sealed {};
+
+int main(int argc, char **argv)
+{
+  A a;
+  return 0;
+}
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index b1d933d..c3fe8c4 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -2172,6 +2172,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
   ADD_TEST_MACRO(CMakeCommands.target_include_directories target_include_directories)
   ADD_TEST_MACRO(CMakeCommands.target_compile_definitions target_compile_definitions)
   ADD_TEST_MACRO(CMakeCommands.target_compile_options target_compile_options)
+  ADD_TEST_MACRO(CMakeCommands.target_compile_features target_compile_features)
   ADD_TEST_MACRO(compile_features compile_features)
 
   configure_file(
diff --git a/Tests/CxxDialect/CMakeLists.txt b/Tests/CxxDialect/CMakeLists.txt
index c55f838..f0b2d10 100644
--- a/Tests/CxxDialect/CMakeLists.txt
+++ b/Tests/CxxDialect/CMakeLists.txt
@@ -1,3 +1,5 @@
+cmake_minimum_required(VERSION 2.8.12)
+cmake_policy(SET CMP0025 NEW)
 project(CxxDialect)
 
 add_executable(use_typeof use_typeof.cxx)
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index bb1b909..dddcce2 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -133,4 +133,5 @@ endif()
 add_RunCMake_test(File_Generate)
 add_RunCMake_test(ExportWithoutLanguage)
 add_RunCMake_test(target_link_libraries)
+add_RunCMake_test(target_compile_features)
 add_RunCMake_test(CheckModules)
diff --git a/Tests/RunCMake/target_compile_features/CMakeLists.txt b/Tests/RunCMake/target_compile_features/CMakeLists.txt
new file mode 100644
index 0000000..aa7278d
--- /dev/null
+++ b/Tests/RunCMake/target_compile_features/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12)
+cmake_policy(SET CMP0025 NEW)
+project(${RunCMake_TEST} CXX)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/target_compile_features/RunCMakeTest.cmake b/Tests/RunCMake/target_compile_features/RunCMakeTest.cmake
new file mode 100644
index 0000000..28341c9
--- /dev/null
+++ b/Tests/RunCMake/target_compile_features/RunCMakeTest.cmake
@@ -0,0 +1,4 @@
+include(RunCMake)
+
+run_cmake(not_a_cxx_feature)
+run_cmake(no_matching_cxx_feature)
diff --git a/Tests/RunCMake/target_compile_features/empty.cpp b/Tests/RunCMake/target_compile_features/empty.cpp
new file mode 100644
index 0000000..bfbbdde
--- /dev/null
+++ b/Tests/RunCMake/target_compile_features/empty.cpp
@@ -0,0 +1,7 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+int empty()
+{
+  return 0;
+}
diff --git a/Tests/RunCMake/target_compile_features/no_matching_cxx_feature-result.txt b/Tests/RunCMake/target_compile_features/no_matching_cxx_feature-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/target_compile_features/no_matching_cxx_feature-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/target_compile_features/no_matching_cxx_feature-stderr.txt b/Tests/RunCMake/target_compile_features/no_matching_cxx_feature-stderr.txt
new file mode 100644
index 0000000..a8f60c7
--- /dev/null
+++ b/Tests/RunCMake/target_compile_features/no_matching_cxx_feature-stderr.txt
@@ -0,0 +1,8 @@
+CMake Error at no_matching_cxx_feature.cmake:[0-9][0-9]? \((target_compile_features|message)\):
+  The compiler feature "[^"]+" is not known to compiler
+
+  "[^"]*"
+
+  version *[.0-9]+\.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:4 \(include\)
diff --git a/Tests/RunCMake/target_compile_features/no_matching_cxx_feature.cmake b/Tests/RunCMake/target_compile_features/no_matching_cxx_feature.cmake
new file mode 100644
index 0000000..99d04b6
--- /dev/null
+++ b/Tests/RunCMake/target_compile_features/no_matching_cxx_feature.cmake
@@ -0,0 +1,26 @@
+
+if (NOT ";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ";gnuxx_typeof;"
+    AND NOT ";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ";msvcxx_sealed;" )
+  # Simulate passing the test.
+  message(SEND_ERROR
+    "The compiler feature \"gnuxx_dummy\" is not known to compiler\n\"GNU\"\nversion 4.8.1."
+  )
+  return()
+endif()
+
+if (";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ";gnuxx_typeof;")
+  set(feature msvcxx_sealed)
+  if (";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ";msvcxx_sealed;")
+    # If a compiler supports both extensions, remove one of them.
+    list(REMOVE_ITEM CMAKE_CXX_COMPILE_FEATURES msvcxx_sealed)
+  endif()
+else()
+  set(feature gnuxx_typeof)
+endif()
+
+add_executable(main empty.cpp)
+
+target_compile_features(main
+  PRIVATE
+    ${feature}
+)
diff --git a/Tests/RunCMake/target_compile_features/not_a_cxx_feature-result.txt b/Tests/RunCMake/target_compile_features/not_a_cxx_feature-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/target_compile_features/not_a_cxx_feature-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/target_compile_features/not_a_cxx_feature-stderr.txt b/Tests/RunCMake/target_compile_features/not_a_cxx_feature-stderr.txt
new file mode 100644
index 0000000..1b82258
--- /dev/null
+++ b/Tests/RunCMake/target_compile_features/not_a_cxx_feature-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at not_a_cxx_feature.cmake:3 \(target_compile_features\):
+  target_compile_features specified unknown feature "cxx_not_a_feature".
+Call Stack \(most recent call first\):
+  CMakeLists.txt:4 \(include\)
diff --git a/Tests/RunCMake/target_compile_features/not_a_cxx_feature.cmake b/Tests/RunCMake/target_compile_features/not_a_cxx_feature.cmake
new file mode 100644
index 0000000..0207b72
--- /dev/null
+++ b/Tests/RunCMake/target_compile_features/not_a_cxx_feature.cmake
@@ -0,0 +1,6 @@
+
+add_executable(main empty.cpp)
+target_compile_features(main
+  PRIVATE
+    cxx_not_a_feature
+)

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

Summary of changes:


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list