forked from OSchip/llvm-project
[CMake] Creating add_clang_tool macro to wrap add_clang_executable and generate install actions and targets.
This change brings forward the LLVM convention that "executables" are just runnable binaries, and "tools" are executables that are part of the project's install. Having this abstraction will allow us to simplify some of the tool CMakeLists files, and it will standardize some of the install behaviors. llvm-svn: 258209
This commit is contained in:
parent
951f73a2de
commit
b6a296ca62
|
@ -444,6 +444,22 @@ macro(add_clang_executable name)
|
|||
set_clang_windows_version_resource_properties(${name})
|
||||
endmacro(add_clang_executable)
|
||||
|
||||
macro(add_clang_tool name)
|
||||
add_clang_executable(${name} ${ARGN})
|
||||
install(TARGETS ${name}
|
||||
EXPORT ClangTargets
|
||||
RUNTIME DESTINATION bin
|
||||
COMPONENT ${name})
|
||||
|
||||
if(NOT CMAKE_CONFIGURATION_TYPES)
|
||||
add_custom_target(install-${name}
|
||||
DEPENDS ${name}
|
||||
COMMAND "${CMAKE_COMMAND}"
|
||||
-DCMAKE_INSTALL_COMPONENT=${name}
|
||||
-P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(add_clang_symlink name dest)
|
||||
add_llvm_tool_symlink(${name} ${dest} ALWAYS_GENERATE)
|
||||
# Always generate install targets
|
||||
|
|
|
@ -24,7 +24,7 @@ if(CLANG_PLUGIN_SUPPORT)
|
|||
set(LLVM_NO_DEAD_STRIP 1)
|
||||
endif()
|
||||
|
||||
add_clang_executable(clang
|
||||
add_clang_tool(clang
|
||||
driver.cpp
|
||||
cc1_main.cpp
|
||||
cc1as_main.cpp
|
||||
|
@ -51,18 +51,6 @@ endif()
|
|||
|
||||
add_dependencies(clang clang-headers)
|
||||
|
||||
install(TARGETS clang
|
||||
RUNTIME DESTINATION bin
|
||||
COMPONENT clang)
|
||||
|
||||
if(NOT CMAKE_CONFIGURATION_TYPES)
|
||||
add_custom_target(install-clang
|
||||
DEPENDS clang
|
||||
COMMAND "${CMAKE_COMMAND}"
|
||||
-DCMAKE_INSTALL_COMPONENT=clang
|
||||
-P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
|
||||
endif()
|
||||
|
||||
if(NOT CLANG_LINKS_TO_CREATE)
|
||||
set(CLANG_LINKS_TO_CREATE clang++ clang-cl)
|
||||
|
||||
|
|
Loading…
Reference in New Issue