Skip to content

[Build] CPack ignores version number in Linux packages if defined via PROJECT_VERSION include instead of CPack params #2689

@oznogon

Description

@oznogon

Building EmptyEpsilon on Debian 13 with a project include to define PROJECT_VERSION results in the game compiling with the correct version number:

$ cat ../version.cmake
set(PROJECT_VERSION 2024.12.08)
set(PROJECT_VERSION_MAJOR 2024)
set(PROJECT_VERSION_MINOR 12)
set(PROJECT_VERSION_PATCH 8)

$ cmake .. -G Ninja -DSERIOUS_PROTON_DIR=../../SeriousProton -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_PROJECT_EmptyEpsilon_INCLUDE=./version.cmake

...

-- EmptyEpsilon Version = 2024.12.08

The correct EE version number can be confirmed by installing the resulting package and running EmptyEpsilon.

However, the DEB package unexpectedly is versioned with today's date instead of the defined major/minor/patch numbers:

$ dpkg --info EmptyEpsilon.deb | grep Version
 Version: 2026.1.6
Image

The same build of the same code using deprecated CPack package version number parameters:

$ cmake .. -G Ninja -DSERIOUS_PROTON_DIR=../../SeriousProton -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCPACK_PACKAGE_VERSION_MAJOR=2024 -DCPACK_PACKAGE_VERSION_MINOR=12 -DCPACK_PACKAGE_VERSION_PATCH=08

creates a DEB package with the defined version number as expected:

$ dpkg --info EmptyEpsilon.deb  | grep Version
 Version: 2024.12.08
Project include build: From EmptyEpsilon/_build:
$ cd ..; rm -rf _build; mkdir -p _build; cd _build
$ cat ../version.cmake 
set(PROJECT_VERSION 2024.12.08)
set(PROJECT_VERSION_MAJOR 2024)
set(PROJECT_VERSION_MINOR 12)
set(PROJECT_VERSION_PATCH 8)
$ cmake .. -G Ninja -DSERIOUS_PROTON_DIR=../../SeriousProton -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_PROJECT_EmptyEpsilon_INCLUDE=./version.cmake
CMake Deprecation Warning at CMakeLists.txt:12 (cmake_minimum_required):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
  to tell CMake that the project requires at least <min> but has been updated
  to work with policies introduced by <max> or earlier.


-- The CXX compiler identification is GNU 14.2.0
-- The C compiler identification is GNU 14.2.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- EmptyEpsilon Version = 2024.12.08
-- GLM version used: BUNDLED

...

-- Configuring done (30.3s)
-- Generating done (0.1s)
-- Build files have been written to: /home/gguillotte/git/EmptyEpsilon/_build
$ ninja package

...

[485/487] Run CPack packaging tool...
CPack: Create package using DEB
CPack: Install projects
CPack: - Install project: EmptyEpsilon []
CPack: - Install project: SeriousProton []
CPack: Create package
CPack: - package: /home/gguillotte/git/EmptyEpsilon/_build/EmptyEpsilon.deb generated.
CPack: - checksum file: /home/gguillotte/git/EmptyEpsilon/_build/EmptyEpsilon.deb.sha256 generated.
$ dpkg --info EmptyEpsilon.deb 
 new Debian package, version 2.0.
 size 267961322 bytes: control archive=21570 bytes.
     236 bytes,    10 lines      control
   76438 bytes,   744 lines      md5sums
 Architecture: arm64
 Depends: libfreetype6, libsdl2-2.0-0
 Description: EmptyEpsilon built using CMake
 Maintainer: https://github.com/daid/
 Package: emptyepsilon
 Priority: optional
 Section: devel
 Version: 2026.1.6
 Installed-Size: 317607
CPack package version build:
$ cmake .. -G Ninja -DSERIOUS_PROTON_DIR=../../SeriousProton -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCPACK_PACKAGE_VERSION_MAJOR=2024 -DCPACK_PACKAGE_VERSION_MINOR=12 -DCPACK_PACKAGE_VERSION_PATCH=08
CMake Deprecation Warning at CMakeLists.txt:12 (cmake_minimum_required):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
  to tell CMake that the project requires at least <min> but has been updated
  to work with policies introduced by <max> or earlier.


CMake Deprecation Warning at CMakeLists.txt:19 (message):
  Prefer setting the version through CMAKE_PROJECT_EmptyEpsilon_INCLUDE file
  override


-- The CXX compiler identification is GNU 14.2.0
-- The C compiler identification is GNU 14.2.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- EmptyEpsilon Version = 2024.12.8
-- GLM version used: BUNDLED

...

-- Found PythonInterp: /usr/bin/python3 (found version "3.13.5")
-- Configuring done (72.2s)
-- Generating done (0.1s)
-- Build files have been written to: /home/gguillotte/git/EmptyEpsilon/_build
$ ninja package
...
[485/486] Run CPack packaging tool...
CPack: Create package using DEB
CPack: Install projects
CPack: - Install project: EmptyEpsilon []
CPack: - Install project: SeriousProton []
CPack: Create package
CPack: - package: /home/gguillotte/git/EmptyEpsilon/_build/EmptyEpsilon.deb generated.
CPack: - checksum file: /home/gguillotte/git/EmptyEpsilon/_build/EmptyEpsilon.deb.sha256 generated.
$ dpkg --info EmptyEpsilon.deb 
 new Debian package, version 2.0.
 size 267961250 bytes: control archive=21570 bytes.
     238 bytes,    10 lines      control
   76438 bytes,   744 lines      md5sums
 Architecture: arm64
 Depends: libfreetype6, libsdl2-2.0-0
 Description: EmptyEpsilon built using CMake
 Maintainer: https://github.com/daid/
 Package: emptyepsilon
 Priority: optional
 Section: devel
 Version: 2024.12.08
 Installed-Size: 317607

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions