1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-06-20 19:55:10 +08:00

65 Commits

Author SHA1 Message Date
Brad King
7c71f9b1e8 Merge topic 'filesystem-path-c++03-abi'
ee9805ccd1 cm/filesystem: Fix crash with pre-C++11 std::string GNU ABI in C++17

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7813
2022-10-21 10:06:22 -04:00
Brad King
ee9805ccd1 cm/filesystem: Fix crash with pre-C++11 std::string GNU ABI in C++17
The `remove_filename` and `replace_extension` methods compute an offset
between the whole path in a `std::string` and a part of a path in a
`std::string_view`.  This is done by subtracting their `.data()`
pointers.  However, C++17 adds a non-const `.data()` through which
modification of the string is allowed.  This means the copy-on-write
implementation used by the pre-C++11 std::string GNU ABI must reallocate
if the string has been copied.  Our subtraction then computes an offset
between two different allocations, which is undefined behavior.

The workaround in commit b3ca4f9ad1 (cm/filesystem: Work around crash
when compiled for CYGWIN/MSYS runtime, 2021-04-22, v3.21.0-rc1~271^2~2)
avoided the problem by calling the non-const `.data()` to reallocate
before constructing the `string_view`.  Instead, explicitly call the
const `.data()` method on the string, which does not reallocate.

Fixes: #22090, #23328
2022-10-20 18:31:50 -04:00
Gregor Jasny
116cc5a57b cm_cxx_features: filter out warnings from Xcode 14
```
xcodebuild[13070:54426] [MT] DVTSDK: Warning: SDK path collision for path
```
2022-06-21 10:48:37 -04:00
Marc Chevrier
10689e564f cm_cxx_filesystem.cxx: revert erroneous change
Revert erroneous change introduced by commit 0a81ea1.
2022-03-15 15:38:09 +01:00
Marc Chevrier
0a81ea1f12 Genex-LINK_GROUP: Add possibility to group libraries at link step
Fixes: #23121
2022-02-28 10:26:26 +01:00
makise-homura
e5d9fce03f LCC: Add dedicated support for MCST LCC compiler
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.
2021-10-15 05:05:19 +03:00
Orgad Shaneh
ddcd1469e8 MSYS: Add support for running under MSYS runtime environment
Detect MSYS as CYGWIN, with the required adaptations.
2021-04-26 14:27:34 -04:00
Marc Chevrier
6cee4c6a8b Restore support for cross-compiling CMake itself
In commit eb583b0a66 (cmake_path command: path management, 2020-07-23,
v3.19.0-rc1~216^2~1) we added a `try_run`.  In cross-compilation mode,
C++ features tests must avoid running tests if there is no emulator
defined.
2021-01-18 12:23:23 -05:00
Anonymous Maarten
b756ec8a46 cm_cxx_features: Filter out MSBXXXX warnings
When building CMake in `%TMP%` on Windows, MSBuild issues warnings.
Filter those out to avoid breaking C++ feature checks.

Fixes: #21270
2020-10-08 09:24:02 -04:00
Marc Chevrier
eb583b0a66 cmake_path command: path management
Fixes: #19568, #20922
2020-09-06 10:52:25 +02:00
Marc Chevrier
d654bf3449 STL Support: Add cm::filesystem::path in <cm/filesystem> 2020-07-09 17:02:42 +02:00
Brad King
e776ff0582 Merge topic 'cm_cxx_features-icpc-10121'
231637eae2 cm_cxx_features: Filter out 'icpc: command line warning #10121'

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4698
2020-05-01 08:24:21 -04:00
Jennifer Kathleen Green
231637eae2 cm_cxx_features: Filter out 'icpc: command line warning #10121'
This warning appears for:

    overriding '-xCORE-AVX2' with '-march=haswell'`

in some Cray environments.

Fixes: #20664
2020-04-30 13:27:59 -04:00
Brad King
5aa1ef1df8 Merge topic 'cm_cxx_features-libhugetlbfs'
4ab0d37b41 cm_cxx_features: Filter out libhugetlbfs warnings

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4681
2020-04-30 09:52:12 -04:00
Jennifer Green
4ab0d37b41 cm_cxx_features: Filter out libhugetlbfs warnings
Without this, CMake fails to build on Cray systems with a
craype-hugepages modulefile loaded on the front-end due to libhugetlbfs
warnings breaking the CXX Feature tests.  Filter out the warnings so the
bootstrap can proceed to successfully install CMake on Cray Linux
systems.

Fixes: #20645
2020-04-29 08:08:59 -04:00
Raul Tambre
e758331595 cm_cxx_features: Remove CUDA installation warning filtering
This has been fixed in upstream LLVM. No released version contains this issue.
d32170dbd5
eb2ba2ea95
2020-04-01 10:34:35 +03:00
Raul Tambre
6ebc6cec41 cm_cxx_features: Filter out CUDA installation warnings
Clang always outputs these if it doesn't recognize the installed CUDA version.
They don't affect compiling C++.

Fixes #20434.
2020-03-09 09:17:41 -04:00
Brad King
e9e0e401c6 Merge topic 'cmext-memory'
fc3b4caa2e Memory management: cast functions for managed pointers

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4064
2019-12-04 14:22:01 -05:00
Marc Chevrier
fc3b4caa2e Memory management: cast functions for managed pointers 2019-11-27 16:03:04 +01:00
Marcus Calhoun-Lopez
ee28580c33 C++ feature checks: Ignore linker warnings 2019-11-25 13:14:57 -07:00
Alex Turbov
7b2dd9dedc
Refactor: Use added message types in various modules
Co-Authored-By: Craig Scott <craig.scott@crascit.com>
2019-11-02 14:10:09 +02:00
Brad King
170fcd715f Extend C++17 feature checks to require std::optional 2019-08-23 08:43:35 -04:00
Brad King
b7a861647e Merge topic 'cxx-checks-warning-match'
4ca5a815f2 C++ feature checks: Match warnings more strictly

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3075
2019-03-08 07:31:36 -05:00
Brad King
4ca5a815f2 C++ feature checks: Match warnings more strictly
Require the word "warning" to appear at the start of a line, after
whitespace, or after a `:`.  This is the same that CTest launchers use
to match warnings.  It avoids matching "warning" inside file paths.

Fixes: #19019
2019-03-07 14:55:54 -05:00
Mathieu Garaud
a605bf438e Extend C++17/C++14 feature checks to cover more standard library APIs
Make sure `std::cbegin`, `std::cend`, and `std::size` work in C++17 or
C++14 mode before choosing the corresponding standard level for
compiling CMake itself.  This helps in cases that the compiler is using
a standard library too old to support the full standard level chosen.
2019-02-27 11:27:17 -05:00
Mathieu Garaud
e17deb7ad4 Extend C++17/C++14 feature checks to cover more standard library APIs
Make sure `std::cbegin`, `std::cend`, and `std::size` work in C++17 or
C++14 mode before choosing the corresponding standard level for
compiling CMake itself.  This helps in cases that the compiler is using
a standard library too old to support the full standard level chosen.
2019-02-27 11:24:43 -05:00
Zsolt Parragi
d625dfcdf9 Avoid compiling CMake itself as C++17 with Clang's MSVC ABI
GUID functions in ATL cause compilation errors with this compiler.
Add the offending case to our check for C++17 support so that it
is not used by default when it does not work.
2019-02-11 15:04:19 +01:00
Brad King
2ca89b5a69 C++ feature checks: Filter out libstdc++ sprintf warnings
On OpenBSD linking to `libstdc++` with GCC 6.4 always warns:

    warning: sprintf() is often misused, please use snprintf()

These do not affect the availability of C++ features we're checking,
so filter them out.

Fixes: #18602
2018-11-20 12:50:45 -05:00
Brad King
3a2c736b41 Extend C++17/C++14 feature checks to require unique_ptr
When testing compiler modes higher than C++11 for constructs we need,
include a check for using `unique_ptr` in that mode.  The PGI 18.4
compiler in some environments supports `unique_ptr` in C++11 mode
but is broken for C++14 and C++17.  Check that `unique_ptr` works
in these modes before using one.
2018-08-01 14:03:43 -04:00
Gregor Jasny
057ecb8f6f C++ feature checks: Ignore Xcode warnings 2018-06-19 10:56:50 -04:00
luz.paz
be28106880 Fix misc. typos
Found via `codespell` and `grep`
2018-06-04 10:32:49 -04:00
Kitware Robot
d7204e649e Revise C++ coding style using clang-format-6.0
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.
2018-06-01 09:53:42 -04:00
Brad King
ddff7aebbc Merge topic 'cxx-checks-tolerate-more-warnings'
2254b72061 C++ feature checks: Filter out warnings caused by local configuration

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2019
2018-04-30 09:21:16 -04:00
Brad King
2254b72061 C++ feature checks: Filter out warnings caused by local configuration
In some environments the linker produces warnings like

    warning: directory not found for option
    warning: object file compiled with -mlong-branch ...

These do not affect the availability of C++ features we're checking,
so filter them out.

Fixes: #17850, #17947
2018-04-30 09:18:15 -04:00
Brad King
99bf77f49c ccmake: Check for curses more robustly before enabling
Compute a default for `BUILD_CursesDialog` by building a small test
project that uses curses.  Disable `ccmake` by default if it fails,
and do not search for Curses as part of the main build.  This avoids
creating FindCurses cache entries when we are not considering ccmake.

If `BUILD_CursesDialog` is enabled (e.g. by the user) then warn if
curses cannot be found.
2018-03-21 13:57:45 -04:00
Brad King
31d59ff3b1 Compile CMake as C++17 if supported by the compiler
Add a check that a simple source file can compile as C++17 that uses
some of the features we need.  Do this only when hosted by CMake 3.8
or above because those versions are aware of C++17.

Check for unordered_map as we do in bootstrap since commit 375eca7881
(bootstrap: Check support for unordered_map from compiler mode,
2017-11-30).  Also maintain the existing C++14 cstdio check.
2017-12-22 09:05:54 -05:00
Brad King
31c6b9adbf Generalize check for C++14 constructs
The check for C++14 and cstdio is a special case of the more general
problem of checking that the compiler's C++14 mode supports everything
we need.  Rename the checks accordingly.
2017-12-22 09:05:54 -05:00
Brad King
b2f612a0fa Simplify CM_FALLTHROUGH implementation
Use the macro now provided by KWSys instead of using `try_compile`
checks.  It will no longer consider the `__attribute__((fallthrough))`
variant, but compilers that don't have one of the modern attributes
shouldn't warn about not using one anyway.
2017-11-30 09:50:39 -05:00
Brad King
b8018135b5 Use C++11 '= delete' instead of CM_EQ_DELETE
We now require C++11 support including `= delete`.  Drop use of
the old compatibility macro.
2017-09-28 09:50:18 -04:00
Brad King
9e0362caa1 Remove checks for auto_ptr that we no longer need
We no longer use `auto_ptr` at all, so drop the checks for it.
2017-09-27 09:04:31 -04:00
Brad King
71b65abca2 C++ feature checks: Filter out warnings caused by user flags
Filter out `-Winvalid-command-line-argument` warnings from Clang (that
can be caused by user-specified flags) so that they do not break our
checks for C++ feature availability.
2017-09-19 09:25:30 -04:00
Brad King
eb3abf8b2b C++ feature checks: Prepare for multiple check output filters 2017-09-19 09:22:54 -04:00
Brad King
4e14498f4f Drop now-unused definition of CM_OVERRIDE 2017-09-15 10:06:41 -04:00
Daniel Pfeifer
5962db4389 Use C++11 nullptr 2017-08-24 23:39:47 +02:00
Daniel Pfeifer
ac6660b671 Merge topic 'cxx11-unordered'
cbcfb79f Use C++11 unordered containers

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1174
2017-08-23 05:11:40 -04:00
Daniel Pfeifer
cbcfb79f9c Use C++11 unordered containers 2017-08-22 23:05:27 +02:00
Brad King
e4aafbf596 Fix CM_FALLTHROUGH with -Wunused-parameter
Fix the test code that we `try_compile` to avoid unused parameter
warnings that cause the check to fail.
2017-08-22 08:13:30 -04:00
Brad King
f44d9bcc8f C++ feature checks: Improve exclusion of "0 Warning(s)"
Simply matching "0 Warning" may match "10 Warning(s)".  Instead remove
the entire `    0 Warning(s)` content from the MSBuild output before
searching it for warnings.

Issue: #16942
2017-06-08 09:22:09 -04:00
Walter Gray
f4ce396254 C++ feature checks: Do not match "0 Warning(s)" as a warning
The change in commit v3.9.0-rc1~6^2~1 (C++ feature checks: check output
for '[Ww]arning', 2017-06-03) accidentally matches `0 Warning(s)` in the
output and always thinks a warning exists, thus failing all checks in
Visual Studio builds.

Fixes: #16942
2017-06-06 08:55:43 -04:00
Daniel Pfeifer
8d7b3ef5d4 Provide and use CM_FALLTHROUGH 2017-06-03 08:38:51 +02:00