From 9cc9e46bd4e1cc7f3475a13f3f31f6bebad1c06d Mon Sep 17 00:00:00 2001 From: Matt Ehrnschwender Date: Sat, 31 Aug 2024 14:53:12 -0400 Subject: [PATCH] Fix Clang/MSVC compile options handling Use `CMAKE_LANG_COMPILER_FRONTEND_VARIANT` instead of `CMAKE_LANG_SIMULATE_ID` for specifying compile flags --- src/CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 709cc831..be86d132 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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)