Hello,
On windows you need to add some #include to be able to link with some libs.
Example, if i want to check the existence of socket() function, i need
to link with ws2_32.lib, but i need to include winsock2.h too for some
defines purpose.
a small cmake example:
if(WIN32)
set(CMAKE_REQUIRED_LIBRARIES ws2_32.lib)
set(CMAKE_REQUIRED_FLAGS /FIwinsock2.h)
endif(WIN32)
CHECK_FUNCTION_EXISTS(socket)
A patch proposal :
diff -rU4 CMakeA/Modules/CheckFunctionExists.c
CMakeB/Modules/CheckFunctionExists.c
--- CMakeA/Modules/CheckFunctionExists.c 2004-04-15
14:22:19.000000000 +0200
+++ CMakeB/Modules/CheckFunctionExists.c 2009-12-30
15:29:07.000000000 +0100
@@ -1,15 +1,18 @@
#ifdef CHECK_FUNCTION_EXISTS
+#ifndef _MSC_VER
char CHECK_FUNCTION_EXISTS();
+#endif /* _MSC_VER */
+
#ifdef __CLASSIC_C__
int main(){
int ac;
char*av[];
#else
int main(int ac, char*av[]){
#endif
- CHECK_FUNCTION_EXISTS();
+ static void * p = (void*) CHECK_FUNCTION_EXISTS;
if(ac > 1000)
{
return *av[0];
}
--
nikita
diff -rU4 CMakeA/Modules/CheckFunctionExists.c CMakeB/Modules/CheckFunctionExists.c
--- CMakeA/Modules/CheckFunctionExists.c 2004-04-15 14:22:19.000000000 +0200
+++ CMakeB/Modules/CheckFunctionExists.c 2009-12-30 15:29:07.000000000 +0100
@@ -1,15 +1,18 @@
#ifdef CHECK_FUNCTION_EXISTS
+#ifndef _MSC_VER
char CHECK_FUNCTION_EXISTS();
+#endif /* _MSC_VER */
+
#ifdef __CLASSIC_C__
int main(){
int ac;
char*av[];
#else
int main(int ac, char*av[]){
#endif
- CHECK_FUNCTION_EXISTS();
+ static void * p = (void*) CHECK_FUNCTION_EXISTS;
if(ac > 1000)
{
return *av[0];
}
_______________________________________________
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