From 9e2a42ebf9485ee38f4ade367368188d1edf0d78 Mon Sep 17 00:00:00 2001 From: Kimmo Varis Date: Sun, 20 Dec 2009 10:45:57 +0200 Subject: [PATCH] CMake - use more strict compiler flags. --- cli/CMakeLists.txt | 7 +++++++ gui/CMakeLists.txt | 7 +++++++ lib/CMakeLists.txt | 9 +++++++++ test/CMakeLists.txt | 7 +++++++ 4 files changed, 30 insertions(+) diff --git a/cli/CMakeLists.txt b/cli/CMakeLists.txt index c9367cf5f..1fa7dbd9c 100644 --- a/cli/CMakeLists.txt +++ b/cli/CMakeLists.txt @@ -27,6 +27,13 @@ set(CHECK_LIBS ) endif (WIN32 AND NOT CYGWIN) +if (CMAKE_COMPILER_IS_GNUCXX) + set(CMAKE_CXX_FLAGS + ${CMAKE_CXX_FLAGS} + "-Wall -Wextra -pedantic" + ) +endif (CMAKE_COMPILER_IS_GNUCXX) + include_directories (${CPPCHECK_SOURCE_DIR}/lib) ADD_EXECUTABLE(cppcheck ${CHECKCLI_SRCS}) TARGET_LINK_LIBRARIES(cppcheck ${CHECK_LIBS}) diff --git a/gui/CMakeLists.txt b/gui/CMakeLists.txt index 680bd95eb..b316f4f2c 100644 --- a/gui/CMakeLists.txt +++ b/gui/CMakeLists.txt @@ -100,6 +100,13 @@ set(CHECK_LIBS ) endif (WIN32 AND NOT CYGWIN) +if (CMAKE_COMPILER_IS_GNUCXX) + set(CMAKE_CXX_FLAGS + ${CMAKE_CXX_FLAGS} + "-Wall" + ) +endif (CMAKE_COMPILER_IS_GNUCXX) + # Generate rules for building source files from the resources QT4_ADD_RESOURCES(CHECK_RCC_SRCS ${CHECK_RCCS}) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index fed1305f1..abc9d16c7 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -1,6 +1,8 @@ # Minimal CMake build file to build static cppcheck library # This static library is used to build executables: # - cli +# - tests +# - Qt GUI SET(CHECKLIB_SRCS checkautovariables.cpp @@ -24,5 +26,12 @@ SET(CHECKLIB_SRCS tokenize.cpp ) +if (CMAKE_COMPILER_IS_GNUCXX) + set(CMAKE_CXX_FLAGS + ${CMAKE_CXX_FLAGS} + "-Wall -Wextra -pedantic" + ) +endif (CMAKE_COMPILER_IS_GNUCXX) + ADD_LIBRARY(checklib STATIC ${CHECKLIB_SRCS}) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index c78eec661..b0d722c97 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -41,6 +41,13 @@ set(CHECK_LIBS ) endif (WIN32 AND NOT CYGWIN) +if (CMAKE_COMPILER_IS_GNUCXX) + set(CMAKE_CXX_FLAGS + ${CMAKE_CXX_FLAGS} + "-Wall -Wextra -pedantic" + ) +endif (CMAKE_COMPILER_IS_GNUCXX) + include_directories (${CPPCHECK_SOURCE_DIR}/lib) ADD_EXECUTABLE(test ${CHECKTEST_SRCS}) TARGET_LINK_LIBRARIES(test ${CHECK_LIBS})