I want to set the RPATH in CMake to $ORIGIN
. I am cross-compiling for a Linux system on my Windows machine. I need to set the RPATH property to $ORIGIN
. For that I use the following code.
set_target_properties(LibraryName PROPERTIES INSTALL_RPATH "\$ORIGIN")
What I get is \$ORIGIN
.
I also tried different ways to escape the $ sign
set_target_properties(LibraryName PROPERTIES INSTALL_RPATH "$ORIGIN") -> \$ORIGIN
set_target_properties(LibraryName PROPERTIES INSTALL_RPATH $ORIGIN) -> \$ORIGIN
set_target_properties(LibraryName PROPERTIES INSTALL_RPATH \$ORIGIN) -> \$ORIGIN
set_target_properties(LibraryName PROPERTIES INSTALL_RPATH "\\\$ORIGIN") -> \\\$ORIGIN
When I cross-compile the same project using a Linux machine, than it works. Meaning "\$ORIGIN"
-> $ORIGIN
.
I already opened a defect in the CMake Issue Tracker, but that takes some time I guess. Is there a workaround how I can set the RPATH in Windows? Maybe some command line tool or other hack? ;-)
EDIT
I tried even more things:
set_target_properties(LibraryName PROPERTIES INSTALL_RPATH [=[$ORIGIN]=]) => \$ORIGIN
set(ORIGIN_RPATH [=[$ORIGIN]=])
set_target_properties(FancyLibrary PROPERTIES INSTALL_RPATH ${ORIGIN_RPATH}) => \$ORIGIN
cmake_policy(SET CMP0095 OLD) + any of the mentioned variations => \$ORIGIN
When I look into the build.make file I find the escaped linker option -Wl,-rpath,"\$$ORIGIN"
Is there a way to at least manipulate the generated build.make before it is executed?