microsoft / cpprestsdk

The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services.
Other
7.98k stars 1.66k forks source link

no cmake find_package() config module #1128

Open RotateAt60MPH opened 5 years ago

RotateAt60MPH commented 5 years ago

I am having problems with vcpkg and cmake under CentOS to build a C++ static library project that has a dependancy on boost and cpprestsdk. I cannot appear to get include paths set in order for header files location to be resolved.

The vcpkg folks say that the problem is that cpprestsdk does not provide a find_package() config module.

Why is there not a config module? If there isn't a config module, there should really be one if cmake is to be at all taken seriously. Without a config module, is there any guidance on what cmake variables to set to get things to actually work (include paths, lib paths, etc)?

Here's my CMakeLists.txt. If I try and message() any of the expected cpprestsdk variables, there are none defined after loading the package.

cmake_minimum_required(VERSION 2.8.9)

if(DEFINED ENV{VCPKG_ROOT} AND NOT DEFINED CMAKE_TOOLCHAIN_FILE)
  set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"  CACHE STRING "")
endif()

message(" [INFO] VCPKG CMAKE_TOOLCHAIN_FILE = ${CMAKE_TOOLCHAIN_FILE}")

set(CMAKE_CXX_STANDARD 11)
# This has to be HARDCODED.  Bleh.
set(cpprestsdk_DIR "/vcpkg/installed/x64-linux/share/cpprestsdk")

find_package(OpenSSL REQUIRED)
find_package(cpprestsdk CONFIG REQUIRED)

find_library(cpprestsdk-lib cpprest)
message(STATUS "cpprestsdk-lib = ${cpprestsdk-lib}") # NOT FOUND

add_compile_options(-std=c++11 -I../ -m64)
file(GLOB SOURCES "*.cpp")
add_library(Domain STATIC ${SOURCES})
install(TARGETS Domain DESTINATION ../lib)
RotateAt60MPH commented 5 years ago

No comments???

hsd-dev commented 5 years ago

https://github.com/microsoft/cpprestsdk/issues/686#issuecomment-440622042