]> git.donarmstrong.com Git - bamtools.git/blob - CMakeLists.txt
Version 2.2.2
[bamtools.git] / CMakeLists.txt
1 # ==========================
2 # BamTools CMakeLists.txt
3 # (c) 2010 Derek Barnett
4 #
5 # top-level
6 # ==========================
7
8 # set project name
9 project( BamTools )
10
11 # Cmake requirements
12 cmake_minimum_required( VERSION 2.6.4 )
13
14 # Force the build directory to be different from source directory
15 macro( ENSURE_OUT_OF_SOURCE_BUILD MSG )
16     string( COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" insource )
17     get_filename_component( PARENTDIR ${CMAKE_SOURCE_DIR} PATH )
18     string( COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${PARENTDIR}" insourcesubdir )
19     IF( insource OR insourcesubdir )
20         message( FATAL_ERROR "${MSG}" )
21     ENDIF( insource OR insourcesubdir )
22 endmacro( ENSURE_OUT_OF_SOURCE_BUILD )
23
24 ensure_out_of_source_build( "
25   ${PROJECT_NAME} requires an out of source build.
26   $ mkdir build 
27   $ cd build
28   $ cmake ..
29   $ make 
30 (or the Windows equivalent)\n" )
31
32 # set BamTools version information
33 set( BamTools_VERSION_MAJOR 2 )
34 set( BamTools_VERSION_MINOR 2 )
35 set( BamTools_VERSION_BUILD 2 )
36
37 # set our library and executable destination dirs
38 set( EXECUTABLE_OUTPUT_PATH "${CMAKE_SOURCE_DIR}/bin" )
39 set( LIBRARY_OUTPUT_PATH    "${CMAKE_SOURCE_DIR}/lib" )
40
41 # define compiler flags for all code
42 set( CMAKE_BUILD_TYPE Release )
43 add_definitions( -Wall -D_FILE_OFFSET_BITS=64 )
44
45 # -----------------------------------------------
46 # handle platform-/environment-specific defines
47
48 # If planning to run in Node.js environment, run:
49 # cmake -DEnableNodeJS=true
50 if( EnableNodeJS )
51     add_definitions( -DSYSTEM_NODEJS=1 )
52 endif()
53
54 # If running on SunOS
55 if( "${CMAKE_SYSTEM_NAME}" MATCHES "SunOS" )
56     add_definitions( -DSUN_OS )
57 endif()
58
59 # -------------------------------------------
60
61 # add our includes root path
62 include_directories( src )
63
64 # list subdirectories to build in
65 add_subdirectory( src )