blob: c7341cb2fa613ad4155e97386ffbbf7e4b5dfa8e [file] [log] [blame]
Oscar Fuentesfbfe8992010-10-17 16:10:32 +00001# We need to execute this script at installation time because the
2# DESTDIR environment variable may be unset at configuration time.
3# See PR8397.
4
5if(UNIX)
6 set(CLANGXX_LINK_OR_COPY create_symlink)
7 set(CLANGXX_DESTDIR $ENV{DESTDIR})
8else()
9 set(CLANGXX_LINK_OR_COPY copy)
10endif()
11
Oscar Fuentescf603e12011-02-22 13:05:15 +000012# CMAKE_EXECUTABLE_SUFFIX is undefined on cmake scripts. See PR9286.
13if( WIN32 )
14 set(EXECUTABLE_SUFFIX ".exe")
15else()
16 set(EXECUTABLE_SUFFIX "")
17endif()
18
Oscar Fuentesfbfe8992010-10-17 16:10:32 +000019set(bindir "${CLANGXX_DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/")
Oscar Fuentescf603e12011-02-22 13:05:15 +000020set(clang "clang${EXECUTABLE_SUFFIX}")
21set(clangxx "clang++${EXECUTABLE_SUFFIX}")
Oscar Fuentesfbfe8992010-10-17 16:10:32 +000022
23message("Creating clang++ executable based on ${clang}")
24
Oscar Fuentes115bcd02010-10-18 02:25:54 +000025execute_process(
26 COMMAND "${CMAKE_COMMAND}" -E ${CLANGXX_LINK_OR_COPY} "${clang}" "${clangxx}"
27 WORKING_DIRECTORY "${bindir}")