Line 0
Link Here
|
|
|
1 |
# Heavily inspired by the FindGpgme.cmake file in this same directory. |
2 |
# Written August 2011 by Martin von Gagern for Licq on Gentoo Linux. |
3 |
|
4 |
find_program(_CDKCONFIG_EXECUTABLE NAMES cdk5-config) |
5 |
|
6 |
message(STATUS "Searching for Curses Development Kit (CDK)") |
7 |
if(_CDKCONFIG_EXECUTABLE) |
8 |
|
9 |
message(STATUS " Found cdk5-config: ${_CDKCONFIG_EXECUTABLE}") |
10 |
exec_program(${_CDKCONFIG_EXECUTABLE} ARGS --version OUTPUT_VARIABLE CDK_VERSION) |
11 |
exec_program(${_CDKCONFIG_EXECUTABLE} ARGS --abi-version OUTPUT_VARIABLE CDK_ABIVERSION) |
12 |
message(STATUS " CDK version: ${CDK_VERSION}") |
13 |
|
14 |
exec_program(${_CDKCONFIG_EXECUTABLE} ARGS --cflags OUTPUT_VARIABLE CDK_CFLAGS) |
15 |
set(CDK_INCLUDE_DIR) |
16 |
string(REGEX REPLACE "[ \r\n]+" ";" _flags ${CDK_CFLAGS}) |
17 |
foreach(_flag ${_flags}) |
18 |
if( "${_flag}" MATCHES "^-I" ) |
19 |
string(SUBSTRING "${_flag}" 2 -1 _dir) |
20 |
file(TO_CMAKE_PATH "${_dir}" _dir) |
21 |
set(CDK_INCLUDE_DIR ${CDK_INCLUDE_DIR} ${_dir}) |
22 |
endif() |
23 |
endforeach() |
24 |
|
25 |
exec_program( ${_CDKCONFIG_EXECUTABLE} ARGS --libs OUTPUT_VARIABLE CDK_LIBS ) |
26 |
set(CDK_LIBRARY) |
27 |
string(REGEX REPLACE "[ \r\n]+" ";" _flags ${CDK_LIBS}) |
28 |
foreach(_flag ${_flags}) |
29 |
if( "${_flag}" MATCHES "^-l" ) |
30 |
string(SUBSTRING "${_flag}" 2 -1 _name) |
31 |
set(CDK_LIBRARY ${CDK_LIBRARY} ${_name}) |
32 |
endif() |
33 |
endforeach() |
34 |
|
35 |
else() |
36 |
|
37 |
message(STATUS " No cdk5-config found") |
38 |
find_path(CDK_INCLUDE_DIR cdk.h PATH_SUFFIXES cdk) |
39 |
if(CDK_INCLUDE_DIR) |
40 |
find_library(CDK_LIBRARY NAMES cdkw cdk) |
41 |
endif(CDK_INCLUDE_DIR) |
42 |
|
43 |
endif() |
44 |
|
45 |
if(CDK_LIBRARY) |
46 |
message(STATUS " CDK library: ${CDK_LIBRARY}") |
47 |
message(STATUS " CDK include directory: ${CDK_INCLUDE_DIR}") |
48 |
else() |
49 |
if(CDK_FIND_REQUIRED) |
50 |
message(FATAL_ERROR "Did not find CDK") |
51 |
else() |
52 |
message(STATUS " Did not find CDK") |
53 |
endif() |
54 |
endif() |