--- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,7 @@ cmake_minimum_required(VERSION 3.13) project(sdbus-c++ VERSION 0.8.2 LANGUAGES C CXX) include(GNUInstallDirs) # Installation directories for `install` command and pkgconfig file +include(CMakeParseArguments) #------------------------------- # PERFORMING CHECKS & PREPARING THE DEPENDENCIES @@ -23,7 +24,11 @@ if(NOT BUILD_LIBSYSTEMD) "and building libsystemd in as part of sdbus-c++ during configuration)") endif() add_library(Systemd::Libsystemd ALIAS PkgConfig::Systemd) - set(LIBSYSTEMD_VERSION ${Systemd_VERSION}) + if( Systemd_VERSION MATCHES "^(0|[1-9][0-9]*)([.](0|[1-9][0-9]*))?$" ) + set( LIBSYSTEMD_VERSION "${CMAKE_MATCH_1}" ) + else() + message( FATAL_ERROR "Couldn't parse libsystemd version" ) + endif() else() # Build static libsystemd library as an external project include(cmake/LibsystemdExternalProject.cmake)