Here is my top level CMakeLists.txt. I build it using cmake -H. -B_builds -DHUNTER_STATUS_DEBUG=ON -DCMAKE_BUILD_TYPE=Release
:
cmake_minimum_required(VERSION 3.2)
set(
CMAKE_TOOLCHAIN_FILE
"${CMAKE_SOURCE_DIR}/cmake/toolchain/cxx17.cmake"
CACHE
FILEPATH
"Default toolchain"
)
include("cmake/HunterGate.cmake")
HunterGate(
URL https://github.com/soramitsu/soramitsu-hunter/archive/v0.23.254-soramitsu1.tar.gz
SHA1 7819e7dd14f58b6df2fd7f2bc835265d60add3f5
FILEPATH "${CMAKE_SOURCE_DIR}/cmake/Hunter/config.cmake"
)
# set the project name
project(QToken-CPP)
# fetch packages
hunter_add_package(Boost COMPONENTS regex system filesystem)
hunter_add_package(GTest)
hunter_add_package(libp2p)
# add them to the project
find_package(GTest CONFIG REQUIRED) # GTest::main
find_package(Boost CONFIG REQUIRED regex system filesystem)
find_package(libp2p CONFIG REQUIRED) # GTest::main
# add srcs and headers
set(SOURCES src/main.cpp src/chunker.cpp src/factory.cpp)
set(HEADERS src/chunker.hpp src/factory.hpp src/kadMain.hpp)
# add the executable
add_executable(VIN ${SOURCES} ${HEADERS})
target_link_libraries(VIN
PRIVATE
libp2p
)
# testing
enable_testing()
add_subdirectory(test)
When I run cmake --build _builds --config Debug
it gives me:
[ 10%] Building CXX object CMakeFiles/VIN.dir/src/main.cpp.o
In file included from /home/gov/dev/qtoken-cpp/src/main.cpp:8:
/home/gov/dev/qtoken-cpp/src/kadMain.hpp:10:10: fatal error: libp2p/common/literals.hpp: No such file or directory
10 | #include <libp2p/common/literals.hpp>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/VIN.dir/build.make:82: CMakeFiles/VIN.dir/src/main.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:176: CMakeFiles/VIN.dir/all] Error 2
make: *** [Makefile:160: all] Error 2
Am I linking the targets incorrectly?