Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame^] | 1 | From 758ba58c81273d9075a539216f8a322935c2e434 Mon Sep 17 00:00:00 2001 |
| 2 | From: Paul Cercueil <paul@crapouillou.net> |
| 3 | Date: Fri, 12 Nov 2021 16:49:21 +0000 |
| 4 | Subject: [PATCH] CMake: Move include(CheckCSourceCompiles) before its macros |
| 5 | are used |
| 6 | |
| 7 | Move include(CheckCSourceCompiles) before any of the |
| 8 | check_c_source_compiles() macros is called. |
| 9 | |
| 10 | This fixes a CMake error when compiling with WITH_NETWORK_GET_BUFFER |
| 11 | disabled. |
| 12 | |
| 13 | Upstream-Status: Accepted [https://github.com/analogdevicesinc/libiio/commit/758ba58c81273d9075a539216f8a322935c2e434] |
| 14 | |
| 15 | Signed-off-by: Paul Cercueil <paul@crapouillou.net> |
| 16 | --- |
| 17 | CMakeLists.txt | 3 ++- |
| 18 | 1 file changed, 2 insertions(+), 1 deletion(-) |
| 19 | |
| 20 | diff --git a/CMakeLists.txt b/CMakeLists.txt |
| 21 | index 7437136c8210..05b4feff233b 100644 |
| 22 | --- a/CMakeLists.txt |
| 23 | +++ b/CMakeLists.txt |
| 24 | @@ -296,9 +296,10 @@ if(WITH_NETWORK_BACKEND) |
| 25 | endif() |
| 26 | |
| 27 | if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") |
| 28 | + include(CheckCSourceCompiles) |
| 29 | + |
| 30 | option(WITH_NETWORK_GET_BUFFER "Enable experimental zero-copy transfers" OFF) |
| 31 | if (WITH_NETWORK_GET_BUFFER) |
| 32 | - include(CheckCSourceCompiles) |
| 33 | check_c_source_compiles("#define _GNU_SOURCE=1\n#include <fcntl.h>\nint main(void) { return O_TMPFILE; }" |
| 34 | HAS_O_TMPFILE) |
| 35 | |
| 36 | -- |
| 37 | 2.34.1 |
| 38 | |