summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/PrecompileHeaders
Commit message (Collapse)AuthorAgeFilesLines
* PCH: MSVC: Restrict OBJECT library INTERFACE_LINK_LIBRARIES usageCristian Adam2021-09-152-0/+25
| | | | | | | | The pch object file could cause problems when the reused pch is passed through an OBJECT library, which would use INTERFACE_LINK_LIBRARIES to link the pch object file. Fixes: #22630
* PCH: Fix all-language precompile header support in XcodeCristian Adam2021-09-135-0/+35
| | | | Fixes: #22384
* VS: Restore support for PCH in CXX but not C within once targetBrad King2021-02-195-0/+33
| | | | | | | | Fix logic from commit 9df1f33c9a (VisualStudio: move PCH rules to projects when possible., 2020-10-15, v3.20.0-rc1~638^2) to explicitly disable PCH on sources that should not use the target-wide PCH rules. Fixes: #21827
* PCH: Remove restrictions for REUSE_FROM signature for MSVCCristian Adam2021-02-022-0/+132
| | | | Fixes: #20201
* Revert "PCH: Remove restrictions for REUSE_FROM signature for MSVC"Brad King2021-02-022-132/+0
| | | | | This reverts commit 9f060971411aca979807f70307d8b9fe1b43ff24. It was merged accidentally.
* PCH: Remove restrictions for REUSE_FROM signature for MSVCCristian Adam2021-02-022-0/+132
| | | | Fixes: #20201
* Tests: Fix PchInstantiateTemplates case on macOS with CMAKE_OSX_ARCHITECTURESBrad King2020-09-111-2/+2
| | | | | | Update the test added by commit 8c8f03422e (PCH: Template instantiation support, 2020-08-28) to recognize flags on PCH files whose names include the architecture. This occurs when `CMAKE_OSX_ARCHITECTURES` is set.
* PCH: Template instantiation supportTobias Hieta2020-09-023-0/+38
| | | | | | | | Adds PCH_INSTANTIATE_TEMPLATES target property for enabling template instantiation in precompiled headers. Enabled by default. Currently only supported for Clang 11 and newer. Implements #21133.
* Merge topic 'pch-fix-bad-ClearSourcesCache'Brad King2020-06-011-2/+5
|\ | | | | | | | | | | | | | | 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-2/+5
| |\
| | * PCH: Fix logic error that incorrectly clears sources during VS generationBrad King2020-05-291-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | Merge topic 'vs-pch-compile-opts' into release-3.17Brad King2020-05-121-0/+3
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | 6b2fb4ffd2 VS: Fix using PCH from source with COMPILE_OPTIONS Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4734
| * \ \ Merge topic 'pch-genex-absolute' into release-3.17Brad King2020-04-284-2/+6
| |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | b204bae261 target_precompile_headers: Fix documented example using genex Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Cristian Adam <cristian.adam@gmail.com> Merge-request: !4678
* | | | | Tests: Fix -Wstrict-prototypes warnings in some C sourcesBrad King2020-05-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some RunCMake tests fail with this warning due to extra stderr content: warning: this old-style function definition is not preceded by a prototype Convert `foo()` to `foo(void)` in `.c` sources of affected tests.
* | | | | Merge topic 'vs-pch-compile-opts'Brad King2020-05-121-0/+3
|\ \ \ \ \ | | |_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | | 6b2fb4ffd2 VS: Fix using PCH from source with COMPILE_OPTIONS Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4734
| * | | | VS: Fix using PCH from source with COMPILE_OPTIONSBrad King2020-05-111-0/+3
| | |_|/ | |/| | | | | | | | | | | | | | | | | | | | | | If a source file gets per-source flags from both PCH and custom `COMPILE_OPTIONS`, combine them correctly. Fixes: #20694, #20456
* | | | Merge topic 'pch-genex-absolute'Brad King2020-04-284-2/+6
|\ \ \ \ | | |_|/ | |/| | | | | | | | | | | | | | | | | | | | | | b204bae261 target_precompile_headers: Fix documented example using genex Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Cristian Adam <cristian.adam@gmail.com> Merge-request: !4678
| * | | target_precompile_headers: Fix documented example using genexBrad King2020-04-274-2/+6
| |/ / | | | | | | | | | | | | | | | | | | | | | When the path to a header file is specified using a generator expression, evaluation of the genex must produce an absolute path. Update our documented example and add a test covering the case. Fixes: #20617
* | | PCH: Add support for multi architecture iOS projectsCristian Adam2020-04-021-6/+3
| | | | | | | | | | | | Fixes: #20497
* | | PCH: add an option to disable `-Winvalid-pch`Cristian Adam2020-03-263-0/+41
| |/ |/| | | | | Fixes: #20295
* | Multi-Ninja: Add precompile headers supportCristian Adam2020-01-177-0/+41
|/ | | | Fixes: #19789
* PCH: Use the target's PREFIX for building the pdb file nameCristian Adam2019-12-083-0/+32
| | | | | | | | Also copy the REUSE_FROM pdb file only if the file is newer than the existing one. Fixes: #19731 Fixes: #20068
* PCH: Do not issue an error on duplicate target_precompile_headers callCristian Adam2019-11-152-2/+15
| | | | Fixes: #19970
* PCH: No repeated path for internal generated PCH filesCristian Adam2019-11-114-26/+7
| | | | Fixes: #19952
* PCH: Document and test COMPILE_LANGUAGE genex for per-language headerBrad King2019-10-162-1/+18
| | | | Fixes: #19839
* PCH: Fix CMake test files indentationCristian Adam2019-10-034-20/+20
|
* PCH: Add multi-language PCH generation supportCristian Adam2019-10-033-0/+27
| | | | | | | | | If the target has C files, it will get a C PCH file. The same for C++ files. The linker language is no longer used to determine which language to use for PCH. Fixes: #19790
* Revise include order using clang-format-6.0Kitware Robot2019-10-011-0/+1
| | | | | 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.
* Precompile headers: Treat headers as relative to current source directoryCristian Adam2019-09-236-13/+22
| | | | | | | Teach `target_precompile_headers` to treat relative paths the same way as `target_sources`. Fixes: #19733
* Precompile Headers: Add REUSE_FROM signatureCristian Adam2019-09-177-1/+49
| | | | | | | Add the ability to share precompiled headers artifacts between targets. Fixes: #19659
* Precompile headers: Add unit testsCristian Adam2019-08-2816-0/+182