Computer Assited Medical Intervention Tool Kit  version 4.1
Modules | Functions
CMake macros

The CMake macros used to configure this project. More...

Modules

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

Functions

 camitk_add_subdirectory ()
 camitk_add_subdirectory is a utility macro that add a source subdirectory only if: 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_git_info ()
 macro get_git_info get the last value of commit count. More...
 
 get_subdirectories ()
 macro get_subdirectories get the names of all the subdirectories that contains a CMakeLists.txt in case insensitive alphabetical order More...
 
 get_subdirectoryfiles ()
 macro get_subdirectoryfiles get the names of all the files (and not directories) contained in a defined directory in case insensitive alphabetical order More...
 

Detailed Description

The CMake macros used to configure this project.

These macros are CamiTK projects specific (the ones in the camitk subfolders), others are CMake macros that you can use in any CMake projects.

Function Documentation

◆ camitk_add_subdirectory()

camitk_add_subdirectory ( )

camitk_add_subdirectory is a utility macro that add a source subdirectory only if:

  1. it exists
  2. it contains a CMakeLists This can avoid CMake warning (see cmake –help-policy CMP0014), but do the opposite: it prints out an information message when it succeed including the directory.

Usage:

Parameters
subdir(required) the name of the source subdirectory to include

◆ export_headers()

export_headers ( )

export_headers is a macro that install header files 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}/${SubdirName}
  • the other one is used at installation time and puts everything in ${CMAKE_INSTALL_PREFIX}/include/${CAMITK_SHORT_VERSION_STRING}/${GroupName}/${ComponentName}/${SubdirName}

Usage:

export_headers(HeaderFile1.h HeaderFile2.h ...
COMPONENT ComponentName
[GROUP GroupName]
[SUBDIRECTORY SubdirName]
)
Parameters
HeaderFileX.h(required) A list of header files to install
COMPONENTname 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:

#--------------
# installation
#--------------
export_headers(${MYPROJECT_HEADERS}
COMPONENT ${MYPROJECT_NAME}
)

Referenced by camitk_library().

◆ gather_headers_and_sources()

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:

gather_headers_and_sources(Name [BaseDirectory])
Parameters
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()

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:

directory_name(FullPathDirectory VariableName)
Parameters
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_git_info()

get_git_info ( )

macro get_git_info get the last value of commit count.

Set CAMITK_GIT_COMMIT_COUNT variable with the last number of commits

Usage:

get_git_info(PATH_TO_SOURCE_DIR)

PATH_TO_SOURCE_DIR (required) input source directory path

◆ get_subdirectories()

get_subdirectories ( )

macro get_subdirectories get the names of all the subdirectories that contains a CMakeLists.txt in case insensitive alphabetical order

Note
This macro sorts the directory alphabetically without considering the case (case insensitive sort) This sort is needed to always get the subdirectories in the same order, on all plateforms (Linux, Windows,...) thanks to the insensitive sort.

Usage:

Parameters
Name(required) the name of the resulting variable containing all the subdirectories names sorted alphabetically (case insensitive)

◆ get_subdirectoryfiles()

get_subdirectoryfiles ( )

macro get_subdirectoryfiles get the names of all the files (and not directories) contained in a defined directory in case insensitive alphabetical order

Note
This macro sorts the filename alphabetically without considering the case (case insensitive sort) This sort is needed to always get the filenames in the same order, on all plateforms (Linux, Windows,...) thanks to the insensitive sort.

Usage:

get_subdirectoryfiles(Path Filenames)

Path (required) input directory path Name (required) the name of the resulting variable containing all the file names of the given directory sorted alphabetically (case insensitive)