Layfon Weller
Layfon Weller

Reputation: 373

Have cmake check version at install time

I have a cmake script that add a "add_custom_command" that generate a program version anytime the program is compiled. That creates a Header File. It works fine...

Now, what I want to do is to have cmake use value from said file during installation and packaging. Parsing the file is of no worry. What I don't know is how do I ask cmake to parse it just before installing, since it would have been modified during the compilation.

Upvotes: 0

Views: 89

Answers (1)

SethMMorton
SethMMorton

Reputation: 48725

You should check out some of the capabilities of the INSTALL command

INSTALL(CODE "CMAKE_CODE_THAT_PARSES_FILE")

or

INSTALL(SCRIPT CMAKE_Parsing_Script.cmake)

These will be executed at install time.

Upvotes: 1

Related Questions