(Windows) Suppressed some compiler warnings when building the external dependencies using MSVC

This commit is contained in:
Leon Styhre 2023-08-10 22:25:05 +02:00
parent 07637a0885
commit b218c4806b

View file

@ -24,14 +24,9 @@ endif()
unset(CMAKE_CXX_FLAGS) unset(CMAKE_CXX_FLAGS)
unset(CMAKE_EXE_LINKER_FLAGS) unset(CMAKE_EXE_LINKER_FLAGS)
if(WIN32) # Strip the DLL files when building with MinGW.
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC) if(WIN32 AND NOT CMAKE_CXX_COMPILER_ID MATCHES MSVC)
# Disable DLL interface warnings.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4251")
else()
# Strip the DLL files when building with MinGW.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s")
endif()
endif() endif()
if (WIN32) if (WIN32)
@ -42,6 +37,11 @@ endif()
add_subdirectory(lunasvg EXCLUDE_FROM_ALL) add_subdirectory(lunasvg EXCLUDE_FROM_ALL)
# Disable LunaSVG DLL interface warnings and narrowing conversion warnings.
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
target_compile_options(lunasvg PRIVATE "/wd4251" "/wd4267")
endif()
# Disable threading support for rlottie as this functionality actually leads to far worse # Disable threading support for rlottie as this functionality actually leads to far worse
# performance. As well there is a bug on Windows that makes rlottie hang forever on application # performance. As well there is a bug on Windows that makes rlottie hang forever on application
# shutdown if compiled using MinGW with threading support enabled. # shutdown if compiled using MinGW with threading support enabled.
@ -53,14 +53,14 @@ if(EMSCRIPTEN)
set(CMAKE_CXX_FLAGS -pthread) set(CMAKE_CXX_FLAGS -pthread)
endif() endif()
add_subdirectory(rlottie EXCLUDE_FROM_ALL)
# rlottie generates a lot of annoying compiler warnings that we don't need to show. # rlottie generates a lot of annoying compiler warnings that we don't need to show.
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC) if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4244 /wd4267 /wd4530 /wd4996") target_compile_options(rlottie PRIVATE "/wd4244" "/wd4251" "/wd4263" "/wd4334" "/wd4267" "/wd4530" "/wd4996")
else() else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w") target_compile_options(rlottie PRIVATE "-w")
endif() endif()
add_subdirectory(rlottie EXCLUDE_FROM_ALL)
# Build LunaSVG before rlottie. # Build LunaSVG before rlottie.
add_dependencies(rlottie lunasvg) add_dependencies(rlottie lunasvg)