FindZLIB accepts various names for zlib (e.g. "z", "zlib", ...) in
various search locations. Before this patch zlib ignored the priority
implied by the search locations and instead prioritized based on the
library name. Consequently ensuring the pick of a zlib from e.g. a
CMAKE_PREFIX_PATH was not possible if it didn't have the highest
priority name ("z").
This unexpected behavior led to bugs in third party projects (e.g.
https://github.com/Microsoft/vcpkg/issues/1939). A common way to
encounter the issue in the wild is on Windows with the popular
Anaconda python distribution which puts a "z.lib" in a lib/
subdirectory reachable from a bin/ path in PATH. From then on cmake
will always pick up this library instead of the one intended by the
user.
This patch adds the NAMES_PER_DIR option to the find_library calls made
by FindZLIB making it search each directory for all names before
considering lower priority directory names resolving these issues.
A new cache option named `CMake_MSVC_PARALLEL` is now available that can
be used to control the usage of [`/MP`][1] to the MSVC compiler. This
enables parallelized builds on a per-translation unit basis. To enable
`/MP`, specify value `ON` to the option. Using an integral non-zero
value will control the specific number of threads used with the `/MP`
option, as opposed to letting the toolchain decide for you.
Fixes#17696
[1]: https://docs.microsoft.com/en-us/cpp/build/reference/mp-build-with-multiple-processes
The `LINK_ONLY` generator expression is used to represent private
dependencies of static libraries in their `INTERFACE_LINK_LIBRARIES`
property value. Fix evaluation of generator expressions during export
to support the `LINK_ONLY` genex. Extend the RunCMake.AndroidMK test
with a case for this.
When exporting `INTERFACE_LINK_LIBRARIES`, we must evaluate generator
expressions first, before expanding the `;` list, in case they contain
or generate semicolons.
Ninja runs just one command line for every build statement, so the Ninja
generator needs to `&&`-chain multiple commands together into one long
string. For long custom command sequences this can exceed the maximum
command-line length for the operating system. In such cases, write the
commands out to a script instead, and then run the script from Ninja's
one command line.
Co-Author: Brad King <brad.king@kitware.com>
Fixes: #15612
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.