[Cmake] Two (related) questions
Andy Cedilnik
andy.cedilnik at kitware.com
Tue Aug 27 10:50:53 EDT 2002
Hi Geoffrey,
There are two good sources to figure that out in VTK (if you have
source):
1. vtktiff (VTK/Utilities/tiff)
uses ADD_CUSTOM_COMMAND to run a binary that is being created by
build process and generate a source code that is then used in
the rest of the build
ADD_CUSTOM_COMMAND(
SOURCE ${EXECUTABLE_OUTPUT_PATH}/mkg3states
COMMAND ${EXECUTABLE_OUTPUT_PATH}/mkg3states
ARGS -c const ${VTKTIFF_BINARY_DIR}/tif_fax3sm.c
TARGET mkg3states
OUTPUTS ${VTKTIFF_BINARY_DIR}/tif_fax3sm.c)
2. VTKJava (VTK/Wrapping/Java)
uses it to build java classes even though CMake does not support that
directly:
ADD_CUSTOM_COMMAND(SOURCE VTKJava
COMMAND ${JAVA_COMPILE}
ARGS ${VTK_BINARY_DIR}/java/vtk/vtk*.java
TARGET VTKJava
OUTPUTS ${VTK_BINARY_DIR}/java/vtk/vtkObject.class)
ADD_CUSTOM_COMMAND(SOURCE VTKJava
COMMAND ${CMAKE_COMMAND}
ARGS -E chdir
${VTK_BINARY_DIR}/java ${JAVA_ARCHIVE}
-cvf ${LIBRARY_OUTPUT_PATH}/vtk.jar
vtk
TARGET VTKJava
OUTPUTS ${LIBRARY_OUTPUT_PATH}/vtk.jar)
So, in general, what this is:
SOURCE - something that will be build to trigger this command
COMMAND - command that will be executed
ARGS - arguments for command
TARGET - target which the command will be part of
OUTPUTS - what the command generates
Andy
On Tue, 2002-08-27 at 10:09, Geoffrey Cross wrote:
>
>
> > For the renaming problem, you can use a custom command to copy the
> > shared library after it is built to a new name.
>
> How does this ADD_CUSTOM_COMMAND thing work? The documentation baffles
> me... :).
More information about the CMake
mailing list