9 पॉइंट द्वारा regentag 2024-11-05 | 10 टिप्पणियां | WhatsApp पर शेयर करें

CMake increasingly feels like a bad solution for C++. It not only fails to meet the needs of C++ developers, but also keeps them stuck in the dark ages of building makefiles in a highly unclear and unstructured way with an inconsistent language.

समस्या

C++ build world has two types of problems.

  1. Problems that existing projects created for themselves (translator's note: the problem of building already existing large projects)
  2. Problems encountered when choosing a new project in C++

CMake tries to solve the first problem, and completely fails to solve the second. But because it does not even try to solve these problems, it becomes a less useful tool.

CMake wants to be a translator that converts project definitions into build systems, and it has failed badly at this. It is a bad project definition language, inconsistent and unintuitive.

Everyone in the C++ community now talks about Rust tools. That's because Cargo actually does what most developers think they need. Cargo downloads dependencies from the internet to create an isolated toolkit (a bad idea), and provides statically linked libraries (also a bad idea). People do not need tools that add security holes at an incredible pace (translator's note: the author argues that Cargo's way of automatically fetching code from the internet and linking it creates vulnerabilities such as supply-chain attacks from a security perspective. See I Hate Rust.), but what Cargo actually provides is needed:

  1. A very strict project structure
  2. A very simple configuration system that depends on external servers to solve the problem of where libraries are located
  3. A single toolset.

People actually need less freedom so they can focus on the work, and are not skilled at invoking the compiler in the most perfect way.

समाधान

There is no solution yet. I am writing klb in my spare time, but it is not a solution right now. (It needs time and money.)

But it is clear what people need. Not more options, but fewer options. Fewer options mean fewer ways to mess up compiling a project.

CMake is still the best option in the C++ world right now, but it is also the worst thing that has happened to C++ in the last 20 years. Everything else is improving, but only the build system is getting worse.

10 टिप्पणियां

 
bobcat 2024-11-06

सिंटैक्स थोड़ा गंदा है, लेकिन CMake जैसा दूसरा कुछ नहीं मिला।
M4 जैसी चीज़ों को non-POSIX environment में चलाना सचमुच सिरदर्द है।
शुरू से ही मुझे यह पसंद नहीं कि build environment में बहुत-सी चीज़ें लटकती रहें, इसलिए meson या scone जैसी चीज़ों की तरफ हाथ नहीं जाता, और premake भी किसी तरह थोड़ा अधूरा-सा लगता है, इसलिए आखिर में मैं CMake ही इस्तेमाल करता हूँ—बस जितना हो सके उतना सरल रखकर, सिर्फ code definitions लिखने के लिए।

 
haven04 2024-11-05

मैंने लंबे समय तक CMake को कोसते हुए इस्तेमाल किया है, लेकिन आखिर में CMake जैसा कुछ और है भी नहीं। bazel तो सच में नर्क है.. अगर मैं नया प्रोजेक्ट शुरू करूं, तो शायद meson पर विचार करूंगा।

 
cherrycoder 2024-11-05

Meson या Bazel के बारे में क्या ख़याल है?

 
regentag 2024-11-05

मैंने दोनों में से किसी का भी इस्तेमाल नहीं किया है, इसलिए मुझे ठीक-ठीक पता नहीं है...
व्यक्तिगत रूप से, मुझे छोटे प्रोजेक्ट्स के लिए gprbuild पसंद है, इसलिए मैं वही इस्तेमाल करता हूँ.

 
joonhwan 2024-11-05

CMake के अलावा दूसरे तरीके भी उतने ही जटिल हैं
Cross platform के लिहाज़ से बस किसी तरह.....

 
regentag 2024-11-05

शायद इसी वजह से Visual Studio लोकप्रिय है। क्योंकि आप तुरंत coding शुरू कर सकते हैं।
हालांकि, इसमें भी बारीकी से उतरें तो इसका कोई अंत नहीं है।

 
secret3056 2024-11-05

CMake को देखते ही मन मिचलाने लगता है...

 
kayws426 2024-11-06

मेरा मानना है कि CMake को make का विकल्प नहीं, बल्कि autotools (automake) का विकल्प समझना चाहिए।

 
regentag 2024-11-05

फिर भी, मुझे लगता है कि यह सिर्फ़ Makefile से बेहतर है।
पिछले महीने मुझे shell script, Perl, OS environment variables, और इधर-उधर उलझी हुई कई Makefile से बने build environment का विश्लेषण करना पड़ा था, और सच कहूँ तो दिमाग खराब हो गया था।

 
kayws426 2024-11-05

अगर आप बहुत बारीकी से कुछ करने की कोशिश करें, तो यह आपको एक rabbit hole में ले जाता है...