mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-09 15:20:56 -06:00
Introduce a ParseImplicitLinkInfo test
By sharing the information used by ParseImplicitIncludeInfo we can also verify the parsing of implicit link info such as directories.
This commit is contained in:
@@ -201,6 +201,7 @@ if(MSVC)
|
||||
endif()
|
||||
add_RunCMake_test(ObjectLibrary)
|
||||
add_RunCMake_test(ParseImplicitIncludeInfo)
|
||||
add_RunCMake_test(ParseImplicitLinkInfo)
|
||||
if(UNIX AND CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG AND CMAKE_EXECUTABLE_FORMAT STREQUAL "ELF")
|
||||
add_RunCMake_test(RuntimePath)
|
||||
endif()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#
|
||||
# helper CMakeLists.txt file that can be used to generate input files
|
||||
# for the Tests/RunCMake/ParseImplicitIncludeInfo test.
|
||||
# for the Tests/RunCMake/ParseImplicit[Include|Lib]Info tests.
|
||||
#
|
||||
# usage:
|
||||
# [create a temporary build directory and chdir to it]
|
||||
@@ -81,6 +81,7 @@ foreach(lang IN ITEMS ${LANGUAGES})
|
||||
endif()
|
||||
|
||||
set(result "CMAKE_LANG=${lang}\n")
|
||||
list(APPEND result "CMAKE_LINKER=${CMAKE_LINKER}\n")
|
||||
foreach(var IN ITEMS ${compvars})
|
||||
list(APPEND result
|
||||
"CMAKE_${lang}_COMPILER_${var}=${CMAKE_${lang}_COMPILER_${var}}\n")
|
||||
@@ -1,6 +1,7 @@
|
||||
This directory contains sample input files for the implicit include
|
||||
directories parser for testing. For each configuration there is one
|
||||
".input" file and one ".output" file.
|
||||
directories, and link info parsers for testing. For each configuration
|
||||
there is one ".input" file and matching ".output" files in
|
||||
ParseImplicitIncludeInfo/results and ParseImplicitLinkInfo/results.
|
||||
|
||||
To generate ".input" files for a system, create a temporary build
|
||||
directory and chdir to it. Then run cmake pointing to this directory.
|
||||
@@ -19,3 +19,5 @@ This is a hand-written test case.
|
||||
../../../adaptive/relative/include
|
||||
/usr/include
|
||||
End of search list.
|
||||
|
||||
/usr/bin/ld -L/usr/lib64 -L../../../adaptive/relative/lib
|
||||
@@ -19,3 +19,5 @@ This is a hand-written test case.
|
||||
../../../adaptive/relative/include
|
||||
/usr/include
|
||||
End of search list.
|
||||
|
||||
/usr/bin/ld -L/usr/lib64 -L../../../adaptive/relative/lib
|
||||
@@ -1,4 +1,5 @@
|
||||
CMAKE_LANG=CUDA
|
||||
CMAKE_LINKER=/usr/bin/ld
|
||||
CMAKE_CUDA_COMPILER_ABI=ELF
|
||||
CMAKE_CUDA_COMPILER_AR=
|
||||
CMAKE_CUDA_COMPILER_ARCHITECTURE_ID=
|
||||
@@ -32,7 +32,7 @@ set(targets
|
||||
linux_nostdinc-C-XL-12.1.0 linux_nostdinc-CXX-XL-12.1.0
|
||||
linux_nostdinc_i-C-XL-12.1.0 linux_nostdinc-CXX-XL-12.1.0
|
||||
linux-C-XL-16.1.0.0 linux-CXX-XL-16.1.0.0
|
||||
linux-CUDA-NVIDIA-9.2.148
|
||||
linux-CUDA-NVIDIA-9.2.148-GCC
|
||||
mingw.org-C-GNU-4.9.3 mingw.org-CXX-GNU-4.9.3
|
||||
netbsd-C-GNU-4.8.5 netbsd-CXX-GNU-4.8.5
|
||||
netbsd_nostdinc-C-GNU-4.8.5 netbsd_nostdinc-CXX-GNU-4.8.5
|
||||
@@ -97,12 +97,16 @@ endfunction()
|
||||
# main test loop
|
||||
#
|
||||
foreach(t ${targets})
|
||||
set(infile "${CMAKE_SOURCE_DIR}/data/${t}.input")
|
||||
set(outfile "${CMAKE_SOURCE_DIR}/data/${t}.output")
|
||||
if (NOT EXISTS ${infile} OR NOT EXISTS ${outfile})
|
||||
message("missing files for target ${t} in ${CMAKE_SOURCE_DIR}/data")
|
||||
set(infile "${CMAKE_SOURCE_DIR}/../ParseImplicitData/${t}.input")
|
||||
set(outfile "${CMAKE_SOURCE_DIR}/results/${t}.output")
|
||||
if (NOT EXISTS ${infile})
|
||||
message("missing input file for target ${t} in ${CMAKE_SOURCE_DIR}/../ParseImplicitData/")
|
||||
continue()
|
||||
elseif(NOT EXISTS ${outfile})
|
||||
message("missing files for target ${t} in ${CMAKE_SOURCE_DIR}/results/")
|
||||
continue()
|
||||
endif()
|
||||
|
||||
load_compiler_info(${infile} lang cmvars input)
|
||||
file(READ ${outfile} output)
|
||||
string(STRIP "${output}" output)
|
||||
@@ -112,6 +116,7 @@ foreach(t ${targets})
|
||||
message("empty parse failed: ${idirs}, log=${log}")
|
||||
endif()
|
||||
elseif(NOT "${state}" STREQUAL "done" OR NOT "${idirs}" MATCHES "^${output}$")
|
||||
message(${t})
|
||||
message("parse failed: state=${state}, '${idirs}' does not match '^${output}$', log=${log}")
|
||||
endif()
|
||||
unload_compiler_info("${cmvars}")
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user