Debian Codegraph @

buildsystems/cmake/GtkDocScanGObjWrapper.cmake

raw
1 # Internal -- for use with UseGtkDoc.cmake
2 #
3 #=============================================================================
4 # Copyright 2009 Rich Wareham
5 # Copyright 2015 Lautsprecher Teufel GmbH
6 #
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
11 #
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #=============================================================================
20
21 # This is needed for find_package(PkgConfig) to work correctly --
22 # CMAKE_MINIMUM_REQUIRED_VERSION needs to be defined.
23 cmake_minimum_required(VERSION 3.12)
24
25 if(NOT APPLE)
26 # We use pkg-config to find glib et al
27 find_package(PkgConfig)
28 # Find glib et al
29 pkg_check_modules(GLIB REQUIRED glib-2.0 gobject-2.0)
30
31 foreach(_flag ${EXTRA_CFLAGS} ${GLIB_CFLAGS})
32 set(ENV{CFLAGS} "$ENV{CFLAGS} '${_flag}'")
33 endforeach(_flag)
34
35 foreach(_flag ${EXTRA_LDFLAGS} ${GLIB_LDFLAGS})
36 set(ENV{LDFLAGS} "$ENV{LDFLAGS} '${_flag}'")
37 endforeach(_flag)
38
39 foreach(_flag ${EXTRA_LDPATH})
40 if(DEFINED ENV{LD_LIBRARY_PATH})
41 set(ENV{LD_LIBRARY_PATH} "$ENV{LD_LIBRARY_PATH}:${_flag}")
42 else(DEFINED ENV{LD_LIBRARY_PATH})
43 set(ENV{LD_LIBRARY_PATH} "${_flag}")
44 endif(DEFINED ENV{LD_LIBRARY_PATH})
45 endforeach(_flag)
46
47 message(STATUS "Executing gtkdoc-scangobj with:")
48 message(STATUS " CFLAGS: $ENV{CFLAGS}")
49 message(STATUS " LDFLAGS: $ENV{LDFLAGS}")
50 message(STATUS " LDPATH: $ENV{LD_LIBRARY_PATH}")
51
52 execute_process(COMMAND ${GTKDOC_SCANGOBJ_EXE}
53 "--module=${doc_prefix}"
54 "--types=${output_types}"
55 "--output-dir=${output_dir}"
56 ${_scanobjopts}
57 WORKING_DIRECTORY "${output_dir}"
58 RESULT_VARIABLE _scan_result)
59
60 if(_scan_result EQUAL 0)
61 message(STATUS "Scan succeeded.")
62 else(_scan_result EQUAL 0)
63 message(SEND_ERROR "Scan failed.")
64 endif(_scan_result EQUAL 0)
65
66 endif(NOT APPLE)
67
68 # vim:sw=4:ts=4:et:autoindent