Multiple out-of-source passes in single library

Hello everyone,

I am developing a bunch of LLVM Analysis passes and I want to bundle them in a single library. I have been following the guide from [1].

Lets say my analyses are implemented in Pass_A.cpp and Pass_B.cpp. Both of them contain the `RegisterPass’ directive. The CMakeLists.txt file contains

add_llvm_loadable_module(LLVMSomeName Pass_A.cpp Pass_B.cpp)

Building the library works, and I can call

opt -load …/lib/libLLVMSomeName.so

However, only Pass_A is available. The flag for Pass_B is not recognized.
Note that Pass_B depends on Pass_A, i.e. its getAnalysisUsage' adds the respective dependence, and getAnalysis<Pass_A>()’ is called.

I am looking forward to your advice.

Thanks & regards,
Immanuel

[1]