[CMake] Distinguish two header files with same name using cmake

dmh at ucar.edu dmh at ucar.edu
Mon Aug 14 17:33:09 EDT 2017


I have the following situation using cmake
1. Running windows 7
2. Both cygwin and visual studio (VS) community edition (version 14)
    installed.
3. I am building with visual studio as my compiler.
4. Cygwin has winsock2.h in /usr/include/w32api
    The VS community edition does not have winsock2.h
5. Note that some older (non community edition) versions of VS do have
    winsock2.h defined.
6. CHECK_INCLUDE_FILE("winsock2.h", HAVE_WINSOCK2_H) returns true
    because it is finding the cygwin version instead of the VS version.

The question is how do I see if the installed VS has winsock2.h defined 
while ignoring any cygwin version.

The reason I need to know this is that the presence of winsock2.h in VS 
is causing a conflict with another package (libcurl). I can work around 
the conflict if I know if the VS installation has winsock2.h (or not).

I speculate that I need to prevent CMake from searching w32api.
I considered using CMAKE_REQUIRED_INClUDES to remove a directory 
(/usr/include/w32api), but I can see no way to do that.

Suggestions?



More information about the CMake mailing list