Revert "[lldb][test] Remove compiler version check and use regex" (#124101)
[llvm-project.git] / llvm / tools / llvm-driver / CMakeLists.txt
blob82d85c7230109cd57bf74e80ab849bdff60d922d
1 get_property(LLVM_COMMON_DEPENDS GLOBAL PROPERTY LLVM_DRIVER_DEPS)
2 get_property(LLVM_DRIVER_OBJLIBS GLOBAL PROPERTY LLVM_DRIVER_OBJLIBS)
4 get_property(LLVM_DRIVER_TOOLS GLOBAL PROPERTY LLVM_DRIVER_TOOLS)
6 list(SORT LLVM_DRIVER_TOOLS)
7 list(REVERSE LLVM_DRIVER_TOOLS)
8 foreach(tool ${LLVM_DRIVER_TOOLS})
9   string(REPLACE "-" "_" tool_entry ${tool})
10   get_property(tool_aliases GLOBAL PROPERTY LLVM_DRIVER_TOOL_ALIASES_${tool})
11   foreach(alias ${tool_aliases})
12     set_property(GLOBAL APPEND PROPERTY LLVM_DRIVER_TOOL_SYMLINKS ${alias})
13     string(REPLACE "llvm-" "" alias ${alias})
14     set(def_decl "${def_decl}LLVM_DRIVER_TOOL(\"${alias}\", ${tool_entry})\n")
15   endforeach()
16   get_property(hidden_tool_aliases GLOBAL PROPERTY LLVM_DRIVER_HIDDEN_TOOL_ALIASES_${tool})
17   foreach(alias ${hidden_tool_aliases})
18     string(REPLACE "llvm-" "" alias ${alias})
19     set(def_decl "${def_decl}LLVM_DRIVER_TOOL(\"${alias}\", ${tool_entry})\n")
20   endforeach()
21 endforeach()
23 file(WRITE
24           "${CMAKE_CURRENT_BINARY_DIR}/LLVMDriverTools.def"
25           "${def_decl}#undef LLVM_DRIVER_TOOL\n")
27 target_include_directories(llvm-driver PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
28 target_sources(llvm-driver PRIVATE llvm-driver.cpp)
30 set_target_properties(llvm-driver PROPERTIES OUTPUT_NAME llvm)
32 target_link_libraries(llvm-driver PUBLIC ${LLVM_DRIVER_OBJLIBS})
33 target_link_libraries(llvm-driver PUBLIC LLVMDebuginfod)
35 if(APPLE)
36   # dsymutil uses some CoreFoundation stuff on Darwin...
37   target_link_libraries(llvm-driver PRIVATE "-framework CoreFoundation")
38 endif(APPLE)
40 macro(generate_driver_tool_targets)
41   get_property(LLVM_DRIVER_TOOL_SYMLINKS GLOBAL PROPERTY LLVM_DRIVER_TOOL_SYMLINKS)
42   foreach(name ${LLVM_DRIVER_TOOL_SYMLINKS})
43     add_llvm_tool_symlink(${name} llvm-driver ALWAYS_GENERATE)
44     # Always generate install targets
45     llvm_install_symlink(LLVM ${name} llvm-driver ALWAYS_GENERATE)
46   endforeach()
47 endmacro()