Use a script for creating the clang++ executable.

The previous method used the DESTDIR environment variable at configure
time, but sometimes it is only available at install time. See PR8397.

llvm-svn: 116689
This commit is contained in:
Oscar Fuentes 2010-10-17 16:10:32 +00:00
parent a8a9f3c52b
commit 95b6f045f1
2 changed files with 19 additions and 2 deletions

View File

@ -35,7 +35,6 @@ add_clang_executable(clang
if(UNIX)
set(CLANGXX_LINK_OR_COPY create_symlink)
set(CLANGXX_DESTDIR $ENV{DESTDIR}/)
else()
set(CLANGXX_LINK_OR_COPY copy)
endif()
@ -51,4 +50,4 @@ install(TARGETS clang
RUNTIME DESTINATION bin)
# Create the clang++ symlink at installation time.
install(CODE "execute_process(COMMAND \"${CMAKE_COMMAND}\" -E ${CLANGXX_LINK_OR_COPY} \"${CMAKE_INSTALL_PREFIX}/bin/clang${CMAKE_EXECUTABLE_SUFFIX}\" \"${CLANGXX_DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/clang++${CMAKE_EXECUTABLE_SUFFIX}\")")
install(SCRIPT clang_symlink.cmake -DCMAKE_INSTALL_PREFIX=\"${CMAKE_INSTALL_PREFIX}\")

View File

@ -0,0 +1,18 @@
# We need to execute this script at installation time because the
# DESTDIR environment variable may be unset at configuration time.
# See PR8397.
if(UNIX)
set(CLANGXX_LINK_OR_COPY create_symlink)
set(CLANGXX_DESTDIR $ENV{DESTDIR})
else()
set(CLANGXX_LINK_OR_COPY copy)
endif()
set(bindir "${CLANGXX_DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/")
set(clang "${bindir}clang${CMAKE_EXECUTABLE_SUFFIX}")
set(clangxx "${bindir}clang++${CMAKE_EXECUTABLE_SUFFIX}")
message("Creating clang++ executable based on ${clang}")
execute_process(COMMAND "${CMAKE_COMMAND}" -E ${CLANGXX_LINK_OR_COPY} "${clang}" "${clangxx}")