diff --git a/recipes/nlohmann_json/all/conanfile.py b/recipes/nlohmann_json/all/conanfile.py index 5bb517c0955a7f..09b5607e0454d3 100644 --- a/recipes/nlohmann_json/all/conanfile.py +++ b/recipes/nlohmann_json/all/conanfile.py @@ -1,8 +1,8 @@ -import os - from conan import ConanFile +from conan.tools.build import check_min_cppstd from conan.tools.files import copy, get from conan.tools.layout import basic_layout +import os required_conan_version = ">=1.50.0" @@ -23,17 +23,24 @@ def layout(self): def package_id(self): self.info.clear() - def generate(self): - pass + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) def source(self): - get(self, **self.conan_data["sources"][self.version], strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): copy(self, "LICENSE*", self.source_folder, os.path.join(self.package_folder, "licenses")) copy(self, "*", os.path.join(self.source_folder, "include"), os.path.join(self.package_folder, "include")) def package_info(self): - self.cpp_info.names["cmake_find_package"] = "nlohmann_json" - self.cpp_info.names["cmake_find_package_multi"] = "nlohmann_json" - self.cpp_info.names["pkg_config"] = "nlohmann_json" + self.cpp_info.set_property("cmake_file_name", "nlohmann_json") + self.cpp_info.set_property("cmake_target_name", "nlohmann_json::nlohmann_json") + self.cpp_info.set_property("pkg_config_name", "nlohmann_json") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/nlohmann_json/all/test_package/CMakeLists.txt b/recipes/nlohmann_json/all/test_package/CMakeLists.txt index a0cd149e8acbff..8976512b85ce63 100644 --- a/recipes/nlohmann_json/all/test_package/CMakeLists.txt +++ b/recipes/nlohmann_json/all/test_package/CMakeLists.txt @@ -1,8 +1,8 @@ -cmake_minimum_required(VERSION 3.15) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(nlohmann_json REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} nlohmann_json::nlohmann_json) -set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE nlohmann_json::nlohmann_json) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/nlohmann_json/all/test_package/conanfile.py b/recipes/nlohmann_json/all/test_package/conanfile.py index 87a7297528bf37..cb68885270b304 100644 --- a/recipes/nlohmann_json/all/test_package/conanfile.py +++ b/recipes/nlohmann_json/all/test_package/conanfile.py @@ -8,6 +8,7 @@ class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" def requirements(self): self.requires(self.tested_reference_str) diff --git a/recipes/nlohmann_json/all/test_v1_package/CMakeLists.txt b/recipes/nlohmann_json/all/test_v1_package/CMakeLists.txt index 6eb158583c5c76..611fe4322eb549 100644 --- a/recipes/nlohmann_json/all/test_v1_package/CMakeLists.txt +++ b/recipes/nlohmann_json/all/test_v1_package/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required(VERSION 3.1.2) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) @@ -7,5 +7,5 @@ conan_basic_setup(TARGETS) find_package(nlohmann_json REQUIRED CONFIG) add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} nlohmann_json::nlohmann_json) -set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE nlohmann_json::nlohmann_json) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11)