[CMake] Help with Windows SDK .lib files and headers. Trying to find winsock elements
Aaron Smith
gngrwzrd.lists at gmail.com
Mon Aug 13 14:27:48 EDT 2012
Hey All,
I'm trying to work my way through some windows configuration and running
into problems. I'm trying a few things: looking for headers, looking for
lib files, and looking for functions/symbols in them. I'm particularly
interested in Winsock stuff right now.
I have a couple things hard coded for the moment just to get this working.
Here's what I have so far:
if(PLATFORM_WINDOWS)
set(WINDOWS_SDK_LIBRARIES "C:/Program Files (x86)/Windows
Kits/8.0/Lib/win8/um/x86")
set(WINDOWS_SDK_INCLUDES "C:/Program Files (x86)/Windows
Kits/8.0/Include/um")
set(CMAKE_LIBRARY_PATH ${WINDOWS_SDK_LIBRARIES})
set(CMAKE_INCLUDE_PATH ${WINDOWS_SDK_INCLUDES})
check_include_file(Windows.h HAVE_WINDOWS_H)
check_include_file(WinSock2.h HAVE_WINSOCK2_H)
check_include_file(WS2tcpip.h HAVE_WS2TCPIP_H)
check_include_file(IPHlpApi.h HAVE_IPHLPAPI_H)
set(_REQUIRED_INCLUDES Winsock2.h)
set(_REQUIRED_LIBRARIES WS2_32.lib WSock32.lib)
set(CMAKE_REQUIRED_INCLUDES ${_REQUIRED_INCLUDES})
set(CMAKE_REQUIRED_LIBRARIES ${_REQUIRED_LIBRARIES})
check_library_exists(WS2_32 select WINDOWS_SDK_LIBRARIES HAVE_WS2_32_lib)
check_library_exists(WSock32 select WINDOWS_SDK_LIBRARIES HAVE_WSOCK32_lib)
//tried these too
//check_library_exists(WS2_32.lib select WINDOWS_SDK_LIBRARIES
HAVE_WS2_32_lib)
//check_library_exists(WSock32.lib select WINDOWS_SDK_LIBRARIES
HAVE_WSOCK32_lib)
endif()
And here's the output:
Looking for Windows.h
Looking for Windows.h - found
Looking for WinSock2.h
Looking for WinSock2.h - found
Looking for WS2tcpip.h
Looking for WS2tcpip.h - found
Looking for IPHlpApi.h
Looking for IPHlpApi.h - not found
Looking for select in WS2_32
Looking for select in WS2_32 - not found
Looking for select in WSock32
Looking for select in WSock32 - not found
A few interesting things about the results:
-IPHlpApi.h header, it says not found but it clearly exists in C:\Program
Files (x86)\Windows Kits\8.0\Include\um\IPHlpApi.h
-WS2_32.lib, it says not found but it exists at C:/Program Files
(x86)/Windows Kits/8.0/Lib/win8/um/x86/WS2_32.lib
-WSock32.lib, it says not found but it exists at C:/Program Files
(x86)/Windows Kits/8.0/Lib/win8/um/x86/WSock32.lib
-I'm checking for the "select" function which according to MSDN exists in
WS2_32.lib
Is there a way to check for .lib files without required a function?
Wondering if that's the issue with finding the winsock lib files. If so,
then how would I make sure select exists? I could probably just assume it
exists after finding the lib files, but I need successful tests first.
Any help is much appreciated.
Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120813/fec6d00d/attachment.htm>
More information about the CMake
mailing list