TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Everything you never wanted to know about CMake (redux)

59 pointsby amirmasoudabdolalmost 2 years ago

15 comments

tempodoxalmost 2 years ago
I love her style.<p>Also,<p>&gt; Please be aware that to poison the content of enterprise LLMs (and thus remove this post from their datasets), that this post contains some amounts of profanity.<p>Hell, yea.
dundariousalmost 2 years ago
Regarding vcvars.bat, I&#x27;m still a fan of letting the user set that <i>before</i> calling into the build system. I specifically <i>don&#x27;t</i> want random projects trying to find random toolchains in random ways. The new toolchain file sounds like a great development in that space.<p>Without CMake, from powershell, you can do something like `&amp; &quot;C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\Launch-VsDevShell.ps1&quot; -VsInstallationPath:&quot;C:\Program Files\Microsoft Visual Studio\2022\Community&quot; -Arch:amd64 -HostArch:amd64 -SkipAutomaticLocation` and it works well enough. I usually provide that oneliner as a vs2022ce-x64-x64.ps1 script, and just note in the README that users can adapt it to their system&#x2F;needs.<p>Also of note is the amazing portable-msvc.py by the one and only Mārtiņš Možeiko : <a href="https:&#x2F;&#x2F;gist.github.com&#x2F;mmozeiko&#x2F;7f3162ec2988e81e56d5c4e22cde9977" rel="nofollow noreferrer">https:&#x2F;&#x2F;gist.github.com&#x2F;mmozeiko&#x2F;7f3162ec2988e81e56d5c4e22cd...</a><p>It downloads the compiler toolchain and nothing more, and writes a setup.bat with no conditional logic. It was trivial for me to adapt to write a setup.ps1 also. Compare the size of the result, vs my attempt to have a minimal toolchain using the Visual Studio Installer.<p><pre><code> 1.3G msvc 4.2G C:&#x2F;Program Files&#x2F;Microsoft Visual Studio&#x2F;2022&#x2F;Community </code></pre> You don&#x27;t get the debugger, profiler, etc., of course, but I use other tools for that stuff anyway (and they don&#x27;t require an additional 3G).<p>I don&#x27;t recommend projects to use it directly, it&#x27;s just an excellent resource to point people towards.
nyanpasu64almost 2 years ago
Just saw vcvarsall.bat in the post. Did you know that the Visual Studio Command Prompt phones home to Microsoft? I tried installing Microsoft&#x27;s build tools on Wine, then when I opened a VS command prompt from KDE I saw an error message, from Wine&#x27;s PowerShell stub being used to run a telemetry script. Then I discovered the very same telemetry had been running every time I had opened a MSVC command prompt on Windows, as well as countless other telemetry operations in the Visual Studio IDE and updater itself.<p>I found a video on this topic at <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=ORH5JfpPx88">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=ORH5JfpPx88</a>.
robot_no_421almost 2 years ago
I cannot overemphasize how enjoyable it is to work with cargo when I&#x27;m coding in Rust; I think it&#x27;s one of the major reasons why Rust took off. As complicated as Rust is, it&#x27;s a breeze to not only build projects but also add existing projects as dependencies.
评论 #36474288 未加载
评论 #36471300 未加载
smitty1ealmost 2 years ago
&gt; CMake Now Has Dictionaries! (Sort of!)<p>It may be time to update Zawinski&#x27;s Law to something like:<p>&quot;Every tool expands until turning complete&quot;<p>At the point where cmake is fungible with a programming language, why not just write the build system in the one you know?<p>As with the various markup languages that purport to &quot;simplify&quot; HTML, we&#x27;re given enough PITA learning curve (how does <i>this</i> doo-hicky do anchor tags, since &lt;a&gt; is right out?) that just writing straight HTML would have sucked less.<p>&#x2F;rant
评论 #36471121 未加载
selimnairbalmost 2 years ago
Whenever I have to work with CMake, I find it useful to adopt a “please sir, may I have another” attitude.
评论 #36467607 未加载
h_mirinalmost 2 years ago
I&#x27;m purely surprised by the activeness of CMake development. I didn&#x27;t know there was still room for improvement. A debugger is surely nice, considering the complexity of the CMakeLists...
rubicksalmost 2 years ago
A good chunk of my day job is beating sense into CMakeLists.txt files. It&#x27;s exhausting in every meaningful dimension. In my literal decades of working with cmake, no amount of familiarity has ever brought me contentment. Rather, with each passing release, the contortions grow ever more torturous.<p>At one point, on one project, in a moment of supreme frustration, I replaced cmake with GNU Make and a single Makefile. I&#x27;m not proud, but for that one instance, it was a good decision because It Just Worked.
rupurtalmost 2 years ago
I&#x27;ve found a lot of value in using Zig as my C &amp; C++ toolchain. I really like that my build logic is more procedural, which I find easier to comprehend.
dangalmost 2 years ago
Related:<p><i>Everything You Never Wanted to Know About CMake</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=19070733">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=19070733</a> - Feb 2019 (87 comments)
ngvrndalmost 2 years ago
Orson Welles voice &quot;Do you have a favorite kind of cardboard?&quot;
yakubinalmost 2 years ago
Wow. This post just prompts me to take another look at xmake.
danny0zalmost 2 years ago
we can also try xmake. <a href="https:&#x2F;&#x2F;github.com&#x2F;xmake-io&#x2F;xmake">https:&#x2F;&#x2F;github.com&#x2F;xmake-io&#x2F;xmake</a><p>Xmake can be used to directly build source code (like with Make or Ninja), or it can generate project source files like CMake or Meson. It also has a built-in package management system to help users integrate C&#x2F;C++ dependencies.
pharmakomalmost 2 years ago
All these CMake improvements are the best example of optimising into a local minimum I have ever seen in SWE
评论 #36468256 未加载
评论 #36468401 未加载
评论 #36473420 未加载
harha_almost 2 years ago
I love CMake.