Attempt to fix building of universal exe

This commit is contained in:
Mathieu Malaterre 2011-12-21 15:19:46 +00:00
parent d88dfc3472
commit 6b1e9d1b4e
3 changed files with 14 additions and 20 deletions

View File

@ -196,6 +196,9 @@ IF(NOT CURL_FOUND)
SET(BUILD_JPIP OFF)
ENDIF (NOT CURL_FOUND)
# Try to find lib Z
FIND_PACKAGE(ZLIB)
IF(BUILD_CODEC OR BUILD_MJ2 OR BUILD_JPIP)
OPTION(BUILD_THIRDPARTY "Build the thirdparty executables if it is needed" OFF)
ADD_SUBDIRECTORY(thirdparty)

View File

@ -30,7 +30,14 @@ ENDIF(WIN32)
FOREACH(exe j2k_to_image image_to_j2k j2k_dump)
ADD_EXECUTABLE(${exe} ${exe}.c ${common_SRCS})
TARGET_LINK_LIBRARIES(${exe} ${OPENJPEG_LIBRARY_NAME}
${Z_LIBNAME} ${PNG_LIBNAME} ${TIFF_LIBNAME} ${LCMS_LIBNAME} )
${PNG_LIBNAME} ${TIFF_LIBNAME} ${LCMS_LIBNAME}
)
# To support universal exe:
IF(ZLIB_FOUND AND APPLE)
TARGET_LINK_LIBRARIES(${exe} z)
ELSe(ZLIB_FOUND AND APPLE)
TARGET_LINK_LIBRARIES(${exe} ${Z_LIBNAME})
ENDIF(ZLIB_FOUND AND APPLE)
# On unix you need to link to the math library:
IF(UNIX)
@ -89,4 +96,4 @@ IF(BUILD_JPWL)
INSTALL(TARGETS JPWL_image_to_j2k JPWL_j2k_to_image
DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
)
ENDIF(BUILD_JPWL)
ENDIF(BUILD_JPWL)

View File

@ -1,30 +1,14 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
IF(UNIX OR CYGWIN)
SET(CMAKE_INCLUDE_PATH /usr/include /usr/local/include /opt/include
/opt/local/include /usr/include/libpng /usr/include/libpng14
/usr/include/libpng12 /usr/local/include/libpng
/usr/local/include/libpng14 /usr/local/include/libpng12
/opt/include/libpng /opt/include/libpng14 /opt/include/libpng12
/opt/local/include/libpng /opt/local/include/libpng14)
SET(CMAKE_LIBRARY_PATH /usr/lib /usr/local/lib /opt/lib /opt/local/lib)
ENDIF(UNIX OR CYGWIN)
#------------
# Try to find lib Z
FIND_PACKAGE(ZLIB)
IF(ZLIB_FOUND)
SET(Z_LIBNAME ${ZLIB_LIBRARIES} PARENT_SCOPE)
SET(Z_INCLUDE_DIRNAME ${ZLIB_INCLUDE_DIRS} PARENT_SCOPE)
message("Your system seems to have a Z lib available, we will use it to generate PNG lib")
message(STATUS "Your system seems to have a Z lib available, we will use it to generate PNG lib")
ELSE (ZLIB_FOUND) # not found
IF(BUILD_THIRDPARTY)
# Try to build it
message("We will build Z lib from thirdparty")
message(STATUS "We will build Z lib from thirdparty")
ADD_SUBDIRECTORY(libz)
SET(Z_LIBNAME z PARENT_SCOPE)
SET(Z_INCLUDE_DIRNAME ${OPENJPEG_SOURCE_DIR}/thirdparty/include PARENT_SCOPE)