From f6ec00e1c4be34051678b3ec575a939c1cbfffbf Mon Sep 17 00:00:00 2001 From: sfan5 Date: Thu, 21 Jul 2022 19:49:36 +0200 Subject: [PATCH] Include revision in SOVERSION for (in)compatibility checks --- CMakeLists.txt | 4 +++- source/Irrlicht/CMakeLists.txt | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2ecb9f7d..ac3cb936 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,8 +7,10 @@ else() cmake_policy(VERSION 3.9) endif() +set(IRRLICHTMT_REVISION 6) + project(Irrlicht - VERSION 1.9.0 + VERSION 1.9.0.${IRRLICHTMT_REVISION} LANGUAGES CXX ) diff --git a/source/Irrlicht/CMakeLists.txt b/source/Irrlicht/CMakeLists.txt index 9c10d8a5..57a43048 100644 --- a/source/Irrlicht/CMakeLists.txt +++ b/source/Irrlicht/CMakeLists.txt @@ -42,6 +42,20 @@ elseif(MSVC) endif() endif() +# Sanity-check version + +include(CheckCXXSourceCompiles) +set(CMAKE_REQUIRED_INCLUDES ${PROJECT_SOURCE_DIR}/include) +unset(REVISION_SANITY_CHECK CACHE) +check_cxx_source_compiles("#include \n\ +#if IRRLICHT_VERSION_MT_REVISION != ${IRRLICHTMT_REVISION}\n\ +#error\n\ +#endif\n\ +int main() {}" REVISION_SANITY_CHECK) +if(NOT REVISION_SANITY_CHECK) + message(FATAL_ERROR "IrrlichtMt revision number mismatches between CMake and headers.") +endif() + # Required libs find_package(ZLIB REQUIRED) @@ -298,7 +312,6 @@ endif() set_target_properties(IrrlichtMt PROPERTIES VERSION ${PROJECT_VERSION} - SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} ) if(WIN32)