summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/ParseImplicitLinkInfo
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-12-14 18:21:59 (GMT)
committerBrad King <brad.king@kitware.com>2024-01-03 21:20:27 (GMT)
commit8153485fd5df3f964f1e6d686c363f4a569cedd7 (patch)
treeadaaf3921d2d31700a35f9277ba620697bc80e41 /Tests/RunCMake/ParseImplicitLinkInfo
parentbd31a35899bec834e941fb145bf700d43751ff5d (diff)
downloadCMake-8153485fd5df3f964f1e6d686c363f4a569cedd7.zip
CMake-8153485fd5df3f964f1e6d686c363f4a569cedd7.tar.gz
CMake-8153485fd5df3f964f1e6d686c363f4a569cedd7.tar.bz2
Tests: Improve isolation of cases parsing implicit link/include information
Diffstat (limited to 'Tests/RunCMake/ParseImplicitLinkInfo')
-rw-r--r--Tests/RunCMake/ParseImplicitLinkInfo/ParseImplicitLinkInfo.cmake88
1 files changed, 39 insertions, 49 deletions
diff --git a/Tests/RunCMake/ParseImplicitLinkInfo/ParseImplicitLinkInfo.cmake b/Tests/RunCMake/ParseImplicitLinkInfo/ParseImplicitLinkInfo.cmake
index 0ede9ee..7e7d015 100644
--- a/Tests/RunCMake/ParseImplicitLinkInfo/ParseImplicitLinkInfo.cmake
+++ b/Tests/RunCMake/ParseImplicitLinkInfo/ParseImplicitLinkInfo.cmake
@@ -94,16 +94,6 @@ function(load_compiler_info infile lang_var outcmvars_var outstr_var)
endfunction()
#
-# unload_compiler_info: clear out any CMAKE_* vars load previously set
-#
-function(unload_compiler_info cmvars)
- foreach(var IN LISTS cmvars)
- unset("${var}" PARENT_SCOPE)
- endforeach()
-endfunction()
-
-
-#
# load_platform_info: establish CMAKE_LIBRARY_ARCHITECTURE_REGEX
# based on the target platform.
#
@@ -132,49 +122,49 @@ foreach(t ${targets})
continue()
endif()
- load_compiler_info(${infile} lang cmvars input)
- load_platform_info(${t})
+ block()
+ load_compiler_info(${infile} lang cmvars input)
+ load_platform_info(${t})
- # Need to handle files with empty entries for both libs or dirs
- set(implicit_lib_output "")
- set(idirs_output "")
- set(implicit_objs "")
- set(library_arch_output "")
- file(STRINGS ${outfile} outputs)
- foreach(line IN LISTS outputs)
- if(line MATCHES "libs=")
- string(REPLACE "libs=" "" implicit_lib_output "${line}")
- endif()
- if(line MATCHES "dirs=")
- string(REPLACE "dirs=" "" idirs_output "${line}")
- endif()
- if(line MATCHES "library_arch=")
- string(REPLACE "library_arch=" "" library_arch_output "${line}")
- endif()
- endforeach()
+ # Need to handle files with empty entries for both libs or dirs
+ set(implicit_lib_output "")
+ set(idirs_output "")
+ set(implicit_objs "")
+ set(library_arch_output "")
+ file(STRINGS ${outfile} outputs)
+ foreach(line IN LISTS outputs)
+ if(line MATCHES "libs=")
+ string(REPLACE "libs=" "" implicit_lib_output "${line}")
+ endif()
+ if(line MATCHES "dirs=")
+ string(REPLACE "dirs=" "" idirs_output "${line}")
+ endif()
+ if(line MATCHES "library_arch=")
+ string(REPLACE "library_arch=" "" library_arch_output "${line}")
+ endif()
+ endforeach()
- cmake_parse_implicit_link_info("${input}" implicit_libs idirs implicit_fwks log
- "${CMAKE_${lang}_IMPLICIT_OBJECT_REGEX}"
- LANGUAGE ${lang}
- COMPUTE_IMPLICIT_OBJECTS implicit_objs)
+ cmake_parse_implicit_link_info("${input}" implicit_libs idirs implicit_fwks log
+ "${CMAKE_${lang}_IMPLICIT_OBJECT_REGEX}"
+ LANGUAGE ${lang}
+ COMPUTE_IMPLICIT_OBJECTS implicit_objs)
- set(library_arch)
- cmake_parse_library_architecture(${lang} "${idirs}" "${implicit_objs}" library_arch)
+ set(library_arch)
+ cmake_parse_library_architecture(${lang} "${idirs}" "${implicit_objs}" library_arch)
- # File format
- # file(WRITE ${outfile} "libs=${implicit_libs}\ndirs=${idirs}\nlibrary_arch=${library_arch}")
+ # File format
+ # file(WRITE ${outfile} "libs=${implicit_libs}\ndirs=${idirs}\nlibrary_arch=${library_arch}")
- if(t MATCHES "-empty$") # empty isn't supposed to parse
- if("${state}" STREQUAL "done")
- message("empty parse failed: ${idirs}, log=${log}")
+ if(t MATCHES "-empty$") # empty isn't supposed to parse
+ if("${state}" STREQUAL "done")
+ message("empty parse failed: ${idirs}, log=${log}")
+ endif()
+ elseif(NOT "${idirs}" MATCHES "^${idirs_output}$")
+ message("${t} parse failed: state=${state}, '${idirs}' does not match '^${idirs_output}$'")
+ elseif(NOT "${implicit_libs}" MATCHES "^${implicit_lib_output}$")
+ message("${t} parse failed: state=${state}, '${implicit_libs}' does not match '^${implicit_lib_output}$'")
+ elseif((library_arch OR library_arch_output) AND NOT "${library_arch}" MATCHES "^${library_arch_output}$")
+ message("${t} parse failed: state=${state}, '${library_arch}' does not match '^${library_arch_output}$'")
endif()
- elseif(NOT "${idirs}" MATCHES "^${idirs_output}$")
- message("${t} parse failed: state=${state}, '${idirs}' does not match '^${idirs_output}$'")
- elseif(NOT "${implicit_libs}" MATCHES "^${implicit_lib_output}$")
- message("${t} parse failed: state=${state}, '${implicit_libs}' does not match '^${implicit_lib_output}$'")
- elseif((library_arch OR library_arch_output) AND NOT "${library_arch}" MATCHES "^${library_arch_output}$")
- message("${t} parse failed: state=${state}, '${library_arch}' does not match '^${library_arch_output}$'")
- endif()
-
- unload_compiler_info("${cmvars}")
+ endblock()
endforeach(t)