From 8239c06a124e8445d426c654eb6d156ffac85b0b Mon Sep 17 00:00:00 2001 From: Louise Poubel Date: Tue, 22 Dec 2020 09:35:44 -0800 Subject: [PATCH 1/2] Enable make codecheck for ign-cmake Signed-off-by: Louise Poubel --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0d6c10ef..e6110e9f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -183,6 +183,12 @@ if (BUILD_TESTING AND BUILDSYSTEM_TESTING) add_subdirectory(examples) endif() +# Codecheck +set(CPPCHECK_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/include) +set(IGNITION_CMAKE_CODECHECK_DIR "${CMAKE_CURRENT_SOURCE_DIR}/codecheck") +include(IgnCodeCheck) +ign_setup_target_for_codecheck() + # Docs set(IGNITION_CMAKE_DOXYGEN_DIR "${CMAKE_CURRENT_SOURCE_DIR}/doc/doxygen") configure_file(${CMAKE_SOURCE_DIR}/api.md.in ${CMAKE_BINARY_DIR}/api.md) From 9b258c587c46a179e095c7f21dd03e14ce6e0c4f Mon Sep 17 00:00:00 2001 From: Louise Poubel Date: Tue, 22 Dec 2020 10:45:55 -0800 Subject: [PATCH 2/2] Move codecheck initialization to top-level and fix warnings Signed-off-by: Louise Poubel --- CMakeLists.txt | 8 +++++++- examples/CMakeLists.txt | 4 ---- examples/comp_deps/child/include/empty.hh | 16 ++++++++++++++++ examples/comp_deps/parent/include/empty.hh | 16 ++++++++++++++++ examples/use_component_depsA/src/empty.cc | 16 ++++++++++++++++ examples/use_component_depsB/src/empty.cc | 16 ++++++++++++++++ examples/use_component_depsC/src/empty.cc | 16 ++++++++++++++++ 7 files changed, 87 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e6110e9f..d60402b6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -184,7 +184,13 @@ if (BUILD_TESTING AND BUILDSYSTEM_TESTING) endif() # Codecheck -set(CPPCHECK_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/include) +set(CPPCHECK_DIRS + ${CMAKE_SOURCE_DIR}/examples +) +set(CPPCHECK_INCLUDE_DIRS + ${CMAKE_SOURCE_DIR}/include + ${CMAKE_SOURCE_DIR}/examples +) set(IGNITION_CMAKE_CODECHECK_DIR "${CMAKE_CURRENT_SOURCE_DIR}/codecheck") include(IgnCodeCheck) ign_setup_target_for_codecheck() diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 562f8235..7396cb5c 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -23,10 +23,6 @@ if (NOT CMAKE_GENERATOR MATCHES "Visual Studio") ) endif() -# test to see if we have programs necessary to run codecheck -include(IgnCodeCheck) -ign_setup_target_for_codecheck() - foreach(example ${example_directories}) set(run_codecheck false) if (${example} STREQUAL "ign_conf") diff --git a/examples/comp_deps/child/include/empty.hh b/examples/comp_deps/child/include/empty.hh index e69de29b..4e55a3a8 100644 --- a/examples/comp_deps/child/include/empty.hh +++ b/examples/comp_deps/child/include/empty.hh @@ -0,0 +1,16 @@ +/* + * Copyright (C) 2018 Open Source Robotics Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ diff --git a/examples/comp_deps/parent/include/empty.hh b/examples/comp_deps/parent/include/empty.hh index e69de29b..4e55a3a8 100644 --- a/examples/comp_deps/parent/include/empty.hh +++ b/examples/comp_deps/parent/include/empty.hh @@ -0,0 +1,16 @@ +/* + * Copyright (C) 2018 Open Source Robotics Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ diff --git a/examples/use_component_depsA/src/empty.cc b/examples/use_component_depsA/src/empty.cc index e69de29b..4e55a3a8 100644 --- a/examples/use_component_depsA/src/empty.cc +++ b/examples/use_component_depsA/src/empty.cc @@ -0,0 +1,16 @@ +/* + * Copyright (C) 2018 Open Source Robotics Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ diff --git a/examples/use_component_depsB/src/empty.cc b/examples/use_component_depsB/src/empty.cc index e69de29b..4e55a3a8 100644 --- a/examples/use_component_depsB/src/empty.cc +++ b/examples/use_component_depsB/src/empty.cc @@ -0,0 +1,16 @@ +/* + * Copyright (C) 2018 Open Source Robotics Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ diff --git a/examples/use_component_depsC/src/empty.cc b/examples/use_component_depsC/src/empty.cc index e69de29b..4e55a3a8 100644 --- a/examples/use_component_depsC/src/empty.cc +++ b/examples/use_component_depsC/src/empty.cc @@ -0,0 +1,16 @@ +/* + * Copyright (C) 2018 Open Source Robotics Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/