diff options
author | Konstantin Podsvirov <konstantin@podsvirov.pro> | 2019-07-24 19:24:00 +0300 |
---|---|---|
committer | Konstantin Podsvirov <konstantin@podsvirov.pro> | 2019-07-24 19:24:00 +0300 |
commit | 731424c837057bc5959e184541ddaec74785728f (patch) | |
tree | e0a966bbceb9879af55bd4c6a3f4d0b830f4ccc3 /CMakeLists.txt | |
parent | f0926b394144cbf11bcdfe65892624b1f4e0cc72 (diff) | |
download | colm-731424c837057bc5959e184541ddaec74785728f.tar.gz |
cmake read configuration from configure.ac
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 89bc5c68..430c7ee4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,23 @@ cmake_minimum_required(VERSION 3.0) -project(colm - VERSION 0.13.0.5 +# Read project configuration from configure.ac file +file(STRINGS configure.ac _PROJECT_CONFIGS + REGEX "(AC_INIT\\()|(PUBDATE=)") +foreach(_PROJECT_CONFIG ${_PROJECT_CONFIGS}) + if(_PROJECT_CONFIG MATCHES "AC_INIT\\(([^,]+)") + string(STRIP ${CMAKE_MATCH_1} PROJECT_NAME) + endif() + if(_PROJECT_CONFIG MATCHES "AC_INIT\\([^,]+,([^\\)]+)") + string(STRIP ${CMAKE_MATCH_1} PROJECT_VERSION) + endif() + if(_PROJECT_CONFIG MATCHES "PUBDATE=\"([^\"]+)") + string(STRIP ${CMAKE_MATCH_1} PROJECT_PUBDATE) + endif() +endforeach() + +project(${PROJECT_NAME} + VERSION ${PROJECT_VERSION} LANGUAGES C CXX) -set(PROJECT_PUBDATE "May 2017") set(${PROJECT_NAME}_MAKE_INSTALL ON CACHE BOOL "Set to OFF to disable install rules (default is ON)") |