Computer Assited Medical Intervention Tool Kit  version 4.0
Modules | Functions

The CMake macros especially defined to configure CMake projects using CamiTK. More...

Modules

 cdash
 CamiTK CMake macros used for continuous integration purpose.
 
 packaging
 CamiTK CMake macros used to create package of the CamiTK project (a custom CEP or the CamiTK project itself).
 
 test
 CamiTK CMake macros used for testing.
 

Functions

 camitk_application ()
 macro camitk_application simplify writing a CMakeLists.txt for CamiTK application extension More...
 
 camitk_extension ()
 Macro camitk_extension simplifies writing a camitk extension (component, action) More...
 
 camitk_extension_project ()
 macro camitk_extension_project creates an optional (disabled by default) CEP (CamiTK Extension Project) subdirectory the build. More...
 
 camitk_install_all_headers ()
 camitk_install_all_headers is a macro that install all header files of a project at build and install time More...
 
 camitk_library ()
 macro camitk_library simplifies the declaration of a library inside CamiTK and is to be used for all inner project libraries More...
 
 camitk_translate ()
 macro camitk_translate allows to perform the translation of any project (action, component, application and libraries) in several languages. More...
 

Detailed Description

The CMake macros especially defined to configure CMake projects using CamiTK.

Function Documentation

◆ camitk_application()

camitk_application ( )

macro camitk_application simplify writing a CMakeLists.txt for CamiTK application extension

The name of the application is automatically the name of the directory from where this macro is called prefixed with "camitk-"

On Unix additional system resources can also be automatically installed or configured: man pages, desktop file and XPM icons.

To write a simple man page, please refer to SDK application examples. If you need to generate a simple manpage or analyze the command line arguments, the CamiTK team recommands to use Code Synthesis CLI configuration (see http://codesynthesis.com/projects/cli)

usage:

[DISABLED]
[NEEDS_ITK]
[NEEDS_PYTHON]
[NEEDS_CEP_LIBRARIES CEPLib1 CEPLib12 ...]
[NEEDS_COMPONENT_EXTENSION component1 component2 ...]
[NEEDS_ACTION_EXTENSION ation1 action2 ...]
[DEFINES flag1 flag2 ...]
[CXX_FLAGS flag1 flag2 ...]
[ADDITIONAL_SOURCES source.cxx source.cpp ...]
[INCLUDE_DIRECTORIES dir1 dir2 ...]
[EXTERNAL_LIBRARIES lib1 lib2 ...]
[EXTRA_TRANSLATE_LANGUAGE]
)
Parameters
DISABLEDmeans this is a default application is NOT to be compiled automatically
NEEDS_ITKmeans this application requires ITK to be compiled / run.
NEEDS_CEP_LIBRARIESlist of needed camitk CEP libraries
NEEDS_COMPONENT_EXTENSIONlist of needed component extensions
NEEDS_ACTION_EXTENSIONlist of needed component extensions
DEFINESlist of define flags to add at compilation time
CXX_FLAGSlist of compiler flags to add (such as warning levels (-Wall ...)).
ADDITIONAL_SOURCESlist of additional sources (that cannot be automatically found by gather_headers_and_sources macro)
CEP_NAMEspecify the CEP_NAME, which is used to categorized the application for packaging purpose No CEP_NAME provided will result in default categorization (generic application).
DESCRIPTIONSimple description of the application. Used for packaging presentation for instance.
INCLUDE_DIRECTORIESadditional include directories
EXTERNAL_LIBRARIESexternal libraries to add to the link command
EXTRA_TRANSLATE_LANGUAGEAdditionnal extra language to translate the application

◆ camitk_extension()

camitk_extension ( )

Macro camitk_extension simplifies writing a camitk extension (component, action)

The name of the extension is automatically the name of the directory from where this macro is called, unless it is overriden by the TARGET_NAME parameter.

usage:

[DISABLED]
[NEEDS_ITK]
[NEEDS_LIBXML2]
[NEEDS_OPENCV]
[NEEDS_IGSTK]
[NEEDS_XSD]
[NEEDS_GDCM]
[NEEDS_ACTION_EXTENSION action1 action2 ...]
[NEEDS_COMPONENT_EXTENSION component1 component2 ...]
[NEEDS_CEP_LIBRARIES CEPLib1 CEPLib2 ...]
[INCLUDE_DIRECTORIES dir1 dir2 ...]
[DEFINES flag1 flag2 ...]
[CXX_FLAGS flag1 flag2 ...]
[EXTERNAL_SOURCES file1 file2 ...]
[EXTERNAL_LIBRARIES lib1 lib2 ...]
[HEADERS_TO_INSTALL header1.h header2.h ...]
[INSTALL_ALL_HEADERS]
[TARGET_NAME non-default-targetname]
[TEST_APPLICATION application-name]
[DESCRIPTION description]
[EXTRA_TRANSLATE_LANGUAGE]
[TEST_FILES file1 file2 ...]
)
Parameters
<type>= REQUIRED. The selected type of extension you wish to build.
DISABLED= means this is a not a default extension, it will not be compiled automatically
NEEDS_ITK= add this if your component needs ITK. Do not forget to add the needed list of ITK libraries in the LIBRARIES parameter
NEEDS_LIBXML2= add this if your component needs libxml2
NEEDS_XSD= add this if your action needs Codesynthesis xsd cxx (xml schema compiler)
NEEDS_OPENCV= add this if your component needs OpenCV
NEEDS_IGSTK= add this if your component needs IgsTK
NEEDS_XERCESC= add this if your action / component needs XercesC library
NEEDS_GDCM= Add this, if your extension requires GDCM 2.x library
NEEDS_CEP_LIBRARIES= list of needed CEP libraries (not external dependencies)
NEEDS_COMPONENT_EXTENSION= list of needed component extensions
NEEDS_ACTION_EXTENSION= list of needed component extensions
INCLUDE_DIRECTORIES= additional include directories
DEFINES= list of define flags to add at compilation time.
CXX_FLAGS= list of compiler flags to add (such as warning levels (-Wall ...)).
EXTERNAL_SOURCES= list of extra source/headers files (external to the current directory) that needed to be added to the SOURCES variable. Note: EXTERNAL_SOURCES are not installed
EXTERNAL_LIBRARIES= external libraries to add to the link command
HEADERS_TO_INSTALL= list of headers to install, if present this will automatically create an "install-COMPONENT_NAMEcomponent" target, that can be used anywhere else to manage dependencies to this component. The headers are installed ${CAMITK_BUILD_INCLUDE_DIR}/COMPONENT_NAME when the target "install-COMPONENT_NAMEcomponent" is called.
INSTALL_ALL_HEADERS= install all of the headers (this is the lazy solution, please consider making a list and using HEADERS_TO_INSTALL parameter instead!
TARGET_NAME= specify a target name different than the default (default is the action/component directory name) this can be very useful for example when you have action/component directory in your CEP that has the same name as one in the camitk opensource.
CEP_NAME= specify the CEP_NAME, which is used to categorized the extension for packaging purpose No CEP_NAME provided will result in default categorization (generic extension).
TEST_APPLICATION= The name of the application to provide for generate automatic basic tests on your extension. No option means no tests!
DESCRIPTION= Simple description of the extension. Used for packaging presentation for instance.
EXTRA_TRANSLATE_LANGUAGE= Additionnal extra language to translate the application
TEST_FILES= Parameter of TestActions module : REQUIRED. List of files on which the action must applied.

References camitk_add_test(), camitk_init_test(), camitk_parse_test_add(), camitk_parse_test_add_separator(), camitk_sub_project_add(), camitk_translate(), execute_process(), export_headers(), gather_headers_and_sources(), get_directory_name(), get_subdirectoryfiles(), include(), parse_arguments(), and usage().

◆ camitk_extension_project()

camitk_extension_project ( )

macro camitk_extension_project creates an optional (disabled by default) CEP (CamiTK Extension Project) subdirectory the build.

Usage:

[ENABLED]
[NAME cepName]
[DESCRIPTION longDescription]
[DEFAULT_APPLICATION exeName]
[NEEDS_CEP cep1 cep2...]
[LICENSE licenseName]
)
Parameters
CONTACTMandatory, this is the person(s) to contact to get more information about the CEP
ENABLEDIf used, this CEP is forced by default (otherwise the user as to tick the option in CMake GUI or defined a -DCEP_<cepName>:BOOL=TRUE on the command line
NAMEBy default the name of a CEP is given automatically by the name of the top level source directory If you specify a name here, the directory name will be ignored
DESCRIPTIONA (not so) small description of this CEP (objective, content, implementation information)
DEFAULT_APPLICATIONThe default application to run (for MSVC launchers), default is camitk-imp
NEEDS_CEP(TODO) Dependencies to other CEP
LICENSEThe name of the license for this CEP, default is LGPL-v3

◆ camitk_install_all_headers()

camitk_install_all_headers ( )

camitk_install_all_headers is a macro that install all header files of a project at build and install time

Duplicate headers installation:

  • one is used at compiled time and puts everything in ${CMAKE_BINARY_DIR}/include/${CAMITK_SHORT_VERSION_STRING}/${GroupName}/${ComponentName}/...
  • the other one is used at installation time and puts everything in ${CMAKE_INSTALL_PREFIX}/include/${CAMITK_SHORT_VERSION_STRING}/${GroupName}/${ComponentName}/...

This macro keeps header files directories tree structure at installation. In other words, if your extension has its header files located in subdirectories, this tree structure will be kept the same at installation.

Usage:

camitk_install_all_headers( COMPONENT ComponentName
[GROUP GroupName]
)
Parameters
COMPONENT(required) Name of the component to use. This is also the include subdirectory name used for copying the file
GROUP(optional) Name of the group this install should be using group will be prepend to the component name. This is either actions, components or libraries.

Example invocation:

#--------------
# installation
#--------------
camitk_install_headers( COMPONENT ${MYPROJECT_NAME}
GROUP libraries
)
Here, in this example, we will install all the header files, in the ${CAMITK_INCLUDE_DIR}/include/libraries/${MYPROJECT_NAME} directories (at build and installation times)
If my header files are located in some subdirectories, this structure will be kept the same at build and installation times.

Referenced by camitk_library().

◆ camitk_library()

camitk_library ( )

macro camitk_library simplifies the declaration of a library inside CamiTK and is to be used for all inner project libraries

The name of the CEP library is deduced from the name of the directory, unless LIBNAME is provided

If the library is compiled as shared, it adds the needed library properties If it needs relocation flag fPIC (on some plateforms), this macro should determine if this is the case and specify this flag

usage:

SHARED|STATIC
SOURCES source1.cpp source1.h...
[LIBNAME libname]
[PUBLIC]
[NEEDS_CEP_LIBRARIES lib1 lib2...]
[NEEDS_ITK]
[NEEDS_LIBXML2]
[NEEDS_XERCESC]
[NEEDS_XSD]
[NEEDS_QT]
[DEFINES flag1 flag2 ...]
[EXTERNAL_LIBRARIES lib1 lib2... ]
[INCLUDE_DIRECTORIES dir1 dir2...]
[LINK_DIRECTORIES dir1 dir2...]
[HEADERS_TO_INSTALL]
[CEP_NAME]
[DESCRIPTION]
[EXTRA_TRANSLATE_LANGUAGE]
[CXX_FLAGS flag1 flag2 ...]
)
Parameters
SHAREDoptional, if the library should be compiled as shared
SOURCESall sources to be included in the library
INCLUDE_DIRECTORIESall needed include directories (${CMAKE_CURRENT_SOURCE_DIR} and ${CMAKE_CURRENT_BINARY_DIR} are automatically added)
EXTERNAL_LIBRARIESall the libraries to be used during the link (shared or static)
NEEDS_CEP_LIBRARIESall the libraries to be used during the link (shared or static)
NEEDS_ITKadd this if your component needs ITK.
NEEDS_LIBXML2add this if the CEP library needs libxml2
NEEDS_XERCESCadd this if your action / component needs XercesC library
NEEDS_XSDadd this if your action needs Codesynthesis xsd cxx (xml schema compiler)
NEEDS_QTadd this if your library depends on Qt 5.x
LIBNAMEforce the CEP library name to be different from the directory it is in
LINK_DIRECTORIESadditional directories to use in link_directories(...)
DEFINESlist of define flags to add at compilation time
PUBLICThe library is a public library that has to be loaded directly by the operating system. It is generally only needed for SDK library. A public library should not be installed in the lib/${CAMITK_SHORT_VERSION_STRING} but directly in lib/ (on Unix/MacOS) or bin/ (on windows)
HEADERS_TO_INSTALLlist of header files to install. File would be copied at build and installation time in the ./include/libraries/library-name subdirectory. Note that, if no header files are provided, all header files (*.h) will be install.
CEP_NAMEspecify the CEP_NAME, which is used to categorized the extension for packaging purpose No CEP_NAME provided will result in default categorization (generic extension).
DESCRIPTIONSimple description of the extension. Used for packaging presentation for instance.
EXTRA_TRANSLATE_LANGUAGEAdditionnal extra language to translate the application
CXX_FLAGS= list of compiler flags to add (such as warning levels (-Wall ...)).

References camitk_install_all_headers(), camitk_sub_project_add(), camitk_translate(), export_headers(), get_directory_name(), include(), and parse_arguments().

◆ camitk_translate()

camitk_translate ( )

macro camitk_translate allows to perform the translation of any project (action, component, application and libraries) in several languages.

usage:

[EXTRA_LANGUAGE]
[USE_FLAGS]
)
Parameters
EXTRA_LANGUAGEoptional, allows the translation of this additional language
USE_FLAGSoptional, use the flag directory to associate a flag per language

Referenced by camitk_extension(), and camitk_library().