Commit Graph

47 Commits

Author SHA1 Message Date
Brad King
e44cc45530 Merge topic 'autogen_adaptive_warning'
5fe18eee13 Autogen: Adaptive missing Qt warning
f2f1661334 Autogen: Add and use QtAutoGen::Tools method
b2343ff086 Autogen: Fix rcc validity check

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2806
2019-01-16 09:51:33 -05:00
Bruno Manganelli
cc2a5261f8 Factor out enum MessageType into dedicated header
Reduce the number of files relying on `cmake.h`.
2019-01-16 08:16:31 -05:00
Regina Pfeifer
414aa6c81e clang-tidy: Simplify boolean expressions 2019-01-15 11:40:25 -05:00
Sebastian Holtermann
5fe18eee13 Autogen: Adaptive missing Qt warning
This makes the warning message for a missing Qt use
the requested Qt version in the message text.
2019-01-15 10:15:03 +01:00
Tobias Hunger
cd32886b2f Autogen: Add AUTO(MOC|RCC|UIC)_EXECUTABLE target properties
Allow to force moc/rcc/uic compiler used for AUTO(MOC|RCC|UIC).

Setting these properties is only necessary if you are going to do
strange things like build these tools as part of your own build system.

Setting these properties will also prevent cmake from testing the
binary: It is user-provided and assumed to be valid.
2019-01-10 08:03:24 -05:00
Tobias Hunger
9045f6a30f Autogen: Prepare for Qt 6
Handle Qt version > 5 in Qt AutoGen.

This patch does *NOT* include tests and documentation: There is no
Qt 6 yet. I still need this patch to work on a cmake based build
system for Qt 6.
2019-01-07 14:13:10 +01:00
Brad King
0f7cca1dae Merge topic 'autogen-cleanups'
7630eb1975 cmQtAutoGenInitializer: Reduce code duplication

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Tobias Hunger <tobias.hunger@gmail.com>
Merge-request: !2689
2018-12-10 08:26:05 -05:00
Tobias Hunger
7630eb1975 cmQtAutoGenInitializer: Reduce code duplication
Do not repeat the code used to find uic/rcc and moc exectuables.
2018-12-07 13:44:33 -05:00
Sebastian Holtermann
4be7f38d57 Autogen: Revert passing compiler implicit includes to moc
Passing an incomplete list of compiler include directories causes
a regression in the KIO project (and probably others). We need to
disable it until the complete list is available (see #16291).

Fixes: #18669
Issue: #18041
2018-12-07 08:01:02 -05:00
Brad King
d69877fe86 Merge topic 'autogen-qtversion-detection'
5191b74524 Autogen: Qt version detection cleanup

Acked-by: Kitware Robot <kwrobot@kitware.com>
Reviewed-by: Sebastian Holtermann <sebholt@xwmw.org>
Merge-request: !2694
2018-12-06 09:05:22 -05:00
Brad King
a722316bcb Merge topic 'autogen_uic_empty_fix'
5f0f84c7e0 Autogen: Don't add a WIN32 moc definition if we have a moc_predefs.h file
0814d74548 Autogen: Add QtAutogen.UicNoGui test
2ef640819f Autogen: Tests: Differentiate between Qt core and Qt gui tests

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2668
2018-12-06 08:57:59 -05:00
Tobias Hunger
5191b74524 Autogen: Qt version detection cleanup
Split the Qt version detection code up a bit so that it is a bit
easier to follow.
2018-12-03 10:10:44 +01:00
Brad King
772edffbf0 Merge topic 'readability-static-accessed-through-instance'
3e60580784 clang-tidy: Fix readability-static-accessed-through-instance

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2647
2018-11-28 09:07:45 -05:00
Sebastian Holtermann
5f0f84c7e0 Autogen: Don't add a WIN32 moc definition if we have a moc_predefs.h file
On Windows systems we used to add a "-DWIN32" definition to the ``moc``
defines.  This is not necessary anymore when we have a
``moc_predefs.h`` file that provides all compiler predefines.

Closes #18623
2018-11-28 13:07:27 +01:00
Brad King
6bfcd4db3b Merge topic 'autogen_uic_empty_fix_3_13'
b1b5004c1a Autogen: Fix empty uic executable string

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2667
2018-11-28 06:42:58 -05:00
Sebastian Holtermann
b1b5004c1a Autogen: Fix empty uic executable string
In CMake 3.13.0 when a target has ``AUTOUIC`` enabled but doesn't
link against Qt5Widgets, the uic executable string is empty and
an error string "The uic executable \"\" does not exist" is generated.
In CMake 3.12 ``AUTOUIC`` was silently disabled instead.
This patch fixes the regression and restores the behavior of CMake 3.12.

Fixes: #18630
2018-11-27 08:21:40 -05:00
Regina Pfeifer
3e60580784 clang-tidy: Fix readability-static-accessed-through-instance
Enable the check in .clang-tidy and fix all warnings.
2018-11-22 00:11:37 +01:00
Sebastian Holtermann
01d5e5c460 Autogen: Add and use cmQtAutoGenInitializer::InfoWriter class
The new ``cmQtAutoGenInitializer::InfoWriter`` class provides an
interface to write strings/vectors/sets/maps in CMake format
into a file.  Its use replaces various `cmJoin` calls that
failed to address escaping of semicolons in list elements.

Closes #18554
2018-11-14 19:21:03 +01:00
Sebastian Holtermann
3baa817c34 Autogen: Add support for global `autogen and autorcc` targets
This teaches CMake the variables

- CMAKE_GLOBAL_AUTOGEN_TARGET
- CMAKE_GLOBAL_AUTOGEN_TARGET_NAME
- CMAKE_GLOBAL_AUTORCC_TARGET
- CMAKE_GLOBAL_AUTORCC_TARGET_NAME

which control the generation of global
``autogen`` and ``autorcc`` targets.

Closes #17721
2018-11-11 14:28:55 +01:00
Sebastian Holtermann
b5e895b5d4 Autogen: Add (CMAKE_)AUTOGEN_ORIGIN_DEPENDS support
This adds

- the variable ``CMAKE_AUTOGEN_ORIGIN_DEPENDS`` which initializes
- the target property ``AUTOGEN_ORIGIN_DEPENDS``

which controls whether or not the origin target dependencies
should be forwarded to the corresponding ``_autogen`` target.

The default value of ``CMAKE_AUTOGEN_ORIGIN_DEPENDS`` is ``ON``
which corresponds to the behavior that is in place since CMake 3.9.

Closes: #18493
2018-11-03 12:14:40 +01:00
Brad King
a6e02f881d add_dependencies: Track backtraces internally
Record backtraces for "utility" dependencies created by
`add_dependencies` calls.
2018-10-18 08:10:55 -04:00
Brad King
8f076acdb0 cmLocalGenerator: Remove AddCompileDefinitions method
This method offers the same definitions as `GetTargetDefines` except
that it excludes the "export" macro on shared libraries.  Update call
sites to use `GetTargetDefines` instead.  Some of them were incorrectly
excluding the export macro.
2018-10-10 09:34:12 -04:00
Vitaly Stakhovsky
f4ff60a803 cmMakefile: Make GetSafeDefinition return std::string const& 2018-09-18 11:16:46 -04:00
Vitaly Stakhovsky
6f16be6a62 Remove unnecessary c_str() calls
Use the new IsOn(),IsOff() overloads.
2018-09-05 15:12:57 -04:00
Vitaly Stakhovsky
c8fd23ec6f cmMakefile: return directories as const std::string& 2018-08-27 14:07:43 -04:00
Sebastian Holtermann
3aa11f31fc Autogen: Use integers to store the Qt version 2018-08-13 18:12:47 +02:00
Sebastian Holtermann
1d87c9f318 Autogen: Initializer: Group variables in structs 2018-08-13 11:31:39 +02:00
Sebastian Holtermann
b6802cd506 cmGeneratedFileStream: clang-tidy applied to remove redundant `c_str` calls
After changing the ``cmGeneratedFileStream`` methods to accept
``std::string const&`` instead of ``const char*`` we don't
need to call ``std::string::c_str`` anymore when passing
a ``std::string`` to a ``cmGeneratedFileStream`` method.

This patch removes all redundant ``std::string::c_str``
calls when passing a string to a ``cmGeneratedFileStream`` method.

It was generated by building CMake with clang-tidy enabled using
the following options:

-DCMAKE_CXX_CLANG_TIDY=/usr/bin/clang-tidy-4.0;-checks=-*,readability-redundant-string-cstr;-fix;-fix-errors
2018-08-07 17:02:39 +02:00
Sebastian Holtermann
f345135845 Autogen: For Qt5 pass all implicit include directories to moc
For Qt4 it was not possible to pass all compiler implicit include
directories to moc because it couldn't handle some system headers.
For reference see commit 753b905ec8,
commit d2536579d5 and
[QTBUG-28045](https://bugreports.qt.io/browse/QTBUG-28045).

For Qt5's moc the problem does not persist anymore so we can
(and should) pass all implicit include directories to moc.

Fixes #18041
2018-07-30 09:22:47 +02:00
Sebastian Holtermann
2d6cfe2677 Autogen: Split initializer main method 2018-07-30 09:22:47 +02:00
Sebastian Holtermann
84bdae8895 Autogen: Compute variables in Init stage instead of Setup stage 2018-07-30 09:22:46 +02:00
Sebastian Holtermann
8e0d70272d Autogen: Move info file write code into methods 2018-07-30 09:22:46 +02:00
Sebastian Holtermann
5776639fbf Autogen: Pass absolute include path in info file 2018-07-30 09:22:46 +02:00
Sebastian Holtermann
86b332c25d Return std::string from cmGeneratorTarget::ImportedGetLocation 2018-07-11 16:58:48 +02:00
Sebastian Holtermann
189f723509 Autogen: Wrap moc/uic/rcc related variables in structs 2018-07-11 13:54:46 +02:00
Sebastian Holtermann
c6a8002827 Autogen: Improve error detection during configuration
cmQtAutoGenInitializer::InitCustomTargets and
cmQtAutoGenInitializer::SetupCustomTargets
now return their success value which gets evaluated
and passed on by the caller (cmGlobalGenerator).

Checks for the existance of the moc/uic/rcc
binaries have been introduces in cmQtAutoGenInitializer.
Additionally they get called once with a "-h"
argument to determine if they're functional.
This way any binary-not-found problem is caught
during the configuration phase.
2018-07-11 13:29:49 +02:00
Sebastian Holtermann
42cc0644d5 Autogen: Use default and remove custom GetSafeProperty functions 2018-07-02 12:53:44 +02:00
Sebastian Holtermann
e28dc3b1d8 Autogen: Add CMAKE_AUTOGEN_VERBOSE variable support
Setting CMAKE_AUTOGEN_VERBOSE enables verbose output during
AUTOMOC, AUTOUIC and AUTORCC generation.
2018-06-21 19:16:40 +02:00
Kitware Robot
d7204e649e Revise C++ coding style using clang-format-6.0
Run the `clang-format.bash` script to update all our C and C++ code to a
new style defined by `.clang-format`.  Use `clang-format` version 6.0.

* If you reached this commit for a line in `git blame`, re-run the blame
  operation starting at the parent of this commit to see older history
  for the content.

* See the parent commit for instructions to rebase a change across this
  style transition commit.
2018-06-01 09:53:42 -04:00
Sebastian Holtermann
41685c8ba0 Autogen: Let AUTORCC generate output for all configurations
For multi configuration generators let AUTORCC generate
the rcc output for all configurations.  This is a workaround
for the incomplete `$<CONFIG>` support in the DEPENDS and OUTPUT
clauses of a custom_command/custom_target.  Since we can't depend
on the per-config rcc output file we somehow must ensure the successful
rcc build for one configuration doesn't shadow the need to rcc rebuild
for a second configuration.

Closes #18006
2018-05-30 17:45:01 +02:00
Sebastian Holtermann
2930a198f6 Autogen: Add lock file to AUTORCC commands
By using a per .qrc lock file in AUTORCC, the same
`cmake -E cmake_autorcc ...` command can be called concurrently.
2018-05-30 17:45:01 +02:00
Sebastian Holtermann
e461a136c1 Autogen: Register generated dependency files
For CMP0058 record that rcc info files are generated by CMake.

Fixes: #17985
2018-05-14 09:21:14 -04:00
Sebastian Holtermann
c85ef9c339 Autogen: Overwrite info files when changed only
Check if the content of the AUTOMOC/UIC/RCC info file
will change before overwriting it. This avoids unnecessary
AUTORCC rebuilds when AUTORCC unrelated CMake settings change.
2018-02-06 11:20:08 -05:00
Sebastian Holtermann
a8ee7406a7 Autogen: Improved multi-config include scheme
For multi configuration generators AUTOMOC generates the
moc files that are included in `mocs_compilation.cpp`
in `AUTOGEN_BUILD_DIR/include_$<CONFIG>/`. By doing so each
configuration reads different moc files when compiling
`mocs_compilation.cpp`. Since we do not (need to) rewrite
`mocs_compilation.cpp` on a configuration change anymore,
the files also does not need to be recompiled anymore.
Not having to rewrite and recompile `mocs_compilation.cpp`
on a configuration change anymore was the main objective of
this patch.

In a similar fashion AUTORCC generates a `qrc_BASE_CMAKE.cpp`
file below `AUTOGEN_BUILD_DIR/include_$<CONFIG>/` and
`qrc_BASE.cpp` becomes a mere wrapper that includes this
actuall rcc output file (when using multi configuration
generators).

The template files `Modules/AutoRccInfo.cmake.in` and
`Modules/AutogenInfo.cmake.in` were removed in favor
of writing the info `.cmake` files manually.

Closes #17230
2018-02-02 09:10:40 +01:00
Pavel Solodovnikov
653b894683 Reduce raw string pointers usage.
* Change some functions to take `std::string` instead of
  `const char*` in the following classes: `cmMakeFile`, `cmake`,
  `cmCoreTryCompile`, `cmSystemTools`,  `cmState`, `cmLocalGenerator`
  and a few others.
* Greatly reduce using of `const char*` overloads for
  `cmSystemTools::MakeDirectory` and `cmSystemTools::RelativePath`.
* Remove many redundant `c_str()` conversions throughout the code.
2018-01-31 18:23:03 +03:00
Wouter Klouwen
e6a80ccfc4 Make use of std::chrono throughout every component
This commit continues the changes made in CTest to support std::chrono
by
applying it throughout every component where a duration was used.

No functional change intended.
2018-01-23 18:56:42 +00:00
Sebastian Holtermann
9cfa213aa6 Autogen: Rename cmQtAutogeneratorInitializer to cmQtAutoGenInitializer 2018-01-17 17:23:49 +01:00