On 08/02/2016 06:59 PM, Chaoren Lin wrote: >> In the gcc-like variant the CMAKE_{C,CXX}_SIMULATE_ID >> should be detected as GNU and cause the existing code to work. > > Huh, it doesn't look like that variable is set automatically when using > clang with the gcc toolchain. Is that supposed to happen? > It should be set manually (say, in a toolchain file)?
It is supposed to be detected automatically. Whenever Clang is detected on Windows the _SIMULATE_ID should be detected too. I found the problem. The simulate id detection is done here: https://gitlab.kitware.com/cmake/cmake/blob/v3.6.1/Modules/Compiler/Clang-DetermineCompilerInternal.cmake#L12-15 and it only looks for MSVC. Grepping for SIMULATE_ID reveals that it is used for Intel and Clang but only ever detects when MSVC is simulated. All consuming code paths are interested in whether SIMULATE_ID==MSVC and otherwise assume GNU, except cmGlobalNinjaGenerator::EnableLanguage. It will take some investigation to decide how/whether to set SIMULATE_ID to GNU. Alternatively the corresponding test in the Ninja generator could be changed to look for `COMPILER_ID == Clang && SIMULATE_ID != MSVC`. -Brad -- 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