912 Commits

Author SHA1 Message Date
Brad King
d6a88d2158 cmTarget: Replace "perConfig" constructor boolean with enum 2020-05-18 12:56:55 -04:00
Brad King
25995b2b30 cmGlobalGenerator: Fix CheckTargetsForMissingSources after refactoring
Refactoring in commit 01b2d6ab74 (Modernize: Use ranged for-loops when
possible, 2019-02-07, v3.15.0-rc1~575^2) accidentally changed a loop
condition in this method from "keep iterating if srcs.empty()" to
"stop iterating if srcs.empty()".  Switch it back.

The bug could only manifest in very subtle conditions in a multi-config
generator.  Add one such case to the test suite.

Fixes: #20706
2020-05-15 05:39:25 -04:00
Marc Chevrier
2faa3f6c55 Refactoring: Third-parties public headers are under cm3p prefix
Fixes: #20666
2020-05-07 12:06:08 +02:00
Brad King
0b08c1279c Merge topic 'cmprop-state'
e267c3fddf cmState::GetInitializedCacheValue: return cmProp

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4696
2020-05-01 08:31:32 -04:00
Vitaly Stakhovsky
e267c3fddf cmState::GetInitializedCacheValue: return cmProp
cmProp alias is used; no actual change in type
2020-04-30 10:45:45 -04:00
Vitaly Stakhovsky
53675adbcf GetSafeProperty: return std::string const& 2020-04-30 10:27:16 -04:00
Vitaly Stakhovsky
36aba01223 cmGeneratorTarget::GetProperty: return cmProp 2020-04-29 10:59:39 -04:00
Marc Chevrier
aacd4e4a90 Refactoring: add cm::contains to <cmext/algorithm> 2020-04-17 10:00:03 +02:00
Brad King
156196938c Merge topic 'cmprop-source'
e64fa5f1b6 cmSourceFile::GetProperty: return cmProp
fc223f9860 cmGlobalXCodeGenerator: Fix genex interpreter overloads

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4603
2020-04-15 09:49:46 -04:00
Brad King
a67565751f Merge topic 'msbuildUtf8Support'
bc877a7e94 Add support to indicate UTF-8 custom command pipe output encoding

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4587
2020-04-15 09:44:48 -04:00
Vitaly Stakhovsky
e64fa5f1b6 cmSourceFile::GetProperty: return cmProp 2020-04-14 10:57:17 -04:00
Justin Goshi
bc877a7e94 Add support to indicate UTF-8 custom command pipe output encoding
Adds a flag to indicate that pipe output from a custom command should be
interpreted as UTF-8 encoded. This change does not introduce a public
way to set the flag, but generators that create internally-generated
commands know if they are calling cmake, which uses UTF-8 pipes.

MSBuild added support for interpreting output of PreBuildEvent,
PreLinkEvent, PostBuildEvent, and CustomBuildStep as UTF-8. This change
will appear in Visual Studio 16.6 Preview 3. It is opt-in, and you need
to add the StdOutEncoding tag. MSBuild treats these as property bags so
if we emit the tag for earlier versions of Visual Studio it would be
safely ignored. This change emits the StdOutEncoding tag and sets it to
UTF-8 whenever the custom command UTF-8 pipe flag is set. This fixes
globalization issues when the output from cmake contained characters
that required MSBuild to interpret as UTF-8 before displaying them.
2020-04-13 12:54:47 -07:00
Ben Boeckel
f413727d27 clang-tidy: address bugprone-sizeof-expression lint 2020-04-13 11:26:03 -04:00
Vitaly Stakhovsky
aba23c747b cmMakefile::GetProperty: return cmProp 2020-04-01 10:56:34 -04:00
Vitaly Stakhovsky
3eec21a01c cmTarget::GetProperty: return cmProp 2020-03-30 15:00:14 -04:00
Vitaly Stakhovsky
c84cf42897 cmState::GetGlobalProperty: return cmProp 2020-03-25 09:10:46 -04:00
Brad King
94139ac58e Merge topic 'export-repeat'
8affe9aa33 export: Fix use-after-free on multiple calls overwriting same FILE

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4494
2020-03-20 06:17:00 -04:00
Brad King
8affe9aa33 export: Fix use-after-free on multiple calls overwriting same FILE
CMake 3.16 and below allow multiple `export()` calls with the same output
file even without using `APPEND`.  The implementation worked by accident
by leaking memory.  Refactoring in commit 5444a8095d (cmGlobalGenerator:
modernize memrory managemenbt, 2019-12-29, v3.17.0-rc1~239^2) cleaned up
that memory leak and converted it to a use-after-free instead.

The problem is caused by using the `cmGlobalGenerator::BuildExportSets`
map to own `cmExportBuildFileGenerator` instances.  It can own only
one instance per output FILE name at a time, so repeating use of the
same file now frees the old `cmExportBuildFileGenerator` instance
and leaves the pointer in the `cmMakefile::ExportBuildFileGenerators`
vector dangling.  Move ownership of the instances into `cmMakefile`'s
vector since its entries are not replaced on a repeat output FILE.

In future work we should introduce a policy to error out on this case.
For now simply fix the use-after-free to restore CMake <= 3.16 behavior.

Fixes: #20469
2020-03-19 06:41:39 -04:00
Vitaly Stakhovsky
36a5b3d1d1 cmMakefile::AddCacheDefinition: Add overload that accepts std::string value 2020-03-11 09:40:43 -04:00
Kyle Edwards
9590c3a400 Generator: Don't allow Ninja Multi-Config variables on other generators
We may want to enable these variables later on with specific
semantics. To avoid breaking backwards compatibility, make it an
error to use them for now.
2020-02-27 09:23:08 -05:00
Kyle Edwards
7abc3d61ac Ninja Multi-Config: Fix issue with framework dependencies and Autogen
Fixes: #20345
2020-02-17 08:24:57 -05:00
Kyle Edwards
2ac835b9f9 Refactor: Allow generators to decide default configuration for build
And allow them to read any cache values they need.
2020-02-04 14:13:07 -05:00
Brad King
a4d7a79beb Merge topic 'ninja-1.10'
ccaa0bccc4 Ninja: Do not clean metadata when re-generating inside a running build
657820a00b Ninja: Track when running to re-generate during a build
b12b013028 Ninja: Factor metadata cleanup into dedicated method
5d92e60d81 Ninja: Skip cleandead and recompact if build.ninja is missing
dd0a4718fd Ninja: Fix CMAKE_NINJA_OUTPUT_PATH_PREFIX with Ninja 1.10
0944caaebb Tests: Fix RunCMake.CMP0037 test with Ninja 1.10
9d4883cce5 Tests: Fix RunCMake.Ninja test for Ninja 1.10

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4290
2020-01-28 11:35:24 -05:00
Brad King
657820a00b Ninja: Track when running to re-generate during a build
Tell CMake explicitly when it is re-running inside a `ninja` invocation
to re-generate the build system.
2020-01-27 15:39:04 -05:00
Vitaly Stakhovsky
1398517f31 AppendProperty: convert value param to std::string 2020-01-25 10:37:00 -05:00
Brad King
56a3e84a67 Merge topic 'realpath-cache'
9d5a554cc9 cmGlobalGenerator: Add cache for realpath() results

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4220
2020-01-20 11:55:04 -05:00
Brad King
cd6f6b2a9f Merge topic 'cmake-ctest-arguments'
4153d8445b Add CMAKE_CTEST_ARGUMENTS variable to pass command-line arguments to ctest

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4168
2020-01-17 09:40:23 -05:00
Tim Blechmann
9d5a554cc9 cmGlobalGenerator: Add cache for realpath() results
Cache the results of `realpath()` system calls in `cmGlobalGenerator`
to avoid repeating such calls for the same paths over and over.
2020-01-16 11:29:25 +08:00
Robert Goulet
4153d8445b Add CMAKE_CTEST_ARGUMENTS variable to pass command-line arguments to ctest
Fixes: #20172
2020-01-15 15:02:56 -05:00
Marc Chevrier
f466cea3c9 cmMakefile: modernize memory management 2020-01-14 11:03:07 +01:00
Marc Chevrier
a00960288b GlobalGenerator family: modernize memory management 2020-01-07 11:03:11 +01:00
Marc Chevrier
5444a8095d cmGlobalGenerator: modernize memrory managemenbt 2019-12-30 16:55:39 +01:00
Brad King
64e2891cbd Merge topic 'stdstring-target'
c34b4497f8 cmTarget: add std::string overloads

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4137
2019-12-17 11:09:20 -05:00
Vitaly Stakhovsky
c34b4497f8 cmTarget: add std::string overloads 2019-12-14 09:30:28 -05:00
Kyle Edwards
5a8a9f7229 Ninja: Add multi-config variant
Co-Authored-by: vector-of-bool <vectorofbool@gmail.com>
2019-12-13 10:51:46 -05:00
Marc Chevrier
36c8cae2e8 cmLocalGenerator: modernize memory management 2019-12-10 00:24:06 +01:00
Brad King
fc99130752 Merge branch 'backport-unity-object-libraries' into unity-object-libraries 2019-12-08 11:21:38 -05:00
Cristian Adam
fa93b4a59b Unity: Proper handling of object libraries
Fixes: #20051
2019-12-07 15:44:38 +01:00
Cristian Adam
f742f7ac1f Unity/PCH: Skip more target types when adding automatic sources
Besides INTERFACE_LIBRARY, skip also UTILITY and GLOBAL_TARGET
target types
2019-12-07 14:51:34 +01:00
Daniel Eiband
96e5042e46 cmCustomCommand: Explicitly pass backtrace on construction 2019-11-24 20:13:23 +01:00
Daniel Eiband
bf76a6b801 cmMakefile: Delay CheckTargetProperties and FinalPass to generate time 2019-11-24 20:13:23 +01:00
Kyle Edwards
51c69fe5f8 FileAPI: Add "multiConfig" parameter to index file 2019-11-20 09:46:10 -05:00
Marc Chevrier
f93385283f cmLocalGenerator: modernize memory management 2019-11-11 16:41:13 +01:00
Alexander Boczar
99e83d4235 cmake: Teach --build mode to load CMAKE_GENERATOR_TOOLSET
Extend the `cmGlobalGenerator::SetGeneratorToolset` signature to
indicate when it is called from `cmake::build`.
2019-10-15 13:28:41 -04:00
Cristian Adam
36ded610af PCH: Generate sources during Compute step 2019-10-09 13:50:25 +02:00
Brad King
f1fb63b306 file(GENERATE): Create output file structures even earlier
Since commit b80557c7bd (file(GENERATE): Evaluate early to allow
generating source files, 2014-11-04, v3.2.0-rc1~398^2) we create the
`cmSourceFile` instances marked with a `GENERATED` source file property
before tracing source dependencies.  Move it to even earlier so that
steps in `cmGlobalGenerator::AddAutomaticSources` can operate on all
sources.  This also avoids the accidental `O(n^2)` calls for `n` local
generators that we had previously.

This is also needed since commit 83c1657ff7 (Unity build: Generate
sources during Compute step, 2019-10-03) to support `file(GENERATE)`
outputs as sources in a target with `UNITY_BUILD` enabled.
2019-10-07 15:22:12 -04:00
Brad King
83c1657ff7 Unity build: Generate sources during Compute step
The unity build sources need to be added for all generators.  Create
them during `cmGlobalGenerator::Compute` to avoid duplicating the calls
in every generator.  We already handle Qt autogen there too.

Issue: #19789
2019-10-03 14:55:22 -04:00
Brad King
d57c1a5b31 Merge topic 'clang-format-normalize-headers-presentation'
ed98209ddc Revise include order using clang-format-6.0
185fe49f29 clang-format: Normalize headers presentation
42ef28b4f3 Remove unused uid_t/gid_t types on Windows

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Sebastian Holtermann <sebholt@web.de>
Merge-request: !3851
2019-10-02 07:53:43 -04:00
Cristian Adam
e6e189e02b PCH: Report error when setting COMPILE_PDB_NAME property
Reusable precompile headers require specific COMPILE_PDB_NAME property
values. Report error if the user tries to set a different value.
2019-10-01 18:33:40 +02:00
Kitware Robot
ed98209ddc Revise include order using clang-format-6.0
Run the `clang-format.bash` script to update our C and C++ code to a new
include order `.clang-format`.  Use `clang-format` version 6.0.
2019-10-01 12:26:36 -04:00