2012-06-27 2 views
2

현재 다음 구문을 사용하여 RPATH를 설정 중입니다. SET (CMAKE_INSTALL_RPATH "$ {CMAKE_INSTALL_RPATH} : $ ORIGIN /../ lib") cmake를 사용하여 이진 빌드에서 작동합니다. 제 3 자 바이너리에서 작동하지 않는 문제입니다. cmake를 사용하여 자동 구성 스크립트를 사용하여 빌드하고 있습니다. 나는 세 번째 경로 구성의 모양에 의해 생성 된구성을위한 CMake 탈출 변수

add_custom_target(
        third_party_bin ALL 
        COMMAND ./configure 
        --with-ld-opt=\"-Wl,-rpath,${CMAKE_INSTALL_RPATH}\" 
        --prefix=${CMAKE_INSTALL_PREFIX} 
       ) 

만들기 파일이 좋아하는 구성에 대해 다음 명령을 사용하고 "-Wl, -rpath을 'RIGIN /../ lib 디렉토리'-lstdC++"

은 내가 생각 $ {CMAKE_INSTALL_RPATH}을 (를) 올바르게 이스케이프 처리해야합니다. 또한

add_custom_target(
        third_party_bin ALL 
        COMMAND ./configure 
        --with-ld-opt=\"-Wl,-rpath,\$\$ORIGIN/../lib\" 
        --prefix=${CMAKE_INSTALL_PREFIX} 
       ) 

add_custom_target(
        third_party_bin ALL 
        COMMAND ./configure 
        --with-ld-opt=\"-Wl,-rpath,\\$\$ORIGIN/../lib\" 
        --prefix=${CMAKE_INSTALL_PREFIX} 
       ) 

하지만 아무것도 작동하지 않습니다 같은 옵션을 사용했습니다.

올바른 값을 이스케이프하는 방법은 무엇입니까?

답변

-1

제대로 읽으면 쉘이 $ 변수를 해석하지 못하도록 할 것입니다 ... 그렇다면 두 배 (") 대신 작은 따옴표 (')를 사용하십시오. 작은 따옴표

0

add_custom_target가 그대로 인수를 받아들이는 문서에 따르면 :..

If VERBATIM is given then all arguments to the commands will be 
    escaped properly for the build tool so that the invoked command 
    receives each argument unchanged. Note that one level of escapes is 
    still used by the CMake language processor before add_custom_target 
    even sees the arguments. Use of VERBATIM is recommended as it enables 
    correct behavior. When VERBATIM is not given the behavior is platform 
    specific because there is no protection of tool-specific special 
    characters.