View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0015897 | CMake | CMake | public | 2016-01-01 10:10 | 2016-06-10 14:21 | ||||
Reporter | Paul "TBBle" Hampson | ||||||||
Assigned To | Brad King | ||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||
Status | closed | Resolution | fixed | ||||||
Platform | Mingw64/msys2 | OS | Windows | OS Version | 10 | ||||
Product Version | CMake 3.4.1 | ||||||||
Target Version | CMake 3.5 | Fixed in Version | CMake 3.5 | ||||||
Summary | 0015897: Clang CXX feature detection disabled on WIN32 platforms | ||||||||
Description | When using clang from mingw64 under msys, the supplied repro case fails with: CMake Error at CMakeLists.txt:12 (target_compile_features): target_compile_features no known features for CXX compiler "Clang" version 3.7.0. This is because when Clang C++ feature detection support was added in https://cmake.org/gitweb?p=cmake.git;a=commit;h=cda233194f9caab8867b2451f3d859080a233d45 [^] (specifically Modules/Compiler/Clang-CXX.cmake, although Modules/Compiler/Clang-C.cmake has the same conditions) the following was done: * The condition to bail out detecting a -std= flag for clang was expanded to also cover WIN32 (This breaks the CXX_STANDARD property) - line 9 * If not UNIX, no compiler features are recorded (This breaks target_compile_features) - line 52 It's not clear why these conditions were used, perhaps there's some interaction with clang-cl (Clang emulating MSVC)? If that was the case, then the first condition should be changed to test that, as done earlier in the file, rather than blocking all WIN32-based clang compilers. | ||||||||
Steps To Reproduce | Given CMakeLists.txt: cmake_minimum_required(VERSION 3.4.1 FATAL_ERROR) project(test1 CXX) # Globally C++11 set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) file(WRITE test1.cpp "int main(int argc, char** argv) {auto x=argc; return x;}") add_executable(test1 test1.cpp) target_compile_features(test1 PRIVATE cxx_auto_type) Running the following in the MINGW64 environment of msys2 works: CXX=g++ cmake .. -G"MSYS Makefiles" && cmake --build . but the following fails to generate: CXX=clang++ cmake .. -G"MSYS Makefiles" && cmake --build . If the target_compile_features directive is removed, then both generate, but the latter will fail to build, noting that 'auto' is a C++11 feature. Test based on https://cmake.org/pipermail/cmake/2015-January/059593.html [^] | ||||||||
Additional Information | I tested that removing the WIN32 and UNIX parts of the conditionals I mentioned got MSYS working, but I don't happen to have clang-cl installed to verify that it wasn't broken by doing this. | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | |||||||||
Relationships | |||||||||||
|
Relationships |
Notes | |
(0040147) Brad King (manager) 2016-01-07 15:08 |
IIRC the only reason the condition was added is that the original author was not able to test on MinGW Clang (or GNU) at the time, and we have no nightly testing for MinGW Clang. This case for Clang appears to be the same case for GNU that was reported in 0015443 and fixed by: Record compile features for GNU on Windows https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f94727a9 [^] Does a patch of that form work here too? |
(0040174) Paul "TBBle" Hampson (reporter) 2016-01-10 23:35 |
That's the same as part of what I did local to fix it, removing UNIX from line 52. However, it's not complete as the WIN32 check on line 9 causes the file to early-out before it hits that point. Note that I tested my fix on msys2 mingw64's clang but not Cygwin or any other platform's clang. Specifically, I didn't test with clang-cl. I believe my fix is correct though. If my fix isn't clear in my description, I can see about producing a diff, but it's: Remove "WIN32 OR" from line 9 Remove "UNIX AND" from line 52 |
(0040182) Brad King (manager) 2016-01-11 10:19 |
Thanks. This should fix it for MinGW Clang: Record compile features for MinGW Clang on Windows https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3baca636 [^] Hopefully someone with clang-cl will be able to help out with that version. |
(0041272) Kitware Robot (administrator) 2016-06-10 14:21 |
This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2016-01-01 10:10 | Paul "TBBle" Hampson | New Issue | |
2016-01-07 15:05 | Brad King | Relationship added | related to 0015443 |
2016-01-07 15:08 | Brad King | Note Added: 0040147 | |
2016-01-10 23:35 | Paul "TBBle" Hampson | Note Added: 0040174 | |
2016-01-11 10:19 | Brad King | Note Added: 0040182 | |
2016-01-11 10:20 | Brad King | Assigned To | => Brad King |
2016-01-11 10:20 | Brad King | Status | new => resolved |
2016-01-11 10:20 | Brad King | Resolution | open => fixed |
2016-01-11 10:20 | Brad King | Fixed in Version | => CMake 3.5 |
2016-01-11 10:20 | Brad King | Target Version | => CMake 3.5 |
2016-01-29 13:27 | Brad King | Relationship added | related to 0015943 |
2016-06-10 14:21 | Kitware Robot | Note Added: 0041272 | |
2016-06-10 14:21 | Kitware Robot | Status | resolved => closed |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |