Commit 47b1d516 authored by Rolf Eike Beer's avatar Rolf Eike Beer

CMake: simplify parsing variables from configure

parent 4159bda6
......@@ -43,17 +43,13 @@ if (POLICY CMP0054)
endif(POLICY CMP0054)
# Read version information from configure.ac.
FILE(READ "${CMAKE_CURRENT_SOURCE_DIR}/configure.ac" configure)
STRING(REGEX REPLACE ";" "\\\\;" configure "${configure}")
STRING(REGEX REPLACE "\n" ";" configure "${configure}")
FILE(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/configure.ac" configure REGEX "^LIBTIFF_.*=")
foreach(line ${configure})
foreach(var LIBTIFF_MAJOR_VERSION LIBTIFF_MINOR_VERSION LIBTIFF_MICRO_VERSION LIBTIFF_ALPHA_VERSION
LIBTIFF_CURRENT LIBTIFF_REVISION LIBTIFF_AGE)
if(NOT ${var})
string(REGEX MATCH "^${var}=(.*)" ${var}_MATCH "${line}")
if(${var}_MATCH)
string(REGEX REPLACE "^${var}=(.*)" "\\1" ${var} "${line}")
endif()
if(NOT ${var} AND line MATCHES "^${var}=(.*)")
set(${var} "${CMAKE_MATCH_1}")
break()
endif()
endforeach()
endforeach()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment