[CMake] Copying files

Mike Jackson mike.jackson at bluequartz.net
Wed Jul 22 21:28:23 EDT 2009


I'll save you some time. Here is the version of Expat that I use. It
is tested on OS X, Linux and Windows (VS and MinGW).

<http://www.bluequartz.net/cgi-bin/gitweb/gitweb.cgi?p=expat.git;a=snapshot;h=refs/heads/master;sf=tgz>

Then if you go to
<http://www.bluequartz.net/cgi-bin/gitweb/gitweb.cgi?p=MXADataModel.git;a=blob_plain;f=Resources/CMake/MXAFindExpat.cmake;hb=HEAD>
that is the CMake module that will properly find the Expat library
that you compiled since it uses some slightly different naming
conventions from the norm.

Also let me state that copying built binaries back into the Source
directory may be a bad idea. What is the point of the copy? To create
a distribution? Look forward to using CPack for creating your
distributions instead of copying binaries back into the source tree
and dirtying that up with built products.

For a simple "Distribution" just keep setting CMAKE_INSTALL_PREFIX to
the same path for all of your projects, such as
/opt/Sandbox/MyProjectDistribution on a unix machine. Then you just
have to simple package up the installation tree (as a hack) or write
some CPack rules to pack up the whole thing for you.

Either way, my expat variant is all under a BSD license (at least the
parts that I wrote) so use what you want from it and let me know if
you find things that could be improved upon.)

Mike Jackson


On Wed, Jul 22, 2009 at 9:07 PM, Tyler Roscoe<tyler at cryptio.net> wrote:
> 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
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>



-- 
Mike Jackson                               mike.jackson at bluequartz.net
BlueQuartz Software                    www.bluequartz.net


More information about the CMake mailing list