Browse Source

Merge topic 'use-consistent-regex-for-info-strings'

3e84e78c Use a more reliable regex for extracting binary INFO strings
Brad King 11 years ago
parent
commit
7b2e3cc63b

+ 1 - 1
Modules/CMakeDetermineCompilerABI.cmake

@@ -52,7 +52,7 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
       message(STATUS "Detecting ${lang} compiler ABI info - done")
       file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
         "Detecting ${lang} compiler ABI info compiled with the following output:\n${OUTPUT}\n\n")
-      file(STRINGS "${BIN}" ABI_STRINGS LIMIT_COUNT 2 REGEX "INFO:[^[]*\\[")
+      file(STRINGS "${BIN}" ABI_STRINGS LIMIT_COUNT 2 REGEX "INFO:[A-Za-z0-9_]+\\[[^]]*\\]")
       foreach(info ${ABI_STRINGS})
         if("${info}" MATCHES "INFO:sizeof_dptr\\[0*([^]]*)\\]")
           set(ABI_SIZEOF_DPTR "${CMAKE_MATCH_1}")

+ 1 - 1
Modules/CMakeDetermineCompilerId.cmake

@@ -390,7 +390,7 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
     set(SIMULATE_ID)
     set(SIMULATE_VERSION)
     file(STRINGS ${file}
-      CMAKE_${lang}_COMPILER_ID_STRINGS LIMIT_COUNT 6 REGEX "INFO:")
+      CMAKE_${lang}_COMPILER_ID_STRINGS LIMIT_COUNT 6 REGEX "INFO:[A-Za-z0-9_]+\\[[^]]*\\]")
     set(COMPILER_ID_TWICE)
     foreach(info ${CMAKE_${lang}_COMPILER_ID_STRINGS})
       if("${info}" MATCHES "INFO:compiler\\[([^]\"]*)\\]")

+ 1 - 1
Modules/FortranCInterface/Detect.cmake

@@ -67,7 +67,7 @@ endif()
 set(FortranCInterface_SYMBOLS)
 if(FortranCInterface_EXE)
   file(STRINGS "${FortranCInterface_EXE}" _info_strings
-    LIMIT_COUNT 8 REGEX "INFO:[^[]*\\[")
+    LIMIT_COUNT 8 REGEX "INFO:[A-Za-z0-9_]+\\[[^]]*\\]")
   foreach(info ${_info_strings})
     if("${info}" MATCHES "INFO:symbol\\[([^]]*)\\]")
       list(APPEND FortranCInterface_SYMBOLS ${CMAKE_MATCH_1})

+ 1 - 1
Tests/PerConfig/perconfig.cmake

@@ -29,7 +29,7 @@ endif()
 
 # Verify that the implementation files are named correctly.
 foreach(lib pcStatic pcShared)
-  file(STRINGS "${${lib}_file}" info LIMIT_COUNT 1 REGEX "INFO:[^[]*\\[")
+  file(STRINGS "${${lib}_file}" info LIMIT_COUNT 1 REGEX "INFO:[A-Za-z0-9_]+\\[[^]]*\\]")
   if(NOT "${info}" MATCHES "INFO:symbol\\[${lib}\\]")
     message(SEND_ERROR "No INFO:symbol[${lib}] found in:\n  ${${lib}_file}")
   endif()