src: omit hugehelp and ca-embed from libcurltool

CMake builds using the Xcode generator broke with an error saying it
doesn't support multiple targets depending on the same custom commands.
These custom commands are generating `tool_hugehelp.c` and
`tool_c_embed.c` for the curl tool and libcurltool.

`unit1394` and `unit1604` tests use libcurltool to test tool-specific
functions. They don't need hugehelp and ca-embed. It's thus safe to
disable and exclude them when compiling the sources for libcurltool.
Use the `UNITTESTS` macro to detect a libcurltool build within C.

After this patch these sources are solely used for building the curl
tool. Making the build compatible with the CMake Xcode generator.

Apply the change to autotools too to keep build systems synchronized.

Follow-up to 12a6de2f66 #16043
Closes #16068
This commit is contained in:
Viktor Szakats 2025-01-21 17:11:45 +01:00
parent 8dfd271c35
commit 96843f4ef7
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
5 changed files with 37 additions and 22 deletions

View file

@ -30,7 +30,9 @@
#include "tool_util.h"
#include "tool_version.h"
#include "tool_cb_prg.h"
#ifndef UNITTESTS
#include "tool_hugehelp.h"
#endif
#include "tool_getparam.h"
#include "terminal.h"
@ -284,11 +286,13 @@ void tool_help(char *category)
msnprintf(cmdbuf, sizeof(cmdbuf), "\n --no-%s", a->lname);
else
msnprintf(cmdbuf, sizeof(cmdbuf), "\n %s", category);
#ifndef UNITTESTS
if(a->cmd == C_XATTR)
/* this is the last option, which then ends when FILES starts */
showhelp("\nALL OPTIONS\n", cmdbuf, "\nFILES");
else
showhelp("\nALL OPTIONS\n", cmdbuf, "\n -");
#endif
}
#else
fprintf(tool_stderr, "Cannot comply. "