From 942b4c8e4a57eab81752dcf0cf653b898347b504 Mon Sep 17 00:00:00 2001 From: srit Date: Wed, 17 Mar 2010 15:43:48 +0000 Subject: [PATCH] Modified ggo mechanism: now uses a macro (WRAP_GGO) on the qt WRAP_UI model. The old mechanism is still in place but the new way should be used, e.g.: WRAP_GGO(FOO_GGO_SOURCES foo.ggo) ADD_EXECUTABLE(foo foo.cxx FOO_GGO_SOURCES) --- cmake/common.cmake | 59 ++++++++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 26 deletions(-) diff --git a/cmake/common.cmake b/cmake/common.cmake index 8f5df50..f4babb8 100644 --- a/cmake/common.cmake +++ b/cmake/common.cmake @@ -1,39 +1,46 @@ #========================================================= -# Find ggo (gengetopt) files (http://www.gnu.org/software/gengetopt/) -FILE(GLOB ALL_GGO_FILES *.ggo) -#MESSAGE(${ALL_GGO_FILES}) +MACRO (DD in) + MESSAGE(${in}=${${in}}) +ENDMACRO(DD) +#========================================================= +# Process ggo (gengetopt) files (http://www.gnu.org/software/gengetopt/) +MACRO (WRAP_GGO GGO_SRCS) + MAKE_DIRECTORY(${CMAKE_BINARY_DIR}/ggo) + FOREACH(GGO_FILE ${ARGN}) + GET_FILENAME_COMPONENT(GGO_BASEFILENAME ${GGO_FILE} NAME_WE) + GET_FILENAME_COMPONENT(GGO_FILE_ABS ${GGO_FILE} ABSOLUTE) + SET(GGO_H ${GGO_BASEFILENAME}_ggo.h) + SET(GGO_C ${GGO_BASEFILENAME}_ggo.c) + SET(GGO_OUTPUT ${GGO_H} ${GGO_C}) + ADD_CUSTOM_COMMAND(OUTPUT ${GGO_OUTPUT} + COMMAND ${CLITK_GENGETOPT}/gengetopt + ARGS < ${GGO_FILE_ABS} + --output-dir=${CMAKE_CURRENT_BINARY_DIR} + --arg-struct-name=args_info_${GGO_BASEFILENAME} + --file-name=${GGO_BASEFILENAME}_ggo + --unamed-opts + --conf-parser + --include-getopt + DEPENDS ${GGO_FILE} + ) + SET(${GGO_SRCS} ${${GGO_SRCS}} ${CMAKE_CURRENT_BINARY_DIR}/${GGO_BASEFILENAME}_ggo.c) + INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) #For _ggo.h includes + ENDFOREACH(GGO_FILE) +ENDMACRO (WRAP_GGO) -FOREACH(GGO_FILE ${ALL_GGO_FILES}) - # MESSAGE(input=${GGO_FILE}) - STRING(REGEX REPLACE "(.*).ggo" - "\\1" GGO_BASEFILENAME - "${GGO_FILE}") - #GET_FILENAME_COMPONENT(GGO_BASEFILENAME ${GGO_FILE} NAME_WE) - GET_FILENAME_COMPONENT(GGO_NAME ${GGO_BASEFILENAME} NAME) - # MESSAGE( base= ${GGO_BASEFILENAME}) - # MESSAGE( name= ${GGO_NAME}) - SET(GGO_H ${GGO_BASEFILENAME}_ggo.h) - #MESSAGE(${GGO_H}) - SET(GGO_C ${GGO_BASEFILENAME}_ggo.c) - #MESSAGE(${GGO_C}) - SET(GGO_OUTPUT ${GGO_H} ${GGO_C}) - ADD_CUSTOM_COMMAND(OUTPUT ${GGO_OUTPUT} - COMMAND ${CLITK_GENGETOPT}/gengetopt - ARGS < ${GGO_FILE} --arg-struct-name=args_info_${GGO_NAME} --file-name=${GGO_BASEFILENAME}_ggo -u --conf-parser --include-getopt - DEPENDS ${GGO_FILE} - ) - ENDFOREACH(GGO_FILE) +# Reproduce old mechanism with new macro for ggo files (for the time being) +FILE(GLOB ALL_GGO_FILES *.ggo) +WRAP_GGO(ALL_GGO_SRCS ${ALL_GGO_FILES}) #========================================================= #Set a reasonable build mode default if the user hasn't set any if (NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release) endif (NOT CMAKE_BUILD_TYPE) - #========================================================= -SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin/) +SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib) LINK_DIRECTORIES(${PROJECT_BINARY_DIR}/lib) INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/common) INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/tools) -INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/signal) +INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR}/filters) #For _ggo.h includes from other directories #========================================================= -- 2.47.1