Hi,
I attached two files, test.cpp, which is an example copied from the cpp-netlib
site, and CMakeLists.txt to build it to allow reproducing the issue.
If I install libcppnetlib-dev and libcppnetlib0, cmake fails:
CMake Error at CMakeLists.txt:6 (find_package):
By not providing "Findcppnetlib.cmake" in CMAKE_MODULE_PATH this project
has asked CMake to find a package configuration file provided by
"cppnetlib", but CMake did not find one.
Could not find a package configuration file provided by "cppnetlib"
(requested version 0.11.0) with any of the following names:
cppnetlibConfig.cmake
cppnetlib-config.cmake
Add the installation prefix of "cppnetlib" to CMAKE_PREFIX_PATH or set
"cppnetlib_DIR" to a directory containing one of the above files. If
"cppnetlib" provides a separate development package or SDK, be sure it has
been installed.
If I download and compile the upstream source code, it will generate (and
install) four files, cppnetlibConfig.cmake, cppnetlibConfigVersion.cmake,
cppnetlibTargets.cmake, and cppnetlibTargets-noconfig.cmake; This makes the
above cmake command run.
If I remove this local build of cpp-netlib, the cmake cache, and
~/.cmake/packages/cppnetlib/*, the cmake command returns the same error as at
the beginning.
Hope that helps reproduce the problem. Let me know if I can help further.
Sten
cmake_minimum_required( VERSION 2.6)
project( test)
find_package( Boost REQUIRED COMPONENTS thread system)
find_package( cppnetlib 0.11.0 REQUIRED)
set( SOURCES_TEST_NETLIB
test.cpp
)
add_executable( test ${SOURCES_TEST_NETLIB})
target_link_libraries( test ${Boost_LIBRARIES} ${CPPNETLIB_LIBRARIES})
#include <boost/network/protocol/http/client.hpp>
#include <iostream>
int main(int argc, char *argv[]) {
using namespace boost::network;
if (argc != 2) {
std::cout << "Usage: " << argv[0] << " [url]" << std::endl;
return 1;
}
http::client client;
http::client::request request(argv[1]);
request << header("Connection", "close");
http::client::response response = client.get(request);
std::cout << body(response) << std::endl;
return 0;
}