CMake没有将静态库链接到其他静态库

时间:2018-05-15 01:34:42

标签: windows visual-studio amazon-web-services cmake static-libraries

我正在创建一个静态库,而这依赖于其他库。我在Windows平台上制作这个库。我是cmake的新手,但尝试过这样:

set(Agent17_LIB Agent17Lib)
add_library(${Agent17_LIB} "${PROJECT_SOURCE_DIR}/Agent17Lib.cpp")


find_library(awscppiotsdklib aws-iot-sdk-cpp.lib ${PROJECT_SOURCE_DIR}/../Libs/aws-iot-device-sdk-cpp/build-64/archive/Debug)
MESSAGE( STATUS "awscppiotsdklib path:         " ${awscppiotsdklib} )

find_library(awscppsdkcorelib aws-cpp-sdk-core.lib ${PROJECT_SOURCE_DIR}/../Libs/aws-cpp-sdk-core/Debug)
MESSAGE( STATUS "awscppsdkcorelib path:         " ${awscppsdkcorelib} )

find_library(awscppsdks3lib aws-cpp-sdk-s3.lib ${PROJECT_SOURCE_DIR}/../Libs/aws-cpp-sdk-s3/Debug)
MESSAGE( STATUS "awscppsdks3lib path:         " ${awscppsdks3lib} )

find_library(awscppsdkstslib aws-cpp-sdk-sts.lib ${PROJECT_SOURCE_DIR}/../Libs/aws-cpp-sdk-sts/Debug)
MESSAGE( STATUS "awscppsdkstslib path:         " ${awscppsdkstslib} )

find_library(libcurllib libcurld.lib ${PROJECT_SOURCE_DIR}/../Libs/Curl)
MESSAGE( STATUS "libcurllib path:         " ${libcurllib} )

find_library(ssleay32MDlib ssleay32MD.lib ${PROJECT_SOURCE_DIR}/../Libs/OpenSSL-Win64/lib/VC)
MESSAGE( STATUS "ssleay32MDlib path:         " ${ssleay32MDlib} )

find_library(libeay32MDlib libeay32MD.lib ${PROJECT_SOURCE_DIR}/../Libs/OpenSSL-Win64/lib/VC)
MESSAGE( STATUS "libeay32MDlib path:         " ${libeay32MDlib} )

target_link_libraries (${Agent17_LIB} awscppiotsdklib awscppsdkcorelib awscppsdks3lib awscppsdkstslib libcurllib ssleay32MDlib libeay32MDlib)

但看起来我的目标库-Agent17_LIB正在创建而不包括其他库。

任何帮助表示赞赏。我被困在这一点上。

我得到的输出是:

$ cmake -G "Visual Studio 15 2017 Win64" ../.
-- The CXX compiler identification is MSVC 19.13.26131.1
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.13.26128/bin/Hostx86/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.13.26128/bin/Hostx86/x64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- awscppiotsdklib path: C:/Work/rits-git-working/Libs/aws-iot-device-sdk-cpp/build-64/archive/Debug/aws-iot-sdk-cpp.lib
-- awscppsdkcorelib path: C:/Work/rits-git-working/Libs/aws-cpp-sdk-core/Debug/aws-cpp-sdk-core.lib
-- awscppsdks3lib path: C:/Work/rits-git-working/Libs/aws-cpp-sdk-s3/Debug/aws-cpp-sdk-s3.lib
-- awscppsdkstslib path: C:/Work/rits-git-working/Libs/aws-cpp-sdk-sts/Debug/aws-cpp-sdk-sts.lib
-- libcurllib path: C:/Work/rits-git-working/Libs/Curl/libcurld.lib
-- ssleay32MDlib path: C:/Work/rits-git-working/Libs/OpenSSL-Win64/lib/VC/ssleay32MD.lib
-- libeay32MDlib path: C:/Work/rits-git-working/Libs/OpenSSL-Win64/lib/VC/libeay32MD.lib
-- CMAKE_BINARY_DIR path: C:/Work/rits-git-working/Agent17Lib/build
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Work/rits-git-working/Agent17Lib/build

有没有办法从cmake更新可视工作室项目的项目属性的Librarian部分?如果我手动更新Librarian部分,那么我就能成功创建主库,但我无法弄清楚如何从cmake更新Librarian。

0 个答案:

没有答案