Parcourir la source

disable dllexport from static builds.

Closes https://github.com/icculus/physfs/pull/15 .
Ozkan Sezer il y a 3 ans
Parent
commit
9e2be90470
2 fichiers modifiés avec 6 ajouts et 0 suppressions
  1. 4 0
      CMakeLists.txt
  2. 2 0
      src/physfs.h

+ 4 - 0
CMakeLists.txt

@@ -165,6 +165,10 @@ if(PHYSFS_BUILD_STATIC)
 		set_target_properties(physfs-static PROPERTIES VS_WINRT_COMPONENT True)
 		set_target_properties(physfs-static PROPERTIES VS_WINRT_COMPONENT True)
         set_target_properties(physfs-static PROPERTIES STATIC_LIBRARY_FLAGS "/ignore:4264")
         set_target_properties(physfs-static PROPERTIES STATIC_LIBRARY_FLAGS "/ignore:4264")
     endif()
     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_LIB_TARGET physfs-static)
     set(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";physfs-static")
     set(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";physfs-static")

+ 2 - 0
src/physfs.h

@@ -225,6 +225,8 @@ extern "C" {
 
 
 #if defined(PHYSFS_DECL)
 #if defined(PHYSFS_DECL)
 /* do nothing. */
 /* do nothing. */
+#elif defined(PHYSFS_STATIC)
+#define PHYSFS_DECL   /**/
 #elif defined(_WIN32) || defined(__OS2__)
 #elif defined(_WIN32) || defined(__OS2__)
 #define PHYSFS_DECL __declspec(dllexport)
 #define PHYSFS_DECL __declspec(dllexport)
 #elif defined(__SUNPRO_C)
 #elif defined(__SUNPRO_C)