[CMake] Batch converting several files

Andy Lego andy at legoandy.com
Sun Mar 16 20:44:55 EDT 2008


Hi Martin,

When you add things to the custom target they will be executed in one
step. What you want are custom commands. Look at the manual for
add_custom_command.

Andy

On Sun, Mar 16, 2008 at 8:31 AM, Martin Fischer <m_fischer at users.sf.net> wrote:
> On 11.03.2008 21:24 Andy Lego wrote:
>
>  Hi Andy,
>
>  so I tried the following
>
>  SET( SOURCEFILES
>       file1
>       file2
>       file3 )
>
>
>  FOREACH( FILE ${SOURCEFILES})
>         SET( EXECUTE
>              ${EXECUTE}
>              ${tool_EXE} ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}.in
>  ${CMAKE_CURRENT_BINARY_DIR}/${FILE}.out )
>  ENDFOREACH( FILE )
>
>
>  ADD_CUSTOM_TARGET( carfiles
>                    DEPENDS SOURCEFILES tool
>                    COMMAND ${EXECUTE}
>                   )
>
>  It looks like the variable EXCUTE is initialized as expected but is
>  considered as one command and not a sequence. Where am I going wrong?
>
>  Regards
>  Martin
>
>
>  > Hello Martin,
>  >
>  > You cannot nest commands and constructs. Move the FOREACH before the
>  > custom target and set a variable in it. Then use the result in the
>  > custom target.
>  >
>  > Andy
>  >
>
> > On Tue, Mar 11, 2008 at 12:44 PM, Martin Fischer <m_fischer at users.sf.net> wrote:
>  >> > Hi,
>  >> >
>  >> >  for a project I'm working on I need to do the following build steps:
>  >> >
>  >> >  - compile an executable from source
>  >> >  - run this executable to convert several files
>  >> >  - for each input file in source directory there will be one output file
>  >> >  in build directory.
>  >> >
>  >> >  I tried several variants of he following but didn't come up with a good
>  >> >  solution.
>
>
>
> _______________________________________________
>  CMake mailing list
>  CMake at cmake.org
>  http://www.cmake.org/mailman/listinfo/cmake
>



-- 
http://legoandy.com -o- http://capitalmtb.org

Support my 150 mile bike ride to fight MS:
http://bikecan.nationalmssociety.org/site/TR?px=3921627&pg=personal&fr_id=9066


More information about the CMake mailing list