https://public.kitware.com/Wiki/api.php?action=feedcontributions&user=Clement.gregoire&feedformat=atomKitwarePublic - User contributions [en]2024-03-29T15:49:48ZUser contributionsMediaWiki 1.38.6https://public.kitware.com/Wiki/index.php?title=CMake_Released_Versions&diff=62175CMake Released Versions2018-01-13T10:19:48Z<p>Clement.gregoire: </p>
<hr />
<div>{{CMake/Template/Header}}<br />
<br />
A compatibility matrix of cmake features you can find on the page [[CMake_Version_Compatibility_Matrix]] .<br />
<br />
Below are the documentations for all previous releases of CMake.<br />
<br />
<br />
{| border="0"<br />
|- bgcolor="#abcdef"<br />
! Release !! Date !! CMake !! CCMake !! CTest !! CPack<br />
|-<br />
| 2.8.12 || 8 Oct 2013 || [[CMake 2.8.12 Docs|cmake]] || [[CCMake 2.8.12 Docs|ccmake]] || [[CTest 2.8.12 Docs|ctest]] || [[CPack 2.8.12 Docs|cpack]]<br />
|-<br />
| 2.8.11 || 17 May 2013 || [[CMake 2.8.11 Docs|cmake]] || [[CCMake 2.8.11 Docs|ccmake]] || [[CTest 2.8.11 Docs|ctest]] || [[CPack 2.8.11 Docs|cpack]]<br />
|-<br />
| 2.8.10 || 31 Oct 2012 || [[CMake 2.8.10 Docs|cmake]] || [[CCMake 2.8.10 Docs|ccmake]] || [[CTest 2.8.10 Docs|ctest]] || [[CPack 2.8.10 Docs|cpack]]<br />
|-<br />
| 2.8.9 || 09 Aug 2012 || [[CMake 2.8.9 Docs|cmake]] || [[CCMake 2.8.9 Docs|ccmake]] || [[CTest 2.8.9 Docs|ctest]] || [[CPack 2.8.9 Docs|cpack]]<br />
|-<br />
| 2.8.8 || 18 Apr 2012 || [[CMake 2.8.8 Docs|cmake]] || [[CCMake 2.8.8 Docs|ccmake]] || [[CTest 2.8.8 Docs|ctest]] || [[CPack 2.8.8 Docs|cpack]]<br />
|-<br />
| 2.8.7 || 30 Dec 2011 || [[CMake 2.8.7 Docs|cmake]] || [[CCMake 2.8.7 Docs|ccmake]] || [[CTest 2.8.7 Docs|ctest]]<br />
|-<br />
| 2.8.6 || 04 Oct 2011 || [[CMake 2.8.6 Docs|cmake]] || [[CCMake 2.8.6 Docs|ccmake]] || [[CTest 2.8.6 Docs|ctest]]<br />
|-<br />
| 2.8.5 || 08 Jul 2011 || [[CMake 2.8.5 Docs|cmake]] || [[CCMake 2.8.5 Docs|ccmake]] || [[CTest 2.8.5 Docs|ctest]]<br />
|-<br />
| 2.8.4 || 16 Feb 2011 || [[CMake 2.8.4 Docs|cmake]] || [[CCMake 2.8.4 Docs|ccmake]] || [[CTest 2.8.4 Docs|ctest]]<br />
|-<br />
| 2.8.3 || 03 Nov 2010 || [[CMake 2.8.3 Docs|cmake]] || [[CCMake 2.8.3 Docs|ccmake]] || [[CTest 2.8.3 Docs|ctest]]<br />
|-<br />
| 2.8.2 || 28 Jun 2010 || [[CMake 2.8.2 Docs|cmake]] || [[CCMake 2.8.2 Docs|ccmake]] || [[CTest 2.8.2 Docs|ctest]]<br />
|-<br />
| 2.8.1 || 17 Mar 2010 || [[CMake 2.8.1 Docs|cmake]] || [[CCMake 2.8.1 Docs|ccmake]] || [[CTest 2.8.1 Docs|ctest]]<br />
|-<br />
| 2.8.0 || 13 Nov 2009 || [[CMake 2.8.0 Docs|cmake]] || [[CCMake 2.8.0 Docs|ccmake]] || [[CTest 2.8.0 Docs|ctest]]<br />
|-<br />
| 2.6.4 || 01 May 2009 || [[CMake 2.6.4 Docs|cmake]] || [[CCMake 2.6.4 Docs|ccmake]] || [[CTest 2.6.4 Docs|ctest]]<br />
|-<br />
| 2.6.3 || 09 Mar 2009 || [[CMake 2.6.3 Docs|cmake]] || [[CCMake 2.6.3 Docs|ccmake]] || [[CTest 2.6.3 Docs|ctest]]<br />
|-<br />
| 2.6.2 || 25 Sep 2008|| [[CMake 2.6.2 Docs|cmake]] || [[CCMake 2.6.2 Docs|ccmake]] || [[CTest 2.6.2 Docs|ctest]]<br />
|-<br />
| 2.6.1 || 04 Aug 2008 || [[CMake 2.6.1 Docs|cmake]] || [[CCMake 2.6.1 Docs|ccmake]] || [[CTest 2.6.1 Docs|ctest]]<br />
|-<br />
| 2.6.0 || 07 May 2008 || [[CMake 2.6.0 Docs|cmake]] || [[CCMake 2.6.0 Docs|ccmake]] || [[CTest 2.6.0 Docs|ctest]]<br />
|-<br />
| 2.4.8 || 23 Jan 2008 || [[CMake 2.4.8 Docs|cmake]] || [[CCMake 2.4.8 Docs|ccmake]] || [[CTest 2.4.8 Docs|ctest]]<br />
|-<br />
| 2.4.7 || 18 Jul 2007 || [[CMake 2.4.7 Docs|cmake]] || [[CCMake 2.4.7 Docs|ccmake]] || [[CTest 2.4.7 Docs|ctest]]<br />
|-<br />
| 2.4.6 || 11 Jan 2007 || [[CMake 2.4.6 Docs|cmake]] || [[CCMake 2.4.6 Docs|ccmake]] || [[CTest 2.4.6 Docs|ctest]]<br />
|-<br />
| 2.4.5 || 04 Dec 2006 || [[CMake 2.4.5 Docs|cmake]] || [[CCMake 2.4.5 Docs|ccmake]] || [[CTest 2.4.5 Docs|ctest]]<br />
|-<br />
| 2.4.4 || 21 Nov 2006 || [[CMake 2.4.4 Docs|cmake]] || [[CCMake 2.4.4 Docs|ccmake]] || [[CTest 2.4.4 Docs|ctest]]<br />
|-<br />
| 2.4.3 || 20 Sep 2006 || [[CMake 2.4.3 Docs|cmake]] || [[CCMake 2.4.3 Docs|ccmake]] || [[CTest 2.4.3 Docs|ctest]]<br />
|-<br />
| 2.2.3 || 05 Dec 2005 || [[CMake 2.2.3 Docs|cmake]] || [[CCMake 2.2.3 Docs|ccmake]] || [[CTest 2.2.3 Docs|ctest]]<br />
|-<br />
| 2.0.6 || 14 Apr 2005 || [[CMake 2.0.6 Docs|cmake]] || [[CCMake 2.0.6 Docs|ccmake]] || [[CTest 2.0.6 Docs|ctest]]<br />
|-<br />
| 1.8.3 || 07 Jan 2004 || [[CMake 1.8.3 Docs|cmake]] || [[CCMake 1.8.3 Docs|ccmake]] || [[CTest 1.8.3 Docs|ctest]]<br />
|}</div>Clement.gregoirehttps://public.kitware.com/Wiki/index.php?title=CMakeUserFindQScintilla&diff=62174CMakeUserFindQScintilla2018-01-13T10:18:56Z<p>Clement.gregoire: </p>
<hr />
<div>{{CMake/Template/Header}}<br />
<br />
[[CMake_User_Contributed_Macros|Back]]<br />
-----<br />
[[File:FindQScintilla.cmake]]<br />
-----<br />
# QScintilla is a port to Qt of Neil Hodgson's Scintilla C++ editor control<br />
# available at http://www.riverbankcomputing.com/software/qscintilla/<br />
#<br />
# The module defines the following variables:<br />
# QSCINTILLA_FOUND - the system has QScintilla<br />
# QSCINTILLA_INCLUDE_DIR - where to find Qsci/qsciscintilla.h<br />
# QSCINTILLA_INCLUDE_DIRS - qwt includes<br />
# QSCINTILLA_LIBRARY - where to find the QScintilla library<br />
# QSCINTILLA_LIBRARIES - aditional libraries<br />
# QSCINTILLA_MAJOR_VERSION - major version<br />
# QSCINTILLA_MINOR_VERSION - minor version<br />
# QSCINTILLA_PATCH_VERSION - patch version<br />
# QSCINTILLA_VERSION_STRING - version (ex. 2.6.2)<br />
# QSCINTILLA_ROOT_DIR - root dir (ex. /usr/local)<br />
#=============================================================================<br />
# Copyright 2010-2013, Julien Schueller<br />
# All rights reserved.<br />
#<br />
# Redistribution and use in source and binary forms, with or without<br />
# modification, are permitted provided that the following conditions are met:<br />
#<br />
# 1. Redistributions of source code must retain the above copyright notice, this<br />
# list of conditions and the following disclaimer.<br />
# 2. Redistributions in binary form must reproduce the above copyright notice,<br />
# this list of conditions and the following disclaimer in the documentation<br />
# and/or other materials provided with the distribution.<br />
#<br />
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND<br />
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED<br />
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE<br />
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR<br />
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES<br />
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;<br />
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND<br />
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT<br />
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS<br />
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.<br />
# The views and conclusions contained in the software and documentation are those<br />
# of the authors and should not be interpreted as representing official policies,<br />
# either expressed or implied, of the FreeBSD Project.<br />
#=============================================================================<br />
<br />
find_path ( QSCINTILLA_INCLUDE_DIR<br />
NAMES Qsci/qsciscintilla.h<br />
HINTS ${QT_INCLUDE_DIR}<br />
)<br />
<br />
set ( QSCINTILLA_INCLUDE_DIRS ${QSCINTILLA_INCLUDE_DIR} )<br />
<br />
# version<br />
set ( _VERSION_FILE ${QSCINTILLA_INCLUDE_DIR}/Qsci/qsciglobal.h )<br />
if ( EXISTS ${_VERSION_FILE} )<br />
file ( STRINGS ${_VERSION_FILE} _VERSION_LINE REGEX "define[ ]+QSCINTILLA_VERSION_STR" )<br />
if ( _VERSION_LINE )<br />
string ( REGEX REPLACE ".*define[ ]+QSCINTILLA_VERSION_STR[ ]+\"(.*)\".*" "\\1" QSCINTILLA_VERSION_STRING "${_VERSION_LINE}" )<br />
string ( REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1" QSCINTILLA_MAJOR_VERSION "${QSCINTILLA_VERSION_STRING}" )<br />
string ( REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\2" QSCINTILLA_MINOR_VERSION "${QSCINTILLA_VERSION_STRING}" )<br />
string ( REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\3" QSCINTILLA_PATCH_VERSION "${QSCINTILLA_VERSION_STRING}" )<br />
endif ()<br />
endif ()<br />
<br />
# check version<br />
set ( _QSCINTILLA_VERSION_MATCH TRUE )<br />
if ( QScintilla_FIND_VERSION AND QSCINTILLA_VERSION_STRING )<br />
if ( QScintilla_FIND_VERSION_EXACT )<br />
if ( NOT QScintilla_FIND_VERSION VERSION_EQUAL QSCINTILLA_VERSION_STRING )<br />
set ( _QSCINTILLA_VERSION_MATCH FALSE )<br />
endif ()<br />
else ()<br />
if ( QSCINTILLA_VERSION_STRING VERSION_LESS QScintilla_FIND_VERSION )<br />
set ( _QSCINTILLA_VERSION_MATCH FALSE )<br />
endif ()<br />
endif ()<br />
endif ()<br />
<br />
find_library ( QSCINTILLA_LIBRARY<br />
NAMES qscintilla qscintilla2 libqscintilla2<br />
HINTS ${QT_LIBRARY_DIR}<br />
)<br />
<br />
set ( QSCINTILLA_LIBRARIES ${QSCINTILLA_LIBRARY} )<br />
<br />
# try to guess root dir from include dir<br />
if ( QSCINTILLA_INCLUDE_DIR )<br />
string ( REGEX REPLACE "(.*)/include.*" "\\1" QSCINTILLA_ROOT_DIR ${QSCINTILLA_INCLUDE_DIR} )<br />
# try to guess root dir from library dir<br />
elseif ( QSCINTILLA_LIBRARY )<br />
string ( REGEX REPLACE "(.*)/lib[/|32|64].*" "\\1" QSCINTILLA_ROOT_DIR ${QSCINTILLA_LIBRARY} )<br />
endif ()<br />
<br />
# handle the QUIETLY and REQUIRED arguments<br />
include ( FindPackageHandleStandardArgs )<br />
<br />
if ( CMAKE_VERSION LESS 2.8.3 )<br />
find_package_handle_standard_args( QScintilla DEFAULT_MSG QSCINTILLA_LIBRARY QSCINTILLA_INCLUDE_DIR _QSCINTILLA_VERSION_MATCH )<br />
else ()<br />
find_package_handle_standard_args( QScintilla REQUIRED_VARS QSCINTILLA_LIBRARY QSCINTILLA_INCLUDE_DIR _QSCINTILLA_VERSION_MATCH VERSION_VAR QSCINTILLA_VERSION_STRING )<br />
endif ()<br />
<br />
mark_as_advanced (<br />
QSCINTILLA_LIBRARY<br />
QSCINTILLA_LIBRARIES<br />
QSCINTILLA_INCLUDE_DIR<br />
QSCINTILLA_INCLUDE_DIRS<br />
QSCINTILLA_MAJOR_VERSION<br />
QSCINTILLA_MINOR_VERSION<br />
QSCINTILLA_PATCH_VERSION<br />
QSCINTILLA_VERSION_STRING<br />
QSCINTILLA_ROOT_DIR<br />
)<br />
<br />
-----<br />
[[CMake_User_Contributed_Macros|Back]]<br />
<br />
{{CMake/Template/Footer}}<br />
[[Category:FindModules]]</div>Clement.gregoirehttps://public.kitware.com/Wiki/index.php?title=CMakeUserFindQwt&diff=62173CMakeUserFindQwt2018-01-13T10:18:37Z<p>Clement.gregoire: </p>
<hr />
<div>{{CMake/Template/Header}}<br />
<br />
[[CMake_User_Contributed_Macros|Back]]<br />
-----<br />
[[File:FindQwt.cmake]]<br />
-----<br />
# Qt Widgets for Technical Applications<br />
# available at http://www.http://qwt.sourceforge.net/<br />
#<br />
# The module defines the following variables:<br />
# QWT_FOUND - the system has Qwt<br />
# QWT_INCLUDE_DIR - where to find qwt_plot.h<br />
# QWT_INCLUDE_DIRS - qwt includes<br />
# QWT_LIBRARY - where to find the Qwt library<br />
# QWT_LIBRARIES - aditional libraries<br />
# QWT_MAJOR_VERSION - major version<br />
# QWT_MINOR_VERSION - minor version<br />
# QWT_PATCH_VERSION - patch version<br />
# QWT_VERSION_STRING - version (ex. 5.2.1)<br />
# QWT_ROOT_DIR - root dir (ex. /usr/local)<br />
<br />
#=============================================================================<br />
# Copyright 2010-2013, Julien Schueller<br />
# All rights reserved.<br />
#<br />
# Redistribution and use in source and binary forms, with or without<br />
# modification, are permitted provided that the following conditions are met:<br />
#<br />
# 1. Redistributions of source code must retain the above copyright notice, this<br />
# list of conditions and the following disclaimer.<br />
# 2. Redistributions in binary form must reproduce the above copyright notice,<br />
# this list of conditions and the following disclaimer in the documentation<br />
# and/or other materials provided with the distribution.<br />
#<br />
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND<br />
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED<br />
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE<br />
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR<br />
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES<br />
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;<br />
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND<br />
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT<br />
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS<br />
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.<br />
<br />
# The views and conclusions contained in the software and documentation are those<br />
# of the authors and should not be interpreted as representing official policies,<br />
# either expressed or implied, of the FreeBSD Project.<br />
#=============================================================================<br />
<br />
<br />
find_path ( QWT_INCLUDE_DIR<br />
NAMES qwt_plot.h<br />
HINTS ${QT_INCLUDE_DIR}<br />
PATH_SUFFIXES qwt qwt-qt3 qwt-qt4 qwt-qt5<br />
)<br />
<br />
set ( QWT_INCLUDE_DIRS ${QWT_INCLUDE_DIR} )<br />
<br />
# version<br />
set ( _VERSION_FILE ${QWT_INCLUDE_DIR}/qwt_global.h )<br />
if ( EXISTS ${_VERSION_FILE} )<br />
file ( STRINGS ${_VERSION_FILE} _VERSION_LINE REGEX "define[ ]+QWT_VERSION_STR" )<br />
if ( _VERSION_LINE )<br />
string ( REGEX REPLACE ".*define[ ]+QWT_VERSION_STR[ ]+\"(.*)\".*" "\\1" QWT_VERSION_STRING "${_VERSION_LINE}" )<br />
string ( REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1" QWT_MAJOR_VERSION "${QWT_VERSION_STRING}" )<br />
string ( REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\2" QWT_MINOR_VERSION "${QWT_VERSION_STRING}" )<br />
string ( REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\3" QWT_PATCH_VERSION "${QWT_VERSION_STRING}" )<br />
endif ()<br />
endif ()<br />
<br />
<br />
# check version<br />
set ( _QWT_VERSION_MATCH TRUE )<br />
if ( Qwt_FIND_VERSION AND QWT_VERSION_STRING )<br />
if ( Qwt_FIND_VERSION_EXACT )<br />
if ( NOT Qwt_FIND_VERSION VERSION_EQUAL QWT_VERSION_STRING )<br />
set ( _QWT_VERSION_MATCH FALSE )<br />
endif ()<br />
else ()<br />
if ( QWT_VERSION_STRING VERSION_LESS Qwt_FIND_VERSION )<br />
set ( _QWT_VERSION_MATCH FALSE )<br />
endif ()<br />
endif ()<br />
endif ()<br />
<br />
<br />
find_library ( QWT_LIBRARY<br />
NAMES qwt qwt-qt3 qwt-qt4 qwt-qt5<br />
)<br />
<br />
set ( QWT_LIBRARIES ${QWT_LIBRARY} )<br />
<br />
<br />
# try to guess root dir from include dir<br />
if ( QWT_INCLUDE_DIR )<br />
string ( REGEX REPLACE "(.*)/include.*" "\\1" QWT_ROOT_DIR ${QWT_INCLUDE_DIR} )<br />
# try to guess root dir from library dir<br />
elseif ( QWT_LIBRARY )<br />
string ( REGEX REPLACE "(.*)/lib[/|32|64].*" "\\1" QWT_ROOT_DIR ${QWT_LIBRARY} )<br />
endif ()<br />
<br />
<br />
# handle the QUIETLY and REQUIRED arguments<br />
include ( FindPackageHandleStandardArgs )<br />
find_package_handle_standard_args( Qwt DEFAULT_MSG QWT_LIBRARY QWT_INCLUDE_DIR _QWT_VERSION_MATCH )<br />
<br />
mark_as_advanced (<br />
QWT_LIBRARY<br />
QWT_LIBRARIES<br />
QWT_INCLUDE_DIR<br />
QWT_INCLUDE_DIRS<br />
QWT_MAJOR_VERSION<br />
QWT_MINOR_VERSION<br />
QWT_PATCH_VERSION<br />
QWT_VERSION_STRING<br />
QWT_ROOT_DIR<br />
)<br />
<br />
-----<br />
[[CMake_User_Contributed_Macros|Back]]<br />
<br />
{{CMake/Template/Footer}}<br />
[[Category:FindModules]]</div>Clement.gregoirehttps://public.kitware.com/Wiki/index.php?title=CMakeUserUseFlex&diff=62172CMakeUserUseFlex2018-01-13T10:17:02Z<p>Clement.gregoire: </p>
<hr />
<div>{{CMake/Template/Header}}<br />
<br />
# - Look for GNU flex, the lexer generator.<br />
# Defines the following:<br />
# FLEX_EXECUTABLE - path to the flex executable<br />
# FLEX_FILE - parse a file with flex<br />
# FLEX_PREFIX_OUTPUTS - Set to true to make FLEX_FILE produce outputs of<br />
# lex.${filename}.c, not lex.yy.c . Passes -P to flex. <br />
<br />
IF(NOT DEFINED FLEX_PREFIX_OUTPUTS)<br />
SET(FLEX_PREFIX_OUTPUTS FALSE)<br />
ENDIF(NOT DEFINED FLEX_PREFIX_OUTPUTS) <br />
<br />
IF(NOT FLEX_EXECUTABLE)<br />
MESSAGE(STATUS "Looking for flex")<br />
FIND_PROGRAM(FLEX_EXECUTABLE flex)<br />
IF(FLEX_EXECUTABLE)<br />
MESSAGE(STATUS "Looking for flex -- ${FLEX_EXECUTABLE}")<br />
ENDIF(FLEX_EXECUTABLE)<br />
ENDIF(NOT FLEX_EXECUTABLE) <br />
<br />
IF(FLEX_EXECUTABLE)<br />
MACRO(FLEX_FILE FILENAME)<br />
GET_FILENAME_COMPONENT(PATH "${FILENAME}" PATH)<br />
IF("${PATH}" STREQUAL "")<br />
SET(PATH_OPT "")<br />
ELSE("${PATH}" STREQUAL "")<br />
SET(PATH_OPT "/${PATH}")<br />
ENDIF("${PATH}" STREQUAL "")<br />
IF(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}${PATH_OPT}")<br />
FILE(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}${PATH_OPT}")<br />
ENDIF(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}${PATH_OPT}")<br />
IF(FLEX_PREFIX_OUTPUTS)<br />
GET_FILENAME_COMPONENT(PREFIX "${FILENAME}" NAME_WE)<br />
ELSE(FLEX_PREFIX_OUTPUTS)<br />
SET(PREFIX "yy")<br />
ENDIF(FLEX_PREFIX_OUTPUTS)<br />
SET(OUTFILE "${CMAKE_CURRENT_BINARY_DIR}${PATH_OPT}/lex.${PREFIX}.c")<br />
ADD_CUSTOM_COMMAND(<br />
OUTPUT "${OUTFILE}"<br />
COMMAND "${FLEX_EXECUTABLE}"<br />
ARGS "--prefix=${PREFIX}"<br />
"--outfile=${OUTFILE}"<br />
"${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME}"<br />
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME}")<br />
SET_SOURCE_FILES_PROPERTIES("${OUTFILE}" PROPERTIES GENERATED TRUE)<br />
ENDMACRO(FLEX_FILE)<br />
ENDIF(FLEX_EXECUTABLE)<br />
<br />
{{CMake/Template/Footer}}<br />
[[Category:CMakeMacro]]</div>Clement.gregoirehttps://public.kitware.com/Wiki/index.php?title=CMakeUserUseBison&diff=62171CMakeUserUseBison2018-01-13T10:16:40Z<p>Clement.gregoire: </p>
<hr />
<div>{{CMake/Template/Header}}<br />
<br />
# - Look for GNU Bison, the parser generator<br />
# Based off a news post from Andy Cedilnik at Kitware<br />
# Defines the following:<br />
# BISON_EXECUTABLE - path to the bison executable<br />
# BISON_FILE - parse a file with bison<br />
# BISON_PREFIX_OUTPUTS - Set to true to make BISON_FILE produce prefixed<br />
# symbols in the generated output based on filename.<br />
# So for ${filename}.y, you'll get ${filename}parse(), etc.<br />
# instead of yyparse().<br />
# BISON_GENERATE_DEFINES - Set to true to make BISON_FILE output the matching<br />
# .h file for a .c file. You want this if you're using<br />
# flex.<br />
<br />
IF(NOT DEFINED BISON_PREFIX_OUTPUTS)<br />
SET(BISON_PREFIX_OUTPUTS FALSE)<br />
ENDIF(NOT DEFINED BISON_PREFIX_OUTPUTS)<br />
<br />
IF(NOT DEFINED BISON_GENERATE_DEFINES)<br />
SET(BISON_GENERATE_DEFINES FALSE)<br />
ENDIF(NOT DEFINED BISON_GENERATE_DEFINES)<br />
<br />
IF(NOT BISON_EXECUTABLE)<br />
MESSAGE(STATUS "Looking for bison")<br />
FIND_PROGRAM(BISON_EXECUTABLE bison)<br />
IF(BISON_EXECUTABLE)<br />
MESSAGE(STATUS "Looking for bison -- ${BISON_EXECUTABLE}")<br />
ENDIF(BISON_EXECUTABLE)<br />
ENDIF(NOT BISON_EXECUTABLE)<br />
<br />
IF(BISON_EXECUTABLE)<br />
MACRO(BISON_FILE FILENAME)<br />
GET_FILENAME_COMPONENT(PATH "${FILENAME}" PATH)<br />
IF("${PATH}" STREQUAL "")<br />
SET(PATH_OPT "")<br />
ELSE("${PATH}" STREQUAL "")<br />
SET(PATH_OPT "/${PATH}")<br />
ENDIF("${PATH}" STREQUAL "")<br />
GET_FILENAME_COMPONENT(HEAD "${FILENAME}" NAME_WE)<br />
IF(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}${PATH_OPT}")<br />
FILE(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}${PATH_OPT}")<br />
ENDIF(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}${PATH_OPT}")<br />
IF(BISON_PREFIX_OUTPUTS)<br />
SET(PREFIX "${HEAD}")<br />
ELSE(BISON_PREFIX_OUTPUTS)<br />
SET(PREFIX "yy")<br />
ENDIF(BISON_PREFIX_OUTPUTS)<br />
SET(OUTFILE "${CMAKE_CURRENT_BINARY_DIR}${PATH_OPT}/${HEAD}.tab.c")<br />
IF(BISON_GENERATE_DEFINES)<br />
SET(HEADER "${CMAKE_CURRENT_BINARY_DIR}${PATH_OPT}/${HEAD}.tab.h")<br />
ADD_CUSTOM_COMMAND(<br />
OUTPUT "${OUTFILE}" "${HEADER}"<br />
COMMAND "${BISON_EXECUTABLE}"<br />
ARGS "--name-prefix=${PREFIX}"<br />
"--defines"<br />
"--output-file=${OUTFILE}"<br />
"${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME}"<br />
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME}")<br />
SET_SOURCE_FILES_PROPERTIES("${OUTFILE}" "${HEADER}" PROPERTIES GENERATED TRUE)<br />
SET_SOURCE_FILES_PROPERTIES("${HEADER}" PROPERTIES HEADER_FILE_ONLY TRUE)<br />
ELSE(BISON_GENERATE_DEFINES)<br />
ADD_CUSTOM_COMMAND(<br />
OUTPUT "${OUTFILE}"<br />
COMMAND "${BISON_EXECUTABLE}"<br />
ARGS "--name-prefix=${PREFIX}"<br />
"--output-file=${OUTFILE}"<br />
"${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME}"<br />
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME}")<br />
SET_SOURCE_FILES_PROPERTIES("${OUTFILE}" PROPERTIES GENERATED TRUE)<br />
ENDIF(BISON_GENERATE_DEFINES)<br />
ENDMACRO(BISON_FILE) <br />
ENDIF(BISON_EXECUTABLE)<br />
<br />
<br />
{{CMake/Template/Footer}}<br />
[[Category:CMakeMacro]]</div>Clement.gregoirehttps://public.kitware.com/Wiki/index.php?title=CMake_User_Contributed_Macros&diff=62170CMake User Contributed Macros2018-01-13T10:15:15Z<p>Clement.gregoire: </p>
<hr />
<div>{{CMake/Template/Header}}<br />
<br />
'''User Contributed Macros'''<br />
<br />
== Find Modules ==<br />
Although CMake comes with a whole bunch of FindXXX packages, there is a large number of packages there are not covered. The hope is that these user-contributed macros will eventually make their way into the official distribution. Before contributing, please have your FindXXX package conform to the [http://www.cmake.org/cgi-bin/viewcvs.cgi/Modules/readme.txt?root=CMake&view=markup CMake Module Guidelines].<br />
<br />
#[[CMakeUserFindAUTOPACK | Find Autopack]]<br />
#[[CMakeUserFindClanLib | Find ClanLib]]<br />
#[[CMakeUserFindDirectShow | Find DirectShow]]<br />
#[[CMakeUserFindMySQL | Find MySQL]]<br />
#[[CMakeUserFindPARMETIS | Find ParMetis]]<br />
#[[CMakeUserFindVLD| Find VLD - Visual Leak Debugger]]<br />
#[[CMakeUserFindWix| Find WIX - Windows Installer XML,v2]]<br />
#[[CMakeUserFindLibSVM| Find LibSVM - A Library for Support Vector Machines]]<br />
#[[CMakeUserFindMuParser| Find MuParser - High performance math expression parser library]]<br />
#[[CMakeUserFindOctave| Find Octave - Interpreted language for numerical computations]]<br />
#[[CMakeUserUseBison| Use Bison - Parser Generator]]<br />
#[[CMakeUserUseFlex| Use Flex - Lexer Generator]]<br />
#[[CMakeUserUseLATEX| Use LaTeX - Build LaTeX Documents]]<br />
#[[CMakeUserUseRPMTools| Use RPM Tools - Build RPM (source or binary)]]<br />
#[[CMakeUserFindCTPP2| Find CTPP2]] - [http://ctpp.havoc.ru/en/ C++ Template Engine]<br />
#[[CMakeUserFindQwt| Find Qwt]] - [http://qwt.sourceforge.net/ Qt Widgets for Technical Applications]<br />
#[[CMakeUserFindQScintilla| Find QScintilla]] - [http://www.riverbankcomputing.com/software/qscintilla/ port to Qt of Neil Hodgson's Scintilla C++ editor control]<br />
[[CMake|Home]] [[CMake_User_Contributed_Macros|Back]]<br />
<br />
== Comprehensive Collection of CMake functions/macros ==<br />
For CMake 2.8.7 and higher.<br />
More complex build scripts might need a larger toolset than is provided by CMake. Here is a tested collection of over 500 CMake functions which you can easily download and use by just including a single file in your CMakeLists.txt. <br />
<br />
Repository: [[https://github.com/toeb/oo-cmake https://github.com/toeb/oo-cmake]]<br />
MIT License <br />
<br />
Some features<br />
* interactive cmake shell<br />
* eval<br />
* maps (objects without functions)<br />
** serialization to and from json<br />
* function functions<br />
** return values<br />
** dynamic call<br />
* objects <br />
* list tools<br />
** slice, splice, filter, map, fold<br />
* string tools<br />
** slice, splice, ...<br />
* semver<br />
** parse, compare, constrain semantic versions<br />
* shell tools<br />
* filesystem<br />
** many bash like functions which work on windows and unix systems(ls, touch, fwrite, fread, cd, pwd, pushd, popd, rm, ...)<br />
** read_line from console<br />
* debugging<br />
** breakpoint<br />
** print scope<br />
* ...<br />
<br />
<br />
An up to date full feature list and installation guide is located [[https://github.com/toeb/oo-cmake#feature-overview here]]<br />
<br />
== Make Equivalents ==<br />
While attempting to convert a gnu makefile to Cmake, there was <br />
a need to provide some macros to provide equivalent functionality. <br />
<br />
#[[CMakeMacroFilterOut | FILTER_OUT (filter-out)]]<br />
#[[CMakeMacroLibtoolFile | CREATE_LIBTOOL_FILE (create a libtool archive file)]]<br />
<br />
[[CMake|Home]] [[CMake_User_Contributed_Macros|Back]]<br />
<br />
== Some helpers along the way ==<br />
#[[CMakeCopyIfDifferent | COPY_IF_DIFFERENT]]<br />
#[[CMakeMacroMerge | MERGE]] --- Merges two sorted lists into a single sorted list. Useful to keep source and header files next to each other.<br />
#[[CMakeMacroCreateFinalFile | CREATE_FINAL_FILE]] -- create a KDE style final file, which includes all source files, so that the compilation will be noticable faster.<br />
#[[CMakeMacroListOperations | List Operations]] -- A compilation of some helpful list operations.<br />
#[[CMakeMacroParseArguments | PARSE_ARGUMENTS]] -- A macro to help parse arguments for other macros.<br />
#[[CMakeMacroAddCxxTest | ADD_CXXTEST]] -- A macro to add tests written the CxxTest testing framework.<br />
#[[CMakeMacroForceAddFlags | Force Flags]] -- A macro to force certain arguments for specified flag (similar to a set union).<br />
#[[CMakeTestInline | Test Inline]] -- A test for how your compiler defines inline.<br />
#[[CMakeCompareVersionStrings | COMPARE_VERSION_STRINGS]] -- A macro to help compare arbitrary version strings for less than, equal to, and greater than.<br />
<br />
See also the list of all macros in the [[:Category:CMakeMacro | CMake Macro category]].<br />
<br />
[[CMake|Home]] <br />
[[CMake_User_Contributed_Macros|Back]]<br />
<br />
== Visual Studio generator helpers ==<br />
When generating Visual Studio projects, the priorities can be <br />
sometimes different than for other generators. These are some<br />
VS-specific (and sometimes not-so-specific) macros that could<br />
help you generate better VS projects.<br />
<br />
#[[CMakeMacroGatherProjectFiles | GatherProjectFiles]] -- create and cache a list of project files by recursively globbing a directory structure<br />
#[[CMakeMacroGenerateProject | GenerateProject]] -- creates a VS project with subgroups that mimic the directory structure<br />
<br />
<br />
[[CMake|Home]] [[CMake_User_Contributed_Macros|Back]]<br />
<br />
{{CMake/Template/Footer}}</div>Clement.gregoirehttps://public.kitware.com/Wiki/index.php?title=CMake:Install_Commands&diff=62169CMake:Install Commands2018-01-13T10:03:57Z<p>Clement.gregoire: </p>
<hr />
<div>{{CMake/Template/Header}}<br />
==Overview==<br />
<br />
CMake has an elaborate install process that simplifies installation of<br />
programs, libraries, and other files. In CMake version 2.4 the new<br />
'''INSTALL''' command was introduced that encompasses the functionality of all<br />
the old '''install''' commands. This page describes the new '''INSTALL'''<br />
command and the transition from the old one.<br />
<br />
==Old INSTALL_* Commands==<br />
<br />
; INSTALL_FILES : Create rules to install the listed files with the given extension into the given directory. Only files existing in the current source tree or its corresponding location in the binary tree may be listed. If a file specified already has an extension, that extension will be removed first. This is useful for providing lists of source files such as foo.cxx when you want the corresponding foo.h to be installed. A typical extension is '.h'.<br />
<br />
INSTALL_FILES(<dir> extension file file ...)<br />
INSTALL_FILES(<dir> regexp)<br />
<br />
: Any files in the current source directory that match the regular expression will be installed.<br />
<br />
INSTALL_FILES(<dir> FILES file file ...)<br />
<br />
: Any files listed after the FILES keyword will be installed explicitly from the names given. Full paths are allowed in this form. The directory <dir> is relative to the installation prefix, which is stored in the variable CMAKE_INSTALL_PREFIX. <br />
<br />
; INSTALL_PROGRAMS : Create rules to install the listed programs into the given directory. Use the FILES argument to guarantee that the file list version of the command will be used even when there is only one argument.<br />
<br />
INSTALL_PROGRAMS(<dir> file1 file2 [file3 ...])<br />
INSTALL_PROGRAMS(<dir> FILES file1 [file2 ...])<br />
INSTALL_PROGRAMS(<dir> regexp)<br />
<br />
: In the third form any program in the current source directory that matches the regular expression will be installed. This command is intended to install programs that are not built by cmake, such as shell scripts. See the TARGETS form of the INSTALL command to create installation rules for targets built by cmake. The directory <dir> is relative to the installation prefix, which is stored in the variable CMAKE_INSTALL_PREFIX.<br />
<br />
<br />
; INSTALL_TARGETS : Create rules to install the listed targets into the given directory. The directory <dir> is relative to the installation prefix, which is stored in the variable CMAKE_INSTALL_PREFIX. If RUNTIME_DIRECTORY is specified, then on systems with special runtime files (Windows DLL), the files will be copied to that directory. <br />
INSTALL_TARGETS(<dir> [RUNTIME_DIRECTORY dir] target target)<br />
<br />
==New INSTALL Command==<br />
<br />
The new '''INSTALL''' command replaces all the old commands with a single<br />
command. This command is much more flexible and provide a common interface for<br />
all installation requirements.<br />
<br />
In addition to all the old functionality, this command also provides a way to<br />
install directories, run CMake scripts and inline CMake code, as well as a<br />
'''component''' framework.<br />
<br />
==Replacing The Old INSTALL_* Commands==<br />
<br />
Each of the old commands can be replaced with a proper signature of the new<br />
'''INSTALL''' command.<br />
<br />
It is important to note that the new INSTALL command takes all the paths as<br />
relative paths. If absolute path is provided, the absolute path will be used.<br />
<br />
===Replace INSTALL_FILES===<br />
<br />
Let say that we have files in source and build directory that we are trying to<br />
install. These files are: file1.h, file2.h, file3.h, file4.hxx, file5.txt, and<br />
file6.cmake. Assume file1.h, file2.h, file4.hxx, and file5.txt are in the<br />
source tree, while all the other files are in the build tree.<br />
<br />
INSTALL_FILES(/include .h file1.cxx file2.c file3.h)<br />
INSTALL_FILES(/include "\.hxx")<br />
INSTALL_FILES(/share/special_files FILES file5.txt<br />
${CMAKE_CURRENT_BINARY_DIR}/file6.cmake)<br />
<br />
These lines are replaced with:<br />
<br />
INSTALL(FILES file1.h file2.h ${CMAKE_CURRENT_BINARY_DIR}/file3.h<br />
DESTINATION include)<br />
FILE(GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx")<br />
INSTALL(FILES ${files} DESTINATION include)<br />
INSTALL(FILES file5.txt ${CMAKE_CURRENT_BINARY_DIR}/file6.cmake<br />
DESTINATION share/special_files)<br />
<br />
===Replace INSTALL_PROGRAMS===<br />
<br />
Assuming there are scripts scr1 and scr2, where scr2 is in the build directory.<br />
The code in CMake list file would look like this:<br />
<br />
INSTALL_PROGRAMS(/bin FILES scr1 ${CMAKE_CURRENT_BINARY_DIR}/scr2)<br />
<br />
This line is replaced with:<br />
<br />
INSTALL(PROGRAMS scr1 ${CMAKE_CURRENT_BINARY_DIR}/scr2<br />
DESTINATION bin)<br />
<br />
===Replace INSTALL_TARGETS===<br />
<br />
Assuming there are targets: ExecutableTarget, StaticLibraryTarget, and<br />
SharedLibraryTarget. Typically there would be code in CMake list file that<br />
would look like this:<br />
<br />
INSTALL_TARGETS(/bin ExecutableTarget)<br />
INSTALL_TARGETS(/lib StaticLibraryTarget)<br />
INSTALL_TARGETS(/lib RUNTIME_DIRECTORY /bin SharedLibraryTarget)<br />
<br />
These lines are replaced with:<br />
<br />
INSTALL(TARGETS ExecutableTarget StaticLibraryTarget SharedLibraryTarget<br />
RUNTIME DESTINATION bin<br />
LIBRARY DESTINATION lib<br />
ARCHIVE DESTINATION lib<br />
)<br />
<br />
'''RUNTIME''' refers to the runtime piece of the target. Runtime piece only<br />
applies to executable targets and DLL (Windows) style shared libraries.<br />
'''LIBRARY''' refers to all the other (non DLL) shared libraries and modules.<br />
'''ARCHIVE''' refers to the static libraries and the import parts of DLL<br />
libraries (LIB files).<br />
<br />
{{CMake/Template/Footer}}</div>Clement.gregoirehttps://public.kitware.com/Wiki/index.php?title=CMake:How_To_Find_Libraries&diff=62168CMake:How To Find Libraries2018-01-13T10:02:59Z<p>Clement.gregoire: </p>
<hr />
<div>{{CMake/Template/Header}}<br />
<br />
If your software uses external libraries (i.e. libraries not coming with your software), you don't know in advance where its headers and libraries will be located on the system where your software will be compiled.<br />
Depending on the location appropriate include directories and library search paths will have to be added to the compile commands.<br />
<br />
CMake helps you with this by providing the [http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:find_package find_package] command.<br />
<br />
This article briefly discusses how to use external libraries in a CMake project and then moves on to how to write your own find modules for libraries that don't already have one.<br />
<br />
= Using external libraries =<br />
<br />
CMake comes with numerous ''modules'' that aid in finding various well-known libraries and packages. You can get a listing of which modules your version of CMake supports by typing ''cmake --help-module-list'', or by figuring out where your modules-path is and looking inside of it. On Ubuntu linux, for example, the module path is ''/usr/share/cmake/Modules/'' <br />
<br />
Let's take the very popular ''bzip2'' library. There is a module named ''FindBZip2.cmake''. Once you call this module with find_package(BZip2), cmake will automatically fill in the values of various variables, which you can then use in your CMake script. For a list of the variables, look at the actual cmake module file, or you can type ''cmake --help-module FindBZip2''.<br />
<br />
For example, consider a very simple program that uses ''bzip2'' - i.e. the compiler needs to know where ''bzlib.h'' is and the linker needs to find the bzip2 library (for dynamic linking, this is something like ''libbz2.so'' on Unix, or ''libbz2.dll'' on Windows):<br />
<br />
cmake_minimum_required(VERSION 2.8)<br />
project(helloworld)<br />
add_executable(helloworld hello.c)<br />
find_package (BZip2)<br />
if (BZIP2_FOUND)<br />
include_directories(${BZIP_INCLUDE_DIRS})<br />
target_link_libraries (helloworld ${BZIP2_LIBRARIES})<br />
endif (BZIP2_FOUND)<br />
<br />
You can then use ''cmake'' and ''make VERBOSE=1'' to verify that the correct flags are being passed to the compiler and linker. You can also use a tool like 'ldd' or 'dependency walker' after compilation to verify what exact files ''helloworld'' has been linked with.<br />
<br />
= Using external libraries that CMake doesn't yet have modules for =<br />
<br />
Suppose you want to use the LibXML++ library. As of this writing, CMake doesn't come with a 'find' module for libXML++. But you found one on the internet (in a file called ''FindLibXML++.cmake'') by googling for ''FindLibXML++ Cmake''. In CMakeLists.txt, write<br />
<br />
<pre><br />
find_package(LibXML++ REQUIRED)<br />
include_directories(${LibXML++_INCLUDE_DIRS})<br />
set(LIBS ${LIBS} ${LibXML++_LIBRARIES})<br />
</pre><br />
<br />
If the package is optional, you can omit the <code>REQUIRED</code> keyword and query the boolean variable <code>LibXML++_FOUND</code> afterwards to see if it has been found.<br />
Then, after detecting all the libraries, for your target:<br />
<br />
<pre><br />
target_link_libraries(exampleProgram ${LIBS})<br />
</pre><br />
<br />
For this to work, you'll need to put the ''FindLibXML++.cmake'' file into your CMake module path. Since CMake (currently) doesn't ship it, you'll have to ship it within your project. Create a folder named cmake/Modules/ under your project root, and in the root CMakeLists.txt, include the following code:<br />
<br />
<pre><br />
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")<br />
</pre><br />
<br />
As you may have guessed, you need to put the CMake modules that you use, and that CMake has to find automatically, inside that folder.<br />
<br />
That's it, usually. Some libraries might require something else, so be sure to look inside that FindSomething.cmake file to see the documentation for that specific library.<br />
<br />
== Packages with components ==<br />
<br />
Some libraries are not monolithic, but come with one or more dependent libraries or components. A notable example for this is the Qt library, which ships (among others) with the components QtOpenGL and QtXml. To use both of these components, use the following the find_package command:<br />
<br />
<pre><br />
find_package(Qt COMPONENTS QtOpenGL QtXml REQUIRED)<br />
</pre><br />
<br />
Again, you can omit the <code>REQUIRED</code> keyword, if the package is optional for your project. In this case, you can use the <code>&lt;PACKAGE&gt;_&lt;COMPONENT&gt;_FOUND</code> variable (e.g. Qt_QtXml_FOUND) to check if a component has been found. The following invocations of find_package are all equivalent:<br />
<br />
<pre><br />
find_package(Qt COMPONENTS QtOpenGL QtXml REQUIRED)<br />
find_package(Qt REQUIRED COMPONENTS QtOpenGL QtXml)<br />
find_package(Qt REQUIRED QtOpenGL QtXml)<br />
</pre><br />
<br />
If you only require some components of a package, and want to use others only, if they are available, you can call find_package twice:<br />
<br />
<pre><br />
find_package(Qt COMPONENTS QtXml REQUIRED)<br />
find_package(Qt COMPONENTS QtOpenGL)<br />
</pre><br />
<br />
Alternatively, you can invoke find_package once with all components, but without the <code>REQUIRED</code> keyword and then explicitly check the required components:<br />
<br />
<pre><br />
find_package(Qt COMPONENTS QtOpenGL QtXml)<br />
if ( NOT Qt_FOUND OR NOT QtXml_FOUND )<br />
message(FATAL_ERROR "Package Qt and component QtXml required, but not found!")<br />
endif( NOT Qt_FOUND OR NOT QtXml_FOUND )<br />
</pre><br />
<br />
= How package finding works =<br />
<br />
The [http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:find_package find_package()] command will look in the module path for Find<name>.cmake, which is the typical way for finding libraries. First CMake checks all directories in ${CMAKE_MODULE_PATH}, then it looks in its own module directory <CMAKE_ROOT>/share/cmake-x.y/Modules/.<br />
<br />
If no such file is found, it looks for <Name>Config.cmake or <lower-case-name>-config.cmake, which are supposed to be installed by libraries (but there are currently not yet many libraries which install them) and that don't do detection, but rather just contain hardcoded values for the installed library.<br />
<br />
The former is called module mode and the latter is called config mode. Creation of config mode files is documented [[CMake/Tutorials/How_to_create_a_ProjectConfig.cmake_file|here]]. You may also need the documentation for [[CMake/Tutorials/Exporting_and_Importing_Targets|importing and exporting targets]].<br />
<br />
For the module system there seems to be no documentation elsewhere, so this article concentrates on it.<br />
<br />
No matter which mode is used, if the package has been found, a set of variables will be defined:<br />
* <NAME>_FOUND<br />
* <NAME>_INCLUDE_DIRS or <NAME>_INCLUDES<br />
* <NAME>_LIBRARIES or <NAME>_LIBRARIES or <NAME>_LIBS<br />
* <NAME>_DEFINITIONS<br />
<br />
All this takes place in the Find<name>.cmake file. <br />
<br />
Now, in the CMakeLists.txt file in the top level directory of your code (the client code that is actually going to make use of the library <name>, we check for the variable <NAME>_FOUND to see whether the package has been found or not. For most packages the resulting variables use the name of the package all uppercased, e.g. LIBFOO_FOUND, for some packages the exact case of the package is used, e.g. LibFoo_FOUND. If this variable is found, then, we pass the<NAME>_INCLUDE_DIRS to the include_directories() command and <NAME>_LIBRARIES to the target_link_libraries() command of CMake.<br />
<br />
These conventions are documented in the file readme.txt in the CMake module directory.<br />
<br />
The "REQUIRED" and other optional find_package arguments are forwarded to the module by find_package and the module should affect its operation based on them.<br />
<br />
= Piggybacking on pkg-config =<br />
<br />
Pkg-config is a build-helping tool, based on '.pc' files that record the location of library-files and include-files. It is typically found on Unix-like systems. Please see [http://www.freedesktop.org/wiki/Software/pkg-config/ the pkg-config’s site] for more information. CMake has its own functions that can make use of pkg-config if it is installed on your system. The functions are documented in the <tt>FindPkgConfig.cmake</tt> file under your CMake’s Modules directory. This can be particularly helpful if you are dealing with a library that does not have a cmake-script built for it, or if you are dealing with a situation where CMake’s ordinary find-script does not work properly. <br />
<br />
However, you should be very careful if you just call pkg-config and use whatever it returned, even when it is available. One major reason for this is that this way the user can accidently override or augment library detection by manually defining the paths using ccmake, as is conventional with CMake. There are also cases when pkg-config just supplies incorrect information (wrong compiler, etc). In these cases, let CMake do the detection, as it would without pkg-config, but use pkg-config to provide additional hints on where to look.<br />
<br />
= Writing find modules =<br />
<br />
First of all, notice that the name, or prefix, supplied to find_package is part of the filename and the prefix used for all variables. The case does matter and the names should match exactly. Unfortunately in many cases, even in the modules shipped with CMake, the names do not match, causing various issues. <br />
<br />
The basic operation of a module should roughly follow this order<br />
* Use find_package to detect other libraries that the library depends on<br />
** The arguments QUIETLY and REQUIRED should be forwarded (e.g. if current package was REQUIRED, the depencency should also be)<br />
* Optionally use pkg-config to detect include/library paths (if pkg-config is available)<br />
* Use [http://www.cmake.org/cmake/help/cmake2.6docs.html#command:find_path find_path] and [http://www.cmake.org/cmake/help/cmake2.6docs.html#command:find_library find_library] to look for the header and library files, respectively<br />
** Paths supplied by pkg-config are used only as hints on where to look<br />
** CMake has many other hardcoded locations where it looks, too<br />
** Results should be saved in variables <name>_INCLUDE_DIR and <name>_LIBRARY (note: singular, not plural)<br />
* Set <name>_INCLUDE_DIRS to <name>_INCLUDE_DIR <dependency1>_INCLUDE_DIRS ...<br />
* Set <name>_LIBRARIES to <name>_LIBRARY <dependency1>_LIBRARIES ...<br />
** Dependencies use plural forms, the package itself uses the singular forms defined by find_path and find_library<br />
* Call the find_package_handle_standard_args() macro to set the <name>_FOUND variable and print a success or failure message.<br />
<br />
<br />
<pre><br />
# - Try to find LibXml2<br />
# Once done this will define<br />
# LIBXML2_FOUND - System has LibXml2<br />
# LIBXML2_INCLUDE_DIRS - The LibXml2 include directories<br />
# LIBXML2_LIBRARIES - The libraries needed to use LibXml2<br />
# LIBXML2_DEFINITIONS - Compiler switches required for using LibXml2<br />
<br />
find_package(PkgConfig)<br />
pkg_check_modules(PC_LIBXML QUIET libxml-2.0)<br />
set(LIBXML2_DEFINITIONS ${PC_LIBXML_CFLAGS_OTHER})<br />
<br />
find_path(LIBXML2_INCLUDE_DIR libxml/xpath.h<br />
HINTS ${PC_LIBXML_INCLUDEDIR} ${PC_LIBXML_INCLUDE_DIRS}<br />
PATH_SUFFIXES libxml2 )<br />
<br />
find_library(LIBXML2_LIBRARY NAMES xml2 libxml2<br />
HINTS ${PC_LIBXML_LIBDIR} ${PC_LIBXML_LIBRARY_DIRS} )<br />
<br />
include(FindPackageHandleStandardArgs)<br />
# handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE<br />
# if all listed variables are TRUE<br />
find_package_handle_standard_args(LibXml2 DEFAULT_MSG<br />
LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR)<br />
<br />
mark_as_advanced(LIBXML2_INCLUDE_DIR LIBXML2_LIBRARY )<br />
<br />
set(LIBXML2_LIBRARIES ${LIBXML2_LIBRARY} )<br />
set(LIBXML2_INCLUDE_DIRS ${LIBXML2_INCLUDE_DIR} )<br />
</pre><br />
<br />
In the first line, LibFindMacros is included. For this to work, the LibFindMacros.cmake file must be placed in the module path, as it is not currently shipped in the CMake distribution.<br />
<br />
== Finding files ==<br />
<br />
After that the actual detection takes place. Supply a variable name as the first argument for both find_path and find_library. If you need multiple include paths, use find_path multiple times with different variable names. The same goes for find_library.<br />
<br />
* NAMES specifies one or more names for the target and if any matches, that one is chosen. In find_path you should use the main header or whatever is #included in the C/C++ code. This may also contain a folder, e.g. alsa/asound.h and then it will give the parent directory of the folder that asound.h is in as result.<br />
* PATHS is used to provide additional search paths for CMake to look into and it should not generally be defined for things other than pkg-config (CMake has its built-in defaults and more can be added as required by various config variables). If you are not using it, leave out the entire section.<br />
* PATH_SUFFIXES (not present in this example) is useful for libraries that on some systems put their files in paths like /usr/include/ExampleLibrary-1.23/ExampleLibrary/main.h; in this case you'd use NAMES ExampleLibrary/main.h PATH_SUFFIXES ExampleLibrary-1.23. Multiple suffixes may be specified and CMake will try them all, and also no suffix at all, in all include directories, and in the bare prefix as well.<br />
<br />
The library names do not contain the lib prefix used on UNIX system, nor any file extension or compiler specifications, as CMake will platform-independently detect them. The library version number is still needed, if present in the body part of the library file name.<br />
<br />
== Using LibFindMacros ==<br />
<br />
The module [https://github.com/Tronic/cmake-modules/blob/master/LibFindMacros.cmake LibFindMacros.cmake] was written to make writing find-modules easier. It contains various libfind macros taking care of the boring parts that are always the same for every library. With it, a scripts look like this:<br />
<br />
<pre><br />
# - Try to find ImageMagick++<br />
# Once done, this will define<br />
#<br />
# Magick++_FOUND - system has Magick++<br />
# Magick++_INCLUDE_DIRS - the Magick++ include directories<br />
# Magick++_LIBRARIES - link these to use Magick++<br />
<br />
include(LibFindMacros)<br />
<br />
# Dependencies<br />
libfind_package(Magick++ Magick)<br />
<br />
# Use pkg-config to get hints about paths<br />
libfind_pkg_check_modules(Magick++_PKGCONF ImageMagick++)<br />
<br />
# Include dir<br />
find_path(Magick++_INCLUDE_DIR<br />
NAMES Magick++.h<br />
PATHS ${Magick++_PKGCONF_INCLUDE_DIRS}<br />
)<br />
<br />
# Finally the library itself<br />
find_library(Magick++_LIBRARY<br />
NAMES Magick++<br />
PATHS ${Magick++_PKGCONF_LIBRARY_DIRS}<br />
)<br />
<br />
# Set the include dir variables and the libraries and let libfind_process do the rest.<br />
# NOTE: Singular variables for this library, plural for libraries this this lib depends on.<br />
set(Magick++_PROCESS_INCLUDES Magick++_INCLUDE_DIR Magick_INCLUDE_DIRS)<br />
set(Magick++_PROCESS_LIBS Magick++_LIBRARY Magick_LIBRARIES)<br />
libfind_process(Magick++)<br />
</pre><br />
<br />
libfind_pkg_check_modules is a convenience wrapper for CMake's own pkg-config modules, with the intention of making things easier. You don't need to test for CMake version, load the appropriate module, check if it loaded, etc. when all you really want to do is a simple optional check. The arguments are the same as for [http://www.cmake.org/cmake/help/cmake2.6docs.html#module:FindPkgConfig pkg_check_modules]: first the prefix for returned variables, then package name (as it is known by pkg-config). This defines <prefix>_INCLUDE_DIRS and other such variables.<br />
<br />
=== Dependencies (optional) ===<br />
<br />
libfind_package functions similarly to find_package, except that it forwards the QUIETLY and REQUIRED arguments. For this to work, the first parameter supplied is the name of the current package. I.e. here Magick++ depends on Magick. Other arguments such as version could be added after Magick and they'd just be forwarded to the CMake internal find_package command. Have one of these lines for every library that your library depends on, and be sure to supply find modules for them as well.<br />
<br />
=== Final processing ===<br />
<br />
Three items done, four to go. Fortunately, those last ones are rather mechanical and can be taken care of by the libfind_process macro and the last three lines of the example file. You will need to set <name>_PROCESS_INCLUDES with the names of all variables to be included in <name>_INCLUDE_DIRS, and <name>_PROCESS_LIBS with the names of all variables to be included in <name>_LIBRARIES. Then call libfind_process(<name>) and it'll do the rest.<br />
<br />
The library is considered FOUND only if all the provided variables have valid values.<br />
<br />
= Performance and caching =<br />
<br />
The CMake variable system is far more complex than it may seem first. Some variables are cached and some are not. The cached variables may be cached as internal (not possible to edit with ccmake) or as external (have a type and a documentation string and can be modified in ccmake). Further, the external variables may be set advanced, so that they'll only be seen in the advanced mode of ccmake.<br />
<br />
By default, all variables are non-cached.<br />
<br />
In order to avoid doing all the library detection again on every run, and more importantly to allow the user to set include dirs and libraries in ccmake, these will have to be cached. Fortunately, this is already taken care of by find_path and find_library, which will cache their variables. If the variable is already set to a valid value (e.g. not -NOTFOUND or undefined), these functions will do nothing, but keep the old value. Similarly, pkg_check_modules does internal caching of the results, so that it does not need to call pkg-config again every time.<br />
<br />
On the other hand, the output values of the find module (<name>_FOUND, <name>_INCLUDE_DIRS and <name>_LIBRARIES) should not be cached because then modifying the other cached variables would no longer cause the actual output to change and this obviously is not a desired operation.<br />
<br />
= Common bugs in find modules =<br />
<br />
* Different case or slightly different name in filename and in variables<br />
* The module does not check <name>_FIND_REQUIRED or <name>_FIND_QUIETLY - and thus the find_package arguments QUIET and REQUIRED will have no effect<br />
* <name>_INCLUDE_DIRS and <name>_LIBRARIES are not set, but instead only the singular forms are available<br />
<br />
= Links =<br />
<br />
* [http://zi.fi/cmake/Modules Tronic's CMake modules]</div>Clement.gregoirehttps://public.kitware.com/Wiki/index.php?title=CMake&diff=62167CMake2018-01-13T10:01:41Z<p>Clement.gregoire: </p>
<hr />
<div>{{CMake/Template/Header}}<br />
<br />
https://cmake.org/cmake/img/CMake-logo-download.jpg<br />
<br />
<!-- documentation manual man information help tutorial --><br />
Welcome to CMake, the cross-platform, open-source make system. CMake is used to control the software compilation process using simple platform and compiler independent configuration files. CMake generates native makefiles and workspaces that can be used in the compiler environment of your choice. CMake is quite sophisticated: it is possible to support complex environments requiring system configuration, pre-processor generation, code generation, and template instantiation.<br />
<br />
You will find here not only documentation for CMake, but also for CPack and CTest.<br />
<br />
=CMake=<br />
<br />
==Primary Resources - Look here first! ==<br />
* Where can I [https://cmake.org/HTML/Download.html download CMake]?<br />
* [https://cmake.org/documentation/ CMake Documentation]<br />
* [https://cmake.org/cmake/help/latest/manual/cmake-variables.7.html CMake Variables]<br />
* [https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html Structure of a CMake Build System]<br />
* [[CMake FAQ| FAQ (Frequently asked questions)]]<br />
* [https://cmake.org/mailman/listinfo/cmake CMake Mailing List] (for searchable archives see [[CMake_FAQ#Where_can_I_find_searchable_CMake_Mailing_Archives | CMake FAQ ]])<br />
* [[https://cmake.org/cmake/help/latest/release/index.html|CMake Release Notes]]<br />
<br />
==Reference Material==<br />
* [https://cmake.org/cmake/help/latest/manual/cmake-variables.7.html CMake Variables]<br />
* [https://cmake.org/cmake/help/latest/manual/cmake-properties.7.html?highlight=properties List of CMake Properties] <br />
====The CMake Language====<br />
* [https://cmake.org/cmake/help/latest/manual/cmake-language.7.html#syntax A quick introduction to CMake syntax]<br />
* [[CMake:VariablesListsStrings| On variables, lists, strings, maps, regexps, etc.]]<br />
* [[CMake/Language Syntax | Language syntax]]<br />
<br />
==Guides==<br />
====General====<br />
* [[CMake Cross Compiling| Cross compiling]]<br />
* [[CMake HowToDoPlatformChecks| How to write platform checks with CMake]]<br />
* [[CMake:How_To_Find_Libraries | How to find libraries]]<br />
* [[CMake:Install Commands| How to install things]]<br />
<br />
====Specific====<br />
* [[CMake RPATH handling|RPATH handling]]<br />
* [[CMake Editors Support|Editors/IDEs with CMake syntax support]]<br />
* [[BuildingWinDLL| How to export symbols from a Windows DLL for the non-Windows Developer]]<br />
* [[RecipeAddSoVersionToDLLs|Appending the SO version to DLLs]]<br />
* [[CMake_Build_Rules | Advanced Usage of CMake Build Rules]]<br />
* [[CMake_Checking_Platform | How to Check the Current Platform]]<br />
<br />
==Development Topics==<br />
* [[CMake/Assembler|Assembler Support]]<br />
* [[CMake Generator Specific Information|Docs for Specific Project Generators]] (Eclipse, KDevelop3, CodeBlocks, Makefile)<br />
* [[CMake User Contributed Macros| Contributed macros]]<br />
* [[CMake:Module Maintainers|Module Maintainers]]<br />
* [[CMake Platform Dependent Issues|Platform Dependent Information]]<br />
* [[CMake/ChangeLog|Current CMake Version ChangeLog]]<br />
* [[CMake Released Versions|Documentation for previous releases]]<br />
* [[CMake Life Cycle Considerations]]<br />
* [[CMake Version Compatibility Matrix|Matrix for checking backwards-compatibility of current features]]<br />
* [[CMake builtin documentation handling]]<br />
* [http://www.aosabook.org/en/cmake.html The architecture of Open Source Applications - CMake]<br />
<br />
==Tutorials==<br />
<br />
===Basic Introductions===<br />
* [https://cmake.org/HTML/Examples.html A Simple CMake Example]<br />
* [http://www.linuxjournal.com/article/6700 Cross-Platform Software Development Using CMake]<br />
* [http://clubjuggler.livejournal.com/138364.html CMake: The Cross Platform Build System]<br />
* [http://www.elpauer.org/stuff/learning_cmake.pdf "Learning CMake"] - Slides of a CMake workshop, including CPack, CTest and CDash<br />
* [https://github.com/TheErk/CMake-tutorial CMake tutorial] - Slides (with LaTeX bearmer source) of a CMake tutorial including CPack, CTest.<br />
* [http://www.visgraf.impa.br/seminar/slides/rodlima_cmake_presentation.pdf "CMake: Behind the Scenes of Code Development"] - Slides of an introductory talk/tutorial about CMake and its benefits<br />
* [http://hackerwithin.org/thw/plugin_wiki/page/buildsystems The Hacker Within: Build Systems] Explains why and how to use build systems with a CMake example.<br />
<br />
* How CMake simplifies the build process by Bruno Abinader<br />
** [https://brunoabinader.com/how-cmake-simplifies-the-build-process-part-1-basic-build-system Part 1 - Basic build system]<br />
** [http://web.archive.org/web/20101030232202/http://cabledogs.org/abinader/2009/12/09/how-cmake-simplifies-the-build-process-part-2-advanced-build-system/ Part 2 - Advanced build system]<br />
* [http://rachid.koucha.free.fr/tech_corner/cmake_manual.html Empirical approach to CMAKE] by Rachid Koucha<br />
* [[CMake/MinimalExamples | Minimal examples]] (wiki page)<br />
<br />
===Finding stuff and platform checking===<br />
<br />
* [[CMake/Tutorials#CMake_Packages|How to package your project for use by others]], create FooConfig.cmake files, and exporting and importing targets.<br />
<br />
* [[CMake:HowToUseExistingOSXFrameworks | How to find and use existing frameworks on OS X]]<br> A quick example to help OS X users find frameworks automatically.<br />
<br />
===How to use CMake with specific Libraries ===<br />
<br />
* [[CMake:How To Build Qt4 Software | How to build Qt4 software with CMake]]<br />
<br />
* [http://qtnode.net/wiki?title=Qt_with_cmake Qt with CMake] <br>Explains how to use CMake to build software with Qt4, Qt3 and KDE3.<br />
<br />
* [http://mikemcquaid.com/2012/01/deploying-qt-applications-with-deployqt4/ Deploying Qt4 applications with CMake] <br>Explains how to use the DeployQt4.cmake module coming with CMake 2.8.7.<br />
<br />
* [[CMake:How To Build KDE4 Software | How to build KDE4 software with CMake]]<br />
<br />
* [[CMake:MatlabMex | How to use CMake to create Matlab MEX files]] <br> Describes how to use CMake when developing Matlab Executable (MEX) files for use with The Mathworks Matlab scripting language.<br />
<br />
* [http://www.wxwidgets.org/wiki/index.php/CMake How to use CMake for building software with wxWidgets ]<br />
<br />
* [http://www.linuxdevices.com/articles/AT6762290643.html Building eCos applications with CMake]<br />
<br />
* [http://www.smslana.eu Building Sms applications with CMake]<br />
<br />
* [http://blog.quickforge.co.uk/2011/10/exploration-of-cross-compiling-on-windows-for-arm-linux-distributions/ Cross compiling from Windows to ARM Linux]<br />
<br />
* [[CMakeForFLTK| Using CMake to build an FLTK application]]<br />
<br />
===Recipes===<br />
<br />
* [[CMake:How To Process Lots Of Input Files | How to process lots of input files with a processor built by CMake]]<br />
<br />
<br />
* [[VSConfigSpecificSettings| Configuration Specific Settings for Visual Studio Generated Project Files]]<br />
<br />
* [[BundleUtilitiesExample| How to use the 'BundleUtilities' to deploy your OS X Application. Example uses Qt 4.]]<br />
<br />
* [[CMakeForFortranExample|How to write a simple CMakeLists.txt for Fortran code]]<br />
<br />
* [[CMakeEmulateMakeCheck|How to emulate GNU Autotools 'make check']]<br />
<br />
* [[CustomCommandCustomTargetInstall|A toy model for add_custom_command and add_custom_target]]<br />
<br />
* [[CMake:OSX_InterfaceBuilderFiles|Working with OS X Interface Builder Files]]<br />
<br />
* [[RecipeAppendVersionNumberToInstallpath|Append the Version Number to the Install path]]<br />
<br />
* [[RecipeInstallToALocalFolderForTesting|Install to a local folder in the build dir for testing]]<br />
<br />
* [[RecipeAddUninstallTarget|Adding an uninstall target to your project]]<br />
<br />
<br />
==Converters from other buildsystems to CMake==<br />
<br />
All converters listed here are not "complete", i.e. the generated CMake files are not 100% finished, in all cases some work is left for the developer.<br />
<br />
====automake/autotools/autoconf====<br />
* [https://projects.kde.org/projects/kde/kdesdk/kde-dev-scripts/repository/revisions/master/changes/cmake-utils/scripts/am2cmake am2cmake (requires Ruby) ] Converts automake/autotools/libtool based projects to CMake, specialized in converting from KDE 3 to KDE 4, should also work for others. This one has been used for converting the KDE buildsystem to CMake.<br />
<br />
* [http://emanuelgreisen.dk/stuff/kdevelop_am2cmake.php.tgz Alternative Automake2CMake (requires PHP)] Converts KDevelop projects that use automake to CMake.<br />
<br />
* [[GccXmlAutoConfHints|Converting autoconf tests]]<br />
<br />
====qmake====<br />
* [[CMake:ConvertFromQmake | qmake converter (requires Ruby)]] Converts projects that use Qt's qmake.<br />
<br />
====Visual Studio====<br />
* [http://vcproj2cmake.sf.net vcproj2cmake.rb (requires Ruby) SourceForge project] Creates '''and maintains''' CMakeLists.txt files by extracting info from Visual Studio project files (.vcproj/.vcxproj). Elaborate script for development side-by-side the updated original static .vc[x]proj files, supports script hooks and powerful definition mappings. Patches and new project members very welcome. Older script versions below:<br />
** [http://www.eskilson.se/vcproj2cmake.rb Original vcproj2cmake.rb version (requires Ruby)] <br />
** Slightly newer version here [http://dgwarp.hd.free.fr/vcproj2cmake.rb vcproj2cmake.rb], see:[[User_talk:Dweeves]] for details<br />
* [http://nberserk.blogspot.com/2010/11/converting-vc-projectsvcproj-to.html vcproj2cmake.ps1(PowerShell version)] Creates CMakeLists.txt. it supports vcproj configuration and detect 'exclude from build' option<br />
* [http://sourceforge.net/projects/folders4cmake/ folders4cmake (requires Java)] Use Visual Studio project files to generate corresponding "source_group" information that you can use inside your own CMake scripts. Supports Visual Studio 9/10 project files (full round-trip possible).<br />
<br />
====Basic CMakeLists.txt from-scratch-generator====<br />
* [http://websvn.kde.org/trunk/KDE/kdesdk/cmake/scripts/ gencmake (requires Ruby) ] Creates basic CMakeLists.txt files from looking at the existing files.<br />
* [http://www.vanvelzensoftware.com/postnuke/index.php?name=Downloads&req=viewdownload&cid=7 CMakeListGenerator (Win32) ] Creates complete CMakeLists.txt files as described in the [https://gucef.svn.sourceforge.net/svnroot/gucef/trunk/tools/CMakeListGenerator/docs/README.txt README ] using a combination of file and directory structure analysis. Supports resolving dependencies between multiple archives.<br />
<br />
==Success Stories==<br />
<br />
* What are some [[CMake Projects|projects using CMake]]?<br />
* [[CMake:Articles|Articles about CMake]]<br />
* [[Really Cool CMake Features]]<br />
<br />
<br />
==More Topics==<br />
<br />
* [[CMake Fortran Issues|Fortran Issues]]<br />
* [[CMake:For CMake Hackers|Generating dependency graphs with CMake]]<br />
* [[CMake:Experiments With Lua|Experiments With Lua]]<br />
* [[CMake Performance Tips|Performance Tips]]<br />
* [[CMake:GNU style example | GNU style directory layout with CMake]]<br />
* [[CMake:OpenTasks| CMake TODO]]<br />
* [[CMake:CreateQtAssistantDocs| Creating Qt Assistant Docs]]<br />
* [[CMake:Static libraries| Writing FindXXX.cmake modules that work with static libraries]]<br />
* [[CMake:Multiple versions| Writing FindXXX.cmake modules that work when multiple versions of packages are installed]]<br />
* [[CMake:Improving Find* Modules ]]<br />
* [[/C Plugins for Loadable Commands/]]<br>For anyone who wonders what the <tt>load_command</tt> command is for.<br />
* [[PC-Lint]] support for CMake<br />
<br />
=CTest=<br />
<br />
===Tutorials===<br />
* [[CMake Testing With CTest|Testing With CTest]]<br>Introduces to testing with CTest, submitting dashboards, and using CMake to add tests to the test system.<br />
<br />
* [[CMake Scripting Of CTest|CTest Scripting]]<br>Describes the scripting with CTest which can significantly simplify and automate testing and submitting dashboards.<br />
<br />
* [[CMake Generating Testing Files|Generating Input Files For CTest]]<br>Describe more in details the concepts behind testing with CTest and also explans how to use CTest without using CMake.<br />
<br />
* [[CTest:Buildserver|Buildmanagement With CTest]]<br>Describes how to setup a central configuration for all CTest scripts.<br />
<br />
===More Information===<br />
* [[CTest:Submission Issues|Configuring CTest Submission Methods]]<br />
* [[CTest:Nightly, Experimental, Continuous|CTest Nightly, Experimental, Continuous, ...]]<br />
* [[CTest:Coverage]]<br />
* [[Media:CTest Running Modes.pdf]]<br />
* [[CTest:FAQ|CTest Frequently asked questions]]<br />
<br />
===More Topics===<br />
* [[CTest:OpenTasks| CTest TODO]]<br />
* [[CTest:TestWithoutBuild| Run tests on machines without building first]]<br />
<br />
=CDash=<br />
* [http://public.kitware.com/Wiki/CDash CDash Wiki].<br />
* [http://public.kitware.com/Wiki/CDash:FAQ CDash FAQ].<br />
<br />
<br />
=CPack=<br />
===Tutorials===<br />
* [[CMake:Packaging With CPack|Packaging with CPack]]<br>Introduction to CPack, installing and packaging of software.<br />
* [https://github.com/TheErk/CMake-tutorial CMake tutorial] - Slides from a CMake tutorial (including LaTeX beamer source) including CPack.<br />
* [[CMake:CPackConfiguration|CPack Variables]]<br><br />
* [[CMake:CPackPackageGenerators|Supported package formats]]<br><br />
* [[CMake:CPackWin32NewbiesChecklist|CPack Win32 Newbie Checklist]] <br><br />
* [[CMake:Component_Install_With_CPack|Component Install With CPack]] <br><br />
<br />
===Recipes===<br />
<br />
* [[RecipeAddShortcutToStartMenu|Add an application shortcut to the Start Menu]]<br />
<br />
<br />
=Old(deprecated) kept for reference only=<br />
<br />
* [[CMake_2.6_Notes|CMake 2.6 Notes]]<br />
* [[CMake Useful Variables|Useful CMake Variables]]<br />
<br />
{{CMake/Template/Footer}}</div>Clement.gregoirehttps://public.kitware.com/Wiki/index.php?title=CMake_Useful_Variables&diff=62166CMake Useful Variables2018-01-13T10:01:02Z<p>Clement.gregoire: </p>
<hr />
<div>{{CMake/Template/Header}}<br />
<br />
CMake uses and defines many variables, which can be used in CMakeLists.txt files.<br />
<br />
'''NOTE:''' As of CMake 2.6.0 many of these variables have been officially documented in TXT and [http://www.cmake.org/cmake/help/documentation.html HTML] files released with CMake. You may still see some ''useful'' variables here that haven't yet been documented in the official documentation, although the number of these diminishes with every release. This page, in either case, is more of a distilled list of some of the more important variables. The [http://www.cmake.org/cmake/help/documentation.html official documentation] is home of the authoritative guide to all CMake variables, commands, and properties.<br />
<br />
== Locations ==<br />
; CMAKE_BINARY_DIR : if you are building in-source, this is the same as CMAKE_SOURCE_DIR, otherwise this is the top level directory of your build tree<br />
; CMAKE_COMMAND : this is the complete path of the cmake which runs currently (e.g. <tt>/usr/local/bin/cmake</tt>). Note that if you have custom commands that invoke <code>cmake -E</code>, it is ''very important'' to use CMAKE_COMMAND as the CMake executable, because CMake might not be on the system PATH.<br />
; CMAKE_CURRENT_BINARY_DIR : if you are building in-source, this is the same as CMAKE_CURRENT_SOURCE_DIR, otherwise this is the directory where the compiled or generated files from the current CMakeLists.txt will go to. <br />
; CMAKE_CURRENT_SOURCE_DIR : this is the directory where the currently processed CMakeLists.txt is located in<br />
; CMAKE_CURRENT_LIST_FILE : this is the full path to the listfile currently being processed.<br />
; CMAKE_CURRENT_LIST_DIR : (since '''2.8.3''') this is the directory of the listfile currently being processed.<br />
; CMAKE_CURRENT_LIST_LINE : this is linenumber where the variable is used.<br />
; CMAKE_FILES_DIRECTORY : the directory within the current binary directory that contains all the CMake generated files. Typically evaluates to "/CMakeFiles". Note the leading slash for the directory. Typically used with the current binary directory, i.e. ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}<br />
; CMAKE_MODULE_PATH : tell CMake to search first in directories listed in CMAKE_MODULE_PATH when you use FIND_PACKAGE() or INCLUDE()<br> <tt> SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/MyCMakeScripts)</tt><br> <tt>FIND_PACKAGE(HelloWorld)</tt><br />
; CMAKE_ROOT : this is the CMake installation directory<br />
; CMAKE_SOURCE_DIR : this is the directory which contains the top-level CMakeLists.txt, i.e. the top level source directory<br />
; PROJECT_NAME : the name of the project set by PROJECT() command.<br />
; CMAKE_PROJECT_NAME : the name of the first project set by the PROJECT() command, i.e. the top level project.<br />
; PROJECT_BINARY_DIR : contains the full path to the top level directory of your build tree<br />
; PROJECT_SOURCE_DIR : contains the full path to the root of your project source directory, i.e. to the nearest directory where CMakeLists.txt contains the PROJECT() command<br />
<br />
== Environment Variables ==<br />
<br />
These are environment variables which effect cmake behaviour.<br />
<br />
; CMAKE_INCLUDE_PATH : This is used when searching for include files e.g. using the FIND_PATH() command. If you have headers in non-standard locations, it may be useful to set this variable to this directory (e.g. <tt>/sw/include</tt> on Mac OS X). If you need several directories, separate them by the platform specific separators (e.g. ":" on UNIX)<br />
<br />
; CMAKE_LIBRARY_PATH : This is used when searching for libraries e.g. using the FIND_LIBRARY() command. If you have libraries in non-standard locations, it may be useful to set this variable to this directory (e.g. <tt>/sw/lib</tt> on Mac OS X). If you need several directories, separate them by the platform specific separators (e.g. ":" on UNIX)<br />
<br />
; CMAKE_PREFIX_PATH : (since CMake '''2.6.0''') This is used when searching for include files, binaries, or libraries using either the FIND_PACKAGE(), FIND_PATH(), FIND_PROGRAM(), or FIND_LIBRARY() commands. For each path in the CMAKE_PREFIX_PATH list, CMake will check "PATH/include" and "PATH" when FIND_PATH() is called, "PATH/bin" and "PATH" when FIND_PROGRAM() is called, and "PATH/lib" and "PATH" when FIND_LIBRARY() is called. See the documentation for FIND_PACKAGE(), FIND_LIBRARY(), FIND_PATH(), and FIND_PROGRAM() for more details.<br />
<br />
; CMAKE_INSTALL_ALWAYS : If set during installation CMake will install all files whether they have changed or not. The default when this is not set is to install only files that have changed since the previous installation. In both cases all files are reported to indicate CMake knows they are up to date in the installed location.<br />
<br />
; $ENV{name} : This is not an environment variable , but this is how you can access environment variables from cmake files. It returns the content of the environment variable with the given name (e.g. <tt>$ENV{PROGRAMFILES}</tt>)<br />
<br />
; DESTDIR : If this environment variable is set it will be prefixed to CMAKE_INSTALL_PREFIX in places where it is used to access files during installation. This allows the files to be installed in an intermediate directory tree without changing the final installation path name. Since the value of CMAKE_INSTALL_PREFIX may be included in installed files it is important to use DESTDIR rather than changing CMAKE_INSTALL_PREFIX when it is necessary to install to a intermediate staging directory.<br />
<br />
== System & Compiler Information ==<br />
; CMAKE_MAJOR_VERSION : major version number for CMake, e.g. the "2" in CMake 2.4.3<br />
; CMAKE_MINOR_VERSION : minor version number for CMake, e.g. the "4" in CMake 2.4.3<br />
; CMAKE_PATCH_VERSION : patch version number for CMake, e.g. the "3" in CMake 2.4.3<br />
; CMAKE_TWEAK_VERSION : tweak version number for CMake, e.g. the "1" in CMake X.X.X.1. Releases use tweak < 20000000 and development versions use the date format CCYYMMDD for the tweak level.<br />
; CMAKE_VERSION : The version number combined, eg. 2.8.4.20110222-ged5ba for a Nightly build. or 2.8.4 for a Release build.<br />
; CMAKE_GENERATOR : the generator specified on the commandline.<br />
; BORLAND : is TRUE on Windows when using a Borland compiler<br />
; WATCOM : is TRUE on Windows when using the Open Watcom compiler<br />
; MSVC, MSVC_IDE, MSVC60, MSVC70, MSVC71, MSVC80, CMAKE_COMPILER_2005, MSVC90, MSVC10 (Visual Studio 2010) : Microsoft compiler<br />
; CMAKE_C_COMPILER_ID : one of "Clang", "GNU", "Intel", or "MSVC". This works even if a compiler wrapper like ccache is used.<br />
; CMAKE_CXX_COMPILER_ID : one of "Clang", "GNU", "Intel", or "MSVC". This works even if a compiler wrapper like ccache is used.<br />
<br />
See the [[CMake_Checking_Platform|Checking the Current Platform]] page for a list of the variables pertaining to platform checks.<br />
<br />
== Various Options ==<br />
; CMAKE_SKIP_RULE_DEPENDENCY : set this to true if you don't want to rebuild the object files if the rules have changed, but not the actual source files or headers (e.g. if you changed the some compiler switches)<br />
; CMAKE_SKIP_INSTALL_ALL_DEPENDENCY : since CMake 2.1 the install rule depends on all, i.e. everything will be built before installing. If you don't like this, set this one to true.<br />
; CMAKE_INCLUDE_CURRENT_DIR : automatically add CMAKE_CURRENT_SOURCE_DIR and CMAKE_CURRENT_BINARY_DIR to the include directories in every processed CMakeLists.txt. It behaves as if you had used INCLUDE_DIRECTORIES in every CMakeLists.txt file or your project. The added directory paths are relative to the being-processed CMakeLists.txt, which is different in each directory. (See [http://www.cmake.org/pipermail/cmake/2007-March/013193.html this thread] for more details).<br />
; CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE : order the include directories so that directories which are in the source or build tree always come before directories outside the project.<br />
; CMAKE_VERBOSE_MAKEFILE : set this to true if you are using makefiles and want to see the full compile and link commands instead of only the shortened ones<br />
; CMAKE_SUPPRESS_REGENERATION : this will cause CMake to not put in the rules that re-run CMake. This might be useful if you want to use the generated build files on another machine.<br />
; CMAKE_COLOR_MAKEFILE : create Makefiles with colored output (defaults to on)<br />
; CMAKE_SKIP_PREPROCESSED_SOURCE_RULES : (since 2.4.4) if set to TRUE, the generated Makefiles will not contain rules for creating preprocessed files (foo.i)<br />
; CMAKE_SKIP_ASSEMBLY_SOURCE_RULES : (since 2.4.4) if set to TRUE, the generated Makefiles will not contain rules for creating compiled, but not yet assembled files (foo.s)<br />
<br />
== Compilers and Tools ==<br />
<br />
; BUILD_SHARED_LIBS : if this is set to ON, then all libraries are built as shared libraries by default.<br> <tt>SET(BUILD_SHARED_LIBS ON)</tt><br />
<br />
; CMAKE_BUILD_TYPE : A variable which controls the type of build when using a ''single-configuration generator'' like the Makefile generator. It is case-insensitive. <br />
<br />
CMake will create by default the following variables when using a single-configuration generator:<br />
<br />
*None (CMAKE_C_FLAGS or CMAKE_CXX_FLAGS used) <br />
*Debug (CMAKE_C_FLAGS_DEBUG or CMAKE_CXX_FLAGS_DEBUG) <br />
*Release (CMAKE_C_FLAGS_RELEASE or CMAKE_CXX_FLAGS_RELEASE)<br />
*RelWithDebInfo (CMAKE_C_FLAGS_RELWITHDEBINFO or CMAKE_CXX_FLAGS_RELWITHDEBINFO<br />
*MinSizeRel (CMAKE_C_FLAGS_MINSIZEREL or CMAKE_CXX_FLAGS_MINSIZEREL)<br />
<br />
You can use these default compilation flags (or modify them) by setting the CMAKE_BUILD_TYPE variable at configuration time on the command line, or from within the "ccmake" GUI. '''Note!''' The default values for these flags change with different compilers. If CMake does not know your compiler, the contents will be empty.<br />
<br />
If you are using the Makefile generator, you can create your own build type like this:<br><br />
<tt>SET(CMAKE_BUILD_TYPE distribution)<br><br />
SET(CMAKE_CXX_FLAGS_DISTRIBUTION "-O3")<br><br />
SET(CMAKE_C_FLAGS_DISTRIBUTION "-O3")</tt><br />
<br />
Note that CMAKE_BUILD_TYPE is not initialized with a readable value at configuration time. This is because the user is free to select a build type at build time. Use CMAKE_CFG_INTDIR if you need a variable that evaluates to the correct build time directory.<br />
<br />
; CMAKE_CONFIGURATION_TYPES : When using a ''multi-configuration generator'', such as the one for '''Visual Studio''', this variable contains a list of the available configurations.<br />
; CMAKE_C_COMPILER : the compiler used for C files. Normally it is detected and set during the CMake run, but you can override it at configuration time. '''Note!''' It can not be changed after the first cmake or ccmake run. Although the gui allows to enter an alternative, it will be ignored in the next 'configure' run. Use for example: <br><tt>CC=gcc-3.3 CXX=g++-3.3 cmake</tt><br> to set the compiler. (You can also set CMAKE_C_COMPILER_INIT, before any PROJECT() or ENABLE_LANGUAGE() command.) Any other way (like writing <tt>make CC=gcc-3.3 CXX=g++-3.3</tt>) will not work. When using distcc or similar tools, you need to write: <br><tt>CC="distcc gcc-3.3" CXX="distcc g++-3.3" cmake</tt><br> However, this will empty all your CMAKE_..._FLAGS_... above.<br><br />
<br />
; CMAKE_C_FLAGS : the compiler flags for compiling C sources. Note you can also specify switches with ADD_COMPILE_OPTIONS().<br />
; CMAKE_C_FLAGS_<CONFIG> : compiler flags for a specific build configuration. Replace "<CONFIG>" in the name with a specific build configuration name.<br />
; CMAKE_C_OUTPUT_EXTENSION : what C object files end in. Typically .o or .obj.<br />
<br />
; CMAKE_CFG_INTDIR : meta-variable! Please note that this is an '''important''' variable, since on multi-configuration generators it will be generated into '''dynamically switched''' content based on the configuration that the user currently selected within the generated build environment. Indicates the name of the current configuration (~ directory) for the project. May be used for any purpose which needs per-configuration-dynamic switching of strings, not just OutputDir configuration. For multi-configuration generators (e.g. MSVC) the resulting strings are typically some of "Debug", "Release", "RelWithDebInfo", or "MinSizeRel". For other compiler generators (single-configuration ones) it is typically ".", as they don't use MSVC-style configuration directories.<br />
<br />
; CMAKE_CXX_COMPILER : the compiler used for C++ files. Normally it is detected and set during the CMake run, but you can override it at configuration time. '''Note!''' It can not be changed after the first cmake or ccmake run. See CMAKE_C_COMPILER above.<br />
; CMAKE_CXX_FLAGS : the compiler flags for compiling C++ sources. Note you can also specify switches with ADD_COMPILE_OPTIONS(). <br />
; CMAKE_CXX_FLAGS_<CONFIG> : compiler flags for a specific configuration for C++ sources. Replace "<CONFIG>" in the name with a specific build configuration name.<br />
<br />
; CMAKE_SHARED_LINKER_FLAGS : additional compiler flags for building shared libraries, e.g.: <br><br />
<tt>set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined")</tt><br><br />
On Unix systems, this will make linker report any unresolved symbols from object files (which is quite typical when you compile many targets in CMake projects, but do not bother with linking target dependencies in proper order). On mac, the flag is <code>-Wl,-undefined-error</code>.<br />
<br />
== Prefixes, Suffixes (Postfixes), and Extensions ==<br />
; CMAKE_EXECUTABLE_SUFFIX : Suffix of executables on the target platform.<br />
; CMAKE_FIND_LIBRARY_PREFIXES : List of possible library prefixes used by find_library(). "lib" on UNIX systems.<br />
; CMAKE_FIND_LIBRARY_SUFFIXES : List of possible library suffixes used by find_library(). ".a;.so" on UNIX systems. Note that it's possible to use this to control whether find_package() modules find shared or static libraries.<br />
; CMAKE_<SHARED|STATIC>_LIBRARY_PREFIX : Prefix for shared or static libraries on this platform. Read-only.<br />
; CMAKE_<SHARED|STATIC>_LIBRARY_SUFFIX : Suffix for shared or static libraries on this platform. Read-only.<br />
; CMAKE_<config>_POSTFIX : Adds a custom "postfix" to static and shared libraries when in a certain build type. Example: Setting '''CMAKE_BUILD_TYPE=DEBUG''' and '''CMAKE_DEBUG_POSTFIX="_d"''' would turn mylib.lib into mylib_d.lib.<br />
<br />
== Variables not listed here ==<br />
CMake has many more variables than are listed above. Documenting all of them is an ongoing project. We need everyone's help with this. If you know of a CMake variable that is not listed here, please edit the wiki and add it. Don't worry about whether you have a precise description for it. This is a wiki, and other people can provide a better description as time goes on.<br />
<br />
How does one find out about additional variables? The CMake mailing list is probably the best resource. Some things can be learned from inspecting the CMake source code. Many - but not all of them - are also listed by this [[CMake_Useful_Variables/Get_Variables_From_CMake_Dashboards|Dashboard script for extracting variables]]. The output of this script is rather raw, but it is a good starting point for finding more variables.<br />
<br />
When a CMake dashboard is run, a "SystemInformation test" is usually run as well. Among other things, it lists the names and values of all of the CMake variables that are in use when the test is run. The script looks at the SystemInformation test output, and uses regular expressions to find the start and end of the "AllVariables.txt" section. It prints the results out in the form of XML.<br />
<br />
== Logging code ==<br />
This code may be placed in a CMakelists.txt file to create status messages<br />
that log a number of the variables documented above. It is not a complete list, however. The variables are not auto-generated from the wiki, it is just sample code. Add whatever variables you are interested in.<br />
#[[CMake_Useful_Variables/Logging_Useful_Variables | Sample code for logging useful variables.]]<br />
<br />
<br />
{{CMake/Template/Footer}}</div>Clement.gregoirehttps://public.kitware.com/Wiki/index.php?title=Template:CMake/Template/Header&diff=62165Template:CMake/Template/Header2018-01-13T10:00:36Z<p>Clement.gregoire: </p>
<hr />
<div><br />
<p style="color:red; font-size:125%;"><br />
<br />
You are now on the CMake wiki. <br/><br />
<br />
Many pages are now <b>DEPRECATED</b> and sometimes even considered bad practice. Those are only kept as reference for previous CMake versions.<br/><br />
<br />
The documentations for the latest versions are available here : [https://cmake.org/documentation/ CMake Documentation].<br/><br />
<br />
</p><br />
<br />
----</div>Clement.gregoirehttps://public.kitware.com/Wiki/index.php?title=CMake:Template/Header&diff=62164CMake:Template/Header2018-01-13T09:59:42Z<p>Clement.gregoire: Clement.gregoire moved page CMake:Template/Header to Template:CMake/Template/Header</p>
<hr />
<div>#REDIRECT [[Template:CMake/Template/Header]]</div>Clement.gregoirehttps://public.kitware.com/Wiki/index.php?title=Template:CMake/Template/Header&diff=62163Template:CMake/Template/Header2018-01-13T09:59:42Z<p>Clement.gregoire: Clement.gregoire moved page CMake:Template/Header to Template:CMake/Template/Header</p>
<hr />
<div><br />
<p style="color:red; font-size:125%;"><br />
<br />
You are now on the CMake wiki. <br/><br />
<br />
Many pages are now <b>DEPRECATED</b> and sometimes even considered bad practice. Those are only kept as reference for previous CMake versions.<br/><br />
<br />
The documentations for the latest versions are available here : [https://cmake.org/documentation/ CMake Documentation].<br/><br />
<br />
</p></div>Clement.gregoirehttps://public.kitware.com/Wiki/index.php?title=Template:CMake/Template/Header&diff=62162Template:CMake/Template/Header2018-01-13T09:57:34Z<p>Clement.gregoire: Created page with " <p style="color:red; font-size:125%;"> You are now on the CMake wiki. <br/> Many pages are now <b>DEPRECATED</b> and sometimes even considered bad practice. Those are only..."</p>
<hr />
<div><br />
<p style="color:red; font-size:125%;"><br />
<br />
You are now on the CMake wiki. <br/><br />
<br />
Many pages are now <b>DEPRECATED</b> and sometimes even considered bad practice. Those are only kept as reference for previous CMake versions.<br/><br />
<br />
The documentations for the latest versions are available here : [https://cmake.org/documentation/ CMake Documentation].<br/><br />
<br />
</p></div>Clement.gregoirehttps://public.kitware.com/Wiki/index.php?title=CMake&diff=62161CMake2018-01-13T09:32:27Z<p>Clement.gregoire: Update links to use the latest doc, (re)move the most obviously deprecated links</p>
<hr />
<div>https://cmake.org/cmake/img/CMake-logo-download.jpg<br />
<br />
<!-- documentation manual man information help tutorial --><br />
Welcome to CMake, the cross-platform, open-source make system. CMake is used to control the software compilation process using simple platform and compiler independent configuration files. CMake generates native makefiles and workspaces that can be used in the compiler environment of your choice. CMake is quite sophisticated: it is possible to support complex environments requiring system configuration, pre-processor generation, code generation, and template instantiation.<br />
<br />
You will find here not only documentation for CMake, but also for CPack and CTest.<br />
<br />
=CMake=<br />
<br />
==Primary Resources - Look here first! ==<br />
* Where can I [https://cmake.org/HTML/Download.html download CMake]?<br />
* [https://cmake.org/documentation/ CMake Documentation]<br />
* [https://cmake.org/cmake/help/latest/manual/cmake-variables.7.html CMake Variables]<br />
* [https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html Structure of a CMake Build System]<br />
* [[CMake FAQ| FAQ (Frequently asked questions)]]<br />
* [https://cmake.org/mailman/listinfo/cmake CMake Mailing List] (for searchable archives see [[CMake_FAQ#Where_can_I_find_searchable_CMake_Mailing_Archives | CMake FAQ ]])<br />
* [[https://cmake.org/cmake/help/latest/release/index.html|CMake Release Notes]]<br />
<br />
==Reference Material==<br />
* [https://cmake.org/cmake/help/latest/manual/cmake-variables.7.html CMake Variables]<br />
* [https://cmake.org/cmake/help/latest/manual/cmake-properties.7.html?highlight=properties List of CMake Properties] <br />
====The CMake Language====<br />
* [https://cmake.org/cmake/help/latest/manual/cmake-language.7.html#syntax A quick introduction to CMake syntax]<br />
* [[CMake:VariablesListsStrings| On variables, lists, strings, maps, regexps, etc.]]<br />
* [[CMake/Language Syntax | Language syntax]]<br />
<br />
==Guides==<br />
====General====<br />
* [[CMake Cross Compiling| Cross compiling]]<br />
* [[CMake HowToDoPlatformChecks| How to write platform checks with CMake]]<br />
* [[CMake:How_To_Find_Libraries | How to find libraries]]<br />
* [[CMake:Install Commands| How to install things]]<br />
<br />
====Specific====<br />
* [[CMake RPATH handling|RPATH handling]]<br />
* [[CMake Editors Support|Editors/IDEs with CMake syntax support]]<br />
* [[BuildingWinDLL| How to export symbols from a Windows DLL for the non-Windows Developer]]<br />
* [[RecipeAddSoVersionToDLLs|Appending the SO version to DLLs]]<br />
* [[CMake_Build_Rules | Advanced Usage of CMake Build Rules]]<br />
* [[CMake_Checking_Platform | How to Check the Current Platform]]<br />
<br />
==Development Topics==<br />
* [[CMake/Assembler|Assembler Support]]<br />
* [[CMake Generator Specific Information|Docs for Specific Project Generators]] (Eclipse, KDevelop3, CodeBlocks, Makefile)<br />
* [[CMake User Contributed Macros| Contributed macros]]<br />
* [[CMake:Module Maintainers|Module Maintainers]]<br />
* [[CMake Platform Dependent Issues|Platform Dependent Information]]<br />
* [[CMake/ChangeLog|Current CMake Version ChangeLog]]<br />
* [[CMake Released Versions|Documentation for previous releases]]<br />
* [[CMake Life Cycle Considerations]]<br />
* [[CMake Version Compatibility Matrix|Matrix for checking backwards-compatibility of current features]]<br />
* [[CMake builtin documentation handling]]<br />
* [http://www.aosabook.org/en/cmake.html The architecture of Open Source Applications - CMake]<br />
<br />
==Tutorials==<br />
<br />
===Basic Introductions===<br />
* [https://cmake.org/HTML/Examples.html A Simple CMake Example]<br />
* [http://www.linuxjournal.com/article/6700 Cross-Platform Software Development Using CMake]<br />
* [http://clubjuggler.livejournal.com/138364.html CMake: The Cross Platform Build System]<br />
* [http://www.elpauer.org/stuff/learning_cmake.pdf "Learning CMake"] - Slides of a CMake workshop, including CPack, CTest and CDash<br />
* [https://github.com/TheErk/CMake-tutorial CMake tutorial] - Slides (with LaTeX bearmer source) of a CMake tutorial including CPack, CTest.<br />
* [http://www.visgraf.impa.br/seminar/slides/rodlima_cmake_presentation.pdf "CMake: Behind the Scenes of Code Development"] - Slides of an introductory talk/tutorial about CMake and its benefits<br />
* [http://hackerwithin.org/thw/plugin_wiki/page/buildsystems The Hacker Within: Build Systems] Explains why and how to use build systems with a CMake example.<br />
<br />
* How CMake simplifies the build process by Bruno Abinader<br />
** [https://brunoabinader.com/how-cmake-simplifies-the-build-process-part-1-basic-build-system Part 1 - Basic build system]<br />
** [http://web.archive.org/web/20101030232202/http://cabledogs.org/abinader/2009/12/09/how-cmake-simplifies-the-build-process-part-2-advanced-build-system/ Part 2 - Advanced build system]<br />
* [http://rachid.koucha.free.fr/tech_corner/cmake_manual.html Empirical approach to CMAKE] by Rachid Koucha<br />
* [[CMake/MinimalExamples | Minimal examples]] (wiki page)<br />
<br />
===Finding stuff and platform checking===<br />
<br />
* [[CMake/Tutorials#CMake_Packages|How to package your project for use by others]], create FooConfig.cmake files, and exporting and importing targets.<br />
<br />
* [[CMake:HowToUseExistingOSXFrameworks | How to find and use existing frameworks on OS X]]<br> A quick example to help OS X users find frameworks automatically.<br />
<br />
===How to use CMake with specific Libraries ===<br />
<br />
* [[CMake:How To Build Qt4 Software | How to build Qt4 software with CMake]]<br />
<br />
* [http://qtnode.net/wiki?title=Qt_with_cmake Qt with CMake] <br>Explains how to use CMake to build software with Qt4, Qt3 and KDE3.<br />
<br />
* [http://mikemcquaid.com/2012/01/deploying-qt-applications-with-deployqt4/ Deploying Qt4 applications with CMake] <br>Explains how to use the DeployQt4.cmake module coming with CMake 2.8.7.<br />
<br />
* [[CMake:How To Build KDE4 Software | How to build KDE4 software with CMake]]<br />
<br />
* [[CMake:MatlabMex | How to use CMake to create Matlab MEX files]] <br> Describes how to use CMake when developing Matlab Executable (MEX) files for use with The Mathworks Matlab scripting language.<br />
<br />
* [http://www.wxwidgets.org/wiki/index.php/CMake How to use CMake for building software with wxWidgets ]<br />
<br />
* [http://www.linuxdevices.com/articles/AT6762290643.html Building eCos applications with CMake]<br />
<br />
* [http://www.smslana.eu Building Sms applications with CMake]<br />
<br />
* [http://blog.quickforge.co.uk/2011/10/exploration-of-cross-compiling-on-windows-for-arm-linux-distributions/ Cross compiling from Windows to ARM Linux]<br />
<br />
* [[CMakeForFLTK| Using CMake to build an FLTK application]]<br />
<br />
===Recipes===<br />
<br />
* [[CMake:How To Process Lots Of Input Files | How to process lots of input files with a processor built by CMake]]<br />
<br />
<br />
* [[VSConfigSpecificSettings| Configuration Specific Settings for Visual Studio Generated Project Files]]<br />
<br />
* [[BundleUtilitiesExample| How to use the 'BundleUtilities' to deploy your OS X Application. Example uses Qt 4.]]<br />
<br />
* [[CMakeForFortranExample|How to write a simple CMakeLists.txt for Fortran code]]<br />
<br />
* [[CMakeEmulateMakeCheck|How to emulate GNU Autotools 'make check']]<br />
<br />
* [[CustomCommandCustomTargetInstall|A toy model for add_custom_command and add_custom_target]]<br />
<br />
* [[CMake:OSX_InterfaceBuilderFiles|Working with OS X Interface Builder Files]]<br />
<br />
* [[RecipeAppendVersionNumberToInstallpath|Append the Version Number to the Install path]]<br />
<br />
* [[RecipeInstallToALocalFolderForTesting|Install to a local folder in the build dir for testing]]<br />
<br />
* [[RecipeAddUninstallTarget|Adding an uninstall target to your project]]<br />
<br />
<br />
==Converters from other buildsystems to CMake==<br />
<br />
All converters listed here are not "complete", i.e. the generated CMake files are not 100% finished, in all cases some work is left for the developer.<br />
<br />
====automake/autotools/autoconf====<br />
* [https://projects.kde.org/projects/kde/kdesdk/kde-dev-scripts/repository/revisions/master/changes/cmake-utils/scripts/am2cmake am2cmake (requires Ruby) ] Converts automake/autotools/libtool based projects to CMake, specialized in converting from KDE 3 to KDE 4, should also work for others. This one has been used for converting the KDE buildsystem to CMake.<br />
<br />
* [http://emanuelgreisen.dk/stuff/kdevelop_am2cmake.php.tgz Alternative Automake2CMake (requires PHP)] Converts KDevelop projects that use automake to CMake.<br />
<br />
* [[GccXmlAutoConfHints|Converting autoconf tests]]<br />
<br />
====qmake====<br />
* [[CMake:ConvertFromQmake | qmake converter (requires Ruby)]] Converts projects that use Qt's qmake.<br />
<br />
====Visual Studio====<br />
* [http://vcproj2cmake.sf.net vcproj2cmake.rb (requires Ruby) SourceForge project] Creates '''and maintains''' CMakeLists.txt files by extracting info from Visual Studio project files (.vcproj/.vcxproj). Elaborate script for development side-by-side the updated original static .vc[x]proj files, supports script hooks and powerful definition mappings. Patches and new project members very welcome. Older script versions below:<br />
** [http://www.eskilson.se/vcproj2cmake.rb Original vcproj2cmake.rb version (requires Ruby)] <br />
** Slightly newer version here [http://dgwarp.hd.free.fr/vcproj2cmake.rb vcproj2cmake.rb], see:[[User_talk:Dweeves]] for details<br />
* [http://nberserk.blogspot.com/2010/11/converting-vc-projectsvcproj-to.html vcproj2cmake.ps1(PowerShell version)] Creates CMakeLists.txt. it supports vcproj configuration and detect 'exclude from build' option<br />
* [http://sourceforge.net/projects/folders4cmake/ folders4cmake (requires Java)] Use Visual Studio project files to generate corresponding "source_group" information that you can use inside your own CMake scripts. Supports Visual Studio 9/10 project files (full round-trip possible).<br />
<br />
====Basic CMakeLists.txt from-scratch-generator====<br />
* [http://websvn.kde.org/trunk/KDE/kdesdk/cmake/scripts/ gencmake (requires Ruby) ] Creates basic CMakeLists.txt files from looking at the existing files.<br />
* [http://www.vanvelzensoftware.com/postnuke/index.php?name=Downloads&req=viewdownload&cid=7 CMakeListGenerator (Win32) ] Creates complete CMakeLists.txt files as described in the [https://gucef.svn.sourceforge.net/svnroot/gucef/trunk/tools/CMakeListGenerator/docs/README.txt README ] using a combination of file and directory structure analysis. Supports resolving dependencies between multiple archives.<br />
<br />
==Success Stories==<br />
<br />
* What are some [[CMake Projects|projects using CMake]]?<br />
* [[CMake:Articles|Articles about CMake]]<br />
* [[Really Cool CMake Features]]<br />
<br />
<br />
==More Topics==<br />
<br />
* [[CMake Fortran Issues|Fortran Issues]]<br />
* [[CMake:For CMake Hackers|Generating dependency graphs with CMake]]<br />
* [[CMake:Experiments With Lua|Experiments With Lua]]<br />
* [[CMake Performance Tips|Performance Tips]]<br />
* [[CMake:GNU style example | GNU style directory layout with CMake]]<br />
* [[CMake:OpenTasks| CMake TODO]]<br />
* [[CMake:CreateQtAssistantDocs| Creating Qt Assistant Docs]]<br />
* [[CMake:Static libraries| Writing FindXXX.cmake modules that work with static libraries]]<br />
* [[CMake:Multiple versions| Writing FindXXX.cmake modules that work when multiple versions of packages are installed]]<br />
* [[CMake:Improving Find* Modules ]]<br />
* [[/C Plugins for Loadable Commands/]]<br>For anyone who wonders what the <tt>load_command</tt> command is for.<br />
* [[PC-Lint]] support for CMake<br />
<br />
=CTest=<br />
<br />
===Tutorials===<br />
* [[CMake Testing With CTest|Testing With CTest]]<br>Introduces to testing with CTest, submitting dashboards, and using CMake to add tests to the test system.<br />
<br />
* [[CMake Scripting Of CTest|CTest Scripting]]<br>Describes the scripting with CTest which can significantly simplify and automate testing and submitting dashboards.<br />
<br />
* [[CMake Generating Testing Files|Generating Input Files For CTest]]<br>Describe more in details the concepts behind testing with CTest and also explans how to use CTest without using CMake.<br />
<br />
* [[CTest:Buildserver|Buildmanagement With CTest]]<br>Describes how to setup a central configuration for all CTest scripts.<br />
<br />
===More Information===<br />
* [[CTest:Submission Issues|Configuring CTest Submission Methods]]<br />
* [[CTest:Nightly, Experimental, Continuous|CTest Nightly, Experimental, Continuous, ...]]<br />
* [[CTest:Coverage]]<br />
* [[Media:CTest Running Modes.pdf]]<br />
* [[CTest:FAQ|CTest Frequently asked questions]]<br />
<br />
===More Topics===<br />
* [[CTest:OpenTasks| CTest TODO]]<br />
* [[CTest:TestWithoutBuild| Run tests on machines without building first]]<br />
<br />
=CDash=<br />
* [http://public.kitware.com/Wiki/CDash CDash Wiki].<br />
* [http://public.kitware.com/Wiki/CDash:FAQ CDash FAQ].<br />
<br />
<br />
=CPack=<br />
===Tutorials===<br />
* [[CMake:Packaging With CPack|Packaging with CPack]]<br>Introduction to CPack, installing and packaging of software.<br />
* [https://github.com/TheErk/CMake-tutorial CMake tutorial] - Slides from a CMake tutorial (including LaTeX beamer source) including CPack.<br />
* [[CMake:CPackConfiguration|CPack Variables]]<br><br />
* [[CMake:CPackPackageGenerators|Supported package formats]]<br><br />
* [[CMake:CPackWin32NewbiesChecklist|CPack Win32 Newbie Checklist]] <br><br />
* [[CMake:Component_Install_With_CPack|Component Install With CPack]] <br><br />
<br />
===Recipes===<br />
<br />
* [[RecipeAddShortcutToStartMenu|Add an application shortcut to the Start Menu]]<br />
<br />
<br />
=Old(deprecated) kept for reference only=<br />
<br />
* [[CMake_2.6_Notes|CMake 2.6 Notes]]<br />
* [[CMake Useful Variables|Useful CMake Variables]]<br />
<br />
{{CMake/Template/Footer}}</div>Clement.gregoire