rpath in LDFLAGS for CMAKE

837 Views Asked by At

I am currently porting my automake into CMAKE. I am trying to find what's equivalent of:

myprogram_LDFLAGS = \
   -lcurl \
   -ldl \
   -lresolv \
    -Wl,-rpath,'/approot/services/lib'

What is the corresponding command in cmake to set my rpath?

set(CMAKE_INSTALL_RPATH "/approot/services/lib")

The above command seems to be related to the install time. Whereas, LDFLAGS are linker related.

1

There are 1 best solutions below

1
ssk On BEST ANSWER

This worked for me:

set_target_properties(${TARGET} PROPERTIES LINK_FLAGS "-Wl,-rpath,'/approot/services/lib'")