From afcf3bad66e2834792e5f2107d3bb16812275832 Mon Sep 17 00:00:00 2001 From: Sneder89 <45610045+Sneder89@users.noreply.github.com> Date: Mon, 28 Nov 2022 21:25:25 +0100 Subject: [PATCH] (#14149) [cppcheck] Add version 2.9.1 * Update conandata.yml * Update config.yml * Update conanfile.py * Update conanfile.py * Update conandata.yml * Update recipes/cppcheck/all/conanfile.py Co-authored-by: Martin Delille * Update conanfile.py * Update conandata.yml * Update conanfile.py * Update conandata.yml * Update conanfile.py * Update config.yml * Delete recipes/cppcheck/all/patches directory * Update conanfile.py * Update conanfile.py * Update recipes/cppcheck/all/test_package/conanfile.py Co-authored-by: Uilian Ries * Update recipes/cppcheck/all/test_package/conanfile.py Co-authored-by: Uilian Ries * Update recipes/cppcheck/all/test_package/conanfile.py Co-authored-by: Uilian Ries * Update conanfile.py * Update conanfile.py * Update conanfile.py * Update conanfile.py * Update conanfile.py * Update conanfile.py * Update conanfile.py * Update conanfile.py * Update config.yml * Update conandata.yml * changes * changes * Update conandata.yml * Update conanfile.py * Update conanfile.py * Update conanfile.py * Update conanfile.py * Update recipes/cppcheck/all/conanfile.py Co-authored-by: Chris Mc * Update recipes/cppcheck/all/conanfile.py Co-authored-by: Chris Mc * Update conanfile.py * Update recipes/cppcheck/all/conanfile.py Co-authored-by: Chris Mc * Update recipes/cppcheck/all/conanfile.py Co-authored-by: Martin Delille * Update conanfile.py * Update conanfile.py * Update conanfile.py * get test package working * add v1 test package * moved changes from replace to file to patches * Update conanfile.py * Update conanfile.py * Update conanfile.py * Update 0003-pcre-debuglib-name-2.7.patch * Update 0003-pcre-debuglib-name-2.7.patch * Update 0003-pcre-debuglib-name-2.7.patch * Update 0003-pcre-debuglib-name-2.7.patch * Update 0003-pcre-debuglib-name-2.7.patch * Update 0003-pcre-debuglib-name-2.7.patch * Update 0003-pcre-debuglib-name-2.7.patch * Update 0003-pcre-debuglib-name-2.7.patch * Update conanfile.py * Update recipes/cppcheck/all/conanfile.py Co-authored-by: Chris Mc * Update recipes/cppcheck/all/conanfile.py Co-authored-by: Chris Mc * Update recipes/cppcheck/all/conanfile.py Co-authored-by: Chris Mc * Update recipes/cppcheck/all/conanfile.py Co-authored-by: Chris Mc * Update recipes/cppcheck/all/conanfile.py Co-authored-by: Chris Mc * use tool_requires in test package, add required fields in conandata.yml file Co-authored-by: Martin Delille Co-authored-by: Uilian Ries Co-authored-by: Chris Mc --- recipes/cppcheck/all/CMakeLists.txt | 14 ---- recipes/cppcheck/all/conandata.yml | 46 +++++++---- recipes/cppcheck/all/conanfile.py | 82 ++++++++++--------- .../0001-cli-remove-dmake-cmake-2.8.patch | 14 ++++ .../patches/0001-cli-remove-dmake-cmake.patch | 14 ++++ .../patches/0001-cmake-source-dir-2.5.patch | 36 -------- .../all/patches/0001-cmake-source-dir.patch | 35 -------- .../0003-handle-exename-on-macos.patch | 35 -------- .../patches/0003-pcre-debuglib-name-2.7.patch | 28 +++++++ .../all/patches/0003-pcre-debuglib-name.patch | 11 +++ .../cppcheck/all/test_package/conanfile.py | 21 ++--- .../cppcheck/all/test_v1_package/conanfile.py | 18 ++++ .../all/test_v1_package/file_to_check.cpp | 3 + recipes/cppcheck/config.yml | 6 +- 14 files changed, 177 insertions(+), 186 deletions(-) delete mode 100644 recipes/cppcheck/all/CMakeLists.txt create mode 100644 recipes/cppcheck/all/patches/0001-cli-remove-dmake-cmake-2.8.patch create mode 100644 recipes/cppcheck/all/patches/0001-cli-remove-dmake-cmake.patch delete mode 100644 recipes/cppcheck/all/patches/0001-cmake-source-dir-2.5.patch delete mode 100644 recipes/cppcheck/all/patches/0001-cmake-source-dir.patch delete mode 100644 recipes/cppcheck/all/patches/0003-handle-exename-on-macos.patch create mode 100644 recipes/cppcheck/all/patches/0003-pcre-debuglib-name-2.7.patch create mode 100644 recipes/cppcheck/all/patches/0003-pcre-debuglib-name.patch create mode 100644 recipes/cppcheck/all/test_v1_package/conanfile.py create mode 100644 recipes/cppcheck/all/test_v1_package/file_to_check.cpp diff --git a/recipes/cppcheck/all/CMakeLists.txt b/recipes/cppcheck/all/CMakeLists.txt deleted file mode 100644 index b0b16ec6b271c..0000000000000 --- a/recipes/cppcheck/all/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper) - -include("conanbuildinfo.cmake") -conan_basic_setup(TARGETS) - -# Set include paths -conan_global_flags() - -# Setup libraries to link -set(Z3_LIBRARIES CONAN_PKG::z3) -set(PCRE_LIBRARY CONAN_PKG::pcre) - -add_subdirectory(source_subfolder) diff --git a/recipes/cppcheck/all/conandata.yml b/recipes/cppcheck/all/conandata.yml index ca1bcf73fc569..d97f5c1a31a95 100644 --- a/recipes/cppcheck/all/conandata.yml +++ b/recipes/cppcheck/all/conandata.yml @@ -1,22 +1,38 @@ sources: + "2.9.2": + url: "https://github.com/danmar/cppcheck/archive/2.9.2.tar.gz" + sha256: "93920d24d4442856bf7916ee0e3fc31308bc23948e7029b4fd332e01cac63c3e" + "2.8.2": + url: "https://github.com/danmar/cppcheck/archive/2.8.2.tar.gz" + sha256: "30ba99ab54089c44b83f02e2453da046a7edff5237950d4A0eb1eba4afcb4f45" "2.7.5": url: "https://github.com/danmar/cppcheck/archive/2.7.5.tar.gz" sha256: "6c7ac29e57fa8b3ac7be224510200e579d5a90217e2152591ef46ffc947d8f78" - "2.7.4": - url: "https://github.com/danmar/cppcheck/archive/2.7.4.tar.gz" - sha256: "f0558c497b7807763325f3a821f1c72b743e5d888b037b8d32157dd07d6c26e1" patches: - "2.7.5": - - patch_file: "patches/0001-cmake-source-dir-2.5.patch" - base_path: "source_subfolder" + "2.9.2": + - patch_file: "patches/0001-cli-remove-dmake-cmake.patch" + patch_description: "Remove dmake tool from target ALL" + patch_type: "portability" + - patch_file: "patches/0002-htmlreport-python3.patch" + patch_description: "Use Python 3 in Shebang Header" + patch_type: "portability" + - patch_file: "patches/0003-pcre-debuglib-name.patch" + patch_description: "Consider the Debug suffix for Windows" + patch_type: "portability" + "2.8.2": + - patch_file: "patches/0001-cli-remove-dmake-cmake-2.8.patch" + patch_description: "Remove dmake tool from target ALL" + patch_type: "portability" - patch_file: "patches/0002-htmlreport-python3.patch" - base_path: "source_subfolder" - - patch_file: "patches/0003-handle-exename-on-macos.patch" - base_path: "source_subfolder" - "2.7.4": - - patch_file: "patches/0001-cmake-source-dir-2.5.patch" - base_path: "source_subfolder" + patch_description: "Use Python 3 in Shebang Header" + patch_type: "portability" + - patch_file: "patches/0003-pcre-debuglib-name.patch" + patch_description: "Consider the Debug suffix for Windows" + patch_type: "portability" + "2.7.5": - patch_file: "patches/0002-htmlreport-python3.patch" - base_path: "source_subfolder" - - patch_file: "patches/0003-handle-exename-on-macos.patch" - base_path: "source_subfolder" + patch_description: "Use Python 3 in Shebang Header" + patch_type: "portability" + - patch_file: "patches/0003-pcre-debuglib-name-2.7.patch" + patch_description: "Consider the Debug suffix for Windows" + patch_type: "portability" diff --git a/recipes/cppcheck/all/conanfile.py b/recipes/cppcheck/all/conanfile.py index 7f61d3fda6eed..4427cdebe7d18 100644 --- a/recipes/cppcheck/all/conanfile.py +++ b/recipes/cppcheck/all/conanfile.py @@ -1,74 +1,78 @@ -from conans import ConanFile, CMake, tools -import functools +from conan import ConanFile +from conan.tools.apple import is_apple_os +from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +from conan.tools.scm import Version import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class CppcheckConan(ConanFile): name = "cppcheck" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/danmar/cppcheck" - topics = ("Cpp Check", "static analyzer") + topics = ("code quality", "static analyzer", "linter") description = "Cppcheck is an analysis tool for C/C++ code." license = "GPL-3.0-or-later" - generators = "cmake" settings = "os", "arch", "compiler", "build_type" options = {"with_z3": [True, False], "have_rules": [True, False]} default_options = {"with_z3": True, "have_rules": True} - exports_sources = ["CMakeLists.txt", "patches/**"] - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + cmake_layout(self) - @property - def _build_subfolder(self): - return "build_subfolder" + def export_sources(self): + export_conandata_patches(self) - def _patch_sources(self): - for patch in self.conan_data["patches"][self.version]: - tools.patch(**patch) - tools.replace_in_file(os.path.join(self._source_subfolder, "cli", "CMakeLists.txt"), - "RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}", - "DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}") + def config_options(self): + if Version(self.version) >= Version("2.8.0"): + del self.options.with_z3 def requirements(self): - if self.options.with_z3: + if self.options.get_safe("with_z3", default=False): self.requires("z3/4.8.8") if self.options.have_rules: self.requires("pcre/8.45") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["USE_Z3"] = self.options.with_z3 - cmake.definitions["HAVE_RULES"] = self.options.have_rules - cmake.definitions["USE_MATCHCOMPILER"] = "Auto" - cmake.definitions["ENABLE_OSS_FUZZ"] = False - cmake.configure(build_folder=self._build_subfolder) - return cmake + def generate(self): + tc = CMakeToolchain(self) + if Version(self.version) < "2.8.0": + tc.variables["USE_Z3"] = self.options.with_z3 + tc.variables["HAVE_RULES"] = self.options.have_rules + tc.variables["USE_MATCHCOMPILER"] = "Auto" + tc.variables["ENABLE_OSS_FUZZ"] = False + if is_apple_os(self): + tc.variables["FILESDIR"] = os.path.join(self.package_folder, "bin", "cfg") + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - self.copy("*", dst=os.path.join("bin","cfg"), src=os.path.join(self._source_subfolder,"cfg")) - self.copy("cppcheck-htmlreport", dst=os.path.join("bin"), src=os.path.join(self._source_subfolder,"htmlreport")) - cmake = self._configure_cmake() + copy(self, "COPYING", dst=os.path.join(self.package_folder, "licenses"), src=os.path.join(self.source_folder)) + copy(self, "*", dst=os.path.join(self.package_folder, "bin", "cfg"), src=os.path.join(self.source_folder, "cfg")) + copy(self, "cppcheck-htmlreport", dst=os.path.join(self.package_folder, "bin"), src=os.path.join(self.source_folder, "htmlreport")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): + self.cpp_info.includedirs = [] + self.cpp_info.libdirs = [] + bin_folder = os.path.join(self.package_folder, "bin") self.output.info("Append %s to environment variable PATH" % bin_folder) self.env_info.PATH.append(bin_folder) - # This is required to run the python script on windows, as we cannot simply add it to the PATH - self.env_info.CPPCHECK_HTMLREPORT = os.path.join(bin_folder, "cppcheck-htmlreport") + cppcheck_htmlreport = os.path.join(bin_folder, "cppcheck-htmlreport") + self.env_info.CPPCHECK_HTMLREPORT = cppcheck_htmlreport + self.runenv_info.define_path("CPPCHECK_HTMLREPORT", cppcheck_htmlreport) diff --git a/recipes/cppcheck/all/patches/0001-cli-remove-dmake-cmake-2.8.patch b/recipes/cppcheck/all/patches/0001-cli-remove-dmake-cmake-2.8.patch new file mode 100644 index 0000000000000..157034975424b --- /dev/null +++ b/recipes/cppcheck/all/patches/0001-cli-remove-dmake-cmake-2.8.patch @@ -0,0 +1,14 @@ +--- a/cli/CMakeLists.txt 2022-07-12 23:11:29.000000000 +0200 ++++ b/cli/CMakeLists.txt 2022-11-23 22:01:29.111581500 +0100 +@@ -45,10 +45,9 @@ + + add_dependencies(cppcheck copy_cfg) + add_dependencies(cppcheck copy_addons) +-add_dependencies(cppcheck run-dmake) + + install(TARGETS cppcheck +- RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} ++ DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} + COMPONENT applications) + + install(FILES ${addons} diff --git a/recipes/cppcheck/all/patches/0001-cli-remove-dmake-cmake.patch b/recipes/cppcheck/all/patches/0001-cli-remove-dmake-cmake.patch new file mode 100644 index 0000000000000..18fff8473a497 --- /dev/null +++ b/recipes/cppcheck/all/patches/0001-cli-remove-dmake-cmake.patch @@ -0,0 +1,14 @@ +--- a/cli/CMakeLists.txt 2022-11-08 20:22:59.000000000 +0100 ++++ b/cli/CMakeLists.txt 2022-11-23 21:33:49.347849300 +0100 +@@ -43,10 +43,9 @@ + + add_dependencies(cppcheck copy_cfg) + add_dependencies(cppcheck copy_addons) +-add_dependencies(cppcheck run-dmake) + + install(TARGETS cppcheck +- RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} ++ DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} + COMPONENT applications) + + install(FILES ${addons} diff --git a/recipes/cppcheck/all/patches/0001-cmake-source-dir-2.5.patch b/recipes/cppcheck/all/patches/0001-cmake-source-dir-2.5.patch deleted file mode 100644 index 06286552a0736..0000000000000 --- a/recipes/cppcheck/all/patches/0001-cmake-source-dir-2.5.patch +++ /dev/null @@ -1,36 +0,0 @@ -diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt -index 100f9a9edab3ae26b1736f79dc2f9b875f627cce..6e810d508afb79f015286b92a4eeff53e497b9c8 100644 ---- a/tools/CMakeLists.txt -+++ b/tools/CMakeLists.txt -@@ -4,19 +4,19 @@ foreach(file ${srcs_lib}) - set(src "${CMAKE_BINARY_DIR}/lib/build/mc_${file}") - set_source_files_properties(${src} PROPERTIES GENERATED TRUE) - else() -- set(src "${CMAKE_SOURCE_DIR}/lib/${file}") -+ set(src "${PROJECT_SOURCE_DIR}/lib/${file}") - endif() - set(srcs_tools ${srcs_tools} ${src}) - endforeach() - - add_executable(dmake EXCLUDE_FROM_ALL - dmake.cpp -- ${CMAKE_SOURCE_DIR}/cli/filelister.cpp -+ ${PROJECT_SOURCE_DIR}/cli/filelister.cpp - ${srcs_tools} -- ${CMAKE_SOURCE_DIR}/lib/utils.cpp -- ${CMAKE_SOURCE_DIR}/externals/simplecpp/simplecpp.cpp -+ ${PROJECT_SOURCE_DIR}/lib/utils.cpp -+ ${PROJECT_SOURCE_DIR}/externals/simplecpp/simplecpp.cpp - ) --target_include_directories(dmake PRIVATE ${CMAKE_SOURCE_DIR}/cli ${CMAKE_SOURCE_DIR}/lib ${CMAKE_SOURCE_DIR}/externals/simplecpp) -+target_include_directories(dmake PRIVATE ${PROJECT_SOURCE_DIR}/cli ${PROJECT_SOURCE_DIR}/lib ${PROJECT_SOURCE_DIR}/externals/simplecpp) - if (WIN32 AND NOT BORLAND) - if(NOT MINGW) - target_link_libraries(dmake Shlwapi.lib) -@@ -26,5 +26,5 @@ if (WIN32 AND NOT BORLAND) - endif() - - add_custom_target(run-dmake $ -- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} -+ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - DEPENDS dmake) diff --git a/recipes/cppcheck/all/patches/0001-cmake-source-dir.patch b/recipes/cppcheck/all/patches/0001-cmake-source-dir.patch deleted file mode 100644 index 95e8658caedb3..0000000000000 --- a/recipes/cppcheck/all/patches/0001-cmake-source-dir.patch +++ /dev/null @@ -1,35 +0,0 @@ -diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt -index 303b8d55f77cd36bc597ddfc406bc5fe7c2992e5..e25948fa14664d9a8b758586a75369ecde111ddb 100644 ---- a/tools/CMakeLists.txt -+++ b/tools/CMakeLists.txt -@@ -4,23 +4,23 @@ foreach(file ${srcs_lib}) - set(src "${CMAKE_BINARY_DIR}/lib/build/mc_${file}") - set_source_files_properties(${src} PROPERTIES GENERATED TRUE) - else() -- set(src "${CMAKE_SOURCE_DIR}/lib/${file}") -+ set(src "${PROJECT_SOURCE_DIR}/lib/${file}") - endif() - set(srcs_tools ${srcs_tools} ${src}) - endforeach() - - add_executable(dmake EXCLUDE_FROM_ALL - dmake.cpp -- ${CMAKE_SOURCE_DIR}/cli/filelister.cpp -+ ${PROJECT_SOURCE_DIR}/cli/filelister.cpp - ${srcs_tools} -- ${CMAKE_SOURCE_DIR}/lib/utils.cpp -- ${CMAKE_SOURCE_DIR}/externals/simplecpp/simplecpp -+ ${PROJECT_SOURCE_DIR}/lib/utils.cpp -+ ${PROJECT_SOURCE_DIR}/externals/simplecpp/simplecpp - ) --target_include_directories(dmake PRIVATE ${CMAKE_SOURCE_DIR}/cli ${CMAKE_SOURCE_DIR}/lib ${CMAKE_SOURCE_DIR}/externals/simplecpp) -+target_include_directories(dmake PRIVATE ${PROJECT_SOURCE_DIR}/cli ${PROJECT_SOURCE_DIR}/lib ${PROJECT_SOURCE_DIR}/externals/simplecpp) - if (WIN32 AND NOT BORLAND) - target_link_libraries(dmake Shlwapi.lib) - endif() - - add_custom_target(run-dmake $ -- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} -+ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - DEPENDS dmake) -\ No newline at end of file diff --git a/recipes/cppcheck/all/patches/0003-handle-exename-on-macos.patch b/recipes/cppcheck/all/patches/0003-handle-exename-on-macos.patch deleted file mode 100644 index 5975775352f74..0000000000000 --- a/recipes/cppcheck/all/patches/0003-handle-exename-on-macos.patch +++ /dev/null @@ -1,35 +0,0 @@ -commit 3b54e7610c8e512432fefd02c047ade142cde19a -Author: Martin Delille -Date: Sun May 1 19:32:12 2022 +0200 - - Handle exename on macos - -diff --git a/cli/main.cpp b/cli/main.cpp -index ca48497d2..dae782ce6 100644 ---- a/cli/main.cpp -+++ b/cli/main.cpp -@@ -76,6 +76,12 @@ - static char exename[1024] = {0}; - #endif - -+#if defined(__APPLE__) -+#include -+ -+static char exename[1024] = {0}; -+#endif -+ - /** - * Main function of cppcheck - * -@@ -95,6 +101,11 @@ int main(int argc, char* argv[]) - GetModuleFileNameA(nullptr, exename, sizeof(exename)/sizeof(exename[0])-1); - argv[0] = exename; - #endif -+#if defined(__APPLE__) -+ uint32_t size = sizeof(exename); -+ _NSGetExecutablePath(exename, &size); -+ argv[0] = exename; -+#endif - // *INDENT-OFF* - #ifdef NDEBUG - try { diff --git a/recipes/cppcheck/all/patches/0003-pcre-debuglib-name-2.7.patch b/recipes/cppcheck/all/patches/0003-pcre-debuglib-name-2.7.patch new file mode 100644 index 0000000000000..fa8b46fd1608e --- /dev/null +++ b/recipes/cppcheck/all/patches/0003-pcre-debuglib-name-2.7.patch @@ -0,0 +1,28 @@ +--- a/cmake/findDependencies.cmake 2022-04-15 20:23:30.000000000 +0200 ++++ b/cmake/findDependencies.cmake 2022-11-24 13:57:22.099453500 +0100 +@@ -16,7 +16,7 @@ + + if (HAVE_RULES) + find_path(PCRE_INCLUDE pcre.h) +- find_library(PCRE_LIBRARY pcre) ++ find_library(PCRE_LIBRARY NAMES pcre pcred) + if (NOT PCRE_LIBRARY OR NOT PCRE_INCLUDE) + message(FATAL_ERROR "pcre dependency for RULES has not been found") + endif() +@@ -24,16 +24,8 @@ + + if (USE_Z3) + find_package(Z3 QUIET) +- if (NOT Z3_FOUND) + find_library(Z3_LIBRARIES z3) +- if (NOT Z3_LIBRARIES) +- message(FATAL_ERROR "z3 dependency has not been found") +- endif() + find_path(Z3_CXX_INCLUDE_DIRS z3++.h PATH_SUFFIXES "z3") +- if (NOT Z3_CXX_INCLUDE_DIRS) +- message(FATAL_ERROR "z3++.h has not been found") +- endif() +- endif() + endif() + + set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/recipes/cppcheck/all/patches/0003-pcre-debuglib-name.patch b/recipes/cppcheck/all/patches/0003-pcre-debuglib-name.patch new file mode 100644 index 0000000000000..9431d05ce2a2d --- /dev/null +++ b/recipes/cppcheck/all/patches/0003-pcre-debuglib-name.patch @@ -0,0 +1,11 @@ +--- a/cmake/findDependencies.cmake 2022-11-08 20:22:59.000000000 +0100 ++++ b/cmake/findDependencies.cmake 2022-11-23 21:29:50.222152900 +0100 +@@ -36,7 +36,7 @@ + + if (HAVE_RULES) + find_path(PCRE_INCLUDE pcre.h) +- find_library(PCRE_LIBRARY pcre) ++ find_library(PCRE_LIBRARY NAMES pcre pcred) + if (NOT PCRE_LIBRARY OR NOT PCRE_INCLUDE) + message(FATAL_ERROR "pcre dependency for RULES has not been found") + endif() diff --git a/recipes/cppcheck/all/test_package/conanfile.py b/recipes/cppcheck/all/test_package/conanfile.py index 5aa61b686254c..f29289a5751d7 100644 --- a/recipes/cppcheck/all/test_package/conanfile.py +++ b/recipes/cppcheck/all/test_package/conanfile.py @@ -1,20 +1,21 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import can_run import sys -import os -import shutil class TestPackageConan(ConanFile): settings = "os", "arch" + generators = "VirtualRunEnv" + test_type = "explicit" + + def build_requirements(self): + self.tool_requires(self.tested_reference_str) def test(self): - shutil.copy(os.path.join(self.source_folder, "file_to_check.cpp"), - os.path.join(self.build_folder, "file_to_check.cpp")) - if not tools.cross_building(self.settings): + if can_run(self): self.run("cppcheck --enable=warning,style,performance --std=c++11 .", - cwd=self.source_folder, run_environment=True) - # On windows we need to explicitly use python to run the python script - if self.settings.os == 'Windows': - self.run("{} {} -h".format(sys.executable, tools.get_env("CPPCHECK_HTMLREPORT"))) + cwd=self.source_folder, run_environment=True) + if self.settings.os == "Windows": + self.run(f"{sys.executable} %CPPCHECK_HTMLREPORT% -h", run_environment=True) else: self.run("cppcheck-htmlreport -h", run_environment=True) diff --git a/recipes/cppcheck/all/test_v1_package/conanfile.py b/recipes/cppcheck/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..14b7ebe1713c7 --- /dev/null +++ b/recipes/cppcheck/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conan import ConanFile +from conan.tools.build import can_run +import sys + + +class TestPackageConan(ConanFile): + settings = "os", "arch" + generators = "VirtualRunEnv" + + def test(self): + if can_run(self): + self.run("cppcheck --enable=warning,style,performance --std=c++11 .", + cwd=self.source_folder, run_environment=True) + if self.settings.os == "Windows": + # Unable to work with Environment variable CPPCHECK_HTML_REPORT + self.run(f"{sys.executable} %CPPCHECK_HTMLREPORT% -h", run_environment=True) + else: + self.run("cppcheck-htmlreport -h", run_environment=True) diff --git a/recipes/cppcheck/all/test_v1_package/file_to_check.cpp b/recipes/cppcheck/all/test_v1_package/file_to_check.cpp new file mode 100644 index 0000000000000..33c14ce1d76c0 --- /dev/null +++ b/recipes/cppcheck/all/test_v1_package/file_to_check.cpp @@ -0,0 +1,3 @@ +int main() { + return 0; +} diff --git a/recipes/cppcheck/config.yml b/recipes/cppcheck/config.yml index cd8c614f41055..bc6d13a4fc4ca 100644 --- a/recipes/cppcheck/config.yml +++ b/recipes/cppcheck/config.yml @@ -1,5 +1,7 @@ versions: - "2.7.5": + "2.9.2": + folder: all + "2.8.2": folder: all - "2.7.4": + "2.7.5": folder: all