[CMake] Copying files

Tyler Roscoe tyler at cryptio.net
Wed Jul 22 21:07:00 EDT 2009


On Wed, Jul 22, 2009 at 05:13:54PM -0700, ML wrote:
> I have:
> 
> PROJECT(expat)
> CMAKE_MINIMUM_REQUIRED (VERSION 2.6 FATAL_ERROR)
> SET(SRCS xmlparse.c
> 		xmlrole.c
> 		xmltok.c
> 		#xmltok_impl.c
> )
> 
> ADD_LIBRARY(expat ${SRCS})
> 
> COMMAND ${CMAKE_COMMAND} -E copy libexpat.a ${PROJECT_SOURCE_DIR}/$ 
> {INSTALL_DIR}

You can't just say COMMAND like that. I'm sure CMake told you that,
right?

You need an add_custom_command(), probably a POST_BUILD step. Look in
the docs for add_custom_command and in the FAQ at the sections about
generating headers.

Oh, and you probably want -E copy_if_different. This will likely save
you some unnecessary rebuilds down the line.

tyler


More information about the CMake mailing list