2

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.

ssk
  • 9,045
  • 26
  • 96
  • 169

1 Answers1

1

This worked for me:

set_target_properties(${TARGET} PROPERTIES LINK_FLAGS "-Wl,-rpath,'/approot/services/lib'")
ssk
  • 9,045
  • 26
  • 96
  • 169
  • The full CMake equivalent would probably also include: `target_link_libraries(${TARGET} PUBLIC curl dl resolv)` – Kevin Oct 09 '19 at 20:33