[CMake] Installing generated files

Boris Boesler baembel at gmx.de
Thu Aug 28 06:19:46 EDT 2008


Hi!

  I'm trying to install some generated files (example):

CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
SET(XFILE foo.x)
SET(ZFILE foo.z)
SET_SOURCE_FILES_PROPERTIES(${ZFILE} PROPERTIES GENERATED TRUE)
ADD_CUSTOM_COMMAND(OUTPUT ${ZFILE}
   COMMAND cp
   ARGS ${XFILE} ${ZFILE}
   DEPENDS ${XFILE}
   WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
# ??
INSTALL(FILES ${ZFILE} DESTINATION zfiles)
#INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${ZFILE} DESTINATION zfiles)
ADD_CUSTOM_TARGET(${ZFILE} ALL)

 > mkdir build; cd build; cmake -DCMAKE_INSTALL_PREFIX=$PWD/ 
install ..; make

  make reports that the target is built, but the file is not generated/ 
copied. If I try to install the file I get an error message that the  
file does not exits (which is true):
CMake Error at cmake_install.cmake:31 (FILE):
   file INSTALL cannot find file
   "/tmp/foo.z" to install.

  That worked in cmake 2.4 (I think I can remember) but it fails in  
cmake 2.6. Does this happen because there is no EXECUTABLE and no  
LIBRARY to build? How can I solve this?

Thanks in advance,
Boris



More information about the CMake mailing list