Let’s make compiler to check return value in cpp functions. If there is wrong data type for interface’s return value, compiling process will fail and gives us error information.
message(STATUS "===== configure compiling option =====, CMAKE_GENERATOR: ${CMAKE_GENERATOR}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror=return-type")
if(CMAKE_GENERATOR MATCHES "Ninja")
set(CMAKE_NINJA_FORCE_RESPONSE_FILE OFF)
endif()
We can also check uninitialized variables in C++ file by the setting:
-Werror=uninitialized