Skip to content

Commit

Permalink
Fix Build using IntelLLVM compiler
Browse files Browse the repository at this point in the history
- Remove unknown flags in the IntelLLVM windows compiler
- Disable warnings as errors if using IntelLLVM compiler due to
  third-party errors.

Signed-off-by: Neil R. Spruit <neil.r.spruit@intel.com>
  • Loading branch information
nrspruit committed Mar 14, 2024
1 parent 87c3ab7 commit 7006996
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ if(MSVC)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DYNAMICBASE")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /guard:cf")
# enable Spectre Mitigation, not supported by clang-cl
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL Clang)
if((NOT CMAKE_CXX_COMPILER_ID STREQUAL Clang) AND (NOT CMAKE_CXX_COMPILER_ID STREQUAL IntelLLVM))
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Qspectre")
endif()
if(NOT CMAKE_C_COMPILER_ID STREQUAL Clang)
if((NOT CMAKE_C_COMPILER_ID STREQUAL Clang) AND NOT (CMAKE_C_COMPILER_ID STREQUAL IntelLLVM))
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Qspectre")
endif()
endif()
Expand All @@ -106,19 +106,23 @@ if(NOT MSVC)
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -Wnon-virtual-dtor")
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL IntelLLVM)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -Wnon-virtual-dtor")
endif()
endif()

#MSVC compile flags
if(MSVC)
string(REPLACE "/MDd" "/MTd" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
string(REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")

# treat warnings as errors
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX /W3")
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL IntelLLVM)
# treat warnings as errors
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX /W3")
endif()

# enable multi-process compilation, not supported by clang-cl
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL Clang)
if((NOT CMAKE_CXX_COMPILER_ID STREQUAL Clang) AND (NOT CMAKE_CXX_COMPILER_ID STREQUAL IntelLLVM))
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
endif()

Expand Down

0 comments on commit 7006996

Please sign in to comment.