Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong path to .VERSION.in when building as a CMake subproject #585

Closed
mcharlou opened this issue Mar 13, 2025 · 1 comment
Closed

Wrong path to .VERSION.in when building as a CMake subproject #585

mcharlou opened this issue Mar 13, 2025 · 1 comment

Comments

@mcharlou
Copy link
Contributor

When building json-fortran as a CMake subproject (i.e. json-fortran is not the top-level project), typically with FetchContent, the following error occurs:

CMake Error: File [REDACTED]/.VERSION.in does not exist.
CMake Error at build/_deps/json-fortran-src/CMakeLists.txt:48 (configure_file):
  configure_file Problem configuring file

This error occurs because json-fortran tries to configure the file .VERSION.in located in CMAKE_SOURCE_DIR, however when json-fortran is not the top-level project, CMAKE_SOURCE_DIR is not json-fortran's source directory (and thus .VERSION.in is likely not present).

Replacing CMAKE_SOURCE_DIR with CMAKE_CURRENT_SOURCE_DIR should solve the issue.

Moreover, since the .VERSION file seems to only be used when generating the documentation, adding a conditional statement with JSONFORTRAN_ENABLE_DOC_GENERATION may be a good idea.

I'll propose a PR with the fixed I suggest.

Version: 9.0.3
OS: Debian 12 (bookworm)
CMake version: 3.25.1

@mcharlou
Copy link
Contributor Author

Done in #586.

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

No branches or pull requests

1 participant