forked from OSchip/llvm-project
Revert "[CMake] Refactoring and cleaning up clang symlink generation."
This reverts commit r248015, because it broke bots. I'll revise and recommit. llvm-svn: 248025
This commit is contained in:
parent
e2bccbbfb2
commit
f41fe8b6f8
|
@ -414,14 +414,6 @@ macro(add_clang_executable name)
|
|||
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
|
||||
|
|
|
@ -51,6 +51,33 @@ endif()
|
|||
|
||||
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)
|
||||
|
@ -60,13 +87,8 @@ add_custom_target(install-clang
|
|||
-DCMAKE_INSTALL_COMPONENT=clang
|
||||
-P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
|
||||
|
||||
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()
|
||||
# Create the clang++ and clang-cl symlinks at installation time.
|
||||
install(SCRIPT clang_symlink.cmake -DCMAKE_INSTALL_PREFIX=\"${CMAKE_INSTALL_PREFIX}\")
|
||||
|
||||
# Configure plist creation for OS X.
|
||||
set (TOOL_INFO_PLIST "Info.plist" CACHE STRING "Plist name")
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
# 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()
|
Loading…
Reference in New Issue