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.
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
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
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.
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
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>
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>
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.
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
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
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
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
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
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
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
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
- 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
The following variables now support the LINKER: prefix:
* CMAKE_SHARED_LIBRARY_CREATE_<LANG>_FLAGS
* CMAKE_SHARED_MODULE_CREATE_<LANG>_FLAGS
* CMAKE_<LANG>_LINK_FLAGS
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
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.