Operating system: Red Hat Linux 7.6
Slicer version: 4.10.2
Expected behavior: A successful build of a test program
Actual behavior:
I would like to create my own C++ application that calls Slicer
functions with the C++ API.
From my reading of the documentation, it appears that to do this
I need to create a Loadable Module. I attempted to do this using the
Extension Wizard Module in Slicer.
The steps I took were:
Click ‘Create Extension’
Named my extension ‘SlicerTest’
Used Type ‘default’
Destination: /home/jtilton/src/SlicerPrograms
Clicked ‘Add module to extension’
Named it ‘SlicerTest’
Type: loadable
Went to /home/jtilton/src/SlicerPrograms/SlicerTest/SlicerTest
mkdir build
cd build
$ cmake …
Got the error:
CMake Error at Logic/CMakeLists.txt:20 (SlicerMacroBuildModuleLogic):
Unknown CMake command “SlicerMacroBuildModuleLogic”.
Where did I go wrong?
Am I completely off base, or did I just miss some small thing?
To build a loadable module (which is a plugin that can be loaded by Slicer), you need to first have a build tree of Slicer.
You will then configure the SlicerTest module passing -DSlicer_DIR:PATH=/path/to/Slicer-build/Slicer-build
Once the module is built, the build tree will have a folder of the form /path/to/SlicerTest-build/lib/Slicer-4.11/qt-loadables-modules that contains the the plugin to be loaded.
This is the path to pass to Slicer using the additional-path option.
To save the trouble of passing option to Slicer, you should find a convenience launcher called “SlicerWithNameOfExtension” in the module build tree, starting this should be enough to start Slicer with you module loaded.
@jcfr
I have the same problem.
I used the same operation as JamesCTilton to create the module
I run command cmake -DSlicer_DIR:PATH=C:\S4R\Slicer-build …/
It still error:
CMake Error at Logic/CMakeLists.txt:20 (SlicerMacroBuildModuleLogic):
Unknown CMake command “SlicerMacroBuildModuleLogic”.