I found Cmake: How to set rpath to ${ORIGIN} with cmake but my cmake does not have target_link_options.
I'm not installing the binary, I'm only "installing" it with RUNTIME_OUTPUT_DIRECTORY, so I don't think CMAKE_INSTALL_RPATH will work. Even though, I tried SET(CMAKE_INSTALL_RPATH "$\{ORIGIN\}") as suggested in the question, but I got
Syntax error in cmake code at
.../CMakeLists.txt:25
when parsing string
$\{ORIGIN\}
Invalid escape sequence \{
I need to set this rpath which I was using in Makefile:
-rpath=\$$ORIGIN/lib
How to do it in cmake?