CMake无法确定目标的链接器语言:azurestorage错误 [英] CMake can not determine linker language for target: azurestorage error
问题描述
我是C ++编程的新手,在使用CMake将azure-storage-cpp存储库添加到VS解决方案时遇到了一些麻烦。
I'm very new to C++ programming and having some trouble using CMake to add the azure-storage-cpp repository to my VS solution.
这里是构建错误,当我尝试构建azure存储项目时进入VS。
Here is the build error I am getting in VS, when I attempt to build the azure storage project.
CMake无法确定目标程序的链接器语言:azurestorage
CMake can not determine linker language for target: azurestorage
这是我的CMake条目:
Here is my CMake entry:
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仓库不是我的仓库,因此我无法添加此类文件。
I tried adding SET_TARGET_PROPERTIES(azurestorage PROPERTIES LINKER_LANGUAGE CXX)
to my CMakeList.txt file but it doesn't help. I've also read on other forums that the repo needs to have a .cpp and .h file in the root directory for CMake to know which language. However since the azure-storage-cpp repo isn't mine, I don't have the ability to add such files.
我在Windows10上使用VS2015
I'm using VS2015 on Windows10
我在做什么错?感谢所有帮助。
What am I doing wrong? Any and all help is appreciated.
推荐答案
我已经尝试了您的示例,相关的错误消息更多CMake的输出:
I've given your example a try and the relevant error message is more to the top of CMake's output:
-- Unsupported Build Platform.
因此,如果要添加它,请不要使用 ExternalProject_Add()
。库中包含的 CMakeLists.txt
用于 Unix / Linux / OSX 。
So if you want to add it, don't use ExternalProject_Add()
. The library's included CMakeLists.txt
is for Unix/Linux/OSX.
但是它带有VS2015的现有 .vcproj
,您可以使用 include_external_msproject()
:
But it comes with an existing .vcproj
for VS2015 which you can include into your project with 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"
)
这篇关于CMake无法确定目标的链接器语言:azurestorage错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!