From: Chris Bieneman Date: Fri, 16 Oct 2015 23:17:13 +0000 (+0000) Subject: [CMake] Cleaning up and generalizing the LLVMInstallSymlink script so that it can... X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=26751e15750dbb733946c940e8a3bdfc5c446d8e;p=oota-llvm.git [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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250573 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake index da42e5cf55e..752e74a00e4 100644 --- a/cmake/modules/AddLLVM.cmake +++ b/cmake/modules/AddLLVM.cmake @@ -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) diff --git a/cmake/modules/LLVMInstallSymlink.cmake b/cmake/modules/LLVMInstallSymlink.cmake index 65973a57135..482697b06ba 100644 --- a/cmake/modules/LLVMInstallSymlink.cmake +++ b/cmake/modules/LLVMInstallSymlink.cmake @@ -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()