From 41364185388e9b924966ed71a65c9b0547dc88df Mon Sep 17 00:00:00 2001 From: Audrow Nash Date: Tue, 29 Sep 2020 09:37:22 -0700 Subject: [PATCH 1/3] Add warnings Signed-off-by: Audrow Nash --- rcl_logging_spdlog/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rcl_logging_spdlog/CMakeLists.txt b/rcl_logging_spdlog/CMakeLists.txt index 0ae2837..5c50ff9 100644 --- a/rcl_logging_spdlog/CMakeLists.txt +++ b/rcl_logging_spdlog/CMakeLists.txt @@ -20,6 +20,12 @@ find_package(spdlog REQUIRED) if(NOT WIN32) add_compile_options(-Wall -Wextra -Wpedantic) endif() +if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang") + add_compile_options( + -Wformat=2 -Wconversion -Woverloaded-virtual -Wshadow + -Wnon-virtual-dtor -Wold-style-cast -Wcast-qual + ) +endif() add_library(${PROJECT_NAME} src/rcl_logging_spdlog.cpp) target_link_libraries(${PROJECT_NAME} spdlog::spdlog) From dc4337cb0d8af5ea431a52417d535f06c6518021 Mon Sep 17 00:00:00 2001 From: Audrow Nash Date: Tue, 29 Sep 2020 09:51:44 -0700 Subject: [PATCH 2/3] Make CMake check for C++ compiler rather than C compiler Signed-off-by: Audrow Nash Co-authored-by: Chris Lalancette --- rcl_logging_spdlog/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rcl_logging_spdlog/CMakeLists.txt b/rcl_logging_spdlog/CMakeLists.txt index 5c50ff9..ef6fb8b 100644 --- a/rcl_logging_spdlog/CMakeLists.txt +++ b/rcl_logging_spdlog/CMakeLists.txt @@ -20,7 +20,7 @@ find_package(spdlog REQUIRED) if(NOT WIN32) add_compile_options(-Wall -Wextra -Wpedantic) endif() -if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang") +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_C_COMPILER_ID MATCHES "Clang") add_compile_options( -Wformat=2 -Wconversion -Woverloaded-virtual -Wshadow -Wnon-virtual-dtor -Wold-style-cast -Wcast-qual From eb33840c65ac4ece38b2e8ab06bd50a6125c08ed Mon Sep 17 00:00:00 2001 From: Audrow Nash Date: Wed, 30 Sep 2020 08:55:32 -0700 Subject: [PATCH 3/3] Update Clang compiler check to look for C++ Signed-off-by: Audrow Nash Co-authored-by: Chen Lihui --- rcl_logging_spdlog/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rcl_logging_spdlog/CMakeLists.txt b/rcl_logging_spdlog/CMakeLists.txt index ef6fb8b..3e14735 100644 --- a/rcl_logging_spdlog/CMakeLists.txt +++ b/rcl_logging_spdlog/CMakeLists.txt @@ -20,7 +20,7 @@ find_package(spdlog REQUIRED) if(NOT WIN32) add_compile_options(-Wall -Wextra -Wpedantic) endif() -if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_C_COMPILER_ID MATCHES "Clang") +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_options( -Wformat=2 -Wconversion -Woverloaded-virtual -Wshadow -Wnon-virtual-dtor -Wold-style-cast -Wcast-qual