summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-03-21 17:37:20 (GMT)
committerBrad King <brad.king@kitware.com>2018-03-21 17:57:45 (GMT)
commit99bf77f49c18f9947b2386c4f5b6308da793de9f (patch)
tree52b3cad33b13e8845d52bb4cc6fc52ec0b8b9052 /CMakeLists.txt
parenta13cfa246fee1ba99eeecda8b8e8d158d29841df (diff)
downloadCMake-99bf77f49c18f9947b2386c4f5b6308da793de9f.zip
CMake-99bf77f49c18f9947b2386c4f5b6308da793de9f.tar.gz
CMake-99bf77f49c18f9947b2386c4f5b6308da793de9f.tar.bz2
ccmake: Check for curses more robustly before enabling
Compute a default for `BUILD_CursesDialog` by building a small test project that uses curses. Disable `ccmake` by default if it fails, and do not search for Curses as part of the main build. This avoids creating FindCurses cache entries when we are not considering ccmake. If `BUILD_CursesDialog` is enabled (e.g. by the user) then warn if curses cannot be found.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt26
1 files changed, 14 insertions, 12 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6623959..a27c662 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -573,23 +573,25 @@ macro (CMAKE_BUILD_UTILITIES)
#---------------------------------------------------------------------
# Use curses?
if (UNIX)
- # there is a bug in the Syllable libraries which makes linking ccmake fail, Alex
- if(NOT CMAKE_SYSTEM_NAME MATCHES syllable)
- set(CURSES_NEED_NCURSES TRUE)
- find_package(Curses QUIET)
- if (CURSES_LIBRARY)
- option(BUILD_CursesDialog "Build the CMake Curses Dialog ccmake" ON)
- else ()
- message("Curses libraries were not found. Curses GUI for CMake will not be built.")
- set(BUILD_CursesDialog 0)
- endif ()
- else()
- set(BUILD_CursesDialog 0)
+ if(NOT DEFINED BUILD_CursesDialog)
+ include(${CMake_SOURCE_DIR}/Source/Checks/Curses.cmake)
+ option(BUILD_CursesDialog "Build the CMake Curses Dialog ccmake" "${CMakeCheckCurses_COMPILED}")
endif()
else ()
set(BUILD_CursesDialog 0)
endif ()
if(BUILD_CursesDialog)
+ set(CURSES_NEED_NCURSES TRUE)
+ find_package(Curses)
+ if(NOT CURSES_FOUND)
+ message(WARNING
+ "'ccmake' will not be built because Curses was not found.\n"
+ "Turn off BUILD_CursesDialog to suppress this message."
+ )
+ set(BUILD_CursesDialog 0)
+ endif()
+ endif()
+ if(BUILD_CursesDialog)
if(NOT CMAKE_USE_SYSTEM_FORM)
add_subdirectory(Source/CursesDialog/form)
elseif(NOT CURSES_FORM_LIBRARY)