CMake to mimic Google Build language

Google use a description language for build and dependency management. That is very convenient, in order to use some libraries, you just need to include some headers in your C++, and add that libraries path to 'deps' list.

I'm using CMake for personal tiny projects. One CMake feature that annoys me a lot is no target namespaces. We can not define the same target in different directories. So I thought, we can define some Google BUILD like functions for CMake and make every target dependent on the it's directory. In my personal tiny projects, I'm using weizi as root of source directory, and in every sub directory, we can refer targets in current directory directly and targets in other directory with full path.

  LIBS /options_parser/options_parser)
  LIBS /options_parser/options_parser
  LIBS /test/test_lite_main)

We can not use '/' in target names directly, one choice is using '.' to join directories.

No comments: