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

CMake fails after downloading source tree from www.fltk.org #499

Open
ManoloFLTK opened this issue Sep 17, 2022 · 3 comments
Open

CMake fails after downloading source tree from www.fltk.org #499

ManoloFLTK opened this issue Sep 17, 2022 · 3 comments
Assignees
Labels
bug Something isn't working CMake CMake bug or needs CMake support

Comments

@ManoloFLTK
Copy link
Contributor

When the FLTK source tree is downloaded from the "download" section of www.fltk.org,
rather than from its github git repo, CMake building fails with

fatal: not a git repository: '/home/xxxx/fltk-1.4.x/.git'

CMake Error at documentation/CMakeLists.txt:53 (string):
  string sub-command REPLACE requires at least four arguments.

The error disappears if OPTION_BUILD_HTML_DOCUMENTATION which is on by default is turned off.

The error comes from documentation/CMakeLists.txt executing command
git --git-dir=${CMAKE_SOURCE_DIR}/.git rev-parse --short=10 HEAD
which fails if ${CMAKE_SOURCE_DIR} is not a git repo.

@Albrecht-S : That could be fixed by setting the default value of this option according to whether the source tree contains a .git directory, or by replacing the output of the git command by something else. What do you think ?

@Albrecht-S
Copy link
Member

@ManoloFLTK Thanks for finding and reporting this. I would not want to change the default of OPTION_BUILD_HTML_DOCUMENTATION and this wouldn't help anyway if someone really wanted to build the docs from a tarball. I added the git revision to the docs (html + pdf) because I found this to be essential to see from which FLTK version (git commit) the docs have been created.

However we must take into account if the current source directory is a git repository or not and I believe the best choice would be to create a file with the git commit hash when we build the tarball so we can access this file rather than using git directly. I'll check how to do this.

Do you agree with this approach?

@Albrecht-S Albrecht-S self-assigned this Sep 17, 2022
@Albrecht-S Albrecht-S added bug Something isn't working CMake CMake bug or needs CMake support labels Sep 17, 2022
@Albrecht-S Albrecht-S added this to the Release FLTK 1.4.0 milestone Sep 17, 2022
@ManoloFLTK
Copy link
Contributor Author

Yes. Putting the git commit hash in the tarball would be perfect.

Albrecht-S pushed a commit that referenced this issue Oct 3, 2022
Ignore error if docs are not generated using a git working tree, for
  instance from a downloaded tarball or zip file. This is only a
  temporary solution for issue #499 (see "FIXME" comment).

Execute doxygen only if it is available. i.e. found by CMake.
@Albrecht-S
Copy link
Member

FTR: commit 5646522 fixes two special cases where either doxygen or git were executed even if the source tree was not a git working copy and/or doxygen would be invoked although it was not found or not in the current PATH.

This is not yet a complete solution for this issue but it should prevent hard build errors.

@ManoloFLTK Writing the current git revision to a file during tarball creation will be done in a later commit. I'm thus leaving this issue open for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working CMake CMake bug or needs CMake support
Projects
None yet
Development

No branches or pull requests

2 participants