summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/PrecompileHeaders
Commit message (Collapse)AuthorAgeFilesLines
* Merge topic 'restore-pch-with-unity'Brad King2024-02-053-0/+4
|\ | | | | | | | | | | | | | | | | | | | | | | 30829da506 Unity: Clarify source comments on unity build transformation 87bf1c6c33 Merge branch 'unity-after-compile-features' into restore-pch-with-unity df08c37a42 cmGlobalGenerator: Add unity/pch sources after computing compile features 004c3c3986 Tests: Add case covering PCH in a unity build Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Acked-by: Ben Boeckel <ben.boeckel@kitware.com> Merge-request: !9215
| * Tests: Add case covering PCH in a unity buildBrad King2024-02-023-0/+4
| | | | | | | | Issue: #25650
* | Tests: Fix clang -Wstrict-prototypes warningsBrad King2023-10-263-4/+4
|/
* CMP0141: Fix PCH REUSE_FROM when MSVC_DEBUG_INFORMATION_FORMAT is emptyBrad King2022-11-152-0/+7
| | | | | | | | | | | | Under the policy's NEW behavior, `[CMAKE_]MSVC_DEBUG_INFORMATION_FORMAT` may be explicitly set to an empty string to tell CMake not to add any flags for this abstraction. In this case, fall back to checking the language-wide flags as we do in the OLD behavior. This revises commit 183b9a9eca (CMP0141: Fix PCH REUSE_FROM under policy NEW behavior, 2022-10-31, v3.25.0-rc3~4^2). Issue: #24106
* CMP0141: Fix PCH REUSE_FROM under policy NEW behaviorBrad King2022-10-314-1/+6
| | | | | | | | | | | Under the CMP0141 NEW behavior added by commit 0e96a20478 (MSVC: Add abstraction for debug information format, 2022-08-25, v3.25.0-rc1~142^2~1), the `-Zi` and `-ZI` flags do not appear in `CMAKE_<LANG>_FLAGS_<CONFIG>` anymore. Teach the PCH REUSE_FROM implementation to recognize the `EditAndContinue` and `ProgramDatabase` debug information formats through the policy's new abstraction. Fixes: #24106
* Tests: Drop redundant project init from RunCMake.PrecompileHeaders casesBrad King2022-10-3113-29/+19
| | | | | The `CMakeLists.txt` file already calls `cmake_minimum_required` and `project` before including each case's code.
* Merge topic 'xcode-pch'Brad King2022-04-122-0/+18
|\ | | | | | | | | | | | | | | | | 476c6a8910 PCH: Fix Xcode non-pch language exclusion fcf1fcfd0c Tests: Ignore all classes in Xcode internal objc warnings Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !7166
| * PCH: Fix Xcode non-pch language exclusionCristian Adam2022-04-112-0/+18
| | | | | | | | | | | | | | Fix a regression caused by commit bbcdac4e5d (PCH: Fix all-language precompile header support in Xcode, 2021-08-07, v3.22.0-rc1~140^2). Fixes: #23138
* | Tests: Skip Clang PCH_INSTANTIATE_TEMPLATES test in MSVC ABIBrad King2022-02-021-1/+2
| |
* | LCC: Add dedicated support for MCST LCC compilermakise-homura2021-10-151-1/+1
|/ | | | | | | | | | | | | | | | | | | | | Divert LCC compiler as a new one, instead of treating it as GNU. Since old times, Elbrus C/C++/Fortran Compiler (LCC) by MCST has been passing checks for GNU compilers, so it has been identified as GNU. Now, with intent of seriously upstreaming its support, it has been added as a separate LCC compiler, and its version displays not a supported GCC version, but LCC version itself (e.g. LCC 1.25.19 instead of GNU 7.3.0). This commit adds its support for detection, and also converts basically every check like 'is this compiler GNU?' to 'is this compiler GNU or LCC?'. The only places where this check is untouched, is where it regards other platforms where LCC is unavailable (primarily non-Linux), and where it REALLY differs from GNU compiler. Note: this transition may break software that are already ported to Elbrus, but hardly relies that LCC will be detected as GNU; still such software is not known.
* 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