forked from OSchip/llvm-project
[flang] Use `GNUInstallDirs` to support custom installation dirs.
Extracted from D99484. My new plan is to start from the outside and work inward. Reviewed By: stephenneuendorffer Differential Revision: https://reviews.llvm.org/D115569
This commit is contained in:
parent
896537048d
commit
5c3347aa8b
|
@ -7,6 +7,8 @@ set(CMAKE_CXX_STANDARD 17)
|
|||
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
set(FLANG_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND NOT MSVC_IDE)
|
||||
|
@ -226,7 +228,10 @@ include_directories(BEFORE
|
|||
${FLANG_SOURCE_DIR}/include)
|
||||
|
||||
# Add Flang-centric modules to cmake path.
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
|
||||
list(INSERT CMAKE_MODULE_PATH 0
|
||||
"${FLANG_SOURCE_DIR}/cmake/modules"
|
||||
"${FLANG_SOURCE_DIR}/../cmake/Modules"
|
||||
)
|
||||
include(AddFlang)
|
||||
|
||||
if (NOT DEFAULT_SYSROOT)
|
||||
|
@ -444,7 +449,7 @@ endif()
|
|||
|
||||
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
|
||||
install(DIRECTORY include/flang
|
||||
DESTINATION include
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
|
||||
COMPONENT flang-headers
|
||||
FILES_MATCHING
|
||||
PATTERN "*.def"
|
||||
|
@ -456,7 +461,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
|
|||
PATTERN "CMakeFiles" EXCLUDE)
|
||||
|
||||
install(DIRECTORY ${FLANG_INCLUDE_DIR}/flang
|
||||
DESTINATION include
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
|
||||
COMPONENT flang-headers
|
||||
FILES_MATCHING
|
||||
PATTERN "*.inc"
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
include(GNUInstallDirs)
|
||||
include(LLVMDistributionSupport)
|
||||
|
||||
macro(set_flang_windows_version_resource_properties name)
|
||||
|
@ -71,7 +72,7 @@ macro(add_flang_library name)
|
|||
${export_to_flangtargets}
|
||||
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
|
||||
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
|
||||
RUNTIME DESTINATION bin)
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||
|
||||
if (NOT LLVM_ENABLE_IDE)
|
||||
add_llvm_install_targets(install-${name}
|
||||
|
@ -108,7 +109,7 @@ macro(add_flang_tool name)
|
|||
get_target_export_arg(${name} Flang export_to_flangtargets)
|
||||
install(TARGETS ${name}
|
||||
${export_to_flangtargets}
|
||||
RUNTIME DESTINATION bin
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||
COMPONENT ${name})
|
||||
|
||||
if(NOT LLVM_ENABLE_IDE)
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
include(ExtendPath)
|
||||
|
||||
# Generate a list of CMake library targets so that other CMake projects can
|
||||
# link against them. LLVM calls its version of this file LLVMExports.cmake, but
|
||||
# the usual CMake convention seems to be ${Project}Targets.cmake.
|
||||
|
@ -41,7 +43,7 @@ endforeach(p)
|
|||
set(FLANG_CONFIG_CMAKE_DIR "\${FLANG_INSTALL_PREFIX}/${FLANG_INSTALL_PACKAGE_DIR}")
|
||||
set(FLANG_CONFIG_LLVM_CMAKE_DIR "\${FLANG_INSTALL_PREFIX}/${LLVM_INSTALL_PACKAGE_DIR}")
|
||||
get_config_exports_includes(Flang FLANG_CONFIG_INCLUDE_EXPORTS)
|
||||
set(FLANG_CONFIG_INCLUDE_DIRS "\${FLANG_INSTALL_PREFIX}/include")
|
||||
extend_path(FLANG_CONFIG_INCLUDE_DIRS "\${FLANG_INSTALL_PREFIX}" "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/FlangConfig.cmake.in
|
||||
|
|
|
@ -38,7 +38,7 @@ foreach(filename ${MODULES})
|
|||
DEPENDS ${base}.mod
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${base}.mod ${base}.f18.mod)
|
||||
list(APPEND MODULE_FILES ${base}.mod ${base}.f18.mod)
|
||||
install(FILES ${base}.mod ${base}.f18.mod DESTINATION include/flang)
|
||||
install(FILES ${base}.mod ${base}.f18.mod DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/flang")
|
||||
endforeach()
|
||||
|
||||
add_custom_target(module_files ALL DEPENDS ${MODULE_FILES})
|
||||
|
@ -48,5 +48,5 @@ if (NOT WIN32)
|
|||
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/flang
|
||||
DESTINATION ${CMAKE_BINARY_DIR}/bin
|
||||
FILE_PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE)
|
||||
install(PROGRAMS ${CMAKE_BINARY_DIR}/bin/flang DESTINATION bin)
|
||||
install(PROGRAMS ${CMAKE_BINARY_DIR}/bin/flang DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||
endif()
|
||||
|
|
|
@ -34,4 +34,4 @@ if(FLANG_PLUGIN_SUPPORT)
|
|||
export_executable_symbols_for_plugins(flang-new)
|
||||
endif()
|
||||
|
||||
install(TARGETS flang-new DESTINATION bin)
|
||||
install(TARGETS flang-new DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||
|
|
Loading…
Reference in New Issue