Skip to content

Autogen: Add moc path prefix generation (AUTOMOC_PATH_PREFIX)

Sebastian Holtermann requested to merge sebholt/cmake:autogen_path_prefix into master

This series of patches refactors AUTOGEN in the following areas.

  • Use collapsed full paths internally, instead of evaluated real paths. This improves compatibility with source or build directories that are symbolic links.
  • Automatically generate the -p path prefix option for moc (when a header is in the include directories). The behavior can be configured by the new variable CMAKE_AUTOMOC_PATH_PREFIX and target property AUTOMOC_PATH_PREFIX. It improves reproducability (closes #18815 (closed)) and ensures that moc output files will compile correctly when the source and/or build directory is a symbolic link.
  • Abbreviate paths in messages by prefixing them with either "SRC:" or "BIN:" instead of the project source or binary directory. This reduces message sizes and improves their readability.
  • Extend concurrency in the _autogen target by evaluating files for AUTOMOC and AUTOUIC in parallel. This reduces the runtime of the _autogen target, when both AUTOMOC and AUTOUIC are enabled and a project has many sources.
  • Add AUTOMOC tests for source and build directories, that are symbolic links.
  • Code cleanups.

Merge request reports