Invalid version generated in ${CMAKE_BINARY_DIR}/src/vsgXchangeConfigVersion.cmake
Closed this issue · 1 comments
Describe the bug
I recognized, that the cmake build system does not set valid version information in the generate cmake support files.
To Reproduce
On openSUSE linux I did:
$ git clone
$ mkdir vsgXchange-build
$ cd vsgXchange-build
$ cmake ../vsgXchange
$ grep '^set(PACKAGE_VERSION' src/vsgXchangeConfigVersion.cmake
set(PACKAGE_VERSION "..")
Expected behavior
In the mentioned file the variable PACKAGE_VERSION should have the value "0.0.1".
The reason for this issue is, that in src/CMakeLists.txt wrong cmake variables are used to get the project version.
write_basic_package_version_file("${CMAKE_BINARY_DIR}/src/vsgXchangeConfigVersion.cmake"
VERSION ${VSGXCHANGE_MAJOR_VERSION}.${VSGXCHANGE_MINOR_VERSION}.${VSGXCHANGE_PATCH_VERSION}
COMPATIBILITY SameMajorVersion
where it should be ${VSGXCHANGE_VERSION_MAJOR}.${VSGXCHANGE_VERSION_MINOR}.${VSGXCHANGE_VERSION_PATCH}
or more simple ${VSGXCHANGE_VERSION}
(https://cmake.org/cmake/help/v3.7/command/project.html#command:project)
To be independent from the upper cased project name (which will change when merging the vsgMacros.cmake branch) ${PROJECT_VERSION}
should be used here.
According to https://cmake.org/cmake/help/latest/module/CMakePackageConfigHelpers.html#command:write_basic_package_version_file the VERSION
attribute is optional. If not set, ${PROJECT_VERSION}
will be used by default.
The VulkanSceneGraph repo is not affected because it already uses this approach. For the remaining repos I will open appropriate pull requests.