summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalGenerator.cxx
Commit message (Collapse)AuthorAgeFilesLines
* Merge topic 'getdef-expand'Brad King2020-06-021-3/+2
|\ | | | | | | | | | | | | 7ed8c9ebe3 cmMakefile: add GetDefExpandList() that splits value into std::vector Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4819
| * cmMakefile: add GetDefExpandList() that splits value into std::vectorVitaly Stakhovsky2020-05-301-3/+2
| | | | | | | | Combines cmMakefile:GetDefinition() and cmExpandList()
* | Merge topic 'cmprop'Brad King2020-06-021-0/+1
|\ \ | | | | | | | | | | | | | | | | | | b36d1bdd9d Single location for cmProp typedef Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4829
| * | Single location for cmProp typedefVitaly Stakhovsky2020-06-011-0/+1
| |/
* | Merge topic 'pch-fix-bad-ClearSourcesCache'Brad King2020-06-011-1/+17
|\ \ | |/ |/| | | | | | | | | | | 902858367f Merge branch 'backport-3.16-pch-fix-bad-ClearSourcesCache' fa7b041eca PCH: Fix logic error that incorrectly clears sources during VS generation Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4815
| * Merge branch 'backport-3.16-pch-fix-bad-ClearSourcesCache'Brad King2020-05-291-1/+17
| |\
| | * PCH: Fix logic error that incorrectly clears sources during VS generationBrad King2020-05-291-1/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since commit 729d997f10 (Precompile Headers: Add REUSE_FROM signature, 2019-08-30, v3.16.0-rc1~101^2), `GetPchFileObject` handles the case that it is called first for another target's `REUSE_FROM` by calling `AddSource` to make sure `GetObjectName` can produce the correct object name. However, `AddSource` causes `ClearSourcesCache` to be called, which since commit a9f4f58f0c (cmGeneratorTarget: Clear AllConfigSources in ClearSourcesCache, 2020-05-15, v3.16.7~2^2) now correctly erases the `AllConfigSources` structure. This is okay during `AddPchDependencies`, but there is another code path in which it is problematic. When the Visual Studio generator's `WriteAllSources` method is looping over the sources, the `cmake_pch.cxx` source is encountered first. This causes `OutputSourceSpecificFlags` to call `GetPchCreateCompileOptions`, which calls `GetPchFile`, which under MSVC with `CMAKE_LINK_PCH` calls `GetPchFileObject`. That leads to `ClearSourcesCache` erasing the structure over which `WriteAllSources` is iterating! This bug is caught by our `RunCMake.PrecompileHeaders` test when run with the VS generator as of the commit that exposed it by fixing `ClearSourcesCache`. However, that change was backported to the CMake 3.16 series after testing only with later versions versions that contain commit a55df20499 (Multi-Ninja: Add precompile headers support, 2020-01-10, v3.17.0-rc1~136^2). By adding proper multi-config support for PCH, that commit taught `cmLocalGenerator::AddPchDependencies` to call `GetPchFile` with the real set of configurations instead of just the empty string. This allows the `GetPchFile` cache of PCH sources to be populated up front so that the later calls to it in the `WriteAllSources` loop as described above do not actually call `GetPchFileObject` or `ClearSourcesCache`. That hid the problem. Fix this by re-ordering calls to `AddPchDependencies` to handle `REUSE_FROM` targets only after the targets whose PCH they re-use. Remove the now-unnecessary call to `AddSource` from `GetPchFileObject` so that `ClearSourcesCache` is never called during `WriteAllSources`. Update the PchReuseFrom test case to cover an ordering of targets that causes generators to encounter a `REUSE_FROM` target before the target whose PCH it re-uses. Fixes: #20770
* | | AutoMoc: Configure AutoMoc after generated sources (PCH, Unity)Cristian Adam2020-05-261-4/+4
| | | | | | | | | | | | Fixes: #20119
* | | cmTarget: Replace "perConfig" constructor boolean with enumBrad King2020-05-181-2/+2
| | |
* | | cmGlobalGenerator: Fix CheckTargetsForMissingSources after refactoringBrad King2020-05-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | Refactoring: Third-parties public headers are under cm3p prefixMarc Chevrier2020-05-071-2/+2
| | | | | | | | | | | | Fixes: #20666
* | | Merge topic 'cmprop-state'Brad King2020-05-011-4/+3
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | e267c3fddf cmState::GetInitializedCacheValue: return cmProp Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4696
| * | | cmState::GetInitializedCacheValue: return cmPropVitaly Stakhovsky2020-04-301-4/+3
| | | | | | | | | | | | | | | | cmProp alias is used; no actual change in type
* | | | GetSafeProperty: return std::string const&Vitaly Stakhovsky2020-04-301-2/+2
|/ / /
* | | cmGeneratorTarget::GetProperty: return cmPropVitaly Stakhovsky2020-04-291-8/+16
| | |
* | | Refactoring: add cm::contains to <cmext/algorithm>Marc Chevrier2020-04-171-5/+6
| | |
* | | Merge topic 'cmprop-source'Brad King2020-04-151-2/+2
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | e64fa5f1b6 cmSourceFile::GetProperty: return cmProp fc223f9860 cmGlobalXCodeGenerator: Fix genex interpreter overloads Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4603
| * | | cmSourceFile::GetProperty: return cmPropVitaly Stakhovsky2020-04-141-2/+2
| | | |
* | | | Merge topic 'msbuildUtf8Support'Brad King2020-04-151-1/+5
|\ \ \ \ | |/ / / |/| | | | | | | | | | | | | | | | | | | bc877a7e94 Add support to indicate UTF-8 custom command pipe output encoding Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4587
| * | | Add support to indicate UTF-8 custom command pipe output encodingJustin Goshi2020-04-131-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | clang-tidy: address bugprone-sizeof-expression lintBen Boeckel2020-04-131-2/+4
|/ / /
* | | cmMakefile::GetProperty: return cmPropVitaly Stakhovsky2020-04-011-4/+4
| | |
* | | cmTarget::GetProperty: return cmPropVitaly Stakhovsky2020-03-301-3/+2
| | |
* | | cmState::GetGlobalProperty: return cmPropVitaly Stakhovsky2020-03-251-9/+8
| | |
* | | Merge topic 'export-repeat'Brad King2020-03-201-10/+9
|\ \ \ | |/ / | | | | | | | | | | | | | | | 8affe9aa33 export: Fix use-after-free on multiple calls overwriting same FILE Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4494
| * | export: Fix use-after-free on multiple calls overwriting same FILEBrad King2020-03-191-10/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | cmMakefile::AddCacheDefinition: Add overload that accepts std::string valueVitaly Stakhovsky2020-03-111-2/+2
|/ /
* | Generator: Don't allow Ninja Multi-Config variables on other generatorsKyle Edwards2020-02-271-0/+35
| | | | | | | | | | | | 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.
* | Ninja Multi-Config: Fix issue with framework dependencies and AutogenKyle Edwards2020-02-171-1/+1
| | | | | | | | Fixes: #20345
* | Refactor: Allow generators to decide default configuration for buildKyle Edwards2020-02-041-2/+6
| | | | | | | | And allow them to read any cache values they need.
* | Merge topic 'ninja-1.10'Brad King2020-01-281-0/+1
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | Ninja: Track when running to re-generate during a buildBrad King2020-01-271-0/+1
| | | | | | | | | | | | | | | Tell CMake explicitly when it is re-running inside a `ninja` invocation to re-generate the build system.
* | | AppendProperty: convert value param to std::stringVitaly Stakhovsky2020-01-251-1/+3
|/ /
* | Merge topic 'realpath-cache'Brad King2020-01-201-0/+11
|\ \ | | | | | | | | | | | | | | | | | | 9d5a554cc9 cmGlobalGenerator: Add cache for realpath() results Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4220
| * | cmGlobalGenerator: Add cache for realpath() resultsTim Blechmann2020-01-161-0/+11
| | | | | | | | | | | | | | | Cache the results of `realpath()` system calls in `cmGlobalGenerator` to avoid repeating such calls for the same paths over and over.
* | | Merge topic 'cmake-ctest-arguments'Brad King2020-01-171-0/+7
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | 4153d8445b Add CMAKE_CTEST_ARGUMENTS variable to pass command-line arguments to ctest Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4168
| * | | Add CMAKE_CTEST_ARGUMENTS variable to pass command-line arguments to ctestRobert Goulet2020-01-151-0/+7
| | | | | | | | | | | | | | | | Fixes: #20172
* | | | cmMakefile: modernize memory managementMarc Chevrier2020-01-141-4/+4
|/ / /
* | | GlobalGenerator family: modernize memory managementMarc Chevrier2020-01-071-2/+2
| | |
* | | cmGlobalGenerator: modernize memrory managemenbtMarc Chevrier2019-12-301-34/+37
|/ /
* | Merge topic 'stdstring-target'Brad King2019-12-171-1/+1
|\ \ | | | | | | | | | | | | | | | | | | c34b4497f8 cmTarget: add std::string overloads Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4137
| * | cmTarget: add std::string overloadsVitaly Stakhovsky2019-12-141-1/+1
| | |
* | | Ninja: Add multi-config variantKyle Edwards2019-12-131-1/+3
|/ / | | | | | | Co-Authored-by: vector-of-bool <vectorofbool@gmail.com>
* | cmLocalGenerator: modernize memory managementMarc Chevrier2019-12-091-35/+33
| |
* | Merge branch 'backport-unity-object-libraries' into unity-object-librariesBrad King2019-12-081-1/+12
|\ \ | |/
| * Unity: Proper handling of object librariesCristian Adam2019-12-071-0/+9
| | | | | | | | Fixes: #20051
| * Unity/PCH: Skip more target types when adding automatic sourcesCristian Adam2019-12-071-1/+3
| | | | | | | | | | Besides INTERFACE_LIBRARY, skip also UTILITY and GLOBAL_TARGET target types
* | cmCustomCommand: Explicitly pass backtrace on constructionDaniel Eiband2019-11-241-2/+2
| |
* | cmMakefile: Delay CheckTargetProperties and FinalPass to generate timeDaniel Eiband2019-11-241-18/+17
| |
* | FileAPI: Add "multiConfig" parameter to index fileKyle Edwards2019-11-201-0/+1
| |