Home | History | Annotate | Download | only in driver
      1 set( LLVM_LINK_COMPONENTS
      2   ${LLVM_TARGETS_TO_BUILD}
      3   asmparser
      4   bitreader
      5   bitwriter
      6   irreader
      7   codegen
      8   instrumentation
      9   ipo
     10   linker
     11   selectiondag
     12   )
     13 
     14 add_clang_executable(clang
     15   driver.cpp
     16   cc1_main.cpp
     17   cc1as_main.cpp
     18   )
     19 
     20 target_link_libraries(clang
     21   clangFrontendTool
     22   clangAST
     23   clangAnalysis
     24   clangBasic
     25   clangCodeGen
     26   clangDriver
     27   clangEdit
     28   clangFrontend
     29   clangLex
     30   clangParse
     31   clangEdit
     32   clangSema
     33   clangSerialization
     34   )
     35 
     36 if(CLANG_ENABLE_STATIC_ANALYZER)
     37   target_link_libraries(clang
     38     clangStaticAnalyzerFrontend
     39     clangStaticAnalyzerCheckers
     40     clangStaticAnalyzerCore
     41     )
     42 endif()
     43 
     44 if(CLANG_ENABLE_ARCMT)
     45   target_link_libraries(clang
     46     clangARCMigrate
     47     )
     48 endif()
     49 
     50 if(CLANG_ENABLE_REWRITER)
     51   target_link_libraries(clang
     52     clangRewriteCore
     53     clangRewriteFrontend
     54     )
     55 endif()
     56 
     57 set_target_properties(clang PROPERTIES VERSION ${CLANG_EXECUTABLE_VERSION})
     58 set_target_properties(clang PROPERTIES ENABLE_EXPORTS 1)
     59 
     60 add_dependencies(clang clang-headers)
     61 
     62 if(UNIX)
     63   set(CLANGXX_LINK_OR_COPY create_symlink)
     64 # Create a relative symlink
     65   set(clang_binary "clang${CMAKE_EXECUTABLE_SUFFIX}")
     66 else()
     67   set(CLANGXX_LINK_OR_COPY copy)
     68   set(clang_binary "${LLVM_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/clang${CMAKE_EXECUTABLE_SUFFIX}")
     69 endif()
     70 
     71 # Create the clang++ symlink in the build directory.
     72 set(clang_pp "${LLVM_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/clang++${CMAKE_EXECUTABLE_SUFFIX}")
     73 add_custom_command(TARGET clang POST_BUILD
     74     COMMAND ${CMAKE_COMMAND} -E ${CLANGXX_LINK_OR_COPY} "${clang_binary}" "${clang_pp}")
     75 
     76 set_property(DIRECTORY APPEND
     77   PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${clang_pp})
     78 
     79 # Create the clang-cl symlink in the build directory.
     80 set(clang_cl "${LLVM_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/clang-cl${CMAKE_EXECUTABLE_SUFFIX}")
     81 add_custom_command(TARGET clang POST_BUILD
     82     COMMAND ${CMAKE_COMMAND} -E ${CLANGXX_LINK_OR_COPY} "${clang_binary}" "${clang_cl}")
     83 
     84 set_property(DIRECTORY APPEND
     85   PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${clang_cl})
     86 
     87 install(TARGETS clang
     88   RUNTIME DESTINATION bin)
     89 
     90 # Create the clang++ and clang-cl symlinks at installation time.
     91 install(SCRIPT clang_symlink.cmake -DCMAKE_INSTALL_PREFIX=\"${CMAKE_INSTALL_PREFIX}\")
     92