1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-07-28 01:41:49 +03:00

cmake: dedupe and merge config detection

Before this patch CMake did feature detections in three files:
`src/CMakefiles.txt`, `examples/CMakefiles.txt` and
`tests/CMakefiles.txt`.

Merge and move them to the root `CMakefiles.txt`.

After this patch we end up with a single `src/libssh2_config.h`. This
brings CMake in sync with autotools builds, which already worked with
a single config header.

This also prevents mistakes where feature detection went out of sync
between `src` & `tests` (see ae90a35d15).
`tests` do compile sources from `src` directly, so these should always
be in sync.

It also allows to better integrate hand-crafted, platform-specific
config headers into the builds, like the one currently residing in
the `win32` directory (and also in `vms` and `os400`). Subject to an
upcoming PR.

Also fix a warning revealed after this patch made CMake correctly
enable `HAVE_GETTIMEOFDAY` for `example` programs.

Closes #906
This commit is contained in:
Viktor Szakats
2023-03-31 18:11:27 +00:00
parent 67ac735ad0
commit ce26743b4e
11 changed files with 112 additions and 220 deletions

View File

@ -283,7 +283,8 @@ int main(int argc, char *argv[])
gettimeofday(&end, NULL);
time_ms = tvdiff(end, start);
fprintf(stderr, "Got %ld bytes in %ld ms = %.1f bytes/sec spin: %d\n",
(long)total, time_ms, (double)total/(time_ms/1000.0), spin);
(long)total, time_ms,
(double)total/((double)time_ms/1000.0), spin);
#else
fprintf(stderr, "Got %ld bytes spin: %d\n", (long)total, spin);
#endif