Include revision in SOVERSION for (in)compatibility checks

This commit is contained in:
sfan5 2022-07-21 19:49:36 +02:00
parent 51f0acb7c1
commit f6ec00e1c4
2 changed files with 17 additions and 2 deletions

View File

@ -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
)

View File

@ -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 <IrrCompileConfig.h>\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)