From 27a2182974869539c66a746a5f449d8ded0fb307 Mon Sep 17 00:00:00 2001 From: Ciro Nishiguchi Date: Tue, 21 Aug 2018 13:41:43 -0500 Subject: uhd: Define UHD_API as empty string when building static lib Fixes #2484 When building uhd host as a static library on Windows, UHD_API is defined as __declspec(dllimport). This results in MSVC returning error C2491 during compilation. Added a preprocessor define UHD_STATIC_LIB in cmake and made the config headers set UHD_API to empty string when UHD_STATIC_LIB is defined. --- host/lib/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'host/lib/CMakeLists.txt') diff --git a/host/lib/CMakeLists.txt b/host/lib/CMakeLists.txt index cbc022533..4461612de 100644 --- a/host/lib/CMakeLists.txt +++ b/host/lib/CMakeLists.txt @@ -198,6 +198,7 @@ ENDIF(NOT UHDHOST_PKG) IF(ENABLE_STATIC_LIBS) ADD_LIBRARY(uhd_static STATIC ${libuhd_sources}) SET_TARGET_PROPERTIES(uhd_static PROPERTIES OUTPUT_NAME uhd) + SET_TARGET_PROPERTIES(uhd_static PROPERTIES COMPILE_DEFINITIONS UHD_STATIC_LIB) INSTALL(TARGETS uhd_static ARCHIVE DESTINATION lib${LIB_SUFFIX} # .lib or .a file ) -- cgit v1.2.3