common: flush stdout before replacing
[gtk-doc.git] / cmake / GtkDocScanGObjWrapper.cmake
blob4ad7d2e35478261754b101bb5aaa0aadebdbfd78
1 # Internal -- for use with UseGtkDoc.cmake
3 #=============================================================================
4 # Copyright 2009 Rich Wareham
5 # Copyright 2015 Lautsprecher Teufel GmbH
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.
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.
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 #=============================================================================
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.2)
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)
31 foreach(_flag ${EXTRA_CFLAGS} ${GLIB_CFLAGS})
32     set(ENV{CFLAGS} "$ENV{CFLAGS} \"${_flag}\"")
33 endforeach(_flag)
35 foreach(_flag ${EXTRA_LDFLAGS} ${GLIB_LDFLAGS})
36     set(ENV{LDFLAGS} "$ENV{LDFLAGS} \"${_flag}\"")
37 endforeach(_flag)
39 foreach(_flag ${EXTRA_LDPATH})
40     if(ENV{LD_LIBRARY_PATH})
41         set(ENV{LD_LIBRARY_PATH} "$ENV{LD_LIBRARY_PATH}:\"${_flag}\"")
42     else(ENV{LD_LIBRARY_PATH})
43         set(ENV{LD_LIBRARY_PATH} "${_flag}")
44     endif(ENV{LD_LIBRARY_PATH})
45 endforeach(_flag)
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}")
52 execute_process(COMMAND ${GTKDOC_SCANGOBJ_EXE}
53     "--module=${doc_prefix}"
54     "--types=${output_types}"
55     "--output-dir=${output_dir}"
56     WORKING_DIRECTORY "${output_dir}"
57     RESULT_VARIABLE _scan_result)
59 if(_scan_result EQUAL 0)
60     message(STATUS "Scan succeeded.")
61 else(_scan_result EQUAL 0)
62     message(SEND_ERROR "Scan failed.")
63 endif(_scan_result EQUAL 0)
65 endif(NOT APPLE)
67 # vim:sw=4:ts=4:et:autoindent