On 01/11/2011 12:55 AM, Tobias Ellinghaus wrote: > Am Montag, 10. Januar 2011 schrub Eric Noulard: >> 2011/1/10 Tobias Ellinghaus <h...@gmx.de>: >>> Hello, >>> >>> I create some files inside of CMAKE_CURRENT_BINARY_DIR using >>> configure_file(). These are not installed but needed for compiling the >>> program. When creating a .tgz file with make package_source these files >>> are not included so that the >> >> package_source will include all file inside CMAKE_SOURCE_DIR >> so if you are doing out-of-source build the observed behavior is the >> expected one. >> >>> resulting source package is basically useless. >> >> WHY do you think so ? >> WHY you want to put GENERATED file inside your source .tgz? >> Do you expect your user to build from source without CMake? > > No, reasons at the end of the mail. > >>> Is there a way to add these files? I have searched through google and the >>> list archives and only found http://www.cmake.org/Bug/view.php?id=8438 >> >> I cannot see the relationship between your issue and the refered bug? > > If I understood the issue in that bug correctly it would allow me to force > cmake to copy/move the files into the source tree before packaging and remove > them afterwards. > >>> 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.
You might use "cmake --build" in conjunction with a custom target: CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR) PROJECT(PKGSRC NONE) IF(EXISTS ${CMAKE_SOURCE_DIR}/manifest.txt) # In packaged source tree. FILE(COPY ${CMAKE_SOURCE_DIR}/manifest.txt DESTINATION ${CMAKE_BINARY_DIR}) ELSE() # In original source tree. FILE(WRITE ${CMAKE_BINARY_DIR}/manifest.txt "...\n") INCLUDE(CPack) ADD_CUSTOM_TARGET(pkgsrc COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/manifest.txt ${CMAKE_SOURCE_DIR}/manifest.txt COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target package_source COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_SOURCE_DIR}/manifest.txt ) ENDIF() The pkgsrc target prepares the source tree for packaging, builds the source package via "cmake --build" and cleans up. AFAICS, writing to the source tree is unavoidable in order to achieve your aim, perhaps unless you copy the whole source tree to a subdirectory of the build tree, prepare and configure it in another subdirectory and build the regular package_source target in there. :[ Regards, Michael _______________________________________________ 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