Answer the question
In order to leave comments, you need to log in
How can Cmake describe non-source dependency and post-copy?
There is a configuration file (not the source) of a part of the project, when it is changed, it is necessary to run a Python script that regenerates the sources.
How to describe? But so that only when changing the configuration file.
How to run python script after linking?
Answer the question
In order to leave comments, you need to log in
You will most likely be helped by add_custom_command with the OUTPUT and DEPENDS options.
Example:
add_executable(
my_target
path/to/generated/file_1
path/to/generated/file_2
)
add_custom_command(
OUTPUT # Файлы, которые генерируем
path/to/generated/file_1
path/to/generated/file_2
COMMAND # Команда генерации
python generate.py
DEPENDS # Файл конфига (CMake должен сам отслеживать изменения этого файла и вызывать COMMAND если это необходимо)
path/to/config.cfg
)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question