From da4d906f99f4c1ead4f1b8ec61c9a3a3763c79c2 Mon Sep 17 00:00:00 2001 From: rnv Date: Thu, 13 Aug 2020 15:20:27 +0300 Subject: [PATCH] Debug compilation warnings on Windows. --- cmake/SalomeSetupPlatform.cmake | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/cmake/SalomeSetupPlatform.cmake b/cmake/SalomeSetupPlatform.cmake index c470e35..a1290e6 100644 --- a/cmake/SalomeSetupPlatform.cmake +++ b/cmake/SalomeSetupPlatform.cmake @@ -125,18 +125,28 @@ IF(NOT NO_CXX11_SUPPORT) ENDIF() # Fight warnings -IF(NOT (WIN32 OR APPLE)) +IF(NOT APPLE) OPTION(SALOME_DEBUG_WARNINGS "Report more warnings" OFF) OPTION(SALOME_TREAT_WARNINGS_AS_ERRORS "Treat warnings as errors" OFF) # Report more warnings MARK_AS_ADVANCED(SALOME_DEBUG_WARNINGS SALOME_TREAT_WARNINGS_AS_ERRORS) IF(SALOME_DEBUG_WARNINGS) - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wpedantic") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic") + IF(WIN32) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4") + ELSE() + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wpedantic") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic") + ENDIF() ENDIF() ## Treat all warnings as errors IF(SALOME_TREAT_WARNINGS_AS_ERRORS) - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror") + IF(WIN32) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX") + ELSE() + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror") + ENDIF() ENDIF() ENDIF() -- 2.39.2