cmake: create a relative symlink to clang, not absolute

Hardcoding the location of the build directory seems like it would
break at `make install`/packaging time.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150201 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dylan Noblesmith 2012-02-09 20:02:46 +00:00
Родитель a34e921165
Коммит 3d9000dc90
1 изменённых файлов: 4 добавлений и 3 удалений

Просмотреть файл

@ -40,16 +40,17 @@ set_target_properties(clang PROPERTIES VERSION ${CLANG_EXECUTABLE_VERSION})
if(UNIX)
set(CLANGXX_LINK_OR_COPY create_symlink)
# Create a relative symlink
set(clang_binary "clang${CMAKE_EXECUTABLE_SUFFIX}")
else()
set(CLANGXX_LINK_OR_COPY copy)
set(clang_binary "${LLVM_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/clang${CMAKE_EXECUTABLE_SUFFIX}")
endif()
# Create the clang++ symlink in the build directory.
set(clang_pp "${LLVM_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/clang++${CMAKE_EXECUTABLE_SUFFIX}")
add_custom_command(TARGET clang POST_BUILD
COMMAND ${CMAKE_COMMAND} -E ${CLANGXX_LINK_OR_COPY}
"${LLVM_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/clang${CMAKE_EXECUTABLE_SUFFIX}"
"${clang_pp}")
COMMAND ${CMAKE_COMMAND} -E ${CLANGXX_LINK_OR_COPY} "${clang_binary}" "${clang_pp}")
set_property(DIRECTORY APPEND
PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${clang_pp})