def get_dependency_filenames(self): ret = [] if self.conanfile.new_cpp_info.required_components: for dep_name, _ in self.conanfile.new_cpp_info.required_components: if dep_name and dep_name not in ret: # External dep req = self.conanfile.dependencies.direct_host[dep_name] ret.append(get_file_name(req)) elif self.conanfile.dependencies.direct_host: ret = [get_file_name(r) for r in self.conanfile.dependencies.direct_host.values()] return ret
def _get_dependency_filenames(self): if self.conanfile.is_build_context: return [] ret = [] direct_host = self.conanfile.dependencies.filter({"build": False, "visible": True, "direct": True}) if self.conanfile.cpp_info.required_components: for dep_name, _ in self.conanfile.cpp_info.required_components: if dep_name and dep_name not in ret: # External dep req = direct_host[dep_name] ret.append(get_file_name(req, self.find_module_mode)) elif direct_host: ret = [get_file_name(r, self.find_module_mode) for r in direct_host.values()] return ret
def context(self): # To find the generated cmake_find_package finders # TODO: Change this for parameterized output location of CMakeDeps find_package_prefer_config = "ON" # assume ON by default if not specified in conf prefer_config = self._conanfile.conf[ "tools.cmake.cmaketoolchain:find_package_prefer_config"] if prefer_config is not None and prefer_config.lower() in ("false", "0", "off"): find_package_prefer_config = "OFF" os_ = self._conanfile.settings.get_safe("os") android_prefix = "${CMAKE_CURRENT_LIST_DIR}" if os_ == "Android" else None host_req = self._conanfile.dependencies.host.values() find_names_needed = os_ in ('iOS', "watchOS", "tvOS") find_names = [get_file_name(req) for req in host_req] if find_names_needed else [] return { "find_package_prefer_config": find_package_prefer_config, "cmake_prefix_path": "${CMAKE_CURRENT_LIST_DIR}", "cmake_module_path": "${CMAKE_CURRENT_LIST_DIR}", "android_prefix_path": android_prefix, "find_names": find_names, "generators_folder": "${CMAKE_CURRENT_LIST_DIR}" }
def context(self): # To find the generated cmake_find_package finders # TODO: Change this for parameterized output location of CMakeDeps find_package_prefer_config = "ON" # assume ON by default if not specified in conf prefer_config = self._conanfile.conf[ "tools.cmake.cmaketoolchain:find_package_prefer_config"] if prefer_config is not None and prefer_config.lower() in ("false", "0", "off"): find_package_prefer_config = "OFF" os_ = self._conanfile.settings.get_safe("os") android_prefix = "${CMAKE_CURRENT_LIST_DIR}" if os_ == "Android" else None host_req = self._conanfile.dependencies.host.values() find_names_needed = os_ in ('iOS', "watchOS", "tvOS") find_names = [get_file_name(req) for req in host_req] if find_names_needed else [] # Read the buildirs build_paths = [] for req in host_req: cppinfo = req.new_cpp_info.copy() cppinfo.aggregate_components() build_paths.extend([ os.path.join( req.package_folder, p.replace('\\', '/').replace('$', '\\$').replace('"', '\\"')) for p in cppinfo.builddirs ]) if self._toolchain.find_builddirs: build_paths = " ".join([ '"{}"'.format( b.replace('\\', '/').replace('$', '\\$').replace('"', '\\"')) for b in build_paths ]) else: build_paths = "" return { "find_package_prefer_config": find_package_prefer_config, "cmake_prefix_path": "${CMAKE_CURRENT_LIST_DIR} " + build_paths, "cmake_module_path": "${CMAKE_CURRENT_LIST_DIR} " + build_paths, "android_prefix_path": android_prefix, "find_names": find_names, "generators_folder": "${CMAKE_CURRENT_LIST_DIR}" }
def get_file_name(self): return get_file_name(self.conanfile)
def file_name(self): return get_file_name(self.conanfile) + self.suffix
def get_file_name(self): return get_file_name(self.conanfile, find_module_mode=self.find_module_mode)
def file_name(self): return get_file_name(self.conanfile, self.find_module_mode) + self.suffix