set_clang_windows_version_resource_properties(${name})
endmacro(add_clang_executable)
+macro(add_clang_symlink name dest)
+ add_llvm_tool_symlink(${name} ${dest})
+ # Always generate install targets
+ if(LLVM_INSTALL_TOOLCHAIN_ONLY)
+ llvm_install_symlink(${name} ${dest})
+ endif()
+endmacro()
+
set(CMAKE_INCLUDE_CURRENT_DIR ON)
include_directories(BEFORE
add_dependencies(clang clang-headers)
-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_RUNTIME_OUTPUT_INTDIR}/clang${CMAKE_EXECUTABLE_SUFFIX}")
-endif()
-
-# Create the clang++ symlink in the build directory.
-set(clang_pp "${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++${CMAKE_EXECUTABLE_SUFFIX}")
-add_custom_command(TARGET clang POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E ${CLANGXX_LINK_OR_COPY} "${clang_binary}" "${clang_pp}"
- WORKING_DIRECTORY "${LLVM_RUNTIME_OUTPUT_INTDIR}")
-
-set_property(DIRECTORY APPEND
- PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${clang_pp})
-
-# Create the clang-cl symlink in the build directory.
-set(clang_cl "${LLVM_RUNTIME_OUTPUT_INTDIR}/clang-cl${CMAKE_EXECUTABLE_SUFFIX}")
-add_custom_command(TARGET clang POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E ${CLANGXX_LINK_OR_COPY} "${clang_binary}" "${clang_cl}"
- WORKING_DIRECTORY "${LLVM_RUNTIME_OUTPUT_INTDIR}")
-
-set_property(DIRECTORY APPEND
- PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${clang_cl})
-
install(TARGETS clang
RUNTIME DESTINATION bin
COMPONENT clang)
-DCMAKE_INSTALL_COMPONENT=clang
-P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
-# Create the clang++ and clang-cl symlinks at installation time.
-install(SCRIPT clang_symlink.cmake -DCMAKE_INSTALL_PREFIX=\"${CMAKE_INSTALL_PREFIX}\")
+if(NOT CLANG_LINKS_TO_CREATE)
+ set(CLANG_LINKS_TO_CREATE clang++ clang-cl)
+endif()
+
+foreach(link ${CLANG_LINKS_TO_CREATE})
+ add_clang_symlink(${link} clang)
+endforeach()
# Configure plist creation for OS X.
set (TOOL_INFO_PLIST "Info.plist" CACHE STRING "Plist name")
+++ /dev/null
-# 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()
-
-# CMAKE_EXECUTABLE_SUFFIX is undefined on cmake scripts. See PR9286.
-if( WIN32 )
- set(EXECUTABLE_SUFFIX ".exe")
-else()
- set(EXECUTABLE_SUFFIX "")
-endif()
-
-set(bindir "${CLANGXX_DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/")
-set(clang "clang${EXECUTABLE_SUFFIX}")
-set(clangxx "clang++${EXECUTABLE_SUFFIX}")
-set(clang_cl "clang-cl${EXECUTABLE_SUFFIX}")
-set(cl "cl${EXECUTABLE_SUFFIX}")
-
-message("Creating clang++ executable based on ${clang}")
-
-execute_process(
- COMMAND "${CMAKE_COMMAND}" -E ${CLANGXX_LINK_OR_COPY} "${clang}" "${clangxx}"
- WORKING_DIRECTORY "${bindir}")
-
-message("Creating clang-cl executable based on ${clang}")
-
-execute_process(
- COMMAND "${CMAKE_COMMAND}" -E ${CLANGXX_LINK_OR_COPY} "${clang}" "${clang_cl}"
- WORKING_DIRECTORY "${bindir}")
-
-if (WIN32)
- message("Creating cl executable based on ${clang}")
-
- execute_process(
- COMMAND "${CMAKE_COMMAND}" -E ${CLANGXX_LINK_OR_COPY} "${clang}" "../msbuild-bin/${cl}"
- WORKING_DIRECTORY "${bindir}")
-endif()