Objective: using CMake with Visual Studio 2022 to build SimpleAmqpClient as a static library.
I have built RabbitMQ-C as a static library and I am trying to get a builld of the SimpleAmqpClient library (again as a static build). SimpleAmqpClient requires the Boost Chrono library and I have specifically told CMake what static library to use. However, when I come to cmake --build . --config Release
CMake is trying to find boost_chrono-vc143-mt-x64_1_80.lib (the DLL headers) rather than the static library libboost_chrono-vc142-mt-x64-1_80.lib
My command line invocation for the initial CMake is:
cmake -G "Visual Studio 17 2022" -A x64 ^
-DBoost_INCLUDE_DIR="C:/SIM_PACKAGES/boost_1_80_0" ^
-DBOOST_ROOT="C:/SIM_PACKAGES/boost_1_80_0" ^
-DBOOST_LIBRARYDIR="C:/SIM_PACKAGES/boost_1_80_0/stage/lib" ^
-DRabbitmqc_INCLUDE_DIR="C:/AmqpPackages/rabbitmq-c-master/rabbitmq-c-master/include" ^
-DRabbitmqc_LIBRARY="C:/AmqpPackages/rabbitmq-c-master/rabbitmq-c-master/build/librabbitmq/Release/librabbitmq.4.lib" ^
-DBoost_ADDITIONAL_VERSIONS="1.80 1.80.0" ^
-DBoost_USE_STATIC_LIBS=ON ^
-DBoost_USE_STATIC_RUNTIME=ON ^
-DBoost_USE_MULTITHREADED=ON ^
-DBoost_CHRONO_LIBRARY="C:/SIM_PACKAGES/boost_1_80_0/stage/lib/libboost_chrono-vc143-mt-x64-1_80.lib" ^
-DENABLE_SSL_SUPPORT=OFF ^
..
Then I attempt to build using cmake --build . --config Release
and get:
MSBuild version 17.9.5+33de0b227 for .NET Framework
1>Checking Build System
Building Custom Rule C:/AmqpPackages/SimpleAmqpClient-master/SimpleAmqpClient-master/CMakeLists.txt
AmqpException.cpp
warning: amqp.h is deprecated, use rabbitmq-c/amqp.h instead.
warning: amqp_framing.h is deprecated, use rabbitmq-c/framing.h instead.
Channel.cpp
warning: amqp.h is deprecated, use rabbitmq-c/amqp.h instead.
warning: amqp_framing.h is deprecated, use rabbitmq-c/framing.h instead.
warning: amqp_tcp_socket.h is deprecated, use rabbitmq-c/tcp_socket.h instead.
C:AmqpPackagesSimpleAmqpClient-masterSimpleAmqpClient-mastersrcSimpleAmqpClientBadUriException.h(41,61): warning
C4275: non dll-interface class 'std::runtime_error' used as base for dll-interface class 'AmqpClient::BadUriException'
[C:AmqpPackagesSimpleAmqpClient-masterSimpleAmqpClient-masterbuildSimpleAmqpClient.vcxproj]
(compiling source file '../src/Channel.cpp')
C:Program FilesMicrosoft Visual Studio2022CommunityVCToolsMSVC14.39.33519includestdexcept(100,19):
see declaration of 'std::runtime_error'
C:AmqpPackagesSimpleAmqpClient-masterSimpleAmqpClient-mastersrcSimpleAmqpClientBadUriException.h(41,31):
see declaration of 'AmqpClient::BadUriException'
C:AmqpPackagesSimpleAmqpClient-masterSimpleAmqpClient-mastersrcSimpleAmqpClientConsumerCancelledException.h(49,19
): warning C4275: non dll-interface class 'std::runtime_error' used as base for dll-interface class 'AmqpClient::Consum
erCancelledException' [C:AmqpPackagesSimpleAmqpClient-masterSimpleAmqpClient-masterbuildSimpleAmqpClient.vcxproj]
(compiling source file '../src/Channel.cpp')
C:Program FilesMicrosoft Visual Studio2022CommunityVCToolsMSVC14.39.33519includestdexcept(100,19):
see declaration of 'std::runtime_error'
C:AmqpPackagesSimpleAmqpClient-masterSimpleAmqpClient-mastersrcSimpleAmqpClientConsumerCancelledException.h(48,
31):
see declaration of 'AmqpClient::ConsumerCancelledException'
C:AmqpPackagesSimpleAmqpClient-masterSimpleAmqpClient-mastersrcSimpleAmqpClientConsumerCancelledException.h(64,15
): warning C4251: 'AmqpClient::ConsumerCancelledException::m_consumer_tag': class 'std::basic_string<char,std::char_tra
its<char>,std::allocator<char>>' needs to have dll-interface to be used by clients of class 'AmqpClient::ConsumerCancel
ledException' [C:AmqpPackagesSimpleAmqpClient-masterSimpleAmqpClient-masterbuildSimpleAmqpClient.vcxproj]
(compiling source file '../src/Channel.cpp')
C:Program FilesMicrosoft Visual Studio2022CommunityVCToolsMSVC14.39.33519includexstring(2337,7):
see declaration of 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>'
C:AmqpPackagesSimpleAmqpClient-masterSimpleAmqpClient-mastersrcChannel.cpp(146,31): warning C4996: 'strdup': The P
OSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _strdup. See online help for det
ails. [C:AmqpPackagesSimpleAmqpClient-masterSimpleAmqpClient-masterbuildSimpleAmqpClient.vcxproj]
C:AmqpPackagesSimpleAmqpClient-masterSimpleAmqpClient-mastersrcChannel.cpp(493,37): warning C4101: 'e': unreferenc
ed local variable [C:AmqpPackagesSimpleAmqpClient-masterSimpleAmqpClient-masterbuildSimpleAmqpClient.vcxproj]
C:AmqpPackagesSimpleAmqpClient-masterSimpleAmqpClient-mastersrcChannel.cpp(617,37): warning C4101: 'e': unreferenc
ed local variable [C:AmqpPackagesSimpleAmqpClient-masterSimpleAmqpClient-masterbuildSimpleAmqpClient.vcxproj]
ChannelImpl.cpp
warning: amqp.h is deprecated, use rabbitmq-c/amqp.h instead.
warning: amqp_framing.h is deprecated, use rabbitmq-c/framing.h instead.
C:AmqpPackagesSimpleAmqpClient-masterSimpleAmqpClient-mastersrcSimpleAmqpClientConsumerCancelledException.h(49,19
): warning C4275: non dll-interface class 'std::runtime_error' used as base for dll-interface class 'AmqpClient::Consum
erCancelledException' [C:AmqpPackagesSimpleAmqpClient-masterSimpleAmqpClient-masterbuildSimpleAmqpClient.vcxproj]
(compiling source file '../src/ChannelImpl.cpp')
C:Program FilesMicrosoft Visual Studio2022CommunityVCToolsMSVC14.39.33519includestdexcept(100,19):
see declaration of 'std::runtime_error'
C:AmqpPackagesSimpleAmqpClient-masterSimpleAmqpClient-mastersrcSimpleAmqpClientConsumerCancelledException.h(48,
31):
see declaration of 'AmqpClient::ConsumerCancelledException'
C:AmqpPackagesSimpleAmqpClient-masterSimpleAmqpClient-mastersrcSimpleAmqpClientConsumerCancelledException.h(64,15
): warning C4251: 'AmqpClient::ConsumerCancelledException::m_consumer_tag': class 'std::basic_string<char,std::char_tra
its<char>,std::allocator<char>>' needs to have dll-interface to be used by clients of class 'AmqpClient::ConsumerCancel
ledException' [C:AmqpPackagesSimpleAmqpClient-masterSimpleAmqpClient-masterbuildSimpleAmqpClient.vcxproj]
(compiling source file '../src/ChannelImpl.cpp')
C:Program FilesMicrosoft Visual Studio2022CommunityVCToolsMSVC14.39.33519includexstring(2337,7):
see declaration of 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>'
C:AmqpPackagesSimpleAmqpClient-masterSimpleAmqpClient-mastersrcSimpleAmqpClientConnectionClosedException.h(44,19)
: warning C4275: non dll-interface class 'std::runtime_error' used as base for dll-interface class 'AmqpClient::Connect
ionClosedException' [C:AmqpPackagesSimpleAmqpClient-masterSimpleAmqpClient-masterbuildSimpleAmqpClient.vcxproj]
(compiling source file '../src/ChannelImpl.cpp')
C:Program FilesMicrosoft Visual Studio2022CommunityVCToolsMSVC14.39.33519includestdexcept(100,19):
see declaration of 'std::runtime_error'
C:AmqpPackagesSimpleAmqpClient-masterSimpleAmqpClient-mastersrcSimpleAmqpClientConnectionClosedException.h(43,3
1):
see declaration of 'AmqpClient::ConnectionClosedException'
C:AmqpPackagesSimpleAmqpClient-masterSimpleAmqpClient-mastersrcChannelImpl.cpp(176,25): warning C4244: 'return': c
onversion from '__int64' to 'amqp_channel_t', possible loss of data [C:AmqpPackagesSimpleAmqpClient-masterSimpleAmqp
Client-masterbuildSimpleAmqpClient.vcxproj]
C:AmqpPackagesSimpleAmqpClient-masterSimpleAmqpClient-mastersrcChannelImpl.cpp(215,13): warning C4244: 'return': c
onversion from '__int64' to 'amqp_channel_t', possible loss of data [C:AmqpPackagesSimpleAmqpClient-masterSimpleAmqp
Client-masterbuildSimpleAmqpClient.vcxproj]
BasicMessage.cpp
warning: amqp.h is deprecated, use rabbitmq-c/amqp.h instead.
warning: amqp_framing.h is deprecated, use rabbitmq-c/framing.h instead.
AmqpLibraryException.cpp
warning: amqp.h is deprecated, use rabbitmq-c/amqp.h instead.
AmqpResponseLibraryException.cpp
warning: amqp.h is deprecated, use rabbitmq-c/amqp.h instead.
Envelope.cpp
MessageReturnedException.cpp
Table.cpp
warning: amqp.h is deprecated, use rabbitmq-c/amqp.h instead.
TableImpl.cpp
warning: amqp.h is deprecated, use rabbitmq-c/amqp.h instead.
C:AmqpPackagesSimpleAmqpClient-masterSimpleAmqpClient-mastersrcTableImpl.cpp(159,41): warning C4267: '=': conversi
on from 'size_t' to 'int', possible loss of data [C:AmqpPackagesSimpleAmqpClient-masterSimpleAmqpClient-masterbuild
SimpleAmqpClient.vcxproj]
C:AmqpPackagesSimpleAmqpClient-masterSimpleAmqpClient-mastersrcTableImpl.cpp(204,37): warning C4267: '=': conversi
on from 'size_t' to 'int', possible loss of data [C:AmqpPackagesSimpleAmqpClient-masterSimpleAmqpClient-masterbuild
SimpleAmqpClient.vcxproj]
Generating Code...
LINK : fatal error LNK1104: cannot open file 'boost_chrono-vc143-mt-x64-1_80.lib' [C:AmqpPackagesSimpleAmqpClient-mas
terSimpleAmqpClient-masterbuildSimpleAmqpClient.vcxproj]