summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2012-01-17 14:25:07 +0000
committerph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2012-01-17 14:25:07 +0000
commitfcba9dceadb5c9097c7532e9be06056a39a667e4 (patch)
treedea9570189b7b2ae269940fa1beae0c4c61136ca /CMakeLists.txt
parent40082f21b2da3123c04dd639d2ab25aaf3a4f8e6 (diff)
downloadpcre-fcba9dceadb5c9097c7532e9be06056a39a667e4.tar.gz
CMake parses version information out of configure.ac instead of relying on
pcre.h.generic. git-svn-id: svn://vcs.exim.org/pcre/code/trunk@886 2f5784b3-3f2a-0410-8824-cb99058d5e15
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt26
1 files changed, 24 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 01d70e8..c0ff97e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -54,6 +54,8 @@
# 2012-01-06 PH removed pcre_info.c and added pcre_string_utils.c
# 2012-01-10 Zoltan Herczeg added libpcre16 support
# 2012-01-13 Stephen Kelly added out of source build support
+# 2012-01-17 PH applied Stephen Kelly's patch to parse the version data out
+# of the configure.ac file
PROJECT(PCRE C CXX)
@@ -314,9 +316,29 @@ CONFIGURE_FILE(config-cmake.h.in
${PROJECT_BINARY_DIR}/config.h
@ONLY)
-CONFIGURE_FILE(pcre.h.generic
+# Parse version numbers and date out of configure.ac
+
+file(STRINGS ${PROJECT_SOURCE_DIR}/configure.ac
+ configure_lines
+ LIMIT_COUNT 50 # Read only the first 50 lines of the file
+)
+
+set(SEARCHED_VARIABLES "pcre_major" "pcre_minor" "pcre_prerelease" "pcre_date")
+foreach(configure_line ${configure_lines})
+ foreach(_substitution_variable ${SEARCHED_VARIABLES})
+ string(TOUPPER ${_substitution_variable} _substitution_variable_upper)
+ if (NOT ${_substitution_variable_upper})
+ string(REGEX MATCH "m4_define\\(${_substitution_variable}, \\[(.*)\\]" MACTHED_STRING ${configure_line})
+ if (CMAKE_MATCH_1)
+ set(${_substitution_variable_upper} ${CMAKE_MATCH_1})
+ endif()
+ endif()
+ endforeach()
+endforeach()
+
+CONFIGURE_FILE(pcre.h.in
${PROJECT_BINARY_DIR}/pcre.h
- COPYONLY)
+ @ONLY)
# What about pcre-config and libpcre.pc?