[CMake] install() rename with version string

Hendrik Sattler post at hendrik-sattler.de
Fri Jan 20 06:03:57 EST 2017



Am 20. Januar 2017 09:36:54 MEZ schrieb Wagner Martin <Martin.Wagner at neuberger.net>:
> 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.

Well, the second install command has the wrong scope:
install(CODE "include(version.cmake)")
install(FILES firmware.hex 
RENAME  firmware_\${version_string}.hex
DESTINATION firmware)        

-- 
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.


More information about the CMake mailing list