The following issue has been SUBMITTED. ====================================================================== https://cmake.org/Bug/view.php?id=15897 ====================================================================== Reported By: Paul "TBBle" Hampson Assigned To: ====================================================================== Project: CMake Issue ID: 15897 Category: CMake Reproducibility: always Severity: minor Priority: normal Status: new ====================================================================== Date Submitted: 2016-01-02 02:10 AEDT Last Modified: 2016-01-02 02:10 AEDT ====================================================================== Summary: 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. ====================================================================== Issue History Date Modified Username Field Change ====================================================================== 2016-01-02 02:10 Paul "TBBle" HampsonNew Issue ====================================================================== -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers