bugs and grammar errors in clang's CMakeLists.txt

I have been working on building clang 3.4 standalone, and thus have gone over its bundled top-level CMakeLists.txt very carefully.

There are numerous issues with this file, English, embedded comments, and logic. A few examples:

English:

If we are not building as a part of LLVM, build Clang as an

standalone project, using LLVM as an external library:

The above should be revised at least to

If clang is not built as a part of LLVM, then Clang is built as an

standalone project, using LLVM as an external library:

Embedded comments:

9 set(CLANG_PATH_TO_LLVM_BUILD “” CACHE PATH
10 “Path to the directory where LLVM was built or installed.”)

where 9 and 10 are line numbers of the CMakeLists.txt.

OK. On a linux system, normally you specify a INSTALL_PREFIX or simply PREFIX for a software package. Also, depending on the distribution, different parts of LLVM are installed at different places, e.g. all cmake modules go to /usr/share/llvm/cmake, executables go to /usr/bin etc. So, what do you mean by “the directory where LLVM was built or installed”?

Logic:

Despite the fact that at the following statements (CMakeLists.txt line numbers given):

45
46 set(LLVM_MAIN_INCLUDE_DIR “${LLVM_MAIN_SRC_DIR}/include”)
47 set(LLVM_BINARY_DIR ${CMAKE_BINARY_DIR})

The two files:

  • include/clang/Driver/Options.td

  • include/clang/Driver/CC1AsOptions.td

are not aware of them. Thus, standalone build for clang 3.4 would fail unless the include statement in the two files are edited - hackish and kludgy x-(

I would be delighted to report more of such defects, but what is the protocol to submit them? I don’t work on LLVM as a regular part of my job :frowning:

– Zack

For grammar and spelling, just send a patch.

Hi Nico,

The file has more than just grammar and spelling. Bugs too :slight_smile: I am new to tablegen, but I do see on the command line help the following:

OPTIONS:

-I= - Directory of include files

Let me see if I can fix these two files that I mentioned so that they become cmake-variable-aware. If that fail to work, I will use cmake’s file(WRITE …) to force the issue :slight_smile:

– Zack