Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • CMake CMake
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,801
    • Issues 3,801
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 12
    • Merge requests 12
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • CMake
  • CMakeCMake
  • Issues
  • #23134

Closed
Open
Created Jan 21, 2022 by Mika Fischer@mikafischer

Issues when updating dependency included by FetchContent (file timestamps, old files)

When using FetchContent, the downloaded project becomes part of the current project and normal dependency tracking using timestamps of the source files happens.

This creates the following problem:

  • Download foo v1. Timestamps of the source files are e.g. 2020-01-01
  • Build project. Timestamps of object files are e.g. 2022-01-01
  • Update foo to v2. Timestamps of the source files are e.g. 2021-01-01
  • Build project. foo is not rebuilt since the object files are still newer than the source files.

Note that this only happens for archives, since the timestamps in the archive are preserved. git always touches all changed files so this is not an issue for git checkouts.

One way to solve this would be to touch the files unpacked from the downloaded archive.

Another way would be to clean the source & binary folders before unpacking an archive.

Maybe the latter would be preferable, since otherwise old files might be left from the old version and possibly cause other issues.

I can't see a way to do either in CMake. But maybe there's another way to achieve proper dependencies that I'm currently not seeing. Any help is much appreciated.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking