Clean up usage of if(... MATCHES regex) followed string(REGEX REPLACE regex)
The matches have already been calculated and can simply be taken from CMAKE_MATCH_n variables. This avoids multiple compilations of the same or very similar regular expressions.
This commit is contained in:
parent
11a6b3d59a
commit
2622bc3f65
|
@ -53,10 +53,10 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
|
||||||
file(STRINGS "${BIN}" ABI_STRINGS LIMIT_COUNT 2 REGEX "INFO:[^[]*\\[")
|
file(STRINGS "${BIN}" ABI_STRINGS LIMIT_COUNT 2 REGEX "INFO:[^[]*\\[")
|
||||||
foreach(info ${ABI_STRINGS})
|
foreach(info ${ABI_STRINGS})
|
||||||
if("${info}" MATCHES ".*INFO:sizeof_dptr\\[0*([^]]*)\\].*")
|
if("${info}" MATCHES ".*INFO:sizeof_dptr\\[0*([^]]*)\\].*")
|
||||||
string(REGEX REPLACE ".*INFO:sizeof_dptr\\[0*([^]]*)\\].*" "\\1" ABI_SIZEOF_DPTR "${info}")
|
set(ABI_SIZEOF_DPTR "${CMAKE_MATCH_1}")
|
||||||
endif()
|
endif()
|
||||||
if("${info}" MATCHES ".*INFO:abi\\[([^]]*)\\].*")
|
if("${info}" MATCHES ".*INFO:abi\\[([^]]*)\\].*")
|
||||||
string(REGEX REPLACE ".*INFO:abi\\[([^]]*)\\].*" "\\1" ABI_NAME "${info}")
|
set(ABI_NAME "${CMAKE_MATCH_1}")
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
|
|
@ -360,28 +360,23 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
|
||||||
if(COMPILER_ID)
|
if(COMPILER_ID)
|
||||||
set(COMPILER_ID_TWICE 1)
|
set(COMPILER_ID_TWICE 1)
|
||||||
endif()
|
endif()
|
||||||
string(REGEX REPLACE ".*INFO:compiler\\[([^]]*)\\].*" "\\1"
|
set(COMPILER_ID "${CMAKE_MATCH_1}")
|
||||||
COMPILER_ID "${info}")
|
|
||||||
endif()
|
endif()
|
||||||
if("${info}" MATCHES ".*INFO:platform\\[([^]\"]*)\\].*")
|
if("${info}" MATCHES ".*INFO:platform\\[([^]\"]*)\\].*")
|
||||||
string(REGEX REPLACE ".*INFO:platform\\[([^]]*)\\].*" "\\1"
|
set(PLATFORM_ID "${CMAKE_MATCH_1}")
|
||||||
PLATFORM_ID "${info}")
|
|
||||||
endif()
|
endif()
|
||||||
if("${info}" MATCHES ".*INFO:arch\\[([^]\"]*)\\].*")
|
if("${info}" MATCHES ".*INFO:arch\\[([^]\"]*)\\].*")
|
||||||
string(REGEX REPLACE ".*INFO:arch\\[([^]]*)\\].*" "\\1"
|
set(ARCHITECTURE_ID "${CMAKE_MATCH_1}")
|
||||||
ARCHITECTURE_ID "${info}")
|
|
||||||
endif()
|
endif()
|
||||||
if("${info}" MATCHES ".*INFO:compiler_version\\[([^]\"]*)\\].*")
|
if("${info}" MATCHES ".*INFO:compiler_version\\[([^]\"]*)\\].*")
|
||||||
string(REGEX REPLACE ".*INFO:compiler_version\\[([^]]*)\\].*" "\\1" COMPILER_VERSION "${info}")
|
string(REGEX REPLACE "^0+([0-9])" "\\1" COMPILER_VERSION "${CMAKE_MATCH_1}")
|
||||||
string(REGEX REPLACE "^0+([0-9])" "\\1" COMPILER_VERSION "${COMPILER_VERSION}")
|
|
||||||
string(REGEX REPLACE "\\.0+([0-9])" ".\\1" COMPILER_VERSION "${COMPILER_VERSION}")
|
string(REGEX REPLACE "\\.0+([0-9])" ".\\1" COMPILER_VERSION "${COMPILER_VERSION}")
|
||||||
endif()
|
endif()
|
||||||
if("${info}" MATCHES ".*INFO:simulate\\[([^]\"]*)\\].*")
|
if("${info}" MATCHES ".*INFO:simulate\\[([^]\"]*)\\].*")
|
||||||
set(SIMULATE_ID "${CMAKE_MATCH_1}")
|
set(SIMULATE_ID "${CMAKE_MATCH_1}")
|
||||||
endif()
|
endif()
|
||||||
if("${info}" MATCHES ".*INFO:simulate_version\\[([^]\"]*)\\].*")
|
if("${info}" MATCHES ".*INFO:simulate_version\\[([^]\"]*)\\].*")
|
||||||
set(SIMULATE_VERSION "${CMAKE_MATCH_1}")
|
string(REGEX REPLACE "^0+([0-9])" "\\1" SIMULATE_VERSION "${CMAKE_MATCH_1}")
|
||||||
string(REGEX REPLACE "^0+([0-9])" "\\1" SIMULATE_VERSION "${SIMULATE_VERSION}")
|
|
||||||
string(REGEX REPLACE "\\.0+([0-9])" ".\\1" SIMULATE_VERSION "${SIMULATE_VERSION}")
|
string(REGEX REPLACE "\\.0+([0-9])" ".\\1" SIMULATE_VERSION "${SIMULATE_VERSION}")
|
||||||
endif()
|
endif()
|
||||||
if("${info}" MATCHES ".*INFO:qnxnto")
|
if("${info}" MATCHES ".*INFO:qnxnto")
|
||||||
|
|
|
@ -64,10 +64,9 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
|
||||||
string(REGEX REPLACE "^-L" "" dir "${arg}")
|
string(REGEX REPLACE "^-L" "" dir "${arg}")
|
||||||
list(APPEND implicit_dirs_tmp ${dir})
|
list(APPEND implicit_dirs_tmp ${dir})
|
||||||
set(log "${log} arg [${arg}] ==> dir [${dir}]\n")
|
set(log "${log} arg [${arg}] ==> dir [${dir}]\n")
|
||||||
elseif("${arg}" MATCHES "^-l[^:]")
|
elseif("${arg}" MATCHES "^-l([^:].*)$")
|
||||||
# Unix library.
|
# Unix library.
|
||||||
string(REGEX REPLACE "^-l" "" lib "${arg}")
|
list(APPEND implicit_libs_tmp ${CMAKE_MATCH_1})
|
||||||
list(APPEND implicit_libs_tmp ${lib})
|
|
||||||
set(log "${log} arg [${arg}] ==> lib [${lib}]\n")
|
set(log "${log} arg [${arg}] ==> lib [${lib}]\n")
|
||||||
elseif("${arg}" MATCHES "^(.:)?[/\\].*\\.a$")
|
elseif("${arg}" MATCHES "^(.:)?[/\\].*\\.a$")
|
||||||
# Unix library full path.
|
# Unix library full path.
|
||||||
|
@ -97,11 +96,10 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
break()
|
break()
|
||||||
elseif("${line}" MATCHES "LPATH(=| is:? )")
|
elseif("${line}" MATCHES "LPATH(=| is:? *)(.*)$")
|
||||||
set(log "${log} LPATH line: [${line}]\n")
|
set(log "${log} LPATH line: [${line}]\n")
|
||||||
# HP search path.
|
# HP search path.
|
||||||
string(REGEX REPLACE ".*LPATH(=| is:? *)" "" paths "${line}")
|
string(REPLACE ":" ";" paths "${CMAKE_MATCH_2}")
|
||||||
string(REPLACE ":" ";" paths "${paths}")
|
|
||||||
list(APPEND implicit_dirs_tmp ${paths})
|
list(APPEND implicit_dirs_tmp ${paths})
|
||||||
set(log "${log} dirs [${paths}]\n")
|
set(log "${log} dirs [${paths}]\n")
|
||||||
else()
|
else()
|
||||||
|
|
|
@ -142,7 +142,7 @@ function(__check_type_size_impl type var map builtin language)
|
||||||
foreach(info ${strings})
|
foreach(info ${strings})
|
||||||
if("${info}" MATCHES "${regex_size}")
|
if("${info}" MATCHES "${regex_size}")
|
||||||
# Get the type size.
|
# Get the type size.
|
||||||
string(REGEX REPLACE "${regex_size}" "\\1" size "${info}")
|
set(size "${CMAKE_MATCH_1}")
|
||||||
if(first)
|
if(first)
|
||||||
set(${var} ${size})
|
set(${var} ${size})
|
||||||
elseif(NOT "${size}" STREQUAL "${${var}}")
|
elseif(NOT "${size}" STREQUAL "${${var}}")
|
||||||
|
|
|
@ -292,8 +292,7 @@ function(ExternalData_expand_arguments target outArgsVar)
|
||||||
foreach(piece IN LISTS pieces)
|
foreach(piece IN LISTS pieces)
|
||||||
if("x${piece}" MATCHES "^x${data_regex}$")
|
if("x${piece}" MATCHES "^x${data_regex}$")
|
||||||
# Replace this DATA{}-piece with a file path.
|
# Replace this DATA{}-piece with a file path.
|
||||||
string(REGEX REPLACE "${data_regex}" "\\1" data "${piece}")
|
_ExternalData_arg("${target}" "${piece}" "${CMAKE_MATCH_1}" file)
|
||||||
_ExternalData_arg("${target}" "${piece}" "${data}" file)
|
|
||||||
set(outArg "${outArg}${file}")
|
set(outArg "${outArg}${file}")
|
||||||
else()
|
else()
|
||||||
# No replacement needed for this piece.
|
# No replacement needed for this piece.
|
||||||
|
@ -428,10 +427,9 @@ function(_ExternalData_arg target arg options var_file)
|
||||||
set(associated_files "")
|
set(associated_files "")
|
||||||
set(associated_regex "")
|
set(associated_regex "")
|
||||||
foreach(opt ${options})
|
foreach(opt ${options})
|
||||||
if("x${opt}" MATCHES "^xREGEX:[^:/]+$")
|
# Regular expression to match associated files.
|
||||||
# Regular expression to match associated files.
|
if("x${opt}" MATCHES "^xREGEX:([^:/]+)$")
|
||||||
string(REGEX REPLACE "^REGEX:" "" regex "${opt}")
|
list(APPEND associated_regex "${CMAKE_MATCH_1}")
|
||||||
list(APPEND associated_regex "${regex}")
|
|
||||||
elseif(opt STREQUAL ":")
|
elseif(opt STREQUAL ":")
|
||||||
# Activate series matching.
|
# Activate series matching.
|
||||||
set(series_option "${opt}")
|
set(series_option "${opt}")
|
||||||
|
|
|
@ -201,11 +201,11 @@ file(STRINGS "${CMAKE_CURRENT_LIST_FILE}" lines
|
||||||
LIMIT_COUNT ${_ep_documentation_line_count}
|
LIMIT_COUNT ${_ep_documentation_line_count}
|
||||||
REGEX "^# ( \\[[A-Z0-9_]+ [^]]*\\] +#.*$|[A-Za-z0-9_]+\\()")
|
REGEX "^# ( \\[[A-Z0-9_]+ [^]]*\\] +#.*$|[A-Za-z0-9_]+\\()")
|
||||||
foreach(line IN LISTS lines)
|
foreach(line IN LISTS lines)
|
||||||
if("${line}" MATCHES "^# [A-Za-z0-9_]+\\(")
|
if("${line}" MATCHES "^# ([A-Za-z0-9_]+)\\(")
|
||||||
if(_ep_func)
|
if(_ep_func)
|
||||||
set(_ep_keywords_${_ep_func} "${_ep_keywords_${_ep_func}})$")
|
set(_ep_keywords_${_ep_func} "${_ep_keywords_${_ep_func}})$")
|
||||||
endif()
|
endif()
|
||||||
string(REGEX REPLACE "^# ([A-Za-z0-9_]+)\\(.*" "\\1" _ep_func "${line}")
|
set(_ep_func "${CMAKE_MATCH_1}")
|
||||||
#message("function [${_ep_func}]")
|
#message("function [${_ep_func}]")
|
||||||
set(_ep_keywords_${_ep_func} "^(")
|
set(_ep_keywords_${_ep_func} "^(")
|
||||||
set(_ep_keyword_sep)
|
set(_ep_keyword_sep)
|
||||||
|
@ -907,7 +907,8 @@ function(_ep_write_initial_cache target_name script_filename args)
|
||||||
set(regex "^([^:]+):([^=]+)=(.*)$")
|
set(regex "^([^:]+):([^=]+)=(.*)$")
|
||||||
set(setArg "")
|
set(setArg "")
|
||||||
foreach(line ${args})
|
foreach(line ${args})
|
||||||
if("${line}" MATCHES "^-D")
|
if("${line}" MATCHES "^-D(.*)")
|
||||||
|
set(line "${CMAKE_MATCH_1}")
|
||||||
if(setArg)
|
if(setArg)
|
||||||
# This is required to build up lists in variables, or complete an entry
|
# This is required to build up lists in variables, or complete an entry
|
||||||
set(setArg "${setArg}${accumulator}\" CACHE ${type} \"Initial cache\" FORCE)")
|
set(setArg "${setArg}${accumulator}\" CACHE ${type} \"Initial cache\" FORCE)")
|
||||||
|
@ -915,9 +916,7 @@ function(_ep_write_initial_cache target_name script_filename args)
|
||||||
set(accumulator "")
|
set(accumulator "")
|
||||||
set(setArg "")
|
set(setArg "")
|
||||||
endif()
|
endif()
|
||||||
string(REGEX REPLACE "^-D" "" line ${line})
|
|
||||||
if("${line}" MATCHES "${regex}")
|
if("${line}" MATCHES "${regex}")
|
||||||
string(REGEX MATCH "${regex}" match "${line}")
|
|
||||||
set(name "${CMAKE_MATCH_1}")
|
set(name "${CMAKE_MATCH_1}")
|
||||||
set(type "${CMAKE_MATCH_2}")
|
set(type "${CMAKE_MATCH_2}")
|
||||||
set(value "${CMAKE_MATCH_3}")
|
set(value "${CMAKE_MATCH_3}")
|
||||||
|
|
|
@ -92,16 +92,13 @@ if(BISON_EXECUTABLE)
|
||||||
message(SEND_ERROR "Command \"${BISON_EXECUTABLE} --version\" failed with output:\n${BISON_version_error}")
|
message(SEND_ERROR "Command \"${BISON_EXECUTABLE} --version\" failed with output:\n${BISON_version_error}")
|
||||||
else()
|
else()
|
||||||
# Bison++
|
# Bison++
|
||||||
if("${BISON_version_output}" MATCHES "^bison\\+\\+")
|
if("${BISON_version_output}" MATCHES "^bison\\+\\+ Version ([^,]+)")
|
||||||
string(REGEX REPLACE "^bison\\+\\+ Version ([^,]+).*" "\\1"
|
set(BISON_VERSION "${CMAKE_MATCH_1}")
|
||||||
BISON_VERSION "${BISON_version_output}")
|
|
||||||
# GNU Bison
|
# GNU Bison
|
||||||
elseif("${BISON_version_output}" MATCHES "^bison[^+]")
|
elseif("${BISON_version_output}" MATCHES "^bison \\(GNU Bison\\) ([^\n]+)\n")
|
||||||
string(REGEX REPLACE "^bison \\(GNU Bison\\) ([^\n]+)\n.*" "\\1"
|
set(BISON_VERSION "${CMAKE_MATCH_1}")
|
||||||
BISON_VERSION "${BISON_version_output}")
|
elseif("${BISON_version_output}" MATCHES "^GNU Bison (version )?([^\n]+)")
|
||||||
elseif("${BISON_version_output}" MATCHES "^GNU Bison ")
|
set(BISON_VERSION "${CMAKE_MATCH_2}")
|
||||||
string(REGEX REPLACE "^GNU Bison (version )?([^\n]+).*" "\\2"
|
|
||||||
BISON_VERSION "${BISON_version_output}")
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -631,12 +631,12 @@ if(NOT Boost_INCLUDE_DIR)
|
||||||
set(_boost_BOOSTIFIED_VERSION)
|
set(_boost_BOOSTIFIED_VERSION)
|
||||||
|
|
||||||
# Transform 1.35 => 1_35 and 1.36.0 => 1_36_0
|
# Transform 1.35 => 1_35 and 1.36.0 => 1_36_0
|
||||||
if(_boost_VER MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+")
|
if(_boost_VER MATCHES "([0-9]+)\\.([0-9]+)\\.([0-9]+)")
|
||||||
string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1_\\2_\\3"
|
set(_boost_BOOSTIFIED_VERSION
|
||||||
_boost_BOOSTIFIED_VERSION ${_boost_VER})
|
"${CMAKE_MATCH_1}_${CMAKE_MATCH_2}_${CMAKE_MATCH_3}")
|
||||||
elseif(_boost_VER MATCHES "[0-9]+\\.[0-9]+")
|
elseif(_boost_VER MATCHES "([0-9]+)\\.([0-9]+)")
|
||||||
string(REGEX REPLACE "([0-9]+)\\.([0-9]+)" "\\1_\\2"
|
set(_boost_BOOSTIFIED_VERSION
|
||||||
_boost_BOOSTIFIED_VERSION ${_boost_VER})
|
"${CMAKE_MATCH_1}_${CMAKE_MATCH_2}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
list(APPEND _boost_PATH_SUFFIXES
|
list(APPEND _boost_PATH_SUFFIXES
|
||||||
|
|
|
@ -57,7 +57,7 @@ if (${file_text} MATCHES ".+")
|
||||||
|
|
||||||
# Extract kernel names.
|
# Extract kernel names.
|
||||||
if (${entry} MATCHES "[^g]name = ([^ ]+)")
|
if (${entry} MATCHES "[^g]name = ([^ ]+)")
|
||||||
string(REGEX REPLACE ".* = ([^ ]+)" "\\1" entry ${entry})
|
set(entry "${CMAKE_MATCH_1}")
|
||||||
|
|
||||||
# Check to see if the kernel name starts with "_"
|
# Check to see if the kernel name starts with "_"
|
||||||
set(skip FALSE)
|
set(skip FALSE)
|
||||||
|
@ -76,19 +76,19 @@ if (${file_text} MATCHES ".+")
|
||||||
|
|
||||||
# Registers
|
# Registers
|
||||||
if (${entry} MATCHES "reg([ ]+)=([ ]+)([^ ]+)")
|
if (${entry} MATCHES "reg([ ]+)=([ ]+)([^ ]+)")
|
||||||
string(REGEX REPLACE ".*([ ]+)=([ ]+)([^ ]+)" "\\3" entry ${entry})
|
set(entry "${CMAKE_MATCH_3}")
|
||||||
message("Registers: ${entry}")
|
message("Registers: ${entry}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Local memory
|
# Local memory
|
||||||
if (${entry} MATCHES "lmem([ ]+)=([ ]+)([^ ]+)")
|
if (${entry} MATCHES "lmem([ ]+)=([ ]+)([^ ]+)")
|
||||||
string(REGEX REPLACE ".*([ ]+)=([ ]+)([^ ]+)" "\\3" entry ${entry})
|
set(entry "${CMAKE_MATCH_3}")
|
||||||
message("Local: ${entry}")
|
message("Local: ${entry}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Shared memory
|
# Shared memory
|
||||||
if (${entry} MATCHES "smem([ ]+)=([ ]+)([^ ]+)")
|
if (${entry} MATCHES "smem([ ]+)=([ ]+)([^ ]+)")
|
||||||
string(REGEX REPLACE ".*([ ]+)=([ ]+)([^ ]+)" "\\3" entry ${entry})
|
set(entry "${CMAKE_MATCH_3}")
|
||||||
message("Shared: ${entry}")
|
message("Shared: ${entry}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -52,9 +52,8 @@ if (CUPS_INCLUDE_DIR AND EXISTS "${CUPS_INCLUDE_DIR}/cups/cups.h")
|
||||||
unset(CUPS_VERSION_STRING)
|
unset(CUPS_VERSION_STRING)
|
||||||
foreach(VPART MAJOR MINOR PATCH)
|
foreach(VPART MAJOR MINOR PATCH)
|
||||||
foreach(VLINE ${cups_version_str})
|
foreach(VLINE ${cups_version_str})
|
||||||
if(VLINE MATCHES "^#[\t ]*define[\t ]+CUPS_VERSION_${VPART}")
|
if(VLINE MATCHES "^#[\t ]*define[\t ]+CUPS_VERSION_${VPART}[\t ]+([0-9]+)$")
|
||||||
string(REGEX REPLACE "^#[\t ]*define[\t ]+CUPS_VERSION_${VPART}[\t ]+([0-9]+)$" "\\1"
|
set(CUPS_VERSION_PART "${CMAKE_MATCH_1}")
|
||||||
CUPS_VERSION_PART "${VLINE}")
|
|
||||||
if(CUPS_VERSION_STRING)
|
if(CUPS_VERSION_STRING)
|
||||||
set(CUPS_VERSION_STRING "${CUPS_VERSION_STRING}.${CUPS_VERSION_PART}")
|
set(CUPS_VERSION_STRING "${CUPS_VERSION_STRING}.${CUPS_VERSION_PART}")
|
||||||
else()
|
else()
|
||||||
|
|
|
@ -38,9 +38,8 @@ if (EXPAT_INCLUDE_DIR AND EXISTS "${EXPAT_INCLUDE_DIR}/expat.h")
|
||||||
unset(EXPAT_VERSION_STRING)
|
unset(EXPAT_VERSION_STRING)
|
||||||
foreach(VPART MAJOR MINOR MICRO)
|
foreach(VPART MAJOR MINOR MICRO)
|
||||||
foreach(VLINE ${expat_version_str})
|
foreach(VLINE ${expat_version_str})
|
||||||
if(VLINE MATCHES "^#[\t ]*define[\t ]+XML_${VPART}_VERSION")
|
if(VLINE MATCHES "^#[\t ]*define[\t ]+XML_${VPART}_VERSION[\t ]+([0-9]+)$")
|
||||||
string(REGEX REPLACE "^#[\t ]*define[\t ]+XML_${VPART}_VERSION[\t ]+([0-9]+)$" "\\1"
|
set(EXPAT_VERSION_PART "${CMAKE_MATCH_1}")
|
||||||
EXPAT_VERSION_PART "${VLINE}")
|
|
||||||
if(EXPAT_VERSION_STRING)
|
if(EXPAT_VERSION_STRING)
|
||||||
set(EXPAT_VERSION_STRING "${EXPAT_VERSION_STRING}.${EXPAT_VERSION_PART}")
|
set(EXPAT_VERSION_STRING "${EXPAT_VERSION_STRING}.${EXPAT_VERSION_PART}")
|
||||||
else()
|
else()
|
||||||
|
|
|
@ -285,9 +285,7 @@ endif()
|
||||||
OUTPUT_VARIABLE FLTK_IMAGES_LDFLAGS)
|
OUTPUT_VARIABLE FLTK_IMAGES_LDFLAGS)
|
||||||
set(FLTK_LIBS_EXTRACT_REGEX ".*-lfltk_images (.*) -lfltk.*")
|
set(FLTK_LIBS_EXTRACT_REGEX ".*-lfltk_images (.*) -lfltk.*")
|
||||||
if("${FLTK_IMAGES_LDFLAGS}" MATCHES "${FLTK_LIBS_EXTRACT_REGEX}")
|
if("${FLTK_IMAGES_LDFLAGS}" MATCHES "${FLTK_LIBS_EXTRACT_REGEX}")
|
||||||
string(REGEX REPLACE "${FLTK_LIBS_EXTRACT_REGEX}" "\\1"
|
string(REGEX REPLACE " +" ";" FLTK_IMAGES_LIBS "${CMAKE_MATCH_1}")
|
||||||
FLTK_IMAGES_LIBS "${FLTK_IMAGES_LDFLAGS}")
|
|
||||||
string(REGEX REPLACE " +" ";" FLTK_IMAGES_LIBS "${FLTK_IMAGES_LIBS}")
|
|
||||||
# The EXEC_PROGRAM will not be inherited into subdirectories from
|
# The EXEC_PROGRAM will not be inherited into subdirectories from
|
||||||
# the file that originally included this module. Save the answer.
|
# the file that originally included this module. Save the answer.
|
||||||
set(FLTK_IMAGES_LIBS "${FLTK_IMAGES_LIBS}" CACHE INTERNAL
|
set(FLTK_IMAGES_LIBS "${FLTK_IMAGES_LIBS}" CACHE INTERNAL
|
||||||
|
|
|
@ -226,9 +226,7 @@ if(FLTK2_DIR)
|
||||||
OUTPUT_VARIABLE FLTK2_IMAGES_LDFLAGS)
|
OUTPUT_VARIABLE FLTK2_IMAGES_LDFLAGS)
|
||||||
set(FLTK2_LIBS_EXTRACT_REGEX ".*-lfltk2_images (.*) -lfltk2.*")
|
set(FLTK2_LIBS_EXTRACT_REGEX ".*-lfltk2_images (.*) -lfltk2.*")
|
||||||
if("${FLTK2_IMAGES_LDFLAGS}" MATCHES "${FLTK2_LIBS_EXTRACT_REGEX}")
|
if("${FLTK2_IMAGES_LDFLAGS}" MATCHES "${FLTK2_LIBS_EXTRACT_REGEX}")
|
||||||
string(REGEX REPLACE "${FLTK2_LIBS_EXTRACT_REGEX}" "\\1"
|
string(REGEX REPLACE " +" ";" FLTK2_IMAGES_LIBS "${CMAKE_MATCH_1}")
|
||||||
FLTK2_IMAGES_LIBS "${FLTK2_IMAGES_LDFLAGS}")
|
|
||||||
string(REGEX REPLACE " +" ";" FLTK2_IMAGES_LIBS "${FLTK2_IMAGES_LIBS}")
|
|
||||||
# The EXEC_PROGRAM will not be inherited into subdirectories from
|
# The EXEC_PROGRAM will not be inherited into subdirectories from
|
||||||
# the file that originally included this module. Save the answer.
|
# the file that originally included this module. Save the answer.
|
||||||
set(FLTK2_IMAGES_LIBS "${FLTK2_IMAGES_LIBS}" CACHE INTERNAL
|
set(FLTK2_IMAGES_LIBS "${FLTK2_IMAGES_LIBS}" CACHE INTERNAL
|
||||||
|
|
|
@ -117,9 +117,8 @@ if(FREETYPE_INCLUDE_DIR_freetype2 AND FREETYPE_H)
|
||||||
unset(FREETYPE_VERSION_STRING)
|
unset(FREETYPE_VERSION_STRING)
|
||||||
foreach(VPART MAJOR MINOR PATCH)
|
foreach(VPART MAJOR MINOR PATCH)
|
||||||
foreach(VLINE ${freetype_version_str})
|
foreach(VLINE ${freetype_version_str})
|
||||||
if(VLINE MATCHES "^#[\t ]*define[\t ]+FREETYPE_${VPART}")
|
if(VLINE MATCHES "^#[\t ]*define[\t ]+FREETYPE_${VPART}[\t ]+([0-9]+)$")
|
||||||
string(REGEX REPLACE "^#[\t ]*define[\t ]+FREETYPE_${VPART}[\t ]+([0-9]+)$" "\\1"
|
set(FREETYPE_VERSION_PART "${CMAKE_MATCH_1}")
|
||||||
FREETYPE_VERSION_PART "${VLINE}")
|
|
||||||
if(FREETYPE_VERSION_STRING)
|
if(FREETYPE_VERSION_STRING)
|
||||||
set(FREETYPE_VERSION_STRING "${FREETYPE_VERSION_STRING}.${FREETYPE_VERSION_PART}")
|
set(FREETYPE_VERSION_STRING "${FREETYPE_VERSION_STRING}.${FREETYPE_VERSION_PART}")
|
||||||
else()
|
else()
|
||||||
|
|
|
@ -71,8 +71,8 @@ if(GETTEXT_MSGMERGE_EXECUTABLE)
|
||||||
OUTPUT_VARIABLE gettext_version
|
OUTPUT_VARIABLE gettext_version
|
||||||
ERROR_QUIET
|
ERROR_QUIET
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
if (gettext_version MATCHES "^msgmerge \\(.*\\) [0-9]")
|
if (gettext_version MATCHES "^msgmerge \\([^\\)]*\\) ([0-9\\.]+[^ \n]*)")
|
||||||
string(REGEX REPLACE "^msgmerge \\([^\\)]*\\) ([0-9\\.]+[^ \n]*).*" "\\1" GETTEXT_VERSION_STRING "${gettext_version}")
|
set(GETTEXT_VERSION_STRING "${CMAKE_MATCH_1}")
|
||||||
endif()
|
endif()
|
||||||
unset(gettext_version)
|
unset(gettext_version)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -221,8 +221,8 @@ if(ImageMagick_mogrify_EXECUTABLE)
|
||||||
OUTPUT_VARIABLE imagemagick_version
|
OUTPUT_VARIABLE imagemagick_version
|
||||||
ERROR_QUIET
|
ERROR_QUIET
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
if(imagemagick_version MATCHES "^Version: ImageMagick [0-9]")
|
if(imagemagick_version MATCHES "^Version: ImageMagick ([-0-9\\.]+)")
|
||||||
string(REGEX REPLACE "^Version: ImageMagick ([-0-9\\.]+).*" "\\1" ImageMagick_VERSION_STRING "${imagemagick_version}")
|
set(ImageMagick_VERSION_STRING "${CMAKE_MATCH_1}")
|
||||||
endif()
|
endif()
|
||||||
unset(imagemagick_version)
|
unset(imagemagick_version)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -128,18 +128,15 @@ if(Java_JAVA_EXECUTABLE)
|
||||||
# 3. GCJ 1.5
|
# 3. GCJ 1.5
|
||||||
# 4. Kaffe 1.4.2
|
# 4. Kaffe 1.4.2
|
||||||
# 5. OpenJDK 1.7.x on OpenBSD
|
# 5. OpenJDK 1.7.x on OpenBSD
|
||||||
if(var MATCHES "java version \"[0-9]+\\.[0-9]+\\.[0-9_.]+.*\".*")
|
if(var MATCHES "java version \"([0-9]+\\.[0-9]+\\.[0-9_.]+.*)\"")
|
||||||
# This is most likely Sun / OpenJDK, or maybe GCJ-java compat layer
|
# This is most likely Sun / OpenJDK, or maybe GCJ-java compat layer
|
||||||
string( REGEX REPLACE ".* version \"([0-9]+\\.[0-9]+\\.[0-9_.]+.*)\".*"
|
set(Java_VERSION_STRING "${CMAKE_MATCH_1}")
|
||||||
"\\1" Java_VERSION_STRING "${var}" )
|
elseif(var MATCHES "java full version \"kaffe-([0-9]+\\.[0-9]+\\.[0-9_]+)\"")
|
||||||
elseif(var MATCHES "java full version \"kaffe-[0-9]+\\.[0-9]+\\.[0-9_]+\".*")
|
|
||||||
# Kaffe style
|
# Kaffe style
|
||||||
string( REGEX REPLACE "java full version \"kaffe-([0-9]+\\.[0-9]+\\.[0-9_]+).*"
|
set(Java_VERSION_STRING "${CMAKE_MATCH_1}")
|
||||||
"\\1" Java_VERSION_STRING "${var}" )
|
elseif(var MATCHES "openjdk version \"([0-9]+\\.[0-9]+\\.[0-9_]+)\"")
|
||||||
elseif(var MATCHES "openjdk version \"[0-9]+\\.[0-9]+\\.[0-9_]+\".*")
|
|
||||||
# OpenJDK ver 1.7.x on OpenBSD
|
# OpenJDK ver 1.7.x on OpenBSD
|
||||||
string( REGEX REPLACE "openjdk version \"([0-9]+\\.[0-9]+\\.[0-9_]+).*"
|
set(Java_VERSION_STRING "${CMAKE_MATCH_1}")
|
||||||
"\\1" Java_VERSION_STRING "${var}" )
|
|
||||||
else()
|
else()
|
||||||
if(NOT Java_FIND_QUIETLY)
|
if(NOT Java_FIND_QUIETLY)
|
||||||
message(WARNING "regex not supported: ${var}. Please report")
|
message(WARNING "regex not supported: ${var}. Please report")
|
||||||
|
|
|
@ -56,10 +56,8 @@ if(ZLIB_FOUND)
|
||||||
list(APPEND PNG_NAMES png libpng)
|
list(APPEND PNG_NAMES png libpng)
|
||||||
unset(PNG_NAMES_DEBUG)
|
unset(PNG_NAMES_DEBUG)
|
||||||
set(_PNG_VERSION_SUFFIXES 17 16 15 14 12)
|
set(_PNG_VERSION_SUFFIXES 17 16 15 14 12)
|
||||||
if (PNG_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\..*)?$")
|
if (PNG_FIND_VERSION MATCHES "^([0-9]+)\\.([0-9]+)(\\..*)?$")
|
||||||
string(REGEX REPLACE
|
set(_PNG_VERSION_SUFFIX_MIN "${CMAKE_MATCH_1}${CMAKE_MATCH_2}")
|
||||||
"^([0-9]+)\\.([0-9]+).*" "\\1\\2"
|
|
||||||
_PNG_VERSION_SUFFIX_MIN "${PNG_FIND_VERSION}")
|
|
||||||
if (PNG_FIND_VERSION_EXACT)
|
if (PNG_FIND_VERSION_EXACT)
|
||||||
set(_PNG_VERSION_SUFFIXES ${_PNG_VERSION_SUFFIX_MIN})
|
set(_PNG_VERSION_SUFFIXES ${_PNG_VERSION_SUFFIX_MIN})
|
||||||
else ()
|
else ()
|
||||||
|
|
|
@ -70,9 +70,9 @@ if(PERL_EXECUTABLE)
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
)
|
)
|
||||||
if(NOT PERL_VERSION_RESULT_VARIABLE AND PERL_VERSION_OUTPUT_VARIABLE MATCHES "This is perl.*[ \\(]v([0-9\\._]+)[ \\)]")
|
if(NOT PERL_VERSION_RESULT_VARIABLE AND PERL_VERSION_OUTPUT_VARIABLE MATCHES "This is perl.*[ \\(]v([0-9\\._]+)[ \\)]")
|
||||||
string(REGEX REPLACE ".*This is perl.*[ \\(]v([0-9\\._]+)[ \\)].*" "\\1" PERL_VERSION_STRING ${PERL_VERSION_OUTPUT_VARIABLE})
|
set(PERL_VERSION_STRING "${CMAKE_MATCH_1}")
|
||||||
elseif(NOT PERL_VERSION_RESULT_VARIABLE AND PERL_VERSION_OUTPUT_VARIABLE MATCHES "This is perl, version ([0-9\\._]+) +")
|
elseif(NOT PERL_VERSION_RESULT_VARIABLE AND PERL_VERSION_OUTPUT_VARIABLE MATCHES "This is perl, version ([0-9\\._]+) +")
|
||||||
string(REGEX REPLACE ".*This is perl, version ([0-9\\._]+) +.*" "\\1" PERL_VERSION_STRING ${PERL_VERSION_OUTPUT_VARIABLE})
|
set(PERL_VERSION_STRING "${CMAKE_MATCH_1}")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -277,10 +277,10 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma
|
||||||
set(_pkg_check_modules_exist_query)
|
set(_pkg_check_modules_exist_query)
|
||||||
|
|
||||||
# check whether version is given
|
# check whether version is given
|
||||||
if (_pkg_check_modules_pkg MATCHES ".*(>=|=|<=).*")
|
if (_pkg_check_modules_pkg MATCHES "(.*[^><])(>=|=|<=)(.*)")
|
||||||
string(REGEX REPLACE "(.*[^><])(>=|=|<=)(.*)" "\\1" _pkg_check_modules_pkg_name "${_pkg_check_modules_pkg}")
|
set(_pkg_check_modules_pkg_name "${CMAKE_MATCH_1}")
|
||||||
string(REGEX REPLACE "(.*[^><])(>=|=|<=)(.*)" "\\2" _pkg_check_modules_pkg_op "${_pkg_check_modules_pkg}")
|
set(_pkg_check_modules_pkg_op "${CMAKE_MATCH_2}")
|
||||||
string(REGEX REPLACE "(.*[^><])(>=|=|<=)(.*)" "\\3" _pkg_check_modules_pkg_ver "${_pkg_check_modules_pkg}")
|
set(_pkg_check_modules_pkg_ver "${CMAKE_MATCH_3}")
|
||||||
else()
|
else()
|
||||||
set(_pkg_check_modules_pkg_name "${_pkg_check_modules_pkg}")
|
set(_pkg_check_modules_pkg_name "${_pkg_check_modules_pkg}")
|
||||||
set(_pkg_check_modules_pkg_op)
|
set(_pkg_check_modules_pkg_op)
|
||||||
|
|
|
@ -138,8 +138,8 @@ if(PYTHON_EXECUTABLE)
|
||||||
string(REGEX REPLACE " .*" "" PYTHON_VERSION_STRING "${_VERSION}")
|
string(REGEX REPLACE " .*" "" PYTHON_VERSION_STRING "${_VERSION}")
|
||||||
string(REGEX REPLACE "^([0-9]+)\\.[0-9]+.*" "\\1" PYTHON_VERSION_MAJOR "${PYTHON_VERSION_STRING}")
|
string(REGEX REPLACE "^([0-9]+)\\.[0-9]+.*" "\\1" PYTHON_VERSION_MAJOR "${PYTHON_VERSION_STRING}")
|
||||||
string(REGEX REPLACE "^[0-9]+\\.([0-9])+.*" "\\1" PYTHON_VERSION_MINOR "${PYTHON_VERSION_STRING}")
|
string(REGEX REPLACE "^[0-9]+\\.([0-9])+.*" "\\1" PYTHON_VERSION_MINOR "${PYTHON_VERSION_STRING}")
|
||||||
if(PYTHON_VERSION_STRING MATCHES "^[0-9]+\\.[0-9]+\\.[0-9]+.*")
|
if(PYTHON_VERSION_STRING MATCHES "^[0-9]+\\.[0-9]+\\.([0-9]+)")
|
||||||
string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" PYTHON_VERSION_PATCH "${PYTHON_VERSION_STRING}")
|
set(PYTHON_VERSION_PATCH "${CMAKE_MATCH_1}")
|
||||||
else()
|
else()
|
||||||
set(PYTHON_VERSION_PATCH "0")
|
set(PYTHON_VERSION_PATCH "0")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -77,10 +77,9 @@ if(XMLRPC_FOUND)
|
||||||
# Look for -I options.
|
# Look for -I options.
|
||||||
set(XMLRPC_INCLUDE_DIRS)
|
set(XMLRPC_INCLUDE_DIRS)
|
||||||
foreach(flag ${XMLRPC_C_CONFIG_CFLAGS})
|
foreach(flag ${XMLRPC_C_CONFIG_CFLAGS})
|
||||||
if("${flag}" MATCHES "^-I")
|
if("${flag}" MATCHES "^-I(.+)")
|
||||||
string(REGEX REPLACE "^-I" "" DIR "${flag}")
|
file(TO_CMAKE_PATH "${CMAKE_MATCH_1}" DIR)
|
||||||
file(TO_CMAKE_PATH "${DIR}" DIR)
|
list(APPEND XMLRPC_INCLUDE_DIRS "${DIR}")
|
||||||
set(XMLRPC_INCLUDE_DIRS ${XMLRPC_INCLUDE_DIRS} "${DIR}")
|
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
else()
|
else()
|
||||||
|
@ -115,13 +114,11 @@ if(XMLRPC_FOUND)
|
||||||
set(XMLRPC_LIBRARY_DIRS)
|
set(XMLRPC_LIBRARY_DIRS)
|
||||||
set(XMLRPC_LIBRARY_NAMES)
|
set(XMLRPC_LIBRARY_NAMES)
|
||||||
foreach(flag ${XMLRPC_C_CONFIG_LIBS})
|
foreach(flag ${XMLRPC_C_CONFIG_LIBS})
|
||||||
if("${flag}" MATCHES "^-L")
|
if("${flag}" MATCHES "^-L(.+)")
|
||||||
string(REGEX REPLACE "^-L" "" DIR "${flag}")
|
file(TO_CMAKE_PATH "${CMAKE_MATCH_1}" DIR)
|
||||||
file(TO_CMAKE_PATH "${DIR}" DIR)
|
list(APPEND XMLRPC_LIBRARY_DIRS "${DIR}")
|
||||||
set(XMLRPC_LIBRARY_DIRS ${XMLRPC_LIBRARY_DIRS} "${DIR}")
|
elseif("${flag}" MATCHES "^-l(.+)")
|
||||||
elseif("${flag}" MATCHES "^-l")
|
list(APPEND XMLRPC_LIBRARY_NAMES "${CMAKE_MATCH_1}")
|
||||||
string(REGEX REPLACE "^-l" "" NAME "${flag}")
|
|
||||||
set(XMLRPC_LIBRARY_NAMES ${XMLRPC_LIBRARY_NAMES} "${NAME}")
|
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
|
|
@ -69,9 +69,8 @@ if(FortranCInterface_EXE)
|
||||||
file(STRINGS "${FortranCInterface_EXE}" _info_strings
|
file(STRINGS "${FortranCInterface_EXE}" _info_strings
|
||||||
LIMIT_COUNT 8 REGEX "INFO:[^[]*\\[")
|
LIMIT_COUNT 8 REGEX "INFO:[^[]*\\[")
|
||||||
foreach(info ${_info_strings})
|
foreach(info ${_info_strings})
|
||||||
if("${info}" MATCHES ".*INFO:symbol\\[([^]]*)\\].*")
|
if("${info}" MATCHES "INFO:symbol\\[([^]]*)\\]")
|
||||||
string(REGEX REPLACE ".*INFO:symbol\\[([^]]*)\\].*" "\\1" symbol "${info}")
|
list(APPEND FortranCInterface_SYMBOLS ${CMAKE_MATCH_1})
|
||||||
list(APPEND FortranCInterface_SYMBOLS ${symbol})
|
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
elseif(NOT _result)
|
elseif(NOT _result)
|
||||||
|
|
|
@ -65,8 +65,8 @@ macro (QT4_MAKE_OUTPUT_FILE infile prefix ext outfile )
|
||||||
else()
|
else()
|
||||||
file(RELATIVE_PATH rel ${CMAKE_CURRENT_SOURCE_DIR} ${infile})
|
file(RELATIVE_PATH rel ${CMAKE_CURRENT_SOURCE_DIR} ${infile})
|
||||||
endif()
|
endif()
|
||||||
if(WIN32 AND rel MATCHES "^[a-zA-Z]:") # absolute path
|
if(WIN32 AND rel MATCHES "^([a-zA-Z]):(.*)$") # absolute path
|
||||||
string(REGEX REPLACE "^([a-zA-Z]):(.*)$" "\\1_\\2" rel "${rel}")
|
set(rel "${CMAKE_MATCH_1}_${CMAKE_MATCH_2}")
|
||||||
endif()
|
endif()
|
||||||
set(_outfile "${CMAKE_CURRENT_BINARY_DIR}/${rel}")
|
set(_outfile "${CMAKE_CURRENT_BINARY_DIR}/${rel}")
|
||||||
string(REPLACE ".." "__" _outfile ${_outfile})
|
string(REPLACE ".." "__" _outfile ${_outfile})
|
||||||
|
|
|
@ -30,8 +30,8 @@ if(EXISTS ${CMake_SOURCE_DIR}/.git/HEAD)
|
||||||
elseif(EXISTS ${CMake_SOURCE_DIR}/CVS/Repository)
|
elseif(EXISTS ${CMake_SOURCE_DIR}/CVS/Repository)
|
||||||
file(READ ${CMake_SOURCE_DIR}/CVS/Repository repo)
|
file(READ ${CMake_SOURCE_DIR}/CVS/Repository repo)
|
||||||
set(branch "")
|
set(branch "")
|
||||||
if("${repo}" MATCHES "\\.git/")
|
if("${repo}" MATCHES "\\.git/([^\r\n]*)")
|
||||||
string(REGEX REPLACE ".*\\.git/([^\r\n]*).*" "-\\1" branch "${repo}")
|
set(branch "${CMAKE_MATCH_1}")
|
||||||
endif()
|
endif()
|
||||||
set(CMake_VERSION_SOURCE "cvs${branch}")
|
set(CMake_VERSION_SOURCE "cvs${branch}")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -52,9 +52,9 @@ function(execute_all_script_tests scriptname result)
|
||||||
|
|
||||||
foreach(line ${script})
|
foreach(line ${script})
|
||||||
if(line MATCHES "${regex}")
|
if(line MATCHES "${regex}")
|
||||||
|
set(testname "${CMAKE_MATCH_2}")
|
||||||
|
set(expected_result "${CMAKE_MATCH_3}")
|
||||||
math(EXPR count "${count} + 1")
|
math(EXPR count "${count} + 1")
|
||||||
string(REGEX REPLACE "${regex}" "\\2" testname "${line}")
|
|
||||||
string(REGEX REPLACE "${regex}" "\\3" expected_result "${line}")
|
|
||||||
execute_one_script_test(${scriptname} ${testname} ${expected_result})
|
execute_one_script_test(${scriptname} ${testname} ${expected_result})
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
Loading…
Reference in New Issue