How to include help files (HTMLDefines.h, MyApp.hhc, MyApp.hhk, MyApp.hhp) in the binary directory to get MyApp.chm help file in VS2013?


I have a project in VS2013 and I want to include ITK and VTK libraries using CMake. I configured my CMakeList.txt to include the files of source code of my application. But, I do not know how to make compile the help file for the User Manual of my application.

First - this is my environment:

  • OS: Windows 10 Pro x64
  • IDE: Visual Studio 2013 Ultimate
  • Cmake: 3.14.6 version x64
  • ITK: 4.13.2 version
  • VTK: 8.1.0 version
  • MyApp: It is a MFC application

Second - CMakeLists.txt (1.0 KB) my CMakeLists.txt

Third - this my problem:

  • Configuration and Generation in CMake: No problem.
  • Compiling my project in VS2013: No problem
  • Compiling the help file (MyApp.chm): Not compiled <== This is my problem

In the source directory the help file compile together with my application correctly. But, when I use CMake to include ITK and VTK libraries in my project and I compile it after in the binary directory, the help file is absent. I know this not an error of CMake, this is because I do not know how to make it. For that reason I ask you for some help.

Thanks in advanced.

Your top-level CMakeLists.txt is simple enough, but it says nothing about help file. If you share CMakeLists.txt from hlp folder, we might be able to offer more help.

But I expect that you will need to add a custom build step to build your help file.

Hi Dženan.

This is my CMakeLists.txt file from hlp directory: CMakeLists.txt (99 Bytes)

I found it incomplete, but I do really do not know how make it.


What build steps does MyApp.chm has in regular Visual Studio project? That’s what we need to add as the custom build step in CMake.


In the original MyApp.vcxproj appears the following:
MyApp.vcxproj.txt (3.2 KB)

Then in MyApp.vcxproj generated with CMake does not appears nothing about.

How can I make it with CMakeLists.txt files?


So this is the build script which generates hlp\HTMLDefines.h:

echo // Generated Help Map file. Used by Stassis.HHP. > "hlp\HTMLDefines.h"
echo. > "hlp\HTMLDefines.h"
echo // Commands (ID_* and IDM_*) >> "hlp\HTMLDefines.h"
makehm /h ID_,HID_,0x10000 IDM_,HIDM_,0x10000 "$(InputFileName)" >> "hlp\HTMLDefines.h"
echo. >> "hlp\HTMLDefines.h"
echo // Prompts (IDP_*) >> "hlp\HTMLDefines.h"
makehm /h IDP_,HIDP_,0x30000 "$(InputFileName)" >> "hlp\HTMLDefines.h"
echo. >> "hlp\HTMLDefines.h"
echo // Resources (IDR_*) >> "hlp\HTMLDefines.h"
makehm /h IDR_,HIDR_,0x20000 "$(InputFileName)" >> "hlp\HTMLDefines.h"
echo. >> "hlp\HTMLDefines.h"
echo // Dialogs (IDD_*) >> "hlp\HTMLDefines.h"
makehm /h IDD_,HIDD_,0x20000 "$(InputFileName)" >> "hlp\HTMLDefines.h"
echo. >> "hlp\HTMLDefines.h"
echo // Frame Controls (IDW_*) >> "hlp\HTMLDefines.h"
makehm /h /a afxhh.h IDW_,HIDW_,0x50000 "$(InputFileName)" >> "hlp\HTMLDefines.h"

What is the $(InputFileName) for this script? This could be turned into a batch file to be invoked by CMake via custom build step.

Also, there should be additional steps to process files from Help_SRCS list (HTMLDefines.h, Stassis.hhc, Stassis.hhk, Stassis.hhp) and produce MyApp.chm. I don’t know what those steps should be, as I have not created .chm help files.

And this is more of a question for CMake mailing list, as it has very little to do with ITK.