Re: [hatari-devel] cmake: check_symbol_exists

[ Thread Index | Date Index | More Archives ]

Le 11/02/2018 à 11:25, Troed Sångberg a écrit :
Hi all,

I must confess that I don't remember when I first noticed it, but it's a long time now. Cmake didn't detect that I had the required libraries (CapsImage, PortAudio etc) and I just patched the cmake files since they obviously were there.

I've now started to clean up the delta between what I have locally and what's in mercurial, and part of that has been to investigate why cmake module detection doesn't work here. It turns out that it's the use of "check_function_exists" that simply never returns true, whatever changes I make to the detection. Reading up on the cmake website it turns out that they consider check_function_exists to be deprecated, there are apparently many corner cases where it doesn't return the right values.

The recommendation is: "Prefer using CheckSymbolExists instead of this module"

And that works for me. The attached patch replaces all usage of check_function_exists with check_symbol_exists, and now all modules are detected as they should on my build system. As an added bonus, all the optional functions are now detected as well, which they weren't before. (I'm not sure cfmakeraw is optional though, I had a workaround in rs232.c because of its non-detection).

If this seems sane and works as intended on other systems as well, this patch brings down the delta between my build system and the repository to only those specific changes I make to create universal release builds (10.6+, fat libraries etc) that normal users would not need.


Thanks for the patch.
I tested it on 2 different linux systems and it worked fine, so I pushed this to main tree.

It didn't work correctly when crosscompiling for windows with mingw though, readline is not found ; I will look at this later, it should be fixable.


Mail converted by MHonArc 2.6.19+