0
votes

I'm trying to build libc++ with LLVM/Clang. I'm running onto a couple of problems. First, though LLVM/Clang supports both Makefiles and Cmake, the libc++ project abandoned Makefile support. So I'm stuck with Cmake for this particular component. Second, LLVM/Clang build infrastructure does not configure libc++, so its not à la carte like I thought. So I need to turn some knobs to make things work.

Here's what the tree looks like I'm working with. Sources are under llvm (in-tree), while artifacts are under build (out-of-tree).

Working directory
  |
  +- build (artifacts and staging)
  |
  +- llvm (source tree)
     |
     +- tools
     |  |
     |  +- Compiler Front End (Clang)
     |
     +- projects
        |
        +- Compiler RT
        |
        +- libcxx
        |
        +- libcxx ABI

I need to run Cmake and tell it to configure what's in llvm/projects/libcxx, and tell Cmake to generate Makefiles that build and stage into the appropriate directory under build. Everything else can use Makefiles. (Its unclear to me what the "appropriate directory" is since the project's documentation does not tell me. I'll cross that bridge next, but I'd like to start with build).

I looked at the Cmake man pages, and I can't find a way to specify those simple requirements. For example, I can find ARCHIVE_OUTPUT_DIRECTORY and CMAKE_Fortran_MODDIR_FLAG, but I don't see where I can specify that everything goes to build. (Configure and Makefiles are pretty easy - I cd into the directory and run configure; or I just say make -f llvm/projects/libcxx/Makefile and things just work).

How do I tell Cmake to configure what's in llvm/projects/libcxx, and how do I tell it to generate Makefiles that specify build as the build and output directory?

1
Whats wrong with cd build && cmake ../llvm && make?BenPope

1 Answers

0
votes

You can't configure subdirectory because parent CMakeLists.txt might contain necessary configuration code for subdirectory CMakeLists.txt.

What you can do is to configure everything, but run make only for libcxx:

cd build/projects/libcxx && make

This would build libcxx and all it's dependencies, but stuff from tools, for instance, wouldn't be built.