With COMGR_STATIC_LLVM=ON, comgr sets LLVM_LINK_LLVM_DYLIB/CLANG_LINK_CLANG_DYLIB OFF near the top of the file, before find_package.
A later include(opencl_header) re-runs find_package(Clang), which re-reads the Clang/LLVM package config and flips both vars back ON — so by the time the link libraries are resolved, comgr links the dynamic libLLVM.so/libclang-cpp.so even though a static build was requested.
#2926 takes a stab at this by disabling those flipped vars again, but ideally we should separate out the Comgr choice to statically link in those libraries, from the build type of the underlying LLVM build.
With
COMGR_STATIC_LLVM=ON, comgr setsLLVM_LINK_LLVM_DYLIB/CLANG_LINK_CLANG_DYLIB OFFnear the top of the file, before find_package.A later
include(opencl_header)re-runsfind_package(Clang), which re-reads the Clang/LLVM package config and flips both vars back ON — so by the time the link libraries are resolved, comgr links the dynamic libLLVM.so/libclang-cpp.so even though a static build was requested.#2926 takes a stab at this by disabling those flipped vars again, but ideally we should separate out the Comgr choice to statically link in those libraries, from the build type of the underlying LLVM build.