Commit ed9ebe82 authored by Mathis Rosenhauer's avatar Mathis Rosenhauer

Next attempt to tackle DLLs.

parent 2a4b99e8
...@@ -26,14 +26,15 @@ CONFIGURE_FILE( ...@@ -26,14 +26,15 @@ CONFIGURE_FILE(
ADD_DEFINITIONS("-DHAVE_CONFIG_H") ADD_DEFINITIONS("-DHAVE_CONFIG_H")
# Allow the developer to select if Dynamic or Static libraries are built # Allow the developer to select if Dynamic or Static libraries are built
OPTION (BUILD_SHARED_LIBS "Build Shared Libraries" OFF) OPTION(BUILD_SHARED_LIBS "Build Shared Libraries" ON)
IF (BUILD_SHARED_LIBS) IF(BUILD_SHARED_LIBS)
# User wants to build Dynamic Libraries,
# so change the LIB_TYPE variable to CMake keyword 'SHARED'
SET (LIB_TYPE SHARED) SET (LIB_TYPE SHARED)
ELSE(BUILD_SHARED_LIBS) ELSE(BUILD_SHARED_LIBS)
SET (LIB_TYPE STATIC) IF(WIN32)
ENDIF (BUILD_SHARED_LIBS) MESSAGE(WARNING "You will have to modify libaec.h for static libs.")
ENDIF(WIN32)
SET(LIB_TYPE STATIC)
ENDIF(BUILD_SHARED_LIBS)
INCLUDE_DIRECTORIES("${PROJECT_BINARY_DIR}") INCLUDE_DIRECTORIES("${PROJECT_BINARY_DIR}")
INCLUDE_DIRECTORIES("${PROJECT_BINARY_DIR}/src") INCLUDE_DIRECTORIES("${PROJECT_BINARY_DIR}/src")
......
...@@ -3,4 +3,3 @@ ...@@ -3,4 +3,3 @@
#cmakedefine WORDS_BIGENDIAN 1 #cmakedefine WORDS_BIGENDIAN 1
#cmakedefine HAVE_DECL___BUILTIN_CLZLL 1 #cmakedefine HAVE_DECL___BUILTIN_CLZLL 1
#cmakedefine HAVE_BSR64 1 #cmakedefine HAVE_BSR64 1
#cmakedefine BUILD_SHARED_LIBS 1
...@@ -11,10 +11,10 @@ SET_TARGET_PROPERTIES(sz PROPERTIES ...@@ -11,10 +11,10 @@ SET_TARGET_PROPERTIES(sz PROPERTIES
) )
TARGET_LINK_LIBRARIES(sz aec) TARGET_LINK_LIBRARIES(sz aec)
IF(WIN32) IF(WIN32 AND BUILD_SHARED_LIBS)
SET_TARGET_PROPERTIES (aec PROPERTIES DEFINE_SYMBOL "DLL_EXPORT") SET_TARGET_PROPERTIES (aec PROPERTIES DEFINE_SYMBOL "AECDLL_EXPORTS")
SET_TARGET_PROPERTIES (sz PROPERTIES DEFINE_SYMBOL "DLL_EXPORT") SET_TARGET_PROPERTIES (sz PROPERTIES DEFINE_SYMBOL "AECDLL_EXPORTS")
ENDIF(WIN32) ENDIF(WIN32 AND BUILD_SHARED_LIBS)
ADD_EXECUTABLE(aec_client aec.c) ADD_EXECUTABLE(aec_client aec.c)
SET_TARGET_PROPERTIES(aec_client PROPERTIES OUTPUT_NAME "aec") SET_TARGET_PROPERTIES(aec_client PROPERTIES OUTPUT_NAME "aec")
......
...@@ -55,8 +55,8 @@ ...@@ -55,8 +55,8 @@
#include <stddef.h> #include <stddef.h>
#if _WIN32 && BUILD_SHARED_LIBS #if _WIN32
# ifdef DLL_EXPORT # ifdef AECDLL_EXPORTS
# define AEC_SCOPE __declspec(dllexport) # define AEC_SCOPE __declspec(dllexport)
# else # else
# define AEC_SCOPE extern __declspec(dllimport) # define AEC_SCOPE extern __declspec(dllimport)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment