[RISCV][VLOPT] Add vector narrowing integer right shift instructions to isSupportedIn...
[llvm-project.git] / clang / cmake / modules / CMakeLists.txt
blobd2d68121371bf9fa60cbcd77fa4c26c27a13a88e
1 include(GNUInstallPackageDir)
2 include(ExtendPath)
3 include(LLVMDistributionSupport)
4 include(FindPrefixFromConfig)
6 # Generate a list of CMake library targets so that other CMake projects can
7 # link against them. LLVM calls its version of this file LLVMExports.cmake, but
8 # the usual CMake convention seems to be ${Project}Targets.cmake.
9 set(CLANG_INSTALL_PACKAGE_DIR "${CMAKE_INSTALL_PACKAGEDIR}/clang" CACHE STRING
10   "Path for CMake subdirectory for Clang (defaults to '${CMAKE_INSTALL_PACKAGEDIR}/clang')")
11 # CMAKE_INSTALL_PACKAGEDIR might be absolute, so don't reuse below.
12 set(clang_cmake_builddir "${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/clang")
14 # Keep this in sync with llvm/cmake/CMakeLists.txt!
15 set(LLVM_INSTALL_PACKAGE_DIR "${CMAKE_INSTALL_PACKAGEDIR}/llvm" CACHE STRING
16   "Path for CMake subdirectory for LLVM (defaults to '${CMAKE_INSTALL_PACKAGEDIR}/llvm')")
17 # CMAKE_INSTALL_PACKAGEDIR might be absolute, so don't reuse below.
18 string(REPLACE "${CMAKE_CFG_INTDIR}" "." llvm_cmake_builddir "${LLVM_LIBRARY_DIR}")
19 set(llvm_cmake_builddir "${llvm_cmake_builddir}/cmake/llvm")
21 get_property(CLANG_EXPORTS GLOBAL PROPERTY CLANG_EXPORTS)
22 export(TARGETS ${CLANG_EXPORTS} FILE ${clang_cmake_builddir}/ClangTargets.cmake)
24 # Generate ClangConfig.cmake for the build tree.
25 set(CLANG_CONFIG_CMAKE_DIR "${clang_cmake_builddir}")
26 set(CLANG_CONFIG_LLVM_CMAKE_DIR "${llvm_cmake_builddir}")
27 set(CLANG_CONFIG_INCLUDE_EXPORTS "include(\"${clang_cmake_builddir}/ClangTargets.cmake\")")
28 set(CLANG_CONFIG_INCLUDE_DIRS
29   "${CLANG_SOURCE_DIR}/include"
30   "${CLANG_BINARY_DIR}/include"
31   )
32 configure_file(
33   ${CMAKE_CURRENT_SOURCE_DIR}/ClangConfig.cmake.in
34   ${clang_cmake_builddir}/ClangConfig.cmake
35   @ONLY)
36 configure_file(
37   ${CMAKE_CURRENT_SOURCE_DIR}/ClangConfigVersion.cmake.in
38   ${clang_cmake_builddir}/ClangConfigVersion.cmake
39   @ONLY)
40 set(CLANG_CONFIG_CMAKE_DIR)
41 set(CLANG_CONFIG_LLVM_CMAKE_DIR)
43 # For compatibility with projects that include(ClangConfig)
44 # via CMAKE_MODULE_PATH, place API modules next to it.
45 # Copy without source permissions because the source could be read-only,
46 # but we need to write into the copied folder.
47 file(COPY .
48   DESTINATION ${clang_cmake_builddir}
49   NO_SOURCE_PERMISSIONS
50   FILES_MATCHING PATTERN *.cmake
51   PATTERN CMakeFiles EXCLUDE
52   )
54 # Generate ClangConfig.cmake for the install tree.
55 find_prefix_from_config(CLANG_CONFIG_CODE CLANG_INSTALL_PREFIX "${CLANG_INSTALL_PACKAGE_DIR}")
56 extend_path(CLANG_CONFIG_CMAKE_DIR "\${CLANG_INSTALL_PREFIX}" "${CLANG_INSTALL_PACKAGE_DIR}")
57 extend_path(CLANG_CONFIG_LLVM_CMAKE_DIR "\${CLANG_INSTALL_PREFIX}" "${LLVM_INSTALL_PACKAGE_DIR}")
58 get_config_exports_includes(Clang CLANG_CONFIG_INCLUDE_EXPORTS)
59 extend_path(base_includedir "\${CLANG_INSTALL_PREFIX}" "${CMAKE_INSTALL_INCLUDEDIR}")
60 set(CLANG_CONFIG_INCLUDE_DIRS
61   "${base_includedir}"
62   )
63 configure_file(
64   ${CMAKE_CURRENT_SOURCE_DIR}/ClangConfig.cmake.in
65   ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/ClangConfig.cmake
66   @ONLY)
67 configure_file(
68   ${CMAKE_CURRENT_SOURCE_DIR}/ClangConfigVersion.cmake.in
69   ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/ClangConfigVersion.cmake
70   @ONLY)
71 set(CLANG_CONFIG_CODE)
72 set(CLANG_CONFIG_CMAKE_DIR)
74 if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
75   install_distribution_exports(Clang)
77   install(FILES
78     ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/ClangConfig.cmake
79     ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/ClangConfigVersion.cmake
80     ${CMAKE_CURRENT_SOURCE_DIR}/AddClang.cmake
81     DESTINATION ${CLANG_INSTALL_PACKAGE_DIR}
82     COMPONENT clang-cmake-exports)
84   if(NOT LLVM_ENABLE_IDE)
85     # Add a dummy target so this can be used with LLVM_DISTRIBUTION_COMPONENTS
86     add_custom_target(clang-cmake-exports)
87     add_llvm_install_targets(install-clang-cmake-exports
88                              COMPONENT clang-cmake-exports)
89   endif()
90 endif()