Skip to content

Commit

Permalink
CMake: Move include(CheckCSourceCompiles) before its macros are used
Browse files Browse the repository at this point in the history
Move include(CheckCSourceCompiles) before any of the
check_c_source_compiles() macros is called.

This fixes a CMake error when compiling with WITH_NETWORK_GET_BUFFER
disabled.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
  • Loading branch information
pcercuei committed Nov 16, 2021
1 parent c2fbae7 commit 758ba58
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,10 @@ if(WITH_NETWORK_BACKEND)
endif()

if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
include(CheckCSourceCompiles)

option(WITH_NETWORK_GET_BUFFER "Enable experimental zero-copy transfers" OFF)
if (WITH_NETWORK_GET_BUFFER)
include(CheckCSourceCompiles)
check_c_source_compiles("#define _GNU_SOURCE=1\n#include <fcntl.h>\nint main(void) { return O_TMPFILE; }"
HAS_O_TMPFILE)

Expand Down

0 comments on commit 758ba58

Please sign in to comment.