Quantcast

install() rename with version string

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

install() rename with version string

Wagner Martin

Hello,

 

I’ve searched for some time, but didn’t find anything useful. Most finds deal with including version system stuff passed to header files for compilation.

 

I want to achieve something like that:

Include(version.cmake)

install(FILES firmware.hex  RENAME  firmware_${version_string}.hex)

 

where version.cmake is created like explained in this mail https://cmake.org/pipermail/cmake/2010-July/038015.html alongside headers needed for compilation.

 

However, CMake needs to include version.cmake at first CMake run time, which is not possible because it’s a generated file.

 

Is there any other way to do the rename?

 

Thanks for your help!

 

Regards,

Martin


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: install() rename with version string

Eric Noulard
You can try:

include(version.cmake OPTIONAL)


which will make include tolerate the absence of version.cmake,

but then your install statement will only be OK after version.cmake has been created.




2017-01-19 9:30 GMT+01:00 Wagner Martin <[hidden email]>:

Hello,

 

I’ve searched for some time, but didn’t find anything useful. Most finds deal with including version system stuff passed to header files for compilation.

 

I want to achieve something like that:

Include(version.cmake)

install(FILES firmware.hex  RENAME  firmware_${version_string}.hex)

 

where version.cmake is created like explained in this mail https://cmake.org/pipermail/cmake/2010-July/038015.html alongside headers needed for compilation.

 

However, CMake needs to include version.cmake at first CMake run time, which is not possible because it’s a generated file.

 

Is there any other way to do the rename?

 

Thanks for your help!

 

Regards,

Martin


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake



--
Eric

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: install() rename with version string

Wagner Martin
That doesn't work as CMake seems to only evaluate the include() statement once at first run. With the OPTIONAL statement, my project builds, but the ${version_string} variable is not populated.



Von: Eric Noulard [mailto:[hidden email]]
Gesendet: Donnerstag, 19. Januar 2017 13:00
An: Wagner Martin
Cc: [hidden email]
Betreff: Re: [CMake] install() rename with version string

You can try:

include(version.cmake OPTIONAL)

which will make include tolerate the absence of version.cmake,
but then your install statement will only be OK after version.cmake has been created.



2017-01-19 9:30 GMT+01:00 Wagner Martin <[hidden email]>:
Hello,
 
I’ve searched for some time, but didn’t find anything useful. Most finds deal with including version system stuff passed to header files for compilation.
 
I want to achieve something like that:
Include(version.cmake)
install(FILES firmware.hex  RENAME  firmware_${version_string}.hex)
 
where version.cmake is created like explained in this mail https://cmake.org/pipermail/cmake/2010-July/038015.html alongside headers needed for compilation.
 
However, CMake needs to include version.cmake at first CMake run time, which is not possible because it’s a generated file.
 
Is there any other way to do the rename?
 
Thanks for your help!
 
Regards,
Martin

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake




--
Eric
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: install() rename with version string

Gonzalo Garramuno
In reply to this post by Wagner Martin



El 19/01/17 a las 05:30, Wagner Martin escribió:

However, CMake needs to include version.cmake at first CMake run time, which is not possible because it’s a generated file.

 

Is there any other way to do the rename?

 

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 )
-- 
Gonzalo Garramuño

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: install() rename with version string

Hendrik Sattler


Am 19. Januar 2017 15:26:47 MEZ schrieb "Gonzalo Garramuño" <[hidden email]>:

>
>
>El 19/01/17 a las 05:30, Wagner Martin escribió:
>>
>> However, CMake needs to include version.cmake at first CMake run
>time,
>> which is not possible because it’s a generated file.
>>
>> Is there any other way to do the rename?
>>
>>
>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.

HS

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

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: install() rename with version string

Wagner Martin
 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.
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: install() rename with version string

Hendrik Sattler


Am 20. Januar 2017 09:36:54 MEZ schrieb Wagner Martin <[hidden email]>:

> 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.
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Loading...