Where is Slicerconfig.cmake

Hi every one,
I wana building an extension(MABMIS) for slicer by CMake but I get this Error:

CMake Error at CMakeLists.txt:12 (find_package):
By not providing "FindSlicer.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Slicer", but
CMake did not find one.
Could not find a package configuration file provided by "Slicer" with any
of the following names:


Add the installation prefix of "Slicer" to CMAKE_PREFIX_PATH or set
"Slicer_DIR" to a directory containing one of the above files. If "Slicer"
provides a separate development package or SDK, be sure it has been

So I build the slicer from sources but these files did not created, Where does they build usually?


what is the cmake command you are using for your extension? You need to specify Slicer-build folder location.

1 Like

I am using cmake GUI, so I just specify source and build folders. (so I do not use any command). I specify slicer build location but it said to me it can not find:


What version of cmake are you using? I suggest to use the newest version for example 3.12.0.

Is your Slicer build completed successfully? Does Slicer start if you run Slicer.exe in your build tree?

Make sure you specify Slicer-build subfolder and not the top-level build directory.

No I found that it did not completed successfully, I have this error in slicer configuration step:

CMake Error at CMake/SlicerBlockFindQtAndCheckVersion.cmake:45 (message):
error: Qt 4.7.4 was not found on your system.You probably need to set the
Call Stack (most recent call first):
CMake/SlicerBlockFindQtAndCheckVersion.cmake:110 (__SlicerBlockFindQtAndCheckVersion_find_qt)
CMakeLists.txt:602 (include)

I am building slicer with its proposed steps. It proposed Qt version 5.1.0, which I downloaded and install successfully. I changed QT_QMAKE_EXECUTABLE to


and still I have that error.

You need to set Qt5_DIR as described in build instructions.

Thanks @lassoan,
I set it but now it does not find some sub directories:


and ten others. I installed Qt5 by [qt-unified-windows-x86-online.exe].

Did you remove build directory before running cmake? Clean up build directory (delete it and create new empty) and then set Qt5_DIR according to this Build Error PythonQt Visual Studio 2015 Qt 5.9.2.

Yes I built in a completely new folder. You know, there is no such a folder with those names(Qt5PHONON , Qt5QTCORE , Qt5QTGUI) in that directory.

It seems that you have partially configured your the CMake project before provided Qt5 directory. You need to start again from scratch and follow configuration instructions very accurately, especially the bold part: do not click configure before specifying Qt5_DIR.

It is difficult to pay attention to all details each time you rebuild Slicer, therefore I always build Slicer using a batch file. In the .bat file you can specify CMake options using command-line options. I’ve added a few examples to Windows configuration instructions.

Thanks @lassoan, It now configured completely without any error.

1 Like

After I configured it successfully by CMake, I generated slicer.sln and then built it using vs2015 x64. But it configured with 50 succeeded and 2 failed which I do not understand them. I see in error list just this description:

Error MSB6006 “cmd.exe” exited with code 1. Slicer C:\Program Files
(x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets 171

What is wrong with my building?

Did you follow the advice below, as described in windows-specific instructions?

In case of any build error, use very short directory names: C:\S4 for source directory, C:\S4D for debug build, C:\S4R for release build.

Yes I think that was too short, but now I am building it again using exactly the same directories you said (but in drive D!). Thanks @fedorov

This indicates that some of the targets were failed to build, but does not tell what was the problem. You should find the actual error message in the full build log (c:\D\S4D\Testing\Temporary\LastBuild_YYYMMDD-HHMM.log).

@lassoan, The folder you mentioned is empty. I built it again and now I can see the slicer.exe and SlicerConfig.cmake in slicer-build folder (but it has 2 failed again).
Thank you so much

Build logs should be in similarly named files. You can also just scroll up to see which project failed and open .sln file of that project and build it. Make sure to choose correct project configuration (Debug/Release) before start building.