Changeset View
Changeset View
Standalone View
Standalone View
find-modules/FindQHelpGenerator.cmake
- This file was added.
1 | # WARNING: FOR ECM-INTERNAL USE ONLY, DO NOT USE IN OWN PROJECTS | ||||
---|---|---|---|---|---|
2 | # THIS FILE MIGHT DISAPPEAR IN FUTURE VERSIONS OF ECM. | ||||
3 | | ||||
4 | # Finds the Qt5 QHelpGenerator | ||||
5 | # | ||||
6 | # QHelpGenerator_FOUND - True if QHelpGenerator found. | ||||
7 | # QHelpGenerator_EXECUTABLE - Path to executable | ||||
8 | | ||||
9 | #============================================================================= | ||||
10 | # Copyright 2016 Friedrich W. H. Kossebau <kossebau@kde.org> | ||||
11 | # | ||||
12 | # Redistribution and use in source and binary forms, with or without | ||||
13 | # modification, are permitted provided that the following conditions | ||||
14 | # are met: | ||||
15 | # | ||||
16 | # 1. Redistributions of source code must retain the copyright | ||||
17 | # notice, this list of conditions and the following disclaimer. | ||||
18 | # 2. Redistributions in binary form must reproduce the copyright | ||||
19 | # notice, this list of conditions and the following disclaimer in the | ||||
20 | # documentation and/or other materials provided with the distribution. | ||||
21 | # 3. The name of the author may not be used to endorse or promote products | ||||
22 | # derived from this software without specific prior written permission. | ||||
23 | # | ||||
24 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | ||||
25 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||||
26 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||||
27 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||||
28 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||||
29 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||||
30 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||||
31 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||||
32 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||||
33 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
34 | #============================================================================= | ||||
35 | | ||||
36 | find_package(Qt5Core QUIET) | ||||
37 | if (TARGET Qt5::qhelpgenerator) | ||||
38 | get_target_property(QHelpGenerator_EXECUTABLE Qt5::qhelpgenerator LOCATION) | ||||
39 | else() | ||||
40 | # assume same folder as qmake executable | ||||
41 | if (TARGET Qt5::qmake) | ||||
42 | get_target_property(_qmake_EXECUTABLE Qt5::qmake LOCATION) | ||||
43 | get_filename_component(_path ${_qmake_EXECUTABLE} DIRECTORY) | ||||
44 | else() | ||||
45 | set(_path) | ||||
46 | endif() | ||||
47 | # TODO: prevent that the Qt4 version is picked up | ||||
48 | find_program(QHelpGenerator_EXECUTABLE | ||||
49 | NAMES | ||||
50 | qhelpgenerator-qt5 | ||||
51 | qhelpgenerator | ||||
52 | PATH | ||||
53 | ${_path} | ||||
54 | ) | ||||
55 | endif() | ||||
56 | mark_as_advanced(QHelpGenerator_EXECUTABLE) | ||||
57 | | ||||
58 | if(QHelpGenerator_EXECUTABLE) | ||||
59 | set(QHelpGenerator_FOUND TRUE) | ||||
60 | else() | ||||
61 | set(QHelpGenerator_FOUND FALSE) | ||||
62 | endif() | ||||
63 | | ||||
64 | if(QHelpGenerator_FOUND) | ||||
65 | if(NOT QHelpGenerator_FIND_QUIETLY ) | ||||
66 | message( STATUS "Found QHelpGenerator executable: ${QHelpGenerator_EXECUTABLE}") | ||||
67 | endif() | ||||
68 | else() | ||||
69 | if(QHelpGenerator_FIND_REQUIRED) | ||||
70 | message( FATAL_ERROR "Could not find QHelpGenerator executable" ) | ||||
71 | else() | ||||
72 | message( STATUS "Optional QHelpGenerator executable was not found" ) | ||||
73 | endif() | ||||
74 | endif() | ||||
75 | |