mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-21 14:10:41 -06:00
Compiler arguments coming from CC environment variables or multi-element CMAKE_<LANG>_COMPILER variables set by toolchain files were previously not exposed in the file API. Among other possible problems, this caused clients to determine wrong system include paths and built-in preprocessor macros by calling the compiler without these important arguments. This is fixed by adding an optional "commandFragment" attribute to the compiler description in the `toolchains` object, containing these arguments as a command line fragment. This is already the form in which they are internally stored in the CMAKE_<LANG>_COMPILER_ARG1 variable, so all that is required is adding this variable to the set of exported variables, besides some logic to omit it if empty. Issue: #22568
43 lines
1.1 KiB
CMake
43 lines
1.1 KiB
CMake
# All of these should fail. Execution does continue though, so we should see
|
|
# the error output from each one. There is no observable effect of the command
|
|
# during the configure phase, so it isn't critical to end processing on the
|
|
# first failure. Allowing execution to proceed may allow the project to see
|
|
# other potential errors before ultimately halting. That behavior is generally
|
|
# desirable, and the multiple failing calls here will confirm that we retain
|
|
# that behavior.
|
|
|
|
message(NOTICE "Non-query check")
|
|
cmake_file_api(NOT_A_QUERY)
|
|
|
|
message(NOTICE "Invalid API version checks")
|
|
cmake_file_api(QUERY API_VERSION 2)
|
|
cmake_file_api(QUERY API_VERSION nah)
|
|
|
|
message(NOTICE "Invalid version numbers check")
|
|
cmake_file_api(
|
|
QUERY
|
|
API_VERSION 1
|
|
CODEMODEL nope
|
|
CACHE -2
|
|
CMAKEFILES .8
|
|
TOOLCHAINS 2 0.1
|
|
)
|
|
|
|
message(NOTICE "Requested versions too high check")
|
|
cmake_file_api(
|
|
QUERY
|
|
API_VERSION 1
|
|
CODEMODEL 3
|
|
CACHE 3
|
|
CMAKEFILES 2
|
|
TOOLCHAINS 1.2
|
|
)
|
|
|
|
message(NOTICE "Requested versions too low check")
|
|
cmake_file_api(
|
|
QUERY
|
|
API_VERSION 1
|
|
CODEMODEL 1
|
|
CACHE 1
|
|
)
|