Skip to content
This repository has been archived by the owner on Jul 1, 2021. It is now read-only.

cannot use Poco components in a cmake transparent way #49

Open
gocarlos opened this issue Apr 27, 2019 · 1 comment
Open

cannot use Poco components in a cmake transparent way #49

gocarlos opened this issue Apr 27, 2019 · 1 comment

Comments

@gocarlos
Copy link

when using poco with conan:

conanfile.txt

# see script conan_setup_environment.sh for the needed commands
[requires]
Poco/1.9.0@pocoproject/stable

[generators]
cmake_find_package
cmake_paths

[options]
Poco:shared=False
Poco:cxx_14=True
# Poco:enable_apacheconnector=False
# Poco:enable_cppparser=False
# Poco:enable_crypto=False
# Poco:enable_data=False
Poco:enable_data_mysql=False
# Poco:enable_data_odbc=False
Poco:enable_data_sqlite=True
Poco:enable_json=True
Poco:enable_mongodb=False
Poco:enable_net=True
Poco:enable_netssl=False
# Poco:enable_netssl_win=True
# Poco:enable_pagecompiler=False
# Poco:enable_pagecompiler_file2page=False
# Poco:enable_pdf=False
# Poco:enable_pocodoc=False
# Poco:enable_sevenzip=False
# Poco:enable_tests=False
Poco:enable_util=True
# Poco:enable_xml=True
# Poco:enable_zip=True

CmakeLists.txt

cmake_minimum_required(VERSION 3.7.2 FATAL_ERROR)

project(http CXX)

if(USE_CONAN_PACKAGE)
include(${CMAKE_SOURCE_DIR}/cmake/conan.cmake)
conan_cmake_run(CONANFILE conanfile.txt BASIC_SETUP BUILD missing)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS)
set(USING_CONAN_PACKAGE ON)
message(STATUS "Using Conan packages")
endif(USE_CONAN_PACKAGE)

find_package(Poco REQUIRED COMPONENTS Foundation Util JSON Net NetSSL Data DataSQLite)


add_library(${PROJECT_NAME}_module
            ${CMAKE_CURRENT_LIST_DIR}/src/io_http.cpp
            ${CMAKE_CURRENT_LIST_DIR}/include/${PROJECT_NAME}/io_http.h)
target_include_directories(${PROJECT_NAME}_module
                           PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
                                  $<INSTALL_INTERFACE:include>)
target_link_libraries(${PROJECT_NAME}_module
                      PRIVATE 
                              Poco::Net)

error:

###
/usr/bin/ld: cannot find -lPoco::Net
###

Poco::Poco is found though Poco::Net is not

xxx@xxxx:~/.conan$ find -name "PocoConfig.cmake"
./data/Poco/1.9.0/pocoproject/stable/build/ccc715586f3c3a0388be23199b3096c8d458cabb/build/Poco/PocoConfig.cmake
./data/Poco/1.9.0/pocoproject/stable/build/1d7611b276f6fb2dc7d77f480833bcaee026730c/build/Poco/PocoConfig.cmake

though this PocoConfig is not in path in the recipe -> only Poco::Poco is exported not Poco::Net, Poco::Utils etc.

As I use conan for native builds and Yocto for cross builds, I'd like to use conan in a cmake transparent way e.g. using find_package and using the lib components

I guess that no PocoConfig.cmake is found in the CMAKE_PREFIX_PATH

ref: https://blog.conan.io/2018/06/11/Transparent-CMake-Integration.html

@litterbug23
Copy link

build-type don't support debug & release config????

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants