From 224a0b7f4743c8dd8b6fed193f0f5ee47f653b6d Mon Sep 17 00:00:00 2001 From: Milan Kriz Date: Fri, 13 Sep 2024 09:48:44 +0200 Subject: [PATCH] Enforce /permissive- option for MSVC compilation --- cmake/toolchain-windows64-msvc.cmake | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cmake/toolchain-windows64-msvc.cmake b/cmake/toolchain-windows64-msvc.cmake index de36020..e060ce4 100644 --- a/cmake/toolchain-windows64-msvc.cmake +++ b/cmake/toolchain-windows64-msvc.cmake @@ -14,8 +14,11 @@ set(COMPILER_MP_FLAG "/MP${PROCESS_MAX}") # set big-obj flag set(COMPILER_BIG_OBJ_FLAG "/bigobj") +# set /permissive- mode to enable "Standards conformance" +set(COMPILER_PERMISSIVE_FLAG "/permissive-") + # set C flags (CMake adds /EHsc by default) -set(CMAKE_C_FLAGS_INIT "${COMPILER_MP_FLAG} ${COMPILER_BIG_OBJ_FLAG}") +set(CMAKE_C_FLAGS_INIT "${COMPILER_MP_FLAG} ${COMPILER_BIG_OBJ_FLAG} ${COMPILER_PERMISSIVE_FLAG}") # set CXX flags (CMake adds /EHsc by default) -set(CMAKE_CXX_FLAGS_INIT "${COMPILER_MP_FLAG} ${COMPILER_BIG_OBJ_FLAG}") +set(CMAKE_CXX_FLAGS_INIT "${COMPILER_MP_FLAG} ${COMPILER_BIG_OBJ_FLAG} ${COMPILER_PERMISSIVE_FLAG}")