Use SlicerOpenIGTLink module in mainwindow of customized Slicer

I am developing customized Slicer by SlicerCAT. I added an button to toolbar of slicer mainwindow to allow toggling IGTLConnector. So I import vtkMRMLIGTLConnectorNode.h file of SlicerOpenIGTLink module in c++ code. But I encountered “No such file” error when compiling the source code:

I have added SlicerOpenIGTLink module in CMakelist.txt of SlicerCAT

set(extension_name "SlicerOpenIGTLink")
set(${extension_name}_SOURCE_DIR "${CMAKE_BINARY_DIR}/${extension_name}")
  SOURCE_DIR     ${${extension_name}_SOURCE_DIR}
  GIT_REPOSITORY /home/lizhixue/project/3D_Slicer/SlicerDependency/extensions/SlicerOpenIGTLink
  GIT_TAG        schcat
message(STATUS "Remote - ${extension_name} [OK]")
list(APPEND Slicer_EXTENSION_SOURCE_DIRS ${${extension_name}_SOURCE_DIR})

And it can be used in GUI and python code in my customized Slicer.
How can I made .h file of SlicerOpenIGTLink module be find when compiling c++ source code?

Who can help me? (;´▽`)

You need to add SlicerIGT folders that include relevant .h files to include files and add relevant .lib files to link targets. See for example SlicerPathReconstruction/PathReconstruction/MRML/CMakeLists.txt at master · SlicerIGT/SlicerPathReconstruction · GitHub

Thank you!I will try it.

I did it when I found the correct parameter name such as “vtkSlicerOpenIGTLinkIFModuleMRML_INCLUDE_DIRS”. Example is very useful !