[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology

Name
Options
Comment
Verification
4chan Pass users can bypass this verification. [Learn More] [Login]
File
  • Please read the Rules and FAQ before posting.
  • You may highlight syntax and preserve whitespace by using [code] tags.

08/21/20New boards added: /vrpg/, /vmg/, /vst/ and /vm/
05/04/17New trial board added: /bant/ - International/Random
10/04/16New board for 4chan Pass users: /vip/ - Very Important Posts
[Hide] [Show All]


[Advertise on 4chan]


File: 1593046109752.jpg (89 KB, 720x960)
89 KB
89 KB JPG
I'll be honest.

Rust is actually better than C or C++.

Feels like the discipline of a compiled language like C and C++ but without the legacy 50 year old garbage BS and closer to a 2025 language.

It's also closer to python in terms of being enjoyable to read.
>>
Terrible bait. Do better.
>>
>>108115218
me on the left side
>>
Having a standard build system with dependency resolution is most of what I need to consider something better than C and C++.
At least Rust projects build consistently.
>>
Thats cool. I heard the entire community and ecosystem surrounding it is super political though and that’s fucking gay so I’m not going to get involved.
>>
>>108115218
>>108115270
Just use FetchContent to get dependencies.
>inb4 but the specific library I want to use doesn't work when I import it with fetchContent cuz they don't use CMake!
That's purely a skill issue on the library author's part, tell them to do better.

cmake_minimum_required(VERSION 3.31)

project(ExampleProject
VERSION 0.1.0
LANGUAGES CXX
)

# ---
# Import 3rd-party libs
# ---

include(FetchContent)

# define where to pull the dependencies from
FetchContent_Declare(
fmt
GIT_REPOSITORY https://github.com/fmtlib/fmt
GIT_TAG 12.1.0
GIT_SHALLOW TRUE
)
FetchContent_Declare(
spdlog
GIT_REPOSITORY https://github.com/gabime/spdlog
GIT_TAG v1.17.0
GIT_SHALLOW TRUE
)

# actually fetch the dependencies from locations defined above
FetchContent_MakeAvailable(fmt spdlog)

# ---
# Foo.exe
# ---

add_executable(Foo)
target_sources(Foo
PRIVATE
src/main.cpp
)
target_compile_features(Foo
PRIVATE
cxx_std_20 # C++20
)

target_link_libraries(Foo
PRIVATE
fmt::fmt
spdlog::spdlog
)

# ---
# Install rules
# ---

include(GNUInstallDirs)
install(TARGETS Foo
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
>>
>>108115246
Are you a phone?
>>
>>108115844
>cmake
Fuck off. Absolute retard. If you mentioned something like vcpkg I would have at least sort of sighed.
>>
>>108115865
vcpkg is niggerlicious.
FetchContent is unironically all you need.
>>
>>108115869
If you think gimped ExternalProject does even half what Cargo.toml does, you're delusional. It doesn't even do the bare minimum for me. I'd rather maintain my own build root and find_package through it.



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.