We have legacy project, which uses proprietary build system. We want to port it to CMake. Before build step we have script, which generates code based on comments inside of source files.
I tried to embed it using add_custom_target,add_custom_command, but it fails, because
- Script should run before all build (it shouldn't run parallel with other targets)
- We have lots of small libraries, which all depend on this script, but it should be ran only one time.
Currently my setup is as follows.
add_library(${PROJECT_NAME} INTERFACE) .... target_link_libraries(${PROJECT_NAME} ${MANY_SMALL_LIBRARIES}) I can't add PRE_BUILD step for interface library.
PRE_BUILD?PRE_BUILDwith interface libraryadd_dependenciesbut command was running for every library (instead of once)