mirror of
https://github.com/llvm/llvm-project.git
synced 2025-05-02 20:06:06 +00:00

Set a dummy CMAKE_INSTALL_LIBDIR in order to silence the following CMake warning when executing LLVMInstallSymlink.cmake script: CMake Warning (dev) at /usr/share/cmake/Modules/GNUInstallDirs.cmake:243 (message): Unable to determine default CMAKE_INSTALL_LIBDIR directory because no target architecture is known. Please enable at least one language before including GNUInstallDirs. Call Stack (most recent call first): /usr/lib/llvm/16/lib64/cmake/llvm/LLVMInstallSymlink.cmake:5 (include) tools/lld/cmake_install.cmake:66 (include) cmake_install.cmake:52 (include) Differential Revision: https://reviews.llvm.org/D136573
29 lines
892 B
CMake
29 lines
892 B
CMake
# We need to execute this script at installation time because the
|
|
# DESTDIR environment variable may be unset at configuration time.
|
|
# See PR8397.
|
|
|
|
# Set to an arbitrary directory to silence GNUInstallDirs warnings
|
|
# regarding being unable to determine libdir.
|
|
set(CMAKE_INSTALL_LIBDIR "lib")
|
|
include(GNUInstallDirs)
|
|
|
|
function(install_symlink name target outdir)
|
|
set(DESTDIR $ENV{DESTDIR})
|
|
if(NOT IS_ABSOLUTE "${outdir}")
|
|
set(outdir "${CMAKE_INSTALL_PREFIX}/${outdir}")
|
|
endif()
|
|
set(outdir "${DESTDIR}${outdir}")
|
|
|
|
message(STATUS "Creating ${name}")
|
|
|
|
execute_process(
|
|
COMMAND "${CMAKE_COMMAND}" -E create_symlink "${target}" "${name}"
|
|
WORKING_DIRECTORY "${outdir}" ERROR_VARIABLE has_err)
|
|
if(CMAKE_HOST_WIN32 AND has_err)
|
|
execute_process(
|
|
COMMAND "${CMAKE_COMMAND}" -E copy "${target}" "${name}"
|
|
WORKING_DIRECTORY "${outdir}")
|
|
endif()
|
|
|
|
endfunction()
|