Reputation: 1538
My CMakeLists.txt needs to include oem.cmake as
INCLUDE (oem.cmake)
The content of oem.cmake looks like
SET (PRODUCT_NAME "...")
SET (PRODUCT_VENDOR "...")
...
but it must be generated by a lua script
lua generate_oem_conf.lua "<oem>"
I tried ADD_CUSTOM_COMMAND, but it will not be executed and reports oem.cmake is not found.
Any way to make oem.cmake to generate before including?
Upvotes: 0
Views: 366
Reputation: 760
The problem is, that the command that you give to add_custoum_command runs when you compile your program.
include needs the file you want to include during configuration, i.e. when you run cmake.
You can use execute_process for commands you want to run during configuration.
For example
execute_process(COMMAND "lua" "generate_oem_conf.lua \"<oem>\""
WORKING_DIRECTORY ${PATH_TO_GEN_LUA_FILE} )
include(oem.cmake)
For this to work lua has to be in your PATH. Maybe you have to escape the < and > characters.
Upvotes: 1