Browse Source

Try harder to find ncursesw

master
Přemysl Janouch 3 years ago
parent
commit
ae4c89e5a7
4 changed files with 31 additions and 15 deletions
  1. 6
    9
      CMakeLists.txt
  2. 7
    5
      cmake/FindLibEV.cmake
  3. 17
    0
      cmake/FindNcursesw.cmake
  4. 1
    1
      termo

+ 6
- 9
CMakeLists.txt View File

@@ -23,9 +23,8 @@ set (project_VERSION "${project_VERSION}.${project_VERSION_PATCH}")
set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)

# Dependencies
find_package (PkgConfig REQUIRED)
pkg_check_modules (ncursesw REQUIRED ncursesw)
find_package (LibEV REQUIRED)
find_package (Ncursesw REQUIRED)

if (USE_SYSTEM_TERMO)
find_package (Termo REQUIRED)
@@ -41,22 +40,20 @@ else (USE_SYSTEM_TERMO)
set (Termo_LIBRARIES termo-static)
endif (USE_SYSTEM_TERMO)

include_directories (${ncursesw_INCLUDE_DIRS}
${LIBEV_INCLUDE_DIRS} ${Termo_INCLUDE_DIRS})
set (project_libraries ${LIBEV_LIBRARIES} ${Termo_LIBRARIES}
${NCURSESW_LIBRARIES})
include_directories (${LIBEV_INCLUDE_DIRS} ${Termo_INCLUDE_DIRS}
${NCURSESW_INCLUDE_DIRS})

# Configuration
include (CheckFunctionExists)
set (CMAKE_REQUIRED_LIBRARIES ${ncursesw_LIBRARIES})
set (CMAKE_REQUIRED_LIBRARIES ${project_libraries})
CHECK_FUNCTION_EXISTS ("resizeterm" HAVE_RESIZETERM)

# Project source files
set (project_sources ${PROJECT_NAME}.c)
set (project_headers ${PROJECT_BINARY_DIR}/config.h)

# Project libraries
set (project_libraries
${ncursesw_LIBRARIES} ${LIBEV_LIBRARIES} ${Termo_LIBRARIES})

# Generate a configuration file
configure_file (${PROJECT_SOURCE_DIR}/config.h.in ${PROJECT_BINARY_DIR}/config.h)
include_directories (${PROJECT_SOURCE_DIR} ${PROJECT_BINARY_DIR})

+ 7
- 5
cmake/FindLibEV.cmake View File

@@ -5,14 +5,16 @@

# Some distributions do add it, though
find_package (PkgConfig REQUIRED)
pkg_check_modules (LIBEV libev)
pkg_check_modules (LIBEV QUIET libev)

set (required_vars LIBEV_LIBRARIES)
if (NOT LIBEV_FOUND)
find_path (LIBEV_INCLUDE_DIRS ev.h)
find_library (LIBEV_LIBRARIES NAMES ev)

if (LIBEV_INCLUDE_DIRS AND LIBEV_LIBRARIES)
set (LIBEV_FOUND TRUE)
endif (LIBEV_INCLUDE_DIRS AND LIBEV_LIBRARIES)
list (APPEND required_vars LIBEV_INCLUDE_DIRS)
endif (NOT LIBEV_FOUND)

include (FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS (LIBEV DEFAULT_MSG ${required_vars})

mark_as_advanced (LIBEV_LIBRARIES LIBEV_INCLUDE_DIRS)

+ 17
- 0
cmake/FindNcursesw.cmake View File

@@ -0,0 +1,17 @@
# Public Domain

find_package (PkgConfig REQUIRED)
pkg_check_modules (NCURSESW QUIET ncursesw)

# OpenBSD doesn't provide a pkg-config file
set (required_vars NCURSESW_LIBRARIES)
if (NOT NCURSESW_FOUND)
find_library (NCURSESW_LIBRARIES NAMES ncursesw)
find_path (NCURSESW_INCLUDE_DIRS ncurses.h)
list (APPEND required_vars NCURSESW_INCLUDE_DIRS)
endif (NOT NCURSESW_FOUND)

include (FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS (NCURSESW DEFAULT_MSG ${required_vars})

mark_as_advanced (NCURSESW_LIBRARIES NCURSESW_INCLUDE_DIRS)

+ 1
- 1
termo

@@ -1 +1 @@
Subproject commit bc0a71f082296cad0ca590889ead558b70fb39d9
Subproject commit 783b744e8baeb606dd8925547ec0318df3c75237

Loading…
Cancel
Save