From: Yuhang Zhao <2546789017@qq.com> Date: Thu, 25 Mar 2021 05:56:08 +0000 (+0800) Subject: CMake: fix MSVC warnings X-Git-Tag: submit/tizen/20210531.030446~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3682828434737c2f8a57d971c573ebaca3b83598;p=platform%2Fcore%2Fuifw%2Flottie-player.git CMake: fix MSVC warnings MSVC can't recognize these parameters. Change-Id: I6be8de53b1ae0ee84eaef4ae47113d5376634b44 Signed-off-by: Yuhang Zhao <2546789017@qq.com> --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 7591437..593276a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,23 +46,26 @@ target_include_directories(rlottie ) #declare common target compilation options -target_compile_options(rlottie - PUBLIC - PRIVATE - -std=c++14 - -fno-exceptions - -fno-unwind-tables - -fno-asynchronous-unwind-tables - -fno-rtti - -Wall - -fvisibility=hidden - ) - -#MSVC does not recognize these parameters -if (NOT WIN32) +if(MSVC) + target_compile_options(rlottie + PUBLIC + PRIVATE + /std:c++14 + /EHs-c- # disable exceptions + /GR- # disable RTTI + /W3 + ) +else() target_compile_options(rlottie PUBLIC PRIVATE + -std=c++14 + -fno-exceptions + -fno-unwind-tables + -fno-asynchronous-unwind-tables + -fno-rtti + -Wall + -fvisibility=hidden -Wnon-virtual-dtor -Woverloaded-virtual -Wno-unused-parameter @@ -197,4 +200,3 @@ export(EXPORT rlottie-targets FILE ${CMAKE_CURRENT_BINARY_DIR}/rlottieTargets.cm #Register package in user's package registry export(PACKAGE rlottie) - diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index b42cc96..aacdc7c 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -1,8 +1,14 @@ add_executable(lottie2gif "lottie2gif.cpp") -target_compile_options(lottie2gif - PRIVATE - -std=c++14) +if(MSVC) + target_compile_options(lottie2gif + PRIVATE + /std:c++14) +else() + target_compile_options(lottie2gif + PRIVATE + -std=c++14) +endif() target_link_libraries(lottie2gif rlottie) diff --git a/src/vector/stb/CMakeLists.txt b/src/vector/stb/CMakeLists.txt index 4861e99..b668b43 100644 --- a/src/vector/stb/CMakeLists.txt +++ b/src/vector/stb/CMakeLists.txt @@ -2,9 +2,11 @@ if(LOTTIE_MODULE) add_library(rlottie-image-loader SHARED stb_image.cpp ) - target_compile_options(rlottie-image-loader PRIVATE - -fvisibility=hidden - ) + if(NOT MSVC) + target_compile_options(rlottie-image-loader PRIVATE + -fvisibility=hidden + ) + endif() get_filename_component(LOTTIE_MODULE_FILENAME ${LOTTIE_MODULE_PATH} NAME) get_filename_component(LOTTIE_MODULE_DIR ${LOTTIE_MODULE_PATH} DIRECTORY)