Skip to content

Commit

Permalink
Added STRICT_BUILD_MODE option
Browse files Browse the repository at this point in the history
This option is disabled by default, but when enabled flags warnings as
errors and may enable additional warnings.

WIP PixarAnimationStudios#1327 and internal issue #OSD-434
  • Loading branch information
davidgyu committed Jun 6, 2024
1 parent 27bca52 commit cb2a4d5
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,15 @@ if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANGCC OR CMAKE_COMPILER_IS_IC

elseif(MSVC)

list(APPEND OSD_COMPILER_FLAGS
/W3 # Use warning level recommended for production purposes.
/WX # Treat all compiler warnings as errors.
# Use warning level recommended for production purposes.
list(APPEND OSD_COMPILER_FLAGS /W3)

# Treat all compiler warnings as errors in strict build mode.
if (STRICT_BUILD_MODE)
list(APPEND OSD_COMPILER_FLAGS /WX)
endif()

list(APPEND OSD_COMPILER_FLAGS
# warning C4005: macro redefinition
/wd4005

Expand All @@ -254,7 +259,9 @@ elseif(MSVC)
/wd4350
# warning C4548: expression before comma has no effect; expected expression with side-effect
/wd4548
)

list(APPEND OSD_COMPILER_FLAGS
# Make sure WinDef.h does not define min and max macros which
# will conflict with std::min() and std::max().
/DNOMINMAX
Expand Down Expand Up @@ -316,6 +323,8 @@ option(PTEX_LOCATION "Path to Ptex" "")
option(GLEW_LOCATION "Path to GLEW" "")
option(GLFW_LOCATION "Path to GLFW" "")

option(STRICT_BUILD_MODE "Turn on additional warnings, Enforce all warnings as errors." OFF)

option(NO_LIB "Disable the opensubdiv libs build (caveat emptor)" OFF)
option(NO_EXAMPLES "Disable examples build" OFF)
option(NO_TUTORIALS "Disable tutorials build" OFF)
Expand Down

0 comments on commit cb2a4d5

Please sign in to comment.