Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • K KTextEditor
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 1
    • Issues 1
    • List
    • Boards
    • Service Desk
    • Milestones
  • Bugzilla
    • Bugzilla
  • Merge requests 1
    • Merge requests 1
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • FrameworksFrameworks
  • KTextEditor
  • Merge requests
  • !80

CMake: Use configure_file() to ensure noop incremental builds

  • Review changes

  • Download
  • Patches
  • Plain diff
Merged Daan De Meyer requested to merge daandemeyer/ktexteditor:noop-incremental into master Jan 19, 2021
  • Overview 3
  • Commits 1
  • Pipelines 0
  • Changes 1

Currently, script.qrc is re-generated every time CMake is rerun. Because the previous file is always removed, all rules depending on script.qrc are always rerun. By writing to a temporary file and using configure_file() to copy to the final location, we avoid unnecessary rebuilds as configure_file() will only touch the final file if it's contents differ from the input file. As a result, the timestamp of the file is not updated and the rules depending on it are not unnecessarily rebuilt.

Before:

[root@mkosi-abd8b2cdeabd4100bb6ac0239afe761e ktexteditor]# cmake . &> /dev/null
[root@mkosi-abd8b2cdeabd4100bb6ac0239afe761e ktexteditor]# ninja
[0/2] Re-checking globbed directories...
[9/9] Creating library symlink bin/libKF5TextEditor.so.5 bin/libKF5TextEditor.so
[root@mkosi-abd8b2cdeabd4100bb6ac0239afe761e ktexteditor]#

After:

[root@mkosi-abd8b2cdeabd4100bb6ac0239afe761e ktexteditor]# cmake . &> /dev/null
[root@mkosi-abd8b2cdeabd4100bb6ac0239afe761e ktexteditor]# ninja
[0/2] Re-checking globbed directories...
ninja: no work to do.
[root@mkosi-abd8b2cdeabd4100bb6ac0239afe761e ktexteditor]#

When the minimum CMake version is raised above 3.18, we can use file(CONFIGURE) instead of writing to a temporary file.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: noop-incremental