[CMake] Re: Processing new extensions with cmake

Alexander Neundorf a.neundorf-work at gmx.net
Tue Apr 11 02:48:02 EDT 2006


> --- Ursprüngliche Nachricht --- 
> Von: "Michael Biebl" <mbiebl at gmail.com> 
> An: cmake at cmake.org 
> Betreff: [CMake] Re: Processing new extensions with cmake 
> Datum: Tue, 11 Apr 2006 05:13:18 +0200 
>  
> FWIW, this is my solution so far: 
>  
> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
> MACRO(PROCESS_IIFILES _i_FILES _ii_FILES) 
>         SET(_i_FILES) 
>         FOREACH(_current_FILE ${ARGN}) 
>                 GET_FILENAME_COMPONENT(_tmp_FILE ${_current_FILE} 
> ABSOLUTE) 
>                 GET_FILENAME_COMPONENT(_abs_PATH ${_tmp_FILE} PATH) 
>                 GET_FILENAME_COMPONENT(_basename ${_tmp_FILE} NAME_WE) 
>  
>                 SET(_i_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.i) 
>                 ADD_CUSTOM_TARGET(${_basename} ALL 
>                         COMMAND echo "Processing: ${_current_FILE}" 
>                         COMMAND 
> ${CMAKE_BINARY_DIR}/tools/install_service -i 
> ${CMAKE_CURRENT_SOURCE_DIR}/${_current_FILE} -o ${_i_FILE} 
>                         DEPENDS ${_current_FILE}) 
>                 ADD_DEPENDENCIES(${_basename} install_service) 
>                 SET(${_i_FILES} ${${_i_FILES}} ${_i_FILE}) 
>  
>         ENDFOREACH(_current_FILE) 
> ENDMACRO(PROCESS_IIFILES) 
> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
> SET(II_FILES 
>         test1.ii 
>         test2.ii 
>         test3.ii 
> ) 
>  
> PROCESS_IIFILES(I_FILES ${II_FILES}) 
>  
> INSTALL_FILES(/share/data/ FILES ${I_FILES}) 
> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
>  
> This works, more or less. But there is still one huge downside with 
> this solution. The ifiles are always regenerated on calling "make" and 
> I only want them to be regenerated if the file itself or the 
> install_service binary has changed. Ideas, how I could do that? 
 
You could use add_custom_target(... DEPENDS 
${CMAKE_CURRENT_SOURCE_DIR}/${_current_FILE} install_service ) 
 
This should then only execute the commands if the depend files have 
changed. 
 
Please check that get_filename_component(... ABSOLUTE) works with your 
cmake version, it was broken in some versions. 
 
Alex 
 

-- 
Analog-/ISDN-Nutzer sparen mit GMX SmartSurfer bis zu 70%!
Kostenlos downloaden: http://www.gmx.net/de/go/smartsurfer


More information about the CMake mailing list