cburstedde / p4est

The "p4est" forest-of-octrees library
www.p4est.org/
GNU General Public License v2.0
260 stars 115 forks source link

Fix git-version-gen path #323

Closed tim-griesbach closed 2 weeks ago

tim-griesbach commented 2 weeks ago

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 https://github.com/DLR-AMR/t8code/issues/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.

cburstedde commented 2 weeks ago

Thanks for the quick check!