I'm trying to get dependency for an existing CMakeLists.txt with conan. So, I followed https://docs.conan.io/en/latest/integrations/build_system/cmake/cmake_find_package_generator.html as it seems to be the least intrusive path. find_package() calls seem to work but targets aren't picked up, resulting in error like:
CMake Error at CMakeLists.txt:15 (add_executable):
Target "md5" links to target "Boost::filesystem" but the target was not
found. Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?
This can be reproduced by using the md5.cpp from Getting Started tutorial with the following files
# conanfile.txt
[requires]
poco/1.9.4
glog/0.4.0
boost/1.72.0
[generators]
cmake_find_package
cmake_paths
# CMakeLists.txt
cmake_minimum_required(VERSION 3.0.2)
project(MD5Encrypter)
include(${CMAKE_BINARY_DIR}/conan_paths.cmake)
add_definitions("-std=c++11")
find_package(poco REQUIRED)
find_package(glog REQUIRED)
find_package(Boost REQUIRED COMPONENTS filesystem)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
add_executable(md5 md5.cpp)
target_link_libraries(md5 poco)
target_link_libraries(md5 glog::glog)
target_link_libraries(md5 Boost::filesystem)
When I commented out the last 2 lines, cmake .. would succeed but but cmake --build . would fail like this:
kittipat-mbp:build kittipat$ cmake --build .
Scanning dependencies of target md5
[ 50%] Building CXX object CMakeFiles/md5.dir/md5.cpp.o
[100%] Linking CXX executable bin/md5
ld: library not found for -lPoco
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [bin/md5] Error 1
make[1]: *** [CMakeFiles/md5.dir/all] Error 2
make: *** [all] Error 2
kittipat-mbp:build kittipat$ conan install ..
Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=apple-clang
compiler.libcxx=libc++
compiler.version=10.0
os=Macos
os_build=Macos
[options]
[build_requires]
[env]
conanfile.txt: Installing package
Requirements
boost/1.72.0 from 'conan-center' - Cache
bzip2/1.0.8 from 'conan-center' - Cache
gflags/2.2.2 from 'conan-center' - Cache
glog/0.4.0 from 'conan-center' - Cache
openssl/1.0.2t from 'conan-center' - Cache
poco/1.9.4 from 'conan-center' - Cache
zlib/1.2.11 from 'conan-center' - Cache
Packages
boost/1.72.0:2439fa14ae114198bd340332be9c9f3e28aa8c03 - Cache
bzip2/1.0.8:25d69afe851bfb8cb5aedd20123fa41e061f316e - Cache
gflags/2.2.2:2b4290fce077501ad5912b53ec470a05cf74c757 - Cache
glog/0.4.0:f05ad137b051ca8019fa168c04ee38d7c489ffb7 - Cache
openssl/1.0.2t:9f67cefb3b597b342ffd9241a4a7dc5a0df50bef - Cache
poco/1.9.4:f3f8158a9c9f8a880a0bbe3aa7bb57112429b5b6 - Cache
zlib/1.2.11:534dcc368c999e07e81f146b3466b8f656ef1f55 - Cache
Installing (downloading, building) binaries...
bzip2/1.0.8: Already installed!
gflags/2.2.2: Already installed!
zlib/1.2.11: Already installed!
boost/1.72.0: Already installed!
boost/1.72.0: LIBRARIES: ['boost_wave', 'boost_container', 'boost_contract', 'boost_exception', 'boost_graph', 'boost_iostreams', 'boost_locale', 'boost_log', 'boost_program_options', 'boost_random', 'boost_regex', 'boost_serialization', 'boost_wserialization', 'boost_coroutine', 'boost_context', 'boost_timer', 'boost_thread', 'boost_chrono', 'boost_date_time', 'boost_atomic', 'boost_filesystem', 'boost_system', 'boost_type_erasure', 'boost_log_setup', 'boost_math_c99', 'boost_math_c99f', 'boost_math_c99l', 'boost_math_tr1', 'boost_math_tr1f', 'boost_math_tr1l', 'boost_stacktrace_addr2line', 'boost_stacktrace_basic', 'boost_stacktrace_noop', 'boost_unit_test_framework']
boost/1.72.0: Package folder: /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03
glog/0.4.0: Already installed!
openssl/1.0.2t: Already installed!
poco/1.9.4: Already installed!
conanfile.txt: Generator cmake_find_package created FindPoco.cmake
conanfile.txt: Generator cmake_find_package created FindGLOG.cmake
conanfile.txt: Generator cmake_find_package created FindBoost.cmake
conanfile.txt: Generator cmake_find_package created FindOpenSSL.cmake
conanfile.txt: Generator cmake_find_package created Findgflags.cmake
conanfile.txt: Generator cmake_find_package created FindBZip2.cmake
conanfile.txt: Generator cmake_find_package created FindZLIB.cmake
conanfile.txt: Generator cmake_paths created conan_paths.cmake
conanfile.txt: Generator txt created conanbuildinfo.txt
conanfile.txt: Generated conaninfo.txt
conanfile.txt: Generated graphinfo
kittipat-mbp:build kittipat$ cmake ..
-- Conan: Using autogenerated FindPoco.cmake
CMake Warning (dev) at /usr/local/Cellar/cmake/3.17.1/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:272 (message):
The package name passed to `find_package_handle_standard_args` (Poco) does
not match the name of the calling package (poco). This can lead to
problems in calling code that expects `find_package` result variables
(e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
build/Findpoco.cmake:77 (find_package_handle_standard_args)
CMakeLists.txt:8 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Found Poco: 1.9.4 (found version "1.9.4")
-- Library PocoMongoDB found /Users/kittipat/.conan/data/poco/1.9.4/_/_/package/f3f8158a9c9f8a880a0bbe3aa7bb57112429b5b6/lib/libPocoMongoDB.a
-- Found: /Users/kittipat/.conan/data/poco/1.9.4/_/_/package/f3f8158a9c9f8a880a0bbe3aa7bb57112429b5b6/lib/libPocoMongoDB.a
-- Library PocoNetSSL found /Users/kittipat/.conan/data/poco/1.9.4/_/_/package/f3f8158a9c9f8a880a0bbe3aa7bb57112429b5b6/lib/libPocoNetSSL.a
-- Found: /Users/kittipat/.conan/data/poco/1.9.4/_/_/package/f3f8158a9c9f8a880a0bbe3aa7bb57112429b5b6/lib/libPocoNetSSL.a
-- Library PocoNet found /Users/kittipat/.conan/data/poco/1.9.4/_/_/package/f3f8158a9c9f8a880a0bbe3aa7bb57112429b5b6/lib/libPocoNet.a
-- Found: /Users/kittipat/.conan/data/poco/1.9.4/_/_/package/f3f8158a9c9f8a880a0bbe3aa7bb57112429b5b6/lib/libPocoNet.a
-- Library PocoCrypto found /Users/kittipat/.conan/data/poco/1.9.4/_/_/package/f3f8158a9c9f8a880a0bbe3aa7bb57112429b5b6/lib/libPocoCrypto.a
-- Found: /Users/kittipat/.conan/data/poco/1.9.4/_/_/package/f3f8158a9c9f8a880a0bbe3aa7bb57112429b5b6/lib/libPocoCrypto.a
-- Library PocoDataSQLite found /Users/kittipat/.conan/data/poco/1.9.4/_/_/package/f3f8158a9c9f8a880a0bbe3aa7bb57112429b5b6/lib/libPocoDataSQLite.a
-- Found: /Users/kittipat/.conan/data/poco/1.9.4/_/_/package/f3f8158a9c9f8a880a0bbe3aa7bb57112429b5b6/lib/libPocoDataSQLite.a
-- Library PocoData found /Users/kittipat/.conan/data/poco/1.9.4/_/_/package/f3f8158a9c9f8a880a0bbe3aa7bb57112429b5b6/lib/libPocoData.a
-- Found: /Users/kittipat/.conan/data/poco/1.9.4/_/_/package/f3f8158a9c9f8a880a0bbe3aa7bb57112429b5b6/lib/libPocoData.a
-- Library PocoZip found /Users/kittipat/.conan/data/poco/1.9.4/_/_/package/f3f8158a9c9f8a880a0bbe3aa7bb57112429b5b6/lib/libPocoZip.a
-- Found: /Users/kittipat/.conan/data/poco/1.9.4/_/_/package/f3f8158a9c9f8a880a0bbe3aa7bb57112429b5b6/lib/libPocoZip.a
-- Library PocoUtil found /Users/kittipat/.conan/data/poco/1.9.4/_/_/package/f3f8158a9c9f8a880a0bbe3aa7bb57112429b5b6/lib/libPocoUtil.a
-- Found: /Users/kittipat/.conan/data/poco/1.9.4/_/_/package/f3f8158a9c9f8a880a0bbe3aa7bb57112429b5b6/lib/libPocoUtil.a
-- Library PocoXML found /Users/kittipat/.conan/data/poco/1.9.4/_/_/package/f3f8158a9c9f8a880a0bbe3aa7bb57112429b5b6/lib/libPocoXML.a
-- Found: /Users/kittipat/.conan/data/poco/1.9.4/_/_/package/f3f8158a9c9f8a880a0bbe3aa7bb57112429b5b6/lib/libPocoXML.a
-- Library PocoJSON found /Users/kittipat/.conan/data/poco/1.9.4/_/_/package/f3f8158a9c9f8a880a0bbe3aa7bb57112429b5b6/lib/libPocoJSON.a
-- Found: /Users/kittipat/.conan/data/poco/1.9.4/_/_/package/f3f8158a9c9f8a880a0bbe3aa7bb57112429b5b6/lib/libPocoJSON.a
-- Library PocoRedis found /Users/kittipat/.conan/data/poco/1.9.4/_/_/package/f3f8158a9c9f8a880a0bbe3aa7bb57112429b5b6/lib/libPocoRedis.a
-- Found: /Users/kittipat/.conan/data/poco/1.9.4/_/_/package/f3f8158a9c9f8a880a0bbe3aa7bb57112429b5b6/lib/libPocoRedis.a
-- Library PocoFoundation found /Users/kittipat/.conan/data/poco/1.9.4/_/_/package/f3f8158a9c9f8a880a0bbe3aa7bb57112429b5b6/lib/libPocoFoundation.a
-- Found: /Users/kittipat/.conan/data/poco/1.9.4/_/_/package/f3f8158a9c9f8a880a0bbe3aa7bb57112429b5b6/lib/libPocoFoundation.a
-- Conan: Using autogenerated FindOpenSSL.cmake
-- Found OpenSSL: 1.0.2t (found version "1.0.2t")
-- Library ssl found /Users/kittipat/.conan/data/openssl/1.0.2t/_/_/package/9f67cefb3b597b342ffd9241a4a7dc5a0df50bef/lib/libssl.a
-- Found: /Users/kittipat/.conan/data/openssl/1.0.2t/_/_/package/9f67cefb3b597b342ffd9241a4a7dc5a0df50bef/lib/libssl.a
-- Library crypto found /Users/kittipat/.conan/data/openssl/1.0.2t/_/_/package/9f67cefb3b597b342ffd9241a4a7dc5a0df50bef/lib/libcrypto.a
-- Found: /Users/kittipat/.conan/data/openssl/1.0.2t/_/_/package/9f67cefb3b597b342ffd9241a4a7dc5a0df50bef/lib/libcrypto.a
-- Conan: Using autogenerated FindZLIB.cmake
-- Library z found /Users/kittipat/.conan/data/zlib/1.2.11/_/_/package/534dcc368c999e07e81f146b3466b8f656ef1f55/lib/libz.a
-- Found: /Users/kittipat/.conan/data/zlib/1.2.11/_/_/package/534dcc368c999e07e81f146b3466b8f656ef1f55/lib/libz.a
-- Conan: Using autogenerated FindGLOG.cmake
CMake Warning (dev) at /usr/local/Cellar/cmake/3.17.1/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:272 (message):
The package name passed to `find_package_handle_standard_args` (GLOG) does
not match the name of the calling package (glog). This can lead to
problems in calling code that expects `find_package` result variables
(e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
build/Findglog.cmake:77 (find_package_handle_standard_args)
CMakeLists.txt:9 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Library glog found /Users/kittipat/.conan/data/glog/0.4.0/_/_/package/f05ad137b051ca8019fa168c04ee38d7c489ffb7/lib/libglog.a
-- Found: /Users/kittipat/.conan/data/glog/0.4.0/_/_/package/f05ad137b051ca8019fa168c04ee38d7c489ffb7/lib/libglog.a
-- Conan: Using autogenerated Findgflags.cmake
-- Library gflags_nothreads found /Users/kittipat/.conan/data/gflags/2.2.2/_/_/package/2b4290fce077501ad5912b53ec470a05cf74c757/lib/libgflags_nothreads.a
-- Found: /Users/kittipat/.conan/data/gflags/2.2.2/_/_/package/2b4290fce077501ad5912b53ec470a05cf74c757/lib/libgflags_nothreads.a
-- Conan: Using autogenerated FindBoost.cmake
-- Library boost_wave found /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_wave.a
-- Found: /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_wave.a
-- Library boost_container found /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_container.a
-- Found: /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_container.a
-- Library boost_contract found /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_contract.a
-- Found: /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_contract.a
-- Library boost_exception found /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_exception.a
-- Found: /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_exception.a
-- Library boost_graph found /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_graph.a
-- Found: /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_graph.a
-- Library boost_iostreams found /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_iostreams.a
-- Found: /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_iostreams.a
-- Library boost_locale found /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_locale.a
-- Found: /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_locale.a
-- Library boost_log found /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_log.a
-- Found: /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_log.a
-- Library boost_program_options found /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_program_options.a
-- Found: /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_program_options.a
-- Library boost_random found /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_random.a
-- Found: /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_random.a
-- Library boost_regex found /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_regex.a
-- Found: /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_regex.a
-- Library boost_serialization found /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_serialization.a
-- Found: /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_serialization.a
-- Library boost_wserialization found /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_wserialization.a
-- Found: /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_wserialization.a
-- Library boost_coroutine found /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_coroutine.a
-- Found: /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_coroutine.a
-- Library boost_context found /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_context.a
-- Found: /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_context.a
-- Library boost_timer found /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_timer.a
-- Found: /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_timer.a
-- Library boost_thread found /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_thread.a
-- Found: /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_thread.a
-- Library boost_chrono found /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_chrono.a
-- Found: /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_chrono.a
-- Library boost_date_time found /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_date_time.a
-- Found: /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_date_time.a
-- Library boost_atomic found /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_atomic.a
-- Found: /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_atomic.a
-- Library boost_filesystem found /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_filesystem.a
-- Found: /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_filesystem.a
-- Library boost_system found /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_system.a
-- Found: /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_system.a
-- Library boost_type_erasure found /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_type_erasure.a
-- Found: /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_type_erasure.a
-- Library boost_log_setup found /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_log_setup.a
-- Found: /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_log_setup.a
-- Library boost_math_c99 found /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_math_c99.a
-- Found: /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_math_c99.a
-- Library boost_math_c99f found /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_math_c99f.a
-- Found: /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_math_c99f.a
-- Library boost_math_c99l found /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_math_c99l.a
-- Found: /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_math_c99l.a
-- Library boost_math_tr1 found /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_math_tr1.a
-- Found: /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_math_tr1.a
-- Library boost_math_tr1f found /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_math_tr1f.a
-- Found: /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_math_tr1f.a
-- Library boost_math_tr1l found /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_math_tr1l.a
-- Found: /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_math_tr1l.a
-- Library boost_stacktrace_addr2line found /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_stacktrace_addr2line.a
-- Found: /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_stacktrace_addr2line.a
-- Library boost_stacktrace_basic found /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_stacktrace_basic.a
-- Found: /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_stacktrace_basic.a
-- Library boost_stacktrace_noop found /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_stacktrace_noop.a
-- Found: /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_stacktrace_noop.a
-- Library boost_unit_test_framework found /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_unit_test_framework.a
-- Found: /Users/kittipat/.conan/data/boost/1.72.0/_/_/package/2439fa14ae114198bd340332be9c9f3e28aa8c03/lib/libboost_unit_test_framework.a
-- Dependency ZLIB already found
-- Conan: Using autogenerated FindBZip2.cmake
-- Library bz2 found /Users/kittipat/.conan/data/bzip2/1.0.8/_/_/package/25d69afe851bfb8cb5aedd20123fa41e061f316e/lib/libbz2.a
-- Found: /Users/kittipat/.conan/data/bzip2/1.0.8/_/_/package/25d69afe851bfb8cb5aedd20123fa41e061f316e/lib/libbz2.a
-- Conan: Adjusting output directories
-- Conan: Using cmake global configuration
-- Conan: Adjusting default RPATHs Conan policies
-- Conan: Adjusting language standard
-- Current conanbuildinfo.cmake directory: /Users/kittipat/horizon/conan_test/build
-- Configuring done
CMake Error at CMakeLists.txt:15 (add_executable):
Target "md5" links to target "glog::glog" but the target was not found.
Perhaps a find_package() call is missing for an IMPORTED target, or an
ALIAS target is missing?
CMake Error at CMakeLists.txt:15 (add_executable):
Target "md5" links to target "Boost::filesystem" but the target was not
found. Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?
-- Generating done
CMake Generate step failed. Build files cannot be regenerated correctly.
Hi, @kittipatv
Right now the cmake_find_package has only one target documented, with all the libraries in the package. We are working on a new feature, _components_ (hopefully ready for the next release), to be able to provide more flexibility, and let the consumer use just one library from a multi-component library (like Boost). Right now it is not possible using this generator.
For example, if you have a look to the glog package in Conan Center, you can inspect the recipe and see these lines:
def package_info(self):
self.cpp_info.libs = tools.collect_libs(self)
if self.settings.os == "Linux":
self.cpp_info.system_libs.append("pthread")
self.cpp_info.names["cmake_find_package"] = "GLOG"
self.cpp_info.names["cmake_find_package_multi"] = "GLOG"
Here you can see that the package glog will populate the target GLOG::GLOG when using the cmake_find_package generator (it is the same name CMake has in its modules).
You can also get this information using the markdown generator, it is a handy way of inspecting a package:
conan install glog/0.4.0@ -g markdown
will create a .md file for each of the requirements, you can open those files (glog.md) using your browser or your preferred text editor (if you have any markdown plugin to render it, the better) and it will show you an example to consume the library (there is a hotfix pending to be released in 1.24.1)
Thank you for the response. How about the link issue with poco? Did I make something wrong in the setup?
The lines you are using to link:
add_executable(md5 md5.cpp)
target_link_libraries(md5 poco)
target_link_libraries(md5 glog::glog)
target_link_libraries(md5 Boost::filesystem)
If you want to use targets coming from the find_package(XXXX) that uses files generated by Conan those aren't the proper targets. glog target is GLOG::GLOG, poco target is Poco::Poco and boost one is Boost::Boost, Conan follows the casing convention from CMake for the targets, but we are not offering yet access to components (PRs are on its way).
The lines you are using to link:
add_executable(md5 md5.cpp) target_link_libraries(md5 poco) target_link_libraries(md5 glog::glog) target_link_libraries(md5 Boost::filesystem)If you want to use targets coming from the
find_package(XXXX)that uses files generated by Conan those aren't the proper targets.glogtarget isGLOG::GLOG,pocotarget isPoco::Pocoandboostone isBoost::Boost, Conan follows the casing convention from CMake for the targets, but we are not offering yet access to components (PRs are on its way).
Any status updates on these PRs? Thanks
This is a bug in the boost recipe at conan-center-index.
There is a pr aiming to fix this at https://github.com/conan-io/conan-center-index/pull/2097.
Most helpful comment
The lines you are using to link:
If you want to use targets coming from the
find_package(XXXX)that uses files generated by Conan those aren't the proper targets.glogtarget isGLOG::GLOG,pocotarget isPoco::Pocoandboostone isBoost::Boost, Conan follows the casing convention from CMake for the targets, but we are not offering yet access to components (PRs are on its way).