diff options
author | Even Rouault <even.rouault@spatialys.com> | 2019-11-15 22:02:02 +0000 |
---|---|---|
committer | Even Rouault <even.rouault@spatialys.com> | 2019-11-15 22:02:02 +0000 |
commit | 4ef21c27c9a31c8d8dd007d2138af6aa13a23f56 (patch) | |
tree | 99d422335417a0b37f08019cbd3959b610ca4d81 | |
parent | 4159bda6db2f8cf8e848d8095b5d37d49ba67a10 (diff) | |
parent | 47b1d516d30204069e18a5db2da1060092510711 (diff) | |
download | libtiff-git-4ef21c27c9a31c8d8dd007d2138af6aa13a23f56.tar.gz |
Merge branch 'cmake-parse' into 'master'
CMake: simplify parsing variables from configure
See merge request libtiff/libtiff!98
-rw-r--r-- | CMakeLists.txt | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 35b48770..d0285be0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() |