1. 15 Sep, 2020 3 commits
  2. 10 Aug, 2020 2 commits
    • Brad King's avatar
      Merge branch 'backport-3.16-automoc-path-prefix-off' into release-3.16 · 521ed96f
      Brad King authored
      Merge-request: !5105
      521ed96f
    • Jörg Bornemann's avatar
      Autogen: Turn off moc path prefix generation by default · 4c33b305
      Jörg Bornemann authored
      Change the default value of `CMAKE_AUTOMOC_PATH_PREFIX` to `OFF` to
      restore compatibility with behavior of CMake 3.15 and below.
      
      C++ source files that are generated by Qt's meta object compiler (moc)
      include the header file that was passed as input argument to moc. This
      is usually a path relative to the source directory, for example
      
          #include "../../source/dir/myobject.h"
      
      That is problematic for reproducible builds as described in #18815.
      To cope with that, the target property AUTOMOC_PATH_PREFIX was
      introduced in CMake 3.16 by commit d018d27c (Autogen: Add moc path
      prefix generation (AUTOMOC_PATH_PREFIX), 2019-09-13, v3.16.0-rc1~94^2~4).
      The property is default-initialized from the variable
      `CMAKE_AUTOMOC_PATH_PREFIX`, which defaults to `ON`.
      
      If this property is ON, and myobject.h is located in an include
      directory of the target, moc-generated C++ files include the file
      without the "path prefix":
      
          #include "myobject.h"
      
      This behavior, however, can break projects that have equally named
      header files in different include directories.  As "not breaking
      existing projects" trumps "have reproducible builds by default" we
      change the default of `CMAKE_AUTOMOC_PATH_PREFIX` to `OFF`.
      
      Also, it is now possible to pass `-DCMAKE_AUTOMOC_PATH_PREFIX=ON` on the
      CMake command line.  Before, it was overridden in `CMakeGenericSystem`.
      
      Fixes: #20598
      Issue: #18815
      4c33b305
  3. 07 Aug, 2020 2 commits
  4. 01 Jun, 2020 1 commit
  5. 29 May, 2020 2 commits
    • Brad King's avatar
      Merge branch 'backport-3.16-pch-fix-bad-ClearSourcesCache' into release-3.16 · 5ff1a252
      Brad King authored
      Merge-request: !4815
      5ff1a252
    • Brad King's avatar
      PCH: Fix logic error that incorrectly clears sources during VS generation · fa7b041e
      Brad King authored
      Since commit 729d997f (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 a9f4f58f (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 a55df204 (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
      fa7b041e
  6. 27 May, 2020 1 commit
  7. 19 May, 2020 2 commits
  8. 15 May, 2020 4 commits
  9. 14 May, 2020 3 commits
  10. 11 May, 2020 4 commits
  11. 09 May, 2020 2 commits
  12. 06 May, 2020 1 commit
  13. 05 May, 2020 3 commits
  14. 28 Apr, 2020 3 commits
  15. 27 Apr, 2020 2 commits
  16. 14 Apr, 2020 3 commits
  17. 10 Apr, 2020 2 commits