diff options
author | Stephen Kelly <steveire@gmail.com> | 2013-02-20 16:06:45 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2013-02-22 13:29:33 (GMT) |
commit | 79568f95ab920158fdcb857c9b99592ad5300a4e (patch) | |
tree | d728b4e87615b8a6b14cf9bb70bd135a119954fb /Tests | |
parent | 4515b09731856dc2713c567a48fec1374b317ece (diff) | |
download | CMake-79568f95ab920158fdcb857c9b99592ad5300a4e.zip CMake-79568f95ab920158fdcb857c9b99592ad5300a4e.tar.gz CMake-79568f95ab920158fdcb857c9b99592ad5300a4e.tar.bz2 |
automoc: Add source file to target early to set the linker language
Previously, GetIncludeDirectories was called before calling
target->AddSourceFile(mocCppSource). Since commit a1c4905f (Use the
link information as a source of compile definitions and
includes., 2013-02-12), the include directories are determined by
the link information.
Valid link information requires that the linker language can be
determined, which depends on the source files languages and the
dependent targets languages. In the case of the no_link_languages
target in the unit test, there are no dependencies and the additional
source file no_link_languages_automoc.cpp is added to the target
at generate-time. That file can be used to determine the linker
language, but it must be added to the target before calling
GetIncludeDirectories.
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/QtAutomoc/CMakeLists.txt | 6 | ||||
-rw-r--r-- | Tests/QtAutomoc/empty.cpp | 1 | ||||
-rw-r--r-- | Tests/QtAutomoc/empty.h | 9 |
3 files changed, 16 insertions, 0 deletions
diff --git a/Tests/QtAutomoc/CMakeLists.txt b/Tests/QtAutomoc/CMakeLists.txt index 530818e..ebfbb03 100644 --- a/Tests/QtAutomoc/CMakeLists.txt +++ b/Tests/QtAutomoc/CMakeLists.txt @@ -38,3 +38,9 @@ generate_export_header(libC) target_link_libraries(libC LINK_PUBLIC libB) target_link_libraries(foo codeeditorLib ${QT_LIBRARIES} libC) + +add_library(empty STATIC empty.cpp) +set_target_properties(empty PROPERTIES AUTOMOC TRUE) +target_link_libraries(empty no_link_language) +add_library(no_link_language STATIC empty.h) +set_target_properties(no_link_language PROPERTIES AUTOMOC TRUE) diff --git a/Tests/QtAutomoc/empty.cpp b/Tests/QtAutomoc/empty.cpp new file mode 100644 index 0000000..ab32cf6 --- /dev/null +++ b/Tests/QtAutomoc/empty.cpp @@ -0,0 +1 @@ +// No content diff --git a/Tests/QtAutomoc/empty.h b/Tests/QtAutomoc/empty.h new file mode 100644 index 0000000..4566142 --- /dev/null +++ b/Tests/QtAutomoc/empty.h @@ -0,0 +1,9 @@ + +#include <QObject> + +class Empty : public QObject +{ + Q_OBJECT +public: + explicit Empty(QObject *parent = 0) {} +}; |