В conanfile.py я делаю следующее:
Код: Выделить всё
class myapp Recipe(ConanFile):
name = "myapp"
version = "1.0"
package_type = "application"
# Binary configuration
settings = "os", "compiler", "build_type", "arch"
# Sources are located in the same place as this recipe, copy them to the recipe
exports_sources = "CMakeLists.txt", "src/*", "include/*"
def layout(self):
cmake_layout(self)
def generate(self):
deps = CMakeDeps(self)
deps.generate()
tc = CMakeToolchain(self)
tc.generate()
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def package(self):
copy(
self,
pattern="*.hpp",
src=os.path.join(self.source_folder, "include"),
dst=os.path.join(self.package_folder, "include")
)
cmake = CMake(self)
cmake.install()
def package_info(self):
self.cpp_info.includedirs = ["include"]
Код: Выделить всё
cmake_minimum_required(VERSION 3.15)
project(myapp CXX)
add_executable(myapp src/myapp.cpp src/main.cpp)
install(TARGETS myapp DESTINATION "."
RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
)
find_package(mylib REQUIRED
target_link_libraries(discovery_devices PRIVATE mylib::mylib)
Код: Выделить всё
#include
Подробнее здесь: https://stackoverflow.com/questions/798 ... sing-conan
Мобильная версия