From 64807353df8515ff8ab34b3c4cdf7039ba7eda00 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Fri, 20 May 2022 23:19:24 -0400 Subject: [PATCH] cmake: Don't try to use readline if you don't also have curses. Fixes #17. --- CMakeLists.txt | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6efdbda..f6fb6a4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -209,13 +209,15 @@ if(PHYSFS_BUILD_TEST) find_path(HISTORY_H readline/history.h) if(READLINE_H AND HISTORY_H) find_library(CURSES_LIBRARY NAMES curses ncurses) - set(CMAKE_REQUIRED_LIBRARIES ${CURSES_LIBRARY}) - find_library(READLINE_LIBRARY readline) - if(READLINE_LIBRARY) - set(HAVE_SYSTEM_READLINE TRUE) - set(TEST_PHYSFS_LIBS ${TEST_PHYSFS_LIBS} ${READLINE_LIBRARY} ${CURSES_LIBRARY}) - include_directories(SYSTEM ${READLINE_H} ${HISTORY_H}) - add_definitions(-DPHYSFS_HAVE_READLINE=1) + if(CURSES_LIBRARY) + set(CMAKE_REQUIRED_LIBRARIES ${CURSES_LIBRARY}) + find_library(READLINE_LIBRARY readline) + if(READLINE_LIBRARY) + set(HAVE_SYSTEM_READLINE TRUE) + set(TEST_PHYSFS_LIBS ${TEST_PHYSFS_LIBS} ${READLINE_LIBRARY} ${CURSES_LIBRARY}) + include_directories(SYSTEM ${READLINE_H} ${HISTORY_H}) + add_definitions(-DPHYSFS_HAVE_READLINE=1) + endif() endif() endif() add_executable(test_physfs test/test_physfs.c)