diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt --- a/llvm/CMakeLists.txt +++ b/llvm/CMakeLists.txt @@ -256,18 +256,29 @@ message(FATAL_ERROR "Invalid value for CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}") endif() -set(LLVM_LIBDIR_SUFFIX "" CACHE STRING "Define suffix of library directory name (32/64)" ) - -set(LLVM_TOOLS_INSTALL_DIR "bin" CACHE STRING "Path for binary subdirectory (defaults to 'bin')") -mark_as_advanced(LLVM_TOOLS_INSTALL_DIR) +set(LLVM_LIBDIR_SUFFIX "" + CACHE STRING "Define suffix of library directory name (32/64)" ) +set(CMAKE_INSTALL_BINDIR bin + CACHE STRING "Path for binary directory relative to CMAKE_INSTALL_PREFIX (defaults to 'bin')" ) +set(CMAKE_INSTALL_LIBDIR lib + CACHE STRING "Path for library directory relative to CMAKE_INSTALL_PREFIX (defaults to 'lib'" ) +set(CMAKE_INSTALL_INCLUDEDIR include + CACHE STRING "Path for include directory relative to CMAKE_INSTALL_PREFIX (defaults to 'include'" ) +set(CMAKE_INSTALL_DOCDIR share/doc + CACHE STRING "Path for documentation directory relative to CMAKE_INSTALL_PREFIX (defaults to 'share/doc')" ) +set(CMAKE_INSTALL_MANDIR share/man + CACHE STRING "Path for manpages directory relative to CMAKE_INSTALL_PREFIX (defaults to 'share/man')" ) + +set(LLVM_INSTALL_DOXYGEN_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/${project}/doxygen-html") +set(LLVM_INSTALL_OCAMLDOC_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/${project}/ocaml-html") set(LLVM_UTILS_INSTALL_DIR "${LLVM_TOOLS_INSTALL_DIR}" CACHE STRING "Path to install LLVM utilities (enabled by LLVM_INSTALL_UTILS=ON) (defaults to LLVM_TOOLS_INSTALL_DIR)") mark_as_advanced(LLVM_UTILS_INSTALL_DIR) # They are used as destination of target generators. -set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin) -set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX}) +set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${CMAKE_INSTALL_BINDIR}) +set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}) if(WIN32 OR CYGWIN) # DLL platform -- put DLLs into bin. set(LLVM_SHLIB_OUTPUT_INTDIR ${LLVM_RUNTIME_OUTPUT_INTDIR}) @@ -567,11 +578,6 @@ option (LLVM_ENABLE_OCAMLDOC "Build OCaml bindings documentation." ON) option (LLVM_ENABLE_BINDINGS "Build bindings." ON) -set(LLVM_INSTALL_DOXYGEN_HTML_DIR "share/doc/llvm/doxygen-html" - CACHE STRING "Doxygen-generated HTML documentation install directory") -set(LLVM_INSTALL_OCAMLDOC_HTML_DIR "share/doc/llvm/ocaml-html" - CACHE STRING "OCamldoc-generated HTML documentation install directory") - option (LLVM_BUILD_EXTERNAL_COMPILER_RT "Build compiler-rt as an external project." OFF) @@ -758,9 +764,9 @@ ) # They are not referenced. See set_output_directory(). -set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/bin ) -set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX} ) -set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX} ) +set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/${CMAKE_INSTALL_BINDIR} ) +set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX} ) +set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX} ) # For up-to-date instructions for installing the Tensorflow dependency, refer to # the bot setup script: https://github.com/google/ml-compiler-opt/blob/master/buildbot/buildbot_init.sh @@ -1027,7 +1033,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) install(DIRECTORY include/llvm include/llvm-c - DESTINATION include + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT llvm-headers FILES_MATCHING PATTERN "*.def" @@ -1038,7 +1044,7 @@ ) install(DIRECTORY ${LLVM_INCLUDE_DIR}/llvm ${LLVM_INCLUDE_DIR}/llvm-c - DESTINATION include + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT llvm-headers FILES_MATCHING PATTERN "*.def" diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake --- a/llvm/cmake/modules/AddLLVM.cmake +++ b/llvm/cmake/modules/AddLLVM.cmake @@ -804,8 +804,8 @@ install(TARGETS ${name} ${export_to_llvmexports} - LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT ${name} - ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT ${name} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX} COMPONENT ${name} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX} COMPONENT ${name} RUNTIME DESTINATION bin COMPONENT ${name}) if (NOT LLVM_ENABLE_IDE) @@ -1015,7 +1015,7 @@ ## Part 1: Extension header to be included whenever we need extension # processing. - set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm) + set(LLVM_INSTALL_PACKAGE_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/cmake/llvm) set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}") file(WRITE "${llvm_cmake_builddir}/LLVMConfigExtensions.cmake" @@ -1025,7 +1025,7 @@ DESTINATION ${LLVM_INSTALL_PACKAGE_DIR} COMPONENT cmake-exports) - set(ExtensionDef "${LLVM_BINARY_DIR}/include/llvm/Support/Extension.def") + set(ExtensionDef "${LLVM_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/llvm/Support/Extension.def") file(WRITE "${ExtensionDef}.tmp" "//extension handlers\n") foreach(llvm_extension ${LLVM_STATIC_EXTENSIONS}) file(APPEND "${ExtensionDef}.tmp" "HANDLE_EXTENSION(${llvm_extension})\n") @@ -1219,7 +1219,7 @@ install(TARGETS ${name} ${export_to_llvmexports} - RUNTIME DESTINATION ${LLVM_TOOLS_INSTALL_DIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${name}) if (NOT LLVM_ENABLE_IDE) @@ -1242,7 +1242,7 @@ endif() add_llvm_executable(${name} ${ARGN}) if( LLVM_BUILD_EXAMPLES ) - install(TARGETS ${name} RUNTIME DESTINATION examples) + install(TARGETS ${name} RUNTIME DESTINATION ${CMAKE_INSTALL_DOCDIR}/examples) endif() set_target_properties(${name} PROPERTIES FOLDER "Examples") endmacro(add_llvm_example name) @@ -1854,7 +1854,7 @@ set(full_name ${CMAKE_${type}_LIBRARY_PREFIX}${name}${CMAKE_${type}_LIBRARY_SUFFIX}) set(full_dest ${CMAKE_${type}_LIBRARY_PREFIX}${dest}${CMAKE_${type}_LIBRARY_SUFFIX}) - set(output_dir lib${LLVM_LIBDIR_SUFFIX}) + set(output_dir ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}) if(WIN32 AND "${type}" STREQUAL "SHARED") set(output_dir bin) endif() @@ -1894,7 +1894,7 @@ set(full_dest ${dest}${CMAKE_EXECUTABLE_SUFFIX}) install(SCRIPT ${INSTALL_SYMLINK} - CODE "install_symlink(${full_name} ${full_dest} ${LLVM_TOOLS_INSTALL_DIR})" + CODE "install_symlink(${full_name} ${full_dest} ${CMAKE_INSTALL_BINDIR})" COMPONENT ${component}) if (NOT LLVM_ENABLE_IDE AND NOT ARG_ALWAYS_GENERATE) @@ -2100,9 +2100,9 @@ if (APPLE) set(_install_name_dir INSTALL_NAME_DIR "@rpath") - set(_install_rpath "@loader_path/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir}) + set(_install_rpath "@loader_path/../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" ${extra_libdir}) elseif(UNIX) - set(_install_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir}) + set(_install_rpath "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" ${extra_libdir}) if(${CMAKE_SYSTEM_NAME} MATCHES "(FreeBSD|DragonFly)") set_property(TARGET ${name} APPEND_STRING PROPERTY LINK_FLAGS " -Wl,-z,origin ") @@ -2135,8 +2135,8 @@ return() endif() - set(deny_attributes_inc "(deny file* (literal \"${LLVM_BINARY_DIR}/include/llvm/IR/Attributes.inc\"))") - set(deny_intrinsics_inc "(deny file* (literal \"${LLVM_BINARY_DIR}/include/llvm/IR/Intrinsics.inc\"))") + set(deny_attributes_inc "(deny file* (literal \"${LLVM_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/llvm/IR/Attributes.inc\"))") + set(deny_intrinsics_inc "(deny file* (literal \"${LLVM_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/llvm/IR/Intrinsics.inc\"))") set(sandbox_command "sandbox-exec -p '(version 1) (allow default) ${deny_attributes_inc} ${deny_intrinsics_inc}'") set_target_properties(${name} PROPERTIES RULE_LAUNCH_COMPILE ${sandbox_command}) diff --git a/llvm/cmake/modules/AddOCaml.cmake b/llvm/cmake/modules/AddOCaml.cmake --- a/llvm/cmake/modules/AddOCaml.cmake +++ b/llvm/cmake/modules/AddOCaml.cmake @@ -144,9 +144,9 @@ endforeach() if( APPLE ) - set(ocaml_rpath "@executable_path/../../../lib${LLVM_LIBDIR_SUFFIX}") + set(ocaml_rpath "@executable_path/../../../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}") elseif( UNIX ) - set(ocaml_rpath "\\$ORIGIN/../../../lib${LLVM_LIBDIR_SUFFIX}") + set(ocaml_rpath "\\$ORIGIN/../../../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}") endif() list(APPEND ocaml_flags "-ldopt" "-Wl,-rpath,${ocaml_rpath}") diff --git a/llvm/cmake/modules/AddSphinxTarget.cmake b/llvm/cmake/modules/AddSphinxTarget.cmake --- a/llvm/cmake/modules/AddSphinxTarget.cmake +++ b/llvm/cmake/modules/AddSphinxTarget.cmake @@ -90,7 +90,7 @@ endif() elseif (builder STREQUAL html) string(TOUPPER "${project}" project_upper) - set(${project_upper}_INSTALL_SPHINX_HTML_DIR "share/doc/${project}/html" + set(${project_upper}_INSTALL_SPHINX_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/${project}/html" CACHE STRING "HTML documentation install directory for ${project}") # '/.' indicates: copy the contents of the directory directly into diff --git a/llvm/cmake/modules/CMakeLists.txt b/llvm/cmake/modules/CMakeLists.txt --- a/llvm/cmake/modules/CMakeLists.txt +++ b/llvm/cmake/modules/CMakeLists.txt @@ -1,4 +1,4 @@ -set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm) +set(LLVM_INSTALL_PACKAGE_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/cmake/llvm CACHE STRING "Path for CMake subdirectory (defaults to 'cmake/llvm')") set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}") # First for users who use an installed LLVM, create the LLVMExports.cmake file. @@ -107,13 +107,13 @@ set(LLVM_CONFIG_CODE "${LLVM_CONFIG_CODE} get_filename_component(LLVM_INSTALL_PREFIX \"\${LLVM_INSTALL_PREFIX}\" PATH)") endforeach(p) -set(LLVM_CONFIG_INCLUDE_DIRS "\${LLVM_INSTALL_PREFIX}/include") +set(LLVM_CONFIG_INCLUDE_DIRS "\${LLVM_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}") set(LLVM_CONFIG_INCLUDE_DIR "${LLVM_CONFIG_INCLUDE_DIRS}") set(LLVM_CONFIG_MAIN_INCLUDE_DIR "${LLVM_CONFIG_INCLUDE_DIRS}") -set(LLVM_CONFIG_LIBRARY_DIRS "\${LLVM_INSTALL_PREFIX}/lib\${LLVM_LIBDIR_SUFFIX}") +set(LLVM_CONFIG_LIBRARY_DIRS "\${LLVM_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}\${LLVM_LIBDIR_SUFFIX}") set(LLVM_CONFIG_CMAKE_DIR "\${LLVM_INSTALL_PREFIX}/${LLVM_INSTALL_PACKAGE_DIR}") set(LLVM_CONFIG_BINARY_DIR "\${LLVM_INSTALL_PREFIX}") -set(LLVM_CONFIG_TOOLS_BINARY_DIR "\${LLVM_INSTALL_PREFIX}/bin") +set(LLVM_CONFIG_TOOLS_BINARY_DIR "\${LLVM_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}") # Generate a default location for lit if (LLVM_INSTALL_UTILS AND LLVM_BUILD_UTILS) diff --git a/llvm/cmake/modules/LLVMConfig.cmake.in b/llvm/cmake/modules/LLVMConfig.cmake.in --- a/llvm/cmake/modules/LLVMConfig.cmake.in +++ b/llvm/cmake/modules/LLVMConfig.cmake.in @@ -103,7 +103,7 @@ set(LLVM_CMAKE_DIR "@LLVM_CONFIG_CMAKE_DIR@") set(LLVM_BINARY_DIR "@LLVM_CONFIG_BINARY_DIR@") set(LLVM_TOOLS_BINARY_DIR "@LLVM_CONFIG_TOOLS_BINARY_DIR@") -set(LLVM_TOOLS_INSTALL_DIR "@LLVM_TOOLS_INSTALL_DIR@") +set(LLVM_TOOLS_INSTALL_DIR "@CMAKE_INSTALL_BINDIR@") set(LLVM_HAVE_OPT_VIEWER_MODULES @LLVM_HAVE_OPT_VIEWER_MODULES@) set(LLVM_CONFIGURATION_TYPES @CMAKE_CONFIGURATION_TYPES@) set(LLVM_ENABLE_SHARED_LIBS @BUILD_SHARED_LIBS@) @@ -111,6 +111,12 @@ set(LLVM_DEFAULT_EXTERNAL_LIT "@LLVM_CONFIG_DEFAULT_EXTERNAL_LIT@") set(LLVM_LIT_ARGS "@LLVM_LIT_ARGS@") +set(CMAKE_INSTALL_BINDIR "@CMAKE_INSTALL_BINDIR@") +set(CMAKE_INSTALL_LIBDIR "@CMAKE_INSTALL_LIBDIR@") +set(CMAKE_INSTALL_INCLUDEDIR "@CMAKE_INSTALL_INCLUDEDIR@") +set(CMAKE_INSTALL_DOCDIR "@CMAKE_INSTALL_DOCDIR@") +set(CMAKE_INSTALL_MANDIR "@CMAKE_INSTALL_MANDIR@") + if(NOT TARGET LLVMSupport) set(LLVM_EXPORTED_TARGETS "@LLVM_CONFIG_EXPORTS@") include("@LLVM_CONFIG_EXPORTS_FILE@") diff --git a/llvm/docs/CMake.rst b/llvm/docs/CMake.rst --- a/llvm/docs/CMake.rst +++ b/llvm/docs/CMake.rst @@ -196,7 +196,7 @@ **LLVM_LIBDIR_SUFFIX**:STRING Extra suffix to append to the directory where libraries are to be installed. On a 64-bit architecture, one could use ``-DLLVM_LIBDIR_SUFFIX=64`` - to install libraries to ``/usr/lib64``. + to install libraries to ``/usr/lib64``. See also ``CMAKE_INSTALL_LIBDIR``. **CMAKE_C_FLAGS**:STRING Extra flags to use when compiling C source files. @@ -550,8 +550,8 @@ **LLVM_INSTALL_DOXYGEN_HTML_DIR**:STRING The path to install Doxygen-generated HTML documentation to. This path can - either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to - `share/doc/llvm/doxygen-html`. + either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to + `${CMAKE_INSTALL_DOCDIR}/${project}/doxygen-html`. **LLVM_ENABLE_SPHINX**:BOOL If specified, CMake will search for the ``sphinx-build`` executable and will make @@ -582,13 +582,33 @@ **LLVM_INSTALL_SPHINX_HTML_DIR**:STRING The path to install Sphinx-generated HTML documentation to. This path can - either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to - `share/doc/llvm/html`. + either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to + `${CMAKE_INSTALL_DOCDIR}/${project}/html`. **LLVM_INSTALL_OCAMLDOC_HTML_DIR**:STRING The path to install OCamldoc-generated HTML documentation to. This path can - either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to - `share/doc/llvm/ocaml-html`. + either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to + `${CMAKE_INSTALL_DOCDIR}/${project}/ocaml-html`. + +**CMAKE_INSTALL_BINDIR**:STRING + The path to install binary tools, relative to the ``CMAKE_INSTALL_PREFIX``. + Defaults to `bin`. + +**CMAKE_INSTALL_LIBDIR**:STRING + The path to install libraries, relative to the ``CMAKE_INSTALL_PREFIX``. + Defaults to `lib`. + +**CMAKE_INSTALL_INCLUDEDIR**:STRING + The path to install header files, relative to the ``CMAKE_INSTALL_PREFIX``. + Defaults to `include`. + +**CMAKE_INSTALL_DOCDIR**:STRING + The path to install documentation, relative to the ``CMAKE_INSTALL_PREFIX``. + Defaults to `share/doc`. + +**CMAKE_INSTALL_MANDIR**:STRING + The path to install manpage files, relative to the ``CMAKE_INSTALL_PREFIX``. + Defaults to `share/man`. **LLVM_CREATE_XCODE_TOOLCHAIN**:BOOL macOS Only: If enabled CMake will generate a target named diff --git a/llvm/include/llvm/CMakeLists.txt b/llvm/include/llvm/CMakeLists.txt --- a/llvm/include/llvm/CMakeLists.txt +++ b/llvm/include/llvm/CMakeLists.txt @@ -5,5 +5,5 @@ # If we're doing an out-of-tree build, copy a module map for generated # header files into the build area. if (NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") - configure_file(module.modulemap.build module.modulemap COPYONLY) + configure_file(module.modulemap.build ${LLVM_INCLUDE_DIR}/module.modulemap COPYONLY) endif (NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") diff --git a/llvm/tools/llvm-config/BuildVariables.inc.in b/llvm/tools/llvm-config/BuildVariables.inc.in --- a/llvm/tools/llvm-config/BuildVariables.inc.in +++ b/llvm/tools/llvm-config/BuildVariables.inc.in @@ -23,6 +23,9 @@ #define LLVM_CXXFLAGS "@LLVM_CXXFLAGS@" #define LLVM_BUILDMODE "@LLVM_BUILDMODE@" #define LLVM_LIBDIR_SUFFIX "@LLVM_LIBDIR_SUFFIX@" +#define LLVM_INSTALL_BINDIR "@CMAKE_INSTALL_BINDIR@" +#define LLVM_INSTALL_LIBDIR "@CMAKE_INSTALL_LIBDIR@" +#define LLVM_INSTALL_INCLUDEDIR "@CMAKE_INSTALL_INCLUDEDIR@" #define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@" #define LLVM_SYSTEM_LIBS "@LLVM_SYSTEM_LIBS@" #define LLVM_BUILD_SYSTEM "@LLVM_BUILD_SYSTEM@" diff --git a/llvm/tools/llvm-config/llvm-config.cpp b/llvm/tools/llvm-config/llvm-config.cpp --- a/llvm/tools/llvm-config/llvm-config.cpp +++ b/llvm/tools/llvm-config/llvm-config.cpp @@ -329,39 +329,39 @@ ActiveCMakeDir; std::string ActiveIncludeOption; if (IsInDevelopmentTree) { - ActiveIncludeDir = std::string(LLVM_SRC_ROOT) + "/include"; + ActiveIncludeDir = std::string(LLVM_SRC_ROOT) + "/" + LLVM_INSTALL_INCLUDEDIR; ActivePrefix = CurrentExecPrefix; // CMake organizes the products differently than a normal prefix style // layout. switch (DevelopmentTreeLayout) { case CMakeStyle: - ActiveBinDir = ActiveObjRoot + "/bin"; - ActiveLibDir = ActiveObjRoot + "/lib" + LLVM_LIBDIR_SUFFIX; + ActiveBinDir = ActiveObjRoot + "/" + LLVM_INSTALL_BINDIR; + ActiveLibDir = ActiveObjRoot + LLVM_INSTALL_LIBDIR + LLVM_LIBDIR_SUFFIX; ActiveCMakeDir = ActiveLibDir + "/cmake/llvm"; break; case CMakeBuildModeStyle: // FIXME: Should we consider the build-mode-specific path as the prefix? ActivePrefix = ActiveObjRoot; - ActiveBinDir = ActiveObjRoot + "/" + build_mode + "/bin"; + ActiveBinDir = ActiveObjRoot + "/" + build_mode + "/" + LLVM_INSTALL_BINDIR; ActiveLibDir = - ActiveObjRoot + "/" + build_mode + "/lib" + LLVM_LIBDIR_SUFFIX; + ActiveObjRoot + "/" + build_mode + "/" + LLVM_INSTALL_LIBDIR + LLVM_LIBDIR_SUFFIX; // The CMake directory isn't separated by build mode. ActiveCMakeDir = - ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX + "/cmake/llvm"; + ActivePrefix + "/" + LLVM_INSTALL_LIBDIR + LLVM_LIBDIR_SUFFIX + "/cmake/llvm"; break; } // We need to include files from both the source and object trees. ActiveIncludeOption = - ("-I" + ActiveIncludeDir + " " + "-I" + ActiveObjRoot + "/include"); + ("-I" + ActiveIncludeDir + " " + "-I" + ActiveObjRoot + "/" + LLVM_INSTALL_INCLUDEDIR); } else { ActivePrefix = CurrentExecPrefix; - ActiveIncludeDir = ActivePrefix + "/include"; - SmallString<256> path(StringRef(LLVM_TOOLS_INSTALL_DIR)); + ActiveIncludeDir = ActivePrefix + "/" + LLVM_INSTALL_INCLUDEDIR; + SmallString<256> path(StringRef(LLVM_INSTALL_BINDIR)); sys::fs::make_absolute(ActivePrefix, path); ActiveBinDir = std::string(path.str()); - ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX; + ActiveLibDir = ActivePrefix + "/" + LLVM_INSTALL_LIBDIR + LLVM_LIBDIR_SUFFIX; ActiveCMakeDir = ActiveLibDir + "/cmake/llvm"; ActiveIncludeOption = "-I" + ActiveIncludeDir; } diff --git a/llvm/tools/llvm-shlib/CMakeLists.txt b/llvm/tools/llvm-shlib/CMakeLists.txt --- a/llvm/tools/llvm-shlib/CMakeLists.txt +++ b/llvm/tools/llvm-shlib/CMakeLists.txt @@ -81,7 +81,7 @@ set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_BINARY_DIR}/libllvm-c.exports) - set(LIB_DIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX}) + set(LIB_DIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}) set(LIB_NAME ${LIB_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}LLVM) set(LIB_PATH ${LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}) set(LIB_EXPORTS_PATH ${LIB_NAME}.exports) diff --git a/llvm/tools/lto/CMakeLists.txt b/llvm/tools/lto/CMakeLists.txt --- a/llvm/tools/lto/CMakeLists.txt +++ b/llvm/tools/lto/CMakeLists.txt @@ -25,7 +25,7 @@ intrinsics_gen) install(FILES ${LLVM_MAIN_INCLUDE_DIR}/llvm-c/lto.h - DESTINATION include/llvm-c + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/llvm-c COMPONENT LTO) if (APPLE)