I'm using CMake for several years now and found that - in the cases where I'm struggling with CMake - I'm still not completely sure about the concept behind CMake
(not taking into account CTest
, CPack
or CDash
also shipped with CMake).
When I started I came across Bill Hoffman's presentation on Google Tech Talks and one claim there has stick to my mind:
CMake aims to give C++ compile portability like the compile once and run everywhere of Java, Python and C#
Starting from there and the basic concepts of CMake page, I came to thinking about CMake in terms of the following three major high-level programming concepts:
- CMake is an abstraction layer for the build and operating systems it's supporting
- CMake is a high level programming language for build procedure descriptions
- CMake assists you in cross-platform development by making code parts configurable
I'm fully aware of the complexity of CMake's task, but I hope you can help me nonetheless with:
- As being an abstraction layer it can't/shouldn't expose all functionality of the underlying layer. So why are there so many holes to explore in CMake?
- Especially commands from the beginning do have bypasses. E.g.
add_definitions()
: "This command can be used to add any flags, but it is intended to add pre-processor definitions" - I see CMake going in the right direction with e.g.
target_compile_features()
for abstracting compiler flags
- Especially commands from the beginning do have bypasses. E.g.
- For the cases where I really need a bypass (something I can only accomplish in the native language) why does CMake not provide some generic way of "inline native code" as other high level programming languages do?
- E.g. like the
asm
macro/command in C++
- E.g. like the
- Is it OK in CMake to add another layer of abstraction to CMake itself (to hide the complexity of CMake to the users of my build environments)?
- I think yes. And since I understand it's a high level programming language, why not?
Thanks in advance for your insights and help with this.