From 14691399cd55e2e6408b2b2d07084881885a30bb Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Sat, 16 Apr 2022 20:10:02 +0300 Subject: [PATCH] disable dllexport from static builds. Closes https://github.com/icculus/physfs/pull/15 . --- CMakeLists.txt | 4 ++++ src/physfs.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index d0356cb..6efdbda 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -166,6 +166,10 @@ if(PHYSFS_BUILD_STATIC) set_target_properties(physfs-static PROPERTIES VS_WINRT_COMPONENT True) set_target_properties(physfs-static PROPERTIES STATIC_LIBRARY_FLAGS "/ignore:4264") endif() + if(WIN32 OR WINRT OR OS2) + # no dll exports from the static library + target_compile_definitions(physfs-static PRIVATE "PHYSFS_STATIC") + endif() set(PHYSFS_LIB_TARGET physfs-static) set(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";physfs-static") diff --git a/src/physfs.h b/src/physfs.h index 1de38f9..733577e 100644 --- a/src/physfs.h +++ b/src/physfs.h @@ -225,6 +225,8 @@ extern "C" { #if defined(PHYSFS_DECL) /* do nothing. */ +#elif defined(PHYSFS_STATIC) +#define PHYSFS_DECL /**/ #elif defined(_WIN32) || defined(__OS2__) #define PHYSFS_DECL __declspec(dllexport) #elif defined(__SUNPRO_C)