[Cmake] Undefined ${CMAKE_COMMAND} in POST_INSTALL_SCRIPT

Andy Cedilnik andy.cedilnik at kitware.com
Thu Sep 9 09:42:37 EDT 2004


Hi Anton,

When you run CMake install, the variable that were available during
CMake run are not available. What you really want to do is to configure
postInstall.cmake file:

CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/postInstall.cmake.in
  ${CMAKE_CURRENT_BINARY_DIR}/postInstall.cmake @ONLY)

Then you put postInstall.cmake.in to contain:

FOREACH(file @FILES_TO_INSTALL@)
  MESSAGE(@CMAKE_COMMAND@
        "  " ${file} "  " @CMAKE_INSTALL_PREFIX@)
#  EXEC_PROGRAM(@CMAKE_COMMAND@
#               ARGS copy ${file}
@CMAKE_INSTALL_PREFIX@/share/cisst/doc/doxygen)
ENDFOREACH(file)

or 
MESSAGE("Install doxygen files")
FILE(INSTALL 
  DESTINATION "@CMAKE_INSTALL_PREFIX@/share/cisst/doc/doxygen"
  TYPE FILE
  FILES @FILES_TO_INSTALL@)

			Andy

On Thu, 2004-09-02 at 15:11, Anton Deguet wrote:
> I'm having a problem I really can't figure in a CMake post install
> script.  I am using SET_TARGET_PROPERTIES as follows:
> 
> # Install the pdf file
> INSTALL_TARGETS(/share/cisst/doc/doxygen
>                 ${cisstDocDoxygen_BINARY_DIR}/latex/refman.pdf)
> 
> 
> # Install the html files generated
> SET_TARGET_PROPERTIES(${cisstDocDoxygen_BINARY_DIR}/latex/refman.pdf
>                       PROPERTIES POST_INSTALL_SCRIPT
>                       ${CMAKE_CURRENT_SOURCE_DIR}/postInstall.cmake)
> 
> The install script has the following code:
> 
> MESSAGE("Custom installation of Doxygen HTML pages")
> 
> # List of files to install
> FILE(GLOB FILES_TO_INSTALL html/*.*)
> 
> # Copy these files using CMake to remain portable
> FOREACH(file ${FILES_TO_INSTALL})
> MESSAGE(${CMAKE_COMMAND}
>         "  " ${file} "  " ${CMAKE_INSTALL_PREFIX})
> #  EXEC_PROGRAM(${CMAKE_COMMAND}
> #               ARGS copy ${file}
> ${CMAKE_INSTALL_PREFIX}/share/cisst/doc/doxygen)
> ENDFOREACH(file)
> 
> when I try "make install", the first message appears correctly but the
> variables ${CMAKE_COMMAND} and ${CMAKE_INSTALL_PREFIX} are empty.
> 
> What should I do?  I could probably define CMAKE_COMMAND but I need to
> pass the current value of CMAKE_INSTALL_PREFIX.




More information about the Cmake mailing list