[CMake] Add new suffix rules
Bill Lorensen
bill.lorensen at gmail.com
Sun Apr 16 14:24:59 EDT 2006
I have added a custom command to generate files with extension .clp.
UTILITY_SOURCE(GENERATECLP_EXE GenerateCLP ./ GenerateCLP.cxx)
MACRO(GENERATECLP XML)
# For each XML file
FOREACH(FILE ${XML})
# what is the filename without the extension
GET_FILENAME_COMPONENT(TMP_FILENAME ${FILE} NAME_WE)
# the input file might be full path so handle that
GET_FILENAME_COMPONENT(TMP_FILEPATH ${FILE} PATH)
# compute the input filename
IF (TMP_FILEPATH)
SET(TMP_INPUT ${TMP_FILEPATH}/${TMP_FILENAME}.xml)
ELSE (TMP_FILEPATH)
SET(TMP_INPUT ${CMAKE_CURRENT_SOURCE_DIR}/${TMP_FILENAME}.xml)
ENDIF (TMP_FILEPATH)
# add custom command to output
ADD_CUSTOM_COMMAND(
OUTPUT ${TMP_FILENAME}.clp
DEPENDS GenerateCLP ${TMP_INPUT}
COMMAND ${GENERATECLP_EXE}
${TMP_INPUT} ${CMAKE_CURRENT_SOURCE_DIR}/${TMP_FILENAME}.clp
)
ENDFOREACH(FILE)
ENDMACRO(GENERATECLP)
GENERATECLP(CLPExample1.xml)
SET ( CLPEXAMPLE1_SOURCE CLPExample1.cxx CLPExample1.clp
)
ADD_EXECUTABLE ( CLPExample1 ${CLPEXAMPLE1_SOURCE})
TARGET_LINK_LIBRARIES ( CLPExample1 ITKEXPAT)
I get an error message:
CMake Error: Source file
"/home/lorensen/Projects/CommandLineAPI/CLPExample1.clp" has unknown type.
I'm using cmake 2.2.
Bill
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20060416/61f28e36/attachment.html
More information about the CMake
mailing list