From cf2b42246cf8d6b59dc5c986b099eff63c73d647 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EB=B0=95=EC=A2=85=ED=98=84/=EB=8F=99=EC=9E=91=EC=A0=9C?= =?utf8?q?=EC=96=B4Lab=28SR=29/Staff=20Engineer/=EC=82=BC=EC=84=B1?= =?utf8?q?=EC=A0=84=EC=9E=90?= Date: Tue, 3 Jul 2018 11:01:09 +0900 Subject: [PATCH] Introduce 'ENABLE_STRICT_BUILD' option (#462) * Introduce 'ENABLE_STRICT_BUILD' option This commit introduces 'ENABLE_STRICR_BUILD' option which allows us to detect compiler warnings as error. Signed-off-by: Jonghyun Park * Fix a typo (wraning -> warning) --- CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index b76a50f..94eb03b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,10 +49,17 @@ endif(${ENABLE_COVERAGE} AND NOT ${ENABLE_TEST}) option(ENABLE_EXAMPLE_BUILD "Build examples" ON) option(ENABLE_CONTRIB_BUILD "Build incubating projects under contrib/" ON) +option(ENABLE_STRICT_BUILD "Treat warning as error" OFF) ### ### Target ### +add_library(nncc_common INTERFACE) +if(ENABLE_STRICT_BUILD) + # TODO Remove -Wno-reoder + target_compile_options(nncc_common INTERFACE -Werror -Wall -Wextra -Wno-reorder) +endif(ENABLE_STRICT_BUILD) + add_library(nncc_coverage INTERFACE) if(ENABLE_COVERAGE) target_compile_options(nncc_coverage INTERFACE -g -O0 -fprofile-arcs -ftest-coverage) @@ -64,6 +71,7 @@ endif(ENABLE_COVERAGE) ### function(add_nncc_library) add_library(${ARGV}) + target_link_libraries(${ARGV0} PRIVATE nncc_common) target_link_libraries(${ARGV0} PUBLIC nncc_coverage) endfunction(add_nncc_library) -- 2.7.4