conan-io / conan-center-index

Recipes for the ConanCenter repository
https://conan.io/center
MIT License
966 stars 1.77k forks source link

[package] boost/1.75.0 + many others: Deleting lib/cmake breaks cmake_paths #4665

Closed OliverHaag closed 1 week ago

OliverHaag commented 3 years ago

Package and Environment Details

Steps to reproduce

Pull boost/1.75.0 via a conanfile.py and use the conan_paths generator:

import os
from conans import ConanFile, CMake, tools

class testConan(ConanFile):
    name = "test"
    settings = "os", "compiler", "arch", "build_type"
    generators = "cmake_paths",
    requires = [ "boost/1.75.0" ]

    def build(self):
        cmake = CMake(self)
        cmake.configure()
        cmake.build()

    def package(self):
        pass

Write a little CMake-Project just doing a:

cmake_minimum_required(VERSION 3.18)
project(test)
include(conan_paths.cmake)
find_package(Boost REQUIRED)

CMake will print a warning indicating that the version of Boost may not be supported. This is caused by it not finding the config file that is provided by boost and falling back to its own. Looking at the conanfile.py of boost the reason is easy to find in the package method:

tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))

Other packages, that don't have an (probably outdated) find script delivered together with CMake are currently unusable with the cmake_paths generator.

Expected behaviour

CMake can find the packages when using the cmake_paths generator using the config scripts provided by the packages:

-- Found Boost: /home/developer/.conan/data/boost/1.75.0/_/_/package/65b2d5e369665b016b4881ba8e1c55f93d96bc99/lib/cmake/Boost-1.75.0/BoostConfig.cmake (found version "1.75.0") found components: date_time filesystem

If there is no really! good reason that would justify deleting the cmake config files of packages and thus breaking cmake_paths, this (or a technically similar) line should be removed from all recipes that have it. I could open a pull request for this if that helps?

A grep for rmdir.*cmake to find the packages having this issue gives the following result:

recipes/abseil/all/conanfile.py:        tools.rmdir(cmake_folder)
recipes/absent/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/amqp-cpp/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "cmake"))
recipes/argtable3/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "cmake"))
recipes/argtable3/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/arrow/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/assimp/5.0.x/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/asyncplusplus/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "cmake"))
recipes/atk/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/bacnet-stack/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/benchmark/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, 'lib', 'cmake'))
recipes/boost/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/bullet3/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/c-ares/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/c-blosc/all/conanfile.py:        tools.rmdir(os.path.join(self._source_subfolder, "cmake"))
recipes/catch2/2.x.x/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/cctz/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/ceres-solver/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/cgal/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/chaiscript/all/conanfile.py:            tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/civetweb/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/cjson/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/cli11/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/clipper/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/cn-cbor/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/cose-c/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/cpprestsdk/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/cpputest/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "CppUTest", "cmake"))
recipes/cryptopp/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/date/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/dbus/1.x.x/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/dcmtk/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "cmake"))
recipes/dcmtk/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/docopt.cpp/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/double-conversion/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib","cmake"))
recipes/easy_profiler/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/easyhttpcpp/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/embree3/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, 'lib', 'cmake'))
recipes/embree3/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "cmake"))
recipes/expat/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/ezc3d/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/fcl/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/fftw/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/flatbuffers/all/conanfile.py:            tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/fmt/all/conanfile.py:            tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/folly/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/freetype/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/g3log/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/geos/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/getdns/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/gflags/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/glad/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/glbinding/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "cmake"))
recipes/glew/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/glfw/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/glog/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/glslang/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/gtest/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/gtsam/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/h3/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/harfbuzz/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/hazelcast-cpp-client/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/hdrhistogram-c/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/ignition-math/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/itk/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/ixwebsocket/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/jansson/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/jansson/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "cmake"))
recipes/json-c/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/json-schema-validator/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/kcp/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/kitten/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/leptonica/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, 'cmake'))
recipes/leveldb/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/libcbor/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/libcds/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/libcheck/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/libcoap/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/libcpuid/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/libcurl/all/conanfile.py:            tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/libde265/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/libdxfrw/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/libevent/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/libevent/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "cmake"))
recipes/libgeotiff/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "cmake"))
recipes/libgta/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/libheif/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/libkml/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/libkml/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "cmake"))
recipes/libmbus/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/libmediainfo/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "cmake"))
recipes/libmediainfo/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/libpqxx/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/libproperties/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/librdkafka/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/libsndfile/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/libsndfile/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "cmake"))
recipes/libssh2/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/libtins/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/libtorrent/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/libuvc/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/libwebsockets/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "cmake"))
recipes/libwebsockets/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/libxml2/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, 'lib', 'cmake'))
recipes/libyaml/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/libzen/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "cmake"))
recipes/libzen/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/libzip/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/libzippp/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "cmake"))
recipes/log4cplus/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/meshoptimizer/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/mimalloc/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "cmake"))
recipes/mongo-c-driver/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/mongo-cxx-driver/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/mpg123/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/msgpack/all/conanfile.py:            tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/muparserx/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "cmake"))
recipes/naive-tsearch/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/nanodbc/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "cmake"))
recipes/nanodbc/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/netcdf/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/nlopt/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/nng/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/norm/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/oatpp-libressl/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/oatpp-openssl/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/oatpp-postgresql/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/oatpp-sqlite/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/oatpp-swagger/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/oatpp-websocket/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/oatpp/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/ogg/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/onedpl/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/open62541/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/openal/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/opencolorio/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "cmake"))
recipes/opencv/3.x/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "cmake"))
recipes/opencv/4.x/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "cmake"))
recipes/openexr/2.3.0/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/openexr/2.x/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/openimageio/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/opus/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/paho-mqtt-c/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/paho-mqtt-cpp/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/pdal/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, 'lib', 'cmake'))
recipes/pistache/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/poco/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/poco/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "cmake"))
recipes/pro-mdnsd/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/proj/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/prometheus-cpp/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/pugixml/all/conanfile.py:            tools.rmdir(os.path.join(self.package_folder, 'lib', 'cmake'))
recipes/pulseaudio/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/qhull/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/qt/5.x.x/conanfile.py:                tools.rmdir(os.path.join("lib", "cmake", m))
recipes/qt/6.x.x/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/quill/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/raylib/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/re2/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/roaring/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, 'lib', 'cmake'))
recipes/rocksdb/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/rttr/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "cmake"))
recipes/sdbus-cpp/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/seasocks/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/sentry-native/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/simdjson/0.2.1/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, 'lib', 'cmake'))
recipes/simdjson/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, 'lib', 'cmake'))
recipes/snappy/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/sobjectizer/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/soci/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "cmake"))
recipes/spdlog/all/conanfile.py:            tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/spdlog/all/conanfile.py:            tools.rmdir(os.path.join(self.package_folder, "lib", "spdlog", "cmake"))
recipes/spirv-tools/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/sqlitecpp/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/systemc/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/taocpp-taopq/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/tesseract/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, 'cmake'))
recipes/tesseract/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, 'lib', 'cmake'))
recipes/thrift/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/tinyply/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/tinyspline/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/tinyxml2/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/tng/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/uriparser/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/volk/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/vorbis/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/wslay/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/wt/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/xapian-core/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/xerces-c/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/xerces-c/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "cmake"))
recipes/yaml-cpp/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, 'lib', 'cmake'))
recipes/z3/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/zeromq/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/zfp/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/zstd/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
recipes/zxing-cpp/all/conanfile.py:        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
SpaceIm commented 3 years ago

Sure, CCI recipes are designed for cmake_find_package, cmake_find_package_multi and pkg_config generators, not cmake_paths generator. See https://github.com/conan-io/conan-center-index/blob/master/docs/faqs.md#why-are-cmake-findconfig-files-and-pkg-config-files-not-packaged

OliverHaag commented 3 years ago

Thanks for the quick response. I don't see a drawback in just leaving the find-scripts there and not forcefully breaking conan_paths. The linked answer doesn't really describe that decision, since there shouldn't be any collision between the packages own cmake-config and the CONAN_PKG:: targets. CMake just won't care about that files unless you issue find_package so I don't see any problems for the cmake_find_package* generators here. Mind explaining the decision further?

SpaceIm commented 3 years ago

cmake_find_package generator and CONAN_PKG::recipe targets are completely different things. cmake_find_package emulates find modules files, and cmake_find_package_multi emulates find config files. If you keep config files in a recipe, they will conflict with those generators. Use cmake_find_package or cmake_find_package_multi, it's the way to go (+ generate() eventually) for transparent integration of CCI recipes in CMake projects.

OliverHaag commented 3 years ago

Sorry mixed up cmake_find_package and cmake generators there. But CMake wont search in the package folder anyway when using cmake_find_package so it will definitely not use any cmake-files included in the package and can't have any collision or am I wrong?

SpaceIm commented 3 years ago

It depends. cmake_find_package and cmake_find_package_multi don't append anything in CMAKE_PREFIX_PATH and CMAKE_MODULE_PATH, they just generate .cmake files where conan install was executed. On the other hand, nothing prevents someone to use more generators, like cmake generator (then call conan_basic_setup()), or to use a toolchain file generared by generate(), which will append all package folders in CMAKE_PREFIX_PATH and CMAKE_MODULE_PATH, and if there are config files in these folders they will conflict with cmake_find_package and cmake_find_package_multi module/config files (they might take precedence over other module/config files depending on order of paths in CMAKE_PREFIX_PATH and CMAKE_MODULE_PATH).

OliverHaag commented 3 years ago

Okay thanks, I see the problem in some scenarios. I tried out cmake_find_package now and it seems to not cause any problems with the find_package calls (and even avoids writing some Find-scripts for libs lacking those). One thing before closing this issue: Could the docs indicate that cmake_find_package should be preferred over cmake_paths and that cmake_paths will not work with CCI (referencing the answer your linked)? Should I open a separate issue for conan itself for this?

danimtb commented 3 years ago

@OliverHaag please, open an issue about that in the documentation repo to add a note about the lack of support of conan center packages for that generator. Thank you

akalali commented 3 years ago

I just found this topic and I think it is closely related to my problem mentioned here: https://github.com/conan-io/conan-center-index/issues/4712

I need to use cmake_find_package_multi, because another project that depends on ITK uses find_package(ITK NO_MODULE REQUIRED) (so I need to generate an ITKConfig.cmake-file). However, the depending project also uses include(${ITK_USE_FILE}), which is not defined. There is no UseITK.cmake-file for this variable and thus building the project fails.

One solution would be to use the cmake-generator instead of the cmake_find_package_multi. This allows to rely on the original ITK config files. However, this approach does not work with the conan-center ITK recipe, because the cmake-directory was removed (because of tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")). I created my own ITK recipe that does not have this line (so the ITK config-files and UseITK.cmake are available in the Conan-created package) and everything works as expected.

Maybe you can comment in the linked issue, what the recommended way to solve this problem would be.

SpaceIm commented 3 years ago

The problem is more or less connected, but still different.

UseITK.cmake could be kept and added to self.cpp_info.build_modules in package_info() (you can open a PR for that if you want). Indeed CCI doesn't forbid to keep CMake module files, only find/config CMake files.

akalali commented 3 years ago

The problem is more or less connected, but still different.

UseITK.cmake could be kept and added to self.cpp_info.build_modules in package_info() (you can open a PR for that if you want). Indeed CCI doesn't forbid to keep CMake module files, only find/config CMake files.

I wouldn't know exactly what to do so although I want to open a PR I don't know what to change inside the recipe. The documentation is not clear for me at that point.

uilianries commented 1 week ago

The generator cmake_paths is no longer supported. Please, read how to integrate your project using new CMake generators in Conan 2.x: https://docs.conan.io/2/integrations/cmake.html