2012-06-21 09:30:21 +08:00
|
|
|
set( LLVM_LINK_COMPONENTS
|
|
|
|
${LLVM_TARGETS_TO_BUILD}
|
|
|
|
asmparser
|
|
|
|
bitreader
|
|
|
|
bitwriter
|
2013-03-26 10:25:54 +08:00
|
|
|
irreader
|
2012-06-21 09:30:21 +08:00
|
|
|
codegen
|
|
|
|
instrumentation
|
|
|
|
ipo
|
|
|
|
linker
|
|
|
|
selectiondag
|
|
|
|
)
|
|
|
|
|
|
|
|
add_clang_executable(clang
|
|
|
|
driver.cpp
|
|
|
|
cc1_main.cpp
|
|
|
|
cc1as_main.cpp
|
|
|
|
)
|
|
|
|
|
|
|
|
target_link_libraries(clang
|
2011-10-31 01:30:44 +08:00
|
|
|
clangFrontendTool
|
2011-02-12 07:46:38 +08:00
|
|
|
clangAST
|
|
|
|
clangAnalysis
|
|
|
|
clangBasic
|
2009-12-12 06:20:12 +08:00
|
|
|
clangCodeGen
|
2011-02-12 07:46:38 +08:00
|
|
|
clangDriver
|
2012-03-07 04:06:33 +08:00
|
|
|
clangEdit
|
2011-02-12 07:46:38 +08:00
|
|
|
clangFrontend
|
|
|
|
clangLex
|
2010-08-21 02:27:03 +08:00
|
|
|
clangParse
|
2012-03-07 04:06:33 +08:00
|
|
|
clangEdit
|
2010-01-29 18:03:42 +08:00
|
|
|
clangSema
|
2011-02-12 07:46:38 +08:00
|
|
|
clangSerialization
|
2009-03-24 10:52:57 +08:00
|
|
|
)
|
|
|
|
|
2013-05-30 05:09:18 +08:00
|
|
|
if(CLANG_ENABLE_STATIC_ANALYZER)
|
|
|
|
target_link_libraries(clang
|
|
|
|
clangStaticAnalyzerFrontend
|
|
|
|
clangStaticAnalyzerCheckers
|
|
|
|
clangStaticAnalyzerCore
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CLANG_ENABLE_ARCMT)
|
|
|
|
target_link_libraries(clang
|
|
|
|
clangARCMigrate
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CLANG_ENABLE_REWRITER)
|
|
|
|
target_link_libraries(clang
|
|
|
|
clangRewriteCore
|
|
|
|
clangRewriteFrontend
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2011-02-26 03:24:02 +08:00
|
|
|
set_target_properties(clang PROPERTIES VERSION ${CLANG_EXECUTABLE_VERSION})
|
2013-04-04 08:58:40 +08:00
|
|
|
set_target_properties(clang PROPERTIES ENABLE_EXPORTS 1)
|
2011-02-26 03:24:02 +08:00
|
|
|
|
2012-07-21 00:40:09 +08:00
|
|
|
add_dependencies(clang clang-headers)
|
|
|
|
|
2009-11-20 00:42:34 +08:00
|
|
|
if(UNIX)
|
|
|
|
set(CLANGXX_LINK_OR_COPY create_symlink)
|
2012-02-10 04:02:46 +08:00
|
|
|
# Create a relative symlink
|
|
|
|
set(clang_binary "clang${CMAKE_EXECUTABLE_SUFFIX}")
|
2009-11-20 00:42:34 +08:00
|
|
|
else()
|
|
|
|
set(CLANGXX_LINK_OR_COPY copy)
|
2012-02-10 04:02:46 +08:00
|
|
|
set(clang_binary "${LLVM_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/clang${CMAKE_EXECUTABLE_SUFFIX}")
|
2009-11-20 00:42:34 +08:00
|
|
|
endif()
|
|
|
|
|
2009-11-19 13:46:45 +08:00
|
|
|
# Create the clang++ symlink in the build directory.
|
2011-02-06 23:33:08 +08:00
|
|
|
set(clang_pp "${LLVM_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/clang++${CMAKE_EXECUTABLE_SUFFIX}")
|
2011-11-21 08:00:48 +08:00
|
|
|
add_custom_command(TARGET clang POST_BUILD
|
2012-02-10 04:02:46 +08:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E ${CLANGXX_LINK_OR_COPY} "${clang_binary}" "${clang_pp}")
|
2011-02-26 03:24:02 +08:00
|
|
|
|
2011-02-06 05:37:37 +08:00
|
|
|
set_property(DIRECTORY APPEND
|
|
|
|
PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${clang_pp})
|
2009-11-19 13:46:45 +08:00
|
|
|
|
2013-07-20 04:33:20 +08:00
|
|
|
# Create the clang-cl symlink in the build directory.
|
|
|
|
set(clang_cl "${LLVM_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/clang-cl${CMAKE_EXECUTABLE_SUFFIX}")
|
|
|
|
add_custom_command(TARGET clang POST_BUILD
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E ${CLANGXX_LINK_OR_COPY} "${clang_binary}" "${clang_cl}")
|
|
|
|
|
|
|
|
set_property(DIRECTORY APPEND
|
|
|
|
PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${clang_cl})
|
|
|
|
|
2009-08-23 13:28:29 +08:00
|
|
|
install(TARGETS clang
|
|
|
|
RUNTIME DESTINATION bin)
|
2009-11-19 13:46:45 +08:00
|
|
|
|
2013-07-20 04:33:20 +08:00
|
|
|
# Create the clang++ and clang-cl symlinks at installation time.
|
2010-10-18 00:10:32 +08:00
|
|
|
install(SCRIPT clang_symlink.cmake -DCMAKE_INSTALL_PREFIX=\"${CMAKE_INSTALL_PREFIX}\")
|
2013-08-20 15:09:51 +08:00
|
|
|
|
|
|
|
# Configure plist creation for OS X.
|
|
|
|
set (TOOL_INFO_PLIST "Info.plist" CACHE STRING "Plist name")
|
|
|
|
if (APPLE)
|
|
|
|
if (CLANG_VENDOR)
|
|
|
|
set(TOOL_INFO_NAME "${CLANG_VENDOR} clang")
|
|
|
|
else()
|
|
|
|
set(TOOL_INFO_NAME "clang")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(TOOL_INFO_UTI "${CLANG_VENDOR_UTI}")
|
|
|
|
set(TOOL_INFO_VERSION "${CLANG_VERSION}")
|
|
|
|
if (LLVM_SUBMIT_VERSION)
|
|
|
|
set(TOOL_INFO_BUILD_VERSION
|
|
|
|
"${LLVM_SUBMIT_VERSION}.${LLVM_SUBMIT_SUBVERSION}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(TOOL_INFO_PLIST_OUT "${CMAKE_CURRENT_BINARY_DIR}/${TOOL_INFO_PLIST}")
|
|
|
|
target_link_libraries(clang
|
|
|
|
"-Wl,-sectcreate,__TEXT,__info_plist,${TOOL_INFO_PLIST_OUT}")
|
|
|
|
configure_file("${TOOL_INFO_PLIST}.in" "${TOOL_INFO_PLIST_OUT}" @ONLY)
|
|
|
|
|
|
|
|
set(TOOL_INFO_UTI)
|
|
|
|
set(TOOL_INFO_NAME)
|
|
|
|
set(TOOL_INFO_VERSION)
|
|
|
|
set(TOOL_INFO_BUILD_VERSION)
|
|
|
|
endif()
|