1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00

[CMake] Cleaning up and generalizing the LLVMInstallSymlink script so that it can be used for libraries too.

In order to resolve PR25059, we're going to need to be able to generate symlinks to libraries manually, so I need this code to be reusable.

llvm-svn: 250573
This commit is contained in:
Chris Bieneman 2015-10-16 23:17:13 +00:00
parent a51be6eaa4
commit f6944257e9
2 changed files with 7 additions and 11 deletions

View File

@ -1044,8 +1044,11 @@ function(llvm_install_symlink name dest)
set(component ${name})
endif()
set(full_name ${name}${CMAKE_EXECUTABLE_SUFFIX})
set(full_dest ${dest}${CMAKE_EXECUTABLE_SUFFIX})
install(SCRIPT ${INSTALL_SYMLINK}
CODE "install_symlink(${name} ${dest})"
CODE "install_symlink(${full_name} ${full_dest} bin)"
COMPONENT ${component})
if (NOT CMAKE_CONFIGURATION_TYPES AND NOT ARG_ALWAYS_GENERATE)

View File

@ -2,7 +2,7 @@
# DESTDIR environment variable may be unset at configuration time.
# See PR8397.
function(install_symlink name target)
function(install_symlink name target outdir)
if(UNIX)
set(LINK_OR_COPY create_symlink)
set(DESTDIR $ENV{DESTDIR})
@ -10,19 +10,12 @@ function(install_symlink name target)
set(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 "${DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/")
set(bindir "${DESTDIR}${CMAKE_INSTALL_PREFIX}/${outdir}/")
message("Creating ${name}")
execute_process(
COMMAND "${CMAKE_COMMAND}" -E ${LINK_OR_COPY} "${target}${EXECUTABLE_SUFFIX}" "${name}${EXECUTABLE_SUFFIX}"
COMMAND "${CMAKE_COMMAND}" -E ${LINK_OR_COPY} "${target}" "${name}"
WORKING_DIRECTORY "${bindir}")
endfunction()