Files
CMake/Tests/RunCMake/ParseImplicitData
Raphael Gozzo d4ba945c48 CMakeParseLibraryArchitecture: Fix parsing /lib/<arch> implicit object path
The current regular expression is able to match `/usr/lib/<arch>`,
`/usr/usr/lib/<arch>`, `/usr/usr/usr/lib/<arch>`, ... but not
`/lib/<arch>`.

This behavior ends up causing the detected architecture to
be x86_64-pc-linux-gnu when the Clang compiler is installed on
a "non-system" location (like /opt/llvm-13) which, in turn, makes
almost every 'find_library()' fail because the correct
architecture is x86_64-linux-gnu.

This is due to a typo in commit 764606e256 (CMakeDetermineCompilerABI:
Extract lib arch from implicit object file paths, 2021-04-05,
v3.20.1~10^2), which used `+` instead of `?`.
2021-12-06 16:47:29 -05:00
..

This directory contains sample input files for the implicit include
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.
The CMakeLists.txt file here will generate ".input" files in your
build directory.  The default set of languages is C and CXX.  This
can be changed with -DLANGUAGES=language_list.  For example:
-DLANGUAGES=Fortran will generate Fortran parser input.

The ".output" files should be generated by hand from the input files.
The test will compare the parser output to the manually generated
".output" file.  The two should match.

For compilers that support "-nostdinc"-like flags, you can generate
a test for this with a command like:
cmake -DUNAME=netbsd_nostdinc \
  -DCMAKE_C_FLAGS=-nostdinc -DCMAKE_CXX_FLAGS=-nostdinc .

Here is an example for testing the XL compiler with both -I and nostdinc:

env CC=xlc CXX=xlC cmake -DUNAME=linux_nostdinc_i \
  -DCMAKE_C_FLAGS='-qnostdinc -I/tmp/ii/test_c' \
  -DCMAKE_CXX_FLAGS='-qnostdinc -I/tmp/ii/test_c -I/tmp/ii/test_cxx' .