Commit Graph

1348 Commits

Author SHA1 Message Date
Marc Chevrier
2e9648e0de Ninja generator: restore correct encoding for policy CMP0181=OLD
Fixes: #26857
2025-04-12 16:37:57 +02:00
Kitware Robot
de273b2e11 LICENSE: Replace references to Copyright.txt with LICENSE.rst
```
git grep -lz 'Copyright.txt or https://cmake.org/licensing ' |
  while IFS= read -r -d $'\0' f ; do
    sed -i '/Copyright.txt or https:\/\/cmake.org\/licensing / {
              s/Copyright.txt/LICENSE.rst/
            }' "$f" ; done
```
2025-03-03 09:56:07 -05:00
Alex Overchenko
a25a4abc01 llvm-rc: Fix regression on .rc sources with LLVM/Clang tooling
Refactoring in commit 2b2344b412 (MSVC: Add abstraction for runtime
checks, 2025-01-22) switched to using local compiler id variables to
recognize compilers that target the MSVC ABI.  However, those variables
may be modified modified in a special case for `lang == "RC"` that does
not apply to the ABI check.  Check the target ABI before applying the
special case.

Fixes: #26663
2025-02-04 09:16:02 -05:00
Brad King
3e64c6a56e Merge topic 'msvc-runtime-checks'
2b2344b412 MSVC: Add abstraction for runtime checks
49dcd1ce5d Help: Fix MSVC_DEBUG_INFORMATION_FORMAT description of example
2f8e643d9d CMP0141: Fix documentation copied from CMP0091

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Alex <leha-bot@yandex.ru>
Merge-request: !10214
2025-01-30 08:48:01 -05:00
AJIOB
2b2344b412 MSVC: Add abstraction for runtime checks
Replace our hard-coded default for `/RTC1` with a first-class
abstraction to select runtime checks from an enumeration of logical
names.  Add a `MSVC_RUNTIME_CHECKS` target property and corresponding
`CMAKE_MSVC_RUNTIME_CHECKS` variable.

Removing the old default flag requires a policy because existing
projects may rely on string processing to edit them and choose
runtime checks under the old behavior.  Add policy CMP0184 to
provide compatibility.

Fixes: #26614
2025-01-29 13:07:41 -05:00
Marc Chevrier
3d2709c1ae Linker configuration: rely now on CMAKE_<LANG>_LINK_MODE variable.
CMake now provides the CMAKE_<LANG>_LINK_MODE variable which specify how
the link step is done. So, the CMAKE_<LANG>_USING_LINKER_MODE variable
is no longer needed.
2025-01-26 14:45:21 +01:00
Kitware Robot
0b96ae1f6a Revise C++ coding style using clang-format with "east const"
Run the `clang-format.bash` script to update all our C and C++ code to a
new style defined by `.clang-format`, now with "east const" enforcement.
Use `clang-format` version 18.

* 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.

Issue: #26123
2025-01-23 13:09:50 -05:00
Brad King
fb1bd1d330 CMP0065: Remove support for OLD behavior 2025-01-22 10:40:55 -05:00
Brad King
ac1a9cb160 CMP0063: Remove support for OLD behavior 2025-01-22 10:40:54 -05:00
Brad King
41a7a0119f CMP0018: Remove support for OLD behavior 2025-01-18 09:51:44 -05:00
Brad King
03a215643d CMP0001: Remove support for OLD behavior 2025-01-17 09:28:35 -05:00
Marc Chevrier
b350f95ecf LINK_WARNING_AS_ERROR property: extend capabilities
Fixes: #26536
2025-01-16 22:35:00 +01:00
Brad King
129c87fb09 Merge topic 'fileapi-no-link-dependency-file'
1a04515a47 fileapi: Do not expose flags for linker-generated dependencies

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !10061
2024-12-04 08:53:54 -05:00
Brad King
1a04515a47 fileapi: Do not expose flags for linker-generated dependencies
In commit 375e6fdbbe (Link step: use linker dependency linker file,
2023-04-19, v3.27.0-rc1~126^2) we added the `-Wl,--dependency-file,...`
flag for the Ninja generator in a code path shared with the file-api.
This flag is a build system implementation detail and should not be
exposed to file-api clients.  Move it to a Ninja-specific code path.

Fixes: #26498
2024-12-03 13:48:57 -05:00
Alex Turbov
6751b3d9b4 cmLocalGenerator.cxx: Optimize std::ostream::operator<<() calls 2024-11-19 17:57:33 +04:00
Brad King
659d8bd430 cmPolicies: Remove now-unused REQUIRED_IF_USED and REQUIRED_ALWAYS states 2024-11-13 11:43:07 -05:00
Marc Chevrier
7907c83175 Link step: Add LINK_WARNING_AS_ERROR target property
Add a way to specify, in a portable way, to raise an error for any
warning during the link step. For that purpose, define:
* CMAKE_LINK_WARNING_AS_ERROR variable
* LINK_WARNING_AS_ERROR target property

Fixes: #25343
2024-11-12 15:11:53 +01:00
Marc Chevrier
656267c871 COMPILE_WARNING_AS_ERROR: rename methods to prepare link similar functionality
Methods renamed:
* SetIgnoreWasinigAsError => SetIgnoreCompileWasningAsError
* GetIgnoreWasinigAsError => GetIgnoreCompileWasningAsError
2024-11-12 14:52:28 +01:00
Martin Duffy
f50fb77a4f Ninja: Regenerate when test or install scripts are missing
Rerun CMake when `cmake_install.cmake` or `CTestTestfile.cmake` are out
of date.  This enables regeneration if a subdirectory is removed before
invoking `ninja`.

Fixes: #26396
2024-11-06 08:35:57 -05:00
Martin Duffy
79349dee01 cmake: Always update timestamps on test and install scripts
Since commit d46d8df0ed (ENH: Re-implemented cmGeneratedFileStream to
... replace the destination file atomically, 2004-11-03, v2.4.0~2578) we
have generated `cmake_install.cmake` scripts with "copy-if-different"
semantics such that their timestamp is only updated when their contents
change.  In commit d395b563ed (ENH: ... test files are written by local
generator, 2005-04-24, v2.4.0~1842) we copied the approach for
generating `CTestTestfile.cmake` scripts.

In both cases, preserving timestamps is not needed and was only a side
effect of using `cmGeneratedFileStream` to replace the generated files
atomically.  Drop the "copy-if-different" semantics and always update
their timestamps so it is possible to know when they have been
regenerated.
2024-11-06 08:35:57 -05:00
Marc Chevrier
61aee8c7bd Add support of "LINKER:" prefix for Windows executable creation
The following variables now support the LINKER: prefix:
* CMAKE_<LANG>_CREATE_WIN32_EXE
* CMAKE_<LANG>_CREATE_CONSOLE_EXE
2024-11-04 17:08:03 +01:00
Marc Chevrier
8bcf9c7a3e Add support of "LINKER:" prefix for artifact creation flags
The following variables now support the LINKER: prefix:
    * CMAKE_SHARED_LIBRARY_CREATE_<LANG>_FLAGS
    * CMAKE_SHARED_MODULE_CREATE_<LANG>_FLAGS
    * CMAKE_<LANG>_LINK_FLAGS
2024-11-04 17:08:03 +01:00
Marc Chevrier
2bd4c06c26 Refactoring cmRulePlaceHolderExpander: propagate cmBuildStep information 2024-11-04 17:08:02 +01:00
Marc Chevrier
35350c419d Add support of "LINKER:" prefix for CMAKE_<TYPE>_LINKER_FLAGS variable
The following variables now support the LINKER: prefix:
* CMAKE_<TYPE>_LINKER_FLAGS
* CMAKE_<TYPE>_LINKER_FLAGS_<CONFIG>

Fixes: #26171
2024-11-04 17:07:58 +01:00
Brad King
ee83165923 cmake: Explicitly normalize input paths as they exist on disk
`CollapseFullPath` has two use cases:

1.  Normalize input paths from command-line arguments and environment
    variables.  On Windows, load their on-disk capitalization.

2.  Simplify paths constructed internally.  These should already have
    the correct capitalization.

Audit all `CollapseFullPath` call sites and code paths leading to them.
Replace those calls that normalize input paths with calls to
`ToNormalizedPathOnDisk` to express that they need the on-disk case.

By making this distinction we will later be able to remove the on-disk
capitalization lookup `CollapseFullPath`, thus eliminating disk accesses
from internal path processing.

Issue: #20214
2024-10-22 13:26:19 -04:00
James Moore
84996a65aa Unity: Add option to use relative paths for unity files
Add a target property that will be read on unity file generation to
attempt to use a relative path to the source file from the CMake Source
Directory or the generated unity file. Additionally add the CMake
Source Directory and the CMake Binary directory to the include path of
the generated unity files.

Closes: #26352
2024-10-15 09:44:18 -07:00
Brad King
e25f95c4cc Merge topic 'standard-link-directories'
20e9b59d5e Linking: Add CMAKE_LANG_STANDARD_LINK_DIRECTORIES

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9707
2024-08-29 08:31:17 -04:00
Vito Gamberini
20e9b59d5e Linking: Add CMAKE_LANG_STANDARD_LINK_DIRECTORIES
Closes: #18222
2024-08-28 15:54:43 -04:00
Vitaly Stakhovsky
58da4aa47d Source: Avoid comparing pointers to nullptr 2024-08-27 10:56:38 -04:00
Brad King
88e90fcd20 Merge topic 'cuda_unity'
b90ae10dda Add support for unity builds with CUDA sources
c99ff40b21 Unity: refactor unity extension logic to single function

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !9655
2024-08-13 11:01:13 -04:00
Robert Maynard
b90ae10dda Add support for unity builds with CUDA sources
Fixes #22750
2024-08-02 13:35:53 -04:00
Brad King
ce07554967 Merge topic 'enable_warnings'
373b29bd3f Rename {_ => }CMAKE_INCLUDE_SYSTEM_FLAG_${lang}_WARNING

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Reviewed-by: Ben Boeckel <ben.boeckel@kitware.com>
Acked-by: Marcel Raad <marcel.raad@teamviewer.com>
Merge-request: !9688
2024-07-30 10:13:05 -04:00
Patrick H
373b29bd3f Rename {_ => }CMAKE_INCLUDE_SYSTEM_FLAG_${lang}_WARNING
Although not documented publicly, projects may need to override
this variable.  Remove the private `_` prefix from its name.

Issue: #25103
2024-07-29 11:50:02 -04:00
Martin Duffy
9799491c7e install: Write manifest file in parallel install
Updates the parallel install to generate the install_manifest.txt file.
2024-07-25 12:36:32 -04:00
Robert Maynard
c99ff40b21 Unity: refactor unity extension logic to single function 2024-07-16 09:39:19 -04:00
Martin Duffy
159ba027b9 Install: Add parallel installation option
Fixes: #26000
2024-07-15 11:49:29 -04:00
Juan Ramos
197cb419d1 add_custom_command: Add CODEGEN support
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.
2024-07-01 12:02:49 -04:00
Brad King
8a06f173d9 Apple: Add CFBundleName to framework Info.plist files
Fixes: #26046
2024-06-20 10:33:07 -04:00
Brad King
1d519cf796 Merge topic 'ninja-parallel'
0e5250e63c Ninja: Add option for parallel install
daeb8fffa2 Help: Add Builtin Targets section to Ninja help

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9505
2024-05-24 10:29:57 -04:00
Martin Duffy
0e5250e63c Ninja: Add option for parallel install
Adds the global property ``INSTALL_PARALLEL`` to enable a parallel install
target for Ninja.

Fixes: #25459
2024-05-23 09:54:19 -04:00
Glenn Coombs
8d2a503c1e add_custom_command: Allow OUTPUT filenames containing a hash '#' character
Most generators now support this character after escaping and quoting
cleanups over time.  Disallow it only on generators that do support it.

Fixes: #25604
2024-05-15 13:27:46 -04:00
Deniz Bahadir
9e67ad47a9 cmLocalGenerator: Support arbitrary component name when installing
The generated `cmake_install.cmake` script no longer blindly tries to
create files `install_manifest_<component-name>.txt` that partly
consists of the verbatim name of a component, which might contain
characters that are not supported on the platform / filesystem.
Instead, if the component's name contains a (possibly) problematic
character its MD5 hash will be used:
`install_manifest_<component-hash>.txt`
2024-05-01 19:20:32 +02:00
Brad King
ef006ebd9b PCH: Use per-arch .pch files only when building multiple Apple architectures
Since commit f593b354da (PCH: Add support for multi architecture iOS
projects, 2020-04-02, v3.18.0-rc1~414^2) we use per-arch .pch files
even when compiling for just the host architecture on macOS arm64.
This breaks with compilers that do not support `-Xarch_` flags, such
as GCC.  Avoid using per-arch .pch files in single-architecture builds.

Fixes: #25514
Issue: #20497
2024-05-01 12:43:39 -04:00
Deniz Bahadir
48fc711064 cmLocalGenerator: Fix comments in generated cmake_install.cmake file 2024-04-30 18:36:25 +02:00
Brad King
1c9e514d28 Merge topic 'swift-module-libraries'
56e5cea600 Swift: Support module libraries with command-line build systems

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9379
2024-04-16 08:47:11 -04:00
Evan Wilde
56e5cea600 Swift: Support module libraries with command-line build systems
Wire up the flags needed to support module libraries built and used with
Swift. We need to pass `-bundle` to the linker when linking module
libraries on Darwin, and we need to pass `-export-dynamic` to the linker
when emitting an executable that exports symbols on Linux. This patch
wires up `CMAKE_SHARED_MODULE_CREATE_Swift_FLAGS` and
`CMAKE_SHARED_MODULE_LOADER_Swift_FLAG` on Darwin, and hooks up
`CMAKE_EXE_EXPORTS_Swift_FLAG` on Linux in order to support passing
things correctly.

We can't expose `CMAKE_EXE_LINKER_FLAGS` to Swift, as it contains flags
that the Swift compiler doesn't recognize, but the other
language-specific variables are safe to expose.
2024-04-15 08:23:39 -07:00
ClausKlein
773dc0a297 Unity: Suppress clang-tidy include checks
`clang-tidy-17` adds include checks similar to IWYU.  Suppress them in
generated code.
2024-04-08 19:16:14 -04:00
Vitaly Stakhovsky
1a49b439a5 Source: Use cmValue::IsOn and IsOff
Speed up a bit by calling members directly.
2024-03-17 19:05:37 -04:00
Brad King
8526943b8c Merge topic 'LINKER_TYPE-mold-support'
801ae06952 LINKER_TYPE: Support MOLD only on GCC versions that support it
939ac5287e LINKER_TYPE: fix spelling error in message
922883782b LINKER_TYPE: Document that linker tool should be in the PATH

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9334
2024-03-14 11:45:14 -04:00
Marc Chevrier
801ae06952 LINKER_TYPE: Support MOLD only on GCC versions that support it
Fixes: #25748
2024-03-13 11:13:21 -04:00