<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.slicer.org/w/index.php?action=history&amp;feed=atom&amp;title=Documentation%2F4.6%2FDevelopers%2FBuild_Module</id>
	<title>Documentation/4.6/Developers/Build Module - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.slicer.org/w/index.php?action=history&amp;feed=atom&amp;title=Documentation%2F4.6%2FDevelopers%2FBuild_Module"/>
	<link rel="alternate" type="text/html" href="https://www.slicer.org/w/index.php?title=Documentation/4.6/Developers/Build_Module&amp;action=history"/>
	<updated>2026-04-25T05:37:23Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.33.0</generator>
	<entry>
		<id>https://www.slicer.org/w/index.php?title=Documentation/4.6/Developers/Build_Module&amp;diff=47874&amp;oldid=prev</id>
		<title>UpdateBot: Nightly -&gt; 4.6</title>
		<link rel="alternate" type="text/html" href="https://www.slicer.org/w/index.php?title=Documentation/4.6/Developers/Build_Module&amp;diff=47874&amp;oldid=prev"/>
		<updated>2016-11-07T07:42:57Z</updated>

		<summary type="html">&lt;p&gt;Nightly -&amp;gt; 4.6&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;noinclude&amp;gt;{{documentation/versioncheck}}&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
= Build module outside of Slicer source tree =&lt;br /&gt;
&lt;br /&gt;
The different [[Documentation/{{documentation/version}}/Developers/Modules|type of modules]] supported by Slicer can easily be built outside of the Slicer source tree.&lt;br /&gt;
&lt;br /&gt;
The following examples are specific to unix-like platforms and can easily be adapted for Windows.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Assuming the source code of your module is located in folder &amp;lt;code&amp;gt;MyModule&amp;lt;/code&amp;gt;, externally building modules could be achieved doing:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ mkdir MyModule-build&lt;br /&gt;
$ cd MyModule-build&lt;br /&gt;
$ cmake -DSlicer_DIR:PATH=/path/to/Slicer-Superbuild/Slicer-build ../MyModule&lt;br /&gt;
$ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this to work, in addition to invoke &amp;lt;code&amp;gt;cmake_minimum_required&amp;lt;/code&amp;gt; at the top of the top-level &amp;lt;code&amp;gt;CMakeLists.txt&amp;lt;/code&amp;gt;, it's important to make sure the following line are added after setting &amp;lt;code&amp;gt;MODULE_NAME&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
find_package(Slicer REQUIRED)&lt;br /&gt;
include(${Slicer_USE_FILE})&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cmake_minimum_required(VERSION 2.8.9)  &amp;lt;- - - - ADD THIS&lt;br /&gt;
&lt;br /&gt;
find_package(Slicer COMPONENTS ConfigurePrerequisites)  &amp;lt;- - - - ADD THIS&lt;br /&gt;
&lt;br /&gt;
project(EmptyExtensionTemplate) &amp;lt;- - - - ADD THIS&lt;br /&gt;
&lt;br /&gt;
#-----------------------------------------------------------------------------&lt;br /&gt;
set(MODULE_NAME ${PROJECT_NAME})&lt;br /&gt;
set(MODULE_TITLE ${MODULE_NAME})&lt;br /&gt;
&lt;br /&gt;
string(TOUPPER ${MODULE_NAME} MODULE_NAME_UPPER)&lt;br /&gt;
&lt;br /&gt;
#-----------------------------------------------------------------------------&lt;br /&gt;
find_package(Slicer REQUIRED)  &amp;lt;- - - - - - - ADD THIS&lt;br /&gt;
include(${Slicer_USE_FILE})  &amp;lt;- - - - - - - - ADD THIS&lt;br /&gt;
&lt;br /&gt;
#-----------------------------------------------------------------------------&lt;br /&gt;
add_subdirectory(Logic)&lt;br /&gt;
&lt;br /&gt;
#-----------------------------------------------------------------------------&lt;br /&gt;
set(MODULE_EXPORT_DIRECTIVE &amp;quot;Q_SLICER_QTMODULES_${MODULE_NAME_UPPER}_EXPORT&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
[...]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After successfully compiling the Slicer module, the Slicer module executables and libraries are located in your module build directory under lib &amp;lt;code&amp;gt;build_dir/lib/Slicer-X.Y/module_type&amp;lt;/code&amp;gt;. Adding this directory to the Additional module paths in the Application Settings GUI within slicer, will allow testing of your module without recompiling the super-build.  Refer to [[Documentation/{{documentation/version}}/Developers/DirectoryStructure|Directory Structure]] description for more details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{:Documentation/{{documentation/version}}/Developers/FAQ/Modules|Modules}}&lt;/div&gt;</summary>
		<author><name>UpdateBot</name></author>
		
	</entry>
</feed>