Skip to content

Commit

Permalink
Fix Clang/MSVC compile options handling
Browse files Browse the repository at this point in the history
Use `CMAKE_LANG_COMPILER_FRONTEND_VARIANT` instead of
`CMAKE_LANG_SIMULATE_ID` for specifying compile flags
  • Loading branch information
MEhrn00 committed Aug 31, 2024
1 parent 1e5d99f commit 9cc9e46
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,13 @@ target_include_directories(lexy_dev INTERFACE
)

if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
if("${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC")
if("${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "MSVC")
target_compile_options(lexy_dev INTERFACE /WX /W3 /D _CRT_SECURE_NO_WARNINGS)
else()
target_compile_options(lexy_dev INTERFACE -pedantic-errors -Werror -Wall -Wextra -Wconversion -Wsign-conversion)
if("${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC")
target_compile_options(lexy_dev INTERFACE -D_CRT_SECURE_NO_WARNINGS)
endif()
endif()
# clang doesn't like operator precedence rules we're using for the DSL.
target_compile_options(lexy_dev INTERFACE -Wno-shift-op-parentheses -Wno-parentheses-equality)
Expand Down

0 comments on commit 9cc9e46

Please sign in to comment.