Redo the BUILD_THIRDPARTY properly. Remove openjpeg.h symlink.

This commit is contained in:
Mathieu Malaterre 2012-01-11 13:17:15 +00:00
parent 6b43ba091e
commit f492f0a3d6
3 changed files with 90 additions and 115 deletions

View File

@ -200,6 +200,8 @@ ENDIF (NOT CURL_FOUND)
FIND_PACKAGE(ZLIB) FIND_PACKAGE(ZLIB)
IF(BUILD_CODEC OR BUILD_MJ2 OR BUILD_JPIP) IF(BUILD_CODEC OR BUILD_MJ2 OR BUILD_JPIP)
# OFF: It will only build 3rd party libs if they are not found on the system
# ON: 3rd party libs will ALWAYS be build, and used
OPTION(BUILD_THIRDPARTY "Build the thirdparty executables if it is needed" OFF) OPTION(BUILD_THIRDPARTY "Build the thirdparty executables if it is needed" OFF)
ADD_SUBDIRECTORY(thirdparty) ADD_SUBDIRECTORY(thirdparty)
ADD_SUBDIRECTORY(applications) ADD_SUBDIRECTORY(applications)

View File

@ -57,8 +57,6 @@ INSTALL(TARGETS ${OPENJPEG_LIBRARY_NAME}
INSTALL(FILES openjpeg.h INSTALL(FILES openjpeg.h
DESTINATION ${OPENJPEG_INSTALL_INCLUDE_DIR}/${OPENJPEG_INSTALL_SUBDIR} COMPONENT Headers DESTINATION ${OPENJPEG_INSTALL_INCLUDE_DIR}/${OPENJPEG_INSTALL_SUBDIR} COMPONENT Headers
) )
INSTALL(CODE
"EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E create_symlink ${OPENJPEG_INSTALL_SUBDIR}/openjpeg.h \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${OPENJPEG_INSTALL_INCLUDE_DIR}/openjpeg.h)")
# install man page of the library # install man page of the library
INSTALL( INSTALL(

View File

@ -1,147 +1,122 @@
IF(ZLIB_FOUND) # 3rd party libs
SET(Z_LIBNAME ${ZLIB_LIBRARIES} PARENT_SCOPE) IF(BUILD_THIRDPARTY)
SET(Z_INCLUDE_DIRNAME ${ZLIB_INCLUDE_DIRS} PARENT_SCOPE) # Try to build it
message(STATUS "Your system seems to have a Z lib available, we will use it to generate PNG lib") message(STATUS "We will build Z lib from thirdparty")
ADD_SUBDIRECTORY(libz)
ELSE (ZLIB_FOUND) # not found SET(Z_LIBNAME z PARENT_SCOPE)
SET(Z_INCLUDE_DIRNAME ${OPENJPEG_SOURCE_DIR}/thirdparty/include PARENT_SCOPE)
IF(BUILD_THIRDPARTY) SET(ZLIB_FOUND 1)
# Try to build it ELSE (BUILD_THIRDPARTY)
message(STATUS "We will build Z lib from thirdparty") IF(ZLIB_FOUND)
ADD_SUBDIRECTORY(libz) SET(Z_LIBNAME ${ZLIB_LIBRARIES} PARENT_SCOPE)
SET(Z_LIBNAME z PARENT_SCOPE) SET(Z_INCLUDE_DIRNAME ${ZLIB_INCLUDE_DIRS} PARENT_SCOPE)
SET(Z_INCLUDE_DIRNAME ${OPENJPEG_SOURCE_DIR}/thirdparty/include PARENT_SCOPE) message(STATUS "Your system seems to have a Z lib available, we will use it to generate PNG lib")
SET(ZLIB_FOUND 1) ELSE (ZLIB_FOUND) # not found
ELSE (BUILD_THIRDPARTY) message(STATUS "Z lib not found, activate BUILD_THIRDPARTY if you want build it (necessary to build libPNG)")
message("Z lib not found, activate BUILD_THIRDPARTY if you want build it (necessary to build libPNG)") ENDIF(ZLIB_FOUND)
ENDIF(BUILD_THIRDPARTY) ENDIF(BUILD_THIRDPARTY)
ENDIF(ZLIB_FOUND)
#------------ #------------
# Try to find lib PNG (which depends to zlib) # Try to find lib PNG (which depends to zlib)
IF (ZLIB_FOUND) IF(BUILD_THIRDPARTY)
FIND_PACKAGE(PNG) # Try to build it
message(STATUS "We will build PNG lib from thirdparty")
IF(PNG_FOUND) ADD_SUBDIRECTORY(libpng)
SET(HAVE_PNG_H 1 PARENT_SCOPE)
message("Your system seems to have a PNG lib available, we will use it") SET(HAVE_LIBPNG 1 PARENT_SCOPE)
SET(HAVE_PNG_H 1 PARENT_SCOPE) SET(PNG_LIBNAME png PARENT_SCOPE)
SET(HAVE_LIBPNG 1 PARENT_SCOPE) SET(PNG_INCLUDE_DIRNAME ${OPENJPEG_SOURCE_DIR}/thirdparty/libpng PARENT_SCOPE)
SET(PNG_LIBNAME ${PNG_LIBRARIES} PARENT_SCOPE) ELSE (BUILD_THIRDPARTY)
SET(PNG_INCLUDE_DIRNAME ${PNG_PNG_INCLUDE_DIR} PARENT_SCOPE) IF (ZLIB_FOUND)
FIND_PACKAGE(PNG)
ELSE(PNG_FOUND) # not found IF(PNG_FOUND)
message(STATUS "Your system seems to have a PNG lib available, we will use it")
IF(BUILD_THIRDPARTY)
# Try to build it
message("We will build PNG lib from thirdparty")
ADD_SUBDIRECTORY(libpng)
SET(HAVE_PNG_H 1 PARENT_SCOPE) SET(HAVE_PNG_H 1 PARENT_SCOPE)
SET(HAVE_LIBPNG 1 PARENT_SCOPE) SET(HAVE_LIBPNG 1 PARENT_SCOPE)
SET(PNG_LIBNAME png PARENT_SCOPE) SET(PNG_LIBNAME ${PNG_LIBRARIES} PARENT_SCOPE)
SET(PNG_INCLUDE_DIRNAME ${OPENJPEG_SOURCE_DIR}/thirdparty/libpng PARENT_SCOPE) SET(PNG_INCLUDE_DIRNAME ${PNG_PNG_INCLUDE_DIR} PARENT_SCOPE)
ELSE (BUILD_THIRDPARTY) ELSE(PNG_FOUND) # not found
SET(HAVE_PNG_H 0 PARENT_SCOPE) SET(HAVE_PNG_H 0 PARENT_SCOPE)
SET(HAVE_LIBPNG 0 PARENT_SCOPE) SET(HAVE_LIBPNG 0 PARENT_SCOPE)
message("PNG lib not found, activate BUILD_THIRDPARTY if you want build it") message(STATUS "PNG lib not found, activate BUILD_THIRDPARTY if you want build it")
ENDIF(BUILD_THIRDPARTY) ENDIF(PNG_FOUND)
ENDIF (ZLIB_FOUND)
ENDIF(PNG_FOUND) ENDIF(BUILD_THIRDPARTY)
ENDIF (ZLIB_FOUND)
#------------ #------------
# Try to find lib TIFF # Try to find lib TIFF
FIND_PACKAGE(TIFF)
IF(BUILD_THIRDPARTY)
IF(TIFF_FOUND) # Try to build it
message(STATUS "We will build TIFF lib from thirdparty")
message("Your system seems to have a TIFF lib available, we will use it") ADD_SUBDIRECTORY(libtiff)
SET(TIFF_LIBNAME tiff PARENT_SCOPE)
SET(TIFF_INCLUDE_DIRNAME ${OPENJPEG_SOURCE_DIR}/thirdparty/libtiff PARENT_SCOPE)
SET(HAVE_TIFF_H 1 PARENT_SCOPE) SET(HAVE_TIFF_H 1 PARENT_SCOPE)
SET(HAVE_LIBTIFF 1 PARENT_SCOPE) SET(HAVE_LIBTIFF 1 PARENT_SCOPE)
SET(TIFF_LIBNAME ${TIFF_LIBRARIES} PARENT_SCOPE) ELSE (BUILD_THIRDPARTY)
SET(TIFF_INCLUDE_DIRNAME ${TIFF_INCLUDE_DIR} PARENT_SCOPE) FIND_PACKAGE(TIFF)
IF(TIFF_FOUND)
ELSE (TIFF_FOUND) # not found message(STATUS "Your system seems to have a TIFF lib available, we will use it")
IF(BUILD_THIRDPARTY)
# Try to build it
message("We will build TIFF lib from thirdparty")
ADD_SUBDIRECTORY(libtiff)
SET(TIFF_LIBNAME tiff PARENT_SCOPE)
SET(TIFF_INCLUDE_DIRNAME ${OPENJPEG_SOURCE_DIR}/thirdparty/libtiff PARENT_SCOPE)
SET(HAVE_TIFF_H 1 PARENT_SCOPE) SET(HAVE_TIFF_H 1 PARENT_SCOPE)
SET(HAVE_LIBTIFF 1 PARENT_SCOPE) SET(HAVE_LIBTIFF 1 PARENT_SCOPE)
ELSE (BUILD_THIRDPARTY) SET(TIFF_LIBNAME ${TIFF_LIBRARIES} PARENT_SCOPE)
SET(TIFF_INCLUDE_DIRNAME ${TIFF_INCLUDE_DIR} PARENT_SCOPE)
ELSE (TIFF_FOUND) # not found
SET(HAVE_TIFF_H 0 PARENT_SCOPE) SET(HAVE_TIFF_H 0 PARENT_SCOPE)
SET(HAVE_LIBTIFF 0 PARENT_SCOPE) SET(HAVE_LIBTIFF 0 PARENT_SCOPE)
message("TIFF lib not found, activate BUILD_THIRDPARTY if you want build it") message(STATUS "TIFF lib not found, activate BUILD_THIRDPARTY if you want build it")
ENDIF(BUILD_THIRDPARTY) ENDIF(TIFF_FOUND)
ENDIF(BUILD_THIRDPARTY)
ENDIF(TIFF_FOUND)
#------------ #------------
# Try to find lib LCMS2 (or by default LCMS) # Try to find lib LCMS2 (or by default LCMS)
FIND_PACKAGE(LCMS2) SET(HAVE_LCMS_H 0 PARENT_SCOPE)
SET(HAVE_LIBLCMS 0 PARENT_SCOPE)
IF(LCMS2_FOUND) IF( BUILD_THIRDPARTY)
# Try to build lcms2
message("Your system seems to have a LCMS2 lib available, we will use it") message(STATUS "We will build LCMS2 lib from thirdparty")
ADD_SUBDIRECTORY(liblcms2)
SET(LCMS_LIBNAME lcms2 PARENT_SCOPE)
SET(LCMS_INCLUDE_DIRNAME ${OPENJPEG_SOURCE_DIR}/thirdparty/liblcms2/include PARENT_SCOPE) #
SET(HAVE_LCMS2_H 1 PARENT_SCOPE) SET(HAVE_LCMS2_H 1 PARENT_SCOPE)
SET(HAVE_LIBLCMS2 1 PARENT_SCOPE) SET(HAVE_LIBLCMS2 1 PARENT_SCOPE)
SET(LCMS_LIBNAME ${LCMS2_LIBRARIES} PARENT_SCOPE) ELSE (BUILD_THIRDPARTY)
SET(LCMS_INCLUDE_DIRNAME ${LCMS2_INCLUDE_DIRS} PARENT_SCOPE) FIND_PACKAGE(LCMS2)
IF(LCMS2_FOUND)
ELSE (LCMS2_FOUND) # not found lcms2 message(STATUS "Your system seems to have a LCMS2 lib available, we will use it")
# try to find LCMS SET(HAVE_LCMS2_H 1 PARENT_SCOPE)
FIND_PACKAGE(LCMS) SET(HAVE_LIBLCMS2 1 PARENT_SCOPE)
SET(LCMS_LIBNAME ${LCMS2_LIBRARIES} PARENT_SCOPE)
IF(LCMS_FOUND) SET(LCMS_INCLUDE_DIRNAME ${LCMS2_INCLUDE_DIRS} PARENT_SCOPE)
ELSE (LCMS2_FOUND) # not found lcms2
message("Your system seems to have a LCMS lib available, we will use it") # try to find LCMS
SET(HAVE_LCMS_H 1 PARENT_SCOPE) FIND_PACKAGE(LCMS)
SET(HAVE_LIBLCMS 1 PARENT_SCOPE) IF(LCMS_FOUND)
SET(LCMS_LIBNAME ${LCMS_LIBRARIES} PARENT_SCOPE) message(STATUS "Your system seems to have a LCMS lib available, we will use it")
SET(LCMS_INCLUDE_DIRNAME ${LCMS_INCLUDE_DIRS} PARENT_SCOPE) SET(HAVE_LCMS_H 1 PARENT_SCOPE)
SET(HAVE_LIBLCMS 1 PARENT_SCOPE)
ELSE (LCMS_FOUND) # not found lcms SET(LCMS_LIBNAME ${LCMS_LIBRARIES} PARENT_SCOPE)
SET(HAVE_LCMS_H 0 PARENT_SCOPE) SET(LCMS_INCLUDE_DIRNAME ${LCMS_INCLUDE_DIRS} PARENT_SCOPE)
SET(HAVE_LIBLCMS 0 PARENT_SCOPE) ELSE (LCMS_FOUND) # not found lcms
SET(HAVE_LCMS2_H 0 PARENT_SCOPE)
IF( BUILD_THIRDPARTY) SET(HAVE_LIBLCMS2 0 PARENT_SCOPE)
message(STATUS "LCMS2 or LCMS lib not found, activate BUILD_THIRDPARTY if you want build it")
# Try to build lcms2 ENDIF (LCMS_FOUND)
message("We will build LCMS2 lib from thirdparty") ENDIF(LCMS2_FOUND)
ADD_SUBDIRECTORY(liblcms2) ENDIF(BUILD_THIRDPARTY)
SET(LCMS_LIBNAME lcms2 PARENT_SCOPE)
SET(LCMS_INCLUDE_DIRNAME ${OPENJPEG_SOURCE_DIR}/thirdparty/liblcms2/include PARENT_SCOPE) #
SET(HAVE_LCMS2_H 1 PARENT_SCOPE)
SET(HAVE_LIBLCMS2 1 PARENT_SCOPE)
ELSE (BUILD_THIRDPARTY)
SET(HAVE_LCMS2_H 0 PARENT_SCOPE)
SET(HAVE_LIBLCMS2 0 PARENT_SCOPE)
message("LCMS2 or LCMS lib not found, activate BUILD_THIRDPARTY if you want build it")
ENDIF(BUILD_THIRDPARTY)
ENDIF (LCMS_FOUND)
ENDIF(LCMS2_FOUND)
#------------ #------------
# Try to find lib FCGI # Try to find lib FCGI
FIND_PACKAGE(FCGI) FIND_PACKAGE(FCGI)
IF(FCGI_FOUND) IF(FCGI_FOUND)
SET(FCGI_LIBNAME ${FCGI_LIBRARIES} PARENT_SCOPE) SET(FCGI_LIBNAME ${FCGI_LIBRARIES} PARENT_SCOPE)
SET(FCGI_INCLUDE_DIRNAME ${FCGI_INCLUDE_DIRS} PARENT_SCOPE) SET(FCGI_INCLUDE_DIRNAME ${FCGI_INCLUDE_DIRS} PARENT_SCOPE)
message("Your system seems to have a FCGI lib available, we will use it to build JPIP") message(STATUS "Your system seems to have a FCGI lib available, we will use it to build JPIP")
ELSE (FCGI_FOUND) # not found ELSE (FCGI_FOUND) # not found
message(STATUS "FCGI lib not found, JPIP will not be built as it requires FCGI")
message("FCGI lib not found, JPIP will not be built as it requires FCGI")
ENDIF(FCGI_FOUND) ENDIF(FCGI_FOUND)