Browse Source

Try harder to find ncursesw

Přemysl Janouch 2 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}")
23 23
 set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
24 24
 
25 25
 # Dependencies
26
-find_package (PkgConfig REQUIRED)
27
-pkg_check_modules (ncursesw REQUIRED ncursesw)
28 26
 find_package (LibEV REQUIRED)
27
+find_package (Ncursesw REQUIRED)
29 28
 
30 29
 if (USE_SYSTEM_TERMO)
31 30
 	find_package (Termo REQUIRED)
@@ -41,22 +40,20 @@ else (USE_SYSTEM_TERMO)
41 40
 	set (Termo_LIBRARIES termo-static)
42 41
 endif (USE_SYSTEM_TERMO)
43 42
 
44
-include_directories (${ncursesw_INCLUDE_DIRS}
45
-	${LIBEV_INCLUDE_DIRS} ${Termo_INCLUDE_DIRS})
43
+set (project_libraries ${LIBEV_LIBRARIES} ${Termo_LIBRARIES}
44
+	${NCURSESW_LIBRARIES})
45
+include_directories (${LIBEV_INCLUDE_DIRS} ${Termo_INCLUDE_DIRS}
46
+	${NCURSESW_INCLUDE_DIRS})
46 47
 
47 48
 # Configuration
48 49
 include (CheckFunctionExists)
49
-set (CMAKE_REQUIRED_LIBRARIES ${ncursesw_LIBRARIES})
50
+set (CMAKE_REQUIRED_LIBRARIES ${project_libraries})
50 51
 CHECK_FUNCTION_EXISTS ("resizeterm" HAVE_RESIZETERM)
51 52
 
52 53
 # Project source files
53 54
 set (project_sources ${PROJECT_NAME}.c)
54 55
 set (project_headers ${PROJECT_BINARY_DIR}/config.h)
55 56
 
56
-# Project libraries
57
-set (project_libraries
58
-	${ncursesw_LIBRARIES} ${LIBEV_LIBRARIES} ${Termo_LIBRARIES})
59
-
60 57
 # Generate a configuration file
61 58
 configure_file (${PROJECT_SOURCE_DIR}/config.h.in ${PROJECT_BINARY_DIR}/config.h)
62 59
 include_directories (${PROJECT_SOURCE_DIR} ${PROJECT_BINARY_DIR})

+ 7
- 5
cmake/FindLibEV.cmake View File

@@ -5,14 +5,16 @@
5 5
 
6 6
 # Some distributions do add it, though
7 7
 find_package (PkgConfig REQUIRED)
8
-pkg_check_modules (LIBEV libev)
8
+pkg_check_modules (LIBEV QUIET libev)
9 9
 
10
+set (required_vars LIBEV_LIBRARIES)
10 11
 if (NOT LIBEV_FOUND)
11 12
 	find_path (LIBEV_INCLUDE_DIRS ev.h)
12 13
 	find_library (LIBEV_LIBRARIES NAMES ev)
13
-
14
-	if (LIBEV_INCLUDE_DIRS AND LIBEV_LIBRARIES)
15
-		set (LIBEV_FOUND TRUE)
16
-	endif (LIBEV_INCLUDE_DIRS AND LIBEV_LIBRARIES)
14
+	list (APPEND required_vars LIBEV_INCLUDE_DIRS)
17 15
 endif (NOT LIBEV_FOUND)
18 16
 
17
+include (FindPackageHandleStandardArgs)
18
+FIND_PACKAGE_HANDLE_STANDARD_ARGS (LIBEV DEFAULT_MSG ${required_vars})
19
+
20
+mark_as_advanced (LIBEV_LIBRARIES LIBEV_INCLUDE_DIRS)

+ 17
- 0
cmake/FindNcursesw.cmake View File

@@ -0,0 +1,17 @@
1
+# Public Domain
2
+
3
+find_package (PkgConfig REQUIRED)
4
+pkg_check_modules (NCURSESW QUIET ncursesw)
5
+
6
+# OpenBSD doesn't provide a pkg-config file
7
+set (required_vars NCURSESW_LIBRARIES)
8
+if (NOT NCURSESW_FOUND)
9
+	find_library (NCURSESW_LIBRARIES NAMES ncursesw)
10
+	find_path (NCURSESW_INCLUDE_DIRS ncurses.h)
11
+	list (APPEND required_vars NCURSESW_INCLUDE_DIRS)
12
+endif (NOT NCURSESW_FOUND)
13
+
14
+include (FindPackageHandleStandardArgs)
15
+FIND_PACKAGE_HANDLE_STANDARD_ARGS (NCURSESW DEFAULT_MSG ${required_vars})
16
+
17
+mark_as_advanced (NCURSESW_LIBRARIES NCURSESW_INCLUDE_DIRS)

+ 1
- 1
termo

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

Loading…
Cancel
Save