I have a project that needs to be built with an LLVM pass. Here is the project structure:
proj/
instrumentation/
CMakeLists.txt
Instrumentation.cpp
[My project files]
CMakeLists.txt
instrumentation/CMakeLists.txt
has a target to build the LLVM pass called MyPass
.
I've added the following the CMakeLists.txt
:
add_subdirectory(instrumentation)
add_compile_options(
"SHELL:-Xclang -load"
"SHELL:-Xclang $<TARGET_FILE:MyPass>")
Now I just need to add MyPass
as a dependency for all the targets in my project. I was wondering if there was a way to force MyPass
to build first so that when compiling other files, the LLVM pass would be present. Maybe there a way to add a target compile_options
dependencies?
Note: I'd rather not add the dependency manually to every target because there many targets in the project.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…