[Cmake] Possible patches for ITK_WRAP_TCL
Anton Deguet
anton at cs.jhu.edu
Mon Apr 28 14:27:44 EDT 2003
Hello,
I am trying to use ADD_CUSTOM_xxx to run cable. My plan is to use a
custom target/command to run cable and then use a regular target to
compile the generated c++ files. My problem is that ccmake complains
about the c++ files which are not yet generated (probably to generate
the include dependencies).
Here is my cmake code (it's part of a macro I use for a bunch of small
libraries):
# specify source files. Now, one per library
SET(${MODULE_NAME}_SOURCES_TCL
${cis_SOURCE_DIR}/${MODULE_NAME}/wrapping/${MODULE_NAME}Tcl.cpp)
IF(EXISTS ${${MODULE_NAME}_SOURCES_TCL})
# cable rule
ADD_CUSTOM_TARGET(${MODULE_NAME}TclWrap ALL echo)
ADD_CUSTOM_COMMAND(SOURCE ${${MODULE_NAME}_SOURCES_TCL}
COMMAND ${CABLE}
ARGS ${${MODULE_NAME}_SOURCES_TCL}
TARGET ${MODULE_NAME}TclWrap
DEPENDS ${${MODULE_NAME}_SOURCES_TCL}
OUTPUT
${cis_BINARY_DIR}/${MODULE_NAME}TclWrapped.cpp)
# include for the compilation of cable generated code
INCLUDE_DIRECTORIES(${TCL_INCLUDE_PATH} ${TK_INCLUDE_PATH}
${CABLE_INCLUDE_DIR})
ADD_LIBRARY(${MODULE_NAME}Tcl
${cis_BINARY_DIR}/${MODULE_NAME}TclWrapped.cpp)
ADD_DEPENDENCIES(${MODULE_NAME}Tcl ${MODULE_NAME}TclWrap)
TARGET_LINK_LIBRARIES(${MODULE_NAME}Tcl ${MODULE_NAME}
${${MODULE_NAME}_DEPENDENCIES} ${CABLE_TCL_LIBRARY})
INSTALL_TARGETS(/lib ${MODULE_NAME}Tcl)
ENDIF(EXISTS ${${MODULE_NAME}_SOURCES_TCL})
When I run cmake, I get the following error (e.g. for MODULE_NAME
cisCommon):
CMake Error: can not find file
/home/spine2/anton/devel/cis-2/build/cisCommonTclWrapped.cpp
Is there anyway to tell a target generated with ADD_LIBRARY that the
source file used as an input is the output of a custom command and
therefore might not exist (yet)?
Anton
Brad King wrote:
>>Here are two possible corrections for CMake related to the ITK_WRAP_TCL
>>command. The first one is for the FindCABLE module:
>
>
> This is done. Thanks.
>
>
>>Nevertheless, now the Unix Makefile has some "\ " and I haven't tested
>>or even modified the code for Windows Visual C and NMake.
>
> [snip]
>
>> > commandArgs.push_back(m_Makefile->GetDefineFlags());
>
>
> This will not quite work. The command arguments are fully escaped to
> handle spaces in paths. The define flags would have to be parsed and
> added as separate arguments. Eventually this command will be replaced by
> a loaded command in Cable, though, so there isn't much point in spending
> much time on it now.
>
> You might want to look at using ADD_CUSTOM_COMMAND to run cable instead.
> I haven't tried it, but it should be possible.
>
> -Brad
>
> _______________________________________________
> Cmake mailing list
> Cmake at public.kitware.com
> http://public.kitware.com/mailman/listinfo/cmake
>
>
--
Anton Deguet - Email anton<at>cs.jhu.edu
Office NEB B26 - Phone 410 516 5261 - Fax 410 516 3332
http://cisstweb.cs.jhu.edu
More information about the CMake
mailing list