简体   繁体   中英

CMake include for C++ Azure

This is about how to integrate the azure-storage C++ toolkit in CMake.

I try to build a tool in our application that connects to Azure blob storage, lists files/containers, reads data, etc., I work on Linux (Ubuntu 17.04). I have built both the cpprestsdk and azure-storage tools from source.

I am able to compile some things because I literally add

-I/apps/azure/inst/include

to the CMAKE_CXX_FLAGS . As you can see I used CMAKE_INSTALL_PREFIX=/apps/azure/inst , used it for both cpprest and azure-storage.

In the lib subdirectory there is a cpprestsdk/ directory that contains .cmake files. But I need a .cmake file for azure-storage that I can include in my own CMakeLists.txt , which adds stuff I need (flags, libs, etc.). Looking at the samples reveals that these are built in a way that will only work during the build of the sdk.

Does anyone know if there is such a .cmake include file, and if so .... where is it installed?

OK well, I could find nothing and nobody posts an answer, so I've been experimenting. The short answer is: use the cpprest stuff and add some azure-storage directives yourself.

The only thing I could find is CMake code in the README.md of cpprest . I took that in and added my own azure storage dir name where that could be needed.

Added:

find_path( AZURE_INST_DIR "" HINTS /apps/azure/inst REQUIRED )

The whole thing works because the big bulk of dependencies is under cpprest, azure-storage itself does not have extra dependencies (thank god!).

Note gcc users: turn off -Wshadow and -Woverloaded-virtual because the cpprest and azure-storage code is riddled with those (apparently these are not available in Visual studio).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM