show git stash or version in output comment
[gpivtools.git] / CMakeLists.txt
blobf195f161b91f11d7bd35b6e18954570954e1ed75
1 cmake_minimum_required(VERSION 2.8.0)
3 project (GPIVTOOLS)
4 set (GPIVTOOLS_VERSION_MAJOR 0)
5 set (GPIVTOOLS_VERSION_MINOR 7)
6 set (GPIVTOOLS_VERSION_PATCH 0)
7 set (GPIVTOOLS_VERSION 
8   ${GPIVTOOLS_VERSION_MAJOR}.${GPIVTOOLS_VERSION_MINOR}.${GPIVTOOLS_VERSION_PATCH})
10 # add binary directory as include directory
11 include_directories(${CMAKE_CURRENT_BINARY_DIR})
13 # set up custom cmake module path
14 set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake/Modules)
16 # include utilities
17 include(${CMAKE_SOURCE_DIR}/CMake/GpivUtilities.cmake)
19 set( CMAKE_VERBOSE_MAKEFILE on )
21 find_package(Gpiv REQUIRED)
22 IF(NOT GPIV_FOUND)
23 MESSAGE(FATAL_ERROR "Could not find Gpiv library")
24 ENDIF()
25 #message (Gpiv_INCLUDE_DIR = ${GPIV_INCLUDE_DIR} )
26 include_directories( ${GPIV_INCLUDE_DIR} )
27 set( LIBS ${LIBS} ${Gpiv_LIBRARIES} )
29 find_package(GSL REQUIRED)
30 #include_directories( ${Gsl_INCLUDE_DIR} )
31 #set( LIBS ${LIBS} ${Gsl_LIBRARIES} )
33 find_package( Glib REQUIRED )
34 include_directories( ${Glib_INCLUDE_DIRS} )
35 set( LIBS ${LIBS} ${Glib_LIBRARIES} )
37 #message (env var home = $ENV{HOME})
39 # Executable-prefix
40 set (_DEFAULT_EXE_PREFIX "gpiv_")
41 set(EXE_PREFIX "${_DEFAULT_EXE_PREFIX}"
42   CACHE STRING "Prefix for application output-names")
43 mark_as_advanced(EXE_PREFIX)
45 #  --enable-mpi            enable Message Protocol Interface (MPI)
46 include_directories( ${MPI_INCLUDE_PATH} )
47 set( LIBS ${LIBS} ${MPI_LIBRARY} )
48 option( USE_MPI "Parallel processing on distributed memory systems" OFF )
49 if(USE_MPI)
50   add_definitions(-DENABLE_MPI)
51   find_package( MPI )
52 endif()
54 #  --enable-cam            enable (IEEE-1394) camera
55 option( USE_CAM "Use (IEEE-1394) camera software for image recording" OFF )
56 if(USE_CAM)
57   add_definitions(-DENABLE_CAM)
58 endif()
60 #  --enable-trig           enable (realtime) triggering
61 option( USE_TRIG "Use RTAI software for laser and camera triggering" OFF )
62 if(USE_TRIG)
63   add_definitions(-DENABLE_TRIG)
64 endif()
66 #  --disable-rta=RTATOPDIR     place where the RTAI code \
67 #resides (default /usr/lib/realtime)
68 #  --enable-k=KTOPDIR     place where the installed kernel \
69 #headers resides (default /usr/src/kernel-headers-2.4.27-adeos)
71 #  --enable-omp            enable Open Multi-Processing (OMP)
72 option( USE_OMP "Use Open Multi-Processing (OMP)" ON )
73 if(USE_OMP)
74   add_definitions(-DENABLE_OMP)
75 endif()
77 # select debug behaviour and execution
78 option(DEBUG_V "Verbose behaviour for debugging." OFF)
79 if (DEBUG_V)
80   add_definitions(-DDEBUG_V)
81 endif (DEBUG_V)
83 option(DISABLE_EXEC "Reduced execution for debugging." OFF)
84 if (DISABLE_EXEC)
85   add_definitions(-DDISABLE_EXEC)
86 endif (DISABLE_EXEC)
88 # Man pages having identic prefix as executables
89 file(REMOVE_RECURSE ${CMAKE_BINARY_DIR}/man/)
90 set(DOC_PATH "share/man/man1")
91 install(FILES ${CMAKE_SOURCE_DIR}/man/gpivtools.1
92         DESTINATION ${DOC_PATH}
95 ## INCLUDE_DIRECTORIES($ENV{HOME}/include)
97 # Adding git hash
98 if (EXISTS ${CMAKE_SOURCE_DIR}/.git)
99   option(USE_GIT_HASH "Show Git hash when -v | --version is used" ON)
100   if (USE_GIT_HASH)
101     find_package(Git)
102     if (GIT_FOUND)
103       add_definitions(-DGIT_HASH)
104       git_hash ()
105     else (GIT_FOUND)
106       message ("No GIT executable is found. GIT_REVISION disabled")
107       git_msg ("No git binary")
108     endif (GIT_FOUND)
109   else (USE_GIT_HASH)
110     git_msg (Disabled)
111   endif (USE_GIT_HASH)
112 else (EXISTS ${CMAKE_SOURCE_DIR}/.git)
113   git_msg ("Disabled: no git repo")
114 endif (EXISTS ${CMAKE_SOURCE_DIR}/.git)
116 # Adding other configurations
117 configure_file (
118   "${PROJECT_SOURCE_DIR}/config.h.in"
119   "${PROJECT_BINARY_DIR}/config.h"
120   )
122 # uninstall target
123 configure_file(
124   "${CMAKE_SOURCE_DIR}/CMake/Modules/cmake_uninstall.cmake.in"
125   "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake"
126   @ONLY
127   )
129 add_custom_target(uninstall
130   "${CMAKE_COMMAND}" -P "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake"
131   )
133 add_subdirectory (src)