c++ - CMake 无法确定目标 : azurestorage error 的链接器语言

标签 c++ azure cmake

我对 C++ 编程非常陌生,在使用 CMake 将 azure-storage-cpp 存储库添加到我的 VS 解决方案时遇到一些问题。

这是当我尝试构建 azure 存储项目时在 VS 中遇到的构建错误。

CMake can not determine linker language for target: azurestorage

这是我的 CMake 条目:

ExternalProject_Add( azurestorage
  PREFIX azurestorage
  GIT_REPOSITORY https://github.com/Azure/azure-storage-cpp.git
  GIT_TAG master
  SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../azurestorage
  SOURCE_SUBDIR Microsoft.WindowsAzure.Storage)

我尝试将 SET_TARGET_PROPERTIES(azurestorage PROPERTIES LINKER_LANGUAGE CXX) 添加到我的 CMakeList.txt 文件,但没有帮助。我还在其他论坛上读到,存储库需要在根目录中有一个 .cpp 和 .h 文件,以便 CMake 知道哪种语言。但是,由于 azure-storage-cpp 存储库不是我的,因此我无法添加此类文件。

我在 Windows10 上使用 VS2015

我做错了什么?感谢任何和所有的帮助。

最佳答案

我已经尝试了您的示例,相关错误消息更多位于 CMake 输出的顶部:

-- Unsupported Build Platform.

因此,如果您想添加它,请不要使用ExternalProject_Add()。该库包含的 CMakeLists.txt 适用于 Unix/Linux/OSX

但它附带了 VS2015 的现有 .vcproj,您可以使用 include_external_msproject() 将其包含到您的项目中:

find_package(Git REQUIRED)
execute_process(
    COMMAND "${GIT_EXECUTABLE}" clone https://github.com/Azure/azure-storage-cpp.git
)
set(NUGET_EXECUTABLE "${CMAKE_CURRENT_BINARY_DIR}/azure-storage-cpp/tools/NuGet.exe")
execute_process(
    COMMAND "${NUGET_EXECUTABLE}" restore "azure-storage-cpp/Microsoft.WindowsAzure.Storage.v140.sln" 
)
include_external_msproject(
    azurestorage 
    "azure-storage-cpp/Microsoft.WindowsAzure.Storage/Microsoft.WindowsAzure.Storage.v140.vcxproj"
)

关于c++ - CMake 无法确定目标 : azurestorage error 的链接器语言,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43036477/

相关文章:

c++ - mysql_stmt_store_result() 上的 MySQL C API 崩溃

c++ - 搜索文件中保存的哈希表

c++将文件连接返回给成员,因此可以由同一类的其他方法使用

.net - Cosmos DB 模拟器 : Failed to get authorization headers for offers

c# - Azure函数从HttpTriggerFunction访问CloudBlobContainer

cmake - 在 CMake 中安装编译期间生成的自定义文件

c++ - 使用 vcpkg 编译 gRPC C++ 示例

c++ - 在 QTableWidget 中动态添加一行

sql-server - Azure 数据工厂上的存储过程失败并显示错误消息 : The length of execution output is over limit (around 1M currently)

c++ - CMake:在 Windows 上将 Boost v1.69 与 MSVC 结合使用