Re: [CMake] Problem with CHECK_FUNCTION_EXISTS and strcasecmp

2010-03-13 Thread Michael Surette

On 03/13/2010 01:03 PM, Mateusz Loskot wrote:

Michael Surette wrote:

I am updating the CMake build files for a cross-platform project.  One
of the tests is for strcasecmp for which I use CHECK_FUNCTION_EXISTS. If
it's not found the code generates its own function by that name.

This works well with GCC under Linux, including cross-compiling with
MinGW, as well as MinGW under Windows.

Testing this with MSVS 2008 Express under Windows XP, it fails to find
the function but gives errors and fails when I try to build.

If I manually edit the config.h file generated by CMake so that it
misreports that there is a strcasecmp function available it compiles well.

My conclusion is that either this function exists or a macro is defining
it, but it's not being found by CHECK_FUNCTION_EXISTS.  I've greped
through the header files, but find no reference to it.

How can I find this function reliably?


CMake macro is right because Visual C++ does not define strcasecmp.
This function is defined by POSIX (not even C99). Visual C++ does not
implement POSIX. For Visual C++, you should look for equivalents, it is:
_stricmp or _strnicmp

Best regards,


Thank you for the prompt answer.

The problem isn't about standards or whether or not Visual C++ defines 
strcasecmp, but that it handles it in a way that isn't compatible with 
the CMake test.  The whole idea of detecting resources is about working 
around missing functions and defining the function yourself should be a 
valid solution, regardless of the standards supported.


CMake detects whether or not that fuction exists and sets a variable. 
When the code is compiled our own version of strcasecmp is #defined in 
depending on that variable.  This is a straightforward solution to a 
simple problem.  If Visual C++ really didn't define strcasecmp that 
would be the end of it.


With observation, I have seen that Visual C++ automatically converts 
calls to strcasecmp to be calls to _stricmp.  This makes things messy, 
because even though the function isn't officially there, we get compile 
errors when we try to define it for ourselves and none when we don't.


This is a cross platform project and Visual C++ is only one of the many 
targets we want to work.  Visual C++ will compile the project without 
code changes as long as we assume that it does have a strcasecmp 
function, which as you pointed out, isn't true.  IMHO, this is the sort 
of thing that should be handled by CMake, not code changes.


Based on your information, I have added a check for _stricmp.  When the 
CMake script detects either strcasecmp or _stricmp it turns off 
inserting our own strcasecmp.  This solution builds well, although a 
check for the compiler itself would probably be a better way.


Thanks for steering me in the right direction.

Mike

___
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


[CMake] Windows/VC9: How to set a global include path?

2010-03-13 Thread Dennis Kempin
Hi there!

Is it possible to set an global include path as environment variable
for cmake? I want cmake to search the path for include files when
using the find_package command.

At the moment I have the following line in my CMakeLists.txt

set(CMAKE_INCLUDE_PATH "C:/Program Files/Microsoft
SDKs/Windows/v6.0A/Include" ${CMAKE_INCLUDE_PATH})

Which, well.. works, but is kinda hacky. Is it possible to set this as
an environment variable for cmake? Or any way to setup this before
configuring without editing the CMakeLists.txt?

Would be nice if someone had a suggestion for my problem.
Regards,
Dennis
___
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


Re: [CMake] CTest/CDash and git

2010-03-13 Thread Andreas Schneider
On Thursday 22 October 2009 23:23:56 Andrew Maclean wrote:
> I guess the subject says it all. What is the status of using CMake,
> Ctest and CDash with git?

Hi,

I've spent the whole afternoon writing a working CTest script which can 
checkout a git repository build and test it and submit to CDash. As this isn't 
documented I've read the source code of CTest to figure out the variables.

I hope this helps other people to get it working.

Here is my working script:

http://dev.libssh.org/browser/tests/ctest-default.cmake

-- andreas

___
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


Re: [CMake] Problem with CHECK_FUNCTION_EXISTS and strcasecmp

2010-03-13 Thread Mateusz Loskot
Michael Surette wrote:
> I am updating the CMake build files for a cross-platform project.  One
> of the tests is for strcasecmp for which I use CHECK_FUNCTION_EXISTS. If
> it's not found the code generates its own function by that name.
> 
> This works well with GCC under Linux, including cross-compiling with
> MinGW, as well as MinGW under Windows.
> 
> Testing this with MSVS 2008 Express under Windows XP, it fails to find
> the function but gives errors and fails when I try to build.
> 
> If I manually edit the config.h file generated by CMake so that it
> misreports that there is a strcasecmp function available it compiles well.
> 
> My conclusion is that either this function exists or a macro is defining
> it, but it's not being found by CHECK_FUNCTION_EXISTS.  I've greped
> through the header files, but find no reference to it.
> 
> How can I find this function reliably?

CMake macro is right because Visual C++ does not define strcasecmp.
This function is defined by POSIX (not even C99). Visual C++ does not
implement POSIX. For Visual C++, you should look for equivalents, it is:
_stricmp or _strnicmp

Best regards,
-- 
Mateusz Loskot, http://mateusz.loskot.net
Charter Member of OSGeo, http://osgeo.org
___
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


[CMake] Problem with CHECK_FUNCTION_EXISTS and strcasecmp

2010-03-13 Thread Michael Surette
I am updating the CMake build files for a cross-platform project.  One 
of the tests is for strcasecmp for which I use CHECK_FUNCTION_EXISTS. 
If it's not found the code generates its own function by that name.


This works well with GCC under Linux, including cross-compiling with 
MinGW, as well as MinGW under Windows.


Testing this with MSVS 2008 Express under Windows XP, it fails to find 
the function but gives errors and fails when I try to build.


If I manually edit the config.h file generated by CMake so that it 
misreports that there is a strcasecmp function available it compiles well.


My conclusion is that either this function exists or a macro is defining 
it, but it's not being found by CHECK_FUNCTION_EXISTS.  I've greped 
through the header files, but find no reference to it.


How can I find this function reliably?

Mike

___
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


[CMake] New FindXXX modules for XUL and NSPR

2010-03-13 Thread Guillaume Duhamel
Hi,

I've been working on some FindXXX modules for XUL (
https://developer.mozilla.org/En/XUL ) and for its dependency: NSPR (
http://www.mozilla.org/projects/nspr/ ) and I'm now searching for some
feedback on them.

I've already talked a bit about it and about a submodule I had to write in a
previous thread: http://www.cmake.org/pipermail/cmake/2010-March/035554.html

You can get the modules and an example project here:
http://code.google.com/p/soupcon/source/browse/#svn/trunk/findxul

If anyone is interested in those modules, please let me know.

Guillaume
___
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