From bb8a2eb8a015f4a02c83a3580897c592e98b9fe5 Mon Sep 17 00:00:00 2001 From: Mark Jan van Kampen Date: Thu, 23 Sep 2021 13:01:10 +0200 Subject: [PATCH 01/12] Adds rapidcheck boost/gtest/catch integrations --- recipes/rapidcheck/all/conanfile.py | 51 +++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 7 deletions(-) diff --git a/recipes/rapidcheck/all/conanfile.py b/recipes/rapidcheck/all/conanfile.py index 88b9e3ebce22c..c1842c3f3fb9d 100644 --- a/recipes/rapidcheck/all/conanfile.py +++ b/recipes/rapidcheck/all/conanfile.py @@ -20,11 +20,21 @@ class RapidcheckConan(ConanFile): "shared": [True, False], "fPIC": [True, False], "enable_rtti": [True, False], + "enable_catch": [True, False], + "enable_gmock": [True, False], + "enable_gtest": [True, False], + "enable_boost": [True, False], + "enable_boost_test": [True, False] } default_options = { "shared": False, "fPIC": True, "enable_rtti": True, + "enable_catch": False, + "enable_gmock": False, + "enable_gtest": False, + "enable_boost": False, + "enable_boost_test": False } _cmake = None @@ -62,6 +72,11 @@ def _configure_cmake(self): self._cmake.definitions["RC_ENABLE_RTTI"] = self.options.enable_rtti self._cmake.definitions["RC_ENABLE_TESTS"] = False self._cmake.definitions["RC_ENABLE_EXAMPLES"] = False + self._cmake.definitions["RC_ENABLE_CATCH"] = self.options.enable_catch + self._cmake.definitions["RC_ENABLE_GMOCK"] = self.options.enable_gmock + self._cmake.definitions["RC_ENABLE_GTEST"] = self.options.enable_gtest + self._cmake.definitions["RC_ENABLE_BOOST"] = self.options.enable_boost + self._cmake.definitions["RC_ENABLE_BOOST_TEST"] = self.options.enable_boost_test self._cmake.configure(build_folder=self._build_subfolder) return self._cmake @@ -76,7 +91,12 @@ def package(self): tools.rmdir(os.path.join(self.package_folder, "share")) self._create_cmake_module_alias_targets( os.path.join(self.package_folder, self._module_file_rel_path), - {"rapidcheck": "rapidcheck::rapidcheck"} + {"rapidcheck": "rapidcheck::rapidcheck", + "rapidcheck::catch": "rapidcheck_catch", + "rapidcheck::gmock": "rapidcheck_gmock", + "rapidcheck::gtest": "rapidcheck_gtest", + "rapidcheck::boost": "rapidcheck_boost", + "rapidcheck::boost_test": "rapidcheck_boost_test"} ) @staticmethod @@ -101,12 +121,29 @@ def _module_file_rel_path(self): "conan-official-{}-targets.cmake".format(self.name)) def package_info(self): - self.cpp_info.names["cmake_find_package"] = "rapidcheck" - self.cpp_info.names["cmake_find_package_multi"] = "rapidcheck" - self.cpp_info.builddirs.append(self._module_subfolder) - self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] - self.cpp_info.build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] - self.cpp_info.libs = ["rapidcheck"] + self.cpp_info.name = "rapidcheck" + + self.cpp_info.components["core"].set_property("cmake_target_name", "rapidcheck") + self.cpp_info.components["core"].builddirs.append(self._module_subfolder) + self.cpp_info.components["core"].set_property("cmake_build_modules", [self._module_file_rel_path]) + self.cpp_info.components["core"].libs = ["rapidcheck"] + self.cpp_info.components["core"].includedirs = ["include"] + + if(self.options.enable_catch): + self.cpp_info.components["catch"].requires = ["core"] + self.cpp_info.components["catch"].includedirs = ["include"] + if(self.options.enable_gmock): + self.cpp_info.components["gmock"].requires = ["core"] + self.cpp_info.components["gmock"].includedirs = ["include"] + if(self.options.enable_gtest): + self.cpp_info.components["gtest"].requires = ["core"] + self.cpp_info.components["gtest"].includedirs = ["include"] + if(self.options.enable_boost): + self.cpp_info.components["boost"].requires = ["core"] + self.cpp_info.components["boost"].includedirs = ["include"] + if(self.options.enable_boost_test): + self.cpp_info.components["boost_test"].requires = ["core"] + self.cpp_info.components["boost_test"].includedirs = ["include"] version = self.version[4:] if tools.Version(version) < "20201218": From dede52e769fd5c82d3c8d22a2dda7e717e4fb5d6 Mon Sep 17 00:00:00 2001 From: Mark Jan van Kampen Date: Thu, 23 Sep 2021 14:19:58 +0200 Subject: [PATCH 02/12] Fixes bad alias --- recipes/rapidcheck/all/conanfile.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/recipes/rapidcheck/all/conanfile.py b/recipes/rapidcheck/all/conanfile.py index c1842c3f3fb9d..b8677a7a80371 100644 --- a/recipes/rapidcheck/all/conanfile.py +++ b/recipes/rapidcheck/all/conanfile.py @@ -92,11 +92,11 @@ def package(self): self._create_cmake_module_alias_targets( os.path.join(self.package_folder, self._module_file_rel_path), {"rapidcheck": "rapidcheck::rapidcheck", - "rapidcheck::catch": "rapidcheck_catch", - "rapidcheck::gmock": "rapidcheck_gmock", - "rapidcheck::gtest": "rapidcheck_gtest", - "rapidcheck::boost": "rapidcheck_boost", - "rapidcheck::boost_test": "rapidcheck_boost_test"} + "rapidcheck_catch":"rapidcheck::catch", + "rapidcheck_gmock": "rapidcheck::gmock", + "rapidcheck_gtest": "rapidcheck::gtest", + "rapidcheck_boost": "rapidcheck::boost", + "rapidcheck_boost_test": "rapidcheck::boost_test"} ) @staticmethod From 607bf33ad721157d4b45cdf90b28dd53dc52b222 Mon Sep 17 00:00:00 2001 From: Mark Jan van Kampen Date: Thu, 23 Sep 2021 14:31:08 +0200 Subject: [PATCH 03/12] Fixes tools.cross_building --- recipes/rapidcheck/all/test_package/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/rapidcheck/all/test_package/conanfile.py b/recipes/rapidcheck/all/test_package/conanfile.py index 7e2dfe859bb27..49a3a66ea5bad 100644 --- a/recipes/rapidcheck/all/test_package/conanfile.py +++ b/recipes/rapidcheck/all/test_package/conanfile.py @@ -12,6 +12,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): + if not tools.cross_building(self): bin_path = os.path.join("bin", "test_package") self.run(bin_path, run_environment=True) From 727bfb9112417b9b5a3e050c87d3697273e6ab69 Mon Sep 17 00:00:00 2001 From: Mark Jan van Kampen Date: Thu, 23 Sep 2021 14:38:47 +0200 Subject: [PATCH 04/12] Fixes package names --- recipes/rapidcheck/all/conanfile.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/recipes/rapidcheck/all/conanfile.py b/recipes/rapidcheck/all/conanfile.py index b8677a7a80371..590f8bccb362f 100644 --- a/recipes/rapidcheck/all/conanfile.py +++ b/recipes/rapidcheck/all/conanfile.py @@ -121,7 +121,8 @@ def _module_file_rel_path(self): "conan-official-{}-targets.cmake".format(self.name)) def package_info(self): - self.cpp_info.name = "rapidcheck" + cpp_info.names["cmake_find_package"] = "rapidcheck" + cpp_info.names["cmake_find_package_multi"] = "rapidcheck" self.cpp_info.components["core"].set_property("cmake_target_name", "rapidcheck") self.cpp_info.components["core"].builddirs.append(self._module_subfolder) From 7d9cb10a08a6a0213edc8b3b3ff98ca75e6943a6 Mon Sep 17 00:00:00 2001 From: Mark Jan van Kampen Date: Thu, 23 Sep 2021 14:57:19 +0200 Subject: [PATCH 05/12] Fixes typo --- recipes/rapidcheck/all/conanfile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/rapidcheck/all/conanfile.py b/recipes/rapidcheck/all/conanfile.py index 590f8bccb362f..ef507c443fcda 100644 --- a/recipes/rapidcheck/all/conanfile.py +++ b/recipes/rapidcheck/all/conanfile.py @@ -121,8 +121,8 @@ def _module_file_rel_path(self): "conan-official-{}-targets.cmake".format(self.name)) def package_info(self): - cpp_info.names["cmake_find_package"] = "rapidcheck" - cpp_info.names["cmake_find_package_multi"] = "rapidcheck" + self.cpp_info.names["cmake_find_package"] = "rapidcheck" + self.cpp_info.names["cmake_find_package_multi"] = "rapidcheck" self.cpp_info.components["core"].set_property("cmake_target_name", "rapidcheck") self.cpp_info.components["core"].builddirs.append(self._module_subfolder) From 2564165f34dc44c5df2029582e0b40d3f4c20999 Mon Sep 17 00:00:00 2001 From: Mark Jan van Kampen Date: Thu, 23 Sep 2021 15:07:48 +0200 Subject: [PATCH 06/12] Fixes older versions --- recipes/rapidcheck/all/conanfile.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/recipes/rapidcheck/all/conanfile.py b/recipes/rapidcheck/all/conanfile.py index ef507c443fcda..caa7c0395826a 100644 --- a/recipes/rapidcheck/all/conanfile.py +++ b/recipes/rapidcheck/all/conanfile.py @@ -129,7 +129,14 @@ def package_info(self): self.cpp_info.components["core"].set_property("cmake_build_modules", [self._module_file_rel_path]) self.cpp_info.components["core"].libs = ["rapidcheck"] self.cpp_info.components["core"].includedirs = ["include"] - + version = self.version[4:] + if tools.Version(version) < "20201218": + if self.options.enable_rtti: + self.cpp_info.components["core"].defines.append("RC_USE_RTTI") + else: + if not self.options.enable_rtti: + self.cpp_info.components["core"].defines.append("RC_DONT_USE_RTTI") + if(self.options.enable_catch): self.cpp_info.components["catch"].requires = ["core"] self.cpp_info.components["catch"].includedirs = ["include"] @@ -146,10 +153,3 @@ def package_info(self): self.cpp_info.components["boost_test"].requires = ["core"] self.cpp_info.components["boost_test"].includedirs = ["include"] - version = self.version[4:] - if tools.Version(version) < "20201218": - if self.options.enable_rtti: - self.cpp_info.defines.append("RC_USE_RTTI") - else: - if not self.options.enable_rtti: - self.cpp_info.defines.append("RC_DONT_USE_RTTI") From 74c6beb9e7f4713f0f9e1abfd563d32250658b00 Mon Sep 17 00:00:00 2001 From: mjvankampen Date: Sat, 25 Sep 2021 04:50:31 +0200 Subject: [PATCH 07/12] Removes redundant includes Co-authored-by: Chris Mc --- recipes/rapidcheck/all/conanfile.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/recipes/rapidcheck/all/conanfile.py b/recipes/rapidcheck/all/conanfile.py index caa7c0395826a..05271ebe1fa85 100644 --- a/recipes/rapidcheck/all/conanfile.py +++ b/recipes/rapidcheck/all/conanfile.py @@ -139,17 +139,12 @@ def package_info(self): if(self.options.enable_catch): self.cpp_info.components["catch"].requires = ["core"] - self.cpp_info.components["catch"].includedirs = ["include"] if(self.options.enable_gmock): self.cpp_info.components["gmock"].requires = ["core"] - self.cpp_info.components["gmock"].includedirs = ["include"] if(self.options.enable_gtest): self.cpp_info.components["gtest"].requires = ["core"] - self.cpp_info.components["gtest"].includedirs = ["include"] if(self.options.enable_boost): self.cpp_info.components["boost"].requires = ["core"] - self.cpp_info.components["boost"].includedirs = ["include"] if(self.options.enable_boost_test): self.cpp_info.components["boost_test"].requires = ["core"] - self.cpp_info.components["boost_test"].includedirs = ["include"] From 1b52785bcf8bf94593c35cff92c442f04f340da3 Mon Sep 17 00:00:00 2001 From: Mark Jan van Kampen Date: Sat, 25 Sep 2021 09:59:20 +0200 Subject: [PATCH 08/12] Links in gtest and catch when necessary --- recipes/rapidcheck/all/conandata.yml | 10 +++++ recipes/rapidcheck/all/conanfile.py | 42 +++++++++---------- .../0001-gtest-catch-integration.patch | 30 +++++++++++++ 3 files changed, 60 insertions(+), 22 deletions(-) create mode 100644 recipes/rapidcheck/all/patches/0001-gtest-catch-integration.patch diff --git a/recipes/rapidcheck/all/conandata.yml b/recipes/rapidcheck/all/conandata.yml index 8da55e3fd71a1..bc158533d9f3d 100644 --- a/recipes/rapidcheck/all/conandata.yml +++ b/recipes/rapidcheck/all/conandata.yml @@ -8,3 +8,13 @@ sources: "cci.20200131": url: "https://github.com/emil-e/rapidcheck/archive/258d907da00a0855f92c963d8f76eef115531716.zip" sha256: "87bfbdceaa09e7aaaf70b2efd0078e93323dd8abdad48c57e9f23bfd84174a75" +patches: + "cci.20210702": + - patch_file: "patches/0001-gtest-catch-integration.patch" + base_path: "source_subfolder" + "cci.20210107": + - patch_file: "patches/0001-gtest-catch-integration.patch" + base_path: "source_subfolder" + "cci.20200131": + - patch_file: "patches/0001-gtest-catch-integration.patch" + base_path: "source_subfolder" diff --git a/recipes/rapidcheck/all/conanfile.py b/recipes/rapidcheck/all/conanfile.py index 05271ebe1fa85..e5202ab673ba1 100644 --- a/recipes/rapidcheck/all/conanfile.py +++ b/recipes/rapidcheck/all/conanfile.py @@ -13,8 +13,8 @@ class RapidcheckConan(ConanFile): homepage = "https://github.com/emil-e/rapidcheck" license = "BSD-2-Clause" topics = "quickcheck", "testing", "property-testing" - exports_sources = "CMakeLists.txt" - generators = "cmake" + exports_sources = ["CMakeLists.txt", "patches/**"] + generators = ["cmake", "cmake_find_package"] settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -22,9 +22,7 @@ class RapidcheckConan(ConanFile): "enable_rtti": [True, False], "enable_catch": [True, False], "enable_gmock": [True, False], - "enable_gtest": [True, False], - "enable_boost": [True, False], - "enable_boost_test": [True, False] + "enable_gtest": [True, False] } default_options = { "shared": False, @@ -32,9 +30,7 @@ class RapidcheckConan(ConanFile): "enable_rtti": True, "enable_catch": False, "enable_gmock": False, - "enable_gtest": False, - "enable_boost": False, - "enable_boost_test": False + "enable_gtest": False } _cmake = None @@ -61,6 +57,12 @@ def validate(self): if self.settings.compiler == "Visual Studio" and self.options.shared: raise ConanInvalidConfiguration("shared is not supported using Visual Studio") + def requirements(self): + if self.options.enable_catch: + self.requires("catch2/2.13.7") + if self.options.enable_gmock or self.options.enable_gtest: + self.requires("gtest/1.11.0") + def source(self): tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) @@ -75,12 +77,12 @@ def _configure_cmake(self): self._cmake.definitions["RC_ENABLE_CATCH"] = self.options.enable_catch self._cmake.definitions["RC_ENABLE_GMOCK"] = self.options.enable_gmock self._cmake.definitions["RC_ENABLE_GTEST"] = self.options.enable_gtest - self._cmake.definitions["RC_ENABLE_BOOST"] = self.options.enable_boost - self._cmake.definitions["RC_ENABLE_BOOST_TEST"] = self.options.enable_boost_test self._cmake.configure(build_folder=self._build_subfolder) return self._cmake def build(self): + for patch in self.conan_data["patches"][self.version]: + tools.patch(**patch) cmake = self._configure_cmake() cmake.build() @@ -94,9 +96,7 @@ def package(self): {"rapidcheck": "rapidcheck::rapidcheck", "rapidcheck_catch":"rapidcheck::catch", "rapidcheck_gmock": "rapidcheck::gmock", - "rapidcheck_gtest": "rapidcheck::gtest", - "rapidcheck_boost": "rapidcheck::boost", - "rapidcheck_boost_test": "rapidcheck::boost_test"} + "rapidcheck_gtest": "rapidcheck::gtest"} ) @staticmethod @@ -128,7 +128,6 @@ def package_info(self): self.cpp_info.components["core"].builddirs.append(self._module_subfolder) self.cpp_info.components["core"].set_property("cmake_build_modules", [self._module_file_rel_path]) self.cpp_info.components["core"].libs = ["rapidcheck"] - self.cpp_info.components["core"].includedirs = ["include"] version = self.version[4:] if tools.Version(version) < "20201218": if self.options.enable_rtti: @@ -137,14 +136,13 @@ def package_info(self): if not self.options.enable_rtti: self.cpp_info.components["core"].defines.append("RC_DONT_USE_RTTI") - if(self.options.enable_catch): - self.cpp_info.components["catch"].requires = ["core"] - if(self.options.enable_gmock): + if self.options.enable_catch: + self.cpp_info.components["core"].requires.append("catch2::catch2") + self.cpp_info.components["catch"].requires = ["core", "catch2::catch2"] + if self.options.enable_gmock: + self.cpp_info.components["core"].requires.append("gtest::gtest") self.cpp_info.components["gmock"].requires = ["core"] - if(self.options.enable_gtest): + if self.options.enable_gtest: + self.cpp_info.components["core"].requires.append("gtest::gtest") self.cpp_info.components["gtest"].requires = ["core"] - if(self.options.enable_boost): - self.cpp_info.components["boost"].requires = ["core"] - if(self.options.enable_boost_test): - self.cpp_info.components["boost_test"].requires = ["core"] diff --git a/recipes/rapidcheck/all/patches/0001-gtest-catch-integration.patch b/recipes/rapidcheck/all/patches/0001-gtest-catch-integration.patch new file mode 100644 index 0000000000000..72362b8cb7dfb --- /dev/null +++ b/recipes/rapidcheck/all/patches/0001-gtest-catch-integration.patch @@ -0,0 +1,30 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 15c46d01288dce235179b791770187f5a38230ab..0c47308162af09841789ff9791b11839d524f852 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -111,8 +111,6 @@ if(NOT RC_ENABLE_RTTI) + target_compile_definitions(rapidcheck PUBLIC RC_DONT_USE_RTTI) + endif() + +-add_subdirectory(ext) +- + if(RC_ENABLE_TESTS) + enable_testing() + add_subdirectory(test) +@@ -122,6 +120,16 @@ if(RC_ENABLE_EXAMPLES) + add_subdirectory(examples) + endif() + ++if (RC_ENABLE_CATCH) ++ find_package(Catch2 REQUIRED) ++ target_link_libraries(rapidcheck PUBLIC Catch2::Catch2) ++endif() ++ ++if (RC_ENABLE_GMOCK OR RC_ENABLE_GTEST) ++ find_package(GTest REQUIRED) ++ target_link_libraries(rapidcheck PUBLIC GTest::GTest) ++endif() ++ + add_subdirectory(extras) + + # Install the export file specifying all the targets for RapidCheck From a3eb3a44f6a8c5e678e8d02741459d2612ed48a7 Mon Sep 17 00:00:00 2001 From: Mark Jan van Kampen Date: Sat, 25 Sep 2021 12:35:58 +0200 Subject: [PATCH 09/12] Fixes older versions --- recipes/rapidcheck/all/conandata.yml | 4 +-- ...001-gtest-catch-integration-20200131.patch | 30 +++++++++++++++++++ ...001-gtest-catch-integration-20210107.patch | 29 ++++++++++++++++++ 3 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 recipes/rapidcheck/all/patches/0001-gtest-catch-integration-20200131.patch create mode 100644 recipes/rapidcheck/all/patches/0001-gtest-catch-integration-20210107.patch diff --git a/recipes/rapidcheck/all/conandata.yml b/recipes/rapidcheck/all/conandata.yml index bc158533d9f3d..d2e9cdaceb7da 100644 --- a/recipes/rapidcheck/all/conandata.yml +++ b/recipes/rapidcheck/all/conandata.yml @@ -13,8 +13,8 @@ patches: - patch_file: "patches/0001-gtest-catch-integration.patch" base_path: "source_subfolder" "cci.20210107": - - patch_file: "patches/0001-gtest-catch-integration.patch" + - patch_file: "patches/0001-gtest-catch-integration-20210107.patch" base_path: "source_subfolder" "cci.20200131": - - patch_file: "patches/0001-gtest-catch-integration.patch" + - patch_file: "patches/0001-gtest-catch-integration-20200131.patch" base_path: "source_subfolder" diff --git a/recipes/rapidcheck/all/patches/0001-gtest-catch-integration-20200131.patch b/recipes/rapidcheck/all/patches/0001-gtest-catch-integration-20200131.patch new file mode 100644 index 0000000000000..a1d1918ea6e72 --- /dev/null +++ b/recipes/rapidcheck/all/patches/0001-gtest-catch-integration-20200131.patch @@ -0,0 +1,30 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 92bc63c7df2cb87b5e5672a7651dbb4eafa3aaa7..c57b700157360f4b5a2e280167e821f567bb31ea 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -106,8 +106,6 @@ if(RC_ENABLE_RTTI) + target_compile_definitions(rapidcheck PUBLIC RC_USE_RTTI) + endif() + +-add_subdirectory(ext) +- + if(RC_ENABLE_TESTS) + enable_testing() + add_subdirectory(test) +@@ -117,6 +115,16 @@ if(RC_ENABLE_EXAMPLES) + add_subdirectory(examples) + endif() + ++if (RC_ENABLE_CATCH) ++ find_package(Catch2 REQUIRED) ++ target_link_libraries(rapidcheck PUBLIC Catch2::Catch2) ++endif() ++ ++if (RC_ENABLE_GMOCK OR RC_ENABLE_GTEST) ++ find_package(GTest REQUIRED) ++ target_link_libraries(rapidcheck PUBLIC GTest::GTest) ++endif() ++ + add_subdirectory(extras) + + # Install the export file specifying all the targets for RapidCheck diff --git a/recipes/rapidcheck/all/patches/0001-gtest-catch-integration-20210107.patch b/recipes/rapidcheck/all/patches/0001-gtest-catch-integration-20210107.patch new file mode 100644 index 0000000000000..aeb2935553204 --- /dev/null +++ b/recipes/rapidcheck/all/patches/0001-gtest-catch-integration-20210107.patch @@ -0,0 +1,29 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 9f583afc171fab0a6894ffd64a0c787fd806bbaa..da2389500c99e4e4b59c772ee25285e2a9607de5 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -106,8 +106,6 @@ if(NOT RC_ENABLE_RTTI) + target_compile_definitions(rapidcheck PUBLIC RC_DONT_USE_RTTI) + endif() + +-add_subdirectory(ext) +- + if(RC_ENABLE_TESTS) + enable_testing() + add_subdirectory(test) +@@ -116,6 +114,15 @@ endif() + if(RC_ENABLE_EXAMPLES) + add_subdirectory(examples) + endif() ++if (RC_ENABLE_CATCH) ++ find_package(Catch2 REQUIRED) ++ target_link_libraries(rapidcheck PUBLIC Catch2::Catch2) ++endif() ++ ++if (RC_ENABLE_GMOCK OR RC_ENABLE_GTEST) ++ find_package(GTest REQUIRED) ++ target_link_libraries(rapidcheck PUBLIC GTest::GTest) ++endif() + + add_subdirectory(extras) + From 0bff4d83acbe6cb074133cca3fcdcb2283b557a4 Mon Sep 17 00:00:00 2001 From: Mark Jan van Kampen Date: Mon, 27 Sep 2021 13:32:52 +0200 Subject: [PATCH 10/12] Fixes requirements --- recipes/rapidcheck/all/conanfile.py | 15 ++++++--------- ...001-gtest-catch-integration-20200131.patch | 19 +------------------ ...001-gtest-catch-integration-20210107.patch | 18 +----------------- .../0001-gtest-catch-integration.patch | 19 +------------------ 4 files changed, 9 insertions(+), 62 deletions(-) diff --git a/recipes/rapidcheck/all/conanfile.py b/recipes/rapidcheck/all/conanfile.py index e5202ab673ba1..4881b4ff0d042 100644 --- a/recipes/rapidcheck/all/conanfile.py +++ b/recipes/rapidcheck/all/conanfile.py @@ -94,9 +94,9 @@ def package(self): self._create_cmake_module_alias_targets( os.path.join(self.package_folder, self._module_file_rel_path), {"rapidcheck": "rapidcheck::rapidcheck", - "rapidcheck_catch":"rapidcheck::catch", - "rapidcheck_gmock": "rapidcheck::gmock", - "rapidcheck_gtest": "rapidcheck::gtest"} + "rapidcheck_catch":"rapidcheck::rapidcheck_catch", + "rapidcheck_gmock": "rapidcheck::rapidcheck_gmock", + "rapidcheck_gtest": "rapidcheck::rapidcheck_gtest"} ) @staticmethod @@ -137,12 +137,9 @@ def package_info(self): self.cpp_info.components["core"].defines.append("RC_DONT_USE_RTTI") if self.options.enable_catch: - self.cpp_info.components["core"].requires.append("catch2::catch2") - self.cpp_info.components["catch"].requires = ["core", "catch2::catch2"] + self.cpp_info.components["rapidcheck_catch"].requires = ["core", "catch2::catch2"] if self.options.enable_gmock: - self.cpp_info.components["core"].requires.append("gtest::gtest") - self.cpp_info.components["gmock"].requires = ["core"] + self.cpp_info.components["rapidcheck_gmock"].requires = ["core", "gtest::gtest"] if self.options.enable_gtest: - self.cpp_info.components["core"].requires.append("gtest::gtest") - self.cpp_info.components["gtest"].requires = ["core"] + self.cpp_info.components["rapidcheck_gtest"].requires = ["core", "gtest::gtest"] diff --git a/recipes/rapidcheck/all/patches/0001-gtest-catch-integration-20200131.patch b/recipes/rapidcheck/all/patches/0001-gtest-catch-integration-20200131.patch index a1d1918ea6e72..000892c7e9c5d 100644 --- a/recipes/rapidcheck/all/patches/0001-gtest-catch-integration-20200131.patch +++ b/recipes/rapidcheck/all/patches/0001-gtest-catch-integration-20200131.patch @@ -1,5 +1,5 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 92bc63c7df2cb87b5e5672a7651dbb4eafa3aaa7..c57b700157360f4b5a2e280167e821f567bb31ea 100644 +index 92bc63c7df2cb87b5e5672a7651dbb4eafa3aaa7..14000896cd4e6ebcde3f2154b85caf4f5cca056b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -106,8 +106,6 @@ if(RC_ENABLE_RTTI) @@ -11,20 +11,3 @@ index 92bc63c7df2cb87b5e5672a7651dbb4eafa3aaa7..c57b700157360f4b5a2e280167e821f5 if(RC_ENABLE_TESTS) enable_testing() add_subdirectory(test) -@@ -117,6 +115,16 @@ if(RC_ENABLE_EXAMPLES) - add_subdirectory(examples) - endif() - -+if (RC_ENABLE_CATCH) -+ find_package(Catch2 REQUIRED) -+ target_link_libraries(rapidcheck PUBLIC Catch2::Catch2) -+endif() -+ -+if (RC_ENABLE_GMOCK OR RC_ENABLE_GTEST) -+ find_package(GTest REQUIRED) -+ target_link_libraries(rapidcheck PUBLIC GTest::GTest) -+endif() -+ - add_subdirectory(extras) - - # Install the export file specifying all the targets for RapidCheck diff --git a/recipes/rapidcheck/all/patches/0001-gtest-catch-integration-20210107.patch b/recipes/rapidcheck/all/patches/0001-gtest-catch-integration-20210107.patch index aeb2935553204..ea5f3774d8053 100644 --- a/recipes/rapidcheck/all/patches/0001-gtest-catch-integration-20210107.patch +++ b/recipes/rapidcheck/all/patches/0001-gtest-catch-integration-20210107.patch @@ -1,5 +1,5 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 9f583afc171fab0a6894ffd64a0c787fd806bbaa..da2389500c99e4e4b59c772ee25285e2a9607de5 100644 +index 9f583afc171fab0a6894ffd64a0c787fd806bbaa..ea31145f55fe1010fe36739c17a655309db552f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -106,8 +106,6 @@ if(NOT RC_ENABLE_RTTI) @@ -11,19 +11,3 @@ index 9f583afc171fab0a6894ffd64a0c787fd806bbaa..da2389500c99e4e4b59c772ee25285e2 if(RC_ENABLE_TESTS) enable_testing() add_subdirectory(test) -@@ -116,6 +114,15 @@ endif() - if(RC_ENABLE_EXAMPLES) - add_subdirectory(examples) - endif() -+if (RC_ENABLE_CATCH) -+ find_package(Catch2 REQUIRED) -+ target_link_libraries(rapidcheck PUBLIC Catch2::Catch2) -+endif() -+ -+if (RC_ENABLE_GMOCK OR RC_ENABLE_GTEST) -+ find_package(GTest REQUIRED) -+ target_link_libraries(rapidcheck PUBLIC GTest::GTest) -+endif() - - add_subdirectory(extras) - diff --git a/recipes/rapidcheck/all/patches/0001-gtest-catch-integration.patch b/recipes/rapidcheck/all/patches/0001-gtest-catch-integration.patch index 72362b8cb7dfb..5b6a9b2d92e33 100644 --- a/recipes/rapidcheck/all/patches/0001-gtest-catch-integration.patch +++ b/recipes/rapidcheck/all/patches/0001-gtest-catch-integration.patch @@ -1,5 +1,5 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 15c46d01288dce235179b791770187f5a38230ab..0c47308162af09841789ff9791b11839d524f852 100644 +index 15c46d01288dce235179b791770187f5a38230ab..1805354a744931086622c41fa5a640c283142adc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -111,8 +111,6 @@ if(NOT RC_ENABLE_RTTI) @@ -11,20 +11,3 @@ index 15c46d01288dce235179b791770187f5a38230ab..0c47308162af09841789ff9791b11839 if(RC_ENABLE_TESTS) enable_testing() add_subdirectory(test) -@@ -122,6 +120,16 @@ if(RC_ENABLE_EXAMPLES) - add_subdirectory(examples) - endif() - -+if (RC_ENABLE_CATCH) -+ find_package(Catch2 REQUIRED) -+ target_link_libraries(rapidcheck PUBLIC Catch2::Catch2) -+endif() -+ -+if (RC_ENABLE_GMOCK OR RC_ENABLE_GTEST) -+ find_package(GTest REQUIRED) -+ target_link_libraries(rapidcheck PUBLIC GTest::GTest) -+endif() -+ - add_subdirectory(extras) - - # Install the export file specifying all the targets for RapidCheck From 8bc083242a97512fd51140f97466aa66414e696f Mon Sep 17 00:00:00 2001 From: Mark Jan van Kampen Date: Mon, 27 Sep 2021 13:37:54 +0200 Subject: [PATCH 11/12] Renames core to be more in line with the rest --- recipes/rapidcheck/all/conanfile.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/recipes/rapidcheck/all/conanfile.py b/recipes/rapidcheck/all/conanfile.py index 4881b4ff0d042..102fb6c912111 100644 --- a/recipes/rapidcheck/all/conanfile.py +++ b/recipes/rapidcheck/all/conanfile.py @@ -124,22 +124,22 @@ def package_info(self): self.cpp_info.names["cmake_find_package"] = "rapidcheck" self.cpp_info.names["cmake_find_package_multi"] = "rapidcheck" - self.cpp_info.components["core"].set_property("cmake_target_name", "rapidcheck") - self.cpp_info.components["core"].builddirs.append(self._module_subfolder) - self.cpp_info.components["core"].set_property("cmake_build_modules", [self._module_file_rel_path]) - self.cpp_info.components["core"].libs = ["rapidcheck"] + self.cpp_info.components["rapidcheck_rapidcheck"].set_property("cmake_target_name", "rapidcheck") + self.cpp_info.components["rapidcheck_rapidcheck"].builddirs.append(self._module_subfolder) + self.cpp_info.components["rapidcheck_rapidcheck"].set_property("cmake_build_modules", [self._module_file_rel_path]) + self.cpp_info.components["rapidcheck_rapidcheck"].libs = ["rapidcheck"] version = self.version[4:] if tools.Version(version) < "20201218": if self.options.enable_rtti: - self.cpp_info.components["core"].defines.append("RC_USE_RTTI") + self.cpp_info.components["rapidcheck_rapidcheck"].defines.append("RC_USE_RTTI") else: if not self.options.enable_rtti: - self.cpp_info.components["core"].defines.append("RC_DONT_USE_RTTI") + self.cpp_info.components["rapidcheck_rapidcheck"].defines.append("RC_DONT_USE_RTTI") if self.options.enable_catch: - self.cpp_info.components["rapidcheck_catch"].requires = ["core", "catch2::catch2"] + self.cpp_info.components["rapidcheck_catch"].requires = ["rapidcheck_rapidcheck", "catch2::catch2"] if self.options.enable_gmock: - self.cpp_info.components["rapidcheck_gmock"].requires = ["core", "gtest::gtest"] + self.cpp_info.components["rapidcheck_gmock"].requires = ["rapidcheck_rapidcheck", "gtest::gtest"] if self.options.enable_gtest: - self.cpp_info.components["rapidcheck_gtest"].requires = ["core", "gtest::gtest"] + self.cpp_info.components["rapidcheck_gtest"].requires = ["rapidcheck_rapidcheck", "gtest::gtest"] From c55c7509e20d2dbb845ab940430e86c12215d751 Mon Sep 17 00:00:00 2001 From: mjvankampen Date: Mon, 27 Sep 2021 20:05:02 +0200 Subject: [PATCH 12/12] Update recipes/rapidcheck/all/conanfile.py Co-authored-by: Uilian Ries --- recipes/rapidcheck/all/conanfile.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipes/rapidcheck/all/conanfile.py b/recipes/rapidcheck/all/conanfile.py index 102fb6c912111..0e41ed0c926ad 100644 --- a/recipes/rapidcheck/all/conanfile.py +++ b/recipes/rapidcheck/all/conanfile.py @@ -81,6 +81,8 @@ def _configure_cmake(self): return self._cmake def build(self): + if self.options.enable_gmock and not self.deps_cpp_info["gtest"].build_gmock: + raise ConanInvalidConfiguration("The option `rapidcheck:enable_gmock` requires gtest:build_gmock=True`") for patch in self.conan_data["patches"][self.version]: tools.patch(**patch) cmake = self._configure_cmake()