curl-library
Re: [PATCH] CMake // windows build fix
Date: Fri, 09 Jan 2015 13:28:53 +0100
On Thursday 08 January 2015 11:44:43 Brad King wrote:
> On 12/23/2014 4:28 PM, Sergei Nikulov wrote:
> > The issue related to winsock2 detection after openssl already found (it will include windows.h first).
> > In this case - winsock2 check will fail and marked as not found
> > I've solve this issue by explicit definition -D_WINSOCKAPI_ in
> > CMAKE_REQUIRED_DEFINITIONS for WIN32 build generation.
>
> A simpler solution is to use just check_include_file instead of
> check_include_file_concat for openssl headers. They do not
> need to be included in the accumulated, ordered system headers.
> Something like this should work:
>
> - check_include_file_concat("openssl/crypto.h" HAVE_OPENSSL_CRYPTO_H)
> - check_include_file_concat("openssl/engine.h" HAVE_OPENSSL_ENGINE_H)
> - check_include_file_concat("openssl/err.h" HAVE_OPENSSL_ERR_H)
> - check_include_file_concat("openssl/pem.h" HAVE_OPENSSL_PEM_H)
> - check_include_file_concat("openssl/pkcs12.h" HAVE_OPENSSL_PKCS12_H)
> - check_include_file_concat("openssl/rsa.h" HAVE_OPENSSL_RSA_H)
> - check_include_file_concat("openssl/ssl.h" HAVE_OPENSSL_SSL_H)
> - check_include_file_concat("openssl/x509.h" HAVE_OPENSSL_X509_H)
> - check_include_file_concat("openssl/rand.h" HAVE_OPENSSL_RAND_H)
> + check_include_file("openssl/crypto.h" HAVE_OPENSSL_CRYPTO_H)
> + check_include_file("openssl/engine.h" HAVE_OPENSSL_ENGINE_H)
> + check_include_file("openssl/err.h" HAVE_OPENSSL_ERR_H)
> + check_include_file("openssl/pem.h" HAVE_OPENSSL_PEM_H)
> + check_include_file("openssl/pkcs12.h" HAVE_OPENSSL_PKCS12_H)
> + check_include_file("openssl/rsa.h" HAVE_OPENSSL_RSA_H)
> + check_include_file("openssl/ssl.h" HAVE_OPENSSL_SSL_H)
> + check_include_file("openssl/x509.h" HAVE_OPENSSL_X509_H)
> + check_include_file("openssl/rand.h" HAVE_OPENSSL_RAND_H)
>
> > Also I've fixed tools_hugehelp.c generation using "cmake -E echo" command.
>
> In this hunk:
>
> > + COMMAND ${CMAKE_COMMAND} -E echo "/* built-in manual is disabled, blank function */" > "tool_hugehelp.c"
> > + COMMAND ${CMAKE_COMMAND} -E echo "\#include \"tool_hugehelp.h\"" >> "tool_hugehelp.c"
> > + COMMAND ${CMAKE_COMMAND} -E echo "void hugehelp(void) {}" >> "tool_hugehelp.c"
>
> The backslash in "\#include..." should not be needed.
>
> The addition of quotes to the redirected file names
> is not necessary but does not hurt either.
>
> -Brad
Cool, this is a small oversight from my side. Be careful with shell
meta characters though. For "COMMAND", I have tried various options
(including single quotes), but it seems that cmake interprets double
quotes and then the shell receives `echo #include "tool_hugehelp.h" >>
tool_hugehelp.c` instead. As '#' marks the begin of a comment,
tool_hugehelp.c is not written. I do not know how relevant this is for
`cmake -E echo`, maybe it is affected too (or not).
The patch *looks* OK to me, but I have not tested it (see also the above
concern).
-- Kind regards, Peter https://lekensteyn.nl ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.htmlReceived on 2015-01-09