Imported Upstream version 3.2.2

ci/unstable
Mario Lang 10 years ago
parent 7434651728
commit 75c6a19f8d

2
.gitattributes vendored

@ -12,6 +12,8 @@ configure crlf=input
*.dsp -crlf *.dsp -crlf
*.dsptemplate -crlf *.dsptemplate -crlf
*.dsw -crlf *.dsw -crlf
*.pfx -crlf
*.png -crlf
*.sln -crlf *.sln -crlf
*.vcproj -crlf *.vcproj -crlf

@ -19,8 +19,12 @@ _ctest()
_filedir _filedir
return return
;; ;;
-L|--label-regex|-LE|--label-exclude|--track|-I|--tests-information|\ -L|--label-regex|-LE|--label-exclude)
--max-width|--timeout|--stop-time) COMPREPLY=( $( compgen -W '$( ctest --print-labels 2>/dev/null |
grep "^ " 2>/dev/null | cut -d" " -f 3 )' -- "$cur" ) )
return
;;
--track|-I|--tests-information|--max-width|--timeout|--stop-time)
# argument required but no completions available # argument required but no completions available
return return
;; ;;

@ -16,7 +16,7 @@
" Version: $Revision$ " Version: $Revision$
" "
" Licence: The CMake license applies to this file. See " Licence: The CMake license applies to this file. See
" http://www.cmake.org/HTML/Copyright.html " http://www.cmake.org/licensing
" This implies that distribution with Vim is allowed " This implies that distribution with Vim is allowed
if exists("b:did_indent") if exists("b:did_indent")

@ -202,7 +202,7 @@ the indentation. Otherwise it retains the same position on the line"
;; Keyword highlighting regex-to-face map. ;; Keyword highlighting regex-to-face map.
;; ;;
(defconst cmake-font-lock-keywords (defconst cmake-font-lock-keywords
(list '("^[ \t]*\\(\\w+\\)[ \t]*(" 1 font-lock-function-name-face)) (list '("^[ \t]*\\([[:word:]_]+\\)[ \t]*(" 1 font-lock-function-name-face))
"Highlighting expressions for CMAKE mode." "Highlighting expressions for CMAKE mode."
) )
@ -241,7 +241,6 @@ the indentation. Otherwise it retains the same position on the line"
; Create the syntax table ; Create the syntax table
(setq cmake-mode-syntax-table (make-syntax-table)) (setq cmake-mode-syntax-table (make-syntax-table))
(set-syntax-table cmake-mode-syntax-table) (set-syntax-table cmake-mode-syntax-table)
(modify-syntax-entry ?_ "w" cmake-mode-syntax-table)
(modify-syntax-entry ?\( "()" cmake-mode-syntax-table) (modify-syntax-entry ?\( "()" cmake-mode-syntax-table)
(modify-syntax-entry ?\) ")(" cmake-mode-syntax-table) (modify-syntax-entry ?\) ")(" cmake-mode-syntax-table)
(modify-syntax-entry ?# "<" cmake-mode-syntax-table) (modify-syntax-entry ?# "<" cmake-mode-syntax-table)
@ -322,8 +321,13 @@ and store the result as a list in LISTVAR."
) )
(require 'thingatpt) (require 'thingatpt)
(defun cmake-symbol-at-point ()
(let ((symbol (symbol-at-point)))
(and (not (null symbol))
(symbol-name symbol))))
(defun cmake-help-type (type) (defun cmake-help-type (type)
(let* ((default-entry (word-at-point)) (let* ((default-entry (cmake-symbol-at-point))
(history (car (cdr (cdr (assoc type cmake-string-to-list-symbol))))) (history (car (cdr (cdr (assoc type cmake-string-to-list-symbol)))))
(input (completing-read (input (completing-read
(format "CMake %s: " type) ; prompt (format "CMake %s: " type) ; prompt
@ -366,7 +370,7 @@ and store the result as a list in LISTVAR."
(defun cmake-help () (defun cmake-help ()
"Queries for any of the four available help topics and prints out the approriate page." "Queries for any of the four available help topics and prints out the approriate page."
(interactive) (interactive)
(let* ((default-entry (word-at-point)) (let* ((default-entry (cmake-symbol-at-point))
(command-list (cmake-get-list "command")) (command-list (cmake-get-list "command"))
(variable-list (cmake-get-list "variable")) (variable-list (cmake-get-list "variable"))
(module-list (cmake-get-list "module")) (module-list (cmake-get-list "module"))

@ -16,7 +16,7 @@
" Version: $Revision$ " Version: $Revision$
" "
" Licence: The CMake license applies to this file. See " Licence: The CMake license applies to this file. See
" http://www.cmake.org/HTML/Copyright.html " http://www.cmake.org/licensing
" This implies that distribution with Vim is allowed " This implies that distribution with Vim is allowed
" For version 5.x: Clear all syntax items " For version 5.x: Clear all syntax items
@ -48,9 +48,9 @@ syn keyword cmakeOperators
syn keyword cmakeDeprecated ABSTRACT_FILES BUILD_NAME SOURCE_FILES SOURCE_FILES_REMOVE VTK_MAKE_INSTANTIATOR VTK_WRAP_JAVA VTK_WRAP_PYTHON VTK_WRAP_TCL WRAP_EXCLUDE_FILES syn keyword cmakeDeprecated ABSTRACT_FILES BUILD_NAME SOURCE_FILES SOURCE_FILES_REMOVE VTK_MAKE_INSTANTIATOR VTK_WRAP_JAVA VTK_WRAP_PYTHON VTK_WRAP_TCL WRAP_EXCLUDE_FILES
\ nextgroup=cmakeArguments \ nextgroup=cmakeArguments
" The keywords are generated as: cmake --help-command-list | tr "\n" " " " The keywords are generated as: cmake --help-command-list | tr "\n" " " | tr "[:lower:]" "[:upper:]"
syn keyword cmakeStatement syn keyword cmakeStatement
\ ADD_CUSTOM_COMMAND ADD_CUSTOM_TARGET ADD_DEFINITIONS ADD_DEPENDENCIES ADD_EXECUTABLE ADD_LIBRARY ADD_SUBDIRECTORY ADD_TEST AUX_SOURCE_DIRECTORY BUILD_COMMAND BUILD_NAME CMAKE_MINIMUM_REQUIRED CONFIGURE_FILE CREATE_TEST_SOURCELIST ELSE ELSEIF ENABLE_LANGUAGE ENABLE_TESTING ENDFOREACH ENDFUNCTION ENDIF ENDMACRO ENDWHILE EXEC_PROGRAM EXECUTE_PROCESS EXPORT_LIBRARY_DEPENDENCIES FILE FIND_FILE FIND_LIBRARY FIND_PACKAGE FIND_PATH FIND_PROGRAM FLTK_WRAP_UI FOREACH FUNCTION GET_CMAKE_PROPERTY GET_DIRECTORY_PROPERTY GET_FILENAME_COMPONENT GET_SOURCE_FILE_PROPERTY GET_TARGET_PROPERTY GET_TEST_PROPERTY IF INCLUDE INCLUDE_DIRECTORIES INCLUDE_EXTERNAL_MSPROJECT INCLUDE_REGULAR_EXPRESSION INSTALL INSTALL_FILES INSTALL_PROGRAMS INSTALL_TARGETS LINK_DIRECTORIES LINK_LIBRARIES LIST LOAD_CACHE LOAD_COMMAND MACRO MAKE_DIRECTORY MARK_AS_ADVANCED MATH MESSAGE OPTION OUTPUT_REQUIRED_FILES PROJECT QT_WRAP_CPP QT_WRAP_UI REMOVE REMOVE_DEFINITIONS SEPARATE_ARGUMENTS SET SET_DIRECTORY_PROPERTIES SET_SOURCE_FILES_PROPERTIES SET_TARGET_PROPERTIES SET_TESTS_PROPERTIES SITE_NAME SOURCE_GROUP STRING SUBDIR_DEPENDS SUBDIRS TARGET_LINK_LIBRARIES TRY_COMPILE TRY_RUN UNSET USE_MANGLED_MESA UTILITY_SOURCE VARIABLE_REQUIRES VTK_MAKE_INSTANTIATOR VTK_WRAP_JAVA VTK_WRAP_PYTHON VTK_WRAP_TCL WHILE WRITE_FILE \ ADD_COMPILE_OPTIONS ADD_CUSTOM_COMMAND ADD_CUSTOM_TARGET ADD_DEFINITIONS ADD_DEPENDENCIES ADD_EXECUTABLE ADD_LIBRARY ADD_SUBDIRECTORY ADD_TEST AUX_SOURCE_DIRECTORY BREAK BUILD_COMMAND BUILD_NAME CMAKE_HOST_SYSTEM_INFORMATION CMAKE_MINIMUM_REQUIRED CMAKE_POLICY CONFIGURE_FILE CREATE_TEST_SOURCELIST CTEST_BUILD CTEST_CONFIGURE CTEST_COVERAGE CTEST_EMPTY_BINARY_DIRECTORY CTEST_MEMCHECK CTEST_READ_CUSTOM_FILES CTEST_RUN_SCRIPT CTEST_SLEEP CTEST_START CTEST_SUBMIT CTEST_TEST CTEST_UPDATE CTEST_UPLOAD DEFINE_PROPERTY ELSE ELSEIF ENABLE_LANGUAGE ENABLE_TESTING ENDFOREACH ENDFUNCTION ENDIF ENDMACRO ENDWHILE EXEC_PROGRAM EXECUTE_PROCESS EXPORT EXPORT_LIBRARY_DEPENDENCIES FILE FIND_FILE FIND_LIBRARY FIND_PACKAGE FIND_PATH FIND_PROGRAM FLTK_WRAP_UI FOREACH FUNCTION GET_CMAKE_PROPERTY GET_DIRECTORY_PROPERTY GET_FILENAME_COMPONENT GET_PROPERTY GET_SOURCE_FILE_PROPERTY GET_TARGET_PROPERTY GET_TEST_PROPERTY IF INCLUDE INCLUDE_DIRECTORIES INCLUDE_EXTERNAL_MSPROJECT INCLUDE_REGULAR_EXPRESSION INSTALL INSTALL_FILES INSTALL_PROGRAMS INSTALL_TARGETS LINK_DIRECTORIES LINK_LIBRARIES LIST LOAD_CACHE LOAD_COMMAND MACRO MAKE_DIRECTORY MARK_AS_ADVANCED MATH MESSAGE OPTION OUTPUT_REQUIRED_FILES PROJECT QT_WRAP_CPP QT_WRAP_UI REMOVE REMOVE_DEFINITIONS RETURN SEPARATE_ARGUMENTS SET SET_DIRECTORY_PROPERTIES SET_PROPERTY SET_SOURCE_FILES_PROPERTIES SET_TARGET_PROPERTIES SET_TESTS_PROPERTIES SITE_NAME SOURCE_GROUP STRING SUBDIR_DEPENDS SUBDIRS TARGET_COMPILE_DEFINITIONS TARGET_COMPILE_FEATURES TARGET_COMPILE_OPTIONS TARGET_INCLUDE_DIRECTORIES TARGET_LINK_LIBRARIES TARGET_SOURCES TRY_COMPILE TRY_RUN UNSET USE_MANGLED_MESA UTILITY_SOURCE VARIABLE_REQUIRES VARIABLE_WATCH WHILE WRITE_FILE
\ nextgroup=cmakeArguments \ nextgroup=cmakeArguments
syn keyword cmakeTodo syn keyword cmakeTodo
\ TODO FIXME XXX \ TODO FIXME XXX

@ -50,7 +50,7 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
if(NOT DEFINED CPACK_SYSTEM_NAME) if(NOT DEFINED CPACK_SYSTEM_NAME)
# make sure package is not Cygwin-unknown, for Cygwin just # make sure package is not Cygwin-unknown, for Cygwin just
# cygwin is good for the system name # cygwin is good for the system name
if("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN") if("x${CMAKE_SYSTEM_NAME}" STREQUAL "xCYGWIN")
set(CPACK_SYSTEM_NAME Cygwin) set(CPACK_SYSTEM_NAME Cygwin)
else() else()
set(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}) set(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR})
@ -59,11 +59,37 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
if(${CPACK_SYSTEM_NAME} MATCHES Windows) if(${CPACK_SYSTEM_NAME} MATCHES Windows)
if(CMAKE_CL_64) if(CMAKE_CL_64)
set(CPACK_SYSTEM_NAME win64-x64) set(CPACK_SYSTEM_NAME win64-x64)
set(CPACK_IFW_TARGET_DIRECTORY "@RootDir@/Program Files/${CMAKE_PROJECT_NAME}")
else() else()
set(CPACK_SYSTEM_NAME win32-x86) set(CPACK_SYSTEM_NAME win32-x86)
endif() endif()
endif() endif()
if(${CMAKE_SYSTEM_NAME} MATCHES Windows)
set(_CPACK_IFW_PACKAGE_ICON
"set(CPACK_IFW_PACKAGE_ICON \"${CMake_SOURCE_DIR}/Source/QtDialog/CMakeSetup.ico\")")
if(BUILD_QtDialog)
set(_CPACK_IFW_SHORTCUT_OPTIONAL "${_CPACK_IFW_SHORTCUT_OPTIONAL}component.addOperation(\"CreateShortcut\", \"@TargetDir@/bin/cmake-gui.exe\", \"@StartMenuDir@/CMake (cmake-gui).lnk\");\n")
endif()
if(SPHINX_HTML)
set(_CPACK_IFW_SHORTCUT_OPTIONAL "${_CPACK_IFW_SHORTCUT_OPTIONAL}component.addOperation(\"CreateShortcut\", \"@TargetDir@/doc/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}/html/index.html\", \"@StartMenuDir@/CMake Documentation.lnk\");\n")
endif()
configure_file("${CMake_SOURCE_DIR}/Source/QtIFW/installscript.qs.in"
"${CMake_BINARY_DIR}/installscript.qs" @ONLY
)
install(FILES "${CMake_SOURCE_DIR}/Source/QtIFW/cmake.org.html"
DESTINATION "."
)
set(_CPACK_IFW_PACKAGE_SCRIPT "set(CPACK_IFW_COMPONENT_GROUP_CMAKE_SCRIPT \"${CMake_BINARY_DIR}/installscript.qs\")")
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES Linux)
set(CPACK_IFW_TARGET_DIRECTORY "@HomeDir@/${CMAKE_PROJECT_NAME}")
set(CPACK_IFW_ADMIN_TARGET_DIRECTORY "@ApplicationsDir@/${CMAKE_PROJECT_NAME}")
endif()
set(_CPACK_IFW_PACKAGE_VERSION ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH})
if(NOT DEFINED CPACK_PACKAGE_FILE_NAME) if(NOT DEFINED CPACK_PACKAGE_FILE_NAME)
# if the CPACK_PACKAGE_FILE_NAME is not defined by the cache # if the CPACK_PACKAGE_FILE_NAME is not defined by the cache
# default to source package - system, on cygwin system is not # default to source package - system, on cygwin system is not

@ -31,6 +31,28 @@ endif()
# they might not if qt was not enabled for the build # they might not if qt was not enabled for the build
include("@QT_DIALOG_CPACK_OPTIONS_FILE@" OPTIONAL) include("@QT_DIALOG_CPACK_OPTIONS_FILE@" OPTIONAL)
if(CPACK_GENERATOR MATCHES "IFW")
# Installer configuration
set(CPACK_IFW_PACKAGE_TITLE "CMake Build Tool")
set(CPACK_IFW_PRODUCT_URL "http://www.cmake.org")
@_CPACK_IFW_PACKAGE_ICON@
set(CPACK_IFW_PACKAGE_WINDOW_ICON
"@CMake_SOURCE_DIR@/Source/QtDialog/CMakeSetup128.png")
# Package configuration group
set(CPACK_IFW_PACKAGE_GROUP CMake)
# Group configuration
set(CPACK_COMPONENT_GROUP_CMAKE_DISPLAY_NAME
"@CPACK_PACKAGE_NAME@")
set(CPACK_COMPONENT_GROUP_CMAKE_DESCRIPTION
"@CPACK_PACKAGE_DESCRIPTION_SUMMARY@")
# IFW group configuration
set(CPACK_IFW_COMPONENT_GROUP_CMAKE_VERSION
"@_CPACK_IFW_PACKAGE_VERSION@")
set(CPACK_IFW_COMPONENT_GROUP_CMAKE_LICENSES
"@CPACK_PACKAGE_NAME@ Copyright" "@CPACK_RESOURCE_FILE_LICENSE@")
@_CPACK_IFW_PACKAGE_SCRIPT@
endif()
if(CPACK_GENERATOR MATCHES "CygwinSource") if(CPACK_GENERATOR MATCHES "CygwinSource")
# when packaging source make sure the .build directory is not included # when packaging source make sure the .build directory is not included
set(CPACK_SOURCE_IGNORE_FILES set(CPACK_SOURCE_IGNORE_FILES

@ -21,7 +21,9 @@ if(CMAKE_BOOTSTRAP)
unset(CMAKE_BOOTSTRAP CACHE) unset(CMAKE_BOOTSTRAP CACHE)
endif() endif()
if(NOT CMake_TEST_EXTERNAL_CMAKE)
set(CMake_BIN_DIR ${CMake_BINARY_DIR}/bin) set(CMake_BIN_DIR ${CMake_BINARY_DIR}/bin)
endif()
if("${CMake_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}") if("${CMake_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
# Disallow architecture-specific try_run. It may not run on the host. # Disallow architecture-specific try_run. It may not run on the host.
@ -34,6 +36,21 @@ if("${CMake_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
endmacro() endmacro()
endif() endif()
# Use most-recent available language dialects with GNU and Clang
if(NOT DEFINED CMAKE_C_STANDARD)
set(CMAKE_C_STANDARD 11)
endif()
if(NOT DEFINED CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()
# option to set the internal encoding of CMake to UTF-8
option(CMAKE_ENCODING_UTF8 "Use UTF-8 encoding internally." ON)
mark_as_advanced(CMAKE_ENCODING_UTF8)
if(CMAKE_ENCODING_UTF8)
set(KWSYS_ENCODING_DEFAULT_CODEPAGE CP_UTF8)
endif()
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
# a macro to deal with system libraries, implemented as a macro # a macro to deal with system libraries, implemented as a macro
# simply to improve readability of the main script # simply to improve readability of the main script
@ -48,7 +65,7 @@ macro(CMAKE_HANDLE_SYSTEM_LIBRARIES)
# Allow the user to enable/disable all system utility library options by # Allow the user to enable/disable all system utility library options by
# defining CMAKE_USE_SYSTEM_LIBRARIES or CMAKE_USE_SYSTEM_LIBRARY_${util}. # defining CMAKE_USE_SYSTEM_LIBRARIES or CMAKE_USE_SYSTEM_LIBRARY_${util}.
set(UTILITIES BZIP2 CURL EXPAT LIBARCHIVE ZLIB) set(UTILITIES BZIP2 CURL EXPAT FORM JSONCPP LIBARCHIVE LIBLZMA ZLIB)
foreach(util ${UTILITIES}) foreach(util ${UTILITIES})
if(NOT DEFINED CMAKE_USE_SYSTEM_LIBRARY_${util} if(NOT DEFINED CMAKE_USE_SYSTEM_LIBRARY_${util}
AND DEFINED CMAKE_USE_SYSTEM_LIBRARIES) AND DEFINED CMAKE_USE_SYSTEM_LIBRARIES)
@ -84,6 +101,10 @@ macro(CMAKE_HANDLE_SYSTEM_LIBRARIES)
"${CMAKE_USE_SYSTEM_LIBRARY_ZLIB}" "NOT CMAKE_USE_SYSTEM_LIBARCHIVE;NOT CMAKE_USE_SYSTEM_CURL" ON) "${CMAKE_USE_SYSTEM_LIBRARY_ZLIB}" "NOT CMAKE_USE_SYSTEM_LIBARCHIVE;NOT CMAKE_USE_SYSTEM_CURL" ON)
CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_BZIP2 "Use system-installed bzip2" CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_BZIP2 "Use system-installed bzip2"
"${CMAKE_USE_SYSTEM_LIBRARY_BZIP2}" "NOT CMAKE_USE_SYSTEM_LIBARCHIVE" ON) "${CMAKE_USE_SYSTEM_LIBRARY_BZIP2}" "NOT CMAKE_USE_SYSTEM_LIBARCHIVE" ON)
CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_LIBLZMA "Use system-installed liblzma"
"${CMAKE_USE_SYSTEM_LIBRARY_LIBLZMA}" "NOT CMAKE_USE_SYSTEM_LIBARCHIVE" ON)
option(CMAKE_USE_SYSTEM_FORM "Use system-installed libform" "${CMAKE_USE_SYSTEM_LIBRARY_FORM}")
option(CMAKE_USE_SYSTEM_JSONCPP "Use system-installed jsoncpp" "${CMAKE_USE_SYSTEM_LIBRARY_JSONCPP}")
# Mention to the user what system libraries are being used. # Mention to the user what system libraries are being used.
foreach(util ${UTILITIES}) foreach(util ${UTILITIES})
@ -102,10 +123,12 @@ endmacro()
if(NOT CMake_TEST_EXTERNAL_CMAKE)
set(CMAKE_BUILD_ON_VISUAL_STUDIO 0) set(CMAKE_BUILD_ON_VISUAL_STUDIO 0)
if(WIN32 AND NOT UNIX AND NOT BORLAND AND NOT MINGW ) if(WIN32 AND NOT UNIX AND NOT MINGW)
set(CMAKE_BUILD_ON_VISUAL_STUDIO 1) set(CMAKE_BUILD_ON_VISUAL_STUDIO 1)
endif() endif()
endif()
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
@ -114,29 +137,6 @@ endif()
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
macro(CMAKE_SETUP_TESTING) macro(CMAKE_SETUP_TESTING)
if(BUILD_TESTING) if(BUILD_TESTING)
set(CMAKE_TEST_GENERATOR "" CACHE STRING
"Generator used when running tests")
set(CMAKE_TEST_MAKEPROGRAM "" CACHE FILEPATH
"Generator used when running tests")
if(NOT CMAKE_TEST_GENERATOR)
set(CMAKE_TEST_GENERATOR "${CMAKE_GENERATOR}")
set(CMAKE_TEST_GENERATOR_TOOLSET "${CMAKE_GENERATOR_TOOLSET}")
else()
set(CMAKE_TEST_DIFFERENT_GENERATOR TRUE)
set(CMAKE_TEST_GENERATOR_TOOLSET "")
endif()
# Are we testing with the MSVC compiler?
set(CMAKE_TEST_MSVC 0)
if(MSVC AND NOT CMAKE_TEST_DIFFERENT_GENERATOR)
set(CMAKE_TEST_MSVC 1)
else()
if("${CMAKE_TEST_GENERATOR}" MATCHES "NMake" OR
"${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio")
set(CMAKE_TEST_MSVC 1)
endif()
endif()
set(CMAKE_TEST_SYSTEM_LIBRARIES 0) set(CMAKE_TEST_SYSTEM_LIBRARIES 0)
foreach(util CURL EXPAT XMLRPC ZLIB) foreach(util CURL EXPAT XMLRPC ZLIB)
if(CMAKE_USE_SYSTEM_${util}) if(CMAKE_USE_SYSTEM_${util})
@ -149,10 +149,20 @@ macro(CMAKE_SETUP_TESTING)
# the ctest from this cmake is used for testing # the ctest from this cmake is used for testing
# and not the ctest from the cmake building and testing # and not the ctest from the cmake building and testing
# cmake. # cmake.
if(CMake_TEST_EXTERNAL_CMAKE)
set(CMAKE_CTEST_COMMAND "${CMake_TEST_EXTERNAL_CMAKE}/ctest")
set(CMAKE_CMAKE_COMMAND "${CMake_TEST_EXTERNAL_CMAKE}/cmake")
set(CMAKE_CPACK_COMMAND "${CMake_TEST_EXTERNAL_CMAKE}/cpack")
foreach(exe cmake ctest cpack)
add_executable(${exe} IMPORTED)
set_property(TARGET ${exe} PROPERTY IMPORTED_LOCATION ${CMake_TEST_EXTERNAL_CMAKE}/${exe})
endforeach()
else()
set(CMAKE_CTEST_COMMAND "${CMake_BIN_DIR}/ctest") set(CMAKE_CTEST_COMMAND "${CMake_BIN_DIR}/ctest")
set(CMAKE_CMAKE_COMMAND "${CMake_BIN_DIR}/cmake") set(CMAKE_CMAKE_COMMAND "${CMake_BIN_DIR}/cmake")
set(CMAKE_CPACK_COMMAND "${CMake_BIN_DIR}/cpack") set(CMAKE_CPACK_COMMAND "${CMake_BIN_DIR}/cpack")
endif() endif()
endif()
# configure some files for testing # configure some files for testing
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/Templates/CTestScript.cmake.in" configure_file("${CMAKE_CURRENT_SOURCE_DIR}/Templates/CTestScript.cmake.in"
@ -164,8 +174,6 @@ macro(CMAKE_SETUP_TESTING)
${CMake_BINARY_DIR}/Modules/.NoDartCoverage) ${CMake_BINARY_DIR}/Modules/.NoDartCoverage)
configure_file(${CMake_SOURCE_DIR}/CTestCustom.cmake.in configure_file(${CMake_SOURCE_DIR}/CTestCustom.cmake.in
${CMake_BINARY_DIR}/CTestCustom.cmake @ONLY) ${CMake_BINARY_DIR}/CTestCustom.cmake @ONLY)
configure_file(${CMake_SOURCE_DIR}/CTestCustom.ctest.in
${CMake_BINARY_DIR}/CTestCustom.ctest @ONLY)
if(BUILD_TESTING AND DART_ROOT) if(BUILD_TESTING AND DART_ROOT)
configure_file(${CMake_SOURCE_DIR}/CMakeLogo.gif configure_file(${CMake_SOURCE_DIR}/CMakeLogo.gif
${CMake_BINARY_DIR}/Testing/HTML/TestingResults/Icons/Logo.gif COPYONLY) ${CMake_BINARY_DIR}/Testing/HTML/TestingResults/Icons/Logo.gif COPYONLY)
@ -204,12 +212,6 @@ endmacro()
# Simply to improve readability of the main script. # Simply to improve readability of the main script.
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
macro (CMAKE_BUILD_UTILITIES) macro (CMAKE_BUILD_UTILITIES)
#---------------------------------------------------------------------
# Create the KWIML library for CMake.
set(KWIML cmIML)
set(KWIML_HEADER_ROOT ${CMake_BINARY_DIR}/Utilities)
add_subdirectory(Utilities/KWIML)
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# Create the kwsys library for CMake. # Create the kwsys library for CMake.
set(KWSYS_NAMESPACE cmsys) set(KWSYS_NAMESPACE cmsys)
@ -279,15 +281,19 @@ macro (CMAKE_BUILD_UTILITIES)
set(CURL_SPECIAL_ZLIB_H ${CMAKE_ZLIB_HEADER}) set(CURL_SPECIAL_ZLIB_H ${CMAKE_ZLIB_HEADER})
set(CURL_SPECIAL_LIBZ_INCLUDES ${CMAKE_ZLIB_INCLUDES}) set(CURL_SPECIAL_LIBZ_INCLUDES ${CMAKE_ZLIB_INCLUDES})
set(CURL_SPECIAL_LIBZ ${CMAKE_ZLIB_LIBRARIES}) set(CURL_SPECIAL_LIBZ ${CMAKE_ZLIB_LIBRARIES})
option(CMAKE_BUILD_CURL_SHARED "Should curl be built shared" FALSE)
if(NOT CMAKE_BUILD_CURL_SHARED)
add_definitions(-DCURL_STATICLIB) add_definitions(-DCURL_STATICLIB)
endif()
set(CMAKE_CURL_INCLUDES) set(CMAKE_CURL_INCLUDES)
set(CMAKE_CURL_LIBRARIES cmcurl) set(CMAKE_CURL_LIBRARIES cmcurl)
if(CMAKE_TESTS_CDASH_SERVER) if(CMAKE_TESTS_CDASH_SERVER)
set(CMAKE_CURL_TEST_URL "${CMAKE_TESTS_CDASH_SERVER}/user.php") set(CMAKE_CURL_TEST_URL "${CMAKE_TESTS_CDASH_SERVER}/user.php")
endif() endif()
option(CMAKE_USE_OPENSSL "Use OpenSSL." OFF)
mark_as_advanced(CMAKE_USE_OPENSSL)
if(CMAKE_USE_OPENSSL)
set(CURL_CA_BUNDLE "" CACHE FILEPATH "Path to SSL CA Certificate Bundle")
set(CURL_CA_PATH "" CACHE PATH "Path to SSL CA Certificate Directory")
mark_as_advanced(CURL_CA_BUNDLE CURL_CA_PATH)
endif()
add_subdirectory(Utilities/cmcurl) add_subdirectory(Utilities/cmcurl)
CMAKE_SET_TARGET_FOLDER(cmcurl "Utilities/3rdParty") CMAKE_SET_TARGET_FOLDER(cmcurl "Utilities/3rdParty")
CMAKE_SET_TARGET_FOLDER(LIBCURL "Utilities/3rdParty") CMAKE_SET_TARGET_FOLDER(LIBCURL "Utilities/3rdParty")
@ -310,10 +316,27 @@ macro (CMAKE_BUILD_UTILITIES)
CMAKE_SET_TARGET_FOLDER(cmbzip2 "Utilities/3rdParty") CMAKE_SET_TARGET_FOLDER(cmbzip2 "Utilities/3rdParty")
endif() endif()
#---------------------------------------------------------------------
# Build or use system liblzma for libarchive.
if(CMAKE_USE_SYSTEM_LIBLZMA)
find_package(LibLZMA)
if(NOT LIBLZMA_FOUND)
message(FATAL_ERROR "CMAKE_USE_SYSTEM_LIBLZMA is ON but LibLZMA is not found!")
endif()
set(LZMA_INCLUDE_DIR ${LIBLZMA_INCLUDE_DIRS})
set(LZMA_LIBRARY ${LIBLZMA_LIBRARIES})
else()
add_subdirectory(Utilities/cmliblzma)
CMAKE_SET_TARGET_FOLDER(cmliblzma "Utilities/3rdParty")
set(LZMA_INCLUDE_DIR
"${CMAKE_CURRENT_SOURCE_DIR}/Utilities/cmliblzma/liblzma/api")
set(LZMA_LIBRARY cmliblzma)
endif()
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# Build or use system libarchive for CMake and CTest. # Build or use system libarchive for CMake and CTest.
if(CMAKE_USE_SYSTEM_LIBARCHIVE) if(CMAKE_USE_SYSTEM_LIBARCHIVE)
find_package(LibArchive) find_package(LibArchive 3.0.0)
if(NOT LibArchive_FOUND) if(NOT LibArchive_FOUND)
message(FATAL_ERROR "CMAKE_USE_SYSTEM_LIBARCHIVE is ON but LibArchive is not found!") message(FATAL_ERROR "CMAKE_USE_SYSTEM_LIBARCHIVE is ON but LibArchive is not found!")
endif() endif()
@ -325,6 +348,12 @@ macro (CMAKE_BUILD_UTILITIES)
add_definitions(-DLIBARCHIVE_STATIC) add_definitions(-DLIBARCHIVE_STATIC)
set(ENABLE_NETTLE OFF CACHE INTERNAL "Enable use of Nettle") set(ENABLE_NETTLE OFF CACHE INTERNAL "Enable use of Nettle")
set(ENABLE_OPENSSL ${CMAKE_USE_OPENSSL} CACHE INTERNAL "Enable use of OpenSSL") set(ENABLE_OPENSSL ${CMAKE_USE_OPENSSL} CACHE INTERNAL "Enable use of OpenSSL")
set(ENABLE_LZMA ON CACHE INTERNAL "Enable the use of the system found LZMA library if found")
set(ENABLE_ZLIB ON CACHE INTERNAL "Enable the use of the system found ZLIB library if found")
set(ENABLE_BZip2 ON CACHE INTERNAL "Enable the use of the system found BZip2 library if found")
set(ENABLE_EXPAT OFF CACHE INTERNAL "Enable the use of the system found EXPAT library if found")
set(ENABLE_PCREPOSIX OFF CACHE INTERNAL "Enable the use of the system found PCREPOSIX library if found")
set(ENABLE_LibGCC OFF CACHE INTERNAL "Enable the use of the system found LibGCC library if found")
set(ENABLE_XATTR OFF CACHE INTERNAL "Enable extended attribute support") set(ENABLE_XATTR OFF CACHE INTERNAL "Enable extended attribute support")
set(ENABLE_ACL OFF CACHE INTERNAL "Enable ACL support") set(ENABLE_ACL OFF CACHE INTERNAL "Enable ACL support")
set(ENABLE_ICONV OFF CACHE INTERNAL "Enable iconv support") set(ENABLE_ICONV OFF CACHE INTERNAL "Enable iconv support")
@ -350,6 +379,25 @@ macro (CMAKE_BUILD_UTILITIES)
CMAKE_SET_TARGET_FOLDER(cmexpat "Utilities/3rdParty") CMAKE_SET_TARGET_FOLDER(cmexpat "Utilities/3rdParty")
endif() endif()
#---------------------------------------------------------------------
# Build jsoncpp library.
if(CMAKE_USE_SYSTEM_JSONCPP)
if(NOT CMAKE_VERSION VERSION_LESS 3.0)
include(${CMake_SOURCE_DIR}/Source/Modules/FindJsonCpp.cmake)
else()
message(FATAL_ERROR "CMAKE_USE_SYSTEM_JSONCPP requires CMake >= 3.0")
endif()
if(NOT JsonCpp_FOUND)
message(FATAL_ERROR
"CMAKE_USE_SYSTEM_JSONCPP is ON but a JsonCpp is not found!")
endif()
set(CMAKE_JSONCPP_LIBRARIES JsonCpp::JsonCpp)
else()
set(CMAKE_JSONCPP_LIBRARIES cmjsoncpp)
add_subdirectory(Utilities/cmjsoncpp)
CMAKE_SET_TARGET_FOLDER(cmjsoncpp "Utilities/3rdParty")
endif()
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# Build XMLRPC library for CMake and CTest. # Build XMLRPC library for CMake and CTest.
if(CTEST_USE_XMLRPC) if(CTEST_USE_XMLRPC)
@ -366,7 +414,7 @@ macro (CMAKE_BUILD_UTILITIES)
# Use curses? # Use curses?
if (UNIX) if (UNIX)
# there is a bug in the Syllable libraries which makes linking ccmake fail, Alex # there is a bug in the Syllable libraries which makes linking ccmake fail, Alex
if(NOT "${CMAKE_SYSTEM_NAME}" MATCHES syllable) if(NOT CMAKE_SYSTEM_NAME MATCHES syllable)
set(CURSES_NEED_NCURSES TRUE) set(CURSES_NEED_NCURSES TRUE)
find_package(Curses QUIET) find_package(Curses QUIET)
if (CURSES_LIBRARY) if (CURSES_LIBRARY)
@ -382,11 +430,16 @@ macro (CMAKE_BUILD_UTILITIES)
set(BUILD_CursesDialog 0) set(BUILD_CursesDialog 0)
endif () endif ()
if(BUILD_CursesDialog) if(BUILD_CursesDialog)
if(NOT CMAKE_USE_SYSTEM_FORM)
add_subdirectory(Source/CursesDialog/form) add_subdirectory(Source/CursesDialog/form)
elseif(NOT CURSES_FORM_LIBRARY)
message( FATAL_ERROR "CMAKE_USE_SYSTEM_FORM in ON but CURSES_FORM_LIBRARY is not set!" )
endif()
endif() endif()
endmacro () endmacro ()
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
if(NOT CMake_TEST_EXTERNAL_CMAKE)
if(CMAKE_CXX_PLATFORM_ID MATCHES "OpenBSD") if(CMAKE_CXX_PLATFORM_ID MATCHES "OpenBSD")
execute_process(COMMAND ${CMAKE_CXX_COMPILER} execute_process(COMMAND ${CMAKE_CXX_COMPILER}
${CMAKE_CXX_COMPILER_ARG1} -dumpversion ${CMAKE_CXX_COMPILER_ARG1} -dumpversion
@ -401,6 +454,7 @@ if(CMAKE_CXX_PLATFORM_ID MATCHES "OpenBSD")
"${CMAKE_CXX_COMPILER} version is: ${_GXX_VERSION}") "${CMAKE_CXX_COMPILER} version is: ${_GXX_VERSION}")
endif() endif()
endif() endif()
endif()
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
# The main section of the CMakeLists file # The main section of the CMakeLists file
@ -417,6 +471,7 @@ include (${CMAKE_ROOT}/Modules/Dart.cmake)
set_directory_properties(PROPERTIES set_directory_properties(PROPERTIES
TEST_INCLUDE_FILE "${CMake_BINARY_DIR}/Tests/EnforceConfig.cmake") TEST_INCLUDE_FILE "${CMake_BINARY_DIR}/Tests/EnforceConfig.cmake")
if(NOT CMake_TEST_EXTERNAL_CMAKE)
# where to write the resulting executables and libraries # where to write the resulting executables and libraries
set(BUILD_SHARED_LIBS OFF) set(BUILD_SHARED_LIBS OFF)
set(EXECUTABLE_OUTPUT_PATH "" CACHE INTERNAL "No configurable exe dir.") set(EXECUTABLE_OUTPUT_PATH "" CACHE INTERNAL "No configurable exe dir.")
@ -441,11 +496,12 @@ include(CompileFlags.cmake)
include(CheckSymbolExists) include(CheckSymbolExists)
CHECK_SYMBOL_EXISTS(unsetenv "stdlib.h" HAVE_UNSETENV) CHECK_SYMBOL_EXISTS(unsetenv "stdlib.h" HAVE_UNSETENV)
CHECK_SYMBOL_EXISTS(environ "stdlib.h" HAVE_ENVIRON_NOT_REQUIRE_PROTOTYPE) CHECK_SYMBOL_EXISTS(environ "stdlib.h" HAVE_ENVIRON_NOT_REQUIRE_PROTOTYPE)
endif()
# CMAKE_TESTS_CDASH_SERVER: CDash server used by CMake/Tests. # CMAKE_TESTS_CDASH_SERVER: CDash server used by CMake/Tests.
# #
# If not defined or "", this variable defaults to the server at # If not defined or "", this variable defaults to the server at
# http://www.cdash.org/CDash. # "http://open.cdash.org".
# #
# If set explicitly to "NOTFOUND", curl tests and ctest tests that use # If set explicitly to "NOTFOUND", curl tests and ctest tests that use
# the network are skipped. # the network are skipped.
@ -456,9 +512,15 @@ CHECK_SYMBOL_EXISTS(environ "stdlib.h" HAVE_ENVIRON_NOT_REQUIRE_PROTOTYPE)
# should be run first. # should be run first.
# #
if("x${CMAKE_TESTS_CDASH_SERVER}" STREQUAL "x") if("x${CMAKE_TESTS_CDASH_SERVER}" STREQUAL "x")
set(CMAKE_TESTS_CDASH_SERVER "http://www.cdash.org/CDash") set(CMAKE_TESTS_CDASH_SERVER "http://open.cdash.org")
endif() endif()
# Create the KWIML library for CMake.
set(KWIML cmIML)
set(KWIML_HEADER_ROOT ${CMake_BINARY_DIR}/Utilities)
add_subdirectory(Utilities/KWIML)
if(NOT CMake_TEST_EXTERNAL_CMAKE)
# build the utilities (a macro defined in this file) # build the utilities (a macro defined in this file)
CMAKE_BUILD_UTILITIES() CMAKE_BUILD_UTILITIES()
@ -523,15 +585,14 @@ add_custom_target(uninstall
include (CMakeCPack.cmake) include (CMakeCPack.cmake)
endif()
# setup some Testing support (a macro defined in this file) # setup some Testing support (a macro defined in this file)
CMAKE_SETUP_TESTING() CMAKE_SETUP_TESTING()
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/DartLocal.conf.in"
"${CMAKE_CURRENT_BINARY_DIR}/DartLocal.conf"
COPYONLY)
if(NOT CMake_TEST_EXTERNAL_CMAKE)
if(NOT CMake_VERSION_IS_RELEASE) if(NOT CMake_VERSION_IS_RELEASE)
if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" AND if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND
NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS 4.2) NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS 4.2)
set(C_FLAGS_LIST -Wcast-align -Werror-implicit-function-declaration -Wchar-subscripts set(C_FLAGS_LIST -Wcast-align -Werror-implicit-function-declaration -Wchar-subscripts
-Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security
@ -557,20 +618,24 @@ endif()
# build the remaining subdirectories # build the remaining subdirectories
add_subdirectory(Source) add_subdirectory(Source)
add_subdirectory(Utilities) add_subdirectory(Utilities)
endif()
add_subdirectory(Tests) add_subdirectory(Tests)
if(NOT CMake_TEST_EXTERNAL_CMAKE)
if(BUILD_TESTING) if(BUILD_TESTING)
CMAKE_SET_TARGET_FOLDER(CMakeLibTests "Tests") CMAKE_SET_TARGET_FOLDER(CMakeLibTests "Tests")
endif() endif()
CMAKE_SET_TARGET_FOLDER(cmw9xcom "Utilities/Win9xCompat")
if(TARGET documentation) if(TARGET documentation)
CMAKE_SET_TARGET_FOLDER(documentation "Documentation") CMAKE_SET_TARGET_FOLDER(documentation "Documentation")
endif() endif()
endif()
# add a test # add a test
add_test(SystemInformationNew "${CMAKE_CMAKE_COMMAND}" add_test(SystemInformationNew "${CMAKE_CMAKE_COMMAND}"
--system-information -G "${CMAKE_TEST_GENERATOR}" ) --system-information -G "${CMAKE_GENERATOR}" )
if(NOT CMake_TEST_EXTERNAL_CMAKE)
# Install license file as it requires. # Install license file as it requires.
install(FILES Copyright.txt DESTINATION ${CMAKE_DOC_DIR}) install(FILES Copyright.txt DESTINATION ${CMAKE_DOC_DIR})
@ -589,3 +654,4 @@ install(
# Install auxiliary files integrating with other tools. # Install auxiliary files integrating with other tools.
add_subdirectory(Auxiliary) add_subdirectory(Auxiliary)
endif()

@ -13,13 +13,8 @@ set(CTEST_PROJECT_NAME "CMake")
set(CTEST_NIGHTLY_START_TIME "1:00:00 UTC") set(CTEST_NIGHTLY_START_TIME "1:00:00 UTC")
set(CTEST_DROP_METHOD "http") set(CTEST_DROP_METHOD "http")
set(CTEST_DROP_SITE "www.cdash.org") set(CTEST_DROP_SITE "open.cdash.org")
set(CTEST_DROP_LOCATION "/CDash/submit.php?project=CMake") set(CTEST_DROP_LOCATION "/submit.php?project=CMake")
set(CTEST_DROP_SITE_CDASH TRUE) set(CTEST_DROP_SITE_CDASH TRUE)
set(CTEST_CDASH_VERSION "1.6") set(CTEST_CDASH_VERSION "1.6")
set(CTEST_CDASH_QUERY_VERSION TRUE) set(CTEST_CDASH_QUERY_VERSION TRUE)
# use old trigger stuff so that cmake 2.4 and below will not
# get errors on trigger
set (TRIGGER_SITE
"http://public.kitware.com/cgi-bin/Submit-CMake-TestingResults.cgi")

@ -19,6 +19,7 @@ set(CTEST_CUSTOM_WARNING_EXCEPTION
"Utilities.cmbzip2." "Utilities.cmbzip2."
"Source.CTest.Curl" "Source.CTest.Curl"
"Source.CursesDialog.form" "Source.CursesDialog.form"
"Source.cm_sha2.*warning.*cast increases required alignment of target type"
"Utilities.cmcurl" "Utilities.cmcurl"
"Utilities.cmexpat." "Utilities.cmexpat."
"Utilities.cmlibarchive" "Utilities.cmlibarchive"
@ -39,12 +40,14 @@ set(CTEST_CUSTOM_WARNING_EXCEPTION
"Warning: public.*BZ2_bz.*in module.*bzlib.*clashes with prior module.*bzlib.*" "Warning: public.*BZ2_bz.*in module.*bzlib.*clashes with prior module.*bzlib.*"
"Warning: public.*_archive.*clashes with prior module.*" "Warning: public.*_archive.*clashes with prior module.*"
"Warning: LINN32: Last line.*is less.*" "Warning: LINN32: Last line.*is less.*"
"Warning: Olimit was exceeded on function.*"
"Warning: To override Olimit for all functions in file.*"
"warning.*directory name.*CMake-Xcode.*/bin/.*does not exist.*" "warning.*directory name.*CMake-Xcode.*/bin/.*does not exist.*"
"stl_deque.h:1051" "stl_deque.h:1051"
"(Lexer|Parser).*warning.*conversion.*may (alter its value|change the sign)" "(Lexer|Parser).*warning.*conversion.*may (alter its value|change the sign)"
"(Lexer|Parser).*warning.*statement is unreachable" "(Lexer|Parser).*warning.*(statement is unreachable|will never be executed)"
"PGC-W-0095-Type cast required for this conversion.*ProcessUNIX.c" "PGC-W-0095-Type cast required for this conversion.*ProcessUNIX.c"
"[Qq]t([Cc]ore|[Gg]ui).*warning.*conversion.*may alter its value" "[Qq]t([Cc]ore|[Gg]ui|[Ww]idgets).*warning.*conversion.*may alter its value"
"warning:.*is.*very unsafe.*consider using.*" "warning:.*is.*very unsafe.*consider using.*"
"warning:.*is.*misused, please use.*" "warning:.*is.*misused, please use.*"
"CMakeSetupManifest.xml.*manifest authoring warning.*Unrecognized Element" "CMakeSetupManifest.xml.*manifest authoring warning.*Unrecognized Element"
@ -52,6 +55,9 @@ set(CTEST_CUSTOM_WARNING_EXCEPTION
"ld: warning: directory not found for option .-(F|L)" "ld: warning: directory not found for option .-(F|L)"
"warning.*This version of Mac OS X is unsupported" "warning.*This version of Mac OS X is unsupported"
"clang.*: warning: argument unused during compilation: .-g" "clang.*: warning: argument unused during compilation: .-g"
"note: in expansion of macro" # diagnostic context note
"cm(StringCommand|CTestTestHandler)\\.cxx.*warning.*rand.*isn.*t random" # we do not do crypto
"cm(StringCommand|CTestTestHandler)\\.cxx.*warning.*srand.*seed choices are.*poor" # we do not do crypto
# Ignore clang's summary warning, assuming prior text has matched some # Ignore clang's summary warning, assuming prior text has matched some
# other warning expression: # other warning expression:

@ -1,3 +0,0 @@
# This file is provided for compatibility with CMake 2.2 and lower.
# Just include the custom file by its new name.
INCLUDE("CTestCustom.cmake")

@ -16,11 +16,8 @@
if(CMAKE_GENERATOR MATCHES "Visual Studio 7") if(CMAKE_GENERATOR MATCHES "Visual Studio 7")
set(CMAKE_SKIP_COMPATIBILITY_TESTS 1) set(CMAKE_SKIP_COMPATIBILITY_TESTS 1)
endif() endif()
if(CMAKE_GENERATOR MATCHES "Visual Studio 6")
set(CMAKE_SKIP_COMPATIBILITY_TESTS 1)
endif()
if(WIN32 AND "${CMAKE_C_COMPILER_ID}" MATCHES "^(Intel)$") if(WIN32 AND CMAKE_C_COMPILER_ID STREQUAL "Intel")
set(_INTEL_WINDOWS 1) set(_INTEL_WINDOWS 1)
endif() endif()
@ -34,20 +31,20 @@ else()
endif() endif()
#silence duplicate symbol warnings on AIX #silence duplicate symbol warnings on AIX
if(CMAKE_SYSTEM MATCHES "AIX.*") if(CMAKE_SYSTEM_NAME MATCHES "AIX")
if(NOT CMAKE_COMPILER_IS_GNUCXX) if(NOT CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -bhalt:5 ") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -bhalt:5 ")
endif() endif()
endif() endif()
if(CMAKE_SYSTEM MATCHES "IRIX.*") if(CMAKE_SYSTEM_NAME MATCHES "IRIX")
if(NOT CMAKE_COMPILER_IS_GNUCXX) if(NOT CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-woff84 -no_auto_include") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-woff84 -no_auto_include")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-woff15") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-woff15")
endif() endif()
endif() endif()
if(CMAKE_SYSTEM MATCHES "OSF1-V.*") if(CMAKE_SYSTEM MATCHES "OSF1-V")
if(NOT CMAKE_COMPILER_IS_GNUCXX) if(NOT CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -timplicit_local -no_implicit_include ") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -timplicit_local -no_implicit_include ")
endif() endif()
@ -65,6 +62,24 @@ if(CMAKE_SYSTEM_NAME MATCHES "HP-UX" AND CMAKE_CXX_COMPILER_ID MATCHES "HP")
endif() endif()
endif() endif()
# Workaround for short jump tables on PA-RISC
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^parisc")
if(CMAKE_COMPILER_IS_GNUC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mlong-calls")
endif()
if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mlong-calls")
endif()
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL SunPro)
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++03")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -library=stlport4")
endif()
endif()
# use the ansi CXX compile flag for building cmake # use the ansi CXX compile flag for building cmake
if (CMAKE_ANSI_CXXFLAGS) if (CMAKE_ANSI_CXXFLAGS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_ANSI_CXXFLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_ANSI_CXXFLAGS}")
@ -73,11 +88,3 @@ endif ()
if (CMAKE_ANSI_CFLAGS) if (CMAKE_ANSI_CFLAGS)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_ANSI_CFLAGS}") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_ANSI_CFLAGS}")
endif () endif ()
# avoid binutils problem with large binaries, e.g. when building CMake in debug mode
# See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50230
if (CMAKE_SYSTEM_NAME STREQUAL Linux AND CMAKE_SYSTEM_PROCESSOR STREQUAL parisc)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--unique=.text._*")
endif ()
include (${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityCXX.cmake)

@ -1,5 +1,5 @@
CMake - Cross Platform Makefile Generator CMake - Cross Platform Makefile Generator
Copyright 2000-2014 Kitware, Inc. Copyright 2000-2015 Kitware, Inc.
Copyright 2000-2011 Insight Software Consortium Copyright 2000-2011 Insight Software Consortium
All rights reserved. All rights reserved.

@ -13,6 +13,6 @@ set(CTEST_PROJECT_NAME "CMake")
set(CTEST_NIGHTLY_START_TIME "21:00:00 EDT") set(CTEST_NIGHTLY_START_TIME "21:00:00 EDT")
set(CTEST_DROP_METHOD "http") set(CTEST_DROP_METHOD "http")
set(CTEST_DROP_SITE "www.cdash.org") set(CTEST_DROP_SITE "open.cdash.org")
set(CTEST_DROP_LOCATION "/CDash/submit.php?project=CMake") set(CTEST_DROP_LOCATION "/submit.php?project=CMake")
set(CTEST_DROP_SITE_CDASH TRUE) set(CTEST_DROP_SITE_CDASH TRUE)

@ -1,121 +0,0 @@
ExpectedBuilds: \
{andoria.kitware Linux-g++3.4-KDevelop} \
{andoria.kitware Linux-g++3.4-SVN} \
{DASH1.kitware Win32-nmake71} \
{DASH1.kitware Win32-vs71} \
{DASH1.kitware Win32-vs71Rel} \
{DASH1.kitware zRel24-Win32-nmake71} \
{DASH1.kitware zRel24-Win32-vs71} \
{DASH11.kitware zRel24-Win32-nmake71} \
{dash14.kitware Win32-bcc5.6} \
{dash14.kitware Win32-cygwin} \
{dash14.kitware Win32-mingw} \
{dash14.kitware zRel24-Win32-bcc5.6} \
{dash17.kitware Linux-g++4.0} \
{dash1win64.kitware Win64-vs80} \
{dash1win98.kitware Win32-vs60} \
{DASH2.kitware Win32-nmake70} \
{DASH2.kitware Win32-vs70} \
{DASH2.kitware Win32-vs70-InPlace} \
{DASH2.kitware zRel24-Win32-nmake70} \
{DASH2.kitware zRel24-Win32-vs70} \
{DASH3.kitware Win32-nmake60} \
{DASH3.kitware Win32-vs60} \
{DASH3.kitware zRel24-Win32-nmake60} \
{DASH3.kitware zRel24-Win32-vs60} \
{dash4.kitware Win32-bcc5.8} \
{DASH5.kitware Linux-gcc332-InPlace} \
{DASH5.kitware zRel24-Linix-gcc332} \
{DASH6.kitware zRel24-Linix-gcc332} \
{dash8.kitware Linux64-g++} \
{dash8.kitware Linux64-g++332} \
{dash8.kitware Linux64-g++341} \
{dash8.kitware zRel24-Linux64-g++} \
{dash8.kitware zRel24-Linux64-g++332} \
{dashmacmini1.kitware Darwin-Tiger-Xcode21} \
{dashmacmini1.kitware zRel24-Darwin-Tiger-g++} \
{dashmacmini2.kitware DarwinIntel-g++} \
{dashmacmini2.kitware DarwinIntel-Universal} \
{dashmacmini2.kitware Darwin-Tiger-Xcode21-univ} \
{dashmacmini3.kitware Darwin-LeopardIntel-g++} \
{dashmacmini3.kitware Darwin-LeopardIntel-Universal} \
{dashmacmini3.kitware Darwin-Leopard-Xcode21-univ} \
{dashsgi1.kitware IRIX32-CC} \
{dashsgi1.kitware IRIX64-CC} \
{dashsun1.kitware SunOS-CC} \
{dashsun1.kitware SunOS-CC-64} \
{dashsun1.kitware SunOS-gcc34-64} \
{destiny.kitware HP-UX-aCC} \
{destiny.kitware HP-UX-aCC-gmake} \
{devqnx.acfr.usyd.edu.au qnx-V3.3.5-gcc_ntox86} \
{grayson.kitware Win32-nmake80} \
{heart HP-UXia64-aCC} \
{hythloth.kitware Linux64-bullseye-cov} \
{hythloth.kitware Linux64-suncc-5.9} \
{hythloth.kitware Linux-nightly-win32-release} \
{insight.journal.kitware KWStyle} \
{iris.elemtech IRIX64-CC64-7.4} \
{iris.elemtech IRIX64-CC-7.4} \
{JET.kitware Linux-valgrind2} \
{krondor.kitware Darwin-c++} \
{krondor.kitware zRel24-Darwin-c++} \
{midworld.kitware DarwinG5-g++} \
{midworld.kitware DarwinG5-XCode15} \
{midworld.kitware zRel24-DarwinG5-g++} \
{pre.vision.cs.rpi.edu FreeBSD-CC-gmake} \
{pre.vision.cs.rpi.edu FreeBSD-CC-make} \
{RogueResearch3 Mac10.5-CMake-gcc-dbg-ppc} \
{RogueResearch3 Mac10.5-CMake-gcc-dbg-ppc64} \
{RogueResearch3 Mac10.5-CMake-gcc-rel-ppc} \
{RogueResearch3 Mac10.5-CMake-gcc-rel-ppc64} \
{RogueResearch3 Mac10.5-CMake-Xcode-dbg-ppc} \
{RogueResearch3 Mac10.5-CMake-Xcode-dbg-ppc64} \
{RogueResearch4 Mac10.5-CMake-gcc-dbg-i386} \
{RogueResearch4 Mac10.5-CMake-gcc-dbg-rosetta} \
{RogueResearch4 Mac10.5-CMake-gcc-rel-i386} \
{tick.rz.uni-augsburg.de LinuxPPC-g++3.3} \
{tick.rz.uni-augsburg.de LinuxPPC-g++3.4} \
{trinsic.kitware Win32-mingw} \
{r06n01.pbm.ihost.com AIX53-xlC} \
{r06n01.pbm.ihost.com zRel24-AIX53-xlC} \
{valhalla.kitware Win32-wcl386}
#{devqnx.acfr.usyd.edu.au qnx-V3.3.5-gcc_ntox86 } \
#{mr-orange.obtech.net gentoo-linux-x86\_64-gcc-4.0.2 } \
#{G5.Nfsnet.Org Darwin8.3-gcc4} \
# commas in names do not work for expected builds....
#{G4.Nfsnet.Org Darwin-c++} \
#{salmon.nlm.nih.gov Darwin8.7-gcc4} \
#{crd.ge.com Solaris-gcc343} \
#{crd.ge.com Linux-icc81} \
#{crd.ge.com Windows-bcc32} \
#{crd.ge.com Windows-nmake71} \
#{crd.ge.com Windows-nmake60} \
#{dash16.kitware Linux-g++4.0} \
#{styx Linuxia64-g++} \
#{crd.ge.com Cygwin-gcc344} \
#{valhalla.kitware Win32-bccRel} \
#{valhalla.kitware Win32-bcc} \
#{valhalla.kitware Win32-g++} \
#{valhalla.kitware Win32-nmake60} \
#{valhalla.kitware Win32-nmake70} \
#{valhalla.kitware Win32-vs60} \
#{valhalla.kitware Win32-vs70}
#{crd.ge.com FreeBSD-gcc321} \
#{crd.ge.com Linux-gcc320} \
#{cogattaca.kitware LinuxWin32-g++-Werror} \
#{cogattaca.kitware LinuxWin32-g++} \
#{dash8.kitware Win64-icl80} \
#{dash8.kitware zLRB-Win64-icl80} \
#{hythloth.kitware Linux-icc-8.1} \
CompressionMode: ALL
CompressionCommand: /bin/gzip
CompressionType: gzip

@ -7,15 +7,16 @@ Adds options to the compilation of source files.
add_compile_options(<option> ...) add_compile_options(<option> ...)
Adds options to the compiler command line for sources in the current Adds options to the compiler command line for targets in the current
directory and below. This command can be used to add any options, but directory and below that are added after this command is invoked.
alternative commands exist to add preprocessor definitions See documentation of the :prop_dir:`directory <COMPILE_OPTIONS>` and
(:command:`target_compile_definitions` and :command:`add_definitions`) or
include directories (:command:`target_include_directories` and
:command:`include_directories`). See documentation of the
:prop_tgt:`directory <COMPILE_OPTIONS>` and
:prop_tgt:`target <COMPILE_OPTIONS>` ``COMPILE_OPTIONS`` properties. :prop_tgt:`target <COMPILE_OPTIONS>` ``COMPILE_OPTIONS`` properties.
This command can be used to add any options, but alternative commands
exist to add preprocessor definitions (:command:`target_compile_definitions`
and :command:`add_definitions`) or include directories
(:command:`target_include_directories` and :command:`include_directories`).
Arguments to ``add_compile_options`` may use "generator expressions" with Arguments to ``add_compile_options`` may use "generator expressions" with
the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
manual for available expressions. See the :manual:`cmake-buildsystem(7)` manual for available expressions. See the :manual:`cmake-buildsystem(7)`

@ -3,43 +3,169 @@ add_custom_command
Add a custom build rule to the generated build system. Add a custom build rule to the generated build system.
There are two main signatures for add_custom_command The first There are two main signatures for ``add_custom_command``.
signature is for adding a custom command to produce an output.
:: Generating Files
^^^^^^^^^^^^^^^^
The first signature is for adding a custom command to produce an output::
add_custom_command(OUTPUT output1 [output2 ...] add_custom_command(OUTPUT output1 [output2 ...]
COMMAND command1 [ARGS] [args1...] COMMAND command1 [ARGS] [args1...]
[COMMAND command2 [ARGS] [args2...] ...] [COMMAND command2 [ARGS] [args2...] ...]
[MAIN_DEPENDENCY depend] [MAIN_DEPENDENCY depend]
[DEPENDS [depends...]] [DEPENDS [depends...]]
[BYPRODUCTS [files...]]
[IMPLICIT_DEPENDS <lang1> depend1 [IMPLICIT_DEPENDS <lang1> depend1
[<lang2> depend2] ...] [<lang2> depend2] ...]
[WORKING_DIRECTORY dir] [WORKING_DIRECTORY dir]
[COMMENT comment] [VERBATIM] [APPEND]) [COMMENT comment]
[VERBATIM] [APPEND] [USES_TERMINAL])
This defines a command to generate specified OUTPUT file(s). A target
created in the same directory (CMakeLists.txt file) that specifies any This defines a command to generate specified ``OUTPUT`` file(s).
output of the custom command as a source file is given a rule to A target created in the same directory (``CMakeLists.txt`` file)
generate the file using the command at build time. Do not list the that specifies any output of the custom command as a source file
output in more than one independent target that may build in parallel is given a rule to generate the file using the command at build time.
or the two instances of the rule may conflict (instead use Do not list the output in more than one independent target that
add_custom_target to drive the command and make the other targets may build in parallel or the two instances of the rule may conflict
depend on that one). If an output name is a relative path it will be (instead use the :command:`add_custom_target` command to drive the
interpreted relative to the build tree directory corresponding to the command and make the other targets depend on that one).
current source directory. Note that MAIN_DEPENDENCY is completely In makefile terms this creates a new target in the following form::
optional and is used as a suggestion to visual studio about where to
hang the custom command. In makefile terms this creates a new target
in the following form:
::
OUTPUT: MAIN_DEPENDENCY DEPENDS OUTPUT: MAIN_DEPENDENCY DEPENDS
COMMAND COMMAND
If more than one command is specified they will be executed in order. The options are:
The optional ARGS argument is for backward compatibility and will be
ignored. ``APPEND``
Append the ``COMMAND`` and ``DEPENDS`` option values to the custom
command for the first output specified. There must have already
been a previous call to this command with the same output.
The ``COMMENT``, ``MAIN_DEPENDENCY``, and ``WORKING_DIRECTORY``
options are currently ignored when APPEND is given, but may be
used in the future.
``BYPRODUCTS``
Specify the files the command is expected to produce but whose
modification time may or may not be newer than the dependencies.
If a byproduct name is a relative path it will be interpreted
relative to the build tree directory corresponding to the
current source directory.
Each byproduct file will be marked with the :prop_sf:`GENERATED`
source file property automatically.
Explicit specification of byproducts is supported by the
:generator:`Ninja` generator to tell the ``ninja`` build tool
how to regenerate byproducts when they are missing. It is
also useful when other build rules (e.g. custom commands)
depend on the byproducts. Ninja requires a build rule for any
generated file on which another rule depends even if there are
order-only dependencies to ensure the byproducts will be
available before their dependents build.
The ``BYPRODUCTS`` option is ignored on non-Ninja generators
except to mark byproducts ``GENERATED``.
``COMMAND``
Specify the command-line(s) to execute at build time.
If more than one ``COMMAND`` is specified they will be executed in order,
but *not* necessarily composed into a stateful shell or batch script.
(To run a full script, use the :command:`configure_file` command or the
:command:`file(GENERATE)` command to create it, and then specify
a ``COMMAND`` to launch it.)
The optional ``ARGS`` argument is for backward compatibility and
will be ignored.
If ``COMMAND`` specifies an executable target (created by the
:command:`add_executable` command) it will automatically be replaced
by the location of the executable created at build time.
Additionally a target-level dependency will be added so that the
executable target will be built before any target using this custom
command. However this does NOT add a file-level dependency that
would cause the custom command to re-run whenever the executable is
recompiled.
Arguments to ``COMMAND`` may use
:manual:`generator expressions <cmake-generator-expressions(7)>`.
References to target names in generator expressions imply target-level
dependencies, but NOT file-level dependencies. List target names with
the ``DEPENDS`` option to add file-level dependencies.
``COMMENT``
Display the given message before the commands are executed at
build time.
``DEPENDS``
Specify files on which the command depends. If any dependency is
an ``OUTPUT`` of another custom command in the same directory
(``CMakeLists.txt`` file) CMake automatically brings the other
custom command into the target in which this command is built.
If ``DEPENDS`` is not specified the command will run whenever
the ``OUTPUT`` is missing; if the command does not actually
create the ``OUTPUT`` then the rule will always run.
If ``DEPENDS`` specifies any target (created by the
:command:`add_custom_target`, :command:`add_executable`, or
:command:`add_library` command) a target-level dependency is
created to make sure the target is built before any target
using this custom command. Additionally, if the target is an
executable or library a file-level dependency is created to
cause the custom command to re-run whenever the target is
recompiled.
Arguments to ``DEPENDS`` may use
:manual:`generator expressions <cmake-generator-expressions(7)>`.
``IMPLICIT_DEPENDS``
Request scanning of implicit dependencies of an input file.
The language given specifies the programming language whose
corresponding dependency scanner should be used.
Currently only ``C`` and ``CXX`` language scanners are supported.
The language has to be specified for every file in the
``IMPLICIT_DEPENDS`` list. Dependencies discovered from the
scanning are added to those of the custom command at build time.
Note that the ``IMPLICIT_DEPENDS`` option is currently supported
only for Makefile generators and will be ignored by other generators.
``MAIN_DEPENDENCY``
Specify the primary input source file to the command. This is
treated just like any value given to the ``DEPENDS`` option
but also suggests to Visual Studio generators where to hang
the custom command. At most one custom command may specify a
given source file as its main dependency.
``OUTPUT``
Specify the output files the command is expected to produce.
If an output name is a relative path it will be interpreted
relative to the build tree directory corresponding to the
current source directory.
Each output file will be marked with the :prop_sf:`GENERATED`
source file property automatically.
If the output of the custom command is not actually created
as a file on disk it should be marked with the :prop_sf:`SYMBOLIC`
source file property.
``USES_TERMINAL``
The command will be given direct access to the terminal if possible.
With the :generator:`Ninja` generator, this places the command in
the ``console`` :prop_gbl:`pool <JOB_POOLS>`.
``VERBATIM``
All arguments to the commands will be escaped properly for the
build tool so that the invoked command receives each argument
unchanged. Note that one level of escapes is still used by the
CMake language processor before add_custom_command even sees the
arguments. Use of ``VERBATIM`` is recommended as it enables
correct behavior. When ``VERBATIM`` is not given the behavior
is platform specific because there is no protection of
tool-specific special characters.
``WORKING_DIRECTORY``
Execute the command with the given current working directory.
If it is a relative path it will be interpreted relative to the
build tree directory corresponding to the current source directory.
Build Events
^^^^^^^^^^^^
The second signature adds a custom command to a target such as a The second signature adds a custom command to a target such as a
library or executable. This is useful for performing an operation library or executable. This is useful for performing an operation
@ -53,106 +179,24 @@ target is already built, the command will not execute.
PRE_BUILD | PRE_LINK | POST_BUILD PRE_BUILD | PRE_LINK | POST_BUILD
COMMAND command1 [ARGS] [args1...] COMMAND command1 [ARGS] [args1...]
[COMMAND command2 [ARGS] [args2...] ...] [COMMAND command2 [ARGS] [args2...] ...]
[BYPRODUCTS [files...]]
[WORKING_DIRECTORY dir] [WORKING_DIRECTORY dir]
[COMMENT comment] [VERBATIM]) [COMMENT comment]
[VERBATIM] [USES_TERMINAL])
This defines a new command that will be associated with building the This defines a new command that will be associated with building the
specified target. When the command will happen is determined by which specified target. When the command will happen is determined by which
of the following is specified: of the following is specified:
:: ``PRE_BUILD``
Run before any other rules are executed within the target.
PRE_BUILD - run before all other dependencies This is supported only on Visual Studio 7 or later.
PRE_LINK - run after other dependencies For all other generators ``PRE_BUILD`` will be treated as
POST_BUILD - run after the target has been built ``PRE_LINK``.
``PRE_LINK``
Note that the PRE_BUILD option is only supported on Visual Studio 7 or Run after sources have been compiled but before linking the binary
later. For all other generators PRE_BUILD will be treated as or running the librarian or archiver tool of a static library.
PRE_LINK. This is not defined for targets created by the
:command:`add_custom_target` command.
If WORKING_DIRECTORY is specified the command will be executed in the ``POST_BUILD``
directory given. If it is a relative path it will be interpreted Run after all other rules within the target have been executed.
relative to the build tree directory corresponding to the current
source directory. If COMMENT is set, the value will be displayed as a
message before the commands are executed at build time. If APPEND is
specified the COMMAND and DEPENDS option values are appended to the
custom command for the first output specified. There must have
already been a previous call to this command with the same output.
The COMMENT, WORKING_DIRECTORY, and MAIN_DEPENDENCY options are
currently ignored when APPEND is given, but may be used in the future.
If VERBATIM is given then all arguments to the commands will be
escaped properly for the build tool so that the invoked command
receives each argument unchanged. Note that one level of escapes is
still used by the CMake language processor before add_custom_command
even sees the arguments. Use of VERBATIM is recommended as it enables
correct behavior. When VERBATIM is not given the behavior is platform
specific because there is no protection of tool-specific special
characters.
If the output of the custom command is not actually created as a file
on disk it should be marked as SYMBOLIC with
SET_SOURCE_FILES_PROPERTIES.
The IMPLICIT_DEPENDS option requests scanning of implicit dependencies
of an input file. The language given specifies the programming
language whose corresponding dependency scanner should be used.
Currently only C and CXX language scanners are supported. The
language has to be specified for every file in the IMPLICIT_DEPENDS
list. Dependencies discovered from the scanning are added to those of
the custom command at build time. Note that the IMPLICIT_DEPENDS
option is currently supported only for Makefile generators and will be
ignored by other generators.
If COMMAND specifies an executable target (created by ADD_EXECUTABLE)
it will automatically be replaced by the location of the executable
created at build time. Additionally a target-level dependency will be
added so that the executable target will be built before any target
using this custom command. However this does NOT add a file-level
dependency that would cause the custom command to re-run whenever the
executable is recompiled.
Arguments to COMMAND may use "generator expressions" with the syntax
``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual for
available expressions.
Note that tgt is not added as a dependency of the target this
expression is evaluated on.
::
$<TARGET_POLICY:pol> = '1' if the policy was NEW when the 'head' target was created, else '0'. If the policy was not set, the warning message for the policy will be emitted. This generator expression only works for a subset of policies.
$<INSTALL_PREFIX> = Content of the install prefix when the target is exported via INSTALL(EXPORT) and empty otherwise.
Boolean expressions:
::
$<AND:?[,?]...> = '1' if all '?' are '1', else '0'
$<OR:?[,?]...> = '0' if all '?' are '0', else '1'
$<NOT:?> = '0' if '?' is '1', else '1'
where '?' is always either '0' or '1'.
Expressions with an implicit 'this' target:
::
$<TARGET_PROPERTY:prop> = The value of the property prop on the target on which the generator expression is evaluated.
References to target names in generator expressions imply target-level
dependencies, but NOT file-level dependencies. List target names with
the DEPENDS option to add file dependencies.
The DEPENDS option specifies files on which the command depends. If
any dependency is an OUTPUT of another custom command in the same
directory (CMakeLists.txt file) CMake automatically brings the other
custom command into the target in which this command is built. If
DEPENDS is not specified the command will run whenever the OUTPUT is
missing; if the command does not actually create the OUTPUT then the
rule will always run. If DEPENDS specifies any target (created by an
ADD_* command) a target-level dependency is created to make sure the
target is built before any target using this custom command.
Additionally, if the target is an executable or library a file-level
dependency is created to cause the custom command to re-run whenever
the target is recompiled.

@ -8,38 +8,104 @@ Add a target with no output so it will always be built.
add_custom_target(Name [ALL] [command1 [args1...]] add_custom_target(Name [ALL] [command1 [args1...]]
[COMMAND command2 [args2...] ...] [COMMAND command2 [args2...] ...]
[DEPENDS depend depend depend ... ] [DEPENDS depend depend depend ... ]
[BYPRODUCTS [files...]]
[WORKING_DIRECTORY dir] [WORKING_DIRECTORY dir]
[COMMENT comment] [VERBATIM] [COMMENT comment]
[VERBATIM] [USES_TERMINAL]
[SOURCES src1 [src2...]]) [SOURCES src1 [src2...]])
Adds a target with the given name that executes the given commands. Adds a target with the given name that executes the given commands.
The target has no output file and is ALWAYS CONSIDERED OUT OF DATE The target has no output file and is *always considered out of date*
even if the commands try to create a file with the name of the target. even if the commands try to create a file with the name of the target.
Use ADD_CUSTOM_COMMAND to generate a file with dependencies. By Use the :command:`add_custom_command` command to generate a file with
default nothing depends on the custom target. Use ADD_DEPENDENCIES to dependencies. By default nothing depends on the custom target. Use
add dependencies to or from other targets. If the ALL option is the :command:`add_dependencies` command to add dependencies to or
specified it indicates that this target should be added to the default from other targets.
build target so that it will be run every time (the command cannot be
called ALL). The command and arguments are optional and if not The options are:
specified an empty target will be created. If WORKING_DIRECTORY is
set, then the command will be run in that directory. If it is a ``ALL``
relative path it will be interpreted relative to the build tree Indicate that this target should be added to the default build
directory corresponding to the current source directory. If COMMENT target so that it will be run every time (the command cannot be
is set, the value will be displayed as a message before the commands called ``ALL``).
are executed at build time. Dependencies listed with the DEPENDS
argument may reference files and outputs of custom commands created ``BYPRODUCTS``
with add_custom_command() in the same directory (CMakeLists.txt file). Specify the files the command is expected to produce but whose
modification time may or may not be updated on subsequent builds.
If VERBATIM is given then all arguments to the commands will be If a byproduct name is a relative path it will be interpreted
escaped properly for the build tool so that the invoked command relative to the build tree directory corresponding to the
receives each argument unchanged. Note that one level of escapes is current source directory.
still used by the CMake language processor before add_custom_target Each byproduct file will be marked with the :prop_sf:`GENERATED`
even sees the arguments. Use of VERBATIM is recommended as it enables source file property automatically.
correct behavior. When VERBATIM is not given the behavior is platform
specific because there is no protection of tool-specific special Explicit specification of byproducts is supported by the
characters. :generator:`Ninja` generator to tell the ``ninja`` build tool
how to regenerate byproducts when they are missing. It is
The SOURCES option specifies additional source files to be included in also useful when other build rules (e.g. custom commands)
the custom target. Specified source files will be added to IDE depend on the byproducts. Ninja requires a build rule for any
project files for convenience in editing even if they have not build generated file on which another rule depends even if there are
rules. order-only dependencies to ensure the byproducts will be
available before their dependents build.
The ``BYPRODUCTS`` option is ignored on non-Ninja generators
except to mark byproducts ``GENERATED``.
``COMMAND``
Specify the command-line(s) to execute at build time.
If more than one ``COMMAND`` is specified they will be executed in order,
but *not* necessarily composed into a stateful shell or batch script.
(To run a full script, use the :command:`configure_file` command or the
:command:`file(GENERATE)` command to create it, and then specify
a ``COMMAND`` to launch it.)
If ``COMMAND`` specifies an executable target (created by the
:command:`add_executable` command) it will automatically be replaced
by the location of the executable created at build time.
Additionally a target-level dependency will be added so that the
executable target will be built before this custom target.
Arguments to ``COMMAND`` may use
:manual:`generator expressions <cmake-generator-expressions(7)>`.
References to target names in generator expressions imply target-level
dependencies.
The command and arguments are optional and if not specified an empty
target will be created.
``COMMENT``
Display the given message before the commands are executed at
build time.
``DEPENDS``
Reference files and outputs of custom commands created with
:command:`add_custom_command` command calls in the same directory
(``CMakeLists.txt`` file). They will be brought up to date when
the target is built.
Use the :command:`add_dependencies` command to add dependencies
on other targets.
``SOURCES``
Specify additional source files to be included in the custom target.
Specified source files will be added to IDE project files for
convenience in editing even if they have no build rules.
``VERBATIM``
All arguments to the commands will be escaped properly for the
build tool so that the invoked command receives each argument
unchanged. Note that one level of escapes is still used by the
CMake language processor before ``add_custom_target`` even sees
the arguments. Use of ``VERBATIM`` is recommended as it enables
correct behavior. When ``VERBATIM`` is not given the behavior
is platform specific because there is no protection of
tool-specific special characters.
``USES_TERMINAL``
The command will be given direct access to the terminal if possible.
With the :generator:`Ninja` generator, this places the command in
the ``console`` :prop_gbl:`pool <JOB_POOLS>`.
``WORKING_DIRECTORY``
Execute the command with the given current working directory.
If it is a relative path it will be interpreted relative to the
build tree directory corresponding to the current source directory.

@ -7,10 +7,12 @@ Adds -D define flags to the compilation of source files.
add_definitions(-DFOO -DBAR ...) add_definitions(-DFOO -DBAR ...)
Adds definitions to the compiler command line for sources in the current Adds definitions to the compiler command line for targets in the current
directory and below. This command can be used to add any flags, but directory and below (whether added before or after this command is invoked).
it is intended to add preprocessor definitions. Flags This command can be used to add any flags, but it is intended to add
beginning in -D or /D that look like preprocessor definitions are preprocessor definitions (see the :command:`add_compile_options` command
to add other flags).
Flags beginning in -D or /D that look like preprocessor definitions are
automatically added to the :prop_dir:`COMPILE_DEFINITIONS` directory automatically added to the :prop_dir:`COMPILE_DEFINITIONS` directory
property for the current directory. Definitions with non-trivial values property for the current directory. Definitions with non-trivial values
may be left in the set of flags instead of being converted for reasons of may be left in the set of flags instead of being converted for reasons of

@ -35,8 +35,11 @@ If ``EXCLUDE_FROM_ALL`` is given the corresponding property will be set on
the created target. See documentation of the :prop_tgt:`EXCLUDE_FROM_ALL` the created target. See documentation of the :prop_tgt:`EXCLUDE_FROM_ALL`
target property for details. target property for details.
See the :manual:`cmake-buildsystem(7)` manual for more on defining Source arguments to ``add_executable`` may use "generator expressions" with
buildsystem properties. the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
manual for available expressions. See the :manual:`cmake-buildsystem(7)`
manual for more on defining buildsystem properties.
-------------------------------------------------------------------------- --------------------------------------------------------------------------

@ -1,8 +1,15 @@
add_library add_library
----------- -----------
.. only:: html
.. contents::
Add a library to the project using the specified source files. Add a library to the project using the specified source files.
Normal Libraries
^^^^^^^^^^^^^^^^
:: ::
add_library(<name> [STATIC | SHARED | MODULE] add_library(<name> [STATIC | SHARED | MODULE]
@ -39,10 +46,13 @@ If ``EXCLUDE_FROM_ALL`` is given the corresponding property will be set on
the created target. See documentation of the :prop_tgt:`EXCLUDE_FROM_ALL` the created target. See documentation of the :prop_tgt:`EXCLUDE_FROM_ALL`
target property for details. target property for details.
See the :manual:`cmake-buildsystem(7)` manual for more on defining buildsystem Source arguments to ``add_library`` may use "generator expressions" with
properties. the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
manual for available expressions. See the :manual:`cmake-buildsystem(7)`
manual for more on defining buildsystem properties.
-------------------------------------------------------------------------- Imported Libraries
^^^^^^^^^^^^^^^^^^
:: ::
@ -63,14 +73,15 @@ variant :prop_tgt:`IMPORTED_LOCATION_<CONFIG>`) which specifies the
location of the main library file on disk. See documentation of the location of the main library file on disk. See documentation of the
``IMPORTED_*`` and ``INTERFACE_*`` properties for more information. ``IMPORTED_*`` and ``INTERFACE_*`` properties for more information.
-------------------------------------------------------------------------- Object Libraries
^^^^^^^^^^^^^^^^
:: ::
add_library(<name> OBJECT <src>...) add_library(<name> OBJECT <src>...)
Creates a special "object library" target. An object library compiles Creates an :ref:`Object Library <Object Libraries>`. An object library
source files but does not archive or link their object files into a compiles source files but does not archive or link their object files into a
library. Instead other targets created by :command:`add_library` or library. Instead other targets created by :command:`add_library` or
:command:`add_executable` may reference the objects using an expression of the :command:`add_executable` may reference the objects using an expression of the
form ``$<TARGET_OBJECTS:objlib>`` as a source, where ``objlib`` is the form ``$<TARGET_OBJECTS:objlib>`` as a source, where ``objlib`` is the
@ -83,7 +94,8 @@ object library name. For example:
will include objlib's object files in a library and an executable will include objlib's object files in a library and an executable
along with those compiled from their own sources. Object libraries along with those compiled from their own sources. Object libraries
may contain only sources (and headers) that compile to object files. may contain only sources that compile, header files, and other files
that would not affect linking of a normal library (e.g. ``.txt``).
They may contain custom commands generating such sources, but not They may contain custom commands generating such sources, but not
``PRE_BUILD``, ``PRE_LINK``, or ``POST_BUILD`` commands. Object libraries ``PRE_BUILD``, ``PRE_LINK``, or ``POST_BUILD`` commands. Object libraries
cannot be imported, exported, installed, or linked. Some native build cannot be imported, exported, installed, or linked. Some native build
@ -91,7 +103,8 @@ systems may not like targets that have only object files, so consider
adding at least one real source file to any target that references adding at least one real source file to any target that references
``$<TARGET_OBJECTS:objlib>``. ``$<TARGET_OBJECTS:objlib>``.
-------------------------------------------------------------------------- Alias Libraries
^^^^^^^^^^^^^^^
:: ::
@ -109,7 +122,8 @@ operand of :command:`set_property`, :command:`set_target_properties`,
:command:`target_link_libraries` etc. An ``ALIAS`` target may not be :command:`target_link_libraries` etc. An ``ALIAS`` target may not be
installed or exported. installed or exported.
-------------------------------------------------------------------------- Interface Libraries
^^^^^^^^^^^^^^^^^^^
:: ::
@ -119,13 +133,17 @@ Creates an :ref:`Interface Library <Interface Libraries>`. An ``INTERFACE``
library target does not directly create build output, though it may library target does not directly create build output, though it may
have properties set on it and it may be installed, exported and have properties set on it and it may be installed, exported and
imported. Typically the ``INTERFACE_*`` properties are populated on imported. Typically the ``INTERFACE_*`` properties are populated on
the interface target using the :command:`set_property`, the interface target using the commands:
:command:`target_link_libraries(INTERFACE)`,
:command:`target_include_directories(INTERFACE)`, * :command:`set_property`,
:command:`target_compile_options(INTERFACE)` * :command:`target_link_libraries(INTERFACE)`,
and :command:`target_compile_definitions(INTERFACE)` commands, and then it * :command:`target_include_directories(INTERFACE)`,
is used as an argument to :command:`target_link_libraries` like any other * :command:`target_compile_options(INTERFACE)`,
target. * :command:`target_compile_definitions(INTERFACE)`, and
* :command:`target_sources(INTERFACE)`,
and then it is used as an argument to :command:`target_link_libraries`
like any other target.
An ``INTERFACE`` :ref:`Imported Target <Imported Targets>` may also be An ``INTERFACE`` :ref:`Imported Target <Imported Targets>` may also be
created with this signature. An ``IMPORTED`` library target references a created with this signature. An ``IMPORTED`` library target references a

@ -8,3 +8,5 @@ Break from an enclosing foreach or while loop.
break() break()
Breaks from an enclosing foreach loop or while loop Breaks from an enclosing foreach loop or while loop
See also the :command:`continue` command.

@ -1,77 +1,93 @@
cmake_policy cmake_policy
------------ ------------
Manage CMake Policy settings. Manage CMake Policy settings. See the :manual:`cmake-policies(7)`
manual for defined policies.
As CMake evolves it is sometimes necessary to change existing behavior As CMake evolves it is sometimes necessary to change existing behavior
in order to fix bugs or improve implementations of existing features. in order to fix bugs or improve implementations of existing features.
The CMake Policy mechanism is designed to help keep existing projects The CMake Policy mechanism is designed to help keep existing projects
building as new versions of CMake introduce changes in behavior. Each building as new versions of CMake introduce changes in behavior. Each
new policy (behavioral change) is given an identifier of the form new policy (behavioral change) is given an identifier of the form
"CMP<NNNN>" where "<NNNN>" is an integer index. Documentation ``CMP<NNNN>`` where ``<NNNN>`` is an integer index. Documentation
associated with each policy describes the OLD and NEW behavior and the associated with each policy describes the ``OLD`` and ``NEW`` behavior
reason the policy was introduced. Projects may set each policy to and the reason the policy was introduced. Projects may set each policy
select the desired behavior. When CMake needs to know which behavior to select the desired behavior. When CMake needs to know which behavior
to use it checks for a setting specified by the project. If no to use it checks for a setting specified by the project. If no
setting is available the OLD behavior is assumed and a warning is setting is available the ``OLD`` behavior is assumed and a warning is
produced requesting that the policy be set. produced requesting that the policy be set.
The cmake_policy command is used to set policies to OLD or NEW Setting Policies by CMake Version
behavior. While setting policies individually is supported, we ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
encourage projects to set policies based on CMake versions.
:: The ``cmake_policy`` command is used to set policies to ``OLD`` or ``NEW``
behavior. While setting policies individually is supported, we
encourage projects to set policies based on CMake versions::
cmake_policy(VERSION major.minor[.patch[.tweak]]) cmake_policy(VERSION major.minor[.patch[.tweak]])
Specify that the current CMake list file is written for the given Specify that the current CMake code is written for the given
version of CMake. All policies introduced in the specified version or version of CMake. All policies introduced in the specified version or
earlier will be set to use NEW behavior. All policies introduced earlier will be set to use ``NEW`` behavior. All policies introduced
after the specified version will be unset (unless variable after the specified version will be unset (unless the
CMAKE_POLICY_DEFAULT_CMP<NNNN> sets a default). This effectively :variable:`CMAKE_POLICY_DEFAULT_CMP<NNNN>` variable sets a default).
requests behavior preferred as of a given CMake version and tells This effectively requests behavior preferred as of a given CMake
newer CMake versions to warn about their new policies. The policy version and tells newer CMake versions to warn about their new policies.
version specified must be at least 2.4 or the command will report an The policy version specified must be at least 2.4 or the command will
error. In order to get compatibility features supporting versions report an error.
earlier than 2.4 see documentation of policy CMP0001.
Note that the :command:`cmake_minimum_required(VERSION)`
command implicitly calls ``cmake_policy(VERSION)`` too.
Setting Policies Explicitly
^^^^^^^^^^^^^^^^^^^^^^^^^^^
:: ::
cmake_policy(SET CMP<NNNN> NEW) cmake_policy(SET CMP<NNNN> NEW)
cmake_policy(SET CMP<NNNN> OLD) cmake_policy(SET CMP<NNNN> OLD)
Tell CMake to use the OLD or NEW behavior for a given policy. Tell CMake to use the ``OLD`` or ``NEW`` behavior for a given policy.
Projects depending on the old behavior of a given policy may silence a Projects depending on the old behavior of a given policy may silence a
policy warning by setting the policy state to OLD. Alternatively one policy warning by setting the policy state to ``OLD``. Alternatively
may fix the project to work with the new behavior and set the policy one may fix the project to work with the new behavior and set the
state to NEW. policy state to ``NEW``.
Checking Policy Settings
^^^^^^^^^^^^^^^^^^^^^^^^
:: ::
cmake_policy(GET CMP<NNNN> <variable>) cmake_policy(GET CMP<NNNN> <variable>)
Check whether a given policy is set to OLD or NEW behavior. The Check whether a given policy is set to ``OLD`` or ``NEW`` behavior.
output variable value will be "OLD" or "NEW" if the policy is set, and The output ``<variable>`` value will be ``OLD`` or ``NEW`` if the
empty otherwise. policy is set, and empty otherwise.
CMake Policy Stack
^^^^^^^^^^^^^^^^^^
CMake keeps policy settings on a stack, so changes made by the CMake keeps policy settings on a stack, so changes made by the
cmake_policy command affect only the top of the stack. A new entry on cmake_policy command affect only the top of the stack. A new entry on
the policy stack is managed automatically for each subdirectory to the policy stack is managed automatically for each subdirectory to
protect its parents and siblings. CMake also manages a new entry for protect its parents and siblings. CMake also manages a new entry for
scripts loaded by include() and find_package() commands except when scripts loaded by :command:`include` and :command:`find_package` commands
invoked with the NO_POLICY_SCOPE option (see also policy CMP0011). except when invoked with the ``NO_POLICY_SCOPE`` option
The cmake_policy command provides an interface to manage custom (see also policy :policy:`CMP0011`).
entries on the policy stack: The ``cmake_policy`` command provides an interface to manage custom
entries on the policy stack::
::
cmake_policy(PUSH) cmake_policy(PUSH)
cmake_policy(POP) cmake_policy(POP)
Each PUSH must have a matching POP to erase any changes. This is Each ``PUSH`` must have a matching ``POP`` to erase any changes.
useful to make temporary changes to policy settings. This is useful to make temporary changes to policy settings.
Calls to the :command:`cmake_minimum_required(VERSION)`,
``cmake_policy(VERSION)``, or ``cmake_policy(SET)`` commands
influence only the current top of the policy stack.
Functions and macros record policy settings when they are created and Commands created by the :command:`function` and :command:`macro`
commands record policy settings when they are created and
use the pre-record policies when they are invoked. If the function or use the pre-record policies when they are invoked. If the function or
macro implementation sets policies, the changes automatically macro implementation sets policies, the changes automatically
propagate up through callers until they reach the closest nested propagate up through callers until they reach the closest nested

@ -9,38 +9,103 @@ Copy a file to another location and modify its contents.
[COPYONLY] [ESCAPE_QUOTES] [@ONLY] [COPYONLY] [ESCAPE_QUOTES] [@ONLY]
[NEWLINE_STYLE [UNIX|DOS|WIN32|LF|CRLF] ]) [NEWLINE_STYLE [UNIX|DOS|WIN32|LF|CRLF] ])
Copies a file <input> to file <output> and substitutes variable values Copies an ``<input>`` file to an ``<output>`` file and substitutes
referenced in the file content. If <input> is a relative path it is variable values referenced as ``@VAR@`` or ``${VAR}`` in the input
evaluated with respect to the current source directory. The <input> file content. Each variable reference will be replaced with the
must be a file, not a directory. If <output> is a relative path it is current value of the variable, or the empty string if the variable
evaluated with respect to the current binary directory. If <output> is not defined. Furthermore, input lines of the form::
names an existing directory the input file is placed in that directory
with its original name. #cmakedefine VAR ...
If the <input> file is modified the build system will re-run CMake to will be replaced with either::
#define VAR ...
or::
/* #undef VAR */
depending on whether ``VAR`` is set in CMake to any value not considered
a false constant by the :command:`if` command. The "..." content on the
line after the variable name, if any, is processed as above.
Input file lines of the form ``#cmakedefine01 VAR`` will be replaced with
either ``#define VAR 1`` or ``#define VAR 0`` similarly.
If the input file is modified the build system will re-run CMake to
re-configure the file and generate the build system again. re-configure the file and generate the build system again.
This command replaces any variables in the input file referenced as The arguments are:
${VAR} or @VAR@ with their values as determined by CMake. If a
variable is not defined, it will be replaced with nothing. If
COPYONLY is specified, then no variable expansion will take place. If
ESCAPE_QUOTES is specified then any substituted quotes will be C-style
escaped. The file will be configured with the current values of CMake
variables. If @ONLY is specified, only variables of the form @VAR@
will be replaced and ${VAR} will be ignored. This is useful for
configuring scripts that use ${VAR}.
Input file lines of the form "#cmakedefine VAR ..." will be replaced
with either "#define VAR ..." or ``/* #undef VAR */`` depending on
whether VAR is set in CMake to any value not considered a false
constant by the if() command. (Content of "...", if any, is processed
as above.) Input file lines of the form "#cmakedefine01 VAR" will be
replaced with either "#define VAR 1" or "#define VAR 0" similarly.
With NEWLINE_STYLE the line ending could be adjusted:
:: ``<input>``
Path to the input file. A relative path is treated with respect to
the value of :variable:`CMAKE_CURRENT_SOURCE_DIR`. The input path
must be a file, not a directory.
``<output>``
Path to the output file or directory. A relative path is treated
with respect to the value of :variable:`CMAKE_CURRENT_BINARY_DIR`.
If the path names an existing directory the output file is placed
in that directory with the same file name as the input file.
``COPYONLY``
Copy the file without replacing any variable references or other
content. This option may not be used with ``NEWLINE_STYLE``.
``ESCAPE_QUOTES``
Escape any substituted quotes with backslashes (C-style).
``@ONLY``
Restrict variable replacement to references of the form ``@VAR@``.
This is useful for configuring scripts that use ``${VAR}`` syntax.
``NEWLINE_STYLE <style>``
Specify the newline style for the output file. Specify
``UNIX`` or ``LF`` for ``\n`` newlines, or specify
``DOS``, ``WIN32``, or ``CRLF`` for ``\r\n`` newlines.
This option may not be used with ``COPYONLY``.
Example
^^^^^^^
Consider a source tree containing a ``foo.h.in`` file:
.. code-block:: c
#cmakedefine FOO_ENABLE
#cmakedefine FOO_STRING "@FOO_STRING@"
An adjacent ``CMakeLists.txt`` may use ``configure_file`` to
configure the header:
.. code-block:: cmake
option(FOO_ENABLE "Enable Foo" ON)
if(FOO_ENABLE)
set(FOO_STRING "foo")
endif()
configure_file(foo.h.in foo.h @ONLY)
This creates a ``foo.h`` in the build directory corresponding to
this source directory. If the ``FOO_ENABLE`` option is on, the
configured file will contain:
.. code-block:: c
#define FOO_ENABLE
#define FOO_STRING "foo"
Otherwise it will contain:
.. code-block:: c
/* #undef FOO_ENABLE */
/* #undef FOO_STRING */
One may then use the :command:`include_directories` command to
specify the output directory as an include directory:
.. code-block:: cmake
'UNIX' or 'LF' for \n, 'DOS', 'WIN32' or 'CRLF' for \r\n. include_directories(${CMAKE_CURRENT_BINARY_DIR})
COPYONLY must not be used with NEWLINE_STYLE. so that sources may include the header as ``#include <foo.h>``.

@ -0,0 +1,12 @@
continue
--------
Continue to the top of enclosing foreach or while loop.
::
continue()
The ``continue`` command allows a cmake script to abort the rest of a block
in a :command:`foreach` or :command:`while` loop, and start at the top of
the next iteration. See also the :command:`break` command.

@ -22,3 +22,8 @@ of build errors and warnings detected.
The APPEND option marks results for append to those previously The APPEND option marks results for append to those previously
submitted to a dashboard server since the last ctest_start. Append submitted to a dashboard server since the last ctest_start. Append
semantics are defined by the dashboard server in use. semantics are defined by the dashboard server in use.
If set, the contents of the variable CTEST_BUILD_FLAGS are passed as
additional arguments to the underlying build command. This can e.g. be
used to trigger a parallel build using the -j option of make. See
:module:`ProcessorCount` for an example.

@ -10,7 +10,15 @@ Starts the testing for a given model
Starts the testing for a given model. The command should be called Starts the testing for a given model. The command should be called
after the binary directory is initialized. If the 'source' and after the binary directory is initialized. If the 'source' and
'binary' directory are not specified, it reads the 'binary' directory are not specified, it reads the
CTEST_SOURCE_DIRECTORY and CTEST_BINARY_DIRECTORY. If the track is :variable:`CTEST_SOURCE_DIRECTORY` and :variable:`CTEST_BINARY_DIRECTORY`.
If the track is
specified, the submissions will go to the specified track. If APPEND specified, the submissions will go to the specified track. If APPEND
is used, the existing TAG is used rather than creating a new one based is used, the existing TAG is used rather than creating a new one based
on the current time stamp. on the current time stamp.
If the :variable:`CTEST_CHECKOUT_COMMAND` variable
(or the :variable:`CTEST_CVS_CHECKOUT` variable)
is set, its content is treated as command-line. The command is
invoked with the current working directory set to the parent of the source
directory, even if the source directory already exists. This can be used
to create the source tree from a version control repository.

@ -5,7 +5,11 @@ Submit results to a dashboard server.
:: ::
ctest_submit([PARTS ...] [FILES ...] [RETRY_COUNT count] [RETRY_DELAY delay][RETURN_VALUE res]) ctest_submit([PARTS ...] [FILES ...]
[RETRY_COUNT count]
[RETRY_DELAY delay]
[RETURN_VALUE res]
)
By default all available parts are submitted if no PARTS or FILES are By default all available parts are submitted if no PARTS or FILES are
specified. The PARTS option lists a subset of parts to be submitted. specified. The PARTS option lists a subset of parts to be submitted.
@ -33,3 +37,16 @@ timed-out submission before attempting to re-submit.
The RETRY_COUNT option specifies how many times to retry a timed-out The RETRY_COUNT option specifies how many times to retry a timed-out
submission. submission.
Submit to CDash Upload API
^^^^^^^^^^^^^^^^^^^^^^^^^^
::
ctest_submit(CDASH_UPLOAD <file> [CDASH_UPLOAD_TYPE <type>])
This second signature is used to upload files to CDash via the CDash
file upload API. The api first sends a request to upload to CDash along
with a content hash of the file. If CDash does not already have the file,
then it is uploaded. Along with the file, a CDash type string is specified
to tell CDash which handler to use to process the data.

@ -51,4 +51,7 @@ projects find and use a package from the current project's build tree
without help from the user. Note that the entry in the package without help from the user. Note that the entry in the package
registry that this command creates works only in conjunction with a registry that this command creates works only in conjunction with a
package configuration file (<name>Config.cmake) that works with the package configuration file (<name>Config.cmake) that works with the
build tree. build tree. In some cases, for example for packaging and for system
wide installations, it is not desirable to write the user package
registry. If the :variable:`CMAKE_EXPORT_NO_PACKAGE_REGISTRY` variable
is enabled, the ``export(PACKAGE)`` command will do nothing.

@ -3,211 +3,340 @@ file
File manipulation command. File manipulation command.
:: ------------------------------------------------------------------------------
file(WRITE filename "message to write"... ) ::
file(APPEND filename "message to write"... )
file(READ filename variable [LIMIT numBytes] [OFFSET offset] [HEX])
file(<MD5|SHA1|SHA224|SHA256|SHA384|SHA512> filename variable)
file(STRINGS filename variable [LIMIT_COUNT num]
[LIMIT_INPUT numBytes] [LIMIT_OUTPUT numBytes]
[LENGTH_MINIMUM numBytes] [LENGTH_MAXIMUM numBytes]
[NEWLINE_CONSUME] [REGEX regex]
[NO_HEX_CONVERSION])
file(GLOB variable [RELATIVE path] [globbing expressions]...)
file(GLOB_RECURSE variable [RELATIVE path]
[FOLLOW_SYMLINKS] [globbing expressions]...)
file(RENAME <oldname> <newname>)
file(REMOVE [file1 ...])
file(REMOVE_RECURSE [file1 ...])
file(MAKE_DIRECTORY [directory1 directory2 ...])
file(RELATIVE_PATH variable directory file)
file(TO_CMAKE_PATH path result)
file(TO_NATIVE_PATH path result)
file(DOWNLOAD url file [INACTIVITY_TIMEOUT timeout]
[TIMEOUT timeout] [STATUS status] [LOG log] [SHOW_PROGRESS]
[EXPECTED_HASH ALGO=value] [EXPECTED_MD5 sum]
[TLS_VERIFY on|off] [TLS_CAINFO file])
file(UPLOAD filename url [INACTIVITY_TIMEOUT timeout]
[TIMEOUT timeout] [STATUS status] [LOG log] [SHOW_PROGRESS])
file(TIMESTAMP filename variable [<format string>] [UTC])
file(GENERATE OUTPUT output_file
<INPUT input_file|CONTENT input_content>
[CONDITION expression])
WRITE will write a message into a file called 'filename'. It file(WRITE <filename> <content>...)
overwrites the file if it already exists, and creates the file if it file(APPEND <filename> <content>...)
does not exist. (If the file is a build input, use configure_file to
update the file only when its content changes.)
APPEND will write a message into a file same as WRITE, except it will Write ``<content>`` into a file called ``<filename>``. If the file does
append it to the end of the file not exist, it will be created. If the file already exists, ``WRITE``
mode will overwrite it and ``APPEND`` mode will append to the end.
(If the file is a build input, use the :command:`configure_file` command
to update the file only when its content changes.)
READ will read the content of a file and store it into the variable. ------------------------------------------------------------------------------
It will start at the given offset and read up to numBytes. If the
argument HEX is given, the binary data will be converted to
hexadecimal representation and this will be stored in the variable.
MD5, SHA1, SHA224, SHA256, SHA384, and SHA512 will compute a ::
cryptographic hash of the content of a file.
STRINGS will parse a list of ASCII strings from a file and store it in file(READ <filename> <variable>
a variable. Binary data in the file are ignored. Carriage return [OFFSET <offset>] [LIMIT <max-in>] [HEX])
(CR) characters are ignored. It works also for Intel Hex and Motorola
S-record files, which are automatically converted to binary format
when reading them. Disable this using NO_HEX_CONVERSION.
LIMIT_COUNT sets the maximum number of strings to return. LIMIT_INPUT Read content from a file called ``<filename>`` and store it in a
sets the maximum number of bytes to read from the input file. ``<variable>``. Optionally start from the given ``<offset>`` and
LIMIT_OUTPUT sets the maximum number of bytes to store in the output read at most ``<max-in>`` bytes. The ``HEX`` option causes data to
variable. LENGTH_MINIMUM sets the minimum length of a string to be converted to a hexadecimal representation (useful for binary data).
return. Shorter strings are ignored. LENGTH_MAXIMUM sets the maximum
length of a string to return. Longer strings are split into strings
no longer than the maximum length. NEWLINE_CONSUME allows newlines to
be included in strings instead of terminating them.
REGEX specifies a regular expression that a string must match to be ------------------------------------------------------------------------------
returned. Typical usage
:: ::
file(STRINGS <filename> <variable> [<options>...])
Parse a list of ASCII strings from ``<filename>`` and store it in
``<variable>``. Binary data in the file are ignored. Carriage return
(``\r``, CR) characters are ignored. The options are:
``LENGTH_MAXIMUM <max-len>``
Consider only strings of at most a given length.
``LENGTH_MINIMUM <min-len>``
Consider only strings of at least a given length.
``LIMIT_COUNT <max-num>``
Limit the number of distinct strings to be extracted.
``LIMIT_INPUT <max-in>``
Limit the number of input bytes to read from the file.
``LIMIT_OUTPUT <max-out>``
Limit the number of total bytes to store in the ``<variable>``.
``NEWLINE_CONSUME``
Treat newline characters (``\n``, LF) as part of string content
instead of terminating at them.
``NO_HEX_CONVERSION``
Intel Hex and Motorola S-record files are automatically converted to
binary while reading unless this option is given.
``REGEX <regex>``
Consider only strings that match the given regular expression.
``ENCODING <encoding-type>``
Consider strings of a given encoding. Currently supported encodings are:
UTF-8, UTF-16LE, UTF-16BE, UTF-32LE, UTF-32BE. If the ENCODING option
is not provided and the file has a Byte Order Mark, the ENCODING option
will be defaulted to respect the Byte Order Mark.
For example, the code
.. code-block:: cmake
file(STRINGS myfile.txt myfile) file(STRINGS myfile.txt myfile)
stores a list in the variable "myfile" in which each item is a line stores a list in the variable ``myfile`` in which each item is a line
from the input file. from the input file.
GLOB will generate a list of all files that match the globbing ------------------------------------------------------------------------------
expressions and store it into the variable. Globbing expressions are
similar to regular expressions, but much simpler. If RELATIVE flag is
specified for an expression, the results will be returned as a
relative path to the given path. (We do not recommend using GLOB to
collect a list of source files from your source tree. If no
CMakeLists.txt file changes when a source is added or removed then the
generated build system cannot know when to ask CMake to regenerate.)
Examples of globbing expressions include: ::
file(<MD5|SHA1|SHA224|SHA256|SHA384|SHA512> <filename> <variable>)
Compute a cryptographic hash of the content of ``<filename>`` and
store it in a ``<variable>``.
------------------------------------------------------------------------------
:: ::
file(GLOB <variable> [RELATIVE <path>] [<globbing-expressions>...])
file(GLOB_RECURSE <variable> [RELATIVE <path>]
[FOLLOW_SYMLINKS] [<globbing-expressions>...])
Generate a list of files that match the ``<globbing-expressions>`` and
store it into the ``<variable>``. Globbing expressions are similar to
regular expressions, but much simpler. If ``RELATIVE`` flag is
specified, the results will be returned as relative paths to the given
path.
.. note::
We do not recommend using GLOB to collect a list of source files from
your source tree. If no CMakeLists.txt file changes when a source is
added or removed then the generated build system cannot know when to
ask CMake to regenerate.
Examples of globbing expressions include::
*.cxx - match all files with extension cxx *.cxx - match all files with extension cxx
*.vt? - match all files with extension vta,...,vtz *.vt? - match all files with extension vta,...,vtz
f[3-5].txt - match files f3.txt, f4.txt, f5.txt f[3-5].txt - match files f3.txt, f4.txt, f5.txt
GLOB_RECURSE will generate a list similar to the regular GLOB, except The ``GLOB_RECURSE`` mode will traverse all the subdirectories of the
it will traverse all the subdirectories of the matched directory and matched directory and match the files. Subdirectories that are symlinks
match the files. Subdirectories that are symlinks are only traversed are only traversed if ``FOLLOW_SYMLINKS`` is given or policy
if FOLLOW_SYMLINKS is given or cmake policy CMP0009 is not set to NEW. :policy:`CMP0009` is not set to ``NEW``.
See cmake --help-policy CMP0009 for more information.
Examples of recursive globbing include::
Examples of recursive globbing include: /dir/*.py - match all python files in /dir and subdirectories
------------------------------------------------------------------------------
:: ::
/dir/*.py - match all python files in /dir and subdirectories file(RENAME <oldname> <newname>)
Move a file or directory within a filesystem from ``<oldname>`` to
``<newname>``, replacing the destination atomically.
------------------------------------------------------------------------------
::
file(REMOVE [<files>...])
file(REMOVE_RECURSE [<files>...])
Remove the given files. The ``REMOVE_RECURSE`` mode will remove the given
files and directories, also non-empty directories
------------------------------------------------------------------------------
::
file(MAKE_DIRECTORY [<directories>...])
Create the given directories and their parents as needed.
------------------------------------------------------------------------------
::
file(RELATIVE_PATH <variable> <directory> <file>)
Compute the relative path from a ``<directory>`` to a ``<file>`` and
store it in the ``<variable>``.
MAKE_DIRECTORY will create the given directories, also if their parent ------------------------------------------------------------------------------
directories don't exist yet
RENAME moves a file or directory within a filesystem, replacing the
destination atomically.
REMOVE will remove the given files, also in subdirectories
REMOVE_RECURSE will remove the given files and directories, also
non-empty directories
RELATIVE_PATH will determine relative path from directory to the given
file.
TO_CMAKE_PATH will convert path into a cmake style path with unix /.
The input can be a single path or a system path like "$ENV{PATH}".
Note the double quotes around the ENV call TO_CMAKE_PATH only takes
one argument. This command will also convert the native list
delimiters for a list of paths like the PATH environment variable.
TO_NATIVE_PATH works just like TO_CMAKE_PATH, but will convert from a
cmake style path into the native path style \ for windows and / for
UNIX.
DOWNLOAD will download the given URL to the given file. If LOG var is
specified a log of the download will be put in var. If STATUS var is
specified the status of the operation will be put in var. The status
is returned in a list of length 2. The first element is the numeric
return value for the operation, and the second element is a string
value for the error. A 0 numeric error means no error in the
operation. If TIMEOUT time is specified, the operation will timeout
after time seconds, time should be specified as an integer. The
INACTIVITY_TIMEOUT specifies an integer number of seconds of
inactivity after which the operation should terminate. If
EXPECTED_HASH ALGO=value is specified, the operation will verify that
the downloaded file's actual hash matches the expected value, where
ALGO is one of MD5, SHA1, SHA224, SHA256, SHA384, or SHA512. If it
does not match, the operation fails with an error. ("EXPECTED_MD5
sum" is short-hand for "EXPECTED_HASH MD5=sum".) If SHOW_PROGRESS is
specified, progress information will be printed as status messages
until the operation is complete. For https URLs CMake must be built
with OpenSSL. TLS/SSL certificates are not checked by default. Set
TLS_VERIFY to ON to check certificates and/or use EXPECTED_HASH to
verify downloaded content. Set TLS_CAINFO to specify a custom
Certificate Authority file. If either TLS option is not given CMake
will check variables CMAKE_TLS_VERIFY and CMAKE_TLS_CAINFO,
respectively.
UPLOAD will upload the given file to the given URL. If LOG var is
specified a log of the upload will be put in var. If STATUS var is
specified the status of the operation will be put in var. The status
is returned in a list of length 2. The first element is the numeric
return value for the operation, and the second element is a string
value for the error. A 0 numeric error means no error in the
operation. If TIMEOUT time is specified, the operation will timeout
after time seconds, time should be specified as an integer. The
INACTIVITY_TIMEOUT specifies an integer number of seconds of
inactivity after which the operation should terminate. If
SHOW_PROGRESS is specified, progress information will be printed as
status messages until the operation is complete.
TIMESTAMP will write a string representation of the modification time
of filename to variable.
Should the command be unable to obtain a timestamp variable will be
set to the empty string "".
See documentation of the string TIMESTAMP sub-command for more
details.
The file() command also provides COPY and INSTALL signatures:
:: ::
file(<COPY|INSTALL> files... DESTINATION <dir> file(TO_CMAKE_PATH "<path>" <variable>)
[FILE_PERMISSIONS permissions...] file(TO_NATIVE_PATH "<path>" <variable>)
[DIRECTORY_PERMISSIONS permissions...]
The ``TO_CMAKE_PATH`` mode converts a native ``<path>`` into a cmake-style
path with forward-slashes (``/``). The input can be a single path or a
system search path like ``$ENV{PATH}``. A search path will be converted
to a cmake-style list separated by ``;`` characters.
The ``TO_NATIVE_PATH`` mode converts a cmake-style ``<path>`` into a native
path with platform-specific slashes (``\`` on Windows and ``/`` elsewhere).
Always use double quotes around the ``<path>`` to be sure it is treated
as a single argument to this command.
------------------------------------------------------------------------------
::
file(DOWNLOAD <url> <file> [<options>...])
file(UPLOAD <file> <url> [<options>...])
The ``DOWNLOAD`` mode downloads the given ``<url>`` to a local ``<file>``.
The ``UPLOAD`` mode uploads a local ``<file>`` to a given ``<url>``.
Options to both ``DOWNLOAD`` and ``UPLOAD`` are:
``INACTIVITY_TIMEOUT <seconds>``
Terminate the operation after a period of inactivity.
``LOG <variable>``
Store a human-readable log of the operation in a variable.
``SHOW_PROGRESS``
Print progress information as status messages until the operation is
complete.
``STATUS <variable>``
Store the resulting status of the operation in a variable.
The status is a ``;`` separated list of length 2.
The first element is the numeric return value for the operation,
and the second element is a string value for the error.
A ``0`` numeric error means no error in the operation.
``TIMEOUT <seconds>``
Terminate the operation after a given total time has elapsed.
Additional options to ``DOWNLOAD`` are:
``EXPECTED_HASH ALGO=<value>``
Verify that the downloaded content hash matches the expected value, where
``ALGO`` is one of ``MD5``, ``SHA1``, ``SHA224``, ``SHA256``, ``SHA384``, or
``SHA512``. If it does not match, the operation fails with an error.
``EXPECTED_MD5 <value>``
Historical short-hand for ``EXPECTED_HASH MD5=<value>``.
``TLS_VERIFY <ON|OFF>``
Specify whether to verify the server certificate for ``https://`` URLs.
The default is to *not* verify.
``TLS_CAINFO <file>``
Specify a custom Certificate Authority file for ``https://`` URLs.
For ``https://`` URLs CMake must be built with OpenSSL support. ``TLS/SSL``
certificates are not checked by default. Set ``TLS_VERIFY`` to ``ON`` to
check certificates and/or use ``EXPECTED_HASH`` to verify downloaded content.
If neither ``TLS`` option is given CMake will check variables
``CMAKE_TLS_VERIFY`` and ``CMAKE_TLS_CAINFO``, respectively.
------------------------------------------------------------------------------
::
file(TIMESTAMP <filename> <variable> [<format>] [UTC])
Compute a string representation of the modification time of ``<filename>``
and store it in ``<variable>``. Should the command be unable to obtain a
timestamp variable will be set to the empty string ("").
See the :command:`string(TIMESTAMP)` command for documentation of
the ``<format>`` and ``UTC`` options.
------------------------------------------------------------------------------
::
file(GENERATE OUTPUT output-file
<INPUT input-file|CONTENT content>
[CONDITION expression])
Generate an output file for each build configuration supported by the current
:manual:`CMake Generator <cmake-generators(7)>`. Evaluate
:manual:`generator expressions <cmake-generator-expressions(7)>`
from the input content to produce the output content. The options are:
``CONDITION <condition>``
Generate the output file for a particular configuration only if
the condition is true. The condition must be either ``0`` or ``1``
after evaluating generator expressions.
``CONTENT <content>``
Use the content given explicitly as input.
``INPUT <input-file>``
Use the content from a given file as input.
``OUTPUT <output-file>``
Specify the output file name to generate. Use generator expressions
such as ``$<CONFIG>`` to specify a configuration-specific output file
name. Multiple configurations may generate the same output file only
if the generated content is identical. Otherwise, the ``<output-file>``
must evaluate to an unique name for each configuration.
Exactly one ``CONTENT`` or ``INPUT`` option must be given. A specific
``OUTPUT`` file may be named by at most one invocation of ``file(GENERATE)``.
Generated files are modified on subsequent cmake runs only if their content
is changed.
------------------------------------------------------------------------------
::
file(<COPY|INSTALL> <files>... DESTINATION <dir>
[FILE_PERMISSIONS <permissions>...]
[DIRECTORY_PERMISSIONS <permissions>...]
[NO_SOURCE_PERMISSIONS] [USE_SOURCE_PERMISSIONS] [NO_SOURCE_PERMISSIONS] [USE_SOURCE_PERMISSIONS]
[FILES_MATCHING] [FILES_MATCHING]
[[PATTERN <pattern> | REGEX <regex>] [[PATTERN <pattern> | REGEX <regex>]
[EXCLUDE] [PERMISSIONS permissions...]] [...]) [EXCLUDE] [PERMISSIONS <permissions>...]] [...])
The COPY signature copies files, directories, and symlinks to a The ``COPY`` signature copies files, directories, and symlinks to a
destination folder. Relative input paths are evaluated with respect destination folder. Relative input paths are evaluated with respect
to the current source directory, and a relative destination is to the current source directory, and a relative destination is
evaluated with respect to the current build directory. Copying evaluated with respect to the current build directory. Copying
preserves input file timestamps, and optimizes out a file if it exists preserves input file timestamps, and optimizes out a file if it exists
at the destination with the same timestamp. Copying preserves input at the destination with the same timestamp. Copying preserves input
permissions unless explicit permissions or NO_SOURCE_PERMISSIONS are permissions unless explicit permissions or ``NO_SOURCE_PERMISSIONS``
given (default is USE_SOURCE_PERMISSIONS). See the install(DIRECTORY) are given (default is ``USE_SOURCE_PERMISSIONS``).
command for documentation of permissions, PATTERN, REGEX, and EXCLUDE See the :command:`install(DIRECTORY)` command for documentation of
options. permissions, ``PATTERN``, ``REGEX``, and ``EXCLUDE`` options.
The INSTALL signature differs slightly from COPY: it prints status The ``INSTALL`` signature differs slightly from ``COPY``: it prints
messages, and NO_SOURCE_PERMISSIONS is default. Installation scripts status messages (subject to the :variable:`CMAKE_INSTALL_MESSAGE` variable),
generated by the install() command use this signature (with some and ``NO_SOURCE_PERMISSIONS`` is default.
undocumented options for internal use). Installation scripts generated by the :command:`install` command
use this signature (with some undocumented options for internal use).
GENERATE will write an <output_file> with content from an
<input_file>, or from <input_content>. The output is generated ------------------------------------------------------------------------------
conditionally based on the content of the <condition>. The file is
written at CMake generate-time and the input may contain generator ::
expressions. The <condition>, <output_file> and <input_file> may also
contain generator expressions. The <condition> must evaluate to file(LOCK <path> [DIRECTORY] [RELEASE]
either '0' or '1'. The <output_file> must evaluate to a unique name [GUARD <FUNCTION|FILE|PROCESS>]
among all configurations and among all invocations of file(GENERATE). [RESULT_VARIABLE <variable>]
[TIMEOUT <seconds>])
Lock a file specified by ``<path>`` if no ``DIRECTORY`` option present and file
``<path>/cmake.lock`` otherwise. File will be locked for scope defined by
``GUARD`` option (default value is ``PROCESS``). ``RELEASE`` option can be used
to unlock file explicitly. If option ``TIMEOUT`` is not specified CMake will
wait until lock succeed or until fatal error occurs. If ``TIMEOUT`` is set to
``0`` lock will be tried once and result will be reported immediately. If
``TIMEOUT`` is not ``0`` CMake will try to lock file for the period specified
by ``<seconds>`` value. Any errors will be interpreted as fatal if there is no
``RESULT_VARIABLE`` option. Otherwise result will be stored in ``<variable>``
and will be ``0`` on success or error message on failure.
Note that lock is advisory - there is no guarantee that other processes will
respect this lock, i.e. lock synchronize two or more CMake instances sharing
some modifiable resources. Similar logic applied to ``DIRECTORY`` option -
locking parent directory doesn't prevent other ``LOCK`` commands to lock any
child directory or file.
Trying to lock file twice is not allowed. Any intermediate directories and
file itself will be created if they not exist. ``GUARD`` and ``TIMEOUT``
options ignored on ``RELEASE`` operation.

@ -272,7 +272,9 @@ enabled.
(This step is implemented only on Windows.) (This step is implemented only on Windows.)
6. Search paths stored in the CMake :ref:`User Package Registry`. 6. Search paths stored in the CMake :ref:`User Package Registry`.
This can be skipped if ``NO_CMAKE_PACKAGE_REGISTRY`` is passed. This can be skipped if ``NO_CMAKE_PACKAGE_REGISTRY`` is passed or by
setting the :variable:`CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY`
to ``TRUE``.
See the :manual:`cmake-packages(7)` manual for details on the user See the :manual:`cmake-packages(7)` manual for details on the user
package registry. package registry.
@ -285,7 +287,9 @@ enabled.
CMAKE_SYSTEM_APPBUNDLE_PATH CMAKE_SYSTEM_APPBUNDLE_PATH
8. Search paths stored in the CMake :ref:`System Package Registry`. 8. Search paths stored in the CMake :ref:`System Package Registry`.
This can be skipped if ``NO_CMAKE_SYSTEM_PACKAGE_REGISTRY`` is passed. This can be skipped if ``NO_CMAKE_SYSTEM_PACKAGE_REGISTRY`` is passed
or by setting the
:variable:`CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY` to ``TRUE``.
See the :manual:`cmake-packages(7)` manual for details on the system See the :manual:`cmake-packages(7)` manual for details on the system
package registry. package registry.
@ -308,6 +312,8 @@ When loading a find module or package configuration file ``find_package``
defines variables to provide information about the call arguments (and defines variables to provide information about the call arguments (and
restores their original state before returning): restores their original state before returning):
``CMAKE_FIND_PACKAGE_NAME``
the ``<package>`` name which is searched for
``<package>_FIND_REQUIRED`` ``<package>_FIND_REQUIRED``
true if ``REQUIRED`` option was given true if ``REQUIRED`` option was given
``<package>_FIND_QUIETLY`` ``<package>_FIND_QUIETLY``

@ -10,6 +10,7 @@ Get a property.
DIRECTORY [dir] | DIRECTORY [dir] |
TARGET <target> | TARGET <target> |
SOURCE <source> | SOURCE <source> |
INSTALL <file> |
TEST <test> | TEST <test> |
CACHE <entry> | CACHE <entry> |
VARIABLE> VARIABLE>
@ -21,29 +22,40 @@ specifies the variable in which to store the result. The second
argument determines the scope from which to get the property. It must argument determines the scope from which to get the property. It must
be one of the following: be one of the following:
GLOBAL scope is unique and does not accept a name. ``GLOBAL``
Scope is unique and does not accept a name.
DIRECTORY scope defaults to the current directory but another ``DIRECTORY``
Scope defaults to the current directory but another
directory (already processed by CMake) may be named by full or directory (already processed by CMake) may be named by full or
relative path. relative path.
TARGET scope must name one existing target. ``TARGET``
Scope must name one existing target.
SOURCE scope must name one source file. ``SOURCE``
Scope must name one source file.
TEST scope must name one existing test. ``INSTALL``
Scope must name one installed file path.
CACHE scope must name one cache entry. ``TEST``
Scope must name one existing test.
VARIABLE scope is unique and does not accept a name. ``CACHE``
Scope must name one cache entry.
The required PROPERTY option is immediately followed by the name of ``VARIABLE``
Scope is unique and does not accept a name.
The required ``PROPERTY`` option is immediately followed by the name of
the property to get. If the property is not set an empty value is the property to get. If the property is not set an empty value is
returned. If the SET option is given the variable is set to a boolean returned. If the ``SET`` option is given the variable is set to a boolean
value indicating whether the property has been set. If the DEFINED value indicating whether the property has been set. If the ``DEFINED``
option is given the variable is set to a boolean value indicating option is given the variable is set to a boolean value indicating
whether the property has been defined such as with define_property. whether the property has been defined such as with the
If BRIEF_DOCS or FULL_DOCS is given then the variable is set to a :command:`define_property` command.
If ``BRIEF_DOCS`` or ``FULL_DOCS`` is given then the variable is set to a
string containing documentation for the requested property. If string containing documentation for the requested property. If
documentation is requested for a property that has not been defined documentation is requested for a property that has not been defined
NOTFOUND is returned. ``NOTFOUND`` is returned.

@ -7,9 +7,9 @@ Get a property of the test.
get_test_property(test property VAR) get_test_property(test property VAR)
Get a property from the Test. The value of the property is stored in Get a property from the test. The value of the property is stored in
the variable VAR. If the property is not found, VAR will be set to the variable VAR. If the test or property is not found, VAR will be
"NOTFOUND". For a list of standard properties you can type cmake set to "NOTFOUND". For a list of standard properties you can type cmake
--help-property-list --help-property-list.
See also the more general get_property() command. See also the more general get_property() command.

@ -42,11 +42,12 @@ Possible expressions are:
or a non-zero number. False if the constant is ``0``, ``OFF``, or a non-zero number. False if the constant is ``0``, ``OFF``,
``NO``, ``FALSE``, ``N``, ``IGNORE``, ``NOTFOUND``, the empty string, ``NO``, ``FALSE``, ``N``, ``IGNORE``, ``NOTFOUND``, the empty string,
or ends in the suffix ``-NOTFOUND``. Named boolean constants are or ends in the suffix ``-NOTFOUND``. Named boolean constants are
case-insensitive. If the argument is not one of these constants, it case-insensitive. If the argument is not one of these specific
is treated as a variable. constants, it is treated as a variable or string and the following
signature is used.
``if(<variable>)`` ``if(<variable|string>)``
True if the variable is defined to a value that is not a false True if given a variable that is defined to a value that is not a false
constant. False otherwise. (Note macro arguments are not variables.) constant. False otherwise. (Note macro arguments are not variables.)
``if(NOT <expression>)`` ``if(NOT <expression>)``
@ -199,3 +200,9 @@ above-documented signature accepts ``<variable|string>``:
* The left and right hand arguments to ``AND`` and ``OR`` are independently * The left and right hand arguments to ``AND`` and ``OR`` are independently
tested to see if they are boolean constants, if so they are used as tested to see if they are boolean constants, if so they are used as
such, otherwise they are assumed to be variables and are dereferenced. such, otherwise they are assumed to be variables and are dereferenced.
To prevent ambiguity, potential variable or keyword names can be
specified in a :ref:`Quoted Argument` or a :ref:`Bracket Argument`.
A quoted or bracketed variable or keyword will be interpreted as a
string and not dereferenced or interpreted.
See policy :policy:`CMP0054`.

@ -1,8 +1,15 @@
install install
------- -------
.. only:: html
.. contents::
Specify rules to run at install time. Specify rules to run at install time.
Introduction
^^^^^^^^^^^^
This command generates installation rules for a project. Rules This command generates installation rules for a project. Rules
specified by calls to this command within a source directory are specified by calls to this command within a source directory are
executed in order during installation. The order across directories executed in order during installation. The order across directories
@ -52,7 +59,12 @@ signatures that specify them. The common options are:
Specify that it is not an error if the file to be installed does Specify that it is not an error if the file to be installed does
not exist. not exist.
------------------------------------------------------------------------------ Command signatures that install files may print messages during
installation. Use the :variable:`CMAKE_INSTALL_MESSAGE` variable
to control which messages are printed.
Installing Targets
^^^^^^^^^^^^^^^^^^
:: ::
@ -147,7 +159,8 @@ file itself, call ``install(EXPORT)``, documented below.
Installing a target with the :prop_tgt:`EXCLUDE_FROM_ALL` target property Installing a target with the :prop_tgt:`EXCLUDE_FROM_ALL` target property
set to ``TRUE`` has undefined behavior. set to ``TRUE`` has undefined behavior.
------------------------------------------------------------------------------ Installing Files
^^^^^^^^^^^^^^^^
:: ::
@ -175,14 +188,15 @@ The list of ``files...`` given to ``FILES`` or ``PROGRAMS`` may use
However, if any item begins in a generator expression it must evaluate However, if any item begins in a generator expression it must evaluate
to a full path. to a full path.
------------------------------------------------------------------------------ Installing Directories
^^^^^^^^^^^^^^^^^^^^^^
:: ::
install(DIRECTORY dirs... DESTINATION <dir> install(DIRECTORY dirs... DESTINATION <dir>
[FILE_PERMISSIONS permissions...] [FILE_PERMISSIONS permissions...]
[DIRECTORY_PERMISSIONS permissions...] [DIRECTORY_PERMISSIONS permissions...]
[USE_SOURCE_PERMISSIONS] [OPTIONAL] [USE_SOURCE_PERMISSIONS] [OPTIONAL] [MESSAGE_NEVER]
[CONFIGURATIONS [Debug|Release|...]] [CONFIGURATIONS [Debug|Release|...]]
[COMPONENT <component>] [FILES_MATCHING] [COMPONENT <component>] [FILES_MATCHING]
[[PATTERN <pattern> | REGEX <regex>] [[PATTERN <pattern> | REGEX <regex>]
@ -205,6 +219,8 @@ permissions specified in the ``FILES`` form of the command, and the
directories will be given the default permissions specified in the directories will be given the default permissions specified in the
``PROGRAMS`` form of the command. ``PROGRAMS`` form of the command.
The ``MESSAGE_NEVER`` option disables file installation status output.
Installation of directories may be controlled with fine granularity Installation of directories may be controlled with fine granularity
using the ``PATTERN`` or ``REGEX`` options. These "match" options specify a using the ``PATTERN`` or ``REGEX`` options. These "match" options specify a
globbing pattern or regular expression to match directories or files globbing pattern or regular expression to match directories or files
@ -247,11 +263,13 @@ will install the ``icons`` directory to ``share/myproj/icons`` and the
file permissions, the scripts will be given specific permissions, and any file permissions, the scripts will be given specific permissions, and any
``CVS`` directories will be excluded. ``CVS`` directories will be excluded.
------------------------------------------------------------------------------ Custom Installation Logic
^^^^^^^^^^^^^^^^^^^^^^^^^
:: ::
install([[SCRIPT <file>] [CODE <code>]] [...]) install([[SCRIPT <file>] [CODE <code>]]
[COMPONENT <component>] [...])
The ``SCRIPT`` form will invoke the given CMake script files during The ``SCRIPT`` form will invoke the given CMake script files during
installation. If the script file name is a relative path it will be installation. If the script file name is a relative path it will be
@ -266,7 +284,8 @@ example, the code
will print a message during installation. will print a message during installation.
------------------------------------------------------------------------------ Installing Exports
^^^^^^^^^^^^^^^^^^
:: ::

@ -1,16 +1,19 @@
link_libraries link_libraries
-------------- --------------
Deprecated. Use the target_link_libraries() command instead.
Link libraries to all targets added later. Link libraries to all targets added later.
:: ::
link_libraries(library1 <debug | optimized> library2 ...) link_libraries([item1 [item2 [...]]]
[[debug|optimized|general] <item>] ...)
Specify libraries or flags to use when linking any targets created later in
the current directory or below by commands such as :command:`add_executable`
or :command:`add_library`. See the :command:`target_link_libraries` command
for meaning of arguments.
Specify a list of libraries to be linked into any following targets .. note::
(typically added with the add_executable or add_library calls). This The :command:`target_link_libraries` command should be preferred whenever
command is passed down to all subdirectories. The debug and optimized possible. Library dependencies are chained automatically, so directory-wide
strings may be used to indicate that the next library listed is to be specification of link libraries is rarely needed.
used only for that specific type of build.

@ -9,6 +9,7 @@ Set a named property in a given scope.
DIRECTORY [dir] | DIRECTORY [dir] |
TARGET [target1 [target2 ...]] | TARGET [target1 [target2 ...]] |
SOURCE [src1 [src2 ...]] | SOURCE [src1 [src2 ...]] |
INSTALL [file1 [file2 ...]] |
TEST [test1 [test2 ...]] | TEST [test1 [test2 ...]] |
CACHE [entry1 [entry2 ...]]> CACHE [entry1 [entry2 ...]]>
[APPEND] [APPEND_STRING] [APPEND] [APPEND_STRING]
@ -18,26 +19,48 @@ Set one property on zero or more objects of a scope. The first
argument determines the scope in which the property is set. It must argument determines the scope in which the property is set. It must
be one of the following: be one of the following:
GLOBAL scope is unique and does not accept a name. ``GLOBAL``
Scope is unique and does not accept a name.
DIRECTORY scope defaults to the current directory but another ``DIRECTORY``
Scope defaults to the current directory but another
directory (already processed by CMake) may be named by full or directory (already processed by CMake) may be named by full or
relative path. relative path.
TARGET scope may name zero or more existing targets. ``TARGET``
Scope may name zero or more existing targets.
SOURCE scope may name zero or more source files. Note that source ``SOURCE``
Scope may name zero or more source files. Note that source
file properties are visible only to targets added in the same file properties are visible only to targets added in the same
directory (CMakeLists.txt). directory (CMakeLists.txt).
TEST scope may name zero or more existing tests. ``INSTALL``
Scope may name zero or more installed file paths.
These are made available to CPack to influence deployment.
CACHE scope must name zero or more cache existing entries. Both the property key and value may use generator expressions.
Specific properties may apply to installed files and/or directories.
The required PROPERTY option is immediately followed by the name of Path components have to be separated by forward slashes,
must be normalized and are case sensitive.
To reference the installation prefix itself with a relative path use ".".
Currently installed file properties are only defined for
the WIX generator where the given paths are relative
to the installation prefix.
``TEST``
Scope may name zero or more existing tests.
``CACHE``
Scope must name zero or more cache existing entries.
The required ``PROPERTY`` option is immediately followed by the name of
the property to set. Remaining arguments are used to compose the the property to set. Remaining arguments are used to compose the
property value in the form of a semicolon-separated list. If the property value in the form of a semicolon-separated list. If the
APPEND option is given the list is appended to any existing property ``APPEND`` option is given the list is appended to any existing property
value.If the APPEND_STRING option is given the string is append to any value. If the ``APPEND_STRING`` option is given the string is append to any
existing property value as string, i.e. it results in a longer string existing property value as string, i.e. it results in a longer string
and not a list of strings. and not a list of strings.

@ -7,7 +7,7 @@ Set a property of the tests.
set_tests_properties(test1 [test2...] PROPERTIES prop1 value1 prop2 value2) set_tests_properties(test1 [test2...] PROPERTIES prop1 value1 prop2 value2)
Set a property for the tests. If the property is not found, CMake Set a property for the tests. If the test is not found, CMake
will report an error. Generator expressions will be expanded the same will report an error. Generator expressions will be expanded the same
as supported by the test's add_test call. The properties include: as supported by the test's add_test call. The properties include:
@ -27,7 +27,7 @@ specified regular expressions, the test will fail.
:: ::
Example: PASS_REGULAR_EXPRESSION "[^a-z]Error;ERROR;Failed" Example: FAIL_REGULAR_EXPRESSION "[^a-z]Error;ERROR;Failed"
Both PASS_REGULAR_EXPRESSION and FAIL_REGULAR_EXPRESSION expect a list Both PASS_REGULAR_EXPRESSION and FAIL_REGULAR_EXPRESSION expect a list
of regular expressions. of regular expressions.

@ -35,6 +35,9 @@ String operations.
string(FIND <string> <substring> <output variable> [REVERSE]) string(FIND <string> <substring> <output variable> [REVERSE])
string(TIMESTAMP <output variable> [<format string>] [UTC]) string(TIMESTAMP <output variable> [<format string>] [UTC])
string(MAKE_C_IDENTIFIER <input string> <output variable>) string(MAKE_C_IDENTIFIER <input string> <output variable>)
string(GENEX_STRIP <input string> <output variable>)
string(UUID <output variable> NAMESPACE <namespace> NAME <name>
TYPE <MD5|SHA1> [UPPER])
REGEX MATCH will match the regular expression once and store the match REGEX MATCH will match the regular expression once and store the match
in the output variable. in the output variable.
@ -72,6 +75,11 @@ LENGTH will return a given string's length.
SUBSTRING will return a substring of a given string. If length is -1 SUBSTRING will return a substring of a given string. If length is -1
the remainder of the string starting at begin will be returned. the remainder of the string starting at begin will be returned.
If string is shorter than length then end of string is used instead.
.. note::
CMake 3.1 and below reported an error if length pointed past
the end of string.
STRIP will return a substring of a given string with leading and STRIP will return a substring of a given string with leading and
trailing spaces removed. trailing spaces removed.
@ -154,3 +162,17 @@ If no explicit <format string> is given it will default to:
MAKE_C_IDENTIFIER will write a string which can be used as an MAKE_C_IDENTIFIER will write a string which can be used as an
identifier in C. identifier in C.
``GENEX_STRIP`` will strip any
:manual:`generator expressions <cmake-generator-expressions(7)>` from the
``input string`` and store the result in the ``output variable``.
UUID creates a univerally unique identifier (aka GUID) as per RFC4122
based on the hash of the combined values of <namespace>
(which itself has to be a valid UUID) and <name>.
The hash algorithm can be either ``MD5`` (Version 3 UUID) or
``SHA1`` (Version 5 UUID).
A UUID has the format ``xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx``
where each `x` represents a lower case hexadecimal character.
Where required an uppercase representation can be requested
with the optional ``UPPER`` flag.

@ -0,0 +1,32 @@
target_compile_features
-----------------------
Add expected compiler features to a target.
::
target_compile_features(<target> <PRIVATE|PUBLIC|INTERFACE> <feature> [...])
Specify compiler features required when compiling a given target. If the
feature is not listed in the :variable:`CMAKE_C_COMPILE_FEATURES` variable
or :variable:`CMAKE_CXX_COMPILE_FEATURES` variable,
then an error will be reported by CMake. If the use of the feature requires
an additional compiler flag, such as ``-std=gnu++11``, the flag will be added
automatically.
The ``INTERFACE``, ``PUBLIC`` and ``PRIVATE`` keywords are required to
specify the scope of the features. ``PRIVATE`` and ``PUBLIC`` items will
populate the :prop_tgt:`COMPILE_FEATURES` property of ``<target>``.
``PUBLIC`` and ``INTERFACE`` items will populate the
:prop_tgt:`INTERFACE_COMPILE_FEATURES` property of ``<target>``. Repeated
calls for the same ``<target>`` append items.
The named ``<target>`` must have been created by a command such as
:command:`add_executable` or :command:`add_library` and must not be
an ``IMPORTED`` target.
Arguments to ``target_compile_features`` may use "generator expressions"
with the syntax ``$<...>``.
See the :manual:`cmake-generator-expressions(7)` manual for available
expressions. See the :manual:`cmake-compile-features(7)` manual for
information on compile features.

@ -12,8 +12,8 @@ Add compile options to a target.
Specify compile options to use when compiling a given target. The Specify compile options to use when compiling a given target. The
named ``<target>`` must have been created by a command such as named ``<target>`` must have been created by a command such as
:command:`add_executable` or :command:`add_library` and must not be an :command:`add_executable` or :command:`add_library` and must not be an
:prop_tgt:`IMPORTED Target`. If ``BEFORE`` is specified, the content will :ref:`IMPORTED Target <Imported Targets>`. If ``BEFORE`` is specified,
be prepended to the property instead of being appended. the content will be prepended to the property instead of being appended.
This command can be used to add any options, but This command can be used to add any options, but
alternative commands exist to add preprocessor definitions alternative commands exist to add preprocessor definitions

@ -9,8 +9,8 @@ Add include directories to a target.
<INTERFACE|PUBLIC|PRIVATE> [items1...] <INTERFACE|PUBLIC|PRIVATE> [items1...]
[<INTERFACE|PUBLIC|PRIVATE> [items2...] ...]) [<INTERFACE|PUBLIC|PRIVATE> [items2...] ...])
Specify include directories or targets to use when compiling a given Specify include directories to use when compiling a given target.
target. The named ``<target>`` must have been created by a command such The named ``<target>`` must have been created by a command such
as :command:`add_executable` or :command:`add_library` and must not be an as :command:`add_executable` or :command:`add_library` and must not be an
:prop_tgt:`IMPORTED` target. :prop_tgt:`IMPORTED` target.
@ -54,3 +54,6 @@ installation prefix. For example:
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/mylib> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/mylib>
$<INSTALL_INTERFACE:include/mylib> # <prefix>/include/mylib $<INSTALL_INTERFACE:include/mylib> # <prefix>/include/mylib
) )
.. |INTERFACE_PROPERTY_LINK| replace:: :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES`
.. include:: /include/INTERFACE_INCLUDE_DIRECTORIES_WARNING.txt

@ -18,7 +18,10 @@ If a library name matches that of another target in the project a
dependency will automatically be added in the build system to make sure dependency will automatically be added in the build system to make sure
the library being linked is up-to-date before the target links. Item names the library being linked is up-to-date before the target links. Item names
starting with ``-``, but not ``-l`` or ``-framework``, are treated as starting with ``-``, but not ``-l`` or ``-framework``, are treated as
linker flags. linker flags. Note that such flags will be treated like any other library
link item for purposes of transitive dependencies, so they are generally
safe to specify only as private link items that will not propagate to
dependents of ``<target>``.
A ``debug``, ``optimized``, or ``general`` keyword indicates that the A ``debug``, ``optimized``, or ``general`` keyword indicates that the
library immediately following it is to be used only for the library immediately following it is to be used only for the
@ -46,6 +49,9 @@ CMake will also propagate :ref:`usage requirements <Target Usage Requirements>`
from linked library targets. Usage requirements of dependencies affect from linked library targets. Usage requirements of dependencies affect
compilation of sources in the ``<target>``. compilation of sources in the ``<target>``.
.. |INTERFACE_PROPERTY_LINK| replace:: :prop_tgt:`INTERFACE_LINK_LIBRARIES`
.. include:: /include/INTERFACE_LINK_LIBRARIES_WARNING.txt
If an ``<item>`` is a library in a Mac OX framework, the ``Headers`` If an ``<item>`` is a library in a Mac OX framework, the ``Headers``
directory of the framework will also be processed as a directory of the framework will also be processed as a
:ref:`usage requirement <Target Usage Requirements>`. This has the same :ref:`usage requirement <Target Usage Requirements>`. This has the same

@ -0,0 +1,32 @@
target_sources
--------------
Add sources to a target.
::
target_sources(<target>
<INTERFACE|PUBLIC|PRIVATE> [items1...]
[<INTERFACE|PUBLIC|PRIVATE> [items2...] ...])
Specify sources to use when compiling a given target. The
named ``<target>`` must have been created by a command such as
:command:`add_executable` or :command:`add_library` and must not be an
:ref:`IMPORTED Target <Imported Targets>`.
The ``INTERFACE``, ``PUBLIC`` and ``PRIVATE`` keywords are required to
specify the scope of the following arguments. ``PRIVATE`` and ``PUBLIC``
items will populate the :prop_tgt:`SOURCES` property of
``<target>``. ``PUBLIC`` and ``INTERFACE`` items will populate the
:prop_tgt:`INTERFACE_SOURCES` property of ``<target>``. The
following arguments specify sources. Repeated calls for the same
``<target>`` append items in the order called.
Targets with :prop_tgt:`INTERFACE_SOURCES` may not be exported with the
:command:`export` or :command:`install(EXPORT)` commands. This limitation may be
lifted in a future version of CMake.
Arguments to ``target_sources`` may use "generator expressions"
with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
manual for available expressions. See the :manual:`cmake-buildsystem(7)`
manual for more on defining buildsystem properties.

@ -1,71 +1,100 @@
try_compile try_compile
----------- -----------
.. only:: html
.. contents::
Try building some code. Try building some code.
Try Compiling Whole Projects
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
:: ::
try_compile(RESULT_VAR <bindir> <srcdir> try_compile(RESULT_VAR <bindir> <srcdir>
<projectName> [targetName] [CMAKE_FLAGS flags...] <projectName> [<targetName>] [CMAKE_FLAGS <flags>...]
[OUTPUT_VARIABLE <var>]) [OUTPUT_VARIABLE <var>])
Try building a project. In this form, srcdir should contain a Try building a project. The success or failure of the ``try_compile``,
complete CMake project with a CMakeLists.txt file and all sources. i.e. ``TRUE`` or ``FALSE`` respectively, is returned in ``RESULT_VAR``.
The bindir and srcdir will not be deleted after this command is run.
Specify targetName to build a specific target instead of the 'all' or In this form, ``<srcdir>`` should contain a complete CMake project with a
'ALL_BUILD' target. ``CMakeLists.txt`` file and all sources. The ``<bindir>`` and ``<srcdir>``
will not be deleted after this command is run. Specify ``<targetName>`` to
build a specific target instead of the ``all`` or ``ALL_BUILD`` target. See
below for the meaning of other options.
Try Compiling Source Files
^^^^^^^^^^^^^^^^^^^^^^^^^^
:: ::
try_compile(RESULT_VAR <bindir> <srcfile|SOURCES srcfile...> try_compile(RESULT_VAR <bindir> <srcfile|SOURCES srcfile...>
[CMAKE_FLAGS flags...] [CMAKE_FLAGS <flags>...]
[COMPILE_DEFINITIONS flags...] [COMPILE_DEFINITIONS <defs>...]
[LINK_LIBRARIES libs...] [LINK_LIBRARIES <libs>...]
[OUTPUT_VARIABLE <var>] [OUTPUT_VARIABLE <var>]
[COPY_FILE <fileName> [COPY_FILE_ERROR <var>]]) [COPY_FILE <fileName> [COPY_FILE_ERROR <var>]])
Try building an executable from one or more source files. In this Try building an executable from one or more source files. The success or
form the user need only supply one or more source files that include a failure of the ``try_compile``, i.e. ``TRUE`` or ``FALSE`` respectively, is
definition for 'main'. CMake will create a CMakeLists.txt file to returned in ``RESULT_VAR``.
build the source(s) as an executable. Specify COPY_FILE to get a copy
of the linked executable at the given fileName and optionally
COPY_FILE_ERROR to capture any error.
In this version all files in bindir/CMakeFiles/CMakeTmp will be
cleaned automatically. For debugging, --debug-trycompile can be
passed to cmake to avoid this clean. However, multiple sequential
try_compile operations reuse this single output directory. If you use
--debug-trycompile, you can only debug one try_compile call at a time.
The recommended procedure is to configure with cmake all the way
through once, then delete the cache entry associated with the
try_compile call of interest, and then re-run cmake again with
--debug-trycompile.
Some extra flags that can be included are, INCLUDE_DIRECTORIES,
LINK_DIRECTORIES, and LINK_LIBRARIES. COMPILE_DEFINITIONS are
-Ddefinition that will be passed to the compile line.
The srcfile signature also accepts a LINK_LIBRARIES argument which may
contain a list of libraries or IMPORTED targets which will be linked
to in the generated project. If LINK_LIBRARIES is specified as a
parameter to try_compile, then any LINK_LIBRARIES passed as
CMAKE_FLAGS will be ignored.
try_compile creates a CMakeList.txt file on the fly that looks like
this:
:: In this form the user need only supply one or more source files that include a
definition for ``main``. CMake will create a ``CMakeLists.txt`` file to build
the source(s) as an executable that looks something like this::
add_definitions( <expanded COMPILE_DEFINITIONS from calling cmake>) add_definitions(<expanded COMPILE_DEFINITIONS from caller>)
include_directories(${INCLUDE_DIRECTORIES}) include_directories(${INCLUDE_DIRECTORIES})
link_directories(${LINK_DIRECTORIES}) link_directories(${LINK_DIRECTORIES})
add_executable(cmTryCompileExec sources) add_executable(cmTryCompileExec <srcfile>...)
target_link_libraries(cmTryCompileExec ${LINK_LIBRARIES}) target_link_libraries(cmTryCompileExec ${LINK_LIBRARIES})
In both versions of the command, if OUTPUT_VARIABLE is specified, then The options are:
the output from the build process is stored in the given variable.
The success or failure of the try_compile, i.e. TRUE or FALSE ``CMAKE_FLAGS <flags>...``
respectively, is returned in RESULT_VAR. CMAKE_FLAGS can be used to Specify flags of the form ``-DVAR:TYPE=VALUE`` to be passed to
pass -DVAR:TYPE=VALUE flags to the cmake that is run during the build. the ``cmake`` command-line used to drive the test build.
Set variable CMAKE_TRY_COMPILE_CONFIGURATION to choose a build The above example shows how values for variables
configuration. ``INCLUDE_DIRECTORIES``, ``LINK_DIRECTORIES``, and ``LINK_LIBRARIES``
are used.
``COMPILE_DEFINITIONS <defs>...``
Specify ``-Ddefinition`` arguments to pass to ``add_definitions``
in the generated test project.
``COPY_FILE <fileName>``
Copy the linked executable to the given ``<fileName>``.
``COPY_FILE_ERROR <var>``
Use after ``COPY_FILE`` to capture into variable ``<var>`` any error
message encountered while trying to copy the file.
``LINK_LIBRARIES <libs>...``
Specify libraries to be linked in the generated project.
The list of libraries may refer to system libraries and to
:ref:`Imported Targets <Imported Targets>` from the calling project.
If this option is specified, any ``-DLINK_LIBRARIES=...`` value
given to the ``CMAKE_FLAGS`` option will be ignored.
``OUTPUT_VARIABLE <var>``
Store the output from the build process the given variable.
In this version all files in ``<bindir>/CMakeFiles/CMakeTmp`` will be
cleaned automatically. For debugging, ``--debug-trycompile`` can be
passed to ``cmake`` to avoid this clean. However, multiple sequential
``try_compile`` operations reuse this single output directory. If you use
``--debug-trycompile``, you can only debug one ``try_compile`` call at a time.
The recommended procedure is to protect all ``try_compile`` calls in your
project by ``if(NOT DEFINED RESULT_VAR)`` logic, configure with cmake
all the way through once, then delete the cache entry associated with
the try_compile call of interest, and then re-run cmake again with
``--debug-trycompile``.
Other Behavior Settings
^^^^^^^^^^^^^^^^^^^^^^^
Set the :variable:`CMAKE_TRY_COMPILE_CONFIGURATION` variable to choose
a build configuration.

@ -1,52 +1,97 @@
try_run try_run
------- -------
.. only:: html
.. contents::
Try compiling and then running some code. Try compiling and then running some code.
Try Compiling and Running Source Files
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
:: ::
try_run(RUN_RESULT_VAR COMPILE_RESULT_VAR try_run(RUN_RESULT_VAR COMPILE_RESULT_VAR
bindir srcfile [CMAKE_FLAGS <Flags>] bindir srcfile [CMAKE_FLAGS <flags>...]
[COMPILE_DEFINITIONS <flags>] [COMPILE_DEFINITIONS <defs>...]
[COMPILE_OUTPUT_VARIABLE comp] [LINK_LIBRARIES <libs>...]
[RUN_OUTPUT_VARIABLE run] [COMPILE_OUTPUT_VARIABLE <var>]
[OUTPUT_VARIABLE var] [RUN_OUTPUT_VARIABLE <var>]
[ARGS <arg1> <arg2>...]) [OUTPUT_VARIABLE <var>]
[ARGS <args>...])
Try compiling a srcfile. Return TRUE or FALSE for success or failure
in COMPILE_RESULT_VAR. Then if the compile succeeded, run the Try compiling a ``<srcfile>``. Returns ``TRUE`` or ``FALSE`` for success
executable and return its exit code in RUN_RESULT_VAR. If the or failure in ``COMPILE_RESULT_VAR``. If the compile succeeded, runs the
executable was built, but failed to run, then RUN_RESULT_VAR will be executable and returns its exit code in ``RUN_RESULT_VAR``. If the
set to FAILED_TO_RUN. COMPILE_OUTPUT_VARIABLE specifies the variable executable was built, but failed to run, then ``RUN_RESULT_VAR`` will be
where the output from the compile step goes. RUN_OUTPUT_VARIABLE set to ``FAILED_TO_RUN``. See the :command:`try_compile` command for
specifies the variable where the output from the running executable information on how the test project is constructed to build the source file.
goes.
The options are:
For compatibility reasons OUTPUT_VARIABLE is still supported, which
gives you the output from the compile and run step combined. ``CMAKE_FLAGS <flags>...``
Specify flags of the form ``-DVAR:TYPE=VALUE`` to be passed to
Cross compiling issues the ``cmake`` command-line used to drive the test build.
The example in :command:`try_compile` shows how values for variables
``INCLUDE_DIRECTORIES``, ``LINK_DIRECTORIES``, and ``LINK_LIBRARIES``
are used.
``COMPILE_DEFINITIONS <defs>...``
Specify ``-Ddefinition`` arguments to pass to ``add_definitions``
in the generated test project.
``COMPILE_OUTPUT_VARIABLE <var>``
Report the compile step build output in a given variable.
``LINK_LIBRARIES <libs>...``
Specify libraries to be linked in the generated project.
The list of libraries may refer to system libraries and to
:ref:`Imported Targets <Imported Targets>` from the calling project.
If this option is specified, any ``-DLINK_LIBRARIES=...`` value
given to the ``CMAKE_FLAGS`` option will be ignored.
``OUTPUT_VARIABLE <var>``
Report the compile build output and the output from running the executable
in the given variable. This option exists for legacy reasons. Prefer
``COMPILE_OUTPUT_VARIABLE`` and ``RUN_OUTPUT_VARIABLE`` instead.
``RUN_OUTPUT_VARIABLE <var>``
Report the output from running the executable in a given variable.
Other Behavior Settings
^^^^^^^^^^^^^^^^^^^^^^^
Set the :variable:`CMAKE_TRY_COMPILE_CONFIGURATION` variable to choose
a build configuration.
Behavior when Cross Compiling
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
When cross compiling, the executable compiled in the first step When cross compiling, the executable compiled in the first step
usually cannot be run on the build host. try_run() checks the usually cannot be run on the build host. The ``try_run`` command checks
CMAKE_CROSSCOMPILING variable to detect whether CMake is in the :variable:`CMAKE_CROSSCOMPILING` variable to detect whether CMake is in
crosscompiling mode. If that's the case, it will still try to compile cross-compiling mode. If that is the case, it will still try to compile
the executable, but it will not try to run the executable. Instead it the executable, but it will not try to run the executable. Instead it
will create cache variables which must be filled by the user or by will create cache variables which must be filled by the user or by
presetting them in some CMake script file to the values the executable presetting them in some CMake script file to the values the executable
would have produced if it had been run on its actual target platform. would have produced if it had been run on its actual target platform.
These variables are RUN_RESULT_VAR (explanation see above) and if These cache entries are:
RUN_OUTPUT_VARIABLE (or OUTPUT_VARIABLE) was used, an additional cache
variable RUN_RESULT_VAR__COMPILE_RESULT_VAR__TRYRUN_OUTPUT.This is ``<RUN_RESULT_VAR>``
intended to hold stdout and stderr from the executable. Exit code if the executable were to be run on the target platform.
In order to make cross compiling your project easier, use try_run only ``<RUN_RESULT_VAR>__TRYRUN_OUTPUT``
if really required. If you use try_run, use RUN_OUTPUT_VARIABLE (or Output from stdout and stderr if the executable were to be run on
OUTPUT_VARIABLE) only if really required. Using them will require the target platform. This is created only if the
that when crosscompiling, the cache variables will have to be set ``RUN_OUTPUT_VARIABLE`` or ``OUTPUT_VARIABLE`` option was used.
manually to the output of the executable. You can also "guard" the
calls to try_run with if(CMAKE_CROSSCOMPILING) and provide an In order to make cross compiling your project easier, use ``try_run``
easy-to-preset alternative for this case. only if really required. If you use ``try_run``, use the
``RUN_OUTPUT_VARIABLE`` or ``OUTPUT_VARIABLE`` options only if really
Set variable CMAKE_TRY_COMPILE_CONFIGURATION to choose a build required. Using them will require that when cross-compiling, the cache
configuration. variables will have to be set manually to the output of the executable.
You can also "guard" the calls to ``try_run`` with an :command:`if`
block checking the :variable:`CMAKE_CROSSCOMPILING` variable and
provide an easy-to-preset alternative for this case.

@ -1,7 +1,11 @@
MSYS Makefiles MSYS Makefiles
-------------- --------------
Generates MSYS makefiles. Generates makefiles for use with MSYS ``make`` under the MSYS shell.
The makefiles use /bin/sh as the shell. They require msys to be Use this generator in a MSYS shell prompt and using ``make`` as the build
installed on the machine. tool. The generated makefiles use ``/bin/sh`` as the shell to launch build
rules. They are not compatible with a Windows command prompt.
To build under a Windows command prompt, use the
:generator:`MinGW Makefiles` generator.

@ -1,7 +1,12 @@
MinGW Makefiles MinGW Makefiles
--------------- ---------------
Generates a make file for use with mingw32-make. Generates makefiles for use with ``mingw32-make`` under a Windows command
prompt.
The makefiles generated use cmd.exe as the shell. They do not require Use this generator under a Windows command prompt with MinGW in the ``PATH``
msys or a unix shell. and using ``mingw32-make`` as the build tool. The generated makefiles use
``cmd.exe`` as the shell to launch build rules. They are not compatible with
MSYS or a unix shell.
To build under the MSYS shell, use the :generator:`MSYS Makefiles` generator.

@ -3,10 +3,17 @@ Visual Studio 10 2010
Generates Visual Studio 10 (VS 2010) project files. Generates Visual Studio 10 (VS 2010) project files.
It is possible to append a space followed by the platform name to The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set
create project files for a specific target platform. E.g. to specify a target platform name.
"Visual Studio 10 2010 Win64" will create project files for the
x64 processor; "Visual Studio 10 2010 IA64" for Itanium. For compatibility with CMake versions prior to 3.1, one may specify
a target platform name optionally at the end of this generator name:
``Visual Studio 10 2010 Win64``
Specify target platform ``x64``.
``Visual Studio 10 2010 IA64``
Specify target platform ``Itanium``.
For compatibility with CMake versions prior to 3.0, one may specify this For compatibility with CMake versions prior to 3.0, one may specify this
generator using the name "Visual Studio 10" without the year component. generator using the name ``Visual Studio 10`` without the year component.

@ -3,10 +3,20 @@ Visual Studio 11 2012
Generates Visual Studio 11 (VS 2012) project files. Generates Visual Studio 11 (VS 2012) project files.
It is possible to append a space followed by the platform name to The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set
create project files for a specific target platform. E.g. to specify a target platform name.
"Visual Studio 11 2012 Win64" will create project files for the
x64 processor; "Visual Studio 11 2012 ARM" for ARM. For compatibility with CMake versions prior to 3.1, one may specify
a target platform name optionally at the end of this generator name:
``Visual Studio 11 2012 Win64``
Specify target platform ``x64``.
``Visual Studio 11 2012 ARM``
Specify target platform ``ARM``.
``Visual Studio 11 2012 <WinCE-SDK>``
Specify target platform matching a Windows CE SDK name.
For compatibility with CMake versions prior to 3.0, one may specify this For compatibility with CMake versions prior to 3.0, one may specify this
generator using the name "Visual Studio 11" without the year component. generator using the name "Visual Studio 11" without the year component.

@ -3,10 +3,17 @@ Visual Studio 12 2013
Generates Visual Studio 12 (VS 2013) project files. Generates Visual Studio 12 (VS 2013) project files.
It is possible to append a space followed by the platform name to The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set
create project files for a specific target platform. E.g. to specify a target platform name.
"Visual Studio 12 2013 Win64" will create project files for the
x64 processor; "Visual Studio 12 2013 ARM" for ARM. For compatibility with CMake versions prior to 3.1, one may specify
a target platform name optionally at the end of this generator name:
``Visual Studio 12 2013 Win64``
Specify target platform ``x64``.
``Visual Studio 12 2013 ARM``
Specify target platform ``ARM``.
For compatibility with CMake versions prior to 3.0, one may specify this For compatibility with CMake versions prior to 3.0, one may specify this
generator using the name "Visual Studio 12" without the year component. generator using the name "Visual Studio 12" without the year component.

@ -0,0 +1,16 @@
Visual Studio 14 2015
---------------------
Generates Visual Studio 14 (VS 2015) project files.
The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set
to specify a target platform name.
For compatibility with CMake versions prior to 3.1, one may specify
a target platform name optionally at the end of this generator name:
``Visual Studio 14 2015 Win64``
Specify target platform ``x64``.
``Visual Studio 14 2015 ARM``
Specify target platform ``ARM``.

@ -3,6 +3,14 @@ Visual Studio 8 2005
Generates Visual Studio 8 2005 project files. Generates Visual Studio 8 2005 project files.
It is possible to append a space followed by the platform name to The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set
create project files for a specific target platform. E.g. "Visual to specify a target platform name.
Studio 8 2005 Win64" will create project files for the x64 processor.
For compatibility with CMake versions prior to 3.1, one may specify
a target platform name optionally at the end of this generator name:
``Visual Studio 8 2005 Win64``
Specify target platform ``x64``.
``Visual Studio 8 2005 <WinCE-SDK>``
Specify target platform matching a Windows CE SDK name.

@ -3,7 +3,17 @@ Visual Studio 9 2008
Generates Visual Studio 9 2008 project files. Generates Visual Studio 9 2008 project files.
It is possible to append a space followed by the platform name to The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set
create project files for a specific target platform. E.g. "Visual to specify a target platform name.
Studio 9 2008 Win64" will create project files for the x64 processor;
"Visual Studio 9 2008 IA64" for Itanium. For compatibility with CMake versions prior to 3.1, one may specify
a target platform name optionally at the end of this generator name:
``Visual Studio 9 2008 Win64``
Specify target platform ``x64``.
``Visual Studio 9 2008 IA64``
Specify target platform ``Itanium``.
``Visual Studio 9 2008 <WinCE-SDK>``
Specify target platform matching a Windows CE SDK name.

@ -0,0 +1,30 @@
Note that it is not advisable to populate the ``INSTALL_INTERFACE`` of the
|INTERFACE_PROPERTY_LINK| of a target with paths for dependencies.
That would hard-code into installed packages the include directory paths
for dependencies **as found on the machine the package was made on**.
The ``INSTALL_INTERFACE`` of the |INTERFACE_PROPERTY_LINK| is only
suitable for specifying the required include directories of the target itself,
not its dependencies.
That is, code like this is incorrect for targets which will be used to
generate :manual:`cmake-packages(7)`:
.. code-block:: cmake
target_include_directories(mylib INTERFACE
$<INSTALL_INTERFACE:${Boost_INCLUDE_DIRS};${OtherDep_INCLUDE_DIRS}>
)
Dependencies must provide their own :ref:`IMPORTED targets <Imported Targets>`
which have their own |INTERFACE_PROPERTY_LINK| populated
appropriately. Those :ref:`IMPORTED targets <Imported Targets>` may then be
used with the :command:`target_link_libraries` command for ``mylib``.
That way, when a consumer uses the installed package, the
consumer will run the appropriate :command:`find_package` command to find
the dependencies on their own machine and populate the
:ref:`IMPORTED targets <Imported Targets>` with appropriate paths. See
:ref:`Creating Packages` for more. Note that many modules currently shipped
with CMake do not currently provide :ref:`IMPORTED targets <Imported Targets>`.

@ -0,0 +1,23 @@
Note that it is not advisable to populate the
|INTERFACE_PROPERTY_LINK| of a target with paths for dependencies.
That would hard-code into installed packages the include directory paths
for dependencies **as found on the machine the package was made on**.
That is, code like this is incorrect for targets which will be used to
generate :manual:`cmake-packages(7)`:
.. code-block:: cmake
target_link_libraries(mylib INTERFACE
${Boost_LIBRARIES};${OtherDep_LIBRARIES}
)
Dependencies must provide their own :ref:`IMPORTED targets <Imported Targets>`
which have their own :prop_tgt:`IMPORTED_LOCATION` populated
appropriately. That way, when a consumer uses the installed package, the
consumer will run the appropriate :command:`find_package` command to find
the dependencies on their own machine and populate the
:ref:`IMPORTED targets <Imported Targets>` with appropriate paths. See
:ref:`Creating Packages` for more. Note that many modules currently shipped
with CMake do not currently provide :ref:`IMPORTED targets <Imported Targets>`.

@ -27,6 +27,7 @@ Reference Manuals
/manual/cmake-buildsystem.7 /manual/cmake-buildsystem.7
/manual/cmake-commands.7 /manual/cmake-commands.7
/manual/cmake-compile-features.7
/manual/cmake-developer.7 /manual/cmake-developer.7
/manual/cmake-generator-expressions.7 /manual/cmake-generator-expressions.7
/manual/cmake-generators.7 /manual/cmake-generators.7

@ -11,12 +11,12 @@ Frequently Asked Questions
A Wiki is provided containing answers to frequently asked questions. A Wiki is provided containing answers to frequently asked questions.
Online Documentation Online Documentation
http://www.cmake.org/HTML/Documentation.html http://www.cmake.org/documentation
Links to available documentation may be found on this web page. Links to available documentation may be found on this web page.
Mailing List Mailing List
http://www.cmake.org/HTML/MailingLists.html http://www.cmake.org/mailing-lists
For help and discussion about using cmake, a mailing list is For help and discussion about using cmake, a mailing list is
provided at cmake@cmake.org. The list is member-post-only but one provided at cmake@cmake.org. The list is member-post-only but one

@ -51,6 +51,17 @@
See native build system documentation for allowed toolset names. See native build system documentation for allowed toolset names.
``-A <platform-name>``
Specify platform name if supported by generator.
Some CMake generators support a platform name to be given to the
native build system to choose a compiler or SDK. This is supported only on
specific generators::
Visual Studio >= 8
See native build system documentation for allowed platform names.
``-Wno-dev`` ``-Wno-dev``
Suppress developer warnings. Suppress developer warnings.

@ -3,7 +3,7 @@
cmake-buildsystem(7) cmake-buildsystem(7)
******************** ********************
.. only:: html or latex .. only:: html
.. contents:: .. contents::
@ -19,8 +19,8 @@ and the rules for regeneration in response to change.
Binary Targets Binary Targets
============== ==============
Executables and libraries are defined using the :command:`add_library` Executables and libraries are defined using the :command:`add_executable`
and :command:`add_executable` commands. The resulting binary files have and :command:`add_library` commands. The resulting binary files have
appropriate prefixes, suffixes and extensions for the platform targeted. appropriate prefixes, suffixes and extensions for the platform targeted.
Dependencies between binary targets are expressed using the Dependencies between binary targets are expressed using the
:command:`target_link_libraries` command: :command:`target_link_libraries` command:
@ -37,9 +37,28 @@ is defined as an executable formed by compiling and linking ``zipapp.cpp``.
When linking the ``zipapp`` executable, the ``archive`` static library is When linking the ``zipapp`` executable, the ``archive`` static library is
linked in. linked in.
Binary Executables
------------------
The :command:`add_executable` command defines an executable target:
.. code-block:: cmake
add_executable(mytool mytool.cpp)
Commands such as :command:`add_custom_command`, which generates rules to be
run at build time can transparently use an :prop_tgt:`EXECUTABLE <TYPE>`
target as a ``COMMAND`` executable. The buildsystem rules will ensure that
the executable is built before attempting to run the command.
Binary Library Types Binary Library Types
-------------------- --------------------
.. _`Normal Libraries`:
Normal Libraries
^^^^^^^^^^^^^^^^
By default, the :command:`add_library` command defines a static library, By default, the :command:`add_library` command defines a static library,
unless a type is specified. A type may be specified when using the command: unless a type is specified. A type may be specified when using the command:
@ -66,6 +85,11 @@ It is a type which is loaded as a plugin using runtime techniques.
add_library(archive MODULE 7z.cpp) add_library(archive MODULE 7z.cpp)
.. _`Object Libraries`:
Object Libraries
^^^^^^^^^^^^^^^^
The ``OBJECT`` library type is also not linked to. It defines a non-archival The ``OBJECT`` library type is also not linked to. It defines a non-archival
collection of object files resulting from compiling the given source files. collection of object files resulting from compiling the given source files.
The object files collection can be used as source inputs to other targets: The object files collection can be used as source inputs to other targets:
@ -83,10 +107,11 @@ they may not be installed, exported, or used in the right hand side of
:command:`target_link_libraries`. They also may not be used as the ``TARGET`` :command:`target_link_libraries`. They also may not be used as the ``TARGET``
in a use of the :command:`add_custom_command(TARGET)` command signature. in a use of the :command:`add_custom_command(TARGET)` command signature.
Commands such as :command:`add_custom_command`, which generates rules to be Although object libraries may not be named directly in calls to
run at build time can transparently use an :prop_tgt:`EXECUTABLE <TYPE>` the :command:`target_link_libraries` command, they can be "linked"
target as a ``COMMAND`` executable. The buildsystem rules will ensure that indirectly by using an :ref:`Interface Library <Interface Libraries>`
the executable is built before attempting to run the command. whose :prop_tgt:`INTERFACE_SOURCES` target property is set to name
``$<TARGET_OBJECTS:objlib>``.
Build Specification and Usage Requirements Build Specification and Usage Requirements
========================================== ==========================================
@ -245,7 +270,11 @@ be specified in the order ``lib3`` ``lib1`` ``lib2``:
target_link_libraries(myExe lib1 lib2 lib3) target_link_libraries(myExe lib1 lib2 lib3)
target_include_directories(myExe target_include_directories(myExe
PRIVATE $<TARGET_PROPERTY:INTERFACE_INCLUDE_DIRECTORIES:lib3>) PRIVATE $<TARGET_PROPERTY:lib3,INTERFACE_INCLUDE_DIRECTORIES>)
Note that care must be taken when specifying usage requirements for targets
which will be exported for installation using the :command:`install(EXPORT)`
command. See :ref:`Creating Packages` for more.
.. _`Compatible Interface Properties`: .. _`Compatible Interface Properties`:
@ -551,7 +580,7 @@ exporting see the :manual:`cmake-packages(7)` manual.
.. _`Include Directories and Usage Requirements`: .. _`Include Directories and Usage Requirements`:
Include Directories and Usage Requirements Include Directories and Usage Requirements
'''''''''''''''''''''''''''''''''''''''''' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Include directories require some special consideration when specified as usage Include directories require some special consideration when specified as usage
requirements and when used with generator expressions. The requirements and when used with generator expressions. The
@ -786,11 +815,12 @@ It may specify usage requirements such as
:prop_tgt:`INTERFACE_COMPILE_DEFINITIONS`, :prop_tgt:`INTERFACE_COMPILE_DEFINITIONS`,
:prop_tgt:`INTERFACE_COMPILE_OPTIONS`, :prop_tgt:`INTERFACE_COMPILE_OPTIONS`,
:prop_tgt:`INTERFACE_LINK_LIBRARIES`, and :prop_tgt:`INTERFACE_LINK_LIBRARIES`, and
:prop_tgt:`INTERFACE_SOURCES`,
:prop_tgt:`INTERFACE_POSITION_INDEPENDENT_CODE`. :prop_tgt:`INTERFACE_POSITION_INDEPENDENT_CODE`.
Only the ``INTERFACE`` modes of the :command:`target_include_directories`, Only the ``INTERFACE`` modes of the :command:`target_include_directories`,
:command:`target_compile_definitions`, :command:`target_compile_options`, :command:`target_compile_definitions`, :command:`target_compile_options`,
and :command:`target_link_libraries` commands may be used with ``INTERFACE`` :command:`target_sources`, and :command:`target_link_libraries` commands
libraries. may be used with ``INTERFACE`` libraries.
A primary use-case for ``INTERFACE`` libraries is header-only libraries. A primary use-case for ``INTERFACE`` libraries is header-only libraries.

@ -3,7 +3,7 @@
cmake-commands(7) cmake-commands(7)
***************** *****************
.. only:: html or latex .. only:: html
.. contents:: .. contents::
@ -31,6 +31,7 @@ These commands may be used freely in CMake projects.
/command/cmake_minimum_required /command/cmake_minimum_required
/command/cmake_policy /command/cmake_policy
/command/configure_file /command/configure_file
/command/continue
/command/create_test_sourcelist /command/create_test_sourcelist
/command/define_property /command/define_property
/command/elseif /command/elseif
@ -67,6 +68,7 @@ These commands may be used freely in CMake projects.
/command/include /command/include
/command/install /command/install
/command/link_directories /command/link_directories
/command/link_libraries
/command/list /command/list
/command/load_cache /command/load_cache
/command/load_command /command/load_command
@ -91,9 +93,11 @@ These commands may be used freely in CMake projects.
/command/source_group /command/source_group
/command/string /command/string
/command/target_compile_definitions /command/target_compile_definitions
/command/target_compile_features
/command/target_compile_options /command/target_compile_options
/command/target_include_directories /command/target_include_directories
/command/target_link_libraries /command/target_link_libraries
/command/target_sources
/command/try_compile /command/try_compile
/command/try_run /command/try_run
/command/unset /command/unset
@ -115,7 +119,6 @@ versions of CMake. Do not use them in new code.
/command/install_files /command/install_files
/command/install_programs /command/install_programs
/command/install_targets /command/install_targets
/command/link_libraries
/command/make_directory /command/make_directory
/command/output_required_files /command/output_required_files
/command/remove /command/remove
@ -126,6 +129,8 @@ versions of CMake. Do not use them in new code.
/command/variable_requires /command/variable_requires
/command/write_file /command/write_file
.. _`CTest Commands`:
CTest Commands CTest Commands
============== ==============

@ -0,0 +1,297 @@
.. cmake-manual-description: CMake Compile Features Reference
cmake-compile-features(7)
*************************
.. only:: html
.. contents::
Introduction
============
Project source code may depend on, or be conditional on, the availability
of certain features of the compiler. There are three use-cases which arise:
`Compile Feature Requirements`_, `Optional Compile Features`_
and `Conditional Compilation Options`_.
While features are typically specified in programming language standards,
CMake provides a primary user interface based on granular handling of
the features, not the language standard that introduced the feature.
The :prop_gbl:`CMAKE_C_KNOWN_FEATURES` and
:prop_gbl:`CMAKE_CXX_KNOWN_FEATURES` global properties contain all the
features known to CMake, regardless of compiler support for the feature.
The :variable:`CMAKE_C_COMPILE_FEATURES` and
:variable:`CMAKE_CXX_COMPILE_FEATURES` variables contain all features
CMake knows are known to the compiler, regardless of language standard
or compile flags needed to use them.
Features known to CMake are named mostly following the same convention
as the Clang feature test macros. The are some exceptions, such as
CMake using ``cxx_final`` and ``cxx_override`` instead of the single
``cxx_override_control`` used by Clang.
Compile Feature Requirements
============================
Compile feature requirements may be specified with the
:command:`target_compile_features` command. For example, if a target must
be compiled with compiler support for the
:prop_gbl:`cxx_constexpr <CMAKE_CXX_KNOWN_FEATURES>` feature:
.. code-block:: cmake
add_library(mylib requires_constexpr.cpp)
target_compile_features(mylib PRIVATE cxx_constexpr)
In processing the requirement for the ``cxx_constexpr`` feature,
:manual:`cmake(1)` will ensure that the in-use C++ compiler is capable
of the feature, and will add any necessary flags such as ``-std=gnu++11``
to the compile lines of C++ files in the ``mylib`` target. A
``FATAL_ERROR`` is issued if the compiler is not capable of the
feature.
The exact compile flags and language standard are deliberately not part
of the user interface for this use-case. CMake will compute the
appropriate compile flags to use by considering the features specified
for each target.
Such compile flags are added even if the compiler supports the
particular feature without the flag. For example, the GNU compiler
supports variadic templates (with a warning) even if ``-std=gnu++98`` is
used. CMake adds the ``-std=gnu++11`` flag if ``cxx_variadic_templates``
is specified as a requirement.
In the above example, ``mylib`` requires ``cxx_constexpr`` when it
is built itself, but consumers of ``mylib`` are not required to use a
compiler which supports ``cxx_constexpr``. If the interface of
``mylib`` does require the ``cxx_constexpr`` feature (or any other
known feature), that may be specified with the ``PUBLIC`` or
``INTERFACE`` signatures of :command:`target_compile_features`:
.. code-block:: cmake
add_library(mylib requires_constexpr.cpp)
# cxx_constexpr is a usage-requirement
target_compile_features(mylib PUBLIC cxx_constexpr)
# main.cpp will be compiled with -std=gnu++11 on GNU for cxx_constexpr.
add_executable(myexe main.cpp)
target_link_libraries(myexe mylib)
Feature requirements are evaluated transitively by consuming the link
implementation. See :manual:`cmake-buildsystem(7)` for more on
transitive behavior of build properties and usage requirements.
Because the :prop_tgt:`CXX_EXTENSIONS` target property is ``ON`` by default,
CMake uses extended variants of language dialects by default, such as
``-std=gnu++11`` instead of ``-std=c++11``. That target property may be
set to ``OFF`` to use the non-extended variant of the dialect flag. Note
that because most compilers enable extensions by default, this could
expose cross-platform bugs in user code or in the headers of third-party
dependencies.
Optional Compile Features
=========================
Compile features may be preferred if available, without creating a hard
requirement. For example, a library may provides alternative
implementations depending on whether the ``cxx_variadic_templates``
feature is available:
.. code-block:: c++
#if Foo_COMPILER_CXX_VARIADIC_TEMPLATES
template<int I, int... Is>
struct Interface;
template<int I>
struct Interface<I>
{
static int accumulate()
{
return I;
}
};
template<int I, int... Is>
struct Interface
{
static int accumulate()
{
return I + Interface<Is...>::accumulate();
}
};
#else
template<int I1, int I2 = 0, int I3 = 0, int I4 = 0>
struct Interface
{
static int accumulate() { return I1 + I2 + I3 + I4; }
};
#endif
Such an interface depends on using the correct preprocessor defines for the
compiler features. CMake can generate a header file containing such
defines using the :module:`WriteCompilerDetectionHeader` module. The
module contains the ``write_compiler_detection_header`` function which
accepts parameters to control the content of the generated header file:
.. code-block:: cmake
write_compiler_detection_header(
FILE "${CMAKE_CURRENT_BINARY_DIR}/foo_compiler_detection.h"
PREFIX Foo
COMPILERS GNU
FEATURES
cxx_variadic_templates
)
Such a header file may be used internally in the source code of a project,
and it may be installed and used in the interface of library code.
For each feature listed in ``FEATURES``, a preprocessor definition
is created in the header file, and defined to either ``1`` or ``0``.
Additionally, some features call for additional defines, such as the
``cxx_final`` and ``cxx_override`` features. Rather than being used in
``#ifdef`` code, the ``final`` keyword is abstracted by a symbol
which is defined to either ``final``, a compiler-specific equivalent, or
to empty. That way, C++ code can be written to unconditionally use the
symbol, and compiler support determines what it is expanded to:
.. code-block:: c++
struct Interface {
virtual void Execute() = 0;
};
struct Concrete Foo_FINAL {
void Execute() Foo_OVERRIDE;
};
In this case, ``Foo_FINAL`` will expand to ``final`` if the
compiler supports the keyword, or to empty otherwise.
In this use-case, the CMake code will wish to enable a particular language
standard if available from the compiler. The :prop_tgt:`CXX_STANDARD`
target property variable may be set to the desired language standard
for a particular target, and the :variable:`CMAKE_CXX_STANDARD` may be
set to influence all following targets:
.. code-block:: cmake
write_compiler_detection_header(
FILE "${CMAKE_CURRENT_BINARY_DIR}/foo_compiler_detection.h"
PREFIX Foo
COMPILERS GNU
FEATURES
cxx_final cxx_override
)
# Includes foo_compiler_detection.h and uses the Foo_FINAL symbol
# which will expand to 'final' if the compiler supports the requested
# CXX_STANDARD.
add_library(foo foo.cpp)
set_property(TARGET foo PROPERTY CXX_STANDARD 11)
# Includes foo_compiler_detection.h and uses the Foo_FINAL symbol
# which will expand to 'final' if the compiler supports the feature,
# even though CXX_STANDARD is not set explicitly. The requirement of
# cxx_constexpr causes CMake to set CXX_STANDARD internally, which
# affects the compile flags.
add_library(foo_impl foo_impl.cpp)
target_compile_features(foo_impl PRIVATE cxx_constexpr)
The ``write_compiler_detection_header`` function also creates compatibility
code for other features which have standard equivalents. For example, the
``cxx_static_assert`` feature is emulated with a template and abstracted
via the ``<PREFIX>_STATIC_ASSERT`` and ``<PREFIX>_STATIC_ASSERT_MSG``
function-macros.
Conditional Compilation Options
===============================
Libraries may provide entirely different header files depending on
requested compiler features.
For example, a header at ``with_variadics/interface.h`` may contain:
.. code-block:: c++
template<int I, int... Is>
struct Interface;
template<int I>
struct Interface<I>
{
static int accumulate()
{
return I;
}
};
template<int I, int... Is>
struct Interface
{
static int accumulate()
{
return I + Interface<Is...>::accumulate();
}
};
while a header at ``no_variadics/interface.h`` may contain:
.. code-block:: c++
template<int I1, int I2 = 0, int I3 = 0, int I4 = 0>
struct Interface
{
static int accumulate() { return I1 + I2 + I3 + I4; }
};
It would be possible to write a abstraction ``interface.h`` header
containing something like:
.. code-block:: c++
#include "foo_compiler_detection.h"
#if Foo_COMPILER_CXX_VARIADIC_TEMPLATES
#include "with_variadics/interface.h"
#else
#include "no_variadics/interface.h"
#endif
However this could be unmaintainable if there are many files to
abstract. What is needed is to use alternative include directories
depending on the compiler capabilities.
CMake provides a ``COMPILE_FEATURES``
:manual:`generator expression <cmake-generator-expressions(7)>` to implement
such conditions. This may be used with the build-property commands such as
:command:`target_include_directories` and :command:`target_link_libraries`
to set the appropriate :manual:`buildsystem <cmake-buildsystem(7)>`
properties:
.. code-block:: cmake
add_library(foo INTERFACE)
set(with_variadics ${CMAKE_CURRENT_SOURCE_DIR}/with_variadics)
set(no_variadics ${CMAKE_CURRENT_SOURCE_DIR}/no_variadics)
target_link_libraries(foo
INTERFACE
"$<$<COMPILE_FEATURES:cxx_variadic_templates>:${with_variadics}>"
"$<$<NOT:$<COMPILE_FEATURES:cxx_variadic_templates>>:${no_variadics}>"
)
Consuming code then simply links to the ``foo`` target as usual and uses
the feature-appropriate include directory
.. code-block:: cmake
add_executable(consumer_with consumer_with.cpp)
target_link_libraries(consumer_with foo)
set_property(TARGET consumer_with CXX_STANDARD 11)
add_executable(consumer_no consumer_no.cpp)
target_link_libraries(consumer_no foo)

File diff suppressed because it is too large Load Diff

@ -3,7 +3,7 @@
cmake-generator-expressions(7) cmake-generator-expressions(7)
****************************** ******************************
.. only:: html or latex .. only:: html
.. contents:: .. contents::
@ -38,6 +38,8 @@ create conditional output::
expands to ``DEBUG_MODE`` when the ``Debug`` configuration is used, and expands to ``DEBUG_MODE`` when the ``Debug`` configuration is used, and
otherwise expands to nothing. otherwise expands to nothing.
Available logical expressions are:
``$<0:...>`` ``$<0:...>``
Empty string (ignores ``...``) Empty string (ignores ``...``)
``$<1:...>`` ``$<1:...>``
@ -83,6 +85,14 @@ otherwise expands to nothing.
else ``0``. If the policy was not set, the warning message for the policy else ``0``. If the policy was not set, the warning message for the policy
will be emitted. This generator expression only works for a subset of will be emitted. This generator expression only works for a subset of
policies. policies.
``$<COMPILE_FEATURES:feature[,feature]...>``
``1`` if all of the ``feature`` features are available for the 'head'
target, and ``0`` otherwise. If this expression is used while evaluating
the link implementation of a target and if any dependency transitively
increases the required :prop_tgt:`C_STANDARD` or :prop_tgt:`CXX_STANDARD`
for the 'head' target, an error is reported. See the
:manual:`cmake-compile-features(7)` manual for information on
compile features.
Informational Expressions Informational Expressions
========================= =========================
@ -103,20 +113,27 @@ expands to ``OLD_COMPILER`` if the
:variable:`CMAKE_CXX_COMPILER_VERSION <CMAKE_<LANG>_COMPILER_VERSION>` is less :variable:`CMAKE_CXX_COMPILER_VERSION <CMAKE_<LANG>_COMPILER_VERSION>` is less
than 4.2.0. than 4.2.0.
Available informational expressions are:
``$<CONFIGURATION>`` ``$<CONFIGURATION>``
Configuration name. Deprecated. Use ``CONFIG`` instead. Configuration name. Deprecated. Use ``CONFIG`` instead.
``$<CONFIG>`` ``$<CONFIG>``
Configuration name Configuration name
``$<PLATFORM_ID>`` ``$<PLATFORM_ID>``
The CMake-id of the platform The CMake-id of the platform.
See also the :variable:`CMAKE_SYSTEM_NAME` variable.
``$<C_COMPILER_ID>`` ``$<C_COMPILER_ID>``
The CMake-id of the C compiler used. The CMake-id of the C compiler used.
See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable.
``$<CXX_COMPILER_ID>`` ``$<CXX_COMPILER_ID>``
The CMake-id of the CXX compiler used. The CMake-id of the CXX compiler used.
See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable.
``$<C_COMPILER_VERSION>`` ``$<C_COMPILER_VERSION>``
The version of the C compiler used. The version of the C compiler used.
See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
``$<CXX_COMPILER_VERSION>`` ``$<CXX_COMPILER_VERSION>``
The version of the CXX compiler used. The version of the CXX compiler used.
See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
``$<TARGET_FILE:tgt>`` ``$<TARGET_FILE:tgt>``
Full path to main file (.exe, .so.1.2, .a) where ``tgt`` is the name of a target. Full path to main file (.exe, .so.1.2, .a) where ``tgt`` is the name of a target.
``$<TARGET_FILE_NAME:tgt>`` ``$<TARGET_FILE_NAME:tgt>``
@ -135,6 +152,17 @@ than 4.2.0.
Name of file with soname (.so.3). Name of file with soname (.so.3).
``$<TARGET_SONAME_FILE_DIR:tgt>`` ``$<TARGET_SONAME_FILE_DIR:tgt>``
Directory of with soname (.so.3). Directory of with soname (.so.3).
``$<TARGET_PDB_FILE:tgt>``
Full path to the linker generated program database file (.pdb)
where ``tgt`` is the name of a target.
See also the :prop_tgt:`PDB_NAME` and :prop_tgt:`PDB_OUTPUT_DIRECTORY`
target properties and their configuration specific variants
:prop_tgt:`PDB_NAME_<CONFIG>` and :prop_tgt:`PDB_OUTPUT_DIRECTORY_<CONFIG>`.
``$<TARGET_PDB_FILE_NAME:tgt>``
Name of the linker generated program database file (.pdb).
``$<TARGET_PDB_FILE_DIR:tgt>``
Directory of the linker generated program database file (.pdb).
``$<TARGET_PROPERTY:tgt,prop>`` ``$<TARGET_PROPERTY:tgt,prop>``
Value of the property ``prop`` on the target ``tgt``. Value of the property ``prop`` on the target ``tgt``.
@ -161,7 +189,13 @@ property with each entry preceeded by ``-I``. Note that a more-complete use
in this situation would require first checking if the INCLUDE_DIRECTORIES in this situation would require first checking if the INCLUDE_DIRECTORIES
property is non-empty:: property is non-empty::
$<$<BOOL:$<TARGET_PROPERTY:INCLUDE_DIRECTORIES>>:-I$<JOIN:$<TARGET_PROPERTY:INCLUDE_DIRECTORIES>, -I>> $<$<BOOL:${prop}>:-I$<JOIN:${prop}, -I>>
where ``${prop}`` refers to a helper variable::
set(prop "$<TARGET_PROPERTY:INCLUDE_DIRECTORIES>")
Available output expressions are:
``$<JOIN:list,...>`` ``$<JOIN:list,...>``
Joins the list with the content of ``...`` Joins the list with the content of ``...``
@ -175,6 +209,13 @@ property is non-empty::
Marks ``...`` as being the name of a target. This is required if exporting Marks ``...`` as being the name of a target. This is required if exporting
targets to multiple dependent export sets. The ``...`` must be a literal targets to multiple dependent export sets. The ``...`` must be a literal
name of a target- it may not contain generator expressions. name of a target- it may not contain generator expressions.
``$<LINK_ONLY:...>``
Content of ``...`` except when evaluated in a link interface while
propagating :ref:`Target Usage Requirements`, in which case it is the
empty string.
Intended for use only in an :prop_tgt:`INTERFACE_LINK_LIBRARIES` target
property, perhaps via the :command:`target_link_libraries` command,
to specify private link dependencies without other usage requirements.
``$<INSTALL_INTERFACE:...>`` ``$<INSTALL_INTERFACE:...>``
Content of ``...`` when the property is exported using :command:`install(EXPORT)`, Content of ``...`` when the property is exported using :command:`install(EXPORT)`,
and empty otherwise. and empty otherwise.
@ -188,3 +229,8 @@ property is non-empty::
Content of ``...`` converted to upper case. Content of ``...`` converted to upper case.
``$<MAKE_C_IDENTIFIER:...>`` ``$<MAKE_C_IDENTIFIER:...>``
Content of ``...`` converted to a C identifier. Content of ``...`` converted to a C identifier.
``$<TARGET_OBJECTS:objLib>``
List of objects resulting from build of ``objLib``. ``objLib`` must be an
object of type ``OBJECT_LIBRARY``. This expression may only be used in
the sources of :command:`add_library` and :command:`add_executable`
commands.

@ -3,7 +3,7 @@
cmake-generators(7) cmake-generators(7)
******************* *******************
.. only:: html or latex .. only:: html
.. contents:: .. contents::
@ -64,6 +64,7 @@ one may launch CMake from any environment.
/generator/Visual Studio 10 2010 /generator/Visual Studio 10 2010
/generator/Visual Studio 11 2012 /generator/Visual Studio 11 2012
/generator/Visual Studio 12 2013 /generator/Visual Studio 12 2013
/generator/Visual Studio 14 2015
/generator/Xcode /generator/Xcode
Extra Generators Extra Generators

@ -3,7 +3,7 @@
cmake-language(7) cmake-language(7)
***************** *****************
.. only:: html or latex .. only:: html
.. contents:: .. contents::
@ -57,17 +57,21 @@ variable.
Syntax Syntax
====== ======
.. _`CMake Language Encoding`:
Encoding Encoding
-------- --------
A CMake Language source file must be written in 7-bit ASCII text A CMake Language source file may be written in 7-bit ASCII text for
to be portable across all supported platforms. Newlines may be maximum portability across all supported platforms. Newlines may be
encoded as either ``\n`` or ``\r\n`` but will be converted to ``\n`` encoded as either ``\n`` or ``\r\n`` but will be converted to ``\n``
as input files are read. as input files are read.
Note that the implementation is 8-bit clean so source files may Note that the implementation is 8-bit clean so source files may
be encoded as UTF-8 on platforms with system APIs supporting this be encoded as UTF-8 on platforms with system APIs supporting this
encoding. Furthermore, CMake 3.0 and above allow a leading UTF-8 encoding. In addition, CMake 3.2 and above support source files
encoded in UTF-8 on Windows (using UTF-16 to call system APIs).
Furthermore, CMake 3.0 and above allow a leading UTF-8
`Byte-Order Mark`_ in source files. `Byte-Order Mark`_ in source files.
.. _`Byte-Order Mark`: http://en.wikipedia.org/wiki/Byte_order_mark .. _`Byte-Order Mark`: http://en.wikipedia.org/wiki/Byte_order_mark
@ -79,6 +83,10 @@ A CMake Language source file consists of zero or more
`Command Invocations`_ separated by newlines and optionally `Command Invocations`_ separated by newlines and optionally
spaces and `Comments`_: spaces and `Comments`_:
.. raw:: latex
\begin{small}
.. productionlist:: .. productionlist::
file: `file_element`* file: `file_element`*
file_element: `command_invocation` `line_ending` | file_element: `command_invocation` `line_ending` |
@ -87,6 +95,10 @@ spaces and `Comments`_:
space: <match '[ \t]+'> space: <match '[ \t]+'>
newline: <match '\n'> newline: <match '\n'>
.. raw:: latex
\end{small}
Note that any source file line not inside `Command Arguments`_ or Note that any source file line not inside `Command Arguments`_ or
a `Bracket Comment`_ can end in a `Line Comment`_. a `Bracket Comment`_ can end in a `Line Comment`_.
@ -98,6 +110,10 @@ Command Invocations
A *command invocation* is a name followed by paren-enclosed arguments A *command invocation* is a name followed by paren-enclosed arguments
separated by whitespace: separated by whitespace:
.. raw:: latex
\begin{small}
.. productionlist:: .. productionlist::
command_invocation: `space`* `identifier` `space`* '(' `arguments` ')' command_invocation: `space`* `identifier` `space`* '(' `arguments` ')'
identifier: <match '[A-Za-z_][A-Za-z0-9_]*'> identifier: <match '[A-Za-z_][A-Za-z0-9_]*'>
@ -106,6 +122,10 @@ separated by whitespace:
: `separation`* '(' `arguments` ')' : `separation`* '(' `arguments` ')'
separation: `space` | `line_ending` separation: `space` | `line_ending`
.. raw:: latex
\end{small}
For example: For example:
.. code-block:: cmake .. code-block:: cmake
@ -137,9 +157,17 @@ Command Arguments
There are three types of arguments within `Command Invocations`_: There are three types of arguments within `Command Invocations`_:
.. raw:: latex
\begin{small}
.. productionlist:: .. productionlist::
argument: `bracket_argument` | `quoted_argument` | `unquoted_argument` argument: `bracket_argument` | `quoted_argument` | `unquoted_argument`
.. raw:: latex
\end{small}
.. _`Bracket Argument`: .. _`Bracket Argument`:
Bracket Argument Bracket Argument
@ -149,6 +177,10 @@ A *bracket argument*, inspired by `Lua`_ long bracket syntax,
encloses content between opening and closing "brackets" of the encloses content between opening and closing "brackets" of the
same length: same length:
.. raw:: latex
\begin{small}
.. productionlist:: .. productionlist::
bracket_argument: `bracket_open` `bracket_content` `bracket_close` bracket_argument: `bracket_open` `bracket_content` `bracket_close`
bracket_open: '[' '='{len} '[' bracket_open: '[' '='{len} '['
@ -156,6 +188,10 @@ same length:
: of the same {len} as the `bracket_open`> : of the same {len} as the `bracket_open`>
bracket_close: ']' '='{len} ']' bracket_close: ']' '='{len} ']'
.. raw:: latex
\end{small}
An opening bracket of length *len >= 0* is written ``[`` followed An opening bracket of length *len >= 0* is written ``[`` followed
by *len* ``=`` followed by ``[`` and the corresponding closing by *len* ``=`` followed by ``[`` and the corresponding closing
bracket is written ``]`` followed by *len* ``=`` followed by ``]``. bracket is written ``]`` followed by *len* ``=`` followed by ``]``.
@ -197,6 +233,10 @@ Quoted Argument
A *quoted argument* encloses content between opening and closing A *quoted argument* encloses content between opening and closing
double-quote characters: double-quote characters:
.. raw:: latex
\begin{small}
.. productionlist:: .. productionlist::
quoted_argument: '"' `quoted_element`* '"' quoted_argument: '"' `quoted_element`* '"'
quoted_element: <any character except '\' or '"'> | quoted_element: <any character except '\' or '"'> |
@ -204,6 +244,10 @@ double-quote characters:
: `quoted_continuation` : `quoted_continuation`
quoted_continuation: '\' `newline` quoted_continuation: '\' `newline`
.. raw:: latex
\end{small}
Quoted argument content consists of all text between opening and Quoted argument content consists of all text between opening and
closing quotes. Both `Escape Sequences`_ and `Variable References`_ closing quotes. Both `Escape Sequences`_ and `Variable References`_
are evaluated. A quoted argument is always given to the command are evaluated. A quoted argument is always given to the command
@ -246,12 +290,20 @@ An *unquoted argument* is not enclosed by any quoting syntax.
It may not contain any whitespace, ``(``, ``)``, ``#``, ``"``, or ``\`` It may not contain any whitespace, ``(``, ``)``, ``#``, ``"``, or ``\``
except when escaped by a backslash: except when escaped by a backslash:
.. raw:: latex
\begin{small}
.. productionlist:: .. productionlist::
unquoted_argument: `unquoted_element`+ | `unquoted_legacy` unquoted_argument: `unquoted_element`+ | `unquoted_legacy`
unquoted_element: <any character except whitespace or one of '()#"\'> | unquoted_element: <any character except whitespace or one of '()#"\'> |
: `escape_sequence` : `escape_sequence`
unquoted_legacy: <see note in text> unquoted_legacy: <see note in text>
.. raw:: latex
\end{small}
Unquoted argument content consists of all text in a contiguous block Unquoted argument content consists of all text in a contiguous block
of allowed or escaped characters. Both `Escape Sequences`_ and of allowed or escaped characters. Both `Escape Sequences`_ and
`Variable References`_ are evaluated. The resulting value is divided `Variable References`_ are evaluated. The resulting value is divided
@ -287,23 +339,37 @@ For example:
Instead use a `Quoted Argument`_ or a `Bracket Argument`_ to Instead use a `Quoted Argument`_ or a `Bracket Argument`_ to
represent the content. represent the content.
.. _`Escape Sequences`:
Escape Sequences Escape Sequences
---------------- ----------------
An *escape sequence* is a ``\`` followed by one character: An *escape sequence* is a ``\`` followed by one character:
.. raw:: latex
\begin{small}
.. productionlist:: .. productionlist::
escape_sequence: `escape_identity` | `escape_encoded` | `escape_semicolon` escape_sequence: `escape_identity` | `escape_encoded` | `escape_semicolon`
escape_identity: '\(' | '\)' | '\#' | '\"' | '\ ' | escape_identity: '\' <match '[^A-Za-z0-9;]'>
: '\\' | '\$' | '\@' | '\^'
escape_encoded: '\t' | '\r' | '\n' escape_encoded: '\t' | '\r' | '\n'
escape_semicolon: '\;' escape_semicolon: '\;'
A ``\`` followed by one of ``()#" \#@^`` simply encodes the literal .. raw:: latex
\end{small}
A ``\`` followed by a non-alphanumeric character simply encodes the literal
character without interpreting it as syntax. A ``\t``, ``\r``, or ``\n`` character without interpreting it as syntax. A ``\t``, ``\r``, or ``\n``
encodes a tab, carriage return, or newline character, respectively. encodes a tab, carriage return, or newline character, respectively. A ``\;``
A ``\;`` encodes itself but may be used in an `Unquoted Argument`_ outside of any `Variable References`_ encodes itself but may be used in an
to encode the ``;`` without dividing the argument value on it. `Unquoted Argument`_ to encode the ``;`` without dividing the argument
value on it. A ``\;`` inside `Variable References`_ encodes the literal
``;`` character. (See also policy :policy:`CMP0053` documentation for
historical considerations.)
.. _`Variable References`:
Variable References Variable References
------------------- -------------------
@ -315,6 +381,11 @@ or by the empty string if the variable is not set.
Variable references can nest and are evaluated from the Variable references can nest and are evaluated from the
inside out, e.g. ``${outer_${inner_variable}_variable}``. inside out, e.g. ``${outer_${inner_variable}_variable}``.
Literal variable references may consist of alphanumeric characters,
the characters ``/_.+-``, and `Escape Sequences`_. Nested references
may be used to evaluate variables of any name. (See also policy
:policy:`CMP0053` documentation for historical considerations.)
The `Variables`_ section documents the scope of variable names The `Variables`_ section documents the scope of variable names
and how their values are set. and how their values are set.
@ -337,9 +408,17 @@ Bracket Comment
A ``#`` immediately followed by a `Bracket Argument`_ forms a A ``#`` immediately followed by a `Bracket Argument`_ forms a
*bracket comment* consisting of the entire bracket enclosure: *bracket comment* consisting of the entire bracket enclosure:
.. raw:: latex
\begin{small}
.. productionlist:: .. productionlist::
bracket_comment: '#' `bracket_argument` bracket_comment: '#' `bracket_argument`
.. raw:: latex
\end{small}
For example: For example:
.. code-block:: cmake .. code-block:: cmake
@ -360,10 +439,18 @@ Line Comment
A ``#`` not immediately followed by a `Bracket Argument`_ forms a A ``#`` not immediately followed by a `Bracket Argument`_ forms a
*line comment* that runs until the end of the line: *line comment* that runs until the end of the line:
.. raw:: latex
\begin{small}
.. productionlist:: .. productionlist::
line_comment: '#' <any text not starting in a `bracket_argument` line_comment: '#' <any text not starting in a `bracket_argument`
: and not containing a `newline`> : and not containing a `newline`>
.. raw:: latex
\end{small}
For example: For example:
.. code-block:: cmake .. code-block:: cmake
@ -386,8 +473,10 @@ Loops
The :command:`foreach`/:command:`endforeach` and The :command:`foreach`/:command:`endforeach` and
:command:`while`/:command:`endwhile` commands delimit code :command:`while`/:command:`endwhile` commands delimit code
blocks to be executed in a loop. The :command:`break` command blocks to be executed in a loop. Inside such blocks the
may be used inside such blocks to terminate the loop early. :command:`break` command may be used to terminate the loop
early whereas the :command:`continue` command may be used
to start with the next iteration immediately.
Command Definitions Command Definitions
------------------- -------------------

@ -3,7 +3,7 @@
cmake-modules(7) cmake-modules(7)
**************** ****************
.. only:: html or latex .. only:: html
.. contents:: .. contents::
@ -23,6 +23,7 @@ All Modules
/module/CheckCXXSourceRuns /module/CheckCXXSourceRuns
/module/CheckCXXSymbolExists /module/CheckCXXSymbolExists
/module/CheckFortranFunctionExists /module/CheckFortranFunctionExists
/module/CheckFortranSourceCompiles
/module/CheckFunctionExists /module/CheckFunctionExists
/module/CheckIncludeFileCXX /module/CheckIncludeFileCXX
/module/CheckIncludeFile /module/CheckIncludeFile
@ -55,12 +56,14 @@ All Modules
/module/CPackCygwin /module/CPackCygwin
/module/CPackDeb /module/CPackDeb
/module/CPackDMG /module/CPackDMG
/module/CPackIFW
/module/CPackNSIS /module/CPackNSIS
/module/CPackPackageMaker /module/CPackPackageMaker
/module/CPackRPM /module/CPackRPM
/module/CPack /module/CPack
/module/CPackWIX /module/CPackWIX
/module/CTest /module/CTest
/module/CTestCoverageCollectGCOV
/module/CTestScriptMode /module/CTestScriptMode
/module/CTestUseLaunchers /module/CTestUseLaunchers
/module/Dart /module/Dart
@ -106,6 +109,7 @@ All Modules
/module/FindGLUT /module/FindGLUT
/module/FindGnuplot /module/FindGnuplot
/module/FindGnuTLS /module/FindGnuTLS
/module/FindGSL
/module/FindGTest /module/FindGTest
/module/FindGTK2 /module/FindGTK2
/module/FindGTK /module/FindGTK
@ -113,8 +117,10 @@ All Modules
/module/FindHg /module/FindHg
/module/FindHSPELL /module/FindHSPELL
/module/FindHTMLHelp /module/FindHTMLHelp
/module/FindIce
/module/FindIcotool /module/FindIcotool
/module/FindImageMagick /module/FindImageMagick
/module/FindIntl
/module/FindITK /module/FindITK
/module/FindJasper /module/FindJasper
/module/FindJava /module/FindJava
@ -138,6 +144,7 @@ All Modules
/module/FindMPEG /module/FindMPEG
/module/FindMPI /module/FindMPI
/module/FindOpenAL /module/FindOpenAL
/module/FindOpenCL
/module/FindOpenGL /module/FindOpenGL
/module/FindOpenMP /module/FindOpenMP
/module/FindOpenSceneGraph /module/FindOpenSceneGraph
@ -204,6 +211,7 @@ All Modules
/module/FindWish /module/FindWish
/module/FindwxWidgets /module/FindwxWidgets
/module/FindwxWindows /module/FindwxWindows
/module/FindXercesC
/module/FindX11 /module/FindX11
/module/FindXMLRPC /module/FindXMLRPC
/module/FindZLIB /module/FindZLIB
@ -231,3 +239,4 @@ All Modules
/module/UsewxWidgets /module/UsewxWidgets
/module/Use_wxWindows /module/Use_wxWindows
/module/WriteBasicConfigVersionFile /module/WriteBasicConfigVersionFile
/module/WriteCompilerDetectionHeader

@ -3,7 +3,7 @@
cmake-packages(7) cmake-packages(7)
***************** *****************
.. only:: html or latex .. only:: html
.. contents:: .. contents::
@ -76,6 +76,8 @@ By setting the :variable:`CMAKE_DISABLE_FIND_PACKAGE_<PackageName>` variable to
``TRUE``, the ``PackageName`` package will not be searched, and will always ``TRUE``, the ``PackageName`` package will not be searched, and will always
be ``NOTFOUND``. be ``NOTFOUND``.
.. _`Config File Packages`:
Config-file Packages Config-file Packages
-------------------- --------------------
@ -260,6 +262,8 @@ The variables report the version of the package that was actually found.
The ``<package>`` part of their name matches the argument given to the The ``<package>`` part of their name matches the argument given to the
:command:`find_package` command. :command:`find_package` command.
.. _`Creating Packages`:
Creating Packages Creating Packages
================= =================
@ -282,7 +286,8 @@ shared library:
generate_export_header(ClimbingStats) generate_export_header(ClimbingStats)
set_property(TARGET ClimbingStats PROPERTY VERSION ${Upstream_VERSION}) set_property(TARGET ClimbingStats PROPERTY VERSION ${Upstream_VERSION})
set_property(TARGET ClimbingStats PROPERTY SOVERSION 3) set_property(TARGET ClimbingStats PROPERTY SOVERSION 3)
set_property(TARGET ClimbingStats PROPERTY INTERFACE_ClimbingStats_MAJOR_VERSION 3) set_property(TARGET ClimbingStats PROPERTY
INTERFACE_ClimbingStats_MAJOR_VERSION 3)
set_property(TARGET ClimbingStats APPEND PROPERTY set_property(TARGET ClimbingStats APPEND PROPERTY
COMPATIBLE_INTERFACE_STRING ClimbingStats_MAJOR_VERSION COMPATIBLE_INTERFACE_STRING ClimbingStats_MAJOR_VERSION
) )
@ -316,7 +321,7 @@ shared library:
) )
configure_file(cmake/ClimbingStatsConfig.cmake configure_file(cmake/ClimbingStatsConfig.cmake
"${CMAKE_CURRENT_BINARY_DIR}/ClimbingStats/ClimbingStatsConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/ClimbingStats/ClimbingStatsConfig.cmake"
COPY_ONLY COPYONLY
) )
set(ConfigPackageLocation lib/cmake/ClimbingStats) set(ConfigPackageLocation lib/cmake/ClimbingStats)
@ -353,7 +358,7 @@ and a ``cmake/ClimbingStatsConfig.cmake`` are installed to the same location,
completing the package. completing the package.
The generated :prop_tgt:`IMPORTED` targets have appropriate properties set The generated :prop_tgt:`IMPORTED` targets have appropriate properties set
to define their usage requirements, such as to define their :ref:`usage requirements <Target Usage Requirements>`, such as
:prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES`, :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES`,
:prop_tgt:`INTERFACE_COMPILE_DEFINITIONS` and other relevant built-in :prop_tgt:`INTERFACE_COMPILE_DEFINITIONS` and other relevant built-in
``INTERFACE_`` properties. The ``INTERFACE`` variant of user-defined ``INTERFACE_`` properties. The ``INTERFACE`` variant of user-defined
@ -368,6 +373,38 @@ attempt to use version 3 together with version 4. Packages can choose to
employ such a pattern if different major versions of the package are designed employ such a pattern if different major versions of the package are designed
to be incompatible. to be incompatible.
Note that it is not advisable to populate any properties which may contain
paths, such as :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` and
:prop_tgt:`INTERFACE_LINK_LIBRARIES`, with paths relevnt to dependencies.
That would hard-code into installed packages the include directory or library
paths for dependencies **as found on the machine the package was made on**.
That is, code like this is incorrect for targets which will be used to
generate config file packages:
.. code-block:: cmake
target_link_libraries(ClimbingStats INTERFACE
${Boost_LIBRARIES};${OtherDep_LIBRARIES}>
)
target_include_directories(ClimbingStats INTERFACE
$<INSTALL_INTERFACE:${Boost_INCLUDE_DIRS};${OtherDep_INCLUDE_DIRS}>
)
Dependencies must provide their own :ref:`IMPORTED targets <Imported Targets>`
which have their own :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` and
:prop_tgt:`IMPORTED_LOCATION` populated appropriately. Those
:ref:`IMPORTED targets <Imported Targets>` may then be
used with the :command:`target_link_libraries` command for ``ClimbingStats``.
That way, when a consumer uses the installed package, the
consumer will run the appropriate :command:`find_package` command (via the
find_dependency macro described below) to find
the dependencies on their own machine and populate the
:ref:`IMPORTED targets <Imported Targets>` with appropriate paths. Note that
many modules currently shipped with CMake do not currently provide
:ref:`IMPORTED targets <Imported Targets>`.
A ``NAMESPACE`` with double-colons is specified when exporting the targets A ``NAMESPACE`` with double-colons is specified when exporting the targets
for installation. This convention of double-colons gives CMake a hint that for installation. This convention of double-colons gives CMake a hint that
the name is an :prop_tgt:`IMPORTED` target when it is used by downstreams the name is an :prop_tgt:`IMPORTED` target when it is used by downstreams
@ -479,7 +516,7 @@ be true. This can be tested with logic in the package configuration file:
foreach(_comp ${ClimbingStats_FIND_COMPONENTS}) foreach(_comp ${ClimbingStats_FIND_COMPONENTS})
if (NOT ";${_supported_components};" MATCHES _comp) if (NOT ";${_supported_components};" MATCHES _comp)
set(ClimbingStats_FOUND False) set(ClimbingStats_FOUND False)
set(ClimbingStats_NOTFOUND_MESSAGE "Specified unsupported component: ${_comp}") set(ClimbingStats_NOTFOUND_MESSAGE "Unsupported component: ${_comp}")
endif() endif()
include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStats${_comp}Targets.cmake") include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStats${_comp}Targets.cmake")
endforeach() endforeach()
@ -564,6 +601,21 @@ containing the package configuration file.
There is no system package registry on non-Windows platforms. There is no system package registry on non-Windows platforms.
.. _`Disabling the Package Registry`:
Disabling the Package Registry
------------------------------
In some cases using the Package Registries is not desirable. CMake
allows to disable them using the following variables:
* :variable:`CMAKE_EXPORT_NO_PACKAGE_REGISTRY` disables the
:command:`export(PACKAGE)` command.
* :variable:`CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY` disables the
User Package Registry in all the :command:`find_package` calls.
* :variable:`CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY` disables
the System Package Registry in all the :command:`find_package` calls.
Package Registry Example Package Registry Example
------------------------ ------------------------

@ -3,7 +3,7 @@
cmake-policies(7) cmake-policies(7)
***************** *****************
.. only:: html or latex .. only:: html
.. contents:: .. contents::
@ -20,6 +20,12 @@ for a policy, also avoiding the warning. Each policy can also be set to
either ``NEW`` or ``OLD`` behavior explicitly on the command line with the either ``NEW`` or ``OLD`` behavior explicitly on the command line with the
:variable:`CMAKE_POLICY_DEFAULT_CMP<NNNN>` variable. :variable:`CMAKE_POLICY_DEFAULT_CMP<NNNN>` variable.
Note that policies are not reliable feature toggles. A policy should
almost never be set to ``OLD``, except to silence warnings in an otherwise
frozen or stable codebase, or temporarily as part of a larger migration
path. The ``OLD`` behavior of each policy is undesirable and will be
replaced with an error condition in a future release.
The :command:`cmake_minimum_required` command does more than report an The :command:`cmake_minimum_required` command does more than report an
error if a too-old version of CMake is used to build a project. It error if a too-old version of CMake is used to build a project. It
also sets all policies introduced in that CMake version or earlier to also sets all policies introduced in that CMake version or earlier to
@ -102,3 +108,9 @@ All Policies
/policy/CMP0048 /policy/CMP0048
/policy/CMP0049 /policy/CMP0049
/policy/CMP0050 /policy/CMP0050
/policy/CMP0051
/policy/CMP0052
/policy/CMP0053
/policy/CMP0054
/policy/CMP0055
/policy/CMP0056

@ -3,7 +3,7 @@
cmake-properties(7) cmake-properties(7)
******************* *******************
.. only:: html or latex .. only:: html
.. contents:: .. contents::
@ -16,6 +16,8 @@ Properties of Global Scope
/prop_gbl/ALLOW_DUPLICATE_CUSTOM_TARGETS /prop_gbl/ALLOW_DUPLICATE_CUSTOM_TARGETS
/prop_gbl/AUTOGEN_TARGETS_FOLDER /prop_gbl/AUTOGEN_TARGETS_FOLDER
/prop_gbl/AUTOMOC_TARGETS_FOLDER /prop_gbl/AUTOMOC_TARGETS_FOLDER
/prop_gbl/CMAKE_C_KNOWN_FEATURES
/prop_gbl/CMAKE_CXX_KNOWN_FEATURES
/prop_gbl/DEBUG_CONFIGURATIONS /prop_gbl/DEBUG_CONFIGURATIONS
/prop_gbl/DISABLED_FEATURES /prop_gbl/DISABLED_FEATURES
/prop_gbl/ENABLED_FEATURES /prop_gbl/ENABLED_FEATURES
@ -49,7 +51,6 @@ Properties on Directories
/prop_dir/CACHE_VARIABLES /prop_dir/CACHE_VARIABLES
/prop_dir/CLEAN_NO_CUSTOM /prop_dir/CLEAN_NO_CUSTOM
/prop_dir/CMAKE_CONFIGURE_DEPENDS /prop_dir/CMAKE_CONFIGURE_DEPENDS
/prop_dir/COMPILE_DEFINITIONS_CONFIG
/prop_dir/COMPILE_DEFINITIONS /prop_dir/COMPILE_DEFINITIONS
/prop_dir/COMPILE_OPTIONS /prop_dir/COMPILE_OPTIONS
/prop_dir/DEFINITIONS /prop_dir/DEFINITIONS
@ -78,6 +79,9 @@ Properties on Targets
:maxdepth: 1 :maxdepth: 1
/prop_tgt/ALIASED_TARGET /prop_tgt/ALIASED_TARGET
/prop_tgt/ANDROID_API
/prop_tgt/ANDROID_API_MIN
/prop_tgt/ANDROID_GUI
/prop_tgt/ARCHIVE_OUTPUT_DIRECTORY_CONFIG /prop_tgt/ARCHIVE_OUTPUT_DIRECTORY_CONFIG
/prop_tgt/ARCHIVE_OUTPUT_DIRECTORY /prop_tgt/ARCHIVE_OUTPUT_DIRECTORY
/prop_tgt/ARCHIVE_OUTPUT_NAME_CONFIG /prop_tgt/ARCHIVE_OUTPUT_NAME_CONFIG
@ -92,16 +96,26 @@ Properties on Targets
/prop_tgt/BUILD_WITH_INSTALL_RPATH /prop_tgt/BUILD_WITH_INSTALL_RPATH
/prop_tgt/BUNDLE_EXTENSION /prop_tgt/BUNDLE_EXTENSION
/prop_tgt/BUNDLE /prop_tgt/BUNDLE
/prop_tgt/C_EXTENSIONS
/prop_tgt/C_STANDARD
/prop_tgt/C_STANDARD_REQUIRED
/prop_tgt/COMPATIBLE_INTERFACE_BOOL /prop_tgt/COMPATIBLE_INTERFACE_BOOL
/prop_tgt/COMPATIBLE_INTERFACE_NUMBER_MAX /prop_tgt/COMPATIBLE_INTERFACE_NUMBER_MAX
/prop_tgt/COMPATIBLE_INTERFACE_NUMBER_MIN /prop_tgt/COMPATIBLE_INTERFACE_NUMBER_MIN
/prop_tgt/COMPATIBLE_INTERFACE_STRING /prop_tgt/COMPATIBLE_INTERFACE_STRING
/prop_tgt/COMPILE_DEFINITIONS_CONFIG
/prop_tgt/COMPILE_DEFINITIONS /prop_tgt/COMPILE_DEFINITIONS
/prop_tgt/COMPILE_FEATURES
/prop_tgt/COMPILE_FLAGS /prop_tgt/COMPILE_FLAGS
/prop_tgt/COMPILE_OPTIONS /prop_tgt/COMPILE_OPTIONS
/prop_tgt/COMPILE_PDB_NAME
/prop_tgt/COMPILE_PDB_NAME_CONFIG
/prop_tgt/COMPILE_PDB_OUTPUT_DIRECTORY
/prop_tgt/COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG
/prop_tgt/CONFIG_OUTPUT_NAME /prop_tgt/CONFIG_OUTPUT_NAME
/prop_tgt/CONFIG_POSTFIX /prop_tgt/CONFIG_POSTFIX
/prop_tgt/CXX_EXTENSIONS
/prop_tgt/CXX_STANDARD
/prop_tgt/CXX_STANDARD_REQUIRED
/prop_tgt/DEBUG_POSTFIX /prop_tgt/DEBUG_POSTFIX
/prop_tgt/DEFINE_SYMBOL /prop_tgt/DEFINE_SYMBOL
/prop_tgt/EchoString /prop_tgt/EchoString
@ -144,10 +158,12 @@ Properties on Targets
/prop_tgt/INSTALL_RPATH_USE_LINK_PATH /prop_tgt/INSTALL_RPATH_USE_LINK_PATH
/prop_tgt/INTERFACE_AUTOUIC_OPTIONS /prop_tgt/INTERFACE_AUTOUIC_OPTIONS
/prop_tgt/INTERFACE_COMPILE_DEFINITIONS /prop_tgt/INTERFACE_COMPILE_DEFINITIONS
/prop_tgt/INTERFACE_COMPILE_FEATURES
/prop_tgt/INTERFACE_COMPILE_OPTIONS /prop_tgt/INTERFACE_COMPILE_OPTIONS
/prop_tgt/INTERFACE_INCLUDE_DIRECTORIES /prop_tgt/INTERFACE_INCLUDE_DIRECTORIES
/prop_tgt/INTERFACE_LINK_LIBRARIES /prop_tgt/INTERFACE_LINK_LIBRARIES
/prop_tgt/INTERFACE_POSITION_INDEPENDENT_CODE /prop_tgt/INTERFACE_POSITION_INDEPENDENT_CODE
/prop_tgt/INTERFACE_SOURCES
/prop_tgt/INTERFACE_SYSTEM_INCLUDE_DIRECTORIES /prop_tgt/INTERFACE_SYSTEM_INCLUDE_DIRECTORIES
/prop_tgt/INTERPROCEDURAL_OPTIMIZATION_CONFIG /prop_tgt/INTERPROCEDURAL_OPTIMIZATION_CONFIG
/prop_tgt/INTERPROCEDURAL_OPTIMIZATION /prop_tgt/INTERPROCEDURAL_OPTIMIZATION
@ -190,9 +206,7 @@ Properties on Targets
/prop_tgt/PDB_OUTPUT_DIRECTORY_CONFIG /prop_tgt/PDB_OUTPUT_DIRECTORY_CONFIG
/prop_tgt/PDB_OUTPUT_DIRECTORY /prop_tgt/PDB_OUTPUT_DIRECTORY
/prop_tgt/POSITION_INDEPENDENT_CODE /prop_tgt/POSITION_INDEPENDENT_CODE
/prop_tgt/POST_INSTALL_SCRIPT
/prop_tgt/PREFIX /prop_tgt/PREFIX
/prop_tgt/PRE_INSTALL_SCRIPT
/prop_tgt/PRIVATE_HEADER /prop_tgt/PRIVATE_HEADER
/prop_tgt/PROJECT_LABEL /prop_tgt/PROJECT_LABEL
/prop_tgt/PUBLIC_HEADER /prop_tgt/PUBLIC_HEADER
@ -224,6 +238,7 @@ Properties on Targets
/prop_tgt/VS_SCC_LOCALPATH /prop_tgt/VS_SCC_LOCALPATH
/prop_tgt/VS_SCC_PROJECTNAME /prop_tgt/VS_SCC_PROJECTNAME
/prop_tgt/VS_SCC_PROVIDER /prop_tgt/VS_SCC_PROVIDER
/prop_tgt/VS_WINRT_COMPONENT
/prop_tgt/VS_WINRT_EXTENSIONS /prop_tgt/VS_WINRT_EXTENSIONS
/prop_tgt/VS_WINRT_REFERENCES /prop_tgt/VS_WINRT_REFERENCES
/prop_tgt/WIN32_EXECUTABLE /prop_tgt/WIN32_EXECUTABLE
@ -262,7 +277,6 @@ Properties on Source Files
/prop_sf/ABSTRACT /prop_sf/ABSTRACT
/prop_sf/AUTOUIC_OPTIONS /prop_sf/AUTOUIC_OPTIONS
/prop_sf/AUTORCC_OPTIONS /prop_sf/AUTORCC_OPTIONS
/prop_sf/COMPILE_DEFINITIONS_CONFIG
/prop_sf/COMPILE_DEFINITIONS /prop_sf/COMPILE_DEFINITIONS
/prop_sf/COMPILE_FLAGS /prop_sf/COMPILE_FLAGS
/prop_sf/EXTERNAL_OBJECT /prop_sf/EXTERNAL_OBJECT
@ -277,7 +291,15 @@ Properties on Source Files
/prop_sf/OBJECT_DEPENDS /prop_sf/OBJECT_DEPENDS
/prop_sf/OBJECT_OUTPUTS /prop_sf/OBJECT_OUTPUTS
/prop_sf/SYMBOLIC /prop_sf/SYMBOLIC
/prop_sf/VS_DEPLOYMENT_CONTENT
/prop_sf/VS_DEPLOYMENT_LOCATION
/prop_sf/VS_SHADER_ENTRYPOINT
/prop_sf/VS_SHADER_FLAGS
/prop_sf/VS_SHADER_MODEL
/prop_sf/VS_SHADER_TYPE
/prop_sf/WRAP_EXCLUDE /prop_sf/WRAP_EXCLUDE
/prop_sf/XCODE_EXPLICIT_FILE_TYPE
/prop_sf/XCODE_LAST_KNOWN_FILE_TYPE
Properties on Cache Entries Properties on Cache Entries
=========================== ===========================
@ -291,3 +313,42 @@ Properties on Cache Entries
/prop_cache/STRINGS /prop_cache/STRINGS
/prop_cache/TYPE /prop_cache/TYPE
/prop_cache/VALUE /prop_cache/VALUE
Properties on Installed Files
=============================
.. toctree::
:maxdepth: 1
/prop_inst/CPACK_NEVER_OVERWRITE.rst
/prop_inst/CPACK_PERMANENT.rst
/prop_inst/CPACK_WIX_ACL.rst
Deprecated Properties on Directories
=====================================
.. toctree::
:maxdepth: 1
/prop_dir/COMPILE_DEFINITIONS_CONFIG
Deprecated Properties on Targets
================================
.. toctree::
:maxdepth: 1
/prop_tgt/COMPILE_DEFINITIONS_CONFIG
/prop_tgt/POST_INSTALL_SCRIPT
/prop_tgt/PRE_INSTALL_SCRIPT
Deprecated Properties on Source Files
=====================================
.. toctree::
:maxdepth: 1
/prop_sf/COMPILE_DEFINITIONS_CONFIG

@ -3,7 +3,7 @@
cmake-qt(7) cmake-qt(7)
*********** ***********
.. only:: html or latex .. only:: html
.. contents:: .. contents::
@ -54,7 +54,7 @@ CMake. Target dependencies may be added to that custom target by adding them
to the :prop_tgt:`AUTOGEN_TARGET_DEPENDS` target property. to the :prop_tgt:`AUTOGEN_TARGET_DEPENDS` target property.
AUTOMOC AUTOMOC
''''''' ^^^^^^^
The :prop_tgt:`AUTOMOC` target property controls whether :manual:`cmake(1)` The :prop_tgt:`AUTOMOC` target property controls whether :manual:`cmake(1)`
inspects the C++ files in the target to determine if they require ``moc`` to inspects the C++ files in the target to determine if they require ``moc`` to
@ -84,7 +84,7 @@ variable may be populated to pre-set the options for all following targets.
.. _`Qt AUTOUIC`: .. _`Qt AUTOUIC`:
AUTOUIC AUTOUIC
''''''' ^^^^^^^
The :prop_tgt:`AUTOUIC` target property controls whether :manual:`cmake(1)` The :prop_tgt:`AUTOUIC` target property controls whether :manual:`cmake(1)`
inspects the C++ files in the target to determine if they require ``uic`` to inspects the C++ files in the target to determine if they require ``uic`` to
@ -147,7 +147,7 @@ result of linking with the :prop_tgt:`IMPORTED` target:
.. _`Qt AUTORCC`: .. _`Qt AUTORCC`:
AUTORCC AUTORCC
''''''' ^^^^^^^
The :prop_tgt:`AUTORCC` target property controls whether :manual:`cmake(1)` The :prop_tgt:`AUTORCC` target property controls whether :manual:`cmake(1)`
creates rules to execute ``rcc`` at the appropriate time on source files creates rules to execute ``rcc`` at the appropriate time on source files

@ -3,7 +3,7 @@
cmake-toolchains(7) cmake-toolchains(7)
******************* *******************
.. only:: html or latex .. only:: html
.. contents:: .. contents::
@ -97,18 +97,27 @@ Cross Compiling
If :manual:`cmake(1)` is invoked with the command line parameter If :manual:`cmake(1)` is invoked with the command line parameter
``-DCMAKE_TOOLCHAIN_FILE=path/to/file``, the file will be loaded early to set ``-DCMAKE_TOOLCHAIN_FILE=path/to/file``, the file will be loaded early to set
values for the compilers. A typical cross-compiling toolchain has content such values for the compilers.
The :variable:`CMAKE_CROSSCOMPILING` variable is set to true when CMake is
cross-compiling.
Cross Compiling for Linux
-------------------------
A typical cross-compiling toolchain for Linux has content such
as: as:
.. code-block:: cmake .. code-block:: cmake
set(CMAKE_SYSTEM_NAME Linux) set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(CMAKE_SYSROOT /home/devel/rasp-pi-rootfs) set(CMAKE_SYSROOT /home/devel/rasp-pi-rootfs)
set(CMAKE_STAGING_PREFIX /home/devel/stage) set(CMAKE_STAGING_PREFIX /home/devel/stage)
set(CMAKE_C_COMPILER /home/devel/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-gcc) set(tools /home/devel/gcc-4.7-linaro-rpi-gnueabihf)
set(CMAKE_CXX_COMPILER /home/devel/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-g++) set(CMAKE_C_COMPILER ${tools}/bin/arm-linux-gnueabihf-gcc)
set(CMAKE_CXX_COMPILER ${tools}/bin/arm-linux-gnueabihf-g++)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
@ -118,6 +127,9 @@ as:
The :variable:`CMAKE_SYSTEM_NAME` is the CMake-identifier of the target platform The :variable:`CMAKE_SYSTEM_NAME` is the CMake-identifier of the target platform
to build for. to build for.
The :variable:`CMAKE_SYSTEM_PROCESSOR` is the CMake-identifier of the target architecture
to build for.
The :variable:`CMAKE_SYSROOT` is optional, and may be specified if a sysroot The :variable:`CMAKE_SYSROOT` is optional, and may be specified if a sysroot
is available. is available.
@ -139,13 +151,17 @@ target system prefixes, whereas executables which must be run as part of the bui
should be found only on the host and not on the target. This is the purpose of should be found only on the host and not on the target. This is the purpose of
the ``CMAKE_FIND_ROOT_PATH_MODE_*`` variables. the ``CMAKE_FIND_ROOT_PATH_MODE_*`` variables.
Some compilers are inherently cross compilers, such as Clang and the QNX QCC Cross Compiling using Clang
compiler. The :variable:`CMAKE_<LANG>_COMPILER_TARGET` can be set to pass a ---------------------------
Some compilers such as Clang are inherently cross compilers.
The :variable:`CMAKE_<LANG>_COMPILER_TARGET` can be set to pass a
value to those supported compilers when compiling: value to those supported compilers when compiling:
.. code-block:: cmake .. code-block:: cmake
set(CMAKE_SYSTEM_NAME Linux) set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(triple arm-linux-gnueabihf) set(triple arm-linux-gnueabihf)
@ -154,7 +170,18 @@ value to those supported compilers when compiling:
set(CMAKE_CXX_COMPILER clang++) set(CMAKE_CXX_COMPILER clang++)
set(CMAKE_CXX_COMPILER_TARGET ${triple}) set(CMAKE_CXX_COMPILER_TARGET ${triple})
Or, for QCC: Similarly, some compilers do not ship their own supplementary utilities
such as linkers, but provide a way to specify the location of the external
toolchain which will be used by the compiler driver. The
:variable:`CMAKE_<LANG>_COMPILER_EXTERNAL_TOOLCHAIN` variable can be set in a
toolchain file to pass the path to the compiler driver.
Cross Compiling for QNX
-----------------------
As the Clang compiler the QNX QCC compile is inherently a cross compiler.
And the :variable:`CMAKE_<LANG>_COMPILER_TARGET` can be set to pass a
value to those supported compilers when compiling:
.. code-block:: cmake .. code-block:: cmake
@ -167,12 +194,68 @@ Or, for QCC:
set(CMAKE_CXX_COMPILER QCC) set(CMAKE_CXX_COMPILER QCC)
set(CMAKE_CXX_COMPILER_TARGET ${arch}) set(CMAKE_CXX_COMPILER_TARGET ${arch})
Cross Compiling for Windows CE
------------------------------
Similarly, some compilers do not ship their own supplementary utilities Cross compiling for Windows CE requires the corresponding SDK being
such as linkers, but provide a way to specify the location of the external installed on your system. These SDKs are usually installed under
toolchain which will be used by the compiler driver. The ``C:/Program Files (x86)/Windows CE Tools/SDKs``.
:variable:`CMAKE_<LANG>_COMPILER_EXTERNAL_TOOLCHAIN` variable can be set in a
toolchain file to pass the path to the compiler driver.
The :variable:`CMAKE_CROSSCOMPILING` variable is set to true when CMake is A toolchain file to configure a Visual Studio generator for
cross-compiling. Windows CE may look like this:
.. code-block:: cmake
set(CMAKE_SYSTEM_NAME WindowsCE)
set(CMAKE_SYSTEM_VERSION 8.0)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(CMAKE_GENERATOR_TOOLSET CE800) # Can be omitted for 8.0
set(CMAKE_GENERATOR_PLATFORM SDK_AM335X_SK_WEC2013_V310)
The :variable:`CMAKE_GENERATOR_PLATFORM` tells the generator which SDK to use.
Further :variable:`CMAKE_SYSTEM_VERSION` tells the generator what version of
Windows CE to use. Currently version 8.0 (Windows Embedded Compact 2013) is
supported out of the box. Other versions may require one to set
:variable:`CMAKE_GENERATOR_TOOLSET` to the correct value.
Cross Compiling for Windows Phone
---------------------------------
A toolchain file to configure a Visual Studio generator for
Windows Phone may look like this:
.. code-block:: cmake
set(CMAKE_SYSTEM_NAME WindowsPhone)
set(CMAKE_SYSTEM_VERSION 8.1)
Cross Compiling for Windows Store
---------------------------------
A toolchain file to configure a Visual Studio generator for
Windows Store may look like this:
.. code-block:: cmake
set(CMAKE_SYSTEM_NAME WindowsStore)
set(CMAKE_SYSTEM_VERSION 8.1)
Cross Compiling using NVIDIA Nsight Tegra
-----------------------------------------
A toolchain file to configure a Visual Studio generator to
build using NVIDIA Nsight Tegra targeting Android may look
like this:
.. code-block:: cmake
set(CMAKE_SYSTEM_NAME Android)
The :variable:`CMAKE_GENERATOR_TOOLSET` may be set to select
the Nsight Tegra "Toolchain Version" value.
See the :prop_tgt:`ANDROID_API_MIN`, :prop_tgt:`ANDROID_API`
and :prop_tgt:`ANDROID_GUI` target properties to configure
targets within the project.

@ -3,7 +3,7 @@
cmake-variables(7) cmake-variables(7)
****************** ******************
.. only:: html or latex .. only:: html
.. contents:: .. contents::
@ -36,7 +36,9 @@ Variables that Provide Information
/variable/CMAKE_EXECUTABLE_SUFFIX /variable/CMAKE_EXECUTABLE_SUFFIX
/variable/CMAKE_EXTRA_GENERATOR /variable/CMAKE_EXTRA_GENERATOR
/variable/CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES /variable/CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES
/variable/CMAKE_FIND_PACKAGE_NAME
/variable/CMAKE_GENERATOR /variable/CMAKE_GENERATOR
/variable/CMAKE_GENERATOR_PLATFORM
/variable/CMAKE_GENERATOR_TOOLSET /variable/CMAKE_GENERATOR_TOOLSET
/variable/CMAKE_HOME_DIRECTORY /variable/CMAKE_HOME_DIRECTORY
/variable/CMAKE_IMPORT_LIBRARY_PREFIX /variable/CMAKE_IMPORT_LIBRARY_PREFIX
@ -46,6 +48,7 @@ Variables that Provide Information
/variable/CMAKE_LINK_LIBRARY_SUFFIX /variable/CMAKE_LINK_LIBRARY_SUFFIX
/variable/CMAKE_MAJOR_VERSION /variable/CMAKE_MAJOR_VERSION
/variable/CMAKE_MAKE_PROGRAM /variable/CMAKE_MAKE_PROGRAM
/variable/CMAKE_MATCH_COUNT
/variable/CMAKE_MINIMUM_REQUIRED_VERSION /variable/CMAKE_MINIMUM_REQUIRED_VERSION
/variable/CMAKE_MINOR_VERSION /variable/CMAKE_MINOR_VERSION
/variable/CMAKE_PARENT_LIST_FILE /variable/CMAKE_PARENT_LIST_FILE
@ -73,6 +76,8 @@ Variables that Provide Information
/variable/CMAKE_VS_INTEL_Fortran_PROJECT_VERSION /variable/CMAKE_VS_INTEL_Fortran_PROJECT_VERSION
/variable/CMAKE_VS_MSBUILD_COMMAND /variable/CMAKE_VS_MSBUILD_COMMAND
/variable/CMAKE_VS_MSDEV_COMMAND /variable/CMAKE_VS_MSDEV_COMMAND
/variable/CMAKE_VS_NsightTegra_VERSION
/variable/CMAKE_VS_PLATFORM_NAME
/variable/CMAKE_VS_PLATFORM_TOOLSET /variable/CMAKE_VS_PLATFORM_TOOLSET
/variable/CMAKE_XCODE_PLATFORM_TOOLSET /variable/CMAKE_XCODE_PLATFORM_TOOLSET
/variable/PROJECT_BINARY_DIR /variable/PROJECT_BINARY_DIR
@ -109,10 +114,13 @@ Variables that Change Behavior
/variable/CMAKE_DISABLE_FIND_PACKAGE_PackageName /variable/CMAKE_DISABLE_FIND_PACKAGE_PackageName
/variable/CMAKE_ERROR_DEPRECATED /variable/CMAKE_ERROR_DEPRECATED
/variable/CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION /variable/CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION
/variable/CMAKE_EXPORT_NO_PACKAGE_REGISTRY
/variable/CMAKE_SYSROOT /variable/CMAKE_SYSROOT
/variable/CMAKE_FIND_LIBRARY_PREFIXES /variable/CMAKE_FIND_LIBRARY_PREFIXES
/variable/CMAKE_FIND_LIBRARY_SUFFIXES /variable/CMAKE_FIND_LIBRARY_SUFFIXES
/variable/CMAKE_FIND_NO_INSTALL_PREFIX /variable/CMAKE_FIND_NO_INSTALL_PREFIX
/variable/CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY
/variable/CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY
/variable/CMAKE_FIND_PACKAGE_WARN_NO_MODULE /variable/CMAKE_FIND_PACKAGE_WARN_NO_MODULE
/variable/CMAKE_FIND_ROOT_PATH /variable/CMAKE_FIND_ROOT_PATH
/variable/CMAKE_FIND_ROOT_PATH_MODE_INCLUDE /variable/CMAKE_FIND_ROOT_PATH_MODE_INCLUDE
@ -125,6 +133,7 @@ Variables that Change Behavior
/variable/CMAKE_INCLUDE_DIRECTORIES_BEFORE /variable/CMAKE_INCLUDE_DIRECTORIES_BEFORE
/variable/CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE /variable/CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE
/variable/CMAKE_INSTALL_DEFAULT_COMPONENT_NAME /variable/CMAKE_INSTALL_DEFAULT_COMPONENT_NAME
/variable/CMAKE_INSTALL_MESSAGE
/variable/CMAKE_INSTALL_PREFIX /variable/CMAKE_INSTALL_PREFIX
/variable/CMAKE_LIBRARY_PATH /variable/CMAKE_LIBRARY_PATH
/variable/CMAKE_MFC_FLAG /variable/CMAKE_MFC_FLAG
@ -172,9 +181,11 @@ Variables that Describe the System
/variable/CMAKE_SYSTEM_VERSION /variable/CMAKE_SYSTEM_VERSION
/variable/CYGWIN /variable/CYGWIN
/variable/ENV /variable/ENV
/variable/MINGW
/variable/MSVC10 /variable/MSVC10
/variable/MSVC11 /variable/MSVC11
/variable/MSVC12 /variable/MSVC12
/variable/MSVC14
/variable/MSVC60 /variable/MSVC60
/variable/MSVC70 /variable/MSVC70
/variable/MSVC71 /variable/MSVC71
@ -185,6 +196,9 @@ Variables that Describe the System
/variable/MSVC_VERSION /variable/MSVC_VERSION
/variable/UNIX /variable/UNIX
/variable/WIN32 /variable/WIN32
/variable/WINCE
/variable/WINDOWS_PHONE
/variable/WINDOWS_STORE
/variable/XCODE_VERSION /variable/XCODE_VERSION
Variables that Control the Build Variables that Control the Build
@ -193,6 +207,9 @@ Variables that Control the Build
.. toctree:: .. toctree::
:maxdepth: 1 :maxdepth: 1
/variable/CMAKE_ANDROID_API
/variable/CMAKE_ANDROID_API_MIN
/variable/CMAKE_ANDROID_GUI
/variable/CMAKE_ARCHIVE_OUTPUT_DIRECTORY /variable/CMAKE_ARCHIVE_OUTPUT_DIRECTORY
/variable/CMAKE_AUTOMOC_MOC_OPTIONS /variable/CMAKE_AUTOMOC_MOC_OPTIONS
/variable/CMAKE_AUTOMOC /variable/CMAKE_AUTOMOC
@ -201,6 +218,8 @@ Variables that Control the Build
/variable/CMAKE_AUTOUIC /variable/CMAKE_AUTOUIC
/variable/CMAKE_AUTOUIC_OPTIONS /variable/CMAKE_AUTOUIC_OPTIONS
/variable/CMAKE_BUILD_WITH_INSTALL_RPATH /variable/CMAKE_BUILD_WITH_INSTALL_RPATH
/variable/CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY
/variable/CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG
/variable/CMAKE_CONFIG_POSTFIX /variable/CMAKE_CONFIG_POSTFIX
/variable/CMAKE_DEBUG_POSTFIX /variable/CMAKE_DEBUG_POSTFIX
/variable/CMAKE_EXE_LINKER_FLAGS_CONFIG /variable/CMAKE_EXE_LINKER_FLAGS_CONFIG
@ -245,6 +264,7 @@ Variables that Control the Build
/variable/CMAKE_USE_RELATIVE_PATHS /variable/CMAKE_USE_RELATIVE_PATHS
/variable/CMAKE_VISIBILITY_INLINES_HIDDEN /variable/CMAKE_VISIBILITY_INLINES_HIDDEN
/variable/CMAKE_WIN32_EXECUTABLE /variable/CMAKE_WIN32_EXECUTABLE
/variable/CMAKE_XCODE_ATTRIBUTE_an-attribute
/variable/EXECUTABLE_OUTPUT_PATH /variable/EXECUTABLE_OUTPUT_PATH
/variable/LIBRARY_OUTPUT_PATH /variable/LIBRARY_OUTPUT_PATH
@ -255,6 +275,14 @@ Variables for Languages
:maxdepth: 1 :maxdepth: 1
/variable/CMAKE_COMPILER_IS_GNULANG /variable/CMAKE_COMPILER_IS_GNULANG
/variable/CMAKE_C_COMPILE_FEATURES
/variable/CMAKE_C_EXTENSIONS
/variable/CMAKE_C_STANDARD
/variable/CMAKE_C_STANDARD_REQUIRED
/variable/CMAKE_CXX_COMPILE_FEATURES
/variable/CMAKE_CXX_EXTENSIONS
/variable/CMAKE_CXX_STANDARD
/variable/CMAKE_CXX_STANDARD_REQUIRED
/variable/CMAKE_Fortran_MODDIR_DEFAULT /variable/CMAKE_Fortran_MODDIR_DEFAULT
/variable/CMAKE_Fortran_MODDIR_FLAG /variable/CMAKE_Fortran_MODDIR_FLAG
/variable/CMAKE_Fortran_MODOUT_FLAG /variable/CMAKE_Fortran_MODOUT_FLAG
@ -295,6 +323,60 @@ Variables for Languages
/variable/CMAKE_LANG_SOURCE_FILE_EXTENSIONS /variable/CMAKE_LANG_SOURCE_FILE_EXTENSIONS
/variable/CMAKE_USER_MAKE_RULES_OVERRIDE_LANG /variable/CMAKE_USER_MAKE_RULES_OVERRIDE_LANG
Variables for CTest
===================
.. toctree::
:maxdepth: 1
/variable/CTEST_BINARY_DIRECTORY
/variable/CTEST_BUILD_COMMAND
/variable/CTEST_BUILD_NAME
/variable/CTEST_BZR_COMMAND
/variable/CTEST_BZR_UPDATE_OPTIONS
/variable/CTEST_CHECKOUT_COMMAND
/variable/CTEST_CONFIGURATION_TYPE
/variable/CTEST_CONFIGURE_COMMAND
/variable/CTEST_COVERAGE_COMMAND
/variable/CTEST_COVERAGE_EXTRA_FLAGS
/variable/CTEST_CURL_OPTIONS
/variable/CTEST_CVS_CHECKOUT
/variable/CTEST_CVS_COMMAND
/variable/CTEST_CVS_UPDATE_OPTIONS
/variable/CTEST_DROP_LOCATION
/variable/CTEST_DROP_METHOD
/variable/CTEST_DROP_SITE
/variable/CTEST_DROP_SITE_CDASH
/variable/CTEST_DROP_SITE_PASSWORD
/variable/CTEST_DROP_SITE_USER
/variable/CTEST_GIT_COMMAND
/variable/CTEST_GIT_UPDATE_CUSTOM
/variable/CTEST_GIT_UPDATE_OPTIONS
/variable/CTEST_HG_COMMAND
/variable/CTEST_HG_UPDATE_OPTIONS
/variable/CTEST_MEMORYCHECK_COMMAND
/variable/CTEST_MEMORYCHECK_COMMAND_OPTIONS
/variable/CTEST_MEMORYCHECK_SANITIZER_OPTIONS
/variable/CTEST_MEMORYCHECK_SUPPRESSIONS_FILE
/variable/CTEST_MEMORYCHECK_TYPE
/variable/CTEST_NIGHTLY_START_TIME
/variable/CTEST_P4_CLIENT
/variable/CTEST_P4_COMMAND
/variable/CTEST_P4_OPTIONS
/variable/CTEST_P4_UPDATE_OPTIONS
/variable/CTEST_SCP_COMMAND
/variable/CTEST_SITE
/variable/CTEST_SOURCE_DIRECTORY
/variable/CTEST_SVN_COMMAND
/variable/CTEST_SVN_OPTIONS
/variable/CTEST_SVN_UPDATE_OPTIONS
/variable/CTEST_TEST_TIMEOUT
/variable/CTEST_TRIGGER_SITE
/variable/CTEST_UPDATE_COMMAND
/variable/CTEST_UPDATE_OPTIONS
/variable/CTEST_UPDATE_VERSION_ONLY
/variable/CTEST_USE_LAUNCHERS
Variables for CPack Variables for CPack
=================== ===================

@ -11,7 +11,7 @@ Synopsis
cmake [<options>] (<path-to-source> | <path-to-existing-build>) cmake [<options>] (<path-to-source> | <path-to-existing-build>)
cmake [(-D<var>=<value>)...] -P <cmake-script-file> cmake [(-D<var>=<value>)...] -P <cmake-script-file>
cmake --build <dir> [<options>] [-- <build-tool-options>...] cmake --build <dir> [<options>] [-- <build-tool-options>...]
cmake -E <command> [<options>] cmake -E <command> [<options>...]
cmake --find-package <options>... cmake --find-package <options>...
Description Description
@ -32,17 +32,8 @@ Options
.. include:: OPTIONS_BUILD.txt .. include:: OPTIONS_BUILD.txt
``-E`` ``-E <command> [<options>...]``
CMake command mode. See `Command-Line Tool Mode`_.
For true platform independence, CMake provides a list of commands
that can be used on all systems. Run with -E help for the usage
information. Commands available are: chdir, compare_files, copy,
copy_directory, copy_if_different, echo, echo_append, environment,
make_directory, md5sum, remove, remove_directory, rename, sleep, tar, time,
touch, touch_nocreate. In addition, some platform specific commands
are available. On Windows: delete_regv, write_regv. On
UNIX: create_symlink.
``-L[A][H]`` ``-L[A][H]``
List non-advanced cached variables. List non-advanced cached variables.
@ -156,6 +147,111 @@ Options
.. include:: OPTIONS_HELP.txt .. include:: OPTIONS_HELP.txt
Command-Line Tool Mode
======================
CMake provides builtin command-line tools through the signature::
cmake -E <command> [<options>...]
Run ``cmake -E`` or ``cmake -E help`` for a summary of commands.
Available commands are:
``chdir <dir> <cmd> [<arg>...]``
Change the current working directory and run a command.
``compare_files <file1> <file2>``
Check if file1 is same as file2.
``copy <file> <destination>``
Copy file to destination (either file or directory).
``copy_directory <source> <destination>``
Copy directory 'source' content to directory 'destination'.
``copy_if_different <in-file> <out-file>``
Copy file if input has changed.
``echo [<string>...]``
Displays arguments as text.
``echo_append [<string>...]``
Displays arguments as text but no new line.
``env [--unset=NAME]... [NAME=VALUE]... COMMAND [ARG]...``
Run command in a modified environment.
``environment``
Display the current environment.
``make_directory <dir>``
Create a directory.
``md5sum [<file>...]``
Compute md5sum of files.
``remove [-f] [<file>...]``
Remove the file(s), use ``-f`` to force it.
``remove_directory <dir>``
Remove a directory and its contents.
``rename <oldname> <newname>``
Rename a file or directory (on one volume).
``sleep <number>...``
Sleep for given number of seconds.
``tar [cxt][vf][zjJ] file.tar [<options>...] [--] [<file>...]``
Create or extract a tar or zip archive. Options are:
``--``
Stop interpreting options and treat all remaining arguments
as file names even if they start in ``-``.
``--files-from=<file>``
Read file names from the given file, one per line.
Blank lines are ignored. Lines may not start in ``-``
except for ``--add-file=<name>`` to add files whose
names start in ``-``.
``--mtime=<date>``
Specify modification time recorded in tarball entries.
``time <command> [<args>...]``
Run command and return elapsed time.
``touch <file>``
Touch a file.
``touch_nocreate <file>``
Touch a file if it exists but do not create it.
UNIX-specific Command-Line Tools
--------------------------------
The following ``cmake -E`` commands are available only on UNIX:
``create_symlink <old> <new>``
Create a symbolic link ``<new>`` naming ``<old>``.
Windows-specific Command-Line Tools
-----------------------------------
The following ``cmake -E`` commands are available only on Windows:
``delete_regv <key>``
Delete Windows registry value.
``env_vs8_wince <sdkname>``
Displays a batch file which sets the environment for the provided
Windows CE SDK installed in VS2005.
``env_vs9_wince <sdkname>``
Displays a batch file which sets the environment for the provided
Windows CE SDK installed in VS2008.
``write_regv <key> <value>``
Write Windows registry value.
See Also See Also
======== ========

@ -111,7 +111,7 @@ Options
``-D <dashboard>, --dashboard <dashboard>`` ``-D <dashboard>, --dashboard <dashboard>``
Execute dashboard test Execute dashboard test
This option tells ctest to act as a Dart client and perform a This option tells ctest to act as a CDash client and perform a
dashboard test. All tests are <Mode><Test>, where Mode can be dashboard test. All tests are <Mode><Test>, where Mode can be
Experimental, Nightly, and Continuous, and Test can be Start, Experimental, Nightly, and Continuous, and Test can be Start,
Update, Configure, Build, Test, Coverage, and Submit. Update, Configure, Build, Test, Coverage, and Submit.
@ -127,14 +127,14 @@ Options
``-M <model>, --test-model <model>`` ``-M <model>, --test-model <model>``
Sets the model for a dashboard Sets the model for a dashboard
This option tells ctest to act as a Dart client where the TestModel This option tells ctest to act as a CDash client where the TestModel
can be Experimental, Nightly, and Continuous. Combining -M and -T can be Experimental, Nightly, and Continuous. Combining -M and -T
is similar to -D is similar to -D
``-T <action>, --test-action <action>`` ``-T <action>, --test-action <action>``
Sets the dashboard action to perform Sets the dashboard action to perform
This option tells ctest to act as a Dart client and perform some This option tells ctest to act as a CDash client and perform some
action such as start, build, test etc. Combining -M and -T is action such as start, build, test etc. Combining -M and -T is
similar to -D similar to -D
@ -258,6 +258,9 @@ Options
``--build-generator`` ``--build-generator``
Specify the generator to use. Specify the generator to use.
``--build-generator-platform``
Specify the generator-specific platform.
``--build-generator-toolset`` ``--build-generator-toolset``
Specify the generator-specific toolset. Specify the generator-specific toolset.
@ -325,11 +328,8 @@ Options
used to detect implicit dependencies in a test suite. used to detect implicit dependencies in a test suite.
``--submit-index`` ``--submit-index``
Submit individual dashboard tests with specific index Legacy option for old Dart2 dashboard server feature.
Do not use.
This option allows performing the same CTest action (such as test)
multiple times and submit all stages to the same dashboard (Dart2
required). Each execution requires different index.
``--timeout <seconds>`` ``--timeout <seconds>``
Set a global timeout on all tests. Set a global timeout on all tests.
@ -365,6 +365,628 @@ Options
.. include:: OPTIONS_HELP.txt .. include:: OPTIONS_HELP.txt
Dashboard Client
================
CTest can operate as a client for the `CDash`_ software quality dashboard
application. As a dashboard client, CTest performs a sequence of steps
to configure, build, and test software, and then submits the results to
a `CDash`_ server.
.. _`CDash`: http://cdash.org/
Dashboard Client Steps
----------------------
CTest defines an ordered list of testing steps of which some or all may
be run as a dashboard client:
``Start``
Start a new dashboard submission to be composed of results recorded
by the following steps.
See the `CTest Start Step`_ section below.
``Update``
Update the source tree from its version control repository.
Record the old and new versions and the list of updated source files.
See the `CTest Update Step`_ section below.
``Configure``
Configure the software by running a command in the build tree.
Record the configuration output log.
See the `CTest Configure Step`_ section below.
``Build``
Build the software by running a command in the build tree.
Record the build output log and detect warnings and errors.
See the `CTest Build Step`_ section below.
``Test``
Test the software by loading a ``CTestTestfile.cmake``
from the build tree and executing the defined tests.
Record the output and result of each test.
See the `CTest Test Step`_ section below.
``Coverage``
Compute coverage of the source code by running a coverage
analysis tool and recording its output.
See the `CTest Coverage Step`_ section below.
``MemCheck``
Run the software test suite through a memory check tool.
Record the test output, results, and issues reported by the tool.
See the `CTest MemCheck Step`_ section below.
``Submit``
Submit results recorded from other testing steps to the
software quality dashboard server.
See the `CTest Submit Step`_ section below.
Dashboard Client Modes
----------------------
CTest defines three modes of operation as a dashboard client:
``Nightly``
This mode is intended to be invoked once per day, typically at night.
It enables the ``Start``, ``Update``, ``Configure``, ``Build``, ``Test``,
``Coverage``, and ``Submit`` steps by default. Selected steps run even
if the ``Update`` step reports no changes to the source tree.
``Continuous``
This mode is intended to be invoked repeatedly throughout the day.
It enables the ``Start``, ``Update``, ``Configure``, ``Build``, ``Test``,
``Coverage``, and ``Submit`` steps by default, but exits after the
``Update`` step if it reports no changes to the source tree.
``Experimental``
This mode is intended to be invoked by a developer to test local changes.
It enables the ``Start``, ``Configure``, ``Build``, ``Test``, ``Coverage``,
and ``Submit`` steps by default.
Dashboard Client via CTest Command-Line
---------------------------------------
CTest can perform testing on an already-generated build tree.
Run the ``ctest`` command with the current working directory set
to the build tree and use one of these signatures::
ctest -D <mode>[<step>]
ctest -M <mode> [ -T <step> ]...
The ``<mode>`` must be one of the above `Dashboard Client Modes`_,
and each ``<step>`` must be one of the above `Dashboard Client Steps`_.
CTest reads the `Dashboard Client Configuration`_ settings from
a file in the build tree called either ``CTestConfiguration.ini``
or ``DartConfiguration.tcl`` (the names are historical). The format
of the file is::
# Lines starting in '#' are comments.
# Other non-blank lines are key-value pairs.
<setting>: <value>
where ``<setting>`` is the setting name and ``<value>`` is the
setting value.
In build trees generated by CMake, this configuration file is
generated by the :module:`CTest` module if included by the project.
The module uses variables to obtain a value for each setting
as documented with the settings below.
.. _`CTest Script`:
Dashboard Client via CTest Script
---------------------------------
CTest can perform testing driven by a :manual:`cmake-language(7)`
script that creates and maintains the source and build tree as
well as performing the testing steps. Run the ``ctest`` command
with the current working directory set outside of any build tree
and use one of these signatures::
ctest -S <script>
ctest -SP <script>
The ``<script>`` file must call :ref:`CTest Commands` commands
to run testing steps explicitly as documented below. The commands
obtain `Dashboard Client Configuration`_ settings from their
arguments or from variables set in the script.
Dashboard Client Configuration
==============================
The `Dashboard Client Steps`_ may be configured by named
settings as documented in the following sections.
.. _`CTest Start Step`:
CTest Start Step
----------------
Start a new dashboard submission to be composed of results recorded
by the following steps.
In a `CTest Script`_, the :command:`ctest_start` command runs this step.
Arguments to the command may specify some of the step settings.
The command first runs the command-line specified by the
``CTEST_CHECKOUT_COMMAND`` variable, if set, to initialize the source
directory.
Configuration settings include:
``BuildDirectory``
The full path to the project build tree.
* `CTest Script`_ variable: :variable:`CTEST_BINARY_DIRECTORY`
* :module:`CTest` module variable: :variable:`PROJECT_BINARY_DIR`
``SourceDirectory``
The full path to the project source tree.
* `CTest Script`_ variable: :variable:`CTEST_SOURCE_DIRECTORY`
* :module:`CTest` module variable: :variable:`PROJECT_SOURCE_DIR`
.. _`CTest Update Step`:
CTest Update Step
-----------------
In a `CTest Script`_, the :command:`ctest_update` command runs this step.
Arguments to the command may specify some of the step settings.
Configuration settings to specify the version control tool include:
``BZRCommand``
``bzr`` command-line tool to use if source tree is managed by Bazaar.
* `CTest Script`_ variable: :variable:`CTEST_BZR_COMMAND`
* :module:`CTest` module variable: none
``BZRUpdateOptions``
Command-line options to the ``BZRCommand`` when updating the source.
* `CTest Script`_ variable: :variable:`CTEST_BZR_UPDATE_OPTIONS`
* :module:`CTest` module variable: none
``CVSCommand``
``cvs`` command-line tool to use if source tree is managed by CVS.
* `CTest Script`_ variable: :variable:`CTEST_CVS_COMMAND`
* :module:`CTest` module variable: ``CVSCOMMAND``
``CVSUpdateOptions``
Command-line options to the ``CVSCommand`` when updating the source.
* `CTest Script`_ variable: :variable:`CTEST_CVS_UPDATE_OPTIONS`
* :module:`CTest` module variable: ``CVS_UPDATE_OPTIONS``
``GITCommand``
``git`` command-line tool to use if source tree is managed by Git.
* `CTest Script`_ variable: :variable:`CTEST_GIT_COMMAND`
* :module:`CTest` module variable: ``GITCOMMAND``
``GITUpdateCustom``
Specify a semicolon-separated list of custom command lines to run
in the source tree (Git work tree) to update it instead of running
the ``GITCommand``.
* `CTest Script`_ variable: :variable:`CTEST_GIT_UPDATE_CUSTOM`
* :module:`CTest` module variable: ``CTEST_GIT_UPDATE_CUSTOM``
``GITUpdateOptions``
Command-line options to the ``GITCommand`` when updating the source.
* `CTest Script`_ variable: :variable:`CTEST_GIT_UPDATE_OPTIONS`
* :module:`CTest` module variable: ``GIT_UPDATE_OPTIONS``
``HGCommand``
``hg`` command-line tool to use if source tree is managed by Mercurial.
* `CTest Script`_ variable: :variable:`CTEST_HG_COMMAND`
* :module:`CTest` module variable: none
``HGUpdateOptions``
Command-line options to the ``HGCommand`` when updating the source.
* `CTest Script`_ variable: :variable:`CTEST_HG_UPDATE_OPTIONS`
* :module:`CTest` module variable: none
``P4Client``
Value of the ``-c`` option to the ``P4Command``.
* `CTest Script`_ variable: :variable:`CTEST_P4_CLIENT`
* :module:`CTest` module variable: ``CTEST_P4_CLIENT``
``P4Command``
``p4`` command-line tool to use if source tree is managed by Perforce.
* `CTest Script`_ variable: :variable:`CTEST_P4_COMMAND`
* :module:`CTest` module variable: ``P4COMMAND``
``P4Options``
Command-line options to the ``P4Command`` for all invocations.
* `CTest Script`_ variable: :variable:`CTEST_P4_OPTIONS`
* :module:`CTest` module variable: ``CTEST_P4_OPTIONS``
``P4UpdateCustom``
Specify a semicolon-separated list of custom command lines to run
in the source tree (Perforce tree) to update it instead of running
the ``P4Command``.
* `CTest Script`_ variable: none
* :module:`CTest` module variable: ``CTEST_P4_UPDATE_CUSTOM``
``P4UpdateOptions``
Command-line options to the ``P4Command`` when updating the source.
* `CTest Script`_ variable: :variable:`CTEST_P4_UPDATE_OPTIONS`
* :module:`CTest` module variable: ``CTEST_P4_UPDATE_OPTIONS``
``SVNCommand``
``svn`` command-line tool to use if source tree is managed by Subversion.
* `CTest Script`_ variable: :variable:`CTEST_SVN_COMMAND`
* :module:`CTest` module variable: ``SVNCOMMAND``
``SVNOptions``
Command-line options to the ``SVNCommand`` for all invocations.
* `CTest Script`_ variable: :variable:`CTEST_SVN_OPTIONS`
* :module:`CTest` module variable: ``CTEST_SVN_OPTIONS``
``SVNUpdateOptions``
Command-line options to the ``SVNCommand`` when updating the source.
* `CTest Script`_ variable: :variable:`CTEST_SVN_UPDATE_OPTIONS`
* :module:`CTest` module variable: ``SVN_UPDATE_OPTIONS``
``UpdateCommand``
Specify the version-control command-line tool to use without
detecting the VCS that manages the source tree.
* `CTest Script`_ variable: :variable:`CTEST_UPDATE_COMMAND`
* :module:`CTest` module variable: ``<VCS>COMMAND``
when ``UPDATE_TYPE`` is ``<vcs>``, else ``UPDATE_COMMAND``
``UpdateOptions``
Command-line options to the ``UpdateCommand``.
* `CTest Script`_ variable: :variable:`CTEST_UPDATE_OPTIONS`
* :module:`CTest` module variable: ``<VCS>_UPDATE_OPTIONS``
when ``UPDATE_TYPE`` is ``<vcs>``, else ``UPDATE_OPTIONS``
``UpdateType``
Specify the version-control system that manages the source
tree if it cannot be detected automatically.
The value may be ``bzr``, ``cvs``, ``git``, ``hg``,
``p4``, or ``svn``.
* `CTest Script`_ variable: none, detected from source tree
* :module:`CTest` module variable: ``UPDATE_TYPE`` if set,
else ``CTEST_UPDATE_TYPE``
``UpdateVersionOnly``
Specify that you want the version control update command to only
discover the current version that is checked out, and not to update
to a different version.
* `CTest Script`_ variable: :variable:`CTEST_UPDATE_VERSION_ONLY`
Additional configuration settings include:
``NightlyStartTime``
In the ``Nightly`` dashboard mode, specify the "nightly start time".
With centralized version control systems (``cvs`` and ``svn``),
the ``Update`` step checks out the version of the software as of
this time so that multiple clients choose a common version to test.
This is not well-defined in distributed version-control systems so
the setting is ignored.
* `CTest Script`_ variable: :variable:`CTEST_NIGHTLY_START_TIME`
* :module:`CTest` module variable: ``NIGHTLY_START_TIME`` if set,
else ``CTEST_NIGHTLY_START_TIME``
.. _`CTest Configure Step`:
CTest Configure Step
--------------------
In a `CTest Script`_, the :command:`ctest_configure` command runs this step.
Arguments to the command may specify some of the step settings.
Configuration settings include:
``ConfigureCommand``
Command-line to launch the software configuration process.
It will be executed in the location specified by the
``BuildDirectory`` setting.
* `CTest Script`_ variable: :variable:`CTEST_CONFIGURE_COMMAND`
* :module:`CTest` module variable: :variable:`CMAKE_COMMAND`
followed by :variable:`PROJECT_SOURCE_DIR`
.. _`CTest Build Step`:
CTest Build Step
----------------
In a `CTest Script`_, the :command:`ctest_build` command runs this step.
Arguments to the command may specify some of the step settings.
Configuration settings include:
``DefaultCTestConfigurationType``
When the build system to be launched allows build-time selection
of the configuration (e.g. ``Debug``, ``Release``), this specifies
the default configuration to be built when no ``-C`` option is
given to the ``ctest`` command. The value will be substituted into
the value of ``MakeCommand`` to replace the literal string
``${CTEST_CONFIGURATION_TYPE}`` if it appears.
* `CTest Script`_ variable: :variable:`CTEST_CONFIGURATION_TYPE`
* :module:`CTest` module variable: ``DEFAULT_CTEST_CONFIGURATION_TYPE``,
initialized by the ``CMAKE_CONFIG_TYPE`` environment variable
``MakeCommand``
Command-line to launch the software build process.
It will be executed in the location specified by the
``BuildDirectory`` setting.
* `CTest Script`_ variable: :variable:`CTEST_BUILD_COMMAND`
* :module:`CTest` module variable: ``MAKECOMMAND``,
initialized by the :command:`build_command` command
``UseLaunchers``
For build trees generated by CMake using a Makefile generator
or the :generator:`Ninja` generator, specify whether the
``CTEST_USE_LAUNCHERS`` feature is enabled by the
:module:`CTestUseLaunchers` module (also included by the
:module:`CTest` module). When enabled, the generated build
system wraps each invocation of the compiler, linker, or
custom command line with a "launcher" that communicates
with CTest via environment variables and files to report
granular build warning and error information. Otherwise,
CTest must "scrape" the build output log for diagnostics.
* `CTest Script`_ variable: :variable:`CTEST_USE_LAUNCHERS`
* :module:`CTest` module variable: ``CTEST_USE_LAUNCHERS``
.. _`CTest Test Step`:
CTest Test Step
---------------
In a `CTest Script`_, the :command:`ctest_test` command runs this step.
Arguments to the command may specify some of the step settings.
Configuration settings include:
``TimeOut``
The default timeout for each test if not specified by the
:prop_test:`TIMEOUT` test property.
* `CTest Script`_ variable: :variable:`CTEST_TEST_TIMEOUT`
* :module:`CTest` module variable: ``DART_TESTING_TIMEOUT``
.. _`CTest Coverage Step`:
CTest Coverage Step
-------------------
In a `CTest Script`_, the :command:`ctest_coverage` command runs this step.
Arguments to the command may specify some of the step settings.
Configuration settings include:
``CoverageCommand``
Command-line tool to perform software coverage analysis.
It will be executed in the location specified by the
``BuildDirectory`` setting.
* `CTest Script`_ variable: :variable:`CTEST_COVERAGE_COMMAND`
* :module:`CTest` module variable: ``COVERAGE_COMMAND``
``CoverageExtraFlags``
Specify command-line options to the ``CoverageCommand`` tool.
* `CTest Script`_ variable: :variable:`CTEST_COVERAGE_EXTRA_FLAGS`
* :module:`CTest` module variable: ``COVERAGE_EXTRA_FLAGS``
.. _`CTest MemCheck Step`:
CTest MemCheck Step
-------------------
In a `CTest Script`_, the :command:`ctest_memcheck` command runs this step.
Arguments to the command may specify some of the step settings.
Configuration settings include:
``MemoryCheckCommand``
Command-line tool to perform dynamic analysis. Test command lines
will be launched through this tool.
* `CTest Script`_ variable: :variable:`CTEST_MEMORYCHECK_COMMAND`
* :module:`CTest` module variable: ``MEMORYCHECK_COMMAND``
``MemoryCheckCommandOptions``
Specify command-line options to the ``MemoryCheckCommand`` tool.
They will be placed prior to the test command line.
* `CTest Script`_ variable: :variable:`CTEST_MEMORYCHECK_COMMAND_OPTIONS`
* :module:`CTest` module variable: ``MEMORYCHECK_COMMAND_OPTIONS``
``MemoryCheckType``
Specify the type of memory checking to perform.
* `CTest Script`_ variable: :variable:`CTEST_MEMORYCHECK_TYPE`
* :module:`CTest` module variable: ``MEMORYCHECK_TYPE``
``MemoryCheckSanitizerOptions``
Specify options to sanitizers when running with a sanitize-enabled build.
* `CTest Script`_ variable: :variable:`CTEST_MEMORYCHECK_SANITIZER_OPTIONS`
* :module:`CTest` module variable: ``MEMORYCHECK_SANITIZER_OPTIONS``
``MemoryCheckSuppressionFile``
Specify a file containing suppression rules for the
``MemoryCheckCommand`` tool. It will be passed with options
appropriate to the tool.
* `CTest Script`_ variable: :variable:`CTEST_MEMORYCHECK_SUPPRESSIONS_FILE`
* :module:`CTest` module variable: ``MEMORYCHECK_SUPPRESSIONS_FILE``
Additional configuration settings include:
``BoundsCheckerCommand``
Specify a ``MemoryCheckCommand`` that is known to be command-line
compatible with Bounds Checker.
* `CTest Script`_ variable: none
* :module:`CTest` module variable: none
``PurifyCommand``
Specify a ``MemoryCheckCommand`` that is known to be command-line
compatible with Purify.
* `CTest Script`_ variable: none
* :module:`CTest` module variable: ``PURIFYCOMMAND``
``ValgrindCommand``
Specify a ``MemoryCheckCommand`` that is known to be command-line
compatible with Valgrind.
* `CTest Script`_ variable: none
* :module:`CTest` module variable: ``VALGRIND_COMMAND``
``ValgrindCommandOptions``
Specify command-line options to the ``ValgrindCommand`` tool.
They will be placed prior to the test command line.
* `CTest Script`_ variable: none
* :module:`CTest` module variable: ``VALGRIND_COMMAND_OPTIONS``
.. _`CTest Submit Step`:
CTest Submit Step
-----------------
In a `CTest Script`_, the :command:`ctest_submit` command runs this step.
Arguments to the command may specify some of the step settings.
Configuration settings include:
``BuildName``
Describe the dashboard client platform with a short string.
(Operating system, compiler, etc.)
* `CTest Script`_ variable: :variable:`CTEST_BUILD_NAME`
* :module:`CTest` module variable: ``BUILDNAME``
``CDashVersion``
Specify the version of `CDash`_ on the server.
* `CTest Script`_ variable: none, detected from server
* :module:`CTest` module variable: ``CTEST_CDASH_VERSION``
``CTestSubmitRetryCount``
Specify a number of attempts to retry submission on network failure.
* `CTest Script`_ variable: none,
use the :command:`ctest_submit` ``RETRY_COUNT`` option.
* :module:`CTest` module variable: ``CTEST_SUBMIT_RETRY_COUNT``
``CTestSubmitRetryDelay``
Specify a delay before retrying submission on network failure.
* `CTest Script`_ variable: none,
use the :command:`ctest_submit` ``RETRY_DELAY`` option.
* :module:`CTest` module variable: ``CTEST_SUBMIT_RETRY_DELAY``
``CurlOptions``
Specify a semicolon-separated list of options to control the
Curl library that CTest uses internally to connect to the
server. Possible options are ``CURLOPT_SSL_VERIFYPEER_OFF``
and ``CURLOPT_SSL_VERIFYHOST_OFF``.
* `CTest Script`_ variable: :variable:`CTEST_CURL_OPTIONS`
* :module:`CTest` module variable: ``CTEST_CURL_OPTIONS``
``DropLocation``
The path on the dashboard server to send the submission.
* `CTest Script`_ variable: :variable:`CTEST_DROP_LOCATION`
* :module:`CTest` module variable: ``DROP_LOCATION`` if set,
else ``CTEST_DROP_LOCATION``
``DropMethod``
Specify the method by which results should be submitted to the
dashboard server. The value may be ``cp``, ``ftp``, ``http``,
``https``, ``scp``, or ``xmlrpc`` (if CMake was built with
support for it).
* `CTest Script`_ variable: :variable:`CTEST_DROP_METHOD`
* :module:`CTest` module variable: ``DROP_METHOD`` if set,
else ``CTEST_DROP_METHOD``
``DropSite``
The dashboard server name
(for ``ftp``, ``http``, and ``https``, ``scp``, and ``xmlrpc``).
* `CTest Script`_ variable: :variable:`CTEST_DROP_SITE`
* :module:`CTest` module variable: ``DROP_SITE`` if set,
else ``CTEST_DROP_SITE``
``DropSitePassword``
The dashboard server login password, if any
(for ``ftp``, ``http``, and ``https``).
* `CTest Script`_ variable: :variable:`CTEST_DROP_SITE_PASSWORD`
* :module:`CTest` module variable: ``DROP_SITE_PASSWORD`` if set,
else ``CTEST_DROP_SITE_PASWORD``
``DropSiteUser``
The dashboard server login user name, if any
(for ``ftp``, ``http``, and ``https``).
* `CTest Script`_ variable: :variable:`CTEST_DROP_SITE_USER`
* :module:`CTest` module variable: ``DROP_SITE_USER`` if set,
else ``CTEST_DROP_SITE_USER``
``IsCDash``
Specify whether the dashboard server is `CDash`_ or an older
dashboard server implementation requiring ``TriggerSite``.
* `CTest Script`_ variable: :variable:`CTEST_DROP_SITE_CDASH`
* :module:`CTest` module variable: ``CTEST_DROP_SITE_CDASH``
``ScpCommand``
``scp`` command-line tool to use when ``DropMethod`` is ``scp``.
* `CTest Script`_ variable: :variable:`CTEST_SCP_COMMAND`
* :module:`CTest` module variable: ``SCPCOMMAND``
``Site``
Describe the dashboard client host site with a short string.
(Hostname, domain, etc.)
* `CTest Script`_ variable: :variable:`CTEST_SITE`
* :module:`CTest` module variable: ``SITE``,
initialized by the :command:`site_name` command
``TriggerSite``
Legacy option to support older dashboard server implementations.
Not used when ``IsCDash`` is true.
* `CTest Script`_ variable: :variable:`CTEST_TRIGGER_SITE`
* :module:`CTest` module variable: ``TRIGGER_SITE`` if set,
else ``CTEST_TRIGGER_SITE``
See Also See Also
======== ========

@ -0,0 +1 @@
.. cmake-module:: ../../Modules/CPackIFW.cmake

@ -0,0 +1 @@
.. cmake-module:: ../../Modules/CTestCoverageCollectGCOV.cmake

@ -0,0 +1 @@
.. cmake-module:: ../../Modules/CheckFortranSourceCompiles.cmake

@ -0,0 +1 @@
.. cmake-module:: ../../Modules/FindGSL.cmake

@ -1 +1,10 @@
.. cmake-module:: ../../Modules/FindITK.cmake FindITK
-------
This module no longer exists.
This module existed in versions of CMake prior to 3.1, but became
only a thin wrapper around ``find_package(ITK NO_MODULE)`` to
provide compatibility for projects using long-outdated conventions.
Now ``find_package(ITK)`` will search for ``ITKConfig.cmake``
directly.

@ -0,0 +1 @@
.. cmake-module:: ../../Modules/FindIce.cmake

@ -0,0 +1 @@
.. cmake-module:: ../../Modules/FindIntl.cmake

@ -0,0 +1 @@
.. cmake-module:: ../../Modules/FindOpenCL.cmake

@ -1 +1,10 @@
.. cmake-module:: ../../Modules/FindVTK.cmake FindVTK
-------
This module no longer exists.
This module existed in versions of CMake prior to 3.1, but became
only a thin wrapper around ``find_package(VTK NO_MODULE)`` to
provide compatibility for projects using long-outdated conventions.
Now ``find_package(VTK)`` will search for ``VTKConfig.cmake``
directly.

@ -0,0 +1 @@
.. cmake-module:: ../../Modules/FindXercesC.cmake

@ -0,0 +1 @@
.. cmake-module:: ../../Modules/WriteCompilerDetectionHeader.cmake

@ -10,6 +10,9 @@ variable reference is an error. The OLD behavior for this policy is
to warn about the error, leave the string untouched, and continue. to warn about the error, leave the string untouched, and continue.
The NEW behavior for this policy is to report an error. The NEW behavior for this policy is to report an error.
If :policy:`CMP0053` is set to ``NEW``, this policy has no effect
and is treated as always being ``NEW``.
This policy was introduced in CMake version 2.6.3. CMake version This policy was introduced in CMake version 2.6.3. CMake version
|release| warns when the policy is not set and uses OLD behavior. Use |release| warns when the policy is not set and uses OLD behavior. Use
the cmake_policy command to set it to OLD or NEW explicitly. the cmake_policy command to set it to OLD or NEW explicitly.

@ -0,0 +1,24 @@
CMP0051
-------
List TARGET_OBJECTS in SOURCES target property.
CMake 3.0 and lower did not include the ``TARGET_OBJECTS``
:manual:`generator expression <cmake-generator-expressions(7)>` when
returning the :prop_tgt:`SOURCES` target property.
Configure-time CMake code is not able to handle generator expressions. If
using the :prop_tgt:`SOURCES` target property at configure time, it may be
necessary to first remove generator expressions using the
:command:`string(GENEX_STRIP)` command. Generate-time CMake code such as
:command:`file(GENERATE)` can handle the content without stripping.
The ``OLD`` behavior for this policy is to omit ``TARGET_OBJECTS``
expressions from the :prop_tgt:`SOURCES` target property. The ``NEW``
behavior for this policy is to include ``TARGET_OBJECTS`` expressions
in the output.
This policy was introduced in CMake version 3.1.
CMake version |release| warns when the policy is not set and uses
``OLD`` behavior. Use the :command:`cmake_policy` command to set it
to ``OLD`` or ``NEW`` explicitly.

@ -0,0 +1,24 @@
CMP0052
-------
Reject source and build dirs in installed INTERFACE_INCLUDE_DIRECTORIES.
CMake 3.0 and lower allowed subdirectories of the source directory or build
directory to be in the :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` of
installed and exported targets, if the directory was also a subdirectory of
the installation prefix. This makes the installation depend on the
existence of the source dir or binary dir, and the installation will be
broken if either are removed after installation.
See :ref:`Include Directories and Usage Requirements` for more on
specifying include directories for targets.
The OLD behavior for this policy is to export the content of the
:prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` with the source or binary
directory. The NEW behavior for this
policy is to issue an error if such a directory is used.
This policy was introduced in CMake version 3.1.
CMake version |release| warns when the policy is not set and uses
``OLD`` behavior. Use the :command:`cmake_policy` command to set it
to ``OLD`` or ``NEW`` explicitly.

@ -0,0 +1,44 @@
CMP0053
-------
Simplify variable reference and escape sequence evaluation.
CMake 3.1 introduced a much faster implementation of evaluation of the
:ref:`Variable References` and :ref:`Escape Sequences` documented in the
:manual:`cmake-language(7)` manual. While the behavior is identical
to the legacy implementation in most cases, some corner cases were
cleaned up to simplify the behavior. Specifically:
* Expansion of ``@VAR@`` reference syntax defined by the
:command:`configure_file` and :command:`string(CONFIGURE)`
commands is no longer performed in other contexts.
* Literal ``${VAR}`` reference syntax may contain only
alphanumeric characters (``A-Z``, ``a-z``, ``0-9``) and
the characters ``_``, ``.``, ``/``, ``-``, and ``+``.
Variables with other characters in their name may still
be referenced indirectly, e.g.
.. code-block:: cmake
set(varname "otherwise & disallowed $ characters")
message("${${varname}}")
* The setting of policy :policy:`CMP0010` is not considered,
so improper variable reference syntax is always an error.
* More characters are allowed to be escaped in variable names.
Previously, only ``()#" \@^`` were valid characters to
escape. Now any non-alphanumeric, non-semicolon, non-NUL
character may be escaped following the ``escape_identity``
production in the :ref:`Escape Sequences` section of the
:manual:`cmake-language(7)` manual.
The ``OLD`` behavior for this policy is to honor the legacy behavior for
variable references and escape sequences. The ``NEW`` behavior is to
use the simpler variable expansion and escape sequence evaluation rules.
This policy was introduced in CMake version 3.1.
CMake version |release| warns when the policy is not set and uses
``OLD`` behavior. Use the :command:`cmake_policy` command to set
it to ``OLD`` or ``NEW`` explicitly.

@ -0,0 +1,46 @@
CMP0054
-------
Only interpret :command:`if` arguments as variables or keywords when unquoted.
CMake 3.1 and above no longer implicitly dereference variables or
interpret keywords in an :command:`if` command argument when
it is a :ref:`Quoted Argument` or a :ref:`Bracket Argument`.
The ``OLD`` behavior for this policy is to dereference variables and
interpret keywords even if they are quoted or bracketed.
The ``NEW`` behavior is to not dereference variables or interpret keywords
that have been quoted or bracketed.
Given the following partial example:
::
set(MONKEY 1)
set(ANIMAL MONKEY)
if("${ANIMAL}" STREQUAL "MONKEY")
After explicit expansion of variables this gives:
::
if("MONKEY" STREQUAL "MONKEY")
With the policy set to ``OLD`` implicit expansion reduces this semantically to:
::
if("1" STREQUAL "1")
With the policy set to ``NEW`` the quoted arguments will not be
further dereferenced:
::
if("MONKEY" STREQUAL "MONKEY")
This policy was introduced in CMake version 3.1.
CMake version |release| warns when the policy is not set and uses
``OLD`` behavior. Use the :command:`cmake_policy` command to set
it to ``OLD`` or ``NEW`` explicitly.

@ -0,0 +1,17 @@
CMP0055
-------
Strict checking for the :command:`break` command.
CMake 3.1 and lower allowed calls to the :command:`break` command
outside of a loop context and also ignored any given arguments.
This was undefined behavior.
The OLD behavior for this policy is to allow :command:`break` to be placed
outside of loop contexts and ignores any arguments. The NEW behavior for this
policy is to issue an error if a misplaced break or any arguments are found.
This policy was introduced in CMake version 3.2.
CMake version |release| warns when the policy is not set and uses
OLD behavior. Use the cmake_policy command to set it to OLD or
NEW explicitly.

@ -0,0 +1,32 @@
CMP0056
-------
Honor link flags in :command:`try_compile` source-file signature.
The :command:`try_compile` command source-file signature generates a
``CMakeLists.txt`` file to build the source file into an executable.
In order to compile the source the same way as it might be compiled
by the calling project, the generated project sets the value of the
:variable:`CMAKE_<LANG>_FLAGS` variable to that in the calling project.
The value of the :variable:`CMAKE_EXE_LINKER_FLAGS` variable may be
needed in some cases too, but CMake 3.1 and lower did not set it in
the generated project. CMake 3.2 and above prefer to set it so that
linker flags are honored as well as compiler flags. This policy
provides compatibility with the pre-3.2 behavior.
The OLD behavior for this policy is to not set the value of the
:variable:`CMAKE_EXE_LINKER_FLAGS` variable in the generated test
project. The NEW behavior for this policy is to set the value of
the :variable:`CMAKE_EXE_LINKER_FLAGS` variable in the test project
to the same as it is in the calling project.
If the project code does not set the policy explicitly, users may
set it on the command line by defining the
:variable:`CMAKE_POLICY_DEFAULT_CMP0056 <CMAKE_POLICY_DEFAULT_CMP<NNNN>>`
variable in the cache.
This policy was introduced in CMake version 3.2. Unlike most policies,
CMake version |release| does *not* warn by default when this policy
is not set and simply uses OLD behavior. See documentation of the
:variable:`CMAKE_POLICY_WARNING_CMP0056 <CMAKE_POLICY_WARNING_CMP<NNNN>>`
variable to control the warning.

@ -1,6 +1,8 @@
COMPILE_DEFINITIONS_<CONFIG> COMPILE_DEFINITIONS_<CONFIG>
---------------------------- ----------------------------
Ignored. See CMake Policy :policy:`CMP0043`.
Per-configuration preprocessor definitions in a directory. Per-configuration preprocessor definitions in a directory.
This is the configuration-specific version of :prop_dir:`COMPILE_DEFINITIONS` This is the configuration-specific version of :prop_dir:`COMPILE_DEFINITIONS`

@ -6,9 +6,9 @@ List of options to pass to the compiler.
This property specifies the list of options given so far to the This property specifies the list of options given so far to the
:command:`add_compile_options` command. :command:`add_compile_options` command.
This property is used to populate the :prop_tgt:`COMPILE_OPTIONS` target This property is used to initialize the :prop_tgt:`COMPILE_OPTIONS` target
property, which is used by the generators to set the options for the property when a target is created, which is used by the generators to set
compiler. the options for the compiler.
Contents of ``COMPILE_OPTIONS`` may use "generator expressions" with the Contents of ``COMPILE_OPTIONS`` may use "generator expressions" with the
syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual

@ -0,0 +1,303 @@
CMAKE_CXX_KNOWN_FEATURES
------------------------
List of C++ features known to this version of CMake.
The features listed in this global property may be known to be available to the
C++ compiler. If the feature is available with the C++ compiler, it will
be listed in the :variable:`CMAKE_CXX_COMPILE_FEATURES` variable.
The features listed here may be used with the :command:`target_compile_features`
command. See the :manual:`cmake-compile-features(7)` manual for information on
compile features.
The features known to this version of CMake are:
``cxx_aggregate_default_initializers``
Aggregate default initializers, as defined in N3605_.
.. _N3605: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3605.html
``cxx_alias_templates``
Template aliases, as defined in N2258_.
.. _N2258: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2258.pdf
``cxx_alignas``
Alignment control ``alignas``, as defined in N2341_.
.. _N2341: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2341.pdf
``cxx_alignof``
Alignment control ``alignof``, as defined in N2341_.
.. _N2341: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2341.pdf
``cxx_attributes``
Generic attributes, as defined in N2761_.
.. _N2761: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2761.pdf
``cxx_attribute_deprecated``
``[[deprecated]]`` attribute, as defined in N3760_.
.. _N3760: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3760.html
``cxx_auto_type``
Automatic type deduction, as defined in N1984_.
.. _N1984: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1984.pdf
``cxx_binary_literals``
Binary literals, as defined in N3472_.
.. _N3472: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3472.pdf
``cxx_constexpr``
Constant expressions, as defined in N2235_.
.. _N2235: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2235.pdf
``cxx_contextual_conversions``
Contextual conversions, as defined in N3323_.
.. _N3323: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3323.pdf
``cxx_decltype_incomplete_return_types``
Decltype on incomplete return types, as defined in N3276_.
.. _N3276 : http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3276.pdf
``cxx_decltype``
Decltype, as defined in N2343_.
.. _N2343: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2343.pdf
``cxx_decltype_auto``
``decltype(auto)`` semantics, as defined in N3638_.
.. _N3638: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3638.html
``cxx_default_function_template_args``
Default template arguments for function templates, as defined in DR226_
.. _DR226: http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#226
``cxx_defaulted_functions``
Defaulted functions, as defined in N2346_.
.. _N2346: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2346.htm
``cxx_defaulted_move_initializers``
Defaulted move initializers, as defined in N3053_.
.. _N3053: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3053.html
``cxx_delegating_constructors``
Delegating constructors, as defined in N1986_.
.. _N1986: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1986.pdf
``cxx_deleted_functions``
Deleted functions, as defined in N2346_.
.. _N2346: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2346.htm
``cxx_digit_separators``
Digit separators, as defined in N3781_.
.. _N3781: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3781.pdf
``cxx_enum_forward_declarations``
Enum forward declarations, as defined in N2764_.
.. _N2764: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2764.pdf
``cxx_explicit_conversions``
Explicit conversion operators, as defined in N2437_.
.. _N2437: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2437.pdf
``cxx_extended_friend_declarations``
Extended friend declarations, as defined in N1791_.
.. _N1791: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1791.pdf
``cxx_extern_templates``
Extern templates, as defined in N1987_.
.. _N1987: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1987.htm
``cxx_final``
Override control ``final`` keyword, as defined in N2928_, N3206_ and N3272_.
.. _N2928: http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2928.htm
.. _N3206: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3206.htm
.. _N3272: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3272.htm
``cxx_func_identifier``
Predefined ``__func__`` identifier, as defined in N2340_.
.. _N2340: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2340.htm
``cxx_generalized_initializers``
Initializer lists, as defined in N2672_.
.. _N2672: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2672.htm
``cxx_generic_lambdas``
Generic lambdas, as defined in N3649_.
.. _N3649: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3649.html
``cxx_inheriting_constructors``
Inheriting constructors, as defined in N2540_.
.. _N2540: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2540.htm
``cxx_inline_namespaces``
Inline namespaces, as defined in N2535_.
.. _N2535: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2535.htm
``cxx_lambdas``
Lambda functions, as defined in N2927_.
.. _N2927: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2927.pdf
``cxx_lambda_init_captures``
Initialized lambda captures, as defined in N3648_.
.. _N3648: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3648.html
``cxx_local_type_template_args``
Local and unnamed types as template arguments, as defined in N2657_.
.. _N2657: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2657.htm
``cxx_long_long_type``
``long long`` type, as defined in N1811_.
.. _N1811: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1811.pdf
``cxx_noexcept``
Exception specifications, as defined in N3050_.
.. _N3050: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3050.html
``cxx_nonstatic_member_init``
Non-static data member initialization, as defined in N2756_.
.. _N2756: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2756.htm
``cxx_nullptr``
Null pointer, as defined in N2431_.
.. _N2431: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf
``cxx_override``
Override control ``override`` keyword, as defined in N2928_, N3206_
and N3272_.
.. _N2928: http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2928.htm
.. _N3206: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3206.htm
.. _N3272: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3272.htm
``cxx_range_for``
Range-based for, as defined in N2930_.
.. _N2930: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2930.html
``cxx_raw_string_literals``
Raw string literals, as defined in N2442_.
.. _N2442: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2442.htm
``cxx_reference_qualified_functions``
Reference qualified functions, as defined in N2439_.
.. _N2439: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2439.htm
``cxx_relaxed_constexpr``
Relaxed constexpr, as defined in N3652_.
.. _N3652: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3652.html
``cxx_return_type_deduction``
Return type deduction on normal functions, as defined in N3386_.
.. _N3386: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3386.html
``cxx_right_angle_brackets``
Right angle bracket parsing, as defined in N1757_.
.. _N1757: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1757.html
``cxx_rvalue_references``
R-value references, as defined in N2118_.
.. _N2118: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2118.html
``cxx_sizeof_member``
Size of non-static data members, as defined in N2253_.
.. _N2253: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2253.html
``cxx_static_assert``
Static assert, as defined in N1720_.
.. _N1720: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1720.html
``cxx_strong_enums``
Strongly typed enums, as defined in N2347_.
.. _N2347: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2347.pdf
``cxx_thread_local``
Thread-local variables, as defined in N2659_.
.. _N2659: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2659.htm
``cxx_trailing_return_types``
Automatic function return type, as defined in N2541_.
.. _N2541: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2541.htm
``cxx_unicode_literals``
Unicode string literals, as defined in N2442_.
.. _N2442: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2442.htm
``cxx_uniform_initialization``
Uniform intialization, as defined in N2640_.
.. _N2640: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2640.pdf
``cxx_unrestricted_unions``
Unrestricted unions, as defined in N2544_.
.. _N2544: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2544.pdf
``cxx_user_literals``
User-defined literals, as defined in N2765_.
.. _N2765: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2765.pdf
``cxx_variable_templates``
Variable templates, as defined in N3651_.
.. _N3651: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3651.pdf
``cxx_variadic_macros``
Variadic macros, as defined in N1653_.
.. _N1653: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1653.htm
``cxx_variadic_templates``
Variadic templates, as defined in N2242_.
.. _N2242: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2242.pdf
``cxx_template_template_parameters``
Template template parameters, as defined in ``ISO/IEC 14882:1998``.

@ -0,0 +1,26 @@
CMAKE_C_KNOWN_FEATURES
----------------------
List of C features known to this version of CMake.
The features listed in this global property may be known to be available to the
C compiler. If the feature is available with the C compiler, it will
be listed in the :variable:`CMAKE_C_COMPILE_FEATURES` variable.
The features listed here may be used with the :command:`target_compile_features`
command. See the :manual:`cmake-compile-features(7)` manual for information on
compile features.
The features known to this version of CMake are:
``c_function_prototypes``
Function prototypes, as defined in ``ISO/IEC 9899:1990``.
``c_restrict``
``restrict`` keyword, as defined in ``ISO/IEC 9899:1999``.
``c_static_assert``
Static assert, as defined in ``ISO/IEC 9899:2011``.
``c_variadic_macros``
Variadic macros, as defined in ``ISO/IEC 9899:1999``.

@ -18,3 +18,6 @@ Defined pools could be used globally by setting
:variable:`CMAKE_JOB_POOL_COMPILE` and :variable:`CMAKE_JOB_POOL_LINK` :variable:`CMAKE_JOB_POOL_COMPILE` and :variable:`CMAKE_JOB_POOL_LINK`
or per target by setting the target properties or per target by setting the target properties
:prop_tgt:`JOB_POOL_COMPILE` and :prop_tgt:`JOB_POOL_LINK`. :prop_tgt:`JOB_POOL_COMPILE` and :prop_tgt:`JOB_POOL_LINK`.
Build targets provided by CMake that are meant for individual interactive
use, such as ``install``, are placed in the ``console`` pool automatically.

@ -0,0 +1,6 @@
CPACK_NEVER_OVERWRITE
---------------------
Request that this file not be overwritten on install or reinstall.
The property is currently only supported by the WIX generator.

@ -0,0 +1,6 @@
CPACK_PERMANENT
---------------
Request that this file not be removed on uninstall.
The property is currently only supported by the WIX generator.

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save