I am using CMake in to custom create files on the fly from files that exist in a specified location. This is my code:
file(GLOB files "${path}/*.data")
file(GLOB sidedata "${path}/*.sidedata")
foreach(file ${files})
get_filename_component(name ${file} NAME_WE)
add_custom_command(
OUTPUT "${name}.library"
DEPENDS ${path} ${file} ${sidedata} ${CMAKE_CURRENT_SOURCE_DIR}/makelibrary.pl
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/makelibrary.pl ARGS ${sidedata} ${file}
COMMENT "Generating ${name}.library"
)
add_custom_target(${name}.target ALL DEPENDS ${name}.library)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${name}.library DESTINATION ${somewhere})
endforeach()
The issue I am seeing that the files
and sidedata
are cached - if a new file is added to path
location it will not be detected; if a file is removed, the dependency check fails.
How do I resolve this problem?
Just to close this question, I followed the Fraser's suggestion : rerun plain cmake <source area>
to update the file list.
Also, the variables were not in the cache.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With