From 4bf49fe990d8f894323d52d02b4bcf70e9eebb20 Mon Sep 17 00:00:00 2001 From: Vojtech Kral Date: Mon, 17 Sep 2018 13:34:29 +0200 Subject: Build: Make return value type mismatch an error on Unix --- xs/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'xs') diff --git a/xs/CMakeLists.txt b/xs/CMakeLists.txt index 8aa80278e..7d4c324f4 100644 --- a/xs/CMakeLists.txt +++ b/xs/CMakeLists.txt @@ -16,6 +16,12 @@ if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUXX) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fext-numeric-literals" ) endif() +if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + # On GCC and Clang, no return from a non-void function is a warning only. Here, we make it an error. + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=return-type" ) +endif() + + # Where all the bundled libraries reside? set(LIBDIR ${CMAKE_CURRENT_SOURCE_DIR}/src/) # For the bundled boost libraries (boost::nowide) -- cgit v1.2.3