diff --git a/Auxiliary/cmake-indent.vim b/Auxiliary/cmake-indent.vim index 6cee9c858..fa088e4dd 100644 --- a/Auxiliary/cmake-indent.vim +++ b/Auxiliary/cmake-indent.vim @@ -16,7 +16,7 @@ " Version: $Revision$ " " Licence: The CMake license applies to this file. See -" http://www.cmake.org/licensing +" https://cmake.org/licensing " This implies that distribution with Vim is allowed if exists("b:did_indent") diff --git a/Auxiliary/cmake-mode.el b/Auxiliary/cmake-mode.el index 7458a660c..e50ae7b95 100644 --- a/Auxiliary/cmake-mode.el +++ b/Auxiliary/cmake-mode.el @@ -43,7 +43,14 @@ set the path with these commands: (setenv \"PATH\" (concat (getenv \"PATH\") \":/usr/local/cmake/bin\"))" :type 'file :group 'cmake) -;; + +;; Keywords +(defconst cmake-keywords-block-open '("IF" "MACRO" "FOREACH" "ELSE" "ELSEIF" "WHILE" "FUNCTION")) +(defconst cmake-keywords-block-close '("ENDIF" "ENDFOREACH" "ENDMACRO" "ELSE" "ELSEIF" "ENDWHILE" "ENDFUNCTION")) +(defconst cmake-keywords + (let ((kwds (append cmake-keywords-block-open cmake-keywords-block-close nil))) + (delete-dups kwds))) + ;; Regular expressions used by line indentation function. ;; (defconst cmake-regex-blank "^[ \t]*$") @@ -51,40 +58,39 @@ set the path with these commands: (defconst cmake-regex-paren-left "(") (defconst cmake-regex-paren-right ")") (defconst cmake-regex-argument-quoted - "\"\\([^\"\\\\]\\|\\\\\\(.\\|\n\\)\\)*\"") + (rx ?\" (* (or (not (any ?\" ?\\)) (and ?\\ anything))) ?\")) (defconst cmake-regex-argument-unquoted - "\\([^ \t\r\n()#\"\\\\]\\|\\\\.\\)\\([^ \t\r\n()#\\\\]\\|\\\\.\\)*") -(defconst cmake-regex-token (concat "\\(" cmake-regex-comment - "\\|" cmake-regex-paren-left - "\\|" cmake-regex-paren-right - "\\|" cmake-regex-argument-unquoted - "\\|" cmake-regex-argument-quoted - "\\)")) -(defconst cmake-regex-indented (concat "^\\(" - cmake-regex-token - "\\|" "[ \t\r\n]" - "\\)*")) + (rx (or (not (any space "()#\"\\\n")) (and ?\\ nonl)) + (* (or (not (any space "()#\\\n")) (and ?\\ nonl))))) +(defconst cmake-regex-token + (rx-to-string `(group (or (regexp ,cmake-regex-comment) + ?( ?) + (regexp ,cmake-regex-argument-unquoted) + (regexp ,cmake-regex-argument-quoted))))) +(defconst cmake-regex-indented + (rx-to-string `(and bol (* (group (or (regexp ,cmake-regex-token) (any space ?\n))))))) (defconst cmake-regex-block-open - "^\\(if\\|macro\\|foreach\\|else\\|elseif\\|while\\|function\\)$") + (rx-to-string `(and symbol-start (or ,@(append cmake-keywords-block-open + (mapcar 'downcase cmake-keywords-block-open))) symbol-end))) (defconst cmake-regex-block-close - "^[ \t]*\\(endif\\|endforeach\\|endmacro\\|else\\|elseif\\|endwhile\\|endfunction\\)[ \t]*(") + (rx-to-string `(and symbol-start (or ,@(append cmake-keywords-block-close + (mapcar 'downcase cmake-keywords-block-close))) symbol-end))) +(defconst cmake-regex-close + (rx-to-string `(and bol (* space) (regexp ,cmake-regex-block-close) + (* space) (regexp ,cmake-regex-paren-left)))) ;------------------------------------------------------------------------------ -;; -;; Helper functions for line indentation function. -;; +;; Line indentation helper functions + (defun cmake-line-starts-inside-string () "Determine whether the beginning of the current line is in a string." - (if (save-excursion - (beginning-of-line) - (let ((parse-end (point))) - (goto-char (point-min)) - (nth 3 (parse-partial-sexp (point) parse-end)) - ) - ) - t - nil + (save-excursion + (beginning-of-line) + (let ((parse-end (point))) + (goto-char (point-min)) + (nth 3 (parse-partial-sexp (point) parse-end)) + ) ) ) @@ -111,57 +117,40 @@ set the path with these commands: ;; Line indentation function. ;; (defun cmake-indent () - "Indent current line as CMAKE code." + "Indent current line as CMake code." (interactive) - (if (cmake-line-starts-inside-string) - () + (unless (cmake-line-starts-inside-string) (if (bobp) (cmake-indent-line-to 0) (let (cur-indent) - (save-excursion (beginning-of-line) - (let ((point-start (point)) (case-fold-search t) ;; case-insensitive token) - ; Search back for the last indented line. (cmake-find-last-indented-line) - ; Start with the indentation on this line. (setq cur-indent (current-indentation)) - ; Search forward counting tokens that adjust indentation. (while (re-search-forward cmake-regex-token point-start t) (setq token (match-string 0)) - (if (string-match (concat "^" cmake-regex-paren-left "$") token) - (setq cur-indent (+ cur-indent cmake-tab-width)) - ) - (if (string-match (concat "^" cmake-regex-paren-right "$") token) - (setq cur-indent (- cur-indent cmake-tab-width)) - ) - (if (and - (string-match cmake-regex-block-open token) - (looking-at (concat "[ \t]*" cmake-regex-paren-left)) - ) - (setq cur-indent (+ cur-indent cmake-tab-width)) - ) + (when (or (string-match (concat "^" cmake-regex-paren-left "$") token) + (and (string-match cmake-regex-block-open token) + (looking-at (concat "[ \t]*" cmake-regex-paren-left)))) + (setq cur-indent (+ cur-indent cmake-tab-width))) + (when (string-match (concat "^" cmake-regex-paren-right "$") token) + (setq cur-indent (- cur-indent cmake-tab-width))) ) (goto-char point-start) - - ; If this is the end of a block, decrease indentation. - (if (looking-at cmake-regex-block-close) - (setq cur-indent (- cur-indent cmake-tab-width)) + ;; If next token closes the block, decrease indentation + (when (looking-at cmake-regex-close) + (setq cur-indent (- cur-indent cmake-tab-width)) ) ) ) - ; Indent this line by the amount selected. - (if (< cur-indent 0) - (cmake-indent-line-to 0) - (cmake-indent-line-to cur-indent) - ) + (cmake-indent-line-to (max cur-indent 0)) ) ) ) @@ -183,17 +172,19 @@ the indentation. Otherwise it retains the same position on the line" ;; ;; Helper functions for buffer ;; -(defun unscreamify-cmake-buffer () +(defun cmake-unscreamify-buffer () "Convert all CMake commands to lowercase in buffer." (interactive) - (goto-char (point-min)) - (while (re-search-forward "^\\([ \t]*\\)\\(\\w+\\)\\([ \t]*(\\)" nil t) - (replace-match - (concat - (match-string 1) - (downcase (match-string 2)) - (match-string 3)) - t)) + (save-excursion + (goto-char (point-min)) + (while (re-search-forward "^\\([ \t]*\\)\\(\\w+\\)\\([ \t]*(\\)" nil t) + (replace-match + (concat + (match-string 1) + (downcase (match-string 2)) + (match-string 3)) + t)) + ) ) ;------------------------------------------------------------------------------ @@ -202,18 +193,32 @@ the indentation. Otherwise it retains the same position on the line" ;; Keyword highlighting regex-to-face map. ;; (defconst cmake-font-lock-keywords - (list '("^[ \t]*\\([[:word:]_]+\\)[ \t]*(" 1 font-lock-function-name-face)) - "Highlighting expressions for CMAKE mode." - ) + `((,(rx-to-string `(and symbol-start + (or ,@cmake-keywords + ,@(mapcar #'downcase cmake-keywords)) + symbol-end)) + . font-lock-keyword-face) + (,(rx symbol-start (group (+ (or word (syntax symbol)))) (* blank) ?\() + 1 font-lock-function-name-face) + (,(rx "${" (group (+(any alnum "-_+/."))) "}") + 1 font-lock-variable-name-face t) + ) + "Highlighting expressions for CMake mode.") ;------------------------------------------------------------------------------ -;; -;; Syntax table for this mode. Initialize to nil so that it is -;; regenerated when the cmake-mode function is called. -;; -(defvar cmake-mode-syntax-table nil "Syntax table for cmake-mode.") -(setq cmake-mode-syntax-table nil) +;; Syntax table for this mode. +(defvar cmake-mode-syntax-table nil + "Syntax table for CMake mode.") +(or cmake-mode-syntax-table + (setq cmake-mode-syntax-table + (let ((table (make-syntax-table))) + (modify-syntax-entry ?\( "()" table) + (modify-syntax-entry ?\) ")(" table) + (modify-syntax-entry ?# "<" table) + (modify-syntax-entry ?\n ">" table) + (modify-syntax-entry ?$ "'" table) + table))) ;; ;; User hook entry point. @@ -227,39 +232,23 @@ the indentation. Otherwise it retains the same position on the line" ;------------------------------------------------------------------------------ -;; -;; CMake mode startup function. +;; For compatibility with Emacs < 24 +(defalias 'cmake--parent-mode + (if (fboundp 'prog-mode) 'prog-mode 'fundamental-mode)) + +;;------------------------------------------------------------------------------ +;; Mode definition. ;; ;;;###autoload -(defun cmake-mode () - "Major mode for editing CMake listfiles." - (interactive) - (kill-all-local-variables) - (setq major-mode 'cmake-mode) - (setq mode-name "CMAKE") - - ; Create the syntax table - (setq cmake-mode-syntax-table (make-syntax-table)) - (set-syntax-table 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 ?\n ">" cmake-mode-syntax-table) +(define-derived-mode cmake-mode cmake--parent-mode "CMake" + "Major mode for editing CMake source files." ; Setup font-lock mode. - (make-local-variable 'font-lock-defaults) - (setq font-lock-defaults '(cmake-font-lock-keywords)) - + (set (make-local-variable 'font-lock-defaults) '(cmake-font-lock-keywords)) ; Setup indentation function. - (make-local-variable 'indent-line-function) - (setq indent-line-function 'cmake-indent) - + (set (make-local-variable 'indent-line-function) 'cmake-indent) ; Setup comment syntax. - (make-local-variable 'comment-start) - (setq comment-start "#") - - ; Run user hooks. - (run-hooks 'cmake-mode-hook)) + (set (make-local-variable 'comment-start) "#")) ; Help mode starts here diff --git a/Auxiliary/cmake-syntax.vim b/Auxiliary/cmake-syntax.vim index 3e4a12275..624a8c4f3 100644 --- a/Auxiliary/cmake-syntax.vim +++ b/Auxiliary/cmake-syntax.vim @@ -16,7 +16,7 @@ " Version: $Revision$ " " Licence: The CMake license applies to this file. See -" http://www.cmake.org/licensing +" https://cmake.org/licensing " This implies that distribution with Vim is allowed " For version 5.x: Clear all syntax items diff --git a/CMakeCPack.cmake b/CMakeCPack.cmake index 22ca8cfa1..a0aadcc9f 100644 --- a/CMakeCPack.cmake +++ b/CMakeCPack.cmake @@ -22,7 +22,9 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON) endif() - include(${CMake_SOURCE_DIR}/Modules/InstallRequiredSystemLibraries.cmake) + if(CMake_INSTALL_DEPENDENCIES) + include(${CMake_SOURCE_DIR}/Modules/InstallRequiredSystemLibraries.cmake) + endif() endif() set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "CMake is a build tool") @@ -65,6 +67,61 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") endif() endif() + # Components + if(CMake_INSTALL_COMPONENTS) + set(_CPACK_IFW_COMPONENTS_ALL cmake ctest cpack) + if(APPLE) + list(APPEND _CPACK_IFW_COMPONENTS_ALL cmakexbuild) + endif() + if(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME) + set(_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME + ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}) + else() + set(_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME Unspecified) + endif() + list(APPEND _CPACK_IFW_COMPONENTS_ALL ${_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME}) + string(TOUPPER "${_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME}" + _CPACK_IFW_COMPONENT_UNSPECIFIED_UNAME) + if(BUILD_CursesDialog) + list(APPEND _CPACK_IFW_COMPONENTS_ALL ccmake) + endif() + if(BUILD_QtDialog) + list(APPEND _CPACK_IFW_COMPONENTS_ALL cmake-gui) + set(_CPACK_IFW_COMPONENT_CMAKE-GUI_LICENSES "set(CPACK_IFW_COMPONENT_CMAKE-GUI_LICENSES + \"LGPLv2.1\" \"${CMake_SOURCE_DIR}/Licenses/LGPLv2.1.txt\")") + endif() + if(SPHINX_MAN) + list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-man) + endif() + if(SPHINX_HTML) + list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-html) + endif() + if(SPHINX_SINGLEHTML) + list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-singlehtml) + endif() + if(SPHINX_QTHELP) + list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-qthelp) + endif() + set(_CPACK_IFW_COMPONENTS_CONFIGURATION " + # Components + set(CPACK_COMPONENTS_ALL \"${_CPACK_IFW_COMPONENTS_ALL}\") + set(CPACK_COMPONENTS_GROUPING IGNORE) +") + else() + if(BUILD_QtDialog AND CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL) + set(_CPACK_IFW_ADDITIONAL_LICENSES + "\"LGPLv2.1\" \"${CMake_SOURCE_DIR}/Licenses/LGPLv2.1.txt\"") + endif() + endif() + + # Components scripts configuration + foreach(_script + CMake + CMake.Documentation.SphinxHTML) + configure_file("${CMake_SOURCE_DIR}/Source/QtIFW/${_script}.qs.in" + "${CMake_BINARY_DIR}/${_script}.qs" @ONLY) + endforeach() + if(${CMAKE_SYSTEM_NAME} MATCHES Windows) set(_CPACK_IFW_PACKAGE_ICON "set(CPACK_IFW_PACKAGE_ICON \"${CMake_SOURCE_DIR}/Source/QtDialog/CMakeSetup.ico\")") @@ -78,9 +135,13 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") "${CMake_BINARY_DIR}/installscript.qs" @ONLY ) install(FILES "${CMake_SOURCE_DIR}/Source/QtIFW/cmake.org.html" - DESTINATION "." + DESTINATION "${CMAKE_DOC_DIR}" ) - set(_CPACK_IFW_PACKAGE_SCRIPT "set(CPACK_IFW_COMPONENT_GROUP_CMAKE_SCRIPT \"${CMake_BINARY_DIR}/installscript.qs\")") + if(CMake_INSTALL_COMPONENTS) + set(_CPACK_IFW_PACKAGE_SCRIPT "${CMake_BINARY_DIR}/CMake.qs") + else() + set(_CPACK_IFW_PACKAGE_SCRIPT "${CMake_BINARY_DIR}/installscript.qs") + endif() endif() if(${CMAKE_SYSTEM_NAME} MATCHES Linux) diff --git a/CMakeCPackOptions.cmake.in b/CMakeCPackOptions.cmake.in index 600356513..b6013efdd 100644 --- a/CMakeCPackOptions.cmake.in +++ b/CMakeCPackOptions.cmake.in @@ -14,14 +14,14 @@ if(CPACK_GENERATOR MATCHES "NSIS") # tell cpack to create links to the doc files set(CPACK_NSIS_MENU_LINKS "@CMAKE_DOC_DIR@/html/index.html" "CMake Documentation" - "http://www.cmake.org" "CMake Web Site" + "https://cmake.org" "CMake Web Site" ) # Use the icon from cmake-gui for add-remove programs set(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\cmake-gui.exe") set(CPACK_NSIS_PACKAGE_NAME "@CPACK_NSIS_PACKAGE_NAME@") set(CPACK_NSIS_DISPLAY_NAME "@CPACK_NSIS_PACKAGE_NAME@, a cross-platform, open-source build system") - set(CPACK_NSIS_HELP_LINK "http://www.cmake.org") + set(CPACK_NSIS_HELP_LINK "https://cmake.org") set(CPACK_NSIS_URL_INFO_ABOUT "http://www.kitware.com") set(CPACK_NSIS_CONTACT @CPACK_PACKAGE_CONTACT@) set(CPACK_NSIS_MODIFY_PATH ON) @@ -32,29 +32,141 @@ endif() 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") + set(CPACK_IFW_PRODUCT_URL "https://cmake.org") @_CPACK_IFW_PACKAGE_ICON@ set(CPACK_IFW_PACKAGE_WINDOW_ICON "@CMake_SOURCE_DIR@/Source/QtDialog/CMakeSetup128.png") set(CPACK_IFW_PACKAGE_CONTROL_SCRIPT "@CMake_SOURCE_DIR@/Source/QtIFW/controlscript.qs") + # Uninstaller configuration set(CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_NAME "cmake-maintenance") + @_CPACK_IFW_COMPONENTS_CONFIGURATION@ + # Unspecified + set(CPACK_IFW_COMPONENT_@_CPACK_IFW_COMPONENT_UNSPECIFIED_UNAME@_VERSION + "@_CPACK_IFW_PACKAGE_VERSION@") + # Package configuration group set(CPACK_IFW_PACKAGE_GROUP CMake) + # Group configuration + + # CMake 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@ + "@CPACK_PACKAGE_NAME@ Copyright" "@CPACK_RESOURCE_FILE_LICENSE@" + @_CPACK_IFW_ADDITIONAL_LICENSES@) + set(CPACK_IFW_COMPONENT_GROUP_CMAKE_SCRIPT "@_CPACK_IFW_PACKAGE_SCRIPT@") + set(CPACK_IFW_COMPONENT_GROUP_CMAKE_PRIORITY 100) + + # Tools + set(CPACK_COMPONENT_GROUP_TOOLS_DISPLAY_NAME "Command-Line Tools") + set(CPACK_COMPONENT_GROUP_TOOLS_DESCRIPTION + "Command-Line Tools: cmake, ctest and cpack") + set(CPACK_COMPONENT_GROUP_TOOLS_PARENT_GROUP CMake) + set(CPACK_IFW_COMPONENT_GROUP_TOOLS_PRIORITY 90) + set(CPACK_IFW_COMPONENT_GROUP_TOOLS_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") + + set(CPACK_COMPONENT_CMAKE_DISPLAY_NAME "cmake") + set(CPACK_COMPONENT_CMAKE_DESCRIPTION + "The \"cmake\" executable is the CMake command-line interface") + set(CPACK_COMPONENT_CMAKE_REQUIRED TRUE) + set(CPACK_COMPONENT_CMAKE_GROUP Tools) + set(CPACK_IFW_COMPONENT_CMAKE_NAME "CMake") + set(CPACK_IFW_COMPONENT_CMAKE_PRIORITY 89) + set(CPACK_IFW_COMPONENT_CMAKE_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") + + set(CPACK_COMPONENT_CTEST_DISPLAY_NAME "ctest") + set(CPACK_COMPONENT_CTEST_DESCRIPTION + "The \"ctest\" executable is the CMake test driver program") + set(CPACK_COMPONENT_CTEST_REQUIRED TRUE) + set(CPACK_COMPONENT_CTEST_GROUP Tools) + set(CPACK_IFW_COMPONENT_CTEST_NAME "CTest") + set(CPACK_IFW_COMPONENT_CTEST_PRIORITY 88) + set(CPACK_IFW_COMPONENT_CTEST_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") + + set(CPACK_COMPONENT_CPACK_DISPLAY_NAME "cpack") + set(CPACK_COMPONENT_CPACK_DESCRIPTION + "The \"cpack\" executable is the CMake packaging program") + set(CPACK_COMPONENT_CPACK_REQUIRED TRUE) + set(CPACK_COMPONENT_CPACK_GROUP Tools) + set(CPACK_IFW_COMPONENT_CPACK_NAME "CPack") + set(CPACK_IFW_COMPONENT_CPACK_PRIORITY 87) + set(CPACK_IFW_COMPONENT_CPACK_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") + + set(CPACK_COMPONENT_CMAKEXBUILD_DISPLAY_NAME "cmakexbuild") + set(CPACK_COMPONENT_CMAKEXBUILD_DESCRIPTION + "The \"cmakexbuild\" executable is a wrapper program for \"xcodebuild\"") + set(CPACK_COMPONENT_CMAKEXBUILD_REQUIRED TRUE) + set(CPACK_COMPONENT_CMAKEXBUILD_GROUP Tools) + set(CPACK_IFW_COMPONENT_CMAKEXBUILD_NAME "CMakeXBuild") + set(CPACK_IFW_COMPONENT_CMAKEXBUILD_PRIORITY 86) + set(CPACK_IFW_COMPONENT_CMAKEXBUILD_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") + + # Dialogs + set(CPACK_COMPONENT_GROUP_DIALOGS_DISPLAY_NAME "Interactive Dialogs") + set(CPACK_COMPONENT_GROUP_DIALOGS_DESCRIPTION + "Interactive Dialogs with Console and GUI interfaces") + set(CPACK_COMPONENT_GROUP_DIALOGS_PARENT_GROUP CMake) + set(CPACK_IFW_COMPONENT_GROUP_DIALOGS_PRIORITY 80) + set(CPACK_IFW_COMPONENT_GROUP_DIALOGS_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") + + set(CPACK_COMPONENT_CMAKE-GUI_DISPLAY_NAME "cmake-gui") + set(CPACK_COMPONENT_CMAKE-GUI_GROUP Dialogs) + set(CPACK_IFW_COMPONENT_CMAKE-GUI_NAME "QtGUI") + set(CPACK_IFW_COMPONENT_CMAKE-GUI_SCRIPT + "@CMake_SOURCE_DIR@/Source/QtIFW/CMake.Dialogs.QtGUI.qs") + set(CPACK_IFW_COMPONENT_CMAKE-GUI_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") + @_CPACK_IFW_COMPONENT_CMAKE-GUI_LICENSES@ + + set(CPACK_COMPONENT_CCMAKE_DISPLAY_NAME "ccmake") + set(CPACK_COMPONENT_CCMAKE_GROUP Dialogs) + set(CPACK_IFW_COMPONENT_CCMAKE_NAME "CursesGUI") + set(CPACK_IFW_COMPONENT_CCMAKE_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") + + # Documentation + set(CPACK_COMPONENT_GROUP_DOCUMENTATION_DISPLAY_NAME "Documentation") + set(CPACK_COMPONENT_GROUP_DOCUMENTATION_DESCRIPTION + "CMake Documentation in different formats (html, man, qch)") + set(CPACK_COMPONENT_GROUP_DOCUMENTATION_PARENT_GROUP CMake) + set(CPACK_IFW_COMPONENT_GROUP_DOCUMENTATION_PRIORITY 60) + set(CPACK_IFW_COMPONENT_GROUP_DOCUMENTATION_VERSION + "@_CPACK_IFW_PACKAGE_VERSION@") + + set(CPACK_COMPONENT_SPHINX-MAN_DISPLAY_NAME "man") + set(CPACK_COMPONENT_SPHINX-MAN_GROUP Documentation) + set(CPACK_COMPONENT_SPHINX-MAN_DISABLED TRUE) + set(CPACK_IFW_COMPONENT_SPHINX-MAN_NAME "SphinxMan") + set(CPACK_IFW_COMPONENT_SPHINX-MAN_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") + + set(CPACK_COMPONENT_SPHINX-HTML_DISPLAY_NAME "HTML") + set(CPACK_COMPONENT_SPHINX-HTML_GROUP Documentation) + set(CPACK_IFW_COMPONENT_SPHINX-HTML_NAME "SphinxHTML") + set(CPACK_IFW_COMPONENT_SPHINX-HTML_SCRIPT + "@CMake_BINARY_DIR@/CMake.Documentation.SphinxHTML.qs") + set(CPACK_IFW_COMPONENT_SPHINX-HTML_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") + + set(CPACK_COMPONENT_SPHINX-SINGLEHTML_DISPLAY_NAME "Single HTML") + set(CPACK_COMPONENT_SPHINX-SINGLEHTML_GROUP Documentation) + set(CPACK_COMPONENT_SPHINX-SINGLEHTML_DISABLED TRUE) + set(CPACK_IFW_COMPONENT_SPHINX-SINGLEHTML_NAME "SphinxSingleHTML") + set(CPACK_IFW_COMPONENT_SPHINX-SINGLEHTML_VERSION + "@_CPACK_IFW_PACKAGE_VERSION@") + + set(CPACK_COMPONENT_SPHINX-QTHELP_DISPLAY_NAME "Qt Compressed Help") + set(CPACK_COMPONENT_SPHINX-QTHELP_GROUP Documentation) + set(CPACK_COMPONENT_SPHINX-QTHELP_DISABLED TRUE) + set(CPACK_IFW_COMPONENT_SPHINX-QTHELP_NAME "SphinxQtHelp") + set(CPACK_IFW_COMPONENT_SPHINX-QTHELP_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") + endif() if(CPACK_GENERATOR MATCHES "CygwinSource") @@ -92,7 +204,7 @@ if("${CPACK_GENERATOR}" STREQUAL "WIX") set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}.${patch}") endif() - set(CPACK_WIX_PROPERTY_ARPURLINFOABOUT "http://www.cmake.org") + set(CPACK_WIX_PROPERTY_ARPURLINFOABOUT "https://cmake.org") set(CPACK_WIX_PROPERTY_ARPCONTACT "@CPACK_PACKAGE_CONTACT@") diff --git a/CMakeLists.txt b/CMakeLists.txt index 1b91ab893..c96f68bcd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,9 @@ cmake_minimum_required(VERSION 2.8.4 FATAL_ERROR) if(POLICY CMP0025) cmake_policy(SET CMP0025 NEW) endif() +if(POLICY CMP0053) + cmake_policy(SET CMP0053 NEW) +endif() project(CMake) if(CMAKE_BOOTSTRAP) @@ -38,7 +41,12 @@ endif() # Use most-recent available language dialects with GNU and Clang if(NOT DEFINED CMAKE_C_STANDARD AND NOT CMake_NO_C_STANDARD) - set(CMAKE_C_STANDARD 11) + include(${CMake_SOURCE_DIR}/Source/Checks/cm_c11_thread_local.cmake) + if(NOT CMake_C11_THREAD_LOCAL_BROKEN) + set(CMAKE_C_STANDARD 11) + else() + set(CMAKE_C_STANDARD 99) + endif() endif() if(NOT DEFINED CMAKE_CXX_STANDARD AND NOT CMake_NO_CXX_STANDARD) include(${CMake_SOURCE_DIR}/Source/Checks/cm_cxx14_cstdio.cmake) @@ -59,6 +67,22 @@ if(CMAKE_ENCODING_UTF8) set(KWSYS_ENCODING_DEFAULT_CODEPAGE CP_UTF8) endif() +# option to use COMPONENT with install command +option(CMake_INSTALL_COMPONENTS "Using components when installing" OFF) +mark_as_advanced(CMake_INSTALL_COMPONENTS) +macro(CMake_OPTIONAL_COMPONENT NAME) + if(CMake_INSTALL_COMPONENTS) + set(COMPONENT COMPONENT ${NAME}) + else() + set(COMPONENT) + endif() +endmacro() + +# option to disable installing 3rd-party dependencies +option(CMake_INSTALL_DEPENDENCIES + "Whether to install 3rd-party runtime dependencies" OFF) +mark_as_advanced(CMake_INSTALL_DEPENDENCIES) + #----------------------------------------------------------------------- # a macro to deal with system libraries, implemented as a macro # simply to improve readability of the main script @@ -128,17 +152,6 @@ macro(CMAKE_HANDLE_SYSTEM_LIBRARIES) endmacro() - - - -if(NOT CMake_TEST_EXTERNAL_CMAKE) - set(CMAKE_BUILD_ON_VISUAL_STUDIO 0) - if(WIN32 AND NOT UNIX AND NOT MINGW) - set(CMAKE_BUILD_ON_VISUAL_STUDIO 1) - endif() -endif() - - #----------------------------------------------------------------------- # a macro to determine the generator and ctest executable to use # for testing. Simply to improve readability of the main script. diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 3499da889..0e5c7e144 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -14,7 +14,7 @@ Please subscribe and post to the `CMake Developers List`_ to offer contributions. Regular and productive contributors may be invited to gain direct push access. -.. _`CMake Developers List`: http://www.cmake.org/mailman/listinfo/cmake-developers +.. _`CMake Developers List`: https://cmake.org/mailman/listinfo/cmake-developers Patches ======= @@ -28,7 +28,7 @@ License We do not require any formal copyright assignment or contributor license agreement. Any contributions intentionally sent upstream are presumed -to be offerred under terms of the OSI-approved BSD 3-clause License. +to be offered under terms of the OSI-approved BSD 3-clause License. See `Copyright.txt`_ for details. .. _`Copyright.txt`: Copyright.txt diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in index 7f20d1062..2adf317a6 100644 --- a/CTestCustom.cmake.in +++ b/CTestCustom.cmake.in @@ -1,9 +1,7 @@ -set(CTEST_CUSTOM_ERROR_MATCH - ${CTEST_CUSTOM_ERROR_MATCH} +list(APPEND CTEST_CUSTOM_ERROR_MATCH "ERROR:") -set(CTEST_CUSTOM_WARNING_EXCEPTION - ${CTEST_CUSTOM_WARNING_EXCEPTION} +list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION "xtree.[0-9]+. : warning C4702: unreachable code" "warning LNK4221" "warning LNK4204" # Occurs by race condition with objects in small libs @@ -32,6 +30,7 @@ set(CTEST_CUSTOM_WARNING_EXCEPTION "remark: .*LOOP WAS VECTORIZED" "warning .980: wrong number of actual arguments to intrinsic function .std::basic_" "LINK : warning LNK4089: all references to.*ADVAPI32.dll.*discarded by /OPT:REF" + "LINK : warning LNK4089: all references to.*CRYPT32.dll.*discarded by /OPT:REF" "LINK : warning LNK4089: all references to.*PSAPI.DLL.*discarded by /OPT:REF" "LINK : warning LNK4089: all references to.*RPCRT4.dll.*discarded by /OPT:REF" "LINK : warning LNK4089: all references to.*SHELL32.dll.*discarded by /OPT:REF" @@ -83,22 +82,18 @@ set(CTEST_CUSTOM_WARNING_EXCEPTION ) if(NOT "@CMAKE_GENERATOR@" MATCHES "Xcode") - set(CTEST_CUSTOM_COVERAGE_EXCLUDE - ${CTEST_CUSTOM_COVERAGE_EXCLUDE} + list(APPEND CTEST_CUSTOM_COVERAGE_EXCLUDE "XCode" ) endif () if(NOT "@CMAKE_GENERATOR@" MATCHES "KDevelop") - set(CTEST_CUSTOM_COVERAGE_EXCLUDE - ${CTEST_CUSTOM_COVERAGE_EXCLUDE} + list(APPEND CTEST_CUSTOM_COVERAGE_EXCLUDE "Kdevelop" ) endif () -set(CTEST_CUSTOM_COVERAGE_EXCLUDE - ${CTEST_CUSTOM_COVERAGE_EXCLUDE} - +list(APPEND CTEST_CUSTOM_COVERAGE_EXCLUDE # Exclude kwsys files from coverage results. They are reported # (with better coverage results) on kwsys dashboards... "/Source/(cm|kw)sys/" @@ -109,3 +104,7 @@ set(CTEST_CUSTOM_COVERAGE_EXCLUDE # Exclude Qt source files from coverage results: "[A-Za-z]./[Qq]t/qt-.+-opensource-src" ) + +list(APPEND CTEST_CUSTOM_MEMCHECK_IGNORE + kwsys.testProcess-10 # See Source/kwsys/CTestCustom.cmake.in + ) diff --git a/Help/command/FIND_XXX.txt b/Help/command/FIND_XXX.txt index 935832930..bd4d2959d 100644 --- a/Help/command/FIND_XXX.txt +++ b/Help/command/FIND_XXX.txt @@ -33,36 +33,47 @@ and the search will not be repeated unless the variable is cleared. If nothing is found, the result will be ``-NOTFOUND``, and the search will be attempted again the next time |FIND_XXX| is invoked with the same variable. -The name of the |SEARCH_XXX| that -is searched for is specified by the names listed -after the NAMES argument. Additional search locations -can be specified after the PATHS argument. If ENV var is -found in the HINTS or PATHS section the environment variable var -will be read and converted from a system environment variable to -a cmake style list of paths. For example ENV PATH would be a way -to list the system path variable. The argument -after DOC will be used for the documentation string in -the cache. -PATH_SUFFIXES specifies additional subdirectories to check below -each search path. - -If NO_DEFAULT_PATH is specified, then no additional paths are + +Options include: + +``NAMES`` + Specify one or more possible names for the |SEARCH_XXX|. + + When using this to specify names with and without a version + suffix, we recommend specifying the unversioned name first + so that locally-built packages can be found before those + provided by distributions. + +``HINTS``, ``PATHS`` + Specify directories to search in addition to the default locations. + The ``ENV var`` sub-option reads paths from a system environment + variable. + +``PATH_SUFFIXES`` + Specify additional subdirectories to check below each directory + location otherwise considered. + +``DOC`` + Specify the documentation string for the ```` cache entry. + +If ``NO_DEFAULT_PATH`` is specified, then no additional paths are added to the search. -If NO_DEFAULT_PATH is not specified, the search process is as follows: +If ``NO_DEFAULT_PATH`` is not specified, the search process is as follows: .. |CMAKE_PREFIX_PATH_XXX_SUBDIR| replace:: - /|XXX_SUBDIR| for each in CMAKE_PREFIX_PATH + |prefix_XXX_SUBDIR| for each ```` in :variable:`CMAKE_PREFIX_PATH` .. |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR| replace:: - /|XXX_SUBDIR| for each /[s]bin in PATH, and - /|XXX_SUBDIR| for other entries in PATH + |prefix_XXX_SUBDIR| for each ``/[s]bin`` in ``PATH``, and + |entry_XXX_SUBDIR| for other entries in ``PATH`` .. |CMAKE_SYSTEM_PREFIX_PATH_XXX_SUBDIR| replace:: - /|XXX_SUBDIR| for each in CMAKE_SYSTEM_PREFIX_PATH + |prefix_XXX_SUBDIR| for each ```` in + :variable:`CMAKE_SYSTEM_PREFIX_PATH` 1. Search paths specified in cmake-specific cache variables. - These are intended to be used on the command line with a -DVAR=value. - This can be skipped if NO_CMAKE_PATH is passed. + These are intended to be used on the command line with a ``-DVAR=value``. + This can be skipped if ``NO_CMAKE_PATH`` is passed. * |CMAKE_PREFIX_PATH_XXX| * |CMAKE_XXX_PATH| @@ -70,24 +81,24 @@ If NO_DEFAULT_PATH is not specified, the search process is as follows: 2. Search paths specified in cmake-specific environment variables. These are intended to be set in the user's shell configuration. - This can be skipped if NO_CMAKE_ENVIRONMENT_PATH is passed. + This can be skipped if ``NO_CMAKE_ENVIRONMENT_PATH`` is passed. * |CMAKE_PREFIX_PATH_XXX| * |CMAKE_XXX_PATH| * |CMAKE_XXX_MAC_PATH| -3. Search the paths specified by the HINTS option. +3. Search the paths specified by the ``HINTS`` option. These should be paths computed by system introspection, such as a hint provided by the location of another item already found. - Hard-coded guesses should be specified with the PATHS option. + Hard-coded guesses should be specified with the ``PATHS`` option. 4. Search the standard system environment variables. - This can be skipped if NO_SYSTEM_ENVIRONMENT_PATH is an argument. + This can be skipped if ``NO_SYSTEM_ENVIRONMENT_PATH`` is an argument. * |SYSTEM_ENVIRONMENT_PATH_XXX| 5. Search cmake variables defined in the Platform files - for the current system. This can be skipped if NO_CMAKE_SYSTEM_PATH + for the current system. This can be skipped if ``NO_CMAKE_SYSTEM_PATH`` is passed. * |CMAKE_SYSTEM_PREFIX_PATH_XXX| @@ -100,6 +111,9 @@ If NO_DEFAULT_PATH is not specified, the search process is as follows: .. |FIND_ARGS_XXX| replace:: NAMES name -.. include:: FIND_XXX_MAC.txt +On OS X the :variable:`CMAKE_FIND_FRAMEWORK` and +:variable:`CMAKE_FIND_APPBUNDLE` variables determine the order of +preference between Apple-style and unix-style package components. + .. include:: FIND_XXX_ROOT.txt .. include:: FIND_XXX_ORDER.txt diff --git a/Help/command/FIND_XXX_MAC.txt b/Help/command/FIND_XXX_MAC.txt deleted file mode 100644 index eb3900cbb..000000000 --- a/Help/command/FIND_XXX_MAC.txt +++ /dev/null @@ -1,24 +0,0 @@ -On Darwin or systems supporting OS X Frameworks, the cmake variable -CMAKE_FIND_FRAMEWORK can be set to empty or one of the following: - -* FIRST: Try to find frameworks before standard libraries or headers. - This is the default on Darwin. - -* LAST: Try to find frameworks after standard libraries or headers. - -* ONLY: Only try to find frameworks. - -* NEVER: Never try to find frameworks. - -On Darwin or systems supporting OS X Application Bundles, the cmake -variable CMAKE_FIND_APPBUNDLE can be set to empty or one of the -following: - -* FIRST: Try to find application bundles before standard programs. - This is the default on Darwin. - -* LAST: Try to find application bundles after standard programs. - -* ONLY: Only try to find application bundles. - -* NEVER: Never try to find application bundles. diff --git a/Help/command/FIND_XXX_ROOT.txt b/Help/command/FIND_XXX_ROOT.txt index b5cab68b8..fab23037c 100644 --- a/Help/command/FIND_XXX_ROOT.txt +++ b/Help/command/FIND_XXX_ROOT.txt @@ -16,8 +16,14 @@ search there too. By default at first the directories listed in directory is searched, and then the non-rooted directories will be searched. The default behavior can be adjusted by setting |CMAKE_FIND_ROOT_PATH_MODE_XXX|. This behavior can be manually -overridden on a per-call basis. By using CMAKE_FIND_ROOT_PATH_BOTH -the search order will be as described above. If -NO_CMAKE_FIND_ROOT_PATH is used then :variable:`CMAKE_FIND_ROOT_PATH` will not be -used. If ONLY_CMAKE_FIND_ROOT_PATH is used then only the re-rooted -directories and directories below :variable:`CMAKE_STAGING_PREFIX` will be searched. +overridden on a per-call basis using options: + +``CMAKE_FIND_ROOT_PATH_BOTH`` + Search in the order described above. + +``NO_CMAKE_FIND_ROOT_PATH`` + Do not use the :variable:`CMAKE_FIND_ROOT_PATH` variable. + +``ONLY_CMAKE_FIND_ROOT_PATH`` + Search only the re-rooted directories and directories below + :variable:`CMAKE_STAGING_PREFIX`. diff --git a/Help/command/add_executable.rst b/Help/command/add_executable.rst index 4ed10e1cf..8b3fb5772 100644 --- a/Help/command/add_executable.rst +++ b/Help/command/add_executable.rst @@ -14,7 +14,7 @@ files listed in the command invocation. The ```` corresponds to the logical target name and must be globally unique within a project. The actual file name of the executable built is constructed based on conventions of the native platform (such as ``.exe`` or just -````. +````). By default the executable file will be created in the build tree directory corresponding to the source tree directory in which the diff --git a/Help/command/add_library.rst b/Help/command/add_library.rst index 7c0620349..5033e1869 100644 --- a/Help/command/add_library.rst +++ b/Help/command/add_library.rst @@ -33,6 +33,14 @@ type is ``STATIC`` or ``SHARED`` based on whether the current value of the variable :variable:`BUILD_SHARED_LIBS` is ``ON``. For ``SHARED`` and ``MODULE`` libraries the :prop_tgt:`POSITION_INDEPENDENT_CODE` target property is set to ``ON`` automatically. +A ``SHARED`` library may be marked with the :prop_tgt:`FRAMEWORK` +target property to create an OS X Framework. + +If a library does not export any symbols, it must not be declared as a +``SHARED`` library. For example, a Windows resource DLL or a managed C++/CLI +DLL that exports no unmanaged symbols would need to be a ``MODULE`` library. +This is because CMake expects a ``SHARED`` library to always have an +associated import library on Windows. By default the library file will be created in the build tree directory corresponding to the source tree directory in which the command was diff --git a/Help/command/add_subdirectory.rst b/Help/command/add_subdirectory.rst index 29b50174c..e97925302 100644 --- a/Help/command/add_subdirectory.rst +++ b/Help/command/add_subdirectory.rst @@ -12,23 +12,23 @@ Add a subdirectory to the build. The source_dir specifies the directory in which the source CMakeLists.txt and code files are located. If it is a relative path it will be evaluated with respect to the current directory (the typical usage), but it may also be an -absolute path. The binary_dir specifies the directory in which to +absolute path. The ``binary_dir`` specifies the directory in which to place the output files. If it is a relative path it will be evaluated with respect to the current output directory, but it may also be an -absolute path. If binary_dir is not specified, the value of -source_dir, before expanding any relative path, will be used (the +absolute path. If ``binary_dir`` is not specified, the value of +``source_dir``, before expanding any relative path, will be used (the typical usage). The CMakeLists.txt file in the specified source directory will be processed immediately by CMake before processing in the current input file continues beyond this command. -If the EXCLUDE_FROM_ALL argument is provided then targets in the -subdirectory will not be included in the ALL target of the parent +If the ``EXCLUDE_FROM_ALL`` argument is provided then targets in the +subdirectory will not be included in the ``ALL`` target of the parent directory by default, and will be excluded from IDE project files. Users must explicitly build targets in the subdirectory. This is meant for use when the subdirectory contains a separate part of the project that is useful but not necessary, such as a set of examples. -Typically the subdirectory should contain its own project() command -invocation so that a full build system will be generated in the +Typically the subdirectory should contain its own :command:`project` +command invocation so that a full build system will be generated in the subdirectory (such as a VS IDE solution file). Note that inter-target dependencies supercede this exclusion. If a target built by the parent project depends on a target in the subdirectory, the dependee diff --git a/Help/command/add_test.rst b/Help/command/add_test.rst index 7e7e6bddd..d8a96e9b9 100644 --- a/Help/command/add_test.rst +++ b/Help/command/add_test.rst @@ -28,6 +28,13 @@ quotes, or other characters special in CMake syntax. The options are: directory set to the build directory corresponding to the current source directory. +The given test command is expected to exit with code ``0`` to pass and +non-zero to fail, or vice-versa if the :prop_test:`WILL_FAIL` test +property is set. Any output written to stdout or stderr will be +captured by :manual:`ctest(1)` but does not affect the pass/fail status +unless the :prop_test:`PASS_REGULAR_EXPRESSION` or +:prop_test:`FAIL_REGULAR_EXPRESSION` test property is used. + The ``COMMAND`` and ``WORKING_DIRECTORY`` options may use "generator expressions" with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual for available expressions. diff --git a/Help/command/aux_source_directory.rst b/Help/command/aux_source_directory.rst index 434d7a919..dcd1cdfc3 100644 --- a/Help/command/aux_source_directory.rst +++ b/Help/command/aux_source_directory.rst @@ -8,7 +8,7 @@ Find all source files in a directory. aux_source_directory( ) Collects the names of all the source files in the specified directory -and stores the list in the provided. This command is +and stores the list in the ```` provided. This command is intended to be used by projects that use explicit template instantiation. Template instantiation files can be stored in a "Templates" subdirectory and collected automatically using this diff --git a/Help/command/build_name.rst b/Help/command/build_name.rst index 53cd05ec1..f717db1dd 100644 --- a/Help/command/build_name.rst +++ b/Help/command/build_name.rst @@ -3,7 +3,7 @@ build_name Disallowed. See CMake Policy :policy:`CMP0036`. -Use ${CMAKE_SYSTEM} and ${CMAKE_CXX_COMPILER} instead. +Use ``${CMAKE_SYSTEM}`` and ``${CMAKE_CXX_COMPILER}`` instead. :: @@ -11,4 +11,5 @@ Use ${CMAKE_SYSTEM} and ${CMAKE_CXX_COMPILER} instead. Sets the specified variable to a string representing the platform and compiler settings. These values are now available through the -CMAKE_SYSTEM and CMAKE_CXX_COMPILER variables. +:variable:`CMAKE_SYSTEM` and +:variable:`CMAKE_CXX_COMPILER _COMPILER>` variables. diff --git a/Help/command/cmake_host_system_information.rst b/Help/command/cmake_host_system_information.rst index ba545d5e2..9402d57e9 100644 --- a/Help/command/cmake_host_system_information.rst +++ b/Help/command/cmake_host_system_information.rst @@ -8,10 +8,10 @@ Query host system specific information. cmake_host_system_information(RESULT QUERY ...) Queries system information of the host system on which cmake runs. -One or more can be provided to select the information to be -queried. The list of queried values is stored in . +One or more ```` can be provided to select the information to be +queried. The list of queried values is stored in ````. - can be one of the following values: +```` can be one of the following values: :: diff --git a/Help/command/cmake_minimum_required.rst b/Help/command/cmake_minimum_required.rst index 9865eeb75..857321817 100644 --- a/Help/command/cmake_minimum_required.rst +++ b/Help/command/cmake_minimum_required.rst @@ -25,7 +25,7 @@ When version 2.4 or lower is given the command implicitly invokes which enables compatibility features for CMake 2.4 and lower. -The FATAL_ERROR option is accepted but ignored by CMake 2.6 and +The ``FATAL_ERROR`` option is accepted but ignored by CMake 2.6 and higher. It should be specified so CMake versions 2.4 and lower fail with an error instead of just a warning. diff --git a/Help/command/create_test_sourcelist.rst b/Help/command/create_test_sourcelist.rst index 9addd6720..dde6812e1 100644 --- a/Help/command/create_test_sourcelist.rst +++ b/Help/command/create_test_sourcelist.rst @@ -14,17 +14,17 @@ A test driver is a program that links together many small tests into a single executable. This is useful when building static executables with large libraries to shrink the total required size. The list of source files needed to build the test driver will be in -sourceListName. DriverName is the name of the test driver program. +``sourceListName``. ``driverName`` is the name of the test driver program. The rest of the arguments consist of a list of test source files, can be semicolon separated. Each test source file should have a function in it that is the same name as the file with no extension (foo.cxx -should have int foo(int, char*[]);) DriverName will be able to call -each of the tests by name on the command line. If EXTRA_INCLUDE is +should have int foo(int, char*[]);) ``driverName`` will be able to call +each of the tests by name on the command line. If ``EXTRA_INCLUDE`` is specified, then the next argument is included into the generated file. -If FUNCTION is specified, then the next argument is taken as a +If ``FUNCTION`` is specified, then the next argument is taken as a function name that is passed a pointer to ac and av. This can be used -to add extra command line processing to each test. The cmake variable -CMAKE_TESTDRIVER_BEFORE_TESTMAIN can be set to have code that will be -placed directly before calling the test main function. -CMAKE_TESTDRIVER_AFTER_TESTMAIN can be set to have code that will be -placed directly after the call to the test main function. +to add extra command line processing to each test. The +``CMAKE_TESTDRIVER_BEFORE_TESTMAIN`` cmake variable can be set to +have code that will be placed directly before calling the test main function. +``CMAKE_TESTDRIVER_AFTER_TESTMAIN`` can be set to have code that +will be placed directly after the call to the test main function. diff --git a/Help/command/ctest_memcheck.rst b/Help/command/ctest_memcheck.rst index 2800511a4..29bdf7d0e 100644 --- a/Help/command/ctest_memcheck.rst +++ b/Help/command/ctest_memcheck.rst @@ -14,6 +14,7 @@ Perform the :ref:`CTest MemCheck Step` as a :ref:`Dashboard Client`. [EXCLUDE_LABEL ] [INCLUDE_LABEL ] [PARALLEL_LEVEL ] + [TEST_LOAD ] [SCHEDULE_RANDOM ] [STOP_TIME ] [RETURN_VALUE ] diff --git a/Help/command/ctest_read_custom_files.rst b/Help/command/ctest_read_custom_files.rst index 0bc57cd93..cf8e17a9c 100644 --- a/Help/command/ctest_read_custom_files.rst +++ b/Help/command/ctest_read_custom_files.rst @@ -9,3 +9,6 @@ read CTestCustom files. Read all the CTestCustom.ctest or CTestCustom.cmake files from the given directory. + +By default, invoking :manual:`ctest(1)` without a script will read custom +files from the binary directory. diff --git a/Help/command/ctest_run_script.rst b/Help/command/ctest_run_script.rst index 0f3501928..5ec543ed1 100644 --- a/Help/command/ctest_run_script.rst +++ b/Help/command/ctest_run_script.rst @@ -10,6 +10,6 @@ runs a ctest -S script Runs a script or scripts much like if it was run from ctest -S. If no argument is provided then the current script is run using the current -settings of the variables. If NEW_PROCESS is specified then each -script will be run in a separate process.If RETURN_VALUE is specified -the return value of the last script run will be put into var. +settings of the variables. If ``NEW_PROCESS`` is specified then each +script will be run in a separate process.If ``RETURN_VALUE`` is specified +the return value of the last script run will be put into ``var``. diff --git a/Help/command/ctest_start.rst b/Help/command/ctest_start.rst index b5c7b34a5..63db32f4e 100644 --- a/Help/command/ctest_start.rst +++ b/Help/command/ctest_start.rst @@ -14,7 +14,7 @@ after the binary directory is initialized. If the 'source' and If the track is 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 -on the current time stamp. If QUIET is used, CTest will suppress any +on the current time stamp. If ``QUIET`` is used, CTest will suppress any non-error messages that it otherwise would have printed to the console. If the :variable:`CTEST_CHECKOUT_COMMAND` variable diff --git a/Help/command/ctest_test.rst b/Help/command/ctest_test.rst index 8cbb9ec71..412e323a5 100644 --- a/Help/command/ctest_test.rst +++ b/Help/command/ctest_test.rst @@ -14,6 +14,7 @@ Perform the :ref:`CTest Test Step` as a :ref:`Dashboard Client`. [EXCLUDE_LABEL ] [INCLUDE_LABEL ] [PARALLEL_LEVEL ] + [TEST_LOAD ] [SCHEDULE_RANDOM ] [STOP_TIME ] [RETURN_VALUE ] @@ -41,7 +42,7 @@ The options are: Specify the end of a range of test numbers. ``STRIDE `` - Specify the stride by which to step acorss a range of test numbers. + Specify the stride by which to step across a range of test numbers. ``EXCLUDE `` Specify a regular expression matching test names to exclude. @@ -61,6 +62,13 @@ The options are: Specify a positive number representing the number of tests to be run in parallel. +``TEST_LOAD `` + While running tests in parallel, try not to start tests when they + may cause the CPU load to pass above a given threshold. If not + specified the :variable:`CTEST_TEST_LOAD` variable will be checked, + and then the ``--test-load`` command-line argument to :manual:`ctest(1)`. + See also the ``TestLoad`` setting in the :ref:`CTest Test Step`. + ``SCHEDULE_RANDOM `` Launch tests in a random order. This may be useful for detecting implicit test dependencies. @@ -77,3 +85,6 @@ The options are: been printed to the console. Output from the underlying test command is not affected. Summary info detailing the percentage of passing tests is also unaffected by the ``QUIET`` option. + +See also the :variable:`CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE` +and :variable:`CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE` variables. diff --git a/Help/command/define_property.rst b/Help/command/define_property.rst index 62bcd1bf1..873c6cabb 100644 --- a/Help/command/define_property.rst +++ b/Help/command/define_property.rst @@ -11,11 +11,11 @@ Define and document custom properties. BRIEF_DOCS [docs...] FULL_DOCS [docs...]) -Define one property in a scope for use with the set_property and -get_property commands. This is primarily useful to associate +Define one property in a scope for use with the :command:`set_property` and +:command:`get_property` commands. This is primarily useful to associate documentation with property names that may be retrieved with the -get_property command. The first argument determines the kind of scope -in which the property should be used. It must be one of the +:command:`get_property` command. The first argument determines the kind of +scope in which the property should be used. It must be one of the following: :: @@ -28,18 +28,18 @@ following: VARIABLE = documents a CMake language variable CACHED_VARIABLE = documents a CMake cache variable -Note that unlike set_property and get_property no actual scope needs -to be given; only the kind of scope is important. +Note that unlike :command:`set_property` and :command:`get_property` no +actual scope needs to be given; only the kind of scope is important. -The required PROPERTY option is immediately followed by the name of +The required ``PROPERTY`` option is immediately followed by the name of the property being defined. -If the INHERITED option then the get_property command will chain up to -the next higher scope when the requested property is not set in the -scope given to the command. DIRECTORY scope chains to GLOBAL. -TARGET, SOURCE, and TEST chain to DIRECTORY. +If the ``INHERITED`` option then the :command:`get_property` command will +chain up to the next higher scope when the requested property is not set +in the scope given to the command. ``DIRECTORY`` scope chains to +``GLOBAL``. ``TARGET``, ``SOURCE``, and ``TEST`` chain to ``DIRECTORY``. -The BRIEF_DOCS and FULL_DOCS options are followed by strings to be +The ``BRIEF_DOCS`` and ``FULL_DOCS`` options are followed by strings to be associated with the property as its brief and full documentation. -Corresponding options to the get_property command will retrieve the -documentation. +Corresponding options to the :command:`get_property` command will retrieve +the documentation. diff --git a/Help/command/else.rst b/Help/command/else.rst index 5eece9566..0e5a19810 100644 --- a/Help/command/else.rst +++ b/Help/command/else.rst @@ -7,4 +7,4 @@ Starts the else portion of an if block. else(expression) -See the if command. +See the :command:`if` command. diff --git a/Help/command/elseif.rst b/Help/command/elseif.rst index 96ee0e924..9a8dfed1d 100644 --- a/Help/command/elseif.rst +++ b/Help/command/elseif.rst @@ -7,4 +7,4 @@ Starts the elseif portion of an if block. elseif(expression) -See the if command. +See the :command:`if` command. diff --git a/Help/command/enable_language.rst b/Help/command/enable_language.rst index d46ff7ed1..444556151 100644 --- a/Help/command/enable_language.rst +++ b/Help/command/enable_language.rst @@ -18,5 +18,5 @@ targets using the named language directly for compiling sources or indirectly through link dependencies. It is simplest to enable all needed languages in the top-level directory of a project. -The OPTIONAL keyword is a placeholder for future implementation and +The ``OPTIONAL`` keyword is a placeholder for future implementation and does not currently work. diff --git a/Help/command/enable_testing.rst b/Help/command/enable_testing.rst index 41ecd5b1b..1e3e2799c 100644 --- a/Help/command/enable_testing.rst +++ b/Help/command/enable_testing.rst @@ -7,7 +7,7 @@ Enable testing for current directory and below. enable_testing() -Enables testing for this directory and below. See also the add_test -command. Note that ctest expects to find a test file in the build -directory root. Therefore, this command should be in the source -directory root. +Enables testing for this directory and below. See also the +:command:`add_test` command. Note that ctest expects to find a test file +in the build directory root. Therefore, this command should be in the +source directory root. diff --git a/Help/command/endforeach.rst b/Help/command/endforeach.rst index f23552d06..9af972bee 100644 --- a/Help/command/endforeach.rst +++ b/Help/command/endforeach.rst @@ -1,10 +1,10 @@ endforeach ---------- -Ends a list of commands in a FOREACH block. +Ends a list of commands in a foreach block. :: endforeach(expression) -See the FOREACH command. +See the :command:`foreach` command. diff --git a/Help/command/endfunction.rst b/Help/command/endfunction.rst index 63e70ba3c..6cc196cde 100644 --- a/Help/command/endfunction.rst +++ b/Help/command/endfunction.rst @@ -7,4 +7,4 @@ Ends a list of commands in a function block. endfunction(expression) -See the function command. +See the :command:`function` command. diff --git a/Help/command/endif.rst b/Help/command/endif.rst index 4c9955c2e..a0163bf33 100644 --- a/Help/command/endif.rst +++ b/Help/command/endif.rst @@ -7,4 +7,4 @@ Ends a list of commands in an if block. endif(expression) -See the if command. +See the :command:`if` command. diff --git a/Help/command/endmacro.rst b/Help/command/endmacro.rst index 524fc80e7..47327a783 100644 --- a/Help/command/endmacro.rst +++ b/Help/command/endmacro.rst @@ -7,4 +7,4 @@ Ends a list of commands in a macro block. endmacro(expression) -See the macro command. +See the :command:`macro` command. diff --git a/Help/command/endwhile.rst b/Help/command/endwhile.rst index 11fdc1be5..798c20e71 100644 --- a/Help/command/endwhile.rst +++ b/Help/command/endwhile.rst @@ -7,4 +7,4 @@ Ends a list of commands in a while block. endwhile(expression) -See the while command. +See the :command:`while` command. diff --git a/Help/command/exec_program.rst b/Help/command/exec_program.rst index aaa0dacc1..6dfdad394 100644 --- a/Help/command/exec_program.rst +++ b/Help/command/exec_program.rst @@ -1,7 +1,7 @@ exec_program ------------ -Deprecated. Use the execute_process() command instead. +Deprecated. Use the :command:`execute_process` command instead. Run an executable program during the processing of the CMakeList.txt file. @@ -15,10 +15,10 @@ file. The executable is run in the optionally specified directory. The executable can include arguments if it is double quoted, but it is -better to use the optional ARGS argument to specify arguments to the +better to use the optional ``ARGS`` argument to specify arguments to the program. This is because cmake will then be able to escape spaces in -the executable path. An optional argument OUTPUT_VARIABLE specifies a +the executable path. An optional argument ``OUTPUT_VARIABLE`` specifies a variable in which to store the output. To capture the return value of -the execution, provide a RETURN_VALUE. If OUTPUT_VARIABLE is +the execution, provide a ``RETURN_VALUE``. If ``OUTPUT_VARIABLE`` is specified, then no output will go to the stdout/stderr of the console running cmake. diff --git a/Help/command/execute_process.rst b/Help/command/execute_process.rst index c38ec1ae2..ca44b534c 100644 --- a/Help/command/execute_process.rst +++ b/Help/command/execute_process.rst @@ -26,7 +26,7 @@ A single standard error pipe is used for all processes. Options: -COMMAND +``COMMAND`` A child process command line. CMake executes the child process using operating system APIs directly. @@ -36,31 +36,31 @@ COMMAND (Use the ``INPUT_*``, ``OUTPUT_*``, and ``ERROR_*`` options to redirect stdin, stdout, and stderr.) -WORKING_DIRECTORY +``WORKING_DIRECTORY`` The named directory will be set as the current working directory of the child processes. -TIMEOUT +``TIMEOUT`` The child processes will be terminated if they do not finish in the specified number of seconds (fractions are allowed). -RESULT_VARIABLE +``RESULT_VARIABLE`` The variable will be set to contain the result of running the processes. This will be an integer return code from the last child or a string describing an error condition. -OUTPUT_VARIABLE, ERROR_VARIABLE +``OUTPUT_VARIABLE``, ``ERROR_VARIABLE`` The variable named will be set with the contents of the standard output and standard error pipes, respectively. If the same variable is named for both pipes their output will be merged in the order produced. -INPUT_FILE, OUTPUT_FILE, ERROR_FILE +``INPUT_FILE, OUTPUT_FILE``, ``ERROR_FILE`` The file named will be attached to the standard input of the first process, standard output of the last process, or standard error of all processes, respectively. If the same file is named for both output and error then it will be used for both. -OUTPUT_QUIET, ERROR_QUIET +``OUTPUT_QUIET``, ``ERROR_QUIET`` The standard output or standard error results will be quietly ignored. If more than one ``OUTPUT_*`` or ``ERROR_*`` option is given for the diff --git a/Help/command/export.rst b/Help/command/export.rst index d4bab352a..4419dc120 100644 --- a/Help/command/export.rst +++ b/Help/command/export.rst @@ -7,20 +7,20 @@ Export targets from the build tree for use by outside projects. export(EXPORT [NAMESPACE ] [FILE ]) -Create a file that may be included by outside projects to +Create a file ```` that may be included by outside projects to import targets from the current project's build tree. This is useful during cross-compiling to build utility executables that can run on the host platform in one project and then import them into another -project being compiled for the target platform. If the NAMESPACE -option is given the string will be prepended to all target +project being compiled for the target platform. If the ``NAMESPACE`` +option is given the ```` string will be prepended to all target names written to the file. -Target installations are associated with the export +Target installations are associated with the export ```` using the ``EXPORT`` option of the :command:`install(TARGETS)` command. The file created by this command is specific to the build tree and -should never be installed. See the install(EXPORT) command to export -targets from an installation tree. +should never be installed. See the :command:`install(EXPORT)` command to +export targets from an installation tree. The properties set on the generated IMPORTED targets will have the same values as the final values of the input TARGETS. @@ -45,12 +45,12 @@ unspecified. export(PACKAGE ) Store the current build directory in the CMake user package registry -for package . The find_package command may consider the -directory while searching for package . This helps dependent +for package ````. The find_package command may consider the +directory while searching for package ````. This helps dependent 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 registry that this command creates works only in conjunction with a -package configuration file (Config.cmake) that works with the +package configuration file (``Config.cmake``) that works with the 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 diff --git a/Help/command/export_library_dependencies.rst b/Help/command/export_library_dependencies.rst index 73c0b4240..2cb437e77 100644 --- a/Help/command/export_library_dependencies.rst +++ b/Help/command/export_library_dependencies.rst @@ -7,22 +7,22 @@ Use :command:`install(EXPORT)` or :command:`export` command. This command generates an old-style library dependencies file. Projects requiring CMake 2.6 or later should not use the command. Use -instead the install(EXPORT) command to help export targets from an -installation tree and the export() command to export targets from a +instead the :command:`install(EXPORT)` command to help export targets from an +installation tree and the :command:`export` command to export targets from a build tree. The old-style library dependencies file does not take into account -per-configuration names of libraries or the LINK_INTERFACE_LIBRARIES -target property. +per-configuration names of libraries or the +:prop_tgt:`LINK_INTERFACE_LIBRARIES` target property. :: export_library_dependencies( [APPEND]) -Create a file named that can be included into a CMake listfile +Create a file named ```` that can be included into a CMake listfile with the INCLUDE command. The file will contain a number of SET commands that will set all the variables needed for library dependency information. This should be the last command in the top level -CMakeLists.txt file of the project. If the APPEND option is +CMakeLists.txt file of the project. If the ``APPEND`` option is specified, the SET commands will be appended to the given file instead of replacing it. diff --git a/Help/command/file.rst b/Help/command/file.rst index bbddd408d..96ac6c72a 100644 --- a/Help/command/file.rst +++ b/Help/command/file.rst @@ -103,7 +103,8 @@ Generate a list of files that match the ```` and store it into the ````. 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. +path. No specific order of results is defined. If order is important then +sort the list explicitly (e.g. using the :command:`list(SORT)` command). By default ``GLOB`` lists directories - directories are omited in result if ``LIST_DIRECTORIES`` is set to false. diff --git a/Help/command/find_file.rst b/Help/command/find_file.rst index be309a530..bf7a91993 100644 --- a/Help/command/find_file.rst +++ b/Help/command/find_file.rst @@ -5,24 +5,27 @@ find_file .. |NAMES| replace:: NAMES name1 [name2 ...] .. |SEARCH_XXX| replace:: full path to a file .. |SEARCH_XXX_DESC| replace:: full path to named file -.. |XXX_SUBDIR| replace:: include +.. |prefix_XXX_SUBDIR| replace:: ``/include`` +.. |entry_XXX_SUBDIR| replace:: ``/include`` .. |CMAKE_PREFIX_PATH_XXX| replace:: - /include/ if CMAKE_LIBRARY_ARCHITECTURE is set, and - |CMAKE_PREFIX_PATH_XXX_SUBDIR| -.. |CMAKE_XXX_PATH| replace:: CMAKE_INCLUDE_PATH -.. |CMAKE_XXX_MAC_PATH| replace:: CMAKE_FRAMEWORK_PATH + ``/include/`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` + is set, and |CMAKE_PREFIX_PATH_XXX_SUBDIR| +.. |CMAKE_XXX_PATH| replace:: :variable:`CMAKE_INCLUDE_PATH` +.. |CMAKE_XXX_MAC_PATH| replace:: :variable:`CMAKE_FRAMEWORK_PATH` -.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: Directories in INCLUDE, - /include/ if CMAKE_LIBRARY_ARCHITECTURE is set, and - |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|, - and the directories in PATH itself. +.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: Directories in ``INCLUDE``, + ``/include/`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` + is set, and |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|, and the + directories in ``PATH`` itself. .. |CMAKE_SYSTEM_PREFIX_PATH_XXX| replace:: - /include/ if CMAKE_LIBRARY_ARCHITECTURE is set, and - |CMAKE_SYSTEM_PREFIX_PATH_XXX_SUBDIR| -.. |CMAKE_SYSTEM_XXX_PATH| replace:: CMAKE_SYSTEM_INCLUDE_PATH -.. |CMAKE_SYSTEM_XXX_MAC_PATH| replace:: CMAKE_SYSTEM_FRAMEWORK_PATH + ``/include/`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` + is set, and |CMAKE_SYSTEM_PREFIX_PATH_XXX_SUBDIR| +.. |CMAKE_SYSTEM_XXX_PATH| replace:: + :variable:`CMAKE_SYSTEM_INCLUDE_PATH` +.. |CMAKE_SYSTEM_XXX_MAC_PATH| replace:: + :variable:`CMAKE_SYSTEM_FRAMEWORK_PATH` .. |CMAKE_FIND_ROOT_PATH_MODE_XXX| replace:: :variable:`CMAKE_FIND_ROOT_PATH_MODE_INCLUDE` diff --git a/Help/command/find_library.rst b/Help/command/find_library.rst index e3dcd2ba0..5d07574ad 100644 --- a/Help/command/find_library.rst +++ b/Help/command/find_library.rst @@ -5,33 +5,36 @@ find_library .. |NAMES| replace:: NAMES name1 [name2 ...] [NAMES_PER_DIR] .. |SEARCH_XXX| replace:: library .. |SEARCH_XXX_DESC| replace:: library -.. |XXX_SUBDIR| replace:: lib +.. |prefix_XXX_SUBDIR| replace:: ``/lib`` +.. |entry_XXX_SUBDIR| replace:: ``/lib`` .. |CMAKE_PREFIX_PATH_XXX| replace:: - /lib/ if CMAKE_LIBRARY_ARCHITECTURE is set, and - |CMAKE_PREFIX_PATH_XXX_SUBDIR| -.. |CMAKE_XXX_PATH| replace:: CMAKE_LIBRARY_PATH -.. |CMAKE_XXX_MAC_PATH| replace:: CMAKE_FRAMEWORK_PATH + ``/lib/`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` is set, + and |CMAKE_PREFIX_PATH_XXX_SUBDIR| +.. |CMAKE_XXX_PATH| replace:: :variable:`CMAKE_LIBRARY_PATH` +.. |CMAKE_XXX_MAC_PATH| replace:: :variable:`CMAKE_FRAMEWORK_PATH` -.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: Directories in LIB, - /lib/ if CMAKE_LIBRARY_ARCHITECTURE is set, and - |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|, - and the directories in PATH itself. +.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: Directories in ``LIB``, + ``/lib/`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` is set, + and |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|, + and the directories in ``PATH`` itself. .. |CMAKE_SYSTEM_PREFIX_PATH_XXX| replace:: - /lib/ if CMAKE_LIBRARY_ARCHITECTURE is set, and - |CMAKE_SYSTEM_PREFIX_PATH_XXX_SUBDIR| -.. |CMAKE_SYSTEM_XXX_PATH| replace:: CMAKE_SYSTEM_LIBRARY_PATH -.. |CMAKE_SYSTEM_XXX_MAC_PATH| replace:: CMAKE_SYSTEM_FRAMEWORK_PATH + ``/lib/`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` is set, + and |CMAKE_SYSTEM_PREFIX_PATH_XXX_SUBDIR| +.. |CMAKE_SYSTEM_XXX_PATH| replace:: + :variable:`CMAKE_SYSTEM_LIBRARY_PATH` +.. |CMAKE_SYSTEM_XXX_MAC_PATH| replace:: + :variable:`CMAKE_SYSTEM_FRAMEWORK_PATH` .. |CMAKE_FIND_ROOT_PATH_MODE_XXX| replace:: :variable:`CMAKE_FIND_ROOT_PATH_MODE_LIBRARY` .. include:: FIND_XXX.txt -When more than one value is given to the NAMES option this command by +When more than one value is given to the ``NAMES`` option this command by default will consider one name at a time and search every directory -for it. The NAMES_PER_DIR option tells this command to consider one +for it. The ``NAMES_PER_DIR`` option tells this command to consider one directory at a time and search for all names in it. Each library name given to the ``NAMES`` option is first considered @@ -40,14 +43,14 @@ prefixes (e.g. ``lib``) and suffixes (e.g. ``.so``). Therefore one may specify library file names such as ``libfoo.a`` directly. This can be used to locate static libraries on UNIX-like systems. -If the library found is a framework, then VAR will be set to the full -path to the framework /A.framework. When a full path to a -framework is used as a library, CMake will use a -framework A, and a --F to link the framework to the target. +If the library found is a framework, then ```` will be set to the full +path to the framework ``/A.framework``. When a full path to a +framework is used as a library, CMake will use a ``-framework A``, and a +``-F`` to link the framework to the target. -If the global property FIND_LIBRARY_USE_LIB64_PATHS is set all search -paths will be tested as normal, with "64/" appended, and with all -matches of "lib/" replaced with "lib64/". This property is +If the :prop_gbl:`FIND_LIBRARY_USE_LIB64_PATHS` global property is set +all search paths will be tested as normal, with ``64/`` appended, and +with all matches of ``lib/`` replaced with ``lib64/``. This property is automatically set for the platforms that are known to need it if at -least one of the languages supported by the PROJECT command is -enabled. +least one of the languages supported by the :command:`project` command +is enabled. diff --git a/Help/command/find_package.rst b/Help/command/find_package.rst index a5efba6d0..58dff9d39 100644 --- a/Help/command/find_package.rst +++ b/Help/command/find_package.rst @@ -228,9 +228,9 @@ installation directory. Those marked with (U) are intended for installations on UNIX platforms where the prefix is shared by multiple packages. This is merely a convention, so all (W) and (U) directories are still searched on all platforms. Directories marked with (A) are -intended for installations on Apple platforms. The cmake variables -``CMAKE_FIND_FRAMEWORK`` and ``CMAKE_FIND_APPBUNDLE`` -determine the order of preference as specified below. +intended for installations on Apple platforms. The +:variable:`CMAKE_FIND_FRAMEWORK` and :variable:`CMAKE_FIND_APPBUNDLE` +variables determine the order of preference. The set of installation prefixes is constructed using the following steps. If ``NO_DEFAULT_PATH`` is specified all ``NO_*`` options are @@ -295,7 +295,6 @@ enabled. .. |CMAKE_FIND_ROOT_PATH_MODE_XXX| replace:: :variable:`CMAKE_FIND_ROOT_PATH_MODE_PACKAGE` -.. include:: FIND_XXX_MAC.txt .. include:: FIND_XXX_ROOT.txt .. include:: FIND_XXX_ORDER.txt diff --git a/Help/command/find_path.rst b/Help/command/find_path.rst index b5a6e373f..4403cb5bc 100644 --- a/Help/command/find_path.rst +++ b/Help/command/find_path.rst @@ -5,31 +5,34 @@ find_path .. |NAMES| replace:: NAMES name1 [name2 ...] .. |SEARCH_XXX| replace:: file in a directory .. |SEARCH_XXX_DESC| replace:: directory containing the named file -.. |XXX_SUBDIR| replace:: include +.. |prefix_XXX_SUBDIR| replace:: ``/include`` +.. |entry_XXX_SUBDIR| replace:: ``/include`` .. |CMAKE_PREFIX_PATH_XXX| replace:: - /include/ if CMAKE_LIBRARY_ARCHITECTURE is set, and - |CMAKE_PREFIX_PATH_XXX_SUBDIR| -.. |CMAKE_XXX_PATH| replace:: CMAKE_INCLUDE_PATH -.. |CMAKE_XXX_MAC_PATH| replace:: CMAKE_FRAMEWORK_PATH + ``/include/`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` + is set, and |CMAKE_PREFIX_PATH_XXX_SUBDIR| +.. |CMAKE_XXX_PATH| replace:: :variable:`CMAKE_INCLUDE_PATH` +.. |CMAKE_XXX_MAC_PATH| replace:: :variable:`CMAKE_FRAMEWORK_PATH` -.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: Directories in INCLUDE, - /include/ if CMAKE_LIBRARY_ARCHITECTURE is set, and - |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|, - and the directories in PATH itself. +.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: Directories in ``INCLUDE``, + ``/include/`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` + is set, and |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|, and the + directories in ``PATH`` itself. .. |CMAKE_SYSTEM_PREFIX_PATH_XXX| replace:: - /include/ if CMAKE_LIBRARY_ARCHITECTURE is set, and - |CMAKE_SYSTEM_PREFIX_PATH_XXX_SUBDIR| -.. |CMAKE_SYSTEM_XXX_PATH| replace:: CMAKE_SYSTEM_INCLUDE_PATH -.. |CMAKE_SYSTEM_XXX_MAC_PATH| replace:: CMAKE_SYSTEM_FRAMEWORK_PATH + ``/include/`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` + is set, and |CMAKE_SYSTEM_PREFIX_PATH_XXX_SUBDIR| +.. |CMAKE_SYSTEM_XXX_PATH| replace:: + :variable:`CMAKE_SYSTEM_INCLUDE_PATH` +.. |CMAKE_SYSTEM_XXX_MAC_PATH| replace:: + :variable:`CMAKE_SYSTEM_FRAMEWORK_PATH` .. |CMAKE_FIND_ROOT_PATH_MODE_XXX| replace:: :variable:`CMAKE_FIND_ROOT_PATH_MODE_INCLUDE` .. include:: FIND_XXX.txt -When searching for frameworks, if the file is specified as A/b.h, then -the framework search will look for A.framework/Headers/b.h. If that +When searching for frameworks, if the file is specified as ``A/b.h``, then +the framework search will look for ``A.framework/Headers/b.h``. If that is found the path will be set to the path to the framework. CMake -will convert this to the correct -F option to include the file. +will convert this to the correct ``-F`` option to include the file. diff --git a/Help/command/find_program.rst b/Help/command/find_program.rst index c62a8a5d2..d3430c054 100644 --- a/Help/command/find_program.rst +++ b/Help/command/find_program.rst @@ -2,24 +2,32 @@ find_program ------------ .. |FIND_XXX| replace:: find_program -.. |NAMES| replace:: NAMES name1 [name2 ...] +.. |NAMES| replace:: NAMES name1 [name2 ...] [NAMES_PER_DIR] .. |SEARCH_XXX| replace:: program .. |SEARCH_XXX_DESC| replace:: program -.. |XXX_SUBDIR| replace:: [s]bin +.. |prefix_XXX_SUBDIR| replace:: ``/[s]bin`` +.. |entry_XXX_SUBDIR| replace:: ``/[s]bin`` .. |CMAKE_PREFIX_PATH_XXX| replace:: |CMAKE_PREFIX_PATH_XXX_SUBDIR| -.. |CMAKE_XXX_PATH| replace:: CMAKE_PROGRAM_PATH -.. |CMAKE_XXX_MAC_PATH| replace:: CMAKE_APPBUNDLE_PATH +.. |CMAKE_XXX_PATH| replace:: :variable:`CMAKE_PROGRAM_PATH` +.. |CMAKE_XXX_MAC_PATH| replace:: :variable:`CMAKE_APPBUNDLE_PATH` -.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: PATH +.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: ``PATH`` .. |CMAKE_SYSTEM_PREFIX_PATH_XXX| replace:: |CMAKE_SYSTEM_PREFIX_PATH_XXX_SUBDIR| -.. |CMAKE_SYSTEM_XXX_PATH| replace:: CMAKE_SYSTEM_PROGRAM_PATH -.. |CMAKE_SYSTEM_XXX_MAC_PATH| replace:: CMAKE_SYSTEM_APPBUNDLE_PATH +.. |CMAKE_SYSTEM_XXX_PATH| replace:: + :variable:`CMAKE_SYSTEM_PROGRAM_PATH` +.. |CMAKE_SYSTEM_XXX_MAC_PATH| replace:: + :variable:`CMAKE_SYSTEM_APPBUNDLE_PATH` .. |CMAKE_FIND_ROOT_PATH_MODE_XXX| replace:: :variable:`CMAKE_FIND_ROOT_PATH_MODE_PROGRAM` .. include:: FIND_XXX.txt + +When more than one value is given to the ``NAMES`` option this command by +default will consider one name at a time and search every directory +for it. The ``NAMES_PER_DIR`` option tells this command to consider one +directory at a time and search for all names in it. diff --git a/Help/command/fltk_wrap_ui.rst b/Help/command/fltk_wrap_ui.rst index 448ae644d..041e5a7e3 100644 --- a/Help/command/fltk_wrap_ui.rst +++ b/Help/command/fltk_wrap_ui.rst @@ -10,5 +10,5 @@ Create FLTK user interfaces Wrappers. Produce .h and .cxx files for all the .fl and .fld files listed. The resulting .h and .cxx files will be added to a variable named -resultingLibraryName_FLTK_UI_SRCS which should be added to your +``resultingLibraryName_FLTK_UI_SRCS`` which should be added to your library. diff --git a/Help/command/foreach.rst b/Help/command/foreach.rst index 348ebd875..c0f3679d9 100644 --- a/Help/command/foreach.rst +++ b/Help/command/foreach.rst @@ -15,7 +15,7 @@ All commands between foreach and the matching endforeach are recorded without being invoked. Once the endforeach is evaluated, the recorded list of commands is invoked once for each argument listed in the original foreach command. Before each iteration of the loop -"${loop_var}" will be set as a variable with the current value in the +``${loop_var}`` will be set as a variable with the current value in the list. :: @@ -40,8 +40,8 @@ three types of this iteration: foreach(loop_var IN [LISTS [list1 [...]]] [ITEMS [item1 [...]]]) -Iterates over a precise list of items. The LISTS option names +Iterates over a precise list of items. The ``LISTS`` option names list-valued variables to be traversed, including empty elements (an empty string is a zero-length list). (Note macro -arguments are not variables.) The ITEMS option ends argument +arguments are not variables.) The ``ITEMS`` option ends argument parsing and includes all arguments following it in the iteration. diff --git a/Help/command/get_cmake_property.rst b/Help/command/get_cmake_property.rst index bcfc5e831..3a6fb41e1 100644 --- a/Help/command/get_cmake_property.rst +++ b/Help/command/get_cmake_property.rst @@ -8,8 +8,8 @@ Get a property of the CMake instance. get_cmake_property(VAR property) Get a property from the CMake instance. The value of the property is -stored in the variable VAR. If the property is not found, VAR will be -set to "NOTFOUND". Some supported properties include: VARIABLES, -CACHE_VARIABLES, COMMANDS, MACROS, and COMPONENTS. +stored in the variable ``VAR``. If the property is not found, ``VAR`` +will be set to "NOTFOUND". See the :manual:`cmake-properties(7)` manual +for available properties. -See also the more general get_property() command. +See also the more general :command:`get_property` command. diff --git a/Help/command/get_directory_property.rst b/Help/command/get_directory_property.rst index f2a0a803e..e50abe0e9 100644 --- a/Help/command/get_directory_property.rst +++ b/Help/command/get_directory_property.rst @@ -1,14 +1,14 @@ get_directory_property ---------------------- -Get a property of DIRECTORY scope. +Get a property of ``DIRECTORY`` scope. :: get_directory_property( [DIRECTORY ] ) Store a property of directory scope in the named variable. If the -property is not defined the empty-string is returned. The DIRECTORY +property is not defined the empty-string is returned. The ``DIRECTORY`` argument specifies another directory from which to retrieve the property value. The specified directory must have already been traversed by CMake. @@ -21,4 +21,4 @@ traversed by CMake. Get a variable definition from a directory. This form is useful to get a variable definition from another directory. -See also the more general get_property() command. +See also the more general :command:`get_property` command. diff --git a/Help/command/get_filename_component.rst b/Help/command/get_filename_component.rst index 5eec79229..14c8cf279 100644 --- a/Help/command/get_filename_component.rst +++ b/Help/command/get_filename_component.rst @@ -3,11 +3,13 @@ get_filename_component Get a specific component of a full filename. +------------------------------------------------------------------------------ + :: get_filename_component( [CACHE]) -Set to a component of , where is one of: +Set ```` to a component of ````, where ```` is one of: :: @@ -15,23 +17,48 @@ Set to a component of , where is one of: NAME = File name without directory EXT = File name longest extension (.b.c from d/a.b.c) NAME_WE = File name without directory or longest extension - ABSOLUTE = Full path to file - REALPATH = Full path to existing file with symlinks resolved PATH = Legacy alias for DIRECTORY (use for CMake <= 2.8.11) -Paths are returned with forward slashes and have no trailing slahes. +Paths are returned with forward slashes and have no trailing slashes. The longest file extension is always considered. If the optional -CACHE argument is specified, the result variable is added to the +``CACHE`` argument is specified, the result variable is added to the +cache. + +------------------------------------------------------------------------------ + +:: + + get_filename_component( + [BASE_DIR ] + [CACHE]) + +Set ```` to the absolute path of ````, where ```` is one +of: + +:: + + ABSOLUTE = Full path to file + REALPATH = Full path to existing file with symlinks resolved + +If the provided ```` is a relative path, it is evaluated relative +to the given base directory ````. If no base directory is +provided, the default base directory will be +:variable:`CMAKE_CURRENT_SOURCE_DIR`. + +Paths are returned with forward slashes and have no trailing slahes. If the +optional ``CACHE`` argument is specified, the result variable is added to the cache. +------------------------------------------------------------------------------ + :: - get_filename_component( FileName + get_filename_component( PROGRAM [PROGRAM_ARGS ] [CACHE]) -The program in FileName will be found in the system search path or -left as a full path. If PROGRAM_ARGS is present with PROGRAM, then -any command-line arguments present in the FileName string are split -from the program name and stored in . This is used to +The program in ```` will be found in the system search path or +left as a full path. If ``PROGRAM_ARGS`` is present with ``PROGRAM``, then +any command-line arguments present in the ```` string are split +from the program name and stored in ````. This is used to separate a program name from its arguments in a command line string. diff --git a/Help/command/get_source_file_property.rst b/Help/command/get_source_file_property.rst index 80c512b4b..3e975c2f9 100644 --- a/Help/command/get_source_file_property.rst +++ b/Help/command/get_source_file_property.rst @@ -8,9 +8,9 @@ Get a property for a source file. get_source_file_property(VAR file property) Get a property from a source file. The value of the property is -stored in the variable VAR. If the property is not found, VAR will be -set to "NOTFOUND". Use set_source_files_properties to set property -values. Source file properties usually control how the file is built. -One property that is always there is LOCATION +stored in the variable ``VAR``. If the property is not found, ``VAR`` +will be set to "NOTFOUND". Use :command:`set_source_files_properties` +to set property values. Source file properties usually control how the +file is built. One property that is always there is :prop_sf:`LOCATION` -See also the more general get_property() command. +See also the more general :command:`get_property` command. diff --git a/Help/command/get_target_property.rst b/Help/command/get_target_property.rst index 4017d31d4..779825299 100644 --- a/Help/command/get_target_property.rst +++ b/Help/command/get_target_property.rst @@ -8,11 +8,11 @@ Get a property from a target. get_target_property(VAR target property) Get a property from a target. The value of the property is stored in -the variable VAR. If the property is not found, VAR will be set to -"NOTFOUND". Use set_target_properties to set property values. +the variable ``VAR``. If the property is not found, ``VAR`` will be set to +"NOTFOUND". Use :command:`set_target_properties` to set property values. Properties are usually used to control how a target is built, but some query the target instead. This command can get properties for any target so far created. The targets do not need to be in the current CMakeLists.txt file. -See also the more general get_property() command. +See also the more general :command:`get_property` command. diff --git a/Help/command/get_test_property.rst b/Help/command/get_test_property.rst index 391a32ee4..e359f4b3d 100644 --- a/Help/command/get_test_property.rst +++ b/Help/command/get_test_property.rst @@ -8,8 +8,8 @@ Get a property of the test. get_test_property(test property VAR) Get a property from the test. The value of the property is stored in -the variable VAR. If the test or property is not found, VAR will be -set to "NOTFOUND". For a list of standard properties you can type cmake ---help-property-list. +the variable ``VAR``. If the test or property is not found, ``VAR`` will +be set to "NOTFOUND". For a list of standard properties you can type +``cmake --help-property-list``. -See also the more general get_property() command. +See also the more general :command:`get_property` command. diff --git a/Help/command/if.rst b/Help/command/if.rst index 396becfaa..2465bde38 100644 --- a/Help/command/if.rst +++ b/Help/command/if.rst @@ -71,6 +71,10 @@ Possible expressions are: created by the :command:`add_executable`, :command:`add_library`, or :command:`add_custom_target` commands. +``if(TEST test-name)`` + True if the given name is an existing test name created by the + :command:`add_test` command. + ``if(EXISTS path-to-file-or-directory)`` True if the named file or directory exists. Behavior is well-defined only for full paths. diff --git a/Help/command/include.rst b/Help/command/include.rst index a9074c1b6..c391561b1 100644 --- a/Help/command/include.rst +++ b/Help/command/include.rst @@ -9,17 +9,17 @@ Load and run CMake code from a file or module. [NO_POLICY_SCOPE]) Load and run CMake code from the file given. Variable reads and -writes access the scope of the caller (dynamic scoping). If OPTIONAL +writes access the scope of the caller (dynamic scoping). If ``OPTIONAL`` is present, then no error is raised if the file does not exist. If -RESULT_VARIABLE is given the variable will be set to the full filename +``RESULT_VARIABLE`` is given the variable will be set to the full filename which has been included or NOTFOUND if it failed. If a module is specified instead of a file, the file with name -.cmake is searched first in CMAKE_MODULE_PATH, then in the -CMake module directory. There is one exception to this: if the file -which calls include() is located itself in the CMake module directory, -then first the CMake module directory is searched and -CMAKE_MODULE_PATH afterwards. See also policy CMP0017. +.cmake is searched first in :variable:`CMAKE_MODULE_PATH`, +then in the CMake module directory. There is one exception to this: if +the file which calls ``include()`` is located itself in the CMake module +directory, then first the CMake module directory is searched and +:variable:`CMAKE_MODULE_PATH` afterwards. See also policy :policy:`CMP0017`. -See the cmake_policy() command documentation for discussion of the -NO_POLICY_SCOPE option. +See the :command:`cmake_policy` command documentation for discussion of the +``NO_POLICY_SCOPE`` option. diff --git a/Help/command/include_external_msproject.rst b/Help/command/include_external_msproject.rst index ba9a3934a..595762d7a 100644 --- a/Help/command/include_external_msproject.rst +++ b/Help/command/include_external_msproject.rst @@ -13,10 +13,10 @@ Include an external Microsoft project file in a workspace. Includes an external Microsoft project in the generated workspace file. Currently does nothing on UNIX. This will create a target -named [projectname]. This can be used in the add_dependencies command -to make things depend on the external project. +named [projectname]. This can be used in the :command:`add_dependencies` +command to make things depend on the external project. -TYPE, GUID and PLATFORM are optional parameters that allow one to +``TYPE``, ``GUID`` and ``PLATFORM`` are optional parameters that allow one to specify the type of project, id (GUID) of the project and the name of the target platform. This is useful for projects requiring values other than the default (e.g. WIX projects). These options are not diff --git a/Help/command/include_regular_expression.rst b/Help/command/include_regular_expression.rst index dd887df5d..ab5a56325 100644 --- a/Help/command/include_regular_expression.rst +++ b/Help/command/include_regular_expression.rst @@ -8,8 +8,8 @@ Set the regular expression used for dependency checking. include_regular_expression(regex_match [regex_complain]) Set the regular expressions used in dependency checking. Only files -matching regex_match will be traced as dependencies. Only files -matching regex_complain will generate warnings if they cannot be found +matching ``regex_match`` will be traced as dependencies. Only files +matching ``regex_complain`` will generate warnings if they cannot be found (standard header paths are not searched). The defaults are: :: diff --git a/Help/command/install.rst b/Help/command/install.rst index c99ed7361..423899e26 100644 --- a/Help/command/install.rst +++ b/Help/command/install.rst @@ -192,6 +192,10 @@ The list of ``files...`` given to ``FILES`` or ``PROGRAMS`` may use However, if any item begins in a generator expression it must evaluate to a full path. +The install destination given to the files install ``DESTINATION`` may +use "generator expressions" with the syntax ``$<...>``. See the +:manual:`cmake-generator-expressions(7)` manual for available expressions. + Installing Directories ^^^^^^^^^^^^^^^^^^^^^^ @@ -267,6 +271,10 @@ will install the ``icons`` directory to ``share/myproj/icons`` and the file permissions, the scripts will be given specific permissions, and any ``CVS`` directories will be excluded. +The install destination given to the directory install ``DESTINATION`` may +use "generator expressions" with the syntax ``$<...>``. See the +:manual:`cmake-generator-expressions(7)` manual for available expressions. + Custom Installation Logic ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/Help/command/install_files.rst b/Help/command/install_files.rst index 7b6bd8114..1850be6e1 100644 --- a/Help/command/install_files.rst +++ b/Help/command/install_files.rst @@ -1,13 +1,13 @@ install_files ------------- -Deprecated. Use the install(FILES ) command instead. +Deprecated. Use the :command:`install(FILES)` command instead. -This command has been superceded by the install command. It is -provided for compatibility with older CMake code. The FILES form is -directly replaced by the FILES form of the install command. The -regexp form can be expressed more clearly using the GLOB form of the -file command. +This command has been superceded by the :command:`install` command. It is +provided for compatibility with older CMake code. The ``FILES`` form is +directly replaced by the ``FILES`` form of the :command:`install` +command. The regexp form can be expressed more clearly using the ``GLOB`` +form of the :command:`file` command. :: @@ -32,8 +32,8 @@ expression will be installed. install_files( FILES file file ...) -Any files listed after the FILES keyword will be installed explicitly +Any files listed after the ``FILES`` keyword will be installed explicitly from the names given. Full paths are allowed in this form. -The directory is relative to the installation prefix, which is -stored in the variable CMAKE_INSTALL_PREFIX. +The directory ```` is relative to the installation prefix, which is +stored in the variable :variable:`CMAKE_INSTALL_PREFIX`. diff --git a/Help/command/install_programs.rst b/Help/command/install_programs.rst index 26789d8db..79aa486a3 100644 --- a/Help/command/install_programs.rst +++ b/Help/command/install_programs.rst @@ -1,13 +1,13 @@ install_programs ---------------- -Deprecated. Use the install(PROGRAMS ) command instead. +Deprecated. Use the :command:`install(PROGRAMS)` command instead. -This command has been superceded by the install command. It is -provided for compatibility with older CMake code. The FILES form is -directly replaced by the PROGRAMS form of the INSTALL command. The -regexp form can be expressed more clearly using the GLOB form of the -FILE command. +This command has been superceded by the :command:`install` command. It is +provided for compatibility with older CMake code. The ``FILES`` form is +directly replaced by the ``PROGRAMS`` form of the :command:`install` +command. The regexp form can be expressed more clearly using the ``GLOB`` +form of the :command:`file` command. :: @@ -15,7 +15,7 @@ FILE command. install_programs( FILES file1 [file2 ...]) Create rules to install the listed programs into the given directory. -Use the FILES argument to guarantee that the file list version of the +Use the ``FILES`` argument to guarantee that the file list version of the command will be used even when there is only one argument. :: @@ -26,8 +26,9 @@ In the second form any program in the current source directory that matches the regular expression will be installed. This command is intended to install programs that are not built by -cmake, such as shell scripts. See the TARGETS form of the INSTALL -command to create installation rules for targets built by cmake. +cmake, such as shell scripts. See the ``TARGETS`` form of the +:command:`install` command to create installation rules for targets built +by cmake. -The directory is relative to the installation prefix, which is -stored in the variable CMAKE_INSTALL_PREFIX. +The directory ```` is relative to the installation prefix, which is +stored in the variable :variable:`CMAKE_INSTALL_PREFIX`. diff --git a/Help/command/install_targets.rst b/Help/command/install_targets.rst index caa933f4b..49ca69694 100644 --- a/Help/command/install_targets.rst +++ b/Help/command/install_targets.rst @@ -1,9 +1,9 @@ install_targets --------------- -Deprecated. Use the install(TARGETS ) command instead. +Deprecated. Use the :command:`install(TARGETS)` command instead. -This command has been superceded by the install command. It is +This command has been superceded by the :command:`install` command. It is provided for compatibility with older CMake code. :: @@ -11,7 +11,7 @@ provided for compatibility with older CMake code. install_targets( [RUNTIME_DIRECTORY dir] target target) Create rules to install the listed targets into the given directory. -The directory is relative to the installation prefix, which is -stored in the variable CMAKE_INSTALL_PREFIX. If RUNTIME_DIRECTORY is -specified, then on systems with special runtime files (Windows DLL), -the files will be copied to that directory. +The directory ```` is relative to the installation prefix, which is +stored in the variable :variable:`CMAKE_INSTALL_PREFIX`. If +``RUNTIME_DIRECTORY`` is specified, then on systems with special runtime +files (Windows DLL), the files will be copied to that directory. diff --git a/Help/command/link_directories.rst b/Help/command/link_directories.rst index bdc94cd73..5c64bc609 100644 --- a/Help/command/link_directories.rst +++ b/Help/command/link_directories.rst @@ -10,10 +10,10 @@ Specify directories in which the linker will look for libraries. Specify the paths in which the linker should search for libraries. The command will apply only to targets created after it is called. Relative paths given to this command are interpreted as relative to -the current source directory, see CMP0015. +the current source directory, see :policy:`CMP0015`. Note that this command is rarely necessary. Library locations -returned by find_package() and find_library() are absolute paths. -Pass these absolute library file paths directly to the -target_link_libraries() command. CMake will ensure the linker finds +returned by :command:`find_package` and :command:`find_library` are +absolute paths. Pass these absolute library file paths directly to the +:command:`target_link_libraries` command. CMake will ensure the linker finds them. diff --git a/Help/command/list.rst b/Help/command/list.rst index aeb1e940a..a7a05c7af 100644 --- a/Help/command/list.rst +++ b/Help/command/list.rst @@ -17,45 +17,45 @@ List operations. list(REVERSE ) list(SORT ) -LENGTH will return a given list's length. +``LENGTH`` will return a given list's length. -GET will return list of elements specified by indices from the list. +``GET`` will return list of elements specified by indices from the list. -APPEND will append elements to the list. +``APPEND`` will append elements to the list. -FIND will return the index of the element specified in the list or -1 +``FIND`` will return the index of the element specified in the list or -1 if it wasn't found. -INSERT will insert elements to the list to the specified location. +``INSERT`` will insert elements to the list to the specified location. -REMOVE_AT and REMOVE_ITEM will remove items from the list. The -difference is that REMOVE_ITEM will remove the given items, while -REMOVE_AT will remove the items at the given indices. +``REMOVE_AT`` and ``REMOVE_ITEM`` will remove items from the list. The +difference is that ``REMOVE_ITEM`` will remove the given items, while +``REMOVE_AT`` will remove the items at the given indices. -REMOVE_DUPLICATES will remove duplicated items in the list. +``REMOVE_DUPLICATES`` will remove duplicated items in the list. -REVERSE reverses the contents of the list in-place. +``REVERSE`` reverses the contents of the list in-place. -SORT sorts the list in-place alphabetically. +``SORT`` sorts the list in-place alphabetically. -The list subcommands APPEND, INSERT, REMOVE_AT, REMOVE_ITEM, -REMOVE_DUPLICATES, REVERSE and SORT may create new values for the list -within the current CMake variable scope. Similar to the SET command, -the LIST command creates new variable values in the current scope, -even if the list itself is actually defined in a parent scope. To -propagate the results of these operations upwards, use SET with -PARENT_SCOPE, SET with CACHE INTERNAL, or some other means of value -propagation. +The list subcommands ``APPEND``, ``INSERT``, ``REMOVE_AT``, ``REMOVE_ITEM``, +``REMOVE_DUPLICATES``, ``REVERSE`` and ``SORT`` may create new values for +the list within the current CMake variable scope. Similar to the +:command:`set` command, the LIST command creates new variable values in the +current scope, even if the list itself is actually defined in a parent +scope. To propagate the results of these operations upwards, use +:command:`set` with ``PARENT_SCOPE``, :command:`set` with +``CACHE INTERNAL``, or some other means of value propagation. -NOTES: A list in cmake is a ; separated group of strings. To create a -list the set command can be used. For example, set(var a b c d e) -creates a list with a;b;c;d;e, and set(var "a b c d e") creates a +NOTES: A list in cmake is a ``;`` separated group of strings. To create a +list the set command can be used. For example, ``set(var a b c d e)`` +creates a list with ``a;b;c;d;e``, and ``set(var "a b c d e")`` creates a string or a list with one item in it. (Note macro arguments are not variables, and therefore cannot be used in LIST commands.) -When specifying index values, if is 0 or greater, it +When specifying index values, if ```` is 0 or greater, it is indexed from the beginning of the list, with 0 representing the -first list element. If is -1 or lesser, it is indexed +first list element. If ```` is -1 or lesser, it is indexed from the end of the list, with -1 representing the last list element. Be careful when counting with negative indices: they do not start from 0. -0 is equivalent to 0, the first list element. diff --git a/Help/command/load_cache.rst b/Help/command/load_cache.rst index b7484cb6d..f1134472d 100644 --- a/Help/command/load_cache.rst +++ b/Help/command/load_cache.rst @@ -19,9 +19,9 @@ does not create entries in the local project's cache. Load in the values from another cache and store them in the local project's cache as internal entries. This is useful for a project -that depends on another project built in a different tree. EXCLUDE +that depends on another project built in a different tree. ``EXCLUDE`` option can be used to provide a list of entries to be excluded. -INCLUDE_INTERNALS can be used to provide a list of internal entries to +``INCLUDE_INTERNALS`` can be used to provide a list of internal entries to be included. Normally, no internal entries are brought in. Use of this form of the command is strongly discouraged, but it is provided for backward compatibility. diff --git a/Help/command/load_command.rst b/Help/command/load_command.rst index fc316d4d1..a1576e8b5 100644 --- a/Help/command/load_command.rst +++ b/Help/command/load_command.rst @@ -11,9 +11,9 @@ Load a command into a running CMake. The given locations are searched for a library whose name is cmCOMMAND_NAME. If found, it is loaded as a module and the command is -added to the set of available CMake commands. Usually, TRY_COMPILE is -used before this command to compile the module. If the command is -successfully loaded a variable named +added to the set of available CMake commands. Usually, +:command:`try_compile` is used before this command to compile the +module. If the command is successfully loaded a variable named :: diff --git a/Help/command/make_directory.rst b/Help/command/make_directory.rst index 44dbe970f..27ecf5194 100644 --- a/Help/command/make_directory.rst +++ b/Help/command/make_directory.rst @@ -1,7 +1,7 @@ make_directory -------------- -Deprecated. Use the file(MAKE_DIRECTORY ) command instead. +Deprecated. Use the :command:`file(MAKE_DIRECTORY)` command instead. :: diff --git a/Help/command/mark_as_advanced.rst b/Help/command/mark_as_advanced.rst index 30b1289f7..c3f94fc48 100644 --- a/Help/command/mark_as_advanced.rst +++ b/Help/command/mark_as_advanced.rst @@ -9,10 +9,10 @@ Mark cmake cached variables as advanced. Mark the named cached variables as advanced. An advanced variable will not be displayed in any of the cmake GUIs unless the show -advanced option is on. If CLEAR is the first argument advanced -variables are changed back to unadvanced. If FORCE is the first -argument, then the variable is made advanced. If neither FORCE nor -CLEAR is specified, new values will be marked as advanced, but if the +advanced option is on. If ``CLEAR`` is the first argument advanced +variables are changed back to unadvanced. If ``FORCE`` is the first +argument, then the variable is made advanced. If neither ``FORCE`` nor +``CLEAR`` is specified, new values will be marked as advanced, but if the variable already has an advanced/non-advanced state, it will not be changed. diff --git a/Help/command/math.rst b/Help/command/math.rst index 38fde1d9d..d4deb16e4 100644 --- a/Help/command/math.rst +++ b/Help/command/math.rst @@ -7,7 +7,7 @@ Mathematical expressions. math(EXPR ) -EXPR evaluates mathematical expression and returns result in the +``EXPR`` evaluates mathematical expression and returns result in the output variable. Example mathematical expression is '5 * ( 10 + 13 )'. Supported operators are + - * / % | & ^ ~ << >> * / %. They have the same meaning as they do in C code. diff --git a/Help/command/message.rst b/Help/command/message.rst index a20325a23..04c62fdff 100644 --- a/Help/command/message.rst +++ b/Help/command/message.rst @@ -7,7 +7,7 @@ Display a message to the user. message([] "message to display" ...) -The optional keyword determines the type of message: +The optional ```` keyword determines the type of message: :: diff --git a/Help/command/option.rst b/Help/command/option.rst index 244ed07ba..91cd0a778 100644 --- a/Help/command/option.rst +++ b/Help/command/option.rst @@ -8,8 +8,8 @@ Provides an option that the user can optionally select. option( "help string describing option" [initial value]) -Provide an option for the user to select as ON or OFF. If no initial -value is provided, OFF is used. +Provide an option for the user to select as ``ON`` or ``OFF``. If no +initial value is provided, ``OFF`` is used. If you have options that depend on the values of other options, see -the module help for CMakeDependentOption. +the module help for :module:`CMakeDependentOption`. diff --git a/Help/command/qt_wrap_cpp.rst b/Help/command/qt_wrap_cpp.rst index 81bbc0647..3843bf5e9 100644 --- a/Help/command/qt_wrap_cpp.rst +++ b/Help/command/qt_wrap_cpp.rst @@ -9,4 +9,4 @@ Create Qt Wrappers. SourceLists ...) Produce moc files for all the .h files listed in the SourceLists. The -moc files will be added to the library using the DestName source list. +moc files will be added to the library using the ``DestName`` source list. diff --git a/Help/command/qt_wrap_ui.rst b/Help/command/qt_wrap_ui.rst index 4e033a8b9..f731ed9a8 100644 --- a/Help/command/qt_wrap_ui.rst +++ b/Help/command/qt_wrap_ui.rst @@ -9,6 +9,6 @@ Create Qt user interfaces Wrappers. SourcesDestName SourceLists ...) Produce .h and .cxx files for all the .ui files listed in the -SourceLists. The .h files will be added to the library using the -HeadersDestNamesource list. The .cxx files will be added to the -library using the SourcesDestNamesource list. +``SourceLists``. The .h files will be added to the library using the +``HeadersDestNamesource`` list. The .cxx files will be added to the +library using the ``SourcesDestNamesource`` list. diff --git a/Help/command/remove.rst b/Help/command/remove.rst index ddf0e9a2d..462827796 100644 --- a/Help/command/remove.rst +++ b/Help/command/remove.rst @@ -1,12 +1,12 @@ remove ------ -Deprecated. Use the list(REMOVE_ITEM ) command instead. +Deprecated. Use the :command:`list(REMOVE_ITEM)` command instead. :: remove(VAR VALUE VALUE ...) -Removes VALUE from the variable VAR. This is typically used to remove -entries from a vector (e.g. semicolon separated list). VALUE is -expanded. +Removes ``VALUE`` from the variable ``VAR``. This is typically used to +remove entries from a vector (e.g. semicolon separated list). ``VALUE`` +is expanded. diff --git a/Help/command/remove_definitions.rst b/Help/command/remove_definitions.rst index 566da6e6b..ea189181c 100644 --- a/Help/command/remove_definitions.rst +++ b/Help/command/remove_definitions.rst @@ -1,11 +1,11 @@ remove_definitions ------------------ -Removes -D define flags added by add_definitions. +Removes -D define flags added by :command:`add_definitions`. :: remove_definitions(-DFOO -DBAR ...) -Removes flags (added by add_definitions) from the compiler command -line for sources in the current directory and below. +Removes flags (added by :command:`add_definitions`) from the compiler +command line for sources in the current directory and below. diff --git a/Help/command/return.rst b/Help/command/return.rst index 899470c69..e49fb3c8d 100644 --- a/Help/command/return.rst +++ b/Help/command/return.rst @@ -8,11 +8,11 @@ Return from a file, directory or function. return() Returns from a file, directory or function. When this command is -encountered in an included file (via include() or find_package()), it -causes processing of the current file to stop and control is returned -to the including file. If it is encountered in a file which is not -included by another file, e.g. a CMakeLists.txt, control is returned -to the parent directory if there is one. If return is called in a -function, control is returned to the caller of the function. Note -that a macro is not a function and does not handle return like a +encountered in an included file (via :command:`include` or +:command:`find_package`), it causes processing of the current file to stop +and control is returned to the including file. If it is encountered in a +file which is not included by another file, e.g. a ``CMakeLists.txt``, +control is returned to the parent directory if there is one. If return is +called in a function, control is returned to the caller of the function. +Note that a macro is not a function and does not handle return like a function does. diff --git a/Help/command/separate_arguments.rst b/Help/command/separate_arguments.rst index a876595ee..0e3e5a5f2 100644 --- a/Help/command/separate_arguments.rst +++ b/Help/command/separate_arguments.rst @@ -8,15 +8,15 @@ Parse space-separated arguments into a semicolon-separated list. separate_arguments( _COMMAND "") Parses a unix- or windows-style command-line string "" and -stores a semicolon-separated list of the arguments in . The +stores a semicolon-separated list of the arguments in ````. The entire command line must be given in one "" argument. -The UNIX_COMMAND mode separates arguments by unquoted whitespace. It +The ``UNIX_COMMAND`` mode separates arguments by unquoted whitespace. It recognizes both single-quote and double-quote pairs. A backslash escapes the next literal character (\" is "); there are no special escapes (\n is just n). -The WINDOWS_COMMAND mode parses a windows command-line using the same +The ``WINDOWS_COMMAND`` mode parses a windows command-line using the same syntax the runtime library uses to construct argv at startup. It separates arguments by whitespace that is not double-quoted. Backslashes are literal unless they precede double-quotes. See the @@ -26,6 +26,6 @@ MSDN article "Parsing C Command-Line Arguments" for details. separate_arguments(VARIABLE) -Convert the value of VARIABLE to a semi-colon separated list. All +Convert the value of ``VARIABLE`` to a semi-colon separated list. All spaces are replaced with ';'. This helps with generating command lines. diff --git a/Help/command/set_property.rst b/Help/command/set_property.rst index 62002309c..5ed788e4a 100644 --- a/Help/command/set_property.rst +++ b/Help/command/set_property.rst @@ -64,3 +64,6 @@ property value in the form of a semicolon-separated list. If the 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 and not a list of strings. + +See the :manual:`cmake-properties(7)` manual for a list of properties +in each scope. diff --git a/Help/command/set_target_properties.rst b/Help/command/set_target_properties.rst index f65ee2494..b894eace3 100644 --- a/Help/command/set_target_properties.rst +++ b/Help/command/set_target_properties.rst @@ -12,93 +12,7 @@ Targets can have properties that affect how they are built. Set properties on a target. The syntax for the command is to list all the files you want to change, and then provide the values you want to set next. You can use any prop value pair you want and extract it -later with the GET_TARGET_PROPERTY command. +later with the :command:`get_property` or :command:`get_target_property` +command. -Properties that affect the name of a target's output file are as -follows. The PREFIX and SUFFIX properties override the default target -name prefix (such as "lib") and suffix (such as ".so"). IMPORT_PREFIX -and IMPORT_SUFFIX are the equivalent properties for the import library -corresponding to a DLL (for SHARED library targets). OUTPUT_NAME sets -the real name of a target when it is built and can be used to help -create two targets of the same name even though CMake requires unique -logical target names. There is also a _OUTPUT_NAME that can -set the output name on a per-configuration basis. _POSTFIX -sets a postfix for the real name of the target when it is built under -the configuration named by (in upper-case, such as -"DEBUG_POSTFIX"). The value of this property is initialized when the -target is created to the value of the variable CMAKE__POSTFIX -(except for executable targets because earlier CMake versions which -did not use this variable for executables). - -The LINK_FLAGS property can be used to add extra flags to the link -step of a target. LINK_FLAGS_ will add to the configuration -, for example, DEBUG, RELEASE, MINSIZEREL, RELWITHDEBINFO. -DEFINE_SYMBOL sets the name of the preprocessor symbol defined when -compiling sources in a shared library. If not set here then it is set -to target_EXPORTS by default (with some substitutions if the target is -not a valid C identifier). This is useful for headers to know whether -they are being included from inside their library or outside to -properly setup dllexport/dllimport decorations. The COMPILE_FLAGS -property sets additional compiler flags used to build sources within -the target. It may also be used to pass additional preprocessor -definitions. - -The LINKER_LANGUAGE property is used to change the tool used to link -an executable or shared library. The default is set the language to -match the files in the library. CXX and C are common values for this -property. - -For shared libraries VERSION and SOVERSION can be used to specify the -build version and API version respectively. When building or -installing appropriate symlinks are created if the platform supports -symlinks and the linker supports so-names. If only one of both is -specified the missing is assumed to have the same version number. For -executables VERSION can be used to specify the build version. When -building or installing appropriate symlinks are created if the -platform supports symlinks. For shared libraries and executables on -Windows the VERSION attribute is parsed to extract a "major.minor" -version number. These numbers are used as the image version of the -binary. - -There are a few properties used to specify RPATH rules. INSTALL_RPATH -is a semicolon-separated list specifying the rpath to use in installed -targets (for platforms that support it). INSTALL_RPATH_USE_LINK_PATH -is a boolean that if set to true will append directories in the linker -search path and outside the project to the INSTALL_RPATH. -SKIP_BUILD_RPATH is a boolean specifying whether to skip automatic -generation of an rpath allowing the target to run from the build tree. -BUILD_WITH_INSTALL_RPATH is a boolean specifying whether to link the -target in the build tree with the INSTALL_RPATH. This takes -precedence over SKIP_BUILD_RPATH and avoids the need for relinking -before installation. INSTALL_NAME_DIR is a string specifying the -directory portion of the "install_name" field of shared libraries on -Mac OSX to use in the installed targets. When the target is created -the values of the variables CMAKE_INSTALL_RPATH, -CMAKE_INSTALL_RPATH_USE_LINK_PATH, CMAKE_SKIP_BUILD_RPATH, -CMAKE_BUILD_WITH_INSTALL_RPATH, and CMAKE_INSTALL_NAME_DIR are used to -initialize these properties. - -PROJECT_LABEL can be used to change the name of the target in an IDE -like visual studio. VS_KEYWORD can be set to change the visual studio -keyword, for example Qt integration works better if this is set to -Qt4VSv1.0. - -VS_SCC_PROJECTNAME, VS_SCC_LOCALPATH, VS_SCC_PROVIDER and -VS_SCC_AUXPATH can be set to add support for source control bindings -in a Visual Studio project file. - -VS_GLOBAL_ can be set to add a Visual Studio -project-specific global variable. Qt integration works better if -VS_GLOBAL_QtVersion is set to the Qt version FindQt4.cmake found. For -example, "4.7.3" - -The PRE_INSTALL_SCRIPT and POST_INSTALL_SCRIPT properties are the old -way to specify CMake scripts to run before and after installing a -target. They are used only when the old INSTALL_TARGETS command is -used to install the target. Use the INSTALL command instead. - -The EXCLUDE_FROM_DEFAULT_BUILD property is used by the visual studio -generators. If it is set to 1 the target will not be part of the -default build when you select "Build Solution". This can also be set -on a per-configuration basis using -EXCLUDE_FROM_DEFAULT_BUILD_. +See :ref:`Target Properties` for the list of properties known to CMake. diff --git a/Help/command/string.rst b/Help/command/string.rst index 351385bf1..0361c74db 100644 --- a/Help/command/string.rst +++ b/Help/command/string.rst @@ -1,99 +1,84 @@ string ------ +.. only:: html + + .. contents:: + String operations. +Search and Replace +^^^^^^^^^^^^^^^^^^ + +FIND +"""" + +:: + + string(FIND [REVERSE]) + +Return the position where the given substring was found in +the supplied string. If the ``REVERSE`` flag was used, the command will +search for the position of the last occurrence of the specified +substring. If the substring is not found, a position of -1 is returned. + +REPLACE +""""""" + :: - string(REGEX MATCH - [...]) - string(REGEX MATCHALL - [...]) - string(REGEX REPLACE - - [...]) string(REPLACE [...]) - string(CONCAT [...]) - string( - ) - string(COMPARE EQUAL ) - string(COMPARE NOTEQUAL ) - string(COMPARE LESS ) - string(COMPARE GREATER ) - string(ASCII [ ...] ) - string(CONFIGURE - [@ONLY] [ESCAPE_QUOTES]) - string(TOUPPER ) - string(TOLOWER ) - string(LENGTH ) - string(SUBSTRING ) - string(STRIP ) - string(RANDOM [LENGTH ] [ALPHABET ] - [RANDOM_SEED ] ) - string(FIND [REVERSE]) - string(TIMESTAMP [] [UTC]) - string(MAKE_C_IDENTIFIER ) - string(GENEX_STRIP ) - string(UUID NAMESPACE NAME - TYPE [UPPER]) -REGEX MATCH will match the regular expression once and store the match -in the output variable. +Replace all occurrences of ``match_string`` in the input +with ``replace_string`` and store the result in the output. -REGEX MATCHALL will match the regular expression as many times as -possible and store the matches in the output variable as a list. +Regular Expressions +^^^^^^^^^^^^^^^^^^^ -REGEX REPLACE will match the regular expression as many times as -possible and substitute the replacement expression for the match in -the output. The replace expression may refer to paren-delimited -subexpressions of the match using \1, \2, ..., \9. Note that two -backslashes (\\1) are required in CMake code to get a backslash -through argument parsing. +REGEX MATCH +""""""""""" -REPLACE will replace all occurrences of match_string in the input with -replace_string and store the result in the output. +:: -CONCAT will concatenate all the input arguments together and store -the result in the named output variable. + string(REGEX MATCH + [...]) -MD5, SHA1, SHA224, SHA256, SHA384, and SHA512 will compute a -cryptographic hash of the input string. +Match the regular expression once and store the match in the output variable. +All ```` arguments are concatenated before matching. -COMPARE EQUAL/NOTEQUAL/LESS/GREATER will compare the strings and store -true or false in the output variable. +REGEX MATCHALL +"""""""""""""" -ASCII will convert all numbers into corresponding ASCII characters. +:: -CONFIGURE will transform a string like CONFIGURE_FILE transforms a -file. + string(REGEX MATCHALL + [...]) -TOUPPER/TOLOWER will convert string to upper/lower characters. +Match the regular expression as many times as possible and store the matches +in the output variable as a list. +All ```` arguments are concatenated before matching. -LENGTH will return a given string's length. +REGEX REPLACE +""""""""""""" -SUBSTRING will return a substring of a given string. If length is -1 -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. + string(REGEX REPLACE + + [...]) -STRIP will return a substring of a given string with leading and -trailing spaces removed. +Match the regular expression as many times as possible and substitute the +replacement expression for the match in the output. +All ```` arguments are concatenated before matching. -RANDOM will return a random string of given length consisting of -characters from the given alphabet. Default length is 5 characters -and default alphabet is all numbers and upper and lower case letters. -If an integer RANDOM_SEED is given, its value will be used to seed the -random number generator. +The replace expression may refer to paren-delimited subexpressions of the +match using ``\1``, ``\2``, ..., ``\9``. Note that two backslashes (``\\1``) +are required in CMake code to get a backslash through argument parsing. -FIND will return the position where the given substring was found in -the supplied string. If the REVERSE flag was used, the command will -search for the position of the last occurrence of the specified -substring. +Regex Specification +""""""""""""""""""" The following characters have special meaning in regular expressions: @@ -118,21 +103,170 @@ The following characters have special meaning in regular expressions: by all regular expression-related commands, including e.g. if( MATCHES ), in the variables CMAKE_MATCH_(0..9). -``*``, ``+`` and ``?`` have higher precedence than concatenation. | has lower -precedence than concatenation. This means that the regular expression -"^ab+d$" matches "abbd" but not "ababd", and the regular expression -"^(ab|cd)$" matches "ab" but not "abd". +``*``, ``+`` and ``?`` have higher precedence than concatenation. ``|`` +has lower precedence than concatenation. This means that the regular +expression ``^ab+d$`` matches ``abbd`` but not ``ababd``, and the regular +expression ``^(ab|cd)$`` matches ``ab`` but not ``abd``. + +Manipulation +^^^^^^^^^^^^ + +APPEND +"""""" + +:: + + string(APPEND [...]) + +Append all the input arguments to the string. + +CONCAT +"""""" + +:: + + string(CONCAT [...]) + +Concatenate all the input arguments together and store +the result in the named output variable. + +TOLOWER +""""""" + +:: + + string(TOLOWER ) + +Convert string to lower characters. + +TOUPPER +""""""" + +:: + + string(TOUPPER ) + +Convert string to upper characters. -TIMESTAMP will write a string representation of the current date +LENGTH +"""""" + +:: + + string(LENGTH ) + +Store in an output variable a given string's length. + +SUBSTRING +""""""""" + +:: + + string(SUBSTRING ) + +Store in an output variable a substring of a given string. If length is +``-1`` 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 +""""" + +:: + + string(STRIP ) + +Store in an output variable a substring of a given string with leading and +trailing spaces removed. + +GENEX_STRIP +""""""""""" + +:: + + string(GENEX_STRIP ) + +Strip any :manual:`generator expressions ` +from the ``input string`` and store the result in the ``output variable``. + +Comparison +^^^^^^^^^^ + +:: + + string(COMPARE EQUAL ) + string(COMPARE NOTEQUAL ) + string(COMPARE LESS ) + string(COMPARE GREATER ) + +Compare the strings and store true or false in the output variable. + +Hashing +^^^^^^^ + +:: + + string( + ) + +Compute a cryptographic hash of the input string. + +Generation +^^^^^^^^^^ + +ASCII +""""" + +:: + + string(ASCII [ ...] ) + +Convert all numbers into corresponding ASCII characters. + +CONFIGURE +""""""""" + +:: + + string(CONFIGURE + [@ONLY] [ESCAPE_QUOTES]) + +Transform a string like :command:`configure_file` transforms a file. + +RANDOM +"""""" + +:: + + string(RANDOM [LENGTH ] [ALPHABET ] + [RANDOM_SEED ] ) + +Return a random string of given length consisting of +characters from the given alphabet. Default length is 5 characters +and default alphabet is all numbers and upper and lower case letters. +If an integer ``RANDOM_SEED`` is given, its value will be used to seed the +random number generator. + +TIMESTAMP +""""""""" + +:: + + string(TIMESTAMP [] [UTC]) + +Write a string representation of the current date and/or time to the output variable. Should the command be unable to obtain a timestamp the output variable will be set to the empty string "". -The optional UTC flag requests the current date/time representation to +The optional ``UTC`` flag requests the current date/time representation to be in Coordinated Universal Time (UTC) rather than local time. -The optional may contain the following format +The optional ```` may contain the following format specifiers: :: @@ -153,23 +287,31 @@ specifiers: Unknown format specifiers will be ignored and copied to the output as-is. -If no explicit is given it will default to: +If no explicit ```` is given it will default to: :: %Y-%m-%dT%H:%M:%S for local time. %Y-%m-%dT%H:%M:%SZ for UTC. -MAKE_C_IDENTIFIER will write a string which can be used as an -identifier in C. -``GENEX_STRIP`` will strip any -:manual:`generator expressions ` from the -``input string`` and store the result in the ``output variable``. +:: + + string(MAKE_C_IDENTIFIER ) + +Write a string which can be used as an identifier in C. + +UUID +"""" + +:: + + string(UUID NAMESPACE NAME + TYPE [UPPER]) -UUID creates a univerally unique identifier (aka GUID) as per RFC4122 -based on the hash of the combined values of -(which itself has to be a valid UUID) and . +Create a univerally unique identifier (aka GUID) as per RFC4122 +based on the hash of the combined values of ```` +(which itself has to be a valid UUID) and ````. 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`` diff --git a/Help/command/subdirs.rst b/Help/command/subdirs.rst index dee49f8e0..43b87d4d7 100644 --- a/Help/command/subdirs.rst +++ b/Help/command/subdirs.rst @@ -1,7 +1,7 @@ subdirs ------- -Deprecated. Use the add_subdirectory() command instead. +Deprecated. Use the :command:`add_subdirectory` command instead. Add a list of subdirectories to the build. @@ -10,12 +10,12 @@ Add a list of subdirectories to the build. subdirs(dir1 dir2 ...[EXCLUDE_FROM_ALL exclude_dir1 exclude_dir2 ...] [PREORDER] ) -Add a list of subdirectories to the build. The add_subdirectory -command should be used instead of subdirs although subdirs will still +Add a list of subdirectories to the build. The :command:`add_subdirectory` +command should be used instead of ``subdirs`` although ``subdirs`` will still work. This will cause any CMakeLists.txt files in the sub directories -to be processed by CMake. Any directories after the PREORDER flag are -traversed first by makefile builds, the PREORDER flag has no effect on -IDE projects. Any directories after the EXCLUDE_FROM_ALL marker will +to be processed by CMake. Any directories after the ``PREORDER`` flag are +traversed first by makefile builds, the ``PREORDER`` flag has no effect on +IDE projects. Any directories after the ``EXCLUDE_FROM_ALL`` marker will not be included in the top level makefile or project file. This is useful for having CMake create makefiles or projects for a set of examples in a project. You would want CMake to generate makefiles or diff --git a/Help/command/try_compile.rst b/Help/command/try_compile.rst index 9a7088520..28dae8074 100644 --- a/Help/command/try_compile.rst +++ b/Help/command/try_compile.rst @@ -96,5 +96,19 @@ the try_compile call of interest, and then re-run cmake again with Other Behavior Settings ^^^^^^^^^^^^^^^^^^^^^^^ +If set, the following variables are passed in to the generated +try_compile CMakeLists.txt to initialize compile target properties with +default values: + +* :variable:`CMAKE_ENABLE_EXPORTS` +* :variable:`CMAKE_LINK_SEARCH_START_STATIC` +* :variable:`CMAKE_LINK_SEARCH_END_STATIC` +* :variable:`CMAKE_POSITION_INDEPENDENT_CODE` + +If :policy:`CMP0056` is set to ``NEW``, then +:variable:`CMAKE_EXE_LINKER_FLAGS` is passed in as well. + +The current setting of :policy:`CMP0065` is set in the generated project. + Set the :variable:`CMAKE_TRY_COMPILE_CONFIGURATION` variable to choose a build configuration. diff --git a/Help/command/unset.rst b/Help/command/unset.rst index d8f0dcdb2..a1fc95cc6 100644 --- a/Help/command/unset.rst +++ b/Help/command/unset.rst @@ -8,14 +8,14 @@ Unset a variable, cache variable, or environment variable. unset( [CACHE | PARENT_SCOPE]) Removes the specified variable causing it to become undefined. If -CACHE is present then the variable is removed from the cache instead +``CACHE`` is present then the variable is removed from the cache instead of the current scope. -If PARENT_SCOPE is present then the variable is removed from the scope -above the current scope. See the same option in the set() command for -further details. +If ``PARENT_SCOPE`` is present then the variable is removed from the scope +above the current scope. See the same option in the :command:`set` command +for further details. - can be an environment variable such as: +```` can be an environment variable such as: :: diff --git a/Help/command/utility_source.rst b/Help/command/utility_source.rst index 5122e520a..ee34492c3 100644 --- a/Help/command/utility_source.rst +++ b/Help/command/utility_source.rst @@ -12,11 +12,11 @@ Specify the source tree of a third-party utility. When a third-party utility's source is included in the distribution, this command specifies its location and name. The cache entry will -not be set unless the path_to_source and all listed files exist. It +not be set unless the ``path_to_source`` and all listed files exist. It is assumed that the source tree of the utility will have been built before it is needed. -When cross compiling CMake will print a warning if a utility_source() +When cross compiling CMake will print a warning if a ``utility_source()`` command is executed, because in many cases it is used to build an executable which is executed later on. This doesn't work when cross compiling, since the executable can run only on their target platform. diff --git a/Help/command/variable_requires.rst b/Help/command/variable_requires.rst index 831dd0023..9cf9f3ffd 100644 --- a/Help/command/variable_requires.rst +++ b/Help/command/variable_requires.rst @@ -3,7 +3,7 @@ variable_requires Disallowed. See CMake Policy :policy:`CMP0035`. -Use the if() command instead. +Use the :command:`if` command instead. Assert satisfaction of an option's required variables. @@ -13,10 +13,10 @@ Assert satisfaction of an option's required variables. REQUIRED_VARIABLE1 REQUIRED_VARIABLE2 ...) -The first argument (TEST_VARIABLE) is the name of the variable to be +The first argument (``TEST_VARIABLE``) is the name of the variable to be tested, if that variable is false nothing else is done. If -TEST_VARIABLE is true, then the next argument (RESULT_VARIABLE) is a -variable that is set to true if all the required variables are set. +``TEST_VARIABLE`` is true, then the next argument (``RESULT_VARIABLE``) +is a variable that is set to true if all the required variables are set. The rest of the arguments are variables that must be true or not set to NOTFOUND to avoid an error. If any are not true, an error is reported. diff --git a/Help/command/while.rst b/Help/command/while.rst index 72c055de1..7509da309 100644 --- a/Help/command/while.rst +++ b/Help/command/while.rst @@ -11,7 +11,7 @@ Evaluate a group of commands while a condition is true ... endwhile(condition) -All commands between while and the matching endwhile are recorded -without being invoked. Once the endwhile is evaluated, the recorded -list of commands is invoked as long as the condition is true. The -condition is evaluated using the same logic as the if command. +All commands between while and the matching :command:`endwhile` are recorded +without being invoked. Once the :command:`endwhile` is evaluated, the +recorded list of commands is invoked as long as the condition is true. The +condition is evaluated using the same logic as the :command:`if` command. diff --git a/Help/command/write_file.rst b/Help/command/write_file.rst index 015514bb3..40e755763 100644 --- a/Help/command/write_file.rst +++ b/Help/command/write_file.rst @@ -1,20 +1,20 @@ write_file ---------- -Deprecated. Use the file(WRITE ) command instead. +Deprecated. Use the :command:`file(WRITE)` command instead. :: write_file(filename "message to write"... [APPEND]) The first argument is the file name, the rest of the arguments are -messages to write. If the argument APPEND is specified, then the +messages to write. If the argument ``APPEND`` is specified, then the message will be appended. -NOTE 1: file(WRITE ... and file(APPEND ... do exactly the same as -this one but add some more functionality. +NOTE 1: :command:`file(WRITE)` and :command:`file(APPEND)` do exactly +the same as this one but add some more functionality. -NOTE 2: When using write_file the produced file cannot be used as an +NOTE 2: When using ``write_file`` the produced file cannot be used as an input to CMake (CONFIGURE_FILE, source file ...) because it will lead -to an infinite loop. Use configure_file if you want to generate input -files to CMake. +to an infinite loop. Use :command:`configure_file` if you want to +generate input files to CMake. diff --git a/Help/manual/LINKS.txt b/Help/manual/LINKS.txt index 38fd1516f..3993ff83d 100644 --- a/Help/manual/LINKS.txt +++ b/Help/manual/LINKS.txt @@ -1,25 +1,25 @@ The following resources are available to get help using CMake: Home Page - http://www.cmake.org + https://cmake.org The primary starting point for learning about CMake. Frequently Asked Questions - http://www.cmake.org/Wiki/CMake_FAQ + https://cmake.org/Wiki/CMake_FAQ A Wiki is provided containing answers to frequently asked questions. Online Documentation - http://www.cmake.org/documentation + https://cmake.org/documentation Links to available documentation may be found on this web page. Mailing List - http://www.cmake.org/mailing-lists + https://cmake.org/mailing-lists For help and discussion about using cmake, a mailing list is provided at cmake@cmake.org. The list is member-post-only but one may sign up on the CMake web page. Please first read the full - documentation at http://www.cmake.org before posting questions to + documentation at https://cmake.org before posting questions to the list. diff --git a/Help/manual/cmake-buildsystem.7.rst b/Help/manual/cmake-buildsystem.7.rst index aefdb7144..bc633e6ec 100644 --- a/Help/manual/cmake-buildsystem.7.rst +++ b/Help/manual/cmake-buildsystem.7.rst @@ -80,11 +80,31 @@ regardless of the library type. The ``MODULE`` library type is dissimilar in that it is generally not linked to -- it is not used in the right-hand-side of the :command:`target_link_libraries` command. It is a type which is loaded as a plugin using runtime techniques. +If the library does not export any unmanaged symbols (e.g. Windows +resource DLL, C++/CLI DLL), it is required that the library not be a +``SHARED`` library because CMake expects ``SHARED`` libraries to export +at least one symbol. .. code-block:: cmake add_library(archive MODULE 7z.cpp) +.. _`Apple Frameworks`: + +Apple Frameworks +"""""""""""""""" + +A ``SHARED`` library may be marked with the :prop_tgt:`FRAMEWORK` +target property to create an OS X Framework: + +.. code-block:: cmake + + add_library(MyFramework SHARED MyFramework.cpp) + set_target_properties(MyFramework PROPERTIES + FRAMEWORK 1 + FRAMEWORK_VERSION A + ) + .. _`Object Libraries`: Object Libraries @@ -765,7 +785,8 @@ An *archive* output artifact of a buildsystem target may be: * On DLL platforms: the import library file (e.g. ``.lib``) of a shared library target created by the :command:`add_library` command - with the ``SHARED`` option. + with the ``SHARED`` option. This file is only guaranteed to exist if + the library exports at least one unmanaged symbol. * On DLL platforms: the import library file (e.g. ``.lib``) of an executable target created by the :command:`add_executable` command diff --git a/Help/manual/cmake-commands.7.rst b/Help/manual/cmake-commands.7.rst index c916f7736..5b92b5156 100644 --- a/Help/manual/cmake-commands.7.rst +++ b/Help/manual/cmake-commands.7.rst @@ -71,7 +71,6 @@ These commands may be used freely in CMake projects. /command/link_libraries /command/list /command/load_cache - /command/load_command /command/macro /command/mark_as_advanced /command/math @@ -119,6 +118,7 @@ versions of CMake. Do not use them in new code. /command/install_files /command/install_programs /command/install_targets + /command/load_command /command/make_directory /command/output_required_files /command/remove diff --git a/Help/manual/cmake-developer.7.rst b/Help/manual/cmake-developer.7.rst index 90a081df8..a33538404 100644 --- a/Help/manual/cmake-developer.7.rst +++ b/Help/manual/cmake-developer.7.rst @@ -52,9 +52,9 @@ When adding the first supported feature to a particular CompilerId, it is necessary to list support for all features known to cmake (See :variable:`CMAKE_C_COMPILE_FEATURES` and :variable:`CMAKE_CXX_COMPILE_FEATURES` as appropriate), where available for -the compiler. Furthermore, set ``CMAKE__STANDARD_DEFAULT`` to the -default language standard level the compiler uses, or to the empty string -if the compiler has no notion of standard levels (such as ``MSVC``). +the compiler. Ensure that the ``CMAKE__STANDARD_DEFAULT`` is set to +the computed internal variable ``CMAKE__STANDARD_COMPUTED_DEFAULT`` +for compiler versions which should be supported. It is sensible to record the features for the most recent version of a particular CompilerId first, and then work backwards. It is sensible to diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index 189c3ef18..13ee4bd3f 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -278,3 +278,7 @@ Available output expressions are: object of type ``OBJECT_LIBRARY``. This expression may only be used in the sources of :command:`add_library` and :command:`add_executable` commands. +``$`` + Content of ``...`` converted to shell path style. For example, slashes are + converted to backslashes in Windows shells and drive letters are converted + to posix paths in MSYS shells. The ``...`` must be an absolute path. diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index 0a313cd10..ae5354fb4 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -121,3 +121,5 @@ All Policies /policy/CMP0061 /policy/CMP0062 /policy/CMP0063 + /policy/CMP0064 + /policy/CMP0065 diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index 615254e6a..931363c83 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -40,6 +40,7 @@ Properties of Global Scope /prop_gbl/RULE_LAUNCH_LINK /prop_gbl/RULE_MESSAGES /prop_gbl/TARGET_ARCHIVES_MAY_BE_SHARED_LIBS + /prop_gbl/TARGET_MESSAGES /prop_gbl/TARGET_SUPPORTS_SHARED_LIBS /prop_gbl/USE_FOLDERS @@ -85,9 +86,23 @@ Properties on Targets :maxdepth: 1 /prop_tgt/ALIASED_TARGET + /prop_tgt/ANDROID_ANT_ADDITIONAL_OPTIONS /prop_tgt/ANDROID_API /prop_tgt/ANDROID_API_MIN + /prop_tgt/ANDROID_ARCH + /prop_tgt/ANDROID_ASSETS_DIRECTORIES /prop_tgt/ANDROID_GUI + /prop_tgt/ANDROID_JAR_DEPENDENCIES + /prop_tgt/ANDROID_JAR_DIRECTORIES + /prop_tgt/ANDROID_JAVA_SOURCE_DIR + /prop_tgt/ANDROID_NATIVE_LIB_DEPENDENCIES + /prop_tgt/ANDROID_NATIVE_LIB_DIRECTORIES + /prop_tgt/ANDROID_PROCESS_MAX + /prop_tgt/ANDROID_PROGUARD + /prop_tgt/ANDROID_PROGUARD_CONFIG_PATH + /prop_tgt/ANDROID_SECURE_PROPS_PATH + /prop_tgt/ANDROID_SKIP_ANT_STEP + /prop_tgt/ANDROID_STL_TYPE /prop_tgt/ARCHIVE_OUTPUT_DIRECTORY_CONFIG /prop_tgt/ARCHIVE_OUTPUT_DIRECTORY /prop_tgt/ARCHIVE_OUTPUT_NAME_CONFIG @@ -99,6 +114,7 @@ Properties on Targets /prop_tgt/AUTOUIC_OPTIONS /prop_tgt/AUTORCC /prop_tgt/AUTORCC_OPTIONS + /prop_tgt/BINARY_DIR /prop_tgt/BUILD_WITH_INSTALL_RPATH /prop_tgt/BUNDLE_EXTENSION /prop_tgt/BUNDLE @@ -135,6 +151,7 @@ Properties on Targets /prop_tgt/Fortran_FORMAT /prop_tgt/Fortran_MODULE_DIRECTORY /prop_tgt/FRAMEWORK + /prop_tgt/FRAMEWORK_VERSION /prop_tgt/GENERATOR_FILE_NAME /prop_tgt/GNUtoMS /prop_tgt/HAS_CXX @@ -177,6 +194,7 @@ Properties on Targets /prop_tgt/JOB_POOL_COMPILE /prop_tgt/JOB_POOL_LINK /prop_tgt/LABELS + /prop_tgt/LANG_COMPILER_LAUNCHER /prop_tgt/LANG_INCLUDE_WHAT_YOU_USE /prop_tgt/LANG_VISIBILITY_PRESET /prop_tgt/LIBRARY_OUTPUT_DIRECTORY_CONFIG @@ -227,6 +245,7 @@ Properties on Targets /prop_tgt/RUNTIME_OUTPUT_NAME_CONFIG /prop_tgt/RUNTIME_OUTPUT_NAME /prop_tgt/SKIP_BUILD_RPATH + /prop_tgt/SOURCE_DIR /prop_tgt/SOURCES /prop_tgt/SOVERSION /prop_tgt/STATIC_LIBRARY_FLAGS_CONFIG @@ -235,21 +254,27 @@ Properties on Targets /prop_tgt/TYPE /prop_tgt/VERSION /prop_tgt/VISIBILITY_INLINES_HIDDEN + /prop_tgt/VS_DESKTOP_EXTENSIONS_VERSION /prop_tgt/VS_DOTNET_REFERENCES /prop_tgt/VS_DOTNET_TARGET_FRAMEWORK_VERSION /prop_tgt/VS_GLOBAL_KEYWORD /prop_tgt/VS_GLOBAL_PROJECT_TYPES /prop_tgt/VS_GLOBAL_ROOTNAMESPACE /prop_tgt/VS_GLOBAL_variable + /prop_tgt/VS_IOT_EXTENSIONS_VERSION + /prop_tgt/VS_IOT_STARTUP_TASK /prop_tgt/VS_KEYWORD + /prop_tgt/VS_MOBILE_EXTENSIONS_VERSION /prop_tgt/VS_SCC_AUXPATH /prop_tgt/VS_SCC_LOCALPATH /prop_tgt/VS_SCC_PROJECTNAME /prop_tgt/VS_SCC_PROVIDER + /prop_tgt/VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION /prop_tgt/VS_WINRT_COMPONENT /prop_tgt/VS_WINRT_EXTENSIONS /prop_tgt/VS_WINRT_REFERENCES /prop_tgt/WIN32_EXECUTABLE + /prop_tgt/WINDOWS_EXPORT_ALL_SYMBOLS /prop_tgt/XCODE_ATTRIBUTE_an-attribute /prop_tgt/XCTEST diff --git a/Help/manual/cmake-toolchains.7.rst b/Help/manual/cmake-toolchains.7.rst index 054438dd6..492fcac39 100644 --- a/Help/manual/cmake-toolchains.7.rst +++ b/Help/manual/cmake-toolchains.7.rst @@ -220,6 +220,23 @@ 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 10 Universal Applications +----------------------------------------------------- + +A toolchain file to configure a Visual Studio generator for a +Windows 10 Universal Application may look like this: + +.. code-block:: cmake + + set(CMAKE_SYSTEM_NAME WindowsStore) + set(CMAKE_SYSTEM_VERSION 10.0) + +A Windows 10 Universal Application targets both Windows Store and +Windows Phone. Specify the :variable:`CMAKE_SYSTEM_VERSION` variable +to be ``10.0`` to build with the latest available Windows 10 SDK. +Specify a more specific version (e.g. ``10.0.10240.0`` for RTM) +to build with the corresponding SDK. + Cross Compiling for Windows Phone --------------------------------- @@ -256,6 +273,22 @@ like this: 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. +See also target properties: + +* :prop_tgt:`ANDROID_ANT_ADDITIONAL_OPTIONS` +* :prop_tgt:`ANDROID_API_MIN` +* :prop_tgt:`ANDROID_API` +* :prop_tgt:`ANDROID_ARCH` +* :prop_tgt:`ANDROID_ASSETS_DIRECTORIES` +* :prop_tgt:`ANDROID_GUI` +* :prop_tgt:`ANDROID_JAR_DEPENDENCIES` +* :prop_tgt:`ANDROID_JAR_DIRECTORIES` +* :prop_tgt:`ANDROID_JAVA_SOURCE_DIR` +* :prop_tgt:`ANDROID_NATIVE_LIB_DEPENDENCIES` +* :prop_tgt:`ANDROID_NATIVE_LIB_DIRECTORIES` +* :prop_tgt:`ANDROID_PROCESS_MAX` +* :prop_tgt:`ANDROID_PROGUARD_CONFIG_PATH` +* :prop_tgt:`ANDROID_PROGUARD` +* :prop_tgt:`ANDROID_SECURE_PROPS_PATH` +* :prop_tgt:`ANDROID_SKIP_ANT_STEP` +* :prop_tgt:`ANDROID_STL_TYPE` diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index bd02f8b8b..211690050 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -47,6 +47,8 @@ Variables that Provide Information /variable/CMAKE_JOB_POOL_COMPILE /variable/CMAKE_JOB_POOL_LINK /variable/CMAKE_LINK_LIBRARY_SUFFIX + /variable/CMAKE_LINK_SEARCH_END_STATIC + /variable/CMAKE_LINK_SEARCH_START_STATIC /variable/CMAKE_MAJOR_VERSION /variable/CMAKE_MAKE_PROGRAM /variable/CMAKE_MATCH_COUNT @@ -80,6 +82,7 @@ Variables that Provide Information /variable/CMAKE_VS_NsightTegra_VERSION /variable/CMAKE_VS_PLATFORM_NAME /variable/CMAKE_VS_PLATFORM_TOOLSET + /variable/CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION /variable/CMAKE_XCODE_PLATFORM_TOOLSET /variable/PROJECT_BINARY_DIR /variable/PROJECT-NAME_BINARY_DIR @@ -117,6 +120,8 @@ Variables that Change Behavior /variable/CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION /variable/CMAKE_EXPORT_NO_PACKAGE_REGISTRY /variable/CMAKE_SYSROOT + /variable/CMAKE_FIND_APPBUNDLE + /variable/CMAKE_FIND_FRAMEWORK /variable/CMAKE_FIND_LIBRARY_PREFIXES /variable/CMAKE_FIND_LIBRARY_SUFFIXES /variable/CMAKE_FIND_NO_INSTALL_PREFIX @@ -147,6 +152,8 @@ Variables that Change Behavior /variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE /variable/CMAKE_SKIP_INSTALL_ALL_DEPENDENCY /variable/CMAKE_STAGING_PREFIX + /variable/CMAKE_SYSTEM_APPBUNDLE_PATH + /variable/CMAKE_SYSTEM_FRAMEWORK_PATH /variable/CMAKE_SYSTEM_IGNORE_PATH /variable/CMAKE_SYSTEM_INCLUDE_PATH /variable/CMAKE_SYSTEM_LIBRARY_PATH @@ -209,9 +216,23 @@ Variables that Control the Build .. toctree:: :maxdepth: 1 + /variable/CMAKE_ANDROID_ANT_ADDITIONAL_OPTIONS /variable/CMAKE_ANDROID_API /variable/CMAKE_ANDROID_API_MIN + /variable/CMAKE_ANDROID_ARCH + /variable/CMAKE_ANDROID_ASSETS_DIRECTORIES /variable/CMAKE_ANDROID_GUI + /variable/CMAKE_ANDROID_JAR_DEPENDENCIES + /variable/CMAKE_ANDROID_JAR_DIRECTORIES + /variable/CMAKE_ANDROID_JAVA_SOURCE_DIR + /variable/CMAKE_ANDROID_NATIVE_LIB_DEPENDENCIES + /variable/CMAKE_ANDROID_NATIVE_LIB_DIRECTORIES + /variable/CMAKE_ANDROID_PROCESS_MAX + /variable/CMAKE_ANDROID_PROGUARD + /variable/CMAKE_ANDROID_PROGUARD_CONFIG_PATH + /variable/CMAKE_ANDROID_SECURE_PROPS_PATH + /variable/CMAKE_ANDROID_SKIP_ANT_STEP + /variable/CMAKE_ANDROID_STL_TYPE /variable/CMAKE_ARCHIVE_OUTPUT_DIRECTORY /variable/CMAKE_ARCHIVE_OUTPUT_DIRECTORY_CONFIG /variable/CMAKE_AUTOMOC_MOC_OPTIONS @@ -225,6 +246,7 @@ Variables that Control the Build /variable/CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG /variable/CMAKE_CONFIG_POSTFIX /variable/CMAKE_DEBUG_POSTFIX + /variable/CMAKE_ENABLE_EXPORTS /variable/CMAKE_EXE_LINKER_FLAGS_CONFIG /variable/CMAKE_EXE_LINKER_FLAGS /variable/CMAKE_Fortran_FORMAT @@ -235,6 +257,7 @@ Variables that Control the Build /variable/CMAKE_INSTALL_NAME_DIR /variable/CMAKE_INSTALL_RPATH /variable/CMAKE_INSTALL_RPATH_USE_LINK_PATH + /variable/CMAKE_LANG_COMPILER_LAUNCHER /variable/CMAKE_LANG_INCLUDE_WHAT_YOU_USE /variable/CMAKE_LANG_VISIBILITY_PRESET /variable/CMAKE_LIBRARY_OUTPUT_DIRECTORY @@ -270,6 +293,7 @@ Variables that Control the Build /variable/CMAKE_USE_RELATIVE_PATHS /variable/CMAKE_VISIBILITY_INLINES_HIDDEN /variable/CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD + /variable/CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS /variable/CMAKE_WIN32_EXECUTABLE /variable/CMAKE_XCODE_ATTRIBUTE_an-attribute /variable/EXECUTABLE_OUTPUT_PATH @@ -345,12 +369,30 @@ Variables for CTest /variable/CTEST_BUILD_NAME /variable/CTEST_BZR_COMMAND /variable/CTEST_BZR_UPDATE_OPTIONS + /variable/CTEST_CHANGE_ID /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_CUSTOM_COVERAGE_EXCLUDE + /variable/CTEST_CUSTOM_ERROR_EXCEPTION + /variable/CTEST_CUSTOM_ERROR_MATCH + /variable/CTEST_CUSTOM_ERROR_POST_CONTEXT + /variable/CTEST_CUSTOM_ERROR_PRE_CONTEXT + /variable/CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE + /variable/CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS + /variable/CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS + /variable/CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE + /variable/CTEST_CUSTOM_MEMCHECK_IGNORE + /variable/CTEST_CUSTOM_POST_MEMCHECK + /variable/CTEST_CUSTOM_POST_TEST + /variable/CTEST_CUSTOM_PRE_MEMCHECK + /variable/CTEST_CUSTOM_PRE_TEST + /variable/CTEST_CUSTOM_TEST_IGNORE + /variable/CTEST_CUSTOM_WARNING_EXCEPTION + /variable/CTEST_CUSTOM_WARNING_MATCH /variable/CTEST_CVS_CHECKOUT /variable/CTEST_CVS_COMMAND /variable/CTEST_CVS_UPDATE_OPTIONS @@ -360,6 +402,7 @@ Variables for CTest /variable/CTEST_DROP_SITE_CDASH /variable/CTEST_DROP_SITE_PASSWORD /variable/CTEST_DROP_SITE_USER + /variable/CTEST_EXTRA_COVERAGE_GLOB /variable/CTEST_GIT_COMMAND /variable/CTEST_GIT_UPDATE_CUSTOM /variable/CTEST_GIT_UPDATE_OPTIONS @@ -381,6 +424,7 @@ Variables for CTest /variable/CTEST_SVN_COMMAND /variable/CTEST_SVN_OPTIONS /variable/CTEST_SVN_UPDATE_OPTIONS + /variable/CTEST_TEST_LOAD /variable/CTEST_TEST_TIMEOUT /variable/CTEST_TRIGGER_SITE /variable/CTEST_UPDATE_COMMAND diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst index 4bd5a5ec7..dac16bf3f 100644 --- a/Help/manual/cmake.1.rst +++ b/Help/manual/cmake.1.rst @@ -27,6 +27,8 @@ in each directory of a source tree with the name CMakeLists.txt. Users build a project by using CMake to generate a build system for a native tool on their platform. +.. _`CMake Options`: + Options ======= @@ -113,14 +115,18 @@ Options ``--debug-output`` Put cmake in a debug mode. - Print extra stuff during the cmake run like stack traces with + Print extra information during the cmake run like stack traces with message(send_error ) calls. ``--trace`` Put cmake in trace mode. - Print a trace of all calls made and from where with - message(send_error ) calls. + Print a trace of all calls made and from where. + +``--trace-expand`` + Put cmake in trace mode. + + Like ``--trace``, but with variables expanded. ``--warn-uninitialized`` Warn about uninitialized values. diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst index c91321b10..2fdf7f329 100644 --- a/Help/manual/ctest.1.rst +++ b/Help/manual/ctest.1.rst @@ -66,6 +66,13 @@ Options number of jobs. This option can also be set by setting the environment variable ``CTEST_PARALLEL_LEVEL``. +``--test-load `` + While running tests in parallel (e.g. with ``-j``), try not to start + tests when they may cause the CPU load to pass above a given threshold. + + When ``ctest`` is run as a `Dashboard Client`_ this sets the + ``TestLoad`` option of the `CTest Test Step`_. + ``-Q,--quiet`` Make ctest quiet. @@ -295,6 +302,12 @@ Options ``--test-command`` The test to run with the --build-and-test option. +``--test-output-size-passed `` + Limit the output for passed tests to bytes. + +``--test-output-size-failed `` + Limit the output for failed tests to bytes. + ``--test-timeout`` The time limit in seconds, internal use only. @@ -776,6 +789,13 @@ Arguments to the command may specify some of the step settings. Configuration settings include: +``TestLoad`` + While running tests in parallel (e.g. with ``-j``), try not to start + tests when they may cause the CPU load to pass above a given threshold. + + * `CTest Script`_ variable: :variable:`CTEST_TEST_LOAD` + * :module:`CTest` module variable: ``CTEST_TEST_LOAD`` + ``TimeOut`` The default timeout for each test if not specified by the :prop_test:`TIMEOUT` test property. diff --git a/Help/policy/CMP0064.rst b/Help/policy/CMP0064.rst new file mode 100644 index 000000000..e9a061ba1 --- /dev/null +++ b/Help/policy/CMP0064.rst @@ -0,0 +1,17 @@ +CMP0064 +------- + +Recognize ``TEST`` as a operator for the :command:`if` command. + +The ``TEST`` operator was added to the :command:`if` command to determine if a +given test name was created by the :command:`add_test` command. + +The ``OLD`` behavior for this policy is to ignore the ``TEST`` operator. +The ``NEW`` behavior is to interpret the ``TEST`` operator. + +This policy was introduced in CMake version 3.4. 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. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0065.rst b/Help/policy/CMP0065.rst new file mode 100644 index 000000000..2ed775dee --- /dev/null +++ b/Help/policy/CMP0065.rst @@ -0,0 +1,27 @@ +CMP0065 +------- + +Do not add flags to export symbols from executables without +the :prop_tgt:`ENABLE_EXPORTS` target property. + +CMake 3.3 and below, for historical reasons, always linked executables +on some platforms with flags like ``-rdynamic`` to export symbols from +the executables for use by any plugins they may load via ``dlopen``. +CMake 3.4 and above prefer to do this only for executables that are +explicitly marked with the :prop_tgt:`ENABLE_EXPORTS` target property. + +The ``OLD`` behavior of this policy is to always use the additional link +flags when linking executables regardless of the value of the +:prop_tgt:`ENABLE_EXPORTS` target property. + +The ``NEW`` behavior of this policy is to only use the additional link +flags when linking executables if the :prop_tgt:`ENABLE_EXPORTS` target +property is set to ``True``. + +This policy was introduced in CMake version 3.4. 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_CMP0065 >` +variable to control the warning. + +.. include:: DEPRECATED.txt diff --git a/Help/prop_dir/INCLUDE_REGULAR_EXPRESSION.rst b/Help/prop_dir/INCLUDE_REGULAR_EXPRESSION.rst index befafa58c..bb90c61a7 100644 --- a/Help/prop_dir/INCLUDE_REGULAR_EXPRESSION.rst +++ b/Help/prop_dir/INCLUDE_REGULAR_EXPRESSION.rst @@ -3,6 +3,7 @@ INCLUDE_REGULAR_EXPRESSION Include file scanning regular expression. -This read-only property specifies the regular expression used during +This property specifies the regular expression used during dependency scanning to match include files that should be followed. -See the include_regular_expression command. +See the :command:`include_regular_expression` command for a high-level +interface to set this property. diff --git a/Help/prop_gbl/RULE_LAUNCH_COMPILE.rst b/Help/prop_gbl/RULE_LAUNCH_COMPILE.rst index 980843bf8..e0df8784a 100644 --- a/Help/prop_gbl/RULE_LAUNCH_COMPILE.rst +++ b/Help/prop_gbl/RULE_LAUNCH_COMPILE.rst @@ -3,7 +3,9 @@ RULE_LAUNCH_COMPILE Specify a launcher for compile rules. -Makefile generators prefix compiler commands with the given launcher -command line. This is intended to allow launchers to intercept build -problems with high granularity. Non-Makefile generators currently -ignore this property. +:ref:`Makefile Generators` and the :generator:`Ninja` generator prefix +compiler commands with the given launcher command line. +This is intended to allow launchers to intercept build problems +with high granularity. Other generators ignore this property +because their underlying build systems provide no hook to wrap +individual commands with a launcher. diff --git a/Help/prop_gbl/RULE_LAUNCH_CUSTOM.rst b/Help/prop_gbl/RULE_LAUNCH_CUSTOM.rst index 9d4a25ce7..b20c59bcc 100644 --- a/Help/prop_gbl/RULE_LAUNCH_CUSTOM.rst +++ b/Help/prop_gbl/RULE_LAUNCH_CUSTOM.rst @@ -3,7 +3,9 @@ RULE_LAUNCH_CUSTOM Specify a launcher for custom rules. -Makefile generators prefix custom commands with the given launcher -command line. This is intended to allow launchers to intercept build -problems with high granularity. Non-Makefile generators currently -ignore this property. +:ref:`Makefile Generators` and the :generator:`Ninja` generator prefix +custom commands with the given launcher command line. +This is intended to allow launchers to intercept build problems +with high granularity. Other generators ignore this property +because their underlying build systems provide no hook to wrap +individual commands with a launcher. diff --git a/Help/prop_gbl/RULE_LAUNCH_LINK.rst b/Help/prop_gbl/RULE_LAUNCH_LINK.rst index 191f1d504..567bb6864 100644 --- a/Help/prop_gbl/RULE_LAUNCH_LINK.rst +++ b/Help/prop_gbl/RULE_LAUNCH_LINK.rst @@ -3,7 +3,9 @@ RULE_LAUNCH_LINK Specify a launcher for link rules. -Makefile generators prefix link and archive commands with the given -launcher command line. This is intended to allow launchers to -intercept build problems with high granularity. Non-Makefile -generators currently ignore this property. +:ref:`Makefile Generators` and the :generator:`Ninja` generator prefix +link and archive commands with the given launcher command line. +This is intended to allow launchers to intercept build problems +with high granularity. Other generators ignore this property +because their underlying build systems provide no hook to wrap +individual commands with a launcher. diff --git a/Help/prop_gbl/TARGET_MESSAGES.rst b/Help/prop_gbl/TARGET_MESSAGES.rst new file mode 100644 index 000000000..275b0741d --- /dev/null +++ b/Help/prop_gbl/TARGET_MESSAGES.rst @@ -0,0 +1,20 @@ +TARGET_MESSAGES +--------------- + +Specify whether to report the completion of each target. + +This property specifies whether :ref:`Makefile Generators` should +add a progress message describing that each target has been completed. +If the property is not set the default is ``ON``. Set the property +to ``OFF`` to disable target completion messages. + +This option is intended to reduce build output when little or no +work needs to be done to bring the build tree up to date. + +If a ``CMAKE_TARGET_MESSAGES`` cache entry exists its value +initializes the value of this property. + +Non-Makefile generators currently ignore this property. + +See the counterpart property :prop_gbl:`RULE_MESSAGES` to disable +everything except for target completion messages. diff --git a/Help/prop_sf/OBJECT_DEPENDS.rst b/Help/prop_sf/OBJECT_DEPENDS.rst index 18022de23..1d24960b5 100644 --- a/Help/prop_sf/OBJECT_DEPENDS.rst +++ b/Help/prop_sf/OBJECT_DEPENDS.rst @@ -3,9 +3,12 @@ OBJECT_DEPENDS Additional files on which a compiled object file depends. -Specifies a semicolon-separated list of full-paths to files on which -any object files compiled from this source file depend. An object -file will be recompiled if any of the named files is newer than it. +Specifies a :ref:`;-list ` of full-paths to +files on which any object files compiled from this source file depend. +On :ref:`Makefile Generators` and the :generator:`Ninja` generator an +object file will be recompiled if any of the named files is newer than it. +:ref:`Visual Studio Generators` and the :generator:`Xcode` generator +cannot implement such compilation dependencies. This property need not be used to specify the dependency of a source file on a generated header file that it includes. Although the @@ -14,5 +17,5 @@ necessary. If the generated header file is created by a custom command in the same target as the source file, the automatic dependency scanning process will recognize the dependency. If the generated header file is created by another target, an inter-target -dependency should be created with the add_dependencies command (if one -does not already exist due to linking relationships). +dependency should be created with the :command:`add_dependencies` +command (if one does not already exist due to linking relationships). diff --git a/Help/prop_tgt/ANDROID_ANT_ADDITIONAL_OPTIONS.rst b/Help/prop_tgt/ANDROID_ANT_ADDITIONAL_OPTIONS.rst new file mode 100644 index 000000000..af6b40587 --- /dev/null +++ b/Help/prop_tgt/ANDROID_ANT_ADDITIONAL_OPTIONS.rst @@ -0,0 +1,8 @@ +ANDROID_ANT_ADDITIONAL_OPTIONS +------------------------------ + +Set the additional options for Android Ant build system. This is +a string value containing all command line options for the Ant build. +This property is initialized by the value of the +:variable:`CMAKE_ANDROID_ANT_ADDITIONAL_OPTIONS` variable if it is +set when a target is created. diff --git a/Help/prop_tgt/ANDROID_ARCH.rst b/Help/prop_tgt/ANDROID_ARCH.rst new file mode 100644 index 000000000..5477fb598 --- /dev/null +++ b/Help/prop_tgt/ANDROID_ARCH.rst @@ -0,0 +1,17 @@ +ANDROID_ARCH +------------ + +Set the Android target architecture. + +This is a string property that could be set to the one of +the following values: + +* ``armv7-a``: "ARMv7-A (armv7-a)" +* ``armv7-a-hard``: "ARMv7-A, hard-float ABI (armv7-a)" +* ``arm64-v8a``: "ARMv8-A, 64bit (arm64-v8a)" +* ``x86``: "x86 (x86)" +* ``x86_64``: "x86_64 (x86_64)" + +This property is initialized by the value of the +:variable:`CMAKE_ANDROID_ARCH` variable if it is set +when a target is created. diff --git a/Help/prop_tgt/ANDROID_ASSETS_DIRECTORIES.rst b/Help/prop_tgt/ANDROID_ASSETS_DIRECTORIES.rst new file mode 100644 index 000000000..764a58244 --- /dev/null +++ b/Help/prop_tgt/ANDROID_ASSETS_DIRECTORIES.rst @@ -0,0 +1,9 @@ +ANDROID_ASSETS_DIRECTORIES +-------------------------- + +Set the Android assets directories to copy into the main assets +folder before build. This a string property that contains the +directory paths separated by semicolon. +This property is initialized by the value of the +:variable:`CMAKE_ANDROID_ASSETS_DIRECTORIES` variable if it is set when +a target is created. diff --git a/Help/prop_tgt/ANDROID_JAR_DEPENDENCIES.rst b/Help/prop_tgt/ANDROID_JAR_DEPENDENCIES.rst new file mode 100644 index 000000000..42937c1b4 --- /dev/null +++ b/Help/prop_tgt/ANDROID_JAR_DEPENDENCIES.rst @@ -0,0 +1,7 @@ +ANDROID_JAR_DEPENDENCIES +------------------------ + +Set the Android property that specifies JAR dependencies. +This is a string value property. This property is initialized +by the value of the :variable:`CMAKE_ANDROID_JAR_DEPENDENCIES` +variable if it is set when a target is created. diff --git a/Help/prop_tgt/ANDROID_JAR_DIRECTORIES.rst b/Help/prop_tgt/ANDROID_JAR_DIRECTORIES.rst new file mode 100644 index 000000000..54f0a8ff7 --- /dev/null +++ b/Help/prop_tgt/ANDROID_JAR_DIRECTORIES.rst @@ -0,0 +1,14 @@ +ANDROID_JAR_DIRECTORIES +----------------------- + +Set the Android property that specifies directories to search for +the JAR libraries. + +This a string property that contains the directory paths separated by +semicolons. This property is initialized by the value of the +:variable:`CMAKE_ANDROID_JAR_DIRECTORIES` variable if it is set when +a target is created. + +Contents of ``ANDROID_JAR_DIRECTORIES`` may use "generator expressions" +with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` +manual for available expressions. diff --git a/Help/prop_tgt/ANDROID_JAVA_SOURCE_DIR.rst b/Help/prop_tgt/ANDROID_JAVA_SOURCE_DIR.rst new file mode 100644 index 000000000..90ef1ce93 --- /dev/null +++ b/Help/prop_tgt/ANDROID_JAVA_SOURCE_DIR.rst @@ -0,0 +1,8 @@ +ANDROID_JAVA_SOURCE_DIR +----------------------- + +Set the Android property that defines the Java source code root directories. +This a string property that contains the directory paths separated by semicolon. +This property is initialized by the value of the +:variable:`CMAKE_ANDROID_JAVA_SOURCE_DIR` variable if it is set +when a target is created. diff --git a/Help/prop_tgt/ANDROID_NATIVE_LIB_DEPENDENCIES.rst b/Help/prop_tgt/ANDROID_NATIVE_LIB_DEPENDENCIES.rst new file mode 100644 index 000000000..759a37b06 --- /dev/null +++ b/Help/prop_tgt/ANDROID_NATIVE_LIB_DEPENDENCIES.rst @@ -0,0 +1,14 @@ +ANDROID_NATIVE_LIB_DEPENDENCIES +------------------------------- + +Set the Android property that specifies the .so dependencies. +This is a string property. + +This property is initialized by the value of the +:variable:`CMAKE_ANDROID_NATIVE_LIB_DEPENDENCIES` variable if it is set +when a target is created. + +Contents of ``ANDROID_NATIVE_LIB_DEPENDENCIES`` may use +"generator expressions" with the syntax ``$<...>``. See the +:manual:`cmake-generator-expressions(7)` manual for +available expressions. diff --git a/Help/prop_tgt/ANDROID_NATIVE_LIB_DIRECTORIES.rst b/Help/prop_tgt/ANDROID_NATIVE_LIB_DIRECTORIES.rst new file mode 100644 index 000000000..bc673804d --- /dev/null +++ b/Help/prop_tgt/ANDROID_NATIVE_LIB_DIRECTORIES.rst @@ -0,0 +1,16 @@ +ANDROID_NATIVE_LIB_DIRECTORIES +------------------------------ + +Set the Android property that specifies directories to search for the +.so libraries. + +This a string property that contains the directory paths separated +by semicolons. + +This property is initialized by the value of the +:variable:`CMAKE_ANDROID_NATIVE_LIB_DIRECTORIES` variable if it is set when a +target is created. + +Contents of ``ANDROID_NATIVE_LIB_DIRECTORIES`` may use "generator expressions" +with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` +manual for available expressions. diff --git a/Help/prop_tgt/ANDROID_PROCESS_MAX.rst b/Help/prop_tgt/ANDROID_PROCESS_MAX.rst new file mode 100644 index 000000000..847acae5b --- /dev/null +++ b/Help/prop_tgt/ANDROID_PROCESS_MAX.rst @@ -0,0 +1,8 @@ +ANDROID_PROCESS_MAX +------------------- + +Set the Android property that defines the maximum number of a +parallel Android NDK compiler processes (e.g. ``4``). +This property is initialized by the value of the +:variable:`CMAKE_ANDROID_PROCESS_MAX` variable if it is set +when a target is created. diff --git a/Help/prop_tgt/ANDROID_PROGUARD.rst b/Help/prop_tgt/ANDROID_PROGUARD.rst new file mode 100644 index 000000000..dafc51ee5 --- /dev/null +++ b/Help/prop_tgt/ANDROID_PROGUARD.rst @@ -0,0 +1,9 @@ +ANDROID_PROGUARD +---------------- + +When this property is set to true that enables the ProGuard tool to shrink, +optimize, and obfuscate the code by removing unused code and renaming +classes, fields, and methods with semantically obscure names. +This property is initialized by the value of the +:variable:`CMAKE_ANDROID_PROGUARD` variable if it is set +when a target is created. diff --git a/Help/prop_tgt/ANDROID_PROGUARD_CONFIG_PATH.rst b/Help/prop_tgt/ANDROID_PROGUARD_CONFIG_PATH.rst new file mode 100644 index 000000000..0e929d16a --- /dev/null +++ b/Help/prop_tgt/ANDROID_PROGUARD_CONFIG_PATH.rst @@ -0,0 +1,9 @@ +ANDROID_PROGUARD_CONFIG_PATH +---------------------------- + +Set the Android property that specifies the location of the ProGuard +config file. Leave empty to use the default one. +This a string property that contains the path to ProGuard config file. +This property is initialized by the value of the +:variable:`CMAKE_ANDROID_PROGUARD_CONFIG_PATH` variable if it is set +when a target is created. diff --git a/Help/prop_tgt/ANDROID_SECURE_PROPS_PATH.rst b/Help/prop_tgt/ANDROID_SECURE_PROPS_PATH.rst new file mode 100644 index 000000000..9533f1a70 --- /dev/null +++ b/Help/prop_tgt/ANDROID_SECURE_PROPS_PATH.rst @@ -0,0 +1,8 @@ +ANDROID_SECURE_PROPS_PATH +------------------------- + +Set the Android property that states the location of the secure properties file. +This is a string property that contains the file path. +This property is initialized by the value of the +:variable:`CMAKE_ANDROID_SECURE_PROPS_PATH` variable +if it is set when a target is created. diff --git a/Help/prop_tgt/ANDROID_SKIP_ANT_STEP.rst b/Help/prop_tgt/ANDROID_SKIP_ANT_STEP.rst new file mode 100644 index 000000000..636189656 --- /dev/null +++ b/Help/prop_tgt/ANDROID_SKIP_ANT_STEP.rst @@ -0,0 +1,6 @@ +ANDROID_SKIP_ANT_STEP +--------------------- + +Set the Android property that defines whether or not to skip the Ant build step. +This is a boolean property initialized by the value of the +:variable:`CMAKE_ANDROID_SKIP_ANT_STEP` variable if it is set when a target is created. diff --git a/Help/prop_tgt/ANDROID_STL_TYPE.rst b/Help/prop_tgt/ANDROID_STL_TYPE.rst new file mode 100644 index 000000000..7256e266c --- /dev/null +++ b/Help/prop_tgt/ANDROID_STL_TYPE.rst @@ -0,0 +1,15 @@ +ANDROID_STL_TYPE +---------------- + +Set the Android property that defines the type of STL support for the project. +This is a string property that could set to the one of the following values: +``none`` e.g. "No C++ Support" +``system`` e.g. "Minimal C++ without STL" +``gabi++_static`` e.g. "GAbi++ Static" +``gabi++_shared`` e.g. "GAbi++ Shared" +``gnustl_static`` e.g. "GNU libstdc++ Static" +``gnustl_shared`` e.g. "GNU libstdc++ Shared" +``stlport_static`` e.g. "STLport Static" +``stlport_shared`` e.g. "STLport Shared" +This property is initialized by the value of the +variable:`CMAKE_ANDROID_STL_TYPE` variable if it is set when a target is created. diff --git a/Help/prop_tgt/ARCHIVE_OUTPUT_DIRECTORY_CONFIG.rst b/Help/prop_tgt/ARCHIVE_OUTPUT_DIRECTORY_CONFIG.rst index 29991ebf8..12f8bb7ef 100644 --- a/Help/prop_tgt/ARCHIVE_OUTPUT_DIRECTORY_CONFIG.rst +++ b/Help/prop_tgt/ARCHIVE_OUTPUT_DIRECTORY_CONFIG.rst @@ -11,3 +11,6 @@ per-configuration subdirectory to the specified directory. This property is initialized by the value of the :variable:`CMAKE_ARCHIVE_OUTPUT_DIRECTORY_` variable if it is set when a target is created. + +Contents of ``ARCHIVE_OUTPUT_DIRECTORY_`` may use +:manual:`generator expressions `. diff --git a/Help/prop_tgt/BINARY_DIR.rst b/Help/prop_tgt/BINARY_DIR.rst new file mode 100644 index 000000000..246f7e605 --- /dev/null +++ b/Help/prop_tgt/BINARY_DIR.rst @@ -0,0 +1,6 @@ +BINARY_DIR +---------- + +This read-only property reports the value of the +:variable:`CMAKE_CURRENT_BINARY_DIR` variable in the directory in which +the target was defined. diff --git a/Help/prop_tgt/CONFIG_OUTPUT_NAME.rst b/Help/prop_tgt/CONFIG_OUTPUT_NAME.rst index f2c875ef5..a61c70295 100644 --- a/Help/prop_tgt/CONFIG_OUTPUT_NAME.rst +++ b/Help/prop_tgt/CONFIG_OUTPUT_NAME.rst @@ -2,6 +2,7 @@ -------------------- Old per-configuration target file base name. +Use :prop_tgt:`OUTPUT_NAME_` instead. -This is a configuration-specific version of OUTPUT_NAME. Use -OUTPUT_NAME_ instead. +This is a configuration-specific version of the :prop_tgt:`OUTPUT_NAME` +target property. diff --git a/Help/prop_tgt/ENABLE_EXPORTS.rst b/Help/prop_tgt/ENABLE_EXPORTS.rst index 283f5a8b2..dfd4af754 100644 --- a/Help/prop_tgt/ENABLE_EXPORTS.rst +++ b/Help/prop_tgt/ENABLE_EXPORTS.rst @@ -7,7 +7,7 @@ Normally an executable does not export any symbols because it is the final program. It is possible for an executable to export symbols to be used by loadable modules. When this property is set to true CMake will allow other targets to "link" to the executable with the -TARGET_LINK_LIBRARIES command. On all platforms a target-level +:command:`TARGET_LINK_LIBRARIES` command. On all platforms a target-level dependency on the executable is created for targets that link to it. For DLL platforms an import library will be created for the exported symbols and then used for linking. All Windows-based systems @@ -17,3 +17,6 @@ module will "link" to the executable using a flag like "-bundle_loader". For other non-DLL platforms the link rule is simply ignored since the dynamic loader will automatically bind symbols when the module is loaded. + +This property is initialized by the value of the variable +:variable:`CMAKE_ENABLE_EXPORTS` if it is set when a target is created. diff --git a/Help/prop_tgt/FRAMEWORK.rst b/Help/prop_tgt/FRAMEWORK.rst index 9f472c025..dcb6d3b97 100644 --- a/Help/prop_tgt/FRAMEWORK.rst +++ b/Help/prop_tgt/FRAMEWORK.rst @@ -6,4 +6,6 @@ This target is a framework on the Mac. If a shared library target has this property set to true it will be built as a framework when built on the mac. It will have the directory structure required for a framework and will be suitable to -be used with the -framework option +be used with the ``-framework`` option + +See also the :prop_tgt:`FRAMEWORK_VERSION` target property. diff --git a/Help/prop_tgt/FRAMEWORK_VERSION.rst b/Help/prop_tgt/FRAMEWORK_VERSION.rst new file mode 100644 index 000000000..bf650a7ff --- /dev/null +++ b/Help/prop_tgt/FRAMEWORK_VERSION.rst @@ -0,0 +1,5 @@ +FRAMEWORK_VERSION +----------------- + +Version of a framework created using the :prop_tgt:`FRAMEWORK` target +property (e.g. ``A``). diff --git a/Help/prop_tgt/LANG_COMPILER_LAUNCHER.rst b/Help/prop_tgt/LANG_COMPILER_LAUNCHER.rst new file mode 100644 index 000000000..0fe0b31e5 --- /dev/null +++ b/Help/prop_tgt/LANG_COMPILER_LAUNCHER.rst @@ -0,0 +1,13 @@ +_COMPILER_LAUNCHER +------------------------ + +This property is implemented only when ```` is ``C`` or ``CXX``. + +Specify a :ref:`;-list ` containing a command line +for a compiler launching tool. The :ref:`Makefile Generators` and the +:generator:`Ninja` generator will run this tool and pass the compiler and +its arguments to the tool. Some example tools are distcc and ccache. + +This property is initialized by the value of +the :variable:`CMAKE__COMPILER_LAUNCHER` variable if it is set +when a target is created. diff --git a/Help/prop_tgt/LIBRARY_OUTPUT_DIRECTORY_CONFIG.rst b/Help/prop_tgt/LIBRARY_OUTPUT_DIRECTORY_CONFIG.rst index 6fc014220..28dd404df 100644 --- a/Help/prop_tgt/LIBRARY_OUTPUT_DIRECTORY_CONFIG.rst +++ b/Help/prop_tgt/LIBRARY_OUTPUT_DIRECTORY_CONFIG.rst @@ -11,3 +11,6 @@ per-configuration subdirectory to the specified directory. This property is initialized by the value of the :variable:`CMAKE_LIBRARY_OUTPUT_DIRECTORY_` variable if it is set when a target is created. + +Contents of ``LIBRARY_OUTPUT_DIRECTORY_`` may use +:manual:`generator expressions `. diff --git a/Help/prop_tgt/LINK_SEARCH_END_STATIC.rst b/Help/prop_tgt/LINK_SEARCH_END_STATIC.rst index fe105bd6c..cf9c87147 100644 --- a/Help/prop_tgt/LINK_SEARCH_END_STATIC.rst +++ b/Help/prop_tgt/LINK_SEARCH_END_STATIC.rst @@ -10,5 +10,9 @@ paths are not known or (in some cases) are in implicit link directories for the platform. By default CMake adds an option at the end of the library list (if necessary) to set the linker search type back to its starting type. This property switches the final linker -search type to -Bstatic regardless of how it started. See also -LINK_SEARCH_START_STATIC. +search type to -Bstatic regardless of how it started. + +This property is initialized by the value of the variable +CMAKE_LINK_SEARCH_END_STATIC if it is set when a target is created. + +See also LINK_SEARCH_START_STATIC. diff --git a/Help/prop_tgt/LINK_SEARCH_START_STATIC.rst b/Help/prop_tgt/LINK_SEARCH_START_STATIC.rst index ca899feaa..2e0f9bd33 100644 --- a/Help/prop_tgt/LINK_SEARCH_START_STATIC.rst +++ b/Help/prop_tgt/LINK_SEARCH_START_STATIC.rst @@ -11,4 +11,9 @@ directories for the platform. By default the linker search type is assumed to be -Bdynamic at the beginning of the library list. This property switches the assumption to -Bstatic. It is intended for use when linking an executable statically (e.g. with the GNU -static -option). See also LINK_SEARCH_END_STATIC. +option). + +This property is initialized by the value of the variable +CMAKE_LINK_SEARCH_START_STATIC if it is set when a target is created. + +See also LINK_SEARCH_END_STATIC. diff --git a/Help/prop_tgt/MACOSX_BUNDLE_INFO_PLIST.rst b/Help/prop_tgt/MACOSX_BUNDLE_INFO_PLIST.rst index 097cce186..07a933faf 100644 --- a/Help/prop_tgt/MACOSX_BUNDLE_INFO_PLIST.rst +++ b/Help/prop_tgt/MACOSX_BUNDLE_INFO_PLIST.rst @@ -1,29 +1,35 @@ MACOSX_BUNDLE_INFO_PLIST ------------------------ -Specify a custom Info.plist template for a Mac OS X App Bundle. +Specify a custom ``Info.plist`` template for a Mac OS X App Bundle. -An executable target with MACOSX_BUNDLE enabled will be built as an -application bundle on Mac OS X. By default its Info.plist file is -created by configuring a template called MacOSXBundleInfo.plist.in -located in the CMAKE_MODULE_PATH. This property specifies an -alternative template file name which may be a full path. +An executable target with :prop_tgt:`MACOSX_BUNDLE` enabled will be built as an +application bundle on Mac OS X. By default its ``Info.plist`` file is created +by configuring a template called ``MacOSXBundleInfo.plist.in`` located in the +:variable:`CMAKE_MODULE_PATH`. This property specifies an alternative template +file name which may be a full path. The following target properties may be set to specify content to be configured into the file: -:: - - MACOSX_BUNDLE_INFO_STRING - MACOSX_BUNDLE_ICON_FILE - MACOSX_BUNDLE_GUI_IDENTIFIER - MACOSX_BUNDLE_LONG_VERSION_STRING - MACOSX_BUNDLE_BUNDLE_NAME - MACOSX_BUNDLE_SHORT_VERSION_STRING - MACOSX_BUNDLE_BUNDLE_VERSION - MACOSX_BUNDLE_COPYRIGHT +``MACOSX_BUNDLE_BUNDLE_NAME`` + Sets ``CFBundleName``. +``MACOSX_BUNDLE_BUNDLE_VERSION`` + Sets ``CFBundleVersion``. +``MACOSX_BUNDLE_COPYRIGHT`` + Sets ``NSHumanReadableCopyright``. +``MACOSX_BUNDLE_GUI_IDENTIFIER`` + Sets ``CFBundleIdentifier``. +``MACOSX_BUNDLE_ICON_FILE`` + Sets ``CFBundleIconFile``. +``MACOSX_BUNDLE_INFO_STRING`` + Sets ``CFBundleGetInfoString``. +``MACOSX_BUNDLE_LONG_VERSION_STRING`` + Sets ``CFBundleLongVersionString``. +``MACOSX_BUNDLE_SHORT_VERSION_STRING`` + Sets ``CFBundleShortVersionString``. CMake variables of the same name may be set to affect all targets in a directory that do not have each specific property set. If a custom -Info.plist is specified by this property it may of course hard-code +``Info.plist`` is specified by this property it may of course hard-code all the settings instead of using the target properties. diff --git a/Help/prop_tgt/MACOSX_FRAMEWORK_INFO_PLIST.rst b/Help/prop_tgt/MACOSX_FRAMEWORK_INFO_PLIST.rst index 729d92902..548c3ac64 100644 --- a/Help/prop_tgt/MACOSX_FRAMEWORK_INFO_PLIST.rst +++ b/Help/prop_tgt/MACOSX_FRAMEWORK_INFO_PLIST.rst @@ -1,25 +1,27 @@ MACOSX_FRAMEWORK_INFO_PLIST --------------------------- -Specify a custom Info.plist template for a Mac OS X Framework. +Specify a custom ``Info.plist`` template for a Mac OS X Framework. -A library target with FRAMEWORK enabled will be built as a framework -on Mac OS X. By default its Info.plist file is created by configuring -a template called MacOSXFrameworkInfo.plist.in located in the -CMAKE_MODULE_PATH. This property specifies an alternative template +A library target with :prop_tgt:`FRAMEWORK` enabled will be built as a +framework on Mac OS X. By default its ``Info.plist`` file is created by +configuring a template called ``MacOSXFrameworkInfo.plist.in`` located in the +:variable:`CMAKE_MODULE_PATH`. This property specifies an alternative template file name which may be a full path. The following target properties may be set to specify content to be configured into the file: -:: - - MACOSX_FRAMEWORK_ICON_FILE - MACOSX_FRAMEWORK_IDENTIFIER - MACOSX_FRAMEWORK_SHORT_VERSION_STRING - MACOSX_FRAMEWORK_BUNDLE_VERSION +``MACOSX_FRAMEWORK_BUNDLE_VERSION`` + Sets ``CFBundleVersion``. +``MACOSX_FRAMEWORK_ICON_FILE`` + Sets ``CFBundleIconFile``. +``MACOSX_FRAMEWORK_IDENTIFIER`` + Sets ``CFBundleIdentifier``. +``MACOSX_FRAMEWORK_SHORT_VERSION_STRING`` + Sets ``CFBundleShortVersionString``. CMake variables of the same name may be set to affect all targets in a directory that do not have each specific property set. If a custom -Info.plist is specified by this property it may of course hard-code +``Info.plist`` is specified by this property it may of course hard-code all the settings instead of using the target properties. diff --git a/Help/prop_tgt/NO_SONAME.rst b/Help/prop_tgt/NO_SONAME.rst index fc668b588..ee45ed849 100644 --- a/Help/prop_tgt/NO_SONAME.rst +++ b/Help/prop_tgt/NO_SONAME.rst @@ -1,11 +1,11 @@ NO_SONAME --------- -Whether to set "soname" when linking a shared library or module. +Whether to set "soname" when linking a shared library. -Enable this boolean property if a generated shared library or module +Enable this boolean property if a generated shared library should not have "soname" set. Default is to set "soname" on all -shared libraries and modules as long as the platform supports it. +shared libraries as long as the platform supports it. Generally, use this property only for leaf private libraries or plugins. If you use it on normal shared libraries which other targets link against, on some platforms a linker will insert a full path to diff --git a/Help/prop_tgt/OUTPUT_NAME.rst b/Help/prop_tgt/OUTPUT_NAME.rst index 97bf01094..f1bdb7c88 100644 --- a/Help/prop_tgt/OUTPUT_NAME.rst +++ b/Help/prop_tgt/OUTPUT_NAME.rst @@ -6,3 +6,16 @@ Output name for target files. This sets the base name for output files created for an executable or library target. If not set, the logical target name is used by default. + +Contents of ``OUTPUT_NAME`` and the variants listed below may use +:manual:`generator expressions `. + +See also the variants: + +* :prop_tgt:`OUTPUT_NAME_` +* :prop_tgt:`ARCHIVE_OUTPUT_NAME_` +* :prop_tgt:`ARCHIVE_OUTPUT_NAME` +* :prop_tgt:`LIBRARY_OUTPUT_NAME_` +* :prop_tgt:`LIBRARY_OUTPUT_NAME` +* :prop_tgt:`RUNTIME_OUTPUT_NAME_` +* :prop_tgt:`RUNTIME_OUTPUT_NAME` diff --git a/Help/prop_tgt/OUTPUT_NAME_CONFIG.rst b/Help/prop_tgt/OUTPUT_NAME_CONFIG.rst index 7bfbcbccf..41b782f98 100644 --- a/Help/prop_tgt/OUTPUT_NAME_CONFIG.rst +++ b/Help/prop_tgt/OUTPUT_NAME_CONFIG.rst @@ -3,4 +3,5 @@ OUTPUT_NAME_ Per-configuration target file base name. -This is the configuration-specific version of OUTPUT_NAME. +This is the configuration-specific version of the :prop_tgt:`OUTPUT_NAME` +target property. diff --git a/Help/prop_tgt/RUNTIME_OUTPUT_DIRECTORY_CONFIG.rst b/Help/prop_tgt/RUNTIME_OUTPUT_DIRECTORY_CONFIG.rst index c10034666..94fb2776a 100644 --- a/Help/prop_tgt/RUNTIME_OUTPUT_DIRECTORY_CONFIG.rst +++ b/Help/prop_tgt/RUNTIME_OUTPUT_DIRECTORY_CONFIG.rst @@ -11,3 +11,6 @@ per-configuration subdirectory to the specified directory. This property is initialized by the value of the :variable:`CMAKE_RUNTIME_OUTPUT_DIRECTORY_` variable if it is set when a target is created. + +Contents of ``RUNTIME_OUTPUT_DIRECTORY_`` may use +:manual:`generator expressions `. diff --git a/Help/prop_tgt/SOURCE_DIR.rst b/Help/prop_tgt/SOURCE_DIR.rst new file mode 100644 index 000000000..b25813bff --- /dev/null +++ b/Help/prop_tgt/SOURCE_DIR.rst @@ -0,0 +1,6 @@ +SOURCE_DIR +---------- + +This read-only property reports the value of the +:variable:`CMAKE_CURRENT_SOURCE_DIR` variable in the directory in which +the target was defined. diff --git a/Help/prop_tgt/VS_DESKTOP_EXTENSIONS_VERSION.rst b/Help/prop_tgt/VS_DESKTOP_EXTENSIONS_VERSION.rst new file mode 100644 index 000000000..19d162049 --- /dev/null +++ b/Help/prop_tgt/VS_DESKTOP_EXTENSIONS_VERSION.rst @@ -0,0 +1,10 @@ +VS_DESKTOP_EXTENSIONS_VERSION +----------------------------- + +Visual Studio Windows 10 Desktop Extensions Version + +Specifies the version of the Desktop Extensions that should be included in the +target. For example ``10.0.10240.0``. If the value is not specified, the Desktop +Extensions will not be included. To use the same version of the extensions as +the Windows 10 SDK that is being used, you can use the +:variable:`CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION` variable. diff --git a/Help/prop_tgt/VS_IOT_EXTENSIONS_VERSION.rst b/Help/prop_tgt/VS_IOT_EXTENSIONS_VERSION.rst new file mode 100644 index 000000000..27c8a3df3 --- /dev/null +++ b/Help/prop_tgt/VS_IOT_EXTENSIONS_VERSION.rst @@ -0,0 +1,10 @@ +VS_IOT_EXTENSIONS_VERSION +------------------------- + +Visual Studio Windows 10 IoT Extensions Version + +Specifies the version of the IoT Extensions that should be included in the +target. For example ``10.0.10240.0``. If the value is not specified, the IoT +Extensions will not be included. To use the same version of the extensions as +the Windows 10 SDK that is being used, you can use the +:variable:`CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION` variable. diff --git a/Help/prop_tgt/VS_IOT_STARTUP_TASK.rst b/Help/prop_tgt/VS_IOT_STARTUP_TASK.rst new file mode 100644 index 000000000..add50cb24 --- /dev/null +++ b/Help/prop_tgt/VS_IOT_STARTUP_TASK.rst @@ -0,0 +1,6 @@ +VS_IOT_STARTUP_TASK +------------------- + +Visual Studio Windows 10 IoT Continuous Background Task + +Specifies that the target should be compiled as a Continuous Background Task library. diff --git a/Help/prop_tgt/VS_MOBILE_EXTENSIONS_VERSION.rst b/Help/prop_tgt/VS_MOBILE_EXTENSIONS_VERSION.rst new file mode 100644 index 000000000..be3c9a018 --- /dev/null +++ b/Help/prop_tgt/VS_MOBILE_EXTENSIONS_VERSION.rst @@ -0,0 +1,10 @@ +VS_MOBILE_EXTENSIONS_VERSION +---------------------------- + +Visual Studio Windows 10 Mobile Extensions Version + +Specifies the version of the Mobile Extensions that should be included in the +target. For example ``10.0.10240.0``. If the value is not specified, the Mobile +Extensions will not be included. To use the same version of the extensions as +the Windows 10 SDK that is being used, you can use the +:variable:`CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION` variable. diff --git a/Help/prop_tgt/VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION.rst b/Help/prop_tgt/VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION.rst new file mode 100644 index 000000000..1ad7a7164 --- /dev/null +++ b/Help/prop_tgt/VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION.rst @@ -0,0 +1,10 @@ +VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION +-------------------------------------- + +Visual Studio Windows Target Platform Minimum Version + +For Windows 10. Specifies the minimum version of the OS that is being +targeted. For example ``10.0.10240.0``. If the value is not specified, the +value of :variable:`CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION` will be used on +WindowsStore projects otherwise the target platform minimum version will not +be specified for the project. diff --git a/Help/prop_tgt/WINDOWS_EXPORT_ALL_SYMBOLS.rst b/Help/prop_tgt/WINDOWS_EXPORT_ALL_SYMBOLS.rst new file mode 100644 index 000000000..3f48af88c --- /dev/null +++ b/Help/prop_tgt/WINDOWS_EXPORT_ALL_SYMBOLS.rst @@ -0,0 +1,18 @@ +WINDOWS_EXPORT_ALL_SYMBOLS +-------------------------- + +This property is implemented only for MS-compatible tools on Windows. + +Enable this boolean property to automatically create a module definition +(``.def``) file with all global symbols found in the input ``.obj`` files +for a ``SHARED`` library on Windows. The module definition file will be +passed to the linker causing all symbols to be exported from the ``.dll``. +For global *data* symbols, ``__declspec(dllimport)`` must still be used when +compiling against the code in the ``.dll``. All other function symbols will +be automatically exported and imported by callers. This simplifies porting +projects to Windows by reducing the need for explicit ``dllexport`` markup, +even in ``C++`` classes. + +This property is initialized by the value of +the :variable:`CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS` variable if it is set +when a target is created. diff --git a/Help/prop_tgt/XXX_OUTPUT_DIRECTORY.txt b/Help/prop_tgt/XXX_OUTPUT_DIRECTORY.txt index 0b3d31c29..3ae54484a 100644 --- a/Help/prop_tgt/XXX_OUTPUT_DIRECTORY.txt +++ b/Help/prop_tgt/XXX_OUTPUT_DIRECTORY.txt @@ -1,8 +1,11 @@ Output directory in which to build |XXX| target files. This property specifies the directory into which |xxx| target files -should be built. Multi-configuration generators (VS, Xcode) append a -per-configuration subdirectory to the specified directory. +should be built. The property value may use +:manual:`generator expressions `. +Multi-configuration generators (VS, Xcode) append a per-configuration +subdirectory to the specified directory unless a generator expression +is used. This property is initialized by the value of the variable |CMAKE_XXX_OUTPUT_DIRECTORY| if it is set when a target is created. diff --git a/Help/release/3.4.rst b/Help/release/3.4.rst new file mode 100644 index 000000000..89c5561d3 --- /dev/null +++ b/Help/release/3.4.rst @@ -0,0 +1,273 @@ +CMake 3.4 Release Notes +*********************** + +.. only:: html + + .. contents:: + +Changes made since CMake 3.3 include the following. + +New Features +============ + +Generators +---------- + +* The :generator:`Visual Studio 14 2015` generator learned to select + a Windows 10 SDK based on the value of the :variable:`CMAKE_SYSTEM_VERSION` + variable and the SDKs available on the host. + +* CMake learned rudimentary support for the Apple Swift language. When using + the :generator:`Xcode` generator with Xcode 6.1 or higher, one may enable + the ``Swift`` language with the :command:`enable_language` command or the + :command:`project` command (this is an error with other generators or when + Xcode is too old). Then one may list ``.swift`` source files in targets + for compilation. + +Commands +-------- + +* The :command:`find_program` command learned a ``NAMES_PER_DIR`` + option to consider all given ``NAMES`` in each directory before + moving on to the next directory. + +* The :command:`get_filename_component` command learned a new ``BASE_DIR`` + subcommand. This is used to specify a base directory when calculating an + absolute path from a relative path. + +* The :command:`if` command learned a new ``TEST`` operator that evaluates + to true if a given test name has been defined by the :command:`add_test` + command. See policy :policy:`CMP0064`. + +* The :command:`install(DIRECTORY)` command ``DESTINATION`` option learned to + support :manual:`generator expressions `. + +* The :command:`install(FILES)` command ``DESTINATION`` option learned to + support :manual:`generator expressions `. + +* The :command:`string` command learned a new ``APPEND`` subcommand. + +Variables +--------- + +* The :ref:`Makefile Generators` and the :generator:`Ninja` generator + learned to add compiler launcher tools like distcc and ccache along + with the compiler for ``C`` and ``CXX`` languages. See the + :variable:`CMAKE__COMPILER_LAUNCHER` variable and + :prop_tgt:`_COMPILER_LAUNCHER` target property for details. + +* New :variable:`CMAKE_LINK_SEARCH_START_STATIC` and + :variable:`CMAKE_LINK_SEARCH_END_STATIC` variables were + introduced to initialize the + :prop_tgt:`LINK_SEARCH_START_STATIC` and + :prop_tgt:`LINK_SEARCH_END_STATIC` target properties, + respectively. + +Properties +---------- + +* :ref:`Visual Studio Generators` learned to support additonal + target properties to customize projects for NVIDIA Nsight + Tegra Visual Studio Edition: + + * :prop_tgt:`ANDROID_ANT_ADDITIONAL_OPTIONS` + * :prop_tgt:`ANDROID_ARCH` + * :prop_tgt:`ANDROID_ASSETS_DIRECTORIES` + * :prop_tgt:`ANDROID_JAR_DEPENDENCIES` + * :prop_tgt:`ANDROID_JAR_DIRECTORIES` + * :prop_tgt:`ANDROID_JAVA_SOURCE_DIR` + * :prop_tgt:`ANDROID_NATIVE_LIB_DEPENDENCIES` + * :prop_tgt:`ANDROID_NATIVE_LIB_DIRECTORIES` + * :prop_tgt:`ANDROID_PROCESS_MAX` + * :prop_tgt:`ANDROID_PROGUARD` + * :prop_tgt:`ANDROID_PROGUARD_CONFIG_PATH` + * :prop_tgt:`ANDROID_SECURE_PROPS_PATH` + * :prop_tgt:`ANDROID_SKIP_ANT_STEP` + * :prop_tgt:`ANDROID_STL_TYPE` + +* The :prop_tgt:`ARCHIVE_OUTPUT_DIRECTORY`, + :prop_tgt:`LIBRARY_OUTPUT_DIRECTORY`, and + :prop_tgt:`RUNTIME_OUTPUT_DIRECTORY` target properties learned to + support :manual:`generator expressions `. + +* The :prop_tgt:`SOURCE_DIR` and :prop_tgt:`BINARY_DIR` target properties + were introduced to allow project code to query where a target is defined. + +* The :prop_tgt:`OUTPUT_NAME` target property and its variants learned to + support :manual:`generator expressions `. + +* A :prop_gbl:`TARGET_MESSAGES` global property was added to tell the + :ref:`Makefile Generators` whether to generate commands to print output + after each target is completed. + +* On Windows with MS-compatible tools, CMake learned to optionally + generate a module definition (``.def``) file for ``SHARED`` libraries. + See the :prop_tgt:`WINDOWS_EXPORT_ALL_SYMBOLS` target property. + +Modules +------- + +* The :module:`ExternalProject` module :command:`ExternalProject_Add` + function ``GIT_SUBMODULES`` option now also limits the set of + submodules that are initialized in addition to the prior behavior + of limiting the set of submodules that are updated. + +* The :module:`ExternalProject` module learned new ``USES_TERMINAL`` + arguments for giving steps exclusive terminal access. This is + useful with the :generator:`Ninja` generator to monitor CMake + superbuild progress and prevent CPU oversubscription. + +* The :module:`FindBISON` module ``BISON_TARGET`` macro learned a + new ``DEFINES_FILE`` option to specify a custom output header + to be generated. + +* The :module:`FindHDF5` module learend a new ``HDF5_PREFER_PARALLEL`` + option allowing users to specify that a parallel HDF5 tool is + preferred if both are available. + +* The :module:`FindIce` module now provides imported targets. + +* The :module:`FindJava` module learned to optionally find + the ``idlj`` and ``jarsigner`` tools. + +* The :module:`FindOpenSSL` module now provides imported targets. + +* The :module:`FindOpenSSL` module learned a new ``OPENSSL_USE_STATIC_LIBS`` + option to search only for static libraries. + +* The :module:`FindPkgConfig` learned a new :command:`pkg_get_variable` + command which may be used to query for arbitrary variables from a package + (such as for related tools or data and plugin install paths). + +* The :module:`FindProtobuf` module gained a new + :command:`protobuf_generate_python` function to generate python + sources from ``.proto`` files. + +* The :module:`FindTIFF` module learned to search separately for + debug and release variants. + +* The :module:`FindwxWidgets` module learned to support version requests. + +* The :module:`FindXercesC` module learned to search separately for + debug and release variants. + +* The :module:`FindZLIB` module learned to search separately for + debug and release variants. + +* The :module:`GNUInstallDirs` module learned special default values + for certain installation prefixes according to the `GNU Coding + Standards`_ and the `Filesystem Hierarchy Standard`_. + +* The :module:`UseJava` module ``add_jar`` function learned + to support response files (e.g. ``@srcs.txt``) for source + specification. + +* The :module:`UseJava` module ``install_jar`` function learned + new ``DESTINATION`` and ``COMPONENT`` options to specify + the corresponding :command:`install` command options. + +* The :module:`UseJava` module gained a new ``create_javah`` + function to create C headers from Java classes. + +.. _`GNU Coding Standards`: https://www.gnu.org/prep/standards/html_node/Directory-Variables.html +.. _`Filesystem Hierarchy Standard`: https://refspecs.linuxfoundation.org/FHS_3.0/fhs/index.html + +Generator Expressions +--------------------- + +* A new ``$`` + :manual:`generator expression ` + has been added. + +CTest +----- + +* CTest learned to optionally measure the CPU load during parallel + testing and avoid starting tests that may cause the load to exceed + a given threshold. See the :manual:`ctest(1)` command ``--test-load`` + option, the ``TestLoad`` setting of the :ref:`CTest Test Step`, + the :variable:`CTEST_TEST_LOAD` variable, and the ``TEST_LOAD`` + option of the :command:`ctest_test` command. + +* :manual:`ctest(1)` learned options + ``--test-output-size-passed`` and ``--test-output-size-failed`` + to customize the limit on test output size submitted when + running as a :ref:`Dashboard Client`. + +CPack +----- + +* The :module:`CPackDeb` module learned to set package dependencies + per component. See variables: + + * :variable:`CPACK_DEBIAN__PACKAGE_BREAKS` + * :variable:`CPACK_DEBIAN__PACKAGE_CONFLICTS` + * :variable:`CPACK_DEBIAN__PACKAGE_ENHANCES` + * :variable:`CPACK_DEBIAN__PACKAGE_PREDEPENDS` + * :variable:`CPACK_DEBIAN__PACKAGE_PROVIDES` + * :variable:`CPACK_DEBIAN__PACKAGE_RECOMMENDS` + * :variable:`CPACK_DEBIAN__PACKAGE_REPLACES` + * :variable:`CPACK_DEBIAN__PACKAGE_SUGGESTS` + +* The :module:`CPack` module learned to package empty directories. + +* The :module:`CPack` module gained a new setting, ``CPACK_VERBATIM_VARIABLES``, + which can be used to ensure the cpack program receives the settings' values + exactly as they were set, even if they contain CMake-special characters. + For compatibility, it's off by default. + +Other +----- + +* The :manual:`Compile Features ` functionality + is now aware of features supported by GNU C compilers on Windows. + +* CMake learned to honor ``*.manifest`` source files with MSVC tools. + Manifest files named as sources of ``.exe`` and ``.dll`` targets + will be merged with linker-generated manifests and embedded in the + binary. + +* The `Concurrent Fortran 77 `__ compiler is now supported. + Its :variable:`compiler id _COMPILER_ID>` is ``CCur``. + +* :manual:`cmake(1)` gained a new ``--trace-expand`` command line option + that is like ``--trace`` but expands variable references in the output. + +Deprecated and Removed Features +=============================== + +* The :module:`CMakeExpandImportedTargets` module is now documented + as deprecated. See module documentation for an explanation. + +* The :variable:`CMAKE_USE_RELATIVE_PATHS` variable no longer has any + effect. Previously it was partially implemented and unreliable. + +Other Changes +============= + +* The :module:`CheckFunctionExists`, :module:`CheckLibraryExists`, + :module:`CheckSymbolExists`, and :module:`FindThreads` modules learned to + work in environments where only CXX is enabled. + +* The :module:`CPackDeb` module now correctly excludes symlinks during package + checksum calculation. + +* The :module:`CPackDeb` no longer uses fakeroot and system tar program for + packaging. + +* The :module:`CPack` module no longer mangles settings with CMake-special + characters when they're used as defaults for other settings. The macro + ``cpack_set_if_not_set``, which was responsible for this, is now deprecated. + +* CMake no longer links executables with flags to export symbols + unless the :prop_tgt:`ENABLE_EXPORTS` target property is set. + See policy :policy:`CMP0065`. + +* The ``SONAME`` field is no longer set for ``MODULE`` libraries + created with the :command:`add_library` command. ``MODULE`` + libraries are meant for explicit dynamic loading at runtime. + They cannot be linked so ``SONAME`` is not useful. + +* The internal :variable:`CMAKE__COMPILE_OBJECT` rule variable now + substitutes compiler include flags in a separate ```` placeholder + instead of the main ```` placeholder. diff --git a/Help/release/index.rst b/Help/release/index.rst index 6b98e48e1..5d1a3f76a 100644 --- a/Help/release/index.rst +++ b/Help/release/index.rst @@ -11,6 +11,7 @@ Releases .. toctree:: :maxdepth: 1 + 3.4 <3.4> 3.3 <3.3> 3.2 <3.2> 3.1 <3.1> diff --git a/Help/variable/APPLE.rst b/Help/variable/APPLE.rst index 3afdee867..a8d2429ad 100644 --- a/Help/variable/APPLE.rst +++ b/Help/variable/APPLE.rst @@ -1,6 +1,6 @@ APPLE ----- -True if running on Mac OS X. +``True`` if running on Mac OS X. -Set to true on Mac OS X. +Set to ``true`` on Mac OS X. diff --git a/Help/variable/BORLAND.rst b/Help/variable/BORLAND.rst index 4af6085bf..badb7338e 100644 --- a/Help/variable/BORLAND.rst +++ b/Help/variable/BORLAND.rst @@ -1,6 +1,6 @@ BORLAND ------- -True if the Borland compiler is being used. +``True`` if the Borland compiler is being used. -This is set to true if the Borland compiler is being used. +This is set to ``true`` if the Borland compiler is being used. diff --git a/Help/variable/BUILD_SHARED_LIBS.rst b/Help/variable/BUILD_SHARED_LIBS.rst index 6f30efba1..53087b23b 100644 --- a/Help/variable/BUILD_SHARED_LIBS.rst +++ b/Help/variable/BUILD_SHARED_LIBS.rst @@ -1,10 +1,10 @@ BUILD_SHARED_LIBS ----------------- -Global flag to cause add_library to create shared libraries if on. +Global flag to cause :command:`add_library` to create shared libraries if on. If present and true, this will cause all libraries to be built shared unless the library was explicitly added as a static library. This -variable is often added to projects as an OPTION so that each user of -a project can decide if they want to build the project using shared or +variable is often added to projects as an :command:`option` so that each user +of a project can decide if they want to build the project using shared or static libraries. diff --git a/Help/variable/CMAKE_ABSOLUTE_DESTINATION_FILES.rst b/Help/variable/CMAKE_ABSOLUTE_DESTINATION_FILES.rst index 36914536c..b6d00543a 100644 --- a/Help/variable/CMAKE_ABSOLUTE_DESTINATION_FILES.rst +++ b/Help/variable/CMAKE_ABSOLUTE_DESTINATION_FILES.rst @@ -1,9 +1,9 @@ CMAKE_ABSOLUTE_DESTINATION_FILES -------------------------------- -List of files which have been installed using an ABSOLUTE DESTINATION path. +List of files which have been installed using an ``ABSOLUTE DESTINATION`` path. -This variable is defined by CMake-generated cmake_install.cmake +This variable is defined by CMake-generated ``cmake_install.cmake`` scripts. It can be used (read-only) by programs or scripts that source those install scripts. This is used by some CPack generators (e.g. RPM). diff --git a/Help/variable/CMAKE_ANDROID_ANT_ADDITIONAL_OPTIONS.rst b/Help/variable/CMAKE_ANDROID_ANT_ADDITIONAL_OPTIONS.rst new file mode 100644 index 000000000..8862ba91d --- /dev/null +++ b/Help/variable/CMAKE_ANDROID_ANT_ADDITIONAL_OPTIONS.rst @@ -0,0 +1,5 @@ +CMAKE_ANDROID_ANT_ADDITIONAL_OPTIONS +------------------------------------ + +Default value for the :prop_tgt:`ANDROID_ANT_ADDITIONAL_OPTIONS` target property. +See that target property for additional information. diff --git a/Help/variable/CMAKE_ANDROID_ARCH.rst b/Help/variable/CMAKE_ANDROID_ARCH.rst new file mode 100644 index 000000000..8fbb46d53 --- /dev/null +++ b/Help/variable/CMAKE_ANDROID_ARCH.rst @@ -0,0 +1,5 @@ +CMAKE_ANDROID_ARCH +------------------ + +Default value for the :prop_tgt:`ANDROID_ARCH` target property. +See that target property for additional information. diff --git a/Help/variable/CMAKE_ANDROID_ASSETS_DIRECTORIES.rst b/Help/variable/CMAKE_ANDROID_ASSETS_DIRECTORIES.rst new file mode 100644 index 000000000..c372fe449 --- /dev/null +++ b/Help/variable/CMAKE_ANDROID_ASSETS_DIRECTORIES.rst @@ -0,0 +1,5 @@ +CMAKE_ANDROID_ASSETS_DIRECTORIES +-------------------------------- + +Default value for the :prop_tgt:`ANDROID_ASSETS_DIRECTORIES` target property. +See that target property for additional information. diff --git a/Help/variable/CMAKE_ANDROID_JAR_DEPENDENCIES.rst b/Help/variable/CMAKE_ANDROID_JAR_DEPENDENCIES.rst new file mode 100644 index 000000000..451a92960 --- /dev/null +++ b/Help/variable/CMAKE_ANDROID_JAR_DEPENDENCIES.rst @@ -0,0 +1,5 @@ +CMAKE_ANDROID_JAR_DEPENDENCIES +------------------------------ + +Default value for the :prop_tgt:`ANDROID_JAR_DEPENDENCIES` target property. +See that target property for additional information. diff --git a/Help/variable/CMAKE_ANDROID_JAR_DIRECTORIES.rst b/Help/variable/CMAKE_ANDROID_JAR_DIRECTORIES.rst new file mode 100644 index 000000000..af83e3430 --- /dev/null +++ b/Help/variable/CMAKE_ANDROID_JAR_DIRECTORIES.rst @@ -0,0 +1,5 @@ +CMAKE_ANDROID_JAR_DIRECTORIES +----------------------------- + +Default value for the :prop_tgt:`ANDROID_JAR_DIRECTORIES` target property. +See that target property for additional information. diff --git a/Help/variable/CMAKE_ANDROID_JAVA_SOURCE_DIR.rst b/Help/variable/CMAKE_ANDROID_JAVA_SOURCE_DIR.rst new file mode 100644 index 000000000..3dc05e05e --- /dev/null +++ b/Help/variable/CMAKE_ANDROID_JAVA_SOURCE_DIR.rst @@ -0,0 +1,5 @@ +CMAKE_ANDROID_JAVA_SOURCE_DIR +----------------------------- + +Default value for the :prop_tgt:`ANDROID_JAVA_SOURCE_DIR` target property. +See that target property for additional information. diff --git a/Help/variable/CMAKE_ANDROID_NATIVE_LIB_DEPENDENCIES.rst b/Help/variable/CMAKE_ANDROID_NATIVE_LIB_DEPENDENCIES.rst new file mode 100644 index 000000000..4191907d4 --- /dev/null +++ b/Help/variable/CMAKE_ANDROID_NATIVE_LIB_DEPENDENCIES.rst @@ -0,0 +1,5 @@ +CMAKE_ANDROID_NATIVE_LIB_DEPENDENCIES +------------------------------------- + +Default value for the :prop_tgt:`ANDROID_NATIVE_LIB_DEPENDENCIES` target +property. See that target property for additional information. diff --git a/Help/variable/CMAKE_ANDROID_NATIVE_LIB_DIRECTORIES.rst b/Help/variable/CMAKE_ANDROID_NATIVE_LIB_DIRECTORIES.rst new file mode 100644 index 000000000..7cb95274e --- /dev/null +++ b/Help/variable/CMAKE_ANDROID_NATIVE_LIB_DIRECTORIES.rst @@ -0,0 +1,5 @@ +CMAKE_ANDROID_NATIVE_LIB_DIRECTORIES +------------------------------------ + +Default value for the :prop_tgt:`ANDROID_NATIVE_LIB_DIRECTORIES` target +property. See that target property for additional information. diff --git a/Help/variable/CMAKE_ANDROID_PROCESS_MAX.rst b/Help/variable/CMAKE_ANDROID_PROCESS_MAX.rst new file mode 100644 index 000000000..19fb527f7 --- /dev/null +++ b/Help/variable/CMAKE_ANDROID_PROCESS_MAX.rst @@ -0,0 +1,5 @@ +CMAKE_ANDROID_PROCESS_MAX +------------------------- + +Default value for the :prop_tgt:`ANDROID_PROCESS_MAX` target property. +See that target property for additional information. diff --git a/Help/variable/CMAKE_ANDROID_PROGUARD.rst b/Help/variable/CMAKE_ANDROID_PROGUARD.rst new file mode 100644 index 000000000..b8fdd46cc --- /dev/null +++ b/Help/variable/CMAKE_ANDROID_PROGUARD.rst @@ -0,0 +1,5 @@ +CMAKE_ANDROID_PROGUARD +---------------------- + +Default value for the :prop_tgt:`ANDROID_PROGUARD` target property. +See that target property for additional information. diff --git a/Help/variable/CMAKE_ANDROID_PROGUARD_CONFIG_PATH.rst b/Help/variable/CMAKE_ANDROID_PROGUARD_CONFIG_PATH.rst new file mode 100644 index 000000000..8dea00907 --- /dev/null +++ b/Help/variable/CMAKE_ANDROID_PROGUARD_CONFIG_PATH.rst @@ -0,0 +1,5 @@ +CMAKE_ANDROID_PROGUARD_CONFIG_PATH +---------------------------------- + +Default value for the :prop_tgt:`ANDROID_PROGUARD_CONFIG_PATH` target property. +See that target property for additional information. diff --git a/Help/variable/CMAKE_ANDROID_SECURE_PROPS_PATH.rst b/Help/variable/CMAKE_ANDROID_SECURE_PROPS_PATH.rst new file mode 100644 index 000000000..69a4d0b56 --- /dev/null +++ b/Help/variable/CMAKE_ANDROID_SECURE_PROPS_PATH.rst @@ -0,0 +1,5 @@ +CMAKE_ANDROID_SECURE_PROPS_PATH +------------------------------- + +Default value for the :prop_tgt:`ANDROID_SECURE_PROPS_PATH` target property. +See that target property for additional information. diff --git a/Help/variable/CMAKE_ANDROID_SKIP_ANT_STEP.rst b/Help/variable/CMAKE_ANDROID_SKIP_ANT_STEP.rst new file mode 100644 index 000000000..0a96df9fa --- /dev/null +++ b/Help/variable/CMAKE_ANDROID_SKIP_ANT_STEP.rst @@ -0,0 +1,5 @@ +CMAKE_ANDROID_SKIP_ANT_STEP +--------------------------- + +Default value for the :prop_tgt:`ANDROID_SKIP_ANT_STEP` target property. +See that target property for additional information. diff --git a/Help/variable/CMAKE_ANDROID_STL_TYPE.rst b/Help/variable/CMAKE_ANDROID_STL_TYPE.rst new file mode 100644 index 000000000..766b2c8fd --- /dev/null +++ b/Help/variable/CMAKE_ANDROID_STL_TYPE.rst @@ -0,0 +1,5 @@ +CMAKE_ANDROID_STL_TYPE +---------------------- + +Default value for the :prop_tgt:`ANDROID_STL_TYPE` target property. +See that target property for additional information. diff --git a/Help/variable/CMAKE_ARGC.rst b/Help/variable/CMAKE_ARGC.rst index be120b8fe..aec97119a 100644 --- a/Help/variable/CMAKE_ARGC.rst +++ b/Help/variable/CMAKE_ARGC.rst @@ -3,5 +3,6 @@ CMAKE_ARGC Number of command line arguments passed to CMake in script mode. -When run in -P script mode, CMake sets this variable to the number of -command line arguments. See also CMAKE_ARGV0, 1, 2 ... +When run in :ref:`-P ` script mode, CMake sets this variable to +the number of command line arguments. See also :variable:`CMAKE_ARGV0`, +``1``, ``2`` ... diff --git a/Help/variable/CMAKE_ARGV0.rst b/Help/variable/CMAKE_ARGV0.rst index e5ed41963..8b1ecb79e 100644 --- a/Help/variable/CMAKE_ARGV0.rst +++ b/Help/variable/CMAKE_ARGV0.rst @@ -3,7 +3,7 @@ CMAKE_ARGV0 Command line argument passed to CMake in script mode. -When run in -P script mode, CMake sets this variable to the first -command line argument. It then also sets CMAKE_ARGV1, CMAKE_ARGV2, -... and so on, up to the number of command line arguments given. See -also CMAKE_ARGC. +When run in :ref:`-P ` script mode, CMake sets this variable to +the first command line argument. It then also sets ``CMAKE_ARGV1``, +``CMAKE_ARGV2``, ... and so on, up to the number of command line arguments +given. See also :variable:`CMAKE_ARGC`. diff --git a/Help/variable/CMAKE_AUTOMOC_RELAXED_MODE.rst b/Help/variable/CMAKE_AUTOMOC_RELAXED_MODE.rst index a814d408b..addc62de4 100644 --- a/Help/variable/CMAKE_AUTOMOC_RELAXED_MODE.rst +++ b/Help/variable/CMAKE_AUTOMOC_RELAXED_MODE.rst @@ -3,11 +3,11 @@ CMAKE_AUTOMOC_RELAXED_MODE Switch between strict and relaxed automoc mode. -By default, :prop_tgt:`AUTOMOC` behaves exactly as described in the documentation -of the :prop_tgt:`AUTOMOC` target property. When set to ``TRUE``, it accepts more -input and tries to find the correct input file for ``moc`` even if it -differs from the documented behaviour. In this mode it e.g. also -checks whether a header file is intended to be processed by moc when a -``"foo.moc"`` file has been included. +By default, :prop_tgt:`AUTOMOC` behaves exactly as described in the +documentation of the :prop_tgt:`AUTOMOC` target property. When set to +``TRUE``, it accepts more input and tries to find the correct input file for +``moc`` even if it differs from the documented behaviour. In this mode it +e.g. also checks whether a header file is intended to be processed by moc +when a ``"foo.moc"`` file has been included. Relaxed mode has to be enabled for KDE4 compatibility. diff --git a/Help/variable/CMAKE_AUTORCC.rst b/Help/variable/CMAKE_AUTORCC.rst index 067f76611..742610541 100644 --- a/Help/variable/CMAKE_AUTORCC.rst +++ b/Help/variable/CMAKE_AUTORCC.rst @@ -3,5 +3,5 @@ CMAKE_AUTORCC Whether to handle ``rcc`` automatically for Qt targets. -This variable is used to initialize the :prop_tgt:`AUTORCC` property on all the targets. -See that target property for additional information. +This variable is used to initialize the :prop_tgt:`AUTORCC` property on all +the targets. See that target property for additional information. diff --git a/Help/variable/CMAKE_AUTOUIC.rst b/Help/variable/CMAKE_AUTOUIC.rst index 0beb55590..5abefaab8 100644 --- a/Help/variable/CMAKE_AUTOUIC.rst +++ b/Help/variable/CMAKE_AUTOUIC.rst @@ -3,5 +3,5 @@ CMAKE_AUTOUIC Whether to handle ``uic`` automatically for Qt targets. -This variable is used to initialize the :prop_tgt:`AUTOUIC` property on all the targets. -See that target property for additional information. +This variable is used to initialize the :prop_tgt:`AUTOUIC` property on all +the targets. See that target property for additional information. diff --git a/Help/variable/CMAKE_BINARY_DIR.rst b/Help/variable/CMAKE_BINARY_DIR.rst index 703bb58c7..f8dd8ab8d 100644 --- a/Help/variable/CMAKE_BINARY_DIR.rst +++ b/Help/variable/CMAKE_BINARY_DIR.rst @@ -5,4 +5,4 @@ The path to the top level of the build tree. This is the full path to the top level of the current CMake build tree. For an in-source build, this would be the same as -CMAKE_SOURCE_DIR. +:variable:`CMAKE_SOURCE_DIR`. diff --git a/Help/variable/CMAKE_BUILD_TYPE.rst b/Help/variable/CMAKE_BUILD_TYPE.rst index 68f08baba..2d54d6049 100644 --- a/Help/variable/CMAKE_BUILD_TYPE.rst +++ b/Help/variable/CMAKE_BUILD_TYPE.rst @@ -4,16 +4,17 @@ CMAKE_BUILD_TYPE Specifies the build type on single-configuration generators. This statically specifies what build type (configuration) will be -built in this build tree. Possible values are empty, Debug, Release, -RelWithDebInfo and MinSizeRel. This variable is only meaningful to -single-configuration generators (such as make and Ninja) i.e. those -which choose a single configuration when CMake runs to generate a -build tree as opposed to multi-configuration generators which offer -selection of the build configuration within the generated build +built in this build tree. Possible values are empty, ``Debug``, ``Release``, +``RelWithDebInfo`` and ``MinSizeRel``. This variable is only meaningful to +single-configuration generators (such as :ref:`Makefile Generators` and +:generator:`Ninja`) i.e. those which choose a single configuration when CMake +runs to generate a build tree as opposed to multi-configuration generators +which offer selection of the build configuration within the generated build environment. There are many per-config properties and variables -(usually following clean SOME_VAR_ order conventions), such as -CMAKE_C_FLAGS_, specified as uppercase: -CMAKE_C_FLAGS_[DEBUG|RELEASE|RELWITHDEBINFO|MINSIZEREL]. For example, -in a build tree configured to build type Debug, CMake will see to -having CMAKE_C_FLAGS_DEBUG settings get added to the CMAKE_C_FLAGS -settings. See also CMAKE_CONFIGURATION_TYPES. +(usually following clean ``SOME_VAR_`` order conventions), such as +``CMAKE_C_FLAGS_``, specified as uppercase: +``CMAKE_C_FLAGS_[DEBUG|RELEASE|RELWITHDEBINFO|MINSIZEREL]``. For example, +in a build tree configured to build type ``Debug``, CMake will see to +having :variable:`CMAKE_C_FLAGS_DEBUG _FLAGS_DEBUG>` settings get +added to the :variable:`CMAKE_C_FLAGS _FLAGS>` settings. See +also :variable:`CMAKE_CONFIGURATION_TYPES`. diff --git a/Help/variable/CMAKE_BUILD_WITH_INSTALL_RPATH.rst b/Help/variable/CMAKE_BUILD_WITH_INSTALL_RPATH.rst index 6875da6aa..5b59a6ef2 100644 --- a/Help/variable/CMAKE_BUILD_WITH_INSTALL_RPATH.rst +++ b/Help/variable/CMAKE_BUILD_WITH_INSTALL_RPATH.rst @@ -1,11 +1,11 @@ CMAKE_BUILD_WITH_INSTALL_RPATH ------------------------------ -Use the install path for the RPATH +Use the install path for the ``RPATH``. -Normally CMake uses the build tree for the RPATH when building -executables etc on systems that use RPATH. When the software is +Normally CMake uses the build tree for the ``RPATH`` when building +executables etc on systems that use ``RPATH``. When the software is installed the executables etc are relinked by CMake to have the -install RPATH. If this variable is set to true then the software is -always built with the install path for the RPATH and does not need to +install ``RPATH``. If this variable is set to true then the software is +always built with the install path for the ``RPATH`` and does not need to be relinked when installed. diff --git a/Help/variable/CMAKE_CACHEFILE_DIR.rst b/Help/variable/CMAKE_CACHEFILE_DIR.rst index 78c7d93d1..8604d0e8c 100644 --- a/Help/variable/CMAKE_CACHEFILE_DIR.rst +++ b/Help/variable/CMAKE_CACHEFILE_DIR.rst @@ -1,7 +1,7 @@ CMAKE_CACHEFILE_DIR ------------------- -The directory with the CMakeCache.txt file. +The directory with the ``CMakeCache.txt`` file. -This is the full path to the directory that has the CMakeCache.txt -file in it. This is the same as CMAKE_BINARY_DIR. +This is the full path to the directory that has the ``CMakeCache.txt`` +file in it. This is the same as :variable:`CMAKE_BINARY_DIR`. diff --git a/Help/variable/CMAKE_CACHE_MAJOR_VERSION.rst b/Help/variable/CMAKE_CACHE_MAJOR_VERSION.rst index e6887d9ed..1e53ed62d 100644 --- a/Help/variable/CMAKE_CACHE_MAJOR_VERSION.rst +++ b/Help/variable/CMAKE_CACHE_MAJOR_VERSION.rst @@ -1,7 +1,7 @@ CMAKE_CACHE_MAJOR_VERSION ------------------------- -Major version of CMake used to create the CMakeCache.txt file +Major version of CMake used to create the ``CMakeCache.txt`` file This stores the major version of CMake used to write a CMake cache file. It is only different when a different version of CMake is run diff --git a/Help/variable/CMAKE_CACHE_MINOR_VERSION.rst b/Help/variable/CMAKE_CACHE_MINOR_VERSION.rst index 799f0a98a..5d174a3c9 100644 --- a/Help/variable/CMAKE_CACHE_MINOR_VERSION.rst +++ b/Help/variable/CMAKE_CACHE_MINOR_VERSION.rst @@ -1,7 +1,7 @@ CMAKE_CACHE_MINOR_VERSION ------------------------- -Minor version of CMake used to create the CMakeCache.txt file +Minor version of CMake used to create the ``CMakeCache.txt`` file This stores the minor version of CMake used to write a CMake cache file. It is only different when a different version of CMake is run diff --git a/Help/variable/CMAKE_CACHE_PATCH_VERSION.rst b/Help/variable/CMAKE_CACHE_PATCH_VERSION.rst index e67d5444e..22d267c98 100644 --- a/Help/variable/CMAKE_CACHE_PATCH_VERSION.rst +++ b/Help/variable/CMAKE_CACHE_PATCH_VERSION.rst @@ -1,7 +1,7 @@ CMAKE_CACHE_PATCH_VERSION ------------------------- -Patch version of CMake used to create the CMakeCache.txt file +Patch version of CMake used to create the ``CMakeCache.txt`` file This stores the patch version of CMake used to write a CMake cache file. It is only different when a different version of CMake is run diff --git a/Help/variable/CMAKE_CFG_INTDIR.rst b/Help/variable/CMAKE_CFG_INTDIR.rst index 55f7b0141..dcc1aede1 100644 --- a/Help/variable/CMAKE_CFG_INTDIR.rst +++ b/Help/variable/CMAKE_CFG_INTDIR.rst @@ -4,11 +4,11 @@ CMAKE_CFG_INTDIR Build-time reference to per-configuration output subdirectory. For native build systems supporting multiple configurations in the -build tree (such as Visual Studio and Xcode), the value is a reference -to a build-time variable specifying the name of the per-configuration -output subdirectory. On Makefile generators this evaluates to "." -because there is only one configuration in a build tree. Example -values: +build tree (such as :ref:`Visual Studio Generators` and :generator:`Xcode`), +the value is a reference to a build-time variable specifying the name +of the per-configuration output subdirectory. On :ref:`Makefile Generators` +this evaluates to `.` because there is only one configuration in a build tree. +Example values: :: @@ -33,13 +33,14 @@ evaluated at build time. Example of intended usage: ) add_custom_target(drive ALL DEPENDS out.txt) -Note that CMAKE_CFG_INTDIR is no longer necessary for this purpose but +Note that ``CMAKE_CFG_INTDIR`` is no longer necessary for this purpose but has been left for compatibility with existing projects. Instead -add_custom_command() recognizes executable target names in its COMMAND -option, so "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/mytool" -can be replaced by just "mytool". +:command:`add_custom_command` recognizes executable target names in its +``COMMAND`` option, so +``${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/mytool`` can be replaced +by just ``mytool``. This variable is read-only. Setting it is undefined behavior. In multi-configuration build systems the value of this variable is passed -as the value of preprocessor symbol "CMAKE_INTDIR" to the compilation +as the value of preprocessor symbol ``CMAKE_INTDIR`` to the compilation of all source files. diff --git a/Help/variable/CMAKE_CL_64.rst b/Help/variable/CMAKE_CL_64.rst index 509682961..a1e86a552 100644 --- a/Help/variable/CMAKE_CL_64.rst +++ b/Help/variable/CMAKE_CL_64.rst @@ -1,6 +1,6 @@ CMAKE_CL_64 ----------- -Using the 64 bit compiler from Microsoft +Using the 64-bit compiler from Microsoft -Set to true when using the 64 bit cl compiler from Microsoft. +Set to ``true`` when using the 64-bit ``cl`` compiler from Microsoft. diff --git a/Help/variable/CMAKE_COLOR_MAKEFILE.rst b/Help/variable/CMAKE_COLOR_MAKEFILE.rst index 170baf3b2..bb86eccc5 100644 --- a/Help/variable/CMAKE_COLOR_MAKEFILE.rst +++ b/Help/variable/CMAKE_COLOR_MAKEFILE.rst @@ -1,7 +1,7 @@ CMAKE_COLOR_MAKEFILE -------------------- -Enables color output when using the Makefile generator. +Enables color output when using the :ref:`Makefile Generators`. When enabled, the generated Makefiles will produce colored output. -Default is ON. +Default is ``ON``. diff --git a/Help/variable/CMAKE_COMMAND.rst b/Help/variable/CMAKE_COMMAND.rst index f4e5f1e44..f80b46cb5 100644 --- a/Help/variable/CMAKE_COMMAND.rst +++ b/Help/variable/CMAKE_COMMAND.rst @@ -1,8 +1,8 @@ CMAKE_COMMAND ------------- -The full path to the cmake executable. +The full path to the :manual:`cmake(1)` executable. -This is the full path to the CMake executable cmake which is useful -from custom commands that want to use the cmake -E option for portable -system commands. (e.g. /usr/local/bin/cmake +This is the full path to the CMake executable :manual:`cmake(1)` which is +useful from custom commands that want to use the ``cmake -E`` option for +portable system commands. (e.g. ``/usr/local/bin/cmake``) diff --git a/Help/variable/CMAKE_COMPILER_IS_GNULANG.rst b/Help/variable/CMAKE_COMPILER_IS_GNULANG.rst index bc5652f00..4b652c008 100644 --- a/Help/variable/CMAKE_COMPILER_IS_GNULANG.rst +++ b/Help/variable/CMAKE_COMPILER_IS_GNULANG.rst @@ -3,10 +3,10 @@ CMAKE_COMPILER_IS_GNU True if the compiler is GNU. -If the selected compiler is the GNU compiler then this is TRUE, -if not it is FALSE. Unlike the other per-language variables, this +If the selected ```` compiler is the GNU compiler then this is ``TRUE``, +if not it is ``FALSE``. Unlike the other per-language variables, this uses the GNU syntax for identifying languages instead of the CMake -syntax. Recognized values of the suffix are: +syntax. Recognized values of the ```` suffix are: :: diff --git a/Help/variable/CMAKE_CONFIGURATION_TYPES.rst b/Help/variable/CMAKE_CONFIGURATION_TYPES.rst index 986b969ee..34e99ebf7 100644 --- a/Help/variable/CMAKE_CONFIGURATION_TYPES.rst +++ b/Help/variable/CMAKE_CONFIGURATION_TYPES.rst @@ -4,7 +4,7 @@ CMAKE_CONFIGURATION_TYPES Specifies the available build types on multi-config generators. This specifies what build types (configurations) will be available -such as Debug, Release, RelWithDebInfo etc. This has reasonable +such as ``Debug``, ``Release``, ``RelWithDebInfo`` etc. This has reasonable defaults on most platforms, but can be extended to provide other build -types. See also CMAKE_BUILD_TYPE for details of managing -configuration data, and CMAKE_CFG_INTDIR. +types. See also :variable:`CMAKE_BUILD_TYPE` for details of managing +configuration data, and :variable:`CMAKE_CFG_INTDIR`. diff --git a/Help/variable/CMAKE_CONFIG_POSTFIX.rst b/Help/variable/CMAKE_CONFIG_POSTFIX.rst index af38bed4b..e686a4338 100644 --- a/Help/variable/CMAKE_CONFIG_POSTFIX.rst +++ b/Help/variable/CMAKE_CONFIG_POSTFIX.rst @@ -1,7 +1,7 @@ CMAKE__POSTFIX ---------------------- -Default filename postfix for libraries under configuration . +Default filename postfix for libraries under configuration ````. -When a non-executable target is created its _POSTFIX target -property is initialized with the value of this variable if it is set. +When a non-executable target is created its :prop_tgt:`_POSTFIX` +target property is initialized with the value of this variable if it is set. diff --git a/Help/variable/CMAKE_CTEST_COMMAND.rst b/Help/variable/CMAKE_CTEST_COMMAND.rst index d5dd2c3bb..b2942e2a8 100644 --- a/Help/variable/CMAKE_CTEST_COMMAND.rst +++ b/Help/variable/CMAKE_CTEST_COMMAND.rst @@ -1,8 +1,8 @@ CMAKE_CTEST_COMMAND ------------------- -Full path to ctest command installed with cmake. +Full path to :manual:`ctest(1)` command installed with CMake. -This is the full path to the CTest executable ctest which is useful -from custom commands that want to use the cmake -E option for portable -system commands. +This is the full path to the CTest executable :manual:`ctest(1)` which is +useful from custom commands that want to use the :manual:`cmake(1)` ``-E`` +option for portable system commands. diff --git a/Help/variable/CMAKE_CURRENT_BINARY_DIR.rst b/Help/variable/CMAKE_CURRENT_BINARY_DIR.rst index fb55a11c6..cc3b63987 100644 --- a/Help/variable/CMAKE_CURRENT_BINARY_DIR.rst +++ b/Help/variable/CMAKE_CURRENT_BINARY_DIR.rst @@ -4,7 +4,7 @@ CMAKE_CURRENT_BINARY_DIR The path to the binary directory currently being processed. This the full path to the build directory that is currently being -processed by cmake. Each directory added by add_subdirectory will +processed by cmake. Each directory added by :command:`add_subdirectory` will create a binary directory in the build tree, and as it is being processed this variable will be set. For in-source builds this is the current source directory being processed. diff --git a/Help/variable/CMAKE_CURRENT_LIST_DIR.rst b/Help/variable/CMAKE_CURRENT_LIST_DIR.rst index b8168211c..ebc3ab9c9 100644 --- a/Help/variable/CMAKE_CURRENT_LIST_DIR.rst +++ b/Help/variable/CMAKE_CURRENT_LIST_DIR.rst @@ -5,8 +5,8 @@ Full directory of the listfile currently being processed. As CMake processes the listfiles in your project this variable will always be set to the directory where the listfile which is currently -being processed (CMAKE_CURRENT_LIST_FILE) is located. The value has -dynamic scope. When CMake starts processing commands in a source file +being processed (:variable:`CMAKE_CURRENT_LIST_FILE`) is located. The value +has dynamic scope. When CMake starts processing commands in a source file it sets this variable to the directory where this file is located. When CMake finishes processing commands from the file it restores the previous value. Therefore the value of the variable inside a macro or @@ -14,4 +14,4 @@ function is the directory of the file invoking the bottom-most entry on the call stack, not the directory of the file containing the macro or function definition. -See also CMAKE_CURRENT_LIST_FILE. +See also :variable:`CMAKE_CURRENT_LIST_FILE`. diff --git a/Help/variable/CMAKE_CURRENT_LIST_FILE.rst b/Help/variable/CMAKE_CURRENT_LIST_FILE.rst index 910d7b455..84b0eeeba 100644 --- a/Help/variable/CMAKE_CURRENT_LIST_FILE.rst +++ b/Help/variable/CMAKE_CURRENT_LIST_FILE.rst @@ -12,4 +12,4 @@ value. Therefore the value of the variable inside a macro or function is the file invoking the bottom-most entry on the call stack, not the file containing the macro or function definition. -See also CMAKE_PARENT_LIST_FILE. +See also :variable:`CMAKE_PARENT_LIST_FILE`. diff --git a/Help/variable/CMAKE_CXX_COMPILE_FEATURES.rst b/Help/variable/CMAKE_CXX_COMPILE_FEATURES.rst index f0032270b..5c59f9503 100644 --- a/Help/variable/CMAKE_CXX_COMPILE_FEATURES.rst +++ b/Help/variable/CMAKE_CXX_COMPILE_FEATURES.rst @@ -4,8 +4,8 @@ CMAKE_CXX_COMPILE_FEATURES List of features known to the C++ compiler These features are known to be available for use with the C++ compiler. This -list is a subset of the features listed in the :prop_gbl:`CMAKE_CXX_KNOWN_FEATURES` -global property. +list is a subset of the features listed in the +:prop_gbl:`CMAKE_CXX_KNOWN_FEATURES` global property. See the :manual:`cmake-compile-features(7)` manual for information on compile features and a list of supported compilers. diff --git a/Help/variable/CMAKE_CXX_EXTENSIONS.rst b/Help/variable/CMAKE_CXX_EXTENSIONS.rst index b14d7538a..4a92425e6 100644 --- a/Help/variable/CMAKE_CXX_EXTENSIONS.rst +++ b/Help/variable/CMAKE_CXX_EXTENSIONS.rst @@ -1,7 +1,7 @@ CMAKE_CXX_EXTENSIONS -------------------- -Default value for ``CXX_EXTENSIONS`` property of targets. +Default value for :prop_tgt:`CXX_EXTENSIONS` property of targets. This variable is used to initialize the :prop_tgt:`CXX_EXTENSIONS` property on all targets. See that target property for additional diff --git a/Help/variable/CMAKE_CXX_STANDARD.rst b/Help/variable/CMAKE_CXX_STANDARD.rst index 2bc4525f6..8a8bdff29 100644 --- a/Help/variable/CMAKE_CXX_STANDARD.rst +++ b/Help/variable/CMAKE_CXX_STANDARD.rst @@ -1,7 +1,7 @@ CMAKE_CXX_STANDARD ------------------ -Default value for ``CXX_STANDARD`` property of targets. +Default value for :prop_tgt:`CXX_STANDARD` property of targets. This variable is used to initialize the :prop_tgt:`CXX_STANDARD` property on all targets. See that target property for additional diff --git a/Help/variable/CMAKE_CXX_STANDARD_REQUIRED.rst b/Help/variable/CMAKE_CXX_STANDARD_REQUIRED.rst index 14ffcd17b..4c710580a 100644 --- a/Help/variable/CMAKE_CXX_STANDARD_REQUIRED.rst +++ b/Help/variable/CMAKE_CXX_STANDARD_REQUIRED.rst @@ -1,7 +1,7 @@ CMAKE_CXX_STANDARD_REQUIRED --------------------------- -Default value for ``CXX_STANDARD_REQUIRED`` property of targets. +Default value for :prop_tgt:`CXX_STANDARD_REQUIRED` property of targets. This variable is used to initialize the :prop_tgt:`CXX_STANDARD_REQUIRED` property on all targets. See that target property for additional diff --git a/Help/variable/CMAKE_C_COMPILE_FEATURES.rst b/Help/variable/CMAKE_C_COMPILE_FEATURES.rst index df66eaedc..8d1eca06a 100644 --- a/Help/variable/CMAKE_C_COMPILE_FEATURES.rst +++ b/Help/variable/CMAKE_C_COMPILE_FEATURES.rst @@ -4,8 +4,8 @@ CMAKE_C_COMPILE_FEATURES List of features known to the C compiler These features are known to be available for use with the C compiler. This -list is a subset of the features listed in the :prop_gbl:`CMAKE_C_KNOWN_FEATURES` -global property. +list is a subset of the features listed in the +:prop_gbl:`CMAKE_C_KNOWN_FEATURES` global property. See the :manual:`cmake-compile-features(7)` manual for information on compile features and a list of supported compilers. diff --git a/Help/variable/CMAKE_C_EXTENSIONS.rst b/Help/variable/CMAKE_C_EXTENSIONS.rst index 25bec12fc..fa510d4a8 100644 --- a/Help/variable/CMAKE_C_EXTENSIONS.rst +++ b/Help/variable/CMAKE_C_EXTENSIONS.rst @@ -1,7 +1,7 @@ CMAKE_C_EXTENSIONS ------------------ -Default value for ``C_EXTENSIONS`` property of targets. +Default value for :prop_tgt:`C_EXTENSIONS` property of targets. This variable is used to initialize the :prop_tgt:`C_EXTENSIONS` property on all targets. See that target property for additional diff --git a/Help/variable/CMAKE_C_STANDARD.rst b/Help/variable/CMAKE_C_STANDARD.rst index 2eb4e43ea..b55e00cd9 100644 --- a/Help/variable/CMAKE_C_STANDARD.rst +++ b/Help/variable/CMAKE_C_STANDARD.rst @@ -1,7 +1,7 @@ CMAKE_C_STANDARD ---------------- -Default value for ``C_STANDARD`` property of targets. +Default value for :prop_tgt:`C_STANDARD` property of targets. This variable is used to initialize the :prop_tgt:`C_STANDARD` property on all targets. See that target property for additional diff --git a/Help/variable/CMAKE_C_STANDARD_REQUIRED.rst b/Help/variable/CMAKE_C_STANDARD_REQUIRED.rst index 5e415dafa..7f70f6edb 100644 --- a/Help/variable/CMAKE_C_STANDARD_REQUIRED.rst +++ b/Help/variable/CMAKE_C_STANDARD_REQUIRED.rst @@ -1,7 +1,7 @@ CMAKE_C_STANDARD_REQUIRED ------------------------- -Default value for ``C_STANDARD_REQUIRED`` property of targets. +Default value for :prop_tgt:`C_STANDARD_REQUIRED` property of targets. This variable is used to initialize the :prop_tgt:`C_STANDARD_REQUIRED` property on all targets. See that target property for additional diff --git a/Help/variable/CMAKE_DEBUG_POSTFIX.rst b/Help/variable/CMAKE_DEBUG_POSTFIX.rst index fde24b2b5..08577a5c8 100644 --- a/Help/variable/CMAKE_DEBUG_POSTFIX.rst +++ b/Help/variable/CMAKE_DEBUG_POSTFIX.rst @@ -1,7 +1,7 @@ CMAKE_DEBUG_POSTFIX ------------------- -See variable CMAKE__POSTFIX. +See variable :variable:`CMAKE__POSTFIX`. This variable is a special case of the more-general -CMAKE__POSTFIX variable for the DEBUG configuration. +:variable:`CMAKE__POSTFIX` variable for the `DEBUG` configuration. diff --git a/Help/variable/CMAKE_DEBUG_TARGET_PROPERTIES.rst b/Help/variable/CMAKE_DEBUG_TARGET_PROPERTIES.rst index e200b8680..513276e57 100644 --- a/Help/variable/CMAKE_DEBUG_TARGET_PROPERTIES.rst +++ b/Help/variable/CMAKE_DEBUG_TARGET_PROPERTIES.rst @@ -9,6 +9,6 @@ only be used when evaluating the :prop_tgt:`INCLUDE_DIRECTORIES`, :prop_tgt:`COMPILE_DEFINITIONS`, :prop_tgt:`COMPILE_OPTIONS`, :prop_tgt:`AUTOUIC_OPTIONS`, :prop_tgt:`SOURCES`, :prop_tgt:`COMPILE_FEATURES`, :prop_tgt:`POSITION_INDEPENDENT_CODE` target properties and any other property -listed in :prop_tgt:`COMPATIBLE_INTERFACE_STRING` and other ``COMPATIBLE_INTERFACE_`` -properties. It outputs an origin for each entry in the target property. -Default is unset. +listed in :prop_tgt:`COMPATIBLE_INTERFACE_STRING` and other +``COMPATIBLE_INTERFACE_`` properties. It outputs an origin for each entry in +the target property. Default is unset. diff --git a/Help/variable/CMAKE_DISABLE_FIND_PACKAGE_PackageName.rst b/Help/variable/CMAKE_DISABLE_FIND_PACKAGE_PackageName.rst index bcb277c99..ed600202c 100644 --- a/Help/variable/CMAKE_DISABLE_FIND_PACKAGE_PackageName.rst +++ b/Help/variable/CMAKE_DISABLE_FIND_PACKAGE_PackageName.rst @@ -1,10 +1,11 @@ CMAKE_DISABLE_FIND_PACKAGE_ ---------------------------------------- -Variable for disabling find_package() calls. +Variable for disabling :command:`find_package` calls. -Every non-REQUIRED find_package() call in a project can be disabled by -setting the variable CMAKE_DISABLE_FIND_PACKAGE_ to TRUE. +Every non-``REQUIRED`` :command:`find_package` call in a project can be +disabled by setting the variable +``CMAKE_DISABLE_FIND_PACKAGE_`` to ``TRUE``. This can be used to build a project without an optional package, although that package is installed. @@ -12,4 +13,4 @@ This switch should be used during the initial CMake run. Otherwise if the package has already been found in a previous CMake run, the variables which have been stored in the cache will still be there. In that case it is recommended to remove the cache variables for this -package from the cache using the cache editor or cmake -U +package from the cache using the cache editor or :manual:`cmake(1)` ``-U`` diff --git a/Help/variable/CMAKE_DL_LIBS.rst b/Help/variable/CMAKE_DL_LIBS.rst index cae4565b8..1fe7641b8 100644 --- a/Help/variable/CMAKE_DL_LIBS.rst +++ b/Help/variable/CMAKE_DL_LIBS.rst @@ -1,7 +1,7 @@ CMAKE_DL_LIBS ------------- -Name of library containing dlopen and dlcose. +Name of library containing ``dlopen`` and ``dlcose``. -The name of the library that has dlopen and dlclose in it, usually --ldl on most UNIX machines. +The name of the library that has ``dlopen`` and ``dlclose`` in it, usually +``-ldl`` on most UNIX machines. diff --git a/Help/variable/CMAKE_EDIT_COMMAND.rst b/Help/variable/CMAKE_EDIT_COMMAND.rst index 562aa0bc6..2f4ab1f62 100644 --- a/Help/variable/CMAKE_EDIT_COMMAND.rst +++ b/Help/variable/CMAKE_EDIT_COMMAND.rst @@ -1,8 +1,8 @@ CMAKE_EDIT_COMMAND ------------------ -Full path to cmake-gui or ccmake. Defined only for Makefile generators -when not using an "extra" generator for an IDE. +Full path to :manual:`cmake-gui(1)` or :manual:`ccmake(1)`. Defined only for +:ref:`Makefile Generators` when not using an "extra" generator for an IDE. This is the full path to the CMake executable that can graphically -edit the cache. For example, cmake-gui or ccmake. +edit the cache. For example, :manual:`cmake-gui(1)` or :manual:`ccmake(1)`. diff --git a/Help/variable/CMAKE_ENABLE_EXPORTS.rst b/Help/variable/CMAKE_ENABLE_EXPORTS.rst new file mode 100644 index 000000000..1f9ba6f6c --- /dev/null +++ b/Help/variable/CMAKE_ENABLE_EXPORTS.rst @@ -0,0 +1,22 @@ +CMAKE_ENABLE_EXPORTS +-------------------- + +Specify whether an executable exports symbols for loadable modules. + +Normally an executable does not export any symbols because it is the +final program. It is possible for an executable to export symbols to +be used by loadable modules. When this property is set to true CMake +will allow other targets to "link" to the executable with the +:command:`TARGET_LINK_LIBRARIES` command. On all platforms a target-level +dependency on the executable is created for targets that link to it. +For DLL platforms an import library will be created for the exported +symbols and then used for linking. All Windows-based systems +including Cygwin are DLL platforms. For non-DLL platforms that +require all symbols to be resolved at link time, such as Mac OS X, the +module will "link" to the executable using a flag like +"-bundle_loader". For other non-DLL platforms the link rule is simply +ignored since the dynamic loader will automatically bind symbols when +the module is loaded. + +This variable is used to initialize the target property +:prop_tgt:`ENABLE_EXPORTS` for executable targets. diff --git a/Help/variable/CMAKE_ERROR_DEPRECATED.rst b/Help/variable/CMAKE_ERROR_DEPRECATED.rst index 43ab282a3..277a4cc11 100644 --- a/Help/variable/CMAKE_ERROR_DEPRECATED.rst +++ b/Help/variable/CMAKE_ERROR_DEPRECATED.rst @@ -3,6 +3,6 @@ CMAKE_ERROR_DEPRECATED Whether to issue deprecation errors for macros and functions. -If TRUE, this can be used by macros and functions to issue fatal +If ``TRUE``, this can be used by macros and functions to issue fatal errors when deprecated macros or functions are used. This variable is -FALSE by default. +``FALSE`` by default. diff --git a/Help/variable/CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION.rst b/Help/variable/CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION.rst index 651d68d1f..38e9b7b36 100644 --- a/Help/variable/CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION.rst +++ b/Help/variable/CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION.rst @@ -1,9 +1,10 @@ CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION ------------------------------------------- -Ask cmake_install.cmake script to error out as soon as a file with absolute INSTALL DESTINATION is encountered. +Ask ``cmake_install.cmake`` script to error out as soon as a file with +absolute ``INSTALL DESTINATION`` is encountered. The fatal error is emitted before the installation of the offending file takes place. This variable is used by CMake-generated -cmake_install.cmake scripts. If one sets this variable to ON while +``cmake_install.cmake`` scripts. If one sets this variable to ``ON`` while running the script, it may get fatal error messages from the script. diff --git a/Help/variable/CMAKE_EXECUTABLE_SUFFIX.rst b/Help/variable/CMAKE_EXECUTABLE_SUFFIX.rst index 45c313c04..356590f6f 100644 --- a/Help/variable/CMAKE_EXECUTABLE_SUFFIX.rst +++ b/Help/variable/CMAKE_EXECUTABLE_SUFFIX.rst @@ -3,7 +3,7 @@ CMAKE_EXECUTABLE_SUFFIX The suffix for executables on this platform. -The suffix to use for the end of an executable filename if any, .exe +The suffix to use for the end of an executable filename if any, ``.exe`` on Windows. -CMAKE_EXECUTABLE_SUFFIX_ overrides this for language . +``CMAKE_EXECUTABLE_SUFFIX_`` overrides this for language ````. diff --git a/Help/variable/CMAKE_EXE_LINKER_FLAGS_CONFIG.rst b/Help/variable/CMAKE_EXE_LINKER_FLAGS_CONFIG.rst index dcaf30062..0cd8113aa 100644 --- a/Help/variable/CMAKE_EXE_LINKER_FLAGS_CONFIG.rst +++ b/Help/variable/CMAKE_EXE_LINKER_FLAGS_CONFIG.rst @@ -3,5 +3,5 @@ CMAKE_EXE_LINKER_FLAGS_ Flags to be used when linking an executable. -Same as CMAKE_C_FLAGS_* but used by the linker when creating +Same as ``CMAKE_C_FLAGS_*`` but used by the linker when creating executables. diff --git a/Help/variable/CMAKE_EXTRA_GENERATOR.rst b/Help/variable/CMAKE_EXTRA_GENERATOR.rst index 71aec92c5..4d513e474 100644 --- a/Help/variable/CMAKE_EXTRA_GENERATOR.rst +++ b/Help/variable/CMAKE_EXTRA_GENERATOR.rst @@ -1,9 +1,10 @@ CMAKE_EXTRA_GENERATOR --------------------- -The extra generator used to build the project. +The extra generator used to build the project. See +:manual:`cmake-generators(7)`. When using the Eclipse, CodeBlocks or KDevelop generators, CMake -generates Makefiles (CMAKE_GENERATOR) and additionally project files -for the respective IDE. This IDE project file generator is stored in -CMAKE_EXTRA_GENERATOR (e.g. "Eclipse CDT4"). +generates Makefiles (:variable:`CMAKE_GENERATOR`) and additionally project +files for the respective IDE. This IDE project file generator is stored in +``CMAKE_EXTRA_GENERATOR`` (e.g. ``Eclipse CDT4``). diff --git a/Help/variable/CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES.rst b/Help/variable/CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES.rst index 6187a7ac8..a130adbee 100644 --- a/Help/variable/CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES.rst +++ b/Help/variable/CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES.rst @@ -4,6 +4,6 @@ CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES Additional suffixes for shared libraries. Extensions for shared libraries other than that specified by -CMAKE_SHARED_LIBRARY_SUFFIX, if any. CMake uses this to recognize +:variable:`CMAKE_SHARED_LIBRARY_SUFFIX`, if any. CMake uses this to recognize external shared library files during analysis of libraries linked by a target. diff --git a/Help/variable/CMAKE_FIND_APPBUNDLE.rst b/Help/variable/CMAKE_FIND_APPBUNDLE.rst new file mode 100644 index 000000000..e0727b547 --- /dev/null +++ b/Help/variable/CMAKE_FIND_APPBUNDLE.rst @@ -0,0 +1,22 @@ +CMAKE_FIND_APPBUNDLE +-------------------- + +This variable affects how ``find_*`` commands choose between +OS X Application Bundles and unix-style package components. + +On Darwin or systems supporting OS X Application Bundles, the +``CMAKE_FIND_APPBUNDLE`` variable can be set to empty or +one of the following: + +``FIRST`` + Try to find application bundles before standard programs. + This is the default on Darwin. + +``LAST`` + Try to find application bundles after standard programs. + +``ONLY`` + Only try to find application bundles. + +``NEVER`` + Never try to find application bundles. diff --git a/Help/variable/CMAKE_FIND_FRAMEWORK.rst b/Help/variable/CMAKE_FIND_FRAMEWORK.rst new file mode 100644 index 000000000..790694ac5 --- /dev/null +++ b/Help/variable/CMAKE_FIND_FRAMEWORK.rst @@ -0,0 +1,22 @@ +CMAKE_FIND_FRAMEWORK +-------------------- + +This variable affects how ``find_*`` commands choose between +OS X Frameworks and unix-style package components. + +On Darwin or systems supporting OS X Frameworks, the +``CMAKE_FIND_FRAMEWORK`` variable can be set to empty or +one of the following: + +``FIRST`` + Try to find frameworks before standard libraries or headers. + This is the default on Darwin. + +``LAST`` + Try to find frameworks after standard libraries or headers. + +``ONLY`` + Only try to find frameworks. + +``NEVER`` + Never try to find frameworks. diff --git a/Help/variable/CMAKE_FIND_LIBRARY_PREFIXES.rst b/Help/variable/CMAKE_FIND_LIBRARY_PREFIXES.rst index 1a9e7ce91..58354b2b2 100644 --- a/Help/variable/CMAKE_FIND_LIBRARY_PREFIXES.rst +++ b/Help/variable/CMAKE_FIND_LIBRARY_PREFIXES.rst @@ -4,6 +4,6 @@ CMAKE_FIND_LIBRARY_PREFIXES Prefixes to prepend when looking for libraries. This specifies what prefixes to add to library names when the -find_library command looks for libraries. On UNIX systems this is -typically lib, meaning that when trying to find the foo library it -will look for libfoo. +:command:`find_library` command looks for libraries. On UNIX systems this is +typically ``lib``, meaning that when trying to find the ``foo`` library it +will look for ``libfoo``. diff --git a/Help/variable/CMAKE_FIND_LIBRARY_SUFFIXES.rst b/Help/variable/CMAKE_FIND_LIBRARY_SUFFIXES.rst index c533909f4..4a64e33e9 100644 --- a/Help/variable/CMAKE_FIND_LIBRARY_SUFFIXES.rst +++ b/Help/variable/CMAKE_FIND_LIBRARY_SUFFIXES.rst @@ -4,6 +4,6 @@ CMAKE_FIND_LIBRARY_SUFFIXES Suffixes to append when looking for libraries. This specifies what suffixes to add to library names when the -find_library command looks for libraries. On Windows systems this is -typically .lib and .dll, meaning that when trying to find the foo -library it will look for foo.dll etc. +:command:`find_library` command looks for libraries. On Windows systems this +is typically ``.lib`` and ``.dll``, meaning that when trying to find the +``foo`` library it will look for ``foo.dll`` etc. diff --git a/Help/variable/CMAKE_FIND_NO_INSTALL_PREFIX.rst b/Help/variable/CMAKE_FIND_NO_INSTALL_PREFIX.rst index 70d920bce..c49d2641b 100644 --- a/Help/variable/CMAKE_FIND_NO_INSTALL_PREFIX.rst +++ b/Help/variable/CMAKE_FIND_NO_INSTALL_PREFIX.rst @@ -8,8 +8,8 @@ CMake adds the :variable:`CMAKE_INSTALL_PREFIX` and the :variable:`CMAKE_SYSTEM_PREFIX_PATH` by default. This variable may be set on the command line to control that behavior. -Set :variable:`CMAKE_FIND_NO_INSTALL_PREFIX` to TRUE to tell find_package not -to search in the :variable:`CMAKE_INSTALL_PREFIX` or -:variable:`CMAKE_STAGING_PREFIX` by default. Note that the +Set ``CMAKE_FIND_NO_INSTALL_PREFIX`` to ``TRUE`` to tell +:command:`find_package` not to search in the :variable:`CMAKE_INSTALL_PREFIX` +or :variable:`CMAKE_STAGING_PREFIX` by default. Note that the prefix may still be searched for other reasons, such as being the same prefix as the CMake installation, or for being a built-in system prefix. diff --git a/Help/variable/CMAKE_FIND_PACKAGE_WARN_NO_MODULE.rst b/Help/variable/CMAKE_FIND_PACKAGE_WARN_NO_MODULE.rst index 5d7599c0c..f1116bb62 100644 --- a/Help/variable/CMAKE_FIND_PACKAGE_WARN_NO_MODULE.rst +++ b/Help/variable/CMAKE_FIND_PACKAGE_WARN_NO_MODULE.rst @@ -1,19 +1,19 @@ CMAKE_FIND_PACKAGE_WARN_NO_MODULE --------------------------------- -Tell find_package to warn if called without an explicit mode. +Tell :command:`find_package` to warn if called without an explicit mode. -If find_package is called without an explicit mode option (MODULE, -CONFIG or NO_MODULE) and no Find.cmake module is in -CMAKE_MODULE_PATH then CMake implicitly assumes that the caller -intends to search for a package configuration file. If no package +If :command:`find_package` is called without an explicit mode option +(``MODULE``, ``CONFIG``, or ``NO_MODULE``) and no ``Find.cmake`` module +is in :variable:`CMAKE_MODULE_PATH` then CMake implicitly assumes that the +caller intends to search for a package configuration file. If no package configuration file is found then the wording of the failure message must account for both the case that the package is really missing and the case that the project has a bug and failed to provide the intended Find module. If instead the caller specifies an explicit mode option then the failure message can be more specific. -Set CMAKE_FIND_PACKAGE_WARN_NO_MODULE to TRUE to tell find_package to -warn when it implicitly assumes Config mode. This helps developers -enforce use of an explicit mode in all calls to find_package within a -project. +Set ``CMAKE_FIND_PACKAGE_WARN_NO_MODULE`` to ``TRUE`` to tell +:command:`find_package` to warn when it implicitly assumes Config mode. This +helps developers enforce use of an explicit mode in all calls to +:command:`find_package` within a project. diff --git a/Help/variable/CMAKE_FIND_ROOT_PATH.rst b/Help/variable/CMAKE_FIND_ROOT_PATH.rst index ccf523451..ba2cf313e 100644 --- a/Help/variable/CMAKE_FIND_ROOT_PATH.rst +++ b/Help/variable/CMAKE_FIND_ROOT_PATH.rst @@ -4,5 +4,5 @@ CMAKE_FIND_ROOT_PATH :ref:`;-list ` of root paths to search on the filesystem. This variable is most useful when cross-compiling. CMake uses the paths in -this list as alternative roots to find filesystem items with :command:`find_package`, -:command:`find_library` etc. +this list as alternative roots to find filesystem items with +:command:`find_package`, :command:`find_library` etc. diff --git a/Help/variable/CMAKE_Fortran_FORMAT.rst b/Help/variable/CMAKE_Fortran_FORMAT.rst index c0e971ce9..1406e59b1 100644 --- a/Help/variable/CMAKE_Fortran_FORMAT.rst +++ b/Help/variable/CMAKE_Fortran_FORMAT.rst @@ -1,7 +1,7 @@ CMAKE_Fortran_FORMAT -------------------- -Set to FIXED or FREE to indicate the Fortran source layout. +Set to ``FIXED`` or ``FREE`` to indicate the Fortran source layout. -This variable is used to initialize the Fortran_FORMAT property on all -the targets. See that target property for additional information. +This variable is used to initialize the :prop_tgt:`Fortran_FORMAT` property on +all the targets. See that target property for additional information. diff --git a/Help/variable/CMAKE_Fortran_MODDIR_DEFAULT.rst b/Help/variable/CMAKE_Fortran_MODDIR_DEFAULT.rst index a8dfcdf34..5aeab0757 100644 --- a/Help/variable/CMAKE_Fortran_MODDIR_DEFAULT.rst +++ b/Help/variable/CMAKE_Fortran_MODDIR_DEFAULT.rst @@ -3,6 +3,6 @@ CMAKE_Fortran_MODDIR_DEFAULT Fortran default module output directory. -Most Fortran compilers write .mod files to the current working -directory. For those that do not, this is set to "." and used when -the Fortran_MODULE_DIRECTORY target property is not set. +Most Fortran compilers write ``.mod`` files to the current working +directory. For those that do not, this is set to ``.`` and used when +the :prop_tgt:`Fortran_MODULE_DIRECTORY` target property is not set. diff --git a/Help/variable/CMAKE_Fortran_MODDIR_FLAG.rst b/Help/variable/CMAKE_Fortran_MODDIR_FLAG.rst index 4b32df328..1da55cade 100644 --- a/Help/variable/CMAKE_Fortran_MODDIR_FLAG.rst +++ b/Help/variable/CMAKE_Fortran_MODDIR_FLAG.rst @@ -4,4 +4,4 @@ CMAKE_Fortran_MODDIR_FLAG Fortran flag for module output directory. This stores the flag needed to pass the value of the -Fortran_MODULE_DIRECTORY target property to the compiler. +:prop_tgt:`Fortran_MODULE_DIRECTORY` target property to the compiler. diff --git a/Help/variable/CMAKE_Fortran_MODOUT_FLAG.rst b/Help/variable/CMAKE_Fortran_MODOUT_FLAG.rst index a232213a1..2f8388017 100644 --- a/Help/variable/CMAKE_Fortran_MODOUT_FLAG.rst +++ b/Help/variable/CMAKE_Fortran_MODOUT_FLAG.rst @@ -3,5 +3,5 @@ CMAKE_Fortran_MODOUT_FLAG Fortran flag to enable module output. -Most Fortran compilers write .mod files out by default. For others, +Most Fortran compilers write ``.mod`` files out by default. For others, this stores the flag needed to enable module output. diff --git a/Help/variable/CMAKE_Fortran_MODULE_DIRECTORY.rst b/Help/variable/CMAKE_Fortran_MODULE_DIRECTORY.rst index b1d49d876..3c7edc1cf 100644 --- a/Help/variable/CMAKE_Fortran_MODULE_DIRECTORY.rst +++ b/Help/variable/CMAKE_Fortran_MODULE_DIRECTORY.rst @@ -3,6 +3,6 @@ CMAKE_Fortran_MODULE_DIRECTORY Fortran module output directory. -This variable is used to initialize the Fortran_MODULE_DIRECTORY +This variable is used to initialize the :prop_tgt:`Fortran_MODULE_DIRECTORY` property on all the targets. See that target property for additional information. diff --git a/Help/variable/CMAKE_GENERATOR.rst b/Help/variable/CMAKE_GENERATOR.rst index a4e70a590..3f6ebc1cd 100644 --- a/Help/variable/CMAKE_GENERATOR.rst +++ b/Help/variable/CMAKE_GENERATOR.rst @@ -1,7 +1,7 @@ CMAKE_GENERATOR --------------- -The generator used to build the project. +The generator used to build the project. See :manual:`cmake-generators(7)`. The name of the generator that is being used to generate the build -files. (e.g. "Unix Makefiles", "Visual Studio 6", etc.) +files. (e.g. ``Unix Makefiles``, ``Visual Studio 6``, etc.) diff --git a/Help/variable/CMAKE_GENERATOR_PLATFORM.rst b/Help/variable/CMAKE_GENERATOR_PLATFORM.rst index 5559eb7f1..a5c284a87 100644 --- a/Help/variable/CMAKE_GENERATOR_PLATFORM.rst +++ b/Help/variable/CMAKE_GENERATOR_PLATFORM.rst @@ -5,8 +5,8 @@ Generator-specific target platform name specified by user. Some CMake generators support a target platform name to be given to the native build system to choose a compiler toolchain. -If the user specifies a platform name (e.g. via the cmake -A option) -the value will be available in this variable. +If the user specifies a platform name (e.g. via the :manual:`cmake(1)` ``-A`` +option) the value will be available in this variable. The value of this variable should never be modified by project code. A toolchain file specified by the :variable:`CMAKE_TOOLCHAIN_FILE` diff --git a/Help/variable/CMAKE_GENERATOR_TOOLSET.rst b/Help/variable/CMAKE_GENERATOR_TOOLSET.rst index 9ccc8b312..89abe5498 100644 --- a/Help/variable/CMAKE_GENERATOR_TOOLSET.rst +++ b/Help/variable/CMAKE_GENERATOR_TOOLSET.rst @@ -5,8 +5,8 @@ Native build system toolset name specified by user. Some CMake generators support a toolset name to be given to the native build system to choose a compiler. If the user specifies a toolset -name (e.g. via the cmake -T option) the value will be available in -this variable. +name (e.g. via the :manual:`cmake(1)` ``-T`` option) the value will be +available in this variable. The value of this variable should never be modified by project code. A toolchain file specified by the :variable:`CMAKE_TOOLCHAIN_FILE` diff --git a/Help/variable/CMAKE_GNUtoMS.rst b/Help/variable/CMAKE_GNUtoMS.rst index e253f59d1..9c0f59e22 100644 --- a/Help/variable/CMAKE_GNUtoMS.rst +++ b/Help/variable/CMAKE_GNUtoMS.rst @@ -1,8 +1,8 @@ CMAKE_GNUtoMS ------------- -Convert GNU import libraries (.dll.a) to MS format (.lib). +Convert GNU import libraries (``.dll.a``) to MS format (``.lib``). -This variable is used to initialize the GNUtoMS property on targets -when they are created. See that target property for additional +This variable is used to initialize the :prop_tgt:`GNUtoMS` property on +targets when they are created. See that target property for additional information. diff --git a/Help/variable/CMAKE_HOST_APPLE.rst b/Help/variable/CMAKE_HOST_APPLE.rst index d4b848344..ac7b03004 100644 --- a/Help/variable/CMAKE_HOST_APPLE.rst +++ b/Help/variable/CMAKE_HOST_APPLE.rst @@ -1,6 +1,6 @@ CMAKE_HOST_APPLE ---------------- -True for Apple OS X operating systems. +``True`` for Apple OS X operating systems. -Set to true when the host system is Apple OS X. +Set to ``true`` when the host system is Apple OS X. diff --git a/Help/variable/CMAKE_HOST_SYSTEM_NAME.rst b/Help/variable/CMAKE_HOST_SYSTEM_NAME.rst index a221de9c0..e5e6f67ff 100644 --- a/Help/variable/CMAKE_HOST_SYSTEM_NAME.rst +++ b/Help/variable/CMAKE_HOST_SYSTEM_NAME.rst @@ -4,5 +4,5 @@ CMAKE_HOST_SYSTEM_NAME Name of the OS CMake is running on. On systems that have the uname command, this variable is set to the -output of uname -s. ``Linux``, ``Windows``, and ``Darwin`` for Mac OS X +output of ``uname -s``. ``Linux``, ``Windows``, and ``Darwin`` for Mac OS X are the values found on the big three operating systems. diff --git a/Help/variable/CMAKE_HOST_SYSTEM_PROCESSOR.rst b/Help/variable/CMAKE_HOST_SYSTEM_PROCESSOR.rst index 790565a84..ba8a850cd 100644 --- a/Help/variable/CMAKE_HOST_SYSTEM_PROCESSOR.rst +++ b/Help/variable/CMAKE_HOST_SYSTEM_PROCESSOR.rst @@ -3,6 +3,6 @@ CMAKE_HOST_SYSTEM_PROCESSOR The name of the CPU CMake is running on. -On systems that support uname, this variable is set to the output of -uname -p, on windows it is set to the value of the environment variable +On systems that support ``uname``, this variable is set to the output of +``uname -p``. On Windows it is set to the value of the environment variable ``PROCESSOR_ARCHITECTURE``. diff --git a/Help/variable/CMAKE_HOST_SYSTEM_VERSION.rst b/Help/variable/CMAKE_HOST_SYSTEM_VERSION.rst index e7e00529a..ed230704c 100644 --- a/Help/variable/CMAKE_HOST_SYSTEM_VERSION.rst +++ b/Help/variable/CMAKE_HOST_SYSTEM_VERSION.rst @@ -4,5 +4,5 @@ CMAKE_HOST_SYSTEM_VERSION The OS version CMake is running on. A numeric version string for the system. On systems that support -uname, this variable is set to the output of uname -r. On other +``uname``, this variable is set to the output of ``uname -r``. On other systems this is set to major-minor version numbers. diff --git a/Help/variable/CMAKE_HOST_UNIX.rst b/Help/variable/CMAKE_HOST_UNIX.rst index bbefba7d9..817a957e9 100644 --- a/Help/variable/CMAKE_HOST_UNIX.rst +++ b/Help/variable/CMAKE_HOST_UNIX.rst @@ -1,7 +1,7 @@ CMAKE_HOST_UNIX --------------- -True for UNIX and UNIX like operating systems. +``True`` for UNIX and UNIX like operating systems. -Set to true when the host system is UNIX or UNIX like (i.e. APPLE and +Set to ``true`` when the host system is UNIX or UNIX like (i.e. APPLE and CYGWIN). diff --git a/Help/variable/CMAKE_HOST_WIN32.rst b/Help/variable/CMAKE_HOST_WIN32.rst index 92ee45658..0e4c891a9 100644 --- a/Help/variable/CMAKE_HOST_WIN32.rst +++ b/Help/variable/CMAKE_HOST_WIN32.rst @@ -1,6 +1,6 @@ CMAKE_HOST_WIN32 ---------------- -True on windows systems, including win64. +``True`` on Windows systems, including Win64. -Set to true when the host system is Windows and on Cygwin. +Set to ``true`` when the host system is Windows and on Cygwin. diff --git a/Help/variable/CMAKE_IMPORT_LIBRARY_PREFIX.rst b/Help/variable/CMAKE_IMPORT_LIBRARY_PREFIX.rst index 1d16a3764..1561a1db9 100644 --- a/Help/variable/CMAKE_IMPORT_LIBRARY_PREFIX.rst +++ b/Help/variable/CMAKE_IMPORT_LIBRARY_PREFIX.rst @@ -6,4 +6,4 @@ The prefix for import libraries that you link to. The prefix to use for the name of an import library if used on this platform. -CMAKE_IMPORT_LIBRARY_PREFIX_ overrides this for language . +``CMAKE_IMPORT_LIBRARY_PREFIX_`` overrides this for language ````. diff --git a/Help/variable/CMAKE_IMPORT_LIBRARY_SUFFIX.rst b/Help/variable/CMAKE_IMPORT_LIBRARY_SUFFIX.rst index c16825eb9..11aeab7e6 100644 --- a/Help/variable/CMAKE_IMPORT_LIBRARY_SUFFIX.rst +++ b/Help/variable/CMAKE_IMPORT_LIBRARY_SUFFIX.rst @@ -6,4 +6,4 @@ The suffix for import libraries that you link to. The suffix to use for the end of an import library filename if used on this platform. -CMAKE_IMPORT_LIBRARY_SUFFIX_ overrides this for language . +``CMAKE_IMPORT_LIBRARY_SUFFIX_`` overrides this for language ````. diff --git a/Help/variable/CMAKE_INCLUDE_CURRENT_DIR.rst b/Help/variable/CMAKE_INCLUDE_CURRENT_DIR.rst index 79f3952fc..6eea322f8 100644 --- a/Help/variable/CMAKE_INCLUDE_CURRENT_DIR.rst +++ b/Help/variable/CMAKE_INCLUDE_CURRENT_DIR.rst @@ -3,11 +3,11 @@ CMAKE_INCLUDE_CURRENT_DIR Automatically add the current source- and build directories to the include path. -If this variable is enabled, CMake automatically adds in each -directory ${CMAKE_CURRENT_SOURCE_DIR} and ${CMAKE_CURRENT_BINARY_DIR} -to the include path for this directory. These additional include +If this variable is enabled, CMake automatically adds +:variable:`CMAKE_CURRENT_SOURCE_DIR` and :variable:`CMAKE_CURRENT_BINARY_DIR` +to the include path for each directory. These additional include directories do not propagate down to subdirectories. This is useful mainly for out-of-source builds, where files generated into the build tree are included by files located in the source tree. -By default CMAKE_INCLUDE_CURRENT_DIR is OFF. +By default ``CMAKE_INCLUDE_CURRENT_DIR`` is ``OFF``. diff --git a/Help/variable/CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE.rst b/Help/variable/CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE.rst index 948db50d5..5fc95f00b 100644 --- a/Help/variable/CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE.rst +++ b/Help/variable/CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE.rst @@ -1,10 +1,12 @@ CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE -------------------------------------- -Automatically add the current source- and build directories to the INTERFACE_INCLUDE_DIRECTORIES. +Automatically add the current source- and build directories to the +:prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` target property. If this variable is enabled, CMake automatically adds for each shared library target, static library target, module target and executable -target, ${CMAKE_CURRENT_SOURCE_DIR} and ${CMAKE_CURRENT_BINARY_DIR} to -the INTERFACE_INCLUDE_DIRECTORIES.By default -CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE is OFF. +target, :variable:`CMAKE_CURRENT_SOURCE_DIR` and +:variable:`CMAKE_CURRENT_BINARY_DIR` to +the :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` target property. By default +``CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE`` is ``OFF``. diff --git a/Help/variable/CMAKE_INCLUDE_DIRECTORIES_BEFORE.rst b/Help/variable/CMAKE_INCLUDE_DIRECTORIES_BEFORE.rst index 3c1fbcfb4..e0f2a2e55 100644 --- a/Help/variable/CMAKE_INCLUDE_DIRECTORIES_BEFORE.rst +++ b/Help/variable/CMAKE_INCLUDE_DIRECTORIES_BEFORE.rst @@ -1,8 +1,9 @@ CMAKE_INCLUDE_DIRECTORIES_BEFORE -------------------------------- -Whether to append or prepend directories by default in :command:`include_directories`. +Whether to append or prepend directories by default in +:command:`include_directories`. This variable affects the default behavior of the :command:`include_directories` -command. Setting this variable to 'ON' is equivalent to using the BEFORE option -in all uses of that command. +command. Setting this variable to ``ON`` is equivalent to using the ``BEFORE`` +option in all uses of that command. diff --git a/Help/variable/CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE.rst b/Help/variable/CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE.rst index cbd04d7d2..37d0a3d48 100644 --- a/Help/variable/CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE.rst +++ b/Help/variable/CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE.rst @@ -4,5 +4,5 @@ CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE Whether to force prepending of project include directories. This variable affects the order of include directories generated in compiler -command lines. If set to 'ON', it causes the :variable:`CMAKE_SOURCE_DIR` and -the :variable:`CMAKE_BINARY_DIR` to appear first. +command lines. If set to ``ON``, it causes the :variable:`CMAKE_SOURCE_DIR` +and the :variable:`CMAKE_BINARY_DIR` to appear first. diff --git a/Help/variable/CMAKE_INSTALL_DEFAULT_COMPONENT_NAME.rst b/Help/variable/CMAKE_INSTALL_DEFAULT_COMPONENT_NAME.rst index 2ad0689aa..57160f1d9 100644 --- a/Help/variable/CMAKE_INSTALL_DEFAULT_COMPONENT_NAME.rst +++ b/Help/variable/CMAKE_INSTALL_DEFAULT_COMPONENT_NAME.rst @@ -1,9 +1,9 @@ CMAKE_INSTALL_DEFAULT_COMPONENT_NAME ------------------------------------ -Default component used in install() commands. +Default component used in :command:`install` commands. -If an install() command is used without the COMPONENT argument, these -files will be grouped into a default component. The name of this +If an :command:`install` command is used without the ``COMPONENT`` argument, +these files will be grouped into a default component. The name of this default install component will be taken from this variable. It -defaults to "Unspecified". +defaults to ``Unspecified``. diff --git a/Help/variable/CMAKE_INSTALL_NAME_DIR.rst b/Help/variable/CMAKE_INSTALL_NAME_DIR.rst index 540df6b73..961d71295 100644 --- a/Help/variable/CMAKE_INSTALL_NAME_DIR.rst +++ b/Help/variable/CMAKE_INSTALL_NAME_DIR.rst @@ -3,6 +3,6 @@ CMAKE_INSTALL_NAME_DIR Mac OS X directory name for installed targets. -CMAKE_INSTALL_NAME_DIR is used to initialize the INSTALL_NAME_DIR -property on all targets. See that target property for more -information. +``CMAKE_INSTALL_NAME_DIR`` is used to initialize the +:prop_tgt:`INSTALL_NAME_DIR` property on all targets. See that target +property for more information. diff --git a/Help/variable/CMAKE_INSTALL_PREFIX.rst b/Help/variable/CMAKE_INSTALL_PREFIX.rst index ee9b61566..3f3347f2f 100644 --- a/Help/variable/CMAKE_INSTALL_PREFIX.rst +++ b/Help/variable/CMAKE_INSTALL_PREFIX.rst @@ -1,14 +1,14 @@ CMAKE_INSTALL_PREFIX -------------------- -Install directory used by install. +Install directory used by :command:`install`. -If "make install" is invoked or INSTALL is built, this directory is +If ``make install`` is invoked or ``INSTALL`` is built, this directory is prepended onto all install directories. This variable defaults to -/usr/local on UNIX and c:/Program Files on Windows. +``/usr/local`` on UNIX and ``c:/Program Files`` on Windows. -On UNIX one can use the DESTDIR mechanism in order to relocate the -whole installation. DESTDIR means DESTination DIRectory. It is +On UNIX one can use the ``DESTDIR`` mechanism in order to relocate the +whole installation. ``DESTDIR`` means DESTination DIRectory. It is commonly used by makefile users in order to install software at non-default location. It is usually invoked like this: @@ -17,16 +17,17 @@ non-default location. It is usually invoked like this: make DESTDIR=/home/john install which will install the concerned software using the installation -prefix, e.g. "/usr/local" prepended with the DESTDIR value which -finally gives "/home/john/usr/local". +prefix, e.g. ``/usr/local`` prepended with the ``DESTDIR`` value which +finally gives ``/home/john/usr/local``. -WARNING: DESTDIR may not be used on Windows because installation -prefix usually contains a drive letter like in "C:/Program Files" +WARNING: ``DESTDIR`` may not be used on Windows because installation +prefix usually contains a drive letter like in ``C:/Program Files`` which cannot be prepended with some other prefix. -The installation prefix is also added to CMAKE_SYSTEM_PREFIX_PATH so -that find_package, find_program, find_library, find_path, and -find_file will search the prefix for other software. +The installation prefix is also added to :variable:`CMAKE_SYSTEM_PREFIX_PATH` +so that :command:`find_package`, :command:`find_program`, +:command:`find_library`, :command:`find_path`, and :command:`find_file` +will search the prefix for other software. .. note:: diff --git a/Help/variable/CMAKE_INSTALL_RPATH.rst b/Help/variable/CMAKE_INSTALL_RPATH.rst index 0992d57eb..813d1e0a7 100644 --- a/Help/variable/CMAKE_INSTALL_RPATH.rst +++ b/Help/variable/CMAKE_INSTALL_RPATH.rst @@ -5,4 +5,4 @@ The rpath to use for installed targets. A semicolon-separated list specifying the rpath to use in installed targets (for platforms that support it). This is used to initialize -the target property INSTALL_RPATH for all targets. +the target property :prop_tgt:`INSTALL_RPATH` for all targets. diff --git a/Help/variable/CMAKE_INSTALL_RPATH_USE_LINK_PATH.rst b/Help/variable/CMAKE_INSTALL_RPATH_USE_LINK_PATH.rst index 9277a3ba4..78148d5f5 100644 --- a/Help/variable/CMAKE_INSTALL_RPATH_USE_LINK_PATH.rst +++ b/Help/variable/CMAKE_INSTALL_RPATH_USE_LINK_PATH.rst @@ -3,7 +3,7 @@ CMAKE_INSTALL_RPATH_USE_LINK_PATH Add paths to linker search and installed rpath. -CMAKE_INSTALL_RPATH_USE_LINK_PATH is a boolean that if set to true +``CMAKE_INSTALL_RPATH_USE_LINK_PATH`` is a boolean that if set to ``true`` will append directories in the linker search path and outside the -project to the INSTALL_RPATH. This is used to initialize the target -property INSTALL_RPATH_USE_LINK_PATH for all targets. +project to the :prop_tgt:`INSTALL_RPATH`. This is used to initialize the +target property :prop_tgt:`INSTALL_RPATH_USE_LINK_PATH` for all targets. diff --git a/Help/variable/CMAKE_LANG_ARCHIVE_APPEND.rst b/Help/variable/CMAKE_LANG_ARCHIVE_APPEND.rst index 2c3abaeba..ab4ad7164 100644 --- a/Help/variable/CMAKE_LANG_ARCHIVE_APPEND.rst +++ b/Help/variable/CMAKE_LANG_ARCHIVE_APPEND.rst @@ -4,6 +4,7 @@ CMAKE__ARCHIVE_APPEND Rule variable to append to a static archive. This is a rule variable that tells CMake how to append to a static -archive. It is used in place of CMAKE__CREATE_STATIC_LIBRARY on -some platforms in order to support large object counts. See also -CMAKE__ARCHIVE_CREATE and CMAKE__ARCHIVE_FINISH. +archive. It is used in place of :variable:`CMAKE__CREATE_STATIC_LIBRARY` +on some platforms in order to support large object counts. See also +:variable:`CMAKE__ARCHIVE_CREATE` and +:variable:`CMAKE__ARCHIVE_FINISH`. diff --git a/Help/variable/CMAKE_LANG_ARCHIVE_CREATE.rst b/Help/variable/CMAKE_LANG_ARCHIVE_CREATE.rst index f93dd1119..fc295af2c 100644 --- a/Help/variable/CMAKE_LANG_ARCHIVE_CREATE.rst +++ b/Help/variable/CMAKE_LANG_ARCHIVE_CREATE.rst @@ -4,6 +4,7 @@ CMAKE__ARCHIVE_CREATE Rule variable to create a new static archive. This is a rule variable that tells CMake how to create a static -archive. It is used in place of CMAKE__CREATE_STATIC_LIBRARY on -some platforms in order to support large object counts. See also -CMAKE__ARCHIVE_APPEND and CMAKE__ARCHIVE_FINISH. +archive. It is used in place of :variable:`CMAKE__CREATE_STATIC_LIBRARY` +on some platforms in order to support large object counts. See also +:variable:`CMAKE__ARCHIVE_APPEND` and +:variable:`CMAKE__ARCHIVE_FINISH`. diff --git a/Help/variable/CMAKE_LANG_ARCHIVE_FINISH.rst b/Help/variable/CMAKE_LANG_ARCHIVE_FINISH.rst index fff4128a4..1bb5d651d 100644 --- a/Help/variable/CMAKE_LANG_ARCHIVE_FINISH.rst +++ b/Help/variable/CMAKE_LANG_ARCHIVE_FINISH.rst @@ -4,6 +4,7 @@ CMAKE__ARCHIVE_FINISH Rule variable to finish an existing static archive. This is a rule variable that tells CMake how to finish a static -archive. It is used in place of CMAKE__CREATE_STATIC_LIBRARY on -some platforms in order to support large object counts. See also -CMAKE__ARCHIVE_CREATE and CMAKE__ARCHIVE_APPEND. +archive. It is used in place of :variable:`CMAKE__CREATE_STATIC_LIBRARY` +on some platforms in order to support large object counts. See also +:variable:`CMAKE__ARCHIVE_CREATE` and +:variable:`CMAKE__ARCHIVE_APPEND`. diff --git a/Help/variable/CMAKE_LANG_COMPILER.rst b/Help/variable/CMAKE_LANG_COMPILER.rst index fffc347bd..89df4954e 100644 --- a/Help/variable/CMAKE_LANG_COMPILER.rst +++ b/Help/variable/CMAKE_LANG_COMPILER.rst @@ -1,7 +1,7 @@ CMAKE__COMPILER --------------------- -The full path to the compiler for LANG. +The full path to the compiler for ``LANG``. -This is the command that will be used as the compiler. Once +This is the command that will be used as the ```` compiler. Once set, you can not change this variable. diff --git a/Help/variable/CMAKE_LANG_COMPILER_EXTERNAL_TOOLCHAIN.rst b/Help/variable/CMAKE_LANG_COMPILER_EXTERNAL_TOOLCHAIN.rst index 033998d0c..8bb7cc08a 100644 --- a/Help/variable/CMAKE_LANG_COMPILER_EXTERNAL_TOOLCHAIN.rst +++ b/Help/variable/CMAKE_LANG_COMPILER_EXTERNAL_TOOLCHAIN.rst @@ -5,9 +5,9 @@ The external toolchain for cross-compiling, if supported. Some compiler toolchains do not ship their own auxilliary utilities such as archivers and linkers. The compiler driver may support a command-line argument -to specify the location of such tools. CMAKE__COMPILER_EXTERNAL_TOOLCHAIN -may be set to a path to a path to the external toolchain and will be passed -to the compiler driver if supported. +to specify the location of such tools. +``CMAKE__COMPILER_EXTERNAL_TOOLCHAIN`` may be set to a path to a path to +the external toolchain and will be passed to the compiler driver if supported. This variable may only be set in a toolchain file specified by the :variable:`CMAKE_TOOLCHAIN_FILE` variable. diff --git a/Help/variable/CMAKE_LANG_COMPILER_ID.rst b/Help/variable/CMAKE_LANG_COMPILER_ID.rst index f554f4ec4..1c3b134d0 100644 --- a/Help/variable/CMAKE_LANG_COMPILER_ID.rst +++ b/Help/variable/CMAKE_LANG_COMPILER_ID.rst @@ -11,6 +11,7 @@ include: Absoft = Absoft Fortran (absoft.com) ADSP = Analog VisualDSP++ (analog.com) AppleClang = Apple Clang (apple.com) + CCur = Concurrent Fortran (ccur.com) Clang = LLVM Clang (clang.llvm.org) Cray = Cray Compiler (cray.com) Embarcadero, Borland = Embarcadero (embarcadero.com) diff --git a/Help/variable/CMAKE_LANG_COMPILER_LAUNCHER.rst b/Help/variable/CMAKE_LANG_COMPILER_LAUNCHER.rst new file mode 100644 index 000000000..7961f609e --- /dev/null +++ b/Help/variable/CMAKE_LANG_COMPILER_LAUNCHER.rst @@ -0,0 +1,6 @@ +CMAKE__COMPILER_LAUNCHER +------------------------------ + +Default value for :prop_tgt:`_COMPILER_LAUNCHER` target property. +This variable is used to initialize the property on each target as it is +created. This is done only when ```` is ``C`` or ``CXX``. diff --git a/Help/variable/CMAKE_LANG_COMPILER_LOADED.rst b/Help/variable/CMAKE_LANG_COMPILER_LOADED.rst index 3b8e9aac6..9308878df 100644 --- a/Help/variable/CMAKE_LANG_COMPILER_LOADED.rst +++ b/Help/variable/CMAKE_LANG_COMPILER_LOADED.rst @@ -3,5 +3,5 @@ CMAKE__COMPILER_LOADED Defined to true if the language is enabled. -When language is enabled by project() or enable_language() this -variable is defined to 1. +When language ```` is enabled by :command:`project` or +:command:`enable_language` this variable is defined to ``1``. diff --git a/Help/variable/CMAKE_LANG_COMPILE_OBJECT.rst b/Help/variable/CMAKE_LANG_COMPILE_OBJECT.rst index f43ed6df8..ba59cad03 100644 --- a/Help/variable/CMAKE_LANG_COMPILE_OBJECT.rst +++ b/Help/variable/CMAKE_LANG_COMPILE_OBJECT.rst @@ -4,4 +4,4 @@ CMAKE__COMPILE_OBJECT Rule variable to compile a single object file. This is a rule variable that tells CMake how to compile a single -object file for the language . +object file for the language ````. diff --git a/Help/variable/CMAKE_LANG_CREATE_SHARED_LIBRARY.rst b/Help/variable/CMAKE_LANG_CREATE_SHARED_LIBRARY.rst index adf1624e5..be89f8529 100644 --- a/Help/variable/CMAKE_LANG_CREATE_SHARED_LIBRARY.rst +++ b/Help/variable/CMAKE_LANG_CREATE_SHARED_LIBRARY.rst @@ -4,4 +4,4 @@ CMAKE__CREATE_SHARED_LIBRARY Rule variable to create a shared library. This is a rule variable that tells CMake how to create a shared -library for the language . +library for the language ````. diff --git a/Help/variable/CMAKE_LANG_CREATE_SHARED_MODULE.rst b/Help/variable/CMAKE_LANG_CREATE_SHARED_MODULE.rst index 406b4daba..ae5f69d56 100644 --- a/Help/variable/CMAKE_LANG_CREATE_SHARED_MODULE.rst +++ b/Help/variable/CMAKE_LANG_CREATE_SHARED_MODULE.rst @@ -4,4 +4,4 @@ CMAKE__CREATE_SHARED_MODULE Rule variable to create a shared module. This is a rule variable that tells CMake how to create a shared -library for the language . +library for the language ````. diff --git a/Help/variable/CMAKE_LANG_CREATE_STATIC_LIBRARY.rst b/Help/variable/CMAKE_LANG_CREATE_STATIC_LIBRARY.rst index 811443293..0cff200d5 100644 --- a/Help/variable/CMAKE_LANG_CREATE_STATIC_LIBRARY.rst +++ b/Help/variable/CMAKE_LANG_CREATE_STATIC_LIBRARY.rst @@ -4,4 +4,4 @@ CMAKE__CREATE_STATIC_LIBRARY Rule variable to create a static library. This is a rule variable that tells CMake how to create a static -library for the language . +library for the language ````. diff --git a/Help/variable/CMAKE_LANG_FLAGS.rst b/Help/variable/CMAKE_LANG_FLAGS.rst index 6aa0a3e18..c57d92cbf 100644 --- a/Help/variable/CMAKE_LANG_FLAGS.rst +++ b/Help/variable/CMAKE_LANG_FLAGS.rst @@ -3,4 +3,4 @@ CMAKE__FLAGS Flags for all build types. - flags used regardless of the value of CMAKE_BUILD_TYPE. +```` flags used regardless of the value of :variable:`CMAKE_BUILD_TYPE`. diff --git a/Help/variable/CMAKE_LANG_FLAGS_DEBUG.rst b/Help/variable/CMAKE_LANG_FLAGS_DEBUG.rst index a72764187..a233d4ad7 100644 --- a/Help/variable/CMAKE_LANG_FLAGS_DEBUG.rst +++ b/Help/variable/CMAKE_LANG_FLAGS_DEBUG.rst @@ -1,6 +1,6 @@ CMAKE__FLAGS_DEBUG ------------------------ -Flags for Debug build type or configuration. +Flags for ``Debug`` build type or configuration. - flags used when CMAKE_BUILD_TYPE is Debug. +```` flags used when :variable:`CMAKE_BUILD_TYPE` is ``Debug``. diff --git a/Help/variable/CMAKE_LANG_FLAGS_MINSIZEREL.rst b/Help/variable/CMAKE_LANG_FLAGS_MINSIZEREL.rst index fbb851697..a9436c184 100644 --- a/Help/variable/CMAKE_LANG_FLAGS_MINSIZEREL.rst +++ b/Help/variable/CMAKE_LANG_FLAGS_MINSIZEREL.rst @@ -1,7 +1,7 @@ CMAKE__FLAGS_MINSIZEREL ----------------------------- -Flags for MinSizeRel build type or configuration. +Flags for ``MinSizeRel`` build type or configuration. - flags used when CMAKE_BUILD_TYPE is MinSizeRel.Short for -minimum size release. +```` flags used when :variable:`CMAKE_BUILD_TYPE` is ``MinSizeRel`` +(short for minimum size release). diff --git a/Help/variable/CMAKE_LANG_FLAGS_RELEASE.rst b/Help/variable/CMAKE_LANG_FLAGS_RELEASE.rst index 4b2c926d5..ffc5d795d 100644 --- a/Help/variable/CMAKE_LANG_FLAGS_RELEASE.rst +++ b/Help/variable/CMAKE_LANG_FLAGS_RELEASE.rst @@ -1,6 +1,6 @@ CMAKE__FLAGS_RELEASE -------------------------- -Flags for Release build type or configuration. +Flags for ``Release`` build type or configuration. - flags used when CMAKE_BUILD_TYPE is Release +```` flags used when :variable:`CMAKE_BUILD_TYPE` is ``Release``. diff --git a/Help/variable/CMAKE_LANG_FLAGS_RELWITHDEBINFO.rst b/Help/variable/CMAKE_LANG_FLAGS_RELWITHDEBINFO.rst index 16bd4e901..962768e44 100644 --- a/Help/variable/CMAKE_LANG_FLAGS_RELWITHDEBINFO.rst +++ b/Help/variable/CMAKE_LANG_FLAGS_RELWITHDEBINFO.rst @@ -1,7 +1,7 @@ CMAKE__FLAGS_RELWITHDEBINFO --------------------------------- -Flags for RelWithDebInfo type or configuration. +Flags for ``RelWithDebInfo`` type or configuration. - flags used when CMAKE_BUILD_TYPE is RelWithDebInfo. Short for -Release With Debug Information. +```` flags used when :variable:`CMAKE_BUILD_TYPE` is ``RelWithDebInfo`` +(short for Release With Debug Information). diff --git a/Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_DEBUG.rst b/Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_DEBUG.rst index c5915c390..1f639a3ba 100644 --- a/Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_DEBUG.rst +++ b/Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_DEBUG.rst @@ -1,6 +1,6 @@ CMAKE__GHS_KERNEL_FLAGS_DEBUG ----------------------------------- -GHS kernel flags for Debug build type or configuration. +GHS kernel flags for ``Debug`` build type or configuration. - flags used when CMAKE_BUILD_TYPE is Debug. +```` flags used when :variable:`CMAKE_BUILD_TYPE` is ``Debug``. diff --git a/Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_MINSIZEREL.rst b/Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_MINSIZEREL.rst index f80e785d5..94e21150a 100644 --- a/Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_MINSIZEREL.rst +++ b/Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_MINSIZEREL.rst @@ -1,7 +1,7 @@ CMAKE__GHS_KERNEL_FLAGS_MINSIZEREL ---------------------------------------- -GHS kernel flags for MinSizeRel build type or configuration. +GHS kernel flags for ``MinSizeRel`` build type or configuration. - flags used when CMAKE_BUILD_TYPE is MinSizeRel.Short for -minimum size release. +```` flags used when :variable:`CMAKE_BUILD_TYPE` is ``MinSizeRel`` +(short for minimum size release). diff --git a/Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_RELEASE.rst b/Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_RELEASE.rst index fe02bc342..74566efca 100644 --- a/Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_RELEASE.rst +++ b/Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_RELEASE.rst @@ -1,6 +1,6 @@ CMAKE__GHS_KERNEL_FLAGS_RELEASE ------------------------------------- -GHS kernel flags for Release build type or configuration. +GHS kernel flags for ``Release`` build type or configuration. - flags used when CMAKE_BUILD_TYPE is Release +```` flags used when :variable:`CMAKE_BUILD_TYPE` is ``Release``. diff --git a/Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_RELWITHDEBINFO.rst b/Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_RELWITHDEBINFO.rst index 220f7f941..d148193d8 100644 --- a/Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_RELWITHDEBINFO.rst +++ b/Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_RELWITHDEBINFO.rst @@ -1,7 +1,7 @@ CMAKE__GHS_KERNEL_FLAGS_RELWITHDEBINFO -------------------------------------------- -GHS kernel flags for RelWithDebInfo type or configuration. +GHS kernel flags for ``RelWithDebInfo`` type or configuration. - flags used when CMAKE_BUILD_TYPE is RelWithDebInfo. Short for -Release With Debug Information. +```` flags used when :variable:`CMAKE_BUILD_TYPE` is ``RelWithDebInfo`` +(short for Release With Debug Information). diff --git a/Help/variable/CMAKE_LANG_IMPLICIT_INCLUDE_DIRECTORIES.rst b/Help/variable/CMAKE_LANG_IMPLICIT_INCLUDE_DIRECTORIES.rst index c60e18c04..cc8085107 100644 --- a/Help/variable/CMAKE_LANG_IMPLICIT_INCLUDE_DIRECTORIES.rst +++ b/Help/variable/CMAKE_LANG_IMPLICIT_INCLUDE_DIRECTORIES.rst @@ -4,6 +4,6 @@ CMAKE__IMPLICIT_INCLUDE_DIRECTORIES Directories implicitly searched by the compiler for header files. CMake does not explicitly specify these directories on compiler -command lines for language . This prevents system include +command lines for language ````. This prevents system include directories from being treated as user include directories on some compilers. diff --git a/Help/variable/CMAKE_LANG_IMPLICIT_LINK_DIRECTORIES.rst b/Help/variable/CMAKE_LANG_IMPLICIT_LINK_DIRECTORIES.rst index 568950c0f..a0bd8303c 100644 --- a/Help/variable/CMAKE_LANG_IMPLICIT_LINK_DIRECTORIES.rst +++ b/Help/variable/CMAKE_LANG_IMPLICIT_LINK_DIRECTORIES.rst @@ -1,7 +1,7 @@ CMAKE__IMPLICIT_LINK_DIRECTORIES -------------------------------------- -Implicit linker search path detected for language . +Implicit linker search path detected for language ````. Compilers typically pass directories containing language runtime libraries and default library search paths when they invoke a linker. @@ -10,8 +10,8 @@ language. CMake automatically detects these directories for each language and reports the results in this variable. When a library in one of these directories is given by full path to -target_link_libraries() CMake will generate the -l form on link -lines to ensure the linker searches its implicit directories for the +:command:`target_link_libraries` CMake will generate the ``-l`` form on +link lines to ensure the linker searches its implicit directories for the library. Note that some toolchains read implicit directories from an -environment variable such as LIBRARY_PATH so keep its value consistent +environment variable such as ``LIBRARY_PATH`` so keep its value consistent when operating in a given build tree. diff --git a/Help/variable/CMAKE_LANG_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES.rst b/Help/variable/CMAKE_LANG_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES.rst index 05e6ddbd0..61ccc5a16 100644 --- a/Help/variable/CMAKE_LANG_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES.rst +++ b/Help/variable/CMAKE_LANG_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES.rst @@ -1,7 +1,7 @@ CMAKE__IMPLICIT_LINK_FRAMEWORK_DIRECTORIES ------------------------------------------------ -Implicit linker framework search path detected for language . +Implicit linker framework search path detected for language ````. These paths are implicit linker framework search directories for the compiler's language. CMake automatically detects these directories diff --git a/Help/variable/CMAKE_LANG_IMPLICIT_LINK_LIBRARIES.rst b/Help/variable/CMAKE_LANG_IMPLICIT_LINK_LIBRARIES.rst index fddfed8bc..ec164774b 100644 --- a/Help/variable/CMAKE_LANG_IMPLICIT_LINK_LIBRARIES.rst +++ b/Help/variable/CMAKE_LANG_IMPLICIT_LINK_LIBRARIES.rst @@ -1,7 +1,7 @@ CMAKE__IMPLICIT_LINK_LIBRARIES ------------------------------------ -Implicit link libraries and flags detected for language . +Implicit link libraries and flags detected for language ````. Compilers typically pass language runtime library names and other flags when they invoke a linker. These flags are implicit link diff --git a/Help/variable/CMAKE_LANG_LIBRARY_ARCHITECTURE.rst b/Help/variable/CMAKE_LANG_LIBRARY_ARCHITECTURE.rst index 4f3149464..7f888eed7 100644 --- a/Help/variable/CMAKE_LANG_LIBRARY_ARCHITECTURE.rst +++ b/Help/variable/CMAKE_LANG_LIBRARY_ARCHITECTURE.rst @@ -1,8 +1,8 @@ CMAKE__LIBRARY_ARCHITECTURE --------------------------------- -Target architecture library directory name detected for . +Target architecture library directory name detected for ````. -If the compiler passes to the linker an architecture-specific -system library search directory such as /lib/ this -variable contains the name if/as detected by CMake. +If the ```` compiler passes to the linker an architecture-specific +system library search directory such as ``/lib/`` this +variable contains the ```` name if/as detected by CMake. diff --git a/Help/variable/CMAKE_LANG_LINKER_PREFERENCE.rst b/Help/variable/CMAKE_LANG_LINKER_PREFERENCE.rst index af7ee60f7..ff82f8b4c 100644 --- a/Help/variable/CMAKE_LANG_LINKER_PREFERENCE.rst +++ b/Help/variable/CMAKE_LANG_LINKER_PREFERENCE.rst @@ -5,7 +5,7 @@ Preference value for linker language selection. The "linker language" for executable, shared library, and module targets is the language whose compiler will invoke the linker. The -LINKER_LANGUAGE target property sets the language explicitly. +:prop_tgt:`LINKER_LANGUAGE` target property sets the language explicitly. Otherwise, the linker language is that whose linker preference value is highest among languages compiled and linked into the target. See -also the CMAKE__LINKER_PREFERENCE_PROPAGATES variable. +also the :variable:`CMAKE__LINKER_PREFERENCE_PROPAGATES` variable. diff --git a/Help/variable/CMAKE_LANG_LINKER_PREFERENCE_PROPAGATES.rst b/Help/variable/CMAKE_LANG_LINKER_PREFERENCE_PROPAGATES.rst index d513767f7..dbbeb0afb 100644 --- a/Help/variable/CMAKE_LANG_LINKER_PREFERENCE_PROPAGATES.rst +++ b/Help/variable/CMAKE_LANG_LINKER_PREFERENCE_PROPAGATES.rst @@ -1,7 +1,7 @@ CMAKE__LINKER_PREFERENCE_PROPAGATES ----------------------------------------- -True if CMAKE__LINKER_PREFERENCE propagates across targets. +True if :variable:`CMAKE__LINKER_PREFERENCE` propagates across targets. This is used when CMake selects a linker language for a target. Languages compiled directly into the target are always considered. A diff --git a/Help/variable/CMAKE_LANG_OUTPUT_EXTENSION.rst b/Help/variable/CMAKE_LANG_OUTPUT_EXTENSION.rst index 22fac2900..0fbc566c1 100644 --- a/Help/variable/CMAKE_LANG_OUTPUT_EXTENSION.rst +++ b/Help/variable/CMAKE_LANG_OUTPUT_EXTENSION.rst @@ -3,5 +3,5 @@ CMAKE__OUTPUT_EXTENSION Extension for the output of a compile for a single file. -This is the extension for an object file for the given . For -example .obj for C on Windows. +This is the extension for an object file for the given ````. For +example ``.obj`` for C on Windows. diff --git a/Help/variable/CMAKE_LANG_SIMULATE_ID.rst b/Help/variable/CMAKE_LANG_SIMULATE_ID.rst index 646c0db7e..15c87a186 100644 --- a/Help/variable/CMAKE_LANG_SIMULATE_ID.rst +++ b/Help/variable/CMAKE_LANG_SIMULATE_ID.rst @@ -5,5 +5,5 @@ Identification string of "simulated" compiler. Some compilers simulate other compilers to serve as drop-in replacements. When CMake detects such a compiler it sets this -variable to what would have been the CMAKE__COMPILER_ID for the -simulated compiler. +variable to what would have been the :variable:`CMAKE__COMPILER_ID` for +the simulated compiler. diff --git a/Help/variable/CMAKE_LANG_SIMULATE_VERSION.rst b/Help/variable/CMAKE_LANG_SIMULATE_VERSION.rst index 982053df2..d6325e06d 100644 --- a/Help/variable/CMAKE_LANG_SIMULATE_VERSION.rst +++ b/Help/variable/CMAKE_LANG_SIMULATE_VERSION.rst @@ -5,5 +5,5 @@ Version string of "simulated" compiler. Some compilers simulate other compilers to serve as drop-in replacements. When CMake detects such a compiler it sets this -variable to what would have been the CMAKE__COMPILER_VERSION for -the simulated compiler. +variable to what would have been the :variable:`CMAKE__COMPILER_VERSION` +for the simulated compiler. diff --git a/Help/variable/CMAKE_LANG_SIZEOF_DATA_PTR.rst b/Help/variable/CMAKE_LANG_SIZEOF_DATA_PTR.rst index c85b5e078..746592324 100644 --- a/Help/variable/CMAKE_LANG_SIZEOF_DATA_PTR.rst +++ b/Help/variable/CMAKE_LANG_SIZEOF_DATA_PTR.rst @@ -1,7 +1,7 @@ CMAKE__SIZEOF_DATA_PTR ---------------------------- -Size of pointer-to-data types for language . +Size of pointer-to-data types for language ````. This holds the size (in bytes) of pointer-to-data types in the target -platform ABI. It is defined for languages C and CXX (C++). +platform ABI. It is defined for languages ``C`` and ``CXX`` (C++). diff --git a/Help/variable/CMAKE_LIBRARY_ARCHITECTURE.rst b/Help/variable/CMAKE_LIBRARY_ARCHITECTURE.rst index c9a15f315..8a7dcbd6d 100644 --- a/Help/variable/CMAKE_LIBRARY_ARCHITECTURE.rst +++ b/Help/variable/CMAKE_LIBRARY_ARCHITECTURE.rst @@ -3,5 +3,5 @@ CMAKE_LIBRARY_ARCHITECTURE Target architecture library directory name, if detected. -This is the value of CMAKE__LIBRARY_ARCHITECTURE as detected for -one of the enabled languages. +This is the value of :variable:`CMAKE__LIBRARY_ARCHITECTURE` as detected +for one of the enabled languages. diff --git a/Help/variable/CMAKE_LIBRARY_ARCHITECTURE_REGEX.rst b/Help/variable/CMAKE_LIBRARY_ARCHITECTURE_REGEX.rst index 6c4126903..1eb2ac2c8 100644 --- a/Help/variable/CMAKE_LIBRARY_ARCHITECTURE_REGEX.rst +++ b/Help/variable/CMAKE_LIBRARY_ARCHITECTURE_REGEX.rst @@ -3,5 +3,5 @@ CMAKE_LIBRARY_ARCHITECTURE_REGEX Regex matching possible target architecture library directory names. -This is used to detect CMAKE__LIBRARY_ARCHITECTURE from the -implicit linker search path by matching the name. +This is used to detect :variable:`CMAKE__LIBRARY_ARCHITECTURE` from the +implicit linker search path by matching the ```` name. diff --git a/Help/variable/CMAKE_LIBRARY_PATH_FLAG.rst b/Help/variable/CMAKE_LIBRARY_PATH_FLAG.rst index ede39e9d6..ebe5fda9a 100644 --- a/Help/variable/CMAKE_LIBRARY_PATH_FLAG.rst +++ b/Help/variable/CMAKE_LIBRARY_PATH_FLAG.rst @@ -4,4 +4,4 @@ CMAKE_LIBRARY_PATH_FLAG The flag to be used to add a library search path to a compiler. The flag will be used to specify a library directory to the compiler. -On most compilers this is "-L". +On most compilers this is ``-L``. diff --git a/Help/variable/CMAKE_LINK_DEF_FILE_FLAG.rst b/Help/variable/CMAKE_LINK_DEF_FILE_FLAG.rst index 382447c98..fa09f9f9c 100644 --- a/Help/variable/CMAKE_LINK_DEF_FILE_FLAG.rst +++ b/Help/variable/CMAKE_LINK_DEF_FILE_FLAG.rst @@ -1,7 +1,7 @@ CMAKE_LINK_DEF_FILE_FLAG ------------------------ -Linker flag to be used to specify a .def file for dll creation. +Linker flag to be used to specify a ``.def`` file for dll creation. -The flag will be used to add a .def file when creating a dll on +The flag will be used to add a ``.def`` file when creating a dll on Windows; this is only defined on Windows. diff --git a/Help/variable/CMAKE_LINK_DEPENDS_NO_SHARED.rst b/Help/variable/CMAKE_LINK_DEPENDS_NO_SHARED.rst index 6ae7df68d..cec7906a1 100644 --- a/Help/variable/CMAKE_LINK_DEPENDS_NO_SHARED.rst +++ b/Help/variable/CMAKE_LINK_DEPENDS_NO_SHARED.rst @@ -3,6 +3,6 @@ CMAKE_LINK_DEPENDS_NO_SHARED Whether to skip link dependencies on shared library files. -This variable initializes the LINK_DEPENDS_NO_SHARED property on +This variable initializes the :prop_tgt:`LINK_DEPENDS_NO_SHARED` property on targets when they are created. See that target property for additional information. diff --git a/Help/variable/CMAKE_LINK_INTERFACE_LIBRARIES.rst b/Help/variable/CMAKE_LINK_INTERFACE_LIBRARIES.rst index efe6fd74c..33865dae3 100644 --- a/Help/variable/CMAKE_LINK_INTERFACE_LIBRARIES.rst +++ b/Help/variable/CMAKE_LINK_INTERFACE_LIBRARIES.rst @@ -1,8 +1,8 @@ CMAKE_LINK_INTERFACE_LIBRARIES ------------------------------ -Default value for LINK_INTERFACE_LIBRARIES of targets. +Default value for :prop_tgt:`LINK_INTERFACE_LIBRARIES` of targets. -This variable is used to initialize the LINK_INTERFACE_LIBRARIES +This variable is used to initialize the :prop_tgt:`LINK_INTERFACE_LIBRARIES` property on all the targets. See that target property for additional information. diff --git a/Help/variable/CMAKE_LINK_LIBRARY_FLAG.rst b/Help/variable/CMAKE_LINK_LIBRARY_FLAG.rst index c3e02d736..b5197e45a 100644 --- a/Help/variable/CMAKE_LINK_LIBRARY_FLAG.rst +++ b/Help/variable/CMAKE_LINK_LIBRARY_FLAG.rst @@ -4,4 +4,4 @@ CMAKE_LINK_LIBRARY_FLAG Flag to be used to link a library into an executable. The flag will be used to specify a library to link to an executable. -On most compilers this is "-l". +On most compilers this is ``-l``. diff --git a/Help/variable/CMAKE_LINK_LIBRARY_SUFFIX.rst b/Help/variable/CMAKE_LINK_LIBRARY_SUFFIX.rst index 390298d85..0ddafe853 100644 --- a/Help/variable/CMAKE_LINK_LIBRARY_SUFFIX.rst +++ b/Help/variable/CMAKE_LINK_LIBRARY_SUFFIX.rst @@ -3,4 +3,4 @@ CMAKE_LINK_LIBRARY_SUFFIX The suffix for libraries that you link to. -The suffix to use for the end of a library filename, .lib on Windows. +The suffix to use for the end of a library filename, ``.lib`` on Windows. diff --git a/Help/variable/CMAKE_LINK_SEARCH_END_STATIC.rst b/Help/variable/CMAKE_LINK_SEARCH_END_STATIC.rst new file mode 100644 index 000000000..54cdaaa8e --- /dev/null +++ b/Help/variable/CMAKE_LINK_SEARCH_END_STATIC.rst @@ -0,0 +1,19 @@ +CMAKE_LINK_SEARCH_END_STATIC +---------------------------- + +End a link line such that static system libraries are used. + +Some linkers support switches such as ``-Bstatic`` and ``-Bdynamic`` to +determine whether to use static or shared libraries for ``-lXXX`` options. +CMake uses these options to set the link type for libraries whose full +paths are not known or (in some cases) are in implicit link +directories for the platform. By default CMake adds an option at the +end of the library list (if necessary) to set the linker search type +back to its starting type. This property switches the final linker +search type to ``-Bstatic`` regardless of how it started. + +This variable is used to initialize the target property +:prop_tgt:`LINK_SEARCH_END_STATIC` for all targets. If set, it's +value is also used by the :command:`try_compile` command. + +See also :variable:`CMAKE_LINK_SEARCH_START_STATIC`. diff --git a/Help/variable/CMAKE_LINK_SEARCH_START_STATIC.rst b/Help/variable/CMAKE_LINK_SEARCH_START_STATIC.rst new file mode 100644 index 000000000..0d52a3143 --- /dev/null +++ b/Help/variable/CMAKE_LINK_SEARCH_START_STATIC.rst @@ -0,0 +1,20 @@ +CMAKE_LINK_SEARCH_START_STATIC +------------------------------ + +Assume the linker looks for static libraries by default. + +Some linkers support switches such as ``-Bstatic`` and ``-Bdynamic`` to +determine whether to use static or shared libraries for ``-lXXX`` options. +CMake uses these options to set the link type for libraries whose full +paths are not known or (in some cases) are in implicit link +directories for the platform. By default the linker search type is +assumed to be ``-Bdynamic`` at the beginning of the library list. This +property switches the assumption to ``-Bstatic``. It is intended for use +when linking an executable statically (e.g. with the GNU ``-static`` +option). + +This variable is used to initialize the target property +:prop_tgt:`LINK_SEARCH_START_STATIC` for all targets. If set, it's +value is also used by the :command:`try_compile` command. + +See also :variable:`CMAKE_LINK_SEARCH_END_STATIC`. diff --git a/Help/variable/CMAKE_MACOSX_BUNDLE.rst b/Help/variable/CMAKE_MACOSX_BUNDLE.rst index e4768f369..0badaf0da 100644 --- a/Help/variable/CMAKE_MACOSX_BUNDLE.rst +++ b/Help/variable/CMAKE_MACOSX_BUNDLE.rst @@ -1,7 +1,7 @@ CMAKE_MACOSX_BUNDLE ------------------- -Default value for MACOSX_BUNDLE of targets. +Default value for :prop_tgt:`MACOSX_BUNDLE` of targets. -This variable is used to initialize the MACOSX_BUNDLE property on all -the targets. See that target property for additional information. +This variable is used to initialize the :prop_tgt:`MACOSX_BUNDLE` property on +all the targets. See that target property for additional information. diff --git a/Help/variable/CMAKE_MAKE_PROGRAM.rst b/Help/variable/CMAKE_MAKE_PROGRAM.rst index 85b098bd6..edf27328c 100644 --- a/Help/variable/CMAKE_MAKE_PROGRAM.rst +++ b/Help/variable/CMAKE_MAKE_PROGRAM.rst @@ -8,18 +8,18 @@ name if it is expected to be in the ``PATH``. The tool selected depends on the :variable:`CMAKE_GENERATOR` used to configure the project: -* The Makefile generators set this to ``make``, ``gmake``, or - a generator-specific tool (e.g. ``nmake`` for "NMake Makefiles"). +* The :ref:`Makefile Generators` set this to ``make``, ``gmake``, or + a generator-specific tool (e.g. ``nmake`` for :generator:`NMake Makefiles`). These generators store ``CMAKE_MAKE_PROGRAM`` in the CMake cache so that it may be edited by the user. -* The Ninja generator sets this to ``ninja``. +* The :generator:`Ninja` generator sets this to ``ninja``. This generator stores ``CMAKE_MAKE_PROGRAM`` in the CMake cache so that it may be edited by the user. -* The Xcode generator sets this to ``xcodebuild`` (or possibly an +* The :generator:`Xcode` generator sets this to ``xcodebuild`` (or possibly an otherwise undocumented ``cmakexbuild`` wrapper implementing some workarounds). @@ -33,7 +33,7 @@ to configure the project: a user or project explicitly adds ``CMAKE_MAKE_PROGRAM`` to the CMake cache then CMake will use the specified value. -* The Visual Studio generators set this to the full path to +* The :ref:`Visual Studio Generators` set this to the full path to ``MSBuild.exe`` (VS >= 10), ``devenv.com`` (VS 7,8,9), ``VCExpress.exe`` (VS Express 8,9), or ``msdev.exe`` (VS 6). (See also variables diff --git a/Help/variable/CMAKE_MAP_IMPORTED_CONFIG_CONFIG.rst b/Help/variable/CMAKE_MAP_IMPORTED_CONFIG_CONFIG.rst index 41ccde1c5..ed29afe33 100644 --- a/Help/variable/CMAKE_MAP_IMPORTED_CONFIG_CONFIG.rst +++ b/Help/variable/CMAKE_MAP_IMPORTED_CONFIG_CONFIG.rst @@ -1,8 +1,8 @@ CMAKE_MAP_IMPORTED_CONFIG_ ---------------------------------- -Default value for MAP_IMPORTED_CONFIG_ of targets. +Default value for :prop_tgt:`MAP_IMPORTED_CONFIG_` of targets. -This variable is used to initialize the MAP_IMPORTED_CONFIG_ -property on all the targets. See that target property for additional -information. +This variable is used to initialize the +:prop_tgt:`MAP_IMPORTED_CONFIG_` property on all the targets. See +that target property for additional information. diff --git a/Help/variable/CMAKE_MFC_FLAG.rst b/Help/variable/CMAKE_MFC_FLAG.rst index 221d26e4f..f60e7a597 100644 --- a/Help/variable/CMAKE_MFC_FLAG.rst +++ b/Help/variable/CMAKE_MFC_FLAG.rst @@ -3,10 +3,10 @@ CMAKE_MFC_FLAG Tell cmake to use MFC for an executable or dll. -This can be set in a CMakeLists.txt file and will enable MFC in the -application. It should be set to 1 for the static MFC library, and 2 +This can be set in a ``CMakeLists.txt`` file and will enable MFC in the +application. It should be set to ``1`` for the static MFC library, and ``2`` for the shared MFC library. This is used in Visual Studio 6 and 7 -project files. The CMakeSetup dialog used MFC and the CMakeLists.txt +project files. The CMakeSetup dialog used MFC and the ``CMakeLists.txt`` looks like this: :: diff --git a/Help/variable/CMAKE_MINIMUM_REQUIRED_VERSION.rst b/Help/variable/CMAKE_MINIMUM_REQUIRED_VERSION.rst index 351de442c..5a51634db 100644 --- a/Help/variable/CMAKE_MINIMUM_REQUIRED_VERSION.rst +++ b/Help/variable/CMAKE_MINIMUM_REQUIRED_VERSION.rst @@ -1,7 +1,7 @@ CMAKE_MINIMUM_REQUIRED_VERSION ------------------------------ -Version specified to cmake_minimum_required command +Version specified to :command:`cmake_minimum_required` command -Variable containing the VERSION component specified in the -cmake_minimum_required command. +Variable containing the ``VERSION`` component specified in the +:command:`cmake_minimum_required` command. diff --git a/Help/variable/CMAKE_MODULE_LINKER_FLAGS_CONFIG.rst b/Help/variable/CMAKE_MODULE_LINKER_FLAGS_CONFIG.rst index 87a19011f..393263ec8 100644 --- a/Help/variable/CMAKE_MODULE_LINKER_FLAGS_CONFIG.rst +++ b/Help/variable/CMAKE_MODULE_LINKER_FLAGS_CONFIG.rst @@ -3,4 +3,4 @@ CMAKE_MODULE_LINKER_FLAGS_ Flags to be used when linking a module. -Same as CMAKE_C_FLAGS_* but used by the linker when creating modules. +Same as ``CMAKE_C_FLAGS_*`` but used by the linker when creating modules. diff --git a/Help/variable/CMAKE_NOT_USING_CONFIG_FLAGS.rst b/Help/variable/CMAKE_NOT_USING_CONFIG_FLAGS.rst index cbe035022..98960c520 100644 --- a/Help/variable/CMAKE_NOT_USING_CONFIG_FLAGS.rst +++ b/Help/variable/CMAKE_NOT_USING_CONFIG_FLAGS.rst @@ -1,7 +1,7 @@ CMAKE_NOT_USING_CONFIG_FLAGS ---------------------------- -Skip _BUILD_TYPE flags if true. +Skip ``_BUILD_TYPE`` flags if true. This is an internal flag used by the generators in CMake to tell CMake -to skip the _BUILD_TYPE flags. +to skip the ``_BUILD_TYPE`` flags. diff --git a/Help/variable/CMAKE_NO_SYSTEM_FROM_IMPORTED.rst b/Help/variable/CMAKE_NO_SYSTEM_FROM_IMPORTED.rst index c1919afd2..61e04b4ca 100644 --- a/Help/variable/CMAKE_NO_SYSTEM_FROM_IMPORTED.rst +++ b/Help/variable/CMAKE_NO_SYSTEM_FROM_IMPORTED.rst @@ -1,8 +1,8 @@ CMAKE_NO_SYSTEM_FROM_IMPORTED ----------------------------- -Default value for NO_SYSTEM_FROM_IMPORTED of targets. +Default value for :prop_tgt:`NO_SYSTEM_FROM_IMPORTED` of targets. -This variable is used to initialize the NO_SYSTEM_FROM_IMPORTED +This variable is used to initialize the :prop_tgt:`NO_SYSTEM_FROM_IMPORTED` property on all the targets. See that target property for additional information. diff --git a/Help/variable/CMAKE_PARENT_LIST_FILE.rst b/Help/variable/CMAKE_PARENT_LIST_FILE.rst index 5566a7222..cfd8608c3 100644 --- a/Help/variable/CMAKE_PARENT_LIST_FILE.rst +++ b/Help/variable/CMAKE_PARENT_LIST_FILE.rst @@ -3,7 +3,7 @@ CMAKE_PARENT_LIST_FILE Full path to the CMake file that included the current one. -While processing a CMake file loaded by include() or find_package() -this variable contains the full path to the file including it. The -top of the include stack is always the CMakeLists.txt for the current -directory. See also CMAKE_CURRENT_LIST_FILE. +While processing a CMake file loaded by :command:`include` or +:command:`find_package` this variable contains the full path to the file +including it. The top of the include stack is always the ``CMakeLists.txt`` +for the current directory. See also :variable:`CMAKE_CURRENT_LIST_FILE`. diff --git a/Help/variable/CMAKE_POLICY_DEFAULT_CMPNNNN.rst b/Help/variable/CMAKE_POLICY_DEFAULT_CMPNNNN.rst index e401aa500..43582be94 100644 --- a/Help/variable/CMAKE_POLICY_DEFAULT_CMPNNNN.rst +++ b/Help/variable/CMAKE_POLICY_DEFAULT_CMPNNNN.rst @@ -1,16 +1,17 @@ CMAKE_POLICY_DEFAULT_CMP ------------------------------ -Default for CMake Policy CMP when it is otherwise left unset. +Default for CMake Policy ``CMP`` when it is otherwise left unset. -Commands cmake_minimum_required(VERSION) and cmake_policy(VERSION) by -default leave policies introduced after the given version unset. Set -CMAKE_POLICY_DEFAULT_CMP to OLD or NEW to specify the default -for policy CMP, where is the policy number. +Commands :command:`cmake_minimum_required(VERSION)` and +:command:`cmake_policy(VERSION)` by default leave policies introduced after +the given version unset. Set ``CMAKE_POLICY_DEFAULT_CMP`` to ``OLD`` +or ``NEW`` to specify the default for policy ``CMP``, where ```` +is the policy number. This variable should not be set by a project in CMake code; use -cmake_policy(SET) instead. Users running CMake may set this variable -in the cache (e.g. -DCMAKE_POLICY_DEFAULT_CMP=) to set -a policy not otherwise set by the project. Set to OLD to quiet a -policy warning while using old behavior or to NEW to try building the +:command:`cmake_policy(SET)` instead. Users running CMake may set this +variable in the cache (e.g. ``-DCMAKE_POLICY_DEFAULT_CMP=``) +to set a policy not otherwise set by the project. Set to ``OLD`` to quiet a +policy warning while using old behavior or to ``NEW`` to try building the project with new behavior. diff --git a/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst b/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst index 092fe3eb6..582f9e495 100644 --- a/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst +++ b/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst @@ -13,9 +13,11 @@ warn by default: policy :policy:`CMP0056`. * ``CMAKE_POLICY_WARNING_CMP0060`` controls the warning for policy :policy:`CMP0060`. +* ``CMAKE_POLICY_WARNING_CMP0065`` controls the warning for + policy :policy:`CMP0065`. This variable should not be set by a project in CMake code. Project developers running CMake may set this variable in their cache to enable the warning (e.g. ``-DCMAKE_POLICY_WARNING_CMP=ON``). -Alternatively, running :manual:`cmake(1)` with the ``--debug-output`` -or ``--trace`` option will also enable the warning. +Alternatively, running :manual:`cmake(1)` with the ``--debug-output``, +``--trace``, or ``--trace-expand`` option will also enable the warning. diff --git a/Help/variable/CMAKE_POSITION_INDEPENDENT_CODE.rst b/Help/variable/CMAKE_POSITION_INDEPENDENT_CODE.rst index 5e7166567..43b1397eb 100644 --- a/Help/variable/CMAKE_POSITION_INDEPENDENT_CODE.rst +++ b/Help/variable/CMAKE_POSITION_INDEPENDENT_CODE.rst @@ -1,8 +1,9 @@ CMAKE_POSITION_INDEPENDENT_CODE ------------------------------- -Default value for POSITION_INDEPENDENT_CODE of targets. +Default value for :prop_tgt:`POSITION_INDEPENDENT_CODE` of targets. -This variable is used to initialize the POSITION_INDEPENDENT_CODE -property on all the targets. See that target property for additional -information. +This variable is used to initialize the +:prop_tgt:`POSITION_INDEPENDENT_CODE` property on all the targets. +See that target property for additional information. If set, it's +value is also used by the :command:`try_compile` command. diff --git a/Help/variable/CMAKE_PROJECT_NAME.rst b/Help/variable/CMAKE_PROJECT_NAME.rst index 47347051a..431e9f302 100644 --- a/Help/variable/CMAKE_PROJECT_NAME.rst +++ b/Help/variable/CMAKE_PROJECT_NAME.rst @@ -4,4 +4,4 @@ CMAKE_PROJECT_NAME The name of the current project. This specifies name of the current project from the closest inherited -PROJECT command. +:command:`project` command. diff --git a/Help/variable/CMAKE_ROOT.rst b/Help/variable/CMAKE_ROOT.rst index f963a7f83..1d0a8af80 100644 --- a/Help/variable/CMAKE_ROOT.rst +++ b/Help/variable/CMAKE_ROOT.rst @@ -3,6 +3,6 @@ CMAKE_ROOT Install directory for running cmake. -This is the install root for the running CMake and the Modules +This is the install root for the running CMake and the ``Modules`` directory can be found here. This is commonly used in this format: -${CMAKE_ROOT}/Modules +``${CMAKE_ROOT}/Modules`` diff --git a/Help/variable/CMAKE_SCRIPT_MODE_FILE.rst b/Help/variable/CMAKE_SCRIPT_MODE_FILE.rst index ad73cc027..981af60cf 100644 --- a/Help/variable/CMAKE_SCRIPT_MODE_FILE.rst +++ b/Help/variable/CMAKE_SCRIPT_MODE_FILE.rst @@ -1,8 +1,9 @@ CMAKE_SCRIPT_MODE_FILE ---------------------- -Full path to the -P script file currently being processed. +Full path to the :manual:`cmake(1)` ``-P`` script file currently being +processed. -When run in -P script mode, CMake sets this variable to the full path -of the script file. When run to configure a CMakeLists.txt file, this -variable is not set. +When run in :manual:`cmake(1)` ``-P`` script mode, CMake sets this variable to +the full path of the script file. When run to configure a ``CMakeLists.txt`` +file, this variable is not set. diff --git a/Help/variable/CMAKE_SHARED_LIBRARY_PREFIX.rst b/Help/variable/CMAKE_SHARED_LIBRARY_PREFIX.rst index a863e2a6c..8afabafe5 100644 --- a/Help/variable/CMAKE_SHARED_LIBRARY_PREFIX.rst +++ b/Help/variable/CMAKE_SHARED_LIBRARY_PREFIX.rst @@ -3,6 +3,6 @@ CMAKE_SHARED_LIBRARY_PREFIX The prefix for shared libraries that you link to. -The prefix to use for the name of a shared library, lib on UNIX. +The prefix to use for the name of a shared library, ``lib`` on UNIX. -CMAKE_SHARED_LIBRARY_PREFIX_ overrides this for language . +``CMAKE_SHARED_LIBRARY_PREFIX_`` overrides this for language ````. diff --git a/Help/variable/CMAKE_SHARED_LIBRARY_SUFFIX.rst b/Help/variable/CMAKE_SHARED_LIBRARY_SUFFIX.rst index c296ecd81..1f96a328e 100644 --- a/Help/variable/CMAKE_SHARED_LIBRARY_SUFFIX.rst +++ b/Help/variable/CMAKE_SHARED_LIBRARY_SUFFIX.rst @@ -3,7 +3,7 @@ CMAKE_SHARED_LIBRARY_SUFFIX The suffix for shared libraries that you link to. -The suffix to use for the end of a shared library filename, .dll on +The suffix to use for the end of a shared library filename, ``.dll`` on Windows. -CMAKE_SHARED_LIBRARY_SUFFIX_ overrides this for language . +``CMAKE_SHARED_LIBRARY_SUFFIX_`` overrides this for language ````. diff --git a/Help/variable/CMAKE_SHARED_LINKER_FLAGS_CONFIG.rst b/Help/variable/CMAKE_SHARED_LINKER_FLAGS_CONFIG.rst index fedc6264a..4bf87a0b6 100644 --- a/Help/variable/CMAKE_SHARED_LINKER_FLAGS_CONFIG.rst +++ b/Help/variable/CMAKE_SHARED_LINKER_FLAGS_CONFIG.rst @@ -3,5 +3,5 @@ CMAKE_SHARED_LINKER_FLAGS_ Flags to be used when linking a shared library. -Same as CMAKE_C_FLAGS_* but used by the linker when creating shared +Same as ``CMAKE_C_FLAGS_*`` but used by the linker when creating shared libraries. diff --git a/Help/variable/CMAKE_SHARED_MODULE_PREFIX.rst b/Help/variable/CMAKE_SHARED_MODULE_PREFIX.rst index a5a2428b1..d6eef9866 100644 --- a/Help/variable/CMAKE_SHARED_MODULE_PREFIX.rst +++ b/Help/variable/CMAKE_SHARED_MODULE_PREFIX.rst @@ -5,4 +5,4 @@ The prefix for loadable modules that you link to. The prefix to use for the name of a loadable module on this platform. -CMAKE_SHARED_MODULE_PREFIX_ overrides this for language . +``CMAKE_SHARED_MODULE_PREFIX_`` overrides this for language ````. diff --git a/Help/variable/CMAKE_SHARED_MODULE_SUFFIX.rst b/Help/variable/CMAKE_SHARED_MODULE_SUFFIX.rst index 32a3c3460..81515c3cf 100644 --- a/Help/variable/CMAKE_SHARED_MODULE_SUFFIX.rst +++ b/Help/variable/CMAKE_SHARED_MODULE_SUFFIX.rst @@ -6,4 +6,4 @@ The suffix for shared libraries that you link to. The suffix to use for the end of a loadable module filename on this platform -CMAKE_SHARED_MODULE_SUFFIX_ overrides this for language . +``CMAKE_SHARED_MODULE_SUFFIX_`` overrides this for language ````. diff --git a/Help/variable/CMAKE_SIZEOF_VOID_P.rst b/Help/variable/CMAKE_SIZEOF_VOID_P.rst index 98dbed660..f5464d1d4 100644 --- a/Help/variable/CMAKE_SIZEOF_VOID_P.rst +++ b/Help/variable/CMAKE_SIZEOF_VOID_P.rst @@ -1,8 +1,8 @@ CMAKE_SIZEOF_VOID_P ------------------- -Size of a void pointer. +Size of a ``void`` pointer. This is set to the size of a pointer on the target machine, and is determined -by a try compile. If a 64 bit size is found, then the library search -path is modified to look for 64 bit libraries first. +by a try compile. If a 64-bit size is found, then the library search +path is modified to look for 64-bit libraries first. diff --git a/Help/variable/CMAKE_SKIP_INSTALL_ALL_DEPENDENCY.rst b/Help/variable/CMAKE_SKIP_INSTALL_ALL_DEPENDENCY.rst index 33ee8a892..80a68c972 100644 --- a/Help/variable/CMAKE_SKIP_INSTALL_ALL_DEPENDENCY.rst +++ b/Help/variable/CMAKE_SKIP_INSTALL_ALL_DEPENDENCY.rst @@ -1,11 +1,11 @@ CMAKE_SKIP_INSTALL_ALL_DEPENDENCY --------------------------------- -Don't make the install target depend on the all target. +Don't make the ``install`` target depend on the ``all`` target. -By default, the "install" target depends on the "all" target. This -has the effect, that when "make install" is invoked or INSTALL is -built, first the "all" target is built, then the installation starts. -If CMAKE_SKIP_INSTALL_ALL_DEPENDENCY is set to TRUE, this dependency -is not created, so the installation process will start immediately, +By default, the ``install`` target depends on the ``all`` target. This +has the effect, that when ``make install`` is invoked or ``INSTALL`` is +built, first the ``all`` target is built, then the installation starts. +If :variable:`CMAKE_SKIP_INSTALL_ALL_DEPENDENCY` is set to ``TRUE``, this +dependency is not created, so the installation process will start immediately, independent from whether the project has been completely built or not. diff --git a/Help/variable/CMAKE_SKIP_INSTALL_RPATH.rst b/Help/variable/CMAKE_SKIP_INSTALL_RPATH.rst index f16b2120f..cc0ac21ee 100644 --- a/Help/variable/CMAKE_SKIP_INSTALL_RPATH.rst +++ b/Help/variable/CMAKE_SKIP_INSTALL_RPATH.rst @@ -11,4 +11,4 @@ always installed without RPATH, even if RPATH is enabled when building. This can be useful for example to allow running tests from the build directory with RPATH enabled before the installation step. To omit RPATH in both the build and install steps, use -CMAKE_SKIP_RPATH instead. +:variable:`CMAKE_SKIP_RPATH` instead. diff --git a/Help/variable/CMAKE_SKIP_INSTALL_RULES.rst b/Help/variable/CMAKE_SKIP_INSTALL_RULES.rst index 5eda25442..44966f32f 100644 --- a/Help/variable/CMAKE_SKIP_INSTALL_RULES.rst +++ b/Help/variable/CMAKE_SKIP_INSTALL_RULES.rst @@ -3,5 +3,6 @@ CMAKE_SKIP_INSTALL_RULES Whether to disable generation of installation rules. -If TRUE, cmake will neither generate installaton rules nor -will it generate cmake_install.cmake files. This variable is FALSE by default. +If ``TRUE``, cmake will neither generate installaton rules nor +will it generate ``cmake_install.cmake`` files. This variable is ``FALSE`` by +default. diff --git a/Help/variable/CMAKE_SKIP_RPATH.rst b/Help/variable/CMAKE_SKIP_RPATH.rst index c93f67f53..d7ce8e43d 100644 --- a/Help/variable/CMAKE_SKIP_RPATH.rst +++ b/Help/variable/CMAKE_SKIP_RPATH.rst @@ -3,8 +3,8 @@ CMAKE_SKIP_RPATH If true, do not add run time path information. -If this is set to TRUE, then the rpath information is not added to +If this is set to ``TRUE``, then the rpath information is not added to compiled executables. The default is to add rpath information if the platform supports it. This allows for easy running from the build tree. To omit RPATH in the install step, but not the build step, use -CMAKE_SKIP_INSTALL_RPATH instead. +:variable:`CMAKE_SKIP_INSTALL_RPATH` instead. diff --git a/Help/variable/CMAKE_SOURCE_DIR.rst b/Help/variable/CMAKE_SOURCE_DIR.rst index 088fa8361..3df0226dc 100644 --- a/Help/variable/CMAKE_SOURCE_DIR.rst +++ b/Help/variable/CMAKE_SOURCE_DIR.rst @@ -5,4 +5,4 @@ The path to the top level of the source tree. This is the full path to the top level of the current CMake source tree. For an in-source build, this would be the same as -CMAKE_BINARY_DIR. +:variable:`CMAKE_BINARY_DIR`. diff --git a/Help/variable/CMAKE_STAGING_PREFIX.rst b/Help/variable/CMAKE_STAGING_PREFIX.rst index c4de7da85..1310e9471 100644 --- a/Help/variable/CMAKE_STAGING_PREFIX.rst +++ b/Help/variable/CMAKE_STAGING_PREFIX.rst @@ -5,9 +5,10 @@ This variable may be set to a path to install to when cross-compiling. This can be useful if the path in :variable:`CMAKE_SYSROOT` is read-only, or otherwise should remain pristine. -The CMAKE_STAGING_PREFIX location is also used as a search prefix by the ``find_*`` -commands. This can be controlled by setting the :variable:`CMAKE_FIND_NO_INSTALL_PREFIX` -variable. +The ``CMAKE_STAGING_PREFIX`` location is also used as a search prefix by the +``find_*`` commands. This can be controlled by setting the +:variable:`CMAKE_FIND_NO_INSTALL_PREFIX` variable. -If any RPATH/RUNPATH entries passed to the linker contain the CMAKE_STAGING_PREFIX, -the matching path fragments are replaced with the :variable:`CMAKE_INSTALL_PREFIX`. +If any RPATH/RUNPATH entries passed to the linker contain the +``CMAKE_STAGING_PREFIX``, the matching path fragments are replaced with the +:variable:`CMAKE_INSTALL_PREFIX`. diff --git a/Help/variable/CMAKE_STATIC_LIBRARY_PREFIX.rst b/Help/variable/CMAKE_STATIC_LIBRARY_PREFIX.rst index 0a3095d0b..714b5cc3b 100644 --- a/Help/variable/CMAKE_STATIC_LIBRARY_PREFIX.rst +++ b/Help/variable/CMAKE_STATIC_LIBRARY_PREFIX.rst @@ -3,6 +3,6 @@ CMAKE_STATIC_LIBRARY_PREFIX The prefix for static libraries that you link to. -The prefix to use for the name of a static library, lib on UNIX. +The prefix to use for the name of a static library, ``lib`` on UNIX. -CMAKE_STATIC_LIBRARY_PREFIX_ overrides this for language . +``CMAKE_STATIC_LIBRARY_PREFIX_`` overrides this for language ````. diff --git a/Help/variable/CMAKE_STATIC_LIBRARY_SUFFIX.rst b/Help/variable/CMAKE_STATIC_LIBRARY_SUFFIX.rst index 4d07671e1..28dc09dd3 100644 --- a/Help/variable/CMAKE_STATIC_LIBRARY_SUFFIX.rst +++ b/Help/variable/CMAKE_STATIC_LIBRARY_SUFFIX.rst @@ -3,7 +3,7 @@ CMAKE_STATIC_LIBRARY_SUFFIX The suffix for static libraries that you link to. -The suffix to use for the end of a static library filename, .lib on +The suffix to use for the end of a static library filename, ``.lib`` on Windows. -CMAKE_STATIC_LIBRARY_SUFFIX_ overrides this for language . +``CMAKE_STATIC_LIBRARY_SUFFIX_`` overrides this for language ````. diff --git a/Help/variable/CMAKE_STATIC_LINKER_FLAGS_CONFIG.rst b/Help/variable/CMAKE_STATIC_LINKER_FLAGS_CONFIG.rst index 6cde24ddd..b9f8003c7 100644 --- a/Help/variable/CMAKE_STATIC_LINKER_FLAGS_CONFIG.rst +++ b/Help/variable/CMAKE_STATIC_LINKER_FLAGS_CONFIG.rst @@ -3,5 +3,5 @@ CMAKE_STATIC_LINKER_FLAGS_ Flags to be used when linking a static library. -Same as CMAKE_C_FLAGS_* but used by the linker when creating static +Same as ``CMAKE_C_FLAGS_*`` but used by the linker when creating static libraries. diff --git a/Help/variable/CMAKE_SYSTEM.rst b/Help/variable/CMAKE_SYSTEM.rst index 23f598087..c7d0d8a5d 100644 --- a/Help/variable/CMAKE_SYSTEM.rst +++ b/Help/variable/CMAKE_SYSTEM.rst @@ -1,7 +1,7 @@ CMAKE_SYSTEM ------------ -Composit Name of OS CMake is compiling for. +Composite name of operating system CMake is compiling for. This variable is the composite of :variable:`CMAKE_SYSTEM_NAME` and :variable:`CMAKE_SYSTEM_VERSION`, e.g. diff --git a/Help/variable/CMAKE_SYSTEM_APPBUNDLE_PATH.rst b/Help/variable/CMAKE_SYSTEM_APPBUNDLE_PATH.rst new file mode 100644 index 000000000..3c6687c6e --- /dev/null +++ b/Help/variable/CMAKE_SYSTEM_APPBUNDLE_PATH.rst @@ -0,0 +1,7 @@ +CMAKE_SYSTEM_APPBUNDLE_PATH +--------------------------- + +Search path for OS X application bundles used by the :command:`find_program`, +and :command:`find_package` commands. By default it contains the standard +directories for the current system. It is *not* intended to be modified by +the project, use :variable:`CMAKE_APPBUNDLE_PATH` for this. diff --git a/Help/variable/CMAKE_SYSTEM_FRAMEWORK_PATH.rst b/Help/variable/CMAKE_SYSTEM_FRAMEWORK_PATH.rst new file mode 100644 index 000000000..1e8b0d947 --- /dev/null +++ b/Help/variable/CMAKE_SYSTEM_FRAMEWORK_PATH.rst @@ -0,0 +1,8 @@ +CMAKE_SYSTEM_FRAMEWORK_PATH +--------------------------- + +Search path for OS X frameworks used by the :command:`find_library`, +:command:`find_package`, :command:`find_path`, and :command:`find_file` +commands. By default it contains the standard directories for the +current system. It is *not* intended to be modified by the project, +use :variable:`CMAKE_FRAMEWORK_PATH` for this. diff --git a/Help/variable/CMAKE_SYSTEM_NAME.rst b/Help/variable/CMAKE_SYSTEM_NAME.rst index 189dc18fc..c3a42e5b4 100644 --- a/Help/variable/CMAKE_SYSTEM_NAME.rst +++ b/Help/variable/CMAKE_SYSTEM_NAME.rst @@ -1,8 +1,20 @@ CMAKE_SYSTEM_NAME ----------------- -Name of the OS CMake is building for. +The name of the operating system for which CMake is to build. +See the :variable:`CMAKE_SYSTEM_VERSION` variable for the OS version. -This is the name of the OS on which CMake is targeting. This variable -is the same as :variable:`CMAKE_HOST_SYSTEM_NAME` if you build for the -host system instead of the target system when cross compiling. +System Name for Host Builds +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +``CMAKE_SYSTEM_NAME`` is by default set to the same value as the +:variable:`CMAKE_HOST_SYSTEM_NAME` variable so that the build +targets the host system. + +System Name for Cross Compiling +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +``CMAKE_SYSTEM_NAME`` may be set explicitly when first configuring a new build +tree in order to enable :ref:`cross compiling `. +In this case the :variable:`CMAKE_SYSTEM_VERSION` variable must also be +set explicitly. diff --git a/Help/variable/CMAKE_SYSTEM_PROCESSOR.rst b/Help/variable/CMAKE_SYSTEM_PROCESSOR.rst index 2f5313bc9..09280dee6 100644 --- a/Help/variable/CMAKE_SYSTEM_PROCESSOR.rst +++ b/Help/variable/CMAKE_SYSTEM_PROCESSOR.rst @@ -7,4 +7,4 @@ This variable is the same as :variable:`CMAKE_HOST_SYSTEM_PROCESSOR` if you build for the host system instead of the target system when cross compiling. -* The Green Hills MULTI generator sets this to ``ARM`` by default +* The :generator:`Green Hills MULTI` generator sets this to ``ARM`` by default. diff --git a/Help/variable/CMAKE_SYSTEM_VERSION.rst b/Help/variable/CMAKE_SYSTEM_VERSION.rst index 33510bbf9..aba8ca32b 100644 --- a/Help/variable/CMAKE_SYSTEM_VERSION.rst +++ b/Help/variable/CMAKE_SYSTEM_VERSION.rst @@ -1,8 +1,28 @@ CMAKE_SYSTEM_VERSION -------------------- -The OS version CMake is building for. +The version of the operating system for which CMake is to build. +See the :variable:`CMAKE_SYSTEM_NAME` variable for the OS name. -This variable is the same as :variable:`CMAKE_HOST_SYSTEM_VERSION` if -you build for the host system instead of the target system when -cross compiling. +System Version for Host Builds +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +When the :variable:`CMAKE_SYSTEM_NAME` variable takes its default value +then ``CMAKE_SYSTEM_VERSION`` is by default set to the same value as the +:variable:`CMAKE_HOST_SYSTEM_VERSION` variable so that the build targets +the host system version. + +In the case of a host build then ``CMAKE_SYSTEM_VERSION`` may be set +explicitly when first configuring a new build tree in order to enable +targeting the build for a different version of the host operating system +than is actually running on the host. This is allowed and not considered +cross compiling so long as the binaries built for the specified OS version +can still run on the host. + +System Version for Cross Compiling +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +When the :variable:`CMAKE_SYSTEM_NAME` variable is set explicitly to +enable :ref:`cross compiling ` then the +value of ``CMAKE_SYSTEM_VERSION`` must also be set explicitly to specify +the target system version. diff --git a/Help/variable/CMAKE_TOOLCHAIN_FILE.rst b/Help/variable/CMAKE_TOOLCHAIN_FILE.rst index e1a65e12b..168ee74c7 100644 --- a/Help/variable/CMAKE_TOOLCHAIN_FILE.rst +++ b/Help/variable/CMAKE_TOOLCHAIN_FILE.rst @@ -4,6 +4,6 @@ CMAKE_TOOLCHAIN_FILE Path to toolchain file supplied to :manual:`cmake(1)`. This variable is specified on the command line when cross-compiling with CMake. -It is the path to a file which is read early in the CMake run and which specifies -locations for compilers and toolchain utilities, and other target platform and -compiler related information. +It is the path to a file which is read early in the CMake run and which +specifies locations for compilers and toolchain utilities, and other target +platform and compiler related information. diff --git a/Help/variable/CMAKE_TRY_COMPILE_CONFIGURATION.rst b/Help/variable/CMAKE_TRY_COMPILE_CONFIGURATION.rst index a92feab5e..d731f02c0 100644 --- a/Help/variable/CMAKE_TRY_COMPILE_CONFIGURATION.rst +++ b/Help/variable/CMAKE_TRY_COMPILE_CONFIGURATION.rst @@ -1,9 +1,10 @@ CMAKE_TRY_COMPILE_CONFIGURATION ------------------------------- -Build configuration used for try_compile and try_run projects. +Build configuration used for :command:`try_compile` and :command:`try_run` +projects. -Projects built by try_compile and try_run are built synchronously -during the CMake configuration step. Therefore a specific build +Projects built by :command:`try_compile` and :command:`try_run` are built +synchronously during the CMake configuration step. Therefore a specific build configuration must be chosen even if the generated build system supports multiple configurations. diff --git a/Help/variable/CMAKE_USER_MAKE_RULES_OVERRIDE.rst b/Help/variable/CMAKE_USER_MAKE_RULES_OVERRIDE.rst index 5a4c86bd1..9af0d97d4 100644 --- a/Help/variable/CMAKE_USER_MAKE_RULES_OVERRIDE.rst +++ b/Help/variable/CMAKE_USER_MAKE_RULES_OVERRIDE.rst @@ -4,20 +4,20 @@ CMAKE_USER_MAKE_RULES_OVERRIDE Specify a CMake file that overrides platform information. CMake loads the specified file while enabling support for each -language from either the project() or enable_language() commands. It -is loaded after CMake's builtin compiler and platform information +language from either the :command:`project` or :command:`enable_language` +commands. It is loaded after CMake's builtin compiler and platform information modules have been loaded but before the information is used. The file may set platform information variables to override CMake's defaults. This feature is intended for use only in overriding information variables that must be set before CMake builds its first test project to check that the compiler for a language works. It should not be -used to load a file in cases that a normal include() will work. Use +used to load a file in cases that a normal :command:`include` will work. Use it only as a last resort for behavior that cannot be achieved any -other way. For example, one may set CMAKE_C_FLAGS_INIT to change the -default value used to initialize CMAKE_C_FLAGS before it is cached. -The override file should NOT be used to set anything that could be set -after languages are enabled, such as variables like -CMAKE_RUNTIME_OUTPUT_DIRECTORY that affect the placement of binaries. -Information set in the file will be used for try_compile and try_run -builds too. +other way. For example, one may set ``CMAKE_C_FLAGS_INIT`` to change the +default value used to initialize :variable:`CMAKE_C_FLAGS _FLAGS>` +before it is cached. The override file should NOT be used to set anything +that could be set after languages are enabled, such as variables like +:variable:`CMAKE_RUNTIME_OUTPUT_DIRECTORY` that affect the placement of +binaries. Information set in the file will be used for :command:`try_compile` +and :command:`try_run` builds too. diff --git a/Help/variable/CMAKE_USER_MAKE_RULES_OVERRIDE_LANG.rst b/Help/variable/CMAKE_USER_MAKE_RULES_OVERRIDE_LANG.rst index e6d2c68c6..e7139ac3c 100644 --- a/Help/variable/CMAKE_USER_MAKE_RULES_OVERRIDE_LANG.rst +++ b/Help/variable/CMAKE_USER_MAKE_RULES_OVERRIDE_LANG.rst @@ -1,7 +1,8 @@ CMAKE_USER_MAKE_RULES_OVERRIDE_ ------------------------------------- -Specify a CMake file that overrides platform information for . +Specify a CMake file that overrides platform information for ````. -This is a language-specific version of CMAKE_USER_MAKE_RULES_OVERRIDE -loaded only when enabling language . +This is a language-specific version of +:variable:`CMAKE_USER_MAKE_RULES_OVERRIDE` loaded only when enabling language +````. diff --git a/Help/variable/CMAKE_USE_RELATIVE_PATHS.rst b/Help/variable/CMAKE_USE_RELATIVE_PATHS.rst index af6f08c54..06fe0fbc6 100644 --- a/Help/variable/CMAKE_USE_RELATIVE_PATHS.rst +++ b/Help/variable/CMAKE_USE_RELATIVE_PATHS.rst @@ -1,10 +1,5 @@ CMAKE_USE_RELATIVE_PATHS ------------------------ -Use relative paths (May not work!). - -If this is set to TRUE, then CMake will use relative paths between the -source and binary tree. This option does not work for more -complicated projects, and relative paths are used when possible. In -general, it is not possible to move CMake generated makefiles to a -different location regardless of the value of this variable. +This variable has no effect. The partially implemented effect it +had in previous releases was removed in CMake 3.4. diff --git a/Help/variable/CMAKE_VERBOSE_MAKEFILE.rst b/Help/variable/CMAKE_VERBOSE_MAKEFILE.rst index 2420a25e1..232a2fd0f 100644 --- a/Help/variable/CMAKE_VERBOSE_MAKEFILE.rst +++ b/Help/variable/CMAKE_VERBOSE_MAKEFILE.rst @@ -3,7 +3,7 @@ CMAKE_VERBOSE_MAKEFILE Enable verbose output from Makefile builds. -This variable is a cache entry initialized (to FALSE) by +This variable is a cache entry initialized (to ``FALSE``) by the :command:`project` command. Users may enable the option in their local build tree to get more verbose output from Makefile builds and show each command line as it is launched. diff --git a/Help/variable/CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD.rst b/Help/variable/CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD.rst index 68f1ff6f5..f54472ad1 100644 --- a/Help/variable/CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD.rst +++ b/Help/variable/CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD.rst @@ -1,8 +1,8 @@ CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD ----------------------------------------- -Include INSTALL target to default build. +Include ``INSTALL`` target to default build. -In Visual Studio solution, by default the INSTALL target will not be part of -the default build. Setting this variable will enable the INSTALL target to be -part of the default build. +In Visual Studio solution, by default the ``INSTALL`` target will not be part +of the default build. Setting this variable will enable the ``INSTALL`` target +to be part of the default build. diff --git a/Help/variable/CMAKE_VS_INTEL_Fortran_PROJECT_VERSION.rst b/Help/variable/CMAKE_VS_INTEL_Fortran_PROJECT_VERSION.rst index 7e9d317f1..0be10e5a0 100644 --- a/Help/variable/CMAKE_VS_INTEL_Fortran_PROJECT_VERSION.rst +++ b/Help/variable/CMAKE_VS_INTEL_Fortran_PROJECT_VERSION.rst @@ -1,7 +1,7 @@ CMAKE_VS_INTEL_Fortran_PROJECT_VERSION -------------------------------------- -When generating for Visual Studio 7 or greater with the Intel Fortran -plugin installed, this specifies the .vfproj project file format +When generating for :generator:`Visual Studio 7` or greater with the Intel +Fortran plugin installed, this specifies the ``.vfproj`` project file format version. This is intended for internal use by CMake and should not be used by project code. diff --git a/Help/variable/CMAKE_VS_PLATFORM_TOOLSET.rst b/Help/variable/CMAKE_VS_PLATFORM_TOOLSET.rst index 08c606172..144a41dc6 100644 --- a/Help/variable/CMAKE_VS_PLATFORM_TOOLSET.rst +++ b/Help/variable/CMAKE_VS_PLATFORM_TOOLSET.rst @@ -5,6 +5,6 @@ Visual Studio Platform Toolset name. VS 10 and above use MSBuild under the hood and support multiple compiler toolchains. CMake may specify a toolset explicitly, such as -"v110" for VS 11 or "Windows7.1SDK" for 64-bit support in VS 10 +``v110`` for VS 11 or ``Windows7.1SDK`` for 64-bit support in VS 10 Express. CMake provides the name of the chosen toolset in this variable. diff --git a/Help/variable/CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION.rst b/Help/variable/CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION.rst new file mode 100644 index 000000000..639284963 --- /dev/null +++ b/Help/variable/CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION.rst @@ -0,0 +1,11 @@ +CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION +---------------------------------------- + +Visual Studio Windows Target Platform Version. + +When targeting Windows 10 and above Visual Studio 2015 and above support +specification of a target Windows version to select a corresponding SDK. +The :variable:`CMAKE_SYSTEM_VERSION` variable may be set to specify a +version. Otherwise CMake computes a default version based on the Windows +SDK versions available. The chosen Windows target version number is provided +in ``CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION``. diff --git a/Help/variable/CMAKE_WARN_DEPRECATED.rst b/Help/variable/CMAKE_WARN_DEPRECATED.rst index 7b2510b66..662cbd8c7 100644 --- a/Help/variable/CMAKE_WARN_DEPRECATED.rst +++ b/Help/variable/CMAKE_WARN_DEPRECATED.rst @@ -3,5 +3,5 @@ CMAKE_WARN_DEPRECATED Whether to issue deprecation warnings for macros and functions. -If TRUE, this can be used by macros and functions to issue deprecation -warnings. This variable is FALSE by default. +If ``TRUE``, this can be used by macros and functions to issue deprecation +warnings. This variable is ``FALSE`` by default. diff --git a/Help/variable/CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION.rst b/Help/variable/CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION.rst index f6a188d1c..81c1158c2 100644 --- a/Help/variable/CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION.rst +++ b/Help/variable/CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION.rst @@ -1,8 +1,9 @@ CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION ------------------------------------------ -Ask cmake_install.cmake script to warn each time a file with absolute INSTALL DESTINATION is encountered. +Ask ``cmake_install.cmake`` script to warn each time a file with absolute +``INSTALL DESTINATION`` is encountered. -This variable is used by CMake-generated cmake_install.cmake scripts. -If one sets this variable to ON while running the script, it may get +This variable is used by CMake-generated ``cmake_install.cmake`` scripts. +If one sets this variable to ``ON`` while running the script, it may get warning messages from the script. diff --git a/Help/variable/CMAKE_WIN32_EXECUTABLE.rst b/Help/variable/CMAKE_WIN32_EXECUTABLE.rst index 3e1e0dd71..b96abba7b 100644 --- a/Help/variable/CMAKE_WIN32_EXECUTABLE.rst +++ b/Help/variable/CMAKE_WIN32_EXECUTABLE.rst @@ -1,7 +1,7 @@ CMAKE_WIN32_EXECUTABLE ---------------------- -Default value for WIN32_EXECUTABLE of targets. +Default value for :prop_tgt:`WIN32_EXECUTABLE` of targets. -This variable is used to initialize the WIN32_EXECUTABLE property on -all the targets. See that target property for additional information. +This variable is used to initialize the :prop_tgt:`WIN32_EXECUTABLE` property +on all the targets. See that target property for additional information. diff --git a/Help/variable/CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS.rst b/Help/variable/CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS.rst new file mode 100644 index 000000000..1636842d9 --- /dev/null +++ b/Help/variable/CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS.rst @@ -0,0 +1,6 @@ +CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS +-------------------------------- + +Default value for :prop_tgt:`WINDOWS_EXPORT_ALL_SYMBOLS` target property. +This variable is used to initialize the property on each target as it is +created. diff --git a/Help/variable/CMAKE_XCODE_ATTRIBUTE_an-attribute.rst b/Help/variable/CMAKE_XCODE_ATTRIBUTE_an-attribute.rst index 096f64e0f..122b9f6b0 100644 --- a/Help/variable/CMAKE_XCODE_ATTRIBUTE_an-attribute.rst +++ b/Help/variable/CMAKE_XCODE_ATTRIBUTE_an-attribute.rst @@ -3,8 +3,8 @@ CMAKE_XCODE_ATTRIBUTE_ Set Xcode target attributes directly. -Tell the Xcode generator to set '' to a given value in -the generated Xcode project. Ignored on other generators. +Tell the :generator:`Xcode` generator to set '' to a given value +in the generated Xcode project. Ignored on other generators. See the :prop_tgt:`XCODE_ATTRIBUTE_` target property to set attributes on a specific target. diff --git a/Help/variable/CMAKE_XCODE_PLATFORM_TOOLSET.rst b/Help/variable/CMAKE_XCODE_PLATFORM_TOOLSET.rst index f0a4841f7..210da52d5 100644 --- a/Help/variable/CMAKE_XCODE_PLATFORM_TOOLSET.rst +++ b/Help/variable/CMAKE_XCODE_PLATFORM_TOOLSET.rst @@ -3,7 +3,7 @@ CMAKE_XCODE_PLATFORM_TOOLSET Xcode compiler selection. -Xcode supports selection of a compiler from one of the installed +:generator:`Xcode` supports selection of a compiler from one of the installed toolsets. CMake provides the name of the chosen toolset in this -variable, if any is explicitly selected (e.g. via the cmake -T -option). +variable, if any is explicitly selected (e.g. via the :manual:`cmake(1)` +``-T`` option). diff --git a/Help/variable/CPACK_ABSOLUTE_DESTINATION_FILES.rst b/Help/variable/CPACK_ABSOLUTE_DESTINATION_FILES.rst index d83662937..928fe4589 100644 --- a/Help/variable/CPACK_ABSOLUTE_DESTINATION_FILES.rst +++ b/Help/variable/CPACK_ABSOLUTE_DESTINATION_FILES.rst @@ -1,10 +1,10 @@ CPACK_ABSOLUTE_DESTINATION_FILES -------------------------------- -List of files which have been installed using an ABSOLUTE DESTINATION path. +List of files which have been installed using an ``ABSOLUTE DESTINATION`` path. This variable is a Read-Only variable which is set internally by CPack during installation and before packaging using -CMAKE_ABSOLUTE_DESTINATION_FILES defined in cmake_install.cmake +:variable:`CMAKE_ABSOLUTE_DESTINATION_FILES` defined in ``cmake_install.cmake`` scripts. The value can be used within CPack project configuration -file and/or CPack.cmake file of generator. +file and/or ``CPack.cmake`` file of ```` generator. diff --git a/Help/variable/CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY.rst b/Help/variable/CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY.rst index e93897804..6cf75e443 100644 --- a/Help/variable/CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY.rst +++ b/Help/variable/CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY.rst @@ -3,6 +3,6 @@ CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY Boolean toggle to include/exclude top level directory (component case). -Similar usage as CPACK_INCLUDE_TOPLEVEL_DIRECTORY but for the -component case. See CPACK_INCLUDE_TOPLEVEL_DIRECTORY documentation -for the detail. +Similar usage as :variable:`CPACK_INCLUDE_TOPLEVEL_DIRECTORY` but for the +component case. See :variable:`CPACK_INCLUDE_TOPLEVEL_DIRECTORY` +documentation for the detail. diff --git a/Help/variable/CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION.rst b/Help/variable/CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION.rst index 4d9638534..5dad6bd68 100644 --- a/Help/variable/CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION.rst +++ b/Help/variable/CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION.rst @@ -1,10 +1,11 @@ CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION ------------------------------------------- -Ask CPack to error out as soon as a file with absolute INSTALL DESTINATION is encountered. +Ask CPack to error out as soon as a file with absolute ``INSTALL DESTINATION`` +is encountered. The fatal error is emitted before the installation of the offending -file takes place. Some CPack generators, like NSIS,enforce this +file takes place. Some CPack generators, like NSIS, enforce this internally. This variable triggers the definition -ofCMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION when CPack runsVariables -common to all CPack generators +of :variable:`CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION` when CPack +runs. diff --git a/Help/variable/CPACK_INCLUDE_TOPLEVEL_DIRECTORY.rst b/Help/variable/CPACK_INCLUDE_TOPLEVEL_DIRECTORY.rst index 4f96bff57..b8e9105a4 100644 --- a/Help/variable/CPACK_INCLUDE_TOPLEVEL_DIRECTORY.rst +++ b/Help/variable/CPACK_INCLUDE_TOPLEVEL_DIRECTORY.rst @@ -4,16 +4,17 @@ CPACK_INCLUDE_TOPLEVEL_DIRECTORY Boolean toggle to include/exclude top level directory. When preparing a package CPack installs the item under the so-called -top level directory. The purpose of is to include (set to 1 or ON or -TRUE) the top level directory in the package or not (set to 0 or OFF -or FALSE). +top level directory. The purpose of is to include (set to ``1`` or ``ON`` or +``TRUE``) the top level directory in the package or not (set to ``0`` or +``OFF`` or ``FALSE``). Each CPack generator has a built-in default value for this variable. E.g. Archive generators (ZIP, TGZ, ...) includes the top level whereas RPM or DEB don't. The user may override the default value by setting this variable. -There is a similar variable CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY -which may be used to override the behavior for the component packaging +There is a similar variable +:variable:`CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY` which may be used +to override the behavior for the component packaging case which may have different default value for historical (now backward compatibility) reason. diff --git a/Help/variable/CPACK_INSTALL_SCRIPT.rst b/Help/variable/CPACK_INSTALL_SCRIPT.rst index 59b8cd724..12a48a40d 100644 --- a/Help/variable/CPACK_INSTALL_SCRIPT.rst +++ b/Help/variable/CPACK_INSTALL_SCRIPT.rst @@ -5,4 +5,4 @@ Extra CMake script provided by the user. If set this CMake script will be executed by CPack during its local [CPack-private] installation which is done right before packaging the -files. The script is not called by e.g.: make install. +files. The script is not called by e.g.: ``make install``. diff --git a/Help/variable/CPACK_PACKAGING_INSTALL_PREFIX.rst b/Help/variable/CPACK_PACKAGING_INSTALL_PREFIX.rst index f9cfa1b88..f423e2e7f 100644 --- a/Help/variable/CPACK_PACKAGING_INSTALL_PREFIX.rst +++ b/Help/variable/CPACK_PACKAGING_INSTALL_PREFIX.rst @@ -3,11 +3,13 @@ CPACK_PACKAGING_INSTALL_PREFIX The prefix used in the built package. -Each CPack generator has a default value (like /usr). This default -value may be overwritten from the CMakeLists.txt or the cpack command -line by setting an alternative value. +Each CPack generator has a default value (like ``/usr``). This default +value may be overwritten from the ``CMakeLists.txt`` or the :manual:`cpack(1)` +command line by setting an alternative value. Example: -e.g. set(CPACK_PACKAGING_INSTALL_PREFIX "/opt") +:: -This is not the same purpose as CMAKE_INSTALL_PREFIX which is used + set(CPACK_PACKAGING_INSTALL_PREFIX "/opt") + +This is not the same purpose as :variable:`CMAKE_INSTALL_PREFIX` which is used when installing from the build tree without building a package. diff --git a/Help/variable/CPACK_SET_DESTDIR.rst b/Help/variable/CPACK_SET_DESTDIR.rst index 69d82e6dc..27fd355ce 100644 --- a/Help/variable/CPACK_SET_DESTDIR.rst +++ b/Help/variable/CPACK_SET_DESTDIR.rst @@ -1,30 +1,31 @@ CPACK_SET_DESTDIR ----------------- -Boolean toggle to make CPack use DESTDIR mechanism when packaging. +Boolean toggle to make CPack use ``DESTDIR`` mechanism when packaging. -DESTDIR means DESTination DIRectory. It is commonly used by makefile +``DESTDIR`` means DESTination DIRectory. It is commonly used by makefile users in order to install software at non-default location. It is a basic relocation mechanism that should not be used on Windows (see -CMAKE_INSTALL_PREFIX documentation). It is usually invoked like this: +:variable:`CMAKE_INSTALL_PREFIX` documentation). It is usually invoked like +this: :: make DESTDIR=/home/john install which will install the concerned software using the installation -prefix, e.g. "/usr/local" prepended with the DESTDIR value which -finally gives "/home/john/usr/local". When preparing a package, CPack +prefix, e.g. ``/usr/local`` prepended with the ``DESTDIR`` value which +finally gives ``/home/john/usr/local``. When preparing a package, CPack first installs the items to be packaged in a local (to the build tree) -directory by using the same DESTDIR mechanism. Nevertheless, if -CPACK_SET_DESTDIR is set then CPack will set DESTDIR before doing the +directory by using the same ``DESTDIR`` mechanism. Nevertheless, if +``CPACK_SET_DESTDIR`` is set then CPack will set ``DESTDIR`` before doing the local install. The most noticeable difference is that without -CPACK_SET_DESTDIR, CPack uses CPACK_PACKAGING_INSTALL_PREFIX as a -prefix whereas with CPACK_SET_DESTDIR set, CPack will use -CMAKE_INSTALL_PREFIX as a prefix. +``CPACK_SET_DESTDIR``, CPack uses :variable:`CPACK_PACKAGING_INSTALL_PREFIX` +as a prefix whereas with ``CPACK_SET_DESTDIR`` set, CPack will use +:variable:`CMAKE_INSTALL_PREFIX` as a prefix. -Manually setting CPACK_SET_DESTDIR may help (or simply be necessary) -if some install rules uses absolute DESTINATION (see CMake INSTALL -command). However, starting with CPack/CMake 2.8.3 RPM and DEB -installers tries to handle DESTDIR automatically so that it is seldom -necessary for the user to set it. +Manually setting ``CPACK_SET_DESTDIR`` may help (or simply be necessary) +if some install rules uses absolute ``DESTINATION`` (see CMake +:command:`install` command). However, starting with CPack/CMake 2.8.3 RPM +and DEB installers tries to handle ``DESTDIR`` automatically so that it is +seldom necessary for the user to set it. diff --git a/Help/variable/CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION.rst b/Help/variable/CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION.rst index 8d6f54fc1..3fc5cca0e 100644 --- a/Help/variable/CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION.rst +++ b/Help/variable/CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION.rst @@ -1,8 +1,9 @@ CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION ------------------------------------------ -Ask CPack to warn each time a file with absolute INSTALL DESTINATION is encountered. +Ask CPack to warn each time a file with absolute ``INSTALL DESTINATION`` is +encountered. This variable triggers the definition of -CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION when CPack runs -cmake_install.cmake scripts. +:variable:`CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION` when CPack runs +``cmake_install.cmake`` scripts. diff --git a/Help/variable/CTEST_CHANGE_ID.rst b/Help/variable/CTEST_CHANGE_ID.rst new file mode 100644 index 000000000..a423f4900 --- /dev/null +++ b/Help/variable/CTEST_CHANGE_ID.rst @@ -0,0 +1,9 @@ +CTEST_CHANGE_ID +--------------- + +Specify the CTest ``ChangeId`` setting +in a :manual:`ctest(1)` dashboard client script. + +This setting allows CTest to pass arbitrary information about this +build up to CDash. One use of this feature is to allow CDash to +post comments on your pull request if anything goes wrong with your build. diff --git a/Help/variable/CTEST_COVERAGE_COMMAND.rst b/Help/variable/CTEST_COVERAGE_COMMAND.rst index a669dd78d..0491d4204 100644 --- a/Help/variable/CTEST_COVERAGE_COMMAND.rst +++ b/Help/variable/CTEST_COVERAGE_COMMAND.rst @@ -12,12 +12,12 @@ Java project can generate a series of XML files. The Cobertura Coverage parser expects to read the coverage data from a single XML file which contains the coverage data for all modules. -Cobertura has a program with the ability to merge given cobertura.ser files +Cobertura has a program with the ability to merge given ``cobertura.ser`` files and then another program to generate a combined XML file from the previous merged file. For command line testing, this can be done by hand prior to CTest looking for the coverage files. For script builds, set the ``CTEST_COVERAGE_COMMAND`` variable to point to a file which will -perform these same steps, such as a .sh or .bat file. +perform these same steps, such as a ``.sh`` or ``.bat`` file. .. code-block:: cmake @@ -35,17 +35,17 @@ the :command:`configure_file` command and might contain the following code: cobertura-report --datafile coberturamerge.ser --destination . \ --format xml $SourceDirs -The script uses ``find`` to capture the paths to all of the cobertura.ser files -found below the project's source directory. It keeps the list of files and -supplies it as an argument to the ``cobertura-merge`` program. The ``--datafile`` -argument signifies where the result of the merge will be kept. +The script uses ``find`` to capture the paths to all of the ``cobertura.ser`` +files found below the project's source directory. It keeps the list of files +and supplies it as an argument to the ``cobertura-merge`` program. The +``--datafile`` argument signifies where the result of the merge will be kept. The combined ``coberturamerge.ser`` file is then used to generate the XML report -using the ``cobertura-report`` program. The call to the cobertura-report program -requires some named arguments. +using the ``cobertura-report`` program. The call to the cobertura-report +program requires some named arguments. ``--datafila`` - path to the merged .ser file + path to the merged ``.ser`` file ``--destination`` path to put the output files(s) @@ -54,7 +54,7 @@ requires some named arguments. file format to write output in: xml or html The rest of the supplied arguments consist of the full paths to the -/src/main/java directories of each module within the souce tree. These +``/src/main/java`` directories of each module within the souce tree. These directories are needed and should not be forgotten. .. _`Cobertura`: http://cobertura.github.io/cobertura/ diff --git a/Help/variable/CTEST_CUSTOM_COVERAGE_EXCLUDE.rst b/Help/variable/CTEST_CUSTOM_COVERAGE_EXCLUDE.rst new file mode 100644 index 000000000..d5893c9f8 --- /dev/null +++ b/Help/variable/CTEST_CUSTOM_COVERAGE_EXCLUDE.rst @@ -0,0 +1,7 @@ +CTEST_CUSTOM_COVERAGE_EXCLUDE +----------------------------- + +A list of regular expressions which will be used to exclude files by their +path from coverage output by the :command:`ctest_coverage` command. + +.. include:: CTEST_CUSTOM_XXX.txt diff --git a/Help/variable/CTEST_CUSTOM_ERROR_EXCEPTION.rst b/Help/variable/CTEST_CUSTOM_ERROR_EXCEPTION.rst new file mode 100644 index 000000000..cd65ae327 --- /dev/null +++ b/Help/variable/CTEST_CUSTOM_ERROR_EXCEPTION.rst @@ -0,0 +1,7 @@ +CTEST_CUSTOM_ERROR_EXCEPTION +---------------------------- + +A list of regular expressions which will be used to exclude when detecting +error messages in build outputs by the :command:`ctest_test` command. + +.. include:: CTEST_CUSTOM_XXX.txt diff --git a/Help/variable/CTEST_CUSTOM_ERROR_MATCH.rst b/Help/variable/CTEST_CUSTOM_ERROR_MATCH.rst new file mode 100644 index 000000000..558f5e580 --- /dev/null +++ b/Help/variable/CTEST_CUSTOM_ERROR_MATCH.rst @@ -0,0 +1,7 @@ +CTEST_CUSTOM_ERROR_MATCH +------------------------ + +A list of regular expressions which will be used to detect error messages in +build outputs by the :command:`ctest_test` command. + +.. include:: CTEST_CUSTOM_XXX.txt diff --git a/Help/variable/CTEST_CUSTOM_ERROR_POST_CONTEXT.rst b/Help/variable/CTEST_CUSTOM_ERROR_POST_CONTEXT.rst new file mode 100644 index 000000000..614859bc8 --- /dev/null +++ b/Help/variable/CTEST_CUSTOM_ERROR_POST_CONTEXT.rst @@ -0,0 +1,7 @@ +CTEST_CUSTOM_ERROR_POST_CONTEXT +------------------------------- + +The number of lines to include as context which follow an error message by the +:command:`ctest_test` command. The default is 10. + +.. include:: CTEST_CUSTOM_XXX.txt diff --git a/Help/variable/CTEST_CUSTOM_ERROR_PRE_CONTEXT.rst b/Help/variable/CTEST_CUSTOM_ERROR_PRE_CONTEXT.rst new file mode 100644 index 000000000..74dc47ad2 --- /dev/null +++ b/Help/variable/CTEST_CUSTOM_ERROR_PRE_CONTEXT.rst @@ -0,0 +1,7 @@ +CTEST_CUSTOM_ERROR_PRE_CONTEXT +------------------------------ + +The number of lines to include as context which precede an error message by +the :command:`ctest_test` command. The default is 10. + +.. include:: CTEST_CUSTOM_XXX.txt diff --git a/Help/variable/CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE.rst b/Help/variable/CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE.rst new file mode 100644 index 000000000..5aeae88a4 --- /dev/null +++ b/Help/variable/CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE.rst @@ -0,0 +1,8 @@ +CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE +-------------------------------------------- + +When saving a failing test's output, this is the maximum size, in bytes, that +will be collected by the :command:`ctest_test` command. Defaults to 307200 +(300 KiB). + +.. include:: CTEST_CUSTOM_XXX.txt diff --git a/Help/variable/CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS.rst b/Help/variable/CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS.rst new file mode 100644 index 000000000..920cb0476 --- /dev/null +++ b/Help/variable/CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS.rst @@ -0,0 +1,8 @@ +CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS +------------------------------------- + +The maximum number of errors in a single build step which will be detected. +After this, the :command:`ctest_test` command will truncate the output. +Defaults to 50. + +.. include:: CTEST_CUSTOM_XXX.txt diff --git a/Help/variable/CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS.rst b/Help/variable/CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS.rst new file mode 100644 index 000000000..a1f1cc14b --- /dev/null +++ b/Help/variable/CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS.rst @@ -0,0 +1,8 @@ +CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS +--------------------------------------- + +The maximum number of warnings in a single build step which will be detected. +After this, the :command:`ctest_test` command will truncate the output. +Defaults to 50. + +.. include:: CTEST_CUSTOM_XXX.txt diff --git a/Help/variable/CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE.rst b/Help/variable/CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE.rst new file mode 100644 index 000000000..1fbb8c53f --- /dev/null +++ b/Help/variable/CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE.rst @@ -0,0 +1,8 @@ +CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE +-------------------------------------------- + +When saving a passing test's output, this is the maximum size, in bytes, that +will be collected by the :command:`ctest_test` command. Defaults to 1024 +(1 KiB). + +.. include:: CTEST_CUSTOM_XXX.txt diff --git a/Help/variable/CTEST_CUSTOM_MEMCHECK_IGNORE.rst b/Help/variable/CTEST_CUSTOM_MEMCHECK_IGNORE.rst new file mode 100644 index 000000000..578576cd6 --- /dev/null +++ b/Help/variable/CTEST_CUSTOM_MEMCHECK_IGNORE.rst @@ -0,0 +1,7 @@ +CTEST_CUSTOM_MEMCHECK_IGNORE +---------------------------- + +A list of regular expressions to use to exclude tests during the +:command:`ctest_memcheck` command. + +.. include:: CTEST_CUSTOM_XXX.txt diff --git a/Help/variable/CTEST_CUSTOM_POST_MEMCHECK.rst b/Help/variable/CTEST_CUSTOM_POST_MEMCHECK.rst new file mode 100644 index 000000000..40291febd --- /dev/null +++ b/Help/variable/CTEST_CUSTOM_POST_MEMCHECK.rst @@ -0,0 +1,6 @@ +CTEST_CUSTOM_POST_MEMCHECK +-------------------------- + +A list of commands to run at the end of the :command:`ctest_memcheck` command. + +.. include:: CTEST_CUSTOM_XXX.txt diff --git a/Help/variable/CTEST_CUSTOM_POST_TEST.rst b/Help/variable/CTEST_CUSTOM_POST_TEST.rst new file mode 100644 index 000000000..791292cd0 --- /dev/null +++ b/Help/variable/CTEST_CUSTOM_POST_TEST.rst @@ -0,0 +1,6 @@ +CTEST_CUSTOM_POST_TEST +---------------------- + +A list of commands to run at the end of the :command:`ctest_test` command. + +.. include:: CTEST_CUSTOM_XXX.txt diff --git a/Help/variable/CTEST_CUSTOM_PRE_MEMCHECK.rst b/Help/variable/CTEST_CUSTOM_PRE_MEMCHECK.rst new file mode 100644 index 000000000..00de8aa2b --- /dev/null +++ b/Help/variable/CTEST_CUSTOM_PRE_MEMCHECK.rst @@ -0,0 +1,7 @@ +CTEST_CUSTOM_PRE_MEMCHECK +------------------------- + +A list of commands to run at the start of the :command:`ctest_memcheck` +command. + +.. include:: CTEST_CUSTOM_XXX.txt diff --git a/Help/variable/CTEST_CUSTOM_PRE_TEST.rst b/Help/variable/CTEST_CUSTOM_PRE_TEST.rst new file mode 100644 index 000000000..6af7152ef --- /dev/null +++ b/Help/variable/CTEST_CUSTOM_PRE_TEST.rst @@ -0,0 +1,6 @@ +CTEST_CUSTOM_PRE_TEST +---------------------- + +A list of commands to run at the start of the :command:`ctest_test` command. + +.. include:: CTEST_CUSTOM_XXX.txt diff --git a/Help/variable/CTEST_CUSTOM_TEST_IGNORE.rst b/Help/variable/CTEST_CUSTOM_TEST_IGNORE.rst new file mode 100644 index 000000000..6114e608c --- /dev/null +++ b/Help/variable/CTEST_CUSTOM_TEST_IGNORE.rst @@ -0,0 +1,7 @@ +CTEST_CUSTOM_TEST_IGNORE +------------------------ + +A list of regular expressions to use to exclude tests during the +:command:`ctest_test` command. + +.. include:: CTEST_CUSTOM_XXX.txt diff --git a/Help/variable/CTEST_CUSTOM_WARNING_EXCEPTION.rst b/Help/variable/CTEST_CUSTOM_WARNING_EXCEPTION.rst new file mode 100644 index 000000000..36fa37d92 --- /dev/null +++ b/Help/variable/CTEST_CUSTOM_WARNING_EXCEPTION.rst @@ -0,0 +1,7 @@ +CTEST_CUSTOM_WARNING_EXCEPTION +------------------------------ + +A list of regular expressions which will be used to exclude when detecting +warning messages in build outputs by the :command:`ctest_test` command. + +.. include:: CTEST_CUSTOM_XXX.txt diff --git a/Help/variable/CTEST_CUSTOM_WARNING_MATCH.rst b/Help/variable/CTEST_CUSTOM_WARNING_MATCH.rst new file mode 100644 index 000000000..a35be96b5 --- /dev/null +++ b/Help/variable/CTEST_CUSTOM_WARNING_MATCH.rst @@ -0,0 +1,7 @@ +CTEST_CUSTOM_WARNING_MATCH +-------------------------- + +A list of regular expressions which will be used to detect warning messages in +build outputs by the :command:`ctest_test` command. + +.. include:: CTEST_CUSTOM_XXX.txt diff --git a/Help/variable/CTEST_CUSTOM_XXX.txt b/Help/variable/CTEST_CUSTOM_XXX.txt new file mode 100644 index 000000000..02d15474a --- /dev/null +++ b/Help/variable/CTEST_CUSTOM_XXX.txt @@ -0,0 +1,2 @@ +It is initialized by :manual:`ctest(1)`, but may be edited in a ``CTestCustom`` +file. See :command:`ctest_read_custom_files` documentation. diff --git a/Help/variable/CTEST_EXTRA_COVERAGE_GLOB.rst b/Help/variable/CTEST_EXTRA_COVERAGE_GLOB.rst new file mode 100644 index 000000000..286f7dfed --- /dev/null +++ b/Help/variable/CTEST_EXTRA_COVERAGE_GLOB.rst @@ -0,0 +1,7 @@ +CTEST_EXTRA_COVERAGE_GLOB +------------------------- + +A list of regular expressions which will be used to find files which should be +covered by the :command:`ctest_coverage` command. + +.. include:: CTEST_CUSTOM_XXX.txt diff --git a/Help/variable/CTEST_MEMORYCHECK_TYPE.rst b/Help/variable/CTEST_MEMORYCHECK_TYPE.rst index f1087c0a1..b96329354 100644 --- a/Help/variable/CTEST_MEMORYCHECK_TYPE.rst +++ b/Help/variable/CTEST_MEMORYCHECK_TYPE.rst @@ -3,5 +3,6 @@ CTEST_MEMORYCHECK_TYPE Specify the CTest ``MemoryCheckType`` setting in a :manual:`ctest(1)` dashboard client script. -Valid values are Valgrind, Purify, BoundsChecker, and ThreadSanitizer, -AddressSanitizer, MemorySanitizer, and UndefinedBehaviorSanitizer. +Valid values are ``Valgrind``, ``Purify``, ``BoundsChecker``, and +``ThreadSanitizer``, ``AddressSanitizer``, ``MemorySanitizer``, and +``UndefinedBehaviorSanitizer``. diff --git a/Help/variable/CTEST_TEST_LOAD.rst b/Help/variable/CTEST_TEST_LOAD.rst new file mode 100644 index 000000000..80823fe4e --- /dev/null +++ b/Help/variable/CTEST_TEST_LOAD.rst @@ -0,0 +1,7 @@ +CTEST_TEST_LOAD +--------------- + +Specify the ``TestLoad`` setting in the :ref:`CTest Test Step` +of a :manual:`ctest(1)` dashboard client script. This sets the +default value for the ``TEST_LOAD`` option of the :command:`ctest_test` +command. diff --git a/Help/variable/CYGWIN.rst b/Help/variable/CYGWIN.rst index c16887855..0039e071f 100644 --- a/Help/variable/CYGWIN.rst +++ b/Help/variable/CYGWIN.rst @@ -1,6 +1,6 @@ CYGWIN ------ -True for Cygwin. +``True`` for Cygwin. -Set to true when using Cygwin. +Set to ``true`` when using Cygwin. diff --git a/Help/variable/ENV.rst b/Help/variable/ENV.rst index 977afc3c2..368152aeb 100644 --- a/Help/variable/ENV.rst +++ b/Help/variable/ENV.rst @@ -3,5 +3,5 @@ ENV Access environment variables. -Use the syntax $ENV{VAR} to read environment variable VAR. See also -the set() command to set ENV{VAR}. +Use the syntax ``$ENV{VAR}`` to read environment variable ``VAR``. See also +the :command:`set` command to set ``ENV{VAR}``. diff --git a/Help/variable/EXECUTABLE_OUTPUT_PATH.rst b/Help/variable/EXECUTABLE_OUTPUT_PATH.rst index 707923056..26d3e92a1 100644 --- a/Help/variable/EXECUTABLE_OUTPUT_PATH.rst +++ b/Help/variable/EXECUTABLE_OUTPUT_PATH.rst @@ -3,6 +3,6 @@ EXECUTABLE_OUTPUT_PATH Old executable location variable. -The target property RUNTIME_OUTPUT_DIRECTORY supercedes this variable -for a target if it is set. Executable targets are otherwise placed in +The target property :prop_tgt:`RUNTIME_OUTPUT_DIRECTORY` supercedes this +variable for a target if it is set. Executable targets are otherwise placed in this directory. diff --git a/Help/variable/LIBRARY_OUTPUT_PATH.rst b/Help/variable/LIBRARY_OUTPUT_PATH.rst index 1c1f8ae9a..ba02911e6 100644 --- a/Help/variable/LIBRARY_OUTPUT_PATH.rst +++ b/Help/variable/LIBRARY_OUTPUT_PATH.rst @@ -3,7 +3,7 @@ LIBRARY_OUTPUT_PATH Old library location variable. -The target properties ARCHIVE_OUTPUT_DIRECTORY, -LIBRARY_OUTPUT_DIRECTORY, and RUNTIME_OUTPUT_DIRECTORY supercede this -variable for a target if they are set. Library targets are otherwise -placed in this directory. +The target properties :prop_tgt:`ARCHIVE_OUTPUT_DIRECTORY`, +:prop_tgt:`LIBRARY_OUTPUT_DIRECTORY`, and :prop_tgt:`RUNTIME_OUTPUT_DIRECTORY` +supercede this variable for a target if they are set. Library targets are +otherwise placed in this directory. diff --git a/Help/variable/MINGW.rst b/Help/variable/MINGW.rst index 521d41727..6d29be462 100644 --- a/Help/variable/MINGW.rst +++ b/Help/variable/MINGW.rst @@ -1,6 +1,6 @@ MINGW ----- -True when using MinGW +``True`` when using MinGW -Set to true when the compiler is some version of MinGW. +Set to ``true`` when the compiler is some version of MinGW. diff --git a/Help/variable/MSVC.rst b/Help/variable/MSVC.rst index e9f931b50..913ed080c 100644 --- a/Help/variable/MSVC.rst +++ b/Help/variable/MSVC.rst @@ -1,6 +1,6 @@ MSVC ---- -True when using Microsoft Visual C +``True`` when using Microsoft Visual C++. -Set to true when the compiler is some version of Microsoft Visual C. +Set to ``true`` when the compiler is some version of Microsoft Visual C++. diff --git a/Help/variable/MSVC10.rst b/Help/variable/MSVC10.rst index 894c5aab0..33692ad20 100644 --- a/Help/variable/MSVC10.rst +++ b/Help/variable/MSVC10.rst @@ -1,6 +1,6 @@ MSVC10 ------ -True when using Microsoft Visual C 10.0 +``True`` when using Microsoft Visual C++ 10.0 -Set to true when the compiler is version 10.0 of Microsoft Visual C. +Set to ``true`` when the compiler is version 10.0 of Microsoft Visual C++. diff --git a/Help/variable/MSVC11.rst b/Help/variable/MSVC11.rst index fe2529753..3ab606d41 100644 --- a/Help/variable/MSVC11.rst +++ b/Help/variable/MSVC11.rst @@ -1,6 +1,6 @@ MSVC11 ------ -True when using Microsoft Visual C 11.0 +``True`` when using Microsoft Visual C++ 11.0 -Set to true when the compiler is version 11.0 of Microsoft Visual C. +Set to ``true`` when the compiler is version 11.0 of Microsoft Visual C++. diff --git a/Help/variable/MSVC12.rst b/Help/variable/MSVC12.rst index 216d3d322..15fa64b96 100644 --- a/Help/variable/MSVC12.rst +++ b/Help/variable/MSVC12.rst @@ -1,6 +1,6 @@ MSVC12 ------ -True when using Microsoft Visual C 12.0 +``True`` when using Microsoft Visual C++ 12.0. -Set to true when the compiler is version 12.0 of Microsoft Visual C. +Set to ``true`` when the compiler is version 12.0 of Microsoft Visual C++. diff --git a/Help/variable/MSVC14.rst b/Help/variable/MSVC14.rst index 33c782b74..0b9125de6 100644 --- a/Help/variable/MSVC14.rst +++ b/Help/variable/MSVC14.rst @@ -1,6 +1,6 @@ MSVC14 ------ -True when using Microsoft Visual C 14.0 +``True`` when using Microsoft Visual C++ 14.0. -Set to true when the compiler is version 14.0 of Microsoft Visual C. +Set to ``true`` when the compiler is version 14.0 of Microsoft Visual C++. diff --git a/Help/variable/MSVC60.rst b/Help/variable/MSVC60.rst index 572e9f47f..14f09cfad 100644 --- a/Help/variable/MSVC60.rst +++ b/Help/variable/MSVC60.rst @@ -1,6 +1,6 @@ MSVC60 ------ -True when using Microsoft Visual C 6.0 +``True`` when using Microsoft Visual C++ 6.0. -Set to true when the compiler is version 6.0 of Microsoft Visual C. +Set to ``true`` when the compiler is version 6.0 of Microsoft Visual C++. diff --git a/Help/variable/MSVC70.rst b/Help/variable/MSVC70.rst index b1b7a8817..76fa96fa9 100644 --- a/Help/variable/MSVC70.rst +++ b/Help/variable/MSVC70.rst @@ -1,6 +1,6 @@ MSVC70 ------ -True when using Microsoft Visual C 7.0 +``True`` when using Microsoft Visual C++ 7.0. -Set to true when the compiler is version 7.0 of Microsoft Visual C. +Set to ``true`` when the compiler is version 7.0 of Microsoft Visual C++. diff --git a/Help/variable/MSVC71.rst b/Help/variable/MSVC71.rst index af309a6a6..d69d4fc10 100644 --- a/Help/variable/MSVC71.rst +++ b/Help/variable/MSVC71.rst @@ -1,6 +1,6 @@ MSVC71 ------ -True when using Microsoft Visual C 7.1 +``True`` when using Microsoft Visual C++ 7.1. -Set to true when the compiler is version 7.1 of Microsoft Visual C. +Set to ``true`` when the compiler is version 7.1 of Microsoft Visual C++. diff --git a/Help/variable/MSVC80.rst b/Help/variable/MSVC80.rst index 306c67f5e..b17777c79 100644 --- a/Help/variable/MSVC80.rst +++ b/Help/variable/MSVC80.rst @@ -1,6 +1,6 @@ MSVC80 ------ -True when using Microsoft Visual C 8.0 +``True`` when using Microsoft Visual C++ 8.0. -Set to true when the compiler is version 8.0 of Microsoft Visual C. +Set to ``true`` when the compiler is version 8.0 of Microsoft Visual C++. diff --git a/Help/variable/MSVC90.rst b/Help/variable/MSVC90.rst index 3cfcc672d..7162d6c4e 100644 --- a/Help/variable/MSVC90.rst +++ b/Help/variable/MSVC90.rst @@ -1,6 +1,6 @@ MSVC90 ------ -True when using Microsoft Visual C 9.0 +``True`` when using Microsoft Visual C++ 9.0. -Set to true when the compiler is version 9.0 of Microsoft Visual C. +Set to ``true`` when the compiler is version 9.0 of Microsoft Visual C++. diff --git a/Help/variable/MSVC_IDE.rst b/Help/variable/MSVC_IDE.rst index 055f876be..027d1bc8c 100644 --- a/Help/variable/MSVC_IDE.rst +++ b/Help/variable/MSVC_IDE.rst @@ -1,7 +1,7 @@ MSVC_IDE -------- -True when using the Microsoft Visual C IDE +``True`` when using the Microsoft Visual C++ IDE. -Set to true when the target platform is the Microsoft Visual C IDE, as +Set to ``true`` when the target platform is the Microsoft Visual C++ IDE, as opposed to the command line compiler. diff --git a/Help/variable/UNIX.rst b/Help/variable/UNIX.rst index 82e345427..0877b7c07 100644 --- a/Help/variable/UNIX.rst +++ b/Help/variable/UNIX.rst @@ -1,7 +1,7 @@ UNIX ---- -True for UNIX and UNIX like operating systems. +``True`` for UNIX and UNIX like operating systems. -Set to true when the target system is UNIX or UNIX like (i.e. APPLE -and CYGWIN). +Set to ``true`` when the target system is UNIX or UNIX like (i.e. +:variable:`APPLE` and :variable:`CYGWIN`). diff --git a/Help/variable/WIN32.rst b/Help/variable/WIN32.rst index 8cf7bf35e..218906955 100644 --- a/Help/variable/WIN32.rst +++ b/Help/variable/WIN32.rst @@ -1,6 +1,6 @@ WIN32 ----- -True on windows systems, including win64. +``True`` on Windows systems, including Win64. -Set to true when the target system is Windows. +Set to ``true`` when the target system is Windows. diff --git a/Help/variable/XCODE_VERSION.rst b/Help/variable/XCODE_VERSION.rst index b6f04037d..b85d41e91 100644 --- a/Help/variable/XCODE_VERSION.rst +++ b/Help/variable/XCODE_VERSION.rst @@ -1,7 +1,7 @@ XCODE_VERSION ------------- -Version of Xcode (Xcode generator only). +Version of Xcode (:generator:`Xcode` generator only). Under the Xcode generator, this is the version of Xcode as specified -in "Xcode.app/Contents/version.plist" (such as "3.1.2"). +in ``Xcode.app/Contents/version.plist`` (such as ``3.1.2``). diff --git a/Modules/BasicConfigVersion-AnyNewerVersion.cmake.in b/Modules/BasicConfigVersion-AnyNewerVersion.cmake.in index b1c4fdf81..bc78016df 100644 --- a/Modules/BasicConfigVersion-AnyNewerVersion.cmake.in +++ b/Modules/BasicConfigVersion-AnyNewerVersion.cmake.in @@ -9,22 +9,22 @@ set(PACKAGE_VERSION "@CVF_VERSION@") -if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) +if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) set(PACKAGE_VERSION_COMPATIBLE FALSE) else() set(PACKAGE_VERSION_COMPATIBLE TRUE) - if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}") + if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) set(PACKAGE_VERSION_EXACT TRUE) endif() endif() # if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it: -if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "") +if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "") return() endif() # check that the installed version has the same 32/64bit-ness as the one which is currently searching: -if(NOT "${CMAKE_SIZEOF_VOID_P}" STREQUAL "@CMAKE_SIZEOF_VOID_P@") +if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "@CMAKE_SIZEOF_VOID_P@") math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8") set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)") set(PACKAGE_VERSION_UNSUITABLE TRUE) diff --git a/Modules/BasicConfigVersion-ExactVersion.cmake.in b/Modules/BasicConfigVersion-ExactVersion.cmake.in index 9fd0136b0..de4a23af0 100644 --- a/Modules/BasicConfigVersion-ExactVersion.cmake.in +++ b/Modules/BasicConfigVersion-ExactVersion.cmake.in @@ -17,30 +17,30 @@ else() set(CVF_VERSION_NO_TWEAK "@CVF_VERSION@") endif() -if("${PACKAGE_FIND_VERSION}" MATCHES "^([0-9]+\\.[0-9]+\\.[0-9]+)\\.") # strip the tweak version +if(PACKAGE_FIND_VERSION MATCHES "^([0-9]+\\.[0-9]+\\.[0-9]+)\\.") # strip the tweak version set(REQUESTED_VERSION_NO_TWEAK "${CMAKE_MATCH_1}") else() set(REQUESTED_VERSION_NO_TWEAK "${PACKAGE_FIND_VERSION}") endif() -if("${REQUESTED_VERSION_NO_TWEAK}" STREQUAL "${CVF_VERSION_NO_TWEAK}") +if(REQUESTED_VERSION_NO_TWEAK STREQUAL CVF_VERSION_NO_TWEAK) set(PACKAGE_VERSION_COMPATIBLE TRUE) else() set(PACKAGE_VERSION_COMPATIBLE FALSE) endif() -if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}") +if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) set(PACKAGE_VERSION_EXACT TRUE) endif() # if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it: -if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "") +if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "") return() endif() # check that the installed version has the same 32/64bit-ness as the one which is currently searching: -if(NOT "${CMAKE_SIZEOF_VOID_P}" STREQUAL "@CMAKE_SIZEOF_VOID_P@") +if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "@CMAKE_SIZEOF_VOID_P@") math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8") set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)") set(PACKAGE_VERSION_UNSUITABLE TRUE) diff --git a/Modules/BasicConfigVersion-SameMajorVersion.cmake.in b/Modules/BasicConfigVersion-SameMajorVersion.cmake.in index 4acd9bb5e..a32245dd5 100644 --- a/Modules/BasicConfigVersion-SameMajorVersion.cmake.in +++ b/Modules/BasicConfigVersion-SameMajorVersion.cmake.in @@ -11,7 +11,7 @@ set(PACKAGE_VERSION "@CVF_VERSION@") -if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) +if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) set(PACKAGE_VERSION_COMPATIBLE FALSE) else() @@ -21,25 +21,25 @@ else() set(CVF_VERSION_MAJOR "@CVF_VERSION@") endif() - if("${PACKAGE_FIND_VERSION_MAJOR}" STREQUAL "${CVF_VERSION_MAJOR}") + if(PACKAGE_FIND_VERSION_MAJOR STREQUAL CVF_VERSION_MAJOR) set(PACKAGE_VERSION_COMPATIBLE TRUE) else() set(PACKAGE_VERSION_COMPATIBLE FALSE) endif() - if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}") + if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) set(PACKAGE_VERSION_EXACT TRUE) endif() endif() # if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it: -if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "") +if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "") return() endif() # check that the installed version has the same 32/64bit-ness as the one which is currently searching: -if(NOT "${CMAKE_SIZEOF_VOID_P}" STREQUAL "@CMAKE_SIZEOF_VOID_P@") +if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "@CMAKE_SIZEOF_VOID_P@") math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8") set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)") set(PACKAGE_VERSION_UNSUITABLE TRUE) diff --git a/Modules/CMakeASMInformation.cmake b/Modules/CMakeASMInformation.cmake index 62ef972a3..0e547c467 100644 --- a/Modules/CMakeASMInformation.cmake +++ b/Modules/CMakeASMInformation.cmake @@ -108,7 +108,7 @@ mark_as_advanced(CMAKE_ASM${ASM_DIALECT}_FLAGS if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT) - set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT " -o -c ") + set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT " -o -c ") endif() if(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_STATIC_LIBRARY) diff --git a/Modules/CMakeASM_MASMInformation.cmake b/Modules/CMakeASM_MASMInformation.cmake index 972883cdf..bd76b9842 100644 --- a/Modules/CMakeASM_MASMInformation.cmake +++ b/Modules/CMakeASM_MASMInformation.cmake @@ -18,7 +18,7 @@ set(ASM_DIALECT "_MASM") set(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS asm) -set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT " /c /Fo ") +set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT " /c /Fo ") include(CMakeASMInformation) set(ASM_DIALECT) diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in index 86cd89450..a1bfc70a0 100644 --- a/Modules/CMakeCCompiler.cmake.in +++ b/Modules/CMakeCCompiler.cmake.in @@ -2,6 +2,8 @@ set(CMAKE_C_COMPILER "@CMAKE_C_COMPILER@") set(CMAKE_C_COMPILER_ARG1 "@CMAKE_C_COMPILER_ARG1@") set(CMAKE_C_COMPILER_ID "@CMAKE_C_COMPILER_ID@") set(CMAKE_C_COMPILER_VERSION "@CMAKE_C_COMPILER_VERSION@") +set(CMAKE_C_COMPILER_LINKS_STATICALLY "@CMAKE_C_COMPILER_LINKS_STATICALLY@") +set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "@CMAKE_C_STANDARD_COMPUTED_DEFAULT@") set(CMAKE_C_COMPILE_FEATURES "@CMAKE_C_COMPILE_FEATURES@") set(CMAKE_C90_COMPILE_FEATURES "@CMAKE_C90_COMPILE_FEATURES@") set(CMAKE_C99_COMPILE_FEATURES "@CMAKE_C99_COMPILE_FEATURES@") @@ -52,12 +54,14 @@ if(CMAKE_C_LIBRARY_ARCHITECTURE) set(CMAKE_LIBRARY_ARCHITECTURE "@CMAKE_C_LIBRARY_ARCHITECTURE@") endif() +set(CMAKE_C_CL_SHOWINCLUDES_PREFIX "@CMAKE_C_CL_SHOWINCLUDES_PREFIX@") +if(CMAKE_C_CL_SHOWINCLUDES_PREFIX) + set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_C_CL_SHOWINCLUDES_PREFIX}") +endif() + @CMAKE_C_SYSROOT_FLAG_CODE@ @CMAKE_C_OSX_DEPLOYMENT_TARGET_FLAG_CODE@ set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "@CMAKE_C_IMPLICIT_LINK_LIBRARIES@") set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "@CMAKE_C_IMPLICIT_LINK_DIRECTORIES@") set(CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES@") - -@SET_CMAKE_CMCLDEPS_EXECUTABLE@ -@SET_CMAKE_CL_SHOWINCLUDES_PREFIX@ diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in index 09ae50936..b22400780 100644 --- a/Modules/CMakeCCompilerId.c.in +++ b/Modules/CMakeCCompilerId.c.in @@ -24,6 +24,17 @@ char const* qnxnto = "INFO" ":" "qnxnto[]"; @CMAKE_C_COMPILER_ID_PLATFORM_CONTENT@ @CMAKE_C_COMPILER_ID_ERROR_FOR_TEST@ +const char* info_language_dialect_default = "INFO" ":" "dialect_default[" +#if !defined(__STDC_VERSION__) + "90" +#elif __STDC_VERSION__ >= 201000L + "11" +#elif __STDC_VERSION__ >= 199901L + "99" +#else +#endif +"]"; + /*--------------------------------------------------------------------------*/ #ifdef ID_VOID_MAIN diff --git a/Modules/CMakeCInformation.cmake b/Modules/CMakeCInformation.cmake index 332b26ee2..0d102a11b 100644 --- a/Modules/CMakeCInformation.cmake +++ b/Modules/CMakeCInformation.cmake @@ -75,6 +75,10 @@ if(CMAKE_C_SIZEOF_DATA_PTR) unset(CMAKE_C_ABI_FILES) endif() +if(CMAKE_C_COMPILER_LINKS_STATICALLY) + set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) +endif() + # This should be included before the _INIT variables are # used to initialize the cache. Since the rule variables # have if blocks on them, users can still define them here. @@ -175,7 +179,7 @@ endif() # Create a static archive incrementally for large object file counts. # If CMAKE_C_CREATE_STATIC_LIBRARY is set it will override these. if(NOT DEFINED CMAKE_C_ARCHIVE_CREATE) - set(CMAKE_C_ARCHIVE_CREATE " cq ") + set(CMAKE_C_ARCHIVE_CREATE " qc ") endif() if(NOT DEFINED CMAKE_C_ARCHIVE_APPEND) set(CMAKE_C_ARCHIVE_APPEND " q ") @@ -187,7 +191,7 @@ endif() # compile a C file into an object file if(NOT CMAKE_C_COMPILE_OBJECT) set(CMAKE_C_COMPILE_OBJECT - " -o -c ") + " -o -c ") endif() if(NOT CMAKE_C_LINK_EXECUTABLE) diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in index af79a31bb..4218a6d12 100644 --- a/Modules/CMakeCXXCompiler.cmake.in +++ b/Modules/CMakeCXXCompiler.cmake.in @@ -2,6 +2,8 @@ set(CMAKE_CXX_COMPILER "@CMAKE_CXX_COMPILER@") set(CMAKE_CXX_COMPILER_ARG1 "@CMAKE_CXX_COMPILER_ARG1@") set(CMAKE_CXX_COMPILER_ID "@CMAKE_CXX_COMPILER_ID@") set(CMAKE_CXX_COMPILER_VERSION "@CMAKE_CXX_COMPILER_VERSION@") +set(CMAKE_CXX_COMPILER_LINKS_STATICALLY "@CMAKE_CXX_COMPILER_LINKS_STATICALLY@") +set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "@CMAKE_CXX_STANDARD_COMPUTED_DEFAULT@") set(CMAKE_CXX_COMPILE_FEATURES "@CMAKE_CXX_COMPILE_FEATURES@") set(CMAKE_CXX98_COMPILE_FEATURES "@CMAKE_CXX98_COMPILE_FEATURES@") set(CMAKE_CXX11_COMPILE_FEATURES "@CMAKE_CXX11_COMPILE_FEATURES@") @@ -53,12 +55,14 @@ if(CMAKE_CXX_LIBRARY_ARCHITECTURE) set(CMAKE_LIBRARY_ARCHITECTURE "@CMAKE_CXX_LIBRARY_ARCHITECTURE@") endif() +set(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX "@CMAKE_CXX_CL_SHOWINCLUDES_PREFIX@") +if(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX) + set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_CXX_CL_SHOWINCLUDES_PREFIX}") +endif() + @CMAKE_CXX_SYSROOT_FLAG_CODE@ @CMAKE_CXX_OSX_DEPLOYMENT_TARGET_FLAG_CODE@ set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "@CMAKE_CXX_IMPLICIT_LINK_LIBRARIES@") set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "@CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES@") set(CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES@") - -@SET_CMAKE_CMCLDEPS_EXECUTABLE@ -@SET_CMAKE_CL_SHOWINCLUDES_PREFIX@ diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in index cc3ab49ab..d46750766 100644 --- a/Modules/CMakeCXXCompilerId.cpp.in +++ b/Modules/CMakeCXXCompilerId.cpp.in @@ -23,6 +23,16 @@ char const* qnxnto = "INFO" ":" "qnxnto[]"; @CMAKE_CXX_COMPILER_ID_PLATFORM_CONTENT@ @CMAKE_CXX_COMPILER_ID_ERROR_FOR_TEST@ +const char* info_language_dialect_default = "INFO" ":" "dialect_default[" +#if __cplusplus >= 201402L + "14" +#elif __cplusplus >= 201103L + "11" +#else + "98" +#endif +"]"; + /*--------------------------------------------------------------------------*/ int main(int argc, char* argv[]) diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake index 72b2857db..dad7969df 100644 --- a/Modules/CMakeCXXInformation.cmake +++ b/Modules/CMakeCXXInformation.cmake @@ -74,6 +74,10 @@ if(CMAKE_CXX_SIZEOF_DATA_PTR) unset(CMAKE_CXX_ABI_FILES) endif() +if(CMAKE_CXX_COMPILER_LINKS_STATICALLY) + set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) +endif() + # This should be included before the _INIT variables are # used to initialize the cache. Since the rule variables # have if blocks on them, users can still define them here. @@ -266,7 +270,7 @@ endif() # Create a static archive incrementally for large object file counts. # If CMAKE_CXX_CREATE_STATIC_LIBRARY is set it will override these. if(NOT DEFINED CMAKE_CXX_ARCHIVE_CREATE) - set(CMAKE_CXX_ARCHIVE_CREATE " cq ") + set(CMAKE_CXX_ARCHIVE_CREATE " qc ") endif() if(NOT DEFINED CMAKE_CXX_ARCHIVE_APPEND) set(CMAKE_CXX_ARCHIVE_APPEND " q ") @@ -278,7 +282,7 @@ endif() # compile a C++ file into an object file if(NOT CMAKE_CXX_COMPILE_OBJECT) set(CMAKE_CXX_COMPILE_OBJECT - " -o -c ") + " -o -c ") endif() if(NOT CMAKE_CXX_LINK_EXECUTABLE) diff --git a/Modules/CMakeClDeps.cmake b/Modules/CMakeClDeps.cmake deleted file mode 100644 index b46e7c254..000000000 --- a/Modules/CMakeClDeps.cmake +++ /dev/null @@ -1,34 +0,0 @@ - -#============================================================================= -# Copyright 2012 Kitware, Inc. -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) - -# -# When using Ninja cl.exe is wrapped by cmcldeps to extract the included -# headers for dependency tracking. -# -# cmcldeps path is set, and cmcldeps needs to know the localized string -# in front of each include path, so it can remove it. -# - -if(CMAKE_GENERATOR MATCHES "Ninja" AND CMAKE_C_COMPILER AND CMAKE_COMMAND) - string(REPLACE "cmake.exe" "cmcldeps.exe" CMAKE_CMCLDEPS_EXECUTABLE ${CMAKE_COMMAND}) - set(showdir ${CMAKE_BINARY_DIR}/CMakeFiles/ShowIncludes) - file(WRITE ${showdir}/foo.h "\n") - file(WRITE ${showdir}/main.c "#include \"foo.h\" \nint main(){}\n") - execute_process(COMMAND ${CMAKE_C_COMPILER} /nologo /showIncludes ${showdir}/main.c - WORKING_DIRECTORY ${showdir} OUTPUT_VARIABLE outLine) - string(REGEX MATCH "\n([^:]*:[^:]*:[ \t]*)" tmp "${outLine}") - set(localizedPrefix "${CMAKE_MATCH_1}") - set(SET_CMAKE_CMCLDEPS_EXECUTABLE "set(CMAKE_CMCLDEPS_EXECUTABLE \"${CMAKE_CMCLDEPS_EXECUTABLE}\")") - set(SET_CMAKE_CL_SHOWINCLUDES_PREFIX "set(CMAKE_CL_SHOWINCLUDES_PREFIX \"${localizedPrefix}\")") -endif() diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake index db477cb6a..e0b54686a 100644 --- a/Modules/CMakeDetermineCCompiler.cmake +++ b/Modules/CMakeDetermineCCompiler.cmake @@ -80,6 +80,7 @@ else() # Each entry in this list is a set of extra flags to try # adding to the compile line to see if it helps produce # a valid identification file. + set(CMAKE_C_COMPILER_ID_TEST_FLAGS_FIRST) set(CMAKE_C_COMPILER_ID_TEST_FLAGS # Try compiling to an object file only. "-c" @@ -100,11 +101,19 @@ if(NOT CMAKE_C_COMPILER_ID_RUN) CMAKE_C_COMPILER_ID_PLATFORM_CONTENT) # The IAR compiler produces weird output. - # See http://www.cmake.org/Bug/view.php?id=10176#c19598 + # See https://cmake.org/Bug/view.php?id=10176#c19598 list(APPEND CMAKE_C_COMPILER_ID_VENDORS IAR) set(CMAKE_C_COMPILER_ID_VENDOR_FLAGS_IAR ) set(CMAKE_C_COMPILER_ID_VENDOR_REGEX_IAR "IAR .+ Compiler") + # Match the link line from xcodebuild output of the form + # Ld ... + # ... + # /path/to/cc ...CompilerIdC/... + # to extract the compiler front-end for the language. + set(CMAKE_C_COMPILER_ID_TOOL_MATCH_REGEX "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerIdC/(\\./)?(CompilerIdC.xctest/)?CompilerIdC[ \t\n\\\"]") + set(CMAKE_C_COMPILER_ID_TOOL_MATCH_INDEX 2) + include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake) CMAKE_DETERMINE_COMPILER_ID(C CFLAGS CMakeCCompilerId.c) @@ -164,7 +173,6 @@ endif () include(CMakeFindBinUtils) if(MSVC_C_ARCHITECTURE_ID) - include(${CMAKE_ROOT}/Modules/CMakeClDeps.cmake) set(SET_MSVC_C_ARCHITECTURE_ID "set(MSVC_C_ARCHITECTURE_ID ${MSVC_C_ARCHITECTURE_ID})") endif() diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake index 18e735bdc..3c9bbc26a 100644 --- a/Modules/CMakeDetermineCXXCompiler.cmake +++ b/Modules/CMakeDetermineCXXCompiler.cmake @@ -78,6 +78,7 @@ else() # Each entry in this list is a set of extra flags to try # adding to the compile line to see if it helps produce # a valid identification file. + set(CMAKE_CXX_COMPILER_ID_TEST_FLAGS_FIRST) set(CMAKE_CXX_COMPILER_ID_TEST_FLAGS # Try compiling to an object file only. "-c" @@ -95,11 +96,19 @@ if(NOT CMAKE_CXX_COMPILER_ID_RUN) CMAKE_CXX_COMPILER_ID_PLATFORM_CONTENT) # The IAR compiler produces weird output. - # See http://www.cmake.org/Bug/view.php?id=10176#c19598 + # See https://cmake.org/Bug/view.php?id=10176#c19598 list(APPEND CMAKE_CXX_COMPILER_ID_VENDORS IAR) set(CMAKE_CXX_COMPILER_ID_VENDOR_FLAGS_IAR ) set(CMAKE_CXX_COMPILER_ID_VENDOR_REGEX_IAR "IAR .+ Compiler") + # Match the link line from xcodebuild output of the form + # Ld ... + # ... + # /path/to/cc ...CompilerIdCXX/... + # to extract the compiler front-end for the language. + set(CMAKE_CXX_COMPILER_ID_TOOL_MATCH_REGEX "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerIdCXX/(\\./)?(CompilerIdCXX.xctest/)?CompilerIdCXX[ \t\n\\\"]") + set(CMAKE_CXX_COMPILER_ID_TOOL_MATCH_INDEX 2) + include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake) CMAKE_DETERMINE_COMPILER_ID(CXX CXXFLAGS CMakeCXXCompilerId.cpp) @@ -162,7 +171,6 @@ endif () include(CMakeFindBinUtils) if(MSVC_CXX_ARCHITECTURE_ID) - include(${CMAKE_ROOT}/Modules/CMakeClDeps.cmake) set(SET_MSVC_CXX_ARCHITECTURE_ID "set(MSVC_CXX_ARCHITECTURE_ID ${MSVC_CXX_ARCHITECTURE_ID})") endif() diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 403ac089a..2e741004b 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -34,12 +34,19 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) # Try building with no extra flags and then try each set # of helper flags. Stop when the compiler is identified. - foreach(flags "" ${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS}) - if(NOT CMAKE_${lang}_COMPILER_ID) - CMAKE_DETERMINE_COMPILER_ID_BUILD("${lang}" "${flags}" "${src}") - foreach(file ${COMPILER_${lang}_PRODUCED_FILES}) - CMAKE_DETERMINE_COMPILER_ID_CHECK("${lang}" "${CMAKE_${lang}_COMPILER_ID_DIR}/${file}" "${src}") - endforeach() + foreach(flags ${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS_FIRST} + "" + ${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS}) + CMAKE_DETERMINE_COMPILER_ID_BUILD("${lang}" "${flags}" "${src}") + CMAKE_DETERMINE_COMPILER_ID_MATCH_VENDOR("${lang}" "${COMPILER_${lang}_PRODUCED_OUTPUT}") + if(CMAKE_${lang}_COMPILER_ID) + break() + endif() + foreach(file ${COMPILER_${lang}_PRODUCED_FILES}) + CMAKE_DETERMINE_COMPILER_ID_CHECK("${lang}" "${CMAKE_${lang}_COMPILER_ID_DIR}/${file}" "${src}") + endforeach() + if(CMAKE_${lang}_COMPILER_ID) + break() endif() endforeach() @@ -68,6 +75,12 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) set(CMAKE_EXECUTABLE_FORMAT "Unknown" CACHE INTERNAL "Executable file format") endif() + if(CMAKE_GENERATOR STREQUAL "Ninja" AND MSVC_${lang}_ARCHITECTURE_ID) + CMAKE_DETERMINE_MSVC_SHOWINCLUDES_PREFIX(${lang}) + else() + set(CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX "") + endif() + # Display the final identification result. if(CMAKE_${lang}_COMPILER_ID) if(CMAKE_${lang}_COMPILER_VERSION) @@ -92,9 +105,12 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) set(CMAKE_${lang}_PLATFORM_ID "${CMAKE_${lang}_PLATFORM_ID}" PARENT_SCOPE) set(MSVC_${lang}_ARCHITECTURE_ID "${MSVC_${lang}_ARCHITECTURE_ID}" PARENT_SCOPE) + set(CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX "${CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX}" PARENT_SCOPE) + set(CMAKE_${lang}_COMPILER_LINKS_STATICALLY "${CMAKE_${lang}_COMPILER_LINKS_STATICALLY}" PARENT_SCOPE) set(CMAKE_${lang}_COMPILER_VERSION "${CMAKE_${lang}_COMPILER_VERSION}" PARENT_SCOPE) set(CMAKE_${lang}_SIMULATE_ID "${CMAKE_${lang}_SIMULATE_ID}" PARENT_SCOPE) set(CMAKE_${lang}_SIMULATE_VERSION "${CMAKE_${lang}_SIMULATE_VERSION}" PARENT_SCOPE) + set(CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT "${CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT}" PARENT_SCOPE) endfunction() include(CMakeCompilerIdDetection) @@ -194,6 +210,9 @@ Id flags: ${testflags} else() set(id_system_version "") endif() + if(CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION) + set(id_WindowsTargetPlatformVersion "${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}") + endif() if(id_platform STREQUAL ARM) set(id_WindowsSDKDesktopARMSupport "true") else() @@ -210,7 +229,7 @@ Id flags: ${testflags} set(id_subsystem 1) endif() set(id_dir ${CMAKE_${lang}_COMPILER_ID_DIR}) - get_filename_component(id_src "${src}" NAME) + set(id_src "${src}") configure_file(${CMAKE_ROOT}/Modules/CompilerId/VS-${v}.${ext}.in ${id_dir}/CompilerId${lang}.${ext} @ONLY) if(CMAKE_VS_MSBUILD_COMMAND AND NOT lang STREQUAL "Fortran") @@ -249,7 +268,7 @@ Id flags: ${testflags} set(id_lang "${lang}") set(id_type ${CMAKE_${lang}_COMPILER_XCODE_TYPE}) set(id_dir ${CMAKE_${lang}_COMPILER_ID_DIR}) - get_filename_component(id_src "${src}" NAME) + set(id_src "${src}") if(CMAKE_XCODE_PLATFORM_TOOLSET) set(id_toolset "GCC_VERSION = ${CMAKE_XCODE_PLATFORM_TOOLSET};") else() @@ -297,41 +316,26 @@ Id flags: ${testflags} set(ENV{MACOSX_DEPLOYMENT_TARGET} "${_ENV_MACOSX_DEPLOYMENT_TARGET}") endif() - # Match the link line from xcodebuild output of the form - # Ld ... - # ... - # /path/to/cc ...CompilerId${lang}/... - # to extract the compiler front-end for the language. - if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerId${lang}/(\\./)?(CompilerId${lang}.xctest/)?CompilerId${lang}[ \t\n\\\"]") - set(_comp "${CMAKE_MATCH_2}") - if(EXISTS "${_comp}") - set(CMAKE_${lang}_COMPILER_ID_TOOL "${_comp}" PARENT_SCOPE) + if(DEFINED CMAKE_${lang}_COMPILER_ID_TOOL_MATCH_REGEX) + if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "${CMAKE_${lang}_COMPILER_ID_TOOL_MATCH_REGEX}") + set(_comp "${CMAKE_MATCH_${CMAKE_${lang}_COMPILER_ID_TOOL_MATCH_INDEX}}") + if(EXISTS "${_comp}") + set(CMAKE_${lang}_COMPILER_ID_TOOL "${_comp}" PARENT_SCOPE) + endif() endif() endif() else() - if(COMMAND EXECUTE_PROCESS) - execute_process( - COMMAND "${CMAKE_${lang}_COMPILER}" - ${CMAKE_${lang}_COMPILER_ID_ARG1} - ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST} - ${testflags} - "${src}" - WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR} - OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT - ERROR_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT - RESULT_VARIABLE CMAKE_${lang}_COMPILER_ID_RESULT - ) - else() - exec_program( - "${CMAKE_${lang}_COMPILER}" ${CMAKE_${lang}_COMPILER_ID_DIR} - ARGS ${CMAKE_${lang}_COMPILER_ID_ARG1} - ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST} - ${testflags} - \"${src}\" - OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT - RETURN_VALUE CMAKE_${lang}_COMPILER_ID_RESULT - ) - endif() + execute_process( + COMMAND "${CMAKE_${lang}_COMPILER}" + ${CMAKE_${lang}_COMPILER_ID_ARG1} + ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST} + ${testflags} + "${src}" + WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR} + OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT + ERROR_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT + RESULT_VARIABLE CMAKE_${lang}_COMPILER_ID_RESULT + ) endif() # Check the result of compilation. @@ -355,6 +359,7 @@ ${CMAKE_${lang}_COMPILER_ID_OUTPUT} # No output files should be inspected. set(COMPILER_${lang}_PRODUCED_FILES) + set(COMPILER_${lang}_PRODUCED_OUTPUT) else() # Compilation succeeded. file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log @@ -395,10 +400,24 @@ ${CMAKE_${lang}_COMPILER_ID_OUTPUT} "${src}\" did not produce an executable in \"" "${CMAKE_${lang}_COMPILER_ID_DIR}\".\n\n") endif() + + set(COMPILER_${lang}_PRODUCED_OUTPUT "${CMAKE_${lang}_COMPILER_ID_OUTPUT}") endif() # Return the files produced by the compilation. set(COMPILER_${lang}_PRODUCED_FILES "${COMPILER_${lang}_PRODUCED_FILES}" PARENT_SCOPE) + set(COMPILER_${lang}_PRODUCED_OUTPUT "${COMPILER_${lang}_PRODUCED_OUTPUT}" PARENT_SCOPE) +endfunction() + +#----------------------------------------------------------------------------- +# Function to extract the compiler id from compiler output. +function(CMAKE_DETERMINE_COMPILER_ID_MATCH_VENDOR lang output) + foreach(vendor ${CMAKE_${lang}_COMPILER_ID_MATCH_VENDORS}) + if(output MATCHES "${CMAKE_${lang}_COMPILER_ID_MATCH_VENDOR_REGEX_${vendor}}") + set(CMAKE_${lang}_COMPILER_ID "${vendor}") + endif() + endforeach() + set(CMAKE_${lang}_COMPILER_ID "${CMAKE_${lang}_COMPILER_ID}" PARENT_SCOPE) endfunction() #----------------------------------------------------------------------------- @@ -468,6 +487,9 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) if("${info}" MATCHES "INFO:qnxnto\\[\\]") set(COMPILER_QNXNTO 1) endif() + if("${info}" MATCHES "INFO:dialect_default\\[([^]\"]*)\\]") + set(CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT "${CMAKE_MATCH_1}") + endif() endforeach() # Construct compiler version from components if needed. @@ -511,6 +533,13 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) endif() endif() + if(UNIX) + execute_process(COMMAND file "${file}" OUTPUT_VARIABLE out ERROR_VARIABLE out) + if(out MATCHES "statically linked") + set(CMAKE_${lang}_COMPILER_LINKS_STATICALLY 1 PARENT_SCOPE) + endif() + endif() + # Check if a valid compiler and platform were found. if(COMPILER_ID AND NOT COMPILER_ID_TWICE) set(CMAKE_${lang}_COMPILER_ID "${COMPILER_ID}") @@ -571,6 +600,7 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) set(CMAKE_${lang}_SIMULATE_VERSION "${CMAKE_${lang}_SIMULATE_VERSION}" PARENT_SCOPE) set(CMAKE_EXECUTABLE_FORMAT "${CMAKE_EXECUTABLE_FORMAT}" PARENT_SCOPE) set(COMPILER_QNXNTO "${COMPILER_QNXNTO}" PARENT_SCOPE) + set(CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT "${CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT}" PARENT_SCOPE) endfunction() #----------------------------------------------------------------------------- @@ -626,3 +656,27 @@ function(CMAKE_DETERMINE_COMPILER_ID_VENDOR lang) endif() endforeach() endfunction() + +function(CMAKE_DETERMINE_MSVC_SHOWINCLUDES_PREFIX lang) + # Run this MSVC-compatible compiler to detect what the /showIncludes + # option displays. We can use a C source even with the C++ compiler + # because MSVC-compatible compilers handle both and show the same output. + set(showdir ${CMAKE_BINARY_DIR}/CMakeFiles/ShowIncludes) + file(WRITE ${showdir}/foo.h "\n") + file(WRITE ${showdir}/main.c "#include \"foo.h\" \nint main(){}\n") + execute_process( + COMMAND "${CMAKE_${lang}_COMPILER}" + ${CMAKE_${lang}_COMPILER_ID_ARG1} + ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST} + /nologo /showIncludes /c main.c + WORKING_DIRECTORY ${showdir} + OUTPUT_VARIABLE out + ERROR_VARIABLE err + RESULT_VARIABLE res + ) + if(res EQUAL 0 AND "${out}" MATCHES "\n([^:]*:[^:]*:[ \t]*)") + set(CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX "${CMAKE_MATCH_1}" PARENT_SCOPE) + else() + set(CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX "" PARENT_SCOPE) + endif() +endfunction() diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake index 3a27127e2..911ffac94 100644 --- a/Modules/CMakeDetermineFortranCompiler.cmake +++ b/Modules/CMakeDetermineFortranCompiler.cmake @@ -98,6 +98,10 @@ else() # Each entry in this list is a set of extra flags to try # adding to the compile line to see if it helps produce # a valid identification executable. + set(CMAKE_Fortran_COMPILER_ID_TEST_FLAGS_FIRST + # Get verbose output to help distinguish compilers. + "-v" + ) set(CMAKE_Fortran_COMPILER_ID_TEST_FLAGS # Try compiling to an object file only. "-c" @@ -111,6 +115,10 @@ endif() if(NOT CMAKE_Fortran_COMPILER_ID_RUN) set(CMAKE_Fortran_COMPILER_ID_RUN 1) + # Table of per-vendor compiler output regular expressions. + list(APPEND CMAKE_Fortran_COMPILER_ID_MATCH_VENDORS CCur) + set(CMAKE_Fortran_COMPILER_ID_MATCH_VENDOR_REGEX_CCur "Concurrent Fortran [0-9]+ Compiler") + # Table of per-vendor compiler id flags with expected output. list(APPEND CMAKE_Fortran_COMPILER_ID_VENDORS Compaq) set(CMAKE_Fortran_COMPILER_ID_VENDOR_FLAGS_Compaq "-what") @@ -119,6 +127,14 @@ if(NOT CMAKE_Fortran_COMPILER_ID_RUN) set(CMAKE_Fortran_COMPILER_ID_VENDOR_FLAGS_NAG "-V") set(CMAKE_Fortran_COMPILER_ID_VENDOR_REGEX_NAG "NAG Fortran Compiler") + # Match the link line from xcodebuild output of the form + # Ld ... + # ... + # /path/to/cc ...CompilerIdFortran/... + # to extract the compiler front-end for the language. + set(CMAKE_Fortran_COMPILER_ID_TOOL_MATCH_REGEX "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerIdFortran/(\\./)?(CompilerIdFortran.xctest/)?CompilerIdFortran[ \t\n\\\"]") + set(CMAKE_Fortran_COMPILER_ID_TOOL_MATCH_INDEX 2) + set(_version_info "") foreach(m MAJOR MINOR PATCH TWEAK) set(_COMP "_${m}") diff --git a/Modules/CMakeDetermineSwiftCompiler.cmake b/Modules/CMakeDetermineSwiftCompiler.cmake new file mode 100644 index 000000000..bff1ae9cd --- /dev/null +++ b/Modules/CMakeDetermineSwiftCompiler.cmake @@ -0,0 +1,53 @@ + +#============================================================================= +# Copyright 2002-2015 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake) + +if("${CMAKE_GENERATOR}" STREQUAL "Xcode") + if(XCODE_VERSION VERSION_LESS 6.1) + message(FATAL_ERROR "Swift language not supported by Xcode ${XCODE_VERSION}") + endif() + set(CMAKE_Swift_COMPILER_XCODE_TYPE sourcecode.swift) + _cmake_find_compiler_path(Swift) +else() + message(FATAL_ERROR "Swift language not supported by \"${CMAKE_GENERATOR}\" generator") +endif() + +# Build a small source file to identify the compiler. +if(NOT CMAKE_Swift_COMPILER_ID_RUN) + set(CMAKE_Swift_COMPILER_ID_RUN 1) + + list(APPEND CMAKE_Swift_COMPILER_ID_MATCH_VENDORS Apple) + set(CMAKE_Swift_COMPILER_ID_MATCH_VENDOR_REGEX_Apple "com.apple.xcode.tools.swift.compiler") + + set(CMAKE_Swift_COMPILER_ID_TOOL_MATCH_REGEX "\nCompileSwiftSources[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]* -c[^\r\n]*CompilerIdSwift/CompilerId/main.swift") + set(CMAKE_Swift_COMPILER_ID_TOOL_MATCH_INDEX 2) + + # Try to identify the compiler. + set(CMAKE_Swift_COMPILER_ID) + include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake) + CMAKE_DETERMINE_COMPILER_ID(Swift "" CompilerId/main.swift) +endif() + +if (NOT _CMAKE_TOOLCHAIN_LOCATION) + get_filename_component(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_Swift_COMPILER}" PATH) +endif () + +include(CMakeFindBinUtils) + +# configure variables set in this file for fast reload later on +configure_file(${CMAKE_ROOT}/Modules/CMakeSwiftCompiler.cmake.in + ${CMAKE_PLATFORM_INFO_DIR}/CMakeSwiftCompiler.cmake + @ONLY + ) diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake index fa14641b5..d9f7579e3 100644 --- a/Modules/CMakeDetermineSystem.cmake +++ b/Modules/CMakeDetermineSystem.cmake @@ -123,7 +123,9 @@ elseif(CMAKE_VS_WINCE_VERSION) set(PRESET_CMAKE_SYSTEM_NAME TRUE) else() set(CMAKE_SYSTEM_NAME "${CMAKE_HOST_SYSTEM_NAME}") - set(CMAKE_SYSTEM_VERSION "${CMAKE_HOST_SYSTEM_VERSION}") + if(NOT DEFINED CMAKE_SYSTEM_VERSION) + set(CMAKE_SYSTEM_VERSION "${CMAKE_HOST_SYSTEM_VERSION}") + endif() set(CMAKE_SYSTEM_PROCESSOR "${CMAKE_HOST_SYSTEM_PROCESSOR}") set(CMAKE_CROSSCOMPILING FALSE) set(PRESET_CMAKE_SYSTEM_NAME FALSE) diff --git a/Modules/CMakeExpandImportedTargets.cmake b/Modules/CMakeExpandImportedTargets.cmake index 8ac336465..28f2e468d 100644 --- a/Modules/CMakeExpandImportedTargets.cmake +++ b/Modules/CMakeExpandImportedTargets.cmake @@ -2,6 +2,19 @@ # CMakeExpandImportedTargets # -------------------------- # +# Deprecated. Do not use. +# +# This module was once needed to expand imported targets to the underlying +# libraries they reference on disk for use with the :command:`try_compile` +# and :command:`try_run` commands. These commands now support imported +# libraries in their ``LINK_LIBRARIES`` options (since CMake 2.8.11 +# for :command:`try_compile` and since CMake 3.2 for :command:`try_run`). +# +# This module does not support the policy :policy:`CMP0022` ``NEW`` +# behavior or use of the :prop_tgt:`INTERFACE_LINK_LIBRARIES` property +# because :manual:`generator expressions ` +# cannot be evaluated during configuration. +# # :: # # CMAKE_EXPAND_IMPORTED_TARGETS( LIBRARIES lib1 lib2...libN @@ -14,9 +27,6 @@ # respective configuration of the imported targets if it exists. If no # CONFIGURATION is given, it uses the first configuration from # ${CMAKE_CONFIGURATION_TYPES} if set, otherwise ${CMAKE_BUILD_TYPE}. -# This macro is used by all Check*.cmake files which use try_compile() -# or try_run() and support CMAKE_REQUIRED_LIBRARIES , so that these -# checks support imported targets in CMAKE_REQUIRED_LIBRARIES: # # :: # diff --git a/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake b/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake index 064e6501a..3bfb876f1 100644 --- a/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake +++ b/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake @@ -101,6 +101,8 @@ if (NOT CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS) _DETERMINE_GCC_SYSTEM_INCLUDE_DIRS(c _dirs _defines) set(CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS "${_dirs}" CACHE INTERNAL "C compiler system include directories") set(CMAKE_EXTRA_GENERATOR_C_SYSTEM_DEFINED_MACROS "${_defines}" CACHE INTERNAL "C compiler system defined macros") + elseif ("${CMAKE_C_COMPILER_ID}" MATCHES MSVC) + set(CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS "$ENV{INCLUDE}" CACHE INTERNAL "C compiler system include directories") endif () endif () @@ -110,6 +112,8 @@ if (NOT CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS) _DETERMINE_GCC_SYSTEM_INCLUDE_DIRS(c++ _dirs _defines) set(CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS "${_dirs}" CACHE INTERNAL "CXX compiler system include directories") set(CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_DEFINED_MACROS "${_defines}" CACHE INTERNAL "CXX compiler system defined macros") + elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES MSVC) + set(CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS "$ENV{INCLUDE}" CACHE INTERNAL "CXX compiler system include directories") endif () endif () diff --git a/Modules/CMakeFortranCompiler.cmake.in b/Modules/CMakeFortranCompiler.cmake.in index 14fdd60d9..6b984e517 100644 --- a/Modules/CMakeFortranCompiler.cmake.in +++ b/Modules/CMakeFortranCompiler.cmake.in @@ -2,6 +2,7 @@ set(CMAKE_Fortran_COMPILER "@CMAKE_Fortran_COMPILER@") set(CMAKE_Fortran_COMPILER_ARG1 "@CMAKE_Fortran_COMPILER_ARG1@") set(CMAKE_Fortran_COMPILER_ID "@CMAKE_Fortran_COMPILER_ID@") set(CMAKE_Fortran_COMPILER_VERSION "@CMAKE_Fortran_COMPILER_VERSION@") +set(CMAKE_Fortran_COMPILER_LINKS_STATICALLY "@CMAKE_Fortran_COMPILER_LINKS_STATICALLY@") set(CMAKE_Fortran_PLATFORM_ID "@CMAKE_Fortran_PLATFORM_ID@") set(CMAKE_Fortran_SIMULATE_ID "@CMAKE_Fortran_SIMULATE_ID@") set(CMAKE_Fortran_SIMULATE_VERSION "@CMAKE_Fortran_SIMULATE_VERSION@") diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in index 2533d3f98..017af91c0 100644 --- a/Modules/CMakeFortranCompilerId.F.in +++ b/Modules/CMakeFortranCompilerId.F.in @@ -17,7 +17,9 @@ # if defined(_MSC_VER) PRINT *, 'INFO:simulate[MSVC]' -# if _MSC_VER >= 1800 +# if _MSC_VER >= 1900 + PRINT *, 'INFO:simulate_version[019.00]' +# elif _MSC_VER >= 1800 PRINT *, 'INFO:simulate_version[018.00]' # elif _MSC_VER >= 1700 PRINT *, 'INFO:simulate_version[017.00]' diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake index d6382078b..aa48df760 100644 --- a/Modules/CMakeFortranInformation.cmake +++ b/Modules/CMakeFortranInformation.cmake @@ -51,6 +51,10 @@ if(CMAKE_Fortran_SIZEOF_DATA_PTR) unset(CMAKE_Fortran_ABI_FILES) endif() +if(CMAKE_Fortran_COMPILER_LINKS_STATICALLY) + set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) +endif() + # This should be included before the _INIT variables are # used to initialize the cache. Since the rule variables # have if blocks on them, users can still define them here. @@ -194,7 +198,7 @@ endif() # Create a static archive incrementally for large object file counts. # If CMAKE_Fortran_CREATE_STATIC_LIBRARY is set it will override these. if(NOT DEFINED CMAKE_Fortran_ARCHIVE_CREATE) - set(CMAKE_Fortran_ARCHIVE_CREATE " cq ") + set(CMAKE_Fortran_ARCHIVE_CREATE " qc ") endif() if(NOT DEFINED CMAKE_Fortran_ARCHIVE_APPEND) set(CMAKE_Fortran_ARCHIVE_APPEND " q ") @@ -207,7 +211,7 @@ endif() # (put -o after -c to workaround bug in at least one mpif77 wrapper) if(NOT CMAKE_Fortran_COMPILE_OBJECT) set(CMAKE_Fortran_COMPILE_OBJECT - " -c -o ") + " -c -o ") endif() # link a fortran program diff --git a/Modules/CMakeGenericSystem.cmake b/Modules/CMakeGenericSystem.cmake index 8a14aea60..5ae757d69 100644 --- a/Modules/CMakeGenericSystem.cmake +++ b/Modules/CMakeGenericSystem.cmake @@ -44,7 +44,7 @@ set (CMAKE_SKIP_INSTALL_RPATH "NO" CACHE BOOL set(CMAKE_VERBOSE_MAKEFILE FALSE CACHE BOOL "If this value is on, makefiles will be generated without the .SILENT directive, and all commands will be echoed to the console during the make. This is useful for debugging only. With Visual Studio IDE projects all commands are done without /nologo.") -if(CMAKE_GENERATOR MATCHES "Makefiles") +if(CMAKE_GENERATOR MATCHES "Make") set(CMAKE_COLOR_MAKEFILE ON CACHE BOOL "Enable/Disable color output during build." ) @@ -52,6 +52,9 @@ if(CMAKE_GENERATOR MATCHES "Makefiles") if(DEFINED CMAKE_RULE_MESSAGES) set_property(GLOBAL PROPERTY RULE_MESSAGES ${CMAKE_RULE_MESSAGES}) endif() + if(DEFINED CMAKE_TARGET_MESSAGES) + set_property(GLOBAL PROPERTY TARGET_MESSAGES ${CMAKE_TARGET_MESSAGES}) + endif() if(CMAKE_GENERATOR MATCHES "Unix Makefiles") set(CMAKE_EXPORT_COMPILE_COMMANDS OFF CACHE BOOL "Enable/Disable output of compile commands during generation." diff --git a/Modules/CMakeParseImplicitLinkInfo.cmake b/Modules/CMakeParseImplicitLinkInfo.cmake index 8abc465f9..59092bd2c 100644 --- a/Modules/CMakeParseImplicitLinkInfo.cmake +++ b/Modules/CMakeParseImplicitLinkInfo.cmake @@ -31,7 +31,7 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj # Construct a regex to match linker lines. It must match both the # whole line and just the command (argv[0]). set(linker_regex "^( *|.*[/\\])(${linker}|([^/\\]+-)?ld|collect2)[^/\\]*( |$)") - set(linker_exclude_regex "collect2 version ") + set(linker_exclude_regex "collect2 version |^[A-Za-z0-9_]+=") set(log "${log} link line regex: [${linker_regex}]\n") string(REGEX REPLACE "\r?\n" ";" output_lines "${text}") foreach(line IN LISTS output_lines) diff --git a/Modules/CMakeRCInformation.cmake b/Modules/CMakeRCInformation.cmake index 6bb2636f1..94abd4be8 100644 --- a/Modules/CMakeRCInformation.cmake +++ b/Modules/CMakeRCInformation.cmake @@ -44,7 +44,7 @@ set(CMAKE_INCLUDE_FLAG_RC "-I") # compile a Resource file into an object file if(NOT CMAKE_RC_COMPILE_OBJECT) set(CMAKE_RC_COMPILE_OBJECT - " /fo ") + " /fo ") endif() mark_as_advanced( diff --git a/Modules/CMakeSwiftCompiler.cmake.in b/Modules/CMakeSwiftCompiler.cmake.in new file mode 100644 index 000000000..45f0a3105 --- /dev/null +++ b/Modules/CMakeSwiftCompiler.cmake.in @@ -0,0 +1,5 @@ +set(CMAKE_Swift_COMPILER "@CMAKE_Swift_COMPILER@") +set(CMAKE_Swift_COMPILER_ID "@CMAKE_Swift_COMPILER_ID@") + +set(CMAKE_Swift_COMPILER_ID_RUN 1) +set(CMAKE_Swift_SOURCE_FILE_EXTENSIONS swift) diff --git a/Modules/CMakeSwiftInformation.cmake b/Modules/CMakeSwiftInformation.cmake new file mode 100644 index 000000000..61ad92834 --- /dev/null +++ b/Modules/CMakeSwiftInformation.cmake @@ -0,0 +1,41 @@ + +#============================================================================= +# Copyright 2004-2015 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +set(CMAKE_Swift_OUTPUT_EXTENSION .o) + +# Load compiler-specific information. +if(CMAKE_Swift_COMPILER_ID) + include(Compiler/${CMAKE_Swift_COMPILER_ID}-Swift OPTIONAL) +endif() + +# load the system- and compiler specific files +if(CMAKE_Swift_COMPILER_ID) + # load a hardware specific file, mostly useful for embedded compilers + if(CMAKE_SYSTEM_PROCESSOR) + include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_Swift_COMPILER_ID}-Swift-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL) + endif() + include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_Swift_COMPILER_ID}-Swift OPTIONAL) +endif() + +# for most systems a module is the same as a shared library +# so unless the variable CMAKE_MODULE_EXISTS is set just +# copy the values from the LIBRARY variables +if(NOT CMAKE_MODULE_EXISTS) + set(CMAKE_SHARED_MODULE_Swift_FLAGS ${CMAKE_SHARED_LIBRARY_Swift_FLAGS}) + set(CMAKE_SHARED_MODULE_CREATE_Swift_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_Swift_FLAGS}) +endif() + +include(CMakeCommonLanguageInclude) + +set(CMAKE_Swift_INFORMATION_LOADED 1) diff --git a/Modules/CMakeTestSwiftCompiler.cmake b/Modules/CMakeTestSwiftCompiler.cmake new file mode 100644 index 000000000..89849fb8c --- /dev/null +++ b/Modules/CMakeTestSwiftCompiler.cmake @@ -0,0 +1,65 @@ + +#============================================================================= +# Copyright 2003-2015 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +if(CMAKE_Swift_COMPILER_FORCED) + # The compiler configuration was forced by the user. + # Assume the user has configured all compiler information. + set(CMAKE_Swift_COMPILER_WORKS TRUE) + return() +endif() + +include(CMakeTestCompilerCommon) + +# Remove any cached result from an older CMake version. +# We now store this in CMakeSwiftCompiler.cmake. +unset(CMAKE_Swift_COMPILER_WORKS CACHE) + +# This file is used by EnableLanguage in cmGlobalGenerator to +# determine that that selected C++ compiler can actually compile +# and link the most basic of programs. If not, a fatal error +# is set and cmake stops processing commands and will not generate +# any makefiles or projects. +if(NOT CMAKE_Swift_COMPILER_WORKS) + PrintTestCompilerStatus("Swift" "") + file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/main.swift + "import Foundation\n" + "print(\"CMake\")\n") + try_compile(CMAKE_Swift_COMPILER_WORKS ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/main.swift + OUTPUT_VARIABLE __CMAKE_Swift_COMPILER_OUTPUT) + # Move result from cache to normal variable. + set(CMAKE_Swift_COMPILER_WORKS ${CMAKE_Swift_COMPILER_WORKS}) + unset(CMAKE_Swift_COMPILER_WORKS CACHE) + set(Swift_TEST_WAS_RUN 1) +endif() + +if(NOT CMAKE_Swift_COMPILER_WORKS) + PrintTestCompilerStatus("Swift" " -- broken") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining if the Swift compiler works failed with " + "the following output:\n${__CMAKE_Swift_COMPILER_OUTPUT}\n\n") + message(FATAL_ERROR "The Swift compiler \"${CMAKE_Swift_COMPILER}\" " + "is not able to compile a simple test program.\nIt fails " + "with the following output:\n ${__CMAKE_Swift_COMPILER_OUTPUT}\n\n" + "CMake will not be able to correctly generate this project.") +else() + if(Swift_TEST_WAS_RUN) + PrintTestCompilerStatus("Swift" " -- works") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining if the Swift compiler works passed with " + "the following output:\n${__CMAKE_Swift_COMPILER_OUTPUT}\n\n") + endif() +endif() + +unset(__CMAKE_Swift_COMPILER_OUTPUT) diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index e223286da..575600180 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -182,6 +182,17 @@ # will be a boolean variable which enables stripping of all files (a list # of files evaluates to TRUE in CMake, so this change is compatible). # +# .. variable:: CPACK_VERBATIM_VARIABLES +# +# If set to TRUE, values of variables prefixed with CPACK_ will be escaped +# before being written to the configuration files, so that the cpack program +# receives them exactly as they were specified. If not, characters like quotes +# and backslashes can cause parsing errors or alter the value received by the +# cpack program. Defaults to FALSE for backwards compatibility. +# +# * Mandatory : NO +# * Default : FALSE +# # The following CPack variables are specific to source packages, and # will not affect binary packages: # @@ -299,49 +310,68 @@ endif() include(CPackComponent) # Macro for setting values if a user did not overwrite them +# Mangles CMake-special characters. Only kept for backwards compatibility. macro(cpack_set_if_not_set name value) - if(NOT DEFINED "${name}") - set(${name} "${value}") - endif() + message(DEPRECATION "cpack_set_if_not_set is obsolete; do not use.") + _cpack_set_default("${name}" "${value}") endmacro() -# cpack_encode_variables - Macro to encode variables for the configuration file +# cpack_encode_variables - Function to encode variables for the configuration file # find any variable that starts with CPACK and create a variable # _CPACK_OTHER_VARIABLES_ that contains SET commands for # each cpack variable. _CPACK_OTHER_VARIABLES_ is then # used as an @ replacment in configure_file for the CPackConfig. -macro(cpack_encode_variables) - set(_CPACK_OTHER_VARIABLES_) +function(cpack_encode_variables) + set(commands "") get_cmake_property(res VARIABLES) foreach(var ${res}) if(var MATCHES "^CPACK") - set(_CPACK_OTHER_VARIABLES_ - "${_CPACK_OTHER_VARIABLES_}\nSET(${var} \"${${var}}\")") + if(CPACK_VERBATIM_VARIABLES) + _cpack_escape_for_cmake(value "${${var}}") + else() + set(value "${${var}}") endif() + + set(commands "${commands}\nSET(${var} \"${value}\")") + endif() endforeach() -endmacro() + + set(_CPACK_OTHER_VARIABLES_ "${commands}" PARENT_SCOPE) +endfunction() + +# Internal use functions +function(_cpack_set_default name value) + if(NOT DEFINED "${name}") + set("${name}" "${value}" PARENT_SCOPE) + endif() +endfunction() + +function(_cpack_escape_for_cmake var value) + string(REGEX REPLACE "([\\\$\"])" "\\\\\\1" escaped "${value}") + set("${var}" "${escaped}" PARENT_SCOPE) +endfunction() # Set the package name -cpack_set_if_not_set(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}") -cpack_set_if_not_set(CPACK_PACKAGE_VERSION_MAJOR "0") -cpack_set_if_not_set(CPACK_PACKAGE_VERSION_MINOR "1") -cpack_set_if_not_set(CPACK_PACKAGE_VERSION_PATCH "1") -cpack_set_if_not_set(CPACK_PACKAGE_VERSION +_cpack_set_default(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}") +_cpack_set_default(CPACK_PACKAGE_VERSION_MAJOR "0") +_cpack_set_default(CPACK_PACKAGE_VERSION_MINOR "1") +_cpack_set_default(CPACK_PACKAGE_VERSION_PATCH "1") +_cpack_set_default(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}") -cpack_set_if_not_set(CPACK_PACKAGE_VENDOR "Humanity") -cpack_set_if_not_set(CPACK_PACKAGE_DESCRIPTION_SUMMARY +_cpack_set_default(CPACK_PACKAGE_VENDOR "Humanity") +_cpack_set_default(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${CMAKE_PROJECT_NAME} built using CMake") -cpack_set_if_not_set(CPACK_PACKAGE_DESCRIPTION_FILE +_cpack_set_default(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_ROOT}/Templates/CPack.GenericDescription.txt") -cpack_set_if_not_set(CPACK_RESOURCE_FILE_LICENSE +_cpack_set_default(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_ROOT}/Templates/CPack.GenericLicense.txt") -cpack_set_if_not_set(CPACK_RESOURCE_FILE_README +_cpack_set_default(CPACK_RESOURCE_FILE_README "${CMAKE_ROOT}/Templates/CPack.GenericDescription.txt") -cpack_set_if_not_set(CPACK_RESOURCE_FILE_WELCOME +_cpack_set_default(CPACK_RESOURCE_FILE_WELCOME "${CMAKE_ROOT}/Templates/CPack.GenericWelcome.txt") -cpack_set_if_not_set(CPACK_MODULE_PATH "${CMAKE_MODULE_PATH}") +_cpack_set_default(CPACK_MODULE_PATH "${CMAKE_MODULE_PATH}") if(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL) set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON) @@ -359,7 +389,7 @@ if(__cpack_system_name MATCHES "Windows") set(__cpack_system_name win32) endif() endif() -cpack_set_if_not_set(CPACK_SYSTEM_NAME "${__cpack_system_name}") +_cpack_set_default(CPACK_SYSTEM_NAME "${__cpack_system_name}") # Root dir: default value should be the string literal "$PROGRAMFILES" # for backwards compatibility. Projects may set this value to anything. @@ -369,17 +399,17 @@ if("x${__cpack_system_name}" STREQUAL "xwin64") else() set(__cpack_root_default "$PROGRAMFILES") endif() -cpack_set_if_not_set(CPACK_NSIS_INSTALL_ROOT "${__cpack_root_default}") +_cpack_set_default(CPACK_NSIS_INSTALL_ROOT "${__cpack_root_default}") # -..--. -cpack_set_if_not_set(CPACK_PACKAGE_FILE_NAME +_cpack_set_default(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}") -cpack_set_if_not_set(CPACK_PACKAGE_INSTALL_DIRECTORY +_cpack_set_default(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}") -cpack_set_if_not_set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY +_cpack_set_default(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CPACK_PACKAGE_INSTALL_DIRECTORY}") -cpack_set_if_not_set(CPACK_PACKAGE_DEFAULT_LOCATION "/") -cpack_set_if_not_set(CPACK_PACKAGE_RELOCATABLE "true") +_cpack_set_default(CPACK_PACKAGE_DEFAULT_LOCATION "/") +_cpack_set_default(CPACK_PACKAGE_RELOCATABLE "true") # always force to exactly "true" or "false" for CPack.Info.plist.in: if(CPACK_PACKAGE_RELOCATABLE) @@ -519,10 +549,10 @@ mark_as_advanced( ) # Set some other variables -cpack_set_if_not_set(CPACK_INSTALL_CMAKE_PROJECTS +_cpack_set_default(CPACK_INSTALL_CMAKE_PROJECTS "${CMAKE_BINARY_DIR};${CMAKE_PROJECT_NAME};ALL;/") -cpack_set_if_not_set(CPACK_CMAKE_GENERATOR "${CMAKE_GENERATOR}") -cpack_set_if_not_set(CPACK_TOPLEVEL_TAG "${CPACK_SYSTEM_NAME}") +_cpack_set_default(CPACK_CMAKE_GENERATOR "${CMAKE_GENERATOR}") +_cpack_set_default(CPACK_TOPLEVEL_TAG "${CPACK_SYSTEM_NAME}") # if the user has set CPACK_NSIS_DISPLAY_NAME remember it if(DEFINED CPACK_NSIS_DISPLAY_NAME) set(CPACK_NSIS_DISPLAY_NAME_SET TRUE) @@ -531,34 +561,32 @@ endif() # explicitly, then use that as the default # value of CPACK_NSIS_PACKAGE_NAME instead # of CPACK_PACKAGE_INSTALL_DIRECTORY -cpack_set_if_not_set(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}") +_cpack_set_default(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}") if(CPACK_NSIS_DISPLAY_NAME_SET) - string(REPLACE "\\" "\\\\" - _NSIS_DISPLAY_NAME_TMP "${CPACK_NSIS_DISPLAY_NAME}") - cpack_set_if_not_set(CPACK_NSIS_PACKAGE_NAME "${_NSIS_DISPLAY_NAME_TMP}") + _cpack_set_default(CPACK_NSIS_PACKAGE_NAME "${CPACK_NSIS_DISPLAY_NAME}") else() - cpack_set_if_not_set(CPACK_NSIS_PACKAGE_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}") + _cpack_set_default(CPACK_NSIS_PACKAGE_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}") endif() -cpack_set_if_not_set(CPACK_OUTPUT_CONFIG_FILE +_cpack_set_default(CPACK_OUTPUT_CONFIG_FILE "${CMAKE_BINARY_DIR}/CPackConfig.cmake") -cpack_set_if_not_set(CPACK_SOURCE_OUTPUT_CONFIG_FILE +_cpack_set_default(CPACK_SOURCE_OUTPUT_CONFIG_FILE "${CMAKE_BINARY_DIR}/CPackSourceConfig.cmake") -cpack_set_if_not_set(CPACK_SET_DESTDIR OFF) -cpack_set_if_not_set(CPACK_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") +_cpack_set_default(CPACK_SET_DESTDIR OFF) +_cpack_set_default(CPACK_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") -cpack_set_if_not_set(CPACK_NSIS_INSTALLER_ICON_CODE "") -cpack_set_if_not_set(CPACK_NSIS_INSTALLER_MUI_ICON_CODE "") +_cpack_set_default(CPACK_NSIS_INSTALLER_ICON_CODE "") +_cpack_set_default(CPACK_NSIS_INSTALLER_MUI_ICON_CODE "") # WiX specific variables -cpack_set_if_not_set(CPACK_WIX_SIZEOF_VOID_P "${CMAKE_SIZEOF_VOID_P}") +_cpack_set_default(CPACK_WIX_SIZEOF_VOID_P "${CMAKE_SIZEOF_VOID_P}") # set sysroot so SDK tools can be used if(CMAKE_OSX_SYSROOT) - cpack_set_if_not_set(CPACK_OSX_SYSROOT "${CMAKE_OSX_SYSROOT}") + _cpack_set_default(CPACK_OSX_SYSROOT "${CMAKE_OSX_SYSROOT}") endif() if(DEFINED CPACK_COMPONENTS_ALL) @@ -598,13 +626,20 @@ cpack_encode_variables() configure_file("${cpack_input_file}" "${CPACK_OUTPUT_CONFIG_FILE}" @ONLY) # Generate source file -cpack_set_if_not_set(CPACK_SOURCE_INSTALLED_DIRECTORIES +_cpack_set_default(CPACK_SOURCE_INSTALLED_DIRECTORIES "${CMAKE_SOURCE_DIR};/") -cpack_set_if_not_set(CPACK_SOURCE_TOPLEVEL_TAG "${CPACK_SYSTEM_NAME}-Source") -cpack_set_if_not_set(CPACK_SOURCE_PACKAGE_FILE_NAME +_cpack_set_default(CPACK_SOURCE_TOPLEVEL_TAG "${CPACK_SYSTEM_NAME}-Source") +_cpack_set_default(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-Source") -cpack_set_if_not_set(CPACK_SOURCE_IGNORE_FILES - "/CVS/;/\\\\\\\\.svn/;/\\\\\\\\.bzr/;/\\\\\\\\.hg/;/\\\\\\\\.git/;\\\\\\\\.swp$;\\\\\\\\.#;/#") + +set(__cpack_source_ignore_files_default + "/CVS/;/\\.svn/;/\\.bzr/;/\\.hg/;/\\.git/;\\.swp$;\\.#;/#") +if(NOT CPACK_VERBATIM_VARIABLES) + _cpack_escape_for_cmake(__cpack_source_ignore_files_default + "${__cpack_source_ignore_files_default}") +endif() +_cpack_set_default(CPACK_SOURCE_IGNORE_FILES "${__cpack_source_ignore_files_default}") + set(CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_SOURCE_INSTALL_CMAKE_PROJECTS}") set(CPACK_INSTALLED_DIRECTORIES "${CPACK_SOURCE_INSTALLED_DIRECTORIES}") set(CPACK_GENERATOR "${CPACK_SOURCE_GENERATOR}") diff --git a/Modules/CPackComponent.cmake b/Modules/CPackComponent.cmake index 573e5aac1..96d5609ee 100644 --- a/Modules/CPackComponent.cmake +++ b/Modules/CPackComponent.cmake @@ -263,7 +263,7 @@ # # The site argument is a URL where the archives for downloadable # components will reside, e.g., -# http://www.cmake.org/files/2.6.1/installer/ All of the archives +# https://cmake.org/files/2.6.1/installer/ All of the archives # produced by CPack should be uploaded to that location. # # UPLOAD_DIRECTORY is the local directory where CPack will create the @@ -301,7 +301,7 @@ if(NOT CPackComponent_CMake_INCLUDED) set(CPackComponent_CMake_INCLUDED 1) -# Argument-parsing macro from http://www.cmake.org/Wiki/CMakeMacroParseArguments +# Argument-parsing macro from https://cmake.org/Wiki/CMakeMacroParseArguments macro(cpack_parse_arguments prefix arg_names option_names) set(${prefix}_DEFAULT_ARGS) foreach(arg_name ${arg_names}) diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake index 09cddcd11..60e0d1f8f 100644 --- a/Modules/CPackDeb.cmake +++ b/Modules/CPackDeb.cmake @@ -9,7 +9,7 @@ # # CPackDeb may be used to create Deb package using CPack. # CPackDeb is a CPack generator thus it uses the CPACK_XXX variables -# used by CPack : http://www.cmake.org/Wiki/CMake:CPackConfiguration. +# used by CPack : https://cmake.org/Wiki/CMake:CPackConfiguration. # CPackDeb generator should work on any linux host but it will produce # better deb package when Debian specific tools 'dpkg-xxx' are usable on # the build system. @@ -23,7 +23,7 @@ # a component GROUP name. # # You'll find a detailed usage on the wiki: -# http://www.cmake.org/Wiki/CMake:CPackPackageGenerators#DEB_.28UNIX_only.29 . +# https://cmake.org/Wiki/CMake:CPackPackageGenerators#DEB_.28UNIX_only.29 . # However as a handy reminder here comes the list of specific variables: # # .. variable:: CPACK_DEBIAN_PACKAGE_NAME @@ -78,6 +78,7 @@ # # set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.3.1-6), libc6 (< 2.4)") # +# # .. variable:: CPACK_DEBIAN_PACKAGE_MAINTAINER # # The Debian package maintainer @@ -152,7 +153,7 @@ # You may need set :variable:`CMAKE_INSTALL_RPATH` to an appropriate value # if you use this feature, because if you don't :code:`dpkg-shlibdeps` # may fail to find your own shared libs. -# See http://www.cmake.org/Wiki/CMake_RPATH_handling. +# See https://cmake.org/Wiki/CMake_RPATH_handling. # # # .. variable:: CPACK_DEBIAN_PACKAGE_DEBUG @@ -164,6 +165,7 @@ # * Default : - # # .. variable:: CPACK_DEBIAN_PACKAGE_PREDEPENDS +# CPACK_DEBIAN__PACKAGE_PREDEPENDS # # Sets the `Pre-Depends` field of the Debian package. # Like :variable:`Depends `, except that it @@ -172,11 +174,16 @@ # pre-dependency. # # * Mandatory : NO -# * Default : - +# * Default : +# +# - An empty string for non-component based installations +# - :variable:`CPACK_DEBIAN_PACKAGE_PREDEPENDS` for component-based +# installations. # # See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps # # .. variable:: CPACK_DEBIAN_PACKAGE_ENHANCES +# CPACK_DEBIAN__PACKAGE_ENHANCES # # Sets the `Enhances` field of the Debian package. # Similar to :variable:`Suggests ` but works @@ -184,11 +191,16 @@ # functionality of another package. # # * Mandatory : NO -# * Default : - +# * Default : +# +# - An empty string for non-component based installations +# - :variable:`CPACK_DEBIAN_PACKAGE_ENHANCES` for component-based +# installations. # # See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps # # .. variable:: CPACK_DEBIAN_PACKAGE_BREAKS +# CPACK_DEBIAN__PACKAGE_BREAKS # # Sets the `Breaks` field of the Debian package. # When a binary package (P) declares that it breaks other packages (B), @@ -199,12 +211,17 @@ # packages (B) cannot be reconfigured again. # # * Mandatory : NO -# * Default : - +# * Default : +# +# - An empty string for non-component based installations +# - :variable:`CPACK_DEBIAN_PACKAGE_BREAKS` for component-based +# installations. # # See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-breaks # # # .. variable:: CPACK_DEBIAN_PACKAGE_CONFLICTS +# CPACK_DEBIAN__PACKAGE_CONFLICTS # # Sets the `Conflicts` field of the Debian package. # When one binary package declares a conflict with another using a `Conflicts` @@ -212,7 +229,11 @@ # the same time. # # * Mandatory : NO -# * Default : - +# * Default : +# +# - An empty string for non-component based installations +# - :variable:`CPACK_DEBIAN_PACKAGE_CONFLICTS` for component-based +# installations. # # See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-conflicts # @@ -225,53 +246,74 @@ # time. # # .. variable:: CPACK_DEBIAN_PACKAGE_PROVIDES +# CPACK_DEBIAN__PACKAGE_PROVIDES # # Sets the `Provides` field of the Debian package. # A virtual package is one which appears in the `Provides` control field of # another package. # # * Mandatory : NO -# * Default : - +# * Default : +# +# - An empty string for non-component based installations +# - :variable:`CPACK_DEBIAN_PACKAGE_PROVIDES` for component-based +# installations. # # See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-virtual # # # .. variable:: CPACK_DEBIAN_PACKAGE_REPLACES +# CPACK_DEBIAN__PACKAGE_REPLACES # # Sets the `Replaces` field of the Debian package. # Packages can declare in their control file that they should overwrite # files in certain other packages, or completely replace other packages. # # * Mandatory : NO -# * Default : - +# * Default : +# +# - An empty string for non-component based installations +# - :variable:`CPACK_DEBIAN_PACKAGE_REPLACES` for component-based +# installations. # # See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps # # # .. variable:: CPACK_DEBIAN_PACKAGE_RECOMMENDS +# CPACK_DEBIAN__PACKAGE_RECOMMENDS # # Sets the `Recommends` field of the Debian package. # Allows packages to declare a strong, but not absolute, dependency on other # packages. # # * Mandatory : NO -# * Default : - +# * Default : +# +# - An empty string for non-component based installations +# - :variable:`CPACK_DEBIAN_PACKAGE_RECOMMENDS` for component-based +# installations. # # See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps # # # .. variable:: CPACK_DEBIAN_PACKAGE_SUGGESTS +# CPACK_DEBIAN__PACKAGE_SUGGESTS # # Sets the `Suggests` field of the Debian package. # Allows packages to declare a suggested package install grouping. # # * Mandatory : NO -# * Default : - +# * Default : +# +# - An empty string for non-component based installations +# - :variable:`CPACK_DEBIAN_PACKAGE_SUGGESTS` for component-based +# installations. # # See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps # # # .. variable:: CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA +# CPACK_DEBIAN__PACKAGE_CONTROL_EXTRA # # This variable allow advanced user to add custom script to the # control.tar.gz. @@ -284,6 +326,34 @@ # # set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA # "${CMAKE_CURRENT_SOURCE_DIR/prerm;${CMAKE_CURRENT_SOURCE_DIR}/postrm") +# +# .. note:: +# +# The original permissions of the files will be used in the final +# package unless the variable +# :variable:`CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION` is set. +# In particular, the scripts should have the proper executable +# flag prior to the generation of the package. +# +# .. variable:: CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION +# CPACK_DEBIAN__PACKAGE_CONTROL_STRICT_PERMISSION +# +# This variable indicates if the Debian policy on control files should be +# strictly followed. +# +# * Mandatory : NO +# * Default : FALSE +# +# Usage:: +# +# set(CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION TRUE) +# +# .. note:: +# +# This overrides the permissions on the original files, following the rules +# set by Debian policy +# https://www.debian.org/doc/debian-policy/ch-files.html#s-permissions-owners +# #============================================================================= @@ -320,11 +390,6 @@ function(cpack_deb_prepare_package_vars) set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS OFF) endif() - find_program(FAKEROOT_EXECUTABLE fakeroot) - if(FAKEROOT_EXECUTABLE) - set(CPACK_DEBIAN_FAKEROOT_EXECUTABLE ${FAKEROOT_EXECUTABLE}) - endif() - set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_DEB_PACKAGE_COMPONENT_PART_PATH}") # per component automatic discover: some of the component might not have @@ -495,19 +560,21 @@ function(cpack_deb_prepare_package_vars) # You should set: DEBIAN_PACKAGE_DEPENDS # TODO: automate 'objdump -p | grep NEEDED' - # if per-component dependency, overrides the global CPACK_DEBIAN_PACKAGE_DEPENDS + # if per-component dependency, overrides the global CPACK_DEBIAN_PACKAGE_${dependency_type_} # automatic dependency discovery will be performed afterwards. if(CPACK_DEB_PACKAGE_COMPONENT) - string(TOUPPER "${CPACK_DEB_PACKAGE_COMPONENT}" _local_component_name) - set(_component_depends_var "CPACK_DEBIAN_${_local_component_name}_PACKAGE_DEPENDS") + foreach(dependency_type_ DEPENDS RECOMMENDS SUGGESTS PREDEPENDS ENHANCES BREAKS CONFLICTS PROVIDES REPLACES) + set(_component_var "CPACK_DEBIAN_${_local_component_name}_PACKAGE_${dependency_type_}") - # if set, overrides the global dependency - if(DEFINED ${_component_depends_var}) - set(CPACK_DEBIAN_PACKAGE_DEPENDS "${${_component_depends_var}}") - if(CPACK_DEBIAN_PACKAGE_DEBUG) - message("CPackDeb Debug: component '${_local_component_name}' dependencies set to '${CPACK_DEBIAN_PACKAGE_DEPENDS}'") + # if set, overrides the global dependency + if(DEFINED ${_component_var}) + set(CPACK_DEBIAN_PACKAGE_${dependency_type_} "${${_component_var}}") + if(CPACK_DEBIAN_PACKAGE_DEBUG) + message("CPackDeb Debug: component '${_local_component_name}' ${dependency_type_}" + "dependencies set to '${CPACK_DEBIAN_PACKAGE_${dependency_}}'") + endif() endif() - endif() + endforeach() endif() # at this point, the CPACK_DEBIAN_PACKAGE_DEPENDS is properly set @@ -542,7 +609,6 @@ function(cpack_deb_prepare_package_vars) set(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}) endif() else() - string(TOUPPER ${CPACK_DEB_PACKAGE_COMPONENT} _local_component_name) set(component_description_var CPACK_COMPONENT_${_local_component_name}_DESCRIPTION) # component description overrides package description @@ -584,13 +650,20 @@ function(cpack_deb_prepare_package_vars) # - conffiles # - postinst # - postrm - # - prerm" + # - prerm # Usage: # set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA # "${CMAKE_CURRENT_SOURCE_DIR/prerm;${CMAKE_CURRENT_SOURCE_DIR}/postrm") # Are we packaging components ? if(CPACK_DEB_PACKAGE_COMPONENT) + # override values with per component version if set + foreach(VAR_NAME_ "PACKAGE_CONTROL_EXTRA" "PACKAGE_CONTROL_STRICT_PERMISSION") + if(CPACK_DEBIAN_${_local_component_name}_${VAR_NAME_}) + set(CPACK_DEBIAN_${VAR_NAME_} "${CPACK_DEBIAN_${_local_component_name}_${VAR_NAME_}}") + endif() + endforeach() + set(CPACK_DEB_PACKAGE_COMPONENT_PART_NAME "-${CPACK_DEB_PACKAGE_COMPONENT}") string(TOLOWER "${CPACK_PACKAGE_NAME}${CPACK_DEB_PACKAGE_COMPONENT_PART_NAME}" CPACK_DEBIAN_PACKAGE_NAME) else() @@ -607,6 +680,7 @@ function(cpack_deb_prepare_package_vars) message("CPackDeb:Debug: CPACK_PACKAGE_FILE_NAME = ${CPACK_PACKAGE_FILE_NAME}") message("CPackDeb:Debug: CPACK_PACKAGE_INSTALL_DIRECTORY = ${CPACK_PACKAGE_INSTALL_DIRECTORY}") message("CPackDeb:Debug: CPACK_TEMPORARY_PACKAGE_FILE_NAME = ${CPACK_TEMPORARY_PACKAGE_FILE_NAME}") + message("CPackDeb:Debug: CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION = ${CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION}") endif() # For debian source packages: @@ -632,7 +706,6 @@ function(cpack_deb_prepare_package_vars) set(GEN_CPACK_DEBIAN_PACKAGE_MAINTAINER "${CPACK_DEBIAN_PACKAGE_MAINTAINER}" PARENT_SCOPE) set(GEN_CPACK_DEBIAN_PACKAGE_DESCRIPTION "${CPACK_DEBIAN_PACKAGE_DESCRIPTION}" PARENT_SCOPE) set(GEN_CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}" PARENT_SCOPE) - set(GEN_CPACK_DEBIAN_FAKEROOT_EXECUTABLE "${CPACK_DEBIAN_FAKEROOT_EXECUTABLE}" PARENT_SCOPE) set(GEN_CPACK_DEBIAN_COMPRESSION_TYPE "${CPACK_DEBIAN_COMPRESSION_TYPE}" PARENT_SCOPE) set(GEN_CPACK_DEBIAN_PACKAGE_RECOMMENDS "${CPACK_DEBIAN_PACKAGE_RECOMMENDS}" PARENT_SCOPE) set(GEN_CPACK_DEBIAN_PACKAGE_SUGGESTS "${CPACK_DEBIAN_PACKAGE_SUGGESTS}" PARENT_SCOPE) @@ -644,6 +717,8 @@ function(cpack_deb_prepare_package_vars) set(GEN_CPACK_DEBIAN_PACKAGE_PROVIDES "${CPACK_DEBIAN_PACKAGE_PROVIDES}" PARENT_SCOPE) set(GEN_CPACK_DEBIAN_PACKAGE_REPLACES "${CPACK_DEBIAN_PACKAGE_REPLACES}" PARENT_SCOPE) set(GEN_CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA}" PARENT_SCOPE) + set(GEN_CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION + "${CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION}" PARENT_SCOPE) set(GEN_WDIR "${WDIR}" PARENT_SCOPE) endfunction() diff --git a/Modules/CPackNSIS.cmake b/Modules/CPackNSIS.cmake index 4b2e0ebbc..c6b3d194a 100644 --- a/Modules/CPackNSIS.cmake +++ b/Modules/CPackNSIS.cmake @@ -115,7 +115,7 @@ # # set(CPACK_NSIS_MENU_LINKS # "doc/cmake-@CMake_VERSION_MAJOR@.@CMake_VERSION_MINOR@/cmake.html" -# "CMake Help" "http://www.cmake.org" "CMake Web Site") +# "CMake Help" "https://cmake.org" "CMake Web Site") # #============================================================================= diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index cb77fb891..1e7b05581 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -9,7 +9,7 @@ # # CPackRPM may be used to create RPM package using CPack. CPackRPM is a # CPack generator thus it uses the CPACK_XXX variables used by CPack : -# http://www.cmake.org/Wiki/CMake:CPackConfiguration +# https://cmake.org/Wiki/CMake:CPackConfiguration # # However CPackRPM has specific features which are controlled by the # specifics CPACK_RPM_XXX variables. CPackRPM is a component aware @@ -24,7 +24,7 @@ # # :: # -# http://www.cmake.org/Wiki/CMake:CPackPackageGenerators#RPM_.28Unix_Only.29 +# https://cmake.org/Wiki/CMake:CPackPackageGenerators#RPM_.28Unix_Only.29 # # However as a handy reminder here comes the list of specific variables: # @@ -95,6 +95,7 @@ # * Default : CPACK_PACKAGE_VENDOR if set or "unknown" # # .. variable:: CPACK_RPM_PACKAGE_URL +# CPACK_RPM__PACKAGE_URL # # The projects URL. # @@ -123,7 +124,55 @@ # compression whereas older cannot use such RPM. Using this one can enforce # compression type to be used. Possible value are: lzma, xz, bzip2 and gzip. # +# .. variable:: CPACK_RPM_PACKAGE_AUTOREQ +# CPACK_RPM__PACKAGE_AUTOREQ +# +# RPM spec autoreq field. +# +# * Mandatory : NO +# * Default : - +# +# May be used to enable (1, yes) or disable (0, no) automatic shared libraries +# dependency detection. Dependencies are added to requires list. +# +# .. note:: +# +# By defalut automatic dependency detection is enabled by rpm generator. +# +# .. variable:: CPACK_RPM_PACKAGE_AUTOPROV +# CPACK_RPM__PACKAGE_AUTOPROV +# +# RPM spec autoprov field. +# +# * Mandatory : NO +# * Default : - +# +# May be used to enable (1, yes) or disable (0, no) automatic listing of shared +# libraries that are provided by the package. Shared libraries are added to +# provides list. +# +# .. note:: +# +# By defalut automatic provides detection is enabled by rpm generator. +# +# .. variable:: CPACK_RPM_PACKAGE_AUTOREQPROV +# CPACK_RPM__PACKAGE_AUTOREQPROV +# +# RPM spec autoreqprov field. +# +# * Mandatory : NO +# * Default : - +# +# Variable enables/disables autoreq and autoprov at the same time. +# See :variable:`CPACK_RPM_PACKAGE_AUTOREQ` and :variable:`CPACK_RPM_PACKAGE_AUTOPROV` +# for more details. +# +# .. note:: +# +# By defalut automatic detection feature is enabled by rpm. +# # .. variable:: CPACK_RPM_PACKAGE_REQUIRES +# CPACK_RPM__PACKAGE_REQUIRES # # RPM spec requires field. # @@ -139,7 +188,25 @@ # # rpm -qp --requires file.rpm # +# .. variable:: CPACK_RPM_PACKAGE_CONFLICTS +# CPACK_RPM__PACKAGE_CONFLICTS +# +# RPM spec conflicts field. +# +# * Mandatory : NO +# * Default : - +# +# May be used to set negative RPM dependencies (conflicts). Note that you must enclose +# the complete requires string between quotes, for example:: +# +# set(CPACK_RPM_PACKAGE_CONFLICTS "libxml2") +# +# The conflicting package list of an RPM file could be printed with:: +# +# rpm -qp --conflicts file.rpm +# # .. variable:: CPACK_RPM_PACKAGE_REQUIRES_PRE +# CPACK_RPM__PACKAGE_REQUIRES_PRE # # RPM spec requires(pre) field. # @@ -152,6 +219,7 @@ # set(CPACK_RPM_PACKAGE_REQUIRES_PRE "shadow-utils, initscripts") # # .. variable:: CPACK_RPM_PACKAGE_REQUIRES_POST +# CPACK_RPM__PACKAGE_REQUIRES_POST # # RPM spec requires(post) field. # @@ -165,6 +233,7 @@ # # # .. variable:: CPACK_RPM_PACKAGE_REQUIRES_POSTUN +# CPACK_RPM__PACKAGE_REQUIRES_POSTUN # # RPM spec requires(postun) field. # @@ -178,6 +247,7 @@ # # # .. variable:: CPACK_RPM_PACKAGE_REQUIRES_PREUN +# CPACK_RPM__PACKAGE_REQUIRES_PREUN # # RPM spec requires(preun) field. # @@ -190,6 +260,7 @@ # set(CPACK_RPM_PACKAGE_REQUIRES_PREUN "shadow-utils, initscripts") # # .. variable:: CPACK_RPM_PACKAGE_SUGGESTS +# CPACK_RPM__PACKAGE_SUGGESTS # # RPM spec suggest field. # @@ -200,6 +271,7 @@ # enclose the complete requires string between quotes. # # .. variable:: CPACK_RPM_PACKAGE_PROVIDES +# CPACK_RPM__PACKAGE_PROVIDES # # RPM spec provides field. # @@ -212,6 +284,7 @@ # rpm -qp --provides file.rpm # # .. variable:: CPACK_RPM_PACKAGE_OBSOLETES +# CPACK_RPM__PACKAGE_OBSOLETES # # RPM spec obsoletes field. # diff --git a/Modules/CPackWIX.cmake b/Modules/CPackWIX.cmake index 5fe51a641..bef8e16c2 100644 --- a/Modules/CPackWIX.cmake +++ b/Modules/CPackWIX.cmake @@ -16,7 +16,7 @@ # # Will be automatically generated unless explicitly provided. # -# It should be explicitly set to a constant generated gloabally unique +# It should be explicitly set to a constant generated globally unique # identifier (GUID) to allow your installers to replace existing # installations that use the same GUID. # @@ -226,7 +226,7 @@ # This variable can be used to provide a value for # the Windows Installer property ```` # -# The follwing list contains some example properties that can be used to +# The following list contains some example properties that can be used to # customize information under # "Programs and Features" (also known as "Add or Remove Programs") # diff --git a/Modules/CTestCoverageCollectGCOV.cmake b/Modules/CTestCoverageCollectGCOV.cmake index 6c74cf39a..ef3aa7639 100644 --- a/Modules/CTestCoverageCollectGCOV.cmake +++ b/Modules/CTestCoverageCollectGCOV.cmake @@ -161,7 +161,7 @@ function(ctest_coverage_collect_gcov) message(STATUS "Could not determine source file corresponding to: ${gcov_file}") endif() - foreach(exclude_entry ${CTEST_CUSTOM_COVERAGE_EXCLUDE}) + foreach(exclude_entry IN LISTS CTEST_CUSTOM_COVERAGE_EXCLUDE) if(source_file MATCHES "${exclude_entry}") set(is_excluded true) diff --git a/Modules/CheckForPthreads.c b/Modules/CheckForPthreads.c index 7250fbff6..2732957e1 100644 --- a/Modules/CheckForPthreads.c +++ b/Modules/CheckForPthreads.c @@ -31,7 +31,7 @@ void* runner(void* args) int cc; for ( cc = 0; cc < 10; cc ++ ) { - printf("%d CC: %d\n", (int)args, cc); + printf("%p CC: %d\n", args, cc); } res ++; return 0; diff --git a/Modules/CheckFunctionExists.c b/Modules/CheckFunctionExists.c index 607b3e8c6..fd29618ce 100644 --- a/Modules/CheckFunctionExists.c +++ b/Modules/CheckFunctionExists.c @@ -1,5 +1,8 @@ #ifdef CHECK_FUNCTION_EXISTS +#ifdef __cplusplus +extern "C" +#endif char CHECK_FUNCTION_EXISTS(); #ifdef __CLASSIC_C__ int main(){ diff --git a/Modules/CheckFunctionExists.cmake b/Modules/CheckFunctionExists.cmake index d277c3282..5dd37517a 100644 --- a/Modules/CheckFunctionExists.cmake +++ b/Modules/CheckFunctionExists.cmake @@ -57,14 +57,26 @@ macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE) else() set(CHECK_FUNCTION_EXISTS_ADD_INCLUDES) endif() + + if(CMAKE_C_COMPILER_LOADED) + set(_cfe_source ${CMAKE_ROOT}/Modules/CheckFunctionExists.c) + elseif(CMAKE_CXX_COMPILER_LOADED) + set(_cfe_source ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckFunctionExists/CheckFunctionExists.cxx) + configure_file(${CMAKE_ROOT}/Modules/CheckFunctionExists.c "${_cfe_source}" COPYONLY) + else() + message(FATAL_ERROR "CHECK_FUNCTION_EXISTS needs either C or CXX language enabled") + endif() + try_compile(${VARIABLE} ${CMAKE_BINARY_DIR} - ${CMAKE_ROOT}/Modules/CheckFunctionExists.c + ${_cfe_source} COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} ${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES} CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} "${CHECK_FUNCTION_EXISTS_ADD_INCLUDES}" OUTPUT_VARIABLE OUTPUT) + unset(_cfe_source) + if(${VARIABLE}) set(${VARIABLE} 1 CACHE INTERNAL "Have function ${FUNCTION}") if(NOT CMAKE_REQUIRED_QUIET) diff --git a/Modules/CheckLibraryExists.cmake b/Modules/CheckLibraryExists.cmake index 95c595a21..6b538233e 100644 --- a/Modules/CheckLibraryExists.cmake +++ b/Modules/CheckLibraryExists.cmake @@ -53,15 +53,26 @@ macro(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE) set(CHECK_LIBRARY_EXISTS_LIBRARIES ${CHECK_LIBRARY_EXISTS_LIBRARIES} ${CMAKE_REQUIRED_LIBRARIES}) endif() + + if(CMAKE_C_COMPILER_LOADED) + set(_cle_source ${CMAKE_ROOT}/Modules/CheckFunctionExists.c) + elseif(CMAKE_CXX_COMPILER_LOADED) + set(_cle_source ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckLibraryExists/CheckFunctionExists.cxx) + configure_file(${CMAKE_ROOT}/Modules/CheckFunctionExists.c "${_cle_source}" COPYONLY) + else() + message(FATAL_ERROR "CHECK_FUNCTION_EXISTS needs either C or CXX language enabled") + endif() + try_compile(${VARIABLE} ${CMAKE_BINARY_DIR} - ${CMAKE_ROOT}/Modules/CheckFunctionExists.c + ${_cle_source} COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} LINK_LIBRARIES ${CHECK_LIBRARY_EXISTS_LIBRARIES} CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_LIBRARY_EXISTS_DEFINITION} -DLINK_DIRECTORIES:STRING=${LOCATION} OUTPUT_VARIABLE OUTPUT) + unset(_cle_source) if(${VARIABLE}) if(NOT CMAKE_REQUIRED_QUIET) diff --git a/Modules/CheckSymbolExists.cmake b/Modules/CheckSymbolExists.cmake index 79c5ba78e..c4dff3faa 100644 --- a/Modules/CheckSymbolExists.cmake +++ b/Modules/CheckSymbolExists.cmake @@ -44,10 +44,14 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) - - macro(CHECK_SYMBOL_EXISTS SYMBOL FILES VARIABLE) - _CHECK_SYMBOL_EXISTS("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.c" "${SYMBOL}" "${FILES}" "${VARIABLE}" ) + if(CMAKE_C_COMPILER_LOADED) + _CHECK_SYMBOL_EXISTS("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.c" "${SYMBOL}" "${FILES}" "${VARIABLE}" ) + elseif(CMAKE_CXX_COMPILER_LOADED) + _CHECK_SYMBOL_EXISTS("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.cxx" "${SYMBOL}" "${FILES}" "${VARIABLE}" ) + else() + message(FATAL_ERROR "CHECK_SYMBOL_EXISTS needs either C or CXX language enabled") + endif() endmacro() macro(_CHECK_SYMBOL_EXISTS SOURCEFILE SYMBOL FILES VARIABLE) diff --git a/Modules/Compiler/AppleClang-C.cmake b/Modules/Compiler/AppleClang-C.cmake index 10454f649..5908c26b3 100644 --- a/Modules/Compiler/AppleClang-C.cmake +++ b/Modules/Compiler/AppleClang-C.cmake @@ -13,7 +13,12 @@ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.0) endif() if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.0) - set(CMAKE_C_STANDARD_DEFAULT 99) + if (NOT CMAKE_C_COMPILER_FORCED) + if (NOT CMAKE_C_STANDARD_COMPUTED_DEFAULT) + message(FATAL_ERROR "CMAKE_C_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_C_COMPILER_ID} (${CMAKE_C_COMPILER}) version ${CMAKE_C_COMPILER_VERSION}") + endif() + set(CMAKE_C_STANDARD_DEFAULT ${CMAKE_C_STANDARD_COMPUTED_DEFAULT}) + endif() endif() macro(cmake_record_c_compile_features) diff --git a/Modules/Compiler/AppleClang-CXX.cmake b/Modules/Compiler/AppleClang-CXX.cmake index 5194da4b8..c4e342bf3 100644 --- a/Modules/Compiler/AppleClang-CXX.cmake +++ b/Modules/Compiler/AppleClang-CXX.cmake @@ -13,16 +13,25 @@ if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0) set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11") endif() -if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1) +if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.1) + set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14") + set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++14") +elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1) # AppleClang 5.0 knows this flag, but does not set a __cplusplus macro greater than 201103L set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++1y") set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y") endif() if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0) - set(CMAKE_CXX_STANDARD_DEFAULT 98) + if (NOT CMAKE_CXX_COMPILER_FORCED) + if (NOT CMAKE_CXX_STANDARD_COMPUTED_DEFAULT) + message(FATAL_ERROR "CMAKE_CXX_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) version ${CMAKE_CXX_COMPILER_VERSION}") + endif() + set(CMAKE_CXX_STANDARD_DEFAULT ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT}) + endif() endif() + macro(cmake_record_cxx_compile_features) macro(_get_appleclang_features std_version list) record_compiler_features(CXX "${std_version}" ${list}) diff --git a/Modules/Compiler/CCur-Fortran.cmake b/Modules/Compiler/CCur-Fortran.cmake new file mode 100644 index 000000000..6ec06ae11 --- /dev/null +++ b/Modules/Compiler/CCur-Fortran.cmake @@ -0,0 +1 @@ +include(Compiler/GNU-Fortran) diff --git a/Modules/Compiler/Clang-C.cmake b/Modules/Compiler/Clang-C.cmake index 548d0a596..a2e81c142 100644 --- a/Modules/Compiler/Clang-C.cmake +++ b/Modules/Compiler/Clang-C.cmake @@ -17,10 +17,13 @@ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4) set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11") endif() -if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.6) - set(CMAKE_C_STANDARD_DEFAULT 11) -elseif(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4) - set(CMAKE_C_STANDARD_DEFAULT 99) +if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4) + if (NOT CMAKE_C_COMPILER_FORCED) + if (NOT CMAKE_C_STANDARD_COMPUTED_DEFAULT) + message(FATAL_ERROR "CMAKE_C_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_C_COMPILER_ID} (${CMAKE_C_COMPILER}) version ${CMAKE_C_COMPILER_VERSION}") + endif() + set(CMAKE_C_STANDARD_DEFAULT ${CMAKE_C_STANDARD_COMPUTED_DEFAULT}) + endif() endif() macro(cmake_record_c_compile_features) diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake index 84b2c741d..055a8eeeb 100644 --- a/Modules/Compiler/Clang-CXX.cmake +++ b/Modules/Compiler/Clang-CXX.cmake @@ -31,8 +31,13 @@ elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4) set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y") endif() -if(UNIX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4) - set(CMAKE_CXX_STANDARD_DEFAULT 98) +if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4) + if (NOT CMAKE_CXX_COMPILER_FORCED) + if (NOT CMAKE_CXX_STANDARD_COMPUTED_DEFAULT) + message(FATAL_ERROR "CMAKE_CXX_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) version ${CMAKE_CXX_COMPILER_VERSION}") + endif() + set(CMAKE_CXX_STANDARD_DEFAULT ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT}) + endif() endif() macro(cmake_record_cxx_compile_features) diff --git a/Modules/Compiler/Cray-DetermineCompiler.cmake b/Modules/Compiler/Cray-DetermineCompiler.cmake index 881b82c0b..660229425 100644 --- a/Modules/Compiler/Cray-DetermineCompiler.cmake +++ b/Modules/Compiler/Cray-DetermineCompiler.cmake @@ -2,5 +2,5 @@ set(_compiler_id_pp_test "defined(_CRAYC)") set(_compiler_id_version_compute " -# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(_RELEASE) +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(_RELEASE_MAJOR) # define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(_RELEASE_MINOR)") diff --git a/Modules/Compiler/GNU-C.cmake b/Modules/Compiler/GNU-C.cmake index 89704e648..d979fb7a4 100644 --- a/Modules/Compiler/GNU-C.cmake +++ b/Modules/Compiler/GNU-C.cmake @@ -22,22 +22,26 @@ elseif (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6) set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu1x") endif() -if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0) - set(CMAKE_C_STANDARD_DEFAULT 11) -elseif(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4) - set(CMAKE_C_STANDARD_DEFAULT 90) +if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4) + if (NOT CMAKE_C_COMPILER_FORCED) + if (NOT CMAKE_C_STANDARD_COMPUTED_DEFAULT) + message(FATAL_ERROR "CMAKE_C_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_C_COMPILER_ID} (${CMAKE_C_COMPILER}) version ${CMAKE_C_COMPILER_VERSION}") + endif() + set(CMAKE_C_STANDARD_DEFAULT ${CMAKE_C_STANDARD_COMPUTED_DEFAULT}) + endif() endif() + macro(cmake_record_c_compile_features) macro(_get_gcc_features std_version list) record_compiler_features(C "${std_version}" ${list}) endmacro() set(_result 0) - if (UNIX AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6) + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6) _get_gcc_features(${CMAKE_C11_STANDARD_COMPILE_OPTION} CMAKE_C11_COMPILE_FEATURES) endif() - if (UNIX AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4) + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4) if (_result EQUAL 0) _get_gcc_features(${CMAKE_C99_STANDARD_COMPILE_OPTION} CMAKE_C99_COMPILE_FEATURES) endif() diff --git a/Modules/Compiler/GNU-CXX.cmake b/Modules/Compiler/GNU-CXX.cmake index 2dc02f0c0..a7e71c36c 100644 --- a/Modules/Compiler/GNU-CXX.cmake +++ b/Modules/Compiler/GNU-CXX.cmake @@ -35,7 +35,12 @@ elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8) endif() if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4) - set(CMAKE_CXX_STANDARD_DEFAULT 98) + if (NOT CMAKE_CXX_COMPILER_FORCED) + if (NOT CMAKE_CXX_STANDARD_COMPUTED_DEFAULT) + message(FATAL_ERROR "CMAKE_CXX_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) version ${CMAKE_CXX_COMPILER_VERSION}") + endif() + set(CMAKE_CXX_STANDARD_DEFAULT ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT}) + endif() endif() macro(cmake_record_cxx_compile_features) diff --git a/Modules/Compiler/GNU-DetermineCompiler.cmake b/Modules/Compiler/GNU-DetermineCompiler.cmake index 261f148cd..6ddc56698 100644 --- a/Modules/Compiler/GNU-DetermineCompiler.cmake +++ b/Modules/Compiler/GNU-DetermineCompiler.cmake @@ -3,7 +3,9 @@ set(_compiler_id_pp_test "defined(__GNUC__)") set(_compiler_id_version_compute " # define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__GNUC__) -# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__GNUC_MINOR__) +# if defined(__GNUC_MINOR__) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__GNUC_MINOR__) +# endif # if defined(__GNUC_PATCHLEVEL__) # define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__GNUC_PATCHLEVEL__) # endif") diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake index f01255cf6..764fbf990 100644 --- a/Modules/Compiler/GNU.cmake +++ b/Modules/Compiler/GNU.cmake @@ -50,8 +50,8 @@ macro(__compiler_gnu lang) set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG") set(CMAKE_${lang}_FLAGS_RELEASE_INIT "-O3 -DNDEBUG") set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-O2 -g -DNDEBUG") - set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE " -E > ") - set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE " -S -o ") + set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE " -E > ") + set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE " -S -o ") if(NOT APPLE) set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-isystem ") endif() diff --git a/Modules/Compiler/HP-C.cmake b/Modules/Compiler/HP-C.cmake index 6dddcbae1..b42ba2be8 100644 --- a/Modules/Compiler/HP-C.cmake +++ b/Modules/Compiler/HP-C.cmake @@ -1,4 +1,4 @@ set(CMAKE_C_VERBOSE_FLAG "-v") -set(CMAKE_C_CREATE_ASSEMBLY_SOURCE " -S -o ") -set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") +set(CMAKE_C_CREATE_ASSEMBLY_SOURCE " -S -o ") +set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") diff --git a/Modules/Compiler/HP-CXX.cmake b/Modules/Compiler/HP-CXX.cmake index 6411dac6b..7548754d3 100644 --- a/Modules/Compiler/HP-CXX.cmake +++ b/Modules/Compiler/HP-CXX.cmake @@ -1,7 +1,7 @@ set(CMAKE_CXX_VERBOSE_FLAG "-v") -set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " -S -o ") -set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") +set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " -S -o ") +set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") # HP aCC since version 3.80 supports the flag +hpxstd98 to get ANSI C++98 # template support. It is known that version 6.25 doesn't need that flag. diff --git a/Modules/Compiler/HP-Fortran.cmake b/Modules/Compiler/HP-Fortran.cmake index ad821ab7d..a6ca2c2b8 100644 --- a/Modules/Compiler/HP-Fortran.cmake +++ b/Modules/Compiler/HP-Fortran.cmake @@ -2,5 +2,5 @@ set(CMAKE_Fortran_VERBOSE_FLAG "-v") set(CMAKE_Fortran_FORMAT_FIXED_FLAG "+source=fixed") set(CMAKE_Fortran_FORMAT_FREE_FLAG "+source=free") -set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE " -S -o ") -set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE " -E > ") +set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE " -S -o ") +set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE " -E > ") diff --git a/Modules/Compiler/IAR-ASM.cmake b/Modules/Compiler/IAR-ASM.cmake index 66fb052df..844c30e50 100644 --- a/Modules/Compiler/IAR-ASM.cmake +++ b/Modules/Compiler/IAR-ASM.cmake @@ -2,7 +2,7 @@ include(Compiler/IAR) -set(CMAKE_ASM_COMPILE_OBJECT " -o ") +set(CMAKE_ASM_COMPILE_OBJECT " -o ") if("${IAR_TARGET_ARCHITECTURE}" STREQUAL "ARM") set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;asm;msa) diff --git a/Modules/Compiler/IAR-C.cmake b/Modules/Compiler/IAR-C.cmake index da29447c4..d2c7df9ed 100644 --- a/Modules/Compiler/IAR-C.cmake +++ b/Modules/Compiler/IAR-C.cmake @@ -3,9 +3,9 @@ include(Compiler/IAR) -set(CMAKE_C_COMPILE_OBJECT " -o ") -set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " --preprocess=cnl ") -set(CMAKE_C_CREATE_ASSEMBLY_SOURCE " -lAH -o .dummy") +set(CMAKE_C_COMPILE_OBJECT " -o ") +set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " --preprocess=cnl ") +set(CMAKE_C_CREATE_ASSEMBLY_SOURCE " -lAH -o .dummy") # The toolchains for ARM and AVR are quite different: if("${IAR_TARGET_ARCHITECTURE}" STREQUAL "ARM") diff --git a/Modules/Compiler/IAR-CXX.cmake b/Modules/Compiler/IAR-CXX.cmake index eae9d1b77..03ecdf1d8 100644 --- a/Modules/Compiler/IAR-CXX.cmake +++ b/Modules/Compiler/IAR-CXX.cmake @@ -2,10 +2,10 @@ include(Compiler/IAR) -set(CMAKE_CXX_COMPILE_OBJECT " -o ") +set(CMAKE_CXX_COMPILE_OBJECT " -o ") -set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " --preprocess=cnl ") -set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " -lAH -o .dummy") +set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " --preprocess=cnl ") +set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " -lAH -o .dummy") diff --git a/Modules/Compiler/IAR.cmake b/Modules/Compiler/IAR.cmake index 00e47133c..8c6c3f600 100644 --- a/Modules/Compiler/IAR.cmake +++ b/Modules/Compiler/IAR.cmake @@ -1,6 +1,6 @@ # This file is processed when the IAR compiler is used for a C or C++ file # Documentation can be downloaded here: http://www.iar.com/website1/1.0.1.0/675/1/ -# The initial feature request is here: http://www.cmake.org/Bug/view.php?id=10176 +# The initial feature request is here: https://cmake.org/Bug/view.php?id=10176 # It also contains additional links and information. if(_IAR_CMAKE_LOADED) @@ -39,7 +39,7 @@ endif() if(NOT IAR_TARGET_ARCHITECTURE) message(FATAL_ERROR "The IAR compiler for this architecture is not yet supported " - " by CMake. Please go to http://www.cmake.org/Bug and enter a feature request there.") + " by CMake. Please go to https://cmake.org/Bug and enter a feature request there.") endif() set(CMAKE_LINKER "${CMAKE_IAR_LINKER}" CACHE FILEPATH "The IAR linker" FORCE) diff --git a/Modules/Compiler/Intel-C.cmake b/Modules/Compiler/Intel-C.cmake index 1d651e368..dfba4b2ce 100644 --- a/Modules/Compiler/Intel-C.cmake +++ b/Modules/Compiler/Intel-C.cmake @@ -8,5 +8,5 @@ set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-O2 -g -DNDEBUG") set(CMAKE_DEPFILE_FLAGS_C "-MMD -MT -MF ") -set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") -set(CMAKE_C_CREATE_ASSEMBLY_SOURCE " -S -o ") +set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") +set(CMAKE_C_CREATE_ASSEMBLY_SOURCE " -S -o ") diff --git a/Modules/Compiler/Intel-CXX.cmake b/Modules/Compiler/Intel-CXX.cmake index 020e862c6..794769527 100644 --- a/Modules/Compiler/Intel-CXX.cmake +++ b/Modules/Compiler/Intel-CXX.cmake @@ -8,5 +8,5 @@ set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2 -g -DNDEBUG") set(CMAKE_DEPFILE_FLAGS_CXX "-MMD -MT -MF ") -set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") -set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " -S -o ") +set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") +set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " -S -o ") diff --git a/Modules/Compiler/Intel-Fortran.cmake b/Modules/Compiler/Intel-Fortran.cmake index 9ebac5a17..671d284dd 100644 --- a/Modules/Compiler/Intel-Fortran.cmake +++ b/Modules/Compiler/Intel-Fortran.cmake @@ -8,5 +8,5 @@ set(CMAKE_Fortran_VERBOSE_FLAG "-v") set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-fixed") set(CMAKE_Fortran_FORMAT_FREE_FLAG "-free") -set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE " -E > ") -set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE " -S -o ") +set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE " -E > ") +set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE " -S -o ") diff --git a/Modules/Compiler/PGI.cmake b/Modules/Compiler/PGI.cmake index 162e3c9b8..797945f9a 100644 --- a/Modules/Compiler/PGI.cmake +++ b/Modules/Compiler/PGI.cmake @@ -30,6 +30,6 @@ macro(__compiler_pgi lang) set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-O2 -gopt") # Preprocessing and assembly rules. - set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE " -E > ") - set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE " -S -o ") + set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE " -E > ") + set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE " -S -o ") endmacro() diff --git a/Modules/Compiler/QCC-CXX.cmake b/Modules/Compiler/QCC-CXX.cmake index a676bbedb..e86d1fa47 100644 --- a/Modules/Compiler/QCC-CXX.cmake +++ b/Modules/Compiler/QCC-CXX.cmake @@ -4,7 +4,7 @@ __compiler_qcc(CXX) # If the toolchain uses qcc for CMAKE_CXX_COMPILER instead of QCC, the # default for the driver is not c++. set(CMAKE_CXX_COMPILE_OBJECT - " -lang-c++ -o -c ") + " -lang-c++ -o -c ") set(CMAKE_CXX_LINK_EXECUTABLE " -lang-c++ -o ") diff --git a/Modules/Compiler/SunPro-C.cmake b/Modules/Compiler/SunPro-C.cmake index 92252cb13..c4529833d 100644 --- a/Modules/Compiler/SunPro-C.cmake +++ b/Modules/Compiler/SunPro-C.cmake @@ -22,5 +22,5 @@ foreach(type SHARED_LIBRARY SHARED_MODULE EXE) set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Bdynamic") endforeach() -set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") -set(CMAKE_C_CREATE_ASSEMBLY_SOURCE " -S -o ") +set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") +set(CMAKE_C_CREATE_ASSEMBLY_SOURCE " -S -o ") diff --git a/Modules/Compiler/SunPro-CXX.cmake b/Modules/Compiler/SunPro-CXX.cmake index 022b4d4ae..50d68eebf 100644 --- a/Modules/Compiler/SunPro-CXX.cmake +++ b/Modules/Compiler/SunPro-CXX.cmake @@ -22,8 +22,8 @@ foreach(type SHARED_LIBRARY SHARED_MODULE EXE) set(CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS "-Bdynamic") endforeach() -set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") -set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " -S -o ") +set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") +set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " -S -o ") # Create archives with "CC -xar" in case user adds "-instances=extern" # so that template instantiations are available to archive members. @@ -36,8 +36,13 @@ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13) set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=c++11") endif() -if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13) - set(CMAKE_CXX_STANDARD_DEFAULT 98) +if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13) + if (NOT CMAKE_CXX_COMPILER_FORCED) + if (NOT CMAKE_CXX_STANDARD_COMPUTED_DEFAULT) + message(FATAL_ERROR "CMAKE_CXX_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) version ${CMAKE_CXX_COMPILER_VERSION}") + endif() + set(CMAKE_CXX_STANDARD_DEFAULT ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT}) + endif() endif() macro(cmake_record_cxx_compile_features) diff --git a/Modules/Compiler/SunPro-Fortran.cmake b/Modules/Compiler/SunPro-Fortran.cmake index 196aae49a..610e19176 100644 --- a/Modules/Compiler/SunPro-Fortran.cmake +++ b/Modules/Compiler/SunPro-Fortran.cmake @@ -18,5 +18,5 @@ set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "-g -xO2 -DNDEBUG") set(CMAKE_Fortran_MODDIR_FLAG "-moddir=") set(CMAKE_Fortran_MODPATH_FLAG "-M") -set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE " -F -o ") -set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE " -S -o ") +set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE " -F -o ") +set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE " -S -o ") diff --git a/Modules/Compiler/TI-ASM.cmake b/Modules/Compiler/TI-ASM.cmake index e097626b6..a566d70e1 100644 --- a/Modules/Compiler/TI-ASM.cmake +++ b/Modules/Compiler/TI-ASM.cmake @@ -2,7 +2,7 @@ set(CMAKE_LIBRARY_PATH_FLAG "--search_path=") set(CMAKE_LINK_LIBRARY_FLAG "--library=") set(CMAKE_INCLUDE_FLAG_ASM "--include_path=") -set(CMAKE_ASM_COMPILE_OBJECT " --compile_only --asm_file= --output_file=") +set(CMAKE_ASM_COMPILE_OBJECT " --compile_only --asm_file= --output_file=") set(CMAKE_ASM_LINK_EXECUTABLE " --run_linker --output_file= ") set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS asm;s;abs) diff --git a/Modules/Compiler/TI-C.cmake b/Modules/Compiler/TI-C.cmake index b5809942e..479666c72 100644 --- a/Modules/Compiler/TI-C.cmake +++ b/Modules/Compiler/TI-C.cmake @@ -2,9 +2,9 @@ set(CMAKE_LIBRARY_PATH_FLAG "--search_path=") set(CMAKE_LINK_LIBRARY_FLAG "--library=") set(CMAKE_INCLUDE_FLAG_C "--include_path=") -set(CMAKE_C_CREATE_ASSEMBLY_SOURCE " --compile_only --skip_assembler --c_file= --output_file=") -set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " --preproc_only --c_file= --output_file=") +set(CMAKE_C_CREATE_ASSEMBLY_SOURCE " --compile_only --skip_assembler --c_file= --output_file=") +set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " --preproc_only --c_file= --output_file=") -set(CMAKE_C_COMPILE_OBJECT " --compile_only --c_file= --output_file=") +set(CMAKE_C_COMPILE_OBJECT " --compile_only --c_file= --output_file=") set(CMAKE_C_ARCHIVE_CREATE " -r ") set(CMAKE_C_LINK_EXECUTABLE " --run_linker --output_file= --map_file=.map ") diff --git a/Modules/Compiler/TI-CXX.cmake b/Modules/Compiler/TI-CXX.cmake index 8cf5ac37e..4104c3b18 100644 --- a/Modules/Compiler/TI-CXX.cmake +++ b/Modules/Compiler/TI-CXX.cmake @@ -2,9 +2,9 @@ set(CMAKE_LIBRARY_PATH_FLAG "--search_path=") set(CMAKE_LINK_LIBRARY_FLAG "--library=") set(CMAKE_INCLUDE_FLAG_CXX "--include_path=") -set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " --compile_only --skip_assembler --cpp_file= --output_file=") -set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " --preproc_only --cpp_file= --output_file=") +set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " --compile_only --skip_assembler --cpp_file= --output_file=") +set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " --preproc_only --cpp_file= --output_file=") -set(CMAKE_CXX_COMPILE_OBJECT " --compile_only --cpp_file= --output_file=") +set(CMAKE_CXX_COMPILE_OBJECT " --compile_only --cpp_file= --output_file=") set(CMAKE_CXX_ARCHIVE_CREATE " -r ") set(CMAKE_CXX_LINK_EXECUTABLE " --run_linker --output_file= --map_file=.map ") diff --git a/Modules/Compiler/XL-ASM.cmake b/Modules/Compiler/XL-ASM.cmake index 07507f9be..212179e34 100644 --- a/Modules/Compiler/XL-ASM.cmake +++ b/Modules/Compiler/XL-ASM.cmake @@ -1,9 +1,8 @@ set(CMAKE_ASM_VERBOSE_FLAG "-V") # -qthreaded = Ensures that all optimizations will be thread-safe -# -qalias=noansi = Turns off type-based aliasing completely (safer optimizer) # -qhalt=e = Halt on error messages (rather than just severe errors) -set(CMAKE_ASM_FLAGS_INIT "-qthreaded -qalias=noansi -qhalt=e -qsourcetype=assembler") +set(CMAKE_ASM_FLAGS_INIT "-qthreaded -qhalt=e -qsourcetype=assembler") set(CMAKE_ASM_FLAGS_DEBUG_INIT "-g") set(CMAKE_ASM_FLAGS_RELEASE_INIT "-O -DNDEBUG") diff --git a/Modules/Compiler/XL-C.cmake b/Modules/Compiler/XL-C.cmake index 09a55291e..97dd01789 100644 --- a/Modules/Compiler/XL-C.cmake +++ b/Modules/Compiler/XL-C.cmake @@ -4,6 +4,5 @@ set(CMAKE_C_FLAGS_RELEASE_INIT "${CMAKE_C_FLAGS_RELEASE_INIT} -DNDEBUG") set(CMAKE_C_FLAGS_MINSIZEREL_INIT "${CMAKE_C_FLAGS_MINSIZEREL_INIT} -DNDEBUG") # -qthreaded = Ensures that all optimizations will be thread-safe -# -qalias=noansi = Turns off type-based aliasing completely (safer optimizer) # -qhalt=e = Halt on error messages (rather than just severe errors) -set(CMAKE_C_FLAGS_INIT "-qthreaded -qalias=noansi -qhalt=e") +set(CMAKE_C_FLAGS_INIT "-qthreaded -qhalt=e") diff --git a/Modules/Compiler/XL-CXX.cmake b/Modules/Compiler/XL-CXX.cmake index 6c842cd77..41372c15b 100644 --- a/Modules/Compiler/XL-CXX.cmake +++ b/Modules/Compiler/XL-CXX.cmake @@ -8,4 +8,4 @@ set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "${CMAKE_CXX_FLAGS_MINSIZEREL_INIT} -DNDEBUG set(CMAKE_CXX_FLAGS_INIT "-qthreaded -qhalt=e") set(CMAKE_CXX_COMPILE_OBJECT - " -+ -o -c ") + " -+ -o -c ") diff --git a/Modules/Compiler/XL.cmake b/Modules/Compiler/XL.cmake index 7bf5020ac..bf4f5541c 100644 --- a/Modules/Compiler/XL.cmake +++ b/Modules/Compiler/XL.cmake @@ -33,8 +33,8 @@ macro(__compiler_xl lang) set(CMAKE_${lang}_FLAGS_RELEASE_INIT "-O") set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-O") set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-g") - set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE " -E > ") - set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE " -S -o ") + set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE " -E > ") + set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE " -S -o ") # CMAKE_XL_CreateExportList is part of the AIX XL compilers but not the linux ones. # If we found the tool, we'll use it to create exports, otherwise stick with the regular diff --git a/Modules/CompilerId/VS-10.vcxproj.in b/Modules/CompilerId/VS-10.vcxproj.in index a17d03d0d..2870a11ca 100644 --- a/Modules/CompilerId/VS-10.vcxproj.in +++ b/Modules/CompilerId/VS-10.vcxproj.in @@ -12,6 +12,7 @@ Win32Proj @id_system@ @id_system_version@ + @id_WindowsTargetPlatformVersion@ @id_WindowsSDKDesktopARMSupport@ diff --git a/Modules/CompilerId/main.swift.in b/Modules/CompilerId/main.swift.in new file mode 100644 index 000000000..13f0ba037 --- /dev/null +++ b/Modules/CompilerId/main.swift.in @@ -0,0 +1 @@ +print("CMakeSwiftCompilerId") diff --git a/Modules/DartConfiguration.tcl.in b/Modules/DartConfiguration.tcl.in index 37a0a408e..2da835427 100644 --- a/Modules/DartConfiguration.tcl.in +++ b/Modules/DartConfiguration.tcl.in @@ -69,6 +69,7 @@ UpdateType: @UPDATE_TYPE@ # Compiler info Compiler: @CMAKE_CXX_COMPILER@ +CompilerVersion: @CMAKE_CXX_COMPILER_VERSION@ # Dynamic analysis (MemCheck) PurifyCommand: @PURIFYCOMMAND@ @@ -95,6 +96,10 @@ SlurmRunCommand: @SLURM_SRUN_COMMAND@ # Currently set to 25 minutes TimeOut: @DART_TESTING_TIMEOUT@ +# During parallel testing CTest will not start a new test if doing +# so would cause the system load to exceed this value. +TestLoad: @CTEST_TEST_LOAD@ + UseLaunchers: @CTEST_USE_LAUNCHERS@ CurlOptions: @CTEST_CURL_OPTIONS@ # warning, if you add new options here that have to do with submit, diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 11a24b8e8..c822bdb97 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -175,6 +175,23 @@ Create custom targets to build projects in external trees ``LOG_INSTALL 1`` Wrap install in script to log output + Steps can be given direct access to the terminal if possible. With + the :generator:`Ninja` generator, this places the steps in the + ``console`` :prop_gbl:`pool `. Options are: + + ``USES_TERMINAL_DOWNLOAD 1`` + Give download terminal access. + ``USES_TERMINAL_UPDATE 1`` + Give update terminal access. + ``USES_TERMINAL_CONFIGURE 1`` + Give configure terminal access. + ``USES_TERMINAL_BUILD 1`` + Give build terminal access. + ``USES_TERMINAL_TEST 1`` + Give test terminal access. + ``USES_TERMINAL_INSTALL 1`` + Give install terminal access. + Other options are: ``STEP_TARGETS ...`` @@ -256,6 +273,8 @@ Create custom targets to build projects in external trees Working directory for command ``LOG 1`` Wrap step in script to log output + ``USES_TERMINAL 1`` + Give the step direct access to the terminal if possible. The command line, comment, working directory, and byproducts of every standard and custom step are processed to replace tokens ````, @@ -529,7 +548,7 @@ if(error_code) endif() execute_process( - COMMAND \"${git_EXECUTABLE}\" submodule init + COMMAND \"${git_EXECUTABLE}\" submodule init ${git_submodules} WORKING_DIRECTORY \"${work_dir}/${src_name}\" RESULT_VARIABLE error_code ) @@ -590,7 +609,7 @@ if(error_code) endif() execute_process( - COMMAND \"${hg_EXECUTABLE}\" clone \"${hg_repository}\" \"${src_name}\" + COMMAND \"${hg_EXECUTABLE}\" clone -U \"${hg_repository}\" \"${src_name}\" WORKING_DIRECTORY \"${work_dir}\" RESULT_VARIABLE error_code ) @@ -627,6 +646,11 @@ endfunction() function(_ep_write_gitupdate_script script_filename git_EXECUTABLE git_tag git_submodules git_repository work_dir) + if(NOT GIT_VERSION_STRING VERSION_LESS 1.7.6) + set(git_stash_save_options --all --quiet) + else() + set(git_stash_save_options --quiet) + endif() file(WRITE ${script_filename} "if(\"${git_tag}\" STREQUAL \"\") message(FATAL_ERROR \"Tag for git checkout should not be empty.\") @@ -705,7 +729,7 @@ if(error_code OR is_remote_ref OR NOT (\"\${tag_sha}\" STREQUAL \"\${head_sha}\" # perform git pull --rebase if(need_stash) execute_process( - COMMAND \"${git_EXECUTABLE}\" stash save --all --quiet + COMMAND \"${git_EXECUTABLE}\" stash save ${git_stash_save_options} WORKING_DIRECTORY \"${work_dir}\" RESULT_VARIABLE error_code ) @@ -1192,7 +1216,7 @@ function(_ep_get_build_command name step cmd_var) if(step STREQUAL "INSTALL") set(args install) endif() - if(step STREQUAL "TEST") + if("x${step}x" STREQUAL "xTESTx") set(args test) endif() else() @@ -1211,7 +1235,7 @@ function(_ep_get_build_command name step cmd_var) list(APPEND args --target install) endif() # But for "TEST" drive the project with corresponding "ctest". - if(step STREQUAL "TEST") + if("x${step}x" STREQUAL "xTESTx") string(REGEX REPLACE "^(.*/)cmake([^/]*)$" "\\1ctest\\2" cmd "${cmd}") set(args "") endif() @@ -1227,7 +1251,7 @@ function(_ep_get_build_command name step cmd_var) if(step STREQUAL "INSTALL") set(args install) endif() - if(step STREQUAL "TEST") + if("x${step}x" STREQUAL "xTESTx") set(args test) endif() endif() @@ -1463,6 +1487,14 @@ function(ExternalProject_Add_Step name step) get_property(comment TARGET ${name} PROPERTY _EP_${step}_COMMENT) endif() + # Uses terminal? + get_property(uses_terminal TARGET ${name} PROPERTY _EP_${step}_USES_TERMINAL) + if(uses_terminal) + set(uses_terminal USES_TERMINAL) + else() + set(uses_terminal "") + endif() + # Run every time? get_property(always TARGET ${name} PROPERTY _EP_${step}_ALWAYS) if(always) @@ -1505,6 +1537,7 @@ function(ExternalProject_Add_Step name step) DEPENDS ${depends} WORKING_DIRECTORY ${work_dir} VERBATIM + ${uses_terminal} ) set_property(TARGET ${name} APPEND PROPERTY _EP_STEPS ${step}) @@ -1603,20 +1636,6 @@ function(_ep_add_mkdir_command name) endfunction() -function(_ep_get_git_version git_EXECUTABLE git_version_var) - if(git_EXECUTABLE) - execute_process( - COMMAND "${git_EXECUTABLE}" --version - OUTPUT_VARIABLE ov - ERROR_VARIABLE ev - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - string(REGEX REPLACE "^git version (.+)$" "\\1" version "${ov}") - set(${git_version_var} "${version}" PARENT_SCOPE) - endif() -endfunction() - - function(_ep_is_dir_empty dir empty_var) file(GLOB gr "${dir}/*") if("${gr}" STREQUAL "") @@ -1712,6 +1731,7 @@ function(_ep_add_download_command name) --non-interactive ${svn_trust_cert_args} ${svn_user_pw_args} ${src_name}) list(APPEND depends ${stamp_dir}/${name}-svninfo.txt) elseif(git_repository) + unset(CMAKE_MODULE_PATH) # Use CMake builtin find module find_package(Git QUIET) if(NOT GIT_EXECUTABLE) message(FATAL_ERROR "error: could not find git for clone of ${name}") @@ -1719,9 +1739,8 @@ function(_ep_add_download_command name) # The git submodule update '--recursive' flag requires git >= v1.6.5 # - _ep_get_git_version("${GIT_EXECUTABLE}" git_version) - if(git_version VERSION_LESS 1.6.5) - message(FATAL_ERROR "error: git version 1.6.5 or later required for 'git submodule update --recursive': git_version='${git_version}'") + if(GIT_VERSION_STRING VERSION_LESS 1.6.5) + message(FATAL_ERROR "error: git version 1.6.5 or later required for 'git submodule update --recursive': GIT_VERSION_STRING='${GIT_VERSION_STRING}'") endif() get_property(git_tag TARGET ${name} PROPERTY _EP_GIT_TAG) @@ -1890,6 +1909,14 @@ function(_ep_add_download_command name) set(log "") endif() + get_property(uses_terminal TARGET ${name} PROPERTY + _EP_USES_TERMINAL_DOWNLOAD) + if(uses_terminal) + set(uses_terminal USES_TERMINAL 1) + else() + set(uses_terminal "") + endif() + ExternalProject_Add_Step(${name} download COMMENT ${comment} COMMAND ${cmd} @@ -1897,6 +1924,7 @@ function(_ep_add_download_command name) DEPENDS ${depends} DEPENDEES mkdir ${log} + ${uses_terminal} ) endfunction() @@ -2001,6 +2029,14 @@ Update to Mercurial >= 2.1.1. set(log "") endif() + get_property(uses_terminal TARGET ${name} PROPERTY + _EP_USES_TERMINAL_UPDATE) + if(uses_terminal) + set(uses_terminal USES_TERMINAL 1) + else() + set(uses_terminal "") + endif() + ExternalProject_Add_Step(${name} update COMMENT ${comment} COMMAND ${cmd} @@ -2009,6 +2045,7 @@ Update to Mercurial >= 2.1.1. WORKING_DIRECTORY ${work_dir} DEPENDEES download ${log} + ${uses_terminal} ) if(always AND update_disconnected) @@ -2021,6 +2058,7 @@ Update to Mercurial >= 2.1.1. WORKING_DIRECTORY ${work_dir} DEPENDEES download ${log} + ${uses_terminal} ) set_property(SOURCE ${skip-update_stamp_file} PROPERTY SYMBOLIC 1) endif() @@ -2149,6 +2187,14 @@ function(_ep_add_configure_command name) set(log "") endif() + get_property(uses_terminal TARGET ${name} PROPERTY + _EP_USES_TERMINAL_CONFIGURE) + if(uses_terminal) + set(uses_terminal USES_TERMINAL 1) + else() + set(uses_terminal "") + endif() + get_property(update_disconnected_set TARGET ${name} PROPERTY _EP_UPDATE_DISCONNECTED SET) if(update_disconnected_set) get_property(update_disconnected TARGET ${name} PROPERTY _EP_UPDATE_DISCONNECTED) @@ -2167,6 +2213,7 @@ function(_ep_add_configure_command name) DEPENDEES ${update_dep} patch DEPENDS ${file_deps} ${log} + ${uses_terminal} ) endfunction() @@ -2188,6 +2235,14 @@ function(_ep_add_build_command name) set(log "") endif() + get_property(uses_terminal TARGET ${name} PROPERTY + _EP_USES_TERMINAL_BUILD) + if(uses_terminal) + set(uses_terminal USES_TERMINAL 1) + else() + set(uses_terminal "") + endif() + get_property(build_always TARGET ${name} PROPERTY _EP_BUILD_ALWAYS) if(build_always) set(always 1) @@ -2204,6 +2259,7 @@ function(_ep_add_build_command name) DEPENDEES configure ALWAYS ${always} ${log} + ${uses_terminal} ) endfunction() @@ -2225,11 +2281,20 @@ function(_ep_add_install_command name) set(log "") endif() + get_property(uses_terminal TARGET ${name} PROPERTY + _EP_USES_TERMINAL_INSTALL) + if(uses_terminal) + set(uses_terminal USES_TERMINAL 1) + else() + set(uses_terminal "") + endif() + ExternalProject_Add_Step(${name} install COMMAND ${cmd} WORKING_DIRECTORY ${binary_dir} DEPENDEES build ${log} + ${uses_terminal} ) endfunction() @@ -2277,6 +2342,14 @@ function(_ep_add_test_command name) set(log "") endif() + get_property(uses_terminal TARGET ${name} PROPERTY + _EP_USES_TERMINAL_TEST) + if(uses_terminal) + set(uses_terminal USES_TERMINAL 1) + else() + set(uses_terminal "") + endif() + ExternalProject_Add_Step(${name} test COMMAND ${cmd} WORKING_DIRECTORY ${binary_dir} @@ -2284,6 +2357,7 @@ function(_ep_add_test_command name) ${dependers_args} ${exclude_args} ${log} + ${uses_terminal} ) endif() endfunction() diff --git a/Modules/FindBISON.cmake b/Modules/FindBISON.cmake index ec3ee78e8..7d81276c8 100644 --- a/Modules/FindBISON.cmake +++ b/Modules/FindBISON.cmake @@ -2,60 +2,75 @@ # FindBISON # --------- # -# Find bison executable and provides macros to generate custom build rules +# Find ``bison`` executable and provide a macro to generate custom build rules. # # The module defines the following variables: # -# :: +# ``BISON_EXECUTABLE`` +# path to the ``bison`` program # -# BISON_EXECUTABLE - path to the bison program -# BISON_VERSION - version of bison -# BISON_FOUND - true if the program was found +# ``BISON_VERSION`` +# version of ``bison`` # +# ``BISON_FOUND`` +# true if the program was found # +# The minimum required version of ``bison`` can be specified using the +# standard CMake syntax, e.g. ``find_package(BISON 2.1.3)``. # -# The minimum required version of bison can be specified using the -# standard CMake syntax, e.g. find_package(BISON 2.1.3) +# If ``bison`` is found, the module defines the macro:: # -# If bison is found, the module defines the macros: +# BISON_TARGET( +# [COMPILE_FLAGS ] +# [DEFINES_FILE ] +# [VERBOSE ] +# ) # -# :: +# which will create a custom rule to generate a parser. ```` is +# the path to a yacc file. ```` is the name of the source file +# generated by bison. A header file is also be generated, and contains +# the token list. # -# BISON_TARGET( [VERBOSE ] -# [COMPILE_FLAGS ]) +# The options are: # -# which will create a custom rule to generate a parser. is -# the path to a yacc file. is the name of the source file -# generated by bison. A header file is also be generated, and contains -# the token list. If COMPILE_FLAGS option is specified, the next -# parameter is added in the bison command line. if VERBOSE option is -# specified, is created and contains verbose descriptions of the -# grammar and parser. The macro defines a set of variables: +# ``COMPILE_FLAGS `` +# Specify flags to be added to the ``bison`` command line. +# +# ``DEFINES_FILE `` +# Specify a non-default header ```` to be generated by ``bison``. +# +# ``VERBOSE `` +# Tell ``bison`` to write verbose descriptions of the grammar and +# parser to the given ````. # -# :: +# The macro defines the following variables: # -# BISON_${Name}_DEFINED - true is the macro ran successfully -# BISON_${Name}_INPUT - The input source file, an alias for -# BISON_${Name}_OUTPUT_SOURCE - The source file generated by bison -# BISON_${Name}_OUTPUT_HEADER - The header file generated by bison -# BISON_${Name}_OUTPUTS - The sources files generated by bison -# BISON_${Name}_COMPILE_FLAGS - Options used in the bison command line +# ``BISON__DEFINED`` +# true is the macro ran successfully # +# ``BISON__INPUT`` +# The input source file, an alias for # +# ``BISON__OUTPUT_SOURCE`` +# The source file generated by bison # -# :: +# ``BISON__OUTPUT_HEADER`` +# The header file generated by bison # -# ==================================================================== -# Example: +# ``BISON__OUTPUTS`` +# The sources files generated by bison # +# ``BISON__COMPILE_FLAGS`` +# Options used in the ``bison`` command line # +# Example usage: # -# :: +# .. code-block:: cmake # -# find_package(BISON) -# BISON_TARGET(MyParser parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp) -# add_executable(Foo main.cpp ${BISON_MyParser_OUTPUTS}) -# ==================================================================== +# find_package(BISON) +# BISON_TARGET(MyParser parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp +# DEFINES_FILE ${CMAKE_CURRENT_BINARY_DIR}/parser.h) +# add_executable(Foo main.cpp ${BISON_MyParser_OUTPUTS}) #============================================================================= # Copyright 2009 Kitware, Inc. @@ -74,6 +89,8 @@ find_program(BISON_EXECUTABLE NAMES bison win_bison DOC "path to the bison executable") mark_as_advanced(BISON_EXECUTABLE) +include(CMakeParseArguments) + if(BISON_EXECUTABLE) # the bison commands should be executed with the C locale, otherwise # the message (which are parsed) may be translated @@ -128,6 +145,12 @@ if(BISON_EXECUTABLE) list(APPEND BISON_TARGET_cmdopt ${BISON_TARGET_extraopts}) endmacro() + # internal macro + macro(BISON_TARGET_option_defines Header) + set(BISON_TARGET_output_header "${Header}") + list(APPEND BISON_TARGET_cmdopt --defines=${BISON_TARGET_output_header}) + endmacro() + #============================================================ # BISON_TARGET (public macro) #============================================================ @@ -136,51 +159,61 @@ if(BISON_EXECUTABLE) set(BISON_TARGET_output_header "") set(BISON_TARGET_cmdopt "") set(BISON_TARGET_outputs "${BisonOutput}") - if(NOT ${ARGC} EQUAL 3 AND NOT ${ARGC} EQUAL 5 AND NOT ${ARGC} EQUAL 7) + + # Parsing parameters + set(BISON_TARGET_PARAM_OPTIONS) + set(BISON_TARGET_PARAM_ONE_VALUE_KEYWORDS + VERBOSE + COMPILE_FLAGS + DEFINES_FILE + ) + set(BISON_TARGET_PARAM_MULTI_VALUE_KEYWORDS) + cmake_parse_arguments( + BISON_TARGET_ARG + "${BISON_TARGET_PARAM_OPTIONS}" + "${BISON_TARGET_PARAM_ONE_VALUE_KEYWORDS}" + "${BISON_TARGET_PARAM_MULTI_VALUE_KEYWORDS}" + ${ARGN} + ) + + if(NOT "${BISON_TARGET_ARG_UNPARSED_ARGUMENTS}" STREQUAL "") message(SEND_ERROR "Usage") else() - # Parsing parameters - if(${ARGC} GREATER 5 OR ${ARGC} EQUAL 5) - if("${ARGV3}" STREQUAL "VERBOSE") - BISON_TARGET_option_verbose(${Name} ${BisonOutput} "${ARGV4}") - endif() - if("${ARGV3}" STREQUAL "COMPILE_FLAGS") - BISON_TARGET_option_extraopts("${ARGV4}") - endif() + if(NOT "${BISON_TARGET_ARG_VERBOSE}" STREQUAL "") + BISON_TARGET_option_verbose(${Name} ${BisonOutput} "${BISON_TARGET_ARG_VERBOSE}") endif() - - if(${ARGC} EQUAL 7) - if("${ARGV5}" STREQUAL "VERBOSE") - BISON_TARGET_option_verbose(${Name} ${BisonOutput} "${ARGV6}") - endif() - - if("${ARGV5}" STREQUAL "COMPILE_FLAGS") - BISON_TARGET_option_extraopts("${ARGV6}") - endif() + if(NOT "${BISON_TARGET_ARG_COMPILE_FLAGS}" STREQUAL "") + BISON_TARGET_option_extraopts("${BISON_TARGET_ARG_COMPILE_FLAGS}") + endif() + if(NOT "${BISON_TARGET_ARG_DEFINES_FILE}" STREQUAL "") + BISON_TARGET_option_defines("${BISON_TARGET_ARG_DEFINES_FILE}") endif() - # Header's name generated by bison (see option -d) - list(APPEND BISON_TARGET_cmdopt "-d") - string(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\2" _fileext "${ARGV2}") - string(REPLACE "c" "h" _fileext ${_fileext}) - string(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\1${_fileext}" - BISON_${Name}_OUTPUT_HEADER "${ARGV2}") - list(APPEND BISON_TARGET_outputs "${BISON_${Name}_OUTPUT_HEADER}") + if("${BISON_TARGET_output_header}" STREQUAL "") + # Header's name generated by bison (see option -d) + list(APPEND BISON_TARGET_cmdopt "-d") + string(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\2" _fileext "${BisonOutput}") + string(REPLACE "c" "h" _fileext ${_fileext}) + string(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\1${_fileext}" + BISON_TARGET_output_header "${BisonOutput}") + endif() + list(APPEND BISON_TARGET_outputs "${BISON_TARGET_output_header}") add_custom_command(OUTPUT ${BISON_TARGET_outputs} ${BISON_TARGET_extraoutputs} COMMAND ${BISON_EXECUTABLE} - ARGS ${BISON_TARGET_cmdopt} -o ${ARGV2} ${ARGV1} - DEPENDS ${ARGV1} + ARGS ${BISON_TARGET_cmdopt} -o ${BisonOutput} ${BisonInput} + DEPENDS ${BisonInput} COMMENT "[BISON][${Name}] Building parser with bison ${BISON_VERSION}" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) # define target variables set(BISON_${Name}_DEFINED TRUE) - set(BISON_${Name}_INPUT ${ARGV1}) + set(BISON_${Name}_INPUT ${BisonInput}) set(BISON_${Name}_OUTPUTS ${BISON_TARGET_outputs}) set(BISON_${Name}_COMPILE_FLAGS ${BISON_TARGET_cmdopt}) set(BISON_${Name}_OUTPUT_SOURCE "${BisonOutput}") + set(BISON_${Name}_OUTPUT_HEADER "${BISON_TARGET_output_header}") endif() endmacro() diff --git a/Modules/FindBZip2.cmake b/Modules/FindBZip2.cmake index b4793327d..6af42ddb5 100644 --- a/Modules/FindBZip2.cmake +++ b/Modules/FindBZip2.cmake @@ -56,11 +56,13 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(BZip2 VERSION_VAR BZIP2_VERSION_STRING) if (BZIP2_FOUND) - include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake) + include(${CMAKE_CURRENT_LIST_DIR}/CheckSymbolExists.cmake) include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake) cmake_push_check_state() set(CMAKE_REQUIRED_QUIET ${BZip2_FIND_QUIETLY}) - CHECK_LIBRARY_EXISTS("${BZIP2_LIBRARIES}" BZ2_bzCompressInit "" BZIP2_NEED_PREFIX) + set(CMAKE_REQUIRED_INCLUDES ${BZIP2_INCLUDE_DIR}) + set(CMAKE_REQUIRED_LIBRARIES ${BZIP2_LIBRARIES}) + CHECK_SYMBOL_EXISTS(BZ2_bzCompressInit "bzlib.h" BZIP2_NEED_PREFIX) cmake_pop_check_state() endif () diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 05b552a59..33e6a4970 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -512,13 +512,15 @@ else() # The user has not requested an exact version. Among known # versions, find those that are acceptable to the user request. set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS} - "1.58.0" "1.58" "1.57.0" "1.57" "1.56.0" "1.56" "1.55.0" "1.55" "1.54.0" "1.54" - "1.53.0" "1.53" "1.52.0" "1.52" "1.51.0" "1.51" + + "1.59.0" "1.59" "1.58.0" "1.58" "1.57.0" "1.57" "1.56.0" "1.56" "1.55.0" "1.55" + "1.54.0" "1.54" "1.53.0" "1.53" "1.52.0" "1.52" "1.51.0" "1.51" "1.50.0" "1.50" "1.49.0" "1.49" "1.48.0" "1.48" "1.47.0" "1.47" "1.46.1" "1.46.0" "1.46" "1.45.0" "1.45" "1.44.0" "1.44" "1.43.0" "1.43" "1.42.0" "1.42" "1.41.0" "1.41" "1.40.0" "1.40" "1.39.0" "1.39" "1.38.0" "1.38" "1.37.0" "1.37" "1.36.1" "1.36.0" "1.36" "1.35.1" "1.35.0" "1.35" "1.34.1" "1.34.0" "1.34" "1.33.1" "1.33.0" "1.33") + set(_boost_TEST_VERSIONS) if(Boost_FIND_VERSION) set(_Boost_FIND_VERSION_SHORT "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}") diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index e8e1fb13d..1fc582fae 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -468,17 +468,31 @@ set(CUDA_NVCC_FLAGS "" CACHE STRING "Semi-colon delimit multiple arguments.") if(CMAKE_GENERATOR MATCHES "Visual Studio") set(CUDA_HOST_COMPILER "$(VCInstallDir)bin" CACHE FILEPATH "Host side compiler used by NVCC") else() - # Using cc which is symlink to clang may let NVCC think it is GCC and issue - # unhandled -dumpspecs option to clang. Also in case neither - # CMAKE_C_COMPILER is defined (project does not use C language) nor - # CUDA_HOST_COMPILER is specified manually we should skip -ccbin and let - # nvcc use its own default C compiler. - if(DEFINED CMAKE_C_COMPILER AND NOT DEFINED CUDA_HOST_COMPILER) - get_filename_component(c_compiler_realpath "${CMAKE_C_COMPILER}" REALPATH) + if(APPLE + AND "${CMAKE_C_COMPILER_ID}" MATCHES "Clang" + AND "${CMAKE_C_COMPILER}" MATCHES "/cc$") + # Using cc which is symlink to clang may let NVCC think it is GCC and issue + # unhandled -dumpspecs option to clang. Also in case neither + # CMAKE_C_COMPILER is defined (project does not use C language) nor + # CUDA_HOST_COMPILER is specified manually we should skip -ccbin and let + # nvcc use its own default C compiler. + # Only care about this on APPLE with clang to avoid + # following symlinks to things like ccache + if(DEFINED CMAKE_C_COMPILER AND NOT DEFINED CUDA_HOST_COMPILER) + get_filename_component(c_compiler_realpath "${CMAKE_C_COMPILER}" REALPATH) + # if the real path does not end up being clang then + # go back to using CMAKE_C_COMPILER + if(NOT "${c_compiler_realpath}" MATCHES "/clang$") + set(c_compiler_realpath "${CMAKE_C_COMPILER}") + endif() + else() + set(c_compiler_realpath "") + endif() + set(CUDA_HOST_COMPILER "${c_compiler_realpath}" CACHE FILEPATH "Host side compiler used by NVCC") else() - set(c_compiler_realpath "") + set(CUDA_HOST_COMPILER "${CMAKE_C_COMPILER}" + CACHE FILEPATH "Host side compiler used by NVCC") endif() - set(CUDA_HOST_COMPILER "${c_compiler_realpath}" CACHE FILEPATH "Host side compiler used by NVCC") endif() # Propagate the host flags to the host compiler via -Xcompiler @@ -1570,9 +1584,8 @@ function(CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS output_file cuda_target options # we work around that issue by compiling the intermediate link object as a # pre-link custom command in that situation. set(do_obj_build_rule TRUE) - if (MSVC_VERSION GREATER 1599) - # VS 2010 and 2012 have this problem. If future versions fix this issue, - # it should still work, it just won't be as nice as the other method. + if (MSVC_VERSION GREATER 1599 AND MSVC_VERSION LESS 1800) + # VS 2010 and 2012 have this problem. set(do_obj_build_rule FALSE) endif() diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake index 3bd6f1e68..9f6e666a0 100644 --- a/Modules/FindHDF5.cmake +++ b/Modules/FindHDF5.cmake @@ -31,6 +31,12 @@ # Find module will then look in this path when searching for HDF5 # executables, paths, and libraries. # +# Both the serial and parallel HDF5 wrappers are considered and the first +# directory to contain either one will be used. In the event that both appear +# in the same directory the serial version is preferentially selected. This +# behavior can be reversed by setting the variable HDF5_PREFER_PARALLEL to +# true. +# # In addition to finding the includes and libraries required to compile # an HDF5 client application, this module also makes an effort to find # tools that come with the HDF5 distribution that may be useful for @@ -103,28 +109,43 @@ else() endforeach() endif() +# Determine whether to search for serial or parallel executable first +if(HDF5_PREFER_PARALLEL) + set(HDF5_C_COMPILER_NAMES h5pcc h5cc) + set(HDF5_CXX_COMPILER_NAMES h5pc++ h5c++) + set(HDF5_Fortran_COMPILER_NAMES h5pfc h5fc) +else() + set(HDF5_C_COMPILER_NAMES h5cc h5pcc) + set(HDF5_CXX_COMPILER_NAMES h5c++ h5pc++) + set(HDF5_Fortran_COMPILER_NAMES h5fc h5pfc) +endif() + # try to find the HDF5 wrapper compilers find_program( HDF5_C_COMPILER_EXECUTABLE - NAMES h5cc h5pcc + NAMES ${HDF5_C_COMPILER_NAMES} NAMES_PER_DIR HINTS ENV HDF5_ROOT PATH_SUFFIXES bin Bin DOC "HDF5 Wrapper compiler. Used only to detect HDF5 compile flags." ) mark_as_advanced( HDF5_C_COMPILER_EXECUTABLE ) find_program( HDF5_CXX_COMPILER_EXECUTABLE - NAMES h5c++ h5pc++ + NAMES ${HDF5_CXX_COMPILER_NAMES} NAMES_PER_DIR HINTS ENV HDF5_ROOT PATH_SUFFIXES bin Bin DOC "HDF5 C++ Wrapper compiler. Used only to detect HDF5 compile flags." ) mark_as_advanced( HDF5_CXX_COMPILER_EXECUTABLE ) find_program( HDF5_Fortran_COMPILER_EXECUTABLE - NAMES h5fc h5pfc + NAMES ${HDF5_Fortran_COMPILER_NAMES} NAMES_PER_DIR HINTS ENV HDF5_ROOT PATH_SUFFIXES bin Bin DOC "HDF5 Fortran Wrapper compiler. Used only to detect HDF5 compile flags." ) mark_as_advanced( HDF5_Fortran_COMPILER_EXECUTABLE ) +unset(HDF5_C_COMPILER_NAMES) +unset(HDF5_CXX_COMPILER_NAMES) +unset(HDF5_Fortran_COMPILER_NAMES) + find_program( HDF5_DIFF_EXECUTABLE NAMES h5diff HINTS ENV HDF5_ROOT @@ -225,6 +246,8 @@ if( NOT HDF5_FOUND ) _HDF5_invoke_compiler( C HDF5_C_COMPILE_LINE HDF5_C_RETURN_VALUE ) _HDF5_invoke_compiler( CXX HDF5_CXX_COMPILE_LINE HDF5_CXX_RETURN_VALUE ) _HDF5_invoke_compiler( Fortran HDF5_Fortran_COMPILE_LINE HDF5_Fortran_RETURN_VALUE ) + set(HDF5_HL_COMPILE_LINE ${HDF5_C_COMPILE_LINE}) + set(HDF5_Fortran_HL_COMPILE_LINE ${HDF5_Fortran_COMPILE_LINE}) # seed the initial lists of libraries to find with items we know we need set( HDF5_C_LIBRARY_NAMES_INIT hdf5 ) @@ -232,7 +255,7 @@ if( NOT HDF5_FOUND ) set( HDF5_CXX_LIBRARY_NAMES_INIT hdf5_cpp ${HDF5_C_LIBRARY_NAMES_INIT} ) set( HDF5_Fortran_LIBRARY_NAMES_INIT hdf5_fortran ${HDF5_C_LIBRARY_NAMES_INIT} ) - set( HDF5_Fortran_HL_LIBRARY_NAMES_INIT hdf5hl_fortran + set( HDF5_Fortran_HL_LIBRARY_NAMES_INIT hdf5hl_fortran hdf5_hl ${HDF5_Fortran_LIBRARY_NAMES_INIT} ) foreach( LANGUAGE ${HDF5_LANGUAGE_BINDINGS} ) @@ -284,7 +307,7 @@ if( NOT HDF5_FOUND ) if( UNIX AND HDF5_USE_STATIC_LIBRARIES ) # According to bug 1643 on the CMake bug tracker, this is the # preferred method for searching for a static library. - # See http://www.cmake.org/Bug/view.php?id=1643. We search + # See https://cmake.org/Bug/view.php?id=1643. We search # first for the full static library name, but fall back to a # generic search on the name if the static search fails. set( THIS_LIBRARY_SEARCH_DEBUG lib${LIB}d.a ${LIB}d ) @@ -376,4 +399,3 @@ find_package_handle_standard_args( HDF5 REQUIRED_VARS HDF5_LIBRARIES HDF5_INCLUDE_DIRS VERSION_VAR HDF5_VERSION ) - diff --git a/Modules/FindIce.cmake b/Modules/FindIce.cmake index 8493d80e2..3fa6cab4d 100644 --- a/Modules/FindIce.cmake +++ b/Modules/FindIce.cmake @@ -20,7 +20,14 @@ # Ice_SLICE_DIRS - the directories containing the Ice slice interface # definitions # -# Ice programs are reported in:: +# Imported targets:: +# +# Ice:: +# +# Where ```` is the name of an Ice component, for example +# ``Ice::Glacier2``. +# +# Ice slice programs are reported in:: # # Ice_SLICE2CPP_EXECUTABLE - path to slice2cpp executable # Ice_SLICE2CS_EXECUTABLE - path to slice2cs executable @@ -28,10 +35,49 @@ # Ice_SLICE2FREEZE_EXECUTABLE - path to slice2freeze executable # Ice_SLICE2HTML_EXECUTABLE - path to slice2html executable # Ice_SLICE2JAVA_EXECUTABLE - path to slice2java executable +# Ice_SLICE2JS_EXECUTABLE - path to slice2js executable # Ice_SLICE2PHP_EXECUTABLE - path to slice2php executable # Ice_SLICE2PY_EXECUTABLE - path to slice2py executable # Ice_SLICE2RB_EXECUTABLE - path to slice2rb executable # +# Ice programs are reported in:: +# +# Ice_GLACIER2ROUTER_EXECUTABLE - path to glacier2router executable +# Ice_ICEBOX_EXECUTABLE - path to icebox executable +# Ice_ICEBOXADMIN_EXECUTABLE - path to iceboxadmin executable +# Ice_ICEBOXD_EXECUTABLE - path to iceboxd executable +# Ice_ICEBOXNET_EXECUTABLE - path to iceboxnet executable +# Ice_ICEGRIDADMIN_EXECUTABLE - path to icegridadmin executable +# Ice_ICEGRIDNODE_EXECUTABLE - path to icegridnode executable +# Ice_ICEGRIDNODED_EXECUTABLE - path to icegridnoded executable +# Ice_ICEGRIDREGISTRY_EXECUTABLE - path to icegridregistry executable +# Ice_ICEGRIDREGISTRYD_EXECUTABLE - path to icegridregistryd executable +# Ice_ICEPATCH2CALC_EXECUTABLE - path to icepatch2calc executable +# Ice_ICEPATCH2CLIENT_EXECUTABLE - path to icepatch2client executable +# Ice_ICEPATCH2SERVER_EXECUTABLE - path to icepatch2server executable +# Ice_ICESERVICEINSTALL_EXECUTABLE - path to iceserviceinstall executable +# Ice_ICESTORMADMIN_EXECUTABLE - path to icestormadmin executable +# Ice_ICESTORMMIGRATE_EXECUTABLE - path to icestormmigrate executable +# +# Ice db programs (Windows only; standard system versions on all other +# platforms) are reported in:: +# +# Ice_DB_ARCHIVE_EXECUTABLE - path to db_archive executable +# Ice_DB_CHECKPOINT_EXECUTABLE - path to db_checkpoint executable +# Ice_DB_DEADLOCK_EXECUTABLE - path to db_deadlock executable +# Ice_DB_DUMP_EXECUTABLE - path to db_dump executable +# Ice_DB_HOTBACKUP_EXECUTABLE - path to db_hotbackup executable +# Ice_DB_LOAD_EXECUTABLE - path to db_load executable +# Ice_DB_LOG_VERIFY_EXECUTABLE - path to db_log_verify executable +# Ice_DB_PRINTLOG_EXECUTABLE - path to db_printlog executable +# Ice_DB_RECOVER_EXECUTABLE - path to db_recover executable +# Ice_DB_STAT_EXECUTABLE - path to db_stat executable +# Ice_DB_TUNER_EXECUTABLE - path to db_tuner executable +# Ice_DB_UPGRADE_EXECUTABLE - path to db_upgrade executable +# Ice_DB_VERIFY_EXECUTABLE - path to db_verify executable +# Ice_DUMPDB_EXECUTABLE - path to dumpdb executable +# Ice_TRANSFORMDB_EXECUTABLE - path to transformdb executable +# # Ice component libraries are reported in:: # # Ice__FOUND - ON if component was found @@ -76,7 +122,7 @@ # Written by Roger Leigh #============================================================================= -# Copyright 2014 University of Dundee +# Copyright 2014-2015 University of Dundee # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -94,6 +140,8 @@ function(_Ice_FIND) # Released versions of Ice, including generic short forms set(ice_versions 3 + 3.6 + 3.6.0 3.5 3.5.1 3.5.0 @@ -198,19 +246,55 @@ function(_Ice_FIND) endforeach() endif() + set(db_programs + db_archive + db_checkpoint + db_deadlock + db_dump + db_hotbackup + db_load + db_log_verify + db_printlog + db_recover + db_stat + db_tuner + db_upgrade + db_verify + dumpdb + transformdb) + set(ice_programs + glacier2router + icebox + iceboxadmin + iceboxd + iceboxnet + icegridadmin + icegridnode + icegridnoded + icegridregistry + icegridregistryd + icepatch2calc + icepatch2client + icepatch2server + iceserviceinstall + icestormadmin + icestormmigrate) + + set(slice_programs slice2cpp slice2cs slice2freezej slice2freeze slice2html slice2java + slice2js slice2php slice2py slice2rb) # Find all Ice programs - foreach(program ${ice_programs}) + foreach(program ${db_programs} ${ice_programs} ${slice_programs}) string(TOUPPER "${program}" program_upcase) set(cache_var "Ice_${program_upcase}_EXECUTABLE") set(program_var "Ice_${program_upcase}_EXECUTABLE") @@ -356,13 +440,21 @@ if(Ice_FOUND) set(_Ice_component_cache "Ice_${_Ice_component_upcase}_LIBRARY") set(_Ice_component_lib "Ice_${_Ice_component_upcase}_LIBRARIES") set(_Ice_component_found "${_Ice_component_upcase}_FOUND") + set(_Ice_imported_target "Ice::${_Ice_component}") if(${_Ice_component_found}) set("${_Ice_component_lib}" "${${_Ice_component_cache}}") + if(NOT TARGET ${_Ice_imported_target}) + add_library(${_Ice_imported_target} UNKNOWN IMPORTED) + set_target_properties(${_Ice_imported_target} PROPERTIES + IMPORTED_LOCATION "${${_Ice_component_cache}}" + INTERFACE_INCLUDE_DIRECTORIES "${Ice_INCLUDE_DIR}") + endif() endif() unset(_Ice_component_upcase) unset(_Ice_component_cache) unset(_Ice_component_lib) unset(_Ice_component_found) + unset(_Ice_imported_target) endforeach() endif() @@ -373,15 +465,51 @@ if(Ice_DEBUG) message(STATUS "Ice_INCLUDE_DIR directory: ${Ice_INCLUDE_DIR}") message(STATUS "Ice_SLICE_DIR directory: ${Ice_SLICE_DIR}") message(STATUS "Ice_LIBRARIES: ${Ice_LIBRARIES}") + message(STATUS "slice2cpp executable: ${Ice_SLICE2CPP_EXECUTABLE}") message(STATUS "slice2cs executable: ${Ice_SLICE2CS_EXECUTABLE}") message(STATUS "slice2freezej executable: ${Ice_SLICE2FREEZEJ_EXECUTABLE}") message(STATUS "slice2freeze executable: ${Ice_SLICE2FREEZE_EXECUTABLE}") message(STATUS "slice2html executable: ${Ice_SLICE2HTML_EXECUTABLE}") message(STATUS "slice2java executable: ${Ice_SLICE2JAVA_EXECUTABLE}") + message(STATUS "slice2js executable: ${Ice_SLICE2JS_EXECUTABLE}") message(STATUS "slice2php executable: ${Ice_SLICE2PHP_EXECUTABLE}") message(STATUS "slice2py executable: ${Ice_SLICE2PY_EXECUTABLE}") message(STATUS "slice2rb executable: ${Ice_SLICE2RB_EXECUTABLE}") + message(STATUS "glacier2router executable: ${Ice_GLACIER2ROUTER_EXECUTABLE}") + + message(STATUS "icebox executable: ${Ice_ICEBOX_EXECUTABLE}") + message(STATUS "iceboxadmin executable: ${Ice_ICEBOXADMIN_EXECUTABLE}") + message(STATUS "iceboxd executable: ${Ice_ICEBOXD_EXECUTABLE}") + message(STATUS "iceboxnet executable: ${Ice_ICEBOXNET_EXECUTABLE}") + message(STATUS "icegridadmin executable: ${Ice_ICEGRIDADMIN_EXECUTABLE}") + message(STATUS "icegridnode executable: ${Ice_ICEGRIDNODE_EXECUTABLE}") + message(STATUS "icegridnoded executable: ${Ice_ICEGRIDNODED_EXECUTABLE}") + message(STATUS "icegridregistry executable: ${Ice_ICEGRIDREGISTRY_EXECUTABLE}") + message(STATUS "icegridregistryd executable: ${Ice_ICEGRIDREGISTRYD_EXECUTABLE}") + message(STATUS "icepatch2calc executable: ${Ice_ICEPATCH2CALC_EXECUTABLE}") + message(STATUS "icepatch2client executable: ${Ice_ICEPATCH2CLIENT_EXECUTABLE}") + message(STATUS "icepatch2server executable: ${Ice_ICEPATCH2SERVER_EXECUTABLE}") + message(STATUS "iceserviceinstall executable: ${Ice_ICESERVICEINSTALL_EXECUTABLE}") + message(STATUS "icestormadmin executable: ${Ice_ICESTORMADMIN_EXECUTABLE}") + message(STATUS "icestormmigrate executable: ${Ice_ICESTORMMIGRATE_EXECUTABLE}") + + message(STATUS "db_archive executable: ${Ice_DB_ARCHIVE_EXECUTABLE}") + message(STATUS "db_checkpoint executable: ${Ice_DB_CHECKPOINT_EXECUTABLE}") + message(STATUS "db_deadlock executable: ${Ice_DB_DEADLOCK_EXECUTABLE}") + message(STATUS "db_dump executable: ${Ice_DB_DUMP_EXECUTABLE}") + message(STATUS "db_hotbackup executable: ${Ice_DB_HOTBACKUP_EXECUTABLE}") + message(STATUS "db_load executable: ${Ice_DB_LOAD_EXECUTABLE}") + message(STATUS "db_log_verify executable: ${Ice_DB_LOG_VERIFY_EXECUTABLE}") + message(STATUS "db_printlog executable: ${Ice_DB_PRINTLOG_EXECUTABLE}") + message(STATUS "db_recover executable: ${Ice_DB_RECOVER_EXECUTABLE}") + message(STATUS "db_stat executable: ${Ice_DB_STAT_EXECUTABLE}") + message(STATUS "db_tuner executable: ${Ice_DB_TUNER_EXECUTABLE}") + message(STATUS "db_upgrade executable: ${Ice_DB_UPGRADE_EXECUTABLE}") + message(STATUS "db_verify executable: ${Ice_DB_VERIFY_EXECUTABLE}") + message(STATUS "dumpdb executable: ${Ice_DUMPDB_EXECUTABLE}") + message(STATUS "transformdb executable: ${Ice_TRANSFORMDB_EXECUTABLE}") + foreach(component ${Ice_FIND_COMPONENTS}) string(TOUPPER "${component}" component_upcase) set(component_lib "Ice_${component_upcase}_LIBRARIES") diff --git a/Modules/FindJNI.cmake b/Modules/FindJNI.cmake index d248fe187..cbe21d7e1 100644 --- a/Modules/FindJNI.cmake +++ b/Modules/FindJNI.cmake @@ -42,7 +42,11 @@ macro(java_append_library_directories _var) # 1.6.0_18 + icedtea patches. However, it would be much better to base the # guess on the first part of the GNU config.guess platform triplet. if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") + if(CMAKE_LIBRARY_ARCHITECTURE STREQUAL "x86_64-linux-gnux32") + set(_java_libarch "x32" "amd64" "i386") + else() set(_java_libarch "amd64" "i386") + endif() elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$") set(_java_libarch "i386") elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^alpha") @@ -53,7 +57,7 @@ macro(java_append_library_directories _var) elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^mips") # mips* machines are bi-endian mostly so processor does not tell # endianess of the underlying system. - set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "mips" "mipsel" "mipseb") + set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "mips" "mipsel" "mipseb" "mips64" "mips64el" "mipsn32" "mipsn32el") elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64le") set(_java_libarch "ppc64" "ppc64le") elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64") @@ -152,6 +156,9 @@ JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES /usr/local/jre-1.7.0/lib/{libarch} /usr/local/jdk-1.6.0/jre/lib/{libarch} /usr/local/jre-1.6.0/lib/{libarch} + # SuSE specific paths for default JVM + /usr/lib64/jvm/java/jre/lib/{libarch} + /usr/lib64/jvm/jre/lib/{libarch} ) set(JAVA_JVM_LIBRARY_DIRECTORIES) @@ -160,6 +167,9 @@ foreach(dir ${JAVA_AWT_LIBRARY_DIRECTORIES}) "${dir}" "${dir}/client" "${dir}/server" + # IBM SDK, Java Technology Edition, specific paths + "${dir}/j9vm" + "${dir}/default" ) endforeach() @@ -189,6 +199,8 @@ list(APPEND JAVA_AWT_INCLUDE_DIRECTORIES # OpenBSD specific path for default JVM /usr/local/jdk-1.7.0/include /usr/local/jdk-1.6.0/include + # SuSE specific paths for default JVM + /usr/lib64/jvm/java/include ) foreach(JAVA_PROG "${JAVA_RUNTIME}" "${JAVA_COMPILE}" "${JAVA_ARCHIVE}") diff --git a/Modules/FindJava.cmake b/Modules/FindJava.cmake index 9e431749d..9f8799783 100644 --- a/Modules/FindJava.cmake +++ b/Modules/FindJava.cmake @@ -8,21 +8,34 @@ # include files and libraries are. The caller may set variable JAVA_HOME # to specify a Java installation prefix explicitly. # +# +# Specify one or more of the following components as you call this find module. See example below. +# +# :: +# +# Runtime = User just want to execute some Java byte-compiled +# Development = Development tools (java, javac, javah and javadoc), includes Runtime component +# IdlJ = idl compiler for Java +# JarSigner = signer tool for jar +# +# # This module sets the following result variables: # # :: # -# Java_JAVA_EXECUTABLE = the full path to the Java runtime -# Java_JAVAC_EXECUTABLE = the full path to the Java compiler -# Java_JAVAH_EXECUTABLE = the full path to the Java header generator -# Java_JAVADOC_EXECUTABLE = the full path to the Java documention generator -# Java_JAR_EXECUTABLE = the full path to the Java archiver -# Java_VERSION_STRING = Version of java found, eg. 1.6.0_12 -# Java_VERSION_MAJOR = The major version of the package found. -# Java_VERSION_MINOR = The minor version of the package found. -# Java_VERSION_PATCH = The patch version of the package found. -# Java_VERSION_TWEAK = The tweak version of the package found (after '_') -# Java_VERSION = This is set to: $major.$minor.$patch(.$tweak) +# Java_JAVA_EXECUTABLE = the full path to the Java runtime +# Java_JAVAC_EXECUTABLE = the full path to the Java compiler +# Java_JAVAH_EXECUTABLE = the full path to the Java header generator +# Java_JAVADOC_EXECUTABLE = the full path to the Java documention generator +# Java_IDLJ_EXECUTABLE = the full path to the Java idl compiler +# Java_JAR_EXECUTABLE = the full path to the Java archiver +# Java_JARSIGNER_EXECUTABLE = the full path to the Java jar signer +# Java_VERSION_STRING = Version of java found, eg. 1.6.0_12 +# Java_VERSION_MAJOR = The major version of the package found. +# Java_VERSION_MINOR = The minor version of the package found. +# Java_VERSION_PATCH = The patch version of the package found. +# Java_VERSION_TWEAK = The tweak version of the package found (after '_') +# Java_VERSION = This is set to: $major.$minor.$patch(.$tweak) # # # @@ -184,28 +197,61 @@ find_program(Java_JAVADOC_EXECUTABLE PATHS ${_JAVA_PATHS} ) +find_program(Java_IDLJ_EXECUTABLE + NAMES idlj + HINTS ${_JAVA_HINTS} + PATHS ${_JAVA_PATHS} +) + +find_program(Java_JARSIGNER_EXECUTABLE + NAMES jarsigner + HINTS ${_JAVA_HINTS} + PATHS ${_JAVA_PATHS} +) + include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) if(Java_FIND_COMPONENTS) + set(_JAVA_REQUIRED_VARS) foreach(component ${Java_FIND_COMPONENTS}) # User just want to execute some Java byte-compiled - if(component STREQUAL "Runtime") - find_package_handle_standard_args(Java - REQUIRED_VARS Java_JAVA_EXECUTABLE - VERSION_VAR Java_VERSION - ) + If(component STREQUAL "Runtime") + list(APPEND _JAVA_REQUIRED_VARS Java_JAVA_EXECUTABLE) + if(Java_JAVA_EXECUTABLE) + set(Java_Runtime_FOUND TRUE) + endif() elseif(component STREQUAL "Development") - find_package_handle_standard_args(Java - REQUIRED_VARS Java_JAVA_EXECUTABLE Java_JAR_EXECUTABLE Java_JAVAC_EXECUTABLE - Java_JAVAH_EXECUTABLE Java_JAVADOC_EXECUTABLE - VERSION_VAR Java_VERSION - ) + list(APPEND _JAVA_REQUIRED_VARS Java_JAVA_EXECUTABLE Java_JAVAC_EXECUTABLE + Java_JAVAH_EXECUTABLE Java_JAVADOC_EXECUTABLE) + if(Java_JAVA_EXECUTABLE AND Java_JAVAC_EXECUTABLE + AND Java_JAVAH_EXECUTABLE AND Java_JAVADOC_EXECUTABLE) + set(Java_Development_FOUND TRUE) + endif() + elseif(component STREQUAL "IdlJ") + list(APPEND _JAVA_REQUIRED_VARS Java_IDLJ_EXECUTABLE) + if(Java_IdlJ_EXECUTABLE) + set(Java_Extra_FOUND TRUE) + endif() + elseif(component STREQUAL "JarSigner") + list(APPEND _JAVA_REQUIRED_VARS Java_JARSIGNER_EXECUTABLE) + if(Java_IDLJ_EXECUTABLE) + set(Java_JarSigner_FOUND TRUE) + endif() else() message(FATAL_ERROR "Comp: ${component} is not handled") endif() - set(Java_${component}_FOUND TRUE) endforeach() + list (REMOVE_DUPLICATES _JAVA_REQUIRED_VARS) + find_package_handle_standard_args(Java + REQUIRED_VARS ${_JAVA_REQUIRED_VARS} HANDLE_COMPONENTS + VERSION_VAR Java_VERSION + ) + if(Java_FOUND) + foreach(component ${Java_FIND_COMPONENTS}) + set(Java_${component}_FOUND TRUE) + endforeach() + endif() else() - # Check for everything + # Check for Development find_package_handle_standard_args(Java REQUIRED_VARS Java_JAVA_EXECUTABLE Java_JAR_EXECUTABLE Java_JAVAC_EXECUTABLE Java_JAVAH_EXECUTABLE Java_JAVADOC_EXECUTABLE @@ -220,6 +266,8 @@ mark_as_advanced( Java_JAVAC_EXECUTABLE Java_JAVAH_EXECUTABLE Java_JAVADOC_EXECUTABLE + Java_IDLJ_EXECUTABLE + Java_JARSIGNER_EXECUTABLE ) # LEGACY diff --git a/Modules/FindKDE4.cmake b/Modules/FindKDE4.cmake index 3c2c30987..55301667b 100644 --- a/Modules/FindKDE4.cmake +++ b/Modules/FindKDE4.cmake @@ -105,7 +105,7 @@ if (KDE4_DATA_DIR) endif () # use FindKDE4Internal.cmake to do the rest - find_package(KDE4Internal ${_req} ${_quiet}) + find_package(KDE4Internal ${_req} ${_quiet} NO_POLICY_SCOPE) else () if (KDE4_FIND_REQUIRED) message(FATAL_ERROR "ERROR: cmake/modules/FindKDE4Internal.cmake not found in ${_data_DIR}") diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake index 06ecfaa8f..48adf3c1e 100644 --- a/Modules/FindMPI.cmake +++ b/Modules/FindMPI.cmake @@ -102,7 +102,6 @@ # include this to handle the QUIETLY and REQUIRED arguments include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -include(${CMAKE_CURRENT_LIST_DIR}/GetPrerequisites.cmake) # # This part detects MPI compilers, attempting to wade through the mess of compiler names in @@ -578,14 +577,13 @@ foreach (lang C CXX Fortran) if (CMAKE_${lang}_COMPILER_WORKS) # If the user supplies a compiler *name* instead of an absolute path, assume that we need to find THAT compiler. if (MPI_${lang}_COMPILER) - is_file_executable(MPI_${lang}_COMPILER MPI_COMPILER_IS_EXECUTABLE) - if (NOT MPI_COMPILER_IS_EXECUTABLE) + if (NOT IS_ABSOLUTE "${MPI_${lang}_COMPILER}") # Get rid of our default list of names and just search for the name the user wants. set(_MPI_${lang}_COMPILER_NAMES ${MPI_${lang}_COMPILER}) set(MPI_${lang}_COMPILER "MPI_${lang}_COMPILER-NOTFOUND" CACHE FILEPATH "Cleared" FORCE) - # If the user specifies a compiler, we don't want to try to search libraries either. - set(try_libs FALSE) endif() + # If the user specifies a compiler, we don't want to try to search libraries either. + set(try_libs FALSE) else() set(try_libs TRUE) endif() diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake index a47a69c99..7a36719fb 100644 --- a/Modules/FindMatlab.cmake +++ b/Modules/FindMatlab.cmake @@ -229,6 +229,7 @@ if(NOT MATLAB_ADDITIONAL_VERSIONS) endif() set(MATLAB_VERSIONS_MAPPING + "R2015b=8.6" "R2015a=8.5" "R2014b=8.4" "R2014a=8.3" diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake index 3adc26926..d75e8ab25 100644 --- a/Modules/FindOpenSSL.cmake +++ b/Modules/FindOpenSSL.cmake @@ -2,26 +2,41 @@ # FindOpenSSL # ----------- # -# Try to find the OpenSSL encryption library +# Find the OpenSSL encryption library. # -# Once done this will define +# Imported Targets +# ^^^^^^^^^^^^^^^^ # -# :: +# This module defines the following :prop_tgt:`IMPORTED` targets: # -# OPENSSL_ROOT_DIR - Set this variable to the root installation of OpenSSL +# ``OpenSSL::SSL`` +# The OpenSSL ``ssl`` library, if found. +# ``OpenSSL::Crypto`` +# The OpenSSL ``crypto`` library, if found. # +# Result Variables +# ^^^^^^^^^^^^^^^^ # +# This module will set the following variables in your project: # -# Read-Only variables: +# ``OPENSSL_FOUND`` +# System has the OpenSSL library. +# ``OPENSSL_INCLUDE_DIR`` +# The OpenSSL include directory. +# ``OPENSSL_CRYPTO_LIBRARY`` +# The OpenSSL crypto library. +# ``OPENSSL_SSL_LIBRARY`` +# The OpenSSL SSL library. +# ``OPENSSL_LIBRARIES`` +# All OpenSSL libraries. +# ``OPENSSL_VERSION`` +# This is set to ``$major.$minor.$revision$patch`` (e.g. ``0.9.8s``). # -# :: +# Hints +# ^^^^^ # -# OPENSSL_FOUND - System has the OpenSSL library -# OPENSSL_INCLUDE_DIR - The OpenSSL include directory -# OPENSSL_CRYPTO_LIBRARY - The OpenSSL crypto library -# OPENSSL_SSL_LIBRARY - The OpenSSL SSL library -# OPENSSL_LIBRARIES - All OpenSSL libraries -# OPENSSL_VERSION - This is set to $major.$minor.$revision$patch (eg. 0.9.8s) +# Set ``OPENSSL_ROOT_DIR`` to the root directory of an OpenSSL installation. +# Set ``OPENSSL_USE_STATIC_LIBS`` to ``TRUE`` to look for static libraries. #============================================================================= # Copyright 2006-2009 Kitware, Inc. @@ -43,6 +58,16 @@ if (UNIX) pkg_check_modules(_OPENSSL QUIET openssl) endif () +# Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES +if(OPENSSL_USE_STATIC_LIBS) + set(_openssl_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) + if(WIN32) + set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) + else() + set(CMAKE_FIND_LIBRARY_SUFFIXES .a ) + endif() +endif() + if (WIN32) # http://www.slproweb.com/products/Win32OpenSSL.html set(_OPENSSL_ROOT_HINTS @@ -99,15 +124,29 @@ if(WIN32 AND NOT CYGWIN) # We are using the libraries located in the VC subdir instead of the parent directory eventhough : # libeay32MD.lib is identical to ../libeay32.lib, and # ssleay32MD.lib is identical to ../ssleay32.lib + # enable OPENSSL_USE_STATIC_LIBS to use the static libs located in lib/VC/static + + if(OPENSSL_USE_STATIC_LIBS) + set(_OPENSSL_PATH_SUFFIXES + "lib" + "VC/static" + "lib/VC/static" + ) + else() + set(_OPENSSL_PATH_SUFFIXES + "lib" + "VC" + "lib/VC" + ) + endif () + find_library(LIB_EAY_DEBUG NAMES libeay32MDd libeay32d ${_OPENSSL_ROOT_HINTS_AND_PATHS} PATH_SUFFIXES - "lib" - "VC" - "lib/VC" + ${_OPENSSL_PATH_SUFFIXES} ) find_library(LIB_EAY_RELEASE @@ -116,9 +155,7 @@ if(WIN32 AND NOT CYGWIN) libeay32 ${_OPENSSL_ROOT_HINTS_AND_PATHS} PATH_SUFFIXES - "lib" - "VC" - "lib/VC" + ${_OPENSSL_PATH_SUFFIXES} ) find_library(SSL_EAY_DEBUG @@ -127,9 +164,7 @@ if(WIN32 AND NOT CYGWIN) ssleay32d ${_OPENSSL_ROOT_HINTS_AND_PATHS} PATH_SUFFIXES - "lib" - "VC" - "lib/VC" + ${_OPENSSL_PATH_SUFFIXES} ) find_library(SSL_EAY_RELEASE @@ -139,9 +174,7 @@ if(WIN32 AND NOT CYGWIN) ssl ${_OPENSSL_ROOT_HINTS_AND_PATHS} PATH_SUFFIXES - "lib" - "VC" - "lib/VC" + ${_OPENSSL_PATH_SUFFIXES} ) set(LIB_EAY_LIBRARY_DEBUG "${LIB_EAY_DEBUG}") @@ -155,9 +188,9 @@ if(WIN32 AND NOT CYGWIN) mark_as_advanced(LIB_EAY_LIBRARY_DEBUG LIB_EAY_LIBRARY_RELEASE SSL_EAY_LIBRARY_DEBUG SSL_EAY_LIBRARY_RELEASE) - set( OPENSSL_SSL_LIBRARY ${SSL_EAY_LIBRARY} ) - set( OPENSSL_CRYPTO_LIBRARY ${LIB_EAY_LIBRARY} ) - set( OPENSSL_LIBRARIES ${SSL_EAY_LIBRARY} ${LIB_EAY_LIBRARY} ) + set(OPENSSL_SSL_LIBRARY ${SSL_EAY_LIBRARY} ) + set(OPENSSL_CRYPTO_LIBRARY ${LIB_EAY_LIBRARY} ) + set(OPENSSL_LIBRARIES ${SSL_EAY_LIBRARY} ${LIB_EAY_LIBRARY} ) elseif(MINGW) # same player, for MinGW set(LIB_EAY_NAMES libeay32) @@ -185,9 +218,9 @@ if(WIN32 AND NOT CYGWIN) ) mark_as_advanced(SSL_EAY LIB_EAY) - set( OPENSSL_SSL_LIBRARY ${SSL_EAY} ) - set( OPENSSL_CRYPTO_LIBRARY ${LIB_EAY} ) - set( OPENSSL_LIBRARIES ${SSL_EAY} ${LIB_EAY} ) + set(OPENSSL_SSL_LIBRARY ${SSL_EAY} ) + set(OPENSSL_CRYPTO_LIBRARY ${LIB_EAY} ) + set(OPENSSL_LIBRARIES ${SSL_EAY} ${LIB_EAY} ) unset(LIB_EAY_NAMES) unset(SSL_EAY_NAMES) else() @@ -213,9 +246,9 @@ if(WIN32 AND NOT CYGWIN) ) mark_as_advanced(SSL_EAY LIB_EAY) - set( OPENSSL_SSL_LIBRARY ${SSL_EAY} ) - set( OPENSSL_CRYPTO_LIBRARY ${LIB_EAY} ) - set( OPENSSL_LIBRARIES ${SSL_EAY} ${LIB_EAY} ) + set(OPENSSL_SSL_LIBRARY ${SSL_EAY} ) + set(OPENSSL_CRYPTO_LIBRARY ${LIB_EAY} ) + set(OPENSSL_LIBRARIES ${SSL_EAY} ${LIB_EAY} ) endif() else() @@ -338,3 +371,71 @@ else () endif () mark_as_advanced(OPENSSL_INCLUDE_DIR OPENSSL_LIBRARIES) + +if(OPENSSL_FOUND) + if(NOT TARGET OpenSSL::Crypto AND + (EXISTS "${OPENSSL_CRYPTO_LIBRARY}" OR + EXISTS "${LIB_EAY_LIBRARY_DEBUG}" OR + EXISTS "${LIB_EAY_LIBRARY_RELEASE}") + ) + add_library(OpenSSL::Crypto UNKNOWN IMPORTED) + set_target_properties(OpenSSL::Crypto PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${OPENSSL_INCLUDE_DIR}") + if(EXISTS "${OPENSSL_CRYPTO_LIBRARY}") + set_target_properties(OpenSSL::Crypto PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${OPENSSL_CRYPTO_LIBRARY}") + endif() + if(EXISTS "${LIB_EAY_LIBRARY_DEBUG}") + set_property(TARGET OpenSSL::Crypto APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(OpenSSL::Crypto PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C" + IMPORTED_LOCATION_DEBUG "${LIB_EAY_LIBRARY_DEBUG}") + endif() + if(EXISTS "${LIB_EAY_LIBRARY_RELEASE}") + set_property(TARGET OpenSSL::Crypto APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(OpenSSL::Crypto PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C" + IMPORTED_LOCATION_RELEASE "${LIB_EAY_LIBRARY_RELEASE}") + endif() + endif() + if(NOT TARGET OpenSSL::SSL AND + (EXISTS "${OPENSSL_SSL_LIBRARY}" OR + EXISTS "${SSL_EAY_LIBRARY_DEBUG}" OR + EXISTS "${SSL_EAY_LIBRARY_RELEASE}") + ) + add_library(OpenSSL::SSL UNKNOWN IMPORTED) + set_target_properties(OpenSSL::SSL PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${OPENSSL_INCLUDE_DIR}") + if(EXISTS "${OPENSSL_SSL_LIBRARY}") + set_target_properties(OpenSSL::SSL PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${OPENSSL_SSL_LIBRARY}") + endif() + if(EXISTS "${SSL_EAY_LIBRARY_DEBUG}") + set_property(TARGET OpenSSL::SSL APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(OpenSSL::SSL PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C" + IMPORTED_LOCATION_DEBUG "${SSL_EAY_LIBRARY_DEBUG}") + endif() + if(EXISTS "${SSL_EAY_LIBRARY_RELEASE}") + set_property(TARGET OpenSSL::SSL APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(OpenSSL::SSL PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C" + IMPORTED_LOCATION_RELEASE "${SSL_EAY_LIBRARY_RELEASE}") + endif() + if(TARGET OpenSSL::Crypto) + set_target_properties(OpenSSL::SSL PROPERTIES + INTERFACE_LINK_LIBRARIES OpenSSL::Crypto) + endif() + endif() +endif() + +# Restore the original find library ordering +if(OPENSSL_USE_STATIC_LIBS) + set(CMAKE_FIND_LIBRARY_SUFFIXES ${_openssl_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) +endif() diff --git a/Modules/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake index 1be38af2b..fe2dbeaa6 100644 --- a/Modules/FindPackageHandleStandardArgs.cmake +++ b/Modules/FindPackageHandleStandardArgs.cmake @@ -42,7 +42,7 @@ valid filepaths. (recommended). Not valid in the full signature. ``FOUND_VAR `` - Obselete. Specifies either ``_FOUND`` or + Obsolete. Specifies either ``_FOUND`` or ``_FOUND`` as the result variable. This exists only for compatibility with older versions of CMake and is now ignored. Result variables of both names are always set for compatibility. diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake index 53c17f1a4..e822b9c43 100644 --- a/Modules/FindPkgConfig.cmake +++ b/Modules/FindPkgConfig.cmake @@ -70,14 +70,14 @@ macro(_pkgconfig_invoke _pkglist _prefix _varname _regexp) execute_process( COMMAND ${PKG_CONFIG_EXECUTABLE} ${ARGN} ${_pkglist} OUTPUT_VARIABLE _pkgconfig_invoke_result - RESULT_VARIABLE _pkgconfig_failed) + RESULT_VARIABLE _pkgconfig_failed + OUTPUT_STRIP_TRAILING_WHITESPACE) if (_pkgconfig_failed) set(_pkgconfig_${_varname} "") _pkgconfig_unset(${_prefix}_${_varname}) else() string(REGEX REPLACE "[\r\n]" " " _pkgconfig_invoke_result "${_pkgconfig_invoke_result}") - string(REGEX REPLACE " +$" "" _pkgconfig_invoke_result "${_pkgconfig_invoke_result}") if (NOT ${_regexp} STREQUAL "") string(REGEX REPLACE "${_regexp}" " " _pkgconfig_invoke_result "${_pkgconfig_invoke_result}") @@ -91,6 +91,26 @@ macro(_pkgconfig_invoke _pkglist _prefix _varname _regexp) endif() endmacro() +#[========================================[.rst: +.. command:: pkg_get_variable + + Retrieves the value of a variable from a package:: + + pkg_get_variable( ) + + For example: + + .. code-block:: cmake + + pkg_get_variable(GI_GIRDIR gobject-introspection-1.0 girdir) +#]========================================] +function (pkg_get_variable result pkg variable) + _pkgconfig_invoke("${pkg}" "prefix" "result" "" "--variable=${variable}") + set("${result}" + "${prefix_result}" + PARENT_SCOPE) +endfunction () + # Invokes pkgconfig two times; once without '--static' and once with # '--static' macro(_pkgconfig_invoke_dyn _pkglist _prefix _varname cleanup_regexp) @@ -109,7 +129,7 @@ macro(_pkgconfig_parse_options _result _is_req _is_silent _no_cmake_path _no_cma set(${_no_cmake_path} 1) set(${_no_cmake_environment_path} 1) endif() - elseif(${CMAKE_MINIMUM_REQUIRED_VERSION} VERSION_LESS 3.1) + elseif(CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 3.1) set(${_no_cmake_path} 1) set(${_no_cmake_environment_path} 1) endif() @@ -192,9 +212,9 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma # give out status message telling checked module if (NOT ${_is_silent}) if (_pkg_check_modules_cnt EQUAL 1) - message(STATUS "checking for module '${_pkg_check_modules_list}'") + message(STATUS "Checking for module '${_pkg_check_modules_list}'") else() - message(STATUS "checking for modules '${_pkg_check_modules_list}'") + message(STATUS "Checking for modules '${_pkg_check_modules_list}'") endif() endif() @@ -327,7 +347,7 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma # evaluate result and tell failures if (_pkgconfig_retval) if(NOT ${_is_silent}) - message(STATUS " package '${_pkg_check_modules_pkg}' not found") + message(STATUS " Package '${_pkg_check_modules_pkg}' not found") endif() set(_pkg_check_modules_failed 1) @@ -356,12 +376,12 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma endif() _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" VERSION "" --modversion ) - _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" PREFIX "" --variable=prefix ) - _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" INCLUDEDIR "" --variable=includedir ) - _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" LIBDIR "" --variable=libdir ) + pkg_get_variable("${_pkg_check_prefix}_PREFIX" ${_pkg_check_modules_pkg} "prefix") + pkg_get_variable("${_pkg_check_prefix}_INCLUDEDIR" ${_pkg_check_modules_pkg} "includedir") + pkg_get_variable("${_pkg_check_prefix}_LIBDIR" ${_pkg_check_modules_pkg} "libdir") if (NOT ${_is_silent}) - message(STATUS " found ${_pkg_check_modules_pkg}, version ${_pkgconfig_VERSION}") + message(STATUS " Found ${_pkg_check_modules_pkg}, version ${_pkgconfig_VERSION}") endif () endforeach() @@ -529,7 +549,7 @@ macro(pkg_search_module _prefix _module0) _pkgconfig_parse_options(_pkg_modules_alt _pkg_is_required _pkg_is_silent _no_cmake_path _no_cmake_environment_path "${_module0}" ${ARGN}) if (NOT ${_pkg_is_silent}) - message(STATUS "checking for one of the modules '${_pkg_modules_alt}'") + message(STATUS "Checking for one of the modules '${_pkg_modules_alt}'") endif () # iterate through all modules and stop at the first working one. diff --git a/Modules/FindPostgreSQL.cmake b/Modules/FindPostgreSQL.cmake index 3ce2c7397..d05d3da7c 100644 --- a/Modules/FindPostgreSQL.cmake +++ b/Modules/FindPostgreSQL.cmake @@ -81,7 +81,7 @@ set(PostgreSQL_ROOT_DIR_MESSAGE "Set the PostgreSQL_ROOT system variable to wher set(PostgreSQL_KNOWN_VERSIONS ${PostgreSQL_ADDITIONAL_VERSIONS} - "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0") + "9.5" "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0") # Define additional search paths for root directories. set( PostgreSQL_ROOT_DIRECTORIES diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index f01bd41a6..4a68cd186 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -9,8 +9,9 @@ # ``PROTOBUF_SRC_ROOT_FOLDER`` # When compiling with MSVC, if this cache variable is set # the protobuf-default VS project build locations -# (vsprojects/Debug & vsprojects/Release) will be searched -# for libraries and binaries. +# (vsprojects/Debug and vsprojects/Release +# or vsprojects/x64/Debug and vsprojects/x64/Release) +# will be searched for libraries and binaries. # ``PROTOBUF_IMPORT_DIRS`` # List of additional directories to be searched for # imported .proto files. @@ -56,17 +57,18 @@ # include_directories(${PROTOBUF_INCLUDE_DIRS}) # include_directories(${CMAKE_CURRENT_BINARY_DIR}) # protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS foo.proto) +# protobuf_generate_python(PROTO_PY foo.proto) # add_executable(bar bar.cc ${PROTO_SRCS} ${PROTO_HDRS}) # target_link_libraries(bar ${PROTOBUF_LIBRARIES}) # # .. note:: -# The PROTOBUF_GENERATE_CPP macro and add_executable() or -# add_library() calls only work properly within the same -# directory. +# The ``protobuf_generate_cpp`` and ``protobuf_generate_python`` +# functions and :command:`add_executable` or :command:`add_library` +# calls only work properly within the same directory. # # .. command:: protobuf_generate_cpp # -# Add custom commands to process ``.proto`` files:: +# Add custom commands to process ``.proto`` files to C++:: # # protobuf_generate_cpp ( [...]) # @@ -76,6 +78,17 @@ # Variable to define with autogenerated header files # ``ARGN`` # ``.proto`` files +# +# .. command:: protobuf_generate_python +# +# Add custom commands to process ``.proto`` files to Python:: +# +# protobuf_generate_python ( [...]) +# +# ``PY`` +# Variable to define with autogenerated Python files +# ``ARGN`` +# ``.proto`` filess #============================================================================= # Copyright 2009 Kitware, Inc. @@ -146,18 +159,69 @@ function(PROTOBUF_GENERATE_CPP SRCS HDRS) set(${HDRS} ${${HDRS}} PARENT_SCOPE) endfunction() +function(PROTOBUF_GENERATE_PYTHON SRCS) + if(NOT ARGN) + message(SEND_ERROR "Error: PROTOBUF_GENERATE_PYTHON() called without any proto files") + return() + endif() + + if(PROTOBUF_GENERATE_CPP_APPEND_PATH) + # Create an include path for each file specified + foreach(FIL ${ARGN}) + get_filename_component(ABS_FIL ${FIL} ABSOLUTE) + get_filename_component(ABS_PATH ${ABS_FIL} PATH) + list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) + if(${_contains_already} EQUAL -1) + list(APPEND _protobuf_include_path -I ${ABS_PATH}) + endif() + endforeach() + else() + set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR}) + endif() + + if(DEFINED PROTOBUF_IMPORT_DIRS) + foreach(DIR ${PROTOBUF_IMPORT_DIRS}) + get_filename_component(ABS_PATH ${DIR} ABSOLUTE) + list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) + if(${_contains_already} EQUAL -1) + list(APPEND _protobuf_include_path -I ${ABS_PATH}) + endif() + endforeach() + endif() + + set(${SRCS}) + foreach(FIL ${ARGN}) + get_filename_component(ABS_FIL ${FIL} ABSOLUTE) + get_filename_component(FIL_WE ${FIL} NAME_WE) + + list(APPEND ${SRCS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}_pb2.py") + add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}_pb2.py" + COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} --python_out ${CMAKE_CURRENT_BINARY_DIR} ${_protobuf_include_path} ${ABS_FIL} + DEPENDS ${ABS_FIL} ${PROTOBUF_PROTOC_EXECUTABLE} + COMMENT "Running Python protocol buffer compiler on ${FIL}" + VERBATIM ) + endforeach() + + set(${SRCS} ${${SRCS}} PARENT_SCOPE) +endfunction() + +if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(_PROTOBUF_ARCH_DIR x64/) +endif() + # Internal function: search for normal library as well as a debug one # if the debug one is specified also include debug/optimized keywords # in *_LIBRARIES variable function(_protobuf_find_libraries name filename) find_library(${name}_LIBRARY NAMES ${filename} - PATHS ${PROTOBUF_SRC_ROOT_FOLDER}/vsprojects/Release) + PATHS ${PROTOBUF_SRC_ROOT_FOLDER}/vsprojects/${_PROTOBUF_ARCH_DIR}Release) mark_as_advanced(${name}_LIBRARY) find_library(${name}_LIBRARY_DEBUG NAMES ${filename} - PATHS ${PROTOBUF_SRC_ROOT_FOLDER}/vsprojects/Debug) + PATHS ${PROTOBUF_SRC_ROOT_FOLDER}/vsprojects/${_PROTOBUF_ARCH_DIR}Debug) mark_as_advanced(${name}_LIBRARY_DEBUG) if(NOT ${name}_LIBRARY_DEBUG) @@ -234,8 +298,8 @@ find_program(PROTOBUF_PROTOC_EXECUTABLE NAMES protoc DOC "The Google Protocol Buffers Compiler" PATHS - ${PROTOBUF_SRC_ROOT_FOLDER}/vsprojects/Release - ${PROTOBUF_SRC_ROOT_FOLDER}/vsprojects/Debug + ${PROTOBUF_SRC_ROOT_FOLDER}/vsprojects/${_PROTOBUF_ARCH_DIR}Release + ${PROTOBUF_SRC_ROOT_FOLDER}/vsprojects/${_PROTOBUF_ARCH_DIR}Debug ) mark_as_advanced(PROTOBUF_PROTOC_EXECUTABLE) diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake index 8784e18d5..879192eb3 100644 --- a/Modules/FindPythonInterp.cmake +++ b/Modules/FindPythonInterp.cmake @@ -51,7 +51,7 @@ unset(_Python_NAMES) set(_PYTHON1_VERSIONS 1.6 1.5) set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0) -set(_PYTHON3_VERSIONS 3.4 3.3 3.2 3.1 3.0) +set(_PYTHON3_VERSIONS 3.6 3.5 3.4 3.3 3.2 3.1 3.0) if(PythonInterp_FIND_VERSION) if(PythonInterp_FIND_VERSION_COUNT GREATER 1) diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake index cc875ade7..68e1228ee 100644 --- a/Modules/FindPythonLibs.cmake +++ b/Modules/FindPythonLibs.cmake @@ -49,13 +49,41 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) +# Use the executable's path as a hint +set(_Python_LIBRARY_PATH_HINT) +if(PYTHON_EXECUTABLE) + if(WIN32) + get_filename_component(_Python_PREFIX ${PYTHON_EXECUTABLE} PATH) + if(_Python_PREFIX) + set(_Python_LIBRARY_PATH_HINT ${_Python_PREFIX}/libs) + endif() + unset(_Python_PREFIX) + else() + get_filename_component(_Python_PREFIX ${PYTHON_EXECUTABLE} PATH) + get_filename_component(_Python_PREFIX ${_Python_PREFIX} PATH) + if(_Python_PREFIX) + set(_Python_LIBRARY_PATH_HINT ${_Python_PREFIX}/lib) + endif() + unset(_Python_PREFIX) + endif() +endif() + include(${CMAKE_CURRENT_LIST_DIR}/CMakeFindFrameworks.cmake) # Search for the python framework on Apple. CMAKE_FIND_FRAMEWORKS(Python) +# Save CMAKE_FIND_FRAMEWORK +if(DEFINED CMAKE_FIND_FRAMEWORK) + set(_PythonLibs_CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK}) +else() + unset(_PythonLibs_CMAKE_FIND_FRAMEWORK) +endif() +# To avoid picking up the system Python.h pre-maturely. +set(CMAKE_FIND_FRAMEWORK LAST) + set(_PYTHON1_VERSIONS 1.6 1.5) set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0) -set(_PYTHON3_VERSIONS 3.4 3.3 3.2 3.1 3.0) +set(_PYTHON3_VERSIONS 3.6 3.5 3.4 3.3 3.2 3.1 3.0) if(PythonLibs_FIND_VERSION) if(PythonLibs_FIND_VERSION_COUNT GREATER 1) @@ -103,6 +131,7 @@ foreach(_CURRENT_VERSION ${_Python_VERSIONS}) if(WIN32) find_library(PYTHON_DEBUG_LIBRARY NAMES python${_CURRENT_VERSION_NO_DOTS}_d python + HINTS ${_Python_LIBRARY_PATH_HINT} PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs/Debug [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs/Debug @@ -111,14 +140,24 @@ foreach(_CURRENT_VERSION ${_Python_VERSIONS}) ) endif() + set(PYTHON_FRAMEWORK_LIBRARIES) + if(Python_FRAMEWORKS AND NOT PYTHON_LIBRARY) + foreach(dir ${Python_FRAMEWORKS}) + list(APPEND PYTHON_FRAMEWORK_LIBRARIES + ${dir}/Versions/${_CURRENT_VERSION}/lib) + endforeach() + endif() find_library(PYTHON_LIBRARY NAMES - python${_CURRENT_VERSION_NO_DOTS} - python${_CURRENT_VERSION}mu - python${_CURRENT_VERSION}m - python${_CURRENT_VERSION}u - python${_CURRENT_VERSION} + python${_CURRENT_VERSION_NO_DOTS} + python${_CURRENT_VERSION}mu + python${_CURRENT_VERSION}m + python${_CURRENT_VERSION}u + python${_CURRENT_VERSION} + HINTS + ${_Python_LIBRARY_PATH_HINT} PATHS + ${PYTHON_FRAMEWORK_LIBRARIES} [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs # Avoid finding the .dll in the PATH. We want the .lib. @@ -133,33 +172,42 @@ foreach(_CURRENT_VERSION ${_Python_VERSIONS}) PATH_SUFFIXES python${_CURRENT_VERSION}/config ) - # For backward compatibility, honour value of PYTHON_INCLUDE_PATH, if - # PYTHON_INCLUDE_DIR is not set. - if(DEFINED PYTHON_INCLUDE_PATH AND NOT DEFINED PYTHON_INCLUDE_DIR) - set(PYTHON_INCLUDE_DIR "${PYTHON_INCLUDE_PATH}" CACHE PATH - "Path to where Python.h is found" FORCE) - endif() + # Don't search for include dir until library location is known + if(PYTHON_LIBRARY) - set(PYTHON_FRAMEWORK_INCLUDES) - if(Python_FRAMEWORKS AND NOT PYTHON_INCLUDE_DIR) - foreach(dir ${Python_FRAMEWORKS}) - set(PYTHON_FRAMEWORK_INCLUDES ${PYTHON_FRAMEWORK_INCLUDES} - ${dir}/Versions/${_CURRENT_VERSION}/include/python${_CURRENT_VERSION}) - endforeach() - endif() + # Use the library's install prefix as a hint + set(_Python_INCLUDE_PATH_HINT) + get_filename_component(_Python_PREFIX ${PYTHON_LIBRARY} PATH) + get_filename_component(_Python_PREFIX ${_Python_PREFIX} PATH) + if(_Python_PREFIX) + set(_Python_INCLUDE_PATH_HINT ${_Python_PREFIX}/include) + endif() + unset(_Python_PREFIX) + + # Add framework directories to the search paths + set(PYTHON_FRAMEWORK_INCLUDES) + if(Python_FRAMEWORKS AND NOT PYTHON_INCLUDE_DIR) + foreach(dir ${Python_FRAMEWORKS}) + list(APPEND PYTHON_FRAMEWORK_INCLUDES + ${dir}/Versions/${_CURRENT_VERSION}/include) + endforeach() + endif() - find_path(PYTHON_INCLUDE_DIR - NAMES Python.h - PATHS - ${PYTHON_FRAMEWORK_INCLUDES} - [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/include - [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/include - PATH_SUFFIXES - python${_CURRENT_VERSION}mu - python${_CURRENT_VERSION}m - python${_CURRENT_VERSION}u - python${_CURRENT_VERSION} - ) + find_path(PYTHON_INCLUDE_DIR + NAMES Python.h + HINTS + ${_Python_INCLUDE_PATH_HINT} + PATHS + ${PYTHON_FRAMEWORK_INCLUDES} + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/include + [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/include + PATH_SUFFIXES + python${_CURRENT_VERSION}mu + python${_CURRENT_VERSION}m + python${_CURRENT_VERSION}u + python${_CURRENT_VERSION} + ) + endif() # For backward compatibility, set PYTHON_INCLUDE_PATH. set(PYTHON_INCLUDE_PATH "${PYTHON_INCLUDE_DIR}") @@ -177,6 +225,9 @@ foreach(_CURRENT_VERSION ${_Python_VERSIONS}) endif() endforeach() +unset(_Python_INCLUDE_PATH_HINT) +unset(_Python_LIBRARY_PATH_HINT) + mark_as_advanced( PYTHON_DEBUG_LIBRARY PYTHON_LIBRARY @@ -201,6 +252,14 @@ SELECT_LIBRARY_CONFIGURATIONS(PYTHON) # for historical reasons. unset(PYTHON_FOUND) +# Restore CMAKE_FIND_FRAMEWORK +if(DEFINED _PythonLibs_CMAKE_FIND_FRAMEWORK) + set(CMAKE_FIND_FRAMEWORK ${_PythonLibs_CMAKE_FIND_FRAMEWORK}) + unset(_PythonLibs_CMAKE_FIND_FRAMEWORK) +else() + unset(CMAKE_FIND_FRAMEWORK) +endif() + include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonLibs REQUIRED_VARS PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS diff --git a/Modules/FindTIFF.cmake b/Modules/FindTIFF.cmake index a67d24d0a..ed092eafa 100644 --- a/Modules/FindTIFF.cmake +++ b/Modules/FindTIFF.cmake @@ -34,7 +34,19 @@ find_path(TIFF_INCLUDE_DIR tiff.h) set(TIFF_NAMES ${TIFF_NAMES} tiff libtiff tiff3 libtiff3) -find_library(TIFF_LIBRARY NAMES ${TIFF_NAMES} ) +foreach(name ${TIFF_NAMES}) + list(APPEND TIFF_NAMES_DEBUG "${name}d") +endforeach() + +if(NOT TIFF_LIBRARY) + find_library(TIFF_LIBRARY_RELEASE NAMES ${TIFF_NAMES}) + find_library(TIFF_LIBRARY_DEBUG NAMES ${TIFF_NAMES_DEBUG}) + include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) + select_library_configurations(TIFF) + mark_as_advanced(TIFF_LIBRARY_RELEASE TIFF_LIBRARY_DEBUG) +endif() +unset(TIFF_NAMES) +unset(TIFF_NAMES_DEBUG) if(TIFF_INCLUDE_DIR AND EXISTS "${TIFF_INCLUDE_DIR}/tiffvers.h") file(STRINGS "${TIFF_INCLUDE_DIR}/tiffvers.h" tiff_version_str diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake index a0bc4d133..c6079231f 100644 --- a/Modules/FindThreads.cmake +++ b/Modules/FindThreads.cmake @@ -39,7 +39,7 @@ #============================================================================= # Copyright 2002-2009 Kitware, Inc. -# Copyright 2011-2014 Rolf Eike Beer +# Copyright 2011-2015 Rolf Eike Beer # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -51,15 +51,23 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -include (CheckIncludeFiles) include (CheckLibraryExists) include (CheckSymbolExists) set(Threads_FOUND FALSE) set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET}) set(CMAKE_REQUIRED_QUIET ${Threads_FIND_QUIETLY}) +if(CMAKE_C_COMPILER_LOADED) + include (CheckIncludeFile) +elseif(CMAKE_CXX_COMPILER_LOADED) + include (CheckIncludeFileCXX) +else() + message(FATAL_ERROR "FindThreads only works if either C or CXX language is enabled") +endif() + # Do we have sproc? if(CMAKE_SYSTEM_NAME MATCHES IRIX AND NOT CMAKE_THREAD_PREFER_PTHREAD) + include (CheckIncludeFiles) CHECK_INCLUDE_FILES("sys/types.h;sys/prctl.h" CMAKE_HAVE_SPROC_H) endif() @@ -83,11 +91,18 @@ macro(_check_pthreads_flag) # If we did not found -lpthread, -lpthread, or -lthread, look for -pthread if(NOT DEFINED THREADS_HAVE_PTHREAD_ARG) message(STATUS "Check if compiler accepts -pthread") + if(CMAKE_C_COMPILER_LOADED) + set(_threads_src ${CMAKE_CURRENT_LIST_DIR}/CheckForPthreads.c) + elseif(CMAKE_CXX_COMPILER_LOADED) + set(_threads_src ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindThreads/CheckForPthreads.cxx) + configure_file(${CMAKE_CURRENT_LIST_DIR}/CheckForPthreads.c "${_threads_src}" COPYONLY) + endif() try_run(THREADS_PTHREAD_ARG THREADS_HAVE_PTHREAD_ARG ${CMAKE_BINARY_DIR} - ${CMAKE_CURRENT_LIST_DIR}/CheckForPthreads.c + ${_threads_src} CMAKE_FLAGS -DLINK_LIBRARIES:STRING=-pthread COMPILE_OUTPUT_VARIABLE OUTPUT) + unset(_threads_src) if(THREADS_HAVE_PTHREAD_ARG) if(THREADS_PTHREAD_ARG STREQUAL "2") @@ -120,7 +135,11 @@ if(CMAKE_HAVE_SPROC_H AND NOT CMAKE_THREAD_PREFER_PTHREAD) set(CMAKE_USE_SPROC_INIT 1) else() # Do we have pthreads? - CHECK_INCLUDE_FILES("pthread.h" CMAKE_HAVE_PTHREAD_H) + if(CMAKE_C_COMPILER_LOADED) + CHECK_INCLUDE_FILE("pthread.h" CMAKE_HAVE_PTHREAD_H) + else() + CHECK_INCLUDE_FILE_CXX("pthread.h" CMAKE_HAVE_PTHREAD_H) + endif() if(CMAKE_HAVE_PTHREAD_H) # diff --git a/Modules/FindXercesC.cmake b/Modules/FindXercesC.cmake index 5a8ea9de2..cf84826a7 100644 --- a/Modules/FindXercesC.cmake +++ b/Modules/FindXercesC.cmake @@ -61,10 +61,18 @@ find_path(XercesC_INCLUDE_DIR DOC "Xerces-C++ include directory") mark_as_advanced(XercesC_INCLUDE_DIR) -# Find all XercesC libraries -find_library(XercesC_LIBRARY "xerces-c" - DOC "Xerces-C++ libraries") -mark_as_advanced(XercesC_LIBRARY) +if(NOT XercesC_LIBRARY) + # Find all XercesC libraries + find_library(XercesC_LIBRARY_RELEASE + NAMES "xerces-c" "xerces-c_3" + DOC "Xerces-C++ libraries (release)") + find_library(XercesC_LIBRARY_DEBUG + NAMES "xerces-cd" "xerces-c_3D" "xerces-c_3_1D" + DOC "Xerces-C++ libraries (debug)") + include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) + select_library_configurations(XercesC) + mark_as_advanced(XercesC_LIBRARY_RELEASE XercesC_LIBRARY_DEBUG) +endif() if(XercesC_INCLUDE_DIR) _XercesC_GET_VERSION("${XercesC_INCLUDE_DIR}/xercesc/util/XercesVersion.hpp") diff --git a/Modules/FindZLIB.cmake b/Modules/FindZLIB.cmake index d4a27d5a1..a57f45008 100644 --- a/Modules/FindZLIB.cmake +++ b/Modules/FindZLIB.cmake @@ -74,14 +74,28 @@ set(_ZLIB_SEARCH_NORMAL ) list(APPEND _ZLIB_SEARCHES _ZLIB_SEARCH_NORMAL) -set(ZLIB_NAMES z zlib zdll zlib1 zlibd zlibd1) +set(ZLIB_NAMES z zlib zdll zlib1) +set(ZLIB_NAMES_DEBUG zlibd zlibd1) # Try each search configuration. foreach(search ${_ZLIB_SEARCHES}) - find_path(ZLIB_INCLUDE_DIR NAMES zlib.h ${${search}} PATH_SUFFIXES include) - find_library(ZLIB_LIBRARY NAMES ${ZLIB_NAMES} ${${search}} PATH_SUFFIXES lib) + find_path(ZLIB_INCLUDE_DIR NAMES zlib.h ${${search}} PATH_SUFFIXES include) endforeach() +# Allow ZLIB_LIBRARY to be set manually, as the location of the zlib library +if(NOT ZLIB_LIBRARY) + foreach(search ${_ZLIB_SEARCHES}) + find_library(ZLIB_LIBRARY_RELEASE NAMES ${ZLIB_NAMES} ${${search}} PATH_SUFFIXES lib) + find_library(ZLIB_LIBRARY_DEBUG NAMES ${ZLIB_NAMES_DEBUG} ${${search}} PATH_SUFFIXES lib) + endforeach() + + include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) + select_library_configurations(ZLIB) +endif() + +unset(ZLIB_NAMES) +unset(ZLIB_NAMES_DEBUG) + mark_as_advanced(ZLIB_LIBRARY ZLIB_INCLUDE_DIR) if(ZLIB_INCLUDE_DIR AND EXISTS "${ZLIB_INCLUDE_DIR}/zlib.h") @@ -112,12 +126,33 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB REQUIRED_VARS ZLIB_LIBRARY ZLIB_INCLUDE_D if(ZLIB_FOUND) set(ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR}) - set(ZLIB_LIBRARIES ${ZLIB_LIBRARY}) + + if(NOT ZLIB_LIBRARIES) + set(ZLIB_LIBRARIES ${ZLIB_LIBRARY}) + endif() if(NOT TARGET ZLIB::ZLIB) add_library(ZLIB::ZLIB UNKNOWN IMPORTED) set_target_properties(ZLIB::ZLIB PROPERTIES - IMPORTED_LOCATION "${ZLIB_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES "${ZLIB_INCLUDE_DIRS}") + + if(ZLIB_LIBRARY_RELEASE) + set_property(TARGET ZLIB::ZLIB APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(ZLIB::ZLIB PROPERTIES + IMPORTED_LOCATION_RELEASE "${ZLIB_LIBRARY_RELEASE}") + endif() + + if(ZLIB_LIBRARY_DEBUG) + set_property(TARGET ZLIB::ZLIB APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(ZLIB::ZLIB PROPERTIES + IMPORTED_LOCATION_DEBUG "${ZLIB_LIBRARY_DEBUG}") + endif() + + if(NOT ZLIB_LIBRARY_RELEASE AND NOT ZLIB_LIBRARY_DEBUG) + set_property(TARGET ZLIB::ZLIB APPEND PROPERTY + IMPORTED_LOCATION "${ZLIB_LIBRARY}") + endif() endif() endif() diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake index 9a706783f..903759404 100644 --- a/Modules/FindwxWidgets.cmake +++ b/Modules/FindwxWidgets.cmake @@ -193,8 +193,8 @@ set(wxWidgets_CXX_FLAGS "") # to prevent UsewxWidgets.cmake from using SYSTEM. # # See cmake mailing list discussions for more info: -# http://www.cmake.org/pipermail/cmake/2008-April/021115.html -# http://www.cmake.org/pipermail/cmake/2008-April/021146.html +# https://cmake.org/pipermail/cmake/2008-April/021115.html +# https://cmake.org/pipermail/cmake/2008-April/021146.html # if(APPLE OR CMAKE_CXX_PLATFORM_ID MATCHES "OpenBSD") set(wxWidgets_INCLUDE_DIRS_NO_SYSTEM 1) @@ -302,6 +302,7 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32") # Find wxWidgets multilib base libraries. find_library(WX_base${_DBG} NAMES + wxbase31${_UCD}${_DBG} wxbase30${_UCD}${_DBG} wxbase29${_UCD}${_DBG} wxbase28${_UCD}${_DBG} @@ -315,6 +316,7 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32") foreach(LIB net odbc xml) find_library(WX_${LIB}${_DBG} NAMES + wxbase31${_UCD}${_DBG}_${LIB} wxbase30${_UCD}${_DBG}_${LIB} wxbase29${_UCD}${_DBG}_${LIB} wxbase28${_UCD}${_DBG}_${LIB} @@ -330,6 +332,7 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32") # Find wxWidgets monolithic library. find_library(WX_mono${_DBG} NAMES + wxmsw${_UNV}31${_UCD}${_DBG} wxmsw${_UNV}30${_UCD}${_DBG} wxmsw${_UNV}29${_UCD}${_DBG} wxmsw${_UNV}28${_UCD}${_DBG} @@ -346,6 +349,7 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32") stc ribbon propgrid webview) find_library(WX_${LIB}${_DBG} NAMES + wxmsw${_UNV}31${_UCD}${_DBG}_${LIB} wxmsw${_UNV}30${_UCD}${_DBG}_${LIB} wxmsw${_UNV}29${_UCD}${_DBG}_${LIB} wxmsw${_UNV}28${_UCD}${_DBG}_${LIB} @@ -386,7 +390,7 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32") # Clear wxWidgets multilib libraries. foreach(LIB core adv aui html media xrc dbgrid gl qa richtext - stc ribbon propgrid) + webview stc ribbon propgrid) WX_CLEAR_LIB(WX_${LIB}${_DBG}) endforeach() endmacro() @@ -741,7 +745,7 @@ else() #----------------------------------------------------------------- # Support cross-compiling, only search in the target platform. find_program(wxWidgets_CONFIG_EXECUTABLE - NAMES wx-config wx-config-3.0 wx-config-2.9 wx-config-2.8 + NAMES wx-config wx-config-3.1 wx-config-3.0 wx-config-2.9 wx-config-2.8 DOC "Location of wxWidgets library configuration provider binary (wx-config)." ONLY_CMAKE_FIND_ROOT_PATH ) @@ -857,6 +861,28 @@ else() endif() endif() +# Check if a specfic version was requested by find_package(). +if(wxWidgets_FOUND) + find_file(_filename wx/version.h PATHS ${wxWidgets_INCLUDE_DIRS} NO_DEFAULT_PATH) + dbg_msg("_filename: ${_filename}") + + if(NOT _filename) + message(FATAL_ERROR "wxWidgets wx/version.h file not found in ${wxWidgets_INCLUDE_DIRS}.") + endif() + + file(READ ${_filename} _wx_version_h) + + string(REGEX REPLACE "^(.*\n)?#define +wxMAJOR_VERSION +([0-9]+).*" + "\\2" wxWidgets_VERSION_MAJOR "${_wx_version_h}" ) + string(REGEX REPLACE "^(.*\n)?#define +wxMINOR_VERSION +([0-9]+).*" + "\\2" wxWidgets_VERSION_MINOR "${_wx_version_h}" ) + string(REGEX REPLACE "^(.*\n)?#define +wxRELEASE_NUMBER +([0-9]+).*" + "\\2" wxWidgets_VERSION_PATCH "${_wx_version_h}" ) + set(wxWidgets_VERSION_STRING + "${wxWidgets_VERSION_MAJOR}.${wxWidgets_VERSION_MINOR}.${wxWidgets_VERSION_PATCH}" ) + dbg_msg("wxWidgets_VERSION_STRING: ${wxWidgets_VERSION_STRING}") +endif() + # Debug output: DBG_MSG("wxWidgets_FOUND : ${wxWidgets_FOUND}") DBG_MSG("wxWidgets_INCLUDE_DIRS : ${wxWidgets_INCLUDE_DIRS}") @@ -867,10 +893,13 @@ DBG_MSG("wxWidgets_USE_FILE : ${wxWidgets_USE_FILE}") #===================================================================== #===================================================================== + include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(wxWidgets DEFAULT_MSG wxWidgets_FOUND) -# Maintain consistency with all other variables. -set(wxWidgets_FOUND ${WXWIDGETS_FOUND}) + +find_package_handle_standard_args(wxWidgets + REQUIRED_VARS wxWidgets_LIBRARIES wxWidgets_INCLUDE_DIRS + VERSION_VAR wxWidgets_VERSION_STRING + ) #===================================================================== # Macros for use in wxWidgets apps. diff --git a/Modules/GNUInstallDirs.cmake b/Modules/GNUInstallDirs.cmake index c61e7e9a1..b42084eda 100644 --- a/Modules/GNUInstallDirs.cmake +++ b/Modules/GNUInstallDirs.cmake @@ -4,59 +4,104 @@ # # Define GNU standard installation directories # -# Provides install directory variables as defined for GNU software: +# Provides install directory variables as defined by the +# `GNU Coding Standards`_. # -# http://www.gnu.org/prep/standards/html_node/Directory-Variables.html +# .. _`GNU Coding Standards`: https://www.gnu.org/prep/standards/html_node/Directory-Variables.html +# +# Result Variables +# ^^^^^^^^^^^^^^^^ # # Inclusion of this module defines the following variables: # # ``CMAKE_INSTALL_`` -# destination for files of a given type +# +# Destination for files of a given type. This value may be passed to +# the ``DESTINATION`` options of :command:`install` commands for the +# corresponding file type. +# # ``CMAKE_INSTALL_FULL_`` -# corresponding absolute path # -# where is one of: +# The absolute path generated from the corresponding ``CMAKE_INSTALL_`` +# value. If the value is not already an absolute path, an absolute path +# is constructed typically by prepending the value of the +# :variable:`CMAKE_INSTALL_PREFIX` variable. However, there are some +# `special cases`_ as documented below. +# +# where ```` is one of: # # ``BINDIR`` -# user executables (bin) +# user executables (``bin``) # ``SBINDIR`` -# system admin executables (sbin) +# system admin executables (``sbin``) # ``LIBEXECDIR`` -# program executables (libexec) +# program executables (``libexec``) # ``SYSCONFDIR`` -# read-only single-machine data (etc) +# read-only single-machine data (``etc``) # ``SHAREDSTATEDIR`` -# modifiable architecture-independent data (com) +# modifiable architecture-independent data (``com``) # ``LOCALSTATEDIR`` -# modifiable single-machine data (var) +# modifiable single-machine data (``var``) # ``LIBDIR`` -# object code libraries (lib or lib64 or lib/ on Debian) +# object code libraries (``lib`` or ``lib64`` +# or ``lib/`` on Debian) # ``INCLUDEDIR`` -# C header files (include) +# C header files (``include``) # ``OLDINCLUDEDIR`` -# C header files for non-gcc (/usr/include) +# C header files for non-gcc (``/usr/include``) # ``DATAROOTDIR`` -# read-only architecture-independent data root (share) +# read-only architecture-independent data root (``share``) # ``DATADIR`` -# read-only architecture-independent data (DATAROOTDIR) +# read-only architecture-independent data (``DATAROOTDIR``) # ``INFODIR`` -# info documentation (DATAROOTDIR/info) +# info documentation (``DATAROOTDIR/info``) # ``LOCALEDIR`` -# locale-dependent data (DATAROOTDIR/locale) +# locale-dependent data (``DATAROOTDIR/locale``) # ``MANDIR`` -# man documentation (DATAROOTDIR/man) +# man documentation (``DATAROOTDIR/man``) # ``DOCDIR`` -# documentation root (DATAROOTDIR/doc/PROJECT_NAME) +# documentation root (``DATAROOTDIR/doc/PROJECT_NAME``) +# +# If the includer does not define a value the above-shown default will be +# used and the value will appear in the cache for editing by the user. +# +# Special Cases +# ^^^^^^^^^^^^^ +# +# The following values of :variable:`CMAKE_INSTALL_PREFIX` are special: +# +# ``/`` +# +# For ```` other than the ``SYSCONFDIR`` and ``LOCALSTATEDIR``, +# the value of ``CMAKE_INSTALL_`` is prefixed with ``usr/`` if +# it is not user-specified as an absolute path. For example, the +# ``INCLUDEDIR`` value ``include`` becomes ``usr/include``. +# This is required by the `GNU Coding Standards`_, which state: +# +# When building the complete GNU system, the prefix will be empty +# and ``/usr`` will be a symbolic link to ``/``. +# +# ``/usr`` # -# Each CMAKE_INSTALL_ value may be passed to the DESTINATION -# options of install() commands for the corresponding file type. If the -# includer does not define a value the above-shown default will be used -# and the value will appear in the cache for editing by the user. Each -# CMAKE_INSTALL_FULL_ value contains an absolute path constructed -# from the corresponding destination by prepending (if necessary) the -# value of CMAKE_INSTALL_PREFIX. +# For ```` equal to ``SYSCONFDIR`` or ``LOCALSTATEDIR``, the +# ``CMAKE_INSTALL_FULL_`` is computed by prepending just ``/`` +# to the value of ``CMAKE_INSTALL_`` if it is not user-specified +# as an absolute path. For example, the ``SYSCONFDIR`` value ``etc`` +# becomes ``/etc``. This is required by the `GNU Coding Standards`_. +# +# ``/opt/...`` +# +# For ```` equal to ``SYSCONFDIR`` or ``LOCALSTATEDIR``, the +# ``CMAKE_INSTALL_FULL_`` is computed by *appending* the prefix +# to the value of ``CMAKE_INSTALL_`` if it is not user-specified +# as an absolute path. For example, the ``SYSCONFDIR`` value ``etc`` +# becomes ``/etc/opt/...``. This is defined by the +# `Filesystem Hierarchy Standard`_. +# +# .. _`Filesystem Hierarchy Standard`: https://refspecs.linuxfoundation.org/FHS_3.0/fhs/index.html #============================================================================= +# Copyright 2015 Alex Turbov # Copyright 2011 Nikita Krupen'ko # Copyright 2011 Kitware, Inc. # @@ -274,8 +319,35 @@ foreach(dir MANDIR DOCDIR ) - if(NOT IS_ABSOLUTE ${CMAKE_INSTALL_${dir}}) - set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}") + if(NOT IS_ABSOLUTE "${CMAKE_INSTALL_${dir}}") + # Handle special cases: + # - CMAKE_INSTALL_PREFIX == / + # - CMAKE_INSTALL_PREFIX == /usr + # - CMAKE_INSTALL_PREFIX == /opt/... + if("${CMAKE_INSTALL_PREFIX}" STREQUAL "/") + if("${dir}" STREQUAL "SYSCONFDIR" OR "${dir}" STREQUAL "LOCALSTATEDIR") + set(CMAKE_INSTALL_FULL_${dir} "/${CMAKE_INSTALL_${dir}}") + else() + if (NOT "${CMAKE_INSTALL_${dir}}" MATCHES "^usr/") + set(CMAKE_INSTALL_${dir} "usr/${CMAKE_INSTALL_${dir}}") + endif() + set(CMAKE_INSTALL_FULL_${dir} "/${CMAKE_INSTALL_${dir}}") + endif() + elseif("${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/?$") + if("${dir}" STREQUAL "SYSCONFDIR" OR "${dir}" STREQUAL "LOCALSTATEDIR") + set(CMAKE_INSTALL_FULL_${dir} "/${CMAKE_INSTALL_${dir}}") + else() + set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}") + endif() + elseif("${CMAKE_INSTALL_PREFIX}" MATCHES "^/opt/.*") + if("${dir}" STREQUAL "SYSCONFDIR" OR "${dir}" STREQUAL "LOCALSTATEDIR") + set(CMAKE_INSTALL_FULL_${dir} "/${CMAKE_INSTALL_${dir}}${CMAKE_INSTALL_PREFIX}") + else() + set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}") + endif() + else() + set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}") + endif() else() set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_${dir}}") endif() diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake index aab29eac4..82054256a 100644 --- a/Modules/GenerateExportHeader.cmake +++ b/Modules/GenerateExportHeader.cmake @@ -268,7 +268,7 @@ macro(_DO_SET_MACRO_VALUES TARGET_LIBRARY) get_property(type TARGET ${TARGET_LIBRARY} PROPERTY TYPE) if(NOT ${type} STREQUAL "STATIC_LIBRARY") - if(WIN32) + if(WIN32 OR CYGWIN) set(DEFINE_EXPORT "__declspec(dllexport)") set(DEFINE_IMPORT "__declspec(dllimport)") elseif(COMPILER_HAS_HIDDEN_VISIBILITY AND USE_COMPILER_HIDDEN_VISIBILITY) diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index 23d486ead..e4018b670 100644 --- a/Modules/GetPrerequisites.cmake +++ b/Modules/GetPrerequisites.cmake @@ -229,9 +229,14 @@ function(is_file_executable file result_var) if(file_cmd) execute_process(COMMAND "${file_cmd}" "${file_full}" + RESULT_VARIABLE file_rv OUTPUT_VARIABLE file_ov + ERROR_VARIABLE file_ev OUTPUT_STRIP_TRAILING_WHITESPACE ) + if(NOT file_rv STREQUAL "0") + message(FATAL_ERROR "${file_cmd} failed: ${file_rv}\n${file_ev}") + endif() # Replace the name of the file in the output with a placeholder token # (the string " _file_full_ ") so that just in case the path name of @@ -543,11 +548,21 @@ function(gp_resolved_file_type original_file file exepath dirs type_var) if(CYGPATH_EXECUTABLE) execute_process(COMMAND ${CYGPATH_EXECUTABLE} -W + RESULT_VARIABLE env_rv OUTPUT_VARIABLE env_windir + ERROR_VARIABLE env_ev OUTPUT_STRIP_TRAILING_WHITESPACE) + if(NOT env_rv STREQUAL "0") + message(FATAL_ERROR "${CYGPATH_EXECUTABLE} -W failed: ${env_rv}\n${env_ev}") + endif() execute_process(COMMAND ${CYGPATH_EXECUTABLE} -S + RESULT_VARIABLE env_rv OUTPUT_VARIABLE env_sysdir + ERROR_VARIABLE env_ev OUTPUT_STRIP_TRAILING_WHITESPACE) + if(NOT env_rv STREQUAL "0") + message(FATAL_ERROR "${CYGPATH_EXECUTABLE} -S failed: ${env_rv}\n${env_ev}") + endif() string(TOLOWER "${env_windir}" windir) string(TOLOWER "${env_sysdir}" sysroot) @@ -685,6 +700,8 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa return() endif() + set(gp_cmd_maybe_filter) # optional command to pre-filter gp_tool results + if(gp_tool STREQUAL "ldd") set(gp_cmd_args "") set(gp_regex "^[\t ]*[^\t ]+ => ([^\t\(]+) .*${eol_char}$") @@ -709,6 +726,11 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa set(gp_regex_error "") set(gp_regex_fallback "") set(gp_regex_cmp_count 1) + # objdump generaates copious output so we create a grep filter to pre-filter results + find_program(gp_grep_cmd grep) + if(gp_grep_cmd) + set(gp_cmd_maybe_filter COMMAND ${gp_grep_cmd} "^[[:blank:]]*DLL Name: ") + endif() else() message(STATUS "warning: gp_tool='${gp_tool}' is an unknown tool...") message(STATUS "CMake function get_prerequisites needs more code to handle '${gp_tool}'") @@ -765,8 +787,19 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa # execute_process( COMMAND ${gp_cmd} ${gp_cmd_args} ${target} + ${gp_cmd_maybe_filter} + RESULT_VARIABLE gp_rv OUTPUT_VARIABLE gp_cmd_ov + ERROR_VARIABLE gp_ev ) + if(NOT gp_rv STREQUAL "0") + if(gp_tool STREQUAL "dumpbin") + # dumpbin error messages seem to go to stdout + message(FATAL_ERROR "${gp_cmd} failed: ${gp_rv}\n${gp_ev}\n${gp_cmd_ov}") + else() + message(FATAL_ERROR "${gp_cmd} failed: ${gp_rv}\n${gp_ev}") + endif() + endif() if(gp_tool STREQUAL "ldd") set(ENV{LD_LIBRARY_PATH} "${old_ld_env}") @@ -791,8 +824,13 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa if(gp_tool STREQUAL "otool") execute_process( COMMAND otool -D ${target} + RESULT_VARIABLE otool_rv OUTPUT_VARIABLE gp_install_id_ov + ERROR_VARIABLE otool_ev ) + if(NOT otool_rv STREQUAL "0") + message(FATAL_ERROR "otool -D failed: ${otool_rv}\n${otool_ev}") + endif() # second line is install name string(REGEX REPLACE ".*:\n" "" gp_install_id "${gp_install_id_ov}") if(gp_install_id) diff --git a/Modules/Internal/FeatureTesting.cmake b/Modules/Internal/FeatureTesting.cmake index abd9a2636..86b89b25c 100644 --- a/Modules/Internal/FeatureTesting.cmake +++ b/Modules/Internal/FeatureTesting.cmake @@ -5,7 +5,7 @@ macro(record_compiler_features lang compile_flags feature_list) string(TOLOWER ${lang} lang_lc) file(REMOVE "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.bin") file(WRITE "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.${lang_lc}" " - const char features[] = {\"\"\n") + const char features[] = {\"\\n\"\n") get_property(known_features GLOBAL PROPERTY CMAKE_${lang}_KNOWN_FEATURES) diff --git a/Modules/Platform/ARTOS-GNU-C.cmake b/Modules/Platform/ARTOS-GNU-C.cmake new file mode 100644 index 000000000..967d0e7c0 --- /dev/null +++ b/Modules/Platform/ARTOS-GNU-C.cmake @@ -0,0 +1,9 @@ +# Define ARTOS to select proper behaviour and tell preprocessor to accept C++ style comments. +set(CMAKE_C_FLAGS_INIT "-DARTOS -Xp -+") +# ac doesn't support -g properly and doesn't support the normal gcc optimization options. Just use the defaults set by ac. +set(CMAKE_C_FLAGS_DEBUG_INIT "") +set(CMAKE_C_FLAGS_MINSIZEREL_INIT "-DNDEBUG") +set(CMAKE_C_FLAGS_RELEASE_INIT "-DNDEBUG") +set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-DNDEBUG") +# Most projects expect the stdio functions to be available. +set(CMAKE_C_STANDARD_LIBRARIES_INIT "stdio.a") diff --git a/Modules/Platform/ARTOS.cmake b/Modules/Platform/ARTOS.cmake new file mode 100644 index 000000000..f9365d6ce --- /dev/null +++ b/Modules/Platform/ARTOS.cmake @@ -0,0 +1,17 @@ +# Support for ARTOS RTOS (locamation.com) +set(CMAKE_LINK_LIBRARY_SUFFIX "") +set(CMAKE_STATIC_LIBRARY_PREFIX "") +set(CMAKE_STATIC_LIBRARY_SUFFIX ".a") +set(CMAKE_SHARED_LIBRARY_PREFIX "") +set(CMAKE_SHARED_LIBRARY_SUFFIX ".a") +set(CMAKE_EXECUTABLE_SUFFIX ".x") +set(CMAKE_DL_LIBS "") + +set(CMAKE_FIND_LIBRARY_PREFIXES "") +set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") + +# ARTOS does not support shared libs +set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) + +set(CMAKE_C_LINK_SHARED_LIBRARY ) +set(CMAKE_C_LINK_MODULE_LIBRARY ) diff --git a/Modules/Platform/BlueGeneQ-base.cmake b/Modules/Platform/BlueGeneQ-base.cmake index fa8dc521b..9372166e8 100644 --- a/Modules/Platform/BlueGeneQ-base.cmake +++ b/Modules/Platform/BlueGeneQ-base.cmake @@ -112,8 +112,8 @@ macro(__BlueGeneQ_common_setup compiler_id lang) foreach(dir ${CMAKE_SYSTEM_INCLUDE_PATH}) set(BGQ_SYSTEM_INCLUDES "${BGQ_SYSTEM_INCLUDES} -I${dir}") endforeach() - set(CMAKE_C_COMPILE_OBJECT " ${BGQ_SYSTEM_INCLUDES} -o -c ") - set(CMAKE_CXX_COMPILE_OBJECT " ${BGQ_SYSTEM_INCLUDES} -o -c ") + set(CMAKE_C_COMPILE_OBJECT " ${BGQ_SYSTEM_INCLUDES} -o -c ") + set(CMAKE_CXX_COMPILE_OBJECT " ${BGQ_SYSTEM_INCLUDES} -o -c ") # # Code below does setup for shared libraries. That this is done diff --git a/Modules/Platform/CYGWIN-windres.cmake b/Modules/Platform/CYGWIN-windres.cmake index 01d6be3df..7d787dddf 100644 --- a/Modules/Platform/CYGWIN-windres.cmake +++ b/Modules/Platform/CYGWIN-windres.cmake @@ -1 +1 @@ -set(CMAKE_RC_COMPILE_OBJECT " -O coff ") +set(CMAKE_RC_COMPILE_OBJECT " -O coff ") diff --git a/Modules/Platform/Darwin-Initialize.cmake b/Modules/Platform/Darwin-Initialize.cmake index 62fb98567..a08411bcc 100644 --- a/Modules/Platform/Darwin-Initialize.cmake +++ b/Modules/Platform/Darwin-Initialize.cmake @@ -100,6 +100,10 @@ elseif("${CMAKE_GENERATOR}" MATCHES Xcode "Instead using SDK:\n \"${_CMAKE_OSX_SYSROOT_DEFAULT}\"." ) endif() + if(NOT CMAKE_OSX_DEPLOYMENT_TARGET AND _CURRENT_OSX_VERSION VERSION_LESS _CMAKE_OSX_DEPLOYMENT_TARGET) + set(CMAKE_OSX_DEPLOYMENT_TARGET ${_CURRENT_OSX_VERSION} CACHE STRING + "Minimum OS X version to target for deployment (at runtime); newer APIs weak linked. Set to empty string for default value." FORCE) + endif() else() # Assume developer files are in root (such as Xcode 4.5 command-line tools). set(_CMAKE_OSX_SYSROOT_DEFAULT "") diff --git a/Modules/Platform/Darwin-NAG-Fortran.cmake b/Modules/Platform/Darwin-NAG-Fortran.cmake index 4c28e625c..e3ac9b51f 100644 --- a/Modules/Platform/Darwin-NAG-Fortran.cmake +++ b/Modules/Platform/Darwin-NAG-Fortran.cmake @@ -16,7 +16,7 @@ set(CMAKE_Fortran_VERBOSE_FLAG "-Wl,-v") # Runs gcc under the hood. # Need -fpp explicitly on case-insensitive filesystem. set(CMAKE_Fortran_COMPILE_OBJECT - " -fpp -o -c ") + " -fpp -o -c ") set(CMAKE_Fortran_OSX_COMPATIBILITY_VERSION_FLAG "-Wl,-compatibility_version -Wl,") set(CMAKE_Fortran_OSX_CURRENT_VERSION_FLAG "-Wl,-current_version -Wl,") diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index 4e4810a2a..bb085ac7c 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -53,7 +53,7 @@ set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-dynamiclib -Wl,-headerpad_max_install_ set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -Wl,-headerpad_max_install_names") set(CMAKE_SHARED_MODULE_LOADER_C_FLAG "-Wl,-bundle_loader,") set(CMAKE_SHARED_MODULE_LOADER_CXX_FLAG "-Wl,-bundle_loader,") -set(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".so" ".a") +set(CMAKE_FIND_LIBRARY_SUFFIXES ".tbd" ".dylib" ".so" ".a") # hack: if a new cmake (which uses CMAKE_INSTALL_NAME_TOOL) runs on an old build tree # (where install_name_tool was hardcoded) and where CMAKE_INSTALL_NAME_TOOL isn't in the cache diff --git a/Modules/Platform/Euros.cmake b/Modules/Platform/Euros.cmake new file mode 100644 index 000000000..4c7b18277 --- /dev/null +++ b/Modules/Platform/Euros.cmake @@ -0,0 +1,19 @@ +# Support for EUROS RTOS (euros-embedded.com) +set(CMAKE_LINK_LIBRARY_SUFFIX "") +set(CMAKE_STATIC_LIBRARY_PREFIX "") +set(CMAKE_STATIC_LIBRARY_SUFFIX ".lib") +set(CMAKE_SHARED_LIBRARY_PREFIX "") +set(CMAKE_SHARED_LIBRARY_SUFFIX ".lib") +set(CMAKE_EXECUTABLE_SUFFIX ".elf") +set(CMAKE_DL_LIBS "") + +set(CMAKE_FIND_LIBRARY_PREFIXES "") +set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib") + +# EUROS RTOS does not support shared libs +set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) + +set(CMAKE_CXX_LINK_SHARED_LIBRARY ) +set(CMAKE_CXX_LINK_MODULE_LIBRARY ) +set(CMAKE_C_LINK_SHARED_LIBRARY ) +set(CMAKE_C_LINK_MODULE_LIBRARY ) diff --git a/Modules/Platform/GHS-MULTI-Initialize.cmake b/Modules/Platform/GHS-MULTI-Initialize.cmake index 342ad21b4..9eb7a8abe 100644 --- a/Modules/Platform/GHS-MULTI-Initialize.cmake +++ b/Modules/Platform/GHS-MULTI-Initialize.cmake @@ -13,13 +13,35 @@ # License text for the above reference.) #Setup Greenhills MULTI specific compilation information -find_path(GHS_INT_DIRECTORY INTEGRITY.ld PATHS - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\GreenHillsSoftware6433c345;InstallLocation]" #int1122 - "C:/ghs/int1122" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\GreenHillsSoftware289b6625;InstallLocation]" #int1104 - "C:/ghs/int1104" - DOC "Path to integrity directory" - ) + +if (NOT GHS_INT_DIRECTORY) + #Assume the C:/ghs/int#### directory that is latest is prefered + set(GHS_EXPECTED_ROOT "C:/ghs") + if (EXISTS ${GHS_EXPECTED_ROOT}) + FILE(GLOB GHS_CANDIDATE_INT_DIRS RELATIVE + ${GHS_EXPECTED_ROOT} ${GHS_EXPECTED_ROOT}/*) + string(REGEX MATCHALL "int[0-9][0-9][0-9][0-9]" GHS_CANDIDATE_INT_DIRS + ${GHS_CANDIDATE_INT_DIRS}) + if (GHS_CANDIDATE_INT_DIRS) + list(SORT GHS_CANDIDATE_INT_DIRS) + list(GET GHS_CANDIDATE_INT_DIRS -1 GHS_INT_DIRECTORY) + string(CONCAT GHS_INT_DIRECTORY ${GHS_EXPECTED_ROOT} "/" + ${GHS_INT_DIRECTORY}) + endif () + endif () + + #Try to look for known registry values + if (NOT GHS_INT_DIRECTORY) + find_path(GHS_INT_DIRECTORY INTEGRITY.ld PATHS + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\GreenHillsSoftware6433c345;InstallLocation]" #int1122 + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\GreenHillsSoftware289b6625;InstallLocation]" #int1104 + ) + endif () + + set(GHS_INT_DIRECTORY ${GHS_INT_DIRECTORY} CACHE PATH + "Path to integrity directory") +endif () + set(GHS_OS_DIR ${GHS_INT_DIRECTORY} CACHE PATH "OS directory") set(GHS_PRIMARY_TARGET "arm_integrity.tgt" CACHE STRING "target for compilation") set(GHS_BSP_NAME "simarm" CACHE STRING "BSP name") diff --git a/Modules/Platform/Generic-SDCC-C.cmake b/Modules/Platform/Generic-SDCC-C.cmake index 588bf32d9..a1ca81243 100644 --- a/Modules/Platform/Generic-SDCC-C.cmake +++ b/Modules/Platform/Generic-SDCC-C.cmake @@ -38,7 +38,7 @@ if(NOT DEFINED CMAKE_EXE_LINKER_FLAGS_INIT) endif() # compile a C file into an object file -set(CMAKE_C_COMPILE_OBJECT " -o -c ") +set(CMAKE_C_COMPILE_OBJECT " -o -c ") # link object files to an executable set(CMAKE_C_LINK_EXECUTABLE " --out-fmt-ihx -o ") diff --git a/Modules/Platform/HP-UX-HP-C.cmake b/Modules/Platform/HP-UX-HP-C.cmake index 100093590..7610383d3 100644 --- a/Modules/Platform/HP-UX-HP-C.cmake +++ b/Modules/Platform/HP-UX-HP-C.cmake @@ -1,6 +1,6 @@ include(Platform/HP-UX-HP) __hpux_compiler_hp(C) -set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") -set(CMAKE_C_CREATE_ASSEMBLY_SOURCE " -S -o ") -set(CMAKE_C_COMPILE_OBJECT " -Aa -Ae -o -c ") +set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") +set(CMAKE_C_CREATE_ASSEMBLY_SOURCE " -S -o ") +set(CMAKE_C_COMPILE_OBJECT " -Aa -Ae -o -c ") diff --git a/Modules/Platform/HP-UX-HP-CXX.cmake b/Modules/Platform/HP-UX-HP-CXX.cmake index dfa1e4e45..6d90191cb 100644 --- a/Modules/Platform/HP-UX-HP-CXX.cmake +++ b/Modules/Platform/HP-UX-HP-CXX.cmake @@ -1,9 +1,9 @@ include(Platform/HP-UX-HP) __hpux_compiler_hp(CXX) -set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") +set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE - " -S " + " -S " "mv `basename \"\" | sed 's/\\.[^./]*$$//'`.s " "rm -f `basename \"\" | sed 's/\\.[^./]*$$//'`.o" ) diff --git a/Modules/Platform/HP-UX-HP-Fortran.cmake b/Modules/Platform/HP-UX-HP-Fortran.cmake index e5c5d10ea..12007e422 100644 --- a/Modules/Platform/HP-UX-HP-Fortran.cmake +++ b/Modules/Platform/HP-UX-HP-Fortran.cmake @@ -1,5 +1,5 @@ include(Platform/HP-UX-HP) __hpux_compiler_hp(Fortran) -set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE " -E > ") -set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE " -S -o ") +set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE " -E > ") +set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE " -S -o ") diff --git a/Modules/Platform/HP-UX.cmake b/Modules/Platform/HP-UX.cmake index 65cc7310d..88932ad67 100644 --- a/Modules/Platform/HP-UX.cmake +++ b/Modules/Platform/HP-UX.cmake @@ -1,9 +1,11 @@ set(CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH /usr/lib) -set(CMAKE_SHARED_LIBRARY_SUFFIX ".sl") # .so +if(NOT CMAKE_SYSTEM_PROCESSOR STREQUAL "ia64") + set(CMAKE_SHARED_LIBRARY_SUFFIX ".sl") # .so + set(CMAKE_FIND_LIBRARY_SUFFIXES ".sl" ".so" ".a") + set(CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES ".so") +endif() set(CMAKE_DL_LIBS "dld") -set(CMAKE_FIND_LIBRARY_SUFFIXES ".sl" ".so" ".a") -set(CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES ".so") # The HP linker needs to find transitive shared library dependencies # in the -L path. Therefore the runtime path must be added to the @@ -33,18 +35,11 @@ list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES # Initialize C and CXX link type selection flags. These flags are # used when building a shared library, shared module, or executable # that links to other libraries to select whether to use the static or -# shared versions of the libraries. Note that C modules and shared -# libs are built using ld directly so we leave off the "-Wl," portion. -foreach(type SHARED_LIBRARY SHARED_MODULE) - set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-a archive") - set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-a default") -endforeach() -foreach(type EXE) - set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-a,archive") - set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-a,default") -endforeach() +# shared versions of the libraries. foreach(type SHARED_LIBRARY SHARED_MODULE EXE) - set(CMAKE_${type}_LINK_STATIC_CXX_FLAGS "-Wl,-a,archive") - set(CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS "-Wl,-a,default") + foreach(lang C CXX) + set(CMAKE_${type}_LINK_STATIC_${lang}_FLAGS "-Wl,-a,archive") + set(CMAKE_${type}_LINK_DYNAMIC_${lang}_FLAGS "-Wl,-a,default") + endforeach() endforeach() diff --git a/Modules/Platform/IRIX64.cmake b/Modules/Platform/IRIX64.cmake index 5acbd81fa..ee9b96e89 100644 --- a/Modules/Platform/IRIX64.cmake +++ b/Modules/Platform/IRIX64.cmake @@ -44,17 +44,17 @@ endif() include(Platform/UnixPaths) if(NOT CMAKE_COMPILER_IS_GNUCC) - set (CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") + set (CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") set (CMAKE_C_CREATE_ASSEMBLY_SOURCE - " -S " + " -S " "mv `basename \"\" | sed 's/\\.[^./]*$$//'`.s " ) endif() if(NOT CMAKE_COMPILER_IS_GNUCXX) - set (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") + set (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") set (CMAKE_CXX_CREATE_ASSEMBLY_SOURCE - " -S " + " -S " "mv `basename \"\" | sed 's/\\.[^./]*$$//'`.s " ) endif() diff --git a/Modules/Platform/Linux-CCur-Fortran.cmake b/Modules/Platform/Linux-CCur-Fortran.cmake new file mode 100644 index 000000000..ceecc2f69 --- /dev/null +++ b/Modules/Platform/Linux-CCur-Fortran.cmake @@ -0,0 +1 @@ +include(Platform/Linux-GNU-Fortran) diff --git a/Modules/Platform/Linux-GNU-Fortran.cmake b/Modules/Platform/Linux-GNU-Fortran.cmake index 68e95404b..85e12265a 100644 --- a/Modules/Platform/Linux-GNU-Fortran.cmake +++ b/Modules/Platform/Linux-GNU-Fortran.cmake @@ -1,2 +1,3 @@ include(Platform/Linux-GNU) __linux_compiler_gnu(Fortran) +set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "") diff --git a/Modules/Platform/SunOS.cmake b/Modules/Platform/SunOS.cmake index aaa79c449..77946f2aa 100644 --- a/Modules/Platform/SunOS.cmake +++ b/Modules/Platform/SunOS.cmake @@ -7,14 +7,6 @@ if(CMAKE_SYSTEM MATCHES "SunOS-4") set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") endif() -if(CMAKE_COMPILER_IS_GNUCXX) - if(CMAKE_COMPILER_IS_GNUCC) - set(CMAKE_CXX_CREATE_SHARED_LIBRARY - " -o ") - else() - # Take default rule from CMakeDefaultMakeRuleVariables.cmake. - endif() -endif() include(Platform/UnixPaths) # Add the compiler's implicit link directories. diff --git a/Modules/Platform/Windows-Embarcadero.cmake b/Modules/Platform/Windows-Embarcadero.cmake index 26b3c0cab..5295a48e6 100644 --- a/Modules/Platform/Windows-Embarcadero.cmake +++ b/Modules/Platform/Windows-Embarcadero.cmake @@ -74,6 +74,12 @@ set (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT}) set (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT}) set (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT}) +# The Borland link tool does not support multiple concurrent +# invocations within a single working directory. +if(NOT DEFINED CMAKE_JOB_POOL_LINK) + set(CMAKE_JOB_POOL_LINK BCC32LinkPool) + set_property(GLOBAL APPEND PROPERTY JOB_POOLS BCC32LinkPool=1) +endif() macro(__embarcadero_language lang) set(CMAKE_${lang}_COMPILE_OPTIONS_DLL "${_tD}") # Note: This variable is a ';' separated list @@ -84,7 +90,7 @@ macro(__embarcadero_language lang) # place outside the response file because Borland refuses # to parse quotes from the response file. set(CMAKE_${lang}_COMPILE_OBJECT - " ${_tR} -DWIN32 -o ${_COMPILE_${lang}} " + " ${_tR} -DWIN32 -o ${_COMPILE_${lang}} " ) set(CMAKE_${lang}_LINK_EXECUTABLE @@ -95,7 +101,7 @@ macro(__embarcadero_language lang) # place outside the response file because Borland refuses # to parse quotes from the response file. set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE - "cpp32 -DWIN32 -o ${_COMPILE_${lang}} " + "cpp32 -DWIN32 -o ${_COMPILE_${lang}} " ) # Borland >= 5.6 allows -P option for cpp32, <= 5.5 does not diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake index b97409c50..d8a423e55 100644 --- a/Modules/Platform/Windows-GNU.cmake +++ b/Modules/Platform/Windows-GNU.cmake @@ -65,7 +65,7 @@ macro(__windows_compiler_gnu lang) if(MSYS OR MINGW) # Create archiving rules to support large object file lists for static libraries. - set(CMAKE_${lang}_ARCHIVE_CREATE " cq ") + set(CMAKE_${lang}_ARCHIVE_CREATE " qc ") set(CMAKE_${lang}_ARCHIVE_APPEND " q ") set(CMAKE_${lang}_ARCHIVE_FINISH " ") diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index 13fe8bc9c..b421b0d6f 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -46,8 +46,10 @@ else() set(_PLATFORM_LINK_FLAGS "") endif() +set(CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS 1) if(CMAKE_GENERATOR MATCHES "Visual Studio 6") set (CMAKE_NO_BUILD_TYPE 1) + set(CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS 0) # not implemented for VS6 endif() if(NOT CMAKE_NO_BUILD_TYPE AND CMAKE_GENERATOR MATCHES "Visual Studio") set (CMAKE_NO_BUILD_TYPE 1) @@ -177,7 +179,9 @@ elseif(WINDOWS_PHONE OR WINDOWS_STORE) set(_PLATFORM_DEFINES "/DWIN32") set(_FLAGS_C " /DUNICODE /D_UNICODE") set(_FLAGS_CXX " /DUNICODE /D_UNICODE /GR /EHsc") - if(WINDOWS_PHONE) + if(WINDOWS_STORE AND MSVC_VERSION GREATER 1899) + set(CMAKE_C_STANDARD_LIBRARIES_INIT "WindowsApp.lib") + elseif(WINDOWS_PHONE) set(CMAKE_C_STANDARD_LIBRARIES_INIT "WindowsPhoneCore.lib RuntimeObject.lib PhoneAppModelHost.lib") elseif(_MSVC_C_ARCHITECTURE_FAMILY STREQUAL "ARM" OR _MSVC_CXX_ARCHITECTURE_FAMILY STREQUAL "ARM") set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib") @@ -230,6 +234,7 @@ elseif(MSVC_Fortran_ARCHITECTURE_ID) set(_MACHINE_ARCH_FLAG "/machine:${MSVC_Fortran_ARCHITECTURE_ID}") endif() set(CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} ${_MACHINE_ARCH_FLAG}") +set(CMAKE_STATIC_LINKER_FLAGS_INIT "${CMAKE_STATIC_LINKER_FLAGS_INIT} ${_MACHINE_ARCH_FLAG}") unset(_MACHINE_ARCH_FLAG) # add /debug and /INCREMENTAL:YES to DEBUG and RELWITHDEBINFO also add pdbtype @@ -271,8 +276,8 @@ set (CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZER macro(__windows_compiler_msvc lang) if(NOT MSVC_VERSION LESS 1400) # for 2005 make sure the manifest is put in the dll with mt - set(_CMAKE_VS_LINK_DLL " -E vs_link_dll ") - set(_CMAKE_VS_LINK_EXE " -E vs_link_exe ") + set(_CMAKE_VS_LINK_DLL " -E vs_link_dll --intdir= --manifests -- ") + set(_CMAKE_VS_LINK_EXE " -E vs_link_exe --intdir= --manifests -- ") endif() set(CMAKE_${lang}_CREATE_SHARED_LIBRARY "${_CMAKE_VS_LINK_DLL} ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /out: /implib: /pdb: /dll /version:.${_PLATFORM_LINK_FLAGS} ${CMAKE_END_TEMP_FILE}") @@ -281,11 +286,11 @@ macro(__windows_compiler_msvc lang) set(CMAKE_${lang}_CREATE_STATIC_LIBRARY " /lib ${CMAKE_CL_NOLOGO} /out: ") set(CMAKE_${lang}_COMPILE_OBJECT - " ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} /Fo /Fd${_FS_${lang}} -c ${CMAKE_END_TEMP_FILE}") + " ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} /Fo /Fd${_FS_${lang}} -c ${CMAKE_END_TEMP_FILE}") set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE - " > ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} -E ${CMAKE_END_TEMP_FILE}") + " > ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} -E ${CMAKE_END_TEMP_FILE}") set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE - " ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} /FoNUL /FAs /Fa /c ${CMAKE_END_TEMP_FILE}") + " ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} /FoNUL /FAs /Fa /c ${CMAKE_END_TEMP_FILE}") set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS 1) set(CMAKE_${lang}_LINK_EXECUTABLE diff --git a/Modules/Platform/Windows-wcl386.cmake b/Modules/Platform/Windows-wcl386.cmake index 88f9bf712..3bc54449e 100644 --- a/Modules/Platform/Windows-wcl386.cmake +++ b/Modules/Platform/Windows-wcl386.cmake @@ -58,19 +58,19 @@ set(CMAKE_CXX_LINK_EXECUTABLE ${CMAKE_C_LINK_EXECUTABLE}) # compile a C++ file into an object file set(CMAKE_CXX_COMPILE_OBJECT - " ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ -fo -c -cc++ ${CMAKE_END_TEMP_FILE}") + " ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ -fo -c -cc++ ${CMAKE_END_TEMP_FILE}") # compile a C file into an object file set(CMAKE_C_COMPILE_OBJECT - " ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ -fo -c -cc ${CMAKE_END_TEMP_FILE}") + " ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ -fo -c -cc ${CMAKE_END_TEMP_FILE}") # preprocess a C source file set(CMAKE_C_CREATE_PREPROCESSED_SOURCE - " ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ -fo -pl -cc ${CMAKE_END_TEMP_FILE}") + " ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ -fo -pl -cc ${CMAKE_END_TEMP_FILE}") # preprocess a C++ source file set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE - " ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ -fo -pl -cc++ ${CMAKE_END_TEMP_FILE}") + " ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ -fo -pl -cc++ ${CMAKE_END_TEMP_FILE}") set(CMAKE_CXX_CREATE_SHARED_LIBRARY "wlink ${CMAKE_START_TEMP_FILE} ${CMAKE_WLINK_QUIET} name option implib= file {} ${CMAKE_END_TEMP_FILE}") diff --git a/Modules/Platform/Windows-windres.cmake b/Modules/Platform/Windows-windres.cmake index 01d6be3df..7d787dddf 100644 --- a/Modules/Platform/Windows-windres.cmake +++ b/Modules/Platform/Windows-windres.cmake @@ -1 +1 @@ -set(CMAKE_RC_COMPILE_OBJECT " -O coff ") +set(CMAKE_RC_COMPILE_OBJECT " -O coff ") diff --git a/Modules/ProcessorCount.cmake b/Modules/ProcessorCount.cmake index 8f21adf98..2c5d5aeb1 100644 --- a/Modules/ProcessorCount.cmake +++ b/Modules/ProcessorCount.cmake @@ -171,17 +171,30 @@ function(ProcessorCount var) endif() if(NOT count) - # Sun (systems where uname -X emits "NumCPU" in its output): - find_program(ProcessorCount_cmd_uname uname) - mark_as_advanced(ProcessorCount_cmd_uname) - if(ProcessorCount_cmd_uname) - execute_process(COMMAND ${ProcessorCount_cmd_uname} -X + # Sun (systems where psrinfo tool is available) + find_program(ProcessorCount_cmd_psrinfo psrinfo PATHS /usr/sbin /sbin) + mark_as_advanced(ProcessorCount_cmd_psrinfo) + if (ProcessorCount_cmd_psrinfo) + execute_process(COMMAND ${ProcessorCount_cmd_psrinfo} -p -v ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE - OUTPUT_VARIABLE uname_X_output) - string(REGEX MATCHALL "NumCPU = ([0-9]+)" procs "${uname_X_output}") + OUTPUT_VARIABLE psrinfo_output) + string(REGEX MATCH "([0-9]+) virtual processor" procs "${psrinfo_output}") set(count "${CMAKE_MATCH_1}") - #message("ProcessorCount: trying uname -X '${ProcessorCount_cmd_uname}'") + #message("ProcessorCount: trying psrinfo -p -v '${ProcessorCount_cmd_prvinfo}'") + else() + # Sun (systems where uname -X emits "NumCPU" in its output): + find_program(ProcessorCount_cmd_uname uname) + mark_as_advanced(ProcessorCount_cmd_uname) + if(ProcessorCount_cmd_uname) + execute_process(COMMAND ${ProcessorCount_cmd_uname} -X + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + OUTPUT_VARIABLE uname_X_output) + string(REGEX MATCHALL "NumCPU = ([0-9]+)" procs "${uname_X_output}") + set(count "${CMAKE_MATCH_1}") + #message("ProcessorCount: trying uname -X '${ProcessorCount_cmd_uname}'") + endif() endif() endif() diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake index 5eb0ca8c1..dced6eca8 100644 --- a/Modules/UseJava.cmake +++ b/Modules/UseJava.cmake @@ -21,7 +21,8 @@ # # This command creates a .jar. It compiles the given # source files (source) and adds the given resource files (resource) to -# the jar file. If only resource files are given then just a jar file +# the jar file. Source files can be java files or listing files +# (prefixed by '@'). If only resource files are given then just a jar file # is created. The list of include jars are added to the classpath when # compiling the java sources and also to the dependencies of the target. # INCLUDE_JARS also accepts other target names created by add_jar. For @@ -210,14 +211,16 @@ # # :: # -# install_jar(TARGET_NAME DESTINATION) +# install_jar(target_name destination) +# install_jar(target_name DESTINATION destination [COMPONENT component]) # # This command installs the TARGET_NAME files to the given DESTINATION. # It should be called in the same scope as add_jar() or it will fail. # # :: # -# install_jni_symlink(TARGET_NAME DESTINATION) +# install_jni_symlink(target_name destination) +# install_jni_symlink(target_name DESTINATION destination [COMPONENT component]) # # This command installs the TARGET_NAME JNI symlinks to the given # DESTINATION. It should be called in the same scope as add_jar() or it @@ -306,6 +309,65 @@ # # # if you don't set the INSTALLPATH. +# +# :: +# +# create_javah(TARGET +# GENERATED_FILES +# CLASSES ... +# [CLASSPATH ...] +# [DEPENDS ...] +# [OUTPUT_NAME |OUTPUT_DIR ] +# ) +# +# Create C header files from java classes. These files provide the connective glue +# that allow your Java and C code to interact. +# +# There are two main signatures for create_javah. The first signature +# returns generated files throught variable specified by GENERATED_FILES option: +# +# :: +# +# Example: +# Create_javah(GENERATED_FILES files_headers +# CLASSES org.cmake.HelloWorld +# CLASSPATH hello.jar +# ) +# +# +# +# The second signature for create_javah creates a target which encapsulates +# header files generation. +# +# :: +# +# Example: +# Create_javah(TARGET target_headers +# CLASSES org.cmake.HelloWorld +# CLASSPATH hello.jar +# ) +# +# +# +# Both signatures share same options. +# +# ``CLASSES ...`` +# Specifies Java classes used to generate headers. +# +# ``CLASSPATH ...`` +# Specifies various paths to look up classes. Here .class files, jar files or targets +# created by command add_jar can be used. +# +# ``DEPENDS ...`` +# Targets on which the javah target depends +# +# ``OUTPUT_NAME `` +# Concatenates the resulting header files for all the classes listed by option CLASSES +# into . Same behavior as option '-o' of javah tool. +# +# ``OUTPUT_DIR `` +# Sets the directory where the header files will be generated. Same behavior as option +# '-d' of javah tool. If not specified, ${CMAKE_CURRENT_BINARY_DIR} is used as output directory. #============================================================================= # Copyright 2013 OpenGamma Ltd. @@ -423,6 +485,7 @@ function(add_jar _TARGET_NAME) set(_JAVA_CLASS_FILES) set(_JAVA_COMPILE_FILES) + set(_JAVA_COMPILE_FILELISTS) set(_JAVA_DEPENDS) set(_JAVA_COMPILE_DEPENDS) set(_JAVA_RESOURCE_FILES) @@ -433,7 +496,11 @@ function(add_jar _TARGET_NAME) get_filename_component(_JAVA_PATH ${_JAVA_SOURCE_FILE} PATH) get_filename_component(_JAVA_FULL ${_JAVA_SOURCE_FILE} ABSOLUTE) - if (_JAVA_EXT MATCHES ".java") + if (_JAVA_SOURCE_FILE MATCHES "^@(.+)$") + get_filename_component(_JAVA_FULL ${CMAKE_MATCH_1} ABSOLUTE) + list(APPEND _JAVA_COMPILE_FILELISTS ${_JAVA_FULL}) + + elseif (_JAVA_EXT MATCHES ".java") file(RELATIVE_PATH _JAVA_REL_BINARY_PATH ${_add_jar_OUTPUT_DIR} ${_JAVA_FULL}) file(RELATIVE_PATH _JAVA_REL_SOURCE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${_JAVA_FULL}) string(LENGTH ${_JAVA_REL_BINARY_PATH} _BIN_LEN) @@ -492,11 +559,21 @@ function(add_jar _TARGET_NAME) file(WRITE ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist "") endif() - if (_JAVA_COMPILE_FILES) - # Create the list of files to compile. - set(_JAVA_SOURCES_FILE ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_sources) - string(REPLACE ";" "\"\n\"" _JAVA_COMPILE_STRING "\"${_JAVA_COMPILE_FILES}\"") - file(WRITE ${_JAVA_SOURCES_FILE} ${_JAVA_COMPILE_STRING}) + if (_JAVA_COMPILE_FILES OR _JAVA_COMPILE_FILELISTS) + set (_JAVA_SOURCES_FILELISTS) + + if (_JAVA_COMPILE_FILES) + # Create the list of files to compile. + set(_JAVA_SOURCES_FILE ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_sources) + string(REPLACE ";" "\"\n\"" _JAVA_COMPILE_STRING "\"${_JAVA_COMPILE_FILES}\"") + file(WRITE ${_JAVA_SOURCES_FILE} ${_JAVA_COMPILE_STRING}) + list (APPEND _JAVA_SOURCES_FILELISTS "@${_JAVA_SOURCES_FILE}") + endif() + if (_JAVA_COMPILE_FILELISTS) + foreach (_JAVA_FILELIST IN LISTS _JAVA_COMPILE_FILELISTS) + list (APPEND _JAVA_SOURCES_FILELISTS "@${_JAVA_FILELIST}") + endforeach() + endif() # Compile the java files and create a list of class files add_custom_command( @@ -506,9 +583,9 @@ function(add_jar _TARGET_NAME) ${CMAKE_JAVA_COMPILE_FLAGS} -classpath "${CMAKE_JAVA_INCLUDE_PATH_FINAL}" -d ${CMAKE_JAVA_CLASS_OUTPUT_PATH} - @${_JAVA_SOURCES_FILE} + ${_JAVA_SOURCES_FILELISTS} COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_compiled_${_TARGET_NAME} - DEPENDS ${_JAVA_COMPILE_FILES} ${_JAVA_COMPILE_DEPENDS} + DEPENDS ${_JAVA_COMPILE_FILES} ${_JAVA_COMPILE_FILELISTS} ${_JAVA_COMPILE_DEPENDS} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMENT "Building Java objects for ${_TARGET_NAME}.jar" ) @@ -613,7 +690,26 @@ function(add_jar _TARGET_NAME) endfunction() -function(INSTALL_JAR _TARGET_NAME _DESTINATION) +function(INSTALL_JAR _TARGET_NAME) + if (ARGC EQUAL 2) + set (_DESTINATION ${ARGV1}) + else() + cmake_parse_arguments(_install_jar + "" + "DESTINATION;COMPONENT" + "" + ${ARGN}) + if (_install_jar_DESTINATION) + set (_DESTINATION ${_install_jar_DESTINATION}) + else() + message(SEND_ERROR "install_jar: ${_TARGET_NAME}: DESTINATION must be specified.") + endif() + + if (_install_jar_COMPONENT) + set (_COMPONENT COMPONENT ${_install_jar_COMPONENT}) + endif() + endif() + get_property(__FILES TARGET ${_TARGET_NAME} @@ -627,13 +723,33 @@ function(INSTALL_JAR _TARGET_NAME _DESTINATION) ${__FILES} DESTINATION ${_DESTINATION} + ${_COMPONENT} ) else () - message(SEND_ERROR "The target ${_TARGET_NAME} is not known in this scope.") + message(SEND_ERROR "install_jar: The target ${_TARGET_NAME} is not known in this scope.") endif () endfunction() -function(INSTALL_JNI_SYMLINK _TARGET_NAME _DESTINATION) +function(INSTALL_JNI_SYMLINK _TARGET_NAME) + if (ARGC EQUAL 2) + set (_DESTINATION ${ARGV1}) + else() + cmake_parse_arguments(_install_jni_symlink + "" + "DESTINATION;COMPONENT" + "" + ${ARGN}) + if (_install_jni_symlink_DESTINATION) + set (_DESTINATION ${_install_jni_symlink_DESTINATION}) + else() + message(SEND_ERROR "install_jni_symlink: ${_TARGET_NAME}: DESTINATION must be specified.") + endif() + + if (_install_jni_symlink_COMPONENT) + set (_COMPONENT COMPONENT ${_install_jni_symlink_COMPONENT}) + endif() + endif() + get_property(__SYMLINK TARGET ${_TARGET_NAME} @@ -647,9 +763,10 @@ function(INSTALL_JNI_SYMLINK _TARGET_NAME _DESTINATION) ${__SYMLINK} DESTINATION ${_DESTINATION} + ${_COMPONENT} ) else () - message(SEND_ERROR "The target ${_TARGET_NAME} is not known in this scope.") + message(SEND_ERROR "install_jni_symlink: The target ${_TARGET_NAME} is not known in this scope.") endif () endfunction() @@ -1073,3 +1190,101 @@ function(create_javadoc _target) DESTINATION ${_javadoc_installpath} ) endfunction() + +function (create_javah) + cmake_parse_arguments(_create_javah + "" + "TARGET;GENERATED_FILES;OUTPUT_NAME;OUTPUT_DIR" + "CLASSES;CLASSPATH;DEPENDS" + ${ARGN}) + + # ckeck parameters + if (NOT _create_javah_TARGET AND NOT _create_javah_GENERATED_FILES) + message (FATAL_ERROR "create_javah: TARGET or GENERATED_FILES must be specified.") + endif() + if (_create_javah_OUTPUT_NAME AND _create_javah_OUTPUT_DIR) + message (FATAL_ERROR "create_javah: OUTPUT_NAME and OUTPUT_DIR are mutually exclusive.") + endif() + + if (NOT _create_javah_CLASSES) + message (FATAL_ERROR "create_javah: CLASSES is a required parameter.") + endif() + + set (_output_files) + if (WIN32 AND NOT CYGWIN AND CMAKE_HOST_SYSTEM_NAME MATCHES "Windows") + set(_classpath_sep ";") + else () + set(_classpath_sep ":") + endif() + + # handle javah options + set (_javah_options) + + if (_create_javah_CLASSPATH) + # CLASSPATH can specify directories, jar files or targets created with add_jar command + set (_classpath) + foreach (_path IN LISTS _create_javah_CLASSPATH) + if (TARGET ${_path}) + get_target_property (_jar_path ${_path} JAR_FILE) + if (_jar_path) + list (APPEND _classpath "${_jar_path}") + list (APPEND _create_javah_DEPENDS "${_path}") + else() + message(SEND_ERROR "create_javah: CLASSPATH target ${_path} is not a jar.") + endif() + elseif (EXISTS "${_path}") + list (APPEND _classpath "${_path}") + if (NOT IS_DIRECTORY "${_path}") + list (APPEND _create_javah_DEPENDS "${_path}") + endif() + else() + message(SEND_ERROR "create_javah: CLASSPATH entry ${_path} does not exist.") + endif() + endforeach() + string (REPLACE ";" "${_classpath_sep}" _classpath "${_classpath}") + list (APPEND _javah_options -classpath ${_classpath}) + endif() + + if (_create_javah_OUTPUT_DIR) + list (APPEND _javah_options -d "${_create_javah_OUTPUT_DIR}") + endif() + + if (_create_javah_OUTPUT_NAME) + list (APPEND _javah_options -o "${_create_javah_OUTPUT_NAME}") + set (_output_files "${_create_javah_OUTPUT_NAME}") + + get_filename_component (_create_javah_OUTPUT_DIR "${_create_javah_OUTPUT_NAME}" DIRECTORY) + get_filename_component (_create_javah_OUTPUT_DIR "${_create_javah_OUTPUT_DIR}" ABSOLUTE) + endif() + + if (NOT _create_javah_OUTPUT_DIR) + set (_create_javah_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}") + endif() + + if (NOT _create_javah_OUTPUT_NAME) + # compute output names + foreach (_class IN LISTS _create_javah_CLASSES) + string (REPLACE "." "_" _c_header "${_class}") + set (_c_header "${_create_javah_OUTPUT_DIR}/${_c_header}.h") + list (APPEND _output_files "${_c_header}") + endforeach() + endif() + + # finalize custom command arguments + if (_create_javah_DEPENDS) + list (INSERT _create_javah_DEPENDS 0 DEPENDS) + endif() + + add_custom_command (OUTPUT ${_output_files} + COMMAND "${Java_JAVAH_EXECUTABLE}" ${_javah_options} -jni ${_create_javah_CLASSES} + ${_create_javah_DEPENDS} + WORKING_DIRECTORY ${_create_javah_OUTPUT_DIR} + COMMENT "Building C header files from classes...") + + if (_create_javah_TARGET) + add_custom_target (${_create_javah_TARGET} ALL DEPENDS ${_output_files}) + endif() + if (_create_javah_GENERATED_FILES) + set (${_create_javah_GENERATED_FILES} ${_output_files} PARENT_SCOPE) + endif() +endfunction() diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index 96b0b35d0..d757f65f7 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -153,10 +153,12 @@ macro(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile) else() set(swig_outdir ${CMAKE_CURRENT_BINARY_DIR}) endif() - SWIG_GET_EXTRA_OUTPUT_FILES(${SWIG_MODULE_${name}_LANGUAGE} - swig_extra_generated_files - "${swig_outdir}" - "${swig_source_file_fullname}") + if (NOT SWIG_MODULE_${name}_NOPROXY) + SWIG_GET_EXTRA_OUTPUT_FILES(${SWIG_MODULE_${name}_LANGUAGE} + swig_extra_generated_files + "${swig_outdir}" + "${swig_source_file_fullname}") + endif() set(swig_generated_file_fullname "${swig_outdir}/${swig_source_file_name_we}") # add the language into the name of the file (i.e. TCL_wrap) diff --git a/Modules/UseVTK40.cmake b/Modules/UseVTK40.cmake deleted file mode 100644 index d6bdaaa52..000000000 --- a/Modules/UseVTK40.cmake +++ /dev/null @@ -1,29 +0,0 @@ -# - -#============================================================================= -# Copyright 2002-2009 Kitware, Inc. -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) - -# This is an implementation detail for using VTK 4.0 with the -# FindVTK.cmake module. Do not include directly by name. This should -# be included only when FindVTK.cmake sets the VTK_USE_FILE variable -# to point here. - -# Add compiler flags needed to use VTK. -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VTK_REQUIRED_C_FLAGS}") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${VTK_REQUIRED_CXX_FLAGS}") - -# Add include directories needed to use VTK. -include_directories(${VTK_INCLUDE_DIRS}) - -# Add link directories needed to use VTK. -link_directories(${VTK_LIBRARY_DIRS}) diff --git a/Modules/UseVTKBuildSettings40.cmake b/Modules/UseVTKBuildSettings40.cmake deleted file mode 100644 index 474f67c9c..000000000 --- a/Modules/UseVTKBuildSettings40.cmake +++ /dev/null @@ -1,38 +0,0 @@ -# - -#============================================================================= -# Copyright 2002-2009 Kitware, Inc. -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) - -# Implementation detail for FindVTK.cmake to let it provide a -# VTK_BUILD_SETTINGS_FILE for VTK 4.0. - -set(CMAKE_BUILD_SETTING_CMAKE_MAJOR_VERSION "${VTK40_CMAKE_MAJOR_VERSION}") -set(CMAKE_BUILD_SETTING_CMAKE_MINOR_VERSION "${VTK40_CMAKE_MINOR_VERSION}") -set(CMAKE_BUILD_SETTING_PROJECT_NAME "VTK") - -set(CMAKE_BUILD_SETTING_C_COMPILER "${VTK40_CMAKE_C_COMPILER}") -set(CMAKE_BUILD_SETTING_C_FLAGS "${VTK40_CMAKE_C_FLAGS}") -set(CMAKE_BUILD_SETTING_C_FLAGS_DEBUG "${VTK40_CMAKE_C_FLAGS_DEBUG}") -set(CMAKE_BUILD_SETTING_C_FLAGS_RELEASE "${VTK40_CMAKE_C_FLAGS_RELEASE}") -set(CMAKE_BUILD_SETTING_C_FLAGS_MINSIZEREL "${VTK40_CMAKE_C_FLAGS_MINSIZEREL}") -set(CMAKE_BUILD_SETTING_C_FLAGS_RELWITHDEBINFO "${VTK40_CMAKE_C_FLAGS_RELWITHDEBINFO}") - -set(CMAKE_BUILD_SETTING_CXX_COMPILER "${VTK40_CMAKE_CXX_COMPILER}") -set(CMAKE_BUILD_SETTING_CXX_FLAGS "${VTK40_CMAKE_CXX_FLAGS}") -set(CMAKE_BUILD_SETTING_CXX_FLAGS_DEBUG "${VTK40_CMAKE_CXX_FLAGS_DEBUG}") -set(CMAKE_BUILD_SETTING_CXX_FLAGS_RELEASE "${VTK40_CMAKE_CXX_FLAGS_RELEASE}") -set(CMAKE_BUILD_SETTING_CXX_FLAGS_MINSIZEREL "${VTK40_CMAKE_CXX_FLAGS_MINSIZEREL}") -set(CMAKE_BUILD_SETTING_CXX_FLAGS_RELWITHDEBINFO "${VTK40_CMAKE_CXX_FLAGS_RELWITHDEBINFO}") - -set(CMAKE_BUILD_SETTING_BUILD_TYPE "${VTK40_CMAKE_BUILD_TYPE}") -set(CMAKE_BUILD_SETTING_BUILD_TOOL "${VTK40_CMAKE_BUILD_TOOL}") diff --git a/Modules/UseVTKConfig40.cmake b/Modules/UseVTKConfig40.cmake deleted file mode 100644 index c5022e4f8..000000000 --- a/Modules/UseVTKConfig40.cmake +++ /dev/null @@ -1,409 +0,0 @@ -# - -#============================================================================= -# Copyright 2002-2009 Kitware, Inc. -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) - -# This is an implementation detail for using VTK 4.0 with the -# FindVTK.cmake module. Do not include directly. - -# Hard-code the version number since it isn't provided by VTK 4.0. -set(VTK_MAJOR_VERSION 4) -set(VTK_MINOR_VERSION 0) -set(VTK_BUILD_VERSION 2) - -# Provide a new UseVTK file that doesn't do a full LOAD_CACHE. -set(VTK_USE_FILE ${CMAKE_ROOT}/Modules/UseVTK40.cmake) - -# Provide a build settings file. -set(VTK_BUILD_SETTINGS_FILE ${CMAKE_ROOT}/Modules/UseVTKBuildSettings40.cmake) - -# There are no CMake extensions for VTK 4.0. -set(VTK_CMAKE_EXTENSIONS_DIR "") - -# grep "VTK40_" UseVTKConfig40.cmake |sed 's/.*VTK40_\([A-Za-z0-9_]*\).*/ \1/' -load_cache(${VTK_DIR} READ_WITH_PREFIX VTK40_ - BUILD_SHARED_LIBS - CMAKE_BUILD_TOOL - CMAKE_BUILD_TYPE - CMAKE_CACHE_MAJOR_VERSION - CMAKE_CACHE_MINOR_VERSION - CMAKE_CXX_COMPILER - CMAKE_CXX_FLAGS - CMAKE_CXX_FLAGS_DEBUG - CMAKE_CXX_FLAGS_MINSIZEREL - CMAKE_CXX_FLAGS_RELEASE - CMAKE_CXX_FLAGS_RELWITHDEBINFO - CMAKE_C_COMPILER - CMAKE_C_FLAGS - CMAKE_C_FLAGS_DEBUG - CMAKE_C_FLAGS_MINSIZEREL - CMAKE_C_FLAGS_RELEASE - CMAKE_C_FLAGS_RELWITHDEBINFO - CMAKE_INSTALL_PREFIX - CMAKE_Xutil_INCLUDE_PATH - EXECUTABLE_OUTPUT_PATH - JAVA_INCLUDE_PATH2 - LIBRARY_OUTPUT_PATH - MPIRUN - MPI_INCLUDE_PATH - MPI_POSTFLAGS - MPI_PREFLAGS - OPENGL_INCLUDE_DIR - OSMESA_INCLUDE_PATH - PYTHON_INCLUDE_PATH - TCL_INCLUDE_PATH - VLI_INCLUDE_PATH_FOR_VG500 - VLI_INCLUDE_PATH_FOR_VP1000 - VTK_BINARY_DIR - VTK_DEBUG_LEAKS - VTK_HAVE_VG500 - VTK_HAVE_VP1000 - VTK_MANGLE_MESA - VTK_OPENGL_HAS_OSMESA - VTK_PARSE_JAVA_EXE - VTK_SOURCE_DIR - VTK_USE_64BIT_IDS - VTK_USE_ANSI_STDLIB - VTK_USE_HYBRID - VTK_USE_MATROX_IMAGING - VTK_USE_MPI - VTK_USE_PARALLEL - VTK_USE_PATENTED - VTK_USE_RENDERING - VTK_USE_VIDEO_FOR_WINDOWS - VTK_USE_VOLUMEPRO - VTK_USE_X - VTK_WRAP_JAVA - VTK_WRAP_JAVA_EXE - VTK_WRAP_PYTHON - VTK_WRAP_PYTHON_EXE - VTK_WRAP_TCL - VTK_WRAP_TCL_EXE - vtkCommonJava_LIB_DEPENDS - vtkCommonPython_LIB_DEPENDS - vtkCommonTCL_LIB_DEPENDS - vtkCommon_LIB_DEPENDS - vtkFilteringJava_LIB_DEPENDS - vtkFilteringPython_LIB_DEPENDS - vtkFilteringTCL_LIB_DEPENDS - vtkFiltering_LIB_DEPENDS - vtkGraphicsJava_LIB_DEPENDS - vtkGraphicsPython_LIB_DEPENDS - vtkGraphicsTCL_LIB_DEPENDS - vtkGraphics_LIB_DEPENDS - vtkHybridJava_LIB_DEPENDS - vtkHybridPython_LIB_DEPENDS - vtkHybridTCL_LIB_DEPENDS - vtkHybrid_LIB_DEPENDS - vtkIOJava_LIB_DEPENDS - vtkIOPython_LIB_DEPENDS - vtkIOTCL_LIB_DEPENDS - vtkIO_LIB_DEPENDS - vtkImagingJava_LIB_DEPENDS - vtkImagingPython_LIB_DEPENDS - vtkImagingTCL_LIB_DEPENDS - vtkImaging_LIB_DEPENDS - vtkParallelJava_LIB_DEPENDS - vtkParallelPython_LIB_DEPENDS - vtkParallelTCL_LIB_DEPENDS - vtkParallel_LIB_DEPENDS - vtkPatentedJava_LIB_DEPENDS - vtkPatentedPython_LIB_DEPENDS - vtkPatentedTCL_LIB_DEPENDS - vtkPatented_LIB_DEPENDS - vtkRenderingJava_LIB_DEPENDS - vtkRenderingPythonTkWidgets_LIB_DEPENDS - vtkRenderingPython_LIB_DEPENDS - vtkRenderingTCL_LIB_DEPENDS - vtkRendering_LIB_DEPENDS - vtkjpeg_LIB_DEPENDS - vtkpng_LIB_DEPENDS - vtkzlib_LIB_DEPENDS -) - -# Copy needed settings from the VTK 4.0 cache. -set(VTK_BUILD_SHARED ${VTK40_BUILD_SHARED_LIBS}) -set(VTK_DEBUG_LEAKS ${VTK40_VTK_DEBUG_LEAKS}) -set(VTK_HAVE_VG500 ${VTK40_VTK_HAVE_VG500}) -set(VTK_HAVE_VP1000 ${VTK40_VTK_HAVE_VP1000}) -set(VTK_USE_MANGLED_MESA ${VTK40_VTK_MANGLE_MESA}) -set(VTK_MPIRUN_EXE ${VTK40_MPIRUN}) -set(VTK_MPI_POSTFLAGS ${VTK40_MPI_POSTFLAGS}) -set(VTK_MPI_PREFLAGS ${VTK40_MPI_PREFLAGS}) -set(VTK_OPENGL_HAS_OSMESA ${VTK40_VTK_OPENGL_HAS_OSMESA}) -set(VTK_USE_64BIT_IDS ${VTK40_VTK_USE_64BIT_IDS}) -set(VTK_USE_ANSI_STDLIB ${VTK40_VTK_USE_ANSI_STDLIB}) -set(VTK_USE_HYBRID ${VTK40_VTK_USE_HYBRID}) -set(VTK_USE_MATROX_IMAGING ${VTK40_VTK_USE_MATROX_IMAGING}) -set(VTK_USE_MPI ${VTK40_VTK_USE_MPI}) -set(VTK_USE_PARALLEL ${VTK40_VTK_USE_PARALLEL}) -set(VTK_USE_PATENTED ${VTK40_VTK_USE_PATENTED}) -set(VTK_USE_RENDERING ${VTK40_VTK_USE_RENDERING}) -set(VTK_USE_VIDEO_FOR_WINDOWS ${VTK40_VTK_USE_VIDEO_FOR_WINDOWS}) -set(VTK_USE_VOLUMEPRO ${VTK40_VTK_USE_VOLUMEPRO}) -set(VTK_USE_X ${VTK40_VTK_USE_X}) -set(VTK_WRAP_JAVA ${VTK40_VTK_WRAP_JAVA}) -set(VTK_WRAP_PYTHON ${VTK40_VTK_WRAP_PYTHON}) -set(VTK_WRAP_TCL ${VTK40_VTK_WRAP_TCL}) - -# Create the list of available kits. -set(VTK_KITS COMMON FILTERING GRAPHICS IMAGING IO) -if(VTK_USE_RENDERING) - set(VTK_KITS ${VTK_KITS} RENDERING) -endif() -if(VTK_USE_HYBRID) - set(VTK_KITS ${VTK_KITS} HYBRID) -endif() -if(VTK_USE_PARALLEL) - set(VTK_KITS ${VTK_KITS} PARALLEL) -endif() -if(VTK_USE_PATENTED) - set(VTK_KITS ${VTK_KITS} PATENTED) -endif() - -# Create the list of available languages. -set(VTK_LANGUAGES "") -if(VTK_WRAP_TCL) - set(VTK_LANGUAGES ${VTK_LANGUAGES} TCL) -endif() -if(VTK_WRAP_PYTHON) - set(VTK_LANGUAGES ${VTK_LANGUAGES} PYTHON) -endif() -if(VTK_WRAP_JAVA) - set(VTK_LANGUAGES ${VTK_LANGUAGES} JAVA) -endif() - -# Include directories for other projects installed on the system and -# used by VTK. -set(VTK_INCLUDE_DIRS_SYS "") -if(VTK_USE_RENDERING) - set(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS} - ${VTK40_OPENGL_INCLUDE_PATH} ${VTK40_OPENGL_INCLUDE_DIR}) - if(VTK_USE_X) - set(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS} - ${VTK40_CMAKE_Xlib_INCLUDE_PATH} ${VTK40_CMAKE_Xutil_INCLUDE_PATH}) - endif() -endif() - -if(VTK_OPENGL_HAS_OSMESA) - set(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS} - ${VTK40_OSMESA_INCLUDE_PATH}) -endif() - -if(VTK_USE_MPI) - set(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS} ${VTK40_MPI_INCLUDE_PATH}) -endif() - -if(VTK_WRAP_TCL) - set(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS} ${VTK40_TCL_INCLUDE_PATH}) -endif() - -if(VTK_WRAP_PYTHON) - set(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS} ${VTK40_PYTHON_INCLUDE_PATH}) -endif() - -if(VTK_WRAP_JAVA) - set(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS} - ${VTK40_JAVA_INCLUDE_PATH} ${VTK40_JAVA_INCLUDE_PATH2}) -endif() - -if(VTK_HAVE_VG500) - set(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS} - ${VTK40_VLI_INCLUDE_PATH_FOR_VG500}) -endif() - -if(VTK_HAVE_VP1000) - set(VTK_INCLUDE_DIRS_SYS ${VTK_INCLUDE_DIRS_SYS} - ${VTK40_VLI_INCLUDE_PATH_FOR_VP1000}) -endif() - -# See if this is a build tree or install tree. -if(EXISTS ${VTK_DIR}/Common) - # This is a VTK 4.0 build tree. - - set(VTK_LIBRARY_DIRS ${VTK40_LIBRARY_OUTPUT_PATH}) - - # Determine the include directories needed. - set(VTK_INCLUDE_DIRS ${VTK40_VTK_BINARY_DIR}) - if(VTK_USE_PARALLEL) - set(VTK_INCLUDE_DIRS ${VTK_INCLUDE_DIRS} ${VTK40_VTK_SOURCE_DIR}/Parallel) - endif() - if(VTK_USE_HYBRID) - set(VTK_INCLUDE_DIRS ${VTK_INCLUDE_DIRS} ${VTK40_VTK_SOURCE_DIR}/Hybrid) - endif() - if(VTK_USE_PATENTED) - set(VTK_INCLUDE_DIRS ${VTK_INCLUDE_DIRS} ${VTK40_VTK_SOURCE_DIR}/Patented) - endif() - if(VTK_USE_RENDERING) - set(VTK_INCLUDE_DIRS ${VTK_INCLUDE_DIRS} ${VTK40_VTK_SOURCE_DIR}/Rendering) - endif() - - # These directories are always needed. - set(VTK_INCLUDE_DIRS ${VTK_INCLUDE_DIRS} - ${VTK40_VTK_SOURCE_DIR}/IO - ${VTK40_VTK_SOURCE_DIR}/Imaging - ${VTK40_VTK_SOURCE_DIR}/Graphics - ${VTK40_VTK_SOURCE_DIR}/Filtering - ${VTK40_VTK_SOURCE_DIR}/Common) - - # Give access to a few utilities. - set(VTK_INCLUDE_DIRS ${VTK_INCLUDE_DIRS} - ${VTK40_VTK_BINARY_DIR}/Utilities/png - ${VTK40_VTK_SOURCE_DIR}/Utilities/png - ${VTK40_VTK_BINARY_DIR}/Utilities/zlib - ${VTK40_VTK_SOURCE_DIR}/Utilities/zlib) - - # Executable locations. - if(VTK_WRAP_TCL) - set(VTK_TCL_EXE ${VTK40_EXECUTABLE_OUTPUT_PATH}/vtk) - set(VTK_WRAP_TCL_EXE ${VTK40_VTK_WRAP_TCL_EXE}) - set(VTK_TCL_HOME ${VTK40_VTK_SOURCE_DIR}/Wrapping/Tcl) - endif() - if(VTK_WRAP_PYTHON) - set(VTK_WRAP_PYTHON_EXE ${VTK40_VTK_WRAP_PYTHON_EXE}) - endif() - if(VTK_WRAP_JAVA) - set(VTK_PARSE_JAVA_EXE ${VTK40_VTK_PARSE_JAVA_EXE}) - set(VTK_WRAP_JAVA_EXE ${VTK40_VTK_WRAP_JAVA_EXE}) - endif() - -else() - # This is a VTK 4.0 install tree. - - set(VTK_INCLUDE_DIRS ${VTK_DIR}) - set(VTK_LIBRARY_DIRS ${VTK40_CMAKE_INSTALL_PREFIX}/lib/vtk) - - # Executable locations. - if(VTK_WRAP_TCL) - set(VTK_TCL_EXE ${VTK40_CMAKE_INSTALL_PREFIX}/bin/vtk) - set(VTK_WRAP_TCL_EXE ${VTK40_CMAKE_INSTALL_PREFIX}/bin/vtkWrapTcl) - set(VTK_TCL_HOME ${VTK40_CMAKE_INSTALL_PREFIX}/lib/vtk/tcl) - endif() - if(VTK_WRAP_PYTHON) - set(VTK_WRAP_PYTHON_EXE ${VTK40_CMAKE_INSTALL_PREFIX}/bin/vtkWrapPython) - endif() - if(VTK_WRAP_JAVA) - set(VTK_PARSE_JAVA_EXE ${VTK40_CMAKE_INSTALL_PREFIX}/bin/vtkParseJava) - set(VTK_WRAP_JAVA_EXE ${VTK40_CMAKE_INSTALL_PREFIX}/bin/vtkWrapJava) - endif() -endif() - -# Add the system include directories last. -set(VTK_INCLUDE_DIRS ${VTK_INCLUDE_DIRS} ${VTK_INCLUDE_DIRS_SYS}) - -# Find the required C and C++ compiler flags. -if(CMAKE_COMPILER_IS_GNUCXX) - if(WIN32) - # The platform is gcc on cygwin. - set(VTK_REQUIRED_CXX_FLAGS "${VTK_REQUIRED_CXX_FLAGS} -mwin32") - set(VTK_REQUIRED_C_FLAGS "${VTK_REQUIRED_C_FLAGS} -mwin32") - endif() -else() - if(CMAKE_ANSI_CFLAGS) - set(VTK_REQUIRED_C_FLAGS "${VTK_REQUIRED_C_FLAGS} ${CMAKE_ANSI_CFLAGS}") - endif() - if(CMAKE_SYSTEM MATCHES "OSF1-V") - set(VTK_REQUIRED_CXX_FLAGS - "${VTK_REQUIRED_CXX_FLAGS} -timplicit_local -no_implicit_include") - endif() -endif() - -if(VTK_USE_X) - if(CMAKE_X_CFLAGS) - set(VTK_REQUIRED_C_FLAGS "${VTK_REQUIRED_C_FLAGS} ${CMAKE_X_CFLAGS}") - set(VTK_REQUIRED_CXX_FLAGS "${VTK_REQUIRED_CXX_FLAGS} ${CMAKE_X_CFLAGS}") - endif() -endif() - -# Copy library dependencies. -set(vtkCommonJava_LIB_DEPENDS "${VTK40_vtkCommonJava_LIB_DEPENDS}") -set(vtkCommonPython_LIB_DEPENDS "${VTK40_vtkCommonPython_LIB_DEPENDS}") -set(vtkCommonTCL_LIB_DEPENDS "${VTK40_vtkCommonTCL_LIB_DEPENDS}") -set(vtkCommon_LIB_DEPENDS "${VTK40_vtkCommon_LIB_DEPENDS}") -set(vtkFilteringJava_LIB_DEPENDS "${VTK40_vtkFilteringJava_LIB_DEPENDS}") -set(vtkFilteringPython_LIB_DEPENDS "${VTK40_vtkFilteringPython_LIB_DEPENDS}") -set(vtkFilteringTCL_LIB_DEPENDS "${VTK40_vtkFilteringTCL_LIB_DEPENDS}") -set(vtkFiltering_LIB_DEPENDS "${VTK40_vtkFiltering_LIB_DEPENDS}") -set(vtkGraphicsJava_LIB_DEPENDS "${VTK40_vtkGraphicsJava_LIB_DEPENDS}") -set(vtkGraphicsPython_LIB_DEPENDS "${VTK40_vtkGraphicsPython_LIB_DEPENDS}") -set(vtkGraphicsTCL_LIB_DEPENDS "${VTK40_vtkGraphicsTCL_LIB_DEPENDS}") -set(vtkGraphics_LIB_DEPENDS "${VTK40_vtkGraphics_LIB_DEPENDS}") -set(vtkHybridJava_LIB_DEPENDS "${VTK40_vtkHybridJava_LIB_DEPENDS}") -set(vtkHybridPython_LIB_DEPENDS "${VTK40_vtkHybridPython_LIB_DEPENDS}") -set(vtkHybridTCL_LIB_DEPENDS "${VTK40_vtkHybridTCL_LIB_DEPENDS}") -set(vtkHybrid_LIB_DEPENDS "${VTK40_vtkHybrid_LIB_DEPENDS}") -set(vtkIOJava_LIB_DEPENDS "${VTK40_vtkIOJava_LIB_DEPENDS}") -set(vtkIOPython_LIB_DEPENDS "${VTK40_vtkIOPython_LIB_DEPENDS}") -set(vtkIOTCL_LIB_DEPENDS "${VTK40_vtkIOTCL_LIB_DEPENDS}") -set(vtkIO_LIB_DEPENDS "${VTK40_vtkIO_LIB_DEPENDS}") -set(vtkImagingJava_LIB_DEPENDS "${VTK40_vtkImagingJava_LIB_DEPENDS}") -set(vtkImagingPython_LIB_DEPENDS "${VTK40_vtkImagingPython_LIB_DEPENDS}") -set(vtkImagingTCL_LIB_DEPENDS "${VTK40_vtkImagingTCL_LIB_DEPENDS}") -set(vtkImaging_LIB_DEPENDS "${VTK40_vtkImaging_LIB_DEPENDS}") -set(vtkParallelJava_LIB_DEPENDS "${VTK40_vtkParallelJava_LIB_DEPENDS}") -set(vtkParallelPython_LIB_DEPENDS "${VTK40_vtkParallelPython_LIB_DEPENDS}") -set(vtkParallelTCL_LIB_DEPENDS "${VTK40_vtkParallelTCL_LIB_DEPENDS}") -set(vtkParallel_LIB_DEPENDS "${VTK40_vtkParallel_LIB_DEPENDS}") -set(vtkPatentedJava_LIB_DEPENDS "${VTK40_vtkPatentedJava_LIB_DEPENDS}") -set(vtkPatentedPython_LIB_DEPENDS "${VTK40_vtkPatentedPython_LIB_DEPENDS}") -set(vtkPatentedTCL_LIB_DEPENDS "${VTK40_vtkPatentedTCL_LIB_DEPENDS}") -set(vtkPatented_LIB_DEPENDS "${VTK40_vtkPatented_LIB_DEPENDS}") -set(vtkRenderingJava_LIB_DEPENDS "${VTK40_vtkRenderingJava_LIB_DEPENDS}") -set(vtkRenderingPythonTkWidgets_LIB_DEPENDS "${VTK40_vtkRenderingPythonTkWidgets_LIB_DEPENDS}") -set(vtkRenderingPython_LIB_DEPENDS "${VTK40_vtkRenderingPython_LIB_DEPENDS}") -set(vtkRenderingTCL_LIB_DEPENDS "${VTK40_vtkRenderingTCL_LIB_DEPENDS}") -set(vtkRendering_LIB_DEPENDS "${VTK40_vtkRendering_LIB_DEPENDS}") -set(vtkjpeg_LIB_DEPENDS "${VTK40_vtkjpeg_LIB_DEPENDS}") -set(vtkpng_LIB_DEPENDS "${VTK40_vtkpng_LIB_DEPENDS}") -set(vtkzlib_LIB_DEPENDS "${VTK40_vtkzlib_LIB_DEPENDS}") - -# List of VTK configuration variables set above. -# grep "^[ ]*set(VTK" UseVTKConfig40.cmake |sed 's/[ ]*set(\([^ ]*\) .*/ \1/' -set(VTK_SETTINGS - VTK_BUILD_SHARED - VTK_BUILD_VERSION - VTK_DEBUG_LEAKS - VTK_HAVE_VG500 - VTK_HAVE_VP1000 - VTK_INCLUDE_DIRS - VTK_KITS - VTK_LANGUAGES - VTK_LIBRARY_DIRS - VTK_MAJOR_VERSION - VTK_MANGLE_MESA - VTK_MINOR_VERSION - VTK_MPIRUN_EXE - VTK_MPI_POSTFLAGS - VTK_MPI_PREFLAGS - VTK_OPENGL_HAS_OSMESA - VTK_PARSE_JAVA_EXE - VTK_TCL_EXE - VTK_TCL_HOME - VTK_USE_64BIT_IDS - VTK_USE_ANSI_STDLIB - VTK_USE_HYBRID - VTK_USE_MATROX_IMAGING - VTK_USE_MPI - VTK_USE_PARALLEL - VTK_USE_PATENTED - VTK_USE_RENDERING - VTK_USE_VIDEO_FOR_WINDOWS - VTK_USE_VOLUMEPRO - VTK_USE_X - VTK_WRAP_JAVA - VTK_WRAP_JAVA_EXE - VTK_WRAP_PYTHON - VTK_WRAP_PYTHON_EXE - VTK_WRAP_TCL - VTK_WRAP_TCL_EXE -) diff --git a/Modules/readme.txt b/Modules/readme.txt index b40f3d009..1e0c13b6a 100644 --- a/Modules/readme.txt +++ b/Modules/readme.txt @@ -1,4 +1,4 @@ See the "Find Modules" section of the cmake-developer(7) manual page. For more information about how to contribute modules to CMake, see this page: -http://www.cmake.org/Wiki/CMake:Module_Maintainers +https://cmake.org/Wiki/CMake:Module_Maintainers diff --git a/README.rst b/README.rst index e8524f81a..5e7a323a4 100644 --- a/README.rst +++ b/README.rst @@ -8,8 +8,8 @@ CMake is a cross-platform, open-source build system generator. For full documentation visit the `CMake Home Page`_ and the `CMake Documentation Page`_. -.. _`CMake Home Page`: http://www.cmake.org -.. _`CMake Documentation Page`: http://www.cmake.org/cmake/help/documentation.html +.. _`CMake Home Page`: https://cmake.org +.. _`CMake Documentation Page`: https://cmake.org/cmake/help/documentation.html CMake is maintained and supported by `Kitware`_ and developed in collaboration with a productive community of contributors. @@ -37,7 +37,7 @@ it should not be a major problem to port CMake to this platform. Subscribe and post to the `CMake Users List`_ to ask if others have had experience with the platform. -.. _`CMake Users List`: http://www.cmake.org/mailman/listinfo/cmake +.. _`CMake Users List`: https://cmake.org/mailman/listinfo/cmake Building CMake from Scratch --------------------------- @@ -63,7 +63,7 @@ You need to download and install a binary release of CMake in order to build CMake. You can get these releases from the `CMake Download Page`_ . Then proceed with the instructions below. -.. _`CMake Download Page`: http://www.cmake.org/cmake/resources/software.html +.. _`CMake Download Page`: https://cmake.org/cmake/resources/software.html Building CMake with CMake ------------------------- @@ -73,7 +73,7 @@ run the installed CMake on the sources of this CMake with your preferred options and generators. Then build it and install it. For instructions how to do this, see documentation on `Running CMake`_. -.. _`Running CMake`: http://www.cmake.org/cmake/help/runningcmake.html +.. _`Running CMake`: https://cmake.org/cmake/help/runningcmake.html Reporting Bugs ============== @@ -82,14 +82,14 @@ If you have found a bug: 1. If you have a patch, please read the `CONTRIBUTING.rst`_ document. -2. Otherwise, please join the the `CMake Users List`_ and ask about +2. Otherwise, please join the `CMake Users List`_ and ask about the expected and observed behaviors to determine if it is really a bug. 3. Finally, if the issue is not resolved by the above steps, open an entry in the `CMake Issue Tracker`_. -.. _`CMake Issue Tracker`: http://www.cmake.org/Bug +.. _`CMake Issue Tracker`: https://cmake.org/Bug Contributing ============ diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index a7adb5125..ae5b03ff9 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -88,7 +88,7 @@ option(CMAKE_REGENERATE_YACCLEX "Regenerate YACC and LEXX files" OFF) mark_as_advanced(CMAKE_REGENERATE_YACCLEX) if(CMAKE_REGENERATE_YACCLEX) - set(parsersLexers cmDependsFortran cmCommandArgument cmExpr) + set(parsersLexers cmFortran cmCommandArgument cmExpr) find_program(YACC_EXECUTABLE NAMES yacc bison PATHS /usr/bin @@ -165,6 +165,8 @@ set(SRCS cmCommandArgumentLexer.cxx cmCommandArgumentParser.cxx cmCommandArgumentParserHelper.cxx + cmCommonTargetGenerator.cxx + cmCommonTargetGenerator.h cmComputeComponentGraph.cxx cmComputeComponentGraph.h cmComputeLinkDepends.cxx @@ -191,9 +193,6 @@ set(SRCS cmDependsC.h cmDependsFortran.cxx cmDependsFortran.h - cmDependsFortranLexer.cxx - cmDependsFortranParser.cxx - cmDependsFortranParser.h cmDependsJava.cxx cmDependsJava.h cmDependsJavaLexer.cxx @@ -241,6 +240,11 @@ set(SRCS cmFileLockResult.h cmFileTimeComparison.cxx cmFileTimeComparison.h + cmFortranLexer.cxx + cmFortranLexer.h + cmFortranParser.cxx + cmFortranParser.h + cmFortranParserImpl.cxx cmGeneratedFileStream.cxx cmGeneratorExpressionContext.cxx cmGeneratorExpressionContext.h @@ -260,6 +264,8 @@ set(SRCS cmGeneratorExpression.h cmGeneratorTarget.cxx cmGeneratorTarget.h + cmGlobalCommonGenerator.cxx + cmGlobalCommonGenerator.h cmGlobalGenerator.cxx cmGlobalGenerator.h cmGlobalGeneratorFactory.h @@ -281,9 +287,13 @@ set(SRCS cmInstallTargetGenerator.cxx cmInstallDirectoryGenerator.h cmInstallDirectoryGenerator.cxx + cmLinkedTree.h + cmLinkItem.h cmListFileCache.cxx cmListFileCache.h cmListFileLexer.c + cmLocalCommonGenerator.cxx + cmLocalCommonGenerator.h cmLocalGenerator.cxx cmLocalGenerator.h cmLocalUnixMakefileGenerator3.cxx @@ -299,6 +309,8 @@ set(SRCS cmMakefileUtilityTargetGenerator.cxx cmOSXBundleGenerator.cxx cmOSXBundleGenerator.h + cmOutputConverter.cxx + cmOutputConverter.h cmNewLineStyle.h cmNewLineStyle.cxx cmOrderDirectories.cxx @@ -315,6 +327,8 @@ set(SRCS cmPropertyDefinitionMap.h cmPropertyMap.cxx cmPropertyMap.h + cmQtAutoGeneratorInitializer.cxx + cmQtAutoGeneratorInitializer.h cmQtAutoGenerators.cxx cmQtAutoGenerators.h cmRST.cxx @@ -427,6 +441,7 @@ if (WIN32) set(SRCS ${SRCS} cmCallVisualStudioMacro.cxx cmCallVisualStudioMacro.h + bindexplib.cxx ) if(NOT UNIX) @@ -489,6 +504,10 @@ if (WIN32) cmGhsMultiGpj.cxx cmGhsMultiGpj.h ) + + # Add a manifest file to executables on Windows to allow for + # GetVersion to work properly on Windows 8 and above. + set(MANIFEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/cmake.version.manifest) endif() endif () @@ -518,7 +537,7 @@ set(SRCS ${SRCS} if(WIN32 AND NOT CYGWIN) set_source_files_properties(cmcldeps.cxx PROPERTIES COMPILE_DEFINITIONS _WIN32_WINNT=0x0501) - add_executable(cmcldeps cmcldeps.cxx) + add_executable(cmcldeps cmcldeps.cxx ${MANIFEST_FILE}) target_link_libraries(cmcldeps CMakeLib) install(TARGETS cmcldeps DESTINATION bin) endif() @@ -543,9 +562,10 @@ if(APPLE) target_link_libraries(CMakeLib "-framework CoreFoundation") endif() -if(CMAKE_BUILD_ON_VISUAL_STUDIO OR MINGW) - # We need the rpcrt4 library for at least the VS7-VC10 generators. - target_link_libraries(CMakeLib rpcrt4) +if(WIN32 AND NOT UNIX) + # We need the rpcrt4 library on Windows. + # We need the crypt32 library on Windows for crypto/cert APIs. + target_link_libraries(CMakeLib rpcrt4 crypt32) endif() # @@ -706,15 +726,15 @@ if(APPLE) endif() # Build CMake executable -add_executable(cmake cmakemain.cxx cmcmd.cxx cmcmd.h) +add_executable(cmake cmakemain.cxx cmcmd.cxx cmcmd.h ${MANIFEST_FILE}) target_link_libraries(cmake CMakeLib) # Build CTest executable -add_executable(ctest ctest.cxx) +add_executable(ctest ctest.cxx ${MANIFEST_FILE}) target_link_libraries(ctest CTestLib) # Build CPack executable -add_executable(cpack CPack/cpack.cxx) +add_executable(cpack CPack/cpack.cxx ${MANIFEST_FILE}) target_link_libraries(cpack CPackLib) # Curses GUI @@ -731,9 +751,17 @@ endif() include (${CMake_BINARY_DIR}/Source/LocalUserOptions.cmake OPTIONAL) include (${CMake_SOURCE_DIR}/Source/LocalUserOptions.cmake OPTIONAL) -install(TARGETS cmake ctest cpack DESTINATION bin) +# Install tools + +set(_tools cmake ctest cpack) + if(APPLE) - install(TARGETS cmakexbuild DESTINATION bin) + list(APPEND _tools cmakexbuild) endif() +foreach(_tool ${_tools}) + CMake_OPTIONAL_COMPONENT(${_tool}) + install(TARGETS ${_tool} DESTINATION bin ${COMPONENT}) +endforeach() + install(FILES cmCPluginAPI.h DESTINATION ${CMAKE_DATA_DIR}/include) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index a9785ef34..0ce169637 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) -set(CMake_VERSION_MINOR 3) -set(CMake_VERSION_PATCH 2) +set(CMake_VERSION_MINOR 4) +set(CMake_VERSION_PATCH 0) #set(CMake_VERSION_RC 0) diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx index 09e123cd4..43d34ee65 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx +++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx @@ -191,7 +191,7 @@ int cmCPackIFWGenerator::PackageFiles() } } // TODO: set correct name for multipackages - if (this->packageFileNames.size() > 0) + if (!this->packageFileNames.empty()) { ifwCmd += " " + packageFileNames[0]; } diff --git a/Source/CPack/OSXScriptLauncher.cxx b/Source/CPack/OSXScriptLauncher.cxx index 1d7afbd19..c271517f1 100644 --- a/Source/CPack/OSXScriptLauncher.cxx +++ b/Source/CPack/OSXScriptLauncher.cxx @@ -11,17 +11,18 @@ ============================================================================*/ #include #include -#include #include +#include + #include // For the PATH_MAX constant #include #define DebugError(x) \ - ofs << x << cmsys_ios::endl; \ - cmsys_ios::cout << x << cmsys_ios::endl + ofs << x << std::endl; \ + std::cout << x << std::endl int main(int argc, char* argv[]) { @@ -77,7 +78,7 @@ int main(int argc, char* argv[]) std::string scriptDirectory = cmsys::SystemTools::GetFilenamePath( fullScriptPath); - ofs << fullScriptPath.c_str() << cmsys_ios::endl; + ofs << fullScriptPath.c_str() << std::endl; std::vector args; args.push_back(fullScriptPath.c_str()); int cc; @@ -109,7 +110,7 @@ int main(int argc, char* argv[]) data[i] = ' '; } } - cmsys_ios::cout.write(data, length); + std::cout.write(data, length); } cmsysProcess_WaitForExit(cp, 0); diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index b3eb7b2fc..6f25e50ba 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -217,7 +217,7 @@ bool cmCPackWIXGenerator::InitializeWiXConfiguration() { std::string defaultRef = "WixUI_InstallDir"; - if(this->Components.size()) + if(!this->Components.empty()) { defaultRef = "WixUI_FeatureTree"; } @@ -1005,7 +1005,7 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons( shortcut.workingDirectoryId = directoryId; shortcuts.insert(cmWIXShortcuts::START_MENU, id, shortcut); - if(desktopExecutables.size() && + if(!desktopExecutables.empty() && std::find(desktopExecutables.begin(), desktopExecutables.end(), executableName) diff --git a/Source/CPack/WiX/cmWIXAccessControlList.cxx b/Source/CPack/WiX/cmWIXAccessControlList.cxx index aeec96861..fc0d3d37a 100644 --- a/Source/CPack/WiX/cmWIXAccessControlList.cxx +++ b/Source/CPack/WiX/cmWIXAccessControlList.cxx @@ -71,7 +71,7 @@ void cmWIXAccessControlList::CreatePermissionElement( this->SourceWriter.BeginElement("Permission"); this->SourceWriter.AddAttribute("User", user); - if(domain.size()) + if(!domain.empty()) { this->SourceWriter.AddAttribute("Domain", domain); } diff --git a/Source/CPack/WiX/cmWIXPatch.cxx b/Source/CPack/WiX/cmWIXPatch.cxx index b5202e0c0..5a8dc6351 100644 --- a/Source/CPack/WiX/cmWIXPatch.cxx +++ b/Source/CPack/WiX/cmWIXPatch.cxx @@ -79,7 +79,7 @@ bool cmWIXPatch::CheckForUnappliedFragments() fragmentList += "'"; } - if(fragmentList.size()) + if(!fragmentList.empty()) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Some XML patch fragments did not have matching IDs: " << diff --git a/Source/CPack/WiX/cmWIXSourceWriter.cxx b/Source/CPack/WiX/cmWIXSourceWriter.cxx index 219fca84a..8d38e9b58 100644 --- a/Source/CPack/WiX/cmWIXSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXSourceWriter.cxx @@ -128,7 +128,7 @@ void cmWIXSourceWriter::AddAttribute( void cmWIXSourceWriter::AddAttributeUnlessEmpty( std::string const& key, std::string const& value) { - if(value.size()) + if(!value.empty()) { AddAttribute(key, value); } diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index 58bd94730..70de757c7 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -78,7 +78,7 @@ int cmCPackArchiveGenerator::addOneComponentToArchive(cmArchiveWrite& archive, std::string rp = filePrefix + *fileIt; cmCPackLogger(cmCPackLog::LOG_DEBUG,"Adding file: " << rp << std::endl); - archive.Add(rp); + archive.Add(rp, 0, 0, false); if (!archive) { cmCPackLogger(cmCPackLog::LOG_ERROR, "ERROR while packaging files: " @@ -284,7 +284,7 @@ int cmCPackArchiveGenerator::PackageFiles() // Get the relative path to the file std::string rp = cmSystemTools::RelativePath(toplevel.c_str(), fileIt->c_str()); - archive.Add(rp); + archive.Add(rp, 0, 0, false); if(!archive) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem while adding file< " diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index 5049a3f33..04efb71aa 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -15,6 +15,7 @@ #include "cmMakefile.h" #include "cmGeneratedFileStream.h" #include "cmCPackLog.h" +#include "cmArchiveWrite.h" #include #include @@ -94,6 +95,7 @@ int cmCPackDebGenerator::PackageOnePack(std::string initialTopLevel, std::string findExpr(this->GetOption("GEN_WDIR")); findExpr += "/*"; gl.RecurseOn(); + gl.SetRecurseListDirs(true); if ( !gl.FindFiles(findExpr) ) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -221,6 +223,7 @@ int cmCPackDebGenerator::PackageComponentsAllInOne() std::string findExpr(this->GetOption("GEN_WDIR")); findExpr += "/*"; gl.RecurseOn(); + gl.SetRecurseListDirs(true); if ( !gl.FindFiles(findExpr) ) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -388,9 +391,9 @@ int cmCPackDebGenerator::createDeb() { std::string dirName = this->GetOption("CPACK_TEMPORARY_DIRECTORY"); dirName += '/'; - for (std::vector::const_iterator fileIt = - packageFiles.begin(); - fileIt != packageFiles.end(); ++ fileIt ) + for (std::vector::const_iterator fileIt = + packageFiles.begin(); + fileIt != packageFiles.end(); ++ fileIt ) { totalSize += cmSystemTools::FileLength(*fileIt); } @@ -401,8 +404,9 @@ int cmCPackDebGenerator::createDeb() out << std::endl; } - std::string cmd(this->GetOption("GEN_CPACK_DEBIAN_FAKEROOT_EXECUTABLE")); + const std::string strGenWDIR(this->GetOption("GEN_WDIR")); + cmArchiveWrite::Compress tar_compression_type = cmArchiveWrite::CompressGZip; const char* debian_compression_type = this->GetOption("GEN_CPACK_DEBIAN_COMPRESSION_TYPE"); if(!debian_compression_type) @@ -410,108 +414,136 @@ int cmCPackDebGenerator::createDeb() debian_compression_type = "gzip"; } - std::string cmake_tar = " ", compression_modifier = "a", compression_suffix; + std::string compression_suffix; if(!strcmp(debian_compression_type, "lzma")) { compression_suffix = ".lzma"; + tar_compression_type = cmArchiveWrite::CompressLZMA; } else if(!strcmp(debian_compression_type, "xz")) { compression_suffix = ".xz"; + tar_compression_type = cmArchiveWrite::CompressXZ; } else if(!strcmp(debian_compression_type, "bzip2")) { compression_suffix = ".bz2"; - compression_modifier = "j"; - cmake_tar += "\"" + cmSystemTools::GetCMakeCommand() + "\" -E "; + tar_compression_type = cmArchiveWrite::CompressBZip2; } else if(!strcmp(debian_compression_type, "gzip")) { compression_suffix = ".gz"; - compression_modifier = "z"; - cmake_tar += "\"" + cmSystemTools::GetCMakeCommand() + "\" -E "; + tar_compression_type = cmArchiveWrite::CompressGZip; } else if(!strcmp(debian_compression_type, "none")) { compression_suffix = ""; - compression_modifier = ""; - cmake_tar += "\"" + cmSystemTools::GetCMakeCommand() + "\" -E "; + tar_compression_type = cmArchiveWrite::CompressNone; } else { cmCPackLogger(cmCPackLog::LOG_ERROR, "Error unrecognized compression type: " << debian_compression_type << std::endl); } - cmd += cmake_tar + "tar c" + compression_modifier + "f data.tar" - + compression_suffix; - // now add all directories which have to be compressed - // collect all top level install dirs for that - // e.g. /opt/bin/foo, /usr/bin/bar and /usr/bin/baz would give /usr and /opt - size_t topLevelLength = std::string(this->GetOption("GEN_WDIR")).length(); - cmCPackLogger(cmCPackLog::LOG_DEBUG, "WDIR: \"" - << this->GetOption("GEN_WDIR") - << "\", length = " << topLevelLength + std::string filename_data_tar = strGenWDIR + + "/data.tar" + compression_suffix; + + // atomic file generation for data.tar + { + cmGeneratedFileStream fileStream_data_tar; + fileStream_data_tar.Open(filename_data_tar.c_str(), false, true); + if(!fileStream_data_tar) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Error opening the file \"" << filename_data_tar << "\" for writing" << std::endl); - std::set installDirs; + return 0; + } + cmArchiveWrite data_tar(fileStream_data_tar, tar_compression_type, "paxr"); + + // uid/gid should be the one of the root user, and this root user has + // always uid/gid equal to 0. + data_tar.SetUIDAndGID(0u, 0u); + data_tar.SetUNAMEAndGNAME("root", "root"); + + // now add all directories which have to be compressed + // collect all top level install dirs for that + // e.g. /opt/bin/foo, /usr/bin/bar and /usr/bin/baz would + // give /usr and /opt + size_t topLevelLength = strGenWDIR.length(); + cmCPackLogger(cmCPackLog::LOG_DEBUG, "WDIR: \"" + << strGenWDIR + << "\", length = " << topLevelLength + << std::endl); + std::set orderedFiles; + + // we have to reconstruct the parent folders as well + for (std::vector::const_iterator fileIt = - packageFiles.begin(); - fileIt != packageFiles.end(); ++ fileIt ) - { - cmCPackLogger(cmCPackLog::LOG_DEBUG, "FILEIT: \"" << *fileIt << "\"" - << std::endl); - std::string::size_type slashPos = fileIt->find('/', topLevelLength+1); - std::string relativeDir = fileIt->substr(topLevelLength, - slashPos - topLevelLength); - cmCPackLogger(cmCPackLog::LOG_DEBUG, "RELATIVEDIR: \"" << relativeDir - << "\"" << std::endl); - if (installDirs.find(relativeDir) == installDirs.end()) + packageFiles.begin(); + fileIt != packageFiles.end(); ++ fileIt ) { - installDirs.insert(relativeDir); - cmd += " ."; - cmd += relativeDir; + std::string currentPath = *fileIt; + while(currentPath != strGenWDIR) + { + // the last one IS strGenWDIR, but we do not want this one: + // XXX/application/usr/bin/myprogram with GEN_WDIR=XXX/application + // should not add XXX/application + orderedFiles.insert(currentPath); + currentPath = cmSystemTools::CollapseCombinedPath(currentPath, ".."); + } } - } - std::string output; - int retval = -1; - int res = cmSystemTools::RunSingleCommand(cmd.c_str(), &output, &output, - &retval, this->GetOption("GEN_WDIR"), this->GeneratorVerbose, 0); - if ( !res || retval ) - { - std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); - tmpFile += "/Deb.log"; - cmGeneratedFileStream ofs(tmpFile.c_str()); - ofs << "# Run command: " << cmd << std::endl - << "# Working directory: " << toplevel << std::endl - << "# Output:" << std::endl - << output << std::endl; - cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running tar command: " - << cmd << std::endl - << "Please check " << tmpFile << " for errors" << std::endl); - return 0; - } + for (std::set::const_iterator fileIt = + orderedFiles.begin(); + fileIt != orderedFiles.end(); ++ fileIt ) + { + cmCPackLogger(cmCPackLog::LOG_DEBUG, "FILEIT: \"" << *fileIt << "\"" + << std::endl); + std::string::size_type slashPos = fileIt->find('/', topLevelLength+1); + std::string relativeDir = fileIt->substr(topLevelLength, + slashPos - topLevelLength); + cmCPackLogger(cmCPackLog::LOG_DEBUG, "RELATIVEDIR: \"" << relativeDir + << "\"" << std::endl); + + // do not recurse because the loop will do it + if(!data_tar.Add(*fileIt, topLevelLength, ".", false)) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Problem adding file to tar:" << std::endl + << "#top level directory: " + << strGenWDIR << std::endl + << "#file: " << *fileIt << std::endl + << "#error:" << data_tar.GetError() << std::endl); + return 0; + } + } + } // scope for file generation - std::string md5filename; - md5filename = this->GetOption("GEN_WDIR"); - md5filename += "/md5sums"; - { // the scope is needed for cmGeneratedFileStream + std::string md5filename = strGenWDIR + "/md5sums"; + { + // the scope is needed for cmGeneratedFileStream cmGeneratedFileStream out(md5filename.c_str()); - std::vector::const_iterator fileIt; -// std::string topLevelWithTrailingSlash = toplevel; + std::string topLevelWithTrailingSlash = this->GetOption("CPACK_TEMPORARY_DIRECTORY"); topLevelWithTrailingSlash += '/'; - for ( fileIt = packageFiles.begin(); - fileIt != packageFiles.end(); ++ fileIt ) + for (std::vector::const_iterator fileIt = + packageFiles.begin(); + fileIt != packageFiles.end(); ++ fileIt ) { - cmd = "\""; - cmd += cmSystemTools::GetCMakeCommand(); - cmd += "\" -E md5sum \""; - cmd += *fileIt; - cmd += "\""; - //std::string output; - //int retVal = -1; - res = cmSystemTools::RunSingleCommand(cmd.c_str(), &output, &output, - &retval, toplevel.c_str(), this->GeneratorVerbose, 0); - if ( !res || retval ) + // hash only regular files + if( cmSystemTools::FileIsDirectory(*fileIt) + || cmSystemTools::FileIsSymlink(*fileIt)) + { + continue; + } + + char md5sum[33]; + if(!cmSystemTools::ComputeFileMD5(*fileIt, md5sum)) { - cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running cmake -E md5sum " - << cmd << std::endl); + cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem computing the md5 of " + << *fileIt << std::endl); } + + md5sum[32] = 0; + + std::string output(md5sum); + output += " " + *fileIt + "\n"; // debian md5sums entries are like this: // 014f3604694729f3bf19263bac599765 usr/bin/ccmake // thus strip the full path (with the trailing slash) @@ -521,70 +553,116 @@ int cmCPackDebGenerator::createDeb() } // each line contains a eol. // Do not end the md5sum file with yet another (invalid) - } + } - // set md5sum file permissins to RW-R--R-- so that deb lintian doesn't warn - // about it - cmSystemTools::SetPermissions(md5filename.c_str(), - S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); - cmd = this->GetOption("GEN_CPACK_DEBIAN_FAKEROOT_EXECUTABLE"); - cmd += cmake_tar + "tar czf control.tar.gz ./control ./md5sums"; + + std::string filename_control_tar = strGenWDIR + "/control.tar.gz"; + // atomic file generation for control.tar + { + cmGeneratedFileStream fileStream_control_tar; + fileStream_control_tar.Open(filename_control_tar.c_str(), false, true); + if(!fileStream_control_tar) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Error opening the file \"" << filename_control_tar + << "\" for writing" << std::endl); + return 0; + } + cmArchiveWrite control_tar(fileStream_control_tar, + cmArchiveWrite::CompressGZip, + "paxr"); + + // sets permissions and uid/gid for the files + control_tar.SetUIDAndGID(0u, 0u); + control_tar.SetUNAMEAndGNAME("root", "root"); + + /* permissions are set according to + https://www.debian.org/doc/debian-policy/ch-files.html#s-permissions-owners + and + https://lintian.debian.org/tags/control-file-has-bad-permissions.html + */ + const mode_t permission644 = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH; + const mode_t permissionExecute = S_IXUSR | S_IXGRP | S_IXOTH; + const mode_t permission755 = permission644 | permissionExecute; + + // for md5sum and control (that we have generated here), we use 644 + // (RW-R--R--) + // so that deb lintian doesn't warn about it + control_tar.SetPermissions(permission644); + + // adds control and md5sums + if( !control_tar.Add(md5filename, strGenWDIR.length(), ".") + || !control_tar.Add(strGenWDIR + "/control", strGenWDIR.length(), ".")) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Error adding file to tar:" << std::endl + << "#top level directory: " + << strGenWDIR << std::endl + << "#file: \"control\" or \"md5sums\"" << std::endl + << "#error:" << control_tar.GetError() << std::endl); + return 0; + } + + // for the other files, we use + // -either the original permission on the files + // -either a permission strictly defined by the Debian policies const char* controlExtra = this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA"); - if( controlExtra ) - { - std::vector controlExtraList; - cmSystemTools::ExpandListArgument(controlExtra, controlExtraList); - for(std::vector::iterator i = - controlExtraList.begin(); i != controlExtraList.end(); ++i) + if( controlExtra ) { - std::string filenamename = - cmsys::SystemTools::GetFilenameName(*i); - std::string localcopy = this->GetOption("GEN_WDIR"); - localcopy += "/"; - localcopy += filenamename; - // if we can copy the file, it means it does exist, let's add it: - if( cmsys::SystemTools::CopyFileIfDifferent( - *i, localcopy) ) + // permissions are now controlled by the original file permissions + + const bool permissionStrictPolicy = + this->IsSet("GEN_CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION"); + + static const char* strictFiles[] = { + "config", "postinst", "postrm", "preinst", "prerm" + }; + std::set setStrictFiles( + strictFiles, + strictFiles + sizeof(strictFiles)/sizeof(strictFiles[0])); + + // default + control_tar.ClearPermissions(); + + std::vector controlExtraList; + cmSystemTools::ExpandListArgument(controlExtra, controlExtraList); + for(std::vector::iterator i = controlExtraList.begin(); + i != controlExtraList.end(); ++i) { - // debian is picky and need relative to ./ path in the tar.* - cmd += " ./"; - cmd += filenamename; + std::string filenamename = + cmsys::SystemTools::GetFilenameName(*i); + std::string localcopy = strGenWDIR + "/" + filenamename; + + if(permissionStrictPolicy) + { + control_tar.SetPermissions(setStrictFiles.count(filenamename) ? + permission755 : permission644); + } + + // if we can copy the file, it means it does exist, let's add it: + if( cmsys::SystemTools::CopyFileIfDifferent(*i, localcopy) ) + { + control_tar.Add(localcopy, strGenWDIR.length(), "."); + } } } - } - res = cmSystemTools::RunSingleCommand(cmd.c_str(), &output, &output, - &retval, this->GetOption("GEN_WDIR"), this->GeneratorVerbose, 0); + } - if ( !res || retval ) - { - std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); - tmpFile += "/Deb.log"; - cmGeneratedFileStream ofs(tmpFile.c_str()); - ofs << "# Run command: " << cmd << std::endl - << "# Working directory: " << toplevel << std::endl - << "# Output:" << std::endl - << output << std::endl; - cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running tar command: " - << cmd << std::endl - << "Please check " << tmpFile << " for errors" << std::endl); - return 0; - } // ar -r your-package-name.deb debian-binary control.tar.* data.tar.* // since debian packages require BSD ar (most Linux distros and even // FreeBSD and NetBSD ship GNU ar) we use a copy of OpenBSD ar here. std::vector arFiles; - std::string topLevelString = this->GetOption("GEN_WDIR"); - topLevelString += "/"; + std::string topLevelString = strGenWDIR + "/"; arFiles.push_back(topLevelString + "debian-binary"); arFiles.push_back(topLevelString + "control.tar.gz"); arFiles.push_back(topLevelString + "data.tar" + compression_suffix); - std::string outputFileName = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); - outputFileName += "/"; - outputFileName += this->GetOption("CPACK_OUTPUT_FILE_NAME"); - res = ar_append(outputFileName.c_str(), arFiles); + std::string outputFileName = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); + outputFileName += "/"; + outputFileName += this->GetOption("CPACK_OUTPUT_FILE_NAME"); + int res = ar_append(outputFileName.c_str(), arFiles); if ( res!=0 ) { std::string tmpFile = this->GetOption("CPACK_TEMPORARY_PACKAGE_FILE_NAME"); diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index bf4df60c2..def9fc7b6 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -367,6 +367,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- Install directory: " << top << std::endl); gl.RecurseOn(); + gl.SetRecurseListDirs(true); if ( !gl.FindFiles(findExpr) ) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -379,7 +380,11 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( for ( gfit = files.begin(); gfit != files.end(); ++ gfit ) { bool skip = false; - std::string &inFile = *gfit; + std::string inFile = *gfit; + if(cmSystemTools::FileIsDirectory(*gfit)) + { + inFile += '/'; + } for ( regIt= ignoreFilesRegex.begin(); regIt!= ignoreFilesRegex.end(); ++ regIt) @@ -716,8 +721,10 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( cm.AddCMakePaths(); cm.SetProgressCallback(cmCPackGeneratorProgress, this); cmGlobalGenerator gg(&cm); - cmsys::auto_ptr lg(gg.MakeLocalGenerator()); - cmMakefile *mf = lg->GetMakefile(); + cmsys::auto_ptr mf( + new cmMakefile(&gg, cm.GetCurrentSnapshot())); + cmsys::auto_ptr lg( + gg.CreateLocalGenerator(mf.get())); std::string realInstallDirectory = tempInstallDirectory; if ( !installSubDirectory.empty() && installSubDirectory != "/" ) { @@ -867,6 +874,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( cmsys::Glob glB; findExpr += "/*"; glB.RecurseOn(); + glB.SetRecurseListDirs(true); glB.FindFiles(findExpr); filesBefore = glB.GetFiles(); std::sort(filesBefore.begin(),filesBefore.end()); @@ -906,6 +914,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( { cmsys::Glob glA; glA.RecurseOn(); + glA.SetRecurseListDirs(true); glA.FindFiles(findExpr); std::vector filesAfter = glA.GetFiles(); std::sort(filesAfter.begin(),filesAfter.end()); @@ -1072,6 +1081,7 @@ int cmCPackGenerator::DoPackage() std::string findExpr = tempDirectory; findExpr += "/*"; gl.RecurseOn(); + gl.SetRecurseListDirs(true); gl.SetRecurseThroughSymlinks(false); if ( !gl.FindFiles(findExpr) ) { diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index 2de2bc4a6..6cdda2832 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -49,7 +49,7 @@ int cmCPackNSISGenerator::PackageFiles() // TODO: Fix nsis to force out file name std::string nsisInFileName = this->FindTemplate("NSIS.template.in"); - if ( nsisInFileName.size() == 0 ) + if (nsisInFileName.empty()) { cmCPackLogger(cmCPackLog::LOG_ERROR, "CPack error: Could not find NSIS installer template file." @@ -58,7 +58,7 @@ int cmCPackNSISGenerator::PackageFiles() } std::string nsisInInstallOptions = this->FindTemplate("NSIS.InstallOptions.ini.in"); - if ( nsisInInstallOptions.size() == 0 ) + if (nsisInInstallOptions.empty()) { cmCPackLogger(cmCPackLog::LOG_ERROR, "CPack error: Could not find NSIS installer options file." @@ -536,7 +536,7 @@ int cmCPackNSISGenerator::InitializeInternal() << ".lnk\"" << std::endl; // see if CPACK_CREATE_DESKTOP_LINK_ExeName is on // if so add a desktop link - if(cpackPackageDesktopLinksVector.size() && + if(!cpackPackageDesktopLinksVector.empty() && std::find(cpackPackageDesktopLinksVector.begin(), cpackPackageDesktopLinksVector.end(), execName) diff --git a/Source/CPack/cmCPackSTGZGenerator.cxx b/Source/CPack/cmCPackSTGZGenerator.cxx index e5da5cfe1..109dcb71f 100644 --- a/Source/CPack/cmCPackSTGZGenerator.cxx +++ b/Source/CPack/cmCPackSTGZGenerator.cxx @@ -19,7 +19,6 @@ #include "cmMakefile.h" #include "cmCPackLog.h" -#include #include #include #include @@ -85,7 +84,7 @@ int cmCPackSTGZGenerator::PackageFiles() int cmCPackSTGZGenerator::GenerateHeader(std::ostream* os) { cmCPackLogger(cmCPackLog::LOG_DEBUG, "Writing header" << std::endl); - cmsys_ios::ostringstream str; + std::ostringstream str; int counter = 0; std::string inLicFile = this->GetOption("CPACK_RESOURCE_FILE_LICENSE"); diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index c2fe76318..cb9cbc49e 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -202,8 +202,10 @@ int main (int argc, char const* const* argv) cminst.SetHomeOutputDirectory(""); cminst.GetState()->RemoveUnscriptableCommands(); cmGlobalGenerator cmgg(&cminst); - cmsys::auto_ptr cmlg(cmgg.MakeLocalGenerator()); - cmMakefile* globalMF = cmlg->GetMakefile(); + cmsys::auto_ptr globalMF( + new cmMakefile(&cmgg, cminst.GetCurrentSnapshot())); + cmsys::auto_ptr cmlg( + cmgg.CreateLocalGenerator(globalMF.get())); #if defined(__CYGWIN__) globalMF->AddDefinition("CMAKE_LEGACY_CYGWIN_WIN32", "0"); #endif @@ -357,8 +359,8 @@ int main (int argc, char const* const* argv) ++it ) { const char* gen = it->c_str(); - cmMakefile::ScopePushPop raii(globalMF); - cmMakefile* mf = globalMF; + cmMakefile::ScopePushPop raii(globalMF.get()); + cmMakefile* mf = globalMF.get(); cmCPack_Log(&log, cmCPackLog::LOG_VERBOSE, "Specified generator: " << gen << std::endl); if ( parsed && !mf->GetDefinition("CPACK_PACKAGE_NAME") ) diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index e141b6019..6dbb2451c 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -920,7 +920,7 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command, char* data; int length; - cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_PROGRESS_OUTPUT, " Each symbol represents " << tick_len << " bytes of output." << std::endl << (this->UseCTestLaunch? "" : @@ -968,7 +968,7 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command, this->ProcessBuffer(0, 0, tick, tick_len, ofs, &this->BuildProcessingQueue); this->ProcessBuffer(0, 0, tick, tick_len, ofs, &this->BuildProcessingErrorQueue); - cmCTestOptionalLog(this->CTest, OUTPUT, " Size of output: " + cmCTestOptionalLog(this->CTest, HANDLER_PROGRESS_OUTPUT, " Size of output: " << ((this->BuildOutputLogSize + 512) / 1024) << "K" << std::endl, this->Quiet); @@ -1175,12 +1175,12 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, int length, while ( this->BuildOutputLogSize > (tick * tick_len) ) { tick ++; - cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, this->LastTickChar, - this->Quiet); + cmCTestOptionalLog(this->CTest, HANDLER_PROGRESS_OUTPUT, + this->LastTickChar, this->Quiet); tickDisplayed = true; if ( tick % tick_line_len == 0 && tick > 0 ) { - cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Size: " + cmCTestOptionalLog(this->CTest, HANDLER_PROGRESS_OUTPUT, " Size: " << ((this->BuildOutputLogSize + 512) / 1024) << "K" << std::endl << " ", this->Quiet); } diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index f92f19ad8..20807c8ea 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -27,8 +27,6 @@ #include #include #include -#include -#include #include #include @@ -446,7 +444,7 @@ int cmCTestCoverageHandler::ProcessHandler() } std::set uncovered = this->FindUncoveredFiles(&cont); - if ( file_count == 0 ) + if (file_count == 0 && this->ExtraCoverageGlobs.empty()) { cmCTestOptionalLog(this->CTest, WARNING, " Cannot find any coverage files. Ignoring Coverage request." @@ -1474,7 +1472,12 @@ int cmCTestCoverageHandler::HandleLCovCoverage( << std::endl, this->Quiet); std::vector files; - this->FindLCovFiles(files); + if (!this->FindLCovFiles(files)) + { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "Error while finding LCov files.\n"); + return 0; + } std::vector::iterator it; if (files.empty()) @@ -1745,18 +1748,28 @@ void cmCTestCoverageHandler::FindGCovFiles(std::vector& files) } //---------------------------------------------------------------------------- -void cmCTestCoverageHandler::FindLCovFiles(std::vector& files) +bool cmCTestCoverageHandler::FindLCovFiles(std::vector& files) { cmsys::Glob gl; gl.RecurseOff(); // No need of recurse if -prof_dir${BUILD_DIR} flag is // used while compiling. gl.RecurseThroughSymlinksOff(); std::string prevBinaryDir; - cmSystemTools::ChangeDirectory( - this->CTest->GetCTestConfiguration("BuildDirectory")); + std::string buildDir = this->CTest->GetCTestConfiguration("BuildDirectory"); + if (cmSystemTools::ChangeDirectory(buildDir)) + { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "Error changing directory to " << buildDir << std::endl); + return false; + } // Run profmerge to merge all *.dyn files into dpi files - cmSystemTools::RunSingleCommand("profmerge"); + if (!cmSystemTools::RunSingleCommand("profmerge")) + { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "Error while running profmerge.\n"); + return false; + } prevBinaryDir = cmSystemTools::GetCurrentWorkingDirectory().c_str(); @@ -1766,10 +1779,16 @@ void cmCTestCoverageHandler::FindLCovFiles(std::vector& files) daGlob += "/*.dpi"; cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " looking for dpi files in: " << daGlob << std::endl, this->Quiet); - gl.FindFiles(daGlob); + if (!gl.FindFiles(daGlob)) + { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "Error while finding files matching " << daGlob << std::endl); + return false; + } files.insert(files.end(), gl.GetFiles().begin(), gl.GetFiles().end()); cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Now searching in: " << daGlob << std::endl, this->Quiet); + return true; } //---------------------------------------------------------------------- diff --git a/Source/CTest/cmCTestCoverageHandler.h b/Source/CTest/cmCTestCoverageHandler.h index 2ca123a20..7102d1e67 100644 --- a/Source/CTest/cmCTestCoverageHandler.h +++ b/Source/CTest/cmCTestCoverageHandler.h @@ -75,7 +75,7 @@ private: //! Handle coverage using Intel's LCov int HandleLCovCoverage(cmCTestCoverageHandlerContainer* cont); - void FindLCovFiles(std::vector& files); + bool FindLCovFiles(std::vector& files); //! Handle coverage using xdebug php coverage int HandlePHPCoverage(cmCTestCoverageHandlerContainer* cont); diff --git a/Source/CTest/cmCTestCurl.cxx b/Source/CTest/cmCTestCurl.cxx index b4c013724..fb6cc007f 100644 --- a/Source/CTest/cmCTestCurl.cxx +++ b/Source/CTest/cmCTestCurl.cxx @@ -166,6 +166,10 @@ bool cmCTestCurl::UploadFile(std::string const& local_file, curlWriteMemoryCallback); ::curl_easy_setopt(this->Curl, CURLOPT_DEBUGFUNCTION, curlDebugCallback); + // Be sure to set Content-Type to satisfy fussy modsecurity rules + struct curl_slist *headers = ::curl_slist_append(NULL, + "Content-Type: text/xml"); + ::curl_easy_setopt(this->Curl, CURLOPT_HTTPHEADER, headers); std::vector responseData; std::vector debugData; ::curl_easy_setopt(this->Curl, CURLOPT_FILE, (void *)&responseData); @@ -174,6 +178,8 @@ bool cmCTestCurl::UploadFile(std::string const& local_file, // Now run off and do what you've been told! ::curl_easy_perform(this->Curl); ::fclose(ftpfile); + ::curl_easy_setopt(this->Curl, CURLOPT_HTTPHEADER, NULL); + ::curl_slist_free_all(headers); if ( responseData.size() > 0 ) { diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx index c32e87657..bbb3b9d47 100644 --- a/Source/CTest/cmCTestGIT.cxx +++ b/Source/CTest/cmCTestGIT.cxx @@ -16,7 +16,6 @@ #include "cmAlgorithms.h" #include -#include #include #include diff --git a/Source/CTest/cmCTestGenericHandler.cxx b/Source/CTest/cmCTestGenericHandler.cxx index 81eb0a808..ad79ba2b1 100644 --- a/Source/CTest/cmCTestGenericHandler.cxx +++ b/Source/CTest/cmCTestGenericHandler.cxx @@ -23,6 +23,7 @@ cmCTestGenericHandler::cmCTestGenericHandler() this->SubmitIndex = 0; this->AppendXML = false; this->Quiet = false; + this->TestLoad = 0; } //---------------------------------------------------------------------- @@ -70,6 +71,7 @@ void cmCTestGenericHandler::SetPersistentOption(const std::string& op, void cmCTestGenericHandler::Initialize() { this->AppendXML = false; + this->TestLoad = 0; this->Options.clear(); t_StringToString::iterator it; for ( it = this->PersistentOptions.begin(); diff --git a/Source/CTest/cmCTestGenericHandler.h b/Source/CTest/cmCTestGenericHandler.h index 8567dd7cd..4b7ae7901 100644 --- a/Source/CTest/cmCTestGenericHandler.h +++ b/Source/CTest/cmCTestGenericHandler.h @@ -89,6 +89,8 @@ public: void SetAppendXML(bool b) { this->AppendXML = b; } void SetQuiet(bool b) { this->Quiet = b; } bool GetQuiet() { return this->Quiet; } + void SetTestLoad(unsigned long load) { this->TestLoad = load; } + unsigned long GetTestLoad() const { return this->TestLoad; } protected: bool StartResultingXML(cmCTest::Part part, @@ -97,6 +99,7 @@ protected: bool AppendXML; bool Quiet; + unsigned long TestLoad; cmSystemTools::OutputOption HandlerVerbose; cmCTest *CTest; t_StringToString Options; diff --git a/Source/CTest/cmCTestHandlerCommand.cxx b/Source/CTest/cmCTestHandlerCommand.cxx index 3003e8a1c..3579aee19 100644 --- a/Source/CTest/cmCTestHandlerCommand.cxx +++ b/Source/CTest/cmCTestHandlerCommand.cxx @@ -109,6 +109,12 @@ bool cmCTestHandlerCommand this->Quiet); } + if(const char* changeId = + this->Makefile->GetDefinition("CTEST_CHANGE_ID")) + { + this->CTest->SetCTestConfiguration("ChangeId", changeId, this->Quiet); + } + cmCTestLog(this->CTest, DEBUG, "Initialize handler" << std::endl;); cmCTestGenericHandler* handler = this->InitializeHandler(); if ( !handler ) diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx index 0f588c584..fb0cce634 100644 --- a/Source/CTest/cmCTestLaunch.cxx +++ b/Source/CTest/cmCTestLaunch.cxx @@ -738,8 +738,9 @@ void cmCTestLaunch::LoadConfig() cm.SetHomeDirectory(""); cm.SetHomeOutputDirectory(""); cmGlobalGenerator gg(&cm); - cmsys::auto_ptr lg(gg.MakeLocalGenerator()); - cmMakefile* mf = lg->GetMakefile(); + cmsys::auto_ptr mf(new cmMakefile(&gg, cm.GetCurrentSnapshot())); + cmsys::auto_ptr lg( + gg.CreateLocalGenerator(mf.get())); std::string fname = this->LogDir; fname += "CTestLaunchConfig.cmake"; if(cmSystemTools::FileExists(fname.c_str()) && diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index bd090db97..7c7f5dfe2 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -13,12 +13,15 @@ #include "cmProcess.h" #include "cmStandardIncludes.h" #include "cmCTest.h" +#include "cmCTestScriptHandler.h" #include "cmSystemTools.h" #include #include #include #include +#include #include +#include class TestComparator { @@ -40,10 +43,12 @@ private: cmCTestMultiProcessHandler::cmCTestMultiProcessHandler() { this->ParallelLevel = 1; + this->TestLoad = 0; this->Completed = 0; this->RunningCount = 0; this->StopTimePassed = false; this->HasCycles = false; + this->SerialTestRunning = false; } cmCTestMultiProcessHandler::~cmCTestMultiProcessHandler() @@ -83,6 +88,11 @@ void cmCTestMultiProcessHandler::SetParallelLevel(size_t level) this->ParallelLevel = level < 1 ? 1 : level; } +void cmCTestMultiProcessHandler::SetTestLoad(unsigned long load) +{ + this->TestLoad = load; +} + //--------------------------------------------------------- void cmCTestMultiProcessHandler::RunTests() { @@ -172,6 +182,11 @@ void cmCTestMultiProcessHandler::LockResources(int index) this->LockedResources.insert( this->Properties[index]->LockedResources.begin(), this->Properties[index]->LockedResources.end()); + + if (this->Properties[index]->RunSerial) + { + this->SerialTestRunning = true; + } } //--------------------------------------------------------- @@ -183,6 +198,10 @@ void cmCTestMultiProcessHandler::UnlockResources(int index) { this->LockedResources.erase(*i); } + if (this->Properties[index]->RunSerial) + { + this->SerialTestRunning = false; + } } //--------------------------------------------------------- @@ -198,17 +217,20 @@ inline size_t cmCTestMultiProcessHandler::GetProcessorsUsed(int test) { size_t processors = static_cast(this->Properties[test]->Processors); - //If this is set to run serially, it must run alone. - //Also, if processors setting is set higher than the -j + //If processors setting is set higher than the -j //setting, we default to using all of the process slots. - if(this->Properties[test]->RunSerial - || processors > this->ParallelLevel) + if (processors > this->ParallelLevel) { processors = this->ParallelLevel; } return processors; } +std::string cmCTestMultiProcessHandler::GetName(int test) +{ + return this->Properties[test]->Name; +} + //--------------------------------------------------------- bool cmCTestMultiProcessHandler::StartTest(int test) { @@ -248,22 +270,136 @@ void cmCTestMultiProcessHandler::StartNextTests() return; } + // Don't start any new tests if one with the RUN_SERIAL property + // is already running. + if (this->SerialTestRunning) + { + return; + } + + bool allTestsFailedTestLoadCheck = false; + bool usedFakeLoadForTesting = false; + size_t minProcessorsRequired = this->ParallelLevel; + std::string testWithMinProcessors = ""; + + cmsys::SystemInformation info; + + unsigned long systemLoad = 0; + size_t spareLoad = 0; + if (this->TestLoad > 0) + { + // Activate possible wait. + allTestsFailedTestLoadCheck = true; + + // Check for a fake load average value used in testing. + if (const char* fake_load_value = + cmSystemTools::GetEnv("__CTEST_FAKE_LOAD_AVERAGE_FOR_TESTING")) + { + usedFakeLoadForTesting = true; + if (!cmSystemTools::StringToULong(fake_load_value, &systemLoad)) + { + cmSystemTools::Error("Failed to parse fake load value: ", + fake_load_value); + } + } + // If it's not set, look up the true load average. + else + { + systemLoad = static_cast(ceil(info.GetLoadAverage())); + } + spareLoad = (this->TestLoad > systemLoad ? + this->TestLoad - systemLoad : 0); + + // Don't start more tests than the spare load can support. + if (numToStart > spareLoad) + { + numToStart = spareLoad; + } + } + TestList copy = this->SortedTests; for(TestList::iterator test = copy.begin(); test != copy.end(); ++test) { + // Take a nap if we're currently performing a RUN_SERIAL test. + if (this->SerialTestRunning) + { + break; + } + // We can only start a RUN_SERIAL test if no other tests are also running. + if (this->Properties[*test]->RunSerial && this->RunningCount > 0) + { + continue; + } + size_t processors = GetProcessorsUsed(*test); + bool testLoadOk = true; + if (this->TestLoad > 0) + { + if (processors <= spareLoad) + { + cmCTestLog(this->CTest, DEBUG, + "OK to run " << GetName(*test) << + ", it requires " << processors << + " procs & system load is: " << + systemLoad << std::endl); + allTestsFailedTestLoadCheck = false; + } + else + { + testLoadOk = false; + } + } - if(processors <= numToStart && this->StartTest(*test)) + if (processors <= minProcessorsRequired) { - if(this->StopTimePassed) - { - return; - } - numToStart -= processors; + minProcessorsRequired = processors; + testWithMinProcessors = GetName(*test); + } + + if(testLoadOk && processors <= numToStart && this->StartTest(*test)) + { + if(this->StopTimePassed) + { + return; + } + + numToStart -= processors; } else if(numToStart == 0) { - return; + break; + } + } + + if (allTestsFailedTestLoadCheck) + { + cmCTestLog(this->CTest, HANDLER_OUTPUT, "***** WAITING, "); + if (this->SerialTestRunning) + { + cmCTestLog(this->CTest, HANDLER_OUTPUT, + "Waiting for RUN_SERIAL test to finish."); + } + else + { + cmCTestLog(this->CTest, HANDLER_OUTPUT, + "System Load: " << systemLoad << ", " + "Max Allowed Load: " << this->TestLoad << ", " + "Smallest test " << testWithMinProcessors << + " requires " << minProcessorsRequired); + } + cmCTestLog(this->CTest, HANDLER_OUTPUT, "*****" << std::endl); + + if (usedFakeLoadForTesting) + { + // Break out of the infinite loop of waiting for our fake load + // to come down. + this->StopTimePassed = true; + } + else + { + // Wait between 1 and 5 seconds before trying again. + cmCTestScriptHandler::SleepInSeconds( + cmSystemTools::RandomSeed() % 5 + 1); } } } diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h index 6440fbc19..ed3e155a0 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.h +++ b/Source/CTest/cmCTestMultiProcessHandler.h @@ -37,6 +37,7 @@ public: void SetTests(TestMap& tests, PropertiesMap& properties); // Set the max number of tests that can be run at the same time. void SetParallelLevel(size_t); + void SetTestLoad(unsigned long load); virtual void RunTests(); void PrintTestList(); void PrintLabels(); @@ -93,6 +94,7 @@ protected: bool CheckCycles(); int FindMaxIndex(); inline size_t GetProcessorsUsed(int index); + std::string GetName(int index); void LockResources(int index); void UnlockResources(int index); @@ -116,11 +118,13 @@ protected: std::set LockedResources; std::vector* TestResults; size_t ParallelLevel; // max number of process that can be run at once + unsigned long TestLoad; std::set RunningTests; // current running tests cmCTestTestHandler * TestHandler; cmCTest* CTest; bool HasCycles; bool Quiet; + bool SerialTestRunning; }; #endif diff --git a/Source/CTest/cmCTestP4.cxx b/Source/CTest/cmCTestP4.cxx index ad8e8b340..5e0c54a3f 100644 --- a/Source/CTest/cmCTestP4.cxx +++ b/Source/CTest/cmCTestP4.cxx @@ -15,7 +15,6 @@ #include "cmSystemTools.h" #include -#include #include #include diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index d9e4bd4b9..d108592f6 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -57,8 +57,7 @@ bool cmCTestRunTest::CheckOutput() // Process has terminated and all output read. return false; } - else if(p == cmsysProcess_Pipe_STDOUT || - p == cmsysProcess_Pipe_STDERR) + else if(p == cmsysProcess_Pipe_STDOUT) { // Store this line of output. cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 047bd9835..c1ba2794a 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -125,42 +125,25 @@ void cmCTestScriptHandler::Initialize() // what time in seconds did this script start running this->ScriptStartTime = 0; + delete this->Makefile; this->Makefile = 0; - if (this->LocalGenerator) - { - delete this->LocalGenerator; - } + + delete this->LocalGenerator; this->LocalGenerator = 0; - if (this->GlobalGenerator) - { - delete this->GlobalGenerator; - } + + delete this->GlobalGenerator; this->GlobalGenerator = 0; - if (this->CMake) - { - delete this->CMake; - } + + delete this->CMake; } //---------------------------------------------------------------------- cmCTestScriptHandler::~cmCTestScriptHandler() { - // local generator owns the makefile - this->Makefile = 0; - if (this->LocalGenerator) - { - delete this->LocalGenerator; - } - this->LocalGenerator = 0; - if (this->GlobalGenerator) - { - delete this->GlobalGenerator; - } - this->GlobalGenerator = 0; - if (this->CMake) - { - delete this->CMake; - } + delete this->Makefile; + delete this->LocalGenerator; + delete this->GlobalGenerator; + delete this->CMake; } @@ -334,6 +317,7 @@ void cmCTestScriptHandler::CreateCMake() delete this->CMake; delete this->GlobalGenerator; delete this->LocalGenerator; + delete this->Makefile; } this->CMake = new cmake; this->CMake->SetHomeDirectory(""); @@ -341,8 +325,10 @@ void cmCTestScriptHandler::CreateCMake() this->CMake->AddCMakePaths(); this->GlobalGenerator = new cmGlobalGenerator(this->CMake); - this->LocalGenerator = this->GlobalGenerator->MakeLocalGenerator(); - this->Makefile = this->LocalGenerator->GetMakefile(); + cmState::Snapshot snapshot = this->CMake->GetCurrentSnapshot(); + this->Makefile = new cmMakefile(this->GlobalGenerator, snapshot); + this->LocalGenerator = + this->GlobalGenerator->CreateLocalGenerator(this->Makefile); this->CMake->SetProgressCallback(ctestScriptProgressCallback, this->CTest); diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 1e12f15c4..833cad6f0 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -338,6 +338,8 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, CURLcode res; FILE* ftpfile; char error_buffer[1024]; + struct curl_slist *headers = ::curl_slist_append(NULL, + "Content-Type: text/xml"); /* In windows, this will init the winsock stuff */ ::curl_global_init(CURL_GLOBAL_ALL); @@ -420,6 +422,9 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, ::curl_easy_setopt(curl, CURLOPT_PUT, 1); ::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); + // Be sure to set Content-Type to satisfy fussy modsecurity rules + ::curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); + std::string local_file = *file; if ( !cmSystemTools::FileExists(local_file.c_str()) ) { @@ -477,6 +482,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, cmCTestLog(this->CTest, ERROR_MESSAGE, " Cannot find file: " << local_file << std::endl); ::curl_easy_cleanup(curl); + ::curl_slist_free_all(headers); ::curl_global_cleanup(); return false; } @@ -621,6 +627,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, << std::endl); } ::curl_easy_cleanup(curl); + ::curl_slist_free_all(headers); ::curl_global_cleanup(); return false; } @@ -630,6 +637,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, " Uploaded: " + local_file << std::endl, this->Quiet); } } + ::curl_slist_free_all(headers); ::curl_global_cleanup(); return true; } diff --git a/Source/CTest/cmCTestTestCommand.cxx b/Source/CTest/cmCTestTestCommand.cxx index 8b357acd3..b7d8318f4 100644 --- a/Source/CTest/cmCTestTestCommand.cxx +++ b/Source/CTest/cmCTestTestCommand.cxx @@ -26,6 +26,7 @@ cmCTestTestCommand::cmCTestTestCommand() this->Arguments[ctt_PARALLEL_LEVEL] = "PARALLEL_LEVEL"; this->Arguments[ctt_SCHEDULE_RANDOM] = "SCHEDULE_RANDOM"; this->Arguments[ctt_STOP_TIME] = "STOP_TIME"; + this->Arguments[ctt_TEST_LOAD] = "TEST_LOAD"; this->Arguments[ctt_LAST] = 0; this->Last = ctt_LAST; } @@ -103,6 +104,38 @@ cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler() { this->CTest->SetStopTime(this->Values[ctt_STOP_TIME]); } + + // Test load is determined by: TEST_LOAD argument, + // or CTEST_TEST_LOAD script variable, or ctest --test-load + // command line argument... in that order. + unsigned long testLoad; + const char* ctestTestLoad + = this->Makefile->GetDefinition("CTEST_TEST_LOAD"); + if(this->Values[ctt_TEST_LOAD] && *this->Values[ctt_TEST_LOAD]) + { + if (!cmSystemTools::StringToULong(this->Values[ctt_TEST_LOAD], &testLoad)) + { + testLoad = 0; + cmCTestLog(this->CTest, WARNING, "Invalid value for 'TEST_LOAD' : " + << this->Values[ctt_TEST_LOAD] << std::endl); + } + } + else if(ctestTestLoad && *ctestTestLoad) + { + if (!cmSystemTools::StringToULong(ctestTestLoad, &testLoad)) + { + testLoad = 0; + cmCTestLog(this->CTest, WARNING, + "Invalid value for 'CTEST_TEST_LOAD' : " << + ctestTestLoad << std::endl); + } + } + else + { + testLoad = this->CTest->GetTestLoad(); + } + handler->SetTestLoad(testLoad); + handler->SetQuiet(this->Quiet); return handler; } diff --git a/Source/CTest/cmCTestTestCommand.h b/Source/CTest/cmCTestTestCommand.h index a1e5f368f..0dfca974d 100644 --- a/Source/CTest/cmCTestTestCommand.h +++ b/Source/CTest/cmCTestTestCommand.h @@ -60,6 +60,7 @@ protected: ctt_PARALLEL_LEVEL, ctt_SCHEDULE_RANDOM, ctt_STOP_TIME, + ctt_TEST_LOAD, ctt_LAST }; }; diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index f93b87b90..f9678e7ba 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -656,9 +656,8 @@ int cmCTestTestHandler::ProcessHandler() void cmCTestTestHandler::PrintLabelSummary() { cmCTestTestHandler::ListOfTests::iterator it = this->TestList.begin(); - cmCTestTestHandler::TestResultsVector::iterator ri = - this->TestResults.begin(); std::map labelTimes; + std::map labelCounts; std::set labels; // initialize maps std::string::size_type maxlen = 0; @@ -676,10 +675,12 @@ void cmCTestTestHandler::PrintLabelSummary() } labels.insert(*l); labelTimes[*l] = 0; + labelCounts[*l] = 0; } } } - ri = this->TestResults.begin(); + cmCTestTestHandler::TestResultsVector::iterator ri = + this->TestResults.begin(); // fill maps for(; ri != this->TestResults.end(); ++ri) { @@ -691,6 +692,7 @@ void cmCTestTestHandler::PrintLabelSummary() l != p.Labels.end(); ++l) { labelTimes[*l] += result.ExecutionTime; + ++labelCounts[*l]; } } } @@ -705,10 +707,21 @@ void cmCTestTestHandler::PrintLabelSummary() { std::string label = *i; label.resize(maxlen +3, ' '); + char buf[1024]; sprintf(buf, "%6.2f sec", labelTimes[*i]); + + std::ostringstream labelCountStr; + labelCountStr << "(" << labelCounts[*i] << " test"; + if (labelCounts[*i] > 1) + { + labelCountStr << "s"; + } + labelCountStr << ")"; + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "\n" - << label << " = " << buf, this->Quiet ); + << label << " = " << buf << " " << labelCountStr.str(), + this->Quiet ); if ( this->LogFile ) { *this->LogFile << "\n" << *i << " = " @@ -1062,6 +1075,14 @@ void cmCTestTestHandler::ProcessDirectory(std::vector &passed, parallel->SetParallelLevel(this->CTest->GetParallelLevel()); parallel->SetTestHandler(this); parallel->SetQuiet(this->Quiet); + if(this->TestLoad > 0) + { + parallel->SetTestLoad(this->TestLoad); + } + else + { + parallel->SetTestLoad(this->CTest->GetTestLoad()); + } *this->LogFile << "Start testing: " << this->CTest->CurrentTime() << std::endl @@ -1571,8 +1592,9 @@ void cmCTestTestHandler::GetListOfTests() cm.SetHomeDirectory(""); cm.SetHomeOutputDirectory(""); cmGlobalGenerator gg(&cm); - cmsys::auto_ptr lg(gg.MakeLocalGenerator()); - cmMakefile *mf = lg->GetMakefile(); + cmsys::auto_ptr mf(new cmMakefile(&gg, cm.GetCurrentSnapshot())); + cmsys::auto_ptr lg( + gg.CreateLocalGenerator(mf.get())); mf->AddDefinition("CTEST_CONFIGURATION_TYPE", this->CTest->GetConfigType().c_str()); diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h index 14067d5f4..c635430d9 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -65,6 +65,11 @@ public: void SetMaxIndex(int n) {this->MaxIndex = n;} int GetMaxIndex() {return this->MaxIndex;} + void SetTestOutputSizePassed(int n) + { this->CustomMaximumPassedTestOutputSize = n; } + void SetTestOutputSizeFailed(int n) + { this->CustomMaximumFailedTestOutputSize = n; } + ///! pass the -I argument down void SetTestsToRunInformation(const char*); diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx index 8494d28c3..963e50173 100644 --- a/Source/CTest/cmCTestUpdateHandler.cxx +++ b/Source/CTest/cmCTestUpdateHandler.cxx @@ -283,13 +283,13 @@ int cmCTestUpdateHandler::ProcessHandler() { xml.Content("Update command failed:\n"); xml.Content(vc->GetUpdateCommandLine()); - cmCTestLog(this->CTest, ERROR_MESSAGE, " Update command failed: " + cmCTestLog(this->CTest, HANDLER_OUTPUT, " Update command failed: " << vc->GetUpdateCommandLine() << "\n"); } xml.EndElement(); // UpdateReturnStatus xml.EndElement(); // Update xml.EndDocument(); - return numUpdated; + return updated? numUpdated : -1; } //---------------------------------------------------------------------- diff --git a/Source/CTest/cmParseJacocoCoverage.cxx b/Source/CTest/cmParseJacocoCoverage.cxx index 31ad9febc..47e3b3267 100644 --- a/Source/CTest/cmParseJacocoCoverage.cxx +++ b/Source/CTest/cmParseJacocoCoverage.cxx @@ -15,11 +15,9 @@ class cmParseJacocoCoverage::XMLParser: public cmXMLParser XMLParser(cmCTest* ctest, cmCTestCoverageHandlerContainer& cont) : CTest(ctest), Coverage(cont) { + this->FilePath = ""; + this->PackagePath = ""; this->PackageName = ""; - this->ModuleName = ""; - this->FileName = ""; - this->CurFileName = ""; - this->FilePaths.push_back(this->Coverage.SourceDir); } virtual ~XMLParser() @@ -38,58 +36,46 @@ class cmParseJacocoCoverage::XMLParser: public cmXMLParser if(name == "package") { this->PackageName = atts[1]; - std::string FilePath = this->Coverage.SourceDir + - "/" + this->ModuleName + "/src/main/java/" + - this->PackageName; - this->FilePaths.push_back(FilePath); - FilePath = this->Coverage.SourceDir + - "/src/main/java/" + this->PackageName; - this->FilePaths.push_back(FilePath); + this->PackagePath = ""; } else if(name == "sourcefile") { - this->FileName = atts[1]; - cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Reading file: " << this->FileName << std::endl, - this->Coverage.Quiet); - for(size_t i=0;i < FilePaths.size();i++) - { - std::string finalpath = FilePaths[i] + "/" + this->FileName; - if(cmSystemTools::FileExists(finalpath.c_str())) - { - this->CurFileName = finalpath; - break; - } - } - cmsys::ifstream fin(this->CurFileName.c_str()); - if(this->CurFileName == "" || !fin ) + std::string fileName = atts[1]; + + if (this->PackagePath == "") { - this->CurFileName = this->Coverage.BinaryDir + "/" + - this->FileName; - fin.open(this->CurFileName.c_str()); - if (!fin) + if(!this->FindPackagePath(fileName)) { - cmCTestLog(this->CTest, ERROR_MESSAGE, - "Jacoco Coverage: Error opening " << this->CurFileName - << std::endl); - this->Coverage.Error++; + cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot find file: " + << this->PackageName << "/" << fileName << std::endl); + this->Coverage.Error++; + return; } } - std::string line; - FileLinesType& curFileLines = - this->Coverage.TotalCoverage[this->CurFileName]; - if(fin) - { - curFileLines.push_back(-1); - } - while(cmSystemTools::GetLineFromStream(fin, line)) + + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Reading file: " << fileName << std::endl, + this->Coverage.Quiet); + + this->FilePath = this->PackagePath + "/" + fileName; + cmsys::ifstream fin(this->FilePath.c_str()); + if (!fin) { - curFileLines.push_back(-1); + cmCTestLog(this->CTest, ERROR_MESSAGE, + "Jacoco Coverage: Error opening " << this->FilePath + << std::endl); + } + std::string line; + FileLinesType& curFileLines = + this->Coverage.TotalCoverage[this->FilePath]; + if(fin) + { + curFileLines.push_back(-1); + } + while(cmSystemTools::GetLineFromStream(fin, line)) + { + curFileLines.push_back(-1); } - } - else if(name == "report") - { - this->ModuleName=atts[1]; } else if(name == "line") { @@ -109,7 +95,7 @@ class cmParseJacocoCoverage::XMLParser: public cmXMLParser if (ci > -1 && nr > 0) { FileLinesType& curFileLines= - this->Coverage.TotalCoverage[this->CurFileName]; + this->Coverage.TotalCoverage[this->FilePath]; if(!curFileLines.empty()) { curFileLines[nr-1] = ci; @@ -121,12 +107,61 @@ class cmParseJacocoCoverage::XMLParser: public cmXMLParser } } + virtual bool FindPackagePath(const std::string fileName) + { + // Search for the source file in the source directory. + if (this->PackagePathFound(fileName, this->Coverage.SourceDir)) + { + return true; + } + + // If not found there, check the binary directory. + if (this->PackagePathFound(fileName, this->Coverage.BinaryDir)) + { + return true; + } + return false; + } + + virtual bool PackagePathFound(const std::string fileName, + const std::string baseDir) + { + // Search for the file in the baseDir and its subdirectories. + std::string packageGlob = baseDir; + packageGlob += "/"; + packageGlob += fileName; + cmsys::Glob gl; + gl.RecurseOn(); + gl.RecurseThroughSymlinksOn(); + gl.FindFiles(packageGlob); + std::vector const& files = gl.GetFiles(); + if (files.size() == 0) + { + return false; + } + + // Check if any of the locations found match our package. + for(std::vector::const_iterator fi = files.begin(); + fi != files.end(); ++fi) + { + std::string dir = cmsys::SystemTools::GetParentDirectory(*fi); + if (cmsys::SystemTools::StringEndsWith(dir, this->PackageName.c_str())) + { + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Found package directory for " << fileName << + ": " << dir << std::endl, + this->Coverage.Quiet); + this->PackagePath = dir; + return true; + } + } + return false; + } + private: + std::string FilePath; + std::string PackagePath; std::string PackageName; - std::string FileName; - std::string ModuleName; - std::string CurFileName; - std::vector FilePaths; typedef cmCTestCoverageHandlerContainer::SingleFileCoverageVector FileLinesType; cmCTest* CTest; diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx index e1bd02b7f..0c25f4050 100644 --- a/Source/CTest/cmProcess.cxx +++ b/Source/CTest/cmProcess.cxx @@ -62,6 +62,7 @@ bool cmProcess::StartProcess() this->WorkingDirectory.c_str()); } cmsysProcess_SetTimeout(this->Process, this->Timeout); + cmsysProcess_SetOption(this->Process, cmsysProcess_Option_MergeOutput, 1); cmsysProcess_Execute(this->Process); return (cmsysProcess_GetState(this->Process) == cmsysProcess_State_Executing); @@ -124,14 +125,10 @@ int cmProcess::GetNextOutputLine(std::string& line, double timeout) for(;;) { // Look for lines already buffered. - if(this->StdOut.GetLine(line)) + if(this->Output.GetLine(line)) { return cmsysProcess_Pipe_STDOUT; } - else if(this->StdErr.GetLine(line)) - { - return cmsysProcess_Pipe_STDERR; - } // Check for more data from the process. char* data; @@ -143,11 +140,7 @@ int cmProcess::GetNextOutputLine(std::string& line, double timeout) } else if(p == cmsysProcess_Pipe_STDOUT) { - this->StdOut.insert(this->StdOut.end(), data, data+length); - } - else if(p == cmsysProcess_Pipe_STDERR) - { - this->StdErr.insert(this->StdErr.end(), data, data+length); + this->Output.insert(this->Output.end(), data, data+length); } else // p == cmsysProcess_Pipe_None { @@ -157,14 +150,10 @@ int cmProcess::GetNextOutputLine(std::string& line, double timeout) } // Look for partial last lines. - if(this->StdOut.GetLast(line)) + if(this->Output.GetLast(line)) { return cmsysProcess_Pipe_STDOUT; } - else if(this->StdErr.GetLast(line)) - { - return cmsysProcess_Pipe_STDERR; - } // No more data. Wait for process exit. if(!cmsysProcess_WaitForExit(this->Process, &timeout)) diff --git a/Source/CTest/cmProcess.h b/Source/CTest/cmProcess.h index 1479df05f..eddeeabe8 100644 --- a/Source/CTest/cmProcess.h +++ b/Source/CTest/cmProcess.h @@ -48,8 +48,7 @@ public: * Read one line of output but block for no more than timeout. * Returns: * cmsysProcess_Pipe_None = Process terminated and all output read - * cmsysProcess_Pipe_STDOUT = Line came from stdout - * cmsysProcess_Pipe_STDOUT = Line came from stderr + * cmsysProcess_Pipe_STDOUT = Line came from stdout or stderr * cmsysProcess_Pipe_Timeout = Timeout expired while waiting */ int GetNextOutputLine(std::string& line, double timeout); @@ -68,13 +67,11 @@ private: bool GetLine(std::string& line); bool GetLast(std::string& line); }; - Buffer StdErr; - Buffer StdOut; + Buffer Output; std::string Command; std::string WorkingDirectory; std::vector Arguments; std::vector ProcessArgs; - std::string Output; int Id; int ExitValue; }; diff --git a/Source/Checks/cm_c11_thread_local.c b/Source/Checks/cm_c11_thread_local.c new file mode 100644 index 000000000..ab780f284 --- /dev/null +++ b/Source/Checks/cm_c11_thread_local.c @@ -0,0 +1,2 @@ +_Thread_local int i = 42; +int main(void) { return 0; } diff --git a/Source/Checks/cm_c11_thread_local.cmake b/Source/Checks/cm_c11_thread_local.cmake new file mode 100644 index 000000000..6b8d10b2b --- /dev/null +++ b/Source/Checks/cm_c11_thread_local.cmake @@ -0,0 +1,33 @@ +set(CMake_C11_THREAD_LOCAL_BROKEN 0) +if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_C11_STANDARD_COMPILE_OPTION) + if(NOT DEFINED CMake_C11_THREAD_LOCAL_WORKS) + message(STATUS "Checking if compiler supports C11 _Thread_local") + try_compile(CMake_C11_THREAD_LOCAL_WORKS + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_LIST_DIR}/cm_c11_thread_local.c + CMAKE_FLAGS -DCMAKE_C_STANDARD=11 + OUTPUT_VARIABLE OUTPUT + ) + if(CMake_C11_THREAD_LOCAL_WORKS AND "${OUTPUT}" MATCHES "error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'") + set_property(CACHE CMake_C11_THREAD_LOCAL_WORKS PROPERTY VALUE 0) + endif() + if(CMake_C11_THREAD_LOCAL_WORKS) + message(STATUS "Checking if compiler supports C11 _Thread_local - yes") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining if compiler supports C11 _Thread_local passed with the following output:\n" + "${OUTPUT}\n" + "\n" + ) + else() + message(STATUS "Checking if compiler supports C11 _Thread_local - no") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining if compiler supports C11 _Thread_local failed with the following output:\n" + "${OUTPUT}\n" + "\n" + ) + endif() + endif() + if(NOT CMake_C11_THREAD_LOCAL_WORKS) + set(CMake_C11_THREAD_LOCAL_BROKEN 1) + endif() +endif() diff --git a/Source/CursesDialog/CMakeLists.txt b/Source/CursesDialog/CMakeLists.txt index 7d4e88cdc..93ff4256e 100644 --- a/Source/CursesDialog/CMakeLists.txt +++ b/Source/CursesDialog/CMakeLists.txt @@ -47,4 +47,5 @@ else() target_link_libraries(ccmake cmForm) endif() -install(TARGETS ccmake DESTINATION bin) +CMake_OPTIONAL_COMPONENT(ccmake) +install(TARGETS ccmake DESTINATION bin ${COMPONENT}) diff --git a/Source/CursesDialog/cmCursesLongMessageForm.cxx b/Source/CursesDialog/cmCursesLongMessageForm.cxx index 67e4aab2b..6144ddc2b 100644 --- a/Source/CursesDialog/cmCursesLongMessageForm.cxx +++ b/Source/CursesDialog/cmCursesLongMessageForm.cxx @@ -80,12 +80,13 @@ void cmCursesLongMessageForm::UpdateStatusBar() sprintf(version+sideSpace, "%s", vertmp); version[width] = '\0'; + char fmt_s[] = "%s"; curses_move(y-4,0); attron(A_STANDOUT); - printw(bar); + printw(fmt_s, bar); attroff(A_STANDOUT); curses_move(y-3,0); - printw(version); + printw(fmt_s, version); pos_form_cursor(this->Form); } @@ -101,8 +102,9 @@ void cmCursesLongMessageForm::PrintKeys() char firstLine[512]; sprintf(firstLine, "Press [e] to exit help"); + char fmt_s[] = "%s"; curses_move(y-2,0); - printw(firstLine); + printw(fmt_s, firstLine); pos_form_cursor(this->Form); } diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index be17a9f8e..a2fc2c0ca 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -451,24 +451,25 @@ void cmCursesMainForm::PrintKeys(int process /* = 0 */) } curses_move(y-4,0); + char fmt_s[] = "%s"; char fmt[512] = "Press [enter] to edit option"; if ( process ) { strcpy(fmt, " "); } - printw(fmt); + printw(fmt_s, fmt); curses_move(y-3,0); - printw(firstLine); + printw(fmt_s, firstLine); curses_move(y-2,0); - printw(secondLine); + printw(fmt_s, secondLine); curses_move(y-1,0); - printw(thirdLine); + printw(fmt_s, thirdLine); if (cw) { sprintf(firstLine, "Page %d of %d", cw->GetPage(), this->NumberOfPages); curses_move(0,65-static_cast(strlen(firstLine))-1); - printw(firstLine); + printw(fmt_s, firstLine); } // } @@ -612,13 +613,13 @@ void cmCursesMainForm::UpdateStatusBar(const char* message) version[width] = '\0'; // Now print both lines + char fmt_s[] = "%s"; curses_move(y-5,0); attron(A_STANDOUT); - char format[] = "%s"; - printw(format, bar); + printw(fmt_s, bar); attroff(A_STANDOUT); curses_move(y-4,0); - printw(version); + printw(fmt_s, version); pos_form_cursor(this->Form); } diff --git a/Source/CursesDialog/cmCursesStringWidget.cxx b/Source/CursesDialog/cmCursesStringWidget.cxx index acf262fef..6eb15c17a 100644 --- a/Source/CursesDialog/cmCursesStringWidget.cxx +++ b/Source/CursesDialog/cmCursesStringWidget.cxx @@ -168,17 +168,16 @@ bool cmCursesStringWidget::HandleInput(int& key, cmCursesMainForm* fm, else if ( key == 127 || key == KEY_BACKSPACE ) { - if ( form->curcol > 0 ) - { + FIELD *cur = current_field(form); form_driver(form, REQ_DEL_PREV); - } + if (current_field(form) != cur) + { + set_current_field(form, cur); + } } else if ( key == ctrl('d') ||key == KEY_DC ) { - if ( form->curcol >= 0 ) - { - form_driver(form, REQ_DEL_CHAR); - } + form_driver(form, REQ_DEL_CHAR); } else { @@ -221,6 +220,7 @@ bool cmCursesStringWidget::PrintKeys() } if (this->InEdit) { + char fmt_s[] = "%s"; char firstLine[512]; // Clean the toolbar for(int i=0; i<512; i++) @@ -229,17 +229,16 @@ bool cmCursesStringWidget::PrintKeys() } firstLine[511] = '\0'; curses_move(y-4,0); - printw(firstLine); + printw(fmt_s, firstLine); curses_move(y-3,0); - printw(firstLine); + printw(fmt_s, firstLine); curses_move(y-2,0); - printw(firstLine); + printw(fmt_s, firstLine); curses_move(y-1,0); - printw(firstLine); + printw(fmt_s, firstLine); - sprintf(firstLine, "Editing option, press [enter] to leave edit."); curses_move(y-3,0); - printw(firstLine); + printw(fmt_s, "Editing option, press [enter] to leave edit."); return true; } else diff --git a/Source/CursesDialog/cmCursesWidget.cxx b/Source/CursesDialog/cmCursesWidget.cxx index e5363f489..a12e4c21d 100644 --- a/Source/CursesDialog/cmCursesWidget.cxx +++ b/Source/CursesDialog/cmCursesWidget.cxx @@ -49,7 +49,7 @@ void cmCursesWidget::Move(int x, int y, bool isNewPage) void cmCursesWidget::SetValue(const std::string& value) { this->Value = value; - set_field_buffer(this->Field, 0, value.c_str()); + set_field_buffer(this->Field, 0, const_cast(value.c_str())); } const char* cmCursesWidget::GetValue() diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index 168f57d04..66fd18b82 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -14,6 +14,7 @@ project(QtDialog) if(POLICY CMP0020) cmake_policy(SET CMP0020 NEW) # Drop when CMake >= 2.8.11 required endif() +CMake_OPTIONAL_COMPONENT(cmake-gui) find_package(Qt5Widgets QUIET) if (Qt5Widgets_FOUND) include_directories(${Qt5Widgets_INCLUDE_DIRS}) @@ -35,35 +36,54 @@ if (Qt5Widgets_FOUND) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}") - # We need to install Cocoa platform plugin and add qt.conf for Qt5 on Mac. + # We need to install platform plugin and add qt.conf for Qt5 on Mac and Windows. # FIXME: This should be part of Qt5 CMake scripts, but unfortunatelly - # Qt5 Mac support is missing there. - if(APPLE) + # Qt5 support is missing there. + if(CMake_INSTALL_DEPENDENCIES AND (APPLE OR WIN32)) macro(install_qt5_plugin _qt_plugin_name _qt_plugins_var) get_target_property(_qt_plugin_path "${_qt_plugin_name}" LOCATION) if(EXISTS "${_qt_plugin_path}") get_filename_component(_qt_plugin_file "${_qt_plugin_path}" NAME) get_filename_component(_qt_plugin_type "${_qt_plugin_path}" PATH) get_filename_component(_qt_plugin_type "${_qt_plugin_type}" NAME) - set(_qt_plugin_dest "PlugIns/${_qt_plugin_type}") + if(APPLE) + set(_qt_plugin_dir "PlugIns") + elseif(WIN32) + set(_qt_plugin_dir "plugins") + endif() + set(_qt_plugin_dest "${_qt_plugin_dir}/${_qt_plugin_type}") install(FILES "${_qt_plugin_path}" - DESTINATION "${_qt_plugin_dest}") + DESTINATION "${_qt_plugin_dest}" + ${COMPONENT}) set(${_qt_plugins_var} "${${_qt_plugins_var}};\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${_qt_plugin_dest}/${_qt_plugin_file}") else() message(FATAL_ERROR "QT plugin ${_qt_plugin_name} not found") endif() endmacro() - install_qt5_plugin("Qt5::QCocoaIntegrationPlugin" QT_PLUGINS) - file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/qt.conf" - "[Paths]\nPlugins = PlugIns\n") - install(FILES "${CMAKE_CURRENT_BINARY_DIR}/qt.conf" - DESTINATION "${CMAKE_INSTALL_PREFIX}/Resources") + if(APPLE) + install_qt5_plugin("Qt5::QCocoaIntegrationPlugin" QT_PLUGINS) + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/qt.conf" + "[Paths]\nPlugins = ${_qt_plugin_dir}\n") + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/qt.conf" + DESTINATION "${CMAKE_INSTALL_PREFIX}/Resources" + ${COMPONENT}) + elseif(WIN32) + install_qt5_plugin("Qt5::QWindowsIntegrationPlugin" QT_PLUGINS) + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/qt.conf" + "[Paths]\nPlugins = ../${_qt_plugin_dir}\n") + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/qt.conf" + DESTINATION bin + ${COMPONENT}) + endif() endif() - if(WIN32 AND TARGET Qt5::Core) + if(TARGET Qt5::Core) get_property(_Qt5_Core_LOCATION TARGET Qt5::Core PROPERTY LOCATION) get_filename_component(Qt_BIN_DIR "${_Qt5_Core_LOCATION}" PATH) + if(APPLE) + get_filename_component(Qt_BIN_DIR "${Qt_BIN_DIR}" PATH) + endif() endif() else() set(QT_MIN_VERSION "4.4.0") @@ -77,12 +97,6 @@ else() set(CMake_QT_LIBRARIES ${QT_LIBRARIES}) - if(WIN32 AND EXISTS "${QT_QMAKE_EXECUTABLE}") - get_filename_component(_Qt_BIN_DIR "${QT_QMAKE_EXECUTABLE}" PATH) - if(EXISTS "${_Qt_BIN_DIR}/QtCore4.dll") - set(Qt_BIN_DIR ${_Qt_BIN_DIR}) - endif() - endif() endif() set(SRCS @@ -130,18 +144,16 @@ endif() if(CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL) install(FILES ${CMake_SOURCE_DIR}/Licenses/LGPLv2.1.txt - DESTINATION ${CMAKE_DATA_DIR}/Licenses) + DESTINATION ${CMAKE_DATA_DIR}/Licenses + ${COMPONENT}) set_property(SOURCE CMakeSetupDialog.cxx PROPERTY COMPILE_DEFINITIONS CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL) endif() set(CMAKE_INCLUDE_CURRENT_DIR ON) -add_executable(cmake-gui WIN32 MACOSX_BUNDLE ${SRCS}) +add_executable(cmake-gui WIN32 MACOSX_BUNDLE ${SRCS} ${MANIFEST_FILE}) target_link_libraries(cmake-gui CMakeLib ${QT_QTMAIN_LIBRARY} ${CMake_QT_LIBRARIES}) -if(Qt_BIN_DIR) - set_property(TARGET cmake-gui PROPERTY Qt_BIN_DIR ${Qt_BIN_DIR}) -endif() if(APPLE) file(STRINGS "${CMake_SOURCE_DIR}/Copyright.txt" copyright_line @@ -163,30 +175,39 @@ if(APPLE) ) endif() set(CMAKE_INSTALL_DESTINATION_ARGS - BUNDLE DESTINATION "${CMAKE_BUNDLE_LOCATION}") + BUNDLE DESTINATION "${CMAKE_BUNDLE_LOCATION}" ${COMPONENT}) -install(TARGETS cmake-gui RUNTIME DESTINATION bin ${CMAKE_INSTALL_DESTINATION_ARGS}) +install(TARGETS cmake-gui + RUNTIME DESTINATION bin ${COMPONENT} + ${CMAKE_INSTALL_DESTINATION_ARGS}) if(UNIX AND NOT APPLE) foreach (size IN ITEMS 32 128) install( FILES "${CMAKE_CURRENT_SOURCE_DIR}/CMakeSetup${size}.png" DESTINATION "share/icons/hicolor/${size}x${size}/apps" + ${COMPONENT} RENAME "CMakeSetup.png") endforeach () # install a desktop file so CMake appears in the application start menu # with an icon - install(FILES CMake.desktop DESTINATION share/applications ) - install(FILES cmakecache.xml DESTINATION share/mime/packages ) + install(FILES CMake.desktop + DESTINATION share/applications + ${COMPONENT}) + install(FILES cmakecache.xml + DESTINATION share/mime/packages + ${COMPONENT}) endif() if(APPLE) - install(CODE "execute_process(COMMAND ln -s \"../MacOS/CMake\" cmake-gui - WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/bin)") + install(CODE " + execute_process(COMMAND ln -s \"../MacOS/CMake\" cmake-gui + WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/bin) + " ${COMPONENT}) endif() -if(APPLE OR WIN32) +if(CMake_INSTALL_DEPENDENCIES AND (APPLE OR WIN32)) # install rules for including 3rd party libs such as Qt # if a system Qt is used (e.g. installed in /usr/lib/), it will not be included in the installation set(fixup_exe "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/bin/cmake-gui${CMAKE_EXECUTABLE_SUFFIX}") @@ -196,8 +217,8 @@ if(APPLE OR WIN32) install(CODE " include(\"${CMake_SOURCE_DIR}/Modules/BundleUtilities.cmake\") set(BU_CHMOD_BUNDLE_ITEMS ON) - fixup_bundle(\"${fixup_exe}\" \"${QT_PLUGINS}\" \"${QT_LIBRARY_DIR};${QT_BINARY_DIR}\") - ") + fixup_bundle(\"${fixup_exe}\" \"${QT_PLUGINS}\" \"${Qt_BIN_DIR};${QT_LIBRARY_DIR};${QT_BINARY_DIR}\") + " ${COMPONENT}) endif() set(CMAKE_PACKAGE_QTGUI TRUE) diff --git a/Source/QtDialog/Info.plist.in b/Source/QtDialog/Info.plist.in index b9c4af583..00a27c39c 100644 --- a/Source/QtDialog/Info.plist.in +++ b/Source/QtDialog/Info.plist.in @@ -28,5 +28,7 @@ public.app-category.developer-tools NSHumanReadableCopyright ${MACOSX_BUNDLE_COPYRIGHT} + NSHighResolutionCapable + diff --git a/Source/QtIFW/CMake.Dialogs.QtGUI.qs b/Source/QtIFW/CMake.Dialogs.QtGUI.qs new file mode 100644 index 000000000..219a0a90a --- /dev/null +++ b/Source/QtIFW/CMake.Dialogs.QtGUI.qs @@ -0,0 +1,21 @@ +// Component: CMake.Dialogs.QtGUI + +function Component() +{ + // Default constructor +} + +Component.prototype.createOperations = function() +{ + // Create shortcut + if (installer.value("os") === "win") { + + component.addOperation("CreateShortcut", + installer.value("TargetDir") + "/bin/cmake-gui.exe", + installer.value("StartMenuDir") + "/CMake (cmake-gui).lnk"); + + } + + // Call default implementation + component.createOperations(); +} diff --git a/Source/QtIFW/CMake.Documentation.SphinxHTML.qs.in b/Source/QtIFW/CMake.Documentation.SphinxHTML.qs.in new file mode 100644 index 000000000..5c929e86f --- /dev/null +++ b/Source/QtIFW/CMake.Documentation.SphinxHTML.qs.in @@ -0,0 +1,21 @@ +// Component: CMake.Documentation.SphinxHTML + +function Component() +{ + // Default constructor +} + +Component.prototype.createOperations = function() +{ + // Create shortcut + if (installer.value("os") === "win") { + + component.addOperation("CreateShortcut", + installer.value("TargetDir") + "/@CMAKE_DOC_DIR@/html/index.html", + installer.value("StartMenuDir") + "/CMake Documentation.lnk"); + + } + + // Call default implementation + component.createOperations(); +} diff --git a/Source/QtIFW/CMake.qs.in b/Source/QtIFW/CMake.qs.in new file mode 100644 index 000000000..828cc7cb2 --- /dev/null +++ b/Source/QtIFW/CMake.qs.in @@ -0,0 +1,22 @@ +function Component() +{ + // Default constructor +} + +Component.prototype.createOperations = function() +{ + // Create shortcut + if (installer.value("os") === "win") { + + component.addOperation("CreateShortcut", + installer.value("TargetDir") + "/@CMAKE_DOC_DIR@/cmake.org.html", + installer.value("StartMenuDir") + "/CMake Web Site.lnk"); + + component.addOperation("CreateShortcut", + installer.value("TargetDir") + "/cmake-maintenance.exe", + installer.value("StartMenuDir") + "/CMake Maintenance Tool.lnk"); + } + + // Call default implementation + component.createOperations(); +} diff --git a/Source/QtIFW/installscript.qs.in b/Source/QtIFW/installscript.qs.in index 570dba1e0..3411e34e4 100644 --- a/Source/QtIFW/installscript.qs.in +++ b/Source/QtIFW/installscript.qs.in @@ -5,20 +5,20 @@ function Component() Component.prototype.createOperations = function() { - // call default implementation to actually install applications! - component.createOperations(); - // Create shortcut if (installer.value("os") === "win") { @_CPACK_IFW_SHORTCUT_OPTIONAL@ component.addOperation("CreateShortcut", - installer.value("TargetDir") + "/cmake.org.html", + installer.value("TargetDir") + "/@CMAKE_DOC_DIR@/cmake.org.html", installer.value("StartMenuDir") + "/CMake Web Site.lnk"); component.addOperation("CreateShortcut", installer.value("TargetDir") + "/cmake-maintenance.exe", installer.value("StartMenuDir") + "/CMake Maintenance Tool.lnk"); } + + // Call default implementation + component.createOperations(); } diff --git a/Source/bindexplib.cxx b/Source/bindexplib.cxx new file mode 100644 index 000000000..dc4db6358 --- /dev/null +++ b/Source/bindexplib.cxx @@ -0,0 +1,439 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2015 Kitware, Inc. + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +/*------------------------------------------------------------------------- + Portions of this source have been derived from the 'bindexplib' tool + provided by the CERN ROOT Data Analysis Framework project (root.cern.ch). + Permission has been granted by Pere Mato to distribute + this derived work under the CMake license. +-------------------------------------------------------------------------*/ + +/* +*---------------------------------------------------------------------- +* Program: dumpexts.exe +* Author: Gordon Chaffee +* +* History: The real functionality of this file was written by +* Matt Pietrek in 1993 in his pedump utility. I've +* modified it to dump the externals in a bunch of object +* files to create a .def file. +* +* Notes: Visual C++ puts an underscore before each exported symbol. +* This file removes them. I don't know if this is a problem +* this other compilers. If _MSC_VER is defined, +* the underscore is removed. If not, it isn't. To get a +* full dump of an object file, use the -f option. This can +* help determine the something that may be different with a +* compiler other than Visual C++. +* ====================================== +* Corrections (Axel 2006-04-04): +* Conversion to C++. Mostly. +* + * Extension (Axel 2006-03-15) + * As soon as an object file contains an /EXPORT directive (which + * is generated by the compiler when a symbol is declared as + * declspec(dllexport)) no to-be-exported symbols are printed, + * as the linker will see these directives, and if those directives + * are present we only export selectively (i.e. we trust the + * programmer). + * + * ====================================== +* ====================================== +* Corrections (Valery Fine 23/02/98): +* +* The "(vector) deleting destructor" MUST not be exported +* To recognize it the following test are introduced: +* "@@UAEPAXI@Z" scalar deleting dtor +* "@@QAEPAXI@Z" vector deleting dtor +* "AEPAXI@Z" vector deleting dtor with thunk adjustor +* ====================================== +* Corrections (Valery Fine 12/02/97): +* +* It created a wrong EXPORTS for the global pointers and constants. +* The Section Header has been involved to discover the missing information +* Now the pointers are correctly supplied supplied with "DATA" descriptor +* the constants with no extra descriptor. +* +* Corrections (Valery Fine 16/09/96): +* +* It didn't work for C++ code with global variables and class definitons +* The DumpExternalObject function has been introduced to generate .DEF file +* +* Author: Valery Fine 16/09/96 (E-mail: fine@vxcern.cern.ch) +*---------------------------------------------------------------------- +*/ + +#include +#include +#include +#include +#include +#include + +typedef struct cmANON_OBJECT_HEADER_BIGOBJ { + /* same as ANON_OBJECT_HEADER_V2 */ + WORD Sig1; // Must be IMAGE_FILE_MACHINE_UNKNOWN + WORD Sig2; // Must be 0xffff + WORD Version; // >= 2 (implies the Flags field is present) + WORD Machine; // Actual machine - IMAGE_FILE_MACHINE_xxx + DWORD TimeDateStamp; + CLSID ClassID; // {D1BAA1C7-BAEE-4ba9-AF20-FAF66AA4DCB8} + DWORD SizeOfData; // Size of data that follows the header + DWORD Flags; // 0x1 -> contains metadata + DWORD MetaDataSize; // Size of CLR metadata + DWORD MetaDataOffset; // Offset of CLR metadata + + /* bigobj specifics */ + DWORD NumberOfSections; // extended from WORD + DWORD PointerToSymbolTable; + DWORD NumberOfSymbols; +} cmANON_OBJECT_HEADER_BIGOBJ; + +typedef struct _cmIMAGE_SYMBOL_EX { + union { + BYTE ShortName[8]; + struct { + DWORD Short; // if 0, use LongName + DWORD Long; // offset into string table + } Name; + DWORD LongName[2]; // PBYTE [2] + } N; + DWORD Value; + LONG SectionNumber; + WORD Type; + BYTE StorageClass; + BYTE NumberOfAuxSymbols; +} cmIMAGE_SYMBOL_EX; +typedef cmIMAGE_SYMBOL_EX UNALIGNED *cmPIMAGE_SYMBOL_EX; + +PIMAGE_SECTION_HEADER GetSectionHeaderOffset(PIMAGE_FILE_HEADER + pImageFileHeader) +{ + return (PIMAGE_SECTION_HEADER) + ((DWORD_PTR)pImageFileHeader + + IMAGE_SIZEOF_FILE_HEADER + + pImageFileHeader->SizeOfOptionalHeader); +} + +PIMAGE_SECTION_HEADER GetSectionHeaderOffset(cmANON_OBJECT_HEADER_BIGOBJ* + pImageFileHeader) +{ + return (PIMAGE_SECTION_HEADER) + ((DWORD_PTR)pImageFileHeader + + sizeof(cmANON_OBJECT_HEADER_BIGOBJ)); +} + +/* ++ * Utility func, strstr with size ++ */ +const char* StrNStr(const char* start, const char* find, size_t &size) { + size_t len; + const char* hint; + + if (!start || !find || !size) { + size = 0; + return 0; + } + len = strlen(find); + + while ((hint = (const char*) memchr(start, find[0], size-len+1))) { + size -= (hint - start); + if (!strncmp(hint, find, len)) + return hint; + start = hint + 1; + } + + size = 0; + return 0; +} + +template < + // cmANON_OBJECT_HEADER_BIGOBJ or IMAGE_FILE_HEADER + class ObjectHeaderType, + // cmPIMAGE_SYMBOL_EX or PIMAGE_SYMBOL + class SymbolTableType> +class DumpSymbols +{ +public: + /* + *---------------------------------------------------------------------- + * Constructor -- + * + * Initialize variables from pointer to object header. + * + *---------------------------------------------------------------------- + */ + + DumpSymbols(ObjectHeaderType* ih, + FILE* fout, bool is64) { + this->ObjectImageHeader = ih; + this->SymbolTable = (SymbolTableType*) + ((DWORD_PTR)this->ObjectImageHeader + + this->ObjectImageHeader->PointerToSymbolTable); + this->FileOut = fout; + this->SectionHeaders = + GetSectionHeaderOffset(this->ObjectImageHeader); + this->ImportFlag = true; + this->SymbolCount = this->ObjectImageHeader->NumberOfSymbols; + this->Is64Bit = is64; + } + + /* + *---------------------------------------------------------------------- + * HaveExportedObjects -- + * + * Returns true if export directives (declspec(dllexport)) exist. + * + *---------------------------------------------------------------------- + */ + + bool HaveExportedObjects() { + WORD i = 0; + size_t size = 0; + const char * rawdata = 0; + PIMAGE_SECTION_HEADER pDirectivesSectionHeader = 0; + PIMAGE_SECTION_HEADER pSectionHeaders = this->SectionHeaders; + for(i = 0; (i < this->ObjectImageHeader->NumberOfSections && + !pDirectivesSectionHeader); i++) + if (!strncmp((const char*)&pSectionHeaders[i].Name[0], ".drectve",8)) + pDirectivesSectionHeader = &pSectionHeaders[i]; + if (!pDirectivesSectionHeader) return 0; + + rawdata=(const char*) + this->ObjectImageHeader+pDirectivesSectionHeader->PointerToRawData; + if (!pDirectivesSectionHeader->PointerToRawData || !rawdata) return 0; + + size = pDirectivesSectionHeader->SizeOfRawData; + const char* posImportFlag = rawdata; + while ((posImportFlag = StrNStr(posImportFlag, " /EXPORT:", size))) { + const char* lookingForDict = posImportFlag + 9; + if (!strncmp(lookingForDict, "_G__cpp_",8) || + !strncmp(lookingForDict, "_G__set_cpp_",12)) { + posImportFlag = lookingForDict; + continue; + } + + const char* lookingForDATA = posImportFlag + 9; + while (*(++lookingForDATA) && *lookingForDATA != ' '); + lookingForDATA -= 5; + // ignore DATA exports + if (strncmp(lookingForDATA, ",DATA", 5)) break; + posImportFlag = lookingForDATA + 5; + } + if(posImportFlag) { + return true; + } + return false; + } + + /* + *---------------------------------------------------------------------- + * DumpObjFile -- + * + * Dump an object file's exported symbols. + *---------------------------------------------------------------------- + */ + void DumpObjFile() { + if(!HaveExportedObjects()) { + this->DumpExternalsObjects(); + } + } + + /* + *---------------------------------------------------------------------- + * DumpExternalsObjects -- + * + * Dumps a COFF symbol table from an OBJ. + *---------------------------------------------------------------------- + */ + void DumpExternalsObjects() { + unsigned i; + PSTR stringTable; + std::string symbol; + DWORD SectChar; + /* + * The string table apparently starts right after the symbol table + */ + stringTable = (PSTR)&this->SymbolTable[this->SymbolCount]; + SymbolTableType* pSymbolTable = this->SymbolTable; + for ( i=0; i < this->SymbolCount; i++ ) { + if (pSymbolTable->SectionNumber > 0 && + ( pSymbolTable->Type == 0x20 || pSymbolTable->Type == 0x0)) { + if (pSymbolTable->StorageClass == IMAGE_SYM_CLASS_EXTERNAL) { + /* + * The name of the Function entry points + */ + if (pSymbolTable->N.Name.Short != 0) { + symbol = ""; + symbol.insert(0, (const char *)pSymbolTable->N.ShortName, 8); + } else { + symbol = stringTable + pSymbolTable->N.Name.Long; + } + + // clear out any leading spaces + while (isspace(symbol[0])) symbol.erase(0,1); + // if it starts with _ and has an @ then it is a __cdecl + // so remove the @ stuff for the export + if(symbol[0] == '_') { + std::string::size_type posAt = symbol.find('@'); + if (posAt != std::string::npos) { + symbol.erase(posAt); + } + } + // For 64 bit builds we don't need to remove _ + if(!this->Is64Bit) + { + if (symbol[0] == '_') + { + symbol.erase(0,1); + } + } + if (this->ImportFlag) { + this->ImportFlag = false; + fprintf(this->FileOut,"EXPORTS \n"); + } + /* + Check whether it is "Scalar deleting destructor" and + "Vector deleting destructor" + */ + const char *scalarPrefix = "??_G"; + const char *vectorPrefix = "??_E"; + // original code had a check for + // symbol.find("real@") == std::string::npos) + // but if this disallows memmber functions with the name real + // if scalarPrefix and vectorPrefix are not found then print + // the symbol + if (symbol.compare(0, 4, scalarPrefix) && + symbol.compare(0, 4, vectorPrefix) ) + { + SectChar = + this-> + SectionHeaders[pSymbolTable->SectionNumber-1].Characteristics; + if (!pSymbolTable->Type && (SectChar & IMAGE_SCN_MEM_WRITE)) { + // Read only (i.e. constants) must be excluded + fprintf(this->FileOut, "\t%s \t DATA\n", symbol.c_str()); + } else { + if ( pSymbolTable->Type || + !(SectChar & IMAGE_SCN_MEM_READ)) { + fprintf(this->FileOut, "\t%s\n", symbol.c_str()); + } else { + // printf(" strange symbol: %s \n",symbol.c_str()); + } + } + } + } + } + else if (pSymbolTable->SectionNumber == IMAGE_SYM_UNDEFINED && + !pSymbolTable->Type && 0) { + /* + * The IMPORT global variable entry points + */ + if (pSymbolTable->StorageClass == IMAGE_SYM_CLASS_EXTERNAL) { + symbol = stringTable + pSymbolTable->N.Name.Long; + while (isspace(symbol[0])) symbol.erase(0,1); + if (symbol[0] == '_') symbol.erase(0,1); + if (!this->ImportFlag) { + this->ImportFlag = true; + fprintf(this->FileOut,"IMPORTS \n"); + } + fprintf(this->FileOut, "\t%s DATA \n", symbol.c_str()+1); + } + } + + /* + * Take into account any aux symbols + */ + i += pSymbolTable->NumberOfAuxSymbols; + pSymbolTable += pSymbolTable->NumberOfAuxSymbols; + pSymbolTable++; + } + } +private: + bool ImportFlag; + FILE* FileOut; + DWORD_PTR SymbolCount; + PIMAGE_SECTION_HEADER SectionHeaders; + ObjectHeaderType* ObjectImageHeader; + SymbolTableType* SymbolTable; + bool Is64Bit; +}; + +bool +DumpFile(const char* filename, FILE *fout) +{ + HANDLE hFile; + HANDLE hFileMapping; + LPVOID lpFileBase; + PIMAGE_DOS_HEADER dosHeader; + + hFile = CreateFileW(cmsys::Encoding::ToWide(filename).c_str(), + GENERIC_READ, FILE_SHARE_READ, NULL, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); + + if (hFile == INVALID_HANDLE_VALUE) { + fprintf(stderr, "Couldn't open file '%s' with CreateFile()\n", filename); + return false; + } + + hFileMapping = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL); + if (hFileMapping == 0) { + CloseHandle(hFile); + fprintf(stderr, "Couldn't open file mapping with CreateFileMapping()\n"); + return false; + } + + lpFileBase = MapViewOfFile(hFileMapping, FILE_MAP_READ, 0, 0, 0); + if (lpFileBase == 0) { + CloseHandle(hFileMapping); + CloseHandle(hFile); + fprintf(stderr, "Couldn't map view of file with MapViewOfFile()\n"); + return false; + } + + dosHeader = (PIMAGE_DOS_HEADER)lpFileBase; + if (dosHeader->e_magic == IMAGE_DOS_SIGNATURE) { + fprintf(stderr, "File is an executable. I don't dump those.\n"); + return false; + } + /* Does it look like a i386 COFF OBJ file??? */ + else if ( + ((dosHeader->e_magic == IMAGE_FILE_MACHINE_I386) || + (dosHeader->e_magic == IMAGE_FILE_MACHINE_AMD64)) + && (dosHeader->e_sp == 0) + ) { + /* + * The two tests above aren't what they look like. They're + * really checking for IMAGE_FILE_HEADER.Machine == i386 (0x14C) + * and IMAGE_FILE_HEADER.SizeOfOptionalHeader == 0; + */ + DumpSymbols + symbolDumper((PIMAGE_FILE_HEADER) lpFileBase, fout, + (dosHeader->e_magic == IMAGE_FILE_MACHINE_AMD64)); + symbolDumper.DumpObjFile(); + } else { + // check for /bigobj format + cmANON_OBJECT_HEADER_BIGOBJ* h = + (cmANON_OBJECT_HEADER_BIGOBJ*) lpFileBase; + if(h->Sig1 == 0x0 && h->Sig2 == 0xffff) { + DumpSymbols + symbolDumper((cmANON_OBJECT_HEADER_BIGOBJ*) lpFileBase, fout, + (dosHeader->e_magic == IMAGE_FILE_MACHINE_AMD64)); + symbolDumper.DumpObjFile(); + } else { + printf("unrecognized file format in '%s'\n", filename); + return false; + } + } + UnmapViewOfFile(lpFileBase); + CloseHandle(hFileMapping); + CloseHandle(hFile); + return true; +} diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index f117475e9..bda933bc3 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -122,35 +122,6 @@ struct DefaultDeleter } }; -template -struct Range -{ - typedef const_iterator_ const_iterator; - typedef typename std::iterator_traits::value_type value_type; - typedef typename std::iterator_traits::difference_type - difference_type; - Range(const_iterator begin_, const_iterator end_) - : Begin(begin_), End(end_) {} - const_iterator begin() const { return Begin; } - const_iterator end() const { return End; } - bool empty() const { return std::distance(Begin, End) == 0; } - difference_type size() const { return std::distance(Begin, End); } - Range& advance(cmIML_INT_intptr_t amount) - { - std::advance(Begin, amount); - return *this; - } - - Range& retreat(cmIML_INT_intptr_t amount) - { - std::advance(End, -amount); - return *this; - } -private: - const_iterator Begin; - const_iterator End; -}; - template FwdIt RemoveN(FwdIt i1, FwdIt i2, size_t n) { @@ -178,17 +149,52 @@ private: } +template +struct cmRange +{ + typedef const_iterator_ const_iterator; + typedef typename std::iterator_traits::value_type value_type; + typedef typename std::iterator_traits::difference_type + difference_type; + cmRange(const_iterator begin_, const_iterator end_) + : Begin(begin_), End(end_) {} + const_iterator begin() const { return Begin; } + const_iterator end() const { return End; } + bool empty() const { return std::distance(Begin, End) == 0; } + difference_type size() const { return std::distance(Begin, End); } + cmRange& advance(cmIML_INT_intptr_t amount) + { + std::advance(Begin, amount); + return *this; + } + + cmRange& retreat(cmIML_INT_intptr_t amount) + { + std::advance(End, -amount); + return *this; + } +private: + const_iterator Begin; + const_iterator End; +}; + +typedef cmRange::const_iterator> cmStringRange; + +class cmListFileBacktrace; +typedef +cmRange::const_iterator> cmBacktraceRange; + template -ContainerAlgorithms::Range cmRange(Iter1 begin, Iter2 end) +cmRange cmMakeRange(Iter1 begin, Iter2 end) { - return ContainerAlgorithms::Range(begin, end); + return cmRange(begin, end); } template -ContainerAlgorithms::Range -cmRange(Range const& range) +cmRange +cmMakeRange(Range const& range) { - return ContainerAlgorithms::Range( + return cmRange( range.begin(), range.end()); } @@ -350,11 +356,17 @@ typename Range::const_iterator cmFindNot(Range const& r, T const& t) } template -ContainerAlgorithms::Range +cmRange cmReverseRange(Range const& range) { - return ContainerAlgorithms::Range( + return cmRange( range.rbegin(), range.rend()); } +template +std::reverse_iterator cmMakeReverseIterator(Iter it) +{ + return std::reverse_iterator(it); +} + #endif diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx index 72818f50a..79469509c 100644 --- a/Source/cmArchiveWrite.cxx +++ b/Source/cmArchiveWrite.cxx @@ -13,7 +13,6 @@ #include "cmSystemTools.h" #include "cmLocale.h" -#include #include #include #include @@ -67,7 +66,7 @@ struct cmArchiveWrite::Callback { cmArchiveWrite* self = static_cast(cd); if(self->Stream.write(static_cast(b), - static_cast(n))) + static_cast(n))) { return static_cast<__LA_SSIZE_T>(n); } @@ -84,54 +83,55 @@ cmArchiveWrite::cmArchiveWrite( Stream(os), Archive(archive_write_new()), Disk(archive_read_disk_new()), - Verbose(false) + Verbose(false), + Format(format) { switch (c) { case CompressNone: - if(archive_write_set_compression_none(this->Archive) != ARCHIVE_OK) + if(archive_write_add_filter_none(this->Archive) != ARCHIVE_OK) { - this->Error = "archive_write_set_compression_none: "; + this->Error = "archive_write_add_filter_none: "; this->Error += cm_archive_error_string(this->Archive); return; } break; case CompressCompress: - if(archive_write_set_compression_compress(this->Archive) != ARCHIVE_OK) + if(archive_write_add_filter_compress(this->Archive) != ARCHIVE_OK) { - this->Error = "archive_write_set_compression_compress: "; + this->Error = "archive_write_add_filter_compress: "; this->Error += cm_archive_error_string(this->Archive); return; } break; case CompressGZip: - if(archive_write_set_compression_gzip(this->Archive) != ARCHIVE_OK) + if(archive_write_add_filter_gzip(this->Archive) != ARCHIVE_OK) { - this->Error = "archive_write_set_compression_gzip: "; + this->Error = "archive_write_add_filter_gzip: "; this->Error += cm_archive_error_string(this->Archive); return; } break; case CompressBZip2: - if(archive_write_set_compression_bzip2(this->Archive) != ARCHIVE_OK) + if(archive_write_add_filter_bzip2(this->Archive) != ARCHIVE_OK) { - this->Error = "archive_write_set_compression_bzip2: "; + this->Error = "archive_write_add_filter_bzip2: "; this->Error += cm_archive_error_string(this->Archive); return; } break; case CompressLZMA: - if(archive_write_set_compression_lzma(this->Archive) != ARCHIVE_OK) + if(archive_write_add_filter_lzma(this->Archive) != ARCHIVE_OK) { - this->Error = "archive_write_set_compression_lzma: "; + this->Error = "archive_write_add_filter_lzma: "; this->Error += cm_archive_error_string(this->Archive); return; } break; case CompressXZ: - if(archive_write_set_compression_xz(this->Archive) != ARCHIVE_OK) + if(archive_write_add_filter_xz(this->Archive) != ARCHIVE_OK) { - this->Error = "archive_write_set_compression_xz: "; + this->Error = "archive_write_add_filter_xz: "; this->Error += cm_archive_error_string(this->Archive); return; } @@ -176,12 +176,15 @@ cmArchiveWrite::cmArchiveWrite( //---------------------------------------------------------------------------- cmArchiveWrite::~cmArchiveWrite() { - archive_read_finish(this->Disk); - archive_write_finish(this->Archive); + archive_read_free(this->Disk); + archive_write_free(this->Archive); } //---------------------------------------------------------------------------- -bool cmArchiveWrite::Add(std::string path, size_t skip, const char* prefix) +bool cmArchiveWrite::Add(std::string path, + size_t skip, + const char* prefix, + bool recursive) { if(this->Okay()) { @@ -189,20 +192,21 @@ bool cmArchiveWrite::Add(std::string path, size_t skip, const char* prefix) { path.erase(path.size()-1); } - this->AddPath(path.c_str(), skip, prefix); + this->AddPath(path.c_str(), skip, prefix, recursive); } return this->Okay(); } //---------------------------------------------------------------------------- bool cmArchiveWrite::AddPath(const char* path, - size_t skip, const char* prefix) + size_t skip, const char* prefix, + bool recursive) { if(!this->AddFile(path, skip, prefix)) { return false; } - if(!cmSystemTools::FileIsDirectory(path) || + if((!cmSystemTools::FileIsDirectory(path) || !recursive) || cmSystemTools::FileIsSymlink(path)) { return true; @@ -278,10 +282,45 @@ bool cmArchiveWrite::AddFile(const char* file, } archive_entry_set_mtime(e, t, 0); } + + // manages the uid/guid of the entry (if any) + if (this->Uid.IsSet() && this->Gid.IsSet()) + { + archive_entry_set_uid(e, this->Uid.Get()); + archive_entry_set_gid(e, this->Gid.Get()); + } + + if (this->Uname.size() && this->Gname.size()) + { + archive_entry_set_uname(e, this->Uname.c_str()); + archive_entry_set_gname(e, this->Gname.c_str()); + } + + + // manages the permissions + if (this->Permissions.IsSet()) + { + archive_entry_set_perm(e, this->Permissions.Get()); + } + + if (this->PermissionsMask.IsSet()) + { + mode_t perm = archive_entry_perm(e); + archive_entry_set_perm(e, perm & this->PermissionsMask.Get()); + } + // Clear acl and xattr fields not useful for distribution. archive_entry_acl_clear(e); archive_entry_xattr_clear(e); archive_entry_set_fflags(e, 0, 0); + + if (this->Format == "pax" || this->Format == "paxr") + { + // Sparse files are a GNU tar extension. + // Do not use them in standard tar files. + archive_entry_sparse_clear(e); + } + if(archive_write_header(this->Archive, e) != ARCHIVE_OK) { this->Error = "archive_write_header: "; @@ -304,7 +343,7 @@ bool cmArchiveWrite::AddFile(const char* file, //---------------------------------------------------------------------------- bool cmArchiveWrite::AddData(const char* file, size_t size) { - cmsys::ifstream fin(file, std::ios::in | cmsys_ios_binary); + cmsys::ifstream fin(file, std::ios::in | std::ios::binary); if(!fin) { this->Error = "Error opening \""; @@ -318,7 +357,7 @@ bool cmArchiveWrite::AddData(const char* file, size_t size) size_t nleft = size; while(nleft > 0) { - typedef cmsys_ios::streamsize ssize_type; + typedef std::streamsize ssize_type; size_t const nnext = nleft > sizeof(buffer)? sizeof(buffer) : nleft; ssize_type const nnext_s = static_cast(nnext); fin.read(buffer, nnext_s); diff --git a/Source/cmArchiveWrite.h b/Source/cmArchiveWrite.h index 794cb282c..8dbbb8372 100644 --- a/Source/cmArchiveWrite.h +++ b/Source/cmArchiveWrite.h @@ -18,6 +18,22 @@ # error "cmArchiveWrite not allowed during bootstrap build!" #endif +template +class cmArchiveWriteOptional +{ +public: + cmArchiveWriteOptional() {this->Clear();} + explicit cmArchiveWriteOptional(T val) {this->Set(val);} + + void Set(T val) {this->IsValueSet = true; this->Value=val;} + void Clear() {this->IsValueSet = false;} + bool IsSet() const {return this->IsValueSet;} + T Get() const {return Value;} +private: + T Value; + bool IsValueSet; +}; + /** \class cmArchiveWrite * \brief Wrapper around libarchive for writing. * @@ -52,7 +68,10 @@ public: * skip. The remaining part of the input path is appended to the * "prefix" value to construct the final name in the archive. */ - bool Add(std::string path, size_t skip = 0, const char* prefix = 0); + bool Add(std::string path, + size_t skip = 0, + const char* prefix = 0, + bool recursive = true); /** Returns true if there has been no error. */ operator safe_bool() const @@ -69,9 +88,65 @@ public: void SetVerbose(bool v) { this->Verbose = v; } void SetMTime(std::string const& t) { this->MTime = t; } + + //! Sets the permissions of the added files/folders + void SetPermissions(mode_t permissions_) + { + this->Permissions.Set(permissions_); + } + + //! Clears permissions - default is used instead + void ClearPermissions() { this->Permissions.Clear(); } + + //! Sets the permissions mask of files/folders + //! + //! The permissions will be copied from the existing file + //! or folder. The mask will then be applied to unset + //! some of them + void SetPermissionsMask(mode_t permissionsMask_) + { + this->PermissionsMask.Set(permissionsMask_); + } + + //! Clears permissions mask - default is used instead + void ClearPermissionsMask() + { + this->PermissionsMask.Clear(); + } + + //! Sets UID and GID to be used in the tar file + void SetUIDAndGID(int uid_, int gid_) + { + this->Uid.Set(uid_); + this->Gid.Set(gid_); + } + + //! Clears UID and GID to be used in the tar file - default is used instead + void ClearUIDAndGID() + { + this->Uid.Clear(); + this->Gid.Clear(); + } + + //! Sets UNAME and GNAME to be used in the tar file + void SetUNAMEAndGNAME(const std::string& uname_, const std::string& gname_) + { + this->Uname = uname_; + this->Gname = gname_; + } + + //! Clears UNAME and GNAME to be used in the tar file + //! default is used instead + void ClearUNAMEAndGNAME() + { + this->Uname = ""; + this->Gname = ""; + } + private: bool Okay() const { return this->Error.empty(); } - bool AddPath(const char* path, size_t skip, const char* prefix); + bool AddPath(const char* path, size_t skip, const char* prefix, + bool recursive = true); bool AddFile(const char* file, size_t skip, const char* prefix); bool AddData(const char* file, size_t size); @@ -84,8 +159,25 @@ private: struct archive* Archive; struct archive* Disk; bool Verbose; + std::string Format; std::string Error; std::string MTime; + + //! UID of the user in the tar file + cmArchiveWriteOptional Uid; + + //! GUID of the user in the tar file + cmArchiveWriteOptional Gid; + + //! UNAME/GNAME of the user (does not override UID/GID) + //!@{ + std::string Uname; + std::string Gname; + //!@} + + //! Permissions on files/folders + cmArchiveWriteOptional Permissions; + cmArchiveWriteOptional PermissionsMask; }; #endif diff --git a/Source/cmBuildNameCommand.h b/Source/cmBuildNameCommand.h index 8f8038feb..47455f851 100644 --- a/Source/cmBuildNameCommand.h +++ b/Source/cmBuildNameCommand.h @@ -23,7 +23,6 @@ public: cmExecutionStatus &status); virtual std::string GetName() const {return "build_name";} virtual bool IsScriptable() const { return true; } - virtual bool IsDiscouraged() const { return true; } }; diff --git a/Source/cmCMakeHostSystemInformationCommand.cxx b/Source/cmCMakeHostSystemInformationCommand.cxx index 52345389c..6ff7c0d98 100644 --- a/Source/cmCMakeHostSystemInformationCommand.cxx +++ b/Source/cmCMakeHostSystemInformationCommand.cxx @@ -11,8 +11,6 @@ ============================================================================*/ #include "cmCMakeHostSystemInformationCommand.h" -#include - // cmCMakeHostSystemInformation bool cmCMakeHostSystemInformationCommand ::InitialPass(std::vector const &args, cmExecutionStatus &) @@ -107,7 +105,7 @@ bool cmCMakeHostSystemInformationCommand std::string cmCMakeHostSystemInformationCommand ::ValueToString(size_t value) const { - cmsys_ios::stringstream tmp; + std::stringstream tmp; tmp << value; return tmp.str(); } diff --git a/Source/cmCMakePolicyCommand.cxx b/Source/cmCMakePolicyCommand.cxx index 3c878bf3b..3ef6d356b 100644 --- a/Source/cmCMakePolicyCommand.cxx +++ b/Source/cmCMakePolicyCommand.cxx @@ -93,6 +93,22 @@ bool cmCMakePolicyCommand::HandleSetMode(std::vector const& args) this->SetError("SET failed to set policy."); return false; } + if(args[1] == "CMP0001" && + (status == cmPolicies::WARN || status == cmPolicies::OLD)) + { + if(!(this->Makefile->GetState() + ->GetInitializedCacheValue("CMAKE_BACKWARDS_COMPATIBILITY"))) + { + // Set it to 2.4 because that is the last version where the + // variable had meaning. + this->Makefile->AddCacheDefinition + ("CMAKE_BACKWARDS_COMPATIBILITY", "2.4", + "For backwards compatibility, what version of CMake " + "commands and " + "syntax should this version of CMake try to support.", + cmState::STRING); + } + } return true; } diff --git a/Source/cmCPackPropertiesGenerator.cxx b/Source/cmCPackPropertiesGenerator.cxx index cf24c136f..cbcdd815e 100644 --- a/Source/cmCPackPropertiesGenerator.cxx +++ b/Source/cmCPackPropertiesGenerator.cxx @@ -1,13 +1,14 @@ #include "cmCPackPropertiesGenerator.h" +#include "cmOutputConverter.h" #include "cmLocalGenerator.h" cmCPackPropertiesGenerator::cmCPackPropertiesGenerator( - cmMakefile* mf, + cmLocalGenerator* lg, cmInstalledFile const& installedFile, std::vector const& configurations): cmScriptGenerator("CPACK_BUILD_CONFIG", configurations), - Makefile(mf), + LG(lg), InstalledFile(installedFile) { this->ActionsPerConfig = true; @@ -17,7 +18,8 @@ void cmCPackPropertiesGenerator::GenerateScriptForConfig(std::ostream& os, const std::string& config, Indent const& indent) { std::string const& expandedFileName = - this->InstalledFile.GetNameExpression().Evaluate(this->Makefile, config); + this->InstalledFile.GetNameExpression().Evaluate(this->LG->GetMakefile(), + config); cmInstalledFile::PropertyMapType const& properties = this->InstalledFile.GetProperties(); @@ -29,15 +31,15 @@ void cmCPackPropertiesGenerator::GenerateScriptForConfig(std::ostream& os, cmInstalledFile::Property const& property = i->second; os << indent << "set_property(INSTALL " << - cmLocalGenerator::EscapeForCMake(expandedFileName) << " PROPERTY " << - cmLocalGenerator::EscapeForCMake(name); + cmOutputConverter::EscapeForCMake(expandedFileName) << " PROPERTY " << + cmOutputConverter::EscapeForCMake(name); for(cmInstalledFile::ExpressionVectorType::const_iterator j = property.ValueExpressions.begin(); j != property.ValueExpressions.end(); ++j) { - std::string value = (*j)->Evaluate(this->Makefile, config); - os << " " << cmLocalGenerator::EscapeForCMake(value); + std::string value = (*j)->Evaluate(LG->GetMakefile(), config); + os << " " << cmOutputConverter::EscapeForCMake(value); } os << ")\n"; diff --git a/Source/cmCPackPropertiesGenerator.h b/Source/cmCPackPropertiesGenerator.h index 71e2eaa42..eec3df092 100644 --- a/Source/cmCPackPropertiesGenerator.h +++ b/Source/cmCPackPropertiesGenerator.h @@ -15,6 +15,8 @@ #include "cmScriptGenerator.h" #include "cmInstalledFile.h" +class cmLocalGenerator; + /** \class cmCPackPropertiesGenerator * \brief Support class for generating CPackProperties.cmake. * @@ -23,7 +25,7 @@ class cmCPackPropertiesGenerator: public cmScriptGenerator { public: cmCPackPropertiesGenerator( - cmMakefile* mf, + cmLocalGenerator* lg, cmInstalledFile const& installedFile, std::vector const& configurations); @@ -31,7 +33,7 @@ protected: virtual void GenerateScriptForConfig(std::ostream& os, const std::string& config, Indent const& indent); - cmMakefile* Makefile; + cmLocalGenerator* LG; cmInstalledFile const& InstalledFile; }; diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index c55ea3597..7da334ef1 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -115,7 +115,9 @@ void CCONV cmAddCacheDefinition(void *arg, const char* name, const char* CCONV cmGetProjectName(void *arg) { cmMakefile *mf = static_cast(arg); - return mf->GetProjectName(); + static std::string name; + name = mf->GetProjectName(); + return name.c_str(); } const char* CCONV cmGetHomeDirectory(void *arg) @@ -426,8 +428,7 @@ int CCONV cmExecuteCommand(void *arg, const char *name, { // Assume all arguments are quoted. lff.Arguments.push_back( - cmListFileArgument(args[i], cmListFileArgument::Quoted, - "[CMake-Plugin]", 0)); + cmListFileArgument(args[i], cmListFileArgument::Quoted, 0)); } cmExecutionStatus status; return mf->ExecuteCommand(lff,status); @@ -526,11 +527,9 @@ void * CCONV cmCreateSourceFile(void) return (void*)new cmCPluginAPISourceFile; } -void * CCONV cmCreateNewSourceFile(void *arg) +void * CCONV cmCreateNewSourceFile(void *) { - cmMakefile *mf = static_cast(arg); cmCPluginAPISourceFile *sf = new cmCPluginAPISourceFile; - sf->Properties.SetCMakeInstance(mf->GetCMakeInstance()); return (void*)sf; } @@ -630,11 +629,7 @@ const char * CCONV cmSourceFileGetProperty(void *arg,const char *prop) { return sf->FullPath.c_str(); } - bool chain = false; - // Ignore chain because old code will not expect it and it is a - // pain to implement here anyway. - return sf->Properties.GetPropertyValue(prop, cmProperty::SOURCE_FILE, - chain); + return sf->Properties.GetPropertyValue(prop); } } @@ -662,7 +657,7 @@ void CCONV cmSourceFileSetProperty(void *arg,const char *prop, else if(prop) { if(!value) { value = "NOTFOUND"; } - sf->Properties.SetProperty(prop, value, cmProperty::SOURCE_FILE); + sf->Properties.SetProperty(prop, value); } } @@ -801,8 +796,7 @@ void CCONV cmSourceFileSetName2(void *arg, const char* name, const char* dir, // Implement the old SetName method code here. if(headerFileOnly) { - sf->Properties.SetProperty("HEADER_FILE_ONLY", "1", - cmProperty::SOURCE_FILE); + sf->Properties.SetProperty("HEADER_FILE_ONLY", "1"); } sf->SourceName = name; std::string fname = sf->SourceName; diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 8fa19d24a..6e55d8939 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -293,6 +293,7 @@ cmCTest::cmCTest() this->LabelSummary = true; this->ParallelLevel = 1; this->ParallelLevelSetInCli = false; + this->TestLoad = 0; this->SubmitIndex = 0; this->Failover = false; this->BatchJobs = false; @@ -392,6 +393,11 @@ void cmCTest::SetParallelLevel(int level) this->ParallelLevel = level < 1 ? 1 : level; } +void cmCTest::SetTestLoad(unsigned long load) +{ + this->TestLoad = load; +} + //---------------------------------------------------------------------------- bool cmCTest::ShouldCompressTestOutput() { @@ -513,9 +519,10 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command) cm.SetHomeDirectory(""); cm.SetHomeOutputDirectory(""); cmGlobalGenerator gg(&cm); - cmsys::auto_ptr lg(gg.MakeLocalGenerator()); - cmMakefile *mf = lg->GetMakefile(); - if ( !this->ReadCustomConfigurationFileTree(this->BinaryDir.c_str(), mf) ) + cmsys::auto_ptr mf(new cmMakefile(&gg, cm.GetCurrentSnapshot())); + cmsys::auto_ptr lg(gg.CreateLocalGenerator(mf.get())); + if ( !this->ReadCustomConfigurationFileTree(this->BinaryDir.c_str(), + mf.get()) ) { cmCTestOptionalLog(this, DEBUG, "Cannot find custom configuration file tree" << std::endl, quiet); @@ -819,6 +826,20 @@ bool cmCTest::UpdateCTestConfiguration() cmSystemTools::ChangeDirectory(this->BinaryDir); } this->TimeOut = atoi(this->GetCTestConfiguration("TimeOut").c_str()); + std::string const& testLoad = this->GetCTestConfiguration("TestLoad"); + if (!testLoad.empty()) + { + unsigned long load; + if (cmSystemTools::StringToULong(testLoad.c_str(), &load)) + { + this->SetTestLoad(load); + } + else + { + cmCTestLog(this, WARNING, "Invalid value for 'Test Load' : " + << testLoad << std::endl); + } + } if ( this->ProduceXML ) { this->CompressXMLFiles = cmSystemTools::IsOn( @@ -1199,7 +1220,7 @@ int cmCTest::RunMakeCommand(const char* command, std::string& output, char* data; int length; - cmCTestLog(this, HANDLER_OUTPUT, + cmCTestLog(this, HANDLER_PROGRESS_OUTPUT, " Each . represents " << tick_len << " bytes of output" << std::endl << " " << std::flush); while(cmsysProcess_WaitForData(cp, &data, &length, 0)) @@ -1215,10 +1236,10 @@ int cmCTest::RunMakeCommand(const char* command, std::string& output, while ( output.size() > (tick * tick_len) ) { tick ++; - cmCTestLog(this, HANDLER_OUTPUT, "." << std::flush); + cmCTestLog(this, HANDLER_PROGRESS_OUTPUT, "." << std::flush); if ( tick % tick_line_len == 0 && tick > 0 ) { - cmCTestLog(this, HANDLER_OUTPUT, + cmCTestLog(this, HANDLER_PROGRESS_OUTPUT, " Size: " << int((double(output.size()) / 1024.0) + 1) << "K" << std::endl @@ -1231,7 +1252,7 @@ int cmCTest::RunMakeCommand(const char* command, std::string& output, ofs << cmCTestLogWrite(data, length); } } - cmCTestLog(this, OUTPUT, " Size of output: " + cmCTestLog(this, HANDLER_PROGRESS_OUTPUT, " Size of output: " << int(double(output.size()) / 1024.0) << "K" << std::endl); cmsysProcess_WaitForExit(cp, 0); @@ -1523,9 +1544,8 @@ void cmCTest::StartXML(cmXMLWriter& xml, bool append) xml.Attribute("Append", "true"); } xml.Attribute("CompilerName", this->GetCTestConfiguration("Compiler")); -#ifdef _COMPILER_VERSION - xml.Attribute("CompilerVersion", _COMPILER_VERSION); -#endif + xml.Attribute("CompilerVersion", + this->GetCTestConfiguration("CompilerVersion")); xml.Attribute("OSName", info.GetOSName()); xml.Attribute("Hostname", info.GetHostname()); xml.Attribute("OSRelease", info.GetOSRelease()); @@ -1544,6 +1564,13 @@ void cmCTest::StartXML(cmXMLWriter& xml, bool append) xml.Attribute("LogicalProcessorsPerPhysical", info.GetLogicalProcessorsPerPhysical()); xml.Attribute("ProcessorClockFrequency", info.GetProcessorClockFrequency()); + + std::string changeId = this->GetCTestConfiguration("ChangeId"); + if(!changeId.empty()) + { + xml.Attribute("ChangeId", changeId); + } + this->AddSiteProperties(xml); } @@ -2048,6 +2075,21 @@ bool cmCTest::HandleCommandLineArguments(size_t &i, } } + if(this->CheckArgument(arg, "--test-load") && i < args.size() - 1) + { + i++; + unsigned long load; + if (cmSystemTools::StringToULong(args[i].c_str(), &load)) + { + this->SetTestLoad(load); + } + else + { + cmCTestLog(this, WARNING, + "Invalid value for 'Test Load' : " << args[i] << std::endl); + } + } + if(this->CheckArgument(arg, "--no-compress-output")) { this->CompressTestOutput = false; @@ -2123,7 +2165,46 @@ bool cmCTest::HandleCommandLineArguments(size_t &i, { this->OutputTestOutputOnTestFailure = true; } - + if (this->CheckArgument(arg, "--test-output-size-passed") && + i < args.size() - 1) + { + i++; + long outputSize; + if (cmSystemTools::StringToLong(args[i].c_str(), &outputSize)) + { + if (cmCTestTestHandler *pCTestTestHandler = + static_cast(this->TestingHandlers["test"])) + { + pCTestTestHandler->SetTestOutputSizePassed(int(outputSize)); + } + } + else + { + cmCTestLog(this, WARNING, + "Invalid value for '--test-output-size-passed': " << + args[i] << "\n"); + } + } + if (this->CheckArgument(arg, "--test-output-size-failed") && + i < args.size() - 1) + { + i++; + long outputSize; + if (cmSystemTools::StringToLong(args[i].c_str(), &outputSize)) + { + if (cmCTestTestHandler *pCTestTestHandler = + static_cast(this->TestingHandlers["test"])) + { + pCTestTestHandler->SetTestOutputSizeFailed(int(outputSize)); + } + } + else + { + cmCTestLog(this, WARNING, + "Invalid value for '--test-output-size-failed': " << + args[i] << "\n"); + } + } if(this->CheckArgument(arg, "-N", "--show-only")) { this->ShowOnly = true; @@ -3063,6 +3144,7 @@ static const char* cmCTestStringLogType[] = "DEBUG", "OUTPUT", "HANDLER_OUTPUT", + "HANDLER_PROGRESS_OUTPUT", "HANDLER_VERBOSE_OUTPUT", "WARNING", "ERROR_MESSAGE", @@ -3101,6 +3183,11 @@ void cmCTest::Log(int logType, const char* file, int line, const char* msg, { return; } + if ( logType == cmCTest::HANDLER_PROGRESS_OUTPUT && + ( this->Debug || this->ExtraVerbose ) ) + { + return; + } if ( this->OutputLogFile ) { bool display = true; diff --git a/Source/cmCTest.h b/Source/cmCTest.h index db3ea1063..73c280752 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -161,6 +161,9 @@ public: int GetParallelLevel() { return this->ParallelLevel; } void SetParallelLevel(int); + unsigned long GetTestLoad() { return this->TestLoad; } + void SetTestLoad(unsigned long); + /** * Check if CTest file exists */ @@ -379,6 +382,7 @@ public: DEBUG = 0, OUTPUT, HANDLER_OUTPUT, + HANDLER_PROGRESS_OUTPUT, HANDLER_VERBOSE_OUTPUT, WARNING, ERROR_MESSAGE, @@ -499,6 +503,8 @@ private: int ParallelLevel; bool ParallelLevelSetInCli; + unsigned long TestLoad; + int CompatibilityMode; // information for the --build-and-test options diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 108208ef1..54209c5ce 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -161,7 +161,6 @@ bool cmCacheManager::LoadCache(const std::string& path, // Format is key:type=value std::string helpString; CacheEntry e; - e.Properties.SetCMakeInstance(this->CMakeInstance); cmSystemTools::GetLineFromStream(fin, buffer); realbuffer = buffer.c_str(); while(*realbuffer != '0' && @@ -323,7 +322,6 @@ bool cmCacheManager::ReadPropertyEntry(std::string const& entryKey, { // Create an entry and store the property. CacheEntry& ne = this->Cache[key]; - ne.Properties.SetCMakeInstance(this->CMakeInstance); ne.Type = cmState::UNINITIALIZED; ne.SetProperty(*p, e.Value.c_str()); } @@ -645,7 +643,6 @@ void cmCacheManager::AddCacheEntry(const std::string& key, cmState::CacheEntryType type) { CacheEntry& e = this->Cache[key]; - e.Properties.SetCMakeInstance(this->CMakeInstance); if ( value ) { e.Value = value; @@ -744,9 +741,7 @@ cmCacheManager::CacheEntry::GetProperty(const std::string& prop) const { return this->Value.c_str(); } - bool c = false; - return - this->Properties.GetPropertyValue(prop, cmProperty::CACHE, c); + return this->Properties.GetPropertyValue(prop); } //---------------------------------------------------------------------------- @@ -763,7 +758,7 @@ void cmCacheManager::CacheEntry::SetProperty(const std::string& prop, } else { - this->Properties.SetProperty(prop, value, cmProperty::CACHE); + this->Properties.SetProperty(prop, value); } } @@ -789,7 +784,7 @@ void cmCacheManager::CacheEntry::AppendProperty(const std::string& prop, } else { - this->Properties.AppendProperty(prop, value, cmProperty::CACHE, asString); + this->Properties.AppendProperty(prop, value, asString); } } diff --git a/Source/cmCallVisualStudioMacro.cxx b/Source/cmCallVisualStudioMacro.cxx index c2111116b..0e0483892 100644 --- a/Source/cmCallVisualStudioMacro.cxx +++ b/Source/cmCallVisualStudioMacro.cxx @@ -498,7 +498,7 @@ int cmCallVisualStudioMacro::CallMacro( } } - if(0 == instances.size()) + if(instances.empty()) { // no instances to call diff --git a/Source/cmCommand.h b/Source/cmCommand.h index 0548c6b9f..59bc396f3 100644 --- a/Source/cmCommand.h +++ b/Source/cmCommand.h @@ -101,15 +101,6 @@ public: return false; } - /** - * This determines if usage of the method is discouraged or not. - * This is currently only used for generating the documentation. - */ - virtual bool IsDiscouraged() const - { - return false; - } - /** * This is used to avoid including this command * in documentation. This is mainly used by diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx index bd098a5f5..14e9e5661 100644 --- a/Source/cmCommandArgumentParserHelper.cxx +++ b/Source/cmCommandArgumentParserHelper.cxx @@ -14,7 +14,7 @@ #include "cmSystemTools.h" #include "cmMakefile.h" #include "cmState.h" -#include "cmLocalGenerator.h" +#include "cmOutputConverter.h" #include "cmCommandArgumentLexer.h" @@ -141,8 +141,9 @@ char* cmCommandArgumentParserHelper::ExpandVariable(const char* var) { std::ostringstream msg; cmListFileContext lfc; - lfc.FilePath = this->Makefile->GetLocalGenerator() - ->Convert(this->FileName, cmLocalGenerator::HOME); + cmOutputConverter converter(this->Makefile->GetStateSnapshot()); + lfc.FilePath = converter.Convert(this->FileName, + cmOutputConverter::HOME); lfc.Line = this->FileLine; msg << "uninitialized variable \'" << var << "\'"; diff --git a/Source/cmCommandArgumentParserHelper.h b/Source/cmCommandArgumentParserHelper.h index d375ae624..387afc639 100644 --- a/Source/cmCommandArgumentParserHelper.h +++ b/Source/cmCommandArgumentParserHelper.h @@ -80,8 +80,6 @@ private: std::string::size_type InputBufferPos; std::string InputBuffer; std::vector OutputBuffer; - int CurrentLine; - int Verbose; void Print(const char* place, const char* str); void SafePrintMissing(const char* str, int line, int cnt); @@ -94,12 +92,14 @@ private: std::vector Variables; const cmMakefile* Makefile; std::string Result; + std::string ErrorString; const char* FileName; + long FileLine; + int CurrentLine; + int Verbose; bool WarnUninitialized; bool CheckSystemVars; - long FileLine; bool EscapeQuotes; - std::string ErrorString; bool NoEscapeMode; bool ReplaceAtSyntax; bool RemoveEmpty; diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx new file mode 100644 index 000000000..252e2312d --- /dev/null +++ b/Source/cmCommonTargetGenerator.cxx @@ -0,0 +1,431 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2015 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmCommonTargetGenerator.h" + +#include "cmComputeLinkInformation.h" +#include "cmGeneratorTarget.h" +#include "cmGlobalCommonGenerator.h" +#include "cmLocalCommonGenerator.h" +#include "cmMakefile.h" +#include "cmSourceFile.h" +#include "cmSystemTools.h" +#include "cmTarget.h" + +cmCommonTargetGenerator::cmCommonTargetGenerator( + cmOutputConverter::RelativeRoot wd, + cmGeneratorTarget* gt + ) + : WorkingDirectory(wd) + , GeneratorTarget(gt) + , Target(gt->Target) + , Makefile(gt->Makefile) + , LocalGenerator(static_cast(gt->LocalGenerator)) + , GlobalGenerator(static_cast( + gt->LocalGenerator->GetGlobalGenerator())) + , ConfigName(LocalGenerator->GetConfigName()) + , ModuleDefinitionFile(GeneratorTarget->GetModuleDefinitionFile(ConfigName)) + , FortranModuleDirectoryComputed(false) +{ +} + +cmCommonTargetGenerator::~cmCommonTargetGenerator() +{ +} + +std::string const& cmCommonTargetGenerator::GetConfigName() const +{ + return this->ConfigName; +} + +std::string cmCommonTargetGenerator::Convert( + std::string const& source, + cmLocalGenerator::RelativeRoot relative, + cmLocalGenerator::OutputFormat output) +{ + return this->LocalGenerator->Convert(source, relative, output); +} + +//---------------------------------------------------------------------------- +const char* cmCommonTargetGenerator::GetFeature(const std::string& feature) +{ + return this->GeneratorTarget->GetFeature(feature, this->ConfigName); +} + +//---------------------------------------------------------------------------- +bool cmCommonTargetGenerator::GetFeatureAsBool(const std::string& feature) +{ + return this->GeneratorTarget->GetFeatureAsBool(feature, this->ConfigName); +} + +//---------------------------------------------------------------------------- +void cmCommonTargetGenerator::AddFeatureFlags( + std::string& flags, const std::string& lang + ) +{ + // Add language-specific flags. + this->LocalGenerator->AddLanguageFlags(flags, lang, this->ConfigName); + + if(this->GetFeatureAsBool("INTERPROCEDURAL_OPTIMIZATION")) + { + this->LocalGenerator->AppendFeatureOptions(flags, lang, "IPO"); + } +} + +//---------------------------------------------------------------------------- +void cmCommonTargetGenerator::AddModuleDefinitionFlag(std::string& flags) +{ + if(this->ModuleDefinitionFile.empty()) + { + return; + } + + // TODO: Create a per-language flag variable. + const char* defFileFlag = + this->Makefile->GetDefinition("CMAKE_LINK_DEF_FILE_FLAG"); + if(!defFileFlag) + { + return; + } + + // Append the flag and value. Use ConvertToLinkReference to help + // vs6's "cl -link" pass it to the linker. + std::string flag = defFileFlag; + flag += (this->LocalGenerator->ConvertToLinkReference( + this->ModuleDefinitionFile)); + this->LocalGenerator->AppendFlags(flags, flag); +} + +//---------------------------------------------------------------------------- +std::string cmCommonTargetGenerator::ComputeFortranModuleDirectory() const +{ + std::string mod_dir; + const char* target_mod_dir = + this->Target->GetProperty("Fortran_MODULE_DIRECTORY"); + const char* moddir_flag = + this->Makefile->GetDefinition("CMAKE_Fortran_MODDIR_FLAG"); + if(target_mod_dir && moddir_flag) + { + // Compute the full path to the module directory. + if(cmSystemTools::FileIsFullPath(target_mod_dir)) + { + // Already a full path. + mod_dir = target_mod_dir; + } + else + { + // Interpret relative to the current output directory. + mod_dir = this->Makefile->GetCurrentBinaryDirectory(); + mod_dir += "/"; + mod_dir += target_mod_dir; + } + + // Make sure the module output directory exists. + cmSystemTools::MakeDirectory(mod_dir); + } + return mod_dir; +} + +//---------------------------------------------------------------------------- +std::string cmCommonTargetGenerator::GetFortranModuleDirectory() +{ + // Compute the module directory. + if(!this->FortranModuleDirectoryComputed) + { + this->FortranModuleDirectoryComputed = true; + this->FortranModuleDirectory = this->ComputeFortranModuleDirectory(); + } + + // Return the computed directory. + return this->FortranModuleDirectory; +} + +//---------------------------------------------------------------------------- +void cmCommonTargetGenerator::AddFortranFlags(std::string& flags) +{ + // Enable module output if necessary. + if(const char* modout_flag = + this->Makefile->GetDefinition("CMAKE_Fortran_MODOUT_FLAG")) + { + this->LocalGenerator->AppendFlags(flags, modout_flag); + } + + // Add a module output directory flag if necessary. + std::string mod_dir = this->GetFortranModuleDirectory(); + if (!mod_dir.empty()) + { + mod_dir = this->Convert(mod_dir, + this->WorkingDirectory, + cmLocalGenerator::SHELL); + } + else + { + mod_dir = + this->Makefile->GetSafeDefinition("CMAKE_Fortran_MODDIR_DEFAULT"); + } + if (!mod_dir.empty()) + { + const char* moddir_flag = + this->Makefile->GetRequiredDefinition("CMAKE_Fortran_MODDIR_FLAG"); + std::string modflag = moddir_flag; + modflag += mod_dir; + this->LocalGenerator->AppendFlags(flags, modflag); + } + + // If there is a separate module path flag then duplicate the + // include path with it. This compiler does not search the include + // path for modules. + if(const char* modpath_flag = + this->Makefile->GetDefinition("CMAKE_Fortran_MODPATH_FLAG")) + { + std::vector includes; + const std::string& config = + this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); + this->LocalGenerator->GetIncludeDirectories(includes, + this->GeneratorTarget, + "C", config); + for(std::vector::const_iterator idi = includes.begin(); + idi != includes.end(); ++idi) + { + std::string flg = modpath_flag; + flg += this->Convert(*idi, + cmLocalGenerator::NONE, + cmLocalGenerator::SHELL); + this->LocalGenerator->AppendFlags(flags, flg); + } + } +} + +//---------------------------------------------------------------------------- +void +cmCommonTargetGenerator +::AppendFortranFormatFlags(std::string& flags, cmSourceFile const& source) +{ + const char* srcfmt = source.GetProperty("Fortran_FORMAT"); + cmLocalGenerator::FortranFormat format = + this->LocalGenerator->GetFortranFormat(srcfmt); + if(format == cmLocalGenerator::FortranFormatNone) + { + const char* tgtfmt = this->Target->GetProperty("Fortran_FORMAT"); + format = this->LocalGenerator->GetFortranFormat(tgtfmt); + } + const char* var = 0; + switch (format) + { + case cmLocalGenerator::FortranFormatFixed: + var = "CMAKE_Fortran_FORMAT_FIXED_FLAG"; break; + case cmLocalGenerator::FortranFormatFree: + var = "CMAKE_Fortran_FORMAT_FREE_FLAG"; break; + default: break; + } + if(var) + { + this->LocalGenerator->AppendFlags( + flags, this->Makefile->GetDefinition(var)); + } +} + +//---------------------------------------------------------------------------- +std::string cmCommonTargetGenerator::GetFrameworkFlags(std::string const& l) +{ + if(!this->Makefile->IsOn("APPLE")) + { + return std::string(); + } + + std::string fwSearchFlagVar = "CMAKE_" + l + "_FRAMEWORK_SEARCH_FLAG"; + const char* fwSearchFlag = + this->Makefile->GetDefinition(fwSearchFlagVar); + if(!(fwSearchFlag && *fwSearchFlag)) + { + return std::string(); + } + + std::set emitted; +#ifdef __APPLE__ /* don't insert this when crosscompiling e.g. to iphone */ + emitted.insert("/System/Library/Frameworks"); +#endif + std::vector includes; + + const std::string& config = + this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); + this->LocalGenerator->GetIncludeDirectories(includes, + this->GeneratorTarget, + "C", config); + // check all include directories for frameworks as this + // will already have added a -F for the framework + for(std::vector::iterator i = includes.begin(); + i != includes.end(); ++i) + { + if(this->Target->NameResolvesToFramework(*i)) + { + std::string frameworkDir = *i; + frameworkDir += "/../"; + frameworkDir = cmSystemTools::CollapseFullPath(frameworkDir); + emitted.insert(frameworkDir); + } + } + + std::string flags; + const char* cfg = this->LocalGenerator->GetConfigName().c_str(); + if(cmComputeLinkInformation* cli = + this->GeneratorTarget->GetLinkInformation(cfg)) + { + std::vector const& frameworks = cli->GetFrameworkPaths(); + for(std::vector::const_iterator i = frameworks.begin(); + i != frameworks.end(); ++i) + { + if(emitted.insert(*i).second) + { + flags += fwSearchFlag; + flags += this->LocalGenerator + ->ConvertToOutputFormat(*i, cmLocalGenerator::SHELL); + flags += " "; + } + } + } + return flags; +} + +//---------------------------------------------------------------------------- +std::string cmCommonTargetGenerator::GetFlags(const std::string &l) +{ + ByLanguageMap::iterator i = this->FlagsByLanguage.find(l); + if (i == this->FlagsByLanguage.end()) + { + std::string flags; + const char *lang = l.c_str(); + + // Add language feature flags. + this->AddFeatureFlags(flags, lang); + + this->LocalGenerator->AddArchitectureFlags(flags, this->GeneratorTarget, + lang, this->ConfigName); + + // Fortran-specific flags computed for this target. + if(l == "Fortran") + { + this->AddFortranFlags(flags); + } + + this->LocalGenerator->AddCMP0018Flags(flags, this->Target, + lang, this->ConfigName); + + this->LocalGenerator->AddVisibilityPresetFlags(flags, this->Target, + lang); + + // Append old-style preprocessor definition flags. + this->LocalGenerator-> + AppendFlags(flags, this->Makefile->GetDefineFlags()); + + // Add framework directory flags. + this->LocalGenerator-> + AppendFlags(flags,this->GetFrameworkFlags(l)); + + // Add target-specific flags. + this->LocalGenerator->AddCompileOptions(flags, this->Target, + lang, this->ConfigName); + + ByLanguageMap::value_type entry(l, flags); + i = this->FlagsByLanguage.insert(entry).first; + } + return i->second; +} + +std::string cmCommonTargetGenerator::GetDefines(const std::string &l) +{ + ByLanguageMap::iterator i = this->DefinesByLanguage.find(l); + if (i == this->DefinesByLanguage.end()) + { + std::set defines; + const char *lang = l.c_str(); + // Add the export symbol definition for shared library objects. + if(const char* exportMacro = this->Target->GetExportMacro()) + { + this->LocalGenerator->AppendDefines(defines, exportMacro); + } + + // Add preprocessor definitions for this target and configuration. + this->LocalGenerator->AddCompileDefinitions(defines, this->Target, + this->LocalGenerator->GetConfigName(), l); + + std::string definesString; + this->LocalGenerator->JoinDefines(defines, definesString, lang); + + ByLanguageMap::value_type entry(l, definesString); + i = this->DefinesByLanguage.insert(entry).first; + } + return i->second; +} + +std::string cmCommonTargetGenerator::GetIncludes(std::string const& l) +{ + ByLanguageMap::iterator i = this->IncludesByLanguage.find(l); + if (i == this->IncludesByLanguage.end()) + { + std::string includes; + this->AddIncludeFlags(includes, l); + ByLanguageMap::value_type entry(l, includes); + i = this->IncludesByLanguage.insert(entry).first; + } + return i->second; +} + +std::vector +cmCommonTargetGenerator::GetLinkedTargetDirectories() const +{ + std::vector dirs; + std::set emitted; + if (cmComputeLinkInformation* cli = + this->GeneratorTarget->GetLinkInformation(this->ConfigName)) + { + cmComputeLinkInformation::ItemVector const& items = cli->GetItems(); + for(cmComputeLinkInformation::ItemVector::const_iterator + i = items.begin(); i != items.end(); ++i) + { + cmTarget const* linkee = i->Target; + if(linkee && !linkee->IsImported() + // We can ignore the INTERFACE_LIBRARY items because + // Target->GetLinkInformation already processed their + // link interface and they don't have any output themselves. + && linkee->GetType() != cmTarget::INTERFACE_LIBRARY + && emitted.insert(linkee).second) + { + cmGeneratorTarget* gt = + this->GlobalGenerator->GetGeneratorTarget(linkee); + cmLocalGenerator* lg = gt->GetLocalGenerator(); + cmMakefile* mf = linkee->GetMakefile(); + std::string di = mf->GetCurrentBinaryDirectory(); + di += "/"; + di += lg->GetTargetDirectory(*linkee); + dirs.push_back(di); + } + } + } + return dirs; +} + +std::string cmCommonTargetGenerator::GetManifests() +{ + std::vector manifest_srcs; + this->GeneratorTarget->GetManifests(manifest_srcs, this->ConfigName); + + std::vector manifests; + for (std::vector::iterator mi = manifest_srcs.begin(); + mi != manifest_srcs.end(); ++mi) + { + manifests.push_back(this->Convert((*mi)->GetFullPath(), + this->WorkingDirectory, + cmOutputConverter::SHELL)); + } + + return cmJoin(manifests, " "); +} diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h new file mode 100644 index 000000000..a4b2c10ec --- /dev/null +++ b/Source/cmCommonTargetGenerator.h @@ -0,0 +1,96 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2015 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmCommonTargetGenerator_h +#define cmCommonTargetGenerator_h + +#include "cmStandardIncludes.h" + +#include "cmLocalGenerator.h" + +class cmGeneratorTarget; +class cmGlobalCommonGenerator; +class cmLocalCommonGenerator; +class cmMakefile; +class cmSourceFile; +class cmTarget; + +/** \class cmCommonTargetGenerator + * \brief Common infrastructure for Makefile and Ninja per-target generators + */ +class cmCommonTargetGenerator +{ +public: + cmCommonTargetGenerator(cmOutputConverter::RelativeRoot wd, + cmGeneratorTarget* gt); + virtual ~cmCommonTargetGenerator(); + + std::string const& GetConfigName() const; + +protected: + + // Add language feature flags. + void AddFeatureFlags(std::string& flags, const std::string& lang); + + // Feature query methods. + const char* GetFeature(const std::string& feature); + bool GetFeatureAsBool(const std::string& feature); + + // Helper to add flag for windows .def file. + void AddModuleDefinitionFlag(std::string& flags); + + cmOutputConverter::RelativeRoot WorkingDirectory; + cmGeneratorTarget* GeneratorTarget; + cmTarget* Target; + cmMakefile* Makefile; + cmLocalCommonGenerator* LocalGenerator; + cmGlobalCommonGenerator* GlobalGenerator; + std::string ConfigName; + + // The windows module definition source file (.def), if any. + std::string ModuleDefinitionFile; + + // Target-wide Fortran module output directory. + bool FortranModuleDirectoryComputed; + std::string FortranModuleDirectory; + std::string GetFortranModuleDirectory(); + virtual std::string ComputeFortranModuleDirectory() const; + + // Compute target-specific Fortran language flags. + void AddFortranFlags(std::string& flags); + + std::string Convert(std::string const& source, + cmLocalGenerator::RelativeRoot relative, + cmLocalGenerator::OutputFormat output = + cmLocalGenerator::UNCHANGED); + + void AppendFortranFormatFlags(std::string& flags, + cmSourceFile const& source); + + // Return the a string with -F flags on apple + std::string GetFrameworkFlags(std::string const& l); + + virtual void AddIncludeFlags(std::string& flags, + std::string const& lang) = 0; + + typedef std::map ByLanguageMap; + std::string GetFlags(const std::string &l); + ByLanguageMap FlagsByLanguage; + std::string GetDefines(const std::string &l); + ByLanguageMap DefinesByLanguage; + std::string GetIncludes(std::string const& l); + ByLanguageMap IncludesByLanguage; + std::string GetManifests(); + + std::vector GetLinkedTargetDirectories() const; +}; + +#endif diff --git a/Source/cmComputeComponentGraph.h b/Source/cmComputeComponentGraph.h index a2ce946c1..4dbac4a2e 100644 --- a/Source/cmComputeComponentGraph.h +++ b/Source/cmComputeComponentGraph.h @@ -67,17 +67,17 @@ private: int Root; int VisitIndex; }; - int TarjanWalkId; std::vector TarjanVisited; std::vector TarjanComponents; std::vector TarjanEntries; + std::vector Components; std::stack TarjanStack; + int TarjanWalkId; int TarjanIndex; void Tarjan(); void TarjanVisit(int i); // Connected components. - std::vector Components; }; #endif diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index abd987767..1b5c9f417 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -12,14 +12,13 @@ #include "cmComputeLinkDepends.h" #include "cmComputeComponentGraph.h" +#include "cmLocalGenerator.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" #include "cmTarget.h" #include "cmake.h" #include "cmAlgorithms.h" -#include - #include /* @@ -173,18 +172,20 @@ items that we know the linker will re-use automatically (shared libs). //---------------------------------------------------------------------------- cmComputeLinkDepends -::cmComputeLinkDepends(cmTarget const* target, const std::string& config) +::cmComputeLinkDepends(const cmGeneratorTarget* target, + const std::string& config) { // Store context information. this->Target = target; - this->Makefile = this->Target->GetMakefile(); - this->GlobalGenerator = this->Makefile->GetGlobalGenerator(); + this->Makefile = this->Target->Target->GetMakefile(); + this->GlobalGenerator = + this->Target->GetLocalGenerator()->GetGlobalGenerator(); this->CMakeInstance = this->GlobalGenerator->GetCMakeInstance(); // The configuration being linked. this->HasConfig = !config.empty(); this->Config = (this->HasConfig)? config : std::string(); - this->LinkType = this->Target->ComputeLinkType(this->Config); + this->LinkType = this->Target->Target->ComputeLinkType(this->Config); // Enable debug mode if requested. this->DebugMode = this->Makefile->IsOn("CMAKE_LINK_DEPENDS_DEBUG_MODE"); @@ -361,9 +362,11 @@ void cmComputeLinkDepends::FollowLinkEntry(BFSEntry const& qe) // Follow the item's dependencies. if(entry.Target) { + cmGeneratorTarget* gtgt = + this->GlobalGenerator->GetGeneratorTarget(entry.Target); // Follow the target dependencies. - if(cmTarget::LinkInterface const* iface = - entry.Target->GetLinkInterface(this->Config, this->Target)) + if(cmLinkInterface const* iface = + gtgt->GetLinkInterface(this->Config, this->Target->Target)) { const bool isIface = entry.Target->GetType() == cmTarget::INTERFACE_LIBRARY; @@ -397,7 +400,7 @@ void cmComputeLinkDepends::FollowLinkEntry(BFSEntry const& qe) //---------------------------------------------------------------------------- void cmComputeLinkDepends -::FollowSharedDeps(int depender_index, cmTarget::LinkInterface const* iface, +::FollowSharedDeps(int depender_index, cmLinkInterface const* iface, bool follow_interface) { // Follow dependencies if we have not followed them already. @@ -460,8 +463,10 @@ void cmComputeLinkDepends::HandleSharedDependency(SharedDepEntry const& dep) // Target items may have their own dependencies. if(entry.Target) { - if(cmTarget::LinkInterface const* iface = - entry.Target->GetLinkInterface(this->Config, this->Target)) + cmGeneratorTarget* gtgt = + this->GlobalGenerator->GetGeneratorTarget(entry.Target); + if(cmLinkInterface const* iface = + gtgt->GetLinkInterface(this->Config, this->Target->Target)) { // Follow public and private dependencies transitively. this->FollowSharedDeps(index, iface, true); @@ -551,7 +556,7 @@ void cmComputeLinkDepends::AddVarLinkEntries(int depender_index, void cmComputeLinkDepends::AddDirectLinkEntries() { // Add direct link dependencies in this configuration. - cmTarget::LinkImplementation const* impl = + cmLinkImplementation const* impl = this->Target->GetLinkImplementation(this->Config); this->AddLinkEntries(-1, impl->Libraries); for(std::vector::const_iterator @@ -634,7 +639,7 @@ cmTarget const* cmComputeLinkDepends::FindTargetToLink(int depender_index, const std::string& name) { // Look for a target in the scope of the depender. - cmTarget const* from = this->Target; + cmTarget const* from = this->Target->Target; if(depender_index >= 0) { if(cmTarget const* depender = this->EntryList[depender_index].Target) @@ -931,8 +936,10 @@ int cmComputeLinkDepends::ComputeComponentCount(NodeList const& nl) { if(cmTarget const* target = this->EntryList[*ni].Target) { - if(cmTarget::LinkInterface const* iface = - target->GetLinkInterface(this->Config, this->Target)) + cmGeneratorTarget* gtgt = + this->GlobalGenerator->GetGeneratorTarget(target); + if(cmLinkInterface const* iface = + gtgt->GetLinkInterface(this->Config, this->Target->Target)) { if(iface->Multiplicity > count) { diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h index 09b9d7053..2cbb43013 100644 --- a/Source/cmComputeLinkDepends.h +++ b/Source/cmComputeLinkDepends.h @@ -22,6 +22,7 @@ class cmComputeComponentGraph; class cmGlobalGenerator; class cmMakefile; +class cmGeneratorTarget; class cmTarget; class cmake; @@ -31,7 +32,8 @@ class cmake; class cmComputeLinkDepends { public: - cmComputeLinkDepends(cmTarget const* target, const std::string& config); + cmComputeLinkDepends(cmGeneratorTarget const* target, + const std::string& config); ~cmComputeLinkDepends(); // Basic information about each link item. @@ -57,18 +59,11 @@ public: private: // Context information. - cmTarget const* Target; + cmGeneratorTarget const* Target; cmMakefile* Makefile; cmGlobalGenerator const* GlobalGenerator; cmake* CMakeInstance; - bool DebugMode; - - // Configuration information. - bool HasConfig; std::string Config; - cmTarget::LinkLibraryType LinkType; - - // Output information. EntryVector FinalLinkEntries; typedef cmTarget::LinkLibraryVectorType LinkLibraryVectorType; @@ -107,7 +102,7 @@ private: std::queue SharedDepQueue; std::set SharedDepFollowed; void FollowSharedDeps(int depender_index, - cmTarget::LinkInterface const* iface, + cmLinkInterface const* iface, bool follow_interface = false); void QueueSharedDependencies(int depender_index, std::vector const& deps); @@ -131,7 +126,7 @@ private: void OrderLinkEntires(); std::vector ComponentVisited; std::vector ComponentOrder; - int ComponentOrderId; + struct PendingComponent { // The real component id. Needed because the map is indexed by @@ -158,11 +153,14 @@ private: // Record of the original link line. std::vector OriginalEntries; + std::set OldWrongConfigItems; + void CheckWrongConfigItem(cmLinkItem const& item); - // Compatibility help. + int ComponentOrderId; + cmTarget::LinkLibraryType LinkType; + bool HasConfig; + bool DebugMode; bool OldLinkDirMode; - void CheckWrongConfigItem(cmLinkItem const& item); - std::set OldWrongConfigItems; }; #endif diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index e6cbe6026..d35b566ad 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -14,11 +14,13 @@ #include "cmComputeLinkDepends.h" #include "cmOrderDirectories.h" +#include "cmLocalGenerator.h" #include "cmGlobalGenerator.h" #include "cmState.h" -#include "cmLocalGenerator.h" +#include "cmOutputConverter.h" #include "cmMakefile.h" #include "cmTarget.h" +#include "cmGeneratorTarget.h" #include "cmake.h" #include "cmAlgorithms.h" @@ -241,13 +243,14 @@ because this need be done only for shared libraries without soname-s. //---------------------------------------------------------------------------- cmComputeLinkInformation -::cmComputeLinkInformation(cmTarget const* target, const std::string& config) +::cmComputeLinkInformation(const cmGeneratorTarget* target, + const std::string& config) { // Store context information. this->Target = target; - this->Makefile = this->Target->GetMakefile(); - this->LocalGenerator = this->Makefile->GetLocalGenerator(); - this->GlobalGenerator = this->Makefile->GetGlobalGenerator(); + this->Makefile = this->Target->Target->GetMakefile(); + this->GlobalGenerator = + this->Target->GetLocalGenerator()->GetGlobalGenerator(); this->CMakeInstance = this->GlobalGenerator->GetCMakeInstance(); // Check whether to recognize OpenBSD-style library versioned names. @@ -281,14 +284,14 @@ cmComputeLinkInformation // Check whether we should skip dependencies on shared library files. this->LinkDependsNoShared = - this->Target->GetPropertyAsBool("LINK_DEPENDS_NO_SHARED"); + this->Target->Target->GetPropertyAsBool("LINK_DEPENDS_NO_SHARED"); // On platforms without import libraries there may be a special flag // to use when creating a plugin (module) that obtains symbols from // the program that will load it. this->LoaderFlag = 0; if(!this->UseImportLibrary && - this->Target->GetType() == cmTarget::MODULE_LIBRARY) + this->Target->Target->GetType() == cmTarget::MODULE_LIBRARY) { std::string loader_flag_var = "CMAKE_SHARED_MODULE_LOADER_"; loader_flag_var += this->LinkLanguage; @@ -306,10 +309,10 @@ cmComputeLinkInformation // Get options needed to specify RPATHs. this->RuntimeUseChrpath = false; - if(this->Target->GetType() != cmTarget::STATIC_LIBRARY) + if(this->Target->Target->GetType() != cmTarget::STATIC_LIBRARY) { const char* tType = - ((this->Target->GetType() == cmTarget::EXECUTABLE)? + ((this->Target->Target->GetType() == cmTarget::EXECUTABLE)? "EXECUTABLE" : "SHARED_LIBRARY"); std::string rtVar = "CMAKE_"; rtVar += tType; @@ -322,6 +325,7 @@ cmComputeLinkInformation this->RuntimeAlways = (this->Makefile-> GetSafeDefinition("CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH")); + this->RuntimeUseChrpath = this->Target->IsChrpathUsed(config); // Get options needed to help find dependent libraries. @@ -374,9 +378,9 @@ cmComputeLinkInformation // Add the search path entries requested by the user to path ordering. this->OrderLinkerSearchPath - ->AddUserDirectories(this->Target->GetLinkDirectories()); + ->AddUserDirectories(this->Target->Target->GetLinkDirectories()); this->OrderRuntimeSearchPath - ->AddUserDirectories(this->Target->GetLinkDirectories()); + ->AddUserDirectories(this->Target->Target->GetLinkDirectories()); // Set up the implicit link directories. this->LoadImplicitLinkInfo(); @@ -404,12 +408,13 @@ cmComputeLinkInformation // order to support such projects we need to add the directories // containing libraries linked with a full path to the -L path. this->OldLinkDirMode = - this->Target->GetPolicyStatusCMP0003() != cmPolicies::NEW; + this->Target->Target->GetPolicyStatusCMP0003() != cmPolicies::NEW; if(this->OldLinkDirMode) { // Construct a mask to not bother with this behavior for link // directories already specified by the user. - std::vector const& dirs = this->Target->GetLinkDirectories(); + std::vector const& dirs = + this->Target->Target->GetLinkDirectories(); this->OldLinkDirMask.insert(dirs.begin(), dirs.end()); } @@ -515,7 +520,8 @@ bool cmComputeLinkInformation::Compute() // Restore the target link type so the correct system runtime // libraries are found. - const char* lss = this->Target->GetProperty("LINK_SEARCH_END_STATIC"); + const char* lss = + this->Target->Target->GetProperty("LINK_SEARCH_END_STATIC"); if(cmSystemTools::IsOn(lss)) { this->SetCurrentLinkType(LinkStatic); @@ -536,10 +542,11 @@ bool cmComputeLinkInformation::Compute() i != wrongItems.end(); ++i) { cmTarget const* tgt = *i; + cmGeneratorTarget *gtgt = this->GlobalGenerator->GetGeneratorTarget(tgt); bool implib = (this->UseImportLibrary && (tgt->GetType() == cmTarget::SHARED_LIBRARY)); - std::string lib = tgt->GetFullPath(this->Config , implib, true); + std::string lib = gtgt->GetFullPath(this->Config , implib, true); this->OldLinkDirItems.push_back(lib); } } @@ -565,7 +572,7 @@ bool cmComputeLinkInformation::Compute() "name." ; this->CMakeInstance->IssueMessage(cmake::AUTHOR_WARNING, w.str(), - this->Target->GetBacktrace()); + this->Target->Target->GetBacktrace()); } return true; @@ -575,7 +582,8 @@ bool cmComputeLinkInformation::Compute() void cmComputeLinkInformation::AddImplicitLinkInfo() { // The link closure lists all languages whose implicit info is needed. - cmTarget::LinkClosure const* lc=this->Target->GetLinkClosure(this->Config); + cmGeneratorTarget::LinkClosure const* lc = + this->Target->GetLinkClosure(this->Config); for(std::vector::const_iterator li = lc->Languages.begin(); li != lc->Languages.end(); ++li) { @@ -638,6 +646,7 @@ void cmComputeLinkInformation::AddItem(std::string const& item, if(tgt && tgt->IsLinkable()) { + cmGeneratorTarget *gtgt = this->GlobalGenerator->GetGeneratorTarget(tgt); // This is a CMake target. Ask the target for its real name. if(impexe && this->LoaderFlag) { @@ -646,7 +655,8 @@ void cmComputeLinkInformation::AddItem(std::string const& item, // platform. Add it now. std::string linkItem; linkItem = this->LoaderFlag; - std::string exe = tgt->GetFullPath(config, this->UseImportLibrary, + + std::string exe = gtgt->GetFullPath(config, this->UseImportLibrary, true); linkItem += exe; this->Items.push_back(Item(linkItem, true, tgt)); @@ -667,7 +677,7 @@ void cmComputeLinkInformation::AddItem(std::string const& item, (impexe || tgt->GetType() == cmTarget::SHARED_LIBRARY)); // Pass the full path to the target file. - std::string lib = tgt->GetFullPath(config, implib, true); + std::string lib = gtgt->GetFullPath(config, implib, true); if(!this->LinkDependsNoShared || tgt->GetType() != cmTarget::SHARED_LIBRARY) { @@ -750,13 +760,17 @@ void cmComputeLinkInformation::AddSharedDepItem(std::string const& item, return; } + cmGeneratorTarget *gtgt = 0; + // Get a full path to the dependent shared library. // Add it to the runtime path computation so that the target being // linked will be able to find it. std::string lib; if(tgt) { - lib = tgt->GetFullPath(this->Config, this->UseImportLibrary); + gtgt = this->GlobalGenerator->GetGeneratorTarget(tgt); + + lib = gtgt->GetFullPath(this->Config, this->UseImportLibrary); this->AddLibraryRuntimeInfo(lib, tgt); } else @@ -781,9 +795,9 @@ void cmComputeLinkInformation::AddSharedDepItem(std::string const& item, } if(order) { - if(tgt) + if(gtgt) { - std::string soName = tgt->GetSOName(this->Config); + std::string soName = gtgt->GetSOName(this->Config); const char* soname = soName.empty()? 0 : soName.c_str(); order->AddRuntimeLibrary(lib, soname); } @@ -845,7 +859,8 @@ void cmComputeLinkInformation::ComputeLinkTypeInfo() } // Lookup the starting link type from the target (linked statically?). - const char* lss = this->Target->GetProperty("LINK_SEARCH_START_STATIC"); + const char* lss = + this->Target->Target->GetProperty("LINK_SEARCH_START_STATIC"); this->StartLinkType = cmSystemTools::IsOn(lss)? LinkStatic : LinkShared; this->CurrentLinkType = this->StartLinkType; } @@ -1131,7 +1146,7 @@ void cmComputeLinkInformation::AddFullItem(std::string const& item) // Full path libraries should specify a valid library file name. // See documentation of CMP0008. std::string generator = this->GlobalGenerator->GetName(); - if(this->Target->GetPolicyStatusCMP0008() != cmPolicies::NEW && + if(this->Target->Target->GetPolicyStatusCMP0008() != cmPolicies::NEW && (generator.find("Visual Studio") != generator.npos || generator.find("Xcode") != generator.npos)) { @@ -1212,7 +1227,7 @@ bool cmComputeLinkInformation::CheckImplicitDirItem(std::string const& item) } // Check the policy for whether we should use the approach below. - switch (this->Target->GetPolicyStatusCMP0060()) + switch (this->Target->Target->GetPolicyStatusCMP0060()) { case cmPolicies::WARN: if (this->CMP0060Warn) @@ -1395,7 +1410,8 @@ void cmComputeLinkInformation::AddFrameworkItem(std::string const& item) // Add the item using the -framework option. this->Items.push_back(Item("-framework", false)); - fw = this->LocalGenerator->EscapeForShell(fw); + cmOutputConverter converter(this->Makefile->GetStateSnapshot()); + fw = converter.EscapeForShell(fw); this->Items.push_back(Item(fw, false)); } @@ -1521,7 +1537,7 @@ void cmComputeLinkInformation::HandleBadFullItem(std::string const& item, this->OrderLinkerSearchPath->AddLinkLibrary(item); // Produce any needed message. - switch(this->Target->GetPolicyStatusCMP0008()) + switch(this->Target->Target->GetPolicyStatusCMP0008()) { case cmPolicies::WARN: { @@ -1538,7 +1554,7 @@ void cmComputeLinkInformation::HandleBadFullItem(std::string const& item, << " " << item << "\n" << "which is a full-path but not a valid library file name."; this->CMakeInstance->IssueMessage(cmake::AUTHOR_WARNING, w.str(), - this->Target->GetBacktrace()); + this->Target->Target->GetBacktrace()); } } case cmPolicies::OLD: @@ -1556,7 +1572,7 @@ void cmComputeLinkInformation::HandleBadFullItem(std::string const& item, << " " << item << "\n" << "which is a full-path but not a valid library file name."; this->CMakeInstance->IssueMessage(cmake::FATAL_ERROR, e.str(), - this->Target->GetBacktrace()); + this->Target->Target->GetBacktrace()); } break; } @@ -1573,7 +1589,7 @@ bool cmComputeLinkInformation::FinishLinkerSearchDirectories() } // Enforce policy constraints. - switch(this->Target->GetPolicyStatusCMP0003()) + switch(this->Target->Target->GetPolicyStatusCMP0003()) { case cmPolicies::WARN: if(!this->CMakeInstance->GetState() @@ -1584,7 +1600,7 @@ bool cmComputeLinkInformation::FinishLinkerSearchDirectories() std::ostringstream w; this->PrintLinkPolicyDiagnosis(w); this->CMakeInstance->IssueMessage(cmake::AUTHOR_WARNING, w.str(), - this->Target->GetBacktrace()); + this->Target->Target->GetBacktrace()); } case cmPolicies::OLD: // OLD behavior is to add the paths containing libraries with @@ -1600,7 +1616,7 @@ bool cmComputeLinkInformation::FinishLinkerSearchDirectories() e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0003) << "\n"; this->PrintLinkPolicyDiagnosis(e); this->CMakeInstance->IssueMessage(cmake::FATAL_ERROR, e.str(), - this->Target->GetBacktrace()); + this->Target->Target->GetBacktrace()); return false; } } @@ -1794,7 +1810,8 @@ cmComputeLinkInformation::AddLibraryRuntimeInfo(std::string const& fullPath, // Try to get the soname of the library. Only files with this name // could possibly conflict. - std::string soName = target->GetSOName(this->Config); + cmGeneratorTarget *gtgt = this->GlobalGenerator->GetGeneratorTarget(target); + std::string soName = gtgt->GetSOName(this->Config); const char* soname = soName.empty()? 0 : soName.c_str(); // Include this library in the runtime path ordering. @@ -1901,9 +1918,9 @@ void cmComputeLinkInformation::GetRPath(std::vector& runtimeDirs, // build tree. bool linking_for_install = (for_install || - this->Target->GetPropertyAsBool("BUILD_WITH_INSTALL_RPATH")); + this->Target->Target->GetPropertyAsBool("BUILD_WITH_INSTALL_RPATH")); bool use_install_rpath = - (outputRuntime && this->Target->HaveInstallTreeRPATH() && + (outputRuntime && this->Target->Target->HaveInstallTreeRPATH() && linking_for_install); bool use_build_rpath = (outputRuntime && this->Target->HaveBuildTreeRPATH(this->Config) && @@ -1911,13 +1928,14 @@ void cmComputeLinkInformation::GetRPath(std::vector& runtimeDirs, bool use_link_rpath = outputRuntime && linking_for_install && !this->Makefile->IsOn("CMAKE_SKIP_INSTALL_RPATH") && - this->Target->GetPropertyAsBool("INSTALL_RPATH_USE_LINK_PATH"); + this->Target->Target->GetPropertyAsBool("INSTALL_RPATH_USE_LINK_PATH"); // Construct the RPATH. std::set emitted; if(use_install_rpath) { - const char* install_rpath = this->Target->GetProperty("INSTALL_RPATH"); + const char* install_rpath = + this->Target->Target->GetProperty("INSTALL_RPATH"); cmCLI_ExpandListUnique(install_rpath, runtimeDirs, emitted); } if(use_build_rpath || use_link_rpath) @@ -1989,7 +2007,7 @@ void cmComputeLinkInformation::GetRPath(std::vector& runtimeDirs, // Add runtime paths required by the languages to always be // present. This is done even when skipping rpath support. { - cmTarget::LinkClosure const* lc = + cmGeneratorTarget::LinkClosure const* lc = this->Target->GetLinkClosure(this->Config); for(std::vector::const_iterator li = lc->Languages.begin(); li != lc->Languages.end(); ++li) diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index 88471413c..8b8357459 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -18,9 +18,9 @@ class cmake; class cmGlobalGenerator; -class cmLocalGenerator; class cmMakefile; class cmTarget; +class cmGeneratorTarget; class cmOrderDirectories; /** \class cmComputeLinkInformation @@ -29,7 +29,8 @@ class cmOrderDirectories; class cmComputeLinkInformation { public: - cmComputeLinkInformation(cmTarget const* target, const std::string& config); + cmComputeLinkInformation(cmGeneratorTarget const* target, + const std::string& config); ~cmComputeLinkInformation(); bool Compute(); @@ -73,16 +74,14 @@ private: std::set SharedLibrariesLinked; // Context information. - cmTarget const* Target; + cmGeneratorTarget const* Target; cmMakefile* Makefile; - cmLocalGenerator* LocalGenerator; cmGlobalGenerator* GlobalGenerator; cmake* CMakeInstance; // Configuration information. std::string Config; std::string LinkLanguage; - bool LinkDependsNoShared; // Modes for dealing with dependent shared libraries. enum SharedDepMode @@ -93,8 +92,6 @@ private: SharedDepModeLink // List file on link line }; - // System info. - bool UseImportLibrary; const char* LoaderFlag; std::string LibLinkFlag; std::string LibLinkFileFlag; @@ -102,22 +99,18 @@ private: std::string RuntimeFlag; std::string RuntimeSep; std::string RuntimeAlways; - bool RuntimeUseChrpath; - bool NoSONameUsesPath; - bool LinkWithRuntimePath; std::string RPathLinkFlag; SharedDepMode SharedDependencyMode; + enum LinkType { LinkUnknown, LinkStatic, LinkShared }; + void SetCurrentLinkType(LinkType lt); + // Link type adjustment. void ComputeLinkTypeInfo(); - enum LinkType { LinkUnknown, LinkStatic, LinkShared }; LinkType StartLinkType; LinkType CurrentLinkType; std::string StaticLinkTypeFlag; std::string SharedLinkTypeFlag; - bool LinkTypeEnabled; - void SetCurrentLinkType(LinkType lt); - bool ArchivesMayBeShared; // Link item parsing. void ComputeItemParserInfo(); @@ -129,7 +122,6 @@ private: cmsys::RegularExpression ExtractSharedLibraryName; cmsys::RegularExpression ExtractAnyLibraryName; std::string SharedRegexString; - bool OpenBSD; void AddLinkPrefix(const char* p); void AddLinkExtension(const char* e, LinkType type); std::string CreateExtensionRegex(std::vector const& exts, @@ -173,20 +165,27 @@ private: std::set OldLinkDirMask; std::vector OldLinkDirItems; std::vector OldUserFlagItems; - bool OldLinkDirMode; - - // CMP0060 warnings. - bool CMP0060Warn; std::set CMP0060WarnItems; - + // Dependent library path computation. + cmOrderDirectories* OrderDependentRPath; // Runtime path computation. cmOrderDirectories* OrderRuntimeSearchPath; + + bool OldLinkDirMode; + bool OpenBSD; + bool LinkDependsNoShared; + bool UseImportLibrary; + bool RuntimeUseChrpath; + bool NoSONameUsesPath; + bool LinkWithRuntimePath; + bool LinkTypeEnabled; + bool ArchivesMayBeShared; + bool CMP0060Warn; + void AddLibraryRuntimeInfo(std::string const& fullPath, cmTarget const* target); void AddLibraryRuntimeInfo(std::string const& fullPath); - // Dependent library path computation. - cmOrderDirectories* OrderDependentRPath; }; #endif diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index 87b47b49f..9e37c3512 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -147,12 +147,12 @@ bool cmComputeTargetDepends::Compute() //---------------------------------------------------------------------------- void -cmComputeTargetDepends::GetTargetDirectDepends(cmTarget const* t, +cmComputeTargetDepends::GetTargetDirectDepends(cmGeneratorTarget const* t, cmTargetDependSet& deps) { // Lookup the index for this target. All targets should be known by // this point. - std::map::const_iterator tii + std::map::const_iterator tii = this->TargetIndex.find(t); assert(tii != this->TargetIndex.end()); int i = tii->second; @@ -161,7 +161,7 @@ cmComputeTargetDepends::GetTargetDirectDepends(cmTarget const* t, EdgeList const& nl = this->FinalGraph[i]; for(EdgeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni) { - cmTarget const* dep = this->Targets[*ni]; + cmGeneratorTarget const* dep = this->Targets[*ni]; cmTargetDependSet::iterator di = deps.insert(dep).first; di->SetType(ni->IsStrong()); } @@ -180,9 +180,11 @@ void cmComputeTargetDepends::CollectTargets() ti != targets.end(); ++ti) { cmTarget const* target = &ti->second; + cmGeneratorTarget* gt = + this->GlobalGenerator->GetGeneratorTarget(target); int index = static_cast(this->Targets.size()); - this->TargetIndex[target] = index; - this->Targets.push_back(target); + this->TargetIndex[gt] = index; + this->Targets.push_back(gt); } } } @@ -204,7 +206,7 @@ void cmComputeTargetDepends::CollectDepends() void cmComputeTargetDepends::CollectTargetDepends(int depender_index) { // Get the depender. - cmTarget const* depender = this->Targets[depender_index]; + cmGeneratorTarget const* depender = this->Targets[depender_index]; if (depender->GetType() == cmTarget::INTERFACE_LIBRARY) { return; @@ -216,10 +218,9 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) // deal with config-specific dependencies. { std::set emitted; - cmGeneratorTarget* gt = this->GlobalGenerator->GetGeneratorTarget(depender); std::vector configs; - depender->GetMakefile()->GetConfigurations(configs); + depender->Makefile->GetConfigurations(configs); if (configs.empty()) { configs.push_back(""); @@ -228,7 +229,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) it != configs.end(); ++it) { std::vector objectFiles; - gt->GetExternalObjects(objectFiles, *it); + depender->GetExternalObjects(objectFiles, *it); for(std::vector::const_iterator oi = objectFiles.begin(); oi != objectFiles.end(); ++oi) { @@ -244,15 +245,14 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) ->IssueMessage(cmake::FATAL_ERROR, "Only executables and non-OBJECT libraries may " "reference target objects.", - depender->GetBacktrace()); + depender->Target->GetBacktrace()); return; } - const_cast(depender)->AddUtility(objLib); + const_cast(depender)->Target->AddUtility(objLib); } } - cmTarget::LinkImplementation const* impl = - depender->GetLinkImplementation(*it); + cmLinkImplementation const* impl = depender->GetLinkImplementation(*it); // A target should not depend on itself. emitted.insert(depender->GetName()); @@ -272,7 +272,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) // Loop over all utility dependencies. { - std::set const& tutils = depender->GetUtilityItems(); + std::set const& tutils = depender->Target->GetUtilityItems(); std::set emitted; // A target should not depend on itself. emitted.insert(depender->GetName()); @@ -290,13 +290,14 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) //---------------------------------------------------------------------------- void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, - cmTarget const* dependee, - const std::string& config, - std::set &emitted) + const cmGeneratorTarget* dependee, + const std::string& config, + std::set &emitted) { - cmTarget const* depender = this->Targets[depender_index]; - if(cmTarget::LinkInterface const* iface = - dependee->GetLinkInterface(config, depender)) + cmGeneratorTarget const* depender = this->Targets[depender_index]; + if(cmLinkInterface const* iface = + dependee->GetLinkInterface(config, + depender->Target)) { for(std::vector::const_iterator lib = iface->Libraries.begin(); @@ -317,7 +318,7 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, cmLinkItem const& dependee_name, std::set &emitted) { - cmTarget const* depender = this->Targets[depender_index]; + cmGeneratorTarget const* depender = this->Targets[depender_index]; cmTarget const* dependee = dependee_name.Target; // Skip targets that will not really be linked. This is probably a // name conflict between an external library and an executable @@ -331,16 +332,17 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, if(dependee) { - this->AddInterfaceDepends(depender_index, dependee, "", emitted); + cmGeneratorTarget* gt = + this->GlobalGenerator->GetGeneratorTarget(dependee); + this->AddInterfaceDepends(depender_index, gt, "", emitted); std::vector configs; - depender->GetMakefile()->GetConfigurations(configs); + depender->Makefile->GetConfigurations(configs); for (std::vector::const_iterator it = configs.begin(); it != configs.end(); ++it) { // A target should not depend on itself. emitted.insert(depender->GetName()); - this->AddInterfaceDepends(depender_index, dependee, - *it, emitted); + this->AddInterfaceDepends(depender_index, gt, *it, emitted); } } } @@ -351,7 +353,7 @@ void cmComputeTargetDepends::AddTargetDepend( bool linking) { // Get the depender. - cmTarget const* depender = this->Targets[depender_index]; + cmGeneratorTarget const* depender = this->Targets[depender_index]; // Check the target's makefile first. cmTarget const* dependee = dependee_name.Target; @@ -362,7 +364,7 @@ void cmComputeTargetDepends::AddTargetDepend( cmake::MessageType messageType = cmake::AUTHOR_WARNING; bool issueMessage = false; std::ostringstream e; - switch(depender->GetPolicyStatusCMP0046()) + switch(depender->Target->GetPolicyStatusCMP0046()) { case cmPolicies::WARN: e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0046) << "\n"; @@ -383,7 +385,7 @@ void cmComputeTargetDepends::AddTargetDepend( << "\" of target \"" << depender->GetName() << "\" does not exist."; cmListFileBacktrace const* backtrace = - depender->GetUtilityBacktrace(dependee_name); + depender->Target->GetUtilityBacktrace(dependee_name); if(backtrace) { cm->IssueMessage(messageType, e.str(), *backtrace); @@ -408,27 +410,31 @@ void cmComputeTargetDepends::AddTargetDepend( if(dependee) { - this->AddTargetDepend(depender_index, dependee, linking); + cmGeneratorTarget* gt = + this->GlobalGenerator->GetGeneratorTarget(dependee); + this->AddTargetDepend(depender_index, gt, linking); } } //---------------------------------------------------------------------------- void cmComputeTargetDepends::AddTargetDepend(int depender_index, - cmTarget const* dependee, + const cmGeneratorTarget* dependee, bool linking) { - if(dependee->IsImported() || + if(dependee->Target->IsImported() || dependee->GetType() == cmTarget::INTERFACE_LIBRARY) { // Skip IMPORTED and INTERFACE targets but follow their utility // dependencies. - std::set const& utils = dependee->GetUtilityItems(); + std::set const& utils = dependee->Target->GetUtilityItems(); for(std::set::const_iterator i = utils.begin(); i != utils.end(); ++i) { if(cmTarget const* transitive_dependee = i->Target) { - this->AddTargetDepend(depender_index, transitive_dependee, false); + cmGeneratorTarget* gt = + this->GlobalGenerator->GetGeneratorTarget(transitive_dependee); + this->AddTargetDepend(depender_index, gt, false); } } } @@ -436,7 +442,7 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index, { // Lookup the index for this target. All targets should be known by // this point. - std::map::const_iterator tii = + std::map::const_iterator tii = this->TargetIndex.find(dependee); assert(tii != this->TargetIndex.end()); int dependee_index = tii->second; @@ -457,13 +463,13 @@ cmComputeTargetDepends::DisplayGraph(Graph const& graph, for(int depender_index = 0; depender_index < n; ++depender_index) { EdgeList const& nl = graph[depender_index]; - cmTarget const* depender = this->Targets[depender_index]; + cmGeneratorTarget const* depender = this->Targets[depender_index]; fprintf(stderr, "target %d is [%s]\n", depender_index, depender->GetName().c_str()); for(EdgeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni) { int dependee_index = *ni; - cmTarget const* dependee = this->Targets[dependee_index]; + cmGeneratorTarget const* dependee = this->Targets[dependee_index]; fprintf(stderr, " depends on target %d [%s] (%s)\n", dependee_index, dependee->GetName().c_str(), ni->IsStrong()? "strong" : "weak"); } @@ -550,11 +556,11 @@ cmComputeTargetDepends { // Get the depender. int i = *ci; - cmTarget const* depender = this->Targets[i]; + cmGeneratorTarget const* depender = this->Targets[i]; // Describe the depender. e << " \"" << depender->GetName() << "\" of type " - << cmTarget::GetTargetTypeName(depender->GetType()) << "\n"; + << cmTarget::GetTargetTypeName(depender->Target->GetType()) << "\n"; // List its dependencies that are inside the component. EdgeList const& nl = this->InitialGraph[i]; @@ -563,7 +569,7 @@ cmComputeTargetDepends int j = *ni; if(cmap[j] == c) { - cmTarget const* dependee = this->Targets[j]; + cmGeneratorTarget const* dependee = this->Targets[j]; e << " depends on \"" << dependee->GetName() << "\"" << " (" << (ni->IsStrong()? "strong" : "weak") << ")\n"; } diff --git a/Source/cmComputeTargetDepends.h b/Source/cmComputeTargetDepends.h index 902f342bf..6100d970a 100644 --- a/Source/cmComputeTargetDepends.h +++ b/Source/cmComputeTargetDepends.h @@ -21,7 +21,7 @@ class cmComputeComponentGraph; class cmGlobalGenerator; class cmLinkItem; -class cmTarget; +class cmGeneratorTarget; class cmTargetDependSet; /** \class cmComputeTargetDepends @@ -39,9 +39,10 @@ public: bool Compute(); - std::vector const& + std::vector const& GetTargets() const { return this->Targets; } - void GetTargetDirectDepends(cmTarget const* t, cmTargetDependSet& deps); + void GetTargetDirectDepends(cmGeneratorTarget const* t, + cmTargetDependSet& deps); private: void CollectTargets(); void CollectDepends(); @@ -49,13 +50,14 @@ private: void AddTargetDepend(int depender_index, cmLinkItem const& dependee_name, bool linking); - void AddTargetDepend(int depender_index, cmTarget const* dependee, + void AddTargetDepend(int depender_index, cmGeneratorTarget const* dependee, bool linking); bool ComputeFinalDepends(cmComputeComponentGraph const& ccg); void AddInterfaceDepends(int depender_index, cmLinkItem const& dependee_name, std::set &emitted); - void AddInterfaceDepends(int depender_index, cmTarget const* dependee, + void AddInterfaceDepends(int depender_index, + cmGeneratorTarget const* dependee, const std::string& config, std::set &emitted); cmGlobalGenerator* GlobalGenerator; @@ -63,8 +65,8 @@ private: bool NoCycles; // Collect all targets. - std::vector Targets; - std::map TargetIndex; + std::vector Targets; + std::map TargetIndex; // Represent the target dependency graph. The entry at each // top-level index corresponds to a depender whose dependencies are diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx index 61847d42b..5330acdaf 100644 --- a/Source/cmConditionEvaluator.cxx +++ b/Source/cmConditionEvaluator.cxx @@ -11,12 +11,18 @@ ============================================================================*/ #include "cmConditionEvaluator.h" +#include "cmOutputConverter.h" -cmConditionEvaluator::cmConditionEvaluator(cmMakefile& makefile): +cmConditionEvaluator::cmConditionEvaluator(cmMakefile& makefile, + const cmListFileContext &context, + const cmListFileBacktrace& bt): Makefile(makefile), + ExecutionContext(context), + Backtrace(bt), Policy12Status(makefile.GetPolicyStatus(cmPolicies::CMP0012)), Policy54Status(makefile.GetPolicyStatus(cmPolicies::CMP0054)), - Policy57Status(makefile.GetPolicyStatus(cmPolicies::CMP0057)) + Policy57Status(makefile.GetPolicyStatus(cmPolicies::CMP0057)), + Policy64Status(makefile.GetPolicyStatus(cmPolicies::CMP0064)) { } @@ -97,6 +103,25 @@ bool cmConditionEvaluator::IsTrue( errorString, status, true); } +cmListFileContext cmConditionEvaluator::GetConditionContext( + cmMakefile* mf, + const cmCommandContext& command, + const std::string& filePath) +{ + cmListFileContext context = + cmListFileContext::FromCommandContext( + command, + filePath); + + if(!mf->GetCMakeInstance()->GetIsInTryCompile()) + { + cmOutputConverter converter(mf->GetStateSnapshot()); + context.FilePath = converter.Convert(context.FilePath, + cmOutputConverter::HOME); + } + return context; +} + //========================================================================= const char* cmConditionEvaluator::GetDefinitionIfUnquoted( cmExpandedCommandArgument const& argument) const @@ -112,7 +137,8 @@ const char* cmConditionEvaluator::GetDefinitionIfUnquoted( if(def && argument.WasQuoted() && this->Policy54Status == cmPolicies::WARN) { - if(!this->Makefile.HasCMP0054AlreadyBeenReported()) + if(!this->Makefile.HasCMP0054AlreadyBeenReported( + this->ExecutionContext)) { std::ostringstream e; e << (cmPolicies::GetPolicyWarning(cmPolicies::CMP0054)) << "\n"; @@ -121,7 +147,9 @@ const char* cmConditionEvaluator::GetDefinitionIfUnquoted( "when the policy is set to NEW. " "Since the policy is not set the OLD behavior will be used."; - this->Makefile.IssueMessage(cmake::AUTHOR_WARNING, e.str()); + this->Makefile.GetCMakeInstance() + ->IssueMessage(cmake::AUTHOR_WARNING, e.str(), + this->Backtrace); } } @@ -158,7 +186,8 @@ bool cmConditionEvaluator::IsKeyword(std::string const& keyword, if(isKeyword && argument.WasQuoted() && this->Policy54Status == cmPolicies::WARN) { - if(!this->Makefile.HasCMP0054AlreadyBeenReported()) + if(!this->Makefile.HasCMP0054AlreadyBeenReported( + this->ExecutionContext)) { std::ostringstream e; e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0054) << "\n"; @@ -167,7 +196,9 @@ bool cmConditionEvaluator::IsKeyword(std::string const& keyword, "when the policy is set to NEW. " "Since the policy is not set the OLD behavior will be used."; - this->Makefile.IssueMessage(cmake::AUTHOR_WARNING, e.str()); + this->Makefile.GetCMakeInstance() + ->IssueMessage(cmake::AUTHOR_WARNING, e.str(), + this->Backtrace); } } @@ -299,11 +330,11 @@ void cmConditionEvaluator::IncrementArguments(cmArgumentList &newArgs, cmArgumentList::iterator &argP1, cmArgumentList::iterator &argP2) const { - if (argP1 != newArgs.end()) + if (argP1 != newArgs.end()) { argP1++; argP2 = argP1; - if (argP1 != newArgs.end()) + if (argP1 != newArgs.end()) { argP2++; } @@ -442,35 +473,35 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList &newArgs, argP1 = arg; this->IncrementArguments(newArgs,argP1,argP2); // does a file exist - if (this->IsKeyword("EXISTS", *arg) && argP1 != newArgs.end()) + if (this->IsKeyword("EXISTS", *arg) && argP1 != newArgs.end()) { this->HandlePredicate( cmSystemTools::FileExists(argP1->c_str()), reducible, arg, newArgs, argP1, argP2); } // does a directory with this name exist - if (this->IsKeyword("IS_DIRECTORY", *arg) && argP1 != newArgs.end()) + if (this->IsKeyword("IS_DIRECTORY", *arg) && argP1 != newArgs.end()) { this->HandlePredicate( cmSystemTools::FileIsDirectory(argP1->c_str()), reducible, arg, newArgs, argP1, argP2); } // does a symlink with this name exist - if (this->IsKeyword("IS_SYMLINK", *arg) && argP1 != newArgs.end()) + if (this->IsKeyword("IS_SYMLINK", *arg) && argP1 != newArgs.end()) { this->HandlePredicate( cmSystemTools::FileIsSymlink(argP1->c_str()), reducible, arg, newArgs, argP1, argP2); } // is the given path an absolute path ? - if (this->IsKeyword("IS_ABSOLUTE", *arg) && argP1 != newArgs.end()) + if (this->IsKeyword("IS_ABSOLUTE", *arg) && argP1 != newArgs.end()) { this->HandlePredicate( cmSystemTools::FileIsFullPath(argP1->c_str()), reducible, arg, newArgs, argP1, argP2); } // does a command exist - if (this->IsKeyword("COMMAND", *arg) && argP1 != newArgs.end()) + if (this->IsKeyword("COMMAND", *arg) && argP1 != newArgs.end()) { cmCommand* command = this->Makefile.GetState()->GetCommand(argP1->c_str()); @@ -493,8 +524,31 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList &newArgs, this->Makefile.FindTargetToUse(argP1->GetValue())?true:false, reducible, arg, newArgs, argP1, argP2); } + // does a test exist + if(this->Policy64Status != cmPolicies::OLD && + this->Policy64Status != cmPolicies::WARN) + { + if (this->IsKeyword("TEST", *arg) && argP1 != newArgs.end()) + { + const cmTest* haveTest = this->Makefile.GetTest(argP1->c_str()); + this->HandlePredicate( + haveTest?true:false, + reducible, arg, newArgs, argP1, argP2); + } + } + else if(this->Policy64Status == cmPolicies::WARN && + this->IsKeyword("TEST", *arg)) + { + std::ostringstream e; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0064) << "\n"; + e << "TEST will be interpreted as an operator " + "when the policy is set to NEW. " + "Since the policy is not set the OLD behavior will be used."; + + this->Makefile.IssueMessage(cmake::AUTHOR_WARNING, e.str()); + } // is a variable defined - if (this->IsKeyword("DEFINED", *arg) && argP1 != newArgs.end()) + if (this->IsKeyword("DEFINED", *arg) && argP1 != newArgs.end()) { size_t argP1len = argP1->GetValue().size(); bool bdef = false; diff --git a/Source/cmConditionEvaluator.h b/Source/cmConditionEvaluator.h index c923d76b9..8600825d0 100644 --- a/Source/cmConditionEvaluator.h +++ b/Source/cmConditionEvaluator.h @@ -22,7 +22,9 @@ class cmConditionEvaluator public: typedef std::list cmArgumentList; - cmConditionEvaluator(cmMakefile& makefile); + cmConditionEvaluator(cmMakefile& makefile, + cmListFileContext const& context, + cmListFileBacktrace const& bt); // this is a shared function for both If and Else to determine if the // arguments were valid, and if so, was the response true. If there is @@ -31,6 +33,9 @@ public: std::string &errorString, cmake::MessageType &status); + static cmListFileContext GetConditionContext(cmMakefile* mf, + const cmCommandContext& command, std::string const& filePath); + private: // Filter the given variable definition based on policy CMP0054. const char* GetDefinitionIfUnquoted( @@ -91,9 +96,12 @@ private: cmake::MessageType &status); cmMakefile& Makefile; + cmListFileContext ExecutionContext; + cmListFileBacktrace Backtrace; cmPolicies::PolicyStatus Policy12Status; cmPolicies::PolicyStatus Policy54Status; cmPolicies::PolicyStatus Policy57Status; + cmPolicies::PolicyStatus Policy64Status; }; #endif diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index dd276a8a1..3d9c4bf0a 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -11,7 +11,7 @@ ============================================================================*/ #include "cmCoreTryCompile.h" #include "cmake.h" -#include "cmLocalGenerator.h" +#include "cmOutputConverter.h" #include "cmGlobalGenerator.h" #include "cmAlgorithms.h" #include "cmExportTryCompileFileGenerator.h" @@ -29,7 +29,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) const char* sourceDirectory = argv[2].c_str(); const char* projectName = 0; std::string targetName; - std::vector cmakeFlags; + std::vector cmakeFlags(1, "CMAKE_FLAGS"); // fake argv[0] std::vector compileDefs; std::string outputVariable; std::string copyFile; @@ -53,10 +53,6 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) if(argv[i] == "CMAKE_FLAGS") { doing = DoingCMakeFlags; - // CMAKE_FLAGS is the first argument because we need an argv[0] that - // is not used, so it matches regular command line parsing which has - // the program name as arg 0 - cmakeFlags.push_back(argv[i]); } else if(argv[i] == "COMPILE_DEFINITIONS") { @@ -322,7 +318,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) std::string langFlags = "CMAKE_" + *li + "_FLAGS"; const char* flags = this->Makefile->GetDefinition(langFlags); fprintf(fout, "set(CMAKE_%s_FLAGS %s)\n", li->c_str(), - cmLocalGenerator::EscapeForCMake(flags?flags:"").c_str()); + cmOutputConverter::EscapeForCMake(flags?flags:"").c_str()); fprintf(fout, "set(CMAKE_%s_FLAGS \"${CMAKE_%s_FLAGS}" " ${COMPILE_DEFINITIONS}\")\n", li->c_str(), li->c_str()); } @@ -355,7 +351,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) const char* exeLinkFlags = this->Makefile->GetDefinition("CMAKE_EXE_LINKER_FLAGS"); fprintf(fout, "set(CMAKE_EXE_LINKER_FLAGS %s)\n", - cmLocalGenerator::EscapeForCMake( + cmOutputConverter::EscapeForCMake( exeLinkFlags ? exeLinkFlags : "").c_str()); } break; } @@ -379,7 +375,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) if (!targets.empty()) { std::string fname = "/" + std::string(targetName) + "Targets.cmake"; - cmExportTryCompileFileGenerator tcfg; + cmExportTryCompileFileGenerator tcfg(gg); tcfg.SetExportFile((this->BinaryDirectory + fname).c_str()); tcfg.SetExports(targets); tcfg.SetConfig(this->Makefile->GetSafeDefinition( @@ -470,6 +466,26 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) { fprintf(fout, "set(CMAKE_POSITION_INDEPENDENT_CODE \"ON\")\n"); } + if (const char *lssDef = this->Makefile->GetDefinition( + "CMAKE_LINK_SEARCH_START_STATIC")) + { + fprintf(fout, "set(CMAKE_LINK_SEARCH_START_STATIC \"%s\")\n", lssDef); + } + if (const char *lssDef = this->Makefile->GetDefinition( + "CMAKE_LINK_SEARCH_END_STATIC")) + { + fprintf(fout, "set(CMAKE_LINK_SEARCH_END_STATIC \"%s\")\n", lssDef); + } + + /* Set the appropriate policy information for ENABLE_EXPORTS */ + fprintf(fout, "cmake_policy(SET CMP0065 %s)\n", + this->Makefile->GetPolicyStatus(cmPolicies::CMP0065) == + cmPolicies::NEW ? "NEW" : "OLD"); + if(const char *ee = this->Makefile->GetDefinition( + "CMAKE_ENABLE_EXPORTS")) + { + fprintf(fout, "set(CMAKE_ENABLE_EXPORTS %s)\n", ee); + } /* Put the executable at a known location (for COPY_FILE). */ fprintf(fout, "set(CMAKE_RUNTIME_OUTPUT_DIRECTORY \"%s\")\n", diff --git a/Source/cmCryptoHash.cxx b/Source/cmCryptoHash.cxx index 74e17b622..66162181e 100644 --- a/Source/cmCryptoHash.cxx +++ b/Source/cmCryptoHash.cxx @@ -46,7 +46,7 @@ std::string cmCryptoHash::HashString(const std::string& input) //---------------------------------------------------------------------------- std::string cmCryptoHash::HashFile(const std::string& file) { - cmsys::ifstream fin(file.c_str(), std::ios::in | cmsys_ios_binary); + cmsys::ifstream fin(file.c_str(), std::ios::in | std::ios::binary); if(!fin) { return ""; diff --git a/Source/cmCurl.cxx b/Source/cmCurl.cxx index 96d3547e3..ad0c7d3e2 100644 --- a/Source/cmCurl.cxx +++ b/Source/cmCurl.cxx @@ -13,7 +13,7 @@ #include "cmSystemTools.h" #define check_curl_result(result, errstr) \ - if (result != CURLE_OK) \ + if (result != CURLE_OK && result != CURLE_NOT_BUILT_IN) \ { \ e += e.empty()? "" : "\n"; \ e += errstr; \ diff --git a/Source/cmCustomCommand.cxx b/Source/cmCustomCommand.cxx index 015825dc8..7c37e3b96 100644 --- a/Source/cmCustomCommand.cxx +++ b/Source/cmCustomCommand.cxx @@ -17,7 +17,7 @@ //---------------------------------------------------------------------------- cmCustomCommand::cmCustomCommand() - : Backtrace(NULL) + : Backtrace() { this->HaveComment = false; this->EscapeOldStyle = true; @@ -25,46 +25,6 @@ cmCustomCommand::cmCustomCommand() this->UsesTerminal = false; } -//---------------------------------------------------------------------------- -cmCustomCommand::cmCustomCommand(const cmCustomCommand& r): - Outputs(r.Outputs), - Byproducts(r.Byproducts), - Depends(r.Depends), - CommandLines(r.CommandLines), - HaveComment(r.HaveComment), - Comment(r.Comment), - WorkingDirectory(r.WorkingDirectory), - EscapeAllowMakeVars(r.EscapeAllowMakeVars), - EscapeOldStyle(r.EscapeOldStyle), - Backtrace(r.Backtrace), - UsesTerminal(r.UsesTerminal) -{ -} - -//---------------------------------------------------------------------------- -cmCustomCommand& cmCustomCommand::operator=(cmCustomCommand const& r) -{ - if(this == &r) - { - return *this; - } - - this->Outputs = r.Outputs; - this->Byproducts= r.Byproducts; - this->Depends = r.Depends; - this->CommandLines = r.CommandLines; - this->HaveComment = r.HaveComment; - this->Comment = r.Comment; - this->WorkingDirectory = r.WorkingDirectory; - this->EscapeAllowMakeVars = r.EscapeAllowMakeVars; - this->EscapeOldStyle = r.EscapeOldStyle; - this->ImplicitDepends = r.ImplicitDepends; - this->Backtrace = r.Backtrace; - this->UsesTerminal = r.UsesTerminal; - - return *this; -} - //---------------------------------------------------------------------------- cmCustomCommand::cmCustomCommand(cmMakefile const* mf, const std::vector& outputs, @@ -77,26 +37,19 @@ cmCustomCommand::cmCustomCommand(cmMakefile const* mf, Byproducts(byproducts), Depends(depends), CommandLines(commandLines), - HaveComment(comment?true:false), + Backtrace(), Comment(comment?comment:""), WorkingDirectory(workingDirectory?workingDirectory:""), + HaveComment(comment?true:false), EscapeAllowMakeVars(false), - EscapeOldStyle(true), - Backtrace(NULL) + EscapeOldStyle(true) { - this->EscapeOldStyle = true; - this->EscapeAllowMakeVars = false; if(mf) { this->Backtrace = mf->GetBacktrace(); } } -//---------------------------------------------------------------------------- -cmCustomCommand::~cmCustomCommand() -{ -} - //---------------------------------------------------------------------------- const std::vector& cmCustomCommand::GetOutputs() const { diff --git a/Source/cmCustomCommand.h b/Source/cmCustomCommand.h index 0bfaef23b..f9b38c3c4 100644 --- a/Source/cmCustomCommand.h +++ b/Source/cmCustomCommand.h @@ -26,8 +26,6 @@ class cmCustomCommand public: /** Default and copy constructors for STL containers. */ cmCustomCommand(); - cmCustomCommand(const cmCustomCommand& r); - cmCustomCommand& operator=(cmCustomCommand const& r); /** Main constructor specifies all information for the command. */ cmCustomCommand(cmMakefile const* mf, @@ -38,8 +36,6 @@ public: const char* comment, const char* workingDirectory); - ~cmCustomCommand(); - /** Get the output file produced by the command. */ const std::vector& GetOutputs() const; @@ -93,13 +89,13 @@ private: std::vector Byproducts; std::vector Depends; cmCustomCommandLines CommandLines; - bool HaveComment; + cmListFileBacktrace Backtrace; + ImplicitDependsList ImplicitDepends; std::string Comment; std::string WorkingDirectory; + bool HaveComment; bool EscapeAllowMakeVars; bool EscapeOldStyle; - cmListFileBacktrace Backtrace; - ImplicitDependsList ImplicitDepends; bool UsesTerminal; }; diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index d23f81520..7f3b65109 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -12,16 +12,17 @@ #include "cmCustomCommandGenerator.h" #include "cmMakefile.h" -#include "cmCustomCommand.h" #include "cmLocalGenerator.h" +#include "cmCustomCommand.h" +#include "cmOutputConverter.h" #include "cmGeneratorExpression.h" //---------------------------------------------------------------------------- cmCustomCommandGenerator::cmCustomCommandGenerator( - cmCustomCommand const& cc, const std::string& config, cmMakefile* mf): - CC(cc), Config(config), Makefile(mf), LG(mf->GetLocalGenerator()), + cmCustomCommand const& cc, const std::string& config, cmLocalGenerator* lg): + CC(cc), Config(config), LG(lg), OldStyle(cc.GetEscapeOldStyle()), MakeVars(cc.GetEscapeAllowMakeVars()), - GE(new cmGeneratorExpression(&cc.GetBacktrace())), DependsDone(false) + GE(new cmGeneratorExpression(cc.GetBacktrace())), DependsDone(false) { } @@ -41,13 +42,16 @@ unsigned int cmCustomCommandGenerator::GetNumberOfCommands() const std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const { std::string const& argv0 = this->CC.GetCommandLines()[c][0]; - cmTarget* target = this->Makefile->FindTargetToUse(argv0); + cmGeneratorTarget* target = + this->LG->GetMakefile()->FindGeneratorTargetToUse(argv0); if(target && target->GetType() == cmTarget::EXECUTABLE && - (target->IsImported() || !this->Makefile->IsOn("CMAKE_CROSSCOMPILING"))) + (target->Target->IsImported() + || !this->LG->GetMakefile()->IsOn("CMAKE_CROSSCOMPILING"))) { return target->GetLocation(this->Config); } - return this->GE->Parse(argv0)->Evaluate(this->Makefile, this->Config); + return this->GE->Parse(argv0)->Evaluate(this->LG->GetMakefile(), + this->Config); } //---------------------------------------------------------------------------- @@ -87,8 +91,9 @@ cmCustomCommandGenerator cmCustomCommandLine const& commandLine = this->CC.GetCommandLines()[c]; for(unsigned int j=1;j < commandLine.size(); ++j) { - std::string arg = this->GE->Parse(commandLine[j])->Evaluate(this->Makefile, - this->Config); + std::string arg = + this->GE->Parse(commandLine[j])->Evaluate(this->LG->GetMakefile(), + this->Config); cmd += " "; if(this->OldStyle) { @@ -96,7 +101,8 @@ cmCustomCommandGenerator } else { - cmd += this->LG->EscapeForShell(arg, this->MakeVars); + cmOutputConverter converter(this->LG->GetMakefile()->GetStateSnapshot()); + cmd += converter.EscapeForShell(arg, this->MakeVars); } } } @@ -140,7 +146,7 @@ std::vector const& cmCustomCommandGenerator::GetDepends() const = this->GE->Parse(*i); std::vector result; cmSystemTools::ExpandListArgument( - cge->Evaluate(this->Makefile, this->Config), result); + cge->Evaluate(this->LG->GetMakefile(), this->Config), result); for (std::vector::iterator it = result.begin(); it != result.end(); ++it) { diff --git a/Source/cmCustomCommandGenerator.h b/Source/cmCustomCommandGenerator.h index b4ae0142b..a637fed7c 100644 --- a/Source/cmCustomCommandGenerator.h +++ b/Source/cmCustomCommandGenerator.h @@ -15,7 +15,6 @@ #include "cmStandardIncludes.h" class cmCustomCommand; -class cmMakefile; class cmLocalGenerator; class cmGeneratorExpression; @@ -23,7 +22,6 @@ class cmCustomCommandGenerator { cmCustomCommand const& CC; std::string Config; - cmMakefile* Makefile; cmLocalGenerator* LG; bool OldStyle; bool MakeVars; @@ -33,7 +31,7 @@ class cmCustomCommandGenerator public: cmCustomCommandGenerator(cmCustomCommand const& cc, const std::string& config, - cmMakefile* mf); + cmLocalGenerator* lg); ~cmCustomCommandGenerator(); cmCustomCommand const& GetCC() const { return this->CC; } unsigned int GetNumberOfCommands() const; diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx index 2dab169ef..b06fb5c0b 100644 --- a/Source/cmDefinitions.cxx +++ b/Source/cmDefinitions.cxx @@ -56,9 +56,9 @@ void cmDefinitions::Raise(const std::string& key, } bool cmDefinitions::HasKey(const std::string& key, - StackConstIter begin, StackConstIter end) + StackIter begin, StackIter end) { - for (StackConstIter it = begin; it != end; ++it) + for (StackIter it = begin; it != end; ++it) { MapType::const_iterator i = it->Map.find(key); if (i != it->Map.end()) @@ -94,12 +94,12 @@ std::vector cmDefinitions::UnusedKeys() const } //---------------------------------------------------------------------------- -cmDefinitions cmDefinitions::MakeClosure(StackConstIter begin, - StackConstIter end) +cmDefinitions cmDefinitions::MakeClosure(StackIter begin, + StackIter end) { cmDefinitions closure; std::set undefined; - for (StackConstIter it = begin; it != end; ++it) + for (StackIter it = begin; it != end; ++it) { // Consider local definitions. for(MapType::const_iterator mi = it->Map.begin(); @@ -125,12 +125,12 @@ cmDefinitions cmDefinitions::MakeClosure(StackConstIter begin, //---------------------------------------------------------------------------- std::vector -cmDefinitions::ClosureKeys(StackConstIter begin, StackConstIter end) +cmDefinitions::ClosureKeys(StackIter begin, StackIter end) { std::set bound; std::vector defined; - for (StackConstIter it = begin; it != end; ++it) + for (StackIter it = begin; it != end; ++it) { defined.reserve(defined.size() + it->Map.size()); for(MapType::const_iterator mi = it->Map.begin(); diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h index 5fdcaab72..411867c52 100644 --- a/Source/cmDefinitions.h +++ b/Source/cmDefinitions.h @@ -13,6 +13,9 @@ #define cmDefinitions_h #include "cmStandardIncludes.h" + +#include "cmLinkedTree.h" + #if defined(CMAKE_BUILD_WITH_CMAKE) #ifdef CMake_HAVE_CXX11_UNORDERED_MAP #include @@ -32,26 +35,26 @@ */ class cmDefinitions { - typedef std::list::reverse_iterator StackIter; - typedef std::list::const_reverse_iterator StackConstIter; + typedef cmLinkedTree::iterator StackIter; public: static const char* Get(const std::string& key, StackIter begin, StackIter end); - static void Raise(const std::string& key, StackIter begin, StackIter end); + static void Raise(const std::string& key, + StackIter begin, StackIter end); static bool HasKey(const std::string& key, - StackConstIter begin, StackConstIter end); + StackIter begin, StackIter end); /** Set (or unset if null) a value associated with a key. */ void Set(const std::string& key, const char* value); std::vector UnusedKeys() const; - static std::vector ClosureKeys(StackConstIter begin, - StackConstIter end); + static std::vector ClosureKeys(StackIter begin, + StackIter end); - static cmDefinitions MakeClosure(StackConstIter begin, StackConstIter end); + static cmDefinitions MakeClosure(StackIter begin, StackIter end); private: // String with existence boolean. diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index 1b2586c23..856dcd429 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -16,83 +16,14 @@ #include "cmMakefile.h" #include "cmGeneratedFileStream.h" -#include "cmDependsFortranParser.h" /* Interface to parser object. */ +#include "cmFortranParser.h" /* Interface to parser object. */ #include #include -#include // TODO: Test compiler for the case of the mod file. Some always // use lower case and some always use upper case. I do not know if any // use the case from the source code. -//---------------------------------------------------------------------------- -// Information about a single source file. -class cmDependsFortranSourceInfo -{ -public: - // The name of the source file. - std::string Source; - - // Set of provided and required modules. - std::set Provides; - std::set Requires; - - // Set of files included in the translation unit. - std::set Includes; -}; - -//---------------------------------------------------------------------------- -// Parser methods not included in generated interface. - -// Get the current buffer processed by the lexer. -YY_BUFFER_STATE cmDependsFortranLexer_GetCurrentBuffer(yyscan_t yyscanner); - -// The parser entry point. -int cmDependsFortran_yyparse(yyscan_t); - -//---------------------------------------------------------------------------- -// Define parser object internal structure. -struct cmDependsFortranFile -{ - cmDependsFortranFile(FILE* file, YY_BUFFER_STATE buffer, - const std::string& dir): - File(file), Buffer(buffer), Directory(dir) {} - FILE* File; - YY_BUFFER_STATE Buffer; - std::string Directory; -}; - -struct cmDependsFortranParser_s -{ - cmDependsFortranParser_s(cmDependsFortran* self, - std::set& ppDefines, - cmDependsFortranSourceInfo& info); - ~cmDependsFortranParser_s(); - - // Pointer back to the main class. - cmDependsFortran* Self; - - // Lexical scanner instance. - yyscan_t Scanner; - - // Stack of open files in the translation unit. - std::stack FileStack; - - // Buffer for string literals. - std::string TokenString; - - // Flag for whether lexer is reading from inside an interface. - bool InInterface; - - int OldStartcond; - std::set PPDefinitions; - size_t InPPFalseBranch; - std::stack SkipToEnd; - - // Information about the parsed source. - cmDependsFortranSourceInfo& Info; -}; - //---------------------------------------------------------------------------- class cmDependsFortranInternals { @@ -105,18 +36,18 @@ public: TargetRequiresMap TargetRequires; // Information about each object file. - typedef std::map ObjectInfoMap; + typedef std::map ObjectInfoMap; ObjectInfoMap ObjectInfo; - cmDependsFortranSourceInfo& CreateObjectInfo(const char* obj, + cmFortranSourceInfo& CreateObjectInfo(const char* obj, const char* src) { - std::map::iterator i = + std::map::iterator i = this->ObjectInfo.find(obj); if(i == this->ObjectInfo.end()) { - std::map::value_type - entry(obj, cmDependsFortranSourceInfo()); + std::map::value_type + entry(obj, cmFortranSourceInfo()); i = this->ObjectInfo.insert(entry).first; i->second.Source = src; } @@ -126,7 +57,7 @@ public: //---------------------------------------------------------------------------- cmDependsFortran::cmDependsFortran(): - PPDefinitions(0), Internal(0) + Internal(0) { } @@ -159,7 +90,7 @@ cmDependsFortran { def = it->substr(0, assignment); } - this->PPDefinitions.push_back(def); + this->PPDefinitions.insert(def); } } @@ -192,22 +123,18 @@ bool cmDependsFortran::WriteDependencies( { const std::string& src = *it; // Get the information object for this source. - cmDependsFortranSourceInfo& info = + cmFortranSourceInfo& info = this->Internal->CreateObjectInfo(obj.c_str(), src.c_str()); - // Make a copy of the macros defined via ADD_DEFINITIONS - std::set ppDefines(this->PPDefinitions.begin(), - this->PPDefinitions.end()); - - // Create the parser object. The constructor takes ppMacro and info per - // reference, so we may look into the resulting objects later. - cmDependsFortranParser parser(this, ppDefines, info); + // Create the parser object. The constructor takes info by reference, + // so we may look into the resulting objects later. + cmFortranParser parser(this->IncludePath, this->PPDefinitions, info); // Push on the starting file. - cmDependsFortranParser_FilePush(&parser, src.c_str()); + cmFortranParser_FilePush(&parser, src.c_str()); // Parse the translation unit. - if(cmDependsFortran_yyparse(parser.Scanner) != 0) + if(cmFortran_yyparse(parser.Scanner) != 0) { // Failed to parse the file. Report failure to write dependencies. okay = false; @@ -227,14 +154,10 @@ bool cmDependsFortran::Finalize(std::ostream& makeDepends, const char* stamp_dir = this->TargetDirectory.c_str(); // Get the directory in which module files will be created. - const char* mod_dir; cmMakefile* mf = this->LocalGenerator->GetMakefile(); - if(const char* target_mod_dir = - mf->GetDefinition("CMAKE_Fortran_TARGET_MODULE_DIR")) - { - mod_dir = target_mod_dir; - } - else + std::string mod_dir = + mf->GetSafeDefinition("CMAKE_Fortran_TARGET_MODULE_DIR"); + if (mod_dir.empty()) { mod_dir = this->LocalGenerator->GetMakefile()->GetCurrentBinaryDirectory(); @@ -318,7 +241,7 @@ void cmDependsFortran::LocateModules() for(ObjectInfoMap::const_iterator infoI = objInfo.begin(); infoI != objInfo.end(); ++infoI) { - cmDependsFortranSourceInfo const& info = infoI->second; + cmFortranSourceInfo const& info = infoI->second; // Include this module in the set provided by this target. this->Internal->TargetProvides.insert(info.Provides.begin(), info.Provides.end()); @@ -428,8 +351,9 @@ void cmDependsFortran::ConsiderModule(const char* name, bool cmDependsFortran ::WriteDependenciesReal(const char *obj, - cmDependsFortranSourceInfo const& info, - const char* mod_dir, const char* stamp_dir, + cmFortranSourceInfo const& info, + std::string const& mod_dir, + const char* stamp_dir, std::ostream& makeDepends, std::ostream& internalDepends) { @@ -701,7 +625,7 @@ bool cmDependsFortran::CopyModule(const std::vector& args) // is later used for longer sequences it should be re-written using an // efficient string search algorithm such as Boyer-Moore. static -bool cmDependsFortranStreamContainsSequence(std::istream& ifs, +bool cmFortranStreamContainsSequence(std::istream& ifs, const char* seq, int len) { assert(len > 0); @@ -734,7 +658,7 @@ bool cmDependsFortranStreamContainsSequence(std::istream& ifs, //---------------------------------------------------------------------------- // Helper function to compare the remaining content in two streams. -static bool cmDependsFortranStreamsDiffer(std::istream& ifs1, +static bool cmFortranStreamsDiffer(std::istream& ifs1, std::istream& ifs2) { // Compare the remaining content. @@ -837,7 +761,7 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile, const char seq[1] = {'\n'}; const int seqlen = 1; - if(!cmDependsFortranStreamContainsSequence(finModFile, seq, seqlen)) + if(!cmFortranStreamContainsSequence(finModFile, seq, seqlen)) { // The module is of unexpected format. Assume it is different. std::cerr << compilerId << " fortran module " << modFile @@ -845,7 +769,7 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile, return true; } - if(!cmDependsFortranStreamContainsSequence(finStampFile, seq, seqlen)) + if(!cmFortranStreamContainsSequence(finStampFile, seq, seqlen)) { // The stamp must differ if the sequence is not contained. return true; @@ -857,7 +781,7 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile, const char seq[2] = {'\n', '\0'}; const int seqlen = 2; - if(!cmDependsFortranStreamContainsSequence(finModFile, seq, seqlen)) + if(!cmFortranStreamContainsSequence(finModFile, seq, seqlen)) { // The module is of unexpected format. Assume it is different. std::cerr << compilerId << " fortran module " << modFile @@ -865,7 +789,7 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile, return true; } - if(!cmDependsFortranStreamContainsSequence(finStampFile, seq, seqlen)) + if(!cmFortranStreamContainsSequence(finStampFile, seq, seqlen)) { // The stamp must differ if the sequence is not contained. return true; @@ -875,7 +799,7 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile, // Compare the remaining content. If no compiler id matched above, // including the case none was given, this will compare the whole // content. - if(!cmDependsFortranStreamsDiffer(finModFile, finStampFile)) + if(!cmFortranStreamsDiffer(finModFile, finStampFile)) { return false; } @@ -883,396 +807,3 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile, // The modules are different. return true; } - -//---------------------------------------------------------------------------- -bool cmDependsFortran::FindIncludeFile(const char* dir, - const char* includeName, - std::string& fileName) -{ - // If the file is a full path, include it directly. - if(cmSystemTools::FileIsFullPath(includeName)) - { - fileName = includeName; - return cmSystemTools::FileExists(fileName.c_str(), true); - } - else - { - // Check for the file in the directory containing the including - // file. - std::string fullName = dir; - fullName += "/"; - fullName += includeName; - if(cmSystemTools::FileExists(fullName.c_str(), true)) - { - fileName = fullName; - return true; - } - - // Search the include path for the file. - for(std::vector::const_iterator i = - this->IncludePath.begin(); i != this->IncludePath.end(); ++i) - { - fullName = *i; - fullName += "/"; - fullName += includeName; - if(cmSystemTools::FileExists(fullName.c_str(), true)) - { - fileName = fullName; - return true; - } - } - } - return false; -} - -//---------------------------------------------------------------------------- -cmDependsFortranParser_s -::cmDependsFortranParser_s(cmDependsFortran* self, - std::set& ppDefines, - cmDependsFortranSourceInfo& info): - Self(self), PPDefinitions(ppDefines), Info(info) -{ - this->InInterface = 0; - this->InPPFalseBranch = 0; - - // Initialize the lexical scanner. - cmDependsFortran_yylex_init(&this->Scanner); - cmDependsFortran_yyset_extra(this, this->Scanner); - - // Create a dummy buffer that is never read but is the fallback - // buffer when the last file is popped off the stack. - YY_BUFFER_STATE buffer = - cmDependsFortran_yy_create_buffer(0, 4, this->Scanner); - cmDependsFortran_yy_switch_to_buffer(buffer, this->Scanner); -} - -//---------------------------------------------------------------------------- -cmDependsFortranParser_s::~cmDependsFortranParser_s() -{ - cmDependsFortran_yylex_destroy(this->Scanner); -} - -//---------------------------------------------------------------------------- -bool cmDependsFortranParser_FilePush(cmDependsFortranParser* parser, - const char* fname) -{ - // Open the new file and push it onto the stack. Save the old - // buffer with it on the stack. - if(FILE* file = cmsys::SystemTools::Fopen(fname, "rb")) - { - YY_BUFFER_STATE current = - cmDependsFortranLexer_GetCurrentBuffer(parser->Scanner); - std::string dir = cmSystemTools::GetParentDirectory(fname); - cmDependsFortranFile f(file, current, dir); - YY_BUFFER_STATE buffer = - cmDependsFortran_yy_create_buffer(0, 16384, parser->Scanner); - cmDependsFortran_yy_switch_to_buffer(buffer, parser->Scanner); - parser->FileStack.push(f); - return 1; - } - else - { - return 0; - } -} - -//---------------------------------------------------------------------------- -bool cmDependsFortranParser_FilePop(cmDependsFortranParser* parser) -{ - // Pop one file off the stack and close it. Switch the lexer back - // to the next one on the stack. - if(parser->FileStack.empty()) - { - return 0; - } - else - { - cmDependsFortranFile f = parser->FileStack.top(); parser->FileStack.pop(); - fclose(f.File); - YY_BUFFER_STATE current = - cmDependsFortranLexer_GetCurrentBuffer(parser->Scanner); - cmDependsFortran_yy_delete_buffer(current, parser->Scanner); - cmDependsFortran_yy_switch_to_buffer(f.Buffer, parser->Scanner); - return 1; - } -} - -//---------------------------------------------------------------------------- -int cmDependsFortranParser_Input(cmDependsFortranParser* parser, - char* buffer, size_t bufferSize) -{ - // Read from the file on top of the stack. If the stack is empty, - // the end of the translation unit has been reached. - if(!parser->FileStack.empty()) - { - FILE* file = parser->FileStack.top().File; - return (int)fread(buffer, 1, bufferSize, file); - } - return 0; -} - -//---------------------------------------------------------------------------- -void cmDependsFortranParser_StringStart(cmDependsFortranParser* parser) -{ - parser->TokenString = ""; -} - -//---------------------------------------------------------------------------- -const char* cmDependsFortranParser_StringEnd(cmDependsFortranParser* parser) -{ - return parser->TokenString.c_str(); -} - -//---------------------------------------------------------------------------- -void cmDependsFortranParser_StringAppend(cmDependsFortranParser* parser, - char c) -{ - parser->TokenString += c; -} - -//---------------------------------------------------------------------------- -void cmDependsFortranParser_SetInInterface(cmDependsFortranParser* parser, - bool in) -{ - if(parser->InPPFalseBranch) - { - return; - } - - parser->InInterface = in; -} - -//---------------------------------------------------------------------------- -bool cmDependsFortranParser_GetInInterface(cmDependsFortranParser* parser) -{ - return parser->InInterface; -} - -//---------------------------------------------------------------------------- -void cmDependsFortranParser_SetOldStartcond(cmDependsFortranParser* parser, - int arg) -{ - parser->OldStartcond = arg; -} - -//---------------------------------------------------------------------------- -int cmDependsFortranParser_GetOldStartcond(cmDependsFortranParser* parser) -{ - return parser->OldStartcond; -} - -//---------------------------------------------------------------------------- -void cmDependsFortranParser_Error(cmDependsFortranParser*, const char*) -{ - // If there is a parser error just ignore it. The source will not - // compile and the user will edit it. Then dependencies will have - // to be regenerated anyway. -} - -//---------------------------------------------------------------------------- -void cmDependsFortranParser_RuleUse(cmDependsFortranParser* parser, - const char* name) -{ - if(!parser->InPPFalseBranch) - { - parser->Info.Requires.insert(cmSystemTools::LowerCase(name) ); - } -} - -//---------------------------------------------------------------------------- -void cmDependsFortranParser_RuleInclude(cmDependsFortranParser* parser, - const char* name) -{ - if(parser->InPPFalseBranch) - { - return; - } - - // If processing an include statement there must be an open file. - assert(!parser->FileStack.empty()); - - // Get the directory containing the source in which the include - // statement appears. This is always the first search location for - // Fortran include files. - std::string dir = parser->FileStack.top().Directory; - - // Find the included file. If it cannot be found just ignore the - // problem because either the source will not compile or the user - // does not care about depending on this included source. - std::string fullName; - if(parser->Self->FindIncludeFile(dir.c_str(), name, fullName)) - { - // Found the included file. Save it in the set of included files. - parser->Info.Includes.insert(fullName); - - // Parse it immediately to translate the source inline. - cmDependsFortranParser_FilePush(parser, fullName.c_str()); - } -} - -//---------------------------------------------------------------------------- -void cmDependsFortranParser_RuleModule(cmDependsFortranParser* parser, - const char* name) -{ - if(!parser->InPPFalseBranch && !parser->InInterface) - { - parser->Info.Provides.insert(cmSystemTools::LowerCase(name)); - } -} - -//---------------------------------------------------------------------------- -void cmDependsFortranParser_RuleDefine(cmDependsFortranParser* parser, - const char* macro) -{ - if(!parser->InPPFalseBranch) - { - parser->PPDefinitions.insert(macro); - } -} - -//---------------------------------------------------------------------------- -void cmDependsFortranParser_RuleUndef(cmDependsFortranParser* parser, - const char* macro) -{ - if(!parser->InPPFalseBranch) - { - std::set::iterator match; - match = parser->PPDefinitions.find(macro); - if(match != parser->PPDefinitions.end()) - { - parser->PPDefinitions.erase(match); - } - } -} - -//---------------------------------------------------------------------------- -void cmDependsFortranParser_RuleIfdef(cmDependsFortranParser* parser, - const char* macro) -{ - // A new PP branch has been opened - parser->SkipToEnd.push(false); - - if (parser->InPPFalseBranch) - { - parser->InPPFalseBranch++; - } - else if(parser->PPDefinitions.find(macro) == parser->PPDefinitions.end()) - { - parser->InPPFalseBranch=1; - } - else - { - parser->SkipToEnd.top() = true; - } -} - -//---------------------------------------------------------------------------- -void cmDependsFortranParser_RuleIfndef(cmDependsFortranParser* parser, - const char* macro) -{ - // A new PP branch has been opened - parser->SkipToEnd.push(false); - - if (parser->InPPFalseBranch) - { - parser->InPPFalseBranch++; - } - else if(parser->PPDefinitions.find(macro) != parser->PPDefinitions.end()) - { - parser->InPPFalseBranch = 1; - } - else - { - // ignore other branches - parser->SkipToEnd.top() = true; - } -} - -//---------------------------------------------------------------------------- -void cmDependsFortranParser_RuleIf(cmDependsFortranParser* parser) -{ - /* Note: The current parser is _not_ able to get statements like - * #if 0 - * #if 1 - * #if MYSMBOL - * #if defined(MYSYMBOL) - * #if defined(MYSYMBOL) && ... - * right. The same for #elif. Thus in - * #if SYMBOL_1 - * .. - * #elif SYMBOL_2 - * ... - * ... - * #elif SYMBOL_N - * .. - * #else - * .. - * #endif - * _all_ N+1 branches are considered. If you got something like this - * #if defined(MYSYMBOL) - * #if !defined(MYSYMBOL) - * use - * #ifdef MYSYMBOL - * #ifndef MYSYMBOL - * instead. - */ - - // A new PP branch has been opened - // Never skip! See note above. - parser->SkipToEnd.push(false); -} - -//---------------------------------------------------------------------------- -void cmDependsFortranParser_RuleElif(cmDependsFortranParser* parser) -{ - /* Note: There are parser limitations. See the note at - * cmDependsFortranParser_RuleIf(..) - */ - - // Always taken unless an #ifdef or #ifndef-branch has been taken - // already. If the second condition isn't meet already - // (parser->InPPFalseBranch == 0) correct it. - if(!parser->SkipToEnd.empty() && - parser->SkipToEnd.top() && !parser->InPPFalseBranch) - { - parser->InPPFalseBranch = 1; - } -} - -//---------------------------------------------------------------------------- -void cmDependsFortranParser_RuleElse(cmDependsFortranParser* parser) -{ - // if the parent branch is false do nothing! - if(parser->InPPFalseBranch > 1) - { - return; - } - - // parser->InPPFalseBranch is either 0 or 1. We change it depending on - // parser->SkipToEnd.top() - if(!parser->SkipToEnd.empty() && - parser->SkipToEnd.top()) - { - parser->InPPFalseBranch = 1; - } - else - { - parser->InPPFalseBranch = 0; - } -} - -//---------------------------------------------------------------------------- -void cmDependsFortranParser_RuleEndif(cmDependsFortranParser* parser) -{ - if(!parser->SkipToEnd.empty()) - { - parser->SkipToEnd.pop(); - } - - // #endif doesn't know if there was a "#else" in before, so it - // always decreases InPPFalseBranch - if(parser->InPPFalseBranch) - { - parser->InPPFalseBranch--; - } -} diff --git a/Source/cmDependsFortran.h b/Source/cmDependsFortran.h index cb40796c8..a8a401330 100644 --- a/Source/cmDependsFortran.h +++ b/Source/cmDependsFortran.h @@ -9,13 +9,13 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ -#ifndef cmDependsFortran_h -#define cmDependsFortran_h +#ifndef cmFortran_h +#define cmFortran_h #include "cmDepends.h" class cmDependsFortranInternals; -class cmDependsFortranSourceInfo; +class cmFortranSourceInfo; /** \class cmDependsFortran * \brief Dependency scanner for Fortran object files. @@ -46,12 +46,6 @@ public: static bool ModulesDiffer(const char* modFile, const char* stampFile, const char* compilerId); - /** Method to find an included file in the include path. Fortran - always searches the directory containing the including source - first. */ - bool FindIncludeFile(const char* dir, const char* includeName, - std::string& fileName); - protected: // Finalize the dependency information for the target. virtual bool Finalize(std::ostream& makeDepends, @@ -71,15 +65,16 @@ protected: // Actually write the depenencies to the streams. bool WriteDependenciesReal(const char *obj, - cmDependsFortranSourceInfo const& info, - const char* mod_dir, const char* stamp_dir, + cmFortranSourceInfo const& info, + std::string const& mod_dir, + const char* stamp_dir, std::ostream& makeDepends, std::ostream& internalDepends); // The source file from which to start scanning. std::string SourceFile; - std::vector PPDefinitions; + std::set PPDefinitions; // Internal implementation details. cmDependsFortranInternals* Internal; diff --git a/Source/cmDependsFortranParser.h b/Source/cmDependsFortranParser.h deleted file mode 100644 index 399c3c8d9..000000000 --- a/Source/cmDependsFortranParser.h +++ /dev/null @@ -1,96 +0,0 @@ -/*============================================================================ - CMake - Cross Platform Makefile Generator - Copyright 2000-2009 Kitware, Inc., Insight Software Consortium - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#ifndef cmDependsFortranParser_h -#define cmDependsFortranParser_h - -#include /* size_t */ - -/* Forward declare parser object type. */ -typedef struct cmDependsFortranParser_s cmDependsFortranParser; - -/* Functions to enter/exit #include'd files in order. */ -bool cmDependsFortranParser_FilePush(cmDependsFortranParser* parser, - const char* fname); -bool cmDependsFortranParser_FilePop(cmDependsFortranParser* parser); - -/* Callbacks for lexer. */ -int cmDependsFortranParser_Input(cmDependsFortranParser* parser, - char* buffer, size_t bufferSize); - - -void cmDependsFortranParser_StringStart(cmDependsFortranParser* parser); -const char* cmDependsFortranParser_StringEnd(cmDependsFortranParser* parser); -void cmDependsFortranParser_StringAppend(cmDependsFortranParser* parser, - char c); - -void cmDependsFortranParser_SetInInterface(cmDependsFortranParser* parser, - bool is_in); -bool cmDependsFortranParser_GetInInterface(cmDependsFortranParser* parser); - - -void cmDependsFortranParser_SetInPPFalseBranch(cmDependsFortranParser* parser, - bool is_in); -bool cmDependsFortranParser_GetInPPFalseBranch(cmDependsFortranParser* parser); - - -void cmDependsFortranParser_SetOldStartcond(cmDependsFortranParser* parser, - int arg); -int cmDependsFortranParser_GetOldStartcond(cmDependsFortranParser* parser); - -/* Callbacks for parser. */ -void cmDependsFortranParser_Error(cmDependsFortranParser* parser, - const char* message); -void cmDependsFortranParser_RuleUse(cmDependsFortranParser* parser, - const char* name); -void cmDependsFortranParser_RuleInclude(cmDependsFortranParser* parser, - const char* name); -void cmDependsFortranParser_RuleModule(cmDependsFortranParser* parser, - const char* name); -void cmDependsFortranParser_RuleDefine(cmDependsFortranParser* parser, - const char* name); -void cmDependsFortranParser_RuleUndef(cmDependsFortranParser* parser, - const char* name); -void cmDependsFortranParser_RuleIfdef(cmDependsFortranParser* parser, - const char* name); -void cmDependsFortranParser_RuleIfndef(cmDependsFortranParser* parser, - const char* name); -void cmDependsFortranParser_RuleIf(cmDependsFortranParser* parser); -void cmDependsFortranParser_RuleElif(cmDependsFortranParser* parser); -void cmDependsFortranParser_RuleElse(cmDependsFortranParser* parser); -void cmDependsFortranParser_RuleEndif(cmDependsFortranParser* parser); - -/* Define the parser stack element type. */ -typedef union cmDependsFortran_yystype_u cmDependsFortran_yystype; -union cmDependsFortran_yystype_u -{ - char* string; -}; - -/* Setup the proper yylex interface. */ -#define YY_EXTRA_TYPE cmDependsFortranParser* -#define YY_DECL \ -int cmDependsFortran_yylex(YYSTYPE* yylvalp, yyscan_t yyscanner) -#define YYSTYPE cmDependsFortran_yystype -#define YYSTYPE_IS_DECLARED 1 -#if !defined(cmDependsFortranLexer_cxx) -# include "cmDependsFortranLexer.h" -#endif -#if !defined(cmDependsFortranLexer_cxx) -#if !defined(cmDependsFortranParser_cxx) -# undef YY_EXTRA_TYPE -# undef YY_DECL -# undef YYSTYPE -# undef YYSTYPE_IS_DECLARED -#endif -#endif - -#endif diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h index 8854c3618..b6c5fde7e 100644 --- a/Source/cmDocumentation.h +++ b/Source/cmDocumentation.h @@ -13,7 +13,6 @@ #define _cmDocumentation_h #include "cmStandardIncludes.h" -#include "cmProperty.h" #include "cmDocumentationFormatter.h" #include "cmDocumentationSection.h" #include "cmake.h" diff --git a/Source/cmExecProgramCommand.cxx b/Source/cmExecProgramCommand.cxx index e021d0bb4..41785c2b0 100644 --- a/Source/cmExecProgramCommand.cxx +++ b/Source/cmExecProgramCommand.cxx @@ -156,7 +156,7 @@ bool cmExecProgramCommand::RunCommand(const char* command, verbose = false; } -#if defined(WIN32) && !defined(__CYGWIN__) +#if defined(_WIN32) && !defined(__CYGWIN__) // if the command does not start with a quote, then // try to find the program, and if the program can not be // found use system to run the command as it must be a built in @@ -219,7 +219,7 @@ bool cmExecProgramCommand::RunCommand(const char* command, return false; } -#if defined(WIN32) && !defined(__CYGWIN__) +#if defined(_WIN32) && !defined(__CYGWIN__) if(dir) { cmsysProcess_SetWorkingDirectory(cp, dir); @@ -305,7 +305,7 @@ bool cmExecProgramCommand::RunCommand(const char* command, } if(!msg.empty()) { -#if defined(WIN32) && !defined(__CYGWIN__) +#if defined(_WIN32) && !defined(__CYGWIN__) // Old Windows process execution printed this info. msg += "\n\nfor command: "; msg += command; diff --git a/Source/cmExecProgramCommand.h b/Source/cmExecProgramCommand.h index 23d10f9f1..adefdf923 100644 --- a/Source/cmExecProgramCommand.h +++ b/Source/cmExecProgramCommand.h @@ -50,12 +50,6 @@ public: */ virtual bool IsScriptable() const { return true; } - /** This command is kept for compatibility with older CMake versions. */ - virtual bool IsDiscouraged() const - { - return true; - } - cmTypeMacro(cmExecProgramCommand, cmCommand); private: static bool RunCommand(const char* command, std::string& output, diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index bf18deb94..fed0dbc90 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -18,7 +18,7 @@ //---------------------------------------------------------------------------- cmExportBuildFileGenerator::cmExportBuildFileGenerator() - : Backtrace(NULL) + : Backtrace() { this->Makefile = 0; this->ExportSet = 0; @@ -27,6 +27,7 @@ cmExportBuildFileGenerator::cmExportBuildFileGenerator() //---------------------------------------------------------------------------- bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os) { + std::vector allTargets; { std::string expectedTargets; std::string sep; @@ -36,10 +37,11 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os) tei = targets.begin(); tei != targets.end(); ++tei) { - cmTarget *te = this->Makefile->FindTargetToUse(*tei); - expectedTargets += sep + this->Namespace + te->GetExportName(); + cmGeneratorTarget *te = this->Makefile + ->FindGeneratorTargetToUse(*tei); + expectedTargets += sep + this->Namespace + te->Target->GetExportName(); sep = " "; - if(this->ExportedTargets.insert(te).second) + if(this->ExportedTargets.insert(te->Target).second) { this->Exports.push_back(te); } @@ -63,11 +65,12 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os) std::vector missingTargets; // Create all the imported targets. - for(std::vector::const_iterator + for(std::vector::const_iterator tei = this->Exports.begin(); tei != this->Exports.end(); ++tei) { - cmTarget* te = *tei; + cmGeneratorTarget* gte = *tei; + cmTarget* te = gte->Target; this->GenerateImportTargetCode(os, te); te->AppendBuildInterfaceIncludes(); @@ -103,7 +106,7 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os) cmGeneratorExpression::BuildInterface, properties, missingTargets); } - this->PopulateCompatibleInterfaceProperties(te, properties); + this->PopulateCompatibleInterfaceProperties(gte, properties); this->GenerateInterfaceProperties(te, os, properties); } @@ -129,12 +132,12 @@ cmExportBuildFileGenerator std::string const& suffix, std::vector &missingTargets) { - for(std::vector::const_iterator + for(std::vector::const_iterator tei = this->Exports.begin(); tei != this->Exports.end(); ++tei) { // Collect import properties for this target. - cmTarget* target = *tei; + cmGeneratorTarget* target = *tei; ImportPropertyMap properties; if (target->GetType() != cmTarget::INTERFACE_LIBRARY) @@ -147,10 +150,12 @@ cmExportBuildFileGenerator if (target->GetType() != cmTarget::INTERFACE_LIBRARY) { this->SetImportDetailProperties(config, suffix, - target, properties, missingTargets); + target, + properties, missingTargets); this->SetImportLinkInterface(config, suffix, - cmGeneratorExpression::BuildInterface, - target, properties, missingTargets); + cmGeneratorExpression::BuildInterface, + target, + properties, missingTargets); } // TOOD: PUBLIC_HEADER_LOCATION @@ -160,7 +165,8 @@ cmExportBuildFileGenerator // properties); // Generate code in the export file. - this->GenerateImportPropertyCode(os, config, target, properties); + this->GenerateImportPropertyCode(os, config, target->Target, + properties); } } } @@ -176,17 +182,18 @@ void cmExportBuildFileGenerator ::SetImportLocationProperty(const std::string& config, std::string const& suffix, - cmTarget* target, ImportPropertyMap& properties) + cmGeneratorTarget* target, + ImportPropertyMap& properties) { // Get the makefile in which to lookup target information. - cmMakefile* mf = target->GetMakefile(); + cmMakefile* mf = target->Makefile; // Add the main target file. { std::string prop = "IMPORTED_LOCATION"; prop += suffix; std::string value; - if(target->IsAppBundleOnApple()) + if(target->Target->IsAppBundleOnApple()) { value = target->GetFullPath(config, false); } @@ -204,13 +211,13 @@ cmExportBuildFileGenerator // Add the import library for windows DLLs. if(dll_platform && (target->GetType() == cmTarget::SHARED_LIBRARY || - target->IsExecutableWithExports()) && + target->Target->IsExecutableWithExports()) && mf->GetDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX")) { std::string prop = "IMPORTED_IMPLIB"; prop += suffix; std::string value = target->GetFullPath(config, true); - target->GetImplibGNUtoMS(value, value, + target->Target->GetImplibGNUtoMS(value, value, "${CMAKE_IMPORT_LIBRARY_SUFFIX}"); properties[prop] = value; } @@ -326,12 +333,12 @@ cmExportBuildFileGenerator } std::string -cmExportBuildFileGenerator::InstallNameDir(cmTarget* target, +cmExportBuildFileGenerator::InstallNameDir(cmGeneratorTarget* target, const std::string& config) { std::string install_name_dir; - cmMakefile* mf = target->GetMakefile(); + cmMakefile* mf = target->Target->GetMakefile(); if(mf->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME")) { install_name_dir = diff --git a/Source/cmExportBuildFileGenerator.h b/Source/cmExportBuildFileGenerator.h index 8b5694c39..ff3d2e1a9 100644 --- a/Source/cmExportBuildFileGenerator.h +++ b/Source/cmExportBuildFileGenerator.h @@ -68,17 +68,18 @@ protected: /** Fill in properties indicating built file locations. */ void SetImportLocationProperty(const std::string& config, std::string const& suffix, - cmTarget* target, + cmGeneratorTarget* target, ImportPropertyMap& properties); - std::string InstallNameDir(cmTarget* target, const std::string& config); + std::string InstallNameDir(cmGeneratorTarget* target, + const std::string& config); std::vector FindNamespaces(cmMakefile* mf, const std::string& name); std::vector Targets; cmExportSet *ExportSet; - std::vector Exports; + std::vector Exports; cmMakefile* Makefile; cmListFileBacktrace Backtrace; }; diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx index 43d26f9e4..96ea77b2d 100644 --- a/Source/cmExportCommand.cxx +++ b/Source/cmExportCommand.cxx @@ -177,6 +177,12 @@ bool cmExportCommand this->SetError(e.str()); return false; } + if (target->GetType() == cmTarget::UTILITY) + { + this->SetError("given custom target \"" + *currentTarget + + "\" which may not be exported."); + return false; + } } else { diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index a51fb2a00..9a7d73f4b 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -23,11 +23,27 @@ #include "cmVersion.h" #include "cmComputeLinkInformation.h" #include "cmAlgorithms.h" +#include "cmOutputConverter.h" #include #include #include +//---------------------------------------------------------------------------- +static std::string cmExportFileGeneratorEscape(std::string const& str) +{ + // Escape a property value for writing into a .cmake file. + std::string result = cmOutputConverter::EscapeForCMake(str); + // Un-escape variable references generated by our own export code. + cmSystemTools::ReplaceString(result, + "\\${_IMPORT_PREFIX}", + "${_IMPORT_PREFIX}"); + cmSystemTools::ReplaceString(result, + "\\${CMAKE_IMPORT_LIBRARY_SUFFIX}", + "${CMAKE_IMPORT_LIBRARY_SUFFIX}"); + return result; +} + //---------------------------------------------------------------------------- cmExportFileGenerator::cmExportFileGenerator() { @@ -509,7 +525,7 @@ void getPropertyContents(cmTarget const* tgt, const std::string& prop, } //---------------------------------------------------------------------------- -void getCompatibleInterfaceProperties(cmTarget *target, +void getCompatibleInterfaceProperties(cmGeneratorTarget *target, std::set &ifaceProperties, const std::string& config) { @@ -517,7 +533,7 @@ void getCompatibleInterfaceProperties(cmTarget *target, if (!info) { - cmMakefile* mf = target->GetMakefile(); + cmMakefile* mf = target->Target->GetMakefile(); std::ostringstream e; e << "Exporting the target \"" << target->GetName() << "\" is not " "allowed since its linker language cannot be determined"; @@ -552,9 +568,10 @@ void getCompatibleInterfaceProperties(cmTarget *target, //---------------------------------------------------------------------------- void cmExportFileGenerator::PopulateCompatibleInterfaceProperties( - cmTarget *target, + cmGeneratorTarget *gtarget, ImportPropertyMap &properties) { + cmTarget *target = gtarget->Target; this->PopulateInterfaceProperty("COMPATIBLE_INTERFACE_BOOL", target, properties); this->PopulateInterfaceProperty("COMPATIBLE_INTERFACE_STRING", @@ -575,7 +592,7 @@ void cmExportFileGenerator::PopulateCompatibleInterfaceProperties( if (target->GetType() != cmTarget::INTERFACE_LIBRARY) { - getCompatibleInterfaceProperties(target, ifaceProperties, ""); + getCompatibleInterfaceProperties(gtarget, ifaceProperties, ""); std::vector configNames; target->GetMakefile()->GetConfigurations(configNames); @@ -583,7 +600,7 @@ void cmExportFileGenerator::PopulateCompatibleInterfaceProperties( for (std::vector::const_iterator ci = configNames.begin(); ci != configNames.end(); ++ci) { - getCompatibleInterfaceProperties(target, ifaceProperties, *ci); + getCompatibleInterfaceProperties(gtarget, ifaceProperties, *ci); } } @@ -608,7 +625,8 @@ void cmExportFileGenerator::GenerateInterfaceProperties(cmTarget const* target, for(ImportPropertyMap::const_iterator pi = properties.begin(); pi != properties.end(); ++pi) { - os << " " << pi->first << " \"" << pi->second << "\"\n"; + os << " " << pi->first << " " + << cmExportFileGeneratorEscape(pi->second) << "\n"; } os << ")\n\n"; } @@ -774,12 +792,12 @@ void cmExportFileGenerator ::SetImportLinkInterface(const std::string& config, std::string const& suffix, cmGeneratorExpression::PreprocessContext preprocessRule, - cmTarget* target, ImportPropertyMap& properties, + cmGeneratorTarget* target, ImportPropertyMap& properties, std::vector& missingTargets) { // Add the transitive link dependencies for this configuration. - cmTarget::LinkInterface const* iface = target->GetLinkInterface(config, - target); + cmLinkInterface const* iface = target->GetLinkInterface(config, + target->Target); if (!iface) { return; @@ -812,12 +830,14 @@ cmExportFileGenerator } const bool newCMP0022Behavior = - target->GetPolicyStatusCMP0022() != cmPolicies::WARN - && target->GetPolicyStatusCMP0022() != cmPolicies::OLD; + target->Target + ->GetPolicyStatusCMP0022() != cmPolicies::WARN + && target->Target + ->GetPolicyStatusCMP0022() != cmPolicies::OLD; if(newCMP0022Behavior && !this->ExportOld) { - cmMakefile *mf = target->GetMakefile(); + cmMakefile *mf = target->Target->GetMakefile(); std::ostringstream e; e << "Target \"" << target->GetName() << "\" has policy CMP0022 enabled, " "but also has old-style LINK_INTERFACE_LIBRARIES properties " @@ -837,7 +857,7 @@ cmExportFileGenerator preprocessRule); if (!prepro.empty()) { - this->ResolveTargetsInGeneratorExpressions(prepro, target, + this->ResolveTargetsInGeneratorExpressions(prepro, target->Target, missingTargets, ReplaceFreeTargets); properties["IMPORTED_LINK_INTERFACE_LIBRARIES" + suffix] = prepro; @@ -849,12 +869,13 @@ void cmExportFileGenerator ::SetImportDetailProperties(const std::string& config, std::string const& suffix, - cmTarget* target, ImportPropertyMap& properties, + cmGeneratorTarget* target, + ImportPropertyMap& properties, std::vector& missingTargets ) { // Get the makefile in which to lookup target information. - cmMakefile* mf = target->GetMakefile(); + cmMakefile* mf = target->Makefile; // Add the soname for unix shared libraries. if(target->GetType() == cmTarget::SHARED_LIBRARY || @@ -887,8 +908,8 @@ cmExportFileGenerator } // Add the transitive link dependencies for this configuration. - if(cmTarget::LinkInterface const* iface = target->GetLinkInterface(config, - target)) + if(cmLinkInterface const* iface = + target->GetLinkInterface(config, target->Target)) { this->SetImportLinkProperty(suffix, target, "IMPORTED_LINK_INTERFACE_LANGUAGES", @@ -914,7 +935,7 @@ template void cmExportFileGenerator ::SetImportLinkProperty(std::string const& suffix, - cmTarget* target, + cmGeneratorTarget* target, const std::string& propName, std::vector const& entries, ImportPropertyMap& properties, @@ -938,7 +959,7 @@ cmExportFileGenerator sep = ";"; std::string temp = *li; - this->AddTargetNamespace(temp, target, missingTargets); + this->AddTargetNamespace(temp, target->Target, missingTargets); link_entries += temp; } @@ -1112,7 +1133,8 @@ cmExportFileGenerator for(ImportPropertyMap::const_iterator pi = properties.begin(); pi != properties.end(); ++pi) { - os << " " << pi->first << " \"" << pi->second << "\"\n"; + os << " " << pi->first << " " + << cmExportFileGeneratorEscape(pi->second) << "\n"; } os << " )\n" << "\n"; @@ -1223,7 +1245,7 @@ cmExportFileGenerator ImportPropertyMap::const_iterator pi = properties.find(*li); if (pi != properties.end()) { - os << "\"" << pi->second << "\" "; + os << cmExportFileGeneratorEscape(pi->second) << " "; } } diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h index b6f4166db..44f779b67 100644 --- a/Source/cmExportFileGenerator.h +++ b/Source/cmExportFileGenerator.h @@ -92,13 +92,15 @@ protected: // Collect properties with detailed information about targets beyond // their location on disk. void SetImportDetailProperties(const std::string& config, - std::string const& suffix, cmTarget* target, + std::string const& suffix, + cmGeneratorTarget* target, ImportPropertyMap& properties, std::vector& missingTargets); template void SetImportLinkProperty(std::string const& suffix, - cmTarget* target, const std::string& propName, + cmGeneratorTarget* target, + const std::string& propName, std::vector const& entries, ImportPropertyMap& properties, std::vector& missingTargets); @@ -130,7 +132,7 @@ protected: std::vector &missingTargets); void PopulateInterfaceProperty(const std::string& propName, cmTarget *target, ImportPropertyMap &properties); - void PopulateCompatibleInterfaceProperties(cmTarget *target, + void PopulateCompatibleInterfaceProperties(cmGeneratorTarget *target, ImportPropertyMap &properties); void GenerateInterfaceProperties(cmTarget const* target, std::ostream& os, const ImportPropertyMap &properties); @@ -148,7 +150,7 @@ protected: void SetImportLinkInterface(const std::string& config, std::string const& suffix, cmGeneratorExpression::PreprocessContext preprocessRule, - cmTarget* target, ImportPropertyMap& properties, + cmGeneratorTarget* target, ImportPropertyMap& properties, std::vector& missingTargets); enum FreeTargetsReplace { @@ -198,7 +200,7 @@ private: virtual void ReplaceInstallPrefix(std::string &input); - virtual std::string InstallNameDir(cmTarget* target, + virtual std::string InstallNameDir(cmGeneratorTarget* target, const std::string& config) = 0; }; diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index 89c6ca297..7ffab0c52 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -72,8 +72,8 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) // Set an _IMPORT_PREFIX variable for import location properties // to reference if they are relative to the install prefix. - std::string installPrefix = - this->IEGen->GetMakefile()->GetSafeDefinition("CMAKE_INSTALL_PREFIX"); + std::string installPrefix = this->IEGen->GetLocalGenerator() + ->GetMakefile()->GetSafeDefinition("CMAKE_INSTALL_PREFIX"); std::string const& expDest = this->IEGen->GetDestination(); if(cmSystemTools::FileIsFullPath(expDest)) { @@ -193,7 +193,11 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE", te, properties); - this->PopulateCompatibleInterfaceProperties(te, properties); + cmGeneratorTarget *gtgt = te->GetMakefile() + ->GetGlobalGenerator() + ->GetGeneratorTarget(te); + + this->PopulateCompatibleInterfaceProperties(gtgt, properties); this->GenerateInterfaceProperties(te, os, properties); } @@ -358,12 +362,14 @@ cmExportInstallFileGenerator if(!properties.empty()) { // Get the rest of the target details. + cmGeneratorTarget *gtgt = te->Target->GetMakefile() + ->GetGlobalGenerator()->GetGeneratorTarget(te->Target); this->SetImportDetailProperties(config, suffix, - te->Target, properties, missingTargets); + gtgt, properties, missingTargets); this->SetImportLinkInterface(config, suffix, cmGeneratorExpression::InstallInterface, - te->Target, properties, missingTargets); + gtgt, properties, missingTargets); // TOOD: PUBLIC_HEADER_LOCATION // This should wait until the build feature propagation stuff @@ -396,7 +402,7 @@ cmExportInstallFileGenerator } // Get the target to be installed. - cmTarget* target = itgen->GetTarget(); + cmTarget* target = itgen->GetTarget()->Target; // Construct the installed location of the target. std::string dest = itgen->GetDestination(config); @@ -540,12 +546,12 @@ cmExportInstallFileGenerator } std::string -cmExportInstallFileGenerator::InstallNameDir(cmTarget* target, +cmExportInstallFileGenerator::InstallNameDir(cmGeneratorTarget* target, const std::string&) { std::string install_name_dir; - cmMakefile* mf = target->GetMakefile(); + cmMakefile* mf = target->Target->GetMakefile(); if(mf->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME")) { install_name_dir = diff --git a/Source/cmExportInstallFileGenerator.h b/Source/cmExportInstallFileGenerator.h index 6f86ac9f9..b06fee541 100644 --- a/Source/cmExportInstallFileGenerator.h +++ b/Source/cmExportInstallFileGenerator.h @@ -83,7 +83,8 @@ protected: std::set& importedLocations ); - std::string InstallNameDir(cmTarget* target, const std::string& config); + std::string InstallNameDir(cmGeneratorTarget* target, + const std::string& config); cmInstallExportGenerator* IEGen; diff --git a/Source/cmExportLibraryDependenciesCommand.cxx b/Source/cmExportLibraryDependenciesCommand.cxx index cb150a79c..fde8fb13f 100644 --- a/Source/cmExportLibraryDependenciesCommand.cxx +++ b/Source/cmExportLibraryDependenciesCommand.cxx @@ -11,7 +11,6 @@ ============================================================================*/ #include "cmExportLibraryDependenciesCommand.h" #include "cmGlobalGenerator.h" -#include "cmLocalGenerator.h" #include "cmGeneratedFileStream.h" #include "cmake.h" #include "cmVersion.h" @@ -82,15 +81,14 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const // the project. cmake* cm = this->Makefile->GetCMakeInstance(); cmGlobalGenerator* global = cm->GetGlobalGenerator(); - const std::vector& locals = global->GetLocalGenerators(); + const std::vector& locals = global->GetMakefiles(); std::map libDepsOld; std::map libDepsNew; std::map libTypes; - for(std::vector::const_iterator i = locals.begin(); + for(std::vector::const_iterator i = locals.begin(); i != locals.end(); ++i) { - const cmLocalGenerator* gen = *i; - const cmTargets &tgts = gen->GetMakefile()->GetTargets(); + const cmTargets &tgts = (*i)->GetTargets(); for(cmTargets::const_iterator l = tgts.begin(); l != tgts.end(); ++l) { diff --git a/Source/cmExportLibraryDependenciesCommand.h b/Source/cmExportLibraryDependenciesCommand.h index 2ea4e79b9..81aa21a5b 100644 --- a/Source/cmExportLibraryDependenciesCommand.h +++ b/Source/cmExportLibraryDependenciesCommand.h @@ -22,7 +22,6 @@ public: virtual bool InitialPass(std::vector const& args, cmExecutionStatus &status); virtual std::string GetName() const { return "export_library_dependencies";} - virtual bool IsDiscouraged() const { return true; } virtual void FinalPass(); virtual bool HasFinalPass() const { return true; } diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx index eb8d1935f..ba66531fd 100644 --- a/Source/cmExportTryCompileFileGenerator.cxx +++ b/Source/cmExportTryCompileFileGenerator.cxx @@ -13,9 +13,16 @@ #include "cmExportTryCompileFileGenerator.h" #include "cmGeneratedFileStream.h" +#include "cmGlobalGenerator.h" #include "cmGeneratorExpressionDAGChecker.h" //---------------------------------------------------------------------------- +cmExportTryCompileFileGenerator::cmExportTryCompileFileGenerator( + cmGlobalGenerator* gg) +{ + gg->CreateGenerationObjects(cmGlobalGenerator::ImportedOnly); +} + bool cmExportTryCompileFileGenerator::GenerateMainFile(std::ostream& os) { std::set emitted; @@ -99,8 +106,6 @@ cmExportTryCompileFileGenerator::PopulateProperties(cmTarget const* target, || i->first.find("IMPORTED_LINK_DEPENDENT_LIBRARIES") == 0 || i->first.find("INTERFACE_LINK_LIBRARIES") == 0) { - const std::string libs = i->second.GetValue(); - std::string evalResult = this->FindTargets(i->first, target, emitted); @@ -118,13 +123,14 @@ cmExportTryCompileFileGenerator::PopulateProperties(cmTarget const* target, } } } + std::string -cmExportTryCompileFileGenerator::InstallNameDir(cmTarget* target, +cmExportTryCompileFileGenerator::InstallNameDir(cmGeneratorTarget* target, const std::string& config) { std::string install_name_dir; - cmMakefile* mf = target->GetMakefile(); + cmMakefile* mf = target->Target->GetMakefile(); if(mf->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME")) { install_name_dir = diff --git a/Source/cmExportTryCompileFileGenerator.h b/Source/cmExportTryCompileFileGenerator.h index ec70d8103..8838eca82 100644 --- a/Source/cmExportTryCompileFileGenerator.h +++ b/Source/cmExportTryCompileFileGenerator.h @@ -9,8 +9,8 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ -#ifndef cmExportInstallFileGenerator_h -#define cmExportInstallFileGenerator_h +#ifndef cmExportTryCompileFileGenerator_h +#define cmExportTryCompileFileGenerator_h #include "cmExportFileGenerator.h" @@ -20,6 +20,8 @@ class cmInstallTargetGenerator; class cmExportTryCompileFileGenerator: public cmExportFileGenerator { public: + cmExportTryCompileFileGenerator(cmGlobalGenerator* gg); + /** Set the list of targets to export. */ void SetExports(const std::vector &exports) { this->Exports = exports; } @@ -43,7 +45,7 @@ protected: ImportPropertyMap& properties, std::set &emitted); - std::string InstallNameDir(cmTarget* target, + std::string InstallNameDir(cmGeneratorTarget* target, const std::string& config); private: std::string FindTargets(const std::string& prop, cmTarget const* tgt, diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index e374387de..dfd51c754 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -313,7 +313,7 @@ void cmExtraCodeBlocksGenerator " "<\n"; - this->AppendTarget(fout, "all", 0, make.c_str(), mf, compiler.c_str()); + this->AppendTarget(fout, "all", 0, make.c_str(), lgs[0], compiler.c_str()); // add all executable and library targets and some of the GLOBAL // and UTILITY targets @@ -335,7 +335,7 @@ void cmExtraCodeBlocksGenerator makefile->GetHomeOutputDirectory())==0) { this->AppendTarget(fout, ti->first, 0, - make.c_str(), makefile, compiler.c_str()); + make.c_str(), *lg, compiler.c_str()); } } break; @@ -351,7 +351,7 @@ void cmExtraCodeBlocksGenerator } this->AppendTarget(fout, ti->first, 0, - make.c_str(), makefile, compiler.c_str()); + make.c_str(), *lg, compiler.c_str()); break; case cmTarget::EXECUTABLE: case cmTarget::STATIC_LIBRARY: @@ -360,11 +360,11 @@ void cmExtraCodeBlocksGenerator case cmTarget::OBJECT_LIBRARY: { this->AppendTarget(fout, ti->first, &ti->second, - make.c_str(), makefile, compiler.c_str()); + make.c_str(), *lg, compiler.c_str()); std::string fastTarget = ti->first; fastTarget += "/fast"; this->AppendTarget(fout, fastTarget, &ti->second, - make.c_str(), makefile, compiler.c_str()); + make.c_str(), *lg, compiler.c_str()); } break; default: @@ -519,14 +519,16 @@ void cmExtraCodeBlocksGenerator // Write a dummy file for OBJECT libraries, so C::B can reference some file std::string cmExtraCodeBlocksGenerator::CreateDummyTargetFile( - cmMakefile* mf, cmTarget* target) const + cmLocalGenerator* lg, + cmTarget* target) const { + cmMakefile *mf = lg->GetMakefile(); // this file doesn't seem to be used by C::B in custom makefile mode, // but we generate a unique file for each OBJECT library so in case // C::B uses it in some way, the targets don't interfere with each other. std::string filename = mf->GetCurrentBinaryDirectory(); filename += "/"; - filename += mf->GetLocalGenerator()->GetTargetDirectory(*target); + filename += lg->GetTargetDirectory(*target); filename += "/"; filename += target->GetName(); filename += ".objlib"; @@ -547,9 +549,10 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout, const std::string& targetName, cmTarget* target, const char* make, - const cmMakefile* makefile, + const cmLocalGenerator* lg, const char* compiler) { + cmMakefile const* makefile = lg->GetMakefile(); std::string makefileName = makefile->GetCurrentBinaryDirectory(); makefileName += "/Makefile"; @@ -583,12 +586,14 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout, std::string location; if ( target->GetType()==cmTarget::OBJECT_LIBRARY) { - location = this->CreateDummyTargetFile(const_cast(makefile), + location = this->CreateDummyTargetFile(const_cast(lg), target); } else { - location = target->GetLocation(buildType); + cmGeneratorTarget* gt = + this->GlobalGenerator->GetGeneratorTarget(target); + location = gt->GetLocation(buildType); } fout<<"