ENH: Do the proper thing for static/shared

This commit is contained in:
Mathieu Malaterre 2006-02-05 21:39:19 +00:00
parent f31d963a64
commit 23eeec8769
2 changed files with 14 additions and 5 deletions

View File

@ -30,6 +30,12 @@ INCLUDE_DIRECTORIES(
${OPENJPEG_SOURCE_DIR}/libopenjpeg ${OPENJPEG_SOURCE_DIR}/libopenjpeg
) )
# Do the proper thing when building static...if only there was configured
# headers or def files instead
IF(NOT BUILD_SHARED_LIBS)
ADD_DEFINITIONS(-DOPJ_STATIC)
ENDIF(NOT BUILD_SHARED_LIBS)
# Loop over all executables: # Loop over all executables:
FOREACH(exe j2k_to_image image_to_j2k) FOREACH(exe j2k_to_image image_to_j2k)
ADD_EXECUTABLE(${exe} ${exe}.c ${common_SRCS}) ADD_EXECUTABLE(${exe} ${exe}.c ${common_SRCS})

View File

@ -21,11 +21,14 @@ SET(OpenJPEG_SRCS
tgt.c tgt.c
) )
# Pass proper definition to preprocessor to generate # Pass proper definition to preprocessor to generate shared lib
# shared lib IF(WIN32)
IF(WIN32 AND BUILD_SHARED_LIBS) IF(BUILD_SHARED_LIBS)
ADD_DEFINITIONS(-DOPJ_EXPORTS) ADD_DEFINITIONS(-DOPJ_EXPORTS)
ENDIF(WIN32 AND BUILD_SHARED_LIBS) ELSE(BUILD_SHARED_LIBS)
ADD_DEFINITIONS(-DOPJ_STATIC)
ENDIF(BUILD_SHARED_LIBS)
ENDIF(WIN32)
# Create the library # Create the library
ADD_LIBRARY(${OPJ_PREFIX}openjpeg ${OpenJPEG_SRCS}) ADD_LIBRARY(${OPJ_PREFIX}openjpeg ${OpenJPEG_SRCS})