Skip to content

Fix compilation of CMake with clang-cl

Zsolt Parragi requested to merge dutow/cmake:clangcl-fixes into master

This commit fixes build/test issues when compiled with clang-cl and ninja on Windows.

Build/tests were run with clang 6.0.1 x64.

  • Can't compile in C++17 mode: GUID functions in ATL cause compilation errors
  • ExitCode constants (such as STATUS_NO_MEMORY) can't fit into an int type, only into an unsigned.
  • Linkage issues caused by make_unique (maybe clang-cl bug?) ** unresolved std::_Iosb::_Openmode in cmExportFileGenerator::GenerateImportFile ** unresolved std::_Iosb::app in cmExportLibraryDependenciesCommand::ConstFinalPass
  • Disabled the system include unused variable test in ExportImport when clang is in MSVC compatible mode
  • Disabled CxxDialect testcase when clang is in MSVC compatible mode, as it doesn't support typeof
  • Changed Module.WriteCompilerDetectionHeader to treat clang-cl as MSVC
  • Disabled the SystemIncludeDirectories testcase within IncludeDirectories when clang is in MSVC compatible mode
  • Disabled the CMakeOnly.CheckCXXCompilerFlag testcase when clang is in MSVC compatible mode
Edited by Brad King

Merge request reports