CMake can't handle negative numbers even after 6 years



  • math(EXPR output "-1 + 1") # error
    

    I found out today while writing a complex CMake script<!--​ https://github.com/LB--/FindMyPackage.cmake -->. CMake is great for compiling stuff, but as soon as you try to do something that isn't compiling stuff, it just gives you that deer-in-headlights face.


  • Winner of the 2016 Presidential Election

    @LB_ said:

    CMake is great for compiling stuffone of the few build tools for C++ that doesn't suck

    FTFY

    I really wouldn't call it great. It works, and it's more powerful than make, but it's still a collection of hacks glued together with a very weird macro language.



  • cmake made setting up IRC hell on Linux. Bleargh. 😷



  • Why, because you refused to download a prebuilt version from your distro?



  • @asdf said:

    ...but it's still a collection of hacks glued together with a very weird macro language.

    Are you talking about cmake or C?


  • Discourse touched me in a no-no place

    @ben_lubar said:

    Why, because you refused to download a prebuilt version from your distro like some city slicker who thinks hamburger comes from the grocery store?

    <In a thousand years, Gandahar was destroyed



  • Do you think that truck that sells hamburgers grows its own cattle?


  • Trolleybus Mechanic

    "grow"? Cows don't grow on trees.

    Goats do, though:



  • Which doesn't exist, because you have to compile it since there aren't prebuilts and a lot of important config needs to be done during compile time?



  • Which one of these nonexistent IRC servers did you choose?



  • @LB_ said:

    CMake is great for compiling stuff, but as soon as you try to do something that isn't compiling stuff, it just gives you that deer-in-headlights face.

    So why do you use it for something it isn't designed for?
    What is your use case?



  • So do shoes.



  • @marczellm said:

    What is your use case?

    A Find Package module. Pretty much every library that uses CMake also provides a Find module for use with the find_package() command, but of course finding a package and determining if it is the correct version and has all the components has nothing to do with compiling code.


  • Discourse touched me in a no-no place

    @ben_lubar said:

    Do you think that truck that sells hamburgers grows its own cattle?

    Except in certain cases, no. But I know that before that nice pile of ground beef was in a nicely-wrapped package at Kroger, it was inside a live cow's skin.


  • Discourse touched me in a no-no place

    @Lorne_Kates said:

    Cows don't grow on trees.

    I bet you if there were big enough trees with low enough branches, you'd find cows on them.



  • I don't use Ubuntu, but thanks for the thought.

    Regardless, compiling from source with an auto-install script should not be painful.


  • Discourse touched me in a no-no place

    Oddly enough, so do @ben_lubar s


  • Discourse touched me in a no-no place

    @rc4 said:

    Regardless, compiling from source with an auto-install script should not be painful.

    :ohwaityoureserious.lol:



  • ...just to be clear, you're aware that UNIX/GNU make and CMake are different programs?



  • Yeah I think that might be confusing to some people. I despise make and autotools. Projects with a CMakeLists.txt are the only ones I am ever able to build with minimal effort.



  • Maybe you should. It makes things a hell of a lot easier. It's definitely the distro of choice when you want to Get Shit Done.



  • @LB_ said:

    Yeah I think that might be confusing to some people. I despise make and autotools. Projects with a CMakeLists.txt are the only ones I am ever able to build with minimal effort.

    For just building a project, autotools isn't too bad. For development, autotools need to die in a fire.

    CMake is an improvement, but I hate their retarded cobbled-together scripting language. (Also, why does CMake refuse to parse info from pkg-config by default? 🖕 cmake.) From that POV, I definitively prefer scons (python), and I'm kinda hoping for premake to become usable for real.

    I also dislike CMake because of one project where the cmake/make process starts checking out/downloading a bunch of dependencies regardless of whether you already have them. It also always defaults to the newest versions, so good luck ever building an older version of said software. Which you need to do because of frequent breaking changes.

    Admittedly that's not really cmake's fault. </rant>


  • Discourse touched me in a no-no place

    @cvi said:

    For development, autotools need to die in a fire.

    Autoconf is retarded but not too awful if you know how to write the required mix of m4 and ancient shell. 😵

    If you're burning the rest of the autotools, I'll bring some kindling.



  • Except I don't want easy, and I don't want to "Get Shit Done." I am also wholly opposed to Ubuntu, and not only because its logo and name are probably the stupidest things ever to exist on planet Earth, as well as the general bloat that comes with trying to make a user-friendly Linux.



  • So it should be painful? I didn't say I expected it to not be, I said it shouldn't.


    **Reading comprehension: it's just too much for some people.**

  • BINNED

    It's probably also available on Debian. Just sayin'.



  • I don't want to use apt. Debian is okay but I'm unfamiliar with it so I just stick to RHEL-based distros because they're what I've always used and there's nothing wrong with them.


  • Discourse touched me in a no-no place

    @rc4 said:

    I am also wholly opposed to Ubuntu, and not only because its logo and name are probably the stupidest things ever to exist on planet Earth

    Why are you so mean to this poor African-American boy?



  • @cvi said:

    CMake is an improvement, but I hate their retarded cobbled-together scripting language. (Also, why does CMake refuse to parse info from pkg-config by default? 🖕 cmake.) From that POV, I definitively prefer scons (python), and I'm kinda hoping for premake to become usable for real.

    I would have preferred scons, but unfortunately I needed to generate Visual Studio projects for building WinCE and Windows Phone targets and XCode projects for building iOS target and CMake is the only tool that can actually fudge together working projects for these IDEspieces of crap (and we used various own builds with unofficial patches before they were integrated in mainstream for quite long even with that).



  • @dkf said:

    if you know how to write [...] m4

    Well ... there you've identified my problem with it. Never bothered to learn m4, and it looks at least as terrible as the cmake stuff, so chances are slim that I will at this point voluntarily sit down and learn it.


  • Discourse touched me in a no-no place

    @cvi said:

    it looks at least as terrible as the cmake stuff

    This is specifically why I never bothered learning m4.



  • @Bulb said:

    I would have preferred scons, but unfortunately I needed to generate Visual Studio projects for building WinCE and Windows Phone targets and XCode projects for building iOS target and CMake is the only tool that can actually fudge together working projects for these IDEspieces of crap (and we used various own builds with unofficial patches before they were integrated in mainstream for quite long even with that).

    Yeah, that's pretty much the reason to use CMake. Premake promises the same, which is why I'm hoping that it will eventually make it. (Don't know about their plans or current status for WinCE, WinPhone or iOS targets, but at the moment that's not really an issue for me.)

    I've seen autotools generate VisualStudio projects(*). Scons seems to have (or used to have) facilities for it, never tested them, though.

    (*) The best part being that the generated files didn't need any external tools, so after I generated them, I could check them into source control, and even the most cygwin-disabled colleagues could easily build that dependency. Ok, not 100% true. It needed nasm, but, hey, you can check in that too.



  • @cvi said:

    I definitively prefer scons (python)

    Wow. Someone else who knows about [URL=http://www.gnu.org/software/cons/]cons[/URL]. I used the original perl version for a long time. I still like it, although it hasn't been updated for ages.

    I haven't used the Python version ([URL=http://scons.org/]scons[/URL]) but I assume it has all the capabilities of cons, plus additions, since it is still being actively maintained.

    I particularly love the fact that it uses MD5 signatures instead of timestamps to detect if a product is out-of-date with respect to its sources. So clock skew between a build-host and the server holding the files doesn't break anything. And if you make a change that results in the generated file being identical to what was was generated on the prior build, it won't trigger rebuilding of everything that uses the generated file.



  • @David_C said:

    Wow. Someone else who knows about [URL=http://www.gnu.org/software/cons/]cons[/URL]. I used the original perl version for a long time. I still like it, although it hasn't been updated for ages.

    To be fair, I never used the original cons. I think I heard about it more or less at the same time as when I discovered scons (which also has been around for a while).

    IIRC you can tell scons to use timestamps instead. ;-)

    Damn, now I spent like 2h looking at different build systems. Maybe it's time to look at waf again. I rather liked it, until they had a large rewriting phase that broke most of my custom tools stuff. One of the cool features that I liked, was that it's self-contained in a single script, so it's possible to check in the waf.py and it will run anywhere that has Python. It also seems to be able to generate Visual Studio project files, so that's nice.



  • @cvi said:

    IIRC you can tell scons to use timestamps instead.

    You can. You can do that with cons as well, but I've never come across a situation where I'd want to.

    Well, it can help if you're processing a custom file type and you haven't properly created sufficient rules to track down all the dependencies for MD5 calculation purposes. But the real solution there is to fix your rules, not switch to timestamps.



  • @David_C said:

    You can. You can do that with cons as well, but I've never come across a situation where I'd want to.

    Well.. hypothetically speaking you could be abusing your build system to bake some data files. Said files could be a few hundred MB in size, and you could be running the whole thing a few years ago on a machine with mechanical drives and not quite enough RAM to permanently cache the inputs. Checking the file hashes could then become annoyingly slow. 😇

    Anyway, I just checked. It seems that you can now tell configure scons to first check the time-stamp and the md5 only in case of a mismatch. (Might even be the default now?)



  • @cvi said:

    Scons seems to have (or used to have) facilities for it,

    Scons can generate Visual Studio projects, but last I tried it (which was admittedly many years ago) they called to Scons for the actual build, which does not work for the special targets and the debugger does not really like it much either.



  • @cvi said:

    one project where the cmake/make process starts checking out/downloading a bunch of dependencies regardless of whether you already have them. It also always defaults to the newest versions, so good luck ever building an older version of said software. Which you need to do because of frequent breaking changes.

    If it uses ExternalProject_Add, it should be relatively simply to find and fix/remove the code that does that. Not ideal, but there isn't much you can do when someone decided make a #define max-style decision like that.


  • Discourse touched me in a no-no place

    @FrostCat said:

    This is specifically why I never bothered learning m4.

    I actually learned m4 independently before learning any of the autotools (because I wanted a macro system for a custom language I was making about 20 years ago, and I didn't want to just use the C preprocessor; I learned that that was a Bad Idea after all). It's… really rather strange, so much so that autoconf can actually be considered to be an extremely sane profile over m4.

    The real weirdness in autoconf is in the fact that it supports (and works around bugs in) really ancient shells. This makes for something that's potentially extremely portable, but at the same drives men to drink.

    However, autoheader is a weird adjunct, automake has a vast number of assumptions that only really hold for the FSF's own projects, and l■bt■■l is the work of someone who should never have been let out of the asylum and only exists to work around problems that haven't existed for several decades. We hates it! We hates it forever!

    @PJH Is there a chance of getting that software added to the banned word list? Please?


  • ♿ (Parody)

    @dkf said:

    The real weirdness in autoconf is in the fact that it supports (and works around bugs in) really ancient shells. This makes for something that's potentially extremely portable, but at the same drives men to drink.

    I have, on occasion, thought that I should make something fully autoconf. And so I start reading a tutorial or whatever and never get more than a few paragraphs in.


  • Discourse touched me in a no-no place

    @boomzilla said:

    I have, on occasion, thought that I should make something fully autoconf

    Yeah, and then sanity reasserted itself.

    FWIW, last year, ESR rebuilt some OSS package and one of the things he did was deliberately rip out autoconf and replace it with something better, because it's insane. I've only ever seen a couple of applications that use it, and while my hat's off to anyone who made it work, I also question their sanity.


  • Discourse touched me in a no-no place

    @FrostCat said:

    . I've only ever seen a couple of applications that use it,

    We (or rather the stuff we compile from scratch,) apparently, depend on it...

    e or directory
    [4.23.x3:root@centos os]# ls */aclocal.m4 | column -c 132
    alsa-driver/aclocal.m4                  inetutils/aclocal.m4                    openssh6_5p1/aclocal.m4
    alsa-lib/aclocal.m4                     iperf/aclocal.m4                        parted/aclocal.m4
    alsa-utils/aclocal.m4                   iptables/aclocal.m4                     patch/aclocal.m4
    atftp/aclocal.m4                        libecap/aclocal.m4                      pcre/aclocal.m4
    bash/aclocal.m4                         libmcrypt/aclocal.m4                    php-52/aclocal.m4
    bind/aclocal.m4                         libmnl/aclocal.m4                       php-53/aclocal.m4
    bison/aclocal.m4                        libnetfilter_conntrack/aclocal.m4       php-54/aclocal.m4
    conntrack/aclocal.m4                    libnetfilter_queue/aclocal.m4           php-55/aclocal.m4
    coreutils/aclocal.m4                    libnfnetlink/aclocal.m4                 php-56/aclocal.m4
    cpufreqd/aclocal.m4                     libnl/aclocal.m4                        popt/aclocal.m4
    curl/aclocal.m4                         libpcap/aclocal.m4                      psmisc/aclocal.m4
    dhcp/aclocal.m4                         libpng/aclocal.m4                       pureftpd/aclocal.m4
    diffutils/aclocal.m4                    libssh2/aclocal.m4                      python/aclocal.m4
    e2fsprogs/aclocal.m4                    libtool/aclocal.m4                      readline/aclocal.m4
    ecapinjector/aclocal.m4                 libusb/aclocal.m4                       rsync/aclocal.m4
    ethtool/aclocal.m4                      libxml2/aclocal.m4                      sed/aclocal.m4
    fcgi/aclocal.m4                         lighttpd/aclocal.m4                     shadow/aclocal.m4
    file/aclocal.m4                         lzo/aclocal.m4                          sqlite/aclocal.m4
    findutils/aclocal.m4                    m4/aclocal.m4                           squid3/aclocal.m4
    flex/aclocal.m4                         minicom/aclocal.m4                      strace/aclocal.m4
    freeradius/aclocal.m4                   module-init-tools/aclocal.m4            stress/aclocal.m4
    gawk/aclocal.m4                         mysql-50/aclocal.m4                     sysfsutils/aclocal.m4
    gettext/aclocal.m4                      ncurses/aclocal.m4                      tar/aclocal.m4
    glib-2.0/aclocal.m4                     net-snmp/aclocal.m4                     tcpdump/aclocal.m4
    grep/aclocal.m4                         nilfs-utils/aclocal.m4                  texinfo/aclocal.m4
    grub/aclocal.m4                         nmap/aclocal.m4                         usbip-utils/aclocal.m4
    gsoap/aclocal.m4                        ntp/aclocal.m4                          usbutils/aclocal.m4
    gzip/aclocal.m4                         openldap/aclocal.m4                     valgrind/aclocal.m4
    ifmetric/aclocal.m4                     openssh4_6p1/aclocal.m4                 wget/aclocal.m4
    


  • So, you don't want it to be simple and easy to work with, and you're moaning because it's not simple and easy to work with. Is that right?



  • Yes.


  • Discourse touched me in a no-no place

    @gordonjcp said:

    simple

    There are many definitions of simple. Of particular relevance are the one which is cognate with “easy, understood with little effort” and the one which is cognate with “simple-minded, stupid”. Which do you want?


Log in to reply