Fix MinGW build issue on example (#2642)
* Fix MinGW build issue on example #2638 * Move the cmake change to example\CMakeLists.txt * Update CMakeLists.txt on the example
This commit is contained in:
parent
927cc29444
commit
da14258533
@ -176,7 +176,6 @@ if(SPDLOG_SYSTEM_INCLUDES)
|
|||||||
set(SPDLOG_INCLUDES_LEVEL "SYSTEM")
|
set(SPDLOG_INCLUDES_LEVEL "SYSTEM")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
target_compile_definitions(spdlog PUBLIC SPDLOG_COMPILED_LIB)
|
target_compile_definitions(spdlog PUBLIC SPDLOG_COMPILED_LIB)
|
||||||
target_include_directories(spdlog ${SPDLOG_INCLUDES_LEVEL} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>"
|
target_include_directories(spdlog ${SPDLOG_INCLUDES_LEVEL} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>"
|
||||||
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
|
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
|
||||||
|
@ -12,7 +12,7 @@ endif()
|
|||||||
# Example of using pre-compiled library
|
# Example of using pre-compiled library
|
||||||
# ---------------------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------------------
|
||||||
add_executable(example example.cpp)
|
add_executable(example example.cpp)
|
||||||
target_link_libraries(example PRIVATE spdlog::spdlog)
|
target_link_libraries(example PRIVATE spdlog::spdlog $<$<BOOL:${MINGW}>:ws2_32>)
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------------------
|
||||||
# Example of using header-only library
|
# Example of using header-only library
|
||||||
|
@ -15,9 +15,11 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#pragma comment(lib, "Ws2_32.lib")
|
#if defined(_MSC_VER)
|
||||||
#pragma comment(lib, "Mswsock.lib")
|
# pragma comment(lib, "Ws2_32.lib")
|
||||||
#pragma comment(lib, "AdvApi32.lib")
|
# pragma comment(lib, "Mswsock.lib")
|
||||||
|
# pragma comment(lib, "AdvApi32.lib")
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace spdlog {
|
namespace spdlog {
|
||||||
namespace details {
|
namespace details {
|
||||||
@ -25,7 +27,7 @@ class udp_client
|
|||||||
{
|
{
|
||||||
static constexpr int TX_BUFFER_SIZE = 1024 * 10;
|
static constexpr int TX_BUFFER_SIZE = 1024 * 10;
|
||||||
SOCKET socket_ = INVALID_SOCKET;
|
SOCKET socket_ = INVALID_SOCKET;
|
||||||
sockaddr_in addr_ = {0};
|
sockaddr_in addr_ = {};
|
||||||
|
|
||||||
static void init_winsock_()
|
static void init_winsock_()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user