Windows is heading toward making UTF-8 the preferred MBCS. As CMake's
internal encoding, `UTF-8` is effectively equivalent to `NONE`, which
was CMake's behavior prior to 3.15's accidental change to `AUTO`.
Behavior of `ENCODING UTF-8` is independent of CMake's internal
encoding, making it in principle a better default than `NONE`.
Add policy CMP0176 for compatibility and to document the default's
history.
Fixes: #26262
The default was originally AUTO in commit 2ed473b3b8 (execute_process:
Add ENCODING option for Windows child process output, 2016-11-23,
v3.8.0-rc1~232^2) but was changed back to NONE by commit 07c3380a6e
(execute_process: Restore no-decoding default behavior, 2017-02-13,
v3.8.0-rc2~26^2) for CMake 3.8. Later it was accidentally changed back
to AUTO by commit b783e62533 (cmExecuteProcessCommand: Port to
cmArgumentParser, 2019-03-25, v3.15.0-rc1~270^2) in CMake 3.15 but the
documentation was not updated. Document the current default, AUTO, and
add a test case to verify it.
Issue: #26262
Add a new CMP0175 policy to preserve backward compatibility
for projects that were using unsupported keywords or arguments.
Fixes: #26096, #21089, #18976
ceeea4e511 cmake_parse_arguments: Set variable if empty string given after keyword
2f5cc6afa1 cmParseArgumentsCommand: Use cmStrCat() for string concatenation
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9748
a1fdcb9d47 Help: get_property() result var is unset if property is not set
edee1b18b2 Help: Minor formatting and grammar fixes for get_property()
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9769
If a single-value keyword is followed by an empty string, the
command unsets the variable for that keyword instead of setting
it to the empty string. This is inconsistent and unexpected. Add
policy CMP0174 which ensures the variable for a single-value
keyword is always set when any value is given, not just for a
non-empty value.
The new CMP0174 policy only affects the PARSE_ARGV form of
cmake_parse_arguments. The older form silently drops all empty
string arguments before processing the argument list.
Fixes: #25972
Previously this behavior was only mentioned implicitly by the command
signature. Describe it explicitly as we do for other conditions that
automatically expand variables.
Fixes: #26234
When a library file name is encountered multiple times, reuse the result
from the first time. This more closely matches the behavior of the
dynamic loader on Linux.
Fixes: #24621
Add initial support for exporting (install only, for now) Common Package
Specification (https://cps-org.github.io/cps/) format package
descriptions. This has some limitations, such as not supporting
generator expressions (as these cannot be portably exported), and only
partially supporting transitive dependencies, but should be usable for
at least some simple cases. (Actually, $<LINK_ONLY> is theoretically
supportable, but is not yet implemented.)
This still needs tests; these will be added in the next commit. Other
potential improvements include support for language-specific compile
definitions and inferring some package properties from project
properties. Additionally, there is no module support yet; this is partly
pending on having a tool agnostic format for providing the necessary
information.
The document's intro claims that the options documented up top are
the ones common to multiple signatures, but `RENAME` is only valid
for `install(FILES ...)`. Move it to that section of the docs.
* Wraps the llpkgc parser with cmPkgConfigParser
* Adds various resolution and mangling code under cmPkgConfigResolver
* Documents new command cmake_pkg_config(EXTRACT). Documentation is written with
the assumption additional subcommands will be added soon.
* Adds various tests for the above
By specifying CODEGEN as an argument to add_custom_command the
custom command will be added to a codegen build target.
The intent is to provide a convenient way for users to get
their generated files without having to build the whole project.
This can be helpful for code analysis tools which can be useful
for IDEs and CI.
This patch improves the wording of the documentation of the
EXCLUDE_FROM_ALL directory property, and makes the
add_subdirectory()- and fetchcontent-documentation refer to it.
4cb5bb014d try_compile: Propagating top level includes into whole-project calls
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robertjmaynard@gmail.com>
Merge-request: !9532
Projects may be generating a list of files or directories to pass as arguments
to file(TOUCH), file(TOUCH_NOCREATE), or file(MAKE_DIRECTORY). Those
lists might end up being empty, so rather than requiring at least one item,
allow an empty list.
Fixes: #24897
67171a99be Help: Fix inaccurate use of "function" in macro docs
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Juan Ramos <juan.ramos@kitware.com>
Merge-request: !9534
8d2a503c1e add_custom_command: Allow OUTPUT filenames containing a hash '#' character
b38000d774 cmGlobalXCodeGenerator: Re-implement legacy makefile path escaping
d929089687 cmGlobalXCodeGenerator: Do not use legacy makefile escaping in shell commands
d61fc2c52e cmGlobalXCodeGenerator: Migrate legacy makefile path escaping to local helper
6010e007c7 cmState: Add method to check for the Borland Makefiles generator
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9514
Most generators now support this character after escaping and quoting
cleanups over time. Disallow it only on generators that do support it.
Fixes: #25604
Moved documentation of file(GET_RUNTIME_DEPENDENCIES ...) from
the 'Reading' section to a separate section at the bottom of
the page. Because it is a very long text, and because this
signature is quite different from all the others in the
'Reading' section.
Re-organize the section to explicitly describe target-specific
commands, build properties, and usage requirement properties.
Add builtin transitive properties that have been created since
the document was first written.
a61c9afdf8 add_library: Reject shared libraries on platforms that do not support them
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !9347
The note regarding commands superseded by install() somehow wound
up nested under the install(EXPORT) signature, when it has nothing
to do with install(EXPORT). Move it to the top level, immediately
before the Examples section.
6ba2bbc0f3 Help: Restructure and improve LINKER_TYPE docs
c39bc6e412 Help: CMAKE_<LANG>_USING_LINKER_<TYPE> can be a list of flags
1c7ccefd83 Help: Add custom linker example for CMAKE_<LANG>_USING_LINKER_<TYPE>
aecea7b28b Help: Grammar, typos and wording improvements for linker variables
5b21897c6e Help: Remove stray formatting for try_compile() LINKER_LANGUAGE keyword
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9362
Specifically, the various CMAKE_PROJECT_...INCLUDE... variables can
now take a list of things, and those things can be module names
too, not just file names.
Under job server integration, added by commit 80fe56c481 (ctest: Add
support for running under a make job server on POSIX systems,
2023-11-15, v3.29.0-rc1~324^2), use a very high default so that
parallelism is effectively limited only by available job server tokens.
Otherwise, choose a default limit based on the number of processors.
Also allow passing `0` to specify unbounded parallelism.
Fixes: #25739
Add a section to the `define_property()` documentation which
details the behavior when attempting to redefine an existing
property. (The command is silently ignored.)
Provide an example using `get_property()` to examine a property
definition created with `define_property()`.
Add tests to cover these cases:
* run as regular CMake module, in NORMAL_MODE (expected to fail);
* run as CMake script in SCRIPT_MODE (expected to exit with given code);
* run as CMake script that `include()`-s another script with EXIT subcommand;
* run as CMake script which EVAL-uates EXIT subcommand via
`cmake_language(EVAL CODE "<cmake code>")`.
Fixes: #23162
Since ff6234509e (Help: Clarify behavior of INHERITED properties, 2018-03-21),
the docs for some get_..._property() commands incorrectly describe
the behavior for inherited properties. When a property is not set, even
in a parent scope, the returned result from the get_..._property()
command is the same whether the property is inherited or not.
The docs incorrectly stated that an empty string would be returned
for inherited properties in such cases.
Property-related commands used a mix of <VAR>, <var>, or
<variable> to specify the variable to store the result in. The <VAR>
form is particularly confusing, since being uppercase it looks more
like a keyword. Use <variable> consistently across all the commands
so that the behavior is clear.
The cmake.vim file is generated by scanning for keyword-like
strings in the docs. Update the corresponding wrong entry
there too directly for now, which will fix the wrong entry until
the next full regeneration of the file.
Fixes: #25503
e831eef933 Help: Note case where IMPORTED_IMPLIB isn't needed for (xc)frameworks
01735badee Help: XCFrameworks and stubs are supported on all Apple, not just macOS
6ac50df591 Help: Add missing versionadded directives for IMPORTED_IMPLIB
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9058
e831eef933 Help: Note case where IMPORTED_IMPLIB isn't needed for (xc)frameworks
01735badee Help: XCFrameworks and stubs are supported on all Apple, not just macOS
6ac50df591 Help: Add missing versionadded directives for IMPORTED_IMPLIB
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9058
This allows individual signatures to be cross-referenced from elsewhere.
It also associates with each signature its main documentation via
indentation.
This allows individual signatures to be cross-referenced from elsewhere.
It also associates with each signature its main documentation via
indentation.
This signature was added by commit 4391913133 (Add INTERFACE libraries
to generated buildsystem if they have SOURCES, 2020-07-20,
v3.19.0-rc1~346^2~1) with incorrect documentation.
Previously the documented signature as:
add_library(<name> INTERFACE [<source>...] [EXCLUDE_FROM_ALL])
which is incorrect. CMake would recognize `EXCLUDE_FROM_ALL` as a source
file and report an error that it doesn't exists.
The correct signature is:
add_library(<name> INTERFACE [EXCLUDE_FROM_ALL] [<source>...])
which places `EXCLUDE_FROM_ALL` in the same position used by the
documentation of other signatures.
Fixes: #25463
bb7a0497ef cmTransformDepfile: warn when a depfile is not written to
c22c473bde Tests/Ninja*/CustomCommandDepfile: check that deps are in the database
b0177003e1 cmGlobalNinjaGenerator: tell `ninja` to actually read the depfile
45eff9145e cmAddCustomCommandCommand: use `cmStrCat`
c6445c615b Tests/RunCMake/Ninja: fix subdir prefix check
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8911
But only do so if the depfile is not specified as an output of the
command. Otherwise the command will out-of-date itself as `ninja`
deletes depfiles that it incorporates into the database and a missing
output will cause the command to run again.
8f9f371668 try_compile: Add support for using ALIAS targets
9f8aa94192 Add missing `OUTPUT` in ExportImport test
Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !8877
In commit 8d7e80cf3d (find_* commands: add control over Windows registry
views, 2022-04-16, v3.24.0-rc1~201^2) this indentation was used for the
other find commands but was left out for `find_package`.
This requires knowing when a generated header is public, which we can
model using file sets. Add policy CMP0154 to treat generated sources
as private by default in targets with file sets. Generated public
headers can be specified in public file sets.
Fixes: #24959
Issue: #15555
Since commit ffc06c1239 (Teach find_(library|file|path) to get prefixes
from PATH, 2015-02-18, v3.3.0-rc1~430^2) we search in `<prefix>/include`
and `<prefix>/lib` directories for prefixes with `bin` directories in
the `PATH` environment variable. The motivation was to search the
installation prefixes of MSYS and MinGW development environments
automatically.
This behavior can search undesired prefixes that happen to be in the
`PATH` for unrelated reasons. It was reverted for non-Windows hosts
within a year by commit b30b32a493 (Drop find_(library|file|path)
prefixes from PATH on non-Windows, 2016-05-09, v3.6.0-rc1~82^2) but was
kept on Windows hosts to support its motivating use case. However,
similar problems have since been observed on Windows. For example,
commit 955d6245c1 (MSVC: Revert "Teach find_library to consider the
'libfoo.a' naming convention", 2022-11-28, v3.25.1~6^2) was primarily
due to undesired discovery of libraries in `PATH`-derived prefixes.
Since commit 5e5132e1b1 (MinGW: Search for packages in standard MSYSTEM
environment prefixes, 2023-09-11) we search MSYS and MinGW environments'
prefixes explicitly, so `PATH`-derived prefixes are no longer needed for
the original motivating use case.
Fixes: #24216
Document the deprecation warnings added by commit 5845c218d7 (Deprecate
compatibility with CMake versions older than 2.8.12, 2020-06-12,
v3.19.0-rc1~629^2) and commit 3a4791548d (Deprecate compatibility with
CMake versions older than 3.5, 2023-02-09, v3.27.0-rc1~508^2).
Fixes: #25196
be53c75852 cmExperimental: recycle the C++ modules API UUID
deb1c3cbd5 cmCoreTryCompile: forward module-related binutils variables
b768d293c5 cmCoreTryCompile: use the source type context for source files
93993c7ad4 cmArgumentParser: support storing a context value with parsing
c9ca5f6326 cmCoreTryCompile: parse `SOURCES_TYPE` argument
07551f35de cmCoreTryCompile: use `target_sources` for `try_compile` targets
aad9033b56 cmExperimental: support forwarding associated variables to `try_compile`
f6cf433256 cmExperimental: only forward C++ module support to non-ABI checks
...
Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !8639
Revise the signature and description to explicitly distinguish the
initial group of artifact options from later groups that apply to
a specific kind.
Issue: #25144Fixes: #16362
After switching to the signature directive we no longer need
per-signature sections. Group all the signatures in one section. Add a
table of contents since it is no longer redundant with the synopsis.
Revert commit f09fda97d8 (Help: improve install() documentation of
argument ordering, 2018-01-08, v3.11.0-rc1~126^2). Although the
example it added is correct, its explanation is misleading.
Revert it to make room for an alternative.
Issue: #25144
Issue: #16362
2b99e64413 set_test_properties: link to the test properties in the documentation
b11e8afbfa ctest: export test labels to junit xml
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8635
Previously REAL_PATH would collapse paths before resolving any symlinks
so if `..` crossed a symlink the output from `REAL_PATH` would be wrong.
It looked like REAL_PATH did this by mistake since it was a side-effect
of ensuring we had an absolute path before resolving symlinks.
Suggest the `CMAKE_MAP_IMPORTED_CONFIG_<CONFIG>` variable for mapping
configurations of dependent projects to configurations exported by these
commands.
Issue: #25096
e588d29eaf Help: add_custom_command(TARGET) does not support USES_TERMINAL
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: William Jones <william.luke.jones@gmail.com>
Merge-request: !8602
e588d29eaf Help: add_custom_command(TARGET) does not support USES_TERMINAL
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: William Jones <william.luke.jones@gmail.com>
Merge-request: !8602
In commit b787be2714 (Help: Update supported languages in project and
enable_language, 2023-01-20, v3.26.0-rc1~53^2) the relevant paragraph
was accidentally moved to the `enable_language` command documentation.
Fixes: #25016