Skip to content

Commit

Permalink
CMake: fix MSVC warnings
Browse files Browse the repository at this point in the history
MSVC can't recognize these parameters.

Signed-off-by: Yuhang Zhao <[email protected]>
  • Loading branch information
wangwenx190 authored and smohantty committed Apr 5, 2021
1 parent fa44b75 commit 7c5b40c
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 21 deletions.
32 changes: 17 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

12 changes: 9 additions & 3 deletions example/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
8 changes: 5 additions & 3 deletions src/vector/stb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 7c5b40c

Please sign in to comment.