| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| |
| |
| |
| |
| |
| | |
5b1ed2a646 try_compile: Do not use CMAKE_BUILD_TYPE or CMAKE_CONFIGURATION_TYPES env vars
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !6755
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Since:
* commit e216b9bbd3 (cmake: Allow CMAKE_BUILD_TYPE to be set by
environment variable, 2021-06-29, v3.22.0-rc1~503^2~1)
* commit ef56eefc9b (cmake: Allow CMAKE_CONFIGURATION_TYPES to be set by
environment variable, 2021-06-29, v3.22.0-rc1~503^2)
the environment variables are supposed to provide defaults for settings
the user otherwise can control via cache entries. However, they
accidentally affect `try_compile` projects too, which are supposed to be
programmatically controlled.
Fixes: #22935
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Due to MCST LCC compiler identification is now changed to LCC,
there should be a way for old projects to still identify it as GNU,
as it was before.
This commits adds the policy:
CMP0129: Compiler id for MCST LCC compilers is now LCC, not GNU.
This policy controls such a behavior.
OLD behaivior is to treat LCC as GNU, NEW is to treat is as LCC.
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Divert LCC compiler as a new one, instead of treating it as GNU.
Since old times, Elbrus C/C++/Fortran Compiler (LCC) by MCST has been
passing checks for GNU compilers, so it has been identified as GNU.
Now, with intent of seriously upstreaming its support, it has been
added as a separate LCC compiler, and its version displays not a
supported GCC version, but LCC version itself (e.g. LCC 1.25.19 instead
of GNU 7.3.0).
This commit adds its support for detection, and also converts basically
every check like 'is this compiler GNU?' to 'is this compiler GNU or
LCC?'. The only places where this check is untouched, is where it
regards other platforms where LCC is unavailable (primarily non-Linux),
and where it REALLY differs from GNU compiler.
Note: this transition may break software that are already ported to
Elbrus, but hardly relies that LCC will be detected as GNU; still such
software is not known.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Upstream ninja commit `ad3d29fb53` (Put builder output through status
interface) from ninja PR 1899 changed the status output from stdout to
stderr. In particular, `ninja: no work to do` is now printed on stderr.
Update our RunCMake tests to accept this difference.
A few RunCMake test cases check for `ninja: no work to do`. For those,
move the message to stdout using `RunCMake_TEST_OUTPUT_MERGE`. The rest
of the test cases do not care about the message, so remove it from the
actual stderr content before comparing against that expected.
|
| |
|
|
|
|
|
|
|
| |
The cmLocalGenerator::AddCompilerRequirementFlag was another
source of truth on what standard levels existed per language,
so fold that into cmStandardLevelResolver to make updating
CMake easier
|
|
|
|
| |
Use 3.3 or 2.8.12 where possible.
|
|
|
|
|
|
|
|
|
|
| |
On low-resolution filesystems, `Makefile` can end up with the same
time stamp as `CMakeCache.txt`. CMake must re-run in this case to
be conservative, but that invalidates the `-nowork` cases.
Rather than trying to detect 1s filesystems, just add an option
called `CMake_TEST_FILESYSTEM_1S` that external scripts can use
to tell CMake's test suite about this.
|
|
|
|
| |
Fixes: #17522
|
| |
|
|
|
|
| |
Fixes: #19920
|
|
|
|
|
|
|
| |
The OLD behaviors of all policies are deprecated, but only by
documentation. Add an explicit deprecation diagnostic for policies
introduced in CMake 3.8 and below to encourage projects to port away
from setting policies to OLD.
|
|
|
|
|
|
|
|
|
| |
Root causes were:
* Using incorrect conditions (assuming MSVC-like command line mode)
* Trying to compile the MSVC STL in C++11 mode, when parts of it require
C++14 or enabling MS extensions in clang.
* Missing flush in a testcase using stdout in a dll and a main part
with static crt
|
|
|
|
|
|
|
| |
The OLD behaviors of all policies are deprecated, but only by
documentation. Add an explicit deprecation diagnostic for policies
introduced in CMake 3.7 and below to encourage projects to port away
from setting policies to OLD.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Disable the system include unused variable test in ExportImport when
clang is in MSVC compatible mode.
* Disable CxxDialect testcase when clang is in MSVC compatible mode, as
it doesn't support `typeof`.
* Teach Module.WriteCompilerDetectionHeader to treat clang-cl as MSVC.
* Disable the SystemIncludeDirectories testcase within
IncludeDirectories when clang is in MSVC compatible mode.
* Disable the CMakeOnly.CheckCXXCompilerFlag testcase when clang is in
MSVC compatible mode.
* Treat clang-cl as MSVC in LinkOptions.cmake in the try_run and
try_compile testcases.
|
| |
|
|
|
|
|
|
| |
The OLD behaviors of all policies are deprecated, but only by
documentation. Add an explicit deprecation diagnostic for some policies
to encourage projects to port away from setting policies to OLD.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Run the `clang-format.bash` script to update all our C and C++ code to a
new style defined by `.clang-format`. Use `clang-format` version 6.0.
* If you reached this commit for a line in `git blame`, re-run the blame
operation starting at the parent of this commit to see older history
for the content.
* See the parent commit for instructions to rebase a change across this
style transition commit.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Projects use `try_compile` to check if they will be able to compile some
particular source code. When a language standard variable like
`CMAKE_CXX_STANDARD` is set, then the project intends to compile source
code using a compiler mode for that standard. Therefore it makes sense
for `try_compile` to use that standard in the test project too.
Unfortunately this was not done when support for the
`CMAKE_CXX_STANDARD` variable was first implemented. Add a policy to
introduce the improved behavior in a compatible way.
Closes: #16456
|
|
|
|
|
|
|
|
|
| |
Give `try_compile` callers a way to control the `CXX_STANDARD`,
`CXX_STANDARD_REQUIRED`, and `CXX_EXTENSIONS` properties of the
generated test target (or the `C` equivalents) in order to compile a
test source for a particular language standard.
Issue: #16456
|
|
|
|
|
|
|
|
| |
This causes the `-Wno-deprecated` option to be honored even inside a
`try_compile` test project, which is needed to suppress all deprecation
warnings as the option documents.
Closes: #16446
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In the `try_compile` source file signature we propagate the caller's
value of `CMAKE_<LANG>_FLAGS` into the test project. Extend this to
propagate `CMAKE_<LANG>_FLAGS_<CONFIG>` too instead of always using the
default value in the test project. This will be useful, for example, to
allow the MSVC runtime library to be changed (e.g. `-MDd` => `-MTd`).
However, some projects may currently depend on this not being done,
so we need to activate the behavior using a policy.
This change was originally made by commit v3.6.0-rc1~160^2 (try_compile:
Honor CMAKE_<LANG>_FLAGS_<CONFIG> changes, 2016-04-11) but without the
policy and so had to be reverted during the 3.6 release candidate cycle.
Fixes #16174.
|
|
|
|
|
|
|
|
|
|
| |
Revert commit v3.6.0-rc1~160^2 (try_compile: Honor
CMAKE_<LANG>_FLAGS_<CONFIG> changes, 2016-04-11). The behavior it
introduced can break projects that depend on the lack of such behavior.
We will have to introduce a policy or other mechanism to enable the
behavior in a compatible way. Simply revert it for now.
See issue #16174.
|
|
|
|
|
|
|
|
|
| |
Add a `CMAKE_TRY_COMPILE_PLATFORM_VARIABLES` variable to specify a list
of custom variables to be forwarded to a `try_compile` test project.
This will be useful for platform information modules or toolchain files
to forward some platform-specific set of variables from the host project
(perhaps set in its cache) to the test project so that it can build the
same way.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Run the `Utilities/Scripts/clang-format.bash` script to update
all our C++ code to a new style defined by `.clang-format`.
Use `clang-format` version 3.8.
* If you reached this commit for a line in `git blame`, re-run the blame
operation starting at the parent of this commit to see older history
for the content.
* See the parent commit for instructions to rebase a change across this
style transition commit.
|
|
|
|
|
|
|
|
| |
In the `try_compile` source file signature we propagate the caller's
value of `CMAKE_<LANG>_FLAGS` into the test project. Extend this to
propagate `CMAKE_<LANG>_FLAGS_<CONFIG>` too instead of always using the
default value in the test project. This will be useful, for example, to
allow the MSVC runtime library to be changed (e.g. `-MDd` => `-MTd`).
|
|
|
|
|
|
|
| |
Create a `CMAKE_TRY_COMPILE_TARGET_TYPE` option to specify use
of `add_library(... STATIC ...)` for the generated test project.
This will be useful for cross-compiling toolchains that cannot
link a binary without custom flags or scripts.
|
|\
| |
| |
| |
| |
| | |
7f2dc8dc configure_file: Test that CMake re-runs on input change or output missing
daf95a38 try_compile: Test that CMake re-runs on input change
|
| |
| |
| |
| |
| |
| |
| | |
With the Makefile and Ninja generators we expect that touching the input
source file for a try_compile will cause CMake to re-run on the next
build. Extend the RunCMake.try_compile test with a case covering this.
Also check that CMake does not re-run if nothing has changed.
|
|/
|
|
|
|
|
|
| |
Most functionality is already implemented in Source/cmCoreTryCompile.{h,cxx}.
Document and improve argument parsing.
This functionality is already being used by a number of modules, like
CheckCSourceCompiles.cmake, but it is not documented.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Copy CMAKE_EXE_LINKER_FLAGS into the test project generated by
try_compile, just like we already copy CMAKE_<LANG>_FLAGS.
Add CMake Policy CMP0056 to activate this behavior in a compatible way,
but do not warn by default when the policy is not set since it will
affect all try_compile calls.
Extend the RunCMake.try_compile test with a case covering this behavior
for each policy setting.
|
|
|
|
|
|
| |
Set the minimum required version of CMake high enough to avoid the
warning for CMAKE_LEGACY_CYGWIN_WIN32. The warning appears on stderr
and breaks the expected output matching.
|
|
|
|
|
|
|
|
|
|
|
| |
When the COPY_FILE operation fails optionally capture the error message
with a COPY_FILE_ERROR option instead of reporting the error
immediately. This gives callers a chance to do something else or report
the error.
Teach the RunCMake.try_compile test to cover bad argument combinations
involving COPY_FILE_ERROR. Teach the TryCompile test to cover the case
of a COPY_FILE error message captured by COPY_FILE_ERROR.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Extend the signature
try_compile(RESULT_VAR <bindir> <srcfile> ...)
to allow multiple sources as
try_compile(RESULT_VAR <bindir> SOURCES <srcfile>... ...)
Process the sources to generate a CMakeLists.txt that enables all needed
languages.
Teach the TryCompile test to try cases with two sources of the same
language and of mixed languages. Teach RunCMake.try_compile to cover
error cases for the signature.
|
|
|
|
|
|
|
|
|
|
| |
Process all arguments in a single loop using a simple state machine.
While at it, fix some error message typos. Also allow LINK_LIBRARIES
with no actual libraries to disable use of the -DLINK_LIBRARIES=...
from the CMAKE_FLAGS. This was already possible in the old logic if
LINK_LIBRARIES was immediately followed by another keyword argument
instead of the end of the argument list, so allow it in general.
Update the RunCMake.try_compile test cases accordingly.
|
|
Add a RunCMake.try_compile test to cover cases of bad invocation of the
try_compile command.
|