[CMake] generating source files with ADD_CUSTOM_COMMAND

Hicham Mouline hicham at mouline.org
Thu Jul 1 15:29:32 EDT 2010


That must be it, obvious indeed,

 

Thank you,

 

From: David Cole [mailto:david.cole at kitware.com] 
Sent: 01 July 2010 20:27
To: Hicham Mouline
Cc: cmake at cmake.org
Subject: Re: [CMake] generating source files with ADD_CUSTOM_COMMAND

 

Did you build yet?

 

Custom commands are executed at build time, not at cmake configure time.

 

On Thu, Jul 1, 2010 at 3:21 PM, Hicham Mouline <hicham at mouline.org> wrote:

I added the -E, no difference.

 

Shouldn't an error have been printed the first time round when I didn't have
the -E.  There was no error.

I traced it and the ADD_CUSTOM_COMMAND was in the trace.

Is this an indication that line is not executed at all?

 

From: David Cole [mailto:david.cole at kitware.com] 
Sent: 01 July 2010 19:58
To: Hicham Mouline
Cc: cmake at cmake.org
Subject: Re: [CMake] generating source files with ADD_CUSTOM_COMMAND

 

I think you mean:

${CMAKE_COMMAND} -E copy src dst

 

You forgot the -E.

 

 

On Thu, Jul 1, 2010 at 2:38 PM, Hicham Mouline <hicham at mouline.org> wrote:

Hello

I'm trying to generate source files .cxx and include them in ADD_LIBRARY to
build a static library, according to
http://www.cmake.org/Wiki/CMake_FAQ#How_can_I_generate_a_source_file_during_
the_build.3F

#
# Copy template source files to *.cxx and place them in the build dir
#
ADD_CUSTOM_COMMAND(
 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/name.cxx
${CMAKE_CURRENT_BINARY_DIR}/widget.cxx
 COMMAND ${CMAKE_COMMAND} copy
${CMAKE_SOURCE_DIR}/systems/template_name.cpp
${CMAKE_CURRENT_BINARY_DIR}/name.cxx
 COMMAND ${CMAKE_COMMAND} copy
${CMAKE_SOURCE_DIR}/systems/template_widget.cpp
${CMAKE_CURRENT_BINARY_DIR}/widget.cxx
 DEPENDS ${CMAKE_SOURCE_DIR}/template_name.cpp
${CMAKE_SOURCE_DIR}/systems/template_widget.cpp
)



 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100701/fa158e5e/attachment.htm>


More information about the CMake mailing list