drogonframework / drogon

Drogon: A C++14/17/20 based HTTP web application framework running on Linux/macOS/Unix/Windows
MIT License
11.44k stars 1.1k forks source link

Fail to build app using `conan 2` #1639

Closed taodongl closed 1 year ago

taodongl commented 1 year ago

Notice my project copies from example of "drogon" repository, and I use conan 2 to manage dependencies ("drogon" is static library). But I can't built it. because it can't find header files of "trantor"

Describe the bug

In file included from /home/username/Projects/scanner/src/gateway.cpp:1:
/home/username/.conan2/p/b/drogoad214e63ff6b8/p/include/drogon/drogon.h:17:10: fatal error: trantor/net/EventLoop.h: No such file or directory
   17 | #include <trantor/net/EventLoop.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

To Reproduce

 $ conan -v
Conan version 2.0.6
 $ conan install . --output-folder=cmake-build-debug --build=missing --settings=build_type=Debug
 $ cd cmake-build-debug
 $ cmake .. -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Debug
 $ cmake --build .

conanfile.txt

[requires]
drogon/1.8.3

[generators]
CMakeDeps
CMakeToolchain

CMakeLists.txt

find_package(Drogon REQUIRED)
add_executable(gateway gateway.cpp)
set_target_properties(gateway PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
target_link_libraries(gateway Drogon::Drogon)

Desktop (please complete the following information):

taodongl commented 1 year ago

done with INCLUDE_DIRECTORIES(${CMAKE_INCLUDE_PATH})

taodongl commented 1 year ago

another solution:

conanfile.txt

[requires]
drogon/1.8.3
trantor/1.5.8    ### explicit dependency of drogon though our app needn't it.
jsoncpp/1.9.5   ### explicit dependency of drogon though our app needn't it.
[generators]
CMakeDeps
CMakeToolchain