Merge branch 'cmake-parse' into 'master'
CMake: simplify parsing variables from configure See merge request libtiff/libtiff!98
This commit is contained in:
commit
4ef21c27c9
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user