CONAN_PKG::spdlog
is not found when using CMake to generate build configurations.
The conan package I use is spdlog/1.3.1@bincrafters/stable.
I have a CMake executable target which references a conan package spdlog
. I am getting this error message:
[build] CMake Error at src/apps/ResultObserver/CMakeLists.txt:10 (ADD_EXECUTABLE):
[build] Target "ResultObserver" links to target "CONAN_PKG::spdlog" but the target
[build] was not found. Perhaps a find_package() call is missing for an IMPORTED
[build] target, or an ALIAS target is missing?
I have these lines in my CMakeLists.txt.
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
ADD_EXECUTABLE(ResultObserver src/ResultObserver.cpp)
TARGET_LINK_LIBRARIES(ResultObserver CONAN_PKG::spdlog)
Also, after installing the conan package, the conanbuildinfo.cmake file is generated in the build directory.
I checked inside the file. It contains these lines.
add_library(CONAN_PKG::spdlog INTERFACE IMPORTED)
# Property INTERFACE_LINK_FLAGS do not work, necessary to add to INTERFACE_LINK_LIBRARIES
set_property(TARGET CONAN_PKG::spdlog PROPERTY INTERFACE_LINK_LIBRARIES .........
Anyone know the reason?