CMake cisst - jhu-cisst/cisst GitHub Wiki
Important note: this page is for cisst library developers. For cisst users, see Using CMake to build cisst and your programs.
For the cisst libraries developers, we have a few important macros that should be used to maintain the consistency of the CMake configuration:
-
cisst_set_package_settings: this macro allows to save some specific settings associated to a given cisst library. For example, incisstMultiTaskMakeLists.txt configuration file,cisst_set_package_settings (cisstMultiTask ZeroCIce INCLUDE_DIRECTORIES ICE_INCLUDE_DIR)indicates that any library compiled againstcisstMultiTaskwill need to use some extra include directories (keywordINCLUDE_DIRECTORIES) becausecisstMultiTaskhas been compiled against ZeroC Ice. The extra include directories are defined by the CMake variableICE_INCLUDE_DIRdefined byFindICE.cmake. The following settings can be saved:-
INCLUDE_DIRECTORIES: will be used with CMakeinclude_directoriesin the cisst use file (include (${CISST_USE_FILE}) -
LIBRARIES: will be used bycisst_target_link_libraries -
LINK_DIRECTORIES: will be used with CMakelink_directoriesin the cisst use file (include (${CISST_USE_FILE}) -
PACKAGES,PACKAGE_COMPONENTSandCMAKE_FILES: will be used by CMakefind_packageandincludein the cisst use file (include (${CISST_USE_FILE})
-
-
cisst_unset_all_package_settings: this macro is used to remove all settings. For examplecisst_unset_all_package_settings (cisstMultiTask ZeroCIce)tells thatcisstMultiTaskdoesn't use ZeroC Ice anymore. For all external dependencies, the CMake configuration should have anif else endifto make sure settings are removed when an external dependency is either not found or turned off by the user. -
cisst_add_library: this macro is used to add a new library. For example, the `cisstVectorQt CMakeLists.txt CMake configuration file] contains:cisst_add_library ( LIBRARY cisstVectorQt LIBRARY_DIR cisstVector DEPENDENCIES cisstCommon cisstVector SOURCE_FILES vctPlot2DOpenGLQtWidget.cpp HEADER_FILES vctPlot2DOpenGLQtWidget.h vctExportQt.h ADDITIONAL_SOURCE_FILES ${QT_WRAPPED_CPP})In this example the following keywords are used:
LIBRARY: name of the library to be generatedLIBRARY_DIR: relative path to include files from the cisst source directory, i.e.trunk/cisst/DEPENDENCIES: list of cisst libraries required for this librarySOURCE_FILES: list of source files found in the current source directory, i.e. directory containing this CMakeLists.txt fileHEADER_FILES: list of header files found in theLIBRARY_DIR. In this example, header files are found intrunk/cisst/cisstVectorADDITIONAL_SOURCE_FILES(andADDITIONAL_HEADER_FILES): extra source (header) files not found in the default directories. These can be generated files, private header files, ...