Which will probably be never.

  • asudox@lemmy.world
    link
    fedilink
    arrow-up
    38
    arrow-down
    6
    ·
    1 year ago

    I mean, all cmake does is run some commands for you. You not understanding cmake errors (mostly) means you don’t understand the errors given to you by the C/C++ compiler.

  • KindaABigDyl@programming.dev
    link
    fedilink
    arrow-up
    26
    arrow-down
    2
    ·
    1 year ago

    Life is and will always be better writing your own Makefiles. It’s literally so easy. I do not get the distaste. Cmake is arcane magic. Bazel is practically written in runes. Makefile is a just a glorified build script, but where you don’t have to use a bunch of if statements to avoid building everything each time.

    • leggettc18@programming.dev
      link
      fedilink
      English
      arrow-up
      6
      ·
      1 year ago

      That works until you need to support Visual Studio or Xcode. Then you either maintain their stuff manually too, or you get CMake to generate all three. I don’t love it but it solves the problem it’s meant to solve. The issue is people using it when they don’t need to.

      • KindaABigDyl@programming.dev
        link
        fedilink
        arrow-up
        1
        ·
        1 year ago

        You can build with mingw64 built with msvc and use more or less the same Makefile. As for Xcode… well, there’s not really a good reason to support Mac. On principle I wouldn’t even try

    • Socsa@sh.itjust.works
      link
      fedilink
      arrow-up
      4
      ·
      1 year ago

      Manual makefiles don’t scale though and you end up needing some other bootstrap framework pretty quick.

  • MajorHavoc@programming.dev
    link
    fedilink
    arrow-up
    12
    ·
    edit-2
    1 year ago

    Thanks for the laugh.

    That was also my experience, but it ended when I stopped using cmake.

    I’m not mad at anyone for using cmake, but I consider myself blessed on each day that I don’t have to collaborate with them (on cmake).

    Which is weird, because someone will have to pry a Makefile from my cold dead hands, someday.

  • nexussapphire@lemm.ee
    link
    fedilink
    English
    arrow-up
    4
    arrow-down
    1
    ·
    1 year ago

    I forgot to assign a variable, now it crashes %5 of the time. It’s wild how c doesn’t default variables to null or something.

    • CodeMonkey@programming.dev
      link
      fedilink
      arrow-up
      6
      ·
      1 year ago

      C does exactly what you tell it, no more. Why waste cycles setting a variable to a zero state when a correct program will set it to whatever initial state it expects? It is not user friendly, but it is performant.

      • marcos@lemmy.world
        link
        fedilink
        arrow-up
        5
        ·
        1 year ago

        Except that this is wrong. C is free to do all kinds of things you didn’t ask it to, and will often initialize your variables without you writing it.

        • nexussapphire@lemm.ee
          link
          fedilink
          English
          arrow-up
          1
          ·
          1 year ago

          Machine code would be a better example of what he’s talking about imo. Not an expert or anything of course.

          • marcos@lemmy.world
            link
            fedilink
            arrow-up
            3
            ·
            1 year ago

            Odds are that your computer doesn’t export any language where it will do exactly as you say (amd64 machine code certainly won’t execute exactly as written). And how much difference it makes varies from one language to another.

            But the specific example from the OP, of uninitialized variables, is one of those cases where the C spec famously goes completely out of line and says your code can do whatever, run with a random value, fail, initialize it, format your hard drive, make a transaction on your bank account… whatever.

      • nexussapphire@lemm.ee
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 year ago

        It wouldn’t be that much processing compared to the rest of the app. It would lot more efficient than running an effectively infinite loop or arithmetic on an arbitrarily large number as a result of an unsigned variables.

  • JATth@lemmy.world
    link
    fedilink
    arrow-up
    3
    ·
    1 year ago

    I never finished reading my CMake book that weights about two kilos. It’s now outdated, except for the core concepts.

  • CrystalRainwater@lemmy.blahaj.zone
    link
    fedilink
    arrow-up
    2
    ·
    1 year ago

    Imo just use something else. If your build system is really simple just write the Makefiles yourself. If the build system tho needs to be really complex I would use something like meson or scons (Having worked on some gigantic fully GNU make build systems it can get pretty out of hand).

    This is all a personal preference thing but cmake in my experience is really non intuitive and a pain to debug. I know it works for a lot of people but I definitely prefer particularly like scons since its python I have a bit easier time understanding what’s happening.

    If you really need to use cmake, use a debugger like another user commented. There’s also a GNU make debugger in case you need to debug makefiles