]> Creatis software - clitk.git/blob - cmake/common.cmake
cosmetic
[clitk.git] / cmake / common.cmake
1 #=========================================================
2 MACRO (DD in)
3     MESSAGE(${in}=${${in}})
4 ENDMACRO(DD)
5 #=========================================================
6 # Process ggo (gengetopt) files (http://www.gnu.org/software/gengetopt/)
7 MACRO (WRAP_GGO GGO_SRCS)
8     FOREACH(GGO_FILE ${ARGN})
9         GET_FILENAME_COMPONENT(GGO_BASEFILENAME ${GGO_FILE} NAME_WE)
10         GET_FILENAME_COMPONENT(GGO_FILE_ABS ${GGO_FILE} ABSOLUTE)
11         SET(GGO_H ${GGO_BASEFILENAME}_ggo.h)
12         SET(GGO_C ${GGO_BASEFILENAME}_ggo.c)
13         SET(GGO_OUTPUT ${GGO_H} ${GGO_C})
14         ADD_CUSTOM_COMMAND(OUTPUT ${GGO_OUTPUT}
15                            COMMAND ${CLITK_GENGETOPT}/gengetopt
16                            ARGS < ${GGO_FILE_ABS}
17                                   --output-dir=${CMAKE_CURRENT_BINARY_DIR}
18                                   --arg-struct-name=args_info_${GGO_BASEFILENAME}
19                                   --func-name=cmdline_parser_${GGO_BASEFILENAME}
20                                   --file-name=${GGO_BASEFILENAME}_ggo
21                                   --unamed-opts
22                                   --conf-parser
23                                   --include-getopt
24                            DEPENDS ${GGO_FILE}
25                           )  
26         SET(${GGO_SRCS} ${${GGO_SRCS}} ${CMAKE_CURRENT_BINARY_DIR}/${GGO_BASEFILENAME}_ggo.c)
27         INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})  #For _ggo.h includes
28     ENDFOREACH(GGO_FILE)
29     SET_SOURCE_FILES_PROPERTIES(${${GGO_SRCS}} PROPERTIES GENERATED TRUE)
30 ENDMACRO (WRAP_GGO)
31
32 # Reproduce old mechanism with new macro for ggo files (for the time being)
33 FILE(GLOB ALL_GGO_FILES *.ggo)
34 #WRAP_GGO(ALL_GGO_SRCS ${ALL_GGO_FILES})
35 #=========================================================
36 #Set a reasonable build mode default if the user hasn't set any
37 if (NOT CMAKE_BUILD_TYPE)
38   set(CMAKE_BUILD_TYPE Release)
39 endif (NOT CMAKE_BUILD_TYPE)
40 #=========================================================
41 SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
42 SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
43 LINK_DIRECTORIES(${PROJECT_BINARY_DIR}/lib)
44 INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/common)
45 INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/tools)
46 INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR}/tools)         #For _ggo.h includes from other directories
47 INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR}/segmentation)  #For _ggo.h includes from other directories
48 INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR}/registration)  #For _ggo.h includes from other directories
49 #=========================================================