summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2016-10-01 18:48:44 +0300
committerTomi Valkeinen <tomi.valkeinen@ti.com>2016-10-01 18:57:13 +0300
commit2293f887ac348cc703f54ff68600db7fc76974f6 (patch)
tree01e9b470d5b71467bd09fecc0438bcfc76d2feac
parentcf01a3f31e109cf97a5de27486442bec852bd4b8 (diff)
Add cmake option for -Werror
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
-rw-r--r--CMakeLists.txt6
1 files changed, 6 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d9bc30c..482771f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,6 +18,7 @@ ENDIF()
string(TOUPPER "${CMAKE_BUILD_TYPE}" U_CMAKE_BUILD_TYPE)
option(BUILD_SHARED_LIBS "Build shared libs" FALSE)
+option(TREAT_WARNINGS_AS_ERRORS "Treat warnings as errors" FALSE)
set(KMSXX_ENABLE_PYTHON ON CACHE BOOL "Enable Python wrappers")
set(KMSXX_ENABLE_KMSCUBE OFF CACHE BOOL "Enable kmscube")
@@ -38,6 +39,11 @@ SET(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
+if (TREAT_WARNINGS_AS_ERRORS)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
+endif()
+
# static link libc
# set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++")