2

I built boringssl with cmake and msvc Then I tried to build with clang-cl so I used -T"LLVM-vs2014" in vmake arguments

Clang-cl uses cl arguments however cmake used gcc style arguments without adding -Xclang

kreuzerkrieg
  • 3,009
  • 3
  • 28
  • 59
dev65
  • 1,440
  • 10
  • 25

2 Answers2

5

The proper way to handle this case is checking for

(CMAKE_CXX_COMPILER_ID STREQUAL Clang AND "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC"))
arrowd
  • 33,231
  • 8
  • 79
  • 110
0

the problem was here :

if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wshadow -Werror -Wno-error=shadow -Wno-error=unused-value -ggdb -std=gnu89")
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wshadow -Werror -Wno-error=shadow -Wno-error=unused-value -ggdb -std=c++0x")

I changed Clang to Clng so clang-cl wasn't identified as clang.exe which take gcc style arguments

dev65
  • 1,440
  • 10
  • 25
  • Can you clarify why you chose the string `Clng`? Is that an identifier for a specific version of clang, or is it meant as a random string that matches nothing? – emmenlau Sep 03 '20 at 08:30