c-string are not writable
[openjpeg.git] / CMakeLists.txt
index 495282680c62ca5fc24f2eba1f7e435bca7f8ebb..61689ca56897a57c29f4bb428b16b2df79ca51c3 100644 (file)
@@ -86,8 +86,12 @@ IF(NOT OPENJPEG_INSTALL_LIB_DIR)
   SET(OPENJPEG_INSTALL_LIB_DIR "lib")
 ENDIF(NOT OPENJPEG_INSTALL_LIB_DIR)
 
+IF(NOT OPENJPEG_INSTALL_SHARE_DIR)
+  SET(OPENJPEG_INSTALL_SHARE_DIR "share")
+ENDIF(NOT OPENJPEG_INSTALL_SHARE_DIR)
+
 IF(NOT OPENJPEG_INSTALL_DATA_DIR)
-  SET(OPENJPEG_INSTALL_DATA_DIR "share/${OPENJPEG_INSTALL_SUBDIR}")
+  SET(OPENJPEG_INSTALL_DATA_DIR "${OPENJPEG_INSTALL_SHARE_DIR}/${OPENJPEG_INSTALL_SUBDIR}")
 ENDIF(NOT OPENJPEG_INSTALL_DATA_DIR)
 
 IF(NOT OPENJPEG_INSTALL_INCLUDE_DIR)
@@ -103,14 +107,10 @@ IF(NOT OPENJPEG_INSTALL_DOC_DIR)
 ENDIF(NOT OPENJPEG_INSTALL_DOC_DIR)
 
 IF(NOT OPENJPEG_INSTALL_PACKAGE_DIR)
-  SET(OPENJPEG_INSTALL_PACKAGE_DIR ${OPENJPEG_INSTALL_LIB_DIR}/${OPENJPEG_INSTALL_SUBDIR}
-    CACHE INTERNAL "")
+  SET(OPENJPEG_INSTALL_PACKAGE_DIR "${OPENJPEG_INSTALL_SHARE_DIR}/${OPENJPEG_INSTALL_SUBDIR}")
 ENDIF(NOT OPENJPEG_INSTALL_PACKAGE_DIR)
 
 #-----------------------------------------------------------------------------
-# Test for some required system information.
-INCLUDE (${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityC.cmake)
-
 # Big endian test:
 INCLUDE (${CMAKE_ROOT}/Modules/TestBigEndian.cmake)
 TEST_BIG_ENDIAN(OPJ_BIG_ENDIAN)
@@ -146,7 +146,7 @@ IF(UNIX)
   CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/libopenjpeg1.pc.cmake
     ${CMAKE_CURRENT_BINARY_DIR}/libopenjpeg1.pc @ONLY)
   INSTALL( FILES  ${CMAKE_CURRENT_BINARY_DIR}/libopenjpeg1.pc DESTINATION
-    ${OPENJPEG_INSTALL_LIB_DIR}/pkgconfig )
+    ${OPENJPEG_INSTALL_SHARE_DIR}/pkgconfig )
   INSTALL( CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E create_symlink
   \"libopenjpeg1.pc\"
   \"\$ENV{DESTDIR}${OPENJPEG_INSTALL_LIB_DIR}/pkgconfig/libopenjpeg.pc\")")
@@ -163,14 +163,15 @@ ENDIF(CMAKE_COMPILER_IS_GNUCC)
 
 #-----------------------------------------------------------------------------
 # opj_config.h generation (1/2)
-CHECK_INCLUDE_FILE("strings.h"       HAVE_STRINGS_H)
-CHECK_INCLUDE_FILE("inttypes.h"       HAVE_INTTYPES_H)
+INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
+CHECK_INCLUDE_FILE("strings.h"      HAVE_STRINGS_H)
+CHECK_INCLUDE_FILE("inttypes.h"     HAVE_INTTYPES_H)
 CHECK_INCLUDE_FILE("memory.h"       HAVE_MEMORY_H)
 CHECK_INCLUDE_FILE("stdint.h"       HAVE_STDINT_H)
 CHECK_INCLUDE_FILE("stdlib.h"       HAVE_STDLIB_H)
 CHECK_INCLUDE_FILE("string.h"       HAVE_STRING_H)
-CHECK_INCLUDE_FILE("sys/stat.h"       HAVE_SYS_STAT_H)
-CHECK_INCLUDE_FILE("sys/types.h"       HAVE_SYS_TYPES_H)
+CHECK_INCLUDE_FILE("sys/stat.h"     HAVE_SYS_STAT_H)
+CHECK_INCLUDE_FILE("sys/types.h"    HAVE_SYS_TYPES_H)
 CHECK_INCLUDE_FILE("unistd.h"       HAVE_UNISTD_H)
 
 
@@ -183,26 +184,23 @@ ADD_SUBDIRECTORY(libopenjpeg)
 # Build Applications
 OPTION(BUILD_CODEC "Build the CODEC executables" ON)
 OPTION(BUILD_MJ2 "Build the MJ2 executables." OFF)
+OPTION(BUILD_JPWL "Build the JPWL library and executables" OFF)
 OPTION(BUILD_JPIP "Build the JPIP library and executables." OFF)
+IF(BUILD_JPIP)
+  OPTION(BUILD_JPIP_SERVER "Build the JPIP server." OFF)
+ENDIF(BUILD_JPIP)
 OPTION(BUILD_VIEWER "Build the OPJViewer executable (C++)" OFF)
+OPTION(BUILD_JAVA "Build the openjpeg jar (Java)" OFF)
 MARK_AS_ADVANCED(BUILD_VIEWER)
+MARK_AS_ADVANCED(BUILD_JAVA)
 
-IF(BUILD_JPIP)
- FIND_PACKAGE(CURL)
-ENDIF (BUILD_JPIP)
-
-IF(NOT CURL_FOUND)
- IF(BUILD_JPIP)
-  message(WARNING "You must have libcurl installed to use JPIP")
- ENDIF (BUILD_JPIP)
- SET(BUILD_JPIP OFF)
-ENDIF (NOT CURL_FOUND)
-
-IF(BUILD_CODEC OR BUILD_MJ2 OR BUILD_JPIP)
+IF(BUILD_CODEC OR BUILD_MJ2)
+  # 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)
   ADD_SUBDIRECTORY(thirdparty)
   ADD_SUBDIRECTORY(applications)
-ENDIF (BUILD_CODEC OR BUILD_MJ2 OR BUILD_JPIP)
+ENDIF (BUILD_CODEC OR BUILD_MJ2)
 
 #-----------------------------------------------------------------------------
 # opj_config.h generation (2/2)
@@ -211,10 +209,6 @@ CONFIGURE_FILE("${OPENJPEG_SOURCE_DIR}/opj_config.h.cmake.in"
  @ONLY
  )
 
-#-----------------------------------------------------------------------------
-# Build JPWL-flavoured library and executables
-OPTION(BUILD_JPWL "Build the JPWL library and executables" OFF)
-
 #-----------------------------------------------------------------------------
 # Build DOCUMENTATION (not in ALL target and only if Doxygen is found)
 OPTION(BUILD_DOC "Build the HTML documentation (with doxygen if available)." OFF)