From 07c7544904da078c46a3fc0e7550ce71b417ef7e Mon Sep 17 00:00:00 2001 From: Mathis Rosenhauer Date: Fri, 25 Jul 2014 09:35:14 +0200 Subject: [PATCH] Fixed Windows static lib buid. --- CMakeLists.txt | 3 ++- config.h.in | 1 + src/libaec.h | 11 +++++------ 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9c644eb..9b789ab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,11 +86,12 @@ ADD_DEFINITIONS("-DHAVE_CONFIG_H") # Allow the developer to select if Dynamic or Static libraries are built OPTION (BUILD_SHARED_LIBS "Build Shared Libraries" OFF) -SET (LIB_TYPE STATIC) IF (BUILD_SHARED_LIBS) # User wants to build Dynamic Libraries, # so change the LIB_TYPE variable to CMake keyword 'SHARED' SET (LIB_TYPE SHARED) +ELSE(BUILD_SHARED_LIBS) + SET (LIB_TYPE STATIC) ENDIF (BUILD_SHARED_LIBS) INCLUDE_DIRECTORIES("${PROJECT_BINARY_DIR}") diff --git a/config.h.in b/config.h.in index 9f5fffb..acfb060 100644 --- a/config.h.in +++ b/config.h.in @@ -3,3 +3,4 @@ #cmakedefine WORDS_BIGENDIAN 1 #cmakedefine HAVE_DECL___BUILTIN_CLZLL 1 #cmakedefine HAVE_BSR64 1 +#cmakedefine BUILD_SHARED_LIBS 1 diff --git a/src/libaec.h b/src/libaec.h index 49ec078..1d99466 100644 --- a/src/libaec.h +++ b/src/libaec.h @@ -59,15 +59,14 @@ # include #endif -#ifdef _WIN32 +#if _WIN32 && BUILD_SHARED_LIBS # ifdef DLL_EXPORT -# define AEC_SCOPE __declspec(dllexport) +# define AEC_SCOPE __declspec(dllexport) # else -# define AEC_SCOPE extern __declspec(dllimport) +# define AEC_SCOPE extern __declspec(dllimport) # endif -#endif -#ifndef AEC_SCOPE -# define AEC_SCOPE extern +#else +# define AEC_SCOPE extern #endif struct internal_state; -- 2.7.4