Michael Wild wrote:
On 21. Jan, 2010, at 17:17 , Jed Brown wrote:
On Thu, 21 Jan 2010 17:03:27 +0100, Michael Wild
<[email protected]> wrote:
But both of them just do a try_compile. I don't see where the
name-mangling comes in there... If the user wants to check for a
template, he has to instantiate the template, e.g.
check_cxx_function_exists("std::copy<std::string::const_iterator,
std::string::iterator>" "algorithm;string" HAVE_STD_COPY).
Tedious, but should work. To check for classes, you'd need a
different macro, however.
You're kidding, right? Have you looked at CheckFunctionExists.c?
It declares the symbol as
char SYMBOL_NAME();
and then tries to link a program that calls this function. No
headers are included, so there is no way for this symbol to match
the mangled symbol in the library.
Of course, you could write a completely different thing with an
interface more like check_cxx_source_compiles, and call this new
thing check_cxx_function_exists, but that would be terribly
inconsistent so I hope you don't.
Jed
Ahh, yes. Obviously didn't think it through...
Jed, Michael,
I confess I haven't dug the source of these check macros.
I have to agree, getting this kind of thing to work with C++ is
probably not worth the trouble... Better use a
> check_cxx_source_compiles in the first place for everything C++.
Yes, though I'd annoyingly keep my side that CXX variants of the macros
would be useful and make C vs C++ separation more clear to user.
Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake