Commit Graph

1057 Commits

Author SHA1 Message Date
Eduard Voronkin
e42881422f FASTBuild: optimize try_compile builds
The generator does a lot of tricks in order to make the "rebuild-bff"
target up-to-date immediately after the generation. We can skip all of
those during "TryCompile" runs, which should reduce configure time.
2025-10-22 17:32:48 -07:00
Brad King
6fdb345f03 Merge topic 'sort-xcode-folders'
4ca5e5480a Xcode: Order targets alphabetically

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11289
2025-10-08 09:32:56 -04:00
Peter Steneteg
4ca5e5480a Xcode: Order targets alphabetically
Fixes: #21659
2025-10-07 11:07:11 -04:00
Craig Scott
f38f325e08 fileAPI: Add direct dependencies to target codemodel files
This adds the following new arrays, which together capture all direct
dependencies and interface dependencies of a target:

- linkLibraries
- interfaceLinkLibraries
- compileDependencies
- interfaceCompileDependencies
- objectDependencies
- orderDependencies

Fixes: #21995, #25213
2025-10-07 10:44:28 -04:00
Brad King
bef873755b Merge topic 'define-windll'
83bbde5449 MSVC: Define _WINDLL consistently for shared libraries
206fcbb392 Tests/RunCMake/FileAPI: Fix whitespace in codemodel-v2 expectation data

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !11194
2025-10-01 09:18:05 -04:00
AJIOB
83bbde5449 MSVC: Define _WINDLL consistently for shared libraries
Visual Studio defines this automatically for `.dll` targets.
For consistency, define it when compiling for the MSVC ABI
with other generators.  Add policy CMP0203 for compatibility.

Fixes: #27253
2025-09-29 18:26:44 -04:00
Darryl Pogue
e97fdf7d9a Xcode: Support new Icon Composer .icon resources
These are a new type of resource folder (treated as a file) similar to
xcassets, supported in Xcode 26 to provide application icons.
2025-09-28 01:45:56 -07:00
Ben Boeckel
bbdc2fd908 cmSourceFile: internally track CMake-managed source files
These source file types don't necessarily show up in the CMake code, but
are side effects of other behaviors in CMake. Support tracking them
specially so that heuristics are not required to figure out if a given
`cmSourceFile` is one of them.
2025-09-08 11:59:57 -04:00
Daniel Pfeifer
ee1c32b6d7 source: Pass cmBuildOptions by value 2025-07-30 11:55:34 -04:00
Stepanov Igor
0b7d8e4ad6 xcode: Restore ctest --build-and-test without --build-project
Previously, it used to be possible to execute ctest --build-and-test
without specifying --build-project. When used with the Xcode generator,
this would work as long as there was only one .xcodeproj file in the
directory, where xcodebuild would then default to using that project.
The recent changes to support .xcworkspace files broke that logic, placing
a malformed pair of options "-project .xcodeproj" on the command line
instead of omitting the "-project" option altogether.

Fixes: #27090
2025-07-26 19:43:28 +10:00
Stepanov Igor
26869fb4ba cmake --build: Fix building multiple targets in Xcode workspace
Extend commit 844d79916a (cmake --build: Add support for driving Xcode
workspaces, 2025-06-02) to support multiple `--target` arguments.
`xcodebuild -scheme` cannot be repeated in a single call, so call it
multiple times instead.

Issue: #26958

Co-Authored-By: Craig Scott <craig.scott@crascit.com>
2025-06-14 16:53:25 +10:00
Brad King
b59925a842 Merge topic 'xcode-build-workspace'
844d79916a cmake --build: Add support for driving Xcode workspaces

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10855
2025-06-11 10:26:54 -04:00
Stepanov Igor
844d79916a cmake --build: Add support for driving Xcode workspaces
External tools may create a `.xcworkspace` directory next to the
`.xcodeproj` directory that CMake generates.  If a workspace exists,
drive the build through it instead.

Closes: #26958
Co-authored-by: Brad King <brad.king@kitware.com>
2025-06-10 11:08:04 -04:00
Brad King
a2414480e8 cmGlobalXCodeGenerator: Remove unused argument from LookupFlags helper 2025-06-07 06:43:08 -04:00
Brad King
35317a7ae2 Xcode: De-duplicate -dynamiclib/-bundle flags for SHARED/MODULE libraries
Xcode automatically adds a flag matching the generated `LIBRARY_STYLE`:

* For SHARED libraries we've been duplicating `-dynamiclib` with a copy
  in `CMAKE_SHARED_LIBRARY_CREATE_<LANG>_FLAGS`.  Remove it for Xcode.

* For MODULE libraries we've been not duplicating `-bundle` only by accident.
  Since commit 586a9427d3 (ENH: Created target property INSTALL_NAME_DIR...,
  2006-02-24, v2.4.0~418) we've looked up `CMAKE_<LANG>_LINK_FLAGS`, meant
  for EXECUTABLEs, instead of `CMAKE_SHARED_MODULE_CREATE_<LANG>_FLAGS`.
  Switch to the latter, but remove `-bundle` for Xcode.
2025-06-07 06:43:08 -04:00
Brad King
5fdd4a5859 cmGlobalXCodeGenerator: Convert GetTargetProductType signature to string_view 2025-06-07 06:42:56 -04:00
Brad King
ced6b31c48 cmGlobalXCodeGenerator: Convert CreateString signature to string_view 2025-06-07 06:36:49 -04:00
Ben Boeckel
b82a74d918 generators: use GetSupportDirectory() in more places 2025-05-23 11:39:53 +02:00
Ben Boeckel
557c44b93e cmStrCat: use character literals where possible
Found and replaced using the `cmstrcat-to-char-literal` rule for
`ast-grep`.
2025-05-15 19:12:04 +02:00
Ben Boeckel
23779057fd cmStrCat: combine neighboring arguments where possible
Found using the `cmstrcat-adjacent-literals` rule for `ast-grep`.
2025-05-15 19:11:41 +02:00
Brad King
93cbcd7596 Merge topic 'xcode-debugger-workdir'
149ee3b4bc Xcode: Use DEBUGGER_WORKING_DIRECTORY as a fallback for scheme work dir
0f1b9ef32a Help: VS_DEBUGGER_WORKING_DIRECTORY precedence

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10736
2025-05-05 08:52:54 -04:00
Craig Scott
149ee3b4bc Xcode: Use DEBUGGER_WORKING_DIRECTORY as a fallback for scheme work dir
This also means when XCODE_SCHEME_WORKING_DIRECTORY is
set and a Xcode generator is used, that property will be used when
writing the debugger field in the file API replies.

Fixes: #26909
2025-05-03 10:16:15 -04:00
Brad King
cacd17230f Merge topic 'apple-CoreFoundation-headers'
d736dafa22 Merge branch 'backport-3.31-apple-CoreFoundation-headers'
42390e7aa2 Source: Include specific CoreFoundation headers instead of umbrella header
14ffd1cc4e cmXCodeObject: Drop unused CoreFoundation header

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10616
2025-04-09 09:08:38 -04:00
Brad King
d736dafa22 Merge branch 'backport-3.31-apple-CoreFoundation-headers' 2025-04-08 11:39:10 -04:00
Sergey Fedorov
42390e7aa2 Source: Include specific CoreFoundation headers instead of umbrella header
Some CoreFoundation headers included by the umbrella header, which we do
not need, use syntax that GCC does not support.  Avoid including them.

GCC-Issue: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115880
2025-04-08 11:38:24 -04:00
Kitware Robot
1772622772 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 10:43:35 -05: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
Alexandra Cherdantseva
2dc8c1d45f Xcode: Fix POST_BUILD order in bundle targets on Xcode 16+
XCode 16+ no longer delays our POST_BUILD phase until after bundle files
like `Info.plist` are generated.  Teach the Xcode generator to add
explicit dependencies to the POST_BUILD phase in bundle targets to
ensure the files are created before it runs.

Fixes: #26656
2025-02-25 08:15:12 -05: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
381c446ff7 VS: Remove support for appending a platform to the generator name
Compatibility with CMake versions prior to 3.1 is no longer supported.

Fixes: #26481
2025-01-21 08:08:22 -05:00
Brad King
f8bc8780c1 CMP0026: Remove support for OLD behavior 2025-01-19 09:40:59 -05:00
Brad King
41a7a0119f CMP0018: Remove support for OLD behavior 2025-01-18 09:51:44 -05:00
Alex Turbov
bc8621d999 Fix: A lot of typos in code found by typos
Yet another great code spellchecker: https://github.com/crate-ci/typos/

(Will be added later as a `pre-commit` hook)
2025-01-12 18:49:34 +04:00
Brad King
5c7bb0bfd9 Merge topic 'rename-cmakelists'
fcbc883fa3 cmake: Allow configuration of default script names

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Acked-by: scivision <michael@scivision.dev>
Merge-request: !10059
2024-12-18 08:49:58 -05:00
Martin Duffy
fcbc883fa3 cmake: Allow configuration of default script names
Adds the ``--project-file`` command-line option to modify the default script
name loaded by CMake and ``add_subdirectory`` to values other than
``CMakeLists.txt``.

Fixes: #21570
2024-12-17 12:47:02 -05:00
Aleksei Sapitskii
0282429c5a Xcode: Fix XCODE_EMBED_FRAMEWORKS when settings differ across targets
In commit 5651901c54 (Xcode: add support for embedding frameworks,
2020-10-24, v3.20.0-rc1~402^2) we incorrectly reused `PBXBuildFile`
instances when the same framework is embedded in multiple targets,
causing target-specific settings to conflict.

Fixes: #26438
2024-12-06 09:22: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
Alex Turbov
f3f70c2f90 StringAlgorithms: Refactor cmTokenize() function
- Refactor and optimize the loop to make it shorter and faster
- Make it push elements into an arbitrary (templated) output iterator
- Make it a template on a separator type with the most used defaults
- Add a backward compatible signature to return `std::vector<std::string>`
- Add an alternative function `cmTokenizedView()` to return a vector of string views
2024-11-06 18:42:17 +04: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
Gusts Kaksis
e3be24da68 Xcode: case-insensitive target ordering 2024-10-11 16:28:52 +03:00
Gusts Kaksis
80d0770250 Xcode: Fix target ordering operator to meet std::sort requirements
`std::sort` requires strict-weak ordering where `a == b` is false.
2024-10-10 15:57:02 -04:00
Vito Gamberini
20e9b59d5e Linking: Add CMAKE_LANG_STANDARD_LINK_DIRECTORIES
Closes: #18222
2024-08-28 15:54:43 -04:00
Brad King
b38000d774 cmGlobalXCodeGenerator: Re-implement legacy makefile path escaping
Apply commit d74e651b78 (Makefiles: Re-implement makefile target path
escaping and quoting, 2020-04-10, v3.18.0-rc1~334^2~1) to the Xcode
generator's legacy Makefile generation.  This adds support for '#'.
However, since we use '$(VAR)' placeholders, do not escape '$'.

Issue: #25604
2024-05-15 13:27:38 -04:00
Brad King
d929089687 cmGlobalXCodeGenerator: Do not use legacy makefile escaping in shell commands
The `ConvertToMakefilePath` helper is meant only for paths in `.make`
files we generate for custom commands in the legacy build system.
2024-05-15 11:41:01 -04:00
Brad King
d61fc2c52e cmGlobalXCodeGenerator: Migrate legacy makefile path escaping to local helper
Also clarify the name.  It does not do any relative path conversion.
2024-05-15 11:40:31 -04:00
Brad King
ff1693cb3c cmGeneratorTarget: Clarify enum for specifying purpose of usage requirements
Since commit 1e49880472 (cmGeneratorTarget: Avoid boolean trap in usage
requirement lookup, 2021-12-08, v3.23.0-rc1~245^2) we have clarified
the distinction between compile-only and link-only usage requirements.
Rename the `LinkInterfaceFor` enum to `UseTo` to clarify that its role
is to specify the purpose of usage requirements.
2024-05-03 13:04:10 -04:00
Ilya Kulakov
3071660247 Xcode: Use builtin "default" file type
"sourcecode" is not appropriate for binary files, such as video, and
hinders Xcode performance.
2024-04-22 20:53:07 -04:00