Skip to content

Preserve config.h timestamp when contents are unchanged - #6140

Open
birolcapa wants to merge 2 commits into
OpenMathLib:developfrom
birolcapa:patch-1
Open

birolcapa wants to merge 2 commits into
OpenMathLib:developfrom
birolcapa:patch-1

Conversation

@birolcapa

Copy link
Copy Markdown

Avoids unnecessary OpenBLAS rebuilds during reconfigure

Avoids unnecessary OpenBLAS rebuilds during reconfigure
@martin-frbg

Copy link
Copy Markdown
Collaborator

Hmm, it's not quite clear to me when this change would actually be useful ?

@birolcapa

birolcapa commented Oct 21, 2026 •

Copy link
Copy Markdown
Author

Hmm, it's not quite clear to me when this change would actually be useful ?

Thank you for your review. I appreciate it.

This is useful when CMake reconfigures because of an unrelated CMake change. The file(RENAME... call replaces config.h every time, even its contents are unchanged, so its timestamp changes. Since OpenBLAS sources depend on config.h, the build system sees the header as newer and recompiles OpenBLAS unnecessarily.

file(COPY_FILE ... ONLY_IF_DIFFERENT) preserves the existing config.h timestamp when the generated contents are identical.

This matters especially in incremental builds, where a small CMake change elsewhere will not trigger building OpenBLAS.

But now I recognized a problem with my PR, OpenBLAS asks cmake_minimum_required(VERSION 3.16.0), but file(COPY_FILE ... ONLY_IF_DIFFERENT) syntax is added in version 3.21.

Am I allowed to change required CMake version? If you agree, I can do that.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants