[CMake] Checking function or symbol in namespace
Mateusz Loskot
mateusz at loskot.net
Thu Jan 21 11:50:37 EST 2010
Eric Noulard wrote:
> 2010/1/21 Mateusz Loskot <mateusz at loskot.net>:
>
>> The fact check_function_exists checks C function but not C++ free
>> function is a bit confusing.
>
> That's true.
>
>> AFAIU, CMake is dedicated to build C++ source code,
>
> However that's look false to me :-(
Perhaps I should be more precise, I meant
CMake targets mainly C and C++ and is optimised with C and C++ in mind,
but it does support other platforms too.
At least that's what I've learned from Bill's last video lecture
given to Google folks.
>> so I suppose many users may expect it works
>> well for both C and C++ free functions.
>>
>> Why it can not work, actually?
>
> You don't want to "enable " ( see CMake command
> enable_language(languageName [OPTIONAL] )
> C++ for people which do "only" use plain C.
Got your point.
Then I see a little inconsistency.
Some macros use CXX moniker in their names to indicate they
are C++ specific. Why not apply this rule to all macros where
C vs C++ incompatibilities do apply.
Meaning, why there is no CheckCXXFunctionExists equivalent.
Naming consistency is one of the best practices in hacking, isn't it?
> Thus the check_functions may be updated to be smart enough to try C++
> free function if ever C++ language has been enabled?
> My be checking CMAKE_CXX_COMPILER_WORKS is possible ?
> or may be it would be easier to explicitely tell this fact to the macro
>
> CHECK_FUNCTION_EXISTS(std::copy HAVE_COPY LANGUAGE CXX)
That's right, or use separate macro with CXX in name.
Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net
More information about the CMake
mailing list