xref: /llvm-project/flang/tools/flang-driver/CMakeLists.txt (revision 4ab5e90c9c52fcf9b4ed297c887b31219e41f7d8)
1# Infrastructure to build flang driver entry point. Flang driver depends on
2# LLVM libraries.
3
4# Set your project compile flags.
5link_directories(${LLVM_LIBRARY_DIR})
6
7set( LLVM_LINK_COMPONENTS
8  ${LLVM_TARGETS_TO_BUILD}
9  MC
10  Option
11  Support
12  TargetParser
13)
14
15add_flang_tool(flang
16  driver.cpp
17  fc1_main.cpp
18)
19
20target_link_libraries(flang
21  PRIVATE
22  flangFrontend
23  flangFrontendTool
24)
25
26clang_target_link_libraries(flang
27  PRIVATE
28  clangDriver
29  clangBasic
30)
31
32# This creates the executable with a version appended
33# and creates a symlink to it without the version
34if(CYGWIN OR NOT WIN32) # but it doesn't work on Windows
35  set_target_properties(flang PROPERTIES VERSION ${FLANG_EXECUTABLE_VERSION})
36endif()
37
38option(FLANG_PLUGIN_SUPPORT "Build Flang with plugin support." ON)
39
40# Enable support for plugins, which need access to symbols from flang
41if(FLANG_PLUGIN_SUPPORT)
42  export_executable_symbols_for_plugins(flang)
43endif()
44
45install(TARGETS flang DESTINATION "${CMAKE_INSTALL_BINDIR}")
46
47# Keep "flang-new" as a symlink for backwards compatiblity. Remove once "flang"
48# is a widely adopted name.
49add_flang_symlink(flang-new flang)
50