Skip to content

Commit 21a8b5f

Browse files
adamrettermeta-codesync[bot]
authored andcommitted
Fixes the Windows VS 2022 build (#14280)
Summary: When building a Release on Windows RTTI is not available, so asserts that use dynamic_cast need to be disabled Pull Request resolved: #14280 Reviewed By: nmk70 Differential Revision: D91807791 Pulled By: mszeszko-meta fbshipit-source-id: e29c19c757bcd076a1f09ed40b306bb50ba9e882
1 parent e94df3d commit 21a8b5f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,10 @@ if(MSVC)
219219
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zi /nologo /EHsc /GS /Gd /GR /GF /fp:precise /Zc:wchar_t /Zc:forScope /errorReport:queue")
220220
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /FC /d2Zi+ /W4 /wd4127 /wd4996 /wd4100 /wd4324")
221221
endif()
222+
if(CMAKE_BUILD_TYPE STREQUAL "Release")
223+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /DNDEBUG")
224+
message(STATUS "Setting /DNDEBUG as CMAKE_BUILD_TYPE is set to ${CMAKE_BUILD_TYPE}")
225+
endif()
222226
else()
223227
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W -Wextra -Wall -pthread")
224228
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsign-compare -Wshadow -Wno-unused-parameter -Wno-unused-variable -Woverloaded-virtual -Wnon-virtual-dtor -Wno-missing-field-initializers -Wno-strict-aliasing -Wno-invalid-offsetof")

0 commit comments

Comments
 (0)