Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8927115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:08:47+00:00 2026-06-15T08:08:47+00:00

So, if you already have a binary, you can add an rpath to it

  • 0

So, if you already have a binary, you can add an rpath to it on OSX using the ‘install_name_tool’, as so:

install_name_tool -add_rpath @executable_path/blah

xcode does this automatically when you’re building an application bundle.

I know that in cmake you can use this to set the install_name of the shared library:

set_target_properties(nshared PROPERTIES BUILD_WITH_INSTALL_RPATH 1 INSTALL_NAME_DIR "@rpath")

My question is, what’s the equivalent of this to add an rpath to a binary?

(for the ‘why would you do that?’ amongst you, go look at the otool -l on any of the apps in your Applications/ folder and you’ll see plenty of apps with entries like:

Load command 15
          cmd LC_RPATH
      cmdsize 36
         path @executable_path/../../Frameworks/

This is standard practice. I’m just trying to do it in cmake)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T08:08:47+00:00Added an answer on June 15, 2026 at 8:08 am

    You can use a POST_BUILD command to add an LC_RPATH load command to the built executable:

    add_custom_command(TARGET executable 
        POST_BUILD COMMAND 
        ${CMAKE_INSTALL_NAME_TOOL} -add_rpath "@executable_path/../../Frameworks/"
        $<TARGET_FILE:executable>)
    

    The variable CMAKE_INSTALL_NAME_TOOL contains the path to the install_name_tool executable under Darwin.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

can i achieve this with php (LINUX machine): i have php binary already running,
I can not compile, this program is giving me errors. I have already spend
I already have my azure web role running in cloud using azure sdk 1.6.
I have already have this code to force these URLs to HTTPS: RewriteCond %{HTTPS}
I already have this issue but I cannot remember how to solved it. (I
First, I have already read C++ Binary Search Tree status access violation error with
I know there are several questions like this on here already, but I can't
I have already looked at this question and even though the question titles seem
We already have the database with real data inside. Now we want to build
i already have a project with TreeNode class which creates a hierachy of nodes

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.