From f30f9a500c5e5aeb053c41307dab9987735570dd Mon Sep 17 00:00:00 2001 From: Ondrej Balaz Date: Fri, 11 Nov 2011 19:13:55 +0000 Subject: [PATCH 1/2] 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". --- Modules/FindBISON.cmake | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Modules/FindBISON.cmake b/Modules/FindBISON.cmake index e855a27eb..25fd51de6 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 From 20cb5edbcaaf89c35638911c27e6aec1c7fc022f Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Fri, 18 Nov 2011 16:14:54 +0100 Subject: [PATCH 2/2] FindBISON: Fix matching output of "bison --version" The output may contain semicolons, which will confuse the IF() because of missing quoting. --- Modules/FindBISON.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/FindBISON.cmake b/Modules/FindBISON.cmake index 25fd51de6..edde9eb96 100644 --- a/Modules/FindBISON.cmake +++ b/Modules/FindBISON.cmake @@ -68,11 +68,11 @@ IF(BISON_EXECUTABLE) MESSAGE(SEND_ERROR "Command \"${BISON_EXECUTABLE} --version\" failed with output:\n${BISON_version_error}") ELSE() # Bison++ - IF(${BISON_version_output} MATCHES "^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[^+]") + ELSEIF("${BISON_version_output}" MATCHES "^bison[^+]") STRING(REGEX REPLACE "^bison \\(GNU Bison\\) ([^\n]+)\n.*" "\\1" BISON_VERSION "${BISON_version_output}") ELSE()