STYLE: Add a lot of comments for the CMake build system
[openjpeg.git] / CMakeLists.txt
1 # Main CMakeLists.txt to build the OpenJPEG project using CMake (www.cmake.org)
2 # Written by Mathieu Malaterre
3
4 # This CMake project will by default create a library called openjpeg
5 # But if you want to use this project within your own (CMake) project
6 # you will eventually like to prefix the library to avoid linking confusion
7 # For this purpose you can define a CMake var: OPJ_PREFIX to whatever you like
8 # e.g.:
9 # SET(OPJ_PREFIX "gdcm")
10 # Also if you want to test (CTest driven) you need to define :
11 # OPJ_STANDALONE to 1, e.g
12 # OPJ_STANDALONE:BOOL=1
13 PROJECT(OPENJPEG C)
14 CMAKE_MINIMUM_REQUIRED(VERSION 2.0)
15
16 #-----------------------------------------------------------------------------
17 # OPENJPEG version number, usefull for packaging and doxygen doc:
18 SET(OPENJPEG_MAJOR_VERSION 1)
19 SET(OPENJPEG_MINOR_VERSION 0)
20 SET(OPENJPEG_BUILD_VERSION 0)
21 SET(OPENJPEG_VERSION
22   "${OPENJPEG_MAJOR_VERSION}.${OPENJPEG_MINOR_VERSION}.${OPENJPEG_BUILD_VERSION}")
23
24 #-----------------------------------------------------------------------------
25 # OpenJPEG build configuration options.
26 OPTION(BUILD_SHARED_LIBS "Build OpenJPEG with shared libraries." OFF)
27
28 #-----------------------------------------------------------------------------
29 # For the codec...
30 OPTION(BUILD_EXAMPLES "Build the Examples (codec...)." OFF)
31
32 #-----------------------------------------------------------------------------
33 # Always build the library
34 SUBDIRS(
35   libopenjpeg
36   )
37 #-----------------------------------------------------------------------------
38 # Build example only if requested
39 IF(BUILD_EXAMPLES)
40   SUBDIRS(codec)
41 ENDIF(BUILD_EXAMPLES)
42
43 #-----------------------------------------------------------------------------
44 # For openjpeg team if they ever want Dart+CMake
45 IF(OPJ_STANDALONE)
46   INCLUDE(Dart)
47   MARK_AS_ADVANCED(BUILD_TESTING DART_ROOT TCL_TCLSH)
48   IF(BUILD_TESTING)
49     ENABLE_TESTING()
50     SET(BUILDNAME "OpenJPEG-${CMAKE_SYSTEM}-${CMAKE_C_COMPILER}" CACHE STRING "Name of build on the dashboard")
51     MARK_AS_ADVANCED(BUILDNAME)
52   ENDIF(BUILD_TESTING)
53 ENDIF(OPJ_STANDALONE)
54
55 # TODO, technically we should add tests, e.g:
56 # http://www.crc.ricoh.com/~gormish/jpeg2000conformance/
57