Got warning "Cannot generate a safe runtime search"

I write two lines of find_library in my project,


the first one finds, and the second one finds

And i got the following warning,

CMake Warning at cmake/core.cmake:68 (add_executable):
  Cannot generate a safe runtime search path for target test_analyze_ir
  because files in some directories may conflict with libraries in implicit

    runtime library [] in /usr/local/cuda/lib64/stubs may be hidden by files in:

  Some of these libraries may not be found correctly.

I think cmake is confusing about these two dso?

CMake is saying that you have library A in directory X and library B in directory Y. However, a library of name A also exists in Y and B in X. Therefore, there is no rpath setting that will guarantee that the libraries chosen at build time will actually be used because instead of X/A and Y/B, the runtime will instead find either X/A and X/B or Y/A and Y/B.