ARTICLE AD BOX
I want to solve a simple problem, that imply integration a subdirectory from include that have .hpp files, named mylib.
In conanfile.py I doing looks as follow:
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"]and in CMakeLists.txt I add these last tow lines, and this looks like
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)If I try to include the sample.hpp file, it results in an error during build. Including the C++ code in main.cpp is done by
#include <mylib/sample.hpp>What have I missed here?
