[cmake-developers] [CMake 0013560]: Ninja: -Wl, -rpath, '$ORIGIN/foobar' not working correctly in CMAKE_EXE_LINKER_FLAGS

Mantis Bug Tracker mantis at public.kitware.com
Tue Sep 25 11:48:45 EDT 2012


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=13560 
====================================================================== 
Reported By:                Andreas Langs
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   13560
Category:                   CMake
Reproducibility:            always
Severity:                   major
Priority:                   high
Status:                     new
====================================================================== 
Date Submitted:             2012-09-25 17:48 CEST
Last Modified:              2012-09-25 17:48 CEST
====================================================================== 
Summary:                    Ninja: -Wl, -rpath,'$ORIGIN/foobar' not working
correctly in CMAKE_EXE_LINKER_FLAGS
Description: 
I used the testcase from issue http://public.kitware.com/Bug/view.php?id=13069
and added to the CMakeLists.txt file below line 16:
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath,'$ORIGIN/foo'")

Then I used the Ninja generator to generate the ninja build files and built it
using ninja 1.0.0.

Inspecting the resulting executable with "objdump -p flags" it shows: "RPATH
/foo"

Using the Makefile generator and building it with make gives the expected entry
shown by objdump: "RPATH $ORIGIN/foo".

Looking at the build.ninja file generated by cmake I see this line:
LINK_FLAGS = -Wl,-rpath,'$ORIGIN/unitTests'

Changing it to:
LINK_FLAGS = -Wl,-rpath,'$$ORIGIN/unitTests'
(double $$) gives the correct RPATH entry in the executable.

It seems as if there needs to be some escaping done with "$" signs when
generating build.ninjs files.



====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2012-09-25 17:48 Andreas Langs  New Issue                                    
======================================================================




More information about the cmake-developers mailing list