[Cmake-commits] CMake branch, next, updated. v2.8.12.1-5689-gf4ac723
Stephen Kelly
steveire at gmail.com
Fri Nov 22 11:12:12 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 f4ac72386558fb5693bfb8642a3959b0d6322c25 (commit)
via db9dd077d1db8a408a759f5b64da826a5c4c063a (commit)
via d20871606453000c1582a7def81655494129ea3c (commit)
via d0058b14daa2da4333f7650cc35cbd10054ca142 (commit)
from bc56c1c44db9683decb5d57402484816ea4c23ff (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=f4ac72386558fb5693bfb8642a3959b0d6322c25
commit f4ac72386558fb5693bfb8642a3959b0d6322c25
Merge: bc56c1c db9dd07
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Fri Nov 22 11:12:06 2013 -0500
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Nov 22 11:12:06 2013 -0500
Merge topic 'INTERFACE_AUTOUIC_OPTIONS' into next
db9dd07 QtAutoUic: Add INTERFACE_AUTOUIC_OPTIONS target property.
d208716 QtAutoUic: Handle new -include command line parameter.
d0058b1 Genex: Add {UPPER,LOWER}_CASE and MAKE_C_IDENTIFIER.
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=db9dd077d1db8a408a759f5b64da826a5c4c063a
commit db9dd077d1db8a408a759f5b64da826a5c4c063a
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Nov 20 14:54:39 2013 +0100
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Fri Nov 22 15:39:18 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 abc6fde..02de39b 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -139,6 +139,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 7399c7b..92f74f3 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::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 c8594e7..fd47ad7 100644
--- a/Source/cmGeneratorExpressionDAGChecker.h
+++ b/Source/cmGeneratorExpressionDAGChecker.h
@@ -20,13 +20,15 @@
F(EvaluatingIncludeDirectories) \
F(EvaluatingSystemIncludeDirectories) \
F(EvaluatingCompileDefinitions) \
- F(EvaluatingCompileOptions)
+ F(EvaluatingCompileOptions) \
+ 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_OPTIONS) \
+ F(AUTOUIC_OPTIONS)
//----------------------------------------------------------------------------
struct cmGeneratorExpressionDAGChecker
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index 0b10c01..12a39c5 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 120a666..d1e20ec 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*> AutoUicOptionsEntries;
std::vector<TargetPropertyEntry*> CompileDefinitionsEntries;
std::vector<cmValueWithOrigin> LinkInterfacePropertyEntries;
@@ -143,11 +144,14 @@ 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, bool> CacheLinkInterfaceIncludeDirectoriesDone;
mutable std::map<std::string, bool> CacheLinkInterfaceCompileDefinitionsDone;
mutable std::map<std::string, bool> CacheLinkInterfaceCompileOptionsDone;
+ mutable std::map<std::string, bool> CacheLinkInterfaceAutoUicOptionsDone;
};
//----------------------------------------------------------------------------
@@ -182,6 +186,7 @@ cmTargetInternals::~cmTargetInternals()
{
deleteAndClear(this->CachedLinkInterfaceIncludeDirectoriesEntries);
deleteAndClear(this->CachedLinkInterfaceCompileOptionsEntries);
+ deleteAndClear(this->CachedLinkInterfaceAutoUicOptionsEntries);
deleteAndClear(this->CachedLinkInterfaceCompileDefinitionsEntries);
}
@@ -1405,6 +1410,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;
@@ -1470,6 +1486,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;
@@ -1966,6 +1991,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
{
@@ -2662,6 +2787,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;
@@ -5864,6 +6007,7 @@ cmTargetInternalPointer::~cmTargetInternalPointer()
{
deleteAndClear(this->Pointer->IncludeDirectoriesEntries);
deleteAndClear(this->Pointer->CompileOptionsEntries);
+ deleteAndClear(this->Pointer->AutoUicOptionsEntries);
deleteAndClear(this->Pointer->CompileDefinitionsEntries);
delete this->Pointer;
}
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 35ec680..c70409c 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -532,6 +532,8 @@ public:
void GetCompileOptions(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,
@@ -689,6 +691,7 @@ private:
bool IsImportedTarget;
mutable bool DebugIncludesDone;
mutable bool DebugCompileOptionsDone;
+ mutable bool DebugAutoUicOptionsDone;
mutable bool DebugCompileDefinitionsDone;
mutable std::set<std::string> LinkImplicitNullProperties;
bool BuildInterfaceIncludesAppended;
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index f7a320a..9e74b7d 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1081,8 +1081,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
# on that platform.
if(WIN32)
set(run_autogen_test ${CMAKE_CTEST_COMMAND} -V)
+ set(run_autouic_test ${CMAKE_CTEST_COMMAND} -V)
else()
set(run_autogen_test QtAutogen)
+ set(run_autouic_test QtAutoUicInterface)
endif()
find_package(Qt5Widgets QUIET NO_MODULE)
@@ -1100,6 +1102,20 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--test-command ${run_autogen_test}
)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt5Autogen")
+
+ add_test(Qt5AutoUicInterface ${CMAKE_CTEST_COMMAND}
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/QtAutoUicInterface"
+ "${CMake_BINARY_DIR}/Tests/Qt5AutoUicInterface"
+ ${build_generator_args}
+ --build-project QtAutoUicInterface
+ --build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt5AutoUicInterface"
+ --force-new-ctest-process
+ --build-options ${build_options}
+ -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} -DQT_TEST_VERSION=5
+ --test-command ${run_autouic_test}
+ )
+ list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt5AutoUicInterface")
endif()
if(QT4_WORKS AND QT_QTGUI_FOUND)
add_test(Qt4Autogen ${CMAKE_CTEST_COMMAND}
@@ -1116,6 +1132,20 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4Autogen")
+ add_test(Qt4AutoUicInterface ${CMAKE_CTEST_COMMAND}
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/QtAutoUicInterface"
+ "${CMake_BINARY_DIR}/Tests/Qt4AutoUicInterface"
+ ${build_generator_args}
+ --build-project QtAutoUicInterface
+ --build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt4AutoUicInterface"
+ --force-new-ctest-process
+ --build-options ${build_options}
+ -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} -DQT_TEST_VERSION=4
+ --test-command ${run_autouic_test}
+ )
+ list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4AutoUicInterface")
+
add_test(Qt4Targets ${CMAKE_CTEST_COMMAND}
--build-and-test
"${CMake_SOURCE_DIR}/Tests/Qt4Targets"
diff --git a/Tests/QtAutoUicInterface/CMakeLists.txt b/Tests/QtAutoUicInterface/CMakeLists.txt
new file mode 100644
index 0000000..efee77e
--- /dev/null
+++ b/Tests/QtAutoUicInterface/CMakeLists.txt
@@ -0,0 +1,68 @@
+
+cmake_minimum_required(VERSION 2.8.12)
+
+project(QtAutoUicInterface)
+
+if (QT_TEST_VERSION STREQUAL 4)
+ find_package(Qt4 REQUIRED)
+
+ include(UseQt4)
+
+ set(QT_CORE_TARGET Qt4::QtCore)
+ set(QT_GUI_TARGET Qt4::QtGui)
+else()
+ if (NOT QT_TEST_VERSION STREQUAL 5)
+ message(SEND_ERROR "Invalid Qt version specified.")
+ endif()
+ find_package(Qt5Widgets REQUIRED)
+
+ set(QT_CORE_TARGET Qt5::Core)
+ set(QT_GUI_TARGET Qt5::Widgets)
+endif()
+
+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 ${QT_CORE_TARGET})
+
+set(autouic_options
+ -tr tr2$<$<NOT:$<BOOL:$<TARGET_PROPERTY:NO_KUIT_SEMANTIC>>>:x>i18n
+)
+if (NOT Qt5Widgets_VERSION VERSION_LESS 5.3.0)
+ list(APPEND autouic_options -include klocalizedstring.h)
+endif()
+
+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 ${QT_GUI_TARGET})
+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 ${QT_GUI_TARGET})
+
+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..f2324bb
--- /dev/null
+++ b/Tests/QtAutoUicInterface/klocalizedstring.cpp
@@ -0,0 +1,12 @@
+
+#include "klocalizedstring.h"
+
+QString tr2xi18n(const char *text, const char *)
+{
+ return QLatin1String("TranslatedX") + QString::fromLatin1(text);
+}
+
+QString tr2i18n(const char *text, const char *)
+{
+ return QLatin1String("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..0b1de10
--- /dev/null
+++ b/Tests/QtAutoUicInterface/libwidget.h
@@ -0,0 +1,23 @@
+
+#ifndef LIBWIDGET_H
+#define LIBWIDGET_H
+
+#include <QWidget>
+
+#if QT_VERSION < QT_VERSION_CHECK(5, 3, 0)
+#include <klocalizedstring.h>
+#endif
+
+#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..c066318
--- /dev/null
+++ b/Tests/QtAutoUicInterface/mywidget.h
@@ -0,0 +1,23 @@
+
+#ifndef MYWIDGET_H
+#define MYWIDGET_H
+
+#include <QWidget>
+
+#if QT_VERSION < QT_VERSION_CHECK(5, 3, 0)
+#include <klocalizedstring.h>
+#endif
+
+#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=d20871606453000c1582a7def81655494129ea3c
commit d20871606453000c1582a7def81655494129ea3c
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Nov 20 23:17:13 2013 +0100
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Fri Nov 22 15:38:35 2013 +0100
QtAutoUic: Handle new -include command line parameter.
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index 35717ce..0b10c01 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=d0058b14daa2da4333f7650cc35cbd10054ca142
commit d0058b14daa2da4333f7650cc35cbd10054ca142
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Nov 20 21:40:29 2013 +0100
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Fri Nov 22 15:38:35 2013 +0100
Genex: Add {UPPER,LOWER}_CASE and MAKE_C_IDENTIFIER.
diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst
index 2a2b7dc..c2501ab 100644
--- a/Help/manual/cmake-generator-expressions.7.rst
+++ b/Help/manual/cmake-generator-expressions.7.rst
@@ -178,3 +178,7 @@ property is non-empty::
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 67972b9..417bf3c 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -199,6 +199,48 @@ static const struct StrEqualNode : public cmGeneratorExpressionNode
} strEqualNode;
//----------------------------------------------------------------------------
+static const struct LowerCaseNode : public cmGeneratorExpressionNode
+{
+ LowerCaseNode() {}
+
+ std::string Evaluate(const std::vector<std::string> ¶meters,
+ cmGeneratorExpressionContext *,
+ const GeneratorExpressionContent *,
+ cmGeneratorExpressionDAGChecker *) const
+ {
+ return cmSystemTools::LowerCase(parameters.front());
+ }
+} lowerCaseNode;
+
+//----------------------------------------------------------------------------
+static const struct UpperCaseNode : public cmGeneratorExpressionNode
+{
+ UpperCaseNode() {}
+
+ std::string Evaluate(const std::vector<std::string> ¶meters,
+ cmGeneratorExpressionContext *,
+ const GeneratorExpressionContent *,
+ cmGeneratorExpressionDAGChecker *) const
+ {
+ return cmSystemTools::UpperCase(parameters.front());
+ }
+} upperCaseNode;
+
+//----------------------------------------------------------------------------
+static const struct MakeCIdentifierNode : public cmGeneratorExpressionNode
+{
+ MakeCIdentifierNode() {}
+
+ std::string Evaluate(const std::vector<std::string> ¶meters,
+ cmGeneratorExpressionContext *,
+ const GeneratorExpressionContent *,
+ cmGeneratorExpressionDAGChecker *) const
+ {
+ return cmSystemTools::MakeCidentifier(parameters.front().c_str());
+ }
+} makeCIdentifierNode;
+
+//----------------------------------------------------------------------------
static const struct Angle_RNode : public cmGeneratorExpressionNode
{
Angle_RNode() {}
@@ -1441,6 +1483,12 @@ cmGeneratorExpressionNode* GetNode(const std::string &identifier)
return &targetSoNameFileDirNode;
else if (identifier == "STREQUAL")
return &strEqualNode;
+ else if (identifier == "LOWER_CASE")
+ return &lowerCaseNode;
+ else if (identifier == "UPPER_CASE")
+ return &upperCaseNode;
+ else if (identifier == "MAKE_C_IDENTIFIER")
+ return &makeCIdentifierNode;
else if (identifier == "BOOL")
return &boolNode;
else if (identifier == "ANGLE-R")
diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt
index e0df8c2..edadb87 100644
--- a/Tests/GeneratorExpression/CMakeLists.txt
+++ b/Tests/GeneratorExpression/CMakeLists.txt
@@ -193,6 +193,9 @@ add_custom_target(check-part3 ALL
-Dtest_platform_id_Linux=$<PLATFORM_ID:Linux>
-Dtest_platform_id_Windows=$<PLATFORM_ID:Windows>
-Dtest_platform_id_Darwin=$<PLATFORM_ID:Darwin>
+ -Dlower_case=$<LOWER_CASE:MiXeD>
+ -Dupper_case=$<UPPER_CASE:MiXeD>
+ -Dmake_c_identifier=$<MAKE_C_IDENTIFIER:4foo:+bar-$>
-P ${CMAKE_CURRENT_SOURCE_DIR}/check-part3.cmake
COMMAND ${CMAKE_COMMAND} -E echo "check done (part 3 of 3)"
VERBATIM
diff --git a/Tests/GeneratorExpression/check-part3.cmake b/Tests/GeneratorExpression/check-part3.cmake
index 93ea487..a86db31 100644
--- a/Tests/GeneratorExpression/check-part3.cmake
+++ b/Tests/GeneratorExpression/check-part3.cmake
@@ -34,3 +34,6 @@ foreach(system Linux Windows Darwin)
check(test_platform_id_${system} 0)
endif()
endforeach()
+check(lower_case "mixed")
+check(upper_case "MIXED")
+check(make_c_identifier "_4foo__bar__")
-----------------------------------------------------------------------
Summary of changes:
Help/manual/cmake-generator-expressions.7.rst | 4 +
Help/manual/cmake-properties.7.rst | 1 +
Help/prop_tgt/AUTOUIC_OPTIONS.rst | 4 +
Help/prop_tgt/INTERFACE_AUTOUIC_OPTIONS.rst | 12 ++
Help/variable/CMAKE_DEBUG_TARGET_PROPERTIES.rst | 4 +-
Source/cmGeneratorExpressionDAGChecker.cxx | 8 ++
Source/cmGeneratorExpressionDAGChecker.h | 6 +-
Source/cmGeneratorExpressionEvaluator.cxx | 48 ++++++++
Source/cmQtAutoGenerators.cxx | 78 +++++++++++--
Source/cmQtAutoGenerators.h | 3 +-
Source/cmTarget.cxx | 144 +++++++++++++++++++++++
Source/cmTarget.h | 3 +
Tests/CMakeLists.txt | 30 +++++
Tests/GeneratorExpression/CMakeLists.txt | 3 +
Tests/GeneratorExpression/check-part3.cmake | 3 +
Tests/QtAutoUicInterface/CMakeLists.txt | 68 +++++++++++
Tests/QtAutoUicInterface/klocalizedstring.cpp | 12 ++
Tests/QtAutoUicInterface/klocalizedstring.h | 17 +++
Tests/QtAutoUicInterface/libwidget.cpp | 9 ++
Tests/QtAutoUicInterface/libwidget.h | 23 ++++
Tests/QtAutoUicInterface/libwidget.ui | 32 +++++
Tests/QtAutoUicInterface/main.cpp | 73 ++++++++++++
Tests/QtAutoUicInterface/mywidget.cpp | 9 ++
Tests/QtAutoUicInterface/mywidget.h | 23 ++++
Tests/QtAutoUicInterface/mywidget.ui | 32 +++++
25 files changed, 636 insertions(+), 13 deletions(-)
create mode 100644 Help/prop_tgt/INTERFACE_AUTOUIC_OPTIONS.rst
create mode 100644 Tests/QtAutoUicInterface/CMakeLists.txt
create mode 100644 Tests/QtAutoUicInterface/klocalizedstring.cpp
create mode 100644 Tests/QtAutoUicInterface/klocalizedstring.h
create mode 100644 Tests/QtAutoUicInterface/libwidget.cpp
create mode 100644 Tests/QtAutoUicInterface/libwidget.h
create mode 100644 Tests/QtAutoUicInterface/libwidget.ui
create mode 100644 Tests/QtAutoUicInterface/main.cpp
create mode 100644 Tests/QtAutoUicInterface/mywidget.cpp
create mode 100644 Tests/QtAutoUicInterface/mywidget.h
create mode 100644 Tests/QtAutoUicInterface/mywidget.ui
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list