summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorMathieu Malaterre <mathieu.malaterre@gmail.com>2012-09-28 08:11:41 +0000
committerMathieu Malaterre <mathieu.malaterre@gmail.com>2012-09-28 08:11:41 +0000
commitd518970039a19a2a9b6d2bdd592cc88a43897bbb (patch)
tree57bac2cf7e63e9352228231062763baac627563c /cmake
parent8363a6ab1e031bb4b2e40a92e56efd40fdab1aa1 (diff)
[trunk] Start FolderReorgProposal task
Update issue 177
Diffstat (limited to 'cmake')
-rw-r--r--cmake/CTestCustom.cmake.in34
-rw-r--r--cmake/FindCPPCHECK.cmake16
-rw-r--r--cmake/FindFCGI.cmake20
-rw-r--r--cmake/FindKAKADU.cmake19
-rw-r--r--cmake/FindLCMS.cmake31
-rw-r--r--cmake/FindLCMS2.cmake31
-rw-r--r--cmake/JPIPTestDriver.cmake9
-rw-r--r--cmake/OpenJPEGCPack.cmake70
-rw-r--r--cmake/OpenJPEGConfig.cmake.in48
-rw-r--r--cmake/TestFileOffsetBits.c10
-rw-r--r--cmake/TestLargeFiles.c.cmake.in23
-rw-r--r--cmake/TestLargeFiles.cmake134
-rw-r--r--cmake/TestWindowsFSeek.c11
-rw-r--r--cmake/openjpeg_valgrind.supp39
14 files changed, 495 insertions, 0 deletions
diff --git a/cmake/CTestCustom.cmake.in b/cmake/CTestCustom.cmake.in
new file mode 100644
index 00000000..d92f5ec5
--- /dev/null
+++ b/cmake/CTestCustom.cmake.in
@@ -0,0 +1,34 @@
+#----------------------------------------------------------------------
+#
+# For further details regarding this file,
+# see http://www.cmake.org/Wiki/CMake_Testing_With_CTest#Customizing_CTest
+#
+# and
+# http://www.kitware.com/blog/home/post/27
+#
+#----------------------------------------------------------------------
+
+set(CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE 1000000)
+set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS 50)
+set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 2000)
+
+set(CTEST_CUSTOM_COVERAGE_EXCLUDE
+ ${CTEST_CUSTOM_COVERAGE_EXCLUDE}
+
+ # Exclude files from the Testing directories
+ ".*/tests/.*"
+
+ # Exclude files from the ThirdParty Utilities directories
+ ".*/thirdparty/.*"
+ )
+
+set(CTEST_CUSTOM_WARNING_EXCEPTION
+ ${CTEST_CUSTOM_WARNING_EXCEPTION}
+
+ # Suppress warning caused by intentional messages about deprecation
+ ".*warning,.* is deprecated"
+ # supress warnings caused by 3rd party libs:
+ ".*/thirdparty/.*"
+ "libtiff.*has no symbols"
+ "libpng.*has no symbols"
+ )
diff --git a/cmake/FindCPPCHECK.cmake b/cmake/FindCPPCHECK.cmake
new file mode 100644
index 00000000..6e11bf73
--- /dev/null
+++ b/cmake/FindCPPCHECK.cmake
@@ -0,0 +1,16 @@
+# cppcheck
+#
+# Copyright (c) 2011 Mathieu Malaterre <mathieu.malaterre@gmail.com>
+#
+# Redistribution and use is allowed according to the terms of the New
+# BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+#
+
+find_program(CPPCHECK_EXECUTABLE
+ cppcheck
+ )
+
+mark_as_advanced(
+ CPPCHECK_EXECUTABLE
+ )
diff --git a/cmake/FindFCGI.cmake b/cmake/FindFCGI.cmake
new file mode 100644
index 00000000..309bdd4d
--- /dev/null
+++ b/cmake/FindFCGI.cmake
@@ -0,0 +1,20 @@
+# Look for the header file.
+find_path(FCGI_INCLUDE_DIR NAMES fastcgi.h)
+
+# Look for the library.
+find_library(FCGI_LIBRARY NAMES fcgi)
+
+# Handle the QUIETLY and REQUIRED arguments and set FCGI_FOUND to TRUE if all listed variables are TRUE.
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(FCGI DEFAULT_MSG FCGI_LIBRARY FCGI_INCLUDE_DIR)
+
+# Copy the results to the output variables.
+if(FCGI_FOUND)
+ set(FCGI_LIBRARIES ${FCGI_LIBRARY})
+ set(FCGI_INCLUDE_DIRS ${FCGI_INCLUDE_DIR})
+else()
+ set(FCGI_LIBRARIES)
+ set(FCGI_INCLUDE_DIRS)
+endif()
+
+mark_as_advanced(FCGI_INCLUDE_DIR FCGI_LIBRARY)
diff --git a/cmake/FindKAKADU.cmake b/cmake/FindKAKADU.cmake
new file mode 100644
index 00000000..3e0409df
--- /dev/null
+++ b/cmake/FindKAKADU.cmake
@@ -0,0 +1,19 @@
+#
+# this module looks for KAKADu
+# http://www.kakadusoftware.com/
+#
+#
+# Copyright (c) 2006-2011 Mathieu Malaterre <mathieu.malaterre@gmail.com>
+#
+# Redistribution and use is allowed according to the terms of the New
+# BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+#
+
+find_program(KDU_EXPAND_EXECUTABLE
+ kdu_expand
+ )
+
+mark_as_advanced(
+ KDU_EXPAND_EXECUTABLE
+ )
diff --git a/cmake/FindLCMS.cmake b/cmake/FindLCMS.cmake
new file mode 100644
index 00000000..e659895d
--- /dev/null
+++ b/cmake/FindLCMS.cmake
@@ -0,0 +1,31 @@
+# - Find LCMS library
+# Find the native LCMS includes and library
+# Once done this will define
+#
+# LCMS_INCLUDE_DIR - Where to find lcms.h, etc.
+# LCMS_LIBRARIES - Libraries to link against to use LCMS.
+# LCMS_FOUND - If false, do not try to use LCMS.
+#
+# also defined, but not for general use are
+# LCMS_LIBRARY, where to find the LCMS library.
+
+#=============================================================================
+#=============================================================================
+
+find_path(LCMS_INCLUDE_DIR lcms.h PATHS /usr/include /usr/local/include /opt/include /opt/local/include)
+
+set(LCMS_NAMES ${LCMS_NAMES} lcms liblcms liblcms_static)
+
+find_library(LCMS_LIBRARY NAMES ${LCMS_NAMES} )
+
+mark_as_advanced(LCMS_INCLUDE_DIR LCMS_LIBRARY)
+
+# handle the QUIETLY and REQUIRED arguments and set LCMS_FOUND to TRUE if
+# all listed variables are TRUE
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(LCMS DEFAULT_MSG LCMS_LIBRARY LCMS_INCLUDE_DIR)
+
+if(LCMS_FOUND)
+ set( LCMS_INCLUDE_DIRS ${LCMS_INCLUDE_DIR})
+ set( LCMS_LIBRARIES ${LCMS_LIBRARY} )
+endif()
diff --git a/cmake/FindLCMS2.cmake b/cmake/FindLCMS2.cmake
new file mode 100644
index 00000000..65b6525c
--- /dev/null
+++ b/cmake/FindLCMS2.cmake
@@ -0,0 +1,31 @@
+# - Find LCMS2 library
+# Find the native LCMS2 includes and library
+# Once done this will define
+#
+# LCMS2_INCLUDE_DIR - Where to find lcms2.h, etc.
+# LCMS2_LIBRARIES - Libraries to link against to use LCMS2.
+# LCMS2_FOUND - If false, do not try to use LCMS2.
+#
+# also defined, but not for general use are
+# LCMS2_LIBRARY - Where to find the LCMS2 library.
+
+#=============================================================================
+#=============================================================================
+
+find_path(LCMS2_INCLUDE_DIR lcms2.h PATHS /usr/include /usr/local/include /opt/include /opt/local/include)
+
+set(LCMS2_NAMES ${LCMS2_NAMES} lcms2 liblcms2 liblcms2_static)
+
+find_library(LCMS2_LIBRARY NAMES ${LCMS2_NAMES} )
+
+mark_as_advanced(LCMS2_INCLUDE_DIR LCMS2_LIBRARY)
+
+# handle the QUIETLY and REQUIRED arguments and set LCMS2_FOUND to TRUE if
+# all listed variables are TRUE
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(LCMS2 DEFAULT_MSG LCMS2_LIBRARY LCMS2_INCLUDE_DIR)
+
+if(LCMS2_FOUND)
+ set( LCMS2_INCLUDE_DIRS ${LCMS2_INCLUDE_DIR})
+ set( LCMS2_LIBRARIES ${LCMS2_LIBRARY} )
+endif()
diff --git a/cmake/JPIPTestDriver.cmake b/cmake/JPIPTestDriver.cmake
new file mode 100644
index 00000000..2147c464
--- /dev/null
+++ b/cmake/JPIPTestDriver.cmake
@@ -0,0 +1,9 @@
+# JPIP test driver
+#message(STATUS "${D_URL}")
+file(DOWNLOAD
+ "${D_URL}"
+ "${D_FILE}"
+ LOG log
+ EXPECTED_MD5 "${EXPECTED_MD5}"
+ )
+message(STATUS "LOG: ${log}")
diff --git a/cmake/OpenJPEGCPack.cmake b/cmake/OpenJPEGCPack.cmake
new file mode 100644
index 00000000..1a40ff17
--- /dev/null
+++ b/cmake/OpenJPEGCPack.cmake
@@ -0,0 +1,70 @@
+# package bundler
+if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
+ if(EXISTS "${CMAKE_ROOT}/Modules/InstallRequiredSystemLibraries.cmake")
+ set(CMAKE_INSTALL_MFC_LIBRARIES 0)
+ set(CMAKE_INSTALL_DEBUG_LIBRARIES 0)
+ if(NOT DEFINED CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
+ set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON)
+ endif()
+ include(${CMAKE_ROOT}/Modules/InstallRequiredSystemLibraries.cmake)
+ endif()
+
+ set(OPJ_PACKAGE_DESCRIPTION_SUMMARY "OpenJPEG - OpenJPEG a JPEG 2000 implementation.")
+ set(OPJ_PACKAGE_CONTACT "openjpeg users <openjpeg@googlegroups.com>")
+
+ set(CPACK_PACKAGE_DESCRIPTION_SUMMARY ${OPJ_PACKAGE_DESCRIPTION_SUMMARY})
+ set(CPACK_PACKAGE_VENDOR "OpenJPEG Team")
+ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/LICENSE"
+ "${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt" COPYONLY
+ )
+ # For PackageMaker on MacOSX it is important to have a file extension:
+ set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt")
+ set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt")
+ set(CPACK_PACKAGE_VERSION_MAJOR "${OPENJPEG_VERSION_MAJOR}")
+ set(CPACK_PACKAGE_VERSION_MINOR "${OPENJPEG_VERSION_MINOR}")
+ set(CPACK_PACKAGE_VERSION_PATCH "${OPENJPEG_VERSION_BUILD}")
+ set(CPACK_PACKAGE_INSTALL_DIRECTORY "OpenJPEG ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
+ set(CPACK_SOURCE_PACKAGE_FILE_NAME "openjpeg-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
+
+ # Make this explicit here, rather than accepting the CPack default value,
+ # so we can refer to it:
+ set(CPACK_PACKAGE_NAME "${OPENJPEG_LIBRARY_NAME}")
+
+ if(NOT DEFINED CPACK_SYSTEM_NAME)
+ # make sure package is not Cygwin-unknown, for Cygwin just
+ # cygwin is good for the system name
+ if("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN")
+ set(CPACK_SYSTEM_NAME Cygwin)
+ else()
+ set(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR})
+ endif()
+ endif()
+ if(${CPACK_SYSTEM_NAME} MATCHES Windows)
+ if(CMAKE_CL_64)
+ set(CPACK_SYSTEM_NAME win64-x64)
+ else()
+ set(CPACK_SYSTEM_NAME win32-x86)
+ endif()
+ endif()
+
+ if(NOT DEFINED CPACK_PACKAGE_FILE_NAME)
+ # if the CPACK_PACKAGE_FILE_NAME is not defined by the cache
+ # default to source package - system, on cygwin system is not
+ # needed
+ if(CYGWIN)
+ set(CPACK_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}")
+ else()
+ set(CPACK_PACKAGE_FILE_NAME
+ "${CPACK_SOURCE_PACKAGE_FILE_NAME}-${CPACK_SYSTEM_NAME}")
+ endif()
+ endif()
+
+ set(CPACK_BUNDLE_NAME "OpenJPEG ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
+ configure_file(${CMAKE_ROOT}/Templates/AppleInfo.plist
+ ${CMAKE_CURRENT_BINARY_DIR}/opj.plist)
+ set(CPACK_BUNDLE_PLIST
+ ${CMAKE_CURRENT_BINARY_DIR}/opj.plist)
+ #include(BundleUtilities)
+
+ include(CPack)
+endiF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
diff --git a/cmake/OpenJPEGConfig.cmake.in b/cmake/OpenJPEGConfig.cmake.in
new file mode 100644
index 00000000..b20294ca
--- /dev/null
+++ b/cmake/OpenJPEGConfig.cmake.in
@@ -0,0 +1,48 @@
+#-----------------------------------------------------------------------------
+#
+# OPENJPEGConfig.cmake - CMake configuration file for external projects.
+#
+# This file is configured by OPENJPEG and used by the UseOPENJPEG.cmake
+# module to load OPENJPEG's settings for an external project.
+@OPENJPEG_CONFIG_INSTALL_ONLY@
+# The OPENJPEG version number.
+set(OPENJPEG_MAJOR_VERSION "@OPENJPEG_VERSION_MAJOR@")
+set(OPENJPEG_MINOR_VERSION "@OPENJPEG_VERSION_MINOR@")
+set(OPENJPEG_BUILD_VERSION "@OPENJPEG_VERSION_BUILD@")
+
+# The libraries.
+set(OPENJPEG_LIBRARIES "@OPENJPEG_LIBRARY_NAME@")
+
+# The CMake macros dir.
+set(OPENJPEG_CMAKE_DIR "@OPENJPEG_INSTALL_PACKAGE_DIR@")
+
+# The configuration options.
+set(OPENJPEG_BUILD_SHARED_LIBS "@BUILD_SHARED_LIBS@")
+
+# The "use" file.
+set(OPENJPEG_USE_FILE "@OPENJPEG_USE_FILE_CONFIG@")
+
+get_filename_component(SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
+if(EXISTS ${SELF_DIR}/OpenJPEGTargets.cmake)
+ # This is an install tree
+ include(${SELF_DIR}/OpenJPEGTargets.cmake)
+ get_filename_component(OPENJPEG_INCLUDE_ROOT "${SELF_DIR}/../../@OPENJPEG_INSTALL_INCLUDE_DIR@" ABSOLUTE)
+ set(OPENJPEG_INCLUDE_DIRS ${OPENJPEG_INCLUDE_ROOT})
+
+else()
+ if(EXISTS ${SELF_DIR}/OpenJPEGExports.cmake)
+ # This is a build tree
+ set( OPENJPEG_INCLUDE_DIRS @OPENJPEG_INCLUDE_PATH@)
+
+ include(${SELF_DIR}/OpenJPEGExports.cmake)
+
+ else()
+ message(FATAL_ERROR "ooops")
+ endif()
+endif()
+
+set(OPENJPEG_USE_FILE ${SELF_DIR}/UseOPENJPEG.cmake)
+
+# Backward compatible part:
+set(OPENJPEG_FOUND TRUE)
+
diff --git a/cmake/TestFileOffsetBits.c b/cmake/TestFileOffsetBits.c
new file mode 100644
index 00000000..993b2da4
--- /dev/null
+++ b/cmake/TestFileOffsetBits.c
@@ -0,0 +1,10 @@
+#include <sys/types.h>
+
+int main(int argc, char **argv)
+{
+ /* Cause a compile-time error if off_t is smaller than 64 bits */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[ (LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1 ];
+ return 0;
+}
+
diff --git a/cmake/TestLargeFiles.c.cmake.in b/cmake/TestLargeFiles.c.cmake.in
new file mode 100644
index 00000000..623f95f8
--- /dev/null
+++ b/cmake/TestLargeFiles.c.cmake.in
@@ -0,0 +1,23 @@
+#cmakedefine _LARGEFILE_SOURCE
+#cmakedefine _LARGE_FILES
+#cmakedefine _FILE_OFFSET_BITS @_FILE_OFFSET_BITS@
+
+#include <sys/types.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int main(int argc, char **argv)
+{
+ /* Cause a compile-time error if off_t is smaller than 64 bits,
+ * and make sure we have ftello / fseeko.
+ */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[ (LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1 ];
+ FILE *fp = fopen(argv[0],"r");
+ off_t offset = ftello( fp );
+
+ fseeko( fp, offset, SEEK_CUR );
+ fclose(fp);
+ return 0;
+}
+
diff --git a/cmake/TestLargeFiles.cmake b/cmake/TestLargeFiles.cmake
new file mode 100644
index 00000000..ffef84f5
--- /dev/null
+++ b/cmake/TestLargeFiles.cmake
@@ -0,0 +1,134 @@
+# - Define macro to check large file support
+#
+# OPJ_TEST_LARGE_FILES(VARIABLE)
+#
+# VARIABLE will be set to true if off_t is 64 bits, and fseeko/ftello present.
+# This macro will also defines the necessary variable enable large file support, for instance
+# _LARGE_FILES
+# _LARGEFILE_SOURCE
+# _FILE_OFFSET_BITS 64
+# HAVE_FSEEKO
+#
+# However, it is YOUR job to make sure these defines are set in a #cmakedefine so they
+# end up in a config.h file that is included in your source if necessary!
+#
+# Adapted from Gromacs project (http://www.gromacs.org/)
+# by Julien Malik
+#
+
+macro(OPJ_TEST_LARGE_FILES VARIABLE)
+ if("${VARIABLE}" MATCHES "^${VARIABLE}$")
+
+ # On most platforms it is probably overkill to first test the flags for 64-bit off_t,
+ # and then separately fseeko. However, in the future we might have 128-bit filesystems
+ # (ZFS), so it might be dangerous to indiscriminately set e.g. _FILE_OFFSET_BITS=64.
+
+ message(STATUS "Checking for 64-bit off_t")
+
+ # First check without any special flags
+ try_compile(FILE64_OK "${PROJECT_BINARY_DIR}"
+ "${PROJECT_SOURCE_DIR}/cmake/TestFileOffsetBits.c")
+ if(FILE64_OK)
+ message(STATUS "Checking for 64-bit off_t - present")
+ endif()
+
+ if(NOT FILE64_OK)
+ # Test with _FILE_OFFSET_BITS=64
+ try_compile(FILE64_OK "${PROJECT_BINARY_DIR}"
+ "${PROJECT_SOURCE_DIR}/cmake/TestFileOffsetBits.c"
+ COMPILE_DEFINITIONS "-D_FILE_OFFSET_BITS=64" )
+ if(FILE64_OK)
+ message(STATUS "Checking for 64-bit off_t - present with _FILE_OFFSET_BITS=64")
+ set(_FILE_OFFSET_BITS 64)
+ endif()
+ endif()
+
+ if(NOT FILE64_OK)
+ # Test with _LARGE_FILES
+ try_compile(FILE64_OK "${PROJECT_BINARY_DIR}"
+ "${PROJECT_SOURCE_DIR}/cmake/TestFileOffsetBits.c"
+ COMPILE_DEFINITIONS "-D_LARGE_FILES" )
+ if(FILE64_OK)
+ message(STATUS "Checking for 64-bit off_t - present with _LARGE_FILES")
+ set(_LARGE_FILES 1)
+ endif()
+ endif()
+
+ if(NOT FILE64_OK)
+ # Test with _LARGEFILE_SOURCE
+ try_compile(FILE64_OK "${PROJECT_BINARY_DIR}"
+ "${PROJECT_SOURCE_DIR}/cmake/TestFileOffsetBits.c"
+ COMPILE_DEFINITIONS "-D_LARGEFILE_SOURCE" )
+ if(FILE64_OK)
+ message(STATUS "Checking for 64-bit off_t - present with _LARGEFILE_SOURCE")
+ set(_LARGEFILE_SOURCE 1)
+ endif()
+ endif()
+
+
+ #if(NOT FILE64_OK)
+ # # now check for Windows stuff
+ # try_compile(FILE64_OK "${PROJECT_BINARY_DIR}"
+ # "${PROJECT_SOURCE_DIR}/cmake/TestWindowsFSeek.c")
+ # if(FILE64_OK)
+ # message(STATUS "Checking for 64-bit off_t - present with _fseeki64")
+ # set(HAVE__FSEEKI64 1)
+ # endif()
+ #endif()
+
+ if(NOT FILE64_OK)
+ message(STATUS "Checking for 64-bit off_t - not present")
+ endif()
+
+ set(_FILE_OFFSET_BITS ${_FILE_OFFSET_BITS} CACHE INTERNAL "Result of test for needed _FILE_OFFSET_BITS=64")
+ set(_LARGE_FILES ${_LARGE_FILES} CACHE INTERNAL "Result of test for needed _LARGE_FILES")
+ set(_LARGEFILE_SOURCE ${_LARGEFILE_SOURCE} CACHE INTERNAL "Result of test for needed _LARGEFILE_SOURCE")
+
+ # Set the flags we might have determined to be required above
+ configure_file("${PROJECT_SOURCE_DIR}/cmake/TestLargeFiles.c.cmake.in"
+ "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/TestLargeFiles.c")
+
+ message(STATUS "Checking for fseeko/ftello")
+
+ # Test if ftello/fseeko are available
+ try_compile(FSEEKO_COMPILE_OK
+ "${PROJECT_BINARY_DIR}"
+ "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/TestLargeFiles.c")
+
+ if(FSEEKO_COMPILE_OK)
+ message(STATUS "Checking for fseeko/ftello - present")
+ endif()
+
+ if(NOT FSEEKO_COMPILE_OK)
+ # glibc 2.2 needs _LARGEFILE_SOURCE for fseeko (but not for 64-bit off_t...)
+ try_compile(FSEEKO_COMPILE_OK
+ "${PROJECT_BINARY_DIR}"
+ "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/TestLargeFiles.c"
+ COMPILE_DEFINITIONS "-D_LARGEFILE_SOURCE" )
+
+ if(FSEEKO_COMPILE_OK)
+ message(STATUS "Checking for fseeko/ftello - present with _LARGEFILE_SOURCE")
+ set(_LARGEFILE_SOURCE ${_LARGEFILE_SOURCE} CACHE INTERNAL "Result of test for needed _LARGEFILE_SOURCE")
+ endif()
+ endif()
+
+ if(FSEEKO_COMPILE_OK)
+ set(HAVE_FSEEKO ON CACHE INTERNAL "Result of test for fseeko/ftello")
+ else()
+ message(STATUS "Checking for fseeko/ftello - not found")
+ set(HAVE_FSEEKO OFF CACHE INTERNAL "Result of test for fseeko/ftello")
+ endif()
+
+ if(FILE64_OK AND FSEEKO_COMPILE_OK)
+ message(STATUS "Large File support - found")
+ set(${VARIABLE} ON CACHE INTERNAL "Result of test for large file support")
+ else()
+ message(STATUS "Large File support - not found")
+ set(${VARIABLE} OFF CACHE INTERNAL "Result of test for large file support")
+ endif()
+
+ endif()
+endmacro()
+
+
+
diff --git a/cmake/TestWindowsFSeek.c b/cmake/TestWindowsFSeek.c
new file mode 100644
index 00000000..ad9f0be1
--- /dev/null
+++ b/cmake/TestWindowsFSeek.c
@@ -0,0 +1,11 @@
+
+#include <stdio.h>
+
+int main()
+{
+ __int64 off=0;
+
+ _fseeki64(NULL, off, SEEK_SET);
+
+ return 0;
+}
diff --git a/cmake/openjpeg_valgrind.supp b/cmake/openjpeg_valgrind.supp
new file mode 100644
index 00000000..f1076469
--- /dev/null
+++ b/cmake/openjpeg_valgrind.supp
@@ -0,0 +1,39 @@
+
+
+{
+ <Appears with libpng uses with Ubuntu10.04 (hulk)>
+ Memcheck:Cond
+ fun:deflate
+ obj:/lib/libpng12.so.0.42.0
+ obj:/lib/libpng12.so.0.42.0
+ obj:/lib/libpng12.so.0.42.0
+ fun:png_write_row
+ fun:imagetopng
+ fun:main
+}
+{
+ <Appears with libpng uses with Ubuntu10.04 (hulk)>
+ Memcheck:Value8
+ fun:crc32
+ obj:/lib/libpng12.so.0.42.0
+ fun:png_write_chunk
+ obj:/lib/libpng12.so.0.42.0
+ obj:/lib/libpng12.so.0.42.0
+ obj:/lib/libpng12.so.0.42.0
+ obj:/lib/libpng12.so.0.42.0
+ fun:png_write_row
+ fun:imagetopng
+ fun:main
+}
+{
+ <Appears with libpng uses with Ubuntu10.04 (hulk)>
+ Memcheck:Param
+ write(buf)
+ fun:__write_nocancel
+ fun:_IO_file_write@@GLIBC_2.2.5
+ fun:_IO_do_write@@GLIBC_2.2.5
+ fun:_IO_file_close_it@@GLIBC_2.2.5
+ fun:fclose@@GLIBC_2.2.5
+ fun:imagetopng
+ fun:main
+}