The XXX_autogen targets are implemented as utility commands, which
means they always run, even if there weren't any changes.
For the Ninja generator and Qt >= 5.15 we're taking a different
approach: This commit adds custom commands that create
XXX_autogen/timestamp files. Those custom commands have a depfile
assigned that is generated from the depfiles that were created by moc.
The XXX_autogen targets merely wrap the XXX_autogen/timestamp custom
commands.
Fixes: #18749
In Qt version 5.15.0 moc learned to output the dependencies
of the generated file.
This commit enhances JobCompileMocT to read the dependency file
written by moc. The dependencies are stored in the same cache that's
used for the dependencies determined by dependency filters.
The dependency filter functionality is turned off if moc's dependency
output feature is used.
Fixes: #17750Fixes: #19058
Introduce the function cmReadGccDepfile that parses a GCC-style depfile
and returns its content. The implementation uses a lexer that is
modeled after the re2c implementation in Ninja.
The sample files of the autotest have been created with gcc 8.3.0.
This depfile reader is to be used by the Autogen facility to make use
of the depfiles that are generated by Qt's meta object compiler.
When CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY is set on
Xcode generator created post build scripts which tried to call
XCODE_DEPEND_HELPER.make script in subproject.
But XCODE_DEPEND_HELPER.make don't exist in
subprojects when mentioned option is set on.
Fixes: #20262
Fixes#17559
Replace our hard-coded default of cudart=static with a first-class abstraction to select the runtime library from an enumeration of logical names.
When `ninja` re-runs CMake to re-generate the build system, do not try
to use the ninja tools to update metadata on Windows. The outer ninja
process is already holding the files open.
Issue: #20274
The ninja 1.10 tools we use since commit fb18215904 (Ninja: clean ninja
metadata once generated, 2019-05-13) expect `build.ninja` to be
available and loadable. In commit 6cc74b6140 (cmGlobalNinjaGenerator:
avoid cleandead and recompact in Ninja-Multi, 2020-01-22) we added a
condition to exclude the tools in a case where `build.ninja` is not
available. Generalize that condition using a local variable and extend
it for the case that `build.ninja` is not loadable in the current
directory because it is meant to be a sub-ninja for a higher directory.
QCC is a wrapper around GCC, but it is not a fully transparent wrapper.
Some compile options need to be passed to GCC using a `-Wc` option.
QCC does not support --sysroot, so setting CMAKE_SYSROOT in a toolchain
file currently does not work. This means that it is likely that no one
is setting CMAKE_SYSROOT in existing QNC toolchain files. Override the
GCC option for sysroot in the QCC.cmake file with -Wc,-isysroot.
This exposes a further issue in that the QNX SDK does not follow the
same architectural folder structure as linux uses. That is, on linux
systems, architecture-specific libraries might be in
<sysroot>/usr/lib/<arch>
such as
/usr/lib/x86_64-linux-gnu/libcurl.so
CMake models this by suffixing the <arch> onto lib directories when
searching for libraries.
The QNX SDK is structured differently such that the <arch> should be
used as a prefix:
<sysroot>/<arch>/usr/lib
such as
<sysroot>/x86_64/usr/lib/libcurl.so
Add a variable for platform configuration to set whether to prefix or
suffix the <arch> and set that in the QCC.cmake.
Use the directory structure of the QNX SDK to compute the <arch> from
the implicit library directories. The assumption is that the arch will
be a single directory directly below the CMAKE_SYSROOT, below which the
usr/ prefix occurs.
It would not be appropriate to instruct users to make the <arch> part of
the sysroot when specified in the toolchain file because:
1. That would be non-DRY - The QCC wrapper already determines the <arch>
by the -V argument passed to the compiler, specified in the toolchain
file as the CMAKE_C_COMPILER_TARGET variable.
2. The includes in the QNX SDK are not below the <arch> directory.
So, the location of the <arch> in the full path is different on QNX
compared to, say an embedded linux platform, but the intent is the same.
Add documentation to recommend the use of CMAKE_SYSROOT in a QNX
toolchain file.
As the CMAKE_SYSROOT is always the same for QNX, it would be possible to
simply set it in QCC.cmake. However, that would change behavior for
existing users as when CMAKE_SYSROOT is set, files/paths outside of the
CMAKE_SYSROOT do not get found.
The <arch> prefixing is only enabled in cmSearchPath.cxx if
CMAKE_SYSROOT is set. This ensures that the user gets consistency in
the current state without CMAKE_SYSROOT, and gets better consistency
when using CMAKE_SYSROOT.
`clang-tidy` does not infer driver mode if it is not provided with a
JSON compilation database. This is exactly the way cmake launches it.
Hence clang-tidy will only use the default driver mode. Add an explicit
driver mode argument to avoid this.
b7a2baf38c Ninja Multi-Config: Add variable to control configs used in cross-config build
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4269
When the `DEPENDS` option names a logical target name, convert to the
"real" path of that target rather than any of the symlink-provided
alternative file names. This makes the dependencies consistent with the
outputs named by link rules producing the target artifacts.
Fixes: #20264
These are not suffix rules and are not suppressed by the empty
`.SUFFIXES` recipe. Additionally, the old `SUFFIXES =` code didn't
actually accomplish this, so remove it.
Add the timestamp and stack depth of the function call to the JSON trace
output format. This information can be useful for cmake profiling and
call stack inspection (see e.g. https://github.com/volo-zyko/cmake-profile-stats).
Improve unit test to allow for varying set of keys to check in trace lines.
3ec82b713e cmMarkAsAdvancedCommand: ignore variables which don't exist in the cache
701a5c60e0 cmake: avoid marking local or unused variables as advanced
af158149e7 FindOpenSSL: do not mark a local variable as advanced
74f659f1f2 FindCurses: only mark CURSES_EXTRA_LIBRARY when it is used
7e2ae4e96d FindOpenGL: only mark declared cache variables as advanced
7cc02a0c29 FindLua: only mark LUA_MATH_LIBRARY as advanced if required
85cd26b8a6 FindBoost: only mark Boost_DIR as advanced if defined
338c7916ba CTest: avoid marking undeclared cache variables as advanced
...
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4150
ba3a417dce Tests/CustomCommand: add a test for depending on a `./path`
e23475dc73 Tests/CustomCommand: fix custom command line to actually make its output
db4780d584 cmGeneratorTarget: search for relative paths to the binary directory
ec479f101f cmLocalGenerator: collapse the path after construction
fd0ba705ce add_custom_command: check if a relative path should be an in-source path
fd84f510f8 cmLocalGenerator: simplify the current source dir query
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4195
`rcc` generated files are not compatible with unity builds, because they
contain classes in anonymous namespaces and static data with identical names.
This patch sets the source file property `SKIP_UNITY_BUILD_INCLUSION` to `On`
on all `AUTORCC` generated files to exclude them from unity build files.
Fixes: #20191 "QT5: Exclude resource files from unity build"
f0e67da061 target_link_libraries: Fix out-of-dir linking of a list of targets
acee629103 cmTargetLinkLibrariesCommand: Move HandleLibrary to helper struct
ba675f1ecc Tests: Enable CMP0022 in ExportImport out-of-dir linking case
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4226
Dependencies in the form `./somepath.txt` are not found otherwise
because we only match on last-path-component searches and `.` never
shows up in a full path as a full component.
This still is broken for dependencies on generated paths where they get
generated to the source directory rather than the build directory
however, but there's no way to determine that is the case.
Fixes: #20194
In a case like
target_link_libraries(targetInOtherDir PUBLIC "$<1:a;b>")
then all entries in the list need to be looked up in the caller's
scope. Previously our `::@(directory-id)` suffix would apply only
to the last entry. Instead surround the entire entry by a pair
`::@(directory-id);...;::@` so that the `::@` syntax can encode
a directory lookup scope change evaluated as the list is processed.
Fixes: #20204