]> Creatis software - clitk.git/blob - cmake/common.cmake
added the new headers
[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     MAKE_DIRECTORY(${CMAKE_BINARY_DIR}/ggo)
9     FOREACH(GGO_FILE ${ARGN})
10         GET_FILENAME_COMPONENT(GGO_BASEFILENAME ${GGO_FILE} NAME_WE)
11         GET_FILENAME_COMPONENT(GGO_FILE_ABS ${GGO_FILE} ABSOLUTE)
12         SET(GGO_H ${GGO_BASEFILENAME}_ggo.h)
13         SET(GGO_C ${GGO_BASEFILENAME}_ggo.c)
14         SET(GGO_OUTPUT ${GGO_H} ${GGO_C})
15         ADD_CUSTOM_COMMAND(OUTPUT ${GGO_OUTPUT}
16                            COMMAND ${CLITK_GENGETOPT}/gengetopt
17                            ARGS < ${GGO_FILE_ABS}
18                                   --output-dir=${CMAKE_CURRENT_BINARY_DIR}
19                                   --arg-struct-name=args_info_${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 ENDMACRO (WRAP_GGO)
30
31 # Reproduce old mechanism with new macro for ggo files (for the time being)
32 FILE(GLOB ALL_GGO_FILES *.ggo)
33 WRAP_GGO(ALL_GGO_SRCS ${ALL_GGO_FILES})
34 #=========================================================
35 #Set a reasonable build mode default if the user hasn't set any
36 if (NOT CMAKE_BUILD_TYPE)
37   set(CMAKE_BUILD_TYPE Release)
38 endif (NOT CMAKE_BUILD_TYPE)
39 #=========================================================
40 SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
41 SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
42 LINK_DIRECTORIES(${PROJECT_BINARY_DIR}/lib)
43 INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/common)
44 INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/tools)
45 INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR}/filters)  #For _ggo.h includes from other directories
46 #=========================================================