[CMake] install() rename with version string

Wagner Martin Martin.Wagner at neuberger.net
Fri Jan 20 03:36:54 EST 2017


 Thanks for your answers.
 
 > >You will need to do the install as another target/command.  For
> >example:
> >
> >add_custom_command( TARGET version
> >                                         POST_BUILD
> >                                         COMMAND ${CMAKE_COMMAND} -D
> >VERSION=${version_string}
> >                                         -P install_commands.cmake
> >                                         USES_TERMINAL )
> 
> Or even simpler, do all of that in the install_commands.cmake by using
> install(CODE) AND escaping the $.
> Just looking at the generated install_commands.cmake will make this much
> clearer.
> 

I think I don't properly understand what you mean. Can you please give me an example?

I've tried

install(CODE "
          Include(version.cmake)
          install(FILES firmware.hex  RENAME  firmware_\${version_string}.hex DESTINATION firmware)        
")

This is correctly expanded in generated "cmake_install.cmake" script, runs without errors, but does not install the file.


More information about the CMake mailing list