[flang] Handle Flang examples consistently with LLVM.
authorSlava Zakharin <szakharin@nvidia.com>
Mon, 13 Mar 2023 21:50:13 +0000 (14:50 -0700)
committerSlava Zakharin <szakharin@nvidia.com>
Tue, 14 Mar 2023 20:08:43 +0000 (13:08 -0700)
commit1c5d12144058b4cfc3028401e8a16df933ff4dc6
tree547a3fc0f00f4ede0295ddbc4da738818271b884
parent207ea5f2e4c35c323c3956d32c3d422f2ef46398
[flang] Handle Flang examples consistently with LLVM.

Without this change the problem is that flangOmpReport and
flangPrintFunctionNames libraries are not built under 'all',
but they are imported targets via LLVMExports.cmake so that
any out-of-tree build that configures upon LLVM+Flang package
will get this CMake error:
```
  The imported target "flangPrintFunctionNames" references the file

     ".../lib/flangPrintFunctionNames.so"

  but this file does not exist.
```

flang-aarch64-out-of-tree buildbot (https://lab.llvm.org/buildbot/#/builders/175)
does not catch this issue, because it does not enable Flang on the first stage.

This change gets rid of FLANG_BUILD_EXAMPLES in favor of LLVM_BUILD_EXAMPLES
and uses available LLVM CMake macros to add example executables/libraries.

Differential Revision: https://reviews.llvm.org/D145992
12 files changed:
flang/CMakeLists.txt
flang/cmake/modules/AddFlang.cmake
flang/docs/FlangDriver.md
flang/examples/CMakeLists.txt
flang/examples/ExternalHelloWorld/CMakeLists.txt
flang/examples/FlangOmpReport/CMakeLists.txt
flang/examples/PrintFlangFunctionNames/CMakeLists.txt
flang/test/CMakeLists.txt
flang/test/Examples/print-fns-calls.f90
flang/test/Examples/print-fns-definitions.f90
flang/test/Examples/print-fns-interfaces.f90
flang/test/lit.site.cfg.py.in