[CMake] rpath to libstdc++.so

Bill Newcomb bnewcomb at nvidia.com
Wed Mar 4 18:29:47 EST 2015


In cmake 2.6, I could do something kind of bogus like this:

  get_filename_component(MY_COMPILER_PREFIX ${CMAKE_C_COMPILER} PATH)
  set(MY_RPATH ${MY_COMPILER_PREFIX}/../CentOS-5.7/x86_64/lib)
  link_directories(${MY_RPATH})
  set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
  set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)                                                                                      

and cmake would add an rpath to the libstdc++.so so I didn't have to 
set LD_LIBRARY_PATH to run executables that I built.

I know it's hideously non-portable, but this is for a project that has
rather minimal portability requirements.   

That behavior seems to no longer be present in cmake 3.x.  Is there a 
different way to achieve the same end?

Thanks,
B.

-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------


More information about the CMake mailing list