Skip to content

Commit 669cae1

Browse files
committed
[clang] Use add_llvm_install_targets
Use this function to create the install targets rather than doing so manually, which gains us the `-stripped` install targets to perform stripped installations. Differential Revision: https://reviews.llvm.org/D40675 llvm-svn: 319489
1 parent 9138b7b commit 669cae1

File tree

5 files changed

+17
-31
lines changed

5 files changed

+17
-31
lines changed

clang/cmake/modules/AddClang.cmake

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,9 @@ macro(add_clang_library name)
104104
RUNTIME DESTINATION bin)
105105

106106
if (${ARG_SHARED} AND NOT CMAKE_CONFIGURATION_TYPES)
107-
add_custom_target(install-${name}
108-
DEPENDS ${name}
109-
COMMAND "${CMAKE_COMMAND}"
110-
-DCMAKE_INSTALL_COMPONENT=${name}
111-
-P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
107+
add_llvm_install_targets(install-${name}
108+
DEPENDS ${name}
109+
COMPONENT ${name})
112110
endif()
113111
endif()
114112
set_property(GLOBAL APPEND PROPERTY CLANG_EXPORTS ${name})
@@ -147,11 +145,9 @@ macro(add_clang_tool name)
147145
COMPONENT ${name})
148146

149147
if(NOT CMAKE_CONFIGURATION_TYPES)
150-
add_custom_target(install-${name}
151-
DEPENDS ${name}
152-
COMMAND "${CMAKE_COMMAND}"
153-
-DCMAKE_INSTALL_COMPONENT=${name}
154-
-P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
148+
add_llvm_install_targets(install-${name}
149+
DEPENDS ${name}
150+
COMPONENT ${name})
155151
endif()
156152
set_property(GLOBAL APPEND PROPERTY CLANG_EXPORTS ${name})
157153
endif()

clang/lib/Headers/CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,7 @@ install(
141141
DESTINATION lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include/cuda_wrappers)
142142

143143
if (NOT CMAKE_CONFIGURATION_TYPES) # don't add this for IDE's.
144-
add_custom_target(install-clang-headers
145-
DEPENDS clang-headers
146-
COMMAND "${CMAKE_COMMAND}"
147-
-DCMAKE_INSTALL_COMPONENT=clang-headers
148-
-P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
144+
add_llvm_install_targets(install-clang-headers
145+
DEPENDS clang-headers
146+
COMPONENT clang-headers)
149147
endif()

clang/runtime/CMakeLists.txt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,9 @@ if(LLVM_BUILD_EXTERNAL_COMPILER_RT AND EXISTS ${COMPILER_RT_SRC_ROOT}/)
101101
install(CODE "execute_process\(COMMAND \${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=\${CMAKE_INSTALL_PREFIX} -P ${BINARY_DIR}/cmake_install.cmake \)"
102102
COMPONENT compiler-rt)
103103

104-
add_custom_target(install-compiler-rt
105-
DEPENDS compiler-rt
106-
COMMAND "${CMAKE_COMMAND}"
107-
-DCMAKE_INSTALL_COMPONENT=compiler-rt
108-
-P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
109-
USES_TERMINAL)
104+
add_llvm_install_targets(install-compiler-rt
105+
DEPENDS compiler-rt
106+
COMPONENT compiler-rt)
110107

111108
# Add top-level targets that build specific compiler-rt runtimes.
112109
set(COMPILER_RT_RUNTIMES fuzzer asan builtins dfsan lsan msan profile tsan ubsan ubsan-minimal)

clang/tools/c-index-test/CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,8 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
5656
COMPONENT c-index-test)
5757

5858
if (NOT CMAKE_CONFIGURATION_TYPES) # don't add this for IDE's.
59-
add_custom_target(install-c-index-test
60-
DEPENDS c-index-test
61-
COMMAND "${CMAKE_COMMAND}"
62-
-DCMAKE_INSTALL_COMPONENT=c-index-test
63-
-P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
59+
add_llvm_install_targets(install-c-index-test
60+
DEPENDS c-index-test
61+
COMPONENT c-index-test)
6462
endif()
6563
endif()

clang/tools/libclang/CMakeLists.txt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,6 @@ add_custom_target(libclang-headers)
148148
set_target_properties(libclang-headers PROPERTIES FOLDER "Misc")
149149

150150
if (NOT CMAKE_CONFIGURATION_TYPES) # don't add this for IDE's.
151-
add_custom_target(install-libclang-headers
152-
DEPENDS
153-
COMMAND "${CMAKE_COMMAND}"
154-
-DCMAKE_INSTALL_COMPONENT=libclang-headers
155-
-P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
151+
add_llvm_install_targets(install-libclang-headers
152+
COMPONENT libclang-headers)
156153
endif()

0 commit comments

Comments
 (0)