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

Fix git-version-gen path #323

Merged
merged 1 commit into from
Nov 7, 2024

Conversation

tim-griesbach
Copy link
Collaborator

Fix git-version-gen path

Problem description

Currently calling cmake on the source directory generates a file include/p4est_config.h with

[...]

/* Define to the full name and version of this package. */
#define P4EST_PACKAGE_STRING "p4est 0.0.0"

/* Define to the one symbol short name of this package. */
#define P4EST_PACKAGE_TARNAME "p4est"

/* Define to the home page for this package. */
#define P4EST_PACKAGE_URL ""

/* Define to the version of this package. */
#define P4EST_PACKAGE_VERSION "0.0.0"

/* Version number of package */
#define P4EST_VERSION "0.0.0"

/* Package major version */
#define P4EST_VERSION_MAJOR 0

/* Package minor version */
#define P4EST_VERSION_MINOR 0

/* Package point version */
#define P4EST_VERSION_POINT 0

as reported in DLR-AMR/t8code#1294.

Proposed change

The reason for the described problem is that the variable PROJECT_SOURCE_DIR in cmake/git.cmake is used to search for the git-version-gen program that is used to get the version number. However, PROJECT_SOURCE_DIR is an empty variable since project was not yet called. Since we want to pass the version number to project we can not change the call sequence. Therefore, I replaced PROJECT_SOURCE_DIR by CMAKE_CURRENT_SOURCE_DIR, which is the path to the current source directory.

Remark: We do not need an analogous PR in libsc since libsc's include/sc_config.h is already set correctly.

The variable PROJECT_SOURCE_DIR is set after the first call of project()
but we want to use git-version-gen to get the version to pass it to
project(). Therefore, we need to use the current source directory
instead of the cmake project directory.
@cburstedde
Copy link
Owner

Thanks for the quick check!

@cburstedde cburstedde merged commit 10fbe5c into cburstedde:develop Nov 7, 2024
12 checks passed
@tim-griesbach tim-griesbach deleted the fix-cmake-version branch November 7, 2024 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants