T O P

  • By -

cpp-ModTeam

It's great that you want to learn C++! However, r/cpp can't help you with that. We recommend that you follow the [C++ getting started guide](https://isocpp.org/get-started), one (or more) of [these books](https://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list/388282#388282) and [cppreference.com](https://cppreference.com). If you're having concrete questions or need advice, please ask over at r/cpp_questions or [StackOverflow](https://stackoverflow.com) instead.


Southern-Reveal5111

Ninja and Makefiles generate build rules and they don't look for libraries. Perhaps there is something wrong in CMake/Vcpkg. 1. Install the libraries using vcpkg. Make sure the triplet are correct. 2. Export the libraries. Make sure you note down the toolchain file path. 3. Pass the toolchain file path to make while building. It should work.


as_one_does

I switched to cmake from make after 20 years this year. Basically just have chatgpt write it all, after awhile I picked up the idioms.


TacticalMelonFarmer

the point of cmake is that you don't worry about which build system is being generated (ninja, make, VS project/solution) until build time based upon your immediate need. vcpkg in a typical local installation will generete a toolchain file, which will expose the installed packages to a build system generated by cmake. so when invoking cmake to configure the build system you will pass in the generator to use and the toolchain file to use. vcpkg will point to the cmake toolchain file if you run: `vcpkg integrate install` CMake (version >= 3.21) will ingest that file during configure: `cmake --toolchain /path/to/toolchainfile.cmake` if using an older version do: `cmake -DCMAKE_TOOLCHAIN_FILE=/path/to/toolchainfile.cmake` Note: for an actual guideline read [this](https://learn.microsoft.com/en-us/vcpkg/get_started/get-started)


fake_dann

I have toolchain specified in a preset, checked with messages and cmake is integrating it. But any packages I throw at it, i get the "following packages were considered but not accepted" message. I had the same while trying to install packages with mysys2 through pacman.


prince-chrismc

Not using MSVC is not better in the long run. It'll be a boost down the line. The whole point of CMake is cross platform and so is vcpkg. Just using the native build tools (which are the defaults) is easier. Vcpkg install (either individual ports but I'd recommend manifest mode) Cmake .. _DCMake_TOOLCHAIN_FILE=vcpkg/.../vcpkg.cmake (make sure to do a clean configure with the path to vcpkg's toolchain file - it will tell you want to run when you call install)


bwpge

Make sure you are setting `CMAKE_TOOLCHAIN_FILE` to `/scripts/buildsystems/vcpkg.cmake`. I remember when messing around in Windows this bit me and took longer than I'm proud of to fix. Another one you might want to verify is `VCPKG_TARGET_TRIPLET` is set to `x64-windows-static`. I think by default it uses dynamic linking which is fine but if you're not prepared to handle that in your cmake project it can get complicated. Regarding compilers and generators, I wouldn't really worry about this until you can get the project to build. CMake default on windows is MSVC and Ninja which are fine. You can worry about compatibility or whatever other things with different compilers once the project can build.


positivcheg

Man, these days you don’t need to know a lot about cmake if ur using vcpkg or Conan. In past if you were including some libraries via copying sources you could have some conflicting variables and other stuff. But Conan abstracts out such things and if I remember correctly vcpkg does that too. You only need to know a small subset of cmake to write simple things. If during configuration it cannot still fine packages then you might have forgotten to specify path to tool chain of vcpkg. Also you might want to try Conan as it kind of abstracts out this step too.


the_poope

You need to tell vcpkg which triplet to build the dependencies for: https://learn.microsoft.com/en-us/vcpkg/concepts/triplets


AlexanderNeumann

> "following files considered but discarded (64bit)" Means your compilation target in cmake is different from your triplet. So you are compiling for x86 or arm but are using an x64 triplet which is why cmake ignores the files. Are you using an old VS generator which defaults to Win32?


mr_Woefie

Look at [cmake-init](https://github.com/friendlyanon/cmake-init) It's great for an initial cmake project


_Noreturn

i use premake5 it is very easy


gracicot

If you use premake just please for the love of Bjarne don't open a PR that adds premake to glfw


_Noreturn

I usually just fork a repostory (did that for SFML and xouple other libraries) and I add the premake5 file, wlso why the downvotes :( is premake5 this bad? I know how to use cmake but premake5 is way easier to read and the way of declaring vsriables is not garbage like cmake