Repository navigation
CMake: Problems with include directories / files - #436
jzakrzewski wants to merge 3 commits into
Conversation
"windows.h" includes "winsock.h" what causes many redefinition errors if "winsock2.h" is included afterwards and can cause build to fail.
…ecks Otherwise some following header tests (incorrectly) fail.
|
@snikulov, can you give this a look and tell me what you think? |
|
@jzakrzewski Could you please elaborate more on this change? This change does not make sense to me, because I see no changes in cmake build with it. I've discovered one issue - if OpenSSL/Windows SSPI both defined we got redefinition error during compilation But your change does not solve it. |
|
OK. So this is what I'm getting without those changes: The interesting part is here: This is of course bull*. The problem is obvious when checking the error log: The LDAP headers cannot be found unless I tell CMake where to look. In general we shouldn't need it but I one tried to eliminate the "always check for all headers" behaviour it has been rolled back because of some nasty dependencies on some platforms. The second change is purely a matter of correctness. There will be warnings about redefinitions otherwise as the "windows.h" includes "winsock.h". Other good idea might be to avoid looking for (and using) "winsock.h" if "winsock2.h" is found. |
|
@jzakrzewski Well, could you please just run I'm just curious which options/libraries breaks windows.h detection. Anyway, current configurations in cmake are terrible :) |
|
This seems to work without problems. The error I had (see previous comment) mentions openLDAP headers are missing. This is how I knew the discovered paths were not used. I've looked again and found that libSSH2 tests reset the CMAKE_REQUIRED_INCLUDES. Indeed, running CMake with OpenLDAP and libSSH2-related options only reproduces the error. CMAKE_REQUIRED_INCLUDES is meant for local usage (correct me if I'm wrong) so I'd rather not enforce maintaining it's content across the entire CMake script. What may be important (in case it's not clear): all the libraries I use are self-compiled and in non-standard paths, so neither libs nor headers are visible to compiler when I don't tell him where to look for them. PS: Yeah, it's terrible. When I've started with it I tried to make it nicer but already initial steps have caused others some problems. Unfortunately it mimics autotools behaviour in every possible way. |
|
@jzakrzewski I suspect we should replace
@bradking What do you think? |
|
@snikulov accumulating include directories for the checks makes sense since the checks are accumulating a list of headers to include. |
|
I'd prefer not to accumulate in CMAKE_REQUIRED_INCLUDES but from the other hand right now the entire CMake script work this way. If we all agree, I'll update the pull request. |
|
👍 |
|
Sorry for being a bit slow here, but is this version now using the agreed upon solution? |
|
Hey, no problem. I know you're busy. I think this is it but I wouldn't mind if someone just scanned it for stupidity ;) |
|
@jzakrzewski it's not that I'm disagree with changes, but if you work with LDAP extensively, maybe better put FindLDAP/FindOpenLDAP module to Cmake folder? I think, _BAK variable really not good idea. @bradking What do you think? |
|
It may work but I'll have to make sure that the detection is aligned to curl's needs. When I first started to play with this I was cautious to mimic what's being done in the autotools. The two build systems must behave the same. As for the _BAK - I couldn't figure this one out and didn't want to pollute include directories with something that does not exist. |
|
@snikulov, splitting LDAP search out into dedicated find modules may be of value but is perhaps out of scope for the change here and could be done with follow-up work. It could be part of an effort to reduce accumulation of headers/include-dirs in favor of independent checks (as @jzakrzewski points out would be better in the long run). |
|
@bradking I think nobody will start long run for better, until we have "crutch" ( Russian folklore ). |
|
Thanks everyone for weighing in. I'll merge this asap, and if someone wants to work further on improving the cmake files we can take that separately. |
...during header checks. Otherwise some following header tests (incorrectly) fail. Closes curl#436
Fixed problems I encountered when building cURL 7.44.0 on Windows / Linux / Solaris. Build has been done with libSSH2, OpenSSL, openLDAP, Heimdal / WINSSPI.