[flang-dev] Unknown CMake command "add_flang_library" error

a sk via flang-dev flang-dev at lists.llvm.org
Tue Dec 21 09:06:54 PST 2021

Hi Community,

I am building Flang out of tree but getting error related to
add_flang_library i.e.


Make Warning (dev) in CMakeLists.txt:

No project() command is present. The top-level CMakeLists.txt file must

contain a literal, direct call to the project() command. Add a line of

code such as


near the top of the file, but after cmake_minimum_required().

CMake is pretending there is a "project(Project)" command on the first


This warning is for project developers. Use -Wno-dev to suppress it.

*CMake Error at Common/CMakeLists.txt:2 (add_flang_library):*

*Unknown CMake command "add_flang_library".*

CMake Warning (dev) in CMakeLists.txt:

No cmake_minimum_required command is present. A line of code such as

cmake_minimum_required(VERSION 3.16)

should be added at the top of the file. The version specified may be lower

if you wish to support older CMake versions for this project. For more

information run "cmake --help-policy CMP0000".

This warning is for project developers. Use -Wno-dev to suppress it.

-- Configuring incomplete, errors occurred!


*Command used for building **Flang **: *cmake
-DMLIR_DIR=llvm-project/build/lib/cmake/mlir -DCMAKE_BUILD_TYPE=Debug
-DCMAKE_INSTALL_PREFIX=llvm-project/flang/build ../lib

Clang, mlir and llvm were built in release mode before building Flang.

Please guide.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/flang-dev/attachments/20211221/7eaf3e31/attachment.html>

More information about the flang-dev mailing list