mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-27 07:31:28 +00:00
[cmake] Slight fix ups to make robust to the full range of GNUInstallDirs
See https://cmake.org/cmake/help/v3.14/module/GNUInstallDirs.html#result-variables for `CMAKE_INSTALL_FULL_*` Reviewed By: sebastian-ne Differential Revision: https://reviews.llvm.org/D130545
This commit is contained in:
parent
0a412b3505
commit
28e665fa05
@ -1,3 +1,5 @@
|
||||
include(GNUInstallDirs)
|
||||
|
||||
set(LLVM_LINK_COMPONENTS
|
||||
${LLVM_TARGETS_TO_BUILD}
|
||||
BitWriter
|
||||
@ -42,4 +44,4 @@ target_link_libraries(clang-linker-wrapper
|
||||
${CLANG_LINKER_WRAPPER_LIB_DEPS}
|
||||
)
|
||||
|
||||
install(TARGETS clang-linker-wrapper RUNTIME DESTINATION bin)
|
||||
install(TARGETS clang-linker-wrapper RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||
|
@ -1,5 +1,6 @@
|
||||
include(CheckLibraryExists)
|
||||
include(GNUInstallDirs)
|
||||
include(ExtendPath)
|
||||
|
||||
string(REPLACE "-Wl,-z,defs" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
|
||||
|
||||
@ -41,13 +42,13 @@ target_link_libraries(libgcc_s PRIVATE
|
||||
c
|
||||
)
|
||||
|
||||
get_filename_component(LLVM_LIBGCC_LIBUNWIND_STATIC_ROOT "${CMAKE_INSTALL_PREFIX}/${LIBUNWIND_INSTALL_LIBRARY_DIR}" ABSOLUTE)
|
||||
extend_path(LLVM_LIBGCC_LIBUNWIND_STATIC_ROOT "${CMAKE_INSTALL_PREFIX}" "${LIBUNWIND_INSTALL_LIBRARY_DIR}")
|
||||
#string(REPLACE "${CMAKE_INSTALL_FULL_LIBDIR}/" "" LLVM_LIBGCC_LIBUNWIND_STATIC_ROOT "${LLVM_LIBGCC_LIBUNWIND_STATIC_ROOT}")
|
||||
|
||||
install(TARGETS libgcc_s
|
||||
LIBRARY DESTINATION "${LLVM_LIBGCC_LIBUNWIND_STATIC_ROOT}" COMPONENT unwind
|
||||
ARCHIVE DESTINATION "${LLVM_LIBGCC_LIBUNWIND_STATIC_ROOT}" COMPONENT unwind
|
||||
RUNTIME DESTINATION bin COMPONENT unwind)
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT unwind)
|
||||
|
||||
get_compiler_rt_install_dir(${LLVM_LIBGCC_TARGET_ARCH} install_dir_builtins)
|
||||
string(REGEX REPLACE "^lib/" "" install_dir_builtins "${install_dir_builtins}")
|
||||
|
@ -137,6 +137,7 @@ list(REMOVE_DUPLICATES LLVM_CONFIG_LIBRARY_DIRS)
|
||||
|
||||
set(LLVM_CONFIG_BINARY_DIR "\${LLVM_INSTALL_PREFIX}")
|
||||
extend_path(LLVM_CONFIG_CMAKE_DIR "\${LLVM_INSTALL_PREFIX}" "${LLVM_INSTALL_PACKAGE_DIR}")
|
||||
extend_path(LLVM_CONFIG_TOOLS_BINARY_DIR "\${LLVM_INSTALL_PREFIX}" "${LLVM_TOOLS_INSTALL_DIR}")
|
||||
|
||||
# Generate a default location for lit
|
||||
if (LLVM_INSTALL_UTILS AND LLVM_BUILD_UTILS)
|
||||
|
@ -1,7 +1,12 @@
|
||||
cmake_minimum_required(VERSION 3.13.4)
|
||||
|
||||
# Add cmake directory to search for custom cmake functions.
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
|
||||
set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
|
||||
|
||||
# Add path for custom modules
|
||||
list(INSERT CMAKE_MODULE_PATH 0
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake"
|
||||
"${LLVM_COMMON_CMAKE_UTILS}/Modules"
|
||||
)
|
||||
|
||||
# llvm/runtimes/ will set OPENMP_STANDALONE_BUILD.
|
||||
if (OPENMP_STANDALONE_BUILD OR "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
|
@ -8,6 +8,8 @@
|
||||
#//===----------------------------------------------------------------------===//
|
||||
#
|
||||
|
||||
include(ExtendPath)
|
||||
|
||||
# Configure omp.h, kmp_config.h and omp-tools.h if necessary
|
||||
configure_file(${LIBOMP_INC_DIR}/omp.h.var omp.h @ONLY)
|
||||
configure_file(kmp_config.h.cmake kmp_config.h @ONLY)
|
||||
@ -347,8 +349,8 @@ endif()
|
||||
add_dependencies(libomp-micro-tests libomp-test-deps)
|
||||
|
||||
# Install rules
|
||||
# We want to install libomp in DESTDIR/CMAKE_INSTALL_PREFIX/lib
|
||||
# We want to install headers in DESTDIR/CMAKE_INSTALL_PREFIX/include
|
||||
# We want to install libomp in ${DESTDIR}/${CMAKE_INSTALL_FULL_LIBDIR}
|
||||
# We want to install headers in ${DESTDIR}/${CMAKE_INSTALL_FULL_INCLUDEDIR}
|
||||
if(${OPENMP_STANDALONE_BUILD})
|
||||
set(LIBOMP_HEADERS_INSTALL_PATH "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
else()
|
||||
@ -362,9 +364,10 @@ if(WIN32)
|
||||
set(LIBOMP_ALIASES "libiomp5md")
|
||||
foreach(alias IN LISTS LIBOMP_ALIASES)
|
||||
install(CODE "execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E copy \"${LIBOMP_LIB_FILE}\"
|
||||
\"${alias}${LIBOMP_LIBRARY_SUFFIX}\" WORKING_DIRECTORY \"\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}\")")
|
||||
\"${alias}${LIBOMP_LIBRARY_SUFFIX}\" WORKING_DIRECTORY \"${CMAKE_INSTALL_FULL_BINDIR}\")")
|
||||
extend_path(outdir "${CMAKE_INSTALL_PREFIX}" "${OPENMP_INSTALL_LIBDIR}")
|
||||
install(CODE "execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E copy \"${LIBOMP_IMP_LIB_FILE}\"
|
||||
\"${alias}${CMAKE_STATIC_LIBRARY_SUFFIX}\" WORKING_DIRECTORY \"\${CMAKE_INSTALL_PREFIX}/${OPENMP_INSTALL_LIBDIR}\")")
|
||||
\"${alias}${CMAKE_STATIC_LIBRARY_SUFFIX}\" WORKING_DIRECTORY \"${outdir}\")")
|
||||
endforeach()
|
||||
else()
|
||||
|
||||
@ -374,9 +377,10 @@ else()
|
||||
# Create aliases (symlinks) of the library for backwards compatibility
|
||||
set(LIBOMP_ALIASES "libgomp;libiomp5")
|
||||
foreach(alias IN LISTS LIBOMP_ALIASES)
|
||||
extend_path(outdir "${CMAKE_INSTALL_PREFIX}" "${OPENMP_INSTALL_LIBDIR}")
|
||||
install(CODE "execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E create_symlink \"${LIBOMP_LIB_FILE}\"
|
||||
\"${alias}${LIBOMP_LIBRARY_SUFFIX}\" WORKING_DIRECTORY
|
||||
\"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${OPENMP_INSTALL_LIBDIR}\")")
|
||||
\"\$ENV{DESTDIR}\${outdir}\")")
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
|
Loading…
Reference in New Issue
Block a user