From cfa1f043ddbbea5305f84208e8fd03112a0b8c8f Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Sun, 6 Jan 2019 15:45:50 -0700 Subject: [PATCH] CMake: Parse project version string out of setup.cfg --- CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5793c47c26..229086b88a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,13 @@ cmake_minimum_required(VERSION 3.0.2) set(CMAKE_DISABLE_SOURCE_CHANGES ON) # Must go before project() below set(CMAKE_DISABLE_IN_SOURCE_BUILD ON) # Must go before project() below -project(Panda3D VERSION 1.10.0) + +# Figure out the version +file(STRINGS "setup.cfg" _version REGEX "^version = ") +string(REGEX REPLACE "^.*= " "" _version "${_version}") +project(Panda3D VERSION ${_version}) +unset(_version) + enable_testing() # Panda3D is now a C++11 project. Newer versions of CMake support this out of