Commit 61c9bc68 authored by Ghislain MARY's avatar Ghislain MARY

Fix for static build of bctoolbox on Windows.

parent 967ae3d8
......@@ -139,6 +139,10 @@ unsigned long __bctbx_thread_self(void);
#endif
#if defined(_WIN32) || defined(_WIN32_WCE)
#ifdef BCTBX_STATIC
#define BCTBX_PUBLIC
#define BCTBX_VAR_PUBLIC
#else
#ifdef BCTBX_EXPORTS
#define BCTBX_PUBLIC __declspec(dllexport)
#define BCTBX_VAR_PUBLIC extern __declspec(dllexport)
......@@ -146,6 +150,7 @@ unsigned long __bctbx_thread_self(void);
#define BCTBX_PUBLIC __declspec(dllimport)
#define BCTBX_VAR_PUBLIC __declspec(dllimport)
#endif
#endif
#pragma push_macro("_WINSOCKAPI_")
#ifndef _WINSOCKAPI_
......
......@@ -60,14 +60,14 @@ if(ENABLE_STATIC)
add_library(bctoolbox-static STATIC ${BCTOOLBOX_SOURCE_FILES})
target_link_libraries(bctoolbox-static ${CMAKE_THREAD_LIBS_INIT})
if(WIN32)
target_compile_definitions(bctoolbox-static PRIVATE "-DBCTBX_EXPORTS")
target_compile_definitions(bctoolbox-static PUBLIC "-DBCTBX_STATIC")
endif()
set_target_properties(bctoolbox-static PROPERTIES OUTPUT_NAME bctoolbox)
if(CUNIT_FOUND)
add_library(bctoolbox-tester-static STATIC ${BCTOOLBOX_TESTER_SOURCE_FILES})
set_target_properties(bctoolbox-tester-static PROPERTIES OUTPUT_NAME bctoolbox-tester)
if(WIN32)
target_compile_definitions(bctoolbox-tester-static PRIVATE "-DBCTBX_EXPORTS")
target_compile_definitions(bctoolbox-tester-static PUBLIC "-DBCTBX_STATIC")
endif()
endif()
if(HAVE_LIBRT)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment