Skip to content

Commit bfd0d1d

Browse files
committed
CMake: define digidocpp_EXPORTS on digidocpp target for static builds
When BUILD_SHARED_LIBS=OFF on Windows, CMake does not automatically define digidocpp_EXPORTS on the digidocpp target (it only does this for shared libraries). This causes DIGIDOCPP_EXPORT in Exports.h to resolve to __declspec(dllimport) instead of __declspec(dllexport), which is incorrect when compiling the library itself. Apply the same pattern already used for digidocpp_util and digidocpp_tsl at line 83-84: set COMPILE_DEFINITIONS digidocpp_EXPORTS on the target for static builds.
1 parent e232b19 commit bfd0d1d

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

src/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ endif()
257257

258258
if(NOT ${BUILD_SHARED_LIBS})
259259
set(STATIC_TARGETS minizip digidocpp_tsl digidocpp_util)
260+
set_property(TARGET digidocpp PROPERTY COMPILE_DEFINITIONS digidocpp_EXPORTS)
260261
endif()
261262

262263
install(TARGETS digidocpp ${STATIC_TARGETS}

0 commit comments

Comments
 (0)