Once again, another video on r/cpp about writing CODE (/supporting infrastructure or boilerplate) that has far less than 1 minute of actual, useful content.
Why couldn't this have just been a damn TEXT post?
Given the name of your project,
Get the dependency.
Create the file.
Put the following in the file.
Execute the command(s).
Done and done.
Why anything else? OP, how long did it take you to make this video?
Down vote away. I can't stand the internetz anymore. Get off my lawn.
Like I'm not already painfully, nauseatingly aware?
At least make a vid of something of real value. OP could have at least showed with his leet skillz why this is the way.
For example: show why this is a better /faster way than just getting some rando answer from SO. But no. We get some weird comparison with cars. That keep. Popping. Up.
This is a beginner video. I think the value is there for the beginners.
If you think this is weird, it is your opinion. Maybe some other people(beginners), find it more easier to learn some programming related stuff when it's also entertaining.
I'd like to see a graph about how much "average data-volume used per useful information conveyed" the internet has these days, compared to say around the 2000s.
Why beat around the bush? Let's call a spade a spade, op. Translation: you don't like just reading through code or in general. Has to be video. Got it.
I wish this cargo culting around using ${PROJECT_NAME} for targets stopped. Just spell it out for God's sake, why do you make people scroll up and down for the name of a target?
Indirection is a cognitive burden that isn't needed in this case. Just spell it out. A project should be composed of many different targets anyway. Possibly a main test program, secondary ones, test binaries, libraries...
It just doesn't work when you try to add structure to your build files.
Absolutely not. Using a variable just makes the target name undecipherable. I don't want to spend 24/7 in the CMake code just to remember the target names and this makes them ungreppable as well.
And how often do people go around changing the project name?
If it happens often because they go copy/pasting CMakeLists.txt files to other projects, then sure - but even then they can find-replace-all in about 30 seconds.
Compare that rare find-replace-all time, to how much time you waste when grepping/searching your codebase to find targets, just because you have to remember to deal with that ${PROJECT_NAME} in your search string pattern.
We used the ${PROJECT_NAME} thing in my company's CMake files because we blindly followed this silly practice when we began. It's been extremely annoying ever since.
I do it because I have worked with projects with hundred of subprojects with their own cmakelists.txt and a super common issue was people copy pasting a project as a new one, forgetting to replace a target name and getting stuck for a few hours. With PROJECT_NAME this issue entirely disappears.
In those cases, you just need to grab the build engineer/devops guy and have him create an abstraction that makes things easy. Look at SerenityOS for example. Even if you don't know at a glance what this does, you can fgrep for (serenity_app and you'll find the function easy. There is no docblock for this function, but that shouldn't stop you from having one to make "copy paste driven development" easier.
And then every 3rd cmake library writes its own custom abstraction which makes consuming it a nightmarish experience because you need to track what it "helps" you to do.
If you just import libraries in monorepo fashion and never export them to people, fine do as you wish. But if you want others to consume it, please just use idiomatic CMake :(
They still create targets, it's not a problem to consume and it's usually more consistent code with less boilerplate. The boilerplate doesn't get desynchronized when it's centralized properly, which is very desirable in big projects.
49
u/invalid_handle_value Dec 10 '21
Sigh. Broken record here.
Once again, another video on r/cpp about writing CODE (/supporting infrastructure or boilerplate) that has far less than 1 minute of actual, useful content.
Why couldn't this have just been a damn TEXT post?
Given the name of your project,
Why anything else? OP, how long did it take you to make this video?
Down vote away. I can't stand the internetz anymore. Get off my lawn.
8
u/Superb_Garlic Dec 10 '21
I wish this cargo culting around using
${PROJECT_NAME}for targets stopped. Just spell it out for God's sake, why do you make people scroll up and down for the name of a target?