2

Is there any automatism in cmake to run qhelpgenerator and get out of it the compressed manual to be included in the executable?

cmake already takes care of a lot of things. As an example, resources files (.qrc) are gracefully handled by adding them to the list of source files of a project. The same applies for the moc generated by qmoc and so on.
I was wondering if there exists something similar to elaborate automatically .qph files. So far, I only found online projects that use custom targets to run qhelpgenerator and set dependencies between targets.
It isn't a problem for itself, I want only to know if there exists a nicer way to do it. That's all.

skypjack
  • 49,335
  • 19
  • 95
  • 187
  • Is this what are you looking for? https://cgit.kde.org/extra-cmake-modules.git/tree/modules/ECMAddQch.cmake – arrowd Jul 03 '17 at 14:31
  • @arrowd More or less. I guess they used custom targets internally for cmake has not (let me say) _native support_ for them, right? – skypjack Jul 03 '17 at 14:33
  • If you don't count `add_custom_target` as native, then yes, I presume. – arrowd Jul 03 '17 at 14:34
  • @arrowd I count `add_custom_target` as native indeed. :-) ... what I meant is that you cannot simply add the `qhp` file to the list of sources and have the `qch` automatically generated, as it happens for `rcc` file or moc. – skypjack Jul 03 '17 at 14:36
  • Yep, it seems, you can't. – arrowd Jul 03 '17 at 14:43
  • @arrowd Well, _no_ is an answer. Feel free to add your own with the link above and I'll accept it if anyone comes with an alternative solution .;-) – skypjack Jul 03 '17 at 14:44
  • The upcoming CMake 3.9 release has upgraded support for Doxygen. It will provide a new [`doxygen_add_docs()`](https://cmake.org/cmake/help/latest/module/FindDoxygen.html#command:doxygen_add_docs) function which makes running Doxygen trivial and Doxygen has direct support for running `qhelpgenerator` and friends. You should be able to set a few variables and then call that function, which will take care of all the custom target stuff for you. Not sure if this helps, you didn't mention what you wanted to run the help generator on (i.e. are you already using Doxygen or not?). – Craig Scott Jul 04 '17 at 20:49
  • @CraigScott Yes I do. This should rather be an answer. ;-) – skypjack Jul 04 '17 at 20:56

2 Answers2

2

(Turning comment into answer)

The upcoming CMake 3.9 release has upgraded support for doxygen. It will provide a new doxygen_add_docs() function which makes running doxygen trivial and doxygen has direct support for running qhelpgenerator and friends. You just need to set a few doxygen-specific variables like DOXYGEN_GENERATE_QHP and then call that function (prefix each of doxygen's variables with DOXYGEN_ to set them in CMake). The function takes care of setting up all the custom target gadgetry.

albert
  • 8,285
  • 3
  • 19
  • 32
Craig Scott
  • 9,238
  • 5
  • 56
  • 85
1

KDE's Extra CMake Modules project contains a CMake module for this. This modules implements .qhc generation with a macro, because, I think, there are too many tweaks and options can be set. Just look at ecm_add_qch signature. Not to mention linking qchs together and exporting targets for use from another CMake project.

arrowd
  • 33,231
  • 8
  • 79
  • 110