TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

An Introduction to Modern CMake

87 点作者 signa1129 天前

13 条评论

sorenjan29 天前
I don&#x27;t think these two statements are fully compatible:<p>&gt; Do any of the following apply to you?<p>&gt; - You want to avoid hard-coding paths<p>&gt; ...<p>&gt; If so, you’ll benefit from a CMake-like build system.<p>and<p>&gt; Don’t GLOB files<p>I find it very annoying that I, a human, am expected to keep a current list of all source code files, when listing files is something that computers are very good at. They even tell us how to structure the project with a src folder, but I still have to remember to add or remove source code files to the right CMakeLists.txt when the content of that folder changes. It&#x27;s poor design.
评论 #43699025 未加载
评论 #43698729 未加载
评论 #43705045 未加载
评论 #43698802 未加载
ndiddy29 天前
CMake gets a lot of hate because a lot of large projects use it poorly and the syntax is strange, but I&#x27;ve found it invaluable for projects I&#x27;ve worked on. The first page of this site has a great list of reasons why someone would want to use CMake. I would recommend at least reading that far rather than reading &quot;CMake&quot; in the title and reflexively commenting something negative. I skimmed through and this seems like a nice resource to get people spun up on CMake, I&#x27;ll recommend it to new users in the future.
评论 #43697804 未加载
评论 #43698351 未加载
评论 #43697864 未加载
评论 #43697834 未加载
评论 #43732914 未加载
评论 #43699732 未加载
xvilka29 天前
Even latest CMake version still has that terrible syntax. If they want to survive the competition, at some point they need to provide (an option at least) another, proper syntax.
评论 #43697106 未加载
评论 #43697100 未加载
评论 #43697128 未加载
评论 #43697096 未加载
wiseowise29 天前
Modern CMake is Bazel or Gradle.<p><i>takes cover</i>
dang28 天前
Related. Others?<p><i>An Introduction to Modern CMake</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=39784784">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=39784784</a> - March 2024 (28 comments)<p><i>An Introduction to Modern CMake</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=22577889">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=22577889</a> - March 2020 (41 comments)<p><i>An Introduction to Modern CMake</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=17897685">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=17897685</a> - Sept 2018 (122 comments)
mrlonglong29 天前
I love cmake. It&#x27;s a brilliant tool. I&#x27;ve used it extensively. In fact, I&#x27;ve recently reworked a large collection of applications and their C++ sources plus test units. The whole process was a joy.
vrajspandya128 天前
From last couple of years, VSCode&#x27;s CMake Debugging plugin has made using CMake much easier. After using that I don&#x27;t spend endless amounts of time figuring out what went wrong. This also helps me not to be afraid of CMake and I have started to like it.
评论 #43701957 未加载
kevin_thibedeau29 天前
I do wish some brave soul would update the main parser to support generator expressions directly so they can have whitespace. Then make the end* commands have optional parens and you&#x27;ve almost got a decent language.
jojo1428 天前
Scons is very easy and readable yet very powerful. It is Python based and extensible.<p><a href="https:&#x2F;&#x2F;scons.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;scons.org&#x2F;</a>
sirwhinesalot28 天前
For better or worse CMake has become a de-facto standard. You can (justifiably) argue Meson is better but honestly CMake is &quot;good enough&quot; and a slightly saner build system is not worth the loss of &quot;standardization&quot;.<p>For C and C++, if I&#x27;m not using CMake, then I&#x27;m using some cobbled together shell scripts that do precisely what I need, no more, no less.<p>But for libraries there&#x27;s a huge benefit to CMake since you can create a Config.cmake file for other projects to easily add your project as a dependency.<p>Or to use with FetchContent for rather nice dependency management.<p>The syntax is horrible, the semantics confusing, the way to do anything correctly weird and unintuitive like those generator expressions or whatever they&#x27;re called and how the Config.cmake file is supposed to be generated. It is hot garbage.<p>But I&#x27;ll still use it because the alternative is making dependency management in C&#x2F;C++ land even worse.
评论 #43732954 未加载
jedisct129 天前
I&#x27;m switching all my C projects over to the Zig toolchain, and honestly, I&#x27;m not looking back.
评论 #43698278 未加载
评论 #43699453 未加载
fithisux28 天前
It is a noble attempt<p>But they should support more native languages<p>D Odin Rust Nim C3 Freebasic Freepascal
ingen0s29 天前
yeah CMake has been good to me past few years.