aboutsummaryrefslogtreecommitdiff
path: root/cmake/FindSphinx.cmake
diff options
context:
space:
mode:
authorJoakim Soderberg <joakim.soderberg@gmail.com>2013-05-06 12:31:29 +0000
committerJoakim Soderberg <joakim.soderberg@gmail.com>2013-05-06 12:31:29 +0000
commit42d398243d306b7dfcd75b9479438ce4372a1cef (patch)
treec039d4e45bdeaf9a7d5d0a91eb91392c73038592 /cmake/FindSphinx.cmake
parentf675514815323277dbffa15f1aba92bdbc704540 (diff)
downloadjansson-42d398243d306b7dfcd75b9479438ce4372a1cef.zip
jansson-42d398243d306b7dfcd75b9479438ce4372a1cef.tar.gz
jansson-42d398243d306b7dfcd75b9479438ce4372a1cef.tar.bz2
Fix the cmake Sphinx find script.
The cmake sphinx find script version parsing assumes a format of 1.2.3, but sphinx version can be 1.2b3 as well, so parse those correctly as well.
Diffstat (limited to 'cmake/FindSphinx.cmake')
-rw-r--r--cmake/FindSphinx.cmake14
1 files changed, 9 insertions, 5 deletions
diff --git a/cmake/FindSphinx.cmake b/cmake/FindSphinx.cmake
index 6eac499..55539d4 100644
--- a/cmake/FindSphinx.cmake
+++ b/cmake/FindSphinx.cmake
@@ -257,12 +257,16 @@ if (Sphinx-build_EXECUTABLE)
ERROR_VARIABLE _Sphinx_VERSION
)
endif ()
- if (_Sphinx_VERSION MATCHES "Sphinx v([0-9]+\\.[0-9]+\\.[0-9]+)")
+
+ # The sphinx version can also contain a "b" instead of the last dot.
+ # For example "Sphinx v1.2b1" so we cannot just split on "."
+ if (_Sphinx_VERSION MATCHES "Sphinx v([0-9]+\\.[0-9]+(\\.|b)[0-9]+)")
set (Sphinx_VERSION_STRING "${CMAKE_MATCH_1}")
- string (REPLACE "." ";" _Sphinx_VERSION "${Sphinx_VERSION_STRING}")
- list(GET _Sphinx_VERSION 0 Sphinx_VERSION_MAJOR)
- list(GET _Sphinx_VERSION 1 Sphinx_VERSION_MINOR)
- list(GET _Sphinx_VERSION 2 Sphinx_VERSION_PATCH)
+ string(REGEX REPLACE "([0-9]+)\\.[0-9]+(\\.|b)[0-9]+" "\\1" Sphinx_VERSION_MAJOR ${Sphinx_VERSION_STRING})
+ string(REGEX REPLACE "[0-9]+\\.([0-9]+)(\\.|b)[0-9]+" "\\1" Sphinx_VERSION_MINOR ${Sphinx_VERSION_STRING})
+ string(REGEX REPLACE "[0-9]+\\.[0-9]+(\\.|b)([0-9]+)" "\\1" Sphinx_VERSION_PATCH ${Sphinx_VERSION_STRING})
+
+ # v1.2.0 -> v1.2
if (Sphinx_VERSION_PATCH EQUAL 0)
string (REGEX REPLACE "\\.0$" "" Sphinx_VERSION_STRING "${Sphinx_VERSION_STRING}")
endif ()