[1.5] jp2_read_boxhdr() can trigger random pointer memory access
[openjpeg.git] / CMakeLists.txt
index 7e222e2408751455ee42ceb27b871d45259624df..d28a948af08169bc2ecf7dcd651a0663e572a8de 100644 (file)
@@ -29,7 +29,7 @@ INCLUDE_REGULAR_EXPRESSION("^.*$")
 # OPENJPEG version number, useful for packaging and doxygen doc:
 SET(OPENJPEG_VERSION_MAJOR 1)
 SET(OPENJPEG_VERSION_MINOR 5)
-SET(OPENJPEG_VERSION_BUILD 0)
+SET(OPENJPEG_VERSION_BUILD 2)
 SET(OPENJPEG_VERSION
   "${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}")
 SET(PACKAGE_VERSION
@@ -38,13 +38,14 @@ SET(PACKAGE_VERSION
 # Because autotools does not support X.Y notation for SOVERSION, we have to use
 # two numerorations, one for the openjpeg version and one for openjpeg soversion
 # version | soversion
-#   1.0   |   0
-#   1.1   |   1
-#   1.2   |   2
-#   1.3   |   3
-#   1.4   |   4
-#   1.5   |   5
-#   2.0   |   6
+#   1.0   |  0
+#   1.1   |  1
+#   1.2   |  2
+#   1.3   |  3
+#   1.4   |  4
+#   1.5   |  5
+#   1.5.1 |  5
+#   2.0   |  6
 # above is the recommendation by the OPJ team. If you really need to override this default,
 # you can specify your own OPENJPEG_SOVERSION at cmake configuration time:
 # cmake -DOPENJPEG_SOVERSION:STRING=42 /path/to/openjpeg
@@ -103,6 +104,18 @@ IF(NOT OPENJPEG_INSTALL_LIB_DIR)
   SET(OPENJPEG_INSTALL_LIB_DIR "lib")
 ENDIF(NOT OPENJPEG_INSTALL_LIB_DIR)
 
+# The following will compute the amount of parent dir to go
+# from include to lib. it works nicely with 
+# OPENJPEG_INSTALL_LIB_DIR=lib
+# OPENJPEG_INSTALL_LIB_DIR=lib/
+# OPENJPEG_INSTALL_LIB_DIR=/lib
+# OPENJPEG_INSTALL_LIB_DIR=lib/gnu-linux-x64
+STRING(REPLACE "/" ";" relative_to_lib ${OPENJPEG_INSTALL_LIB_DIR})
+set(relative_parent "..")
+foreach( elem ${relative_to_lib})
+  set( relative_parent "${relative_parent}/.." )
+endforeach()
+
 IF(NOT OPENJPEG_INSTALL_SHARE_DIR)
   SET(OPENJPEG_INSTALL_SHARE_DIR "share")
 ENDIF(NOT OPENJPEG_INSTALL_SHARE_DIR)
@@ -252,6 +265,7 @@ IF(BUILD_TESTING)
       PATHS
       $ENV{OPJ_DATA_ROOT}
       ${CMAKE_SOURCE_DIR}/../data
+      ${CMAKE_SOURCE_DIR}/../../data
       )
 
     # Add repository where to find tests