I'm setting up a c++ project, which uses cmake and has two build type:
- debug, having a
cmake-build-debug
folder - release, having a
cmake-build-release
folder
I want to add plog
through cmake, so I installed it successfully by defining a conanfile.txt
:
[requires]
plog/1.1.5
[generators]
cmake
then, I conan install .
on my root and I edited my CMakeLists.txt
like this:
set(CMAKE_VERBOSE_MAKEFILE ON)
cmake_minimum_required(VERSION 3.17)
project(test)
set(CMAKE_CXX_STANDARD 20)
set(CXX_EXTENSIONS OFF)
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(LLVM_ENABLE_WARNINGS ON)
endif()
# ADDED ROW
include(conanbuildinfo.cmake)
add_executable(primo main.cpp io.cpp io.h)
# ADDED ROW
target_link_libraries(plog ${CONAN_LIBS})
the problem is that cmake complaints about the last row:
CMake Error at CMakeLists.txt:15 (target_link_libraries):
Cannot specify link libraries for target "plog" which is not built by this
project.
I'm new to cmake so maybe I've configured it badly. What seems to be the problem?