![]() |
Computer Assited Medical Intervention Tool Kit
version 3.3
|
The CMake macros defined for the CamiTK SDK. More...
Functions | |
camitk_add_subdirectory () | |
camitk_add_subdirectory is a utility macro that add a source subdirectory only if: More... | |
camitk_add_test () | |
camitk_add_test is a macro to add a new test to the CTest infrastructure It encapsulates CMake add_test and adds useful way of testing programs. More... | |
camitk_application () | |
macro camitk_application simplify writing a CMakeLists.txt for CamiTK application extension More... | |
camitk_cep_packaging () | |
CamiTK cep packaging allows you to build a package from a CEP If README and COPYRIGHT files exists at top source dir, then they will be included in the source package. More... | |
camitk_extension () | |
Macro camitk_extension simplifies writing a camitk extension (component, action) More... | |
camitk_extension_project () | |
macro add_cep creates an optional (disabled by default) CEP (CamiTK Extension Project) subdirectory the build. More... | |
camitk_init_test () | |
camitk_init_test is a macro to initialize a group of test (for the same command) It is used to initialize a series of tests for a given target. 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_sub_project_add () | |
macro camitk_sub_project_add adds a subproject definition from targets and its dependencies (if any) to the variable Typically recursively call this function accross all targets to generate Project.xml file. More... | |
camitk_sub_project_init () | |
MACRO camitk_sub_project_init initializes the xml_subprojects variable to gather CamiTK subprojects. More... | |
camitk_sub_project_validate () | |
macro camitk_sub_project_validate validates the xml_subprojects variable by ending its xml tag i.e. More... | |
export_headers () | |
export_headers is a macro that install header files at build and install time More... | |
gather_headers_and_sources () | |
macro gather_headers_and_sources find all headers, sources, including the qt ui, moc and resources and create two variables from it: ${Name}_HEADERS ${Name}_SOURCES, and define all needed commands for qt if BaseDirectory is specified, the glob recurse starts in directory DIR More... | |
get_directory_name () | |
macro get_directory_name set the variable VariableName to the name of the last directory of FullPathDirectory set the variable VariableName_CMAKE to be the same but in uppercase More... | |
get_subdirectories () | |
macro get_subdirectories get the names of all the subdirectories that contains a CMakeLists.txt More... | |
get_subdirectoryfiles () | |
macro get_subdirectoryfiles get the names of all the files (and not directories) contained in a defined directory More... | |
parse_arguments () | |
macro parse_arguments is a fork from CMakeMacroParseArguments see http://www.cmake.org/Wiki/CMakeMacroParseArguments for more information More... | |
The CMake macros defined for the CamiTK SDK.
camitk_add_subdirectory | ( | ) |
camitk_add_subdirectory is a utility macro that add a source subdirectory only if:
Usage:
subdir | (required) the name of the source subdirectory to include |
camitk_add_test | ( | ) |
camitk_add_test is a macro to add a new test to the CTest infrastructure It encapsulates CMake add_test and adds useful way of testing programs.
It cannot operate on its on, you need to call camitk_init_test first (and only once) before calling camitk_add_test
Details on the runned test can be found in ${CMAKE_BINARY_DIR}/Testing/Temporary/target# where target is the executable name (see camitk_init_test() macro), and # is the test order number.
Usage:
EXECUTABLE_ARGS | (optional) The executable arguments (all in double quotes), typically each test will have different arguments. Can be empty |
PASS_FILE | (optional) If specified the test to perform is to compare the output of the command to this file. It the output is the same, then the test is passed, otherwise it is failed. |
PASS_REGULAR_EXPRESSION | (optional) This is equivalent to "PASS_REGULAR_EXPRESSION regexp" property for the test, see http://www.cmake.org/Wiki/CTest:FAQ#My_test_does_not_return_non-zero_on_failure._What_can_I_do.3F |
FAIL_REGULAR_EXPRESSION | This is equivalent to "FAIL_REGULAR_EXPRESSION regexp" property for the test, see http://www.cmake.org/Wiki/CTest:FAQ#My_test_does_not_return_non-zero_on_failure._What_can_I_do.3F |
If no argument are given, it does the equivalent as add_test(name target)
Example invocation:
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 | means this is a default application is NOT to be compiled automatically |
NEEDS_QT_MODULES | add this if your library depends on Qt modules, such as QtCore, QtGui, QtMultimedia, QtNetwork, QtOpenGL, QtScript, QtScriptTools, QtSql, QtSvg, QtWebkit, QtXml, QtXmlPatterns, QtDeclarative |
NEEDS_ITK | means this application requires ITK to be compiled / run. |
NEEDS_CEP_LIBRARIES | list of needed camitk CEP libraries |
NEEDS_COMPONENT_EXTENSION | list of needed component extensions |
NEEDS_ACTION_EXTENSION | list of needed component extensions |
DEFINES | list of define flags to add at compilation time |
CXX_FLAGS | = list of compiler flags to add (such as warning levels (-Wall ...)). |
ADDITIONAL_SOURCES | list of additional sources (that cannot be automatically found by gather_headers_and_sources macro) |
CEP_NAME | specify the CEP_NAME, which is used to categorized the application for packaging purpose No CEP_NAME provided will result in default categorization (generic application). |
DESCRIPTION | Simple description of the application. Used for packaging presentation for instance. |
INCLUDE_DIRECTORIES | additional include directories |
EXTERNAL_LIBRARIES | external libraries to add to the link command |
camitk_cep_packaging | ( | ) |
CamiTK cep packaging allows you to build a package from a CEP If README and COPYRIGHT files exists at top source dir, then they will be included in the source package.
Usage:
NAME | (optional) Specify the package name (default is project name) |
VENDOR | (optional) Specify the vendor name (default is TIMC-IMAG) |
CONTACT | (optional) Specify the contact name (default is link to CamiTK website) |
APPLICATIONS | (optional) If you want to package some applications |
When configuring CMake, do not forget to set the CMAKE_INSTALL_PREFIX correctly (e.g., /usr on Linux) It will always use the CamiTK install directory as install prefix (install where the core is already)
To generate deb package add this to the cmake configuration line: -DCPACK_BINARY_DEB:BOOL=TRUE To generate rpm package add this to the cmake configuration line: -DCPACK_BINARY_RPM:BOOL=TRUE
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:
<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_QT_MODULES | = add this if your library depends on Qt modules, such as QtCore, QtGui, QtMultimedia, QtNetwork, QtOpenGL, QtScript, QtScriptTools, QtSql, QtSvg, QtWebkit, QtXml, QtXmlPatterns, QtDeclarative |
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_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). |
DESCRIPTION | = Simple description of the extension. Used for packaging presentation for instance. |
NEEDS_GDCM | = Add this, if your extension requires GDCM 2.x library |
camitk_extension_project | ( | ) |
macro add_cep creates an optional (disabled by default) CEP (CamiTK Extension Project) subdirectory the build.
Usage:
CONTACT | Mandatory, this is the person(s) to contact to get more information about the CEP |
ENABLED | If 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 |
NAME | By 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 |
DESCRIPTION | A (not so) small description of this CEP (objective, content, implementation information) |
DEFAULT_APPLICATION | The default application to run (for MSVC launchers), default is camitk-imp |
NEEDS_CEP | (TODO) Dependencies to other CEP |
LICENSE | The name of the license for this CEP, default is LGPL-v3 |
camitk_init_test | ( | ) |
camitk_init_test is a macro to initialize a group of test (for the same command) It is used to initialize a series of tests for a given target.
Usually this is placed in the same CMakeLists.txt as the add_executable() cmake instruction or camitk_application() macro
It does few useful things:
Usage:
applicationname | (required) The name of the test application (in camitk context, name of the project |
Example invocation:
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 | optional, if the library should be compiled as shared |
SOURCES | all sources to be included in the library |
INCLUDE_DIRECTORIES | all needed include directories (${CMAKE_CURRENT_SOURCE_DIR} and ${CMAKE_CURRENT_BINARY_DIR} are automatically added) |
EXTERNAL_LIBRARIES | all the libraries to be used during the link (shared or static) |
NEEDS_CEP_LIBRARIES | all the libraries to be used during the link (shared or static) |
NEEDS_LIBXML2 | add this if the CEP library needs libxml2 |
NEEDS_XERCESC | add this if your action / component needs XercesC library |
NEEDS_XSD | add this if your action needs Codesynthesis xsd cxx (xml schema compiler) |
NEEDS_QT_MODULES | add this if your library depends on Qt modules, such as QtCore, QtGui, QtMultimedia, QtNetwork, QtOpenGL, QtScript, QtScriptTools, QtSql, QtSvg, QtWebkit, QtXml, QtXmlPatterns, QtDeclarative |
LIBNAME | force the CEP library name to be different from the directory it is in |
LINK_DIRECTORIES | additional directories to use in link_directories(...) |
DEFINES | list of define flags to add at compilation time |
PUBLIC | The 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_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. |
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). |
DESCRIPTION | Simple description of the extension. Used for packaging presentation for instance. |
References camitk_sub_project_add(), CEP_LIBRARY, COMPONENT, DESCRIPTION, elseif(), endif(), export_headers(), file(), get_directory_name(), GROUP, if(), include(), macro(), message(), parse_arguments(), set(), string(), and variable().
camitk_sub_project_add | ( | ) |
macro camitk_sub_project_add adds a subproject definition from targets and its dependencies (if any) to the variable Typically recursively call this function accross all targets to generate Project.xml file.
Usage:
TARGET_TYPE | name the library / exe program targeted for CMake compilation |
DEPENDENCIES | (optional) the library dependencies to build the target |
Referenced by camitk_library().
camitk_sub_project_init | ( | ) |
MACRO camitk_sub_project_init initializes the xml_subprojects variable to gather CamiTK subprojects.
usage:
camitk_sub_project_validate | ( | ) |
macro camitk_sub_project_validate validates the xml_subprojects variable by ending its xml tag i.e.
By adding the closing </Project> xml node, this will close the xml data Then create the '${CMAKE_BINARY_DIR}/Project.xml file Use this file to send to the DashBoard to get the CEP and its subprojects definition
Usage:
CEP_SET | (optional) should be added only if this is a CEP set validation |
export_headers | ( | ) |
export_headers is a macro that install header files at build and install time
Duplicate headers installation:
Usage:
HeaderFileX.h | (required) A list of header files to install |
COMPONENT | name of the component to use. This is also the include subdirectory name used for copying the file |
GROUP | (optional) the name of the group this install should be using group will be prepend to the component name. |
SUBDIRECTORY | (optional) subdirectory to use in ${CAMITK_INCLUDE_DIR}/include/${ComponentName} |
Example invocation:
Referenced by camitk_library().
gather_headers_and_sources | ( | ) |
macro gather_headers_and_sources find all headers, sources, including the qt ui, moc and resources and create two variables from it: ${Name}_HEADERS ${Name}_SOURCES, and define all needed commands for qt if BaseDirectory is specified, the glob recurse starts in directory DIR
Usage:
Name | (required) the prefix of the resulting variables ${Name}_HEADERS ${Name}_SOURCES |
BaseDirectory | (optional) do not start gathering from current subdirectory but from the given directory |
get_directory_name | ( | ) |
macro get_directory_name set the variable VariableName to the name of the last directory of FullPathDirectory set the variable VariableName_CMAKE to be the same but in uppercase
Usage:
FullPathDirectory | (required) the full path directory (input) |
VariableName | (required) the resulting variable name containing the base name all in uppercase |
Referenced by camitk_library().
get_subdirectories | ( | ) |
macro get_subdirectories get the names of all the subdirectories that contains a CMakeLists.txt
Usage:
Name | (required) the name of the resulting variable containing all the subdirectories names |
get_subdirectoryfiles | ( | ) |
macro get_subdirectoryfiles get the names of all the files (and not directories) contained in a defined directory
Usage:
Path (required) input directory path Name (required) the name of the resulting variable containing all the file names of the given directory
parse_arguments | ( | ) |
macro parse_arguments is a fork from CMakeMacroParseArguments see http://www.cmake.org/Wiki/CMakeMacroParseArguments for more information
Usage: