[Cmake-commits] CMake branch, next, updated. v2.8.10.2-2481-g65df2d9
Brad King
brad.king at kitware.com
Tue Mar 12 17:44:34 EDT 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 65df2d9bcfb41d117eb639dfa6e9af6111e6b7da (commit)
via a223a3b65f518f59a73967f0087b0d67842d9f0d (commit)
via 65b5c1e0645a466dbf5d163296754d12e2db53d5 (commit)
from 057a1c8dca8b66023550c0f39d311f784e75b8d0 (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=65df2d9bcfb41d117eb639dfa6e9af6111e6b7da
commit 65df2d9bcfb41d117eb639dfa6e9af6111e6b7da
Merge: 057a1c8 a223a3b
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue Mar 12 17:44:22 2013 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Mar 12 17:44:22 2013 -0400
Merge topic 'fix-automoc-no-qt' into next
a223a3b Automoc: Don't create automoc targets if Qt is not used (#13999)
65b5c1e Merge branch 'property-link-depends-no-crash' into fix-automoc-no-qt
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a223a3b65f518f59a73967f0087b0d67842d9f0d
commit a223a3b65f518f59a73967f0087b0d67842d9f0d
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon Mar 11 23:26:38 2013 +0100
Commit: Brad King <brad.king at kitware.com>
CommitDate: Tue Mar 12 17:42:02 2013 -0400
Automoc: Don't create automoc targets if Qt is not used (#13999)
Commit 79568f95 (automoc: Add source file to target early to set the
linker language, 2013-02-20) changed automoc initialization to a two
step process. In the first step, the generated source file was added
to the target, which allows the link language to be determined.
However, this bypassed the check for the availability of Qt itself.
At build-time the automoc file could not be generated because the moc
tool was not available to create it.
The solution is to only add the automoc file to the target if Qt is
found.
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index f2defbb..2fae7d0 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1086,8 +1086,10 @@ void cmGlobalGenerator::CreateAutomocTargets()
if(target.GetPropertyAsBool("AUTOMOC") && !target.IsImported())
{
cmQtAutomoc automoc;
- automoc.InitializeMocSourceFile(&target);
- automocs.push_back(std::make_pair(automoc, &target));
+ if(automoc.InitializeMocSourceFile(&target))
+ {
+ automocs.push_back(std::make_pair(automoc, &target));
+ }
}
}
}
diff --git a/Source/cmQtAutomoc.cxx b/Source/cmQtAutomoc.cxx
index 10ce641..5730c8c 100644
--- a/Source/cmQtAutomoc.cxx
+++ b/Source/cmQtAutomoc.cxx
@@ -119,10 +119,21 @@ cmQtAutomoc::cmQtAutomoc()
}
}
-void cmQtAutomoc::InitializeMocSourceFile(cmTarget* target)
+bool cmQtAutomoc::InitializeMocSourceFile(cmTarget* target)
{
+ cmMakefile* makefile = target->GetMakefile();
+ // don't do anything if there is no Qt4 or Qt5Core (which contains moc):
+ std::string qtMajorVersion = makefile->GetSafeDefinition("QT_VERSION_MAJOR");
+ if (qtMajorVersion == "")
+ {
+ qtMajorVersion = makefile->GetSafeDefinition("Qt5Core_VERSION_MAJOR");
+ }
+ if (qtMajorVersion != "4" && qtMajorVersion != "5")
+ {
+ return false;
+ }
+
std::string automocTargetName = target->GetName();
- cmMakefile *makefile = target->GetMakefile();
automocTargetName += "_automoc";
std::string mocCppFile = makefile->GetCurrentOutputDirectory();
mocCppFile += "/";
@@ -134,6 +145,7 @@ void cmQtAutomoc::InitializeMocSourceFile(cmTarget* target)
mocCppFile.c_str(), false);
target->AddSourceFile(mocCppSource);
+ return true;
}
void cmQtAutomoc::SetupAutomocTarget(cmTarget* target)
@@ -141,16 +153,6 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target)
cmMakefile* makefile = target->GetMakefile();
cmLocalGenerator* localGen = makefile->GetLocalGenerator();
const char* targetName = target->GetName();
- // don't do anything if there is no Qt4 or Qt5Core (which contains moc):
- std::string qtMajorVersion = makefile->GetSafeDefinition("QT_VERSION_MAJOR");
- if (qtMajorVersion == "")
- {
- qtMajorVersion = makefile->GetSafeDefinition("Qt5Core_VERSION_MAJOR");
- }
- if (qtMajorVersion != "4" && qtMajorVersion != "5")
- {
- return;
- }
bool relaxedMode = makefile->IsOn("CMAKE_AUTOMOC_RELAXED_MODE");
diff --git a/Source/cmQtAutomoc.h b/Source/cmQtAutomoc.h
index 962e254..01b68fc 100644
--- a/Source/cmQtAutomoc.h
+++ b/Source/cmQtAutomoc.h
@@ -23,7 +23,7 @@ public:
cmQtAutomoc();
bool Run(const char* targetDirectory);
- void InitializeMocSourceFile(cmTarget* target);
+ bool InitializeMocSourceFile(cmTarget* target);
void SetupAutomocTarget(cmTarget* target);
private:
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index f8e4afd..30f733c 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -970,6 +970,16 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Environment")
+ add_test(QtAutomocNoQt ${CMAKE_CTEST_COMMAND}
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/QtAutomocNoQt"
+ "${CMake_BINARY_DIR}/Tests/QtAutomocNoQt"
+ ${build_generator_args}
+ --build-project QtAutomocNoQt
+ --build-options -DCMAKE_BUILD_TYPE=\${CTEST_CONFIGURATION_TYPE}
+ )
+ list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/QtAutomocNoQt")
+
if(QT4_WORKS AND QT_QTGUI_FOUND)
add_test(QtAutomoc ${CMAKE_CTEST_COMMAND}
--build-and-test
diff --git a/Tests/QtAutomocNoQt/CMakeLists.txt b/Tests/QtAutomocNoQt/CMakeLists.txt
new file mode 100644
index 0000000..b26e471
--- /dev/null
+++ b/Tests/QtAutomocNoQt/CMakeLists.txt
@@ -0,0 +1,7 @@
+cmake_minimum_required(VERSION 2.8)
+
+project(QtAutomocNoQt)
+
+set(CMAKE_AUTOMOC ON)
+
+add_executable(hello main.c)
diff --git a/Tests/QtAutomocNoQt/main.c b/Tests/QtAutomocNoQt/main.c
new file mode 100644
index 0000000..8488f4e
--- /dev/null
+++ b/Tests/QtAutomocNoQt/main.c
@@ -0,0 +1,4 @@
+int main(void)
+{
+ return 0;
+}
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=65b5c1e0645a466dbf5d163296754d12e2db53d5
commit 65b5c1e0645a466dbf5d163296754d12e2db53d5
Merge: 79568f9 ab079ee
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue Mar 12 17:39:03 2013 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Tue Mar 12 17:39:03 2013 -0400
Merge branch 'property-link-depends-no-crash' into fix-automoc-no-qt
-----------------------------------------------------------------------
Summary of changes:
Source/cmGlobalGenerator.cxx | 6 +++-
Source/cmQtAutomoc.cxx | 26 ++++++++++---------
Source/cmQtAutomoc.h | 2 +-
Tests/CMakeLists.txt | 10 +++++++
Tests/QtAutomocNoQt/CMakeLists.txt | 7 +++++
.../subdir => QtAutomocNoQt}/main.c | 0
6 files changed, 36 insertions(+), 15 deletions(-)
create mode 100644 Tests/QtAutomocNoQt/CMakeLists.txt
copy Tests/{CTestTestSubdir/subdir => QtAutomocNoQt}/main.c (100%)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list