summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2020-08-18 17:44:51 -0700
committerGitHub <noreply@github.com>2020-08-18 17:44:51 -0700
commit40f6a8a9354f335f9bbe05b1962172873c2913f0 (patch)
tree711cc44c3148dc336f8c9e445309ab02719116e2 /CMakeLists.txt
parent95c04e0fb7ae5b9b0c92f66d707fa579114f1569 (diff)
downloadwabt-40f6a8a9354f335f9bbe05b1962172873c2913f0.tar.gz
wabt-40f6a8a9354f335f9bbe05b1962172873c2913f0.tar.bz2
wabt-40f6a8a9354f335f9bbe05b1962172873c2913f0.zip
Enable -Werror during CI (#1522)
Fixes: #1249
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt16
1 files changed, 7 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d625dd15..fe043b73 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -121,10 +121,6 @@ if (COMPILER_IS_MSVC)
# disable warning C4800: implicit conversion from larger int to bool
add_definitions(-W3 -wd4018 -wd4056 -wd4756 -wd4267 -wd4244 -wd4800 -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS)
- if (WERROR)
- add_definitions(-WX)
- endif ()
-
if (NOT WITH_EXCEPTIONS)
# disable exception use in C++ library
add_definitions(-D_HAS_EXCEPTIONS=0)
@@ -145,10 +141,6 @@ else ()
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wold-style-cast")
- if (WERROR)
- add_definitions(-Werror)
- endif ()
-
if (NOT WITH_EXCEPTIONS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions")
endif ()
@@ -364,9 +356,15 @@ if (BUILD_LIBWASM)
target_link_libraries(wasm wabt)
target_include_directories(wasm PUBLIC third_party/wasm-c-api/include)
if (COMPILER_IS_MSVC)
+ if (WERROR)
+ target_compile_options(wasm PRIVATE -WX)
+ endif ()
target_compile_definitions(wasm PRIVATE "WASM_API_EXTERN=__declspec(dllexport)")
else ()
- target_compile_options(wasm PRIVATE -Wno-old-style-cast)
+ if (WERROR)
+ target_compile_options(wasm PRIVATE -Werror)
+ endif ()
+ target_compile_options(wasm PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-Wno-old-style-cast>)
target_compile_definitions(wasm PRIVATE "WASM_API_EXTERN=__attribute__((visibility(\"default\")))")
endif ()
set_target_properties(wasm PROPERTIES CXX_VISIBILITY_PRESET hidden)