[LLVMdev] Understanding some of the recent cmake build changes

Rafael EspĂ­ndola rafael.espindola at gmail.com
Wed Feb 26 17:08:40 PST 2014


I was a bit confused with what the difference was between the old

target_link_libraries(foo bar)

and the new

target_link_libraries(foo INTERFACE|PRIVATE|PUBLIC bar)

To try to find out, I decided to look at the generated build.ninja.
The difference that shows up is far fewer order only dependencies. For
example

build lib/TableGen/CMakeFiles/LLVMTableGen.dir/Error.cpp.o:
CXX_COMPILER /home/espindola/llvm/llvm/lib/TableGen/Error.cpp ||
lib/libLLVMSupport.a

becomes just

build lib/TableGen/CMakeFiles/LLVMTableGen.dir/Error.cpp.o:
CXX_COMPILER /home/espindola/llvm/llvm/lib/TableGen/Error.cpp

The net result is that in the old system running

ninja  ./lib/TableGen/CMakeFiles/LLVMTableGen.dir/Error.cpp.o

on a tree just after running cmake would execute 91 commands to build
lib/libLLVMSupport.a and then Error.cpp.o. On the new system only one
command is executed :-)

In a more realistic situation, Error.cpp.o will be compiled in
parallel with the files needed to build lib/libLLVMSupport.a.

Cheers,
Rafael



More information about the llvm-dev mailing list