diff options
Diffstat (limited to 'contrib/cmake')
-rw-r--r-- | contrib/cmake/USCXMLMacros.cmake | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/contrib/cmake/USCXMLMacros.cmake b/contrib/cmake/USCXMLMacros.cmake index 76e1121..082caa0 100644 --- a/contrib/cmake/USCXMLMacros.cmake +++ b/contrib/cmake/USCXMLMacros.cmake @@ -59,15 +59,20 @@ endfunction() # see http://www.cmake.org/Wiki/CMakeCompareVersionStrings SET(THREE_PART_VERSION_REGEX "[0-9]+\\.[0-9]+\\.[0-9]+") +SET(TWO_PART_VERSION_REGEX "[0-9]+\\.[0-9]+") # Breaks up a string in the form n1.n2.n3 into three parts and stores # them in major, minor, and patch. version should be a value, not a # variable, while major, minor and patch should be variables. + MACRO(THREE_PART_VERSION_TO_VARS version major minor patch) IF(${version} MATCHES ${THREE_PART_VERSION_REGEX}) STRING(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" ${major} "${version}") STRING(REGEX REPLACE "^[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" ${minor} "${version}") STRING(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" ${patch} "${version}") + ELSEIF(${version} MATCHES ${TWO_PART_VERSION_REGEX}) + STRING(REGEX REPLACE "^([0-9]+)\\.[0-9]+" "\\1" ${major} "${version}") + STRING(REGEX REPLACE "^[0-9]+\\.([0-9])+" "\\1" ${minor} "${version}") ELSE(${version} MATCHES ${THREE_PART_VERSION_REGEX}) MESSAGE("MACRO(THREE_PART_VERSION_TO_VARS ${version} ${major} ${minor} ${patch}") MESSAGE(FATAL_ERROR "Problem parsing version string, I can't parse it properly.") |