Skip to content

Commit

Permalink
cmake: fix error for CMake before v3.28
Browse files Browse the repository at this point in the history
On some distributions with non-latest CMake, it will fail on configuration due to its incapability of substition from unset variable to an empty string. To fix this, we need to add double quotes between variables that will be tested by EQUAL, LESS, GREATER, and other related keywords. For better compatibility, use STREQUAL instead of EQUAL if possible.

Signed-off-by: Athaariq Ardhiansyah <[email protected]>
  • Loading branch information
Thor-x86 committed Jun 2, 2024
1 parent 6e8ee4c commit 24f3ca3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cmake/build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ if(${BACKEND_TYPE} MATCHES "^DRM-(GBM|EGLSTREAM)$")
)

# Indicate whether libsystemd must replace libuv
if(${LIBSYSTEMD_FOUND} EQUAL 1)
if("${LIBSYSTEMD_FOUND}" STREQUAL "1")
add_definitions(-DUSE_LIBSYSTEMD)
endif()
endif()
Expand Down
8 changes: 5 additions & 3 deletions cmake/package.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ if(${BACKEND_TYPE} MATCHES "^DRM-(GBM|EGLSTREAM)$")
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
# Check if either systemd or libuv exist
if((NOT ${LIBSYSTEMD_FOUND} EQUAL 1) AND (NOT ${LIBUV_FOUND} EQUAL 1))
message(FATAL_ERROR "${BACKEND_TYPE} backend requires either libsystemd or libuv, but they're not exist.")
elseif((${LIBSYSTEMD_FOUND} EQUAL 1) AND (${LIBUV_FOUND} EQUAL 1))
if((NOT "${LIBSYSTEMD_FOUND}" STREQUAL "1") AND (NOT "${LIBUV_FOUND}" STREQUAL "1"))
message(FATAL_ERROR
"${BACKEND_TYPE} backend requires either libsystemd or libuv, but
they're not exist.")
elseif(("${LIBSYSTEMD_FOUND}" STREQUAL "1") AND ("${LIBUV_FOUND}" STREQUAL "1"))
message("!! NOTICE: libsystemd found, libuv won't be used.")
endif()
elseif(${BACKEND_TYPE} STREQUAL "X11")
Expand Down

0 comments on commit 24f3ca3

Please sign in to comment.