title: clang++: rpath in executable not the same as in compiler configuration
body: <p>I am installing clang from source using CMake. I have a gcc 4.9.2 installation in a non-system path e.g. /gcc/path/.</p>
  
  <p>I use the recommended:</p>
  
  <pre><code>CC=... CXX=... cmake -DCMAKE_GCC_INSTALL_DIR=... -DCMAKE_EXE_LINKER_FLAGS="-Wl,-rpath,/gcc/path/lib64"
  </code></pre>
  
  <p>This compiles my sample code fine and when I</p>
  
  <pre><code>readelf -d clang++ | grep RPATH
  </code></pre>
  
  <p>it correctly outputs my specified rpath. However, the compiled object file doesn't contain any RPATH and gives me the error:</p>
  
  <pre><code>/usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.15' not found
  </code></pre>
  
  <p>I know the above error occurs because the library search path is not specified correctly. But I want to avoid setting LD_LIBRARY_PATH and wanted to pass the correct linker flags through cmake.</p>
  
  <p>Interestingely when I compile using the following:</p>
  
  <pre><code>clang++ sample.cpp -std=c++11 -Wl,-rpath,/gcc/path/lib64
  </code></pre>
  
  <p>the executable does contain the correct rpath. I dont want to specify this compiler flag explicitly though and want the object file to use the rpath that the compiler was configured with. Is that possible through a cmake build? If so how?</p>