summaryrefslogtreecommitdiff
path: root/Modules/FindBISON.cmake
diff options
context:
space:
mode:
authorOndrej Balaz <ondra@blami.net>2011-11-11 19:13:55 +0000
committerBrad King <brad.king@kitware.com>2011-11-11 16:50:23 -0500
commitf30f9a500c5e5aeb053c41307dab9987735570dd (patch)
treeb6045f279140a671f71832207b6ce6040aec3601 /Modules/FindBISON.cmake
parent437deb33563b2011f3713e51cf53671780534ef1 (diff)
downloadcmake-f30f9a500c5e5aeb053c41307dab9987735570dd.tar.gz
FindBISON: Fix bison++ version parsing to avoid "Offending entry"
I've just found out that use of FindBISON.cmake shipped with CMake 2.8 on system where bison++ is default bison executable (e.g. Debian Linux) will result in corrupted CMakeCache.txt file and parse error due to "Offending entry" As FindBISON.cmake logic used to obtain installed bison executable version is tailored to match only the message used in GNU Bison it fails on absolutely different Bison++ version message and whole version message including \n characters is stored into BISON_VERSION which is then dumped into CMakeCache.txt, so everything after first \n character makes "Offending entry".
Diffstat (limited to 'Modules/FindBISON.cmake')
-rw-r--r--Modules/FindBISON.cmake13
1 files changed, 11 insertions, 2 deletions
diff --git a/Modules/FindBISON.cmake b/Modules/FindBISON.cmake
index e855a27ebc..25fd51de6d 100644
--- a/Modules/FindBISON.cmake
+++ b/Modules/FindBISON.cmake
@@ -67,8 +67,17 @@ IF(BISON_EXECUTABLE)
IF(NOT ${BISON_version_result} EQUAL 0)
MESSAGE(SEND_ERROR "Command \"${BISON_EXECUTABLE} --version\" failed with output:\n${BISON_version_error}")
ELSE()
- STRING(REGEX REPLACE "^bison \\(GNU Bison\\) ([^\n]+)\n.*" "\\1"
- BISON_VERSION "${BISON_version_output}")
+ # Bison++
+ IF(${BISON_version_output} MATCHES "^bison\\+\\+")
+ STRING(REGEX REPLACE "^bison\\+\\+ Version ([^,]+).*" "\\1"
+ BISON_VERSION "${BISON_version_output}")
+ # GNU Bison
+ ELSEIF(${BISON_version_output} MATCHES "^bison[^+]")
+ STRING(REGEX REPLACE "^bison \\(GNU Bison\\) ([^\n]+)\n.*" "\\1"
+ BISON_VERSION "${BISON_version_output}")
+ ELSE()
+ SET(BISON_VERSION "unknown")
+ ENDIF()
ENDIF()
# internal macro