2011/1/11 Tobias Ellinghaus <h...@gmx.de>:
> Am Montag, 10. Januar 2011 schrub Eric Noulard:
>
>> > which would at least allow to copy the files into
>> > CMAKE_CURRENT_SOURCE_DIR.
>>
>> You may generate those file (with configure_file) inside your source tree
>> and the generated file will be packaged by "package_source", but again
>> WHY do you want to include a generated file inside your source package?
>
> Because some information (like latest git commit as version string) is no
> longer available when using a source package. Of course I can put the
> generated files into the source tree, but that's kind of against the idea of
> out-of-source builds.

Ok I understand but your source package is meant to be built with
CMake too right?
So you have to handle the case "Am I" building from git source tree or from
"package source" tree from within your CMakeLists.txt ?

So you can perfectly add something like:

supposed GIT_TREE is true if your are configuring a git tree:

if (GIT_TREE)
   configure_file(whatever.h.in ${CMAKE_CURRENT_BINARY_DIR}/whatever.h)
   configure_file(whatever.h.in ${CMAKE_CURRENT_SOURCE_DIR}/whatever.h.srctree)
else(GIT_TREE)
   configure_file(whatever.h.srctree
${CMAKE_CURRENT_BINARY_DIR}/whatever.h @COPYONLY)
endif(GIT_TREE)

the "whatever.h.srctree" is your generated file that will be package
with your source tree
but it will only be used if you are building from a non GIT source tree.

and... you can do out-of-source build in both cases.

concerning the fact that:
> Of course I can put the
> generated files into the source tree, but that's kind of against the idea of
> out-of-source builds.

That's true but in any case you want your source package to contain the file
so the file WILL end up in the source tree when building from package
source right ?

-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
_______________________________________________
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

Reply via email to