[CMake] Batch converting several files
Martin Fischer
m_fischer at users.sf.net
Mon Mar 17 17:18:35 EDT 2008
Hi Andy,
it seems I don't understand the direction you are pointing me to. I
used add_custom_command in some occasions. So now I tried:
FOREACH( FILE ${SOURCEFILES})
ADD_CUSTOM_COMMAND ${FILE}.out
COMMAND ${tool_EXE} ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}.in
${CMAKE_CURRENT_BINARY_DIR}/${FILE}.out
DEPEND tool ${FILE}.in
)
ENDFOREACH( FILE )
CMake outputs: "Wrong syntax. Unknown type of argument"
It looks like I'll go the less flexible way to code a list of commands
to execute.
Frustrated
Martin
On 17.03.2008 01:44 Andy Lego wrote:
> 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.
More information about the CMake
mailing list