summaryrefslogtreecommitdiff
path: root/Tests/RunCMake/ParseImplicitIncludeInfo
Commit message (Collapse)AuthorAgeFilesLines
* Tests/RunCMake: Update cmake_minimum_required versionsBrad King2023-02-112-4/+1
| | | | | | | | For policy-specific tests, use the version before the policy was introduced. Otherwise, use 3.5 where possible. Also, remove `cmake_minimum_required()` and `project()` calls from individual cases where they are handled by `CMakeLists.txt`.
* CMakeParseLibraryArchitecture: Fix parsing /lib/<arch> implicit object pathRaphael Gozzo2021-12-063-0/+3
| | | | | | | | | | | | | | | | 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 `?`.
* Tests: Extend ParseImplicit*Info with static GNU runtime library flagsBrad King2021-06-034-0/+6
| | | | | Generate sample input data with GNU 10.2.1 compilers using flags like `-static-libstdc++` and `-static-libgfortran`.
* CMakeDetermineCompilerABI: Extract lib arch from implicit object file pathsRobert Maynard2021-04-053-0/+1
| | | | | | | | | The NVHPC compiler does not have any implicit link directories that can be used to detect `CMAKE_LIBRARY_ARCHITECTURE`, but it does have implicit object files. Extract implicit object file paths from link lines and check them for the `CMAKE_LIBRARY_ARCHITECTURE` pattern. Issue: #22024
* CMakeParseImplicitLinkInfo supports comma separated link linesRobert Maynard2019-08-283-5/+10
| | | | | | | | | It is currently presumed that the linker will generate a space separated line. This is not the case for some compilers such as IBM XL where it can output space or comma separated. This is particularly apparent when IBM XL is used as the host compiler for CUDA as it generates a comma separated link line.
* Introduce a ParseImplicitLinkInfo testRobert Maynard2019-08-28123-3107/+10
| | | | | By sharing the information used by ParseImplicitIncludeInfo we can also verify the parsing of implicit link info such as directories.
* Merge branch 'backport-implicit-includes-cray-hlist'Brad King2019-07-097-0/+165
|\
| * Cray: Fix include parsing when the -hlist= flag is presentChuck Atkins2019-07-097-0/+165
| | | | | | | | | | | | Update parsing logic from commit 5990ecb741 (Compute implicit include directories from compiler output, 2018-12-07, v3.14.0-rc1~108^2) to handle the quoting behavior caused by the `-hlist=` flag.
* | Merge branch 'backport-implicit-includes-relative'Brad King2019-04-0825-20/+65
|\ \ | |/
| * Fix implicit include directory extraction for adaptive relative pathsBrad King2019-04-085-0/+45
| | | | | | | | | | | | | | | | | | | | In some cases GCC reports *relative* implicit include directories. They are computed adaptively with respect to the current working directory such that the effective implicit include directory is an unchanging absolute path. Teach our implicit include directory extraction to recognize such paths and normalize them. Fixes: #19133
| * Tests: Teach RunCMake.ParseImplicitIncludeInfo to match output by regexBrad King2019-04-0816-17/+17
| |
| * Tests: Clarify hand-written cases in RunCMake.ParseImplicitIncludeInfoBrad King2019-04-085-2/+2
| |
* | Merge topic 'implicit-includes'Brad King2019-03-2916-70/+78
|\ \ | |/ | | | | | | | | | | | | dad86f1873 ParseImplicitIncludeInfo: Canonicalize implicit include dirs Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Michel Zou <xantares09@hotmail.com> Merge-request: !3157
| * ParseImplicitIncludeInfo: Canonicalize implicit include dirsBrad King2019-03-2916-70/+78
| | | | | | | | | | | | | | | | | | | | | | | | The implicit include directory extraction added by commit 5990ecb741 (Compute implicit include directories from compiler output, 2018-12-07, v3.14.0-rc1~108^2) leaves paths like `/usr/lib/../include` unchanged. Fix the logic to canonicalize such paths (e.g. to `/usr/include`) as we do for implicit link directories already. This is important to ensure the set of implicit directories is represented in the same form as the include directories that will be compared to them. Issue: #19095
* | XLClang: Extract compiler implicit include directoriesBrad King2019-02-255-0/+87
| |
* | XLClang: Add policy CMP0089 to present as XL for compatibilityBrad King2019-02-251-0/+3
|/ | | | | | | | We now identify IBM's Clang-based XL compilers, which define `__ibmxl__`, as `XLClang` rather than `XL`. In order to support existing project code that checks for `XL`, add a policy whose OLD behavior is to present the compiler id as `XL` and whose NEW behavior is to present the compiler id as `XLClang` as we really detect it.
* ParseImplicitIncludeInfo: add SunPro Fortran and PGI compiler, Cray fixChuck Cranor2019-01-2917-1/+332
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add implicit include parser for PGI compiler ID. PGI verbose output for CXX differs from C and Fortran, so CXX is broken out into its own case. The C and Fortran compilers take "-YI,path" and "-Mnostdinc" to change or disable the builtin include path. The last arg on the command line appears to override previous args (e.g. "-YI,path1 -YI,path2" will set the path to "path2" ... the previous "-YI,path1" gets undone). The CXX compiler verbose output reports with "-I" rather than "-stdinc" for the built in path. In addition with CXX "-Mnostdinc" does not completely zero the include path (e.g. "#include <stdio.h>" still works with "-Mnostdinc"... "-I/usr/include" still shows up in the verbose output). Minor adjustments to get the SunPro parser to handle Fortran as well. Fixes for Cray compiler support (Modules/Compiler/Cray-{C,CXX}.cmake): The *_COMPILE_OPTION flags contain options like "-h c99,gnu" ... these options need to be in double quotes (they are currently not). Otherwise, cmake treats them as lists and tries to run the compiler with "-h;c99,gnu" and fails when it is "Detecting C compile features"... Also, the Cray-CXX.cmake contains "__compiler_cray(C)" instead of "__compiler_cray(CXX)" -- this error prevents the correct VERBOSE flags for CXX from being defined which prevents the implicit include parser from running. Add additional test cases for PGI and SunPro Fortran to the Tests/RunCMake/ParseImplicitIncludeInfo area.
* ParseImplicitIncludeInfo: add Fortran implicit include handlingChuck Cranor2019-01-2515-6/+436
| | | | | | | | | | | | | | | | | | | | | | | Currently cmake is only setting CMAKE_Fortran_IMPLICIT_INCLUDE_DIRECTORIES the first time it runs (the implicit includes parser is only run when the cache variables are initially populated). It is left unset during additional runs. This behavior is both confusing and inconsistent. Modify CMakeFortranCompiler.cmake.in to preserve the value of CMAKE_Fortran_IMPLICIT_INCLUDE_DIRECTORIES so that cmake's Fortran behavior matches C and CXX (i.e. CMAKE_Fortran_IMPLICIT_INCLUDE_DIRECTORIES retains its value across runs). The implicit includes variable may not be as useful for Fortran as it is for C and CXX, but we do want cmake to be consistent in how it is handled. Adjust CMakeParseImplicitIncludeInfo to parse verbose Fortran output for Cray and XL compiler IDs (GNU and clang were already ok since they use the same verbose output format as they do with C/CXX). Allow Tests/RunCMake/ParseImplicitIncludeInfo/data/CMakeLists.txt to generate test inputs for Fortran too, and add some sample Fortran input files for the Tests/RunCMake/ParseImplicitIncludeInfo test.
* ParseImplicitIncludeInfo: handle/add SunPro, XL, and -nostdinc test casesChuck Cranor2019-01-2532-2/+650
| | | | | | | | | | | | | | | | | | | | | | | | | Add parser code for compiler IDs SunPro and XL. For SunPro, /usr/include appears to be hardwired in and it does not have a -nostdinc-type flag. For XL, the "xlc" and "xlC" commands determine if you are C or C++ based on input filename. So compiling x.c with "xlC" reverts to C and compiling x.cc with "xlc" upgrades to CXX. System include paths are specified by: -qc_stdinc=[path] and -qgcc_c_stdinc=[path] (for C) -qcpp_stdinc=[path] and -qgcc_cpp_stdinc=[path] (for CXX) If you specify "-qnostdinc" then the above flags are ignored. Specifying an empty path reverts the value to the default path (e.g. "-qgcc_c_stdinc=" reverts that to the default). Adjust the code to handle parsing the case where the user specifies additional compiler include flags via CMAKE_C_FLAGS/CMAKE_CXX_FLAGS. For example: "-DCMAKE_C_FLAGS=-nostdinc" ... note that gcc and clang output slightly differ when -nostdinc is specified (clang skips printing 'search starts here:' with the angle brackets, gcc always prints it). Enable sunos-{C,CXX}-SunPro test cases and add XL test cases. Also add a few -nostdinc style tests.
* Compute implicit include directories from compiler outputChuck Cranor2019-01-2155-0/+1559
- CMakeParseImplicitIncludeInfo.cmake: new parser that extracts the compiler's include path from verbose output. If the parser cannot parse the output, we fall back to the old behavior. On osx we skip over framework directories (handled elsewhere). - CMakeDetermineCompilerABI.cmake: - use verbose flag in try_compile for ${src} - use new cmake_parse_implicit_include_info() to attempt extract implicit include directory path and if successful set CMAKE_${LANG}_IMPLICIT_INCLUDE_DIRECTORIES - CMakeCCompiler.cmake.in and CMakeCXXCompiler.cmake.in - preserve CMAKE_${LANG}_IMPLICIT_INCLUDE_DIRECTORIES value between runs in the same way CMAKE_${LANG}_IMPLICIT_LINK_DIRECTORIES is preserved - Tests/RunCMake/ParseImplicitIncludeInfo: tests for parse based on the older Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in. The test runs a set of verbose compiler outputs collected from various machines through the parser and checks the results. New compiler files can be added by dropping input/output files in the ParseImplicitIncludeInfo/data subdirectory and then adding the new set of files to the ${targets} list in ParseImplicitIncludeInfo.cmake. There is a helper CMakeLists.txt in ParseImplicitIncludeInfo/data that can help with the generation of test input files. NOTE: the standard cmake pre-commit hook rejects verbose compiler output with trailing spaces... you have to manually edit them out. This shouldn't impact the test. Note that both the parser and the test code can use CMAKE_${LANG}_COMPILER_* variables such as ${CMAKE_CXX_COMPILER_ID} to decide how to parse verbose compiler output. For the test code, this requires us to save the variables values in the test input files. Fixes: #16291