mirror of
https://github.com/json-c/json-c.git
synced 2026-03-21 14:09:06 +08:00
Merge pull request #898 from Seagate/fix_cmake_clangcl
bug: Fixing Cmake build when using clang-cl
This commit is contained in:
@@ -177,7 +177,17 @@ endif()
|
||||
check_symbol_exists(_isnan "float.h" HAVE_DECL__ISNAN)
|
||||
check_symbol_exists(_finite "float.h" HAVE_DECL__FINITE)
|
||||
|
||||
if ((MSVC AND NOT (MSVC_VERSION LESS 1800)) OR MINGW OR CYGWIN OR UNIX OR AMIGA)
|
||||
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
|
||||
# Detect clang-cl.exe, it is Clang but with MSVC compatible command line arguments
|
||||
execute_process (COMMAND ${CMAKE_C_COMPILER} -? ERROR_QUIET OUTPUT_QUIET RESULT_VARIABLE _clang_result)
|
||||
if (_clang_result EQUAL 0)
|
||||
set(CLANG_CL TRUE)
|
||||
else()
|
||||
set(CLANG_CL FALSE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if ((MSVC AND NOT (MSVC_VERSION LESS 1800)) OR MINGW OR CYGWIN OR UNIX OR AMIGA OR CLANG_CL)
|
||||
check_symbol_exists(INFINITY "math.h" HAVE_DECL_INFINITY)
|
||||
check_symbol_exists(isinf "math.h" HAVE_DECL_ISINF)
|
||||
check_symbol_exists(isnan "math.h" HAVE_DECL_ISNAN)
|
||||
@@ -328,9 +338,7 @@ if (NOT DEFINED CMAKE_C_COMPILER_FRONTEND_VARIANT OR "${CMAKE_C_COMPILER_FRONTEN
|
||||
elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
|
||||
set(CMAKE_C_COMPILER_FRONTEND_VARIANT "GNU")
|
||||
elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
|
||||
# Detect clang-cl.exe, it is Clang but with MSVC compatible command line arguments
|
||||
execute_process (COMMAND ${CMAKE_C_COMPILER} -? ERROR_QUIET OUTPUT_QUIET RESULT_VARIABLE _clang_result)
|
||||
if (_clang_result EQUAL 0)
|
||||
if (CLANG_CL)
|
||||
set(CMAKE_C_COMPILER_FRONTEND_VARIANT "MSVC")
|
||||
else()
|
||||
set(CMAKE_C_COMPILER_FRONTEND_VARIANT "GNU")
|
||||
|
||||
Reference in New Issue
Block a user