From kwrobot at kitware.com Tue Jan 1 00:03:03 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 1 Jan 2019 00:03:03 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.2-788-g938e5c0 Message-ID: <20190101050303.DEE451259B5@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 938e5c075a612a8d327ad387baceab011beb6904 (commit) from 124c741f7bb4e32f933b2ef9ca3414985992278e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=938e5c075a612a8d327ad387baceab011beb6904 commit 938e5c075a612a8d327ad387baceab011beb6904 Author: Kitware Robot AuthorDate: Tue Jan 1 00:01:05 2019 -0500 Commit: Kitware Robot CommitDate: Tue Jan 1 00:01:05 2019 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index f24dc93..0f2f036 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 13) -set(CMake_VERSION_PATCH 20181231) +set(CMake_VERSION_PATCH 20190101) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Wed Jan 2 00:03:05 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 2 Jan 2019 00:03:05 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.2-789-g88f1e79 Message-ID: <20190102050305.E3B571277D3@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 88f1e79f3e8076bd57d9ae54037fd05f655c2960 (commit) from 938e5c075a612a8d327ad387baceab011beb6904 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=88f1e79f3e8076bd57d9ae54037fd05f655c2960 commit 88f1e79f3e8076bd57d9ae54037fd05f655c2960 Author: Kitware Robot AuthorDate: Wed Jan 2 00:01:04 2019 -0500 Commit: Kitware Robot CommitDate: Wed Jan 2 00:01:04 2019 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 0f2f036..a8a16b4 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 13) -set(CMake_VERSION_PATCH 20190101) +set(CMake_VERSION_PATCH 20190102) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Wed Jan 2 15:33:05 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 2 Jan 2019 15:33:05 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.2-791-g124a863 Message-ID: <20190102203305.D718D11DC27@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 124a8632cbdb88be8e9768a83ddb63790d5bf60f (commit) via 8a803d784bf65d2c8556eb1e6b6134b878e89c79 (commit) from 88f1e79f3e8076bd57d9ae54037fd05f655c2960 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=124a8632cbdb88be8e9768a83ddb63790d5bf60f commit 124a8632cbdb88be8e9768a83ddb63790d5bf60f Merge: 88f1e79 8a803d7 Author: Craig Scott AuthorDate: Wed Jan 2 20:28:14 2019 +0000 Commit: Kitware Robot CommitDate: Wed Jan 2 15:31:39 2019 -0500 Merge topic 'messenger-no-cmstate-v2' 8a803d784b cmMessenger: Decouple from cmState Acked-by: Kitware Robot Merge-request: !2653 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8a803d784bf65d2c8556eb1e6b6134b878e89c79 commit 8a803d784bf65d2c8556eb1e6b6134b878e89c79 Author: Bruno Manganelli AuthorDate: Thu Nov 22 00:49:50 2018 +0000 Commit: Craig Scott CommitDate: Tue Jan 1 11:55:08 2019 +1100 cmMessenger: Decouple from cmState diff --git a/Source/cmMessenger.cxx b/Source/cmMessenger.cxx index a81428a..880cf4b 100644 --- a/Source/cmMessenger.cxx +++ b/Source/cmMessenger.cxx @@ -4,7 +4,6 @@ #include "cmAlgorithms.h" #include "cmDocumentationFormatter.h" -#include "cmState.h" #include "cmSystemTools.h" #if defined(CMAKE_BUILD_WITH_CMAKE) @@ -131,11 +130,6 @@ void displayMessage(cmake::MessageType t, std::ostringstream& msg) } } -cmMessenger::cmMessenger(cmState* state) - : State(state) -{ -} - void cmMessenger::IssueMessage(cmake::MessageType t, const std::string& text, const cmListFileBacktrace& backtrace) const { @@ -173,31 +167,3 @@ void cmMessenger::DisplayMessage(cmake::MessageType t, const std::string& text, displayMessage(t, msg); } - -bool cmMessenger::GetSuppressDevWarnings() const -{ - const char* cacheEntryValue = - this->State->GetCacheEntryValue("CMAKE_SUPPRESS_DEVELOPER_WARNINGS"); - return cmSystemTools::IsOn(cacheEntryValue); -} - -bool cmMessenger::GetSuppressDeprecatedWarnings() const -{ - const char* cacheEntryValue = - this->State->GetCacheEntryValue("CMAKE_WARN_DEPRECATED"); - return cacheEntryValue && cmSystemTools::IsOff(cacheEntryValue); -} - -bool cmMessenger::GetDevWarningsAsErrors() const -{ - const char* cacheEntryValue = - this->State->GetCacheEntryValue("CMAKE_SUPPRESS_DEVELOPER_ERRORS"); - return cacheEntryValue && cmSystemTools::IsOff(cacheEntryValue); -} - -bool cmMessenger::GetDeprecatedWarningsAsErrors() const -{ - const char* cacheEntryValue = - this->State->GetCacheEntryValue("CMAKE_ERROR_DEPRECATED"); - return cmSystemTools::IsOn(cacheEntryValue); -} diff --git a/Source/cmMessenger.h b/Source/cmMessenger.h index 4aafbd4..e947eaa 100644 --- a/Source/cmMessenger.h +++ b/Source/cmMessenger.h @@ -10,13 +10,9 @@ #include -class cmState; - class cmMessenger { public: - cmMessenger(cmState* state); - void IssueMessage( cmake::MessageType t, std::string const& text, cmListFileBacktrace const& backtrace = cmListFileBacktrace()) const; @@ -24,16 +20,42 @@ public: void DisplayMessage(cmake::MessageType t, std::string const& text, cmListFileBacktrace const& backtrace) const; - bool GetSuppressDevWarnings() const; - bool GetSuppressDeprecatedWarnings() const; - bool GetDevWarningsAsErrors() const; - bool GetDeprecatedWarningsAsErrors() const; + void SetSuppressDevWarnings(bool suppress) + { + this->SuppressDevWarnings = suppress; + } + void SetSuppressDeprecatedWarnings(bool suppress) + { + this->SuppressDeprecatedWarnings = suppress; + } + void SetDevWarningsAsErrors(bool error) + { + this->DevWarningsAsErrors = error; + } + void SetDeprecatedWarningsAsErrors(bool error) + { + this->DeprecatedWarningsAsErrors = error; + } + + bool GetSuppressDevWarnings() const { return this->SuppressDevWarnings; } + bool GetSuppressDeprecatedWarnings() const + { + return this->SuppressDeprecatedWarnings; + } + bool GetDevWarningsAsErrors() const { return this->DevWarningsAsErrors; } + bool GetDeprecatedWarningsAsErrors() const + { + return this->DeprecatedWarningsAsErrors; + } private: bool IsMessageTypeVisible(cmake::MessageType t) const; cmake::MessageType ConvertMessageType(cmake::MessageType t) const; - cmState* State; + bool SuppressDevWarnings = false; + bool SuppressDeprecatedWarnings = false; + bool DevWarningsAsErrors = false; + bool DeprecatedWarningsAsErrors = false; }; #endif diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 2ac7f4d..181522f 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -140,7 +140,7 @@ cmake::cmake(Role role) this->State = new cmState; this->CurrentSnapshot = this->State->CreateBaseSnapshot(); - this->Messenger = new cmMessenger(this->State); + this->Messenger = new cmMessenger; #ifdef __APPLE__ struct rlimit rlp; @@ -1299,6 +1299,23 @@ int cmake::Configure() } } + // Cache variables may have already been set by a previous invocation, + // so we cannot rely on command line options alone. Always ensure our + // messenger is in sync with the cache. + const char* value = this->State->GetCacheEntryValue("CMAKE_WARN_DEPRECATED"); + this->Messenger->SetSuppressDeprecatedWarnings(value && + cmSystemTools::IsOff(value)); + + value = this->State->GetCacheEntryValue("CMAKE_ERROR_DEPRECATED"); + this->Messenger->SetDeprecatedWarningsAsErrors(cmSystemTools::IsOn(value)); + + value = this->State->GetCacheEntryValue("CMAKE_SUPPRESS_DEVELOPER_WARNINGS"); + this->Messenger->SetSuppressDevWarnings(cmSystemTools::IsOn(value)); + + value = this->State->GetCacheEntryValue("CMAKE_SUPPRESS_DEVELOPER_ERRORS"); + this->Messenger->SetDevWarningsAsErrors(value && + cmSystemTools::IsOff(value)); + int ret = this->ActualConfigure(); const char* delCacheVars = this->State->GetGlobalProperty("__CMAKE_DELETE_CACHE_CHANGE_VARS_"); @@ -1691,6 +1708,18 @@ void cmake::AddCacheEntry(const std::string& key, const char* value, this->State->AddCacheEntry(key, value, helpString, cmStateEnums::CacheEntryType(type)); this->UnwatchUnusedCli(key); + + if (key == "CMAKE_WARN_DEPRECATED") { + this->Messenger->SetSuppressDeprecatedWarnings( + value && cmSystemTools::IsOff(value)); + } else if (key == "CMAKE_ERROR_DEPRECATED") { + this->Messenger->SetDeprecatedWarningsAsErrors(cmSystemTools::IsOn(value)); + } else if (key == "CMAKE_SUPPRESS_DEVELOPER_WARNINGS") { + this->Messenger->SetSuppressDevWarnings(cmSystemTools::IsOn(value)); + } else if (key == "CMAKE_SUPPRESS_DEVELOPER_ERRORS") { + this->Messenger->SetDevWarningsAsErrors(value && + cmSystemTools::IsOff(value)); + } } bool cmake::DoWriteGlobVerifyTarget() const ----------------------------------------------------------------------- Summary of changes: Source/cmMessenger.cxx | 34 ---------------------------------- Source/cmMessenger.h | 40 +++++++++++++++++++++++++++++++--------- Source/cmake.cxx | 31 ++++++++++++++++++++++++++++++- 3 files changed, 61 insertions(+), 44 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Jan 3 00:03:05 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 3 Jan 2019 00:03:05 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.2-792-g6b163fc Message-ID: <20190103050305.26FC9113AFB@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 6b163fc6e5b21f5107afab5a270617ae0efc9ace (commit) from 124a8632cbdb88be8e9768a83ddb63790d5bf60f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6b163fc6e5b21f5107afab5a270617ae0efc9ace commit 6b163fc6e5b21f5107afab5a270617ae0efc9ace Author: Kitware Robot AuthorDate: Thu Jan 3 00:01:06 2019 -0500 Commit: Kitware Robot CommitDate: Thu Jan 3 00:01:06 2019 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index a8a16b4..c4b02fa 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 13) -set(CMake_VERSION_PATCH 20190102) +set(CMake_VERSION_PATCH 20190103) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Fri Jan 4 00:03:05 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 4 Jan 2019 00:03:05 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.2-793-g11fcecb Message-ID: <20190104050305.9C793151C@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 11fcecbaadafc86aff75960b4efed06ce76dce74 (commit) from 6b163fc6e5b21f5107afab5a270617ae0efc9ace (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=11fcecbaadafc86aff75960b4efed06ce76dce74 commit 11fcecbaadafc86aff75960b4efed06ce76dce74 Author: Kitware Robot AuthorDate: Fri Jan 4 00:01:04 2019 -0500 Commit: Kitware Robot CommitDate: Fri Jan 4 00:01:04 2019 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index c4b02fa..69e5eae 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 13) -set(CMake_VERSION_PATCH 20190103) +set(CMake_VERSION_PATCH 20190104) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Fri Jan 4 05:23:08 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 4 Jan 2019 05:23:08 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.2-795-ge7a88ce Message-ID: <20190104102308.3C90918850@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via e7a88ce48243b953c4234692726c7f663212e5cd (commit) via 9816748847fba47bb0633b49cff1432fd677897e (commit) from 11fcecbaadafc86aff75960b4efed06ce76dce74 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e7a88ce48243b953c4234692726c7f663212e5cd commit e7a88ce48243b953c4234692726c7f663212e5cd Merge: 11fcecb 9816748 Author: Marc Chevrier AuthorDate: Fri Jan 4 05:16:41 2019 -0500 Commit: Marc Chevrier CommitDate: Fri Jan 4 05:16:41 2019 -0500 Merge branch 'swig_src_file_ext' into 'master' UseSWIG: Add support for custom Swig source file extensions Closes #18727 See merge request cmake/cmake!2764 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9816748847fba47bb0633b49cff1432fd677897e commit 9816748847fba47bb0633b49cff1432fd677897e Author: Thirumal Venkat AuthorDate: Sat Dec 29 22:15:26 2018 +0530 Commit: Thirumal Venkat CommitDate: Thu Jan 3 09:36:15 2019 +0530 SWIG: Add support for custom Swig source file extensions diff --git a/Help/release/dev/UseSWIG-source-file-ext.rst b/Help/release/dev/UseSWIG-source-file-ext.rst new file mode 100644 index 0000000..5d11dc6 --- /dev/null +++ b/Help/release/dev/UseSWIG-source-file-ext.rst @@ -0,0 +1,5 @@ +UseSWIG-source-file-ext +----------------------- + +* The :module:`UseSWIG` module gains capability to specify + ``SWIG`` source file extensions. diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index a3d6d9e..18ea55c 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -75,7 +75,8 @@ Defines the following command for use with ``SWIG``: ``SOURCES`` List of sources for the library. Files with extension ``.i`` will be identified as sources for the ``SWIG`` tool. Other files will be handled in - the standard way. + the standard way. This behavior can be overriden by specifying the variable + ``SWIG_SOURCE_FILE_EXTENSIONS``. .. note:: @@ -222,6 +223,15 @@ as well as ``SWIG``: ``SWIG_MODULE__EXTRA_DEPS`` Specify extra dependencies for the generated module for ````. + +``SWIG_SOURCE_FILE_EXTENSIONS`` + Specify a list of source file extensions to override the default + behavior of considering only ``.i`` files as sources for the ``SWIG`` + tool. For example: + + .. code-block:: cmake + + set(SWIG_SOURCE_FILE_EXTENSIONS ".i" ".swg") #]=======================================================================] cmake_policy(GET CMP0078 target_name_policy) @@ -659,8 +669,20 @@ function(SWIG_ADD_LIBRARY name) set(CMAKE_SWIG_OUTDIR "${outputdir}") set(SWIG_OUTFILE_DIR "${outfiledir}") + # See if the user has specified source extensions for swig files? + if (NOT DEFINED SWIG_SOURCE_FILE_EXTENSIONS) + # Assume the default (*.i) file extension for Swig source files + set(SWIG_SOURCE_FILE_EXTENSIONS ".i") + endif() + + # Generate a regex out of file extensions. + string(REGEX REPLACE "([$^.*+?|()-])" "\\\\\\1" swig_source_ext_regex "${SWIG_SOURCE_FILE_EXTENSIONS}") + list (JOIN swig_source_ext_regex "|" swig_source_ext_regex) + string (PREPEND swig_source_ext_regex "(") + string (APPEND swig_source_ext_regex ")$") + set(swig_dot_i_sources ${_SAM_SOURCES}) - list(FILTER swig_dot_i_sources INCLUDE REGEX "\\.i$") + list(FILTER swig_dot_i_sources INCLUDE REGEX ${swig_source_ext_regex}) if (NOT swig_dot_i_sources) message(FATAL_ERROR "SWIG_ADD_LIBRARY: no SWIG interface files specified") endif() diff --git a/Tests/UseSWIG/CMakeLists.txt b/Tests/UseSWIG/CMakeLists.txt index f79cda6..434895e 100644 --- a/Tests/UseSWIG/CMakeLists.txt +++ b/Tests/UseSWIG/CMakeLists.txt @@ -111,3 +111,15 @@ add_test(NAME UseSWIG.ModuleName COMMAND --build-options ${build_options} --test-command ${CMAKE_CTEST_COMMAND} -V -C $ ) + + +add_test(NAME UseSWIG.SwigSrcFileExtension COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/UseSWIG/SwigSrcFileExtension" + "${CMake_BINARY_DIR}/Tests/UseSWIG/SwigSrcFileExtension" + ${build_generator_args} + --build-project SwigSrcFileExtension + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) diff --git a/Tests/UseSWIG/SwigSrcFileExtension/CMakeLists.txt b/Tests/UseSWIG/SwigSrcFileExtension/CMakeLists.txt new file mode 100644 index 0000000..7eb73d4 --- /dev/null +++ b/Tests/UseSWIG/SwigSrcFileExtension/CMakeLists.txt @@ -0,0 +1,28 @@ +cmake_minimum_required(VERSION 3.1...3.14) + +project(SwigSrcFileExtension C) + +include(CTest) +find_package(SWIG REQUIRED) +find_package(Python COMPONENTS Interpreter Development REQUIRED) + +include(${SWIG_USE_FILE}) + +# Use the newer target name preference +set(UseSWIG_TARGET_NAME_PREFERENCE "STANDARD") + +# Set the custom source file extension to both .i and .swg +set(SWIG_SOURCE_FILE_EXTENSIONS ".i" ".swg") + +# Generate a Python module out of `.i` +swig_add_library(my_add LANGUAGE python SOURCES my_add.i) +target_link_libraries(my_add Python::Python) + +# Generate a Python module out of `.swg` +swig_add_library(my_sub LANGUAGE python SOURCES my_sub.swg) +target_link_libraries(my_sub Python::Python) + +# Add a test +add_test(NAME SwigSrcFileExtension + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}" + "${Python_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/runme.py") diff --git a/Tests/UseSWIG/SwigSrcFileExtension/my_add.i b/Tests/UseSWIG/SwigSrcFileExtension/my_add.i new file mode 100644 index 0000000..d087ab5 --- /dev/null +++ b/Tests/UseSWIG/SwigSrcFileExtension/my_add.i @@ -0,0 +1,9 @@ +%module my_add + +%{ +int add(int a, int b) { + return a + b; +} +%} + +int add(int a, int b); diff --git a/Tests/UseSWIG/SwigSrcFileExtension/my_sub.swg b/Tests/UseSWIG/SwigSrcFileExtension/my_sub.swg new file mode 100644 index 0000000..df34b44 --- /dev/null +++ b/Tests/UseSWIG/SwigSrcFileExtension/my_sub.swg @@ -0,0 +1,9 @@ +%module my_sub + +%{ +int sub(int a, int b) { + return a - b; +} +%} + +int sub(int a, int b); diff --git a/Tests/UseSWIG/SwigSrcFileExtension/runme.py b/Tests/UseSWIG/SwigSrcFileExtension/runme.py new file mode 100755 index 0000000..290175b --- /dev/null +++ b/Tests/UseSWIG/SwigSrcFileExtension/runme.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python + +from __future__ import print_function +import random + +import my_add +import my_sub + + +# These can be changed, but make sure not to overflow `int` +a = random.randint(1, 1024) +b = random.randint(1, 1024) + +if my_add.add(a, b) == a + b: + print ("Test 1 Passed for SWIG custom source file extension") +else: + print ("Test 1 FAILED for SWIG custom source file extension") + exit(1) + +if my_sub.sub(a, b) == a - b: + print ("Test 2 Passed for SWIG custom source file extension") +else: + print ("Test 2 FAILED for SWIG custom source file extension") + exit(1) ----------------------------------------------------------------------- Summary of changes: Help/release/dev/UseSWIG-source-file-ext.rst | 5 ++++ Modules/UseSWIG.cmake | 26 +++++++++++++++++++-- Tests/UseSWIG/CMakeLists.txt | 12 ++++++++++ Tests/UseSWIG/SwigSrcFileExtension/CMakeLists.txt | 28 +++++++++++++++++++++++ Tests/UseSWIG/SwigSrcFileExtension/my_add.i | 9 ++++++++ Tests/UseSWIG/SwigSrcFileExtension/my_sub.swg | 9 ++++++++ Tests/UseSWIG/SwigSrcFileExtension/runme.py | 24 +++++++++++++++++++ 7 files changed, 111 insertions(+), 2 deletions(-) create mode 100644 Help/release/dev/UseSWIG-source-file-ext.rst create mode 100644 Tests/UseSWIG/SwigSrcFileExtension/CMakeLists.txt create mode 100644 Tests/UseSWIG/SwigSrcFileExtension/my_add.i create mode 100644 Tests/UseSWIG/SwigSrcFileExtension/my_sub.swg create mode 100755 Tests/UseSWIG/SwigSrcFileExtension/runme.py hooks/post-receive -- CMake From kwrobot at kitware.com Fri Jan 4 16:53:05 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 4 Jan 2019 16:53:05 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.2-799-gf789441 Message-ID: <20190104215305.ACFA61135E8@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via f789441179fb4bc8df01d6a5ec6c235553164d3e (commit) via aaf7c94ddb9d906baff34141e65623e2bee98020 (commit) via 77d83568e0aa96c34520b78e3671aa0d140a158e (commit) via 1b135cdff26e36fdd846edd2625e7edd7943b0b4 (commit) from e7a88ce48243b953c4234692726c7f663212e5cd (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f789441179fb4bc8df01d6a5ec6c235553164d3e commit f789441179fb4bc8df01d6a5ec6c235553164d3e Merge: aaf7c94 1b135cd Author: Craig Scott AuthorDate: Fri Jan 4 21:48:59 2019 +0000 Commit: Kitware Robot CommitDate: Fri Jan 4 16:49:07 2019 -0500 Merge topic 'remove-std-iterator' 1b135cdff2 cmLinkedTree: Remove deprecated std::iterator Acked-by: Kitware Robot Merge-request: !2767 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=aaf7c94ddb9d906baff34141e65623e2bee98020 commit aaf7c94ddb9d906baff34141e65623e2bee98020 Merge: e7a88ce 77d8356 Author: Craig Scott AuthorDate: Fri Jan 4 21:46:38 2019 +0000 Commit: Kitware Robot CommitDate: Fri Jan 4 16:47:01 2019 -0500 Merge topic 'get-ide-version-const' 77d83568e0 cmGlobalVisualStudioGenerator::GetIDEVersion(): const added Acked-by: Kitware Robot Merge-request: !2769 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=77d83568e0aa96c34520b78e3671aa0d140a158e commit 77d83568e0aa96c34520b78e3671aa0d140a158e Author: Vitaly Stakhovsky AuthorDate: Wed Jan 2 08:25:49 2019 -0500 Commit: Vitaly Stakhovsky CommitDate: Wed Jan 2 08:25:49 2019 -0500 cmGlobalVisualStudioGenerator::GetIDEVersion(): const added diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 15244ac..dc49ded 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -140,7 +140,7 @@ protected: virtual bool SelectWindowsPhoneToolset(std::string& toolset) const; virtual bool SelectWindowsStoreToolset(std::string& toolset) const; - const char* GetIDEVersion() override { return "10.0"; } + const char* GetIDEVersion() const override { return "10.0"; } std::string const& GetMSBuildCommand(); diff --git a/Source/cmGlobalVisualStudio11Generator.h b/Source/cmGlobalVisualStudio11Generator.h index 624bf36..5b089a4 100644 --- a/Source/cmGlobalVisualStudio11Generator.h +++ b/Source/cmGlobalVisualStudio11Generator.h @@ -43,7 +43,7 @@ protected: bool IsWindowsPhoneToolsetInstalled() const; bool IsWindowsStoreToolsetInstalled() const; - const char* GetIDEVersion() override { return "11.0"; } + const char* GetIDEVersion() const override { return "11.0"; } bool UseFolderProperty() const override; static std::set GetInstalledWindowsCESDKs(); diff --git a/Source/cmGlobalVisualStudio12Generator.h b/Source/cmGlobalVisualStudio12Generator.h index 9d6554a..ae78de7 100644 --- a/Source/cmGlobalVisualStudio12Generator.h +++ b/Source/cmGlobalVisualStudio12Generator.h @@ -48,7 +48,7 @@ protected: // of the toolset is installed bool IsWindowsPhoneToolsetInstalled() const; bool IsWindowsStoreToolsetInstalled() const; - const char* GetIDEVersion() override { return "12.0"; } + const char* GetIDEVersion() const override { return "12.0"; } private: class Factory; diff --git a/Source/cmGlobalVisualStudio14Generator.h b/Source/cmGlobalVisualStudio14Generator.h index 9f5bb4e..4bc430b 100644 --- a/Source/cmGlobalVisualStudio14Generator.h +++ b/Source/cmGlobalVisualStudio14Generator.h @@ -41,7 +41,7 @@ protected: // version of the toolset. virtual std::string GetWindows10SDKMaxVersion() const; - const char* GetIDEVersion() override { return "14.0"; } + const char* GetIDEVersion() const override { return "14.0"; } virtual bool SelectWindows10SDK(cmMakefile* mf, bool required); // Used to verify that the Desktop toolset for the current generator is diff --git a/Source/cmGlobalVisualStudio15Generator.h b/Source/cmGlobalVisualStudio15Generator.h index 8ab63f1..68aa14f 100644 --- a/Source/cmGlobalVisualStudio15Generator.h +++ b/Source/cmGlobalVisualStudio15Generator.h @@ -39,7 +39,7 @@ protected: bool InitializeWindows(cmMakefile* mf) override; bool SelectWindowsStoreToolset(std::string& toolset) const override; - const char* GetIDEVersion() override { return "15.0"; } + const char* GetIDEVersion() const override { return "15.0"; } // Used to verify that the Desktop toolset for the current generator is // installed on the machine. diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index 59e7a98..12a86f2 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -111,7 +111,6 @@ public: protected: void Generate() override; - virtual const char* GetIDEVersion() = 0; std::string const& GetDevEnvCommand(); virtual std::string FindDevEnvCommand(); diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h index a431cc1..a21c53d 100644 --- a/Source/cmGlobalVisualStudio8Generator.h +++ b/Source/cmGlobalVisualStudio8Generator.h @@ -49,7 +49,7 @@ public: protected: void AddExtraIDETargets() override; - const char* GetIDEVersion() override { return "8.0"; } + const char* GetIDEVersion() const override { return "8.0"; } std::string FindDevEnvCommand() override; diff --git a/Source/cmGlobalVisualStudio9Generator.h b/Source/cmGlobalVisualStudio9Generator.h index 2aa6a91..ee17c37 100644 --- a/Source/cmGlobalVisualStudio9Generator.h +++ b/Source/cmGlobalVisualStudio9Generator.h @@ -37,7 +37,7 @@ public: std::string GetUserMacrosRegKeyBase() override; protected: - const char* GetIDEVersion() override { return "9.0"; } + const char* GetIDEVersion() const override { return "9.0"; } private: class Factory; diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index 4a7705d..c891160 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -137,7 +137,7 @@ protected: // below 8. virtual bool VSLinksDependencies() const { return true; } - virtual const char* GetIDEVersion() = 0; + virtual const char* GetIDEVersion() const = 0; bool ComputeTargetDepends() override; class VSDependSet : public std::set https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1b135cdff26e36fdd846edd2625e7edd7943b0b4 commit 1b135cdff26e36fdd846edd2625e7edd7943b0b4 Author: Vitaly Stakhovsky AuthorDate: Sun Dec 30 15:55:14 2018 -0500 Commit: Vitaly Stakhovsky CommitDate: Tue Jan 1 16:51:50 2019 -0500 cmLinkedTree: Remove deprecated std::iterator diff --git a/Source/cmLinkedTree.h b/Source/cmLinkedTree.h index 975f052..099fb6d 100644 --- a/Source/cmLinkedTree.h +++ b/Source/cmLinkedTree.h @@ -6,7 +6,6 @@ #include "cmConfigure.h" // IWYU pragma: keep #include -#include #include /** @@ -33,7 +32,7 @@ class cmLinkedTree typedef T& ReferenceType; public: - class iterator : public std::iterator + class iterator { friend class cmLinkedTree; cmLinkedTree* Tree; ----------------------------------------------------------------------- Summary of changes: Source/cmGlobalVisualStudio10Generator.h | 2 +- Source/cmGlobalVisualStudio11Generator.h | 2 +- Source/cmGlobalVisualStudio12Generator.h | 2 +- Source/cmGlobalVisualStudio14Generator.h | 2 +- Source/cmGlobalVisualStudio15Generator.h | 2 +- Source/cmGlobalVisualStudio7Generator.h | 1 - Source/cmGlobalVisualStudio8Generator.h | 2 +- Source/cmGlobalVisualStudio9Generator.h | 2 +- Source/cmGlobalVisualStudioGenerator.h | 2 +- Source/cmLinkedTree.h | 3 +-- 10 files changed, 9 insertions(+), 11 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Sat Jan 5 00:03:06 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Sat, 5 Jan 2019 00:03:06 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.2-800-g662ab10 Message-ID: <20190105050306.477561264E9@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 662ab10bc2ec952b89b6a6f5824caf608734051f (commit) from f789441179fb4bc8df01d6a5ec6c235553164d3e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=662ab10bc2ec952b89b6a6f5824caf608734051f commit 662ab10bc2ec952b89b6a6f5824caf608734051f Author: Kitware Robot AuthorDate: Sat Jan 5 00:01:05 2019 -0500 Commit: Kitware Robot CommitDate: Sat Jan 5 00:01:05 2019 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 69e5eae..a288ea4 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 13) -set(CMake_VERSION_PATCH 20190104) +set(CMake_VERSION_PATCH 20190105) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Sun Jan 6 00:03:04 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Sun, 6 Jan 2019 00:03:04 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.2-801-gd3e0e65 Message-ID: <20190106050304.E708C11362D@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via d3e0e65de3dc8fbc8b96ef9780bffe7390bf6b70 (commit) from 662ab10bc2ec952b89b6a6f5824caf608734051f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d3e0e65de3dc8fbc8b96ef9780bffe7390bf6b70 commit d3e0e65de3dc8fbc8b96ef9780bffe7390bf6b70 Author: Kitware Robot AuthorDate: Sun Jan 6 00:01:04 2019 -0500 Commit: Kitware Robot CommitDate: Sun Jan 6 00:01:04 2019 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index a288ea4..cdc1662 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 13) -set(CMake_VERSION_PATCH 20190105) +set(CMake_VERSION_PATCH 20190106) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Sun Jan 6 15:13:05 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Sun, 6 Jan 2019 15:13:05 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.2-807-g99a0a6d Message-ID: <20190106201305.BC8DC111905@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 99a0a6d8163f27daf08e53da95b8c685bcd5189e (commit) via 08be74bfd7e24af9ffdb64dddffd3d56bf52c3ce (commit) via 52445300d67df73b5b8c288cc33c915053c7ba24 (commit) via 1bac4678eaf7beefb12ad91ecdea0e551b4d0fcf (commit) via 5072598f0795f44e157bef8423feda7de24c5504 (commit) via 428680da92b98755be1a908ee4a5d705d8753bb9 (commit) from d3e0e65de3dc8fbc8b96ef9780bffe7390bf6b70 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=99a0a6d8163f27daf08e53da95b8c685bcd5189e commit 99a0a6d8163f27daf08e53da95b8c685bcd5189e Merge: d3e0e65 08be74b Author: Craig Scott AuthorDate: Sun Jan 6 20:05:18 2019 +0000 Commit: Kitware Robot CommitDate: Sun Jan 6 15:05:32 2019 -0500 Merge topic 'bundle_fixes' 08be74bfd7 GetPrerequisites: Fix handling of executable scripts 52445300d6 GetPrerequisites: Allow prefixed tools 1bac4678ea GetPrerequisites: Add GET_PREREQUISITES_VERBOSE to set verbose 5072598f07 BundleUtilites: Don't use hardcoded name for install_name_tool 428680da92 GetPrerequisites: Don't use hardcoded name for otool Acked-by: Kitware Robot Merge-request: !2748 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=08be74bfd7e24af9ffdb64dddffd3d56bf52c3ce commit 08be74bfd7e24af9ffdb64dddffd3d56bf52c3ce Author: Alexander Grund AuthorDate: Sun Dec 16 18:05:23 2018 +0100 Commit: Craig Scott CommitDate: Sat Jan 5 09:09:39 2019 +1100 GetPrerequisites: Fix handling of executable scripts Fixes: #18667 diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index d3b773c..fa6d75a 100644 --- a/Modules/GetPrerequisites.cmake +++ b/Modules/GetPrerequisites.cmake @@ -660,6 +660,15 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa return() endif() + # Check for a script by extension (.bat,.sh,...) or if the file starts with "#!" (shebang) + file(READ ${target} file_contents LIMIT 5) + if(target MATCHES "\\.(bat|c?sh|bash|ksh|cmd)$" OR file_contents MATCHES "^#!") + message(STATUS "GetPrequisites(${target}) : ignoring script file") + # Clear var + set(${prerequisites_var} "" PARENT_SCOPE) + return() + endif() + set(gp_cmd_paths ${gp_cmd_paths} "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\14.0;InstallDir]/../../VC/bin" "$ENV{VS140COMNTOOLS}/../../VC/bin" diff --git a/Tests/RunCMake/GetPrerequisites/ExecutableScripts-stdout.txt b/Tests/RunCMake/GetPrerequisites/ExecutableScripts-stdout.txt new file mode 100644 index 0000000..5a353d8 --- /dev/null +++ b/Tests/RunCMake/GetPrerequisites/ExecutableScripts-stdout.txt @@ -0,0 +1,3 @@ +-- GetPrequisites\(.*script.sh\) : ignoring script file +-- GetPrequisites\(.*script.bat\) : ignoring script file +-- GetPrequisites\(.*script\) : ignoring script file diff --git a/Tests/RunCMake/GetPrerequisites/ExecutableScripts.cmake b/Tests/RunCMake/GetPrerequisites/ExecutableScripts.cmake new file mode 100644 index 0000000..d1bc9b1 --- /dev/null +++ b/Tests/RunCMake/GetPrerequisites/ExecutableScripts.cmake @@ -0,0 +1,19 @@ +include(GetPrerequisites) + +function(check_script script) + set(prereqs "") + get_prerequisites(${script} prereqs 1 1 "" "") + if(NOT "${prereqs}" STREQUAL "") + message(FATAL_ERROR "Prerequisites for ${script} not empty") + endif() +endfunction() + +# Should not throw any errors +# Regular executable +get_prerequisites(${CMAKE_COMMAND} cmake_prereqs 1 1 "" "") +# Shell script +check_script(${CMAKE_CURRENT_LIST_DIR}/script.sh) +# Batch script +check_script(${CMAKE_CURRENT_LIST_DIR}/script.bat) +# Shell script without extension +check_script(${CMAKE_CURRENT_LIST_DIR}/script) diff --git a/Tests/RunCMake/GetPrerequisites/RunCMakeTest.cmake b/Tests/RunCMake/GetPrerequisites/RunCMakeTest.cmake index 3856c54..a635e38 100644 --- a/Tests/RunCMake/GetPrerequisites/RunCMakeTest.cmake +++ b/Tests/RunCMake/GetPrerequisites/RunCMakeTest.cmake @@ -1,3 +1,4 @@ include(RunCMake) run_cmake_command(TargetMissing ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/TargetMissing.cmake) +run_cmake_command(ExecutableScripts ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/ExecutableScripts.cmake) diff --git a/Tests/RunCMake/GetPrerequisites/script b/Tests/RunCMake/GetPrerequisites/script new file mode 100755 index 0000000..23bf47c --- /dev/null +++ b/Tests/RunCMake/GetPrerequisites/script @@ -0,0 +1,3 @@ +#!/bin/bash + +echo "Hello World" diff --git a/Tests/RunCMake/GetPrerequisites/script.bat b/Tests/RunCMake/GetPrerequisites/script.bat new file mode 100755 index 0000000..dbb0ec2 --- /dev/null +++ b/Tests/RunCMake/GetPrerequisites/script.bat @@ -0,0 +1,3 @@ + at echo off + +echo "Hello world" diff --git a/Tests/RunCMake/GetPrerequisites/script.sh b/Tests/RunCMake/GetPrerequisites/script.sh new file mode 100755 index 0000000..23bf47c --- /dev/null +++ b/Tests/RunCMake/GetPrerequisites/script.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +echo "Hello World" https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=52445300d67df73b5b8c288cc33c915053c7ba24 commit 52445300d67df73b5b8c288cc33c915053c7ba24 Author: Alexander Grund AuthorDate: Sun Dec 16 17:18:41 2018 +0100 Commit: Craig Scott CommitDate: Mon Dec 31 11:56:40 2018 +1100 GetPrerequisites: Allow prefixed tools e.g. for cross-compilation with e.g. x86_64-pc-linux-gnu-ldd diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index fea299c..d3b773c 100644 --- a/Modules/GetPrerequisites.cmake +++ b/Modules/GetPrerequisites.cmake @@ -718,25 +718,25 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa set(gp_cmd_maybe_filter) # optional command to pre-filter gp_tool results - if(gp_tool STREQUAL "ldd") + if(gp_tool MATCHES "ldd$") set(gp_cmd_args "") set(gp_regex "^[\t ]*[^\t ]+ => ([^\t\(]+) .*${eol_char}$") set(gp_regex_error "not found${eol_char}$") set(gp_regex_fallback "^[\t ]*([^\t ]+) => ([^\t ]+).*${eol_char}$") set(gp_regex_cmp_count 1) - elseif(gp_tool STREQUAL "otool") + elseif(gp_tool MATCHES "otool$") set(gp_cmd_args "-L") set(gp_regex "^\t([^\t]+) \\(compatibility version ([0-9]+.[0-9]+.[0-9]+), current version ([0-9]+.[0-9]+.[0-9]+)\\)${eol_char}$") set(gp_regex_error "") set(gp_regex_fallback "") set(gp_regex_cmp_count 3) - elseif(gp_tool STREQUAL "dumpbin") + elseif(gp_tool MATCHES "dumpbin$") set(gp_cmd_args "/dependents") set(gp_regex "^ ([^ ].*[Dd][Ll][Ll])${eol_char}$") set(gp_regex_error "") set(gp_regex_fallback "") set(gp_regex_cmp_count 1) - elseif(gp_tool STREQUAL "objdump") + elseif(gp_tool MATCHES "objdump$") set(gp_cmd_args "-p") set(gp_regex "^\t*DLL Name: (.*\\.[Dd][Ll][Ll])${eol_char}$") set(gp_regex_error "") @@ -759,7 +759,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa endif() - if(gp_tool STREQUAL "dumpbin") + if(gp_tool MATCHES "dumpbin$") # When running dumpbin, it also needs the "Common7/IDE" directory in the # PATH. It will already be in the PATH if being run from a Visual Studio # command prompt. Add it to the PATH here in case we are running from a @@ -788,7 +788,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa # # - if(gp_tool STREQUAL "ldd") + if(gp_tool MATCHES "ldd$") set(old_ld_env "$ENV{LD_LIBRARY_PATH}") set(new_ld_env "${exepath}") foreach(dir ${dirs}) @@ -813,7 +813,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa ERROR_VARIABLE gp_ev ) - if(gp_tool STREQUAL "dumpbin") + if(gp_tool MATCHES "dumpbin$") # Exclude delay load dependencies under windows (they are listed in dumpbin output after the message below) string(FIND "${gp_cmd_ov}" "Image has the following delay load dependencies" gp_delayload_pos) if (${gp_delayload_pos} GREATER -1) @@ -827,7 +827,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa endif() if(NOT gp_rv STREQUAL "0") - if(gp_tool STREQUAL "dumpbin") + if(gp_tool MATCHES "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() @@ -835,7 +835,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa endif() endif() - if(gp_tool STREQUAL "ldd") + if(gp_tool MATCHES "ldd$") set(ENV{LD_LIBRARY_PATH} "${old_ld_env}") endif() @@ -855,7 +855,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa # check for install id and remove it from list, since otool -L can include a # reference to itself set(gp_install_id) - if(gp_tool STREQUAL "otool") + if(gp_tool MATCHES "otool$") execute_process( COMMAND ${gp_cmd} -D ${target} RESULT_VARIABLE otool_rv https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1bac4678eaf7beefb12ad91ecdea0e551b4d0fcf commit 1bac4678eaf7beefb12ad91ecdea0e551b4d0fcf Author: Alexander Grund AuthorDate: Sun Dec 16 17:14:23 2018 +0100 Commit: Craig Scott CommitDate: Mon Dec 31 11:56:40 2018 +1100 GetPrerequisites: Add GET_PREREQUISITES_VERBOSE to set verbose diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index 8d54fed..fea299c 100644 --- a/Modules/GetPrerequisites.cmake +++ b/Modules/GetPrerequisites.cmake @@ -63,6 +63,9 @@ searched first when a target without any path info is given. Then standard system locations are also searched: PATH, Framework locations, /usr/lib... +The variable GET_PREREQUISITES_VERBOSE can be set to true to enable verbose +output. + :: LIST_PREREQUISITES( [ [ []]]) @@ -644,6 +647,10 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa set(rpaths "") endif() + if(GET_PREREQUISITES_VERBOSE) + set(verbose 1) + endif() + if(NOT IS_ABSOLUTE "${target}") message("warning: target '${target}' is not absolute...") endif() https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5072598f0795f44e157bef8423feda7de24c5504 commit 5072598f0795f44e157bef8423feda7de24c5504 Author: Alexander Grund AuthorDate: Sun Dec 30 15:17:35 2018 +0100 Commit: Craig Scott CommitDate: Mon Dec 31 11:56:40 2018 +1100 BundleUtilites: Don't use hardcoded name for install_name_tool diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake index 10e5510..d5c47f8 100644 --- a/Modules/BundleUtilities.cmake +++ b/Modules/BundleUtilities.cmake @@ -877,9 +877,13 @@ function(fixup_bundle_item resolved_embedded_item exepath dirs) execute_process(COMMAND chmod u+w "${resolved_embedded_item}") endif() + # CMAKE_INSTALL_NAME_TOOL may not be set if executed in script mode + # Duplicated from CMakeFindBinUtils.cmake + find_program(CMAKE_INSTALL_NAME_TOOL NAMES install_name_tool HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) + # Only if install_name_tool supports -delete_rpath: # - execute_process(COMMAND install_name_tool + execute_process(COMMAND ${CMAKE_INSTALL_NAME_TOOL} OUTPUT_VARIABLE install_name_tool_usage ERROR_VARIABLE install_name_tool_usage ) @@ -897,7 +901,7 @@ function(fixup_bundle_item resolved_embedded_item exepath dirs) # to install_name_tool: # if(changes) - set(cmd install_name_tool ${changes} "${resolved_embedded_item}") + set(cmd ${CMAKE_INSTALL_NAME_TOOL} ${changes} "${resolved_embedded_item}") execute_process(COMMAND ${cmd} RESULT_VARIABLE install_name_tool_result) if(NOT install_name_tool_result EQUAL 0) string(REPLACE ";" "' '" msg "'${cmd}'") https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=428680da92b98755be1a908ee4a5d705d8753bb9 commit 428680da92b98755be1a908ee4a5d705d8753bb9 Author: Alexander Grund AuthorDate: Sun Dec 30 15:08:49 2018 +0100 Commit: Alexander Grund CommitDate: Sun Dec 30 15:08:49 2018 +0100 GetPrerequisites: Don't use hardcoded name for otool diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index 5b32f7c..8d54fed 100644 --- a/Modules/GetPrerequisites.cmake +++ b/Modules/GetPrerequisites.cmake @@ -850,7 +850,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa set(gp_install_id) if(gp_tool STREQUAL "otool") execute_process( - COMMAND otool -D ${target} + COMMAND ${gp_cmd} -D ${target} RESULT_VARIABLE otool_rv OUTPUT_VARIABLE gp_install_id_ov ERROR_VARIABLE otool_ev ----------------------------------------------------------------------- Summary of changes: Modules/BundleUtilities.cmake | 8 +++-- Modules/GetPrerequisites.cmake | 38 +++++++++++++++------- .../GetPrerequisites/ExecutableScripts-stdout.txt | 3 ++ .../GetPrerequisites/ExecutableScripts.cmake | 19 +++++++++++ Tests/RunCMake/GetPrerequisites/RunCMakeTest.cmake | 1 + Tests/RunCMake/GetPrerequisites/script | 3 ++ Tests/RunCMake/GetPrerequisites/script.bat | 3 ++ Tests/RunCMake/GetPrerequisites/script.sh | 3 ++ 8 files changed, 65 insertions(+), 13 deletions(-) create mode 100644 Tests/RunCMake/GetPrerequisites/ExecutableScripts-stdout.txt create mode 100644 Tests/RunCMake/GetPrerequisites/ExecutableScripts.cmake create mode 100755 Tests/RunCMake/GetPrerequisites/script create mode 100755 Tests/RunCMake/GetPrerequisites/script.bat create mode 100755 Tests/RunCMake/GetPrerequisites/script.sh hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jan 7 00:03:04 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 7 Jan 2019 00:03:04 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.2-808-gc1e9b1c Message-ID: <20190107050304.A228E125CBF@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via c1e9b1c283caccd468adfafd0496edd63964b899 (commit) from 99a0a6d8163f27daf08e53da95b8c685bcd5189e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c1e9b1c283caccd468adfafd0496edd63964b899 commit c1e9b1c283caccd468adfafd0496edd63964b899 Author: Kitware Robot AuthorDate: Mon Jan 7 00:01:06 2019 -0500 Commit: Kitware Robot CommitDate: Mon Jan 7 00:01:06 2019 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index cdc1662..58df3d9 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 13) -set(CMake_VERSION_PATCH 20190106) +set(CMake_VERSION_PATCH 20190107) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jan 7 15:33:05 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 7 Jan 2019 15:33:05 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.2-811-g6f904d0 Message-ID: <20190107203305.CCFBA125443@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 6f904d01009bf26d129b2a2f0335e99bf30732ac (commit) via 37c6a02dc27154881c8b6b03beb7a17528ed5907 (commit) via 7583f7490e23e025d9072533990f7cd9fec4b61d (commit) from c1e9b1c283caccd468adfafd0496edd63964b899 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6f904d01009bf26d129b2a2f0335e99bf30732ac commit 6f904d01009bf26d129b2a2f0335e99bf30732ac Merge: c1e9b1c 37c6a02 Author: Craig Scott AuthorDate: Mon Jan 7 20:26:44 2019 +0000 Commit: Kitware Robot CommitDate: Mon Jan 7 15:26:55 2019 -0500 Merge topic 'nmake-compile-commands' 37c6a02dc2 CMake: fix nmake compile_commands generation 7583f7490e cmGlobalGenerator: Teach EscapeJSON to escape newlines and tabs Acked-by: Kitware Robot Merge-request: !2648 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=37c6a02dc27154881c8b6b03beb7a17528ed5907 commit 37c6a02dc27154881c8b6b03beb7a17528ed5907 Author: Yan Pashkovsky AuthorDate: Fri Dec 14 18:23:53 2018 +0300 Commit: Yan Pashkovsky CommitDate: Fri Dec 14 18:23:53 2018 +0300 CMake: fix nmake compile_commands generation diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 9acae49..0ea9724 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -687,6 +687,17 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile( std::string langIncludes = std::string("$(") + lang + "_INCLUDES)"; compileCommand.replace(compileCommand.find(langIncludes), langIncludes.size(), this->GetIncludes(lang)); + + const char* eliminate[] = { + this->Makefile->GetDefinition("CMAKE_START_TEMP_FILE"), + this->Makefile->GetDefinition("CMAKE_END_TEMP_FILE") + }; + for (const char* el : eliminate) { + if (el) { + cmSystemTools::ReplaceString(compileCommand, el, ""); + } + } + this->GlobalGenerator->AddCXXCompileCommand( source.GetFullPath(), workingDirectory, compileCommand); } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7583f7490e23e025d9072533990f7cd9fec4b61d commit 7583f7490e23e025d9072533990f7cd9fec4b61d Author: Yan Pashkovsky AuthorDate: Fri Dec 14 18:23:20 2018 +0300 Commit: Yan Pashkovsky CommitDate: Fri Dec 14 18:23:20 2018 +0300 cmGlobalGenerator: Teach EscapeJSON to escape newlines and tabs diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 2805395..9326e5f 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -3014,11 +3014,23 @@ void cmGlobalGenerator::WriteSummary(cmGeneratorTarget* target) std::string cmGlobalGenerator::EscapeJSON(const std::string& s) { std::string result; + result.reserve(s.size()); for (char i : s) { - if (i == '"' || i == '\\') { - result += '\\'; + switch (i) { + case '"': + case '\\': + result += '\\'; + result += i; + break; + case '\n': + result += "\\n"; + break; + case '\t': + result += "\\t"; + break; + default: + result += i; } - result += i; } return result; } ----------------------------------------------------------------------- Summary of changes: Source/cmGlobalGenerator.cxx | 18 +++++++++++++++--- Source/cmMakefileTargetGenerator.cxx | 11 +++++++++++ 2 files changed, 26 insertions(+), 3 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jan 7 15:43:04 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 7 Jan 2019 15:43:04 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.2-816-g5b7eb38 Message-ID: <20190107204304.D569F11D88E@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 5b7eb38e8e4711433ba83b22a6a74efd1c6e2de1 (commit) via cbf0c0fce4dfe23912f7cc012c6f0234a5fd694b (commit) via 1d32a35c10b384e8eb0dd2ce68c7bd11424409ac (commit) via 67ac4ed1dc5ad049ab443ce76a3f93b207703cec (commit) via 5257af363442aa4168776b70db1fc58d218a20c8 (commit) from 6f904d01009bf26d129b2a2f0335e99bf30732ac (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5b7eb38e8e4711433ba83b22a6a74efd1c6e2de1 commit 5b7eb38e8e4711433ba83b22a6a74efd1c6e2de1 Merge: 6f904d0 cbf0c0f Author: Craig Scott AuthorDate: Mon Jan 7 20:33:41 2019 +0000 Commit: Kitware Robot CommitDate: Mon Jan 7 15:33:52 2019 -0500 Merge topic 'fix-warn-uninitialized-in-configure' cbf0c0fce4 cmake: Enable --warn-uninitialized inside string(CONFIGURE) and configure_file 1d32a35c10 cmCommandArgumentParserHelper: use cmMakefile::MaybeWarnUninitialized 67ac4ed1dc cmMakefile: Move uninitialized vars logic into MaybeWarnUninitialized() 5257af3634 cmMakefile: move common logic to IsProjectFile function Acked-by: Kitware Robot Merge-request: !2676 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cbf0c0fce4dfe23912f7cc012c6f0234a5fd694b commit cbf0c0fce4dfe23912f7cc012c6f0234a5fd694b Author: Artur Ryt AuthorDate: Thu Dec 13 20:45:17 2018 +0100 Commit: Craig Scott CommitDate: Sun Dec 30 08:31:09 2018 +1100 cmake: Enable --warn-uninitialized inside string(CONFIGURE) and configure_file Fixes: #18489 diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx index f94dc24..ca29967 100644 --- a/Source/cmCommandArgumentParserHelper.cxx +++ b/Source/cmCommandArgumentParserHelper.cxx @@ -92,9 +92,11 @@ const char* cmCommandArgumentParserHelper::ExpandVariable(const char* var) return this->AddString(ostr.str()); } const char* value = this->Makefile->GetDefinition(var); - if (!value && !this->RemoveEmpty) { + if (!value) { this->Makefile->MaybeWarnUninitialized(var, this->FileName); - return nullptr; + if (!this->RemoveEmpty) { + return nullptr; + } } if (this->EscapeQuotes && value) { return this->AddString(cmSystemTools::EscapeQuotes(value)); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 256202c..68a5101 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2522,9 +2522,9 @@ const std::string& cmMakefile::ExpandVariablesInString( // Suppress variable watches to avoid calling hooks twice. Suppress new // dereferences since the OLD behavior is still what is actually used. this->SuppressSideEffects = true; - newError = ExpandVariablesInStringNew( - newErrorstr, newResult, escapeQuotes, noEscapes, atOnly, filename, - line, removeEmpty, replaceAt); + newError = ExpandVariablesInStringNew(newErrorstr, newResult, + escapeQuotes, noEscapes, atOnly, + filename, line, replaceAt); this->SuppressSideEffects = false; CM_FALLTHROUGH; } @@ -2537,9 +2537,9 @@ const std::string& cmMakefile::ExpandVariablesInString( case cmPolicies::REQUIRED_ALWAYS: // Messaging here would be *very* verbose. case cmPolicies::NEW: - mtype = ExpandVariablesInStringNew(errorstr, source, escapeQuotes, - noEscapes, atOnly, filename, line, - removeEmpty, replaceAt); + mtype = + ExpandVariablesInStringNew(errorstr, source, escapeQuotes, noEscapes, + atOnly, filename, line, replaceAt); break; } @@ -2726,7 +2726,7 @@ bool cmMakefile::IsProjectFile(const char* filename) const cmake::MessageType cmMakefile::ExpandVariablesInStringNew( std::string& errorstr, std::string& source, bool escapeQuotes, bool noEscapes, bool atOnly, const char* filename, long line, - bool removeEmpty, bool replaceAt) const + bool replaceAt) const { // This method replaces ${VAR} and @VAR@ where VAR is looked up // with GetDefinition(), if not found in the map, nothing is expanded. @@ -2783,7 +2783,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew( } else { varresult = value; } - } else if (!removeEmpty && !this->SuppressSideEffects) { + } else if (!this->SuppressSideEffects) { this->MaybeWarnUninitialized(lookup, filename); } result.replace(var.loc, result.size() - var.loc, varresult); @@ -2896,7 +2896,12 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew( if (filename && variable == lineVar) { varresult = std::to_string(line); } else { - varresult = this->GetSafeDefinition(variable); + const std::string* def = this->GetDef(variable); + if (def) { + varresult = *def; + } else if (!this->SuppressSideEffects) { + this->MaybeWarnUninitialized(variable, filename); + } } if (escapeQuotes) { diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 1a2a0e7..1607735 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -990,7 +990,7 @@ private: cmake::MessageType ExpandVariablesInStringNew( std::string& errorstr, std::string& source, bool escapeQuotes, bool noEscapes, bool atOnly, const char* filename, long line, - bool removeEmpty, bool replaceAt) const; + bool replaceAt) const; /** * Old version of GetSourceFileWithOutput(const std::string&) kept for * backward-compatibility. It implements a linear search and support diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index a37b7f1..4cd34de 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -350,7 +350,7 @@ set(RunCMake_TEST_OPTIONS --trace-expand --warn-uninitialized) run_cmake(trace-expand-warn-uninitialized) unset(RunCMake_TEST_OPTIONS) -set(RunCMake_TEST_OPTIONS --warn-uninitialized) +set(RunCMake_TEST_OPTIONS -Wno-deprecated --warn-uninitialized) run_cmake(warn-uninitialized) unset(RunCMake_TEST_OPTIONS) diff --git a/Tests/RunCMake/CommandLine/warn-uninitialized-stderr.txt b/Tests/RunCMake/CommandLine/warn-uninitialized-stderr.txt index a13402a..41ba098 100644 --- a/Tests/RunCMake/CommandLine/warn-uninitialized-stderr.txt +++ b/Tests/RunCMake/CommandLine/warn-uninitialized-stderr.txt @@ -1,5 +1,53 @@ -^CMake Warning \(dev\) at warn-uninitialized.cmake:1 \(set\): - uninitialized variable 'WARN_FROM_NORMAL_CMAKE_FILE' +^CMake Warning \(dev\) at warn-uninitialized.cmake:3 \(set\): + uninitialized variable 'OLD_WARN_FROM_NORMAL_CMAKE_FILE_INSIDE_BRACES' +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\) at warn-uninitialized.cmake:4 \(set\): + uninitialized variable 'OLD_WARN_FROM_NORMAL_CMAKE_FILE_IN_ATS' +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\) at warn-uninitialized.cmake:5 \(string\): + uninitialized variable 'OLD_WARN_FROM_STRING_CONFIGURE_INSIDE_BRACES' +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\) at warn-uninitialized.cmake:7 \(configure_file\): + uninitialized variable 'OLD_WARN_FROM_CONFIGURE_FILE_INSIDE_AT' +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\) at warn-uninitialized.cmake:8 \(string\): + uninitialized variable 'OLD_WARN_FROM_STRING_CONFIGURE_INSIDE_AT' +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\) at warn-uninitialized.cmake:13 \(set\): + uninitialized variable 'NEW_WARN_FROM_NORMAL_CMAKE_FILE_INSIDE_BRACES' +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\) at warn-uninitialized.cmake:14 \(string\): + uninitialized variable 'NEW_WARN_FROM_STRING_CONFIGURE_INSIDE_BRACES' +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\) at warn-uninitialized.cmake:16 \(configure_file\): + uninitialized variable 'NEW_WARN_FROM_CONFIGURE_FILE_INSIDE_AT' +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\) at warn-uninitialized.cmake:17 \(string\): + uninitialized variable 'NEW_WARN_FROM_STRING_CONFIGURE_INSIDE_AT' Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/CommandLine/warn-uninitialized.cmake b/Tests/RunCMake/CommandLine/warn-uninitialized.cmake index f1a75c9..ff65c16 100644 --- a/Tests/RunCMake/CommandLine/warn-uninitialized.cmake +++ b/Tests/RunCMake/CommandLine/warn-uninitialized.cmake @@ -1 +1,18 @@ -set(FOO "${WARN_FROM_NORMAL_CMAKE_FILE}") +cmake_policy(PUSH) +cmake_policy(SET CMP0053 OLD) +set(FOO "${OLD_WARN_FROM_NORMAL_CMAKE_FILE_INSIDE_BRACES}") +set(FOO "@OLD_WARN_FROM_NORMAL_CMAKE_FILE_IN_ATS@") +string(CONFIGURE "\${OLD_WARN_FROM_STRING_CONFIGURE_INSIDE_BRACES}" OUT1) +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/file1.in "\@OLD_WARN_FROM_CONFIGURE_FILE_INSIDE_AT\@") +configure_file(${CMAKE_CURRENT_BINARY_DIR}/file1.in file1.out) +string(CONFIGURE "\@OLD_WARN_FROM_STRING_CONFIGURE_INSIDE_AT\@" OUT2) +cmake_policy(POP) + +cmake_policy(PUSH) +cmake_policy(SET CMP0053 NEW) +set(FOO "${NEW_WARN_FROM_NORMAL_CMAKE_FILE_INSIDE_BRACES}") +string(CONFIGURE "\${NEW_WARN_FROM_STRING_CONFIGURE_INSIDE_BRACES}" OUT3) +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/file2.in "\@NEW_WARN_FROM_CONFIGURE_FILE_INSIDE_AT\@") +configure_file(${CMAKE_CURRENT_BINARY_DIR}/file2.in file2.out) +string(CONFIGURE "@NEW_WARN_FROM_STRING_CONFIGURE_INSIDE_AT@" OUT4) +cmake_policy(POP) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1d32a35c10b384e8eb0dd2ce68c7bd11424409ac commit 1d32a35c10b384e8eb0dd2ce68c7bd11424409ac Author: Artur Ryt AuthorDate: Thu Dec 13 20:45:15 2018 +0100 Commit: Craig Scott CommitDate: Sun Dec 30 08:31:09 2018 +1100 cmCommandArgumentParserHelper: use cmMakefile::MaybeWarnUninitialized It removes logic duplication and need to have cached WarnUninitialized and CheckSystemVars diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx index 2b4ceaa..f94dc24 100644 --- a/Source/cmCommandArgumentParserHelper.cxx +++ b/Source/cmCommandArgumentParserHelper.cxx @@ -6,7 +6,6 @@ #include "cmMakefile.h" #include "cmState.h" #include "cmSystemTools.h" -#include "cmake.h" #include #include @@ -16,8 +15,6 @@ int cmCommandArgument_yyparse(yyscan_t yyscanner); // cmCommandArgumentParserHelper::cmCommandArgumentParserHelper() { - this->WarnUninitialized = false; - this->CheckSystemVars = false; this->FileLine = -1; this->FileName = nullptr; this->RemoveEmpty = true; @@ -96,21 +93,7 @@ const char* cmCommandArgumentParserHelper::ExpandVariable(const char* var) } const char* value = this->Makefile->GetDefinition(var); if (!value && !this->RemoveEmpty) { - // check to see if we need to print a warning - // if strict mode is on and the variable has - // not been "cleared"/initialized with a set(foo ) call - if (this->WarnUninitialized && !this->Makefile->VariableInitialized(var)) { - if (this->CheckSystemVars || - (this->FileName && - (cmSystemTools::IsSubDirectory( - this->FileName, this->Makefile->GetHomeDirectory()) || - cmSystemTools::IsSubDirectory( - this->FileName, this->Makefile->GetHomeOutputDirectory())))) { - std::ostringstream msg; - msg << "uninitialized variable \'" << var << "\'"; - this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, msg.str()); - } - } + this->Makefile->MaybeWarnUninitialized(var, this->FileName); return nullptr; } if (this->EscapeQuotes && value) { @@ -286,8 +269,6 @@ void cmCommandArgumentParserHelper::Error(const char* str) void cmCommandArgumentParserHelper::SetMakefile(const cmMakefile* mf) { this->Makefile = mf; - this->WarnUninitialized = mf->GetCMakeInstance()->GetWarnUninitialized(); - this->CheckSystemVars = mf->GetCMakeInstance()->GetCheckSystemVars(); } void cmCommandArgumentParserHelper::SetResult(const char* value) diff --git a/Source/cmCommandArgumentParserHelper.h b/Source/cmCommandArgumentParserHelper.h index 098c000..4dc238e 100644 --- a/Source/cmCommandArgumentParserHelper.h +++ b/Source/cmCommandArgumentParserHelper.h @@ -75,8 +75,6 @@ private: long FileLine; int CurrentLine; int Verbose; - bool WarnUninitialized; - bool CheckSystemVars; bool EscapeQuotes; bool NoEscapeMode; bool ReplaceAtSyntax; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=67ac4ed1dc5ad049ab443ce76a3f93b207703cec commit 67ac4ed1dc5ad049ab443ce76a3f93b207703cec Author: Artur Ryt AuthorDate: Thu Dec 13 20:45:11 2018 +0100 Commit: Artur Ryt CommitDate: Fri Dec 28 15:16:37 2018 +0100 cmMakefile: Move uninitialized vars logic into MaybeWarnUninitialized() diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index bbbe300..256202c 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1837,6 +1837,23 @@ bool cmMakefile::VariableInitialized(const std::string& var) const return this->StateSnapshot.IsInitialized(var); } +void cmMakefile::MaybeWarnUninitialized(std::string const& variable, + const char* sourceFilename) const +{ + // check to see if we need to print a warning + // if strict mode is on and the variable has + // not been "cleared"/initialized with a set(foo ) call + if (this->GetCMakeInstance()->GetWarnUninitialized() && + !this->VariableInitialized(variable)) { + if (this->CheckSystemVars || + (sourceFilename && this->IsProjectFile(sourceFilename))) { + std::ostringstream msg; + msg << "uninitialized variable \'" << variable << "\'"; + this->IssueMessage(cmake::AUTHOR_WARNING, msg.str()); + } + } +} + void cmMakefile::LogUnused(const char* reason, const std::string& name) const { if (this->WarnUnused) { @@ -2767,18 +2784,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew( varresult = value; } } else if (!removeEmpty && !this->SuppressSideEffects) { - // check to see if we need to print a warning - // if strict mode is on and the variable has - // not been "cleared"/initialized with a set(foo ) call - if (this->GetCMakeInstance()->GetWarnUninitialized() && - !this->VariableInitialized(lookup)) { - if (this->CheckSystemVars || - (filename && this->IsProjectFile(filename))) { - std::ostringstream msg; - msg << "uninitialized variable \'" << lookup << "\'"; - this->IssueMessage(cmake::AUTHOR_WARNING, msg.str()); - } - } + this->MaybeWarnUninitialized(lookup, filename); } result.replace(var.loc, result.size() - var.loc, varresult); // Start looking from here on out. diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index be1e6a1..1a2a0e7 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -866,6 +866,8 @@ public: std::deque> FindPackageRootPathStack; void MaybeWarnCMP0074(std::string const& pkg); + void MaybeWarnUninitialized(std::string const& variable, + const char* sourceFilename) const; bool IsProjectFile(const char* filename) const; protected: https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5257af363442aa4168776b70db1fc58d218a20c8 commit 5257af363442aa4168776b70db1fc58d218a20c8 Author: Artur Ryt AuthorDate: Thu Dec 13 20:44:58 2018 +0100 Commit: Artur Ryt CommitDate: Fri Dec 28 15:16:37 2018 +0100 cmMakefile: move common logic to IsProjectFile function diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index d7c4f22..bbbe300 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1848,11 +1848,7 @@ void cmMakefile::LogUnused(const char* reason, const std::string& name) const path += "/CMakeLists.txt"; } - if (this->CheckSystemVars || - cmSystemTools::IsSubDirectory(path, this->GetHomeDirectory()) || - (cmSystemTools::IsSubDirectory(path, this->GetHomeOutputDirectory()) && - !cmSystemTools::IsSubDirectory(path, - cmake::GetCMakeFilesDirectory()))) { + if (this->CheckSystemVars || this->IsProjectFile(path.c_str())) { std::ostringstream msg; msg << "unused variable (" << reason << ") \'" << name << "\'"; this->IssueMessage(cmake::AUTHOR_WARNING, msg.str()); @@ -2702,6 +2698,14 @@ struct t_lookup size_t loc = 0; }; +bool cmMakefile::IsProjectFile(const char* filename) const +{ + return cmSystemTools::IsSubDirectory(filename, this->GetHomeDirectory()) || + (cmSystemTools::IsSubDirectory(filename, this->GetHomeOutputDirectory()) && + !cmSystemTools::IsSubDirectory(filename, + cmake::GetCMakeFilesDirectory())); +} + cmake::MessageType cmMakefile::ExpandVariablesInStringNew( std::string& errorstr, std::string& source, bool escapeQuotes, bool noEscapes, bool atOnly, const char* filename, long line, @@ -2769,11 +2773,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew( if (this->GetCMakeInstance()->GetWarnUninitialized() && !this->VariableInitialized(lookup)) { if (this->CheckSystemVars || - (filename && - (cmSystemTools::IsSubDirectory(filename, - this->GetHomeDirectory()) || - cmSystemTools::IsSubDirectory( - filename, this->GetHomeOutputDirectory())))) { + (filename && this->IsProjectFile(filename))) { std::ostringstream msg; msg << "uninitialized variable \'" << lookup << "\'"; this->IssueMessage(cmake::AUTHOR_WARNING, msg.str()); diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index aa94054..be1e6a1 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -866,6 +866,7 @@ public: std::deque> FindPackageRootPathStack; void MaybeWarnCMP0074(std::string const& pkg); + bool IsProjectFile(const char* filename) const; protected: // add link libraries and directories to the target ----------------------------------------------------------------------- Summary of changes: Source/cmCommandArgumentParserHelper.cxx | 25 ++------ Source/cmCommandArgumentParserHelper.h | 2 - Source/cmMakefile.cxx | 71 +++++++++++++--------- Source/cmMakefile.h | 5 +- Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 2 +- .../CommandLine/warn-uninitialized-stderr.txt | 52 +++++++++++++++- .../RunCMake/CommandLine/warn-uninitialized.cmake | 19 +++++- 7 files changed, 118 insertions(+), 58 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Tue Jan 8 00:03:05 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 8 Jan 2019 00:03:05 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.2-817-gf5da1bb Message-ID: <20190108050305.9B8B912561C@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via f5da1bb34954b1a9e78f07133f4aa3ce332a329f (commit) from 5b7eb38e8e4711433ba83b22a6a74efd1c6e2de1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f5da1bb34954b1a9e78f07133f4aa3ce332a329f commit f5da1bb34954b1a9e78f07133f4aa3ce332a329f Author: Kitware Robot AuthorDate: Tue Jan 8 00:01:05 2019 -0500 Commit: Kitware Robot CommitDate: Tue Jan 8 00:01:05 2019 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 58df3d9..4bde35e 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 13) -set(CMake_VERSION_PATCH 20190107) +set(CMake_VERSION_PATCH 20190108) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Tue Jan 8 10:03:05 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 8 Jan 2019 10:03:05 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.2-819-g6a796b5 Message-ID: <20190108150305.3A8F6111905@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 6a796b57b25267e13532e22c0f31551aa7c81acf (commit) via 1cf9c754db3fcdcd500dbec48e509535135eba1b (commit) from f5da1bb34954b1a9e78f07133f4aa3ce332a329f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6a796b57b25267e13532e22c0f31551aa7c81acf commit 6a796b57b25267e13532e22c0f31551aa7c81acf Merge: f5da1bb 1cf9c75 Author: Kyle Edwards AuthorDate: Tue Jan 8 14:55:22 2019 +0000 Commit: Kitware Robot CommitDate: Tue Jan 8 09:55:47 2019 -0500 Merge topic 'modernize-for' 1cf9c754db Source: Modernize for loops, add const modifiers Acked-by: Kitware Robot Merge-request: !2765 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1cf9c754db3fcdcd500dbec48e509535135eba1b commit 1cf9c754db3fcdcd500dbec48e509535135eba1b Author: Vitaly Stakhovsky AuthorDate: Sun Dec 30 14:31:53 2018 -0500 Commit: Vitaly Stakhovsky CommitDate: Mon Dec 31 11:50:40 2018 -0500 Source: Modernize for loops, add const modifiers diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx index bbc90a2..2fa593c 100644 --- a/Source/cmExtraCodeLiteGenerator.cxx +++ b/Source/cmExtraCodeLiteGenerator.cxx @@ -59,18 +59,17 @@ void cmExtraCodeLiteGenerator::Generate() // and extract the information for creating the worspace // root makefile for (auto const& it : projectMap) { - const cmMakefile* mf = it.second[0]->GetMakefile(); + cmLocalGenerator* lg = it.second[0]; + const cmMakefile* mf = lg->GetMakefile(); this->ConfigName = GetConfigurationName(mf); - if (it.second[0]->GetCurrentBinaryDirectory() == - it.second[0]->GetBinaryDirectory()) { - workspaceOutputDir = it.second[0]->GetCurrentBinaryDirectory(); - workspaceProjectName = it.second[0]->GetProjectName(); - workspaceSourcePath = it.second[0]->GetSourceDirectory(); + if (lg->GetCurrentBinaryDirectory() == lg->GetBinaryDirectory()) { + workspaceOutputDir = lg->GetCurrentBinaryDirectory(); + workspaceProjectName = lg->GetProjectName(); + workspaceSourcePath = lg->GetSourceDirectory(); workspaceFileName = workspaceOutputDir + "/"; workspaceFileName += workspaceProjectName + ".workspace"; - this->WorkspacePath = it.second[0]->GetCurrentBinaryDirectory(); - ; + this->WorkspacePath = lg->GetCurrentBinaryDirectory(); break; } } diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index 2727d9a..96d4ad6 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -71,16 +71,11 @@ const std::string& cmCompiledGeneratorExpression::EvaluateWithContext( this->Output.clear(); - std::vector::const_iterator it = - this->Evaluators.begin(); - const std::vector::const_iterator end = - this->Evaluators.end(); + for (const cmGeneratorExpressionEvaluator* it : this->Evaluators) { + this->Output += it->Evaluate(&context, dagChecker); - for (; it != end; ++it) { - this->Output += (*it)->Evaluate(&context, dagChecker); - - this->SeenTargetProperties.insert(context.SeenTargetProperties.begin(), - context.SeenTargetProperties.end()); + this->SeenTargetProperties.insert(context.SeenTargetProperties.cbegin(), + context.SeenTargetProperties.cend()); if (context.HadError) { this->Output.clear(); break; diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index 4d98d55..1a25633 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -196,7 +196,7 @@ void cmGhsMultiTargetGenerator::WriteTypeSpecifics(const std::string& config, std::string outputFilename(this->GetOutputFilename(config)); if (this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY) { - std::string const static_library_suffix = + std::string const& static_library_suffix = this->Makefile->GetSafeDefinition("CMAKE_STATIC_LIBRARY_SUFFIX"); *this->GetFolderBuildStreams() << " -o \"" << outputDir << outputFilename << static_library_suffix @@ -478,10 +478,9 @@ void cmGhsMultiTargetGenerator::WriteSources( std::vector const& objectSources, std::map const& objectNames) { - for (std::vector::const_iterator si = objectSources.begin(); - si != objectSources.end(); ++si) { + for (const cmSourceFile* sf : objectSources) { std::vector sourceGroups(this->Makefile->GetSourceGroups()); - std::string const& sourceFullPath = (*si)->GetFullPath(); + std::string const& sourceFullPath = sf->GetFullPath(); cmSourceGroup* sourceGroup = this->Makefile->FindSourceGroup(sourceFullPath, sourceGroups); std::string sgPath = sourceGroup->GetFullName(); @@ -491,8 +490,8 @@ void cmGhsMultiTargetGenerator::WriteSources( this->LocalGenerator->GetBinaryDirectory().c_str(), sgPath, GhsMultiGpj::SUBPROJECT, this->RelBuildFilePath); - std::string fullSourcePath((*si)->GetFullPath()); - if ((*si)->GetExtension() == "int" || (*si)->GetExtension() == "bsp") { + std::string fullSourcePath(sf->GetFullPath()); + if (sf->GetExtension() == "int" || sf->GetExtension() == "bsp") { *this->FolderBuildStreams[sgPath] << fullSourcePath << std::endl; } else { // WORKAROUND: GHS MULTI needs the path to use backslashes without quotes @@ -501,12 +500,12 @@ void cmGhsMultiTargetGenerator::WriteSources( *this->FolderBuildStreams[sgPath] << fullSourcePath << std::endl; } - if ("ld" != (*si)->GetExtension() && "int" != (*si)->GetExtension() && - "bsp" != (*si)->GetExtension()) { - this->WriteObjectLangOverride(this->FolderBuildStreams[sgPath], (*si)); - if (objectNames.end() != objectNames.find(*si)) { + if ("ld" != sf->GetExtension() && "int" != sf->GetExtension() && + "bsp" != sf->GetExtension()) { + this->WriteObjectLangOverride(this->FolderBuildStreams[sgPath], sf); + if (objectNames.end() != objectNames.find(sf)) { *this->FolderBuildStreams[sgPath] - << " -o \"" << objectNames.find(*si)->second << "\"" << std::endl; + << " -o \"" << objectNames.find(sf)->second << "\"" << std::endl; } this->WriteObjectDir(this->FolderBuildStreams[sgPath], @@ -516,7 +515,7 @@ void cmGhsMultiTargetGenerator::WriteSources( } void cmGhsMultiTargetGenerator::WriteObjectLangOverride( - cmGeneratedFileStream* fileStream, cmSourceFile* sourceFile) + cmGeneratedFileStream* fileStream, const cmSourceFile* sourceFile) { const char* rawLangProp = sourceFile->GetProperty("LANGUAGE"); if (NULL != rawLangProp) { diff --git a/Source/cmGhsMultiTargetGenerator.h b/Source/cmGhsMultiTargetGenerator.h index 2cdf68e..e936b08 100644 --- a/Source/cmGhsMultiTargetGenerator.h +++ b/Source/cmGhsMultiTargetGenerator.h @@ -86,7 +86,7 @@ private: cmLocalGhsMultiGenerator* localGhsMultiGenerator, cmGeneratorTarget* generatorTarget); static void WriteObjectLangOverride(cmGeneratedFileStream* fileStream, - cmSourceFile* sourceFile); + const cmSourceFile* sourceFile); static void WriteObjectDir(cmGeneratedFileStream* fileStream, std::string const& dir); std::string GetOutputDirectory(const std::string& config) const; ----------------------------------------------------------------------- Summary of changes: Source/cmExtraCodeLiteGenerator.cxx | 15 +++++++-------- Source/cmGeneratorExpression.cxx | 13 ++++--------- Source/cmGhsMultiTargetGenerator.cxx | 23 +++++++++++------------ Source/cmGhsMultiTargetGenerator.h | 2 +- 4 files changed, 23 insertions(+), 30 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Wed Jan 9 00:03:05 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 9 Jan 2019 00:03:05 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.2-820-g98103e3 Message-ID: <20190109050305.617081184A9@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 98103e38d0f6b64ded0503462abfc7b09dc8bea7 (commit) from 6a796b57b25267e13532e22c0f31551aa7c81acf (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=98103e38d0f6b64ded0503462abfc7b09dc8bea7 commit 98103e38d0f6b64ded0503462abfc7b09dc8bea7 Author: Kitware Robot AuthorDate: Wed Jan 9 00:01:04 2019 -0500 Commit: Kitware Robot CommitDate: Wed Jan 9 00:01:04 2019 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 4bde35e..f696fed 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 13) -set(CMake_VERSION_PATCH 20190108) +set(CMake_VERSION_PATCH 20190109) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Wed Jan 9 08:23:05 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 9 Jan 2019 08:23:05 -0500 (EST) Subject: [Cmake-commits] CMake branch, release, updated. v3.13.2-2-g68bc9fc Message-ID: <20190109132305.E39DE11212D@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, release has been updated via 68bc9fcbb9a0d0a91d9c7b592c79b04d0f03fabc (commit) via d44f81c2173d56cba662bc414f7cd2dc030b74fe (commit) from 9bbfbd54ba04e07b0bf2eb8bb1056bca53d639c5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Source/cmVSSetupHelper.cxx | 9 +++++++++ 1 file changed, 9 insertions(+) hooks/post-receive -- CMake From kwrobot at kitware.com Wed Jan 9 08:23:05 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 9 Jan 2019 08:23:05 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.2-824-gc9854a5 Message-ID: <20190109132305.D452610323C@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via c9854a5843ac75df32c26140e1b568a3f0018699 (commit) via 90b08fc27bae5c08e1f91a130eabc27cb092c6f5 (commit) via 68bc9fcbb9a0d0a91d9c7b592c79b04d0f03fabc (commit) via d44f81c2173d56cba662bc414f7cd2dc030b74fe (commit) from 98103e38d0f6b64ded0503462abfc7b09dc8bea7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c9854a5843ac75df32c26140e1b568a3f0018699 commit c9854a5843ac75df32c26140e1b568a3f0018699 Merge: 90b08fc 68bc9fc Author: Brad King AuthorDate: Wed Jan 9 08:19:56 2019 -0500 Commit: Brad King CommitDate: Wed Jan 9 08:19:56 2019 -0500 Merge branch 'release-3.13' https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=90b08fc27bae5c08e1f91a130eabc27cb092c6f5 commit 90b08fc27bae5c08e1f91a130eabc27cb092c6f5 Merge: 98103e3 d44f81c Author: Brad King AuthorDate: Wed Jan 9 13:12:52 2019 +0000 Commit: Kitware Robot CommitDate: Wed Jan 9 08:13:02 2019 -0500 Merge topic 'vs2017-skip-2019' d44f81c217 VS: Exclude VS 2019 instances when using VS 2017 generator Acked-by: Kitware Robot Merge-request: !2775 ----------------------------------------------------------------------- Summary of changes: Source/cmVSSetupHelper.cxx | 9 +++++++++ 1 file changed, 9 insertions(+) hooks/post-receive -- CMake From kwrobot at kitware.com Wed Jan 9 16:43:04 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 9 Jan 2019 16:43:04 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.2-826-g1fe3d12 Message-ID: <20190109214304.CB697110A75@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 1fe3d126a571427114d56e1115e73feb06cd5c3e (commit) via 200bf5774285d51d9c5f24b5b52226a7cb54d33d (commit) from c9854a5843ac75df32c26140e1b568a3f0018699 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1fe3d126a571427114d56e1115e73feb06cd5c3e commit 1fe3d126a571427114d56e1115e73feb06cd5c3e Merge: c9854a5 200bf57 Author: Craig Scott AuthorDate: Wed Jan 9 21:41:27 2019 +0000 Commit: Kitware Robot CommitDate: Wed Jan 9 16:41:38 2019 -0500 Merge topic 'BundleUtilities-make-dir' 200bf57742 BundleUtilities: Ensure target dir exists when creating symlinks Acked-by: Kitware Robot Tested-by: Craig Scott Merge-request: !2728 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=200bf5774285d51d9c5f24b5b52226a7cb54d33d commit 200bf5774285d51d9c5f24b5b52226a7cb54d33d Author: Tim Blechmann AuthorDate: Tue Dec 11 23:48:53 2018 +0800 Commit: Craig Scott CommitDate: Tue Jan 8 19:56:34 2019 +1100 BundleUtilities: Ensure target dir exists when creating symlinks Commit v3.13.0-rc1~279^2 (GetPrerequisites: Move dylibs from MacOS to Frameworks folder in bundle, 2018-07-22) introduced a regression that can cause symlink creation to fail during packaging. Symlinks can be created before targets are installed, so the destination directory of the symlink sometimes won't exist at symlink creation. Fixes: #18726 diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake index 613ba1a..89ca918 100644 --- a/Modules/BundleUtilities.cmake +++ b/Modules/BundleUtilities.cmake @@ -720,6 +720,9 @@ function(link_resolved_item_into_bundle resolved_item resolved_embedded_item) else() get_filename_component(target_dir "${resolved_embedded_item}" DIRECTORY) file(RELATIVE_PATH symlink_target "${target_dir}" "${resolved_item}") + if (NOT EXISTS "${target_dir}") + file(MAKE_DIRECTORY "${target_dir}") + endif() execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${symlink_target}" "${resolved_embedded_item}") endif() endfunction() ----------------------------------------------------------------------- Summary of changes: Modules/BundleUtilities.cmake | 3 +++ 1 file changed, 3 insertions(+) hooks/post-receive -- CMake From kwrobot at kitware.com Wed Jan 9 16:53:02 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 9 Jan 2019 16:53:02 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.2-828-gd085403 Message-ID: <20190109215302.C2DBB110A75@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via d085403f722d107e812dbdef0762674e9e4e4153 (commit) via 88c710ab56576fb80abd7940926c0fe461cf2469 (commit) from 1fe3d126a571427114d56e1115e73feb06cd5c3e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d085403f722d107e812dbdef0762674e9e4e4153 commit d085403f722d107e812dbdef0762674e9e4e4153 Merge: 1fe3d12 88c710a Author: Craig Scott AuthorDate: Thu Jan 10 08:43:09 2019 +1100 Commit: Craig Scott CommitDate: Thu Jan 10 08:43:09 2019 +1100 Merge branch 'release-3.13' ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From kwrobot at kitware.com Wed Jan 9 16:53:02 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 9 Jan 2019 16:53:02 -0500 (EST) Subject: [Cmake-commits] CMake branch, release, updated. v3.13.2-4-g88c710a Message-ID: <20190109215302.D4EB2110A75@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, release has been updated via 88c710ab56576fb80abd7940926c0fe461cf2469 (commit) via 200bf5774285d51d9c5f24b5b52226a7cb54d33d (commit) from 68bc9fcbb9a0d0a91d9c7b592c79b04d0f03fabc (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Modules/BundleUtilities.cmake | 3 +++ 1 file changed, 3 insertions(+) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Jan 10 00:03:04 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 10 Jan 2019 00:03:04 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.2-829-gf2a78ae Message-ID: <20190110050304.D2ABF125443@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via f2a78aeed94e9ccf76c1268e8ed934669a08d389 (commit) from d085403f722d107e812dbdef0762674e9e4e4153 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f2a78aeed94e9ccf76c1268e8ed934669a08d389 commit f2a78aeed94e9ccf76c1268e8ed934669a08d389 Author: Kitware Robot AuthorDate: Thu Jan 10 00:01:04 2019 -0500 Commit: Kitware Robot CommitDate: Thu Jan 10 00:01:04 2019 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index f696fed..220040c 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 13) -set(CMake_VERSION_PATCH 20190109) +set(CMake_VERSION_PATCH 20190110) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Jan 10 08:03:05 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 10 Jan 2019 08:03:05 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.2-834-gecf3c5c Message-ID: <20190110130305.25D75F9E69@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via ecf3c5c6f322168e11aa37d899b076ef4abc5625 (commit) via 49b3ebf5f5b0500eea9f5e241c5d5024fa3a95fa (commit) via db89590f364c9c95628b367914188ca6a63b8eab (commit) via 5bcfe98bd5215d8fc1638879c3ee92ca2c1383b8 (commit) via 70e245f19ec8e753784db6a1153c64e5f5eec16a (commit) from f2a78aeed94e9ccf76c1268e8ed934669a08d389 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ecf3c5c6f322168e11aa37d899b076ef4abc5625 commit ecf3c5c6f322168e11aa37d899b076ef4abc5625 Merge: 49b3ebf 5bcfe98 Author: Brad King AuthorDate: Thu Jan 10 13:00:35 2019 +0000 Commit: Kitware Robot CommitDate: Thu Jan 10 08:00:44 2019 -0500 Merge topic 'fix-msvc-warnings' 5bcfe98bd5 Source: Fix various compiler warnings in Visual Studio 2017 70e245f19e cmAlgorithms: add utility functions to get signed size of containers Acked-by: Kitware Robot Merge-request: !2757 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=49b3ebf5f5b0500eea9f5e241c5d5024fa3a95fa commit 49b3ebf5f5b0500eea9f5e241c5d5024fa3a95fa Merge: f2a78ae db89590f Author: Brad King AuthorDate: Thu Jan 10 12:55:38 2019 +0000 Commit: Kitware Robot CommitDate: Thu Jan 10 07:55:46 2019 -0500 Merge topic 'better_sphinx_colors' db89590f36 Help: CMakeTemplateStyle uses colors that better contrast. Acked-by: Kitware Robot Merge-request: !2779 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=db89590f364c9c95628b367914188ca6a63b8eab commit db89590f364c9c95628b367914188ca6a63b8eab Author: Robert Maynard AuthorDate: Wed Jan 9 14:01:30 2019 -0500 Commit: Robert Maynard CommitDate: Wed Jan 9 15:53:26 2019 -0500 Help: CMakeTemplateStyle uses colors that better contrast. diff --git a/Utilities/Sphinx/colors.py b/Utilities/Sphinx/colors.py index f98a483..dae0063 100644 --- a/Utilities/Sphinx/colors.py +++ b/Utilities/Sphinx/colors.py @@ -14,14 +14,14 @@ class CMakeTemplateStyle(Style): styles = { Whitespace: "#bbbbbb", Comment: "italic #408080", - Operator: "bold #000000", + Operator: "#555555", String: "#217A21", Number: "#105030", - Name.Builtin: "#400080", # anything lowercase - Name.Function: "bold #1010A0", # function + Name.Builtin: "#333333", # anything lowercase + Name.Function: "#007020", # function Name.Variable: "#1080B0", # <..> - Name.Tag: "#19177C", # ${..} - Name.Constant: "#6020E0", # uppercase only + Name.Tag: "#bb60d5", # ${..} + Name.Constant: "#4070a0", # uppercase only Name.Entity: "italic #70A020", # @..@ Name.Attribute: "#906060", # paths, URLs Name.Label: "#A0A000", # anything left over https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5bcfe98bd5215d8fc1638879c3ee92ca2c1383b8 commit 5bcfe98bd5215d8fc1638879c3ee92ca2c1383b8 Author: Bruno Manganelli AuthorDate: Mon Dec 24 12:11:26 2018 +0000 Commit: Brad King CommitDate: Wed Jan 9 08:25:10 2019 -0500 Source: Fix various compiler warnings in Visual Studio 2017 diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index 065a184..1d9621c 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -407,7 +407,7 @@ char CCONV* cmExpandVariablesInString(void* arg, const char* source, cmMakefile* mf = static_cast(arg); std::string barf = source; std::string const& result = - mf->ExpandVariablesInString(barf, escapeQuotes, atOnly); + mf->ExpandVariablesInString(barf, escapeQuotes != 0, atOnly != 0); return strdup(result.c_str()); } diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 594cb67..fc9c1d2 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -220,7 +220,7 @@ bool cmFileCommand::HandleWriteCommand(std::vector const& args, // Set permissions to writable if (cmSystemTools::GetPermissions(fileName.c_str(), mode)) { #if defined(_MSC_VER) || defined(__MINGW32__) - writable = mode & S_IWRITE; + writable = (mode & S_IWRITE) != 0; mode_t newMode = mode | S_IWRITE; #else writable = mode & S_IWUSR; diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index 5d67dcf..afe9230 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -269,7 +269,7 @@ void cmVisualStudioGeneratorOptions::FixManifestUACFlags() if (keyValue[1].front() == '\'' && keyValue[1].back() == '\'') { keyValue[1] = - keyValue[1].substr(1, std::max(0, keyValue[1].size() - 2)); + keyValue[1].substr(1, std::max(0, cm::isize(keyValue[1]) - 2)); } if (keyValue[0] == "level") { diff --git a/Source/cmWriteFileCommand.cxx b/Source/cmWriteFileCommand.cxx index c504ef4..49dbf1a 100644 --- a/Source/cmWriteFileCommand.cxx +++ b/Source/cmWriteFileCommand.cxx @@ -50,7 +50,7 @@ bool cmWriteFileCommand::InitialPass(std::vector const& args, // Set permissions to writable if (cmSystemTools::GetPermissions(fileName.c_str(), mode)) { #if defined(_MSC_VER) || defined(__MINGW32__) - writable = mode & S_IWRITE; + writable = (mode & S_IWRITE) != 0; mode_t newMode = mode | S_IWRITE; #else writable = mode & S_IWUSR; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=70e245f19ec8e753784db6a1153c64e5f5eec16a commit 70e245f19ec8e753784db6a1153c64e5f5eec16a Author: Bruno Manganelli AuthorDate: Mon Dec 24 20:52:58 2018 +0000 Commit: Bruno Manganelli CommitDate: Thu Dec 27 22:29:06 2018 +0100 cmAlgorithms: add utility functions to get signed size of containers diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index bbd3e8e..2f8e675 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -396,6 +396,12 @@ constexpr #endif +template +int isize(const T& t) +{ + return static_cast(cm::size(t)); +} + #if __cplusplus >= 201402L || defined(_MSVC_LANG) && _MSVC_LANG >= 201402L using std::cbegin; ----------------------------------------------------------------------- Summary of changes: Source/cmAlgorithms.h | 6 ++++++ Source/cmCPluginAPI.cxx | 2 +- Source/cmFileCommand.cxx | 2 +- Source/cmVisualStudioGeneratorOptions.cxx | 2 +- Source/cmWriteFileCommand.cxx | 2 +- Utilities/Sphinx/colors.py | 10 +++++----- 6 files changed, 15 insertions(+), 9 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Jan 10 09:43:06 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 10 Jan 2019 09:43:06 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.2-854-g6092a77 Message-ID: <20190110144306.5F45D10EEA9@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 6092a770f66bff959749170141d44188f4b6f3f1 (commit) via 143fbde17b5b22355a372bac774b26e75eba574a (commit) via 18ca9d082072f90eb8412565dbaa242ad0a56c14 (commit) via dd71b683e5ba86708d301cb42affebcdd558dcd4 (commit) via 91fa6a472cd262014a74d765b003bb1cc9d7ab8a (commit) via a1b3d79f728f2c626d3aac2e68dbab524baa4634 (commit) via cd32886b2f5c8f6bdcc9185274a934102c821a20 (commit) via 163cc8bbdd20fceaa6958a071e3d15f53b224864 (commit) via 6d99406e698a3d1b0b69b0fc0f6e09e93fc4ed79 (commit) via 03f74a16cde9e2e7e3433054970cc7cadd31388f (commit) via d07f453f39b477d687dd87aad2e1cd766598b434 (commit) via 67209a9291c672f7c6d6cc36f28e6adbc9c42b8c (commit) via fc41a95f0803abb2b5daa4f0eb21cf38c625bd26 (commit) via 2ec3363ea5f5c569063a9094959cf166a54f8ce2 (commit) via 6d53a60f007b0a1a1c03ce5f9373eddc55f49d5a (commit) via 757737075a3f998c9ecc93f5c467dabe4b005fee (commit) via 5395c526fc0066aad302298ab9ad46cc19b771ab (commit) via 7b81d8c21e0a0d8756f0afdc0530c2d06ee3bcd4 (commit) via 00530d74d5d07a320c998d6caccc00cf4e59b06d (commit) via 9045f6a30fc8ce21d2b2298c27ba1da41c23bbf3 (commit) from ecf3c5c6f322168e11aa37d899b076ef4abc5625 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6092a770f66bff959749170141d44188f4b6f3f1 commit 6092a770f66bff959749170141d44188f4b6f3f1 Merge: 143fbde 163cc8b Author: Brad King AuthorDate: Thu Jan 10 14:38:07 2019 +0000 Commit: Kitware Robot CommitDate: Thu Jan 10 09:38:14 2019 -0500 Merge topic 'vs-refactor' 163cc8bbdd VS: Convert WriteSLNHeader to non-virtual lookup table 6d99406e69 VS: Move ExpressEdition member to top-level generator 03f74a16cd VS: Convert GetIDEVersion to non-virtual table lookup d07f453f39 VS: Convert GetToolsVersion to non-virtual table lookup 757737075a VS: Remove unused MSBuild XML parsing script 5395c526fc cmake: Drop unused table entry for selecting default generator Acked-by: Kitware Robot Merge-request: !2780 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=143fbde17b5b22355a372bac774b26e75eba574a commit 143fbde17b5b22355a372bac774b26e75eba574a Merge: 18ca9d0 67209a9 Author: Brad King AuthorDate: Thu Jan 10 14:37:14 2019 +0000 Commit: Kitware Robot CommitDate: Thu Jan 10 09:37:25 2019 -0500 Merge topic 'ctest-show-as-json' 67209a9291 Tests: Add cases for ctest --show-only=json-v1 fc41a95f08 CTest: Add --show-only[=format] option to print test info 7b81d8c21e TestGenerator: Record support file and line where test was added 00530d74d5 Tests: Pass python interpreter into RunCMake.CTestCommandLine Acked-by: Kitware Robot Acked-by: Brad King Merge-request: !2499 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=18ca9d082072f90eb8412565dbaa242ad0a56c14 commit 18ca9d082072f90eb8412565dbaa242ad0a56c14 Merge: dd71b68 91fa6a4 Author: Brad King AuthorDate: Thu Jan 10 09:36:20 2019 -0500 Commit: Brad King CommitDate: Thu Jan 10 09:36:20 2019 -0500 Merge branch 'release-3.13' https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dd71b683e5ba86708d301cb42affebcdd558dcd4 commit dd71b683e5ba86708d301cb42affebcdd558dcd4 Merge: a1b3d79 2ec3363 Author: Brad King AuthorDate: Thu Jan 10 14:35:34 2019 +0000 Commit: Kitware Robot CommitDate: Thu Jan 10 09:35:40 2019 -0500 Merge topic 'cmake-CDU-option-parsing' 2ec3363ea5 Tests: Add cases for -{C,D,U} without a source tree 6d53a60f00 cmake: distinguish '-Cpath' from '-C path' in source dir parsing Acked-by: Kitware Robot Merge-request: !2783 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a1b3d79f728f2c626d3aac2e68dbab524baa4634 commit a1b3d79f728f2c626d3aac2e68dbab524baa4634 Merge: ecf3c5c cd32886 Author: Brad King AuthorDate: Thu Jan 10 14:33:30 2019 +0000 Commit: Kitware Robot CommitDate: Thu Jan 10 09:33:48 2019 -0500 Merge topic 'autogen-qt6' cd32886b2f Autogen: Add AUTO(MOC|RCC|UIC)_EXECUTABLE target properties 9045f6a30f Autogen: Prepare for Qt 6 Acked-by: Kitware Robot Merge-request: !2679 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cd32886b2f5c8f6bdcc9185274a934102c821a20 commit cd32886b2f5c8f6bdcc9185274a934102c821a20 Author: Tobias Hunger AuthorDate: Wed Nov 28 16:00:50 2018 +0100 Commit: Brad King CommitDate: Thu Jan 10 08:03:24 2019 -0500 Autogen: Add AUTO(MOC|RCC|UIC)_EXECUTABLE target properties Allow to force moc/rcc/uic compiler used for AUTO(MOC|RCC|UIC). Setting these properties is only necessary if you are going to do strange things like build these tools as part of your own build system. Setting these properties will also prevent cmake from testing the binary: It is user-provided and assumed to be valid. diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index 047859d..df8f12c 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -129,13 +129,16 @@ Properties on Targets /prop_tgt/AUTOGEN_TARGET_DEPENDS /prop_tgt/AUTOMOC_COMPILER_PREDEFINES /prop_tgt/AUTOMOC_DEPEND_FILTERS + /prop_tgt/AUTOMOC_EXECUTABLE /prop_tgt/AUTOMOC_MACRO_NAMES /prop_tgt/AUTOMOC_MOC_OPTIONS /prop_tgt/AUTOMOC /prop_tgt/AUTOUIC + /prop_tgt/AUTOUIC_EXECUTABLE /prop_tgt/AUTOUIC_OPTIONS /prop_tgt/AUTOUIC_SEARCH_PATHS /prop_tgt/AUTORCC + /prop_tgt/AUTORCC_EXECUTABLE /prop_tgt/AUTORCC_OPTIONS /prop_tgt/BINARY_DIR /prop_tgt/BUILD_RPATH diff --git a/Help/prop_tgt/AUTOMOC.rst b/Help/prop_tgt/AUTOMOC.rst index 7a3fd48..3e6d560 100644 --- a/Help/prop_tgt/AUTOMOC.rst +++ b/Help/prop_tgt/AUTOMOC.rst @@ -58,6 +58,9 @@ source files at build time and invoke moc accordingly. This property is initialized by the value of the :variable:`CMAKE_AUTOMOC` variable if it is set when a target is created. +The ``moc`` executable will be detected automatically, but can be forced to +a certain binary using the :prop_tgt:`AUTOMOC_EXECUTABLE` property. + Additional command line options for ``moc`` can be set via the :prop_tgt:`AUTOMOC_MOC_OPTIONS` property. diff --git a/Help/prop_tgt/AUTOMOC_EXECUTABLE.rst b/Help/prop_tgt/AUTOMOC_EXECUTABLE.rst new file mode 100644 index 0000000..6b66ce8 --- /dev/null +++ b/Help/prop_tgt/AUTOMOC_EXECUTABLE.rst @@ -0,0 +1,15 @@ +AUTOMOC_EXECUTABLE +------------------ + +:prop_tgt:`AUTOMOC_EXECUTABLE` is file path pointing to the ``moc`` +executable to use for :prop_tgt:`AUTOMOC` enabled files. Setting +this property will make CMake skip the automatic detection of the +``moc`` binary as well as the sanity-tests normally run to ensure +that the binary is available and working as expected. + +Usually this property does not need to be set. Only consider this +property if auto-detection of ``moc`` can not work -- e.g. because +you are building the ``moc`` binary as part of your project. + +See the :manual:`cmake-qt(7)` manual for more information on using CMake +with Qt. diff --git a/Help/prop_tgt/AUTORCC.rst b/Help/prop_tgt/AUTORCC.rst index 27fb149..5db6ed0 100644 --- a/Help/prop_tgt/AUTORCC.rst +++ b/Help/prop_tgt/AUTORCC.rst @@ -21,6 +21,9 @@ If the ``.qrc`` file is :prop_sf:`GENERATED` though, a Additional command line options for rcc can be set via the :prop_sf:`AUTORCC_OPTIONS` source file property on the ``.qrc`` file. +The ``rcc`` executable will be detected automatically, but can be forced to +a certain binary using the :prop_tgt:`AUTORCC_EXECUTABLE` property. + The global property :prop_gbl:`AUTOGEN_TARGETS_FOLDER` can be used to group the autorcc targets together in an IDE, e.g. in MSVS. diff --git a/Help/prop_tgt/AUTORCC_EXECUTABLE.rst b/Help/prop_tgt/AUTORCC_EXECUTABLE.rst new file mode 100644 index 0000000..ca0fbd7 --- /dev/null +++ b/Help/prop_tgt/AUTORCC_EXECUTABLE.rst @@ -0,0 +1,15 @@ +AUTORCC_EXECUTABLE +------------------ + +:prop_tgt:`AUTORCC_EXECUTABLE` is file path pointing to the ``rcc`` +executable to use for :prop_tgt:`AUTORCC` enabled files. Setting +this property will make CMake skip the automatic detection of the +``rcc`` binary as well as the sanity-tests normally run to ensure +that the binary is available and working as expected. + +Usually this property does not need to be set. Only consider this +property if auto-detection of ``rcc`` can not work -- e.g. because +you are building the ``rcc`` binary as part of your project. + +See the :manual:`cmake-qt(7)` manual for more information on using CMake +with Qt. diff --git a/Help/prop_tgt/AUTOUIC.rst b/Help/prop_tgt/AUTOUIC.rst index 4f58b35..85226c1 100644 --- a/Help/prop_tgt/AUTOUIC.rst +++ b/Help/prop_tgt/AUTOUIC.rst @@ -30,6 +30,9 @@ Additional command line options for ``uic`` can be set via the The global property :prop_gbl:`AUTOGEN_TARGETS_FOLDER` can be used to group the autouic targets together in an IDE, e.g. in MSVS. +The ``uic`` executable will be detected automatically, but can be forced to +a certain binary using the :prop_tgt:`AUTOUIC_EXECUTABLE` property. + Source files can be excluded from :prop_tgt:`AUTOUIC` processing by enabling :prop_sf:`SKIP_AUTOUIC` or the broader :prop_sf:`SKIP_AUTOGEN`. diff --git a/Help/prop_tgt/AUTOUIC_EXECUTABLE.rst b/Help/prop_tgt/AUTOUIC_EXECUTABLE.rst new file mode 100644 index 0000000..03bd554 --- /dev/null +++ b/Help/prop_tgt/AUTOUIC_EXECUTABLE.rst @@ -0,0 +1,15 @@ +AUTOUIC_EXECUTABLE +------------------ + +:prop_tgt:`AUTOUIC_EXECUTABLE` is file path pointing to the ``uic`` +executable to use for :prop_tgt:`AUTOUIC` enabled files. Setting +this property will make CMake skip the automatic detection of the +``uic`` binary as well as the sanity-tests normally run to ensure +that the binary is available and working as expected. + +Usually this property does not need to be set. Only consider this +property if auto-detection of ``uic`` can not work -- e.g. because +you are building the ``uic`` binary as part of your project. + +See the :manual:`cmake-qt(7)` manual for more information on using CMake +with Qt. diff --git a/Help/release/dev/autogen_executables.rst b/Help/release/dev/autogen_executables.rst new file mode 100644 index 0000000..5e967ea --- /dev/null +++ b/Help/release/dev/autogen_executables.rst @@ -0,0 +1,9 @@ +AUTO*_EXECUTABLE +---------------- + +* The :prop_tgt:`AUTOMOC_EXECUTABLE`, :prop_tgt:`AUTORCC_EXECUTABLE` and + :prop_tgt:`AUTOUIC_EXECUTABLE` target properties all take a path to an + executable and force automoc/autorcc/autouic to use this executable. + + Setting these will also prevent the configure time testing for these + executables. This is mainly useful when you build these tools yourself. diff --git a/Source/cmQtAutoGenGlobalInitializer.cxx b/Source/cmQtAutoGenGlobalInitializer.cxx index 0ed8af4..678ff14 100644 --- a/Source/cmQtAutoGenGlobalInitializer.cxx +++ b/Source/cmQtAutoGenGlobalInitializer.cxx @@ -75,14 +75,26 @@ cmQtAutoGenGlobalInitializer::cmQtAutoGenGlobalInitializer( bool const uic = target->GetPropertyAsBool("AUTOUIC"); bool const rcc = target->GetPropertyAsBool("AUTORCC"); if (moc || uic || rcc) { - // We support Qt4 and Qt5 + std::string const mocExec = + target->GetSafeProperty("AUTOMOC_EXECUTABLE"); + std::string const uicExec = + target->GetSafeProperty("AUTOUIC_EXECUTABLE"); + std::string const rccExec = + target->GetSafeProperty("AUTORCC_EXECUTABLE"); + + // We support Qt4, Qt5 and Qt6 auto qtVersion = cmQtAutoGenInitializer::GetQtVersion(target); - if ((qtVersion.Major == 4) || (qtVersion.Major == 5) || - (qtVersion.Major == 6)) { + bool const validQt = (qtVersion.Major == 4) || + (qtVersion.Major == 5) || (qtVersion.Major == 6); + bool const mocIsValid = moc && (validQt || !mocExec.empty()); + bool const uicIsValid = uic && (validQt || !uicExec.empty()); + bool const rccIsValid = rcc && (validQt || !rccExec.empty()); + + if (mocIsValid || uicIsValid || rccIsValid) { // Create autogen target initializer Initializers_.emplace_back(cm::make_unique( - this, target, qtVersion, moc, uic, rcc, globalAutoGenTarget, - globalAutoRccTarget)); + this, target, qtVersion, mocIsValid, uicIsValid, rccIsValid, + globalAutoGenTarget, globalAutoRccTarget)); } } } diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index ffa6a35..e4d2c82 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -9,6 +9,7 @@ #include "cmCustomCommandLines.h" #include "cmDuration.h" #include "cmFilePathChecksum.h" +#include "cmGeneratorExpression.h" #include "cmGeneratorTarget.h" #include "cmGlobalGenerator.h" #include "cmLinkItem.h" @@ -398,8 +399,16 @@ bool cmQtAutoGenInitializer::InitCustomTargets() } // Init uic specific settings - if (this->Uic.Enabled && !InitUic()) { - return false; + if (this->Uic.Enabled) { + if (InitUic()) { + auto* uicTarget = makefile->FindTargetToUse( + GetQtExecutableTargetName(this->QtVersion, "uic")); + if (uicTarget != nullptr) { + this->AutogenTarget.DependTargets.insert(uicTarget); + } + } else { + return false; + } } // Autogen target name @@ -440,6 +449,12 @@ bool cmQtAutoGenInitializer::InitCustomTargets() this->AutogenTarget.DependOrigin = this->Target->GetPropertyAsBool("AUTOGEN_ORIGIN_DEPENDS"); + auto* mocTarget = makefile->FindTargetToUse( + GetQtExecutableTargetName(this->QtVersion, "moc")); + if (mocTarget != nullptr) { + this->AutogenTarget.DependTargets.insert(mocTarget); + } + std::string const deps = this->Target->GetSafeProperty("AUTOGEN_TARGET_DEPENDS"); if (!deps.empty()) { @@ -1095,6 +1110,7 @@ bool cmQtAutoGenInitializer::InitRccTargets() { cmMakefile* makefile = this->Target->Target->GetMakefile(); cmLocalGenerator* localGen = this->Target->GetLocalGenerator(); + auto rccTargetName = GetQtExecutableTargetName(this->QtVersion, "rcc"); for (Qrc const& qrc : this->Rcc.Qrcs) { // Register info file as generated by CMake @@ -1105,6 +1121,11 @@ bool cmQtAutoGenInitializer::InitRccTargets() std::vector ccOutput; ccOutput.push_back(qrc.RccFile); + std::vector ccDepends; + // Add the .qrc and info file to the custom command dependencies + ccDepends.push_back(qrc.QrcFile); + ccDepends.push_back(qrc.InfoFile); + cmCustomCommandLines commandLines; if (this->MultiConfig) { // Build for all configurations @@ -1140,15 +1161,12 @@ bool cmQtAutoGenInitializer::InitRccTargets() ccName += "_"; ccName += qrc.PathChecksum; } - std::vector ccDepends; - // Add the .qrc and info file to the custom target dependencies - ccDepends.push_back(qrc.QrcFile); - ccDepends.push_back(qrc.InfoFile); cmTarget* autoRccTarget = makefile->AddUtilityCommand( ccName, cmMakefile::TargetOrigin::Generator, true, this->Dir.Work.c_str(), ccOutput, ccDepends, commandLines, false, ccComment.c_str()); + // Create autogen generator target localGen->AddGeneratorTarget( new cmGeneratorTarget(autoRccTarget, localGen)); @@ -1157,6 +1175,9 @@ bool cmQtAutoGenInitializer::InitRccTargets() if (!this->TargetsFolder.empty()) { autoRccTarget->SetProperty("FOLDER", this->TargetsFolder.c_str()); } + if (!rccTargetName.empty()) { + autoRccTarget->AddUtility(rccTargetName, makefile); + } } // Add autogen target to the origin target dependencies this->Target->Target->AddUtility(ccName, makefile); @@ -1169,16 +1190,15 @@ bool cmQtAutoGenInitializer::InitRccTargets() // Create custom rcc command { std::vector ccByproducts; - std::vector ccDepends; - // Add the .qrc and info file to the custom command dependencies - ccDepends.push_back(qrc.QrcFile); - ccDepends.push_back(qrc.InfoFile); // Add the resource files to the dependencies for (std::string const& fileName : qrc.Resources) { // Add resource file to the custom command dependencies ccDepends.push_back(fileName); } + if (!rccTargetName.empty()) { + ccDepends.push_back(rccTargetName); + } makefile->AddCustomCommandToOutput(ccOutput, ccByproducts, ccDepends, /*main_dependency*/ std::string(), commandLines, ccComment.c_str(), @@ -1421,21 +1441,36 @@ std::pair GetQtExecutable( const cmQtAutoGen::IntegerVersion& qtVersion, cmGeneratorTarget* target, const std::string& executable, bool ignoreMissingTarget, std::string* output) { + const std::string upperExecutable = cmSystemTools::UpperCase(executable); + std::string result = + target->Target->GetSafeProperty("AUTO" + upperExecutable + "_EXECUTABLE"); + if (!result.empty()) { + cmListFileBacktrace lfbt = target->Target->GetMakefile()->GetBacktrace(); + cmGeneratorExpression ge(lfbt); + std::unique_ptr cge = ge.Parse(result); + result = cge->Evaluate(target->GetLocalGenerator(), ""); + + return std::make_pair(true, result); + } + std::string err; - std::string result; // Find executable { const std::string targetName = GetQtExecutableTargetName(qtVersion, executable); if (targetName.empty()) { - err = "The AUTOMOC, AUTOUIC and AUTORCC feature "; + err = "The AUTO" + upperExecutable + " feature "; err += "supports only Qt 4, Qt 5 and Qt 6."; } else { cmLocalGenerator* localGen = target->GetLocalGenerator(); cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse(targetName); if (tgt != nullptr) { - result = tgt->ImportedGetLocation(""); + if (tgt->IsImported()) { + result = tgt->ImportedGetLocation(""); + } else { + result = tgt->GetLocation(""); + } } else { if (ignoreMissingTarget) { return std::make_pair(true, ""); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=163cc8bbdd20fceaa6958a071e3d15f53b224864 commit 163cc8bbdd20fceaa6958a071e3d15f53b224864 Author: Brad King AuthorDate: Wed Jan 9 11:51:12 2019 -0500 Commit: Brad King CommitDate: Thu Jan 10 07:52:51 2019 -0500 VS: Convert WriteSLNHeader to non-virtual lookup table diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 6be1e23..4709194 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -488,16 +488,6 @@ std::string cmGlobalVisualStudio10Generator::SelectWindowsCEToolset() const return ""; } -void cmGlobalVisualStudio10Generator::WriteSLNHeader(std::ostream& fout) -{ - fout << "Microsoft Visual Studio Solution File, Format Version 11.00\n"; - if (this->ExpressEdition) { - fout << "# Visual C++ Express 2010\n"; - } else { - fout << "# Visual Studio 2010\n"; - } -} - ///! Create a local generator appropriate to this Global Generator cmLocalGenerator* cmGlobalVisualStudio10Generator::CreateLocalGenerator( cmMakefile* mf) diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 7a071e2..1e72959 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -43,7 +43,6 @@ public: */ void EnableLanguage(std::vector const& languages, cmMakefile*, bool optional) override; - void WriteSLNHeader(std::ostream& fout) override; bool IsCudaEnabled() const { return this->CudaEnabled; } diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index 4cde874..499ae32 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -188,16 +188,6 @@ bool cmGlobalVisualStudio11Generator::SelectWindowsStoreToolset( toolset); } -void cmGlobalVisualStudio11Generator::WriteSLNHeader(std::ostream& fout) -{ - fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n"; - if (this->ExpressEdition) { - fout << "# Visual Studio Express 2012 for Windows Desktop\n"; - } else { - fout << "# Visual Studio 2012\n"; - } -} - bool cmGlobalVisualStudio11Generator::UseFolderProperty() const { // Intentionally skip up to the top-level class implementation. diff --git a/Source/cmGlobalVisualStudio11Generator.h b/Source/cmGlobalVisualStudio11Generator.h index f7ae0d6..6346da2 100644 --- a/Source/cmGlobalVisualStudio11Generator.h +++ b/Source/cmGlobalVisualStudio11Generator.h @@ -26,8 +26,6 @@ public: bool MatchesGeneratorName(const std::string& name) const override; - void WriteSLNHeader(std::ostream& fout) override; - protected: bool InitializeWindowsPhone(cmMakefile* mf) override; bool InitializeWindowsStore(cmMakefile* mf) override; diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx index 3be7d24..2cec48c 100644 --- a/Source/cmGlobalVisualStudio12Generator.cxx +++ b/Source/cmGlobalVisualStudio12Generator.cxx @@ -186,16 +186,6 @@ bool cmGlobalVisualStudio12Generator::SelectWindowsStoreToolset( toolset); } -void cmGlobalVisualStudio12Generator::WriteSLNHeader(std::ostream& fout) -{ - fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n"; - if (this->ExpressEdition) { - fout << "# Visual Studio Express 2013 for Windows Desktop\n"; - } else { - fout << "# Visual Studio 2013\n"; - } -} - bool cmGlobalVisualStudio12Generator::IsWindowsDesktopToolsetInstalled() const { const char desktop81Key[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\" diff --git a/Source/cmGlobalVisualStudio12Generator.h b/Source/cmGlobalVisualStudio12Generator.h index d392280..1b7bbc9 100644 --- a/Source/cmGlobalVisualStudio12Generator.h +++ b/Source/cmGlobalVisualStudio12Generator.h @@ -24,8 +24,6 @@ public: bool MatchesGeneratorName(const std::string& name) const override; - void WriteSLNHeader(std::ostream& fout) override; - protected: bool ProcessGeneratorToolsetField(std::string const& key, std::string const& value) override; diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx index ac969e8..a6dbc23 100644 --- a/Source/cmGlobalVisualStudio14Generator.cxx +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -174,17 +174,6 @@ bool cmGlobalVisualStudio14Generator::SelectWindowsStoreToolset( toolset); } -void cmGlobalVisualStudio14Generator::WriteSLNHeader(std::ostream& fout) -{ - // Visual Studio 14 writes .sln format 12.00 - fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n"; - if (this->ExpressEdition) { - fout << "# Visual Studio Express 14 for Windows Desktop\n"; - } else { - fout << "# Visual Studio 14\n"; - } -} - bool cmGlobalVisualStudio14Generator::IsWindowsDesktopToolsetInstalled() const { const char desktop10Key[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\" diff --git a/Source/cmGlobalVisualStudio14Generator.h b/Source/cmGlobalVisualStudio14Generator.h index 9494681..4be21e0 100644 --- a/Source/cmGlobalVisualStudio14Generator.h +++ b/Source/cmGlobalVisualStudio14Generator.h @@ -24,8 +24,6 @@ public: bool MatchesGeneratorName(const std::string& name) const override; - void WriteSLNHeader(std::ostream& fout) override; - protected: bool InitializeWindows(cmMakefile* mf) override; bool InitializeWindowsStore(cmMakefile* mf) override; diff --git a/Source/cmGlobalVisualStudio15Generator.cxx b/Source/cmGlobalVisualStudio15Generator.cxx index 4a08352..2af17e8 100644 --- a/Source/cmGlobalVisualStudio15Generator.cxx +++ b/Source/cmGlobalVisualStudio15Generator.cxx @@ -97,17 +97,6 @@ bool cmGlobalVisualStudio15Generator::MatchesGeneratorName( return false; } -void cmGlobalVisualStudio15Generator::WriteSLNHeader(std::ostream& fout) -{ - // Visual Studio 15 writes .sln format 12.00 - fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n"; - if (this->ExpressEdition) { - fout << "# Visual Studio Express 15 for Windows Desktop\n"; - } else { - fout << "# Visual Studio 15\n"; - } -} - bool cmGlobalVisualStudio15Generator::SetGeneratorInstance( std::string const& i, cmMakefile* mf) { diff --git a/Source/cmGlobalVisualStudio15Generator.h b/Source/cmGlobalVisualStudio15Generator.h index 5a3fa20..233f3bc 100644 --- a/Source/cmGlobalVisualStudio15Generator.h +++ b/Source/cmGlobalVisualStudio15Generator.h @@ -24,8 +24,6 @@ public: bool MatchesGeneratorName(const std::string& name) const override; - void WriteSLNHeader(std::ostream& fout) override; - bool SetGeneratorInstance(std::string const& i, cmMakefile* mf) override; bool GetVSInstance(std::string& dir) const; diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index 3be09b0..8694df2 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -217,9 +217,3 @@ void cmGlobalVisualStudio71Generator::WriteProjectConfigurations( } } } - -// output standard header for dsw file -void cmGlobalVisualStudio71Generator::WriteSLNHeader(std::ostream& fout) -{ - fout << "Microsoft Visual Studio Solution File, Format Version 8.00\n"; -} diff --git a/Source/cmGlobalVisualStudio71Generator.h b/Source/cmGlobalVisualStudio71Generator.h index b634b95..85755af 100644 --- a/Source/cmGlobalVisualStudio71Generator.h +++ b/Source/cmGlobalVisualStudio71Generator.h @@ -34,7 +34,6 @@ protected: void WriteExternalProject(std::ostream& fout, const std::string& name, const char* path, const char* typeGuid, const std::set>& depends) override; - void WriteSLNHeader(std::ostream& fout) override; // Folders are not supported by VS 7.1. bool UseFolderProperty() const override { return false; } diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index 12a86f2..f092b56 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -134,7 +134,6 @@ protected: virtual void WriteSLNGlobalSections(std::ostream& fout, cmLocalGenerator* root); virtual void WriteSLNFooter(std::ostream& fout); - virtual void WriteSLNHeader(std::ostream& fout) = 0; std::string WriteUtilityDepend(const cmGeneratorTarget* target) override; virtual void WriteTargetsToSolution( diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx index 7ac3a6f..760cce4 100644 --- a/Source/cmGlobalVisualStudio9Generator.cxx +++ b/Source/cmGlobalVisualStudio9Generator.cxx @@ -94,12 +94,6 @@ cmGlobalVisualStudio9Generator::cmGlobalVisualStudio9Generator( vc9Express, cmSystemTools::KeyWOW64_32); } -void cmGlobalVisualStudio9Generator::WriteSLNHeader(std::ostream& fout) -{ - fout << "Microsoft Visual Studio Solution File, Format Version 10.00\n"; - fout << "# Visual Studio 2008\n"; -} - std::string cmGlobalVisualStudio9Generator::GetUserMacrosDirectory() { std::string base; diff --git a/Source/cmGlobalVisualStudio9Generator.h b/Source/cmGlobalVisualStudio9Generator.h index 5b50f77..e537a3d 100644 --- a/Source/cmGlobalVisualStudio9Generator.h +++ b/Source/cmGlobalVisualStudio9Generator.h @@ -18,12 +18,6 @@ public: static cmGlobalGeneratorFactory* NewFactory(); /** - * Try to determine system information such as shared library - * extension, pthreads, byte order etc. - */ - void WriteSLNHeader(std::ostream& fout) override; - - /** * Where does this version of Visual Studio look for macros for the * current user? Returns the empty string if this version of Visual * Studio does not implement support for VB macros. diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index ff53487..adf0a81 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -62,6 +62,58 @@ const char* cmGlobalVisualStudioGenerator::GetIDEVersion() const return ""; } +void cmGlobalVisualStudioGenerator::WriteSLNHeader(std::ostream& fout) +{ + switch (this->Version) { + case cmGlobalVisualStudioGenerator::VS9: + fout << "Microsoft Visual Studio Solution File, Format Version 10.00\n"; + fout << "# Visual Studio 2008\n"; + break; + case cmGlobalVisualStudioGenerator::VS10: + fout << "Microsoft Visual Studio Solution File, Format Version 11.00\n"; + if (this->ExpressEdition) { + fout << "# Visual C++ Express 2010\n"; + } else { + fout << "# Visual Studio 2010\n"; + } + break; + case cmGlobalVisualStudioGenerator::VS11: + fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n"; + if (this->ExpressEdition) { + fout << "# Visual Studio Express 2012 for Windows Desktop\n"; + } else { + fout << "# Visual Studio 2012\n"; + } + break; + case cmGlobalVisualStudioGenerator::VS12: + fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n"; + if (this->ExpressEdition) { + fout << "# Visual Studio Express 2013 for Windows Desktop\n"; + } else { + fout << "# Visual Studio 2013\n"; + } + break; + case cmGlobalVisualStudioGenerator::VS14: + // Visual Studio 14 writes .sln format 12.00 + fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n"; + if (this->ExpressEdition) { + fout << "# Visual Studio Express 14 for Windows Desktop\n"; + } else { + fout << "# Visual Studio 14\n"; + } + break; + case cmGlobalVisualStudioGenerator::VS15: + // Visual Studio 15 writes .sln format 12.00 + fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n"; + if (this->ExpressEdition) { + fout << "# Visual Studio Express 15 for Windows Desktop\n"; + } else { + fout << "# Visual Studio 15\n"; + } + break; + } +} + std::string cmGlobalVisualStudioGenerator::GetRegistryBase() { return cmGlobalVisualStudioGenerator::GetRegistryBase(this->GetIDEVersion()); diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index 58c0d90..0d4491d 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -142,6 +142,8 @@ protected: const char* GetIDEVersion() const; + void WriteSLNHeader(std::ostream& fout); + bool ComputeTargetDepends() override; class VSDependSet : public std::set { https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6d99406e698a3d1b0b69b0fc0f6e09e93fc4ed79 commit 6d99406e698a3d1b0b69b0fc0f6e09e93fc4ed79 Author: Brad King AuthorDate: Wed Jan 9 11:50:21 2019 -0500 Commit: Brad King CommitDate: Thu Jan 10 07:52:49 2019 -0500 VS: Move ExpressEdition member to top-level generator We no longer support any VS versions that pre-date introduction of express editions. diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h index 0ecf59f..cacfa68 100644 --- a/Source/cmGlobalVisualStudio8Generator.h +++ b/Source/cmGlobalVisualStudio8Generator.h @@ -44,9 +44,6 @@ public: return !this->WindowsCEVersion.empty(); } - /** Is the installed VS an Express edition? */ - bool IsExpressEdition() const { return this->ExpressEdition; } - protected: void AddExtraIDETargets() override; @@ -76,6 +73,5 @@ protected: std::string Name; std::string WindowsCEVersion; - bool ExpressEdition; }; #endif diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index 6779dc8..58c0d90 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -47,6 +47,9 @@ public: VSVersion GetVersion() const; void SetVersion(VSVersion v); + /** Is the installed VS an Express edition? */ + bool IsExpressEdition() const { return this->ExpressEdition; } + /** * Configure CMake's Visual Studio macros file into the user's Visual * Studio macros directory. @@ -159,6 +162,7 @@ protected: protected: VSVersion Version; + bool ExpressEdition; private: virtual std::string GetVSMakeProgram() = 0; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=03f74a16cde9e2e7e3433054970cc7cadd31388f commit 03f74a16cde9e2e7e3433054970cc7cadd31388f Author: Brad King AuthorDate: Wed Jan 9 11:28:57 2019 -0500 Commit: Brad King CommitDate: Thu Jan 10 07:52:48 2019 -0500 VS: Convert GetIDEVersion to non-virtual table lookup diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 5c8ab1c..7a071e2 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -140,8 +140,6 @@ protected: virtual bool SelectWindowsPhoneToolset(std::string& toolset) const; virtual bool SelectWindowsStoreToolset(std::string& toolset) const; - const char* GetIDEVersion() const override { return "10.0"; } - std::string const& GetMSBuildCommand(); cmIDEFlagTable const* LoadFlagTable(std::string const& flagTableName, diff --git a/Source/cmGlobalVisualStudio11Generator.h b/Source/cmGlobalVisualStudio11Generator.h index 5b089a4..f7ae0d6 100644 --- a/Source/cmGlobalVisualStudio11Generator.h +++ b/Source/cmGlobalVisualStudio11Generator.h @@ -43,7 +43,6 @@ protected: bool IsWindowsPhoneToolsetInstalled() const; bool IsWindowsStoreToolsetInstalled() const; - const char* GetIDEVersion() const override { return "11.0"; } bool UseFolderProperty() const override; static std::set GetInstalledWindowsCESDKs(); diff --git a/Source/cmGlobalVisualStudio12Generator.h b/Source/cmGlobalVisualStudio12Generator.h index 2e1e00c..d392280 100644 --- a/Source/cmGlobalVisualStudio12Generator.h +++ b/Source/cmGlobalVisualStudio12Generator.h @@ -43,7 +43,6 @@ protected: // of the toolset is installed bool IsWindowsPhoneToolsetInstalled() const; bool IsWindowsStoreToolsetInstalled() const; - const char* GetIDEVersion() const override { return "12.0"; } private: class Factory; diff --git a/Source/cmGlobalVisualStudio14Generator.h b/Source/cmGlobalVisualStudio14Generator.h index 8edd018..9494681 100644 --- a/Source/cmGlobalVisualStudio14Generator.h +++ b/Source/cmGlobalVisualStudio14Generator.h @@ -39,7 +39,6 @@ protected: // version of the toolset. virtual std::string GetWindows10SDKMaxVersion() const; - const char* GetIDEVersion() const override { return "14.0"; } virtual bool SelectWindows10SDK(cmMakefile* mf, bool required); // Used to verify that the Desktop toolset for the current generator is diff --git a/Source/cmGlobalVisualStudio15Generator.h b/Source/cmGlobalVisualStudio15Generator.h index 6bf95c3..5a3fa20 100644 --- a/Source/cmGlobalVisualStudio15Generator.h +++ b/Source/cmGlobalVisualStudio15Generator.h @@ -37,8 +37,6 @@ protected: bool InitializeWindows(cmMakefile* mf) override; bool SelectWindowsStoreToolset(std::string& toolset) const override; - const char* GetIDEVersion() const override { return "15.0"; } - // Used to verify that the Desktop toolset for the current generator is // installed on the machine. bool IsWindowsDesktopToolsetInstalled() const override; diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h index a21c53d..0ecf59f 100644 --- a/Source/cmGlobalVisualStudio8Generator.h +++ b/Source/cmGlobalVisualStudio8Generator.h @@ -49,7 +49,6 @@ public: protected: void AddExtraIDETargets() override; - const char* GetIDEVersion() const override { return "8.0"; } std::string FindDevEnvCommand() override; diff --git a/Source/cmGlobalVisualStudio9Generator.h b/Source/cmGlobalVisualStudio9Generator.h index ee17c37..5b50f77 100644 --- a/Source/cmGlobalVisualStudio9Generator.h +++ b/Source/cmGlobalVisualStudio9Generator.h @@ -36,9 +36,6 @@ public: */ std::string GetUserMacrosRegKeyBase() override; -protected: - const char* GetIDEVersion() const override { return "9.0"; } - private: class Factory; friend class Factory; diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index da3daf8..ff53487 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -43,6 +43,25 @@ void cmGlobalVisualStudioGenerator::SetVersion(VSVersion v) this->Version = v; } +const char* cmGlobalVisualStudioGenerator::GetIDEVersion() const +{ + switch (this->Version) { + case cmGlobalVisualStudioGenerator::VS9: + return "9.0"; + case cmGlobalVisualStudioGenerator::VS10: + return "10.0"; + case cmGlobalVisualStudioGenerator::VS11: + return "11.0"; + case cmGlobalVisualStudioGenerator::VS12: + return "12.0"; + case cmGlobalVisualStudioGenerator::VS14: + return "14.0"; + case cmGlobalVisualStudioGenerator::VS15: + return "15.0"; + } + return ""; +} + std::string cmGlobalVisualStudioGenerator::GetRegistryBase() { return cmGlobalVisualStudioGenerator::GetRegistryBase(this->GetIDEVersion()); diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index c891160..6779dc8 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -137,7 +137,7 @@ protected: // below 8. virtual bool VSLinksDependencies() const { return true; } - virtual const char* GetIDEVersion() const = 0; + const char* GetIDEVersion() const; bool ComputeTargetDepends() override; class VSDependSet : public std::set https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d07f453f39b477d687dd87aad2e1cd766598b434 commit d07f453f39b477d687dd87aad2e1cd766598b434 Author: Brad King AuthorDate: Wed Jan 9 11:21:20 2019 -0500 Commit: Brad King CommitDate: Thu Jan 10 07:51:47 2019 -0500 VS: Convert GetToolsVersion to non-virtual table lookup diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index c9c6938..6be1e23 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -1024,6 +1024,27 @@ std::string cmGlobalVisualStudio10Generator::Encoding() return "utf-8"; } +const char* cmGlobalVisualStudio10Generator::GetToolsVersion() const +{ + switch (this->Version) { + case cmGlobalVisualStudioGenerator::VS9: + case cmGlobalVisualStudioGenerator::VS10: + case cmGlobalVisualStudioGenerator::VS11: + return "4.0"; + + // in Visual Studio 2013 they detached the MSBuild tools version + // from the .Net Framework version and instead made it have it's own + // version number + case cmGlobalVisualStudioGenerator::VS12: + return "12.0"; + case cmGlobalVisualStudioGenerator::VS14: + return "14.0"; + case cmGlobalVisualStudioGenerator::VS15: + return "15.0"; + } + return ""; +} + bool cmGlobalVisualStudio10Generator::IsNsightTegra() const { return !this->NsightTegraVersion.empty(); diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index dc49ded..5c8ab1c 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -104,7 +104,7 @@ public: std::string const& sfRel); std::string Encoding() override; - virtual const char* GetToolsVersion() { return "4.0"; } + const char* GetToolsVersion() const; virtual bool IsDefaultToolset(const std::string& version) const; virtual std::string GetAuxiliaryToolset() const; diff --git a/Source/cmGlobalVisualStudio12Generator.h b/Source/cmGlobalVisualStudio12Generator.h index ae78de7..2e1e00c 100644 --- a/Source/cmGlobalVisualStudio12Generator.h +++ b/Source/cmGlobalVisualStudio12Generator.h @@ -26,11 +26,6 @@ public: void WriteSLNHeader(std::ostream& fout) override; - // in Visual Studio 2013 they detached the MSBuild tools version - // from the .Net Framework version and instead made it have it's own - // version number - const char* GetToolsVersion() override { return "12.0"; } - protected: bool ProcessGeneratorToolsetField(std::string const& key, std::string const& value) override; diff --git a/Source/cmGlobalVisualStudio14Generator.h b/Source/cmGlobalVisualStudio14Generator.h index 4bc430b..8edd018 100644 --- a/Source/cmGlobalVisualStudio14Generator.h +++ b/Source/cmGlobalVisualStudio14Generator.h @@ -26,8 +26,6 @@ public: void WriteSLNHeader(std::ostream& fout) override; - const char* GetToolsVersion() override { return "14.0"; } - protected: bool InitializeWindows(cmMakefile* mf) override; bool InitializeWindowsStore(cmMakefile* mf) override; diff --git a/Source/cmGlobalVisualStudio15Generator.h b/Source/cmGlobalVisualStudio15Generator.h index 68aa14f..6bf95c3 100644 --- a/Source/cmGlobalVisualStudio15Generator.h +++ b/Source/cmGlobalVisualStudio15Generator.h @@ -26,8 +26,6 @@ public: void WriteSLNHeader(std::ostream& fout) override; - const char* GetToolsVersion() override { return "15.0"; } - bool SetGeneratorInstance(std::string const& i, cmMakefile* mf) override; bool GetVSInstance(std::string& dir) const; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=67209a9291c672f7c6d6cc36f28e6adbc9c42b8c commit 67209a9291c672f7c6d6cc36f28e6adbc9c42b8c Author: Brad King AuthorDate: Thu Nov 1 11:42:23 2018 -0400 Commit: Brad King CommitDate: Thu Jan 10 07:37:35 2019 -0500 Tests: Add cases for ctest --show-only=json-v1 diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index 750ae50..cae14b1 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -173,3 +173,32 @@ function(run_TestStdin) run_cmake_command(TestStdin ${CMAKE_CTEST_COMMAND} -V) endfunction() run_TestStdin() + +function(ShowAsJson_check_python v) + set(json_file "${RunCMake_TEST_BINARY_DIR}/ctest.json") + file(WRITE "${json_file}" "${actual_stdout}") + set(actual_stdout "" PARENT_SCOPE) + execute_process( + COMMAND ${PYTHON_EXECUTABLE} "${RunCMake_SOURCE_DIR}/ShowAsJson${v}-check.py" "${json_file}" + RESULT_VARIABLE result + OUTPUT_VARIABLE output + ERROR_VARIABLE output + ) + if(NOT result EQUAL 0) + string(REPLACE "\n" "\n " output " ${output}") + set(RunCMake_TEST_FAILED "Unexpected output:\n${output}" PARENT_SCOPE) + endif() +endfunction() + +function(run_ShowAsJson) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/ShowAsJson) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" " + add_test(ShowAsJson \"${CMAKE_COMMAND}\" -E echo) + set_tests_properties(ShowAsJson PROPERTIES WILL_FAIL true _BACKTRACE_TRIPLES \"file1;1;add_test;file0;;\") +") + run_cmake_command(ShowAsJsonVersionOne ${CMAKE_CTEST_COMMAND} --show-only=json-v1) +endfunction() +run_ShowAsJson() diff --git a/Tests/RunCMake/CTestCommandLine/ShowAsJson1-check.py b/Tests/RunCMake/CTestCommandLine/ShowAsJson1-check.py new file mode 100644 index 0000000..d794e7d --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/ShowAsJson1-check.py @@ -0,0 +1,106 @@ +from ShowAsJson_check import * + +def check_kind(k): + assert is_string(k) + assert k == "ctestInfo" + +def check_version(v): + assert is_dict(v) + assert sorted(v.keys()) == ["major", "minor"] + assert is_int(v["major"]) + assert is_int(v["minor"]) + assert v["major"] == 1 + assert v["minor"] == 0 + +def check_backtracegraph(b): + assert is_dict(b) + assert sorted(b.keys()) == ["commands", "files", "nodes"] + check_backtracegraph_commands(b["commands"]) + check_backtracegraph_files(b["files"]) + check_backtracegraph_nodes(b["nodes"]) + +def check_backtracegraph_commands(c): + assert is_list(c) + assert len(c) == 1 + assert is_string(c[0]) + assert c[0] == "add_test" + +def check_backtracegraph_files(f): + assert is_list(f) + assert len(f) == 2 + assert is_string(f[0]) + assert is_string(f[1]) + assert f[0] == "file1" + assert f[1] == "file0" + +def check_backtracegraph_nodes(n): + assert is_list(n) + assert len(n) == 2 + node = n[0] + assert is_dict(node) + assert sorted(node.keys()) == ["file"] + assert is_int(node["file"]) + assert node["file"] == 1 + node = n[1] + assert is_dict(node) + assert sorted(node.keys()) == ["command", "file", "line", "parent"] + assert is_int(node["command"]) + assert is_int(node["file"]) + assert is_int(node["line"]) + assert is_int(node["parent"]) + assert node["command"] == 0 + assert node["file"] == 0 + assert node["line"] == 1 + assert node["parent"] == 0 + +def check_command(c): + assert is_list(c) + assert len(c) == 3 + assert is_string(c[0]) + check_re(c[0], "/cmake(\.exe)?$") + assert is_string(c[1]) + assert c[1] == "-E" + assert is_string(c[2]) + assert c[2] == "echo" + +def check_willfail_property(p): + assert is_dict(p) + assert sorted(p.keys()) == ["name", "value"] + assert is_string(p["name"]) + assert is_bool(p["value"]) + assert p["name"] == "WILL_FAIL" + assert p["value"] == True + +def check_workingdir_property(p): + assert is_dict(p) + assert sorted(p.keys()) == ["name", "value"] + assert is_string(p["name"]) + assert is_string(p["value"]) + assert p["name"] == "WORKING_DIRECTORY" + assert p["value"].endswith("Tests/RunCMake/CTestCommandLine/ShowAsJson") + +def check_properties(p): + assert is_list(p) + assert len(p) == 2 + check_willfail_property(p[0]) + check_workingdir_property(p[1]) + +def check_tests(t): + assert is_list(t) + assert len(t) == 1 + test = t[0] + assert is_dict(test) + assert sorted(test.keys()) == ["backtrace", "command", "name", "properties"] + assert is_int(test["backtrace"]) + assert test["backtrace"] == 1 + check_command(test["command"]) + assert is_string(test["name"]) + assert test["name"] == "ShowAsJson" + check_properties(test["properties"]) + +assert is_dict(ctest_json) +assert sorted(ctest_json.keys()) == ["backtraceGraph", "kind", "tests", "version"] +check_backtracegraph(ctest_json["backtraceGraph"]) +check_kind(ctest_json["kind"]) +check_version(ctest_json["version"]) +check_tests(ctest_json["tests"]) diff --git a/Tests/RunCMake/CTestCommandLine/ShowAsJson_check.py b/Tests/RunCMake/CTestCommandLine/ShowAsJson_check.py new file mode 100644 index 0000000..493c9e5 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/ShowAsJson_check.py @@ -0,0 +1,24 @@ +import sys +import json +import re + +def is_bool(x): + return isinstance(x, bool) + +def is_dict(x): + return isinstance(x, dict) + +def is_list(x): + return isinstance(x, list) + +def is_int(x): + return isinstance(x, int) or isinstance(x, long) + +def is_string(x): + return isinstance(x, str) or isinstance(x, unicode) + +def check_re(x, regex): + assert re.search(regex, x) + +with open(sys.argv[1]) as f: + ctest_json = json.load(f) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fc41a95f0803abb2b5daa4f0eb21cf38c625bd26 commit fc41a95f0803abb2b5daa4f0eb21cf38c625bd26 Author: Justin Goshi AuthorDate: Thu Oct 18 11:34:37 2018 -0700 Commit: Brad King CommitDate: Thu Jan 10 07:37:32 2019 -0500 CTest: Add --show-only[=format] option to print test info format can be 'human' to print the current text format or 'json-v1' to print the test object model in json format and is useful for IDEs who want to gather information about the tests. Defaults to 'human' format. diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst index 1ef20ab..8490e3d 100644 --- a/Help/manual/ctest.1.rst +++ b/Help/manual/ctest.1.rst @@ -109,13 +109,23 @@ Options This option tells CTest to write all its output to a log file. -``-N,--show-only`` +``-N,--show-only[=]`` Disable actual execution of tests. This option tells CTest to list the tests that would be run but not actually run them. Useful in conjunction with the ``-R`` and ``-E`` options. + ```` can be one of the following values. + + ``human`` + Human-friendly output. This is not guaranteed to be stable. + This is the default. + + ``json-v1`` + Dump the test information in JSON format. + See `Show as JSON Object Model`_. + ``-L , --label-regex `` Run tests with labels matching regular expression. @@ -1163,6 +1173,65 @@ Configuration settings include: * :module:`CTest` module variable: ``TRIGGER_SITE`` if set, else ``CTEST_TRIGGER_SITE`` +.. _`Show as JSON Object Model`: + +Show as JSON Object Model +========================= + +When the ``--show-only=json-v1`` command line option is given, the test +information is output in JSON format. Version 1.0 of the JSON object +model is defined as follows: + +``kind`` + The string "ctestInfo". + +``version`` + A JSON object specifying the version components. Its members are + + ``major`` + A non-negative integer specifying the major version component. + ``minor`` + A non-negative integer specifying the minor version component. + +``backtraceGraph`` + JSON object representing backtrace information with the + following members: + + ``commands`` + List of command names. + ``files`` + List of file names. + ``nodes`` + List of node JSON objects with members: + + ``command`` + Index into the ``commands`` member of the ``backtraceGraph``. + ``file`` + Index into the ``files`` member of the ``backtraceGraph``. + ``line`` + Line number in the file where the backtrace was added. + ``parent`` + Index into the ``nodes`` member of the ``backtraceGraph`` + representing the parent in the graph. + +``tests`` + A JSON array listing information about each test. Each entry + is a JSON object with members: + + ``name`` + Test name. + ``config`` + Configuration that the test can run on. + Empty string means any config. + ``command`` + List where the first element is the test command and the + remaining elements are the command arguments. + ``backtrace`` + Index into the ``nodes`` member of the ``backtraceGraph``. + ``properties`` + Test properties. + Can contain keys for each of the supported test properties. + See Also ======== diff --git a/Help/release/dev/ctest-show-only-json-v1.rst b/Help/release/dev/ctest-show-only-json-v1.rst new file mode 100644 index 0000000..f593e7e --- /dev/null +++ b/Help/release/dev/ctest-show-only-json-v1.rst @@ -0,0 +1,6 @@ +ctest-show-only-json-v1 +----------------------- + +* :manual:`ctest(1)` gained a ``--show-only=json-v1`` option to show the + list of tests in a machine-readable JSON format. + See the :ref:`Show as JSON Object Model` section of the manual. diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index f026001..8867323 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -6,9 +6,13 @@ #include "cmCTest.h" #include "cmCTestRunTest.h" #include "cmCTestTestHandler.h" +#include "cmDuration.h" +#include "cmListFileCache.h" #include "cmSystemTools.h" #include "cmWorkingDirectory.h" +#include "cm_jsoncpp_value.h" +#include "cm_jsoncpp_writer.h" #include "cm_uv.h" #include "cmUVSignalHackRAII.h" // IWYU pragma: keep @@ -20,13 +24,19 @@ #include #include #include +#include #include #include #include #include #include +#include #include +namespace cmsys { +class RegularExpression; +} + class TestComparator { public: @@ -725,9 +735,330 @@ void cmCTestMultiProcessHandler::MarkFinished() cmSystemTools::RemoveFile(fname); } +static Json::Value DumpToJsonArray(const std::set& values) +{ + Json::Value jsonArray = Json::arrayValue; + for (auto& it : values) { + jsonArray.append(it); + } + return jsonArray; +} + +static Json::Value DumpToJsonArray(const std::vector& values) +{ + Json::Value jsonArray = Json::arrayValue; + for (auto& it : values) { + jsonArray.append(it); + } + return jsonArray; +} + +static Json::Value DumpRegExToJsonArray( + const std::vector>& values) +{ + Json::Value jsonArray = Json::arrayValue; + for (auto& it : values) { + jsonArray.append(it.second); + } + return jsonArray; +} + +static Json::Value DumpMeasurementToJsonArray( + const std::map& values) +{ + Json::Value jsonArray = Json::arrayValue; + for (auto& it : values) { + Json::Value measurement = Json::objectValue; + measurement["measurement"] = it.first; + measurement["value"] = it.second; + jsonArray.append(measurement); + } + return jsonArray; +} + +static Json::Value DumpTimeoutAfterMatch( + cmCTestTestHandler::cmCTestTestProperties& testProperties) +{ + Json::Value timeoutAfterMatch = Json::objectValue; + timeoutAfterMatch["timeout"] = testProperties.AlternateTimeout.count(); + timeoutAfterMatch["regex"] = + DumpRegExToJsonArray(testProperties.TimeoutRegularExpressions); + return timeoutAfterMatch; +} + +static Json::Value DumpCTestProperty(std::string const& name, + Json::Value value) +{ + Json::Value property = Json::objectValue; + property["name"] = name; + property["value"] = std::move(value); + return property; +} + +static Json::Value DumpCTestProperties( + cmCTestTestHandler::cmCTestTestProperties& testProperties) +{ + Json::Value properties = Json::arrayValue; + if (!testProperties.AttachOnFail.empty()) { + properties.append(DumpCTestProperty( + "ATTACHED_FILES_ON_FAIL", DumpToJsonArray(testProperties.AttachOnFail))); + } + if (!testProperties.AttachedFiles.empty()) { + properties.append(DumpCTestProperty( + "ATTACHED_FILES", DumpToJsonArray(testProperties.AttachedFiles))); + } + if (testProperties.Cost != 0.0f) { + properties.append( + DumpCTestProperty("COST", static_cast(testProperties.Cost))); + } + if (!testProperties.Depends.empty()) { + properties.append( + DumpCTestProperty("DEPENDS", DumpToJsonArray(testProperties.Depends))); + } + if (testProperties.Disabled) { + properties.append(DumpCTestProperty("DISABLED", testProperties.Disabled)); + } + if (!testProperties.Environment.empty()) { + properties.append(DumpCTestProperty( + "ENVIRONMENT", DumpToJsonArray(testProperties.Environment))); + } + if (!testProperties.ErrorRegularExpressions.empty()) { + properties.append(DumpCTestProperty( + "FAIL_REGULAR_EXPRESSION", + DumpRegExToJsonArray(testProperties.ErrorRegularExpressions))); + } + if (!testProperties.FixturesCleanup.empty()) { + properties.append(DumpCTestProperty( + "FIXTURES_CLEANUP", DumpToJsonArray(testProperties.FixturesCleanup))); + } + if (!testProperties.FixturesRequired.empty()) { + properties.append(DumpCTestProperty( + "FIXTURES_REQUIRED", DumpToJsonArray(testProperties.FixturesRequired))); + } + if (!testProperties.FixturesSetup.empty()) { + properties.append(DumpCTestProperty( + "FIXTURES_SETUP", DumpToJsonArray(testProperties.FixturesSetup))); + } + if (!testProperties.Labels.empty()) { + properties.append( + DumpCTestProperty("LABELS", DumpToJsonArray(testProperties.Labels))); + } + if (!testProperties.Measurements.empty()) { + properties.append(DumpCTestProperty( + "MEASUREMENT", DumpMeasurementToJsonArray(testProperties.Measurements))); + } + if (!testProperties.RequiredRegularExpressions.empty()) { + properties.append(DumpCTestProperty( + "PASS_REGULAR_EXPRESSION", + DumpRegExToJsonArray(testProperties.RequiredRegularExpressions))); + } + if (testProperties.WantAffinity) { + properties.append( + DumpCTestProperty("PROCESSOR_AFFINITY", testProperties.WantAffinity)); + } + if (testProperties.Processors != 1) { + properties.append( + DumpCTestProperty("PROCESSORS", testProperties.Processors)); + } + if (!testProperties.RequiredFiles.empty()) { + properties["REQUIRED_FILES"] = + DumpToJsonArray(testProperties.RequiredFiles); + } + if (!testProperties.LockedResources.empty()) { + properties.append(DumpCTestProperty( + "RESOURCE_LOCK", DumpToJsonArray(testProperties.LockedResources))); + } + if (testProperties.RunSerial) { + properties.append( + DumpCTestProperty("RUN_SERIAL", testProperties.RunSerial)); + } + if (testProperties.SkipReturnCode != -1) { + properties.append( + DumpCTestProperty("SKIP_RETURN_CODE", testProperties.SkipReturnCode)); + } + if (testProperties.ExplicitTimeout) { + properties.append( + DumpCTestProperty("TIMEOUT", testProperties.Timeout.count())); + } + if (!testProperties.TimeoutRegularExpressions.empty()) { + properties.append(DumpCTestProperty( + "TIMEOUT_AFTER_MATCH", DumpTimeoutAfterMatch(testProperties))); + } + if (testProperties.WillFail) { + properties.append(DumpCTestProperty("WILL_FAIL", testProperties.WillFail)); + } + if (!testProperties.Directory.empty()) { + properties.append( + DumpCTestProperty("WORKING_DIRECTORY", testProperties.Directory)); + } + return properties; +} + +class BacktraceData +{ + std::unordered_map CommandMap; + std::unordered_map FileMap; + std::unordered_map NodeMap; + Json::Value Commands = Json::arrayValue; + Json::Value Files = Json::arrayValue; + Json::Value Nodes = Json::arrayValue; + + Json::ArrayIndex AddCommand(std::string const& command) + { + auto i = this->CommandMap.find(command); + if (i == this->CommandMap.end()) { + i = this->CommandMap.emplace(command, this->Commands.size()).first; + this->Commands.append(command); + } + return i->second; + } + + Json::ArrayIndex AddFile(std::string const& file) + { + auto i = this->FileMap.find(file); + if (i == this->FileMap.end()) { + i = this->FileMap.emplace(file, this->Files.size()).first; + this->Files.append(file); + } + return i->second; + } + +public: + bool Add(cmListFileBacktrace const& bt, Json::ArrayIndex& index); + Json::Value Dump(); +}; + +bool BacktraceData::Add(cmListFileBacktrace const& bt, Json::ArrayIndex& index) +{ + if (bt.Empty()) { + return false; + } + cmListFileContext const* top = &bt.Top(); + auto found = this->NodeMap.find(top); + if (found != this->NodeMap.end()) { + index = found->second; + return true; + } + Json::Value entry = Json::objectValue; + entry["file"] = this->AddFile(top->FilePath); + if (top->Line) { + entry["line"] = static_cast(top->Line); + } + if (!top->Name.empty()) { + entry["command"] = this->AddCommand(top->Name); + } + Json::ArrayIndex parent; + if (this->Add(bt.Pop(), parent)) { + entry["parent"] = parent; + } + index = this->NodeMap[top] = this->Nodes.size(); + this->Nodes.append(std::move(entry)); // NOLINT(*) + return true; +} + +Json::Value BacktraceData::Dump() +{ + Json::Value backtraceGraph; + this->CommandMap.clear(); + this->FileMap.clear(); + this->NodeMap.clear(); + backtraceGraph["commands"] = std::move(this->Commands); + backtraceGraph["files"] = std::move(this->Files); + backtraceGraph["nodes"] = std::move(this->Nodes); + return backtraceGraph; +} + +static void AddBacktrace(BacktraceData& backtraceGraph, Json::Value& object, + cmListFileBacktrace const& bt) +{ + Json::ArrayIndex backtrace; + if (backtraceGraph.Add(bt, backtrace)) { + object["backtrace"] = backtrace; + } +} + +static Json::Value DumpCTestInfo( + cmCTestRunTest& testRun, + cmCTestTestHandler::cmCTestTestProperties& testProperties, + BacktraceData& backtraceGraph) +{ + Json::Value testInfo = Json::objectValue; + // test name should always be present + testInfo["name"] = testProperties.Name; + std::string const& config = testRun.GetCTest()->GetConfigType(); + if (!config.empty()) { + testInfo["config"] = config; + } + std::string const& command = testRun.GetActualCommand(); + if (!command.empty()) { + std::vector commandAndArgs; + commandAndArgs.push_back(command); + const std::vector& args = testRun.GetArguments(); + if (!args.empty()) { + commandAndArgs.reserve(args.size() + 1); + commandAndArgs.insert(commandAndArgs.end(), args.begin(), args.end()); + } + testInfo["command"] = DumpToJsonArray(commandAndArgs); + } + Json::Value properties = DumpCTestProperties(testProperties); + if (!properties.empty()) { + testInfo["properties"] = properties; + } + if (!testProperties.Backtrace.Empty()) { + AddBacktrace(backtraceGraph, testInfo, testProperties.Backtrace); + } + return testInfo; +} + +static Json::Value DumpVersion(int major, int minor) +{ + Json::Value version = Json::objectValue; + version["major"] = major; + version["minor"] = minor; + return version; +} + +void cmCTestMultiProcessHandler::PrintOutputAsJson() +{ + this->TestHandler->SetMaxIndex(this->FindMaxIndex()); + + Json::Value result = Json::objectValue; + result["kind"] = "ctestInfo"; + result["version"] = DumpVersion(1, 0); + + BacktraceData backtraceGraph; + Json::Value tests = Json::arrayValue; + for (auto& it : this->Properties) { + cmCTestTestHandler::cmCTestTestProperties& p = *it.second; + + // Don't worry if this fails, we are only showing the test list, not + // running the tests + cmWorkingDirectory workdir(p.Directory); + cmCTestRunTest testRun(*this); + testRun.SetIndex(p.Index); + testRun.SetTestProperties(&p); + testRun.ComputeArguments(); + + Json::Value testInfo = DumpCTestInfo(testRun, p, backtraceGraph); + tests.append(testInfo); + } + result["backtraceGraph"] = backtraceGraph.Dump(); + result["tests"] = std::move(tests); + + Json::StreamWriterBuilder builder; + builder["indentation"] = " "; + std::unique_ptr jout(builder.newStreamWriter()); + jout->write(result, &std::cout); +} + // For ShowOnly mode void cmCTestMultiProcessHandler::PrintTestList() { + if (this->CTest->GetOutputAsJson()) { + PrintOutputAsJson(); + return; + } + this->TestHandler->SetMaxIndex(this->FindMaxIndex()); int count = 0; diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h index 3927a8a..93bb880 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.h +++ b/Source/CTest/cmCTestMultiProcessHandler.h @@ -51,6 +51,7 @@ public: void SetParallelLevel(size_t); void SetTestLoad(unsigned long load); virtual void RunTests(); + void PrintOutputAsJson(); void PrintTestList(); void PrintLabels(); diff --git a/Source/CTest/cmCTestRunTest.h b/Source/CTest/cmCTestRunTest.h index 10dceca..c786413 100644 --- a/Source/CTest/cmCTestRunTest.h +++ b/Source/CTest/cmCTestRunTest.h @@ -78,6 +78,10 @@ public: cmCTest* GetCTest() const { return this->CTest; } + std::string& GetActualCommand() { return this->ActualCommand; } + + const std::vector& GetArguments() { return this->Arguments; } + void FinalizeTest(); bool TimedOutForStopTime() const { return this->TimeoutIsForStopTime; } diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 7c19864..225c99f 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -278,6 +278,8 @@ cmCTest::cmCTest() this->ExtraVerbose = false; this->ProduceXML = false; this->ShowOnly = false; + this->OutputAsJson = false; + this->OutputAsJsonVersion = 1; this->RunConfigurationScript = false; this->UseHTTP10 = false; this->PrintLabels = false; @@ -1930,6 +1932,20 @@ bool cmCTest::HandleCommandLineArguments(size_t& i, if (this->CheckArgument(arg, "-N", "--show-only")) { this->ShowOnly = true; } + if (cmSystemTools::StringStartsWith(arg.c_str(), "--show-only=")) { + this->ShowOnly = true; + + // Check if a specific format is requested. Defaults to human readable + // text. + std::string argWithFormat = "--show-only="; + std::string format = arg.substr(argWithFormat.length()); + if (format == "json-v1") { + // Force quiet mode so the only output is the json object model. + this->Quiet = true; + this->OutputAsJson = true; + this->OutputAsJsonVersion = 1; + } + } if (this->CheckArgument(arg, "-O", "--output-log") && i < args.size() - 1) { i++; @@ -2630,6 +2646,16 @@ bool cmCTest::GetShowOnly() return this->ShowOnly; } +bool cmCTest::GetOutputAsJson() +{ + return this->OutputAsJson; +} + +int cmCTest::GetOutputAsJsonVersion() +{ + return this->OutputAsJsonVersion; +} + int cmCTest::GetMaxTestNameWidth() const { return this->MaxTestNameWidth; diff --git a/Source/cmCTest.h b/Source/cmCTest.h index 480204a..2b40ca3 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -215,6 +215,10 @@ public: /** Should we only show what we would do? */ bool GetShowOnly(); + bool GetOutputAsJson(); + + int GetOutputAsJsonVersion(); + bool ShouldUseHTTP10() { return this->UseHTTP10; } bool ShouldPrintLabels() { return this->PrintLabels; } @@ -507,6 +511,8 @@ private: t_TestingHandlers TestingHandlers; bool ShowOnly; + bool OutputAsJson; + int OutputAsJsonVersion; /** Map of configuration properties */ typedef std::map CTestConfigurationMap; diff --git a/Source/ctest.cxx b/Source/ctest.cxx index ca412ae..8ba126f 100644 --- a/Source/ctest.cxx +++ b/Source/ctest.cxx @@ -46,7 +46,10 @@ static const char* cmDocumentationOptions[][2] = { "given number of jobs." }, { "-Q,--quiet", "Make ctest quiet." }, { "-O , --output-log ", "Output to log file" }, - { "-N,--show-only", "Disable actual execution of tests." }, + { "-N,--show-only[=format]", + "Disable actual execution of tests. The optional 'format' defines the " + "format of the test information and can be 'human' for the current text " + "format or 'json-v1' for json format. Defaults to 'human'." }, { "-L , --label-regex ", "Run tests with labels matching " "regular expression." }, https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=757737075a3f998c9ecc93f5c467dabe4b005fee commit 757737075a3f998c9ecc93f5c467dabe4b005fee Author: Brad King AuthorDate: Wed Jan 9 14:21:34 2019 -0500 Commit: Brad King CommitDate: Wed Jan 9 14:38:12 2019 -0500 VS: Remove unused MSBuild XML parsing script It has been superseded by `cmConvertMSBuildXMLToJSON.py`. diff --git a/Source/cmparseMSBuildXML.py b/Source/cmparseMSBuildXML.py deleted file mode 100755 index 1b38d15..0000000 --- a/Source/cmparseMSBuildXML.py +++ /dev/null @@ -1,341 +0,0 @@ -# This python script parses the spec files from MSBuild to create -# mappings from compiler options to IDE XML specifications. For -# more information see here: - -# http://blogs.msdn.com/vcblog/archive/2008/12/16/msbuild-task.aspx -# "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/1033/cl.xml" -# "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/1033/lib.xml" -# "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/1033/link.xml" -# "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/V110/1033/cl.xml" -# "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/V110/1033/lib.xml" -# "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/V110/1033/link.xml" -# "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/v120/1033/cl.xml" -# "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/v120/1033/lib.xml" -# "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/v120/1033/link.xml" -# "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/V140/1033/cl.xml" -# "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/V140/1033/lib.xml" -# "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/V140/1033/link.xml" -# "${PROGRAMFILES}/Microsoft Visual Studio/VS15Preview/Common7/IDE/VC/VCTargets/1033/cl.xml" -# "${PROGRAMFILES}/Microsoft Visual Studio/VS15Preview/Common7/IDE/VC/VCTargets/1033/lib.xml" -# "${PROGRAMFILES}/Microsoft Visual Studio/VS15Preview/Common7/IDE/VC/VCTargets/1033/link.xml" -# -# BoolProperty true|false -# simple example: -# -# -# -# true -# -# -# argument means it might be this: /MP3 -# example with argument: -# -# -# Multi-processor Compilation -# -# -# Multi-processor Compilation -# -# -# -# -# true -# 4 -# -# IntProperty -# not used AFIT -# - - -# per config options example -# true -# -# EnumProperty -# -# -# Optimization -# -# -# Select option for code optimization; choose Custom to use specific optimization options. (/Od, /O1, /O2, /Ox) -# -# -# -# Maximize Speed -# -# -# Equivalent to /Og /Oi /Ot /Oy /Ob2 /Gs /GF /Gy -# -# -# -# -# Minimize Size -# -# -# Equivalent to /Og /Os /Oy /Ob2 /Gs /GF /Gy -# -# -# example for O2 would be this: -# MaxSpeed -# example for O1 would be this: -# MinSpace -# -# StringListProperty -# -# -# Preprocessor Definitions -# -# -# Defines a preprocessing symbols for your source file. -# -# - -# -# -# Additional Include Directories -# -# -# Specifies one or more directories to add to the include path; separate with semi-colons if more than one. (/I[path]) -# -# -# StringProperty - -# Example add bill include: - -# ..\..\..\..\..\..\bill;%(AdditionalIncludeDirectories) - - -import sys -from xml.dom.minidom import parse, parseString - -def getText(node): - nodelist = node.childNodes - rc = "" - for child in nodelist: - if child.nodeType == child.TEXT_NODE: - rc = rc + child.data - return rc - -def print_tree(document, spaces=""): - for i in range(len(document.childNodes)): - if document.childNodes[i].nodeType == document.childNodes[i].ELEMENT_NODE: - print spaces+str(document.childNodes[i].nodeName ) - print_tree(document.childNodes[i],spaces+"----") - pass - -########################################################################################### -#Data structure that stores a property of MSBuild -class Property: - #type = type of MSBuild property (ex. if the property is EnumProperty type should be "Enum") - #attributeNames = a list of any attributes that this property could have (ex. if this was a EnumProperty it should be ["Name","Category"]) - #document = the dom file that's root node is the Property node (ex. if you were parsing a BoolProperty the root node should be something like - def __init__(self,type,attributeNames,document=None): - self.suffix_type = "Property" - self.prefix_type = type - self.attributeNames = attributeNames - self.attributes = {} - self.DisplayName = "" - self.Description = "" - self.argumentProperty = "" - self.argumentIsRequired = "" - self.values = [] - if document is not None: - self.populate(document) - pass - - #document = the dom file that's root node is the Property node (ex. if you were parsing a BoolProperty the root node should be something like - #spaces = do not use - def populate(self,document, spaces = ""): - if document.nodeName == self.prefix_type+self.suffix_type: - for i in self.attributeNames: - self.attributes[i] = document.getAttribute(i) - for i in range(len(document.childNodes)): - child = document.childNodes[i] - if child.nodeType == child.ELEMENT_NODE: - if child.nodeName == self.prefix_type+self.suffix_type+".DisplayName": - self.DisplayName = getText(child.childNodes[1]) - if child.nodeName == self.prefix_type+self.suffix_type+".Description": - self.Description = getText(child.childNodes[1]) - if child.nodeName == "Argument": - self.argumentProperty = child.getAttribute("Property") - self.argumentIsRequired = child.getAttribute("IsRequired") - if child.nodeName == self.prefix_type+"Value": - va = Property(self.prefix_type,["Name","DisplayName","Switch"]) - va.suffix_type = "Value" - va.populate(child) - self.values.append(va) - self.populate(child,spaces+"----") - pass - - #toString function - def __str__(self): - toReturn = self.prefix_type+self.suffix_type+":" - for i in self.attributeNames: - toReturn += "\n "+i+": "+self.attributes[i] - if self.argumentProperty != "": - toReturn += "\n Argument:\n Property: "+self.argumentProperty+"\n IsRequired: "+self.argumentIsRequired - for i in self.values: - toReturn+="\n "+str(i).replace("\n","\n ") - return toReturn -########################################################################################### - -########################################################################################### -#Class that populates itself from an MSBuild file and outputs it in CMake -#format - -class MSBuildToCMake: - #document = the entire MSBuild xml file - def __init__(self,document=None): - self.enumProperties = [] - self.stringProperties = [] - self.stringListProperties = [] - self.boolProperties = [] - self.intProperties = [] - if document!=None : - self.populate(document) - pass - - #document = the entire MSBuild xml file - #spaces = don't use - #To add a new property (if they exist) copy and paste this code and fill in appropriate places - # - #if child.nodeName == "Property": - # self.Properties.append(Property("",[],child)) - # - #Replace with the name of the new property (ex. if property is StringProperty replace with String) - #Replace with a list of attributes in your property's root node - #in the __init__ function add the line self.Properties = [] - # - #That is all that is required to add new properties - # - def populate(self,document, spaces=""): - for i in range(len(document.childNodes)): - child = document.childNodes[i] - if child.nodeType == child.ELEMENT_NODE: - if child.nodeName == "EnumProperty": - self.enumProperties.append(Property("Enum",["Name","Category"],child)) - if child.nodeName == "StringProperty": - self.stringProperties.append(Property("String",["Name","Subtype","Separator","Category","Visible","IncludeInCommandLine","Switch","DisplayName","ReadOnly"],child)) - if child.nodeName == "StringListProperty": - self.stringListProperties.append(Property("StringList",["Name","Category","Switch","DisplayName","Subtype"],child)) - if child.nodeName == "BoolProperty": - self.boolProperties.append(Property("Bool",["ReverseSwitch","Name","Category","Switch","DisplayName","SwitchPrefix","IncludeInCommandLine"],child)) - if child.nodeName == "IntProperty": - self.intProperties.append(Property("Int",["Name","Category","Visible"],child)) - self.populate(child,spaces+"----") - pass - - #outputs information that CMake needs to know about MSBuild xml files - def toCMake(self): - toReturn = "static cmVS7FlagTable cmVS10CxxTable[] =\n{\n" - toReturn += "\n //Enum Properties\n" - lastProp = {} - for i in self.enumProperties: - if i.attributes["Name"] == "CompileAsManaged": - #write these out after the rest of the enumProperties - lastProp = i - continue - for j in i.values: - #hardcore Brad King's manual fixes for cmVS10CLFlagTable.h - if i.attributes["Name"] == "PrecompiledHeader" and j.attributes["Switch"] != "": - toReturn+=" {\""+i.attributes["Name"]+"\", \""+j.attributes["Switch"]+"\",\n \""+j.attributes["DisplayName"]+"\", \""+j.attributes["Name"]+"\",\n cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},\n" - else: - #default (normal, non-hardcoded) case - toReturn+=" {\""+i.attributes["Name"]+"\", \""+j.attributes["Switch"]+"\",\n \""+j.attributes["DisplayName"]+"\", \""+j.attributes["Name"]+"\", 0},\n" - toReturn += "\n" - - if lastProp != {}: - for j in lastProp.values: - toReturn+=" {\""+lastProp.attributes["Name"]+"\", \""+j.attributes["Switch"]+"\",\n \""+j.attributes["DisplayName"]+"\", \""+j.attributes["Name"]+"\", 0},\n" - toReturn += "\n" - - toReturn += "\n //Bool Properties\n" - for i in self.boolProperties: - if i.argumentProperty == "": - if i.attributes["ReverseSwitch"] != "": - toReturn += " {\""+i.attributes["Name"]+"\", \""+i.attributes["ReverseSwitch"]+"\", \"\", \"false\", 0},\n" - if i.attributes["Switch"] != "": - toReturn += " {\""+i.attributes["Name"]+"\", \""+i.attributes["Switch"]+"\", \"\", \"true\", 0},\n" - - toReturn += "\n //Bool Properties With Argument\n" - for i in self.boolProperties: - if i.argumentProperty != "": - if i.attributes["ReverseSwitch"] != "": - toReturn += " {\""+i.attributes["Name"]+"\", \""+i.attributes["ReverseSwitch"]+"\", \"\", \"false\",\n cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},\n" - toReturn += " {\""+i.attributes["Name"]+"\", \""+i.attributes["ReverseSwitch"]+"\", \""+i.attributes["DisplayName"]+"\", \"\",\n cmVS7FlagTable::UserValueRequired},\n" - if i.attributes["Switch"] != "": - toReturn += " {\""+i.attributes["Name"]+"\", \""+i.attributes["Switch"]+"\", \"\", \"true\",\n cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},\n" - toReturn += " {\""+i.argumentProperty+"\", \""+i.attributes["Switch"]+"\", \""+i.attributes["DisplayName"]+"\", \"\",\n cmVS7FlagTable::UserValueRequired},\n" - - toReturn += "\n //String List Properties\n" - for i in self.stringListProperties: - if i.attributes["Switch"] == "": - toReturn += " // Skip [" + i.attributes["Name"] + "] - no command line Switch.\n"; - else: - toReturn +=" {\""+i.attributes["Name"]+"\", \""+i.attributes["Switch"]+"\",\n \""+i.attributes["DisplayName"]+"\",\n \"\", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable},\n" - - toReturn += "\n //String Properties\n" - for i in self.stringProperties: - if i.attributes["Switch"] == "": - if i.attributes["Name"] == "PrecompiledHeaderFile": - #more hardcoding - toReturn += " {\"PrecompiledHeaderFile\", \"Yc\",\n" - toReturn += " \"Precompiled Header Name\",\n" - toReturn += " \"\", cmVS7FlagTable::UserValueRequired},\n" - toReturn += " {\"PrecompiledHeaderFile\", \"Yu\",\n" - toReturn += " \"Precompiled Header Name\",\n" - toReturn += " \"\", cmVS7FlagTable::UserValueRequired},\n" - else: - toReturn += " // Skip [" + i.attributes["Name"] + "] - no command line Switch.\n"; - else: - toReturn +=" {\""+i.attributes["Name"]+"\", \""+i.attributes["Switch"]+i.attributes["Separator"]+"\",\n \""+i.attributes["DisplayName"]+"\",\n \"\", cmVS7FlagTable::UserValue},\n" - - toReturn += " {0,0,0,0,0}\n};" - return toReturn - pass - - #toString function - def __str__(self): - toReturn = "" - allList = [self.enumProperties,self.stringProperties,self.stringListProperties,self.boolProperties,self.intProperties] - for p in allList: - for i in p: - toReturn += "==================================================\n"+str(i).replace("\n","\n ")+"\n==================================================\n" - - return toReturn -########################################################################################### - -########################################################################################### -# main function -def main(argv): - xml_file = None - help = """ - Please specify an input xml file with -x - - Exiting... - Have a nice day :)""" - for i in range(0,len(argv)): - if argv[i] == "-x": - xml_file = argv[i+1] - if argv[i] == "-h": - print help - sys.exit(0) - pass - if xml_file == None: - print help - sys.exit(1) - - f = open(xml_file,"r") - xml_str = f.read() - xml_dom = parseString(xml_str) - - convertor = MSBuildToCMake(xml_dom) - print convertor.toCMake() - - xml_dom.unlink() -########################################################################################### -# main entry point -if __name__ == "__main__": - main(sys.argv) - -sys.exit(0) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5395c526fc0066aad302298ab9ad46cc19b771ab commit 5395c526fc0066aad302298ab9ad46cc19b771ab Author: Brad King AuthorDate: Wed Jan 9 09:25:20 2019 -0500 Commit: Brad King CommitDate: Wed Jan 9 11:31:55 2019 -0500 cmake: Drop unused table entry for selecting default generator In `cmake::CreateDefaultGlobalGenerator` the table of registry entries does not need an entry for VS 2017 because that is found via the VS setup helper. diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 1bc36cc..e1bae34 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1528,7 +1528,6 @@ void cmake::CreateDefaultGlobalGenerator() const char* GeneratorName; }; static VSVersionedGenerator const vsGenerators[] = { - { "15.0", "Visual Studio 15 2017" }, // { "14.0", "Visual Studio 14 2015" }, // { "12.0", "Visual Studio 12 2013" }, // { "11.0", "Visual Studio 11 2012" }, // https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7b81d8c21e0a0d8756f0afdc0530c2d06ee3bcd4 commit 7b81d8c21e0a0d8756f0afdc0530c2d06ee3bcd4 Author: Justin Goshi AuthorDate: Thu Oct 18 11:33:01 2018 -0700 Commit: Brad King CommitDate: Tue Jan 8 11:22:11 2019 -0500 TestGenerator: Record support file and line where test was added Add internal test properties that ctest can use to report where the test was added in CMake code. diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 2e1bb0a..9fd2299 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -2147,6 +2147,32 @@ bool cmCTestTestHandler::SetTestsProperties( for (std::string const& t : tests) { for (cmCTestTestProperties& rt : this->TestList) { if (t == rt.Name) { + if (key == "_BACKTRACE_TRIPLES") { + std::vector triples; + // allow empty args in the triples + cmSystemTools::ExpandListArgument(val, triples, true); + + // Ensure we have complete triples otherwise the data is corrupt. + if (triples.size() % 3 == 0) { + cmState state; + rt.Backtrace = cmListFileBacktrace(state.CreateBaseSnapshot()); + + // the first entry represents the top of the trace so we need to + // reconstruct the backtrace in reverse + for (size_t i = triples.size(); i >= 3; i -= 3) { + cmListFileContext fc; + fc.FilePath = triples[i - 3]; + long line = 0; + if (!cmSystemTools::StringToLong(triples[i - 2].c_str(), + &line)) { + line = 0; + } + fc.Line = line; + fc.Name = triples[i - 1]; + rt.Backtrace = rt.Backtrace.Push(fc); + } + } + } if (key == "WILL_FAIL") { rt.WillFail = cmSystemTools::IsOn(val); } diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h index bcacf23..0b557db 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -7,6 +7,7 @@ #include "cmCTestGenericHandler.h" #include "cmDuration.h" +#include "cmListFileCache.h" #include "cmsys/RegularExpression.hxx" #include @@ -141,6 +142,8 @@ public: std::set FixturesCleanup; std::set FixturesRequired; std::set RequireSuccessDepends; + // Private test generator properties used to track backtraces + cmListFileBacktrace Backtrace; }; struct cmCTestTestResult diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx index 796d2df..e4ced6e 100644 --- a/Source/cmTestGenerator.cxx +++ b/Source/cmTestGenerator.cxx @@ -7,14 +7,16 @@ #include "cmGeneratorExpression.h" #include "cmGeneratorTarget.h" +#include "cmListFileCache.h" #include "cmLocalGenerator.h" #include "cmOutputConverter.h" #include "cmProperty.h" -#include "cmPropertyMap.h" #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmTest.h" +class cmPropertyMap; + cmTestGenerator::cmTestGenerator( cmTest* test, std::vector const& configurations) : cmScriptGenerator("CTEST_CONFIGURATION_TYPE", configurations) @@ -121,16 +123,15 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os, // Output properties for the test. cmPropertyMap& pm = this->Test->GetProperties(); - if (!pm.empty()) { - os << indent << "set_tests_properties(" << this->Test->GetName() - << " PROPERTIES "; - for (auto const& i : pm) { - os << " " << i.first << " " - << cmOutputConverter::EscapeForCMake( - ge.Parse(i.second.GetValue())->Evaluate(this->LG, config)); - } - os << ")" << std::endl; + os << indent << "set_tests_properties(" << this->Test->GetName() + << " PROPERTIES "; + for (auto const& i : pm) { + os << " " << i.first << " " + << cmOutputConverter::EscapeForCMake( + ge.Parse(i.second.GetValue())->Evaluate(this->LG, config)); } + this->GenerateInternalProperties(os); + os << ")" << std::endl; } void cmTestGenerator::GenerateScriptNoConfig(std::ostream& os, Indent indent) @@ -179,13 +180,37 @@ void cmTestGenerator::GenerateOldStyle(std::ostream& fout, Indent indent) // Output properties for the test. cmPropertyMap& pm = this->Test->GetProperties(); - if (!pm.empty()) { - fout << indent << "set_tests_properties(" << this->Test->GetName() - << " PROPERTIES "; - for (auto const& i : pm) { - fout << " " << i.first << " " - << cmOutputConverter::EscapeForCMake(i.second.GetValue()); + fout << indent << "set_tests_properties(" << this->Test->GetName() + << " PROPERTIES "; + for (auto const& i : pm) { + fout << " " << i.first << " " + << cmOutputConverter::EscapeForCMake(i.second.GetValue()); + } + this->GenerateInternalProperties(fout); + fout << ")" << std::endl; +} + +void cmTestGenerator::GenerateInternalProperties(std::ostream& os) +{ + cmListFileBacktrace bt = this->Test->GetBacktrace(); + if (bt.Empty()) { + return; + } + + os << " " + << "_BACKTRACE_TRIPLES" + << " \""; + + bool prependTripleSeparator = false; + while (!bt.Empty()) { + const auto& entry = bt.Top(); + if (prependTripleSeparator) { + os << ";"; } - fout << ")" << std::endl; + os << entry.FilePath << ";" << entry.Line << ";" << entry.Name; + bt = bt.Pop(); + prependTripleSeparator = true; } + + os << "\""; } diff --git a/Source/cmTestGenerator.h b/Source/cmTestGenerator.h index 73d05a3..f26d2ff 100644 --- a/Source/cmTestGenerator.h +++ b/Source/cmTestGenerator.h @@ -35,6 +35,9 @@ public: cmTest* GetTest() const; +private: + void GenerateInternalProperties(std::ostream& os); + protected: void GenerateScriptConfigs(std::ostream& os, Indent indent) override; void GenerateScriptActions(std::ostream& os, Indent indent) override; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=00530d74d5d07a320c998d6caccc00cf4e59b06d commit 00530d74d5d07a320c998d6caccc00cf4e59b06d Author: Brad King AuthorDate: Fri Nov 2 09:36:31 2018 -0400 Commit: Brad King CommitDate: Tue Jan 8 11:22:11 2019 -0500 Tests: Pass python interpreter into RunCMake.CTestCommandLine This will be useful for adding python-based result checks. diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 67fd65a..e222376 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -385,8 +385,9 @@ add_RunCMake_test(CPackConfig) add_RunCMake_test(CPackInstallProperties) add_RunCMake_test(ExternalProject) add_RunCMake_test(FetchContent) +set(CTestCommandLine_ARGS -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}) if(NOT CMake_TEST_EXTERNAL_CMAKE) - set(CTestCommandLine_ARGS -DTEST_AFFINITY=$) + list(APPEND CTestCommandLine_ARGS -DTEST_AFFINITY=$) endif() add_executable(print_stdin print_stdin.c) add_RunCMake_test(CTestCommandLine -DTEST_PRINT_STDIN=$) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9045f6a30fc8ce21d2b2298c27ba1da41c23bbf3 commit 9045f6a30fc8ce21d2b2298c27ba1da41c23bbf3 Author: Tobias Hunger AuthorDate: Wed Nov 28 15:07:31 2018 +0100 Commit: Tobias Hunger CommitDate: Mon Jan 7 14:13:10 2019 +0100 Autogen: Prepare for Qt 6 Handle Qt version > 5 in Qt AutoGen. This patch does *NOT* include tests and documentation: There is no Qt 6 yet. I still need this patch to work on a cmake based build system for Qt 6. diff --git a/Source/cmQtAutoGenGlobalInitializer.cxx b/Source/cmQtAutoGenGlobalInitializer.cxx index 5470ec3..0ed8af4 100644 --- a/Source/cmQtAutoGenGlobalInitializer.cxx +++ b/Source/cmQtAutoGenGlobalInitializer.cxx @@ -77,7 +77,8 @@ cmQtAutoGenGlobalInitializer::cmQtAutoGenGlobalInitializer( if (moc || uic || rcc) { // We support Qt4 and Qt5 auto qtVersion = cmQtAutoGenInitializer::GetQtVersion(target); - if ((qtVersion.Major == 4) || (qtVersion.Major == 5)) { + if ((qtVersion.Major == 4) || (qtVersion.Major == 5) || + (qtVersion.Major == 6)) { // Create autogen target initializer Initializers_.emplace_back(cm::make_unique( this, target, qtVersion, moc, uic, rcc, globalAutoGenTarget, diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index 6a2a951..ffa6a35 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -42,6 +42,9 @@ std::string GetQtExecutableTargetName( const cmQtAutoGen::IntegerVersion& qtVersion, std::string const& executable) { + if (qtVersion.Major == 6) { + return ("Qt6::" + executable); + } if (qtVersion.Major == 5) { return ("Qt5::" + executable); } @@ -504,7 +507,7 @@ bool cmQtAutoGenInitializer::InitMoc() { // We need to disable this until we have all implicit includes available. // See issue #18669. - // bool const appendImplicit = (this->QtVersion.Major == 5); + // bool const appendImplicit = (this->QtVersion.Major >= 5); auto GetIncludeDirs = [this, localGen](std::string const& cfg) -> std::vector { @@ -839,7 +842,7 @@ bool cmQtAutoGenInitializer::InitScanFiles() // Process qrc files if (!this->Rcc.Qrcs.empty()) { - const bool QtV5 = (this->QtVersion.Major == 5); + const bool modernQt = (this->QtVersion.Major >= 5); // Target rcc options std::vector optionsTarget; cmSystemTools::ExpandListArgument( @@ -911,10 +914,10 @@ bool cmQtAutoGenInitializer::InitScanFiles() std::vector nameOpts; nameOpts.emplace_back("-name"); nameOpts.emplace_back(std::move(name)); - RccMergeOptions(opts, nameOpts, QtV5); + RccMergeOptions(opts, nameOpts, modernQt); } // Merge file option - RccMergeOptions(opts, qrc.Options, QtV5); + RccMergeOptions(opts, qrc.Options, modernQt); qrc.Options = std::move(opts); } // RCC resources @@ -1374,7 +1377,7 @@ static std::vector GetKnownQtVersions( std::vector result; for (const std::string& prefix : - std::vector({ "Qt5Core", "QT" })) { + std::vector({ "Qt6Core", "Qt5Core", "QT" })) { auto tmp = cmQtAutoGenInitializer::IntegerVersion( StringToInt(makefile->GetSafeDefinition(prefix + "_VERSION_MAJOR")), StringToInt(makefile->GetSafeDefinition(prefix + "_VERSION_MINOR"))); @@ -1427,7 +1430,7 @@ std::pair GetQtExecutable( GetQtExecutableTargetName(qtVersion, executable); if (targetName.empty()) { err = "The AUTOMOC, AUTOUIC and AUTORCC feature "; - err += "supports only Qt 4 and Qt 5"; + err += "supports only Qt 4, Qt 5 and Qt 6."; } else { cmLocalGenerator* localGen = target->GetLocalGenerator(); cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse(targetName); @@ -1510,7 +1513,7 @@ bool cmQtAutoGenInitializer::GetRccExecutable() return false; } - if (this->QtVersion.Major == 5) { + if (this->QtVersion.Major == 5 || this->QtVersion.Major == 6) { if (stdOut.find("--list") != std::string::npos) { this->Rcc.ListOptions.push_back("--list"); } else { ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-properties.7.rst | 3 + Help/manual/ctest.1.rst | 71 ++++- Help/prop_tgt/AUTOMOC.rst | 3 + Help/prop_tgt/AUTOMOC_EXECUTABLE.rst | 15 + Help/prop_tgt/AUTORCC.rst | 3 + Help/prop_tgt/AUTORCC_EXECUTABLE.rst | 15 + Help/prop_tgt/AUTOUIC.rst | 3 + Help/prop_tgt/AUTOUIC_EXECUTABLE.rst | 15 + Help/release/dev/autogen_executables.rst | 9 + Help/release/dev/ctest-show-only-json-v1.rst | 6 + Source/CTest/cmCTestMultiProcessHandler.cxx | 331 ++++++++++++++++++++ Source/CTest/cmCTestMultiProcessHandler.h | 1 + Source/CTest/cmCTestRunTest.h | 4 + Source/CTest/cmCTestTestHandler.cxx | 26 ++ Source/CTest/cmCTestTestHandler.h | 3 + Source/cmCTest.cxx | 26 ++ Source/cmCTest.h | 6 + Source/cmGlobalVisualStudio10Generator.cxx | 31 +- Source/cmGlobalVisualStudio10Generator.h | 5 +- Source/cmGlobalVisualStudio11Generator.cxx | 10 - Source/cmGlobalVisualStudio11Generator.h | 3 - Source/cmGlobalVisualStudio12Generator.cxx | 10 - Source/cmGlobalVisualStudio12Generator.h | 8 - Source/cmGlobalVisualStudio14Generator.cxx | 11 - Source/cmGlobalVisualStudio14Generator.h | 5 - Source/cmGlobalVisualStudio15Generator.cxx | 11 - Source/cmGlobalVisualStudio15Generator.h | 6 - Source/cmGlobalVisualStudio71Generator.cxx | 6 - Source/cmGlobalVisualStudio71Generator.h | 1 - Source/cmGlobalVisualStudio7Generator.h | 1 - Source/cmGlobalVisualStudio8Generator.h | 5 - Source/cmGlobalVisualStudio9Generator.cxx | 6 - Source/cmGlobalVisualStudio9Generator.h | 9 - Source/cmGlobalVisualStudioGenerator.cxx | 71 +++++ Source/cmGlobalVisualStudioGenerator.h | 8 +- Source/cmQtAutoGenGlobalInitializer.cxx | 21 +- Source/cmQtAutoGenInitializer.cxx | 78 +++-- Source/cmTestGenerator.cxx | 59 +++- Source/cmTestGenerator.h | 3 + Source/cmake.cxx | 1 - Source/cmparseMSBuildXML.py | 341 --------------------- Source/ctest.cxx | 5 +- Tests/RunCMake/CMakeLists.txt | 3 +- Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake | 29 ++ .../RunCMake/CTestCommandLine/ShowAsJson1-check.py | 106 +++++++ .../RunCMake/CTestCommandLine/ShowAsJson_check.py | 24 ++ 46 files changed, 924 insertions(+), 493 deletions(-) create mode 100644 Help/prop_tgt/AUTOMOC_EXECUTABLE.rst create mode 100644 Help/prop_tgt/AUTORCC_EXECUTABLE.rst create mode 100644 Help/prop_tgt/AUTOUIC_EXECUTABLE.rst create mode 100644 Help/release/dev/autogen_executables.rst create mode 100644 Help/release/dev/ctest-show-only-json-v1.rst delete mode 100755 Source/cmparseMSBuildXML.py create mode 100644 Tests/RunCMake/CTestCommandLine/ShowAsJson1-check.py create mode 100644 Tests/RunCMake/CTestCommandLine/ShowAsJson_check.py hooks/post-receive -- CMake From kwrobot at kitware.com Thu Jan 10 09:43:06 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 10 Jan 2019 09:43:06 -0500 (EST) Subject: [Cmake-commits] CMake branch, release, updated. v3.13.2-7-g91fa6a4 Message-ID: <20190110144306.9CD851137AC@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, release has been updated via 91fa6a472cd262014a74d765b003bb1cc9d7ab8a (commit) via 2ec3363ea5f5c569063a9094959cf166a54f8ce2 (commit) via 6d53a60f007b0a1a1c03ce5f9373eddc55f49d5a (commit) from 88c710ab56576fb80abd7940926c0fe461cf2469 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Source/cmake.cxx | 15 +++++++++++++++ Tests/RunCMake/CommandLine/C-no-file-stderr.txt | 2 +- .../Cno-file-result.txt} | 0 .../{C-no-file-stderr.txt => Cno-file-stderr.txt} | 2 +- .../D-no-src-result.txt} | 0 .../{cache-no-file-stderr.txt => D-no-src-stderr.txt} | 2 +- .../Dno-src-result.txt} | 0 .../{cache-no-file-stderr.txt => Dno-src-stderr.txt} | 2 +- Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 5 +++++ .../U-no-src-result.txt} | 0 .../{cache-no-file-stderr.txt => U-no-src-stderr.txt} | 2 +- .../Uno-src-result.txt} | 0 .../{cache-no-file-stderr.txt => Uno-src-stderr.txt} | 2 +- 13 files changed, 26 insertions(+), 6 deletions(-) copy Tests/RunCMake/{while/MissingArgument-result.txt => CommandLine/Cno-file-result.txt} (100%) copy Tests/RunCMake/CommandLine/{C-no-file-stderr.txt => Cno-file-stderr.txt} (76%) copy Tests/RunCMake/{while/MissingArgument-result.txt => CommandLine/D-no-src-result.txt} (100%) copy Tests/RunCMake/CommandLine/{cache-no-file-stderr.txt => D-no-src-stderr.txt} (68%) copy Tests/RunCMake/{while/MissingArgument-result.txt => CommandLine/Dno-src-result.txt} (100%) copy Tests/RunCMake/CommandLine/{cache-no-file-stderr.txt => Dno-src-stderr.txt} (69%) copy Tests/RunCMake/{while/MissingArgument-result.txt => CommandLine/U-no-src-result.txt} (100%) copy Tests/RunCMake/CommandLine/{cache-no-file-stderr.txt => U-no-src-stderr.txt} (68%) copy Tests/RunCMake/{while/MissingArgument-result.txt => CommandLine/Uno-src-result.txt} (100%) copy Tests/RunCMake/CommandLine/{cache-no-file-stderr.txt => Uno-src-stderr.txt} (69%) hooks/post-receive -- CMake From kwrobot at kitware.com Fri Jan 11 00:03:05 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 11 Jan 2019 00:03:05 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.2-855-gac0b59e Message-ID: <20190111050305.42827125801@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via ac0b59ef015b296114a97fc61ef4f9677302da03 (commit) from 6092a770f66bff959749170141d44188f4b6f3f1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ac0b59ef015b296114a97fc61ef4f9677302da03 commit ac0b59ef015b296114a97fc61ef4f9677302da03 Author: Kitware Robot AuthorDate: Fri Jan 11 00:01:05 2019 -0500 Commit: Kitware Robot CommitDate: Fri Jan 11 00:01:05 2019 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 220040c..2c83140 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 13) -set(CMake_VERSION_PATCH 20190110) +set(CMake_VERSION_PATCH 20190111) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Fri Jan 11 07:43:06 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 11 Jan 2019 07:43:06 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.2-857-g003759b Message-ID: <20190111124306.DBBB4127AD1@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 003759ba0da49dfa35bccfc1c4432e4ec935cd86 (commit) via 5a5a1d90f01d6364426be5f08244e9acf0526734 (commit) from ac0b59ef015b296114a97fc61ef4f9677302da03 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=003759ba0da49dfa35bccfc1c4432e4ec935cd86 commit 003759ba0da49dfa35bccfc1c4432e4ec935cd86 Merge: ac0b59e 5a5a1d9 Author: Brad King AuthorDate: Fri Jan 11 12:42:45 2019 +0000 Commit: Kitware Robot CommitDate: Fri Jan 11 07:42:54 2019 -0500 Merge topic 'threads' 5a5a1d90f0 Help: FindThreads not needed with modern C++. Acked-by: Kitware Robot Merge-request: !2776 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5a5a1d90f01d6364426be5f08244e9acf0526734 commit 5a5a1d90f01d6364426be5f08244e9acf0526734 Author: Joachim Wuttke (o) AuthorDate: Wed Jan 9 11:01:46 2019 +0100 Commit: Joachim Wuttke (o) CommitDate: Wed Jan 9 11:03:44 2019 +0100 Help: FindThreads not needed with modern C++. diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake index 9c96a1b..5d894c8 100644 --- a/Modules/FindThreads.cmake +++ b/Modules/FindThreads.cmake @@ -29,9 +29,12 @@ caller can set THREADS_PREFER_PTHREAD_FLAG -Please note that the compiler flag can only be used with the imported +The compiler flag can only be used with the imported target. Use of both the imported target as well as this switch is highly recommended for new code. + +This module is not needed for C++11 and later if threading is done using +``std::thread`` from the standard library. #]=======================================================================] include (CheckLibraryExists) ----------------------------------------------------------------------- Summary of changes: Modules/FindThreads.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Fri Jan 11 07:53:06 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 11 Jan 2019 07:53:06 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.2-867-g283c93f Message-ID: <20190111125306.784BC127B80@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 283c93fe9abe481836a41eb3e565a02d215965c5 (commit) via 9e8f2e509f61c4478f2176a03e45c1fd35537d82 (commit) via 60666e2cd38d4c2922cc4fdc2e062fec975bc5f3 (commit) via c84fe1e71fb9bd9bbb4a5d5184b58ecffe8192e3 (commit) via 9143627c93aaa3fadd54aabaf662918e8f882c6a (commit) via 74720a298cec05af29f18315990f64ddfda344f6 (commit) via 9922e70b1ac308a74bbd3aeceb4cc0406b12f55b (commit) via 5000fed5af6925a7d57083c8806ea0537e97bdda (commit) via 20b7826e1477c4463c9fc7f710f02d5f58a0749f (commit) via 261ae28ccde2059905b7febeb5126515c2da39ef (commit) from 003759ba0da49dfa35bccfc1c4432e4ec935cd86 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=283c93fe9abe481836a41eb3e565a02d215965c5 commit 283c93fe9abe481836a41eb3e565a02d215965c5 Merge: 9e8f2e5 74720a2 Author: Brad King AuthorDate: Fri Jan 11 12:52:36 2019 +0000 Commit: Kitware Robot CommitDate: Fri Jan 11 07:52:53 2019 -0500 Merge topic 'xl-early-bE' 74720a298c XL: Move '-bE' flag earlier so it can be overridden Acked-by: Kitware Robot Merge-request: !2771 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9e8f2e509f61c4478f2176a03e45c1fd35537d82 commit 9e8f2e509f61c4478f2176a03e45c1fd35537d82 Merge: 60666e2 5000fed Author: Brad King AuthorDate: Fri Jan 11 12:51:57 2019 +0000 Commit: Kitware Robot CommitDate: Fri Jan 11 07:52:05 2019 -0500 Merge topic 'bison_target_policy' 5000fed5af FindBISON: Add policy CMP0088 to run bison in build tree Acked-by: Kitware Robot Merge-request: !2774 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=60666e2cd38d4c2922cc4fdc2e062fec975bc5f3 commit 60666e2cd38d4c2922cc4fdc2e062fec975bc5f3 Merge: c84fe1e 261ae28 Author: Brad King AuthorDate: Fri Jan 11 12:43:08 2019 +0000 Commit: Kitware Robot CommitDate: Fri Jan 11 07:46:16 2019 -0500 Merge topic 'fix-doc-typo' 261ae28ccd Help: fix typo for CTEST_CUSTOM_TESTS_IGNORE Acked-by: Kitware Robot Merge-request: !2770 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c84fe1e71fb9bd9bbb4a5d5184b58ecffe8192e3 commit c84fe1e71fb9bd9bbb4a5d5184b58ecffe8192e3 Merge: 9143627 20b7826 Author: Brad King AuthorDate: Fri Jan 11 12:42:54 2019 +0000 Commit: Kitware Robot CommitDate: Fri Jan 11 07:45:07 2019 -0500 Merge topic 'sort1' 20b7826e14 Help: correct alphabetical sorting of lines Acked-by: Kitware Robot Merge-request: !2784 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9143627c93aaa3fadd54aabaf662918e8f882c6a commit 9143627c93aaa3fadd54aabaf662918e8f882c6a Merge: 003759b 9922e70 Author: Brad King AuthorDate: Fri Jan 11 12:43:02 2019 +0000 Commit: Kitware Robot CommitDate: Fri Jan 11 07:43:57 2019 -0500 Merge topic 'doc-roff-fix' 9922e70b1a Help: Prevent .so from being treated as a roff macro Acked-by: Kitware Robot Merge-request: !2756 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=74720a298cec05af29f18315990f64ddfda344f6 commit 74720a298cec05af29f18315990f64ddfda344f6 Author: Rob Boehne AuthorDate: Thu Jan 3 16:42:23 2019 -0600 Commit: Brad King CommitDate: Thu Jan 10 14:25:06 2019 -0500 XL: Move '-bE' flag earlier so it can be overridden By default, we generate an export list for a shared library and pass that file on the link line. The problem was that it could not be overridden by a target when a specific export file is being used. Multiple `-bE` flags on the link are overridden by subsequent `-bE` flags, so only the last one is used. Fixes: #13282 diff --git a/Modules/Compiler/XL.cmake b/Modules/Compiler/XL.cmake index 21fe5e8..68dc28a 100644 --- a/Modules/Compiler/XL.cmake +++ b/Modules/Compiler/XL.cmake @@ -48,7 +48,7 @@ macro(__compiler_xl lang) # files so that we export only the symbols actually provided by the sources. set(CMAKE_${lang}_CREATE_SHARED_LIBRARY "${CMAKE_XL_CreateExportList} /objects.exp " - " -Wl,-bE:/objects.exp -o " + " -Wl,-bE:/objects.exp -o " ) endif() endmacro() https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9922e70b1ac308a74bbd3aeceb4cc0406b12f55b commit 9922e70b1ac308a74bbd3aeceb4cc0406b12f55b Author: Raf Czlonka AuthorDate: Thu Dec 20 09:50:20 2018 -0500 Commit: Brad King CommitDate: Thu Jan 10 13:38:51 2019 -0500 Help: Prevent .so from being treated as a roff macro Move `.so` to the line above - otherwise it is being treated as a `roff` macro, i.e.: $ mandoc -Tlint /usr/local/man/man7/cmake-properties.7 | head -n 3 mandoc: /usr/local/man/man7/cmake-properties.7:1131:2: WARNING: .so is fragile, better use ln(1): so libraries. mandoc: /usr/local/man/man7/cmake-properties.7: ERROR: No such file or directory mandoc: /usr/local/man/man7/cmake-properties.7:1131:15: ERROR: .so request failed: .so libraries. and causes other issues down the line. diff --git a/Help/prop_tgt/ANDROID_NATIVE_LIB_DIRECTORIES.rst b/Help/prop_tgt/ANDROID_NATIVE_LIB_DIRECTORIES.rst index bc67380..d0cd29d 100644 --- a/Help/prop_tgt/ANDROID_NATIVE_LIB_DIRECTORIES.rst +++ b/Help/prop_tgt/ANDROID_NATIVE_LIB_DIRECTORIES.rst @@ -1,8 +1,8 @@ ANDROID_NATIVE_LIB_DIRECTORIES ------------------------------ -Set the Android property that specifies directories to search for the -.so libraries. +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. https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5000fed5af6925a7d57083c8806ea0537e97bdda commit 5000fed5af6925a7d57083c8806ea0537e97bdda Author: Robert Maynard AuthorDate: Tue Jan 8 10:50:10 2019 -0500 Commit: Brad King CommitDate: Thu Jan 10 13:23:14 2019 -0500 FindBISON: Add policy CMP0088 to run bison in build tree diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index 40ec1ef..409b5b1 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -57,6 +57,7 @@ Policies Introduced by CMake 3.14 .. toctree:: :maxdepth: 1 + CMP0088: FindBISON runs bison in CMAKE_CURRENT_BINARY_DIR when executing. CMP0087: install(SCRIPT | CODE) supports generator expressions. CMP0086: UseSWIG honors SWIG_MODULE_NAME via -module flag. CMP0085: IN_LIST generator expression handles empty list items. diff --git a/Help/policy/CMP0088.rst b/Help/policy/CMP0088.rst new file mode 100644 index 0000000..82c04ef --- /dev/null +++ b/Help/policy/CMP0088.rst @@ -0,0 +1,29 @@ +CMP0088 +------- + +:module:`FindBISON` runs bison in :variable:`CMAKE_CURRENT_BINARY_DIR` +when executing. + +The module provides a ``BISON_TARGET`` macro which generates BISON output. +In CMake 3.13 and below the macro would generate a custom command that runs +``bison`` in the source directory. CMake 3.14 and later prefer to run it +in the build directory and use :variable:`CMAKE_CURRENT_BINARY_DIR` as the +``WORKING_DIRECTORY`` of its :command:`add_custom_command` invocation. +This ensures that any implicitly generated file is written to the build +tree rather than the source. + +This policy provides compatibility for projects that have not been updated +to expect the new behavior. + +The ``OLD`` behavior for this policy is for ``BISON_TARGET`` to use +the current source directory for the ``WORKING_DIRECTORY`` and where +to generate implicit files. The ``NEW`` behavior of this policy is to +use the current binary directory for the ``WORKING_DIRECTORY`` and where +to generate implicit files. + +This policy was introduced in CMake version 3.14. Use the +:command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. +Unlike most policies, CMake version |release| does *not* warn +when this policy is not set and simply uses ``OLD`` behavior. + +.. include:: DEPRECATED.txt diff --git a/Help/release/dev/bison_target_policy.rst b/Help/release/dev/bison_target_policy.rst new file mode 100644 index 0000000..3240318 --- /dev/null +++ b/Help/release/dev/bison_target_policy.rst @@ -0,0 +1,6 @@ +bison_target_policy +------------------- + +* The :module:`FindBISON` module's ``BISON_TARGET`` command now runs ``bison`` + with :variable:`CMAKE_CURRENT_BINARY_DIR` as the working directory. + See policy :policy:`CMP0088`. diff --git a/Modules/FindBISON.cmake b/Modules/FindBISON.cmake index d59dc27..06ac2d9 100644 --- a/Modules/FindBISON.cmake +++ b/Modules/FindBISON.cmake @@ -151,7 +151,15 @@ if(BISON_EXECUTABLE) list(APPEND BISON_TARGET_cmdopt "--report-file=${BISON_TARGET_verbose_file}") endif() if(NOT IS_ABSOLUTE "${BISON_TARGET_verbose_file}") - set(BISON_TARGET_verbose_file "${CMAKE_CURRENT_SOURCE_DIR}/${BISON_TARGET_verbose_file}") + cmake_policy(GET CMP0088 _BISON_CMP0088 + PARENT_SCOPE # undocumented, do not use outside of CMake + ) + if("x${_BISON_CMP0088}x" STREQUAL "xNEWx") + set(BISON_TARGET_verbose_file "${CMAKE_CURRENT_BINARY_DIR}/${BISON_TARGET_verbose_file}") + else() + set(BISON_TARGET_verbose_file "${CMAKE_CURRENT_SOURCE_DIR}/${BISON_TARGET_verbose_file}") + endif() + unset(_BISON_CMP0088) endif() endmacro() @@ -159,6 +167,15 @@ if(BISON_EXECUTABLE) # adds a custom command and sets # BISON_TARGET_cmdopt, BISON_TARGET_extraoutputs macro(BISON_TARGET_option_verbose Name BisonOutput filename) + cmake_policy(GET CMP0088 _BISON_CMP0088 + PARENT_SCOPE # undocumented, do not use outside of CMake + ) + set(_BISON_WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + if("x${_BISON_CMP0088}x" STREQUAL "xNEWx") + set(_BISON_WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + endif() + unset(_BISON_CMP0088) + list(APPEND BISON_TARGET_cmdopt "--verbose") list(APPEND BISON_TARGET_outputs "${BISON_TARGET_verbose_file}") @@ -166,8 +183,9 @@ if(BISON_EXECUTABLE) if(IS_ABSOLUTE "${filename}") set(BISON_TARGET_verbose_extra_file "${filename}") else() - set(BISON_TARGET_verbose_extra_file "${CMAKE_CURRENT_SOURCE_DIR}/${filename}") + set(BISON_TARGET_verbose_extra_file "${_BISON_WORKING_DIRECTORY}/${filename}") endif() + add_custom_command(OUTPUT ${BISON_TARGET_verbose_extra_file} COMMAND ${CMAKE_COMMAND} -E copy "${BISON_TARGET_verbose_file}" @@ -176,10 +194,11 @@ if(BISON_EXECUTABLE) DEPENDS "${BISON_TARGET_verbose_file}" COMMENT "[BISON][${Name}] Copying bison verbose table to ${filename}" - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + WORKING_DIRECTORY ${_BISON_WORKING_DIRECTORY}) list(APPEND BISON_TARGET_extraoutputs "${BISON_TARGET_verbose_extra_file}") unset(BISON_TARGET_verbose_extra_file) + unset(_BISON_WORKING_DIRECTORY) endif() endmacro() @@ -234,12 +253,23 @@ if(BISON_EXECUTABLE) list(APPEND BISON_TARGET_outputs "${BISON_TARGET_output_header}") + cmake_policy(GET CMP0088 _BISON_CMP0088 + PARENT_SCOPE # undocumented, do not use outside of CMake + ) + set(_BISON_WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + if("x${_BISON_CMP0088}x" STREQUAL "xNEWx") + set(_BISON_WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + endif() + unset(_BISON_CMP0088) + add_custom_command(OUTPUT ${BISON_TARGET_outputs} COMMAND ${BISON_EXECUTABLE} ${BISON_TARGET_cmdopt} -o ${BisonOutput} ${BisonInput} VERBATIM DEPENDS ${BisonInput} COMMENT "[BISON][${Name}] Building parser with bison ${BISON_VERSION}" - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + WORKING_DIRECTORY ${_BISON_WORKING_DIRECTORY}) + + unset(_BISON_WORKING_DIRECTORY) # define target variables set(BISON_${Name}_DEFINED TRUE) diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 206dd3d..314f27d 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -258,6 +258,9 @@ class cmMakefile; SELECT(POLICY, CMP0087, \ "Install CODE|SCRIPT allow the use of generator " \ "expressions.", \ + 3, 14, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0088, \ + "FindBISON runs bison in CMAKE_CURRENT_BINARY_DIR when executing.", \ 3, 14, 0, cmPolicies::WARN) #define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=20b7826e1477c4463c9fc7f710f02d5f58a0749f commit 20b7826e1477c4463c9fc7f710f02d5f58a0749f Author: Joachim Wuttke (o) AuthorDate: Thu Jan 10 12:57:49 2019 +0100 Commit: Joachim Wuttke (o) CommitDate: Thu Jan 10 12:58:59 2019 +0100 Help: correct alphabetical sorting of lines diff --git a/Help/manual/cmake-commands.7.rst b/Help/manual/cmake-commands.7.rst index aec9ba5..ee13e40 100644 --- a/Help/manual/cmake-commands.7.rst +++ b/Help/manual/cmake-commands.7.rst @@ -22,8 +22,8 @@ These commands are always available. /command/cmake_policy /command/configure_file /command/continue - /command/elseif /command/else + /command/elseif /command/endforeach /command/endfunction /command/endif @@ -53,9 +53,9 @@ These commands are always available. /command/option /command/return /command/separate_arguments + /command/set /command/set_directory_properties /command/set_property - /command/set /command/site_name /command/string /command/unset https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=261ae28ccde2059905b7febeb5126515c2da39ef commit 261ae28ccde2059905b7febeb5126515c2da39ef Author: Ben Boeckel AuthorDate: Wed Jan 2 15:39:43 2019 -0500 Commit: Ben Boeckel CommitDate: Wed Jan 2 15:42:33 2019 -0500 Help: fix typo for CTEST_CUSTOM_TESTS_IGNORE In commit v3.4.0-rc1~57^2 (Help: document CTEST_CUSTOM_* variables, 2015-09-17), the CTEST_CUSTOM_TESTS_IGNORE variable was documented with a typo. diff --git a/Auxiliary/vim/syntax/cmake.vim b/Auxiliary/vim/syntax/cmake.vim index b67ef06..1083036 100644 --- a/Auxiliary/vim/syntax/cmake.vim +++ b/Auxiliary/vim/syntax/cmake.vim @@ -733,7 +733,7 @@ syn keyword cmakeVariable contained \ CTEST_CUSTOM_POST_TEST \ CTEST_CUSTOM_PRE_MEMCHECK \ CTEST_CUSTOM_PRE_TEST - \ CTEST_CUSTOM_TEST_IGNORE + \ CTEST_CUSTOM_TESTS_IGNORE \ CTEST_CUSTOM_WARNING_EXCEPTION \ CTEST_CUSTOM_WARNING_MATCH \ CTEST_CVS_CHECKOUT diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index d808b1c..e464b0c 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -541,7 +541,7 @@ Variables for CTest /variable/CTEST_CUSTOM_POST_TEST /variable/CTEST_CUSTOM_PRE_MEMCHECK /variable/CTEST_CUSTOM_PRE_TEST - /variable/CTEST_CUSTOM_TEST_IGNORE + /variable/CTEST_CUSTOM_TESTS_IGNORE /variable/CTEST_CUSTOM_WARNING_EXCEPTION /variable/CTEST_CUSTOM_WARNING_MATCH /variable/CTEST_CVS_CHECKOUT diff --git a/Help/variable/CTEST_CUSTOM_TEST_IGNORE.rst b/Help/variable/CTEST_CUSTOM_TESTS_IGNORE.rst similarity index 71% rename from Help/variable/CTEST_CUSTOM_TEST_IGNORE.rst rename to Help/variable/CTEST_CUSTOM_TESTS_IGNORE.rst index 6114e60..57222ca 100644 --- a/Help/variable/CTEST_CUSTOM_TEST_IGNORE.rst +++ b/Help/variable/CTEST_CUSTOM_TESTS_IGNORE.rst @@ -1,5 +1,5 @@ -CTEST_CUSTOM_TEST_IGNORE ------------------------- +CTEST_CUSTOM_TESTS_IGNORE +------------------------- A list of regular expressions to use to exclude tests during the :command:`ctest_test` command. ----------------------------------------------------------------------- Summary of changes: Auxiliary/vim/syntax/cmake.vim | 2 +- Help/manual/cmake-commands.7.rst | 4 +-- Help/manual/cmake-policies.7.rst | 1 + Help/manual/cmake-variables.7.rst | 2 +- Help/policy/CMP0088.rst | 29 +++++++++++++++++ Help/prop_tgt/ANDROID_NATIVE_LIB_DIRECTORIES.rst | 4 +-- Help/release/dev/bison_target_policy.rst | 6 ++++ ...ST_IGNORE.rst => CTEST_CUSTOM_TESTS_IGNORE.rst} | 4 +-- Modules/Compiler/XL.cmake | 2 +- Modules/FindBISON.cmake | 38 +++++++++++++++++++--- Source/cmPolicies.h | 3 ++ 11 files changed, 82 insertions(+), 13 deletions(-) create mode 100644 Help/policy/CMP0088.rst create mode 100644 Help/release/dev/bison_target_policy.rst rename Help/variable/{CTEST_CUSTOM_TEST_IGNORE.rst => CTEST_CUSTOM_TESTS_IGNORE.rst} (71%) hooks/post-receive -- CMake From kwrobot at kitware.com Fri Jan 11 08:03:05 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 11 Jan 2019 08:03:05 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.2-874-g696c6af Message-ID: <20190111130305.09D78211F@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 696c6afcafa97d50ae7677d29e0f02e042a58088 (commit) via f15345be41c7b5514c2e0c3bd6cf4b8106b449e7 (commit) via 5951c676e6fd84e08e5ccaff8004c8cd8223f92a (commit) via fbb115d198783a32887649dc630e14119a045918 (commit) via b4444d605430b340a30f92f80ae8eccd37b1cd6b (commit) via 450131cc0e80f22f169f2647dc7ecb1bd1024cf6 (commit) via 266808c4130a0b40aed236381707462a9368a1eb (commit) from 283c93fe9abe481836a41eb3e565a02d215965c5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=696c6afcafa97d50ae7677d29e0f02e042a58088 commit 696c6afcafa97d50ae7677d29e0f02e042a58088 Merge: f15345b 266808c Author: Brad King AuthorDate: Fri Jan 11 13:00:39 2019 +0000 Commit: Kitware Robot CommitDate: Fri Jan 11 08:00:45 2019 -0500 Merge topic 'FindBoost-1.70' 266808c413 FindBoost: Add support for Boost 1.70 Acked-by: Kitware Robot Merge-request: !2747 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f15345be41c7b5514c2e0c3bd6cf4b8106b449e7 commit f15345be41c7b5514c2e0c3bd6cf4b8106b449e7 Merge: 5951c67 fbb115d Author: Brad King AuthorDate: Fri Jan 11 12:55:56 2019 +0000 Commit: Kitware Robot CommitDate: Fri Jan 11 07:56:11 2019 -0500 Merge topic 'FindICE-more-exe' fbb115d198 FindIce: Find slice2confluence and slice2matlab executables Acked-by: Kitware Robot Merge-request: !2773 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5951c676e6fd84e08e5ccaff8004c8cd8223f92a commit 5951c676e6fd84e08e5ccaff8004c8cd8223f92a Merge: 283c93f b4444d6 Author: Brad King AuthorDate: Fri Jan 11 12:55:20 2019 +0000 Commit: Kitware Robot CommitDate: Fri Jan 11 07:55:27 2019 -0500 Merge topic 'cpack-deb-rpm-split' b4444d6054 Tests: Split CPack DEB and RPM tests into smaller tests 450131cc0e Tests: Add infrastructure to split up large CPack tests Acked-by: Kitware Robot Merge-request: !2742 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fbb115d198783a32887649dc630e14119a045918 commit fbb115d198783a32887649dc630e14119a045918 Author: jspam <5172-jspam at users.noreply.gitlab.kitware.com> AuthorDate: Mon Jan 7 06:17:04 2019 -0500 Commit: Brad King CommitDate: Thu Jan 10 14:36:10 2019 -0500 FindIce: Find slice2confluence and slice2matlab executables diff --git a/Help/release/dev/FindICE-more-exe.rst b/Help/release/dev/FindICE-more-exe.rst new file mode 100644 index 0000000..fa18a88 --- /dev/null +++ b/Help/release/dev/FindICE-more-exe.rst @@ -0,0 +1,5 @@ +FindICE-more-exe +---------------- + +* The :module:`FindIce` module learned to find + ``slice2confluence`` and ``slice2matlab``. diff --git a/Modules/FindIce.cmake b/Modules/FindIce.cmake index 42d3d47..1e0f0b8 100644 --- a/Modules/FindIce.cmake +++ b/Modules/FindIce.cmake @@ -40,6 +40,7 @@ Where ```` is the name of an Ice component, for example Ice slice programs are reported in:: + Ice_SLICE2CONFLUENCE_EXECUTABLE - path to slice2confluence executable Ice_SLICE2CPP_EXECUTABLE - path to slice2cpp executable Ice_SLICE2CS_EXECUTABLE - path to slice2cs executable Ice_SLICE2FREEZEJ_EXECUTABLE - path to slice2freezej executable @@ -47,6 +48,7 @@ Ice slice programs are reported in:: Ice_SLICE2HTML_EXECUTABLE - path to slice2html executable Ice_SLICE2JAVA_EXECUTABLE - path to slice2java executable Ice_SLICE2JS_EXECUTABLE - path to slice2js executable + Ice_SLICE2MATLAB_EXECUTABLE - path to slice2matlab executable Ice_SLICE2OBJC_EXECUTABLE - path to slice2objc executable Ice_SLICE2PHP_EXECUTABLE - path to slice2php executable Ice_SLICE2PY_EXECUTABLE - path to slice2py executable @@ -185,6 +187,7 @@ Other variables one may set to control this module are:: icestormmigrate) set(_Ice_slice_programs + slice2confluence slice2cpp slice2cs slice2freezej @@ -192,6 +195,7 @@ Other variables one may set to control this module are:: slice2html slice2java slice2js + slice2matlab slice2objc slice2php slice2py https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b4444d605430b340a30f92f80ae8eccd37b1cd6b commit b4444d605430b340a30f92f80ae8eccd37b1cd6b Author: Kyle Edwards AuthorDate: Thu Dec 13 17:59:45 2018 -0500 Commit: Kyle Edwards CommitDate: Thu Jan 10 13:56:35 2019 -0500 Tests: Split CPack DEB and RPM tests into smaller tests The DEB and RPM tests are quite large, which can result in CTest clients timing out on these tests even though they're working properly. The RPM test in particular causes a lot of timeouts on the CMake dashboard machines. This change splits these tests into smaller tests so that they don't time out. diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 63c5374..875ebfc 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -461,7 +461,53 @@ if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja") add_RunCMake_test(ctest_labels_for_subprojects) endif() -add_RunCMake_test_group(CPack "DEB;RPM;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ;External") +set(cpack_tests + DEB.CUSTOM_NAMES + DEB.DEBUGINFO + DEB.DEFAULT_PERMISSIONS + DEB.DEPENDENCIES + DEB.EMPTY_DIR + DEB.VERSION + DEB.EXTRA + DEB.GENERATE_SHLIBS + DEB.GENERATE_SHLIBS_LDCONFIG + DEB.LONG_FILENAMES + DEB.MINIMAL + DEB.PER_COMPONENT_FIELDS + DEB.TIMESTAMPS + DEB.MD5SUMS + DEB.DEB_PACKAGE_VERSION_BACK_COMPATIBILITY + + RPM.CUSTOM_BINARY_SPEC_FILE + RPM.CUSTOM_NAMES + RPM.DEBUGINFO + RPM.DEFAULT_PERMISSIONS + RPM.DEPENDENCIES + RPM.DIST + RPM.EMPTY_DIR + RPM.VERSION + RPM.INSTALL_SCRIPTS + RPM.MAIN_COMPONENT + RPM.MINIMAL + RPM.PARTIALLY_RELOCATABLE_WARNING + RPM.PER_COMPONENT_FIELDS + RPM.SINGLE_DEBUGINFO + RPM.EXTRA_SLASH_IN_PATH + RPM.SOURCE_PACKAGE + RPM.SUGGESTS + RPM.SYMLINKS + RPM.USER_FILELIST + + 7Z + TBZ2 + TGZ + TXZ + TZ + ZIP + STGZ + External + ) +add_RunCMake_test_group(CPack "${cpack_tests}") # add a test to make sure symbols are exported from a shared library # for MSVC compilers CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS property is used add_RunCMake_test(AutoExportDll) diff --git a/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt b/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt index f02f9d6..6c87ca0 100644 --- a/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt +++ b/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt @@ -1 +1 @@ -^(CPackRPM: Will use GENERATED spec file: (/[^/]*)*/Tests/RunCMake/RPM/CPack/[^-]*(-package-target)?-build((-[^-]*-subtest/)|/)_CPack_Packages/.*/RPM/SPECS/[^\.]*\.spec(\n|$))*$ +^(CPackRPM: Will use GENERATED spec file: (/[^/]*)*/Tests/RunCMake/RPM\.[^/]*/CPack/[^-]*(-package-target)?-build((-[^-]*-subtest/)|/)_CPack_Packages/.*/RPM/SPECS/[^\.]*\.spec(\n|$))*$ diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake index 33ddb72..37df57c 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -4,35 +4,35 @@ include(RunCMake) include("${RunCMake_SOURCE_DIR}/CPackTestHelpers.cmake") # run_cpack_test args: TEST_NAME "GENERATORS" RUN_CMAKE_BUILD_STEP "PACKAGING_TYPES" -run_cpack_test(CUSTOM_BINARY_SPEC_FILE "RPM" false "MONOLITHIC;COMPONENT") -run_cpack_test(CUSTOM_NAMES "RPM;DEB;TGZ" true "COMPONENT") -run_cpack_test(DEBUGINFO "RPM;DEB" true "COMPONENT") -run_cpack_test_subtests(DEFAULT_PERMISSIONS "CMAKE_var_set;CPACK_var_set;both_set;invalid_CMAKE_var;invalid_CPACK_var" "RPM;DEB" false "MONOLITHIC;COMPONENT") -run_cpack_test(DEPENDENCIES "RPM;DEB" true "COMPONENT") -run_cpack_test(DIST "RPM" false "MONOLITHIC") -run_cpack_test(EMPTY_DIR "RPM;DEB;TGZ" true "MONOLITHIC;COMPONENT") -run_cpack_test(VERSION "RPM;DEB" false "MONOLITHIC;COMPONENT") -run_cpack_test(EXTRA "DEB" false "COMPONENT") -run_cpack_test_subtests(GENERATE_SHLIBS "soversion_not_zero;soversion_zero" "DEB" true "COMPONENT") -run_cpack_test(GENERATE_SHLIBS_LDCONFIG "DEB" true "COMPONENT") -run_cpack_test(INSTALL_SCRIPTS "RPM" false "COMPONENT") -run_cpack_test(LONG_FILENAMES "DEB" false "MONOLITHIC") -run_cpack_test_subtests(MAIN_COMPONENT "invalid;found" "RPM" false "COMPONENT") -run_cpack_test(MINIMAL "RPM;DEB;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ;External" false "MONOLITHIC;COMPONENT") -run_cpack_test_package_target(MINIMAL "RPM;DEB;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ;External" false "MONOLITHIC;COMPONENT") +run_cpack_test(CUSTOM_BINARY_SPEC_FILE "RPM.CUSTOM_BINARY_SPEC_FILE" false "MONOLITHIC;COMPONENT") +run_cpack_test(CUSTOM_NAMES "RPM.CUSTOM_NAMES;DEB.CUSTOM_NAMES;TGZ" true "COMPONENT") +run_cpack_test(DEBUGINFO "RPM.DEBUGINFO;DEB.DEBUGINFO" true "COMPONENT") +run_cpack_test_subtests(DEFAULT_PERMISSIONS "CMAKE_var_set;CPACK_var_set;both_set;invalid_CMAKE_var;invalid_CPACK_var" "RPM.DEFAULT_PERMISSIONS;DEB.DEFAULT_PERMISSIONS" false "MONOLITHIC;COMPONENT") +run_cpack_test(DEPENDENCIES "RPM.DEPENDENCIES;DEB.DEPENDENCIES" true "COMPONENT") +run_cpack_test(DIST "RPM.DIST" false "MONOLITHIC") +run_cpack_test(EMPTY_DIR "RPM.EMPTY_DIR;DEB.EMPTY_DIR;TGZ" true "MONOLITHIC;COMPONENT") +run_cpack_test(VERSION "RPM.VERSION;DEB.VERSION" false "MONOLITHIC;COMPONENT") +run_cpack_test(EXTRA "DEB.EXTRA" false "COMPONENT") +run_cpack_test_subtests(GENERATE_SHLIBS "soversion_not_zero;soversion_zero" "DEB.GENERATE_SHLIBS" true "COMPONENT") +run_cpack_test(GENERATE_SHLIBS_LDCONFIG "DEB.GENERATE_SHLIBS_LDCONFIG" true "COMPONENT") +run_cpack_test(INSTALL_SCRIPTS "RPM.INSTALL_SCRIPTS" false "COMPONENT") +run_cpack_test(LONG_FILENAMES "DEB.LONG_FILENAMES" false "MONOLITHIC") +run_cpack_test_subtests(MAIN_COMPONENT "invalid;found" "RPM.MAIN_COMPONENT" false "COMPONENT") +run_cpack_test(MINIMAL "RPM.MINIMAL;DEB.MINIMAL;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ;External" false "MONOLITHIC;COMPONENT") +run_cpack_test_package_target(MINIMAL "RPM.MINIMAL;DEB.MINIMAL;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ;External" false "MONOLITHIC;COMPONENT") run_cpack_test_subtests(PACKAGE_CHECKSUM "invalid;MD5;SHA1;SHA224;SHA256;SHA384;SHA512" "TGZ" false "MONOLITHIC") -run_cpack_test(PARTIALLY_RELOCATABLE_WARNING "RPM" false "COMPONENT") -run_cpack_test(PER_COMPONENT_FIELDS "RPM;DEB" false "COMPONENT") -run_cpack_test_subtests(SINGLE_DEBUGINFO "no_main_component;one_component;one_component_main;no_debuginfo;one_component_no_debuginfo;no_components;valid" "RPM" true "CUSTOM") -run_cpack_test(EXTRA_SLASH_IN_PATH "RPM" true "COMPONENT") -run_cpack_source_test(SOURCE_PACKAGE "RPM") -run_cpack_test(SUGGESTS "RPM" false "MONOLITHIC") -run_cpack_test(SYMLINKS "RPM;TGZ" false "MONOLITHIC;COMPONENT") +run_cpack_test(PARTIALLY_RELOCATABLE_WARNING "RPM.PARTIALLY_RELOCATABLE_WARNING" false "COMPONENT") +run_cpack_test(PER_COMPONENT_FIELDS "RPM.PER_COMPONENT_FIELDS;DEB.PER_COMPONENT_FIELDS" false "COMPONENT") +run_cpack_test_subtests(SINGLE_DEBUGINFO "no_main_component;one_component;one_component_main;no_debuginfo;one_component_no_debuginfo;no_components;valid" "RPM.SINGLE_DEBUGINFO" true "CUSTOM") +run_cpack_test(EXTRA_SLASH_IN_PATH "RPM.EXTRA_SLASH_IN_PATH" true "COMPONENT") +run_cpack_source_test(SOURCE_PACKAGE "RPM.SOURCE_PACKAGE") +run_cpack_test(SUGGESTS "RPM.SUGGESTS" false "MONOLITHIC") +run_cpack_test(SYMLINKS "RPM.SYMLINKS;TGZ" false "MONOLITHIC;COMPONENT") set(ENVIRONMENT "SOURCE_DATE_EPOCH=123456789") -run_cpack_test(TIMESTAMPS "DEB;TGZ" false "COMPONENT") +run_cpack_test(TIMESTAMPS "DEB.TIMESTAMPS;TGZ" false "COMPONENT") unset(ENVIRONMENT) -run_cpack_test(USER_FILELIST "RPM" false "MONOLITHIC") -run_cpack_test(MD5SUMS "DEB" false "MONOLITHIC;COMPONENT") +run_cpack_test(USER_FILELIST "RPM.USER_FILELIST" false "MONOLITHIC") +run_cpack_test(MD5SUMS "DEB.MD5SUMS" false "MONOLITHIC;COMPONENT") run_cpack_test(CPACK_INSTALL_SCRIPT "ZIP" false "MONOLITHIC") -run_cpack_test(DEB_PACKAGE_VERSION_BACK_COMPATIBILITY "DEB" false "MONOLITHIC;COMPONENT") +run_cpack_test(DEB_PACKAGE_VERSION_BACK_COMPATIBILITY "DEB.DEB_PACKAGE_VERSION_BACK_COMPATIBILITY" false "MONOLITHIC;COMPONENT") run_cpack_test_subtests(EXTERNAL "none;good;good_multi;bad_major;bad_minor;invalid_good;invalid_bad;stage_and_package" "External" false "MONOLITHIC;COMPONENT") diff --git a/Tests/RunCMake/CPack/tests/CUSTOM_BINARY_SPEC_FILE/RPM-COMPONENT-stderr.txt b/Tests/RunCMake/CPack/tests/CUSTOM_BINARY_SPEC_FILE/RPM-COMPONENT-stderr.txt index e6d86d0..b050262 100644 --- a/Tests/RunCMake/CPack/tests/CUSTOM_BINARY_SPEC_FILE/RPM-COMPONENT-stderr.txt +++ b/Tests/RunCMake/CPack/tests/CUSTOM_BINARY_SPEC_FILE/RPM-COMPONENT-stderr.txt @@ -1,2 +1,2 @@ ^CPackRPM: Will use USER specified spec file: (/[^/]*)*/CUSTOM_BINARY_SPEC_FILE/custom\.spec\.in -CPackRPM: Will use GENERATED spec file:.*/Tests/RunCMake/RPM/CPack/CUSTOM_BINARY_SPEC_FILE-build/_CPack_Packages/.*/RPM/SPECS/custom_binary_spec_file-test2\.spec$ +CPackRPM: Will use GENERATED spec file:.*/Tests/RunCMake/RPM\.CUSTOM_BINARY_SPEC_FILE/CPack/CUSTOM_BINARY_SPEC_FILE-build/_CPack_Packages/.*/RPM/SPECS/custom_binary_spec_file-test2\.spec$ diff --git a/Tests/RunCMake/CPack/tests/SUGGESTS/RPM-stderr.txt b/Tests/RunCMake/CPack/tests/SUGGESTS/RPM-stderr.txt index feb296c..53d71d9 100644 --- a/Tests/RunCMake/CPack/tests/SUGGESTS/RPM-stderr.txt +++ b/Tests/RunCMake/CPack/tests/SUGGESTS/RPM-stderr.txt @@ -1 +1 @@ -^(.*CPackRPM:Warning: SUGGESTS not supported in provided rpmbuild.*)?CPackRPM: Will use GENERATED spec file: (/[^/]*)*/Tests/RunCMake/RPM/CPack/[^-]*-build/_CPack_Packages/.*/RPM/SPECS/[^\.]*\.spec$ +^(.*CPackRPM:Warning: SUGGESTS not supported in provided rpmbuild.*)?CPackRPM: Will use GENERATED spec file: (/[^/]*)*/Tests/RunCMake/RPM\.SUGGESTS/CPack/[^-]*-build/_CPack_Packages/.*/RPM/SPECS/[^\.]*\.spec$ https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=450131cc0e80f22f169f2647dc7ecb1bd1024cf6 commit 450131cc0e80f22f169f2647dc7ecb1bd1024cf6 Author: Kyle Edwards AuthorDate: Thu Dec 13 17:57:09 2018 -0500 Commit: Kyle Edwards CommitDate: Thu Jan 10 13:56:35 2019 -0500 Tests: Add infrastructure to split up large CPack tests This allows CPack generator tests to be split into smaller tests of the format ".". diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index e222376..63c5374 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -42,7 +42,12 @@ function(add_RunCMake_test_group test types) # much system information so it is easier to set programs and environment # values here unset(${test}_${type}_FOUND_PREREQUIREMENTS) - include("${CMAKE_CURRENT_SOURCE_DIR}/${test}/${type}/Prerequirements.cmake") + if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${test}/${type}/Prerequirements.cmake") + include("${CMAKE_CURRENT_SOURCE_DIR}/${test}/${type}/Prerequirements.cmake") + else() + string(REGEX MATCH "^[^.]*" main_type "${type}") + include("${CMAKE_CURRENT_SOURCE_DIR}/${test}/${main_type}/Prerequirements.cmake") + endif() get_test_prerequirements("${test}_${type}_FOUND_PREREQUIREMENTS" "${TEST_CONFIG_DIR}/${type}_config.cmake") diff --git a/Tests/RunCMake/CPack/CPackTestHelpers.cmake b/Tests/RunCMake/CPack/CPackTestHelpers.cmake index d00ef3b..f65cb9d 100644 --- a/Tests/RunCMake/CPack/CPackTestHelpers.cmake +++ b/Tests/RunCMake/CPack/CPackTestHelpers.cmake @@ -2,6 +2,7 @@ cmake_policy(SET CMP0057 NEW) function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACKAGING_TYPE package_target) if(TEST_TYPE IN_LIST types) + string(REGEX MATCH "^[^.]*" GENERATOR_TYPE "${TEST_TYPE}") set(RunCMake_TEST_NO_CLEAN TRUE) if(package_target) set(full_test_name_ "${TEST_NAME}-package-target") @@ -21,8 +22,8 @@ function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACK file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") - if(EXISTS "${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${TEST_TYPE}-Prerequirements.cmake") - include("${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${TEST_TYPE}-Prerequirements.cmake") + if(EXISTS "${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${GENERATOR_TYPE}-Prerequirements.cmake") + include("${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${GENERATOR_TYPE}-Prerequirements.cmake") set(FOUND_PREREQUIREMENTS false) get_test_prerequirements("FOUND_PREREQUIREMENTS" "${config_file}") @@ -35,7 +36,7 @@ function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACK endif() # execute cmake - set(RunCMake_TEST_OPTIONS "-DGENERATOR_TYPE=${TEST_TYPE}" + set(RunCMake_TEST_OPTIONS "-DGENERATOR_TYPE=${GENERATOR_TYPE}" "-DRunCMake_TEST_FILE_PREFIX=${TEST_NAME}" "-DRunCMake_SUBTEST_SUFFIX=${SUBTEST_SUFFIX}" "-DPACKAGING_TYPE=${PACKAGING_TYPE}") @@ -64,9 +65,9 @@ function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACK endif() if(source) - set(pack_params_ -G ${TEST_TYPE} --config ./CPackSourceConfig.cmake) + set(pack_params_ -G ${GENERATOR_TYPE} --config ./CPackSourceConfig.cmake) FILE(APPEND ${RunCMake_TEST_BINARY_DIR}/CPackSourceConfig.cmake - "\nset(CPACK_RPM_SOURCE_PKG_BUILD_PARAMS \"-DRunCMake_TEST:STRING=${full_test_name_} -DRunCMake_TEST_FILE_PREFIX:STRING=${TEST_NAME} -DGENERATOR_TYPE:STRING=${TEST_TYPE}\")") + "\nset(CPACK_RPM_SOURCE_PKG_BUILD_PARAMS \"-DRunCMake_TEST:STRING=${full_test_name_} -DRunCMake_TEST_FILE_PREFIX:STRING=${TEST_NAME} -DGENERATOR_TYPE:STRING=${GENERATOR_TYPE}\")") else() unset(pack_params_) endif() @@ -91,18 +92,18 @@ function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACK ) foreach(o out err) - if(SUBTEST_SUFFIX AND EXISTS ${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${TEST_TYPE}-${PACKAGING_TYPE}-${SUBTEST_SUFFIX}-std${o}.txt) - set(RunCMake-std${o}-file "tests/${TEST_NAME}/${TEST_TYPE}-${PACKAGING_TYPE}-${SUBTEST_SUFFIX}-std${o}.txt") - elseif(EXISTS ${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${TEST_TYPE}-${PACKAGING_TYPE}-std${o}.txt) - set(RunCMake-std${o}-file "tests/${TEST_NAME}/${TEST_TYPE}-${PACKAGING_TYPE}-std${o}.txt") - elseif(SUBTEST_SUFFIX AND EXISTS ${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${TEST_TYPE}-${SUBTEST_SUFFIX}-std${o}.txt) - set(RunCMake-std${o}-file "tests/${TEST_NAME}/${TEST_TYPE}-${SUBTEST_SUFFIX}-std${o}.txt") - elseif(EXISTS ${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${TEST_TYPE}-std${o}.txt) - set(RunCMake-std${o}-file "tests/${TEST_NAME}/${TEST_TYPE}-std${o}.txt") + if(SUBTEST_SUFFIX AND EXISTS ${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${GENERATOR_TYPE}-${PACKAGING_TYPE}-${SUBTEST_SUFFIX}-std${o}.txt) + set(RunCMake-std${o}-file "tests/${TEST_NAME}/${GENERATOR_TYPE}-${PACKAGING_TYPE}-${SUBTEST_SUFFIX}-std${o}.txt") + elseif(EXISTS ${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${GENERATOR_TYPE}-${PACKAGING_TYPE}-std${o}.txt) + set(RunCMake-std${o}-file "tests/${TEST_NAME}/${GENERATOR_TYPE}-${PACKAGING_TYPE}-std${o}.txt") + elseif(SUBTEST_SUFFIX AND EXISTS ${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${GENERATOR_TYPE}-${SUBTEST_SUFFIX}-std${o}.txt) + set(RunCMake-std${o}-file "tests/${TEST_NAME}/${GENERATOR_TYPE}-${SUBTEST_SUFFIX}-std${o}.txt") + elseif(EXISTS ${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${GENERATOR_TYPE}-std${o}.txt) + set(RunCMake-std${o}-file "tests/${TEST_NAME}/${GENERATOR_TYPE}-std${o}.txt") elseif(SUBTEST_SUFFIX AND EXISTS ${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${SUBTEST_SUFFIX}-std${o}.txt) set(RunCMake-std${o}-file "tests/${TEST_NAME}/${SUBTEST_SUFFIX}-std${o}.txt") - elseif(EXISTS ${RunCMake_SOURCE_DIR}/${TEST_TYPE}/default_expected_std${o}.txt) - set(RunCMake-std${o}-file "${TEST_TYPE}/default_expected_std${o}.txt") + elseif(EXISTS ${RunCMake_SOURCE_DIR}/${GENERATOR_TYPE}/default_expected_std${o}.txt) + set(RunCMake-std${o}-file "${GENERATOR_TYPE}/default_expected_std${o}.txt") else() unset(RunCMake-std${o}-file) endif() @@ -110,12 +111,12 @@ function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACK # verify result run_cmake_command( - ${TEST_TYPE}/${full_test_name_} + ${GENERATOR_TYPE}/${full_test_name_} "${CMAKE_COMMAND}" -DRunCMake_TEST=${full_test_name_} -DRunCMake_TEST_FILE_PREFIX=${TEST_NAME} -DRunCMake_SUBTEST_SUFFIX=${SUBTEST_SUFFIX} - -DGENERATOR_TYPE=${TEST_TYPE} + -DGENERATOR_TYPE=${GENERATOR_TYPE} -DPACKAGING_TYPE=${PACKAGING_TYPE} "-Dsrc_dir=${RunCMake_SOURCE_DIR}" "-Dbin_dir=${RunCMake_TEST_BINARY_DIR}" https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=266808c4130a0b40aed236381707462a9368a1eb commit 266808c4130a0b40aed236381707462a9368a1eb Author: Mateusz ?oskot AuthorDate: Sat Dec 15 00:29:51 2018 +0100 Commit: Mateusz ?oskot CommitDate: Tue Dec 18 15:33:09 2018 +0100 FindBoost: Add support for Boost 1.70 Boost master and develop branches just bumped the version. diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index ce307fa..8c112d4 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -862,8 +862,22 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) set(_Boost_TIMER_DEPENDENCIES chrono system) set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 106900 AND Boost_VERSION VERSION_LESS 107000) + set(_Boost_CONTRACT_DEPENDENCIES thread chrono date_time) + set(_Boost_COROUTINE_DEPENDENCIES context) + set(_Boost_FIBER_DEPENDENCIES context) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES date_time log_setup filesystem thread regex chrono atomic) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_NUMPY_DEPENDENCIES python${component_python_version}) + set(_Boost_THREAD_DEPENDENCIES chrono date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) else() - if(NOT Boost_VERSION VERSION_LESS 106900) + if(NOT Boost_VERSION VERSION_LESS 107000) set(_Boost_CONTRACT_DEPENDENCIES thread chrono date_time) set(_Boost_COROUTINE_DEPENDENCIES context) set(_Boost_FIBER_DEPENDENCIES context) @@ -878,7 +892,7 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono date_time atomic) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) endif() - if(NOT Boost_VERSION VERSION_LESS 107000) + if(NOT Boost_VERSION VERSION_LESS 107100) message(WARNING "New Boost version may have incorrect or missing dependencies and imported targets") endif() endif() @@ -1126,7 +1140,7 @@ else() # _Boost_COMPONENT_HEADERS. See the instructions at the top of # _Boost_COMPONENT_DEPENDENCIES. set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS} - "1.69.0" "1.69" + "1.70.0" "1.70" "1.69.0" "1.69" "1.68.0" "1.68" "1.67.0" "1.67" "1.66.0" "1.66" "1.65.1" "1.65.0" "1.65" "1.64.0" "1.64" "1.63.0" "1.63" "1.62.0" "1.62" "1.61.0" "1.61" "1.60.0" "1.60" "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" ----------------------------------------------------------------------- Summary of changes: Help/release/dev/FindICE-more-exe.rst | 5 ++ Modules/FindBoost.cmake | 20 ++++++-- Modules/FindIce.cmake | 4 ++ Tests/RunCMake/CMakeLists.txt | 55 +++++++++++++++++++++- Tests/RunCMake/CPack/CPackTestHelpers.cmake | 35 +++++++------- .../RunCMake/CPack/RPM/default_expected_stderr.txt | 2 +- Tests/RunCMake/CPack/RunCMakeTest.cmake | 54 ++++++++++----------- .../RPM-COMPONENT-stderr.txt | 2 +- Tests/RunCMake/CPack/tests/SUGGESTS/RPM-stderr.txt | 2 +- 9 files changed, 127 insertions(+), 52 deletions(-) create mode 100644 Help/release/dev/FindICE-more-exe.rst hooks/post-receive -- CMake From kwrobot at kitware.com Fri Jan 11 10:13:06 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 11 Jan 2019 10:13:06 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.2-877-g73aca05 Message-ID: <20190111151306.B2ED110D0C8@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 73aca0572b30a46bf5b5e75daa300fabb6bbb8cc (commit) via 5e4887e67305c2973155dc763701f7d22c08ff55 (commit) via a4332cac4bd178fd1b771154413565ae0b0ce61f (commit) from 696c6afcafa97d50ae7677d29e0f02e042a58088 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=73aca0572b30a46bf5b5e75daa300fabb6bbb8cc commit 73aca0572b30a46bf5b5e75daa300fabb6bbb8cc Merge: 696c6af 5e4887e Author: Brad King AuthorDate: Fri Jan 11 15:06:48 2019 +0000 Commit: Kitware Robot CommitDate: Fri Jan 11 10:06:58 2019 -0500 Merge topic 'vs_ce_support' 5e4887e673 VS: Honor WinCE deployment properties in VS 2010+ a4332cac4b Tests: Detect VS and SDK availability early Acked-by: Kitware Robot Merge-request: !2680 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5e4887e67305c2973155dc763701f7d22c08ff55 commit 5e4887e67305c2973155dc763701f7d22c08ff55 Author: Wil Stark AuthorDate: Wed Nov 28 09:51:30 2018 -0800 Commit: Brad King CommitDate: Thu Jan 10 13:06:25 2019 -0500 VS: Honor WinCE deployment properties in VS 2010+ Previously only VS 2008 was supported. diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 6d54c12..b0e70ff 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -623,6 +623,7 @@ void cmVisualStudio10TargetGenerator::Generate() Elem(e0, "PropertyGroup").Attribute("Label", "UserMacros"); this->WriteWinRTPackageCertificateKeyFile(e0); this->WritePathAndIncrementalLinkOptions(e0); + this->WriteCEDebugProjectConfigurationValues(e0); this->WriteItemDefinitionGroups(e0); this->WriteCustomCommands(e0); this->WriteAllSources(e0); @@ -1071,6 +1072,32 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues(Elem& e0) } } +void cmVisualStudio10TargetGenerator::WriteCEDebugProjectConfigurationValues( + Elem& e0) +{ + if (!this->GlobalGenerator->TargetsWindowsCE()) { + return; + } + const char* additionalFiles = + this->GeneratorTarget->GetProperty("DEPLOYMENT_ADDITIONAL_FILES"); + const char* remoteDirectory = + this->GeneratorTarget->GetProperty("DEPLOYMENT_REMOTE_DIRECTORY"); + if (!(additionalFiles || remoteDirectory)) { + return; + } + for (std::string const& c : this->Configurations) { + Elem e1(e0, "PropertyGroup"); + e1.Attribute("Condition", this->CalcCondition(c)); + + if (remoteDirectory) { + e1.Element("RemoteDirectory", remoteDirectory); + } + if (additionalFiles) { + e1.Element("CEAdditionalFiles", additionalFiles); + } + } +} + void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValues( Elem& e1, std::string const& config) { diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index b17b5f8..7d24e88 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -57,6 +57,7 @@ private: void WriteProjectConfigurations(Elem& e0); void WriteProjectConfigurationValues(Elem& e0); void WriteMSToolConfigurationValues(Elem& e1, std::string const& config); + void WriteCEDebugProjectConfigurationValues(Elem& e0); void WriteMSToolConfigurationValuesManaged(Elem& e1, std::string const& config); void WriteHeaderSource(Elem& e1, cmSourceFile const* sf); diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 3e58471..803e5f0 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -178,7 +178,6 @@ if(BUILD_TESTING) endif() # Build a key to be used by get_filename_component that is pointing to the SDK directory set(_reg "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows CE Tools\\SDKs\\${_sdk}]") - # Set return values set(${selected_reg} ${_reg}) set(${selected_sdk} ${_sdk}) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index e222376..9f18b6f 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -338,6 +338,9 @@ endif() if("${CMAKE_GENERATOR}" MATCHES "Visual Studio ([^9]|9[0-9])") add_RunCMake_test(VS10Project) + if( vs12 AND wince ) + add_RunCMake_test( VS10ProjectWinCE "-DRunCMake_GENERATOR_PLATFORM=${wince_sdk}") + endif() endif() if(XCODE_VERSION) diff --git a/Tests/RunCMake/VS10ProjectWinCE/CMakeLists.txt b/Tests/RunCMake/VS10ProjectWinCE/CMakeLists.txt new file mode 100644 index 0000000..91baae7 --- /dev/null +++ b/Tests/RunCMake/VS10ProjectWinCE/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.5.0) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/VS10ProjectWinCE/RunCMakeTest.cmake b/Tests/RunCMake/VS10ProjectWinCE/RunCMakeTest.cmake new file mode 100644 index 0000000..b35ee90 --- /dev/null +++ b/Tests/RunCMake/VS10ProjectWinCE/RunCMakeTest.cmake @@ -0,0 +1,8 @@ +include(RunCMake) + +set(RunCMake_GENERATOR "Visual Studio 12 2013") +set(RunCMake_GENERATOR_TOOLSET CE800) +set(RunCMake_GENERATOR_INSTANCE "") +set(RunCMake_TEST_OPTIONS -DCMAKE_SYSTEM_NAME=WindowsCE ) + +run_cmake(VsCEDebuggerDeploy) diff --git a/Tests/RunCMake/VS10ProjectWinCE/VsCEDebuggerDeploy-check.cmake b/Tests/RunCMake/VS10ProjectWinCE/VsCEDebuggerDeploy-check.cmake new file mode 100644 index 0000000..c66676f --- /dev/null +++ b/Tests/RunCMake/VS10ProjectWinCE/VsCEDebuggerDeploy-check.cmake @@ -0,0 +1,34 @@ +set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj") +if(NOT EXISTS "${vcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.") + return() +endif() + + +if( NOT ${CMAKE_SYSTEM_NAME} STREQUAL "WindowsCE" ) + set(RunCMake_TEST_FAILED "Test only valid for WindowsCE") + return() +endif() + + +set(FoundCEAdditionalFiles FALSE) +set(FoundRemoteDirectory FALSE) + +file(STRINGS "${vcProjectFile}" lines) +foreach(line IN LISTS lines) + if(line MATCHES "^ * *foo\\.dll\\|\\\\foo\\\\src\\\\dir\\\\on\\\\host\\|\\$\\(RemoteDirectory\\)\\|0;bar\\.dll\\|\\\\bar\\\\src\\\\dir\\|\\$\\(RemoteDirectory\\)bardir\\|0.* *$") + set(FoundCEAdditionalFiles TRUE) + elseif(line MATCHES " *[A-Za-z0-9\\]+ *$") + set(FoundRemoteDirectory TRUE) + endif() +endforeach() + +if(NOT FoundCEAdditionalFiles) + set(RunCMake_TEST_FAILED "CEAddionalFiles not found or not set correctly.") + return() +endif() + +if(NOT FoundRemoteDirectory) + set(RunCMake_TEST_FAILED "RemoteDirectory not found or not set correctly.") + return() +endif() diff --git a/Tests/RunCMake/VS10ProjectWinCE/VsCEDebuggerDeploy.cmake b/Tests/RunCMake/VS10ProjectWinCE/VsCEDebuggerDeploy.cmake new file mode 100644 index 0000000..948f14c --- /dev/null +++ b/Tests/RunCMake/VS10ProjectWinCE/VsCEDebuggerDeploy.cmake @@ -0,0 +1,13 @@ +enable_language(CXX) + +set(DEPLOY_DIR + "temp\\foodir" +) + +add_library(foo foo.cpp) + +set_target_properties(foo + PROPERTIES + DEPLOYMENT_ADDITIONAL_FILES "foo.dll|\\foo\\src\\dir\\on\\host|$(RemoteDirectory)|0;bar.dll|\\bar\\src\\dir|$(RemoteDirectory)bardir|0" + DEPLOYMENT_REMOTE_DIRECTORY ${DEPLOY_DIR} +) diff --git a/Tests/RunCMake/VS10ProjectWinCE/foo.cpp b/Tests/RunCMake/VS10ProjectWinCE/foo.cpp new file mode 100644 index 0000000..3695dc9 --- /dev/null +++ b/Tests/RunCMake/VS10ProjectWinCE/foo.cpp @@ -0,0 +1,3 @@ +void foo() +{ +} diff --git a/Tests/RunCMake/VS10ProjectWinCE/foo.cs b/Tests/RunCMake/VS10ProjectWinCE/foo.cs new file mode 100644 index 0000000..3695dc9 --- /dev/null +++ b/Tests/RunCMake/VS10ProjectWinCE/foo.cs @@ -0,0 +1,3 @@ +void foo() +{ +} https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a4332cac4bd178fd1b771154413565ae0b0ce61f commit a4332cac4bd178fd1b771154413565ae0b0ce61f Author: Wil Stark AuthorDate: Wed Dec 12 10:28:32 2018 -0800 Commit: Brad King CommitDate: Thu Jan 10 12:49:51 2019 -0500 Tests: Detect VS and SDK availability early diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 2a8d3e6..3e58471 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -163,6 +163,50 @@ if(BUILD_TESTING) set(CPACK_BINARY_NUGET OFF) endif() + if(WIN32) + # Macro to search for available Windows CE SDKs in the windows Registry + macro(select_wince_sdk selected_reg selected_sdk) + if(CMAKE_HOST_WIN32) + execute_process(COMMAND reg QUERY "HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows CE Tools\\SDKs" + OUTPUT_VARIABLE sdk_reg + ERROR_VARIABLE my_err) + string(REGEX REPLACE "HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Wow6432Node\\\\Microsoft\\\\Windows CE Tools\\\\SDKs\\\\" ";" sdk_list "${sdk_reg}") + list(LENGTH sdk_list sdk_list_len) + if (${sdk_list_len} GREATER 1) + list(GET sdk_list 1 _sdk) # The first entry is always empty due to the regex replace above + string(STRIP ${_sdk} _sdk) # Make sure there is no newline in the SDK name + endif() + # Build a key to be used by get_filename_component that is pointing to the SDK directory + set(_reg "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows CE Tools\\SDKs\\${_sdk}]") + + # Set return values + set(${selected_reg} ${_reg}) + set(${selected_sdk} ${_sdk}) + endif(CMAKE_HOST_WIN32) + endmacro(select_wince_sdk) + + set(reg_vs10 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0;InstallDir]") + set(reg_vs11 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0;InstallDir]") + set(reg_vs12 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\12.0;InstallDir]") + set(reg_vs14 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\14.0;InstallDir]") + set(reg_ws80 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.0;InstallationFolder]") + set(reg_ws81 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.1;InstallationFolder]") + set(reg_ws10_0 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\14.0\\Setup\\Build Tools for Windows 10;srcPath]") + set(reg_wp80 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\WindowsPhone\\v8.0;InstallationFolder]") + set(reg_wp81 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\WindowsPhone\\v8.1;InstallationFolder]") + select_wince_sdk(reg_wince wince_sdk) + set(reg_tegra "[HKEY_LOCAL_MACHINE\\SOFTWARE\\NVIDIA Corporation\\Nsight Tegra;sdkRoot]") + set(reg_nasm "[HKEY_CURRENT_USER\\SOFTWARE\\nasm]") + foreach(reg vs10 vs11 vs12 vs14 ws80 ws81 ws10_0 wp80 wp81 wince tegra nasm) + get_filename_component(r "${reg_${reg}}" ABSOLUTE) + if(IS_DIRECTORY "${r}" AND NOT "${r}" STREQUAL "/registry") + set(${reg} 1) + else() + set(${reg} 0) + endif() + endforeach() + endif() + #--------------------------------------------------------------------------- # Add tests below here. @@ -2125,50 +2169,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release endif() endif() - if(WIN32) - # Macro to search for available Windows CE SDKs in the windows Registry - macro(select_wince_sdk selected_reg selected_sdk) - if(CMAKE_HOST_WIN32) - execute_process(COMMAND reg QUERY "HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows CE Tools\\SDKs" - OUTPUT_VARIABLE sdk_reg - ERROR_VARIABLE my_err) - string(REGEX REPLACE "HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Wow6432Node\\\\Microsoft\\\\Windows CE Tools\\\\SDKs\\\\" ";" sdk_list "${sdk_reg}") - list(LENGTH sdk_list sdk_list_len) - if (${sdk_list_len} GREATER 1) - list(GET sdk_list 1 _sdk) # The first entry is always empty due to the regex replace above - string(STRIP ${_sdk} _sdk) # Make sure there is no newline in the SDK name - endif() - # Build a key to be used by get_filename_component that is pointing to the SDK directory - set(_reg "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows CE Tools\\SDKs\\${_sdk}]") - - # Set return values - set(${selected_reg} ${_reg}) - set(${selected_sdk} ${_sdk}) - endif(CMAKE_HOST_WIN32) - endmacro(select_wince_sdk) - - set(reg_vs10 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0;InstallDir]") - set(reg_vs11 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0;InstallDir]") - set(reg_vs12 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\12.0;InstallDir]") - set(reg_vs14 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\14.0;InstallDir]") - set(reg_ws80 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.0;InstallationFolder]") - set(reg_ws81 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.1;InstallationFolder]") - set(reg_ws10_0 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\14.0\\Setup\\Build Tools for Windows 10;srcPath]") - set(reg_wp80 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\WindowsPhone\\v8.0;InstallationFolder]") - set(reg_wp81 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\WindowsPhone\\v8.1;InstallationFolder]") - select_wince_sdk(reg_wince wince_sdk) - set(reg_tegra "[HKEY_LOCAL_MACHINE\\SOFTWARE\\NVIDIA Corporation\\Nsight Tegra;sdkRoot]") - set(reg_nasm "[HKEY_CURRENT_USER\\SOFTWARE\\nasm]") - foreach(reg vs10 vs11 vs12 vs14 ws80 ws81 ws10_0 wp80 wp81 wince tegra nasm) - get_filename_component(r "${reg_${reg}}" ABSOLUTE) - if(IS_DIRECTORY "${r}" AND NOT "${r}" STREQUAL "/registry") - set(${reg} 1) - else() - set(${reg} 0) - endif() - endforeach() - endif() - get_filename_component(ntver "[HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion;CurrentVersion]" NAME) if(WIN32 AND ntver VERSION_GREATER 6.1) # Windows >= 8.0 macro(add_test_VSWinStorePhone name generator systemName systemVersion architecture) ----------------------------------------------------------------------- Summary of changes: Source/cmVisualStudio10TargetGenerator.cxx | 27 +++++++ Source/cmVisualStudio10TargetGenerator.h | 1 + Tests/CMakeLists.txt | 87 +++++++++++----------- Tests/RunCMake/CMakeLists.txt | 3 + .../CMakeLists.txt | 0 Tests/RunCMake/VS10ProjectWinCE/RunCMakeTest.cmake | 8 ++ .../VsCEDebuggerDeploy-check.cmake | 34 +++++++++ .../VS10ProjectWinCE/VsCEDebuggerDeploy.cmake | 13 ++++ .../{XcodeProject => VS10ProjectWinCE}/foo.cpp | 0 .../{VS10Project => VS10ProjectWinCE}/foo.cs | 0 10 files changed, 129 insertions(+), 44 deletions(-) copy Tests/RunCMake/{VS10Project => VS10ProjectWinCE}/CMakeLists.txt (100%) create mode 100644 Tests/RunCMake/VS10ProjectWinCE/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/VS10ProjectWinCE/VsCEDebuggerDeploy-check.cmake create mode 100644 Tests/RunCMake/VS10ProjectWinCE/VsCEDebuggerDeploy.cmake copy Tests/RunCMake/{XcodeProject => VS10ProjectWinCE}/foo.cpp (100%) copy Tests/RunCMake/{VS10Project => VS10ProjectWinCE}/foo.cs (100%) hooks/post-receive -- CMake From kwrobot at kitware.com Fri Jan 11 10:43:04 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 11 Jan 2019 10:43:04 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.2-882-g5a283b7 Message-ID: <20190111154304.1772010D0C8@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 5a283b79e5fe1739142cc513a9a701855849b2f8 (commit) via b91f6f39f7be92bab1302c4587dd51423f20cf00 (commit) via 89cc3d432bc576d00cb12880b37ec8b348599897 (commit) via 40a732800d52b394d7bd4a81e9aaef04ef5914e6 (commit) via 5ca7e5057bcadbcbe6b933b004ba37ddb5199dba (commit) from 73aca0572b30a46bf5b5e75daa300fabb6bbb8cc (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5a283b79e5fe1739142cc513a9a701855849b2f8 commit 5a283b79e5fe1739142cc513a9a701855849b2f8 Merge: 73aca05 b91f6f3 Author: Brad King AuthorDate: Fri Jan 11 15:35:57 2019 +0000 Commit: Kitware Robot CommitDate: Fri Jan 11 10:36:03 2019 -0500 Merge topic 'vs-refactor' b91f6f39f7 VS: Track explicitly when platform is specified in generator name 89cc3d432b VS: Move platform name members to top-level global generator 40a732800d VS: Clarify global generator constructor interface 5ca7e5057b Help: Document VS generator default platform selection Acked-by: Kitware Robot Merge-request: !2786 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b91f6f39f7be92bab1302c4587dd51423f20cf00 commit b91f6f39f7be92bab1302c4587dd51423f20cf00 Author: Brad King AuthorDate: Thu Jan 10 09:13:54 2019 -0500 Commit: Brad King CommitDate: Thu Jan 10 09:38:35 2019 -0500 VS: Track explicitly when platform is specified in generator name diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 7573153..a6bec4b 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -407,7 +407,7 @@ bool cmGlobalVisualStudio10Generator::InitializeSystem(cmMakefile* mf) return false; } } else if (this->SystemName == "Android") { - if (this->DefaultPlatformName != "Win32") { + if (this->PlatformInGeneratorName) { std::ostringstream e; e << "CMAKE_SYSTEM_NAME is 'Android' but CMAKE_GENERATOR " << "specifies a platform too: '" << this->GetName() << "'"; @@ -438,7 +438,7 @@ bool cmGlobalVisualStudio10Generator::InitializeWindows(cmMakefile*) bool cmGlobalVisualStudio10Generator::InitializeWindowsCE(cmMakefile* mf) { - if (this->DefaultPlatformName != "Win32") { + if (this->PlatformInGeneratorName) { std::ostringstream e; e << "CMAKE_SYSTEM_NAME is 'WindowsCE' but CMAKE_GENERATOR " << "specifies a platform too: '" << this->GetName() << "'"; diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 616328d..55284c9 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -61,7 +61,7 @@ void cmGlobalVisualStudio8Generator::AddPlatformDefinitions(cmMakefile* mf) bool cmGlobalVisualStudio8Generator::SetGeneratorPlatform(std::string const& p, cmMakefile* mf) { - if (this->DefaultPlatformName == "Win32") { + if (!this->PlatformInGeneratorName) { this->GeneratorPlatform = p; return this->cmGlobalVisualStudio7Generator::SetGeneratorPlatform("", mf); } else { diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 4828c8a..dc8de03 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -32,6 +32,7 @@ cmGlobalVisualStudioGenerator::cmGlobalVisualStudioGenerator( this->DefaultPlatformName = "Win32"; } else { this->DefaultPlatformName = platformInGeneratorName; + this->PlatformInGeneratorName = true; } } diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index 3909a26..d44f5a5 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -178,6 +178,7 @@ protected: std::string GeneratorPlatform; std::string DefaultPlatformName; + bool PlatformInGeneratorName = false; private: virtual std::string GetVSMakeProgram() = 0; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=89cc3d432bc576d00cb12880b37ec8b348599897 commit 89cc3d432bc576d00cb12880b37ec8b348599897 Author: Brad King AuthorDate: Thu Jan 10 08:43:29 2019 -0500 Commit: Brad King CommitDate: Thu Jan 10 09:38:35 2019 -0500 VS: Move platform name members to top-level global generator We no longer support any VS versions that pre-date support for multiple platforms (target architectures). diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 84f8df1..5855177 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -42,18 +42,12 @@ static cmVS7FlagTable cmVS7ExtraFlagTable[] = { cmGlobalVisualStudio7Generator::cmGlobalVisualStudio7Generator( cmake* cm, std::string const& platformInGeneratorName) - : cmGlobalVisualStudioGenerator(cm) + : cmGlobalVisualStudioGenerator(cm, platformInGeneratorName) { this->IntelProjectVersion = 0; this->DevEnvCommandInitialized = false; this->MasmEnabled = false; this->NasmEnabled = false; - - if (platformInGeneratorName.empty()) { - this->DefaultPlatformName = "Win32"; - } else { - this->DefaultPlatformName = platformInGeneratorName; - } this->ExtraFlagTable = cmVS7ExtraFlagTable; } @@ -263,14 +257,6 @@ Json::Value cmGlobalVisualStudio7Generator::GetJson() const } #endif -std::string const& cmGlobalVisualStudio7Generator::GetPlatformName() const -{ - if (!this->GeneratorPlatform.empty()) { - return this->GeneratorPlatform; - } - return this->DefaultPlatformName; -} - bool cmGlobalVisualStudio7Generator::SetSystemName(std::string const& s, cmMakefile* mf) { @@ -279,18 +265,6 @@ bool cmGlobalVisualStudio7Generator::SetSystemName(std::string const& s, return this->cmGlobalVisualStudioGenerator::SetSystemName(s, mf); } -bool cmGlobalVisualStudio7Generator::SetGeneratorPlatform(std::string const& p, - cmMakefile* mf) -{ - if (this->GetPlatformName() == "x64") { - mf->AddDefinition("CMAKE_FORCE_WIN64", "TRUE"); - } else if (this->GetPlatformName() == "Itanium") { - mf->AddDefinition("CMAKE_FORCE_IA64", "TRUE"); - } - mf->AddDefinition("CMAKE_VS_PLATFORM_NAME", this->GetPlatformName().c_str()); - return this->cmGlobalVisualStudioGenerator::SetGeneratorPlatform(p, mf); -} - void cmGlobalVisualStudio7Generator::Generate() { // first do the superclass method diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index 4240bd4..d2a2a38 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -20,9 +20,6 @@ class cmGlobalVisualStudio7Generator : public cmGlobalVisualStudioGenerator public: ~cmGlobalVisualStudio7Generator(); - ///! Get the name for the platform. - std::string const& GetPlatformName() const; - ///! Create a local generator appropriate to this Global Generator cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf) override; @@ -32,8 +29,6 @@ public: bool SetSystemName(std::string const& s, cmMakefile* mf) override; - bool SetGeneratorPlatform(std::string const& p, cmMakefile* mf) override; - /** * Utilized by the generator factory to determine if this generator * supports toolsets. @@ -167,8 +162,6 @@ protected: // Set during OutputSLNFile with the name of the current project. // There is one SLN file per project. std::string CurrentProject; - std::string GeneratorPlatform; - std::string DefaultPlatformName; bool MasmEnabled; bool NasmEnabled; diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index adf0a81..4828c8a 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -20,12 +20,19 @@ #include "cmState.h" #include "cmTarget.h" -cmGlobalVisualStudioGenerator::cmGlobalVisualStudioGenerator(cmake* cm) +cmGlobalVisualStudioGenerator::cmGlobalVisualStudioGenerator( + cmake* cm, std::string const& platformInGeneratorName) : cmGlobalGenerator(cm) { cm->GetState()->SetIsGeneratorMultiConfig(true); cm->GetState()->SetWindowsShell(true); cm->GetState()->SetWindowsVSIDE(true); + + if (platformInGeneratorName.empty()) { + this->DefaultPlatformName = "Win32"; + } else { + this->DefaultPlatformName = platformInGeneratorName; + } } cmGlobalVisualStudioGenerator::~cmGlobalVisualStudioGenerator() @@ -43,6 +50,26 @@ void cmGlobalVisualStudioGenerator::SetVersion(VSVersion v) this->Version = v; } +bool cmGlobalVisualStudioGenerator::SetGeneratorPlatform(std::string const& p, + cmMakefile* mf) +{ + if (this->GetPlatformName() == "x64") { + mf->AddDefinition("CMAKE_FORCE_WIN64", "TRUE"); + } else if (this->GetPlatformName() == "Itanium") { + mf->AddDefinition("CMAKE_FORCE_IA64", "TRUE"); + } + mf->AddDefinition("CMAKE_VS_PLATFORM_NAME", this->GetPlatformName().c_str()); + return this->cmGlobalGenerator::SetGeneratorPlatform(p, mf); +} + +std::string const& cmGlobalVisualStudioGenerator::GetPlatformName() const +{ + if (!this->GeneratorPlatform.empty()) { + return this->GeneratorPlatform; + } + return this->DefaultPlatformName; +} + const char* cmGlobalVisualStudioGenerator::GetIDEVersion() const { switch (this->Version) { diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index d827616..3909a26 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -49,6 +49,14 @@ public: /** Is the installed VS an Express edition? */ bool IsExpressEdition() const { return this->ExpressEdition; } + bool SetGeneratorPlatform(std::string const& p, cmMakefile* mf) override; + + /** + * Get the name of the target platform (architecture) for which we generate. + * The names are as defined by VS, e.g. "Win32", "x64", "Itanium", "ARM". + */ + std::string const& GetPlatformName() const; + /** * Configure CMake's Visual Studio macros file into the user's Visual * Studio macros directory. @@ -132,7 +140,8 @@ public: bool dryRun) override; protected: - cmGlobalVisualStudioGenerator(cmake* cm); + cmGlobalVisualStudioGenerator(cmake* cm, + std::string const& platformInGeneratorName); void AddExtraIDETargets() override; @@ -167,6 +176,9 @@ protected: VSVersion Version; bool ExpressEdition; + std::string GeneratorPlatform; + std::string DefaultPlatformName; + private: virtual std::string GetVSMakeProgram() = 0; void PrintCompilerAdvice(std::ostream&, std::string const&, https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=40a732800d52b394d7bd4a81e9aaef04ef5914e6 commit 40a732800d52b394d7bd4a81e9aaef04ef5914e6 Author: Brad King AuthorDate: Thu Jan 10 08:37:40 2019 -0500 Commit: Brad King CommitDate: Thu Jan 10 09:38:35 2019 -0500 VS: Clarify global generator constructor interface Make the constructors protected since they should be produced through factories. Also rename `platform{ => InGenerator}Name` to clarify the meaning of the argument. diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 4709194..7573153 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -90,8 +90,9 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio10Generator::NewFactory() } cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator( - cmake* cm, const std::string& name, const std::string& platformName) - : cmGlobalVisualStudio8Generator(cm, name, platformName) + cmake* cm, const std::string& name, + std::string const& platformInGeneratorName) + : cmGlobalVisualStudio8Generator(cm, name, platformInGeneratorName) { std::string vc10Express; this->ExpressEdition = cmSystemTools::ReadRegistryValue( diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 1e72959..7f7c516 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -14,8 +14,6 @@ class cmGlobalVisualStudio10Generator : public cmGlobalVisualStudio8Generator { public: - cmGlobalVisualStudio10Generator(cmake* cm, const std::string& name, - const std::string& platformName); static cmGlobalGeneratorFactory* NewFactory(); bool MatchesGeneratorName(const std::string& name) const override; @@ -125,6 +123,9 @@ public: cmIDEFlagTable const* GetNasmFlagTable() const; protected: + cmGlobalVisualStudio10Generator(cmake* cm, const std::string& name, + std::string const& platformInGeneratorName); + void Generate() override; virtual bool InitializeSystem(cmMakefile* mf); virtual bool InitializeWindows(cmMakefile* mf); @@ -168,6 +169,8 @@ protected: private: class Factory; + friend class Factory; + struct LongestSourcePath { LongestSourcePath() diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index 499ae32..07318cf 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -92,8 +92,9 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio11Generator::NewFactory() } cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator( - cmake* cm, const std::string& name, const std::string& platformName) - : cmGlobalVisualStudio10Generator(cm, name, platformName) + cmake* cm, const std::string& name, + std::string const& platformInGeneratorName) + : cmGlobalVisualStudio10Generator(cm, name, platformInGeneratorName) { std::string vc11Express; this->ExpressEdition = cmSystemTools::ReadRegistryValue( diff --git a/Source/cmGlobalVisualStudio11Generator.h b/Source/cmGlobalVisualStudio11Generator.h index 6346da2..8b4c8b7 100644 --- a/Source/cmGlobalVisualStudio11Generator.h +++ b/Source/cmGlobalVisualStudio11Generator.h @@ -20,13 +20,14 @@ class cmake; class cmGlobalVisualStudio11Generator : public cmGlobalVisualStudio10Generator { public: - cmGlobalVisualStudio11Generator(cmake* cm, const std::string& name, - const std::string& platformName); static cmGlobalGeneratorFactory* NewFactory(); bool MatchesGeneratorName(const std::string& name) const override; protected: + cmGlobalVisualStudio11Generator(cmake* cm, const std::string& name, + std::string const& platformInGeneratorName); + bool InitializeWindowsPhone(cmMakefile* mf) override; bool InitializeWindowsStore(cmMakefile* mf) override; bool SelectWindowsPhoneToolset(std::string& toolset) const override; diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx index 2cec48c..f9da68c 100644 --- a/Source/cmGlobalVisualStudio12Generator.cxx +++ b/Source/cmGlobalVisualStudio12Generator.cxx @@ -75,8 +75,9 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio12Generator::NewFactory() } cmGlobalVisualStudio12Generator::cmGlobalVisualStudio12Generator( - cmake* cm, const std::string& name, const std::string& platformName) - : cmGlobalVisualStudio11Generator(cm, name, platformName) + cmake* cm, const std::string& name, + std::string const& platformInGeneratorName) + : cmGlobalVisualStudio11Generator(cm, name, platformInGeneratorName) { std::string vc12Express; this->ExpressEdition = cmSystemTools::ReadRegistryValue( diff --git a/Source/cmGlobalVisualStudio12Generator.h b/Source/cmGlobalVisualStudio12Generator.h index 1b7bbc9..53b7091 100644 --- a/Source/cmGlobalVisualStudio12Generator.h +++ b/Source/cmGlobalVisualStudio12Generator.h @@ -18,13 +18,14 @@ class cmake; class cmGlobalVisualStudio12Generator : public cmGlobalVisualStudio11Generator { public: - cmGlobalVisualStudio12Generator(cmake* cm, const std::string& name, - const std::string& platformName); static cmGlobalGeneratorFactory* NewFactory(); bool MatchesGeneratorName(const std::string& name) const override; protected: + cmGlobalVisualStudio12Generator(cmake* cm, const std::string& name, + std::string const& platformInGeneratorName); + bool ProcessGeneratorToolsetField(std::string const& key, std::string const& value) override; @@ -44,5 +45,6 @@ protected: private: class Factory; + friend class Factory; }; #endif diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx index a6dbc23..8f7dac9 100644 --- a/Source/cmGlobalVisualStudio14Generator.cxx +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -75,8 +75,9 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio14Generator::NewFactory() } cmGlobalVisualStudio14Generator::cmGlobalVisualStudio14Generator( - cmake* cm, const std::string& name, const std::string& platformName) - : cmGlobalVisualStudio12Generator(cm, name, platformName) + cmake* cm, const std::string& name, + std::string const& platformInGeneratorName) + : cmGlobalVisualStudio12Generator(cm, name, platformInGeneratorName) { std::string vc14Express; this->ExpressEdition = cmSystemTools::ReadRegistryValue( diff --git a/Source/cmGlobalVisualStudio14Generator.h b/Source/cmGlobalVisualStudio14Generator.h index 4be21e0..32008b0 100644 --- a/Source/cmGlobalVisualStudio14Generator.h +++ b/Source/cmGlobalVisualStudio14Generator.h @@ -18,13 +18,14 @@ class cmake; class cmGlobalVisualStudio14Generator : public cmGlobalVisualStudio12Generator { public: - cmGlobalVisualStudio14Generator(cmake* cm, const std::string& name, - const std::string& platformName); static cmGlobalGeneratorFactory* NewFactory(); bool MatchesGeneratorName(const std::string& name) const override; protected: + cmGlobalVisualStudio14Generator(cmake* cm, const std::string& name, + std::string const& platformInGeneratorName); + bool InitializeWindows(cmMakefile* mf) override; bool InitializeWindowsStore(cmMakefile* mf) override; bool SelectWindowsStoreToolset(std::string& toolset) const override; @@ -47,5 +48,6 @@ protected: private: class Factory; + friend class Factory; }; #endif diff --git a/Source/cmGlobalVisualStudio15Generator.cxx b/Source/cmGlobalVisualStudio15Generator.cxx index 2af17e8..eb49e87 100644 --- a/Source/cmGlobalVisualStudio15Generator.cxx +++ b/Source/cmGlobalVisualStudio15Generator.cxx @@ -76,8 +76,9 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio15Generator::NewFactory() } cmGlobalVisualStudio15Generator::cmGlobalVisualStudio15Generator( - cmake* cm, const std::string& name, const std::string& platformName) - : cmGlobalVisualStudio14Generator(cm, name, platformName) + cmake* cm, const std::string& name, + std::string const& platformInGeneratorName) + : cmGlobalVisualStudio14Generator(cm, name, platformInGeneratorName) { this->ExpressEdition = false; this->DefaultPlatformToolset = "v141"; diff --git a/Source/cmGlobalVisualStudio15Generator.h b/Source/cmGlobalVisualStudio15Generator.h index 233f3bc..da85d23 100644 --- a/Source/cmGlobalVisualStudio15Generator.h +++ b/Source/cmGlobalVisualStudio15Generator.h @@ -18,8 +18,6 @@ class cmake; class cmGlobalVisualStudio15Generator : public cmGlobalVisualStudio14Generator { public: - cmGlobalVisualStudio15Generator(cmake* cm, const std::string& name, - const std::string& platformName); static cmGlobalGeneratorFactory* NewFactory(); bool MatchesGeneratorName(const std::string& name) const override; @@ -32,6 +30,9 @@ public: std::string GetAuxiliaryToolset() const override; protected: + cmGlobalVisualStudio15Generator(cmake* cm, const std::string& name, + std::string const& platformInGeneratorName); + bool InitializeWindows(cmMakefile* mf) override; bool SelectWindowsStoreToolset(std::string& toolset) const override; @@ -53,6 +54,7 @@ protected: private: class Factory; + friend class Factory; mutable cmVSSetupAPIHelper vsSetupAPIHelper; }; #endif diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 3648086..84f8df1 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -41,7 +41,7 @@ static cmVS7FlagTable cmVS7ExtraFlagTable[] = { }; cmGlobalVisualStudio7Generator::cmGlobalVisualStudio7Generator( - cmake* cm, const std::string& platformName) + cmake* cm, std::string const& platformInGeneratorName) : cmGlobalVisualStudioGenerator(cm) { this->IntelProjectVersion = 0; @@ -49,10 +49,10 @@ cmGlobalVisualStudio7Generator::cmGlobalVisualStudio7Generator( this->MasmEnabled = false; this->NasmEnabled = false; - if (platformName.empty()) { + if (platformInGeneratorName.empty()) { this->DefaultPlatformName = "Win32"; } else { - this->DefaultPlatformName = platformName; + this->DefaultPlatformName = platformInGeneratorName; } this->ExtraFlagTable = cmVS7ExtraFlagTable; } diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index f092b56..4240bd4 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -18,8 +18,6 @@ struct cmIDEFlagTable; class cmGlobalVisualStudio7Generator : public cmGlobalVisualStudioGenerator { public: - cmGlobalVisualStudio7Generator(cmake* cm, - const std::string& platformName = ""); ~cmGlobalVisualStudio7Generator(); ///! Get the name for the platform. @@ -110,6 +108,9 @@ public: cmIDEFlagTable const* ExtraFlagTable; protected: + cmGlobalVisualStudio7Generator(cmake* cm, + std::string const& platformInGeneratorName); + void Generate() override; std::string const& GetDevEnvCommand(); diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index ee118f1..616328d 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -12,8 +12,9 @@ #include "cmake.h" cmGlobalVisualStudio8Generator::cmGlobalVisualStudio8Generator( - cmake* cm, const std::string& name, const std::string& platformName) - : cmGlobalVisualStudio71Generator(cm, platformName) + cmake* cm, const std::string& name, + std::string const& platformInGeneratorName) + : cmGlobalVisualStudio71Generator(cm, platformInGeneratorName) { this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms"; this->Name = name; diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h index cacfa68..8719bf3 100644 --- a/Source/cmGlobalVisualStudio8Generator.h +++ b/Source/cmGlobalVisualStudio8Generator.h @@ -13,9 +13,6 @@ class cmGlobalVisualStudio8Generator : public cmGlobalVisualStudio71Generator { public: - cmGlobalVisualStudio8Generator(cmake* cm, const std::string& name, - const std::string& platformName); - ///! Get the name for the generator. std::string GetName() const override { return this->Name; } @@ -45,6 +42,9 @@ public: } protected: + cmGlobalVisualStudio8Generator(cmake* cm, const std::string& name, + std::string const& platformInGeneratorName); + void AddExtraIDETargets() override; std::string FindDevEnvCommand() override; diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx index 760cce4..e784595 100644 --- a/Source/cmGlobalVisualStudio9Generator.cxx +++ b/Source/cmGlobalVisualStudio9Generator.cxx @@ -83,8 +83,9 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio9Generator::NewFactory() } cmGlobalVisualStudio9Generator::cmGlobalVisualStudio9Generator( - cmake* cm, const std::string& name, const std::string& platformName) - : cmGlobalVisualStudio8Generator(cm, name, platformName) + cmake* cm, const std::string& name, + std::string const& platformInGeneratorName) + : cmGlobalVisualStudio8Generator(cm, name, platformInGeneratorName) { this->Version = VS9; std::string vc9Express; diff --git a/Source/cmGlobalVisualStudio9Generator.h b/Source/cmGlobalVisualStudio9Generator.h index e537a3d..7bebfd6 100644 --- a/Source/cmGlobalVisualStudio9Generator.h +++ b/Source/cmGlobalVisualStudio9Generator.h @@ -13,8 +13,6 @@ class cmGlobalVisualStudio9Generator : public cmGlobalVisualStudio8Generator { public: - cmGlobalVisualStudio9Generator(cmake* cm, const std::string& name, - const std::string& platformName); static cmGlobalGeneratorFactory* NewFactory(); /** @@ -30,6 +28,10 @@ public: */ std::string GetUserMacrosRegKeyBase() override; +protected: + cmGlobalVisualStudio9Generator(cmake* cm, const std::string& name, + std::string const& platformInGeneratorName); + private: class Factory; friend class Factory; diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index 0d4491d..d827616 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -41,7 +41,6 @@ public: VS15 = 150 }; - cmGlobalVisualStudioGenerator(cmake* cm); virtual ~cmGlobalVisualStudioGenerator(); VSVersion GetVersion() const; @@ -133,6 +132,8 @@ public: bool dryRun) override; protected: + cmGlobalVisualStudioGenerator(cmake* cm); + void AddExtraIDETargets() override; // Does this VS version link targets to each other if there are https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5ca7e5057bcadbcbe6b933b004ba37ddb5199dba commit 5ca7e5057bcadbcbe6b933b004ba37ddb5199dba Author: Brad King AuthorDate: Thu Jan 10 09:30:52 2019 -0500 Commit: Brad King CommitDate: Thu Jan 10 09:38:35 2019 -0500 Help: Document VS generator default platform selection diff --git a/Help/generator/Visual Studio 10 2010.rst b/Help/generator/Visual Studio 10 2010.rst index 0446b8c..4bf9a8f 100644 --- a/Help/generator/Visual Studio 10 2010.rst +++ b/Help/generator/Visual Studio 10 2010.rst @@ -15,6 +15,8 @@ projects (Database, Website, etc.) are not supported. Platform Selection ^^^^^^^^^^^^^^^^^^ +The default target platform name (architecture) is ``Win32``. + The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set, perhaps via the :manual:`cmake(1)` ``-A`` option, to specify a target platform name (architecture). For example: diff --git a/Help/generator/Visual Studio 11 2012.rst b/Help/generator/Visual Studio 11 2012.rst index 8fddbb3..5d89a6e 100644 --- a/Help/generator/Visual Studio 11 2012.rst +++ b/Help/generator/Visual Studio 11 2012.rst @@ -15,6 +15,8 @@ projects (JavaScript, Database, Website, etc.) are not supported. Platform Selection ^^^^^^^^^^^^^^^^^^ +The default target platform name (architecture) is ``Win32``. + The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set, perhaps via the :manual:`cmake(1)` ``-A`` option, to specify a target platform name (architecture). For example: diff --git a/Help/generator/Visual Studio 12 2013.rst b/Help/generator/Visual Studio 12 2013.rst index 8b4c162..d342c53 100644 --- a/Help/generator/Visual Studio 12 2013.rst +++ b/Help/generator/Visual Studio 12 2013.rst @@ -15,6 +15,8 @@ projects (JavaScript, Powershell, Python, etc.) are not supported. Platform Selection ^^^^^^^^^^^^^^^^^^ +The default target platform name (architecture) is ``Win32``. + The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set, perhaps via the :manual:`cmake(1)` ``-A`` option, to specify a target platform name (architecture). For example: diff --git a/Help/generator/Visual Studio 14 2015.rst b/Help/generator/Visual Studio 14 2015.rst index 917d8e5..106b7c5 100644 --- a/Help/generator/Visual Studio 14 2015.rst +++ b/Help/generator/Visual Studio 14 2015.rst @@ -12,6 +12,8 @@ projects (JavaScript, Powershell, Python, etc.) are not supported. Platform Selection ^^^^^^^^^^^^^^^^^^ +The default target platform name (architecture) is ``Win32``. + The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set, perhaps via the :manual:`cmake(1)` ``-A`` option, to specify a target platform name (architecture). For example: diff --git a/Help/generator/Visual Studio 15 2017.rst b/Help/generator/Visual Studio 15 2017.rst index 42a3bb6..52c1fa0 100644 --- a/Help/generator/Visual Studio 15 2017.rst +++ b/Help/generator/Visual Studio 15 2017.rst @@ -28,6 +28,8 @@ by default. Platform Selection ^^^^^^^^^^^^^^^^^^ +The default target platform name (architecture) is ``Win32``. + The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set, perhaps via the :manual:`cmake(1)` ``-A`` option, to specify a target platform name (architecture). For example: diff --git a/Help/generator/Visual Studio 9 2008.rst b/Help/generator/Visual Studio 9 2008.rst index a29033f..a09d047 100644 --- a/Help/generator/Visual Studio 9 2008.rst +++ b/Help/generator/Visual Studio 9 2008.rst @@ -6,6 +6,8 @@ Generates Visual Studio 9 2008 project files. Platform Selection ^^^^^^^^^^^^^^^^^^ +The default target platform name (architecture) is ``Win32``. + The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set, perhaps via the :manual:`cmake(1)` ``-A`` option, to specify a target platform name (architecture). For example: ----------------------------------------------------------------------- Summary of changes: Help/generator/Visual Studio 10 2010.rst | 2 ++ Help/generator/Visual Studio 11 2012.rst | 2 ++ Help/generator/Visual Studio 12 2013.rst | 2 ++ Help/generator/Visual Studio 14 2015.rst | 2 ++ Help/generator/Visual Studio 15 2017.rst | 2 ++ Help/generator/Visual Studio 9 2008.rst | 2 ++ Source/cmGlobalVisualStudio10Generator.cxx | 9 +++++---- Source/cmGlobalVisualStudio10Generator.h | 7 +++++-- Source/cmGlobalVisualStudio11Generator.cxx | 5 +++-- Source/cmGlobalVisualStudio11Generator.h | 5 +++-- Source/cmGlobalVisualStudio12Generator.cxx | 5 +++-- Source/cmGlobalVisualStudio12Generator.h | 6 ++++-- Source/cmGlobalVisualStudio14Generator.cxx | 5 +++-- Source/cmGlobalVisualStudio14Generator.h | 6 ++++-- Source/cmGlobalVisualStudio15Generator.cxx | 5 +++-- Source/cmGlobalVisualStudio15Generator.h | 6 ++++-- Source/cmGlobalVisualStudio7Generator.cxx | 30 ++---------------------------- Source/cmGlobalVisualStudio7Generator.h | 12 +++--------- Source/cmGlobalVisualStudio8Generator.cxx | 7 ++++--- Source/cmGlobalVisualStudio8Generator.h | 6 +++--- Source/cmGlobalVisualStudio9Generator.cxx | 5 +++-- Source/cmGlobalVisualStudio9Generator.h | 6 ++++-- Source/cmGlobalVisualStudioGenerator.cxx | 30 +++++++++++++++++++++++++++++- Source/cmGlobalVisualStudioGenerator.h | 16 +++++++++++++++- 24 files changed, 112 insertions(+), 71 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Sat Jan 12 00:03:07 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Sat, 12 Jan 2019 00:03:07 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.2-883-gc459bea Message-ID: <20190112050307.944731265E4@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via c459beaf60b21ac906b70d4ccd6ba16d2cae5be6 (commit) from 5a283b79e5fe1739142cc513a9a701855849b2f8 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c459beaf60b21ac906b70d4ccd6ba16d2cae5be6 commit c459beaf60b21ac906b70d4ccd6ba16d2cae5be6 Author: Kitware Robot AuthorDate: Sat Jan 12 00:01:06 2019 -0500 Commit: Kitware Robot CommitDate: Sat Jan 12 00:01:06 2019 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 2c83140..3910c3b 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 13) -set(CMake_VERSION_PATCH 20190111) +set(CMake_VERSION_PATCH 20190112) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Sun Jan 13 00:03:05 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Sun, 13 Jan 2019 00:03:05 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.2-884-g310054a Message-ID: <20190113050305.0FD3612609E@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 310054ac230d2c7ad2a88052502cbd8939cf2529 (commit) from c459beaf60b21ac906b70d4ccd6ba16d2cae5be6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=310054ac230d2c7ad2a88052502cbd8939cf2529 commit 310054ac230d2c7ad2a88052502cbd8939cf2529 Author: Kitware Robot AuthorDate: Sun Jan 13 00:01:04 2019 -0500 Commit: Kitware Robot CommitDate: Sun Jan 13 00:01:04 2019 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 3910c3b..65c2c94 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 13) -set(CMake_VERSION_PATCH 20190112) +set(CMake_VERSION_PATCH 20190113) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jan 14 00:03:06 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 14 Jan 2019 00:03:06 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.2-885-gdd90811 Message-ID: <20190114050306.77B961267C2@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via dd90811bbf61fb9066f84463e9817b94324c105f (commit) from 310054ac230d2c7ad2a88052502cbd8939cf2529 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dd90811bbf61fb9066f84463e9817b94324c105f commit dd90811bbf61fb9066f84463e9817b94324c105f Author: Kitware Robot AuthorDate: Mon Jan 14 00:01:04 2019 -0500 Commit: Kitware Robot CommitDate: Mon Jan 14 00:01:04 2019 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 65c2c94..4a4f63f 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 13) -set(CMake_VERSION_PATCH 20190113) +set(CMake_VERSION_PATCH 20190114) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jan 14 06:53:07 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 14 Jan 2019 06:53:07 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.2-890-g6a23e16 Message-ID: <20190114115307.3316D125A29@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 6a23e16ec289ca737b7a4c1020e6b0c71c749672 (commit) via 0377fe1e2b05b729b2baad6c78b922aa972b7c09 (commit) via dd39da551883bca5f8ec1be376a77f6d56666552 (commit) via f44a0414aec38f6e70eb2c11c75c9f35bb526259 (commit) via 5ae69f591965886c5e6a1cde780a87ddc4c4722d (commit) from dd90811bbf61fb9066f84463e9817b94324c105f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6a23e16ec289ca737b7a4c1020e6b0c71c749672 commit 6a23e16ec289ca737b7a4c1020e6b0c71c749672 Merge: dd90811 0377fe1 Author: Brad King AuthorDate: Mon Jan 14 11:51:32 2019 +0000 Commit: Kitware Robot CommitDate: Mon Jan 14 06:51:42 2019 -0500 Merge topic 'autogen_noqt_warning' 0377fe1e2b Merge branch 'backport-autogen_noqt_warning' into autogen_noqt_warning dd39da5518 Tests: Add case for warning when AUTOMOC/UIC/RCC gets disabled f44a0414ae Autogen: Issue a warning when AUTOMOC/UIC/RCC gets disabled. 5ae69f5919 Autogen: Issue a warning when AUTOMOC/UIC/RCC gets disabled. Acked-by: Kitware Robot Merge-request: !2787 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0377fe1e2b05b729b2baad6c78b922aa972b7c09 commit 0377fe1e2b05b729b2baad6c78b922aa972b7c09 Merge: f44a041 dd39da5 Author: Brad King AuthorDate: Fri Jan 11 08:41:51 2019 -0500 Commit: Brad King CommitDate: Fri Jan 11 08:41:51 2019 -0500 Merge branch 'backport-autogen_noqt_warning' into autogen_noqt_warning https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dd39da551883bca5f8ec1be376a77f6d56666552 commit dd39da551883bca5f8ec1be376a77f6d56666552 Author: Brad King AuthorDate: Fri Jan 11 08:27:14 2019 -0500 Commit: Brad King CommitDate: Fri Jan 11 08:28:42 2019 -0500 Tests: Add case for warning when AUTOMOC/UIC/RCC gets disabled diff --git a/Tests/RunCMake/Autogen/CMakeLists.txt b/Tests/RunCMake/Autogen/CMakeLists.txt new file mode 100644 index 0000000..9a66cde --- /dev/null +++ b/Tests/RunCMake/Autogen/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.13) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/Autogen/NoQt-stderr.txt b/Tests/RunCMake/Autogen/NoQt-stderr.txt new file mode 100644 index 0000000..6b4a933 --- /dev/null +++ b/Tests/RunCMake/Autogen/NoQt-stderr.txt @@ -0,0 +1,8 @@ +^CMake Warning \(dev\) in CMakeLists.txt: + AUTOGEN: No valid Qt version found for target main. AUTOMOC, AUTOUIC, + AUTORCC disabled. Consider adding: + + find_package\(Qt5 COMPONENTS Widgets\) + + to your CMakeLists.txt file. +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/Autogen/NoQt.cmake b/Tests/RunCMake/Autogen/NoQt.cmake new file mode 100644 index 0000000..b2d375a --- /dev/null +++ b/Tests/RunCMake/Autogen/NoQt.cmake @@ -0,0 +1,6 @@ +enable_language(CXX) + +add_executable(main empty.cpp) +set_property(TARGET main PROPERTY AUTOMOC 1) +set_property(TARGET main PROPERTY AUTORCC 1) +set_property(TARGET main PROPERTY AUTOUIC 1) diff --git a/Tests/RunCMake/Autogen/RunCMakeTest.cmake b/Tests/RunCMake/Autogen/RunCMakeTest.cmake new file mode 100644 index 0000000..e52f28d --- /dev/null +++ b/Tests/RunCMake/Autogen/RunCMakeTest.cmake @@ -0,0 +1,3 @@ +include(RunCMake) + +run_cmake(NoQt) diff --git a/Tests/RunCMake/Autogen/empty.cpp b/Tests/RunCMake/Autogen/empty.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 99f4ae7..89102dd 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -142,6 +142,7 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE) endif() add_RunCMake_test(AndroidTestUtilities) +add_RunCMake_test(Autogen) add_RunCMake_test(BuildDepends) if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja") add_RunCMake_test(Byproducts) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f44a0414aec38f6e70eb2c11c75c9f35bb526259 commit f44a0414aec38f6e70eb2c11c75c9f35bb526259 Author: Sebastian Holtermann AuthorDate: Thu Jan 10 17:39:51 2019 +0100 Commit: Brad King CommitDate: Thu Jan 10 14:05:33 2019 -0500 Autogen: Issue a warning when AUTOMOC/UIC/RCC gets disabled. We used to silently disable AUTOMOC/UIC/RCC when no valid Qt version was found. This patch introduces the generation of a warning message in that case. diff --git a/Source/cmQtAutoGenGlobalInitializer.cxx b/Source/cmQtAutoGenGlobalInitializer.cxx index 678ff14..f4cf3e0 100644 --- a/Source/cmQtAutoGenGlobalInitializer.cxx +++ b/Source/cmQtAutoGenGlobalInitializer.cxx @@ -13,6 +13,7 @@ #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmTarget.h" +#include "cmake.h" #include #include @@ -86,10 +87,43 @@ cmQtAutoGenGlobalInitializer::cmQtAutoGenGlobalInitializer( auto qtVersion = cmQtAutoGenInitializer::GetQtVersion(target); bool const validQt = (qtVersion.Major == 4) || (qtVersion.Major == 5) || (qtVersion.Major == 6); - bool const mocIsValid = moc && (validQt || !mocExec.empty()); - bool const uicIsValid = uic && (validQt || !uicExec.empty()); - bool const rccIsValid = rcc && (validQt || !rccExec.empty()); + bool const mocAvailable = (validQt || !mocExec.empty()); + bool const uicAvailable = (validQt || !uicExec.empty()); + bool const rccAvailable = (validQt || !rccExec.empty()); + bool const mocIsValid = (moc && mocAvailable); + bool const uicIsValid = (uic && uicAvailable); + bool const rccIsValid = (rcc && uicAvailable); + // Disabled AUTOMOC/UIC/RCC warning + bool const mocDisabled = (moc && !mocAvailable); + bool const uicDisabled = (uic && !uicAvailable); + bool const rccDisabled = (rcc && !rccAvailable); + if (mocDisabled || uicDisabled || rccDisabled) { + std::string msg = "AUTOGEN: No valid Qt version found for target "; + msg += target->GetName(); + msg += ". "; + { + std::vector lst; + if (mocDisabled) { + lst.emplace_back("AUTOMOC"); + } + if (uicDisabled) { + lst.emplace_back("AUTOUIC"); + } + if (rccDisabled) { + lst.emplace_back("AUTORCC"); + } + msg += cmJoin(lst, ", "); + } + msg += " disabled. Consider adding:\n"; + if (uicDisabled) { + msg += " find_package(Qt5 COMPONENTS Widgets)\n"; + } else { + msg += " find_package(Qt5 COMPONENTS Core)\n"; + } + msg += "to your CMakeLists.txt file."; + target->Makefile->IssueMessage(cmake::AUTHOR_WARNING, msg); + } if (mocIsValid || uicIsValid || rccIsValid) { // Create autogen target initializer Initializers_.emplace_back(cm::make_unique( https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5ae69f591965886c5e6a1cde780a87ddc4c4722d commit 5ae69f591965886c5e6a1cde780a87ddc4c4722d Author: Sebastian Holtermann AuthorDate: Thu Jan 10 15:44:10 2019 +0100 Commit: Sebastian Holtermann CommitDate: Thu Jan 10 16:48:28 2019 +0100 Autogen: Issue a warning when AUTOMOC/UIC/RCC gets disabled. We used to silently disable AUTOMOC/UIC/RCC when no valid Qt version was found. This patch introduces the generation of a warning message in that case. Closes #18732. diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 71e844e..5f7ff0b 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1500,6 +1500,31 @@ bool cmGlobalGenerator::QtAutoGen() auto qtVersion = cmQtAutoGenInitializer::GetQtVersion(target); // don't do anything if there is no Qt4 or Qt5Core (which contains moc) if (qtVersion.Major != 4 && qtVersion.Major != 5) { + std::string msg = "AUTOGEN: No valid Qt version found for target "; + msg += target->GetName(); + msg += ". "; + { + std::vector lst; + if (mocEnabled) { + lst.emplace_back("AUTOMOC"); + } + if (uicEnabled) { + lst.emplace_back("AUTOUIC"); + } + if (rccEnabled) { + lst.emplace_back("AUTORCC"); + } + msg += cmJoin(lst, ", "); + } + msg += " disabled. "; + msg += "Consider adding:\n"; + if (uicEnabled) { + msg += " find_package(Qt5 COMPONENTS Widgets)\n"; + } else { + msg += " find_package(Qt5 COMPONENTS Core)\n"; + } + msg += "to your CMakeLists.txt file."; + target->Makefile->IssueMessage(cmake::AUTHOR_WARNING, msg); continue; } ----------------------------------------------------------------------- Summary of changes: Source/cmQtAutoGenGlobalInitializer.cxx | 40 ++++++++++++++++++++-- Tests/RunCMake/{Android => Autogen}/CMakeLists.txt | 2 +- Tests/RunCMake/Autogen/NoQt-stderr.txt | 8 +++++ Tests/RunCMake/Autogen/NoQt.cmake | 6 ++++ Tests/RunCMake/Autogen/RunCMakeTest.cmake | 3 ++ .../{include_directories => Autogen}/empty.cpp | 0 Tests/RunCMake/CMakeLists.txt | 1 + 7 files changed, 56 insertions(+), 4 deletions(-) copy Tests/RunCMake/{Android => Autogen}/CMakeLists.txt (63%) create mode 100644 Tests/RunCMake/Autogen/NoQt-stderr.txt create mode 100644 Tests/RunCMake/Autogen/NoQt.cmake create mode 100644 Tests/RunCMake/Autogen/RunCMakeTest.cmake copy Tests/RunCMake/{include_directories => Autogen}/empty.cpp (100%) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jan 14 07:33:07 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 14 Jan 2019 07:33:07 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.2-896-g848dc85 Message-ID: <20190114123307.8CD371279DB@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 848dc85187ec1e4b2364987d911ce7af93062b45 (commit) via 1f411b0cfaad12c87da02ffc2b20bb791b1f9024 (commit) via c63a19e9201474750fea6adc11d75a9bb5a21e5b (commit) via 27eb7c5bdb5bb8deefe1772675dc4819592bf036 (commit) via a1adbc724336b0a4185e34b63e18de03a8b119cf (commit) via ddb5b097cd29e2e7fcddcb79c4e3ae8c64b0a5b3 (commit) from 6a23e16ec289ca737b7a4c1020e6b0c71c749672 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=848dc85187ec1e4b2364987d911ce7af93062b45 commit 848dc85187ec1e4b2364987d911ce7af93062b45 Merge: 1f411b0 c63a19e Author: Brad King AuthorDate: Mon Jan 14 07:26:12 2019 -0500 Commit: Brad King CommitDate: Mon Jan 14 07:26:12 2019 -0500 Merge branch 'release-3.13' https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1f411b0cfaad12c87da02ffc2b20bb791b1f9024 commit 1f411b0cfaad12c87da02ffc2b20bb791b1f9024 Merge: 6a23e16 27eb7c5 Author: Brad King AuthorDate: Mon Jan 14 12:25:39 2019 +0000 Commit: Kitware Robot CommitDate: Mon Jan 14 07:25:46 2019 -0500 Merge topic 'cmake-option-parsing' 27eb7c5bdb cmake: Ensure source and binary dirs are set a1adbc7243 cmake: Stop processing if -P option lacks file name Acked-by: Kitware Robot Merge-request: !2799 ----------------------------------------------------------------------- Summary of changes: Source/cmake.cxx | 25 ++++++++++++------- Source/cmake.h | 3 +-- Source/cmakemain.cxx | 10 ++++---- Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 29 +++++++++++----------- .../no-S-B-result.txt} | 0 Tests/RunCMake/CommandLine/no-S-B-stderr.txt | 1 + 6 files changed, 38 insertions(+), 30 deletions(-) copy Tests/RunCMake/{while/MissingArgument-result.txt => CommandLine/no-S-B-result.txt} (100%) create mode 100644 Tests/RunCMake/CommandLine/no-S-B-stderr.txt hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jan 14 07:33:08 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 14 Jan 2019 07:33:08 -0500 (EST) Subject: [Cmake-commits] CMake branch, release, updated. v3.13.2-13-gc63a19e Message-ID: <20190114123308.02CA91279B0@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, release has been updated via c63a19e9201474750fea6adc11d75a9bb5a21e5b (commit) via 27eb7c5bdb5bb8deefe1772675dc4819592bf036 (commit) via a1adbc724336b0a4185e34b63e18de03a8b119cf (commit) via ddb5b097cd29e2e7fcddcb79c4e3ae8c64b0a5b3 (commit) via dd39da551883bca5f8ec1be376a77f6d56666552 (commit) via 5ae69f591965886c5e6a1cde780a87ddc4c4722d (commit) from 91fa6a472cd262014a74d765b003bb1cc9d7ab8a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Source/cmGlobalGenerator.cxx | 25 +++++++++++++++++++ Source/cmake.cxx | 25 ++++++++++++------- Source/cmake.h | 3 +-- Source/cmakemain.cxx | 10 ++++---- Tests/RunCMake/{Android => Autogen}/CMakeLists.txt | 2 +- Tests/RunCMake/Autogen/NoQt-stderr.txt | 8 ++++++ Tests/RunCMake/Autogen/NoQt.cmake | 6 +++++ Tests/RunCMake/Autogen/RunCMakeTest.cmake | 3 +++ .../{include_directories => Autogen}/empty.cpp | 0 Tests/RunCMake/CMakeLists.txt | 1 + Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 29 +++++++++++----------- .../no-S-B-result.txt} | 0 Tests/RunCMake/CommandLine/no-S-B-stderr.txt | 1 + 13 files changed, 82 insertions(+), 31 deletions(-) copy Tests/RunCMake/{Android => Autogen}/CMakeLists.txt (63%) create mode 100644 Tests/RunCMake/Autogen/NoQt-stderr.txt create mode 100644 Tests/RunCMake/Autogen/NoQt.cmake create mode 100644 Tests/RunCMake/Autogen/RunCMakeTest.cmake copy Tests/RunCMake/{include_directories => Autogen}/empty.cpp (100%) copy Tests/RunCMake/{while/MissingArgument-result.txt => CommandLine/no-S-B-result.txt} (100%) create mode 100644 Tests/RunCMake/CommandLine/no-S-B-stderr.txt hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jan 14 09:03:04 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 14 Jan 2019 09:03:04 -0500 (EST) Subject: [Cmake-commits] CMake branch, release, updated. v3.13.2-14-g8887ebc Message-ID: <20190114140304.D7E9411D88E@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, release has been updated via 8887ebc69b86606b388272d5c89ce11753bb4804 (commit) from c63a19e9201474750fea6adc11d75a9bb5a21e5b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jan 14 09:03:04 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 14 Jan 2019 09:03:04 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.2-898-g3e763d5 Message-ID: <20190114140304.AE18F11372D@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 3e763d506cda64d76c40d327371925e9df7cbca8 (commit) via 8887ebc69b86606b388272d5c89ce11753bb4804 (commit) from 848dc85187ec1e4b2364987d911ce7af93062b45 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3e763d506cda64d76c40d327371925e9df7cbca8 commit 3e763d506cda64d76c40d327371925e9df7cbca8 Merge: 848dc85 8887ebc Author: Brad King AuthorDate: Mon Jan 14 09:02:41 2019 -0500 Commit: Brad King CommitDate: Mon Jan 14 09:02:41 2019 -0500 Merge branch 'release-3.13' ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jan 14 09:13:03 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 14 Jan 2019 09:13:03 -0500 (EST) Subject: [Cmake-commits] CMake annotated tag, v3.13.3, created. v3.13.3 Message-ID: <20190114141303.9E8511267C1@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The annotated tag, v3.13.3 has been created at 085e1f6ac8e234c874c0e854945c5228d055638e (tag) tagging 8887ebc69b86606b388272d5c89ce11753bb4804 (commit) replaces v3.13.2 tagged by Brad King on Mon Jan 14 09:07:45 2019 -0500 - Log ----------------------------------------------------------------- CMake 3.13.3 -----BEGIN PGP SIGNATURE----- iQJKBAABCgA0FiEExsJlMku+vcNQtRPQLSzvEDSSFoQFAlw8l7EWHGJyYWQua2lu Z0BraXR3YXJlLmNvbQAKCRAtLO8QNJIWhOAMEACpNrxLFINl8nnXqS+bV7HN5v3E ViCUrrCMd+FN2F7XwhlO/UfIGXq8YKq9dnVPBcLf9uaYPqDobBJvyFvxTM0D2Rrz 7knEMSJm/JFDAGat9V+eNYO6xMBmDhqWlujcD4dfF36CHiXr9GYTDHtK+6VPVrQp S8wOkMgW81ogTT4Y4kM92xJag9Vp4FhwQs9k1OU2E+jvGMp65xBfLwx//BEgFLrR kZNp4zpzY6Qa5olAonhBWQX7RTA90ec3znc0h6i58lBZ9PB2w35rAg1ZEVuYQT8+ /jy6ZSU9+mjiJ/5pDa0VopWhIpM99SAUIfFMaW1ucVdNZE+tvYUbYOu7uY3fh15Y sFMbzhK0J8CCJje0vCL2sL5hjq0HALdqlpVvoJx9emo32egHudIJqDuSaBdyz1h+ w7TTp/u/8GuBIBLidr6NJ8qI2zTE70Z2YxmZfwfupfEUlpRawjsC5vvunNi6qp98 GNahzAi4ziCUfbMSI8FjxIwTDw1aW6rS91Y6wugzovBESIoh8yrEQOSe5z3J5WCZ qEzQMquaoEXPBxlEYl+QxMTsrhY8N3YNW7w/8KW2sH6DtuQt2AATZ2GG5cZ7Hld7 DZSHU+wjUfphzz2DbIhuLui6s3xHew9xmylJEd17vGIxk66AJnBJ5/HfDqd030+6 SQRtJKK2HuK1k9LGpg== =+nrX -----END PGP SIGNATURE----- Brad King (8): VS: Exclude VS 2019 instances when using VS 2017 generator Merge branch 'vs2017-skip-2019' into release-3.13 Tests: Add cases for -{C,D,U} without a source tree Merge branch 'cmake-CDU-option-parsing' into release-3.13 Tests: Add case for warning when AUTOMOC/UIC/RCC gets disabled Merge branch 'backport-autogen_noqt_warning' into release-3.13 Merge branch 'cmake-option-parsing' into release-3.13 CMake 3.13.3 Craig Scott (3): Merge branch 'feature/fix-link_resolved_item_into_bundle' into release-3.13 cmake: Stop processing if -P option lacks file name cmake: Ensure source and binary dirs are set Paul Seyfert (1): cmake: distinguish '-Cpath' from '-C path' in source dir parsing Sebastian Holtermann (1): Autogen: Issue a warning when AUTOMOC/UIC/RCC gets disabled. Tim Blechmann (1): BundleUtilities: Ensure target dir exists when creating symlinks ----------------------------------------------------------------------- hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jan 14 09:23:05 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 14 Jan 2019 09:23:05 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-888-g9e03a63 Message-ID: <20190114142305.F1BB2125B94@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 9e03a63ba8b6b01ffbf5c0ee207c8c0bf040f494 (commit) via e91f1616d92120bd364437fc915634d48d653512 (commit) via beb991110d84e9c0a6b1339e22fa98284b08bac9 (commit) via c834c47dfc8006fbdf95a22ea4241b53d7235915 (commit) from 3e763d506cda64d76c40d327371925e9df7cbca8 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9e03a63ba8b6b01ffbf5c0ee207c8c0bf040f494 commit 9e03a63ba8b6b01ffbf5c0ee207c8c0bf040f494 Merge: e91f161 beb9911 Author: Brad King AuthorDate: Mon Jan 14 14:15:04 2019 +0000 Commit: Kitware Robot CommitDate: Mon Jan 14 09:15:10 2019 -0500 Merge topic 'drop-IRIX' beb991110d Remove now-unused code once used on IRIX Acked-by: Kitware Robot Merge-request: !2791 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e91f1616d92120bd364437fc915634d48d653512 commit e91f1616d92120bd364437fc915634d48d653512 Merge: 3e763d5 c834c47 Author: Brad King AuthorDate: Mon Jan 14 14:14:09 2019 +0000 Commit: Kitware Robot CommitDate: Mon Jan 14 09:14:17 2019 -0500 Merge topic 'cpplint-no-output-no-warning' c834c47dfc cpplint: only print diagnostics to console if there are errors Acked-by: Kitware Robot Merge-request: !2788 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=beb991110d84e9c0a6b1339e22fa98284b08bac9 commit beb991110d84e9c0a6b1339e22fa98284b08bac9 Author: Brad King AuthorDate: Fri Jan 11 13:50:46 2019 -0500 Commit: Brad King CommitDate: Fri Jan 11 13:50:46 2019 -0500 Remove now-unused code once used on IRIX We dropped support for IRIX as a host platform long ago. Remove some leftover code. diff --git a/CompileFlags.cmake b/CompileFlags.cmake index ec9b31b..5d0e144 100644 --- a/CompileFlags.cmake +++ b/CompileFlags.cmake @@ -28,13 +28,6 @@ if(CMAKE_SYSTEM_NAME MATCHES "AIX") endif() endif() -if(CMAKE_SYSTEM_NAME MATCHES "IRIX") - if(NOT CMAKE_COMPILER_IS_GNUCXX) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-woff84 -no_auto_include") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-woff15") - endif() -endif() - if(CMAKE_SYSTEM MATCHES "OSF1-V") if(NOT CMAKE_COMPILER_IS_GNUCXX) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -timplicit_local -no_implicit_include ") diff --git a/Modules/CMakeBackwardCompatibilityCXX.cmake b/Modules/CMakeBackwardCompatibilityCXX.cmake index 628b541..02744a9 100644 --- a/Modules/CMakeBackwardCompatibilityCXX.cmake +++ b/Modules/CMakeBackwardCompatibilityCXX.cmake @@ -22,9 +22,6 @@ if(NOT CMAKE_SKIP_COMPATIBILITY_TESTS) if(NOT CMAKE_COMPILER_IS_GNUCXX) include(TestCXXAcceptsFlag) set(CMAKE_TRY_ANSI_CXX_FLAGS "") - if(CMAKE_SYSTEM_NAME MATCHES "IRIX") - set(CMAKE_TRY_ANSI_CXX_FLAGS "-LANG:std") - endif() if(CMAKE_SYSTEM_NAME MATCHES "OSF") set(CMAKE_TRY_ANSI_CXX_FLAGS "-std strict_ansi -nopure_cname") endif() diff --git a/Modules/CMakeCompilerABI.h b/Modules/CMakeCompilerABI.h index 6f36b03..45532af 100644 --- a/Modules/CMakeCompilerABI.h +++ b/Modules/CMakeCompilerABI.h @@ -10,16 +10,10 @@ const char info_sizeof_dptr[] = { }; /* Application Binary Interface. */ -#if defined(__sgi) && defined(_ABIO32) -# define ABI_ID "ELF O32" -#elif defined(__sgi) && defined(_ABIN32) -# define ABI_ID "ELF N32" -#elif defined(__sgi) && defined(_ABI64) -# define ABI_ID "ELF 64" /* Check for (some) ARM ABIs. * See e.g. http://wiki.debian.org/ArmEabiPort for some information on this. */ -#elif defined(__GNU__) && defined(__ELF__) && defined(__ARM_EABI__) +#if defined(__GNU__) && defined(__ELF__) && defined(__ARM_EABI__) # define ABI_ID "ELF ARMEABI" #elif defined(__GNU__) && defined(__ELF__) && defined(__ARMEB__) # define ABI_ID "ELF ARM" diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake index f2d43b6..9b2a91f 100644 --- a/Modules/CMakeCompilerIdDetection.cmake +++ b/Modules/CMakeCompilerIdDetection.cmake @@ -135,9 +135,6 @@ function(compiler_id_detection outvar lang) /* These compilers are either not known or too old to define an identification macro. Try to identify the platform and guess that it is the native compiler. */ -#elif defined(__sgi) -# define ${CID_PREFIX}COMPILER_ID \"MIPSpro\" - #elif defined(__hpux) || defined(__hpua) # define ${CID_PREFIX}COMPILER_ID \"HP\" diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake index 600d558..dc208c6 100644 --- a/Modules/CMakeDetermineSystem.cmake +++ b/Modules/CMakeDetermineSystem.cmake @@ -13,7 +13,6 @@ # BSD/OS BSD/OS # FreeBSD FreeBSD # HP-UX HP-UX -# IRIX IRIX # Linux Linux # GNU/kFreeBSD GNU/kFreeBSD # NetBSD NetBSD diff --git a/Modules/CMakeFortranCompilerABI.F b/Modules/CMakeFortranCompilerABI.F index b34c284..f4a5489 100644 --- a/Modules/CMakeFortranCompilerABI.F +++ b/Modules/CMakeFortranCompilerABI.F @@ -33,13 +33,7 @@ #if 0 ! Application Binary Interface #endif -#if defined(__sgi) && defined(_ABIO32) - PRINT *, 'INFO:abi[ELF O32]' -#elif defined(__sgi) && defined(_ABIN32) - PRINT *, 'INFO:abi[ELF N32]' -#elif defined(__sgi) && defined(_ABI64) - PRINT *, 'INFO:abi[ELF 64]' -#elif defined(__ELF__) +#if defined(__ELF__) PRINT *, 'INFO:abi[ELF]' #endif PRINT *, 'ABI Detection' diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in index da3d953..5995694 100644 --- a/Modules/CMakeFortranCompilerId.F.in +++ b/Modules/CMakeFortranCompilerId.F.in @@ -105,8 +105,6 @@ # endif #elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) PRINT *, 'INFO:compiler[VisualAge]' -#elif defined(__sgi) || defined(__sgi__) || defined(_SGI) - PRINT *, 'INFO:compiler[MIPSpro]' #elif defined(__hpux) || defined(__hpux__) PRINT *, 'INFO:compiler[HP]' #elif defined(NAGFOR) @@ -114,11 +112,7 @@ #define COMPILER_VERSION_MAJOR DEC(__NAG_COMPILER_RELEASE/10) #define COMPILER_VERSION_MINOR DEC(__NAG_COMPILER_RELEASE % 10) #define COMPILER_VERSION_PATCH DEC(__NAG_COMPILER_BUILD) -#elif 1 -# if 0 -! The above 'elif 1' instead of 'else' is to work around a bug in the -! SGI preprocessor which produces both the __sgi and else blocks. -# endif +#else PRINT *, 'INFO:compiler[]' #endif #if defined(__CRAYXE) || defined(__CRAYXC) @@ -148,8 +142,6 @@ PRINT *, 'INFO:platform[SunOS]' #elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) PRINT *, 'INFO:platform[AIX]' -#elif defined(__sgi) || defined(__sgi__) || defined(_SGI) - PRINT *, 'INFO:platform[IRIX]' #elif defined(__hpux) || defined(__hpux__) PRINT *, 'INFO:platform[HP-UX]' #elif defined(__HAIKU__) @@ -178,11 +170,7 @@ PRINT *, 'INFO:platform[ULTRIX]' #elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) PRINT *, 'INFO:platform[Xenix]' -#elif 1 -# if 0 -! The above 'elif 1' instead of 'else' is to work around a bug in the -! SGI preprocessor which produces both the __sgi and else blocks. -# endif +#else PRINT *, 'INFO:platform[]' #endif #if defined(_WIN32) && (defined(__INTEL_COMPILER) || defined(__ICC)) diff --git a/Modules/CMakePlatformId.h.in b/Modules/CMakePlatformId.h.in index dd77379..c2b5aa9 100644 --- a/Modules/CMakePlatformId.h.in +++ b/Modules/CMakePlatformId.h.in @@ -32,9 +32,6 @@ #elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) # define PLATFORM_ID "AIX" -#elif defined(__sgi) || defined(__sgi__) || defined(_SGI) -# define PLATFORM_ID "IRIX" - #elif defined(__hpux) || defined(__hpux__) # define PLATFORM_ID "HP-UX" diff --git a/Modules/Platform/IRIX.cmake b/Modules/Platform/IRIX.cmake deleted file mode 100644 index 12b0f37..0000000 --- a/Modules/Platform/IRIX.cmake +++ /dev/null @@ -1,53 +0,0 @@ -set(CMAKE_DL_LIBS "") -set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -rdata_shared") -set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath -set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty -if(NOT CMAKE_COMPILER_IS_GNUCXX) - set(CMAKE_CXX_CREATE_STATIC_LIBRARY - " -ar -o ") - set (CMAKE_CXX_FLAGS_INIT "") - set (CMAKE_CXX_FLAGS_DEBUG_INIT "-g") - set (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-O3 -DNDEBUG") - set (CMAKE_CXX_FLAGS_RELEASE_INIT "-O2 -DNDEBUG") - set (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2") - set (CMAKE_C_FLAGS_INIT "") -endif() -# set flags for gcc support -include(Platform/UnixPaths) - -if(NOT CMAKE_COMPILER_IS_GNUCC) - set (CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") - set (CMAKE_C_CREATE_ASSEMBLY_SOURCE - " -S " - "mv `basename \"\" | sed 's/\\.[^./]*$$//'`.s " - ) -endif() - -if(NOT CMAKE_COMPILER_IS_GNUCXX) - set (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") - set (CMAKE_CXX_CREATE_ASSEMBLY_SOURCE - " -S " - "mv `basename \"\" | sed 's/\\.[^./]*$$//'`.s " - ) -endif() - -if(NOT CMAKE_COMPILER_IS_GNUG77) - set (CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE " -E > ") - set (CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE - " -S " - "mv `basename \"\" | sed 's/\\.[^./]*$$//'`.s " - ) -endif() - -# Initialize C 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. -foreach(type SHARED_LIBRARY SHARED_MODULE EXE) - set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic") - set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic") -endforeach() - -# The IRIX linker needs to find transitive shared library dependencies -# in the -L path. -set(CMAKE_LINK_DEPENDENT_LIBRARY_DIRS 1) diff --git a/Modules/Platform/IRIX64.cmake b/Modules/Platform/IRIX64.cmake deleted file mode 100644 index ee9b96e..0000000 --- a/Modules/Platform/IRIX64.cmake +++ /dev/null @@ -1,73 +0,0 @@ -set(CMAKE_DL_LIBS "") -set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -rdata_shared") -set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath -set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty -set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") -if(NOT CMAKE_COMPILER_IS_GNUCC) - # Set default flags init. - set(CMAKE_C_FLAGS_INIT "") - set(CMAKE_CXX_FLAGS_INIT "") - set(CMAKE_Fortran_FLAGS_INIT "") - set(CMAKE_EXE_LINKER_FLAGS_INIT "") - set(CMAKE_SHARED_LINKER_FLAGS_INIT "") - set(CMAKE_MODULE_LINKER_FLAGS_INIT "") - - # If no -o32, -n32, or -64 flag is given, set a reasonable default. - if("$ENV{CFLAGS} $ENV{CXXFLAGS} $ENV{LDFLAGS}" MATCHES "-([no]32|64)") - else() - # Check if this is a 64-bit CMake. - if(CMAKE_FILE_SELF MATCHES "^CMAKE_FILE_SELF$") - exec_program(file ARGS ${CMAKE_COMMAND} OUTPUT_VARIABLE CMAKE_FILE_SELF) - set(CMAKE_FILE_SELF "${CMAKE_FILE_SELF}" CACHE INTERNAL - "Output of file command on ${CMAKE_COMMAND}.") - endif() - - # Set initial flags to match cmake executable. - if(CMAKE_FILE_SELF MATCHES " 64-bit ") - set(CMAKE_C_FLAGS_INIT "-64") - set(CMAKE_CXX_FLAGS_INIT "-64") - set(CMAKE_Fortran_FLAGS_INIT "-64") - set(CMAKE_EXE_LINKER_FLAGS_INIT "-64") - set(CMAKE_SHARED_LINKER_FLAGS_INIT "-64") - set(CMAKE_MODULE_LINKER_FLAGS_INIT "-64") - endif() - endif() - - # Set remaining defaults. - set(CMAKE_CXX_CREATE_STATIC_LIBRARY - " -ar -o ") - set (CMAKE_CXX_FLAGS_DEBUG_INIT "-g") - set (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-O3 -DNDEBUG") - set (CMAKE_CXX_FLAGS_RELEASE_INIT "-O2 -DNDEBUG") - set (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2") -endif() -include(Platform/UnixPaths) - -if(NOT CMAKE_COMPILER_IS_GNUCC) - set (CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") - set (CMAKE_C_CREATE_ASSEMBLY_SOURCE - " -S " - "mv `basename \"\" | sed 's/\\.[^./]*$$//'`.s " - ) -endif() - -if(NOT CMAKE_COMPILER_IS_GNUCXX) - set (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") - set (CMAKE_CXX_CREATE_ASSEMBLY_SOURCE - " -S " - "mv `basename \"\" | sed 's/\\.[^./]*$$//'`.s " - ) -endif() - -# Initialize C 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. -foreach(type SHARED_LIBRARY SHARED_MODULE EXE) - set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic") - set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic") -endforeach() - -# The IRIX linker needs to find transitive shared library dependencies -# in the -L path. -set(CMAKE_LINK_DEPENDENT_LIBRARY_DIRS 1) diff --git a/Modules/ProcessorCount.cmake b/Modules/ProcessorCount.cmake index 05f56d8..e4b4e53 100644 --- a/Modules/ProcessorCount.cmake +++ b/Modules/ProcessorCount.cmake @@ -12,7 +12,7 @@ Determine the number of processors/cores and save value in ${var} Sets the variable named ${var} to the number of physical cores available on the machine if the information can be determined. Otherwise it is set to 0. Currently this functionality is implemented -for AIX, cygwin, FreeBSD, HPUX, IRIX, Linux, macOS, QNX, Sun and +for AIX, cygwin, FreeBSD, HPUX, Linux, macOS, QNX, Sun and Windows. This function is guaranteed to return a positive integer (>=1) if it @@ -115,22 +115,6 @@ function(ProcessorCount var) endif() if(NOT count) - # IRIX (systems with hinv): - find_program(ProcessorCount_cmd_hinv hinv - PATHS /sbin) - mark_as_advanced(ProcessorCount_cmd_hinv) - if(ProcessorCount_cmd_hinv) - execute_process(COMMAND ${ProcessorCount_cmd_hinv} - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE - OUTPUT_VARIABLE hinv_output) - string(REGEX MATCHALL "([0-9]+) .* Processors" procs "${hinv_output}") - set(count "${CMAKE_MATCH_1}") - #message("ProcessorCount: trying hinv '${ProcessorCount_cmd_hinv}'") - endif() - endif() - - if(NOT count) # AIX (systems with lsconf): find_program(ProcessorCount_cmd_lsconf lsconf PATHS /usr/sbin) diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 27b8599..29483f9 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -30,7 +30,7 @@ Notes about linking on various platforms: ------------------------------------------------------------------------------ -Linux, FreeBSD, macOS, IRIX, Sun, Windows: +Linux, FreeBSD, macOS, Sun, Windows: Linking to libraries using the full path works fine. diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 803e5f0..6b166d6 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -597,7 +597,6 @@ if(BUILD_TESTING) else() if (CMAKE_CXX_COMPILER_ID MATCHES "PGI" OR CMAKE_CXX_COMPILER_ID MATCHES "PathScale" - OR CMAKE_SYSTEM_NAME MATCHES "IRIX64" OR CMAKE_CXX_COMPILER_ID MATCHES "Intel") set(run_pic_test 0) else() diff --git a/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in b/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in index 9157c76..f01e616 100644 --- a/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in +++ b/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in @@ -415,78 +415,6 @@ set(hp_f90_64_dirs "/usr/lib/hpux64;/opt/langtools/lib/hpux64") list(APPEND platforms hp_f90_64) #----------------------------------------------------------------------------- -# IRIX - -# cc -o32 dummy.c -v -set(irix64_cc_o32_text "/usr/lib/ld -elf -_SYSTYPE_SVR4 -require_dynamic_link _rld_new_interface -no_unresolved -Wx,-G 0 -o32 -mips2 -call_shared -g0 -KPIC -L/usr/lib/ -nocount /usr/lib/crt1.o -count dummy.o -nocount -lc /usr/lib/crtn.o") -set(irix64_cc_o32_libs "c") -set(irix64_cc_o32_dirs "/usr/lib") -list(APPEND platforms irix64_cc_o32) - -# cc -n32 dummy.c -v -set(irix64_cc_n32_text "/usr/lib32/cmplrs/ld32 -call_shared -no_unresolved -transitive_link -elf -_SYSTYPE_SVR4 -show -mips4 -n32 -L/usr/lib32/mips4/r10000 -L/usr/lib32/mips4 -L/usr/lib32 /usr/lib32/mips4/crt1.o dummy.o -dont_warn_unused -Bdynamic -lc /usr/lib32/mips4/crtn.o -warn_unused") -set(irix64_cc_n32_libs "c") -set(irix64_cc_n32_dirs "/usr/lib32/mips4/r10000;/usr/lib32/mips4;/usr/lib32") -list(APPEND platforms irix64_cc_n32) - -# cc -64 dummy.c -v -set(irix64_cc_64_text "/usr/lib32/cmplrs/ld64 -call_shared -no_unresolved -transitive_link -elf -_SYSTYPE_SVR4 -show -mips4 -64 -L/usr/lib64/mips4/r10000 -L/usr/lib64/mips4 -L/usr/lib64 /usr/lib64/mips4/crt1.o dummy.o -dont_warn_unused -Bdynamic -lc /usr/lib64/mips4/crtn.o -warn_unused") -set(irix64_cc_64_libs "c") -set(irix64_cc_64_dirs "/usr/lib64/mips4/r10000;/usr/lib64/mips4;/usr/lib64") -list(APPEND platforms irix64_cc_64) - -# CC -o32 dummy.cxx -v -set(irix64_CC_o32_text "/usr/lib/ld -elf -cxx -woff 134 -_SYSTYPE_SVR4 -require_dynamic_link _rld_new_interface -no_unresolved -Wx,-G 0 -o32 -mips2 -call_shared -g0 -KPIC -L/usr/lib/ -nocount /usr/lib/crt1.o /usr/lib/c++init.o -count dummy.o -nocount -dont_warn_unused -lC -warn_unused -lc /usr/lib/crtn.o") -set(irix64_CC_o32_libs "C;c") -set(irix64_CC_o32_dirs "/usr/lib") -list(APPEND platforms irix64_CC_o32) - -# CC -n32 dummy.cxx -v -set(irix64_CC_n32_text "/usr/lib32/cmplrs/ld32 -call_shared -init _main -fini _fini -no_unresolved -transitive_link -demangle -elf -_SYSTYPE_SVR4 -LANG:std -show -mips4 -n32 -L/usr/lib32/mips4/r10000 -L/usr/lib32/mips4 -L/usr/lib32 -cxx -woff 134 /usr/lib32/mips4/crt1.o /usr/lib32/c++init.o dummy.o -dont_warn_unused -lCsup -lC -lCio -Bdynamic -lc /usr/lib32/mips4/crtn.o -warn_unused") -set(irix64_CC_n32_libs "Csup;C;Cio;c") -set(irix64_CC_n32_dirs "/usr/lib32/mips4/r10000;/usr/lib32/mips4;/usr/lib32") -list(APPEND platforms irix64_CC_n32) - -# CC -64 dummy.cxx -v -set(irix64_CC_64_text "/usr/lib32/cmplrs/ld64 -call_shared -init _main -fini _fini -no_unresolved -transitive_link -demangle -elf -_SYSTYPE_SVR4 -LANG:std -show -mips4 -64 -L/usr/lib64/mips4/r10000 -L/usr/lib64/mips4 -L/usr/lib64 -cxx -woff 134 /usr/lib64/mips4/crt1.o /usr/lib64/c++init.o dummy.o -dont_warn_unused -lCsup -lC -lCio -Bdynamic -lc /usr/lib64/mips4/crtn.o -warn_unused") -set(irix64_CC_64_libs "Csup;C;Cio;c") -set(irix64_CC_64_dirs "/usr/lib64/mips4/r10000;/usr/lib64/mips4;/usr/lib64") -list(APPEND platforms irix64_CC_64) - -# f77 -o32 dummy.f -v -set(irix64_f77_o32_text "/usr/lib/ld -elf -_SYSTYPE_SVR4 -require_dynamic_link _rld_new_interface -no_unresolved -Wx,-G 0 -o32 -mips2 -call_shared -g0 -KPIC -L/usr/lib/ -nocount /usr/lib/crt1.o -count dummy.o -nocount -lftn -lm -lc /usr/lib/crtn.o") -set(irix64_f77_o32_libs "ftn;m;c") -set(irix64_f77_o32_dirs "/usr/lib") -list(APPEND platforms irix64_f77_o32) - -# f77 -n32 dummy.f -v -set(irix64_f77_n32_text "/usr/lib32/cmplrs/ld32 -call_shared -no_unresolved -transitive_link -elf -_SYSTYPE_SVR4 -show -mips4 -n32 -L/usr/lib32/mips4/r10000 -L/usr/lib32/mips4 -L/usr/lib32 /usr/lib32/mips4/crt1.o dummy.o -dont_warn_unused -lftn -lm -Bdynamic -lc /usr/lib32/mips4/crtn.o -warn_unused") -set(irix64_f77_n32_libs "ftn;m;c") -set(irix64_f77_n32_dirs "/usr/lib32/mips4/r10000;/usr/lib32/mips4;/usr/lib32") -list(APPEND platforms irix64_f77_n32) - -# f77 -64 dummy.f -v -set(irix64_f77_64_text "/usr/lib32/cmplrs/ld64 -call_shared -no_unresolved -transitive_link -elf -_SYSTYPE_SVR4 -show -mips4 -64 -L/usr/lib64/mips4/r10000 -L/usr/lib64/mips4 -L/usr/lib64 /usr/lib64/mips4/crt1.o dummy.o -dont_warn_unused -lftn -lm -Bdynamic -lc /usr/lib64/mips4/crtn.o -warn_unused") -set(irix64_f77_64_libs "ftn;m;c") -set(irix64_f77_64_dirs "/usr/lib64/mips4/r10000;/usr/lib64/mips4;/usr/lib64") -list(APPEND platforms irix64_f77_64) - -# f90 -o32 dummy.f -v -#f90 ERROR: specified abi -o32 not supported. - -# f90 -n32 dummy.f -v -set(irix64_f90_n32_text "/usr/lib32/cmplrs/ld32 -call_shared -no_unresolved -transitive_link -elf -_SYSTYPE_SVR4 -show -mips4 -n32 -L/usr/lib32/mips4/r10000 -L/usr/lib32/mips4 -L/usr/lib32 /usr/lib32/mips4/crt1.o dummy.o -dont_warn_unused -lfortran -lffio -lftn -lm -Bdynamic -lc /usr/lib32/mips4/crtn.o -warn_unused") -set(irix64_f90_n32_libs "fortran;ffio;ftn;m;c") -set(irix64_f90_n32_dirs "/usr/lib32/mips4/r10000;/usr/lib32/mips4;/usr/lib32") -list(APPEND platforms irix64_f90_n32) - -# f90 -64 dummy.f -v -set(irix64_f90_64_text "/usr/lib32/cmplrs/ld64 -call_shared -no_unresolved -transitive_link -elf -_SYSTYPE_SVR4 -show -mips4 -64 -L/usr/lib64/mips4/r10000 -L/usr/lib64/mips4 -L/usr/lib64 /usr/lib64/mips4/crt1.o dummy.o -dont_warn_unused -lfortran -lffio -lftn -lm -Bdynamic -lc /usr/lib64/mips4/crtn.o -warn_unused") -set(irix64_f90_64_libs "fortran;ffio;ftn;m;c") -set(irix64_f90_64_dirs "/usr/lib64/mips4/r10000;/usr/lib64/mips4;/usr/lib64") -list(APPEND platforms irix64_f90_64) - -#----------------------------------------------------------------------------- # Cygwin # gcc dummy.c -v diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt index 67fcc02..811fff3 100644 --- a/Tests/ExportImport/Import/A/CMakeLists.txt +++ b/Tests/ExportImport/Import/A/CMakeLists.txt @@ -332,7 +332,6 @@ if (APPLE OR CMAKE_CXX_COMPILER_ID MATCHES "GNU") else() if (CMAKE_CXX_COMPILER_ID MATCHES "PGI" OR CMAKE_CXX_COMPILER_ID MATCHES "PathScale" - OR CMAKE_SYSTEM_NAME MATCHES "IRIX64" OR CMAKE_CXX_COMPILER_ID MATCHES "Intel") set(run_pic_test 0) else() diff --git a/Tests/SubDirSpaces/CMakeLists.txt b/Tests/SubDirSpaces/CMakeLists.txt index 40c265e..0d45db8 100644 --- a/Tests/SubDirSpaces/CMakeLists.txt +++ b/Tests/SubDirSpaces/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required (VERSION 2.6) project(SUBDIR) # Some systems do not seem to support rpath with spaces. -if(CMAKE_SYSTEM_NAME MATCHES "IRIX|QNX") +if(CMAKE_SYSTEM_NAME MATCHES "QNX") set(CMAKE_SKIP_BUILD_RPATH 1) endif() https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c834c47dfc8006fbdf95a22ea4241b53d7235915 commit c834c47dfc8006fbdf95a22ea4241b53d7235915 Author: jasjuang AuthorDate: Fri Jan 11 09:39:47 2019 -0800 Commit: Brad King CommitDate: Fri Jan 11 12:56:51 2019 -0500 cpplint: only print diagnostics to console if there are errors Fixes: #18781 diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 930ced9..7287594 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -270,9 +270,12 @@ static int HandleCppLint(const std::string& runCmd, << "\n"; return 1; } - std::cerr << "Warning: cpplint diagnostics:\n"; - // Output the output from cpplint to stderr - std::cerr << stdOut; + if (!stdOut.empty()) { + std::cerr << "Warning: cpplint diagnostics:\n"; + // Output the output from cpplint to stderr + std::cerr << stdOut; + } + // always return 0 so the build can continue as cpplint returns non-zero // for any warning return 0; ----------------------------------------------------------------------- Summary of changes: CompileFlags.cmake | 7 --- Modules/CMakeBackwardCompatibilityCXX.cmake | 3 -- Modules/CMakeCompilerABI.h | 8 +-- Modules/CMakeCompilerIdDetection.cmake | 3 -- Modules/CMakeDetermineSystem.cmake | 1 - Modules/CMakeFortranCompilerABI.F | 8 +-- Modules/CMakeFortranCompilerId.F.in | 16 +----- Modules/CMakePlatformId.h.in | 3 -- Modules/Platform/IRIX.cmake | 53 ------------------- Modules/Platform/IRIX64.cmake | 73 -------------------------- Modules/ProcessorCount.cmake | 18 +------ Source/cmComputeLinkInformation.cxx | 2 +- Source/cmcmd.cxx | 9 ++-- Tests/CMakeLists.txt | 1 - Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in | 72 ------------------------- Tests/ExportImport/Import/A/CMakeLists.txt | 1 - Tests/SubDirSpaces/CMakeLists.txt | 2 +- 17 files changed, 13 insertions(+), 267 deletions(-) delete mode 100644 Modules/Platform/IRIX.cmake delete mode 100644 Modules/Platform/IRIX64.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jan 14 10:23:04 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 14 Jan 2019 10:23:04 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-890-g4541c91 Message-ID: <20190114152304.1E3CA1276B2@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 4541c914b587125048c8e82bc3cd687f573f753a (commit) via bfc367054639b9a3de3419c3e66d948f25efc2ec (commit) from 9e03a63ba8b6b01ffbf5c0ee207c8c0bf040f494 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4541c914b587125048c8e82bc3cd687f573f753a commit 4541c914b587125048c8e82bc3cd687f573f753a Merge: 9e03a63 bfc3670 Author: Kyle Edwards AuthorDate: Mon Jan 14 15:15:59 2019 +0000 Commit: Kitware Robot CommitDate: Mon Jan 14 10:16:11 2019 -0500 Merge topic 'xref3' bfc3670546 Help: Provide cross-references from and to set_property Acked-by: Kitware Robot Merge-request: !2785 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bfc367054639b9a3de3419c3e66d948f25efc2ec commit bfc367054639b9a3de3419c3e66d948f25efc2ec Author: Joachim Wuttke (o) AuthorDate: Thu Jan 10 14:01:58 2019 +0100 Commit: Joachim Wuttke (o) CommitDate: Thu Jan 10 16:13:18 2019 +0100 Help: Provide cross-references from and to set_property diff --git a/Help/command/set_directory_properties.rst b/Help/command/set_directory_properties.rst index cc71522..f02a8e6 100644 --- a/Help/command/set_directory_properties.rst +++ b/Help/command/set_directory_properties.rst @@ -9,5 +9,7 @@ Set properties of the current directory and subdirectories. Sets properties of the current directory and its subdirectories in key-value pairs. +See also the :command:`set_property(DIRECTORY)` command. + See :ref:`Directory Properties` for the list of properties known to CMake and their individual documentation for the behavior of each property. diff --git a/Help/command/set_property.rst b/Help/command/set_property.rst index 2d270ec..2624b4b 100644 --- a/Help/command/set_property.rst +++ b/Help/command/set_property.rst @@ -24,17 +24,19 @@ It must be one of the following: Scope is unique and does not accept a name. ``DIRECTORY`` - Scope defaults to the current directory but another - directory (already processed by CMake) may be named by full or - relative path. + Scope defaults to the current directory but another directory + (already processed by CMake) may be named by full or relative path. + See also the :command:`set_directory_properties` command. ``TARGET`` Scope may name zero or more existing targets. + See also the :command:`set_target_properties` command. ``SOURCE`` Scope may name zero or more source files. Note that source file properties are visible only to targets added in the same directory (CMakeLists.txt). + See also the :command:`set_source_files_properties` command. ``INSTALL`` Scope may name zero or more installed file paths. @@ -54,6 +56,7 @@ It must be one of the following: ``TEST`` Scope may name zero or more existing tests. + See also the :command:`set_tests_properties` command. ``CACHE`` Scope must name zero or more cache existing entries. diff --git a/Help/command/set_source_files_properties.rst b/Help/command/set_source_files_properties.rst index 8538a1e..91f995c 100644 --- a/Help/command/set_source_files_properties.rst +++ b/Help/command/set_source_files_properties.rst @@ -10,6 +10,10 @@ Source files can have properties that affect how they are built. [prop2 value2 [...]]) Sets properties associated with source files using a key/value paired -list. See :ref:`Source File Properties` for the list of properties known +list. + +See also the :command:`set_property(SOURCE)` command. + +See :ref:`Source File Properties` for the list of properties known to CMake. Source file properties are visible only to targets added in the same directory (CMakeLists.txt). diff --git a/Help/command/set_tests_properties.rst b/Help/command/set_tests_properties.rst index 55fd635..9bc94ae 100644 --- a/Help/command/set_tests_properties.rst +++ b/Help/command/set_tests_properties.rst @@ -10,5 +10,8 @@ Set a property of the tests. Sets a property for the tests. If the test is not found, CMake will report an error. :manual:`Generator expressions ` will be -expanded the same as supported by the test's :command:`add_test` call. See -:ref:`Test Properties` for the list of properties known to CMake. +expanded the same as supported by the test's :command:`add_test` call. + +See also the :command:`set_property(TEST)` command. + +See :ref:`Test Properties` for the list of properties known to CMake. ----------------------------------------------------------------------- Summary of changes: Help/command/set_directory_properties.rst | 2 ++ Help/command/set_property.rst | 9 ++++++--- Help/command/set_source_files_properties.rst | 6 +++++- Help/command/set_tests_properties.rst | 7 +++++-- 4 files changed, 18 insertions(+), 6 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Tue Jan 15 00:03:04 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 15 Jan 2019 00:03:04 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-891-g2033c1e Message-ID: <20190115050304.92F341267C1@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 2033c1e56fd3d9367fc4eb9a2595c3c592575d54 (commit) from 4541c914b587125048c8e82bc3cd687f573f753a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2033c1e56fd3d9367fc4eb9a2595c3c592575d54 commit 2033c1e56fd3d9367fc4eb9a2595c3c592575d54 Author: Kitware Robot AuthorDate: Tue Jan 15 00:01:05 2019 -0500 Commit: Kitware Robot CommitDate: Tue Jan 15 00:01:05 2019 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 4a4f63f..7ae4417 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 13) -set(CMake_VERSION_PATCH 20190114) +set(CMake_VERSION_PATCH 20190115) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Tue Jan 15 09:53:07 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 15 Jan 2019 09:53:07 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-893-gc07fa6d Message-ID: <20190115145307.B58621264FE@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via c07fa6d98c3ca2bc645c23c4a437d48d57d3eb8d (commit) via 427ebecdf5336b9915179464586d929850a95101 (commit) from 2033c1e56fd3d9367fc4eb9a2595c3c592575d54 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c07fa6d98c3ca2bc645c23c4a437d48d57d3eb8d commit c07fa6d98c3ca2bc645c23c4a437d48d57d3eb8d Merge: 2033c1e 427ebec Author: Kyle Edwards AuthorDate: Tue Jan 15 14:49:27 2019 +0000 Commit: Kitware Robot CommitDate: Tue Jan 15 09:49:35 2019 -0500 Merge topic 'find_package-doc-clarification' 427ebecdf5 Help/find_package: clarify intended behavior with REQUIRED QUIET Acked-by: Kitware Robot Merge-request: !2777 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=427ebecdf5336b9915179464586d929850a95101 commit 427ebecdf5336b9915179464586d929850a95101 Author: Ben Boeckel AuthorDate: Wed Jan 9 11:19:50 2019 -0500 Commit: Ben Boeckel CommitDate: Mon Jan 14 10:42:10 2019 -0500 Help/find_package: clarify intended behavior with REQUIRED QUIET See #18773 diff --git a/Help/command/find_package.rst b/Help/command/find_package.rst index 937a930..cafef8c 100644 --- a/Help/command/find_package.rst +++ b/Help/command/find_package.rst @@ -23,9 +23,9 @@ Finds and loads settings from an external project. ``_FOUND`` will be set to indicate whether the package was found. When the package is found package-specific information is provided through variables and :ref:`Imported Targets` documented by the package itself. The -``QUIET`` option disables messages if the package cannot be found. The -``REQUIRED`` option stops processing with an error message if the package -cannot be found. +``QUIET`` option disables informational messages, including those indicating +that the package cannot be found if it is not ``REQUIRED``. The ``REQUIRED`` +option stops processing with an error message if the package cannot be found. A package-specific list of required components may be listed after the ``COMPONENTS`` option (or after the ``REQUIRED`` option if present). ----------------------------------------------------------------------- Summary of changes: Help/command/find_package.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Tue Jan 15 10:13:05 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 15 Jan 2019 10:13:05 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-898-gf3b7652 Message-ID: <20190115151305.3D653125D5E@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via f3b7652efcdd9a2e248ed2ec83ce7fc10944f194 (commit) via 9e4b6bcbe8f4d3bf495650309b94b045a3c3d7fe (commit) via 613323a78bf33e22f510e41c8733fe2bc8df606a (commit) via bf2503089b19d1462be7838ed7364361481587d4 (commit) via ee555c2a33258a7b272f049aca369edf4d86fa7c (commit) from c07fa6d98c3ca2bc645c23c4a437d48d57d3eb8d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f3b7652efcdd9a2e248ed2ec83ce7fc10944f194 commit f3b7652efcdd9a2e248ed2ec83ce7fc10944f194 Merge: c07fa6d 9e4b6bc Author: Kyle Edwards AuthorDate: Tue Jan 15 15:06:50 2019 +0000 Commit: Kitware Robot CommitDate: Tue Jan 15 10:07:02 2019 -0500 Merge topic 'clang-scan-build-warnings' 9e4b6bcbe8 Source/LexerParser: Suppress "Use of zero-allocated memory" warning 613323a78b cmGlobalUnixMakefileGenerator3: Fix memory leak warning bf2503089b liblzma: fix undefined shift result ee555c2a33 libuv: fix clang scan-build warning Acked-by: Kitware Robot Merge-request: !2796 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9e4b6bcbe8f4d3bf495650309b94b045a3c3d7fe commit 9e4b6bcbe8f4d3bf495650309b94b045a3c3d7fe Author: Kyle Edwards AuthorDate: Fri Jan 11 18:30:13 2019 -0500 Commit: Kyle Edwards CommitDate: Mon Jan 14 10:31:38 2019 -0500 Source/LexerParser: Suppress "Use of zero-allocated memory" warning clang scan-build warns about YY_CURRENT_BUFFER_LVALUE being zero- allocated, but the whole point of the macro is to know that it's not zero. Wrap the entire file in an "#ifndef __clang_analyzer__" block in order to suppress the warning. diff --git a/Source/LexerParser/cmCommandArgumentLexer.cxx b/Source/LexerParser/cmCommandArgumentLexer.cxx index 6b4fc85..c96f8b3 100644 --- a/Source/LexerParser/cmCommandArgumentLexer.cxx +++ b/Source/LexerParser/cmCommandArgumentLexer.cxx @@ -664,6 +664,8 @@ Modify cmCommandArgumentLexer.cxx: /* IWYU pragma: no_forward_declare yyguts_t */ +#ifndef __clang_analyzer__ /* Suppress clang scan-build warnings */ + #include "cmCommandArgumentParserHelper.h" /* Replace the lexer input function. */ @@ -2246,3 +2248,5 @@ void cmCommandArgument_SetupEscapes(yyscan_t yyscanner, bool noEscapes) BEGIN(ESCAPES); } } + +#endif /* __clang_analyzer__ */ diff --git a/Source/LexerParser/cmCommandArgumentLexer.in.l b/Source/LexerParser/cmCommandArgumentLexer.in.l index 5927b9e..79275dd 100644 --- a/Source/LexerParser/cmCommandArgumentLexer.in.l +++ b/Source/LexerParser/cmCommandArgumentLexer.in.l @@ -18,6 +18,8 @@ Modify cmCommandArgumentLexer.cxx: /* IWYU pragma: no_forward_declare yyguts_t */ +#ifndef __clang_analyzer__ /* Suppress clang scan-build warnings */ + #include "cmCommandArgumentParserHelper.h" /* Replace the lexer input function. */ @@ -145,3 +147,5 @@ void cmCommandArgument_SetupEscapes(yyscan_t yyscanner, bool noEscapes) BEGIN(ESCAPES); } } + +#endif /* __clang_analyzer__ */ diff --git a/Source/LexerParser/cmDependsJavaLexer.cxx b/Source/LexerParser/cmDependsJavaLexer.cxx index 36cac61..ed6eea9 100644 --- a/Source/LexerParser/cmDependsJavaLexer.cxx +++ b/Source/LexerParser/cmDependsJavaLexer.cxx @@ -860,6 +860,8 @@ Modify cmDependsJavaLexer.cxx: /* IWYU pragma: no_forward_declare yyguts_t */ +#ifndef __clang_analyzer__ /* Suppress clang scan-build warnings */ + #include #include "cmDependsJavaParserHelper.h" @@ -2811,3 +2813,7 @@ void yyfree (void * ptr , yyscan_t yyscanner) } #define YYTABLES_NAME "yytables" + +/*--------------------------------------------------------------------------*/ + +#endif /* __clang_analyzer__ */ diff --git a/Source/LexerParser/cmDependsJavaLexer.in.l b/Source/LexerParser/cmDependsJavaLexer.in.l index 01a0fa3..b48d1bd 100644 --- a/Source/LexerParser/cmDependsJavaLexer.in.l +++ b/Source/LexerParser/cmDependsJavaLexer.in.l @@ -18,6 +18,8 @@ Modify cmDependsJavaLexer.cxx: /* IWYU pragma: no_forward_declare yyguts_t */ +#ifndef __clang_analyzer__ /* Suppress clang scan-build warnings */ + #include #include "cmDependsJavaParserHelper.h" @@ -173,3 +175,7 @@ null { PRIMITIVE; return jp_NULLLITERAL; } } %% + +/*--------------------------------------------------------------------------*/ + +#endif /* __clang_analyzer__ */ diff --git a/Source/LexerParser/cmExprLexer.cxx b/Source/LexerParser/cmExprLexer.cxx index cb24687..fd0f745 100644 --- a/Source/LexerParser/cmExprLexer.cxx +++ b/Source/LexerParser/cmExprLexer.cxx @@ -664,6 +664,8 @@ Modify cmExprLexer.cxx: /* IWYU pragma: no_forward_declare yyguts_t */ +#ifndef __clang_analyzer__ /* Suppress clang scan-build warnings */ + #include "cmExprParserHelper.h" /* Replace the lexer input function. */ @@ -2223,3 +2225,7 @@ void yyfree (void * ptr , yyscan_t yyscanner) } #define YYTABLES_NAME "yytables" + +/*--------------------------------------------------------------------------*/ + +#endif /* __clang_analyzer__ */ diff --git a/Source/LexerParser/cmExprLexer.in.l b/Source/LexerParser/cmExprLexer.in.l index 2197c2a..89d1381 100644 --- a/Source/LexerParser/cmExprLexer.in.l +++ b/Source/LexerParser/cmExprLexer.in.l @@ -18,6 +18,8 @@ Modify cmExprLexer.cxx: /* IWYU pragma: no_forward_declare yyguts_t */ +#ifndef __clang_analyzer__ /* Suppress clang scan-build warnings */ + #include "cmExprParserHelper.h" /* Replace the lexer input function. */ @@ -61,3 +63,7 @@ Modify cmExprLexer.cxx: . { yyextra->UnexpectedChar(yytext[0]); } %% + +/*--------------------------------------------------------------------------*/ + +#endif /* __clang_analyzer__ */ diff --git a/Source/LexerParser/cmFortranLexer.cxx b/Source/LexerParser/cmFortranLexer.cxx index 82048df..f12df29 100644 --- a/Source/LexerParser/cmFortranLexer.cxx +++ b/Source/LexerParser/cmFortranLexer.cxx @@ -838,6 +838,8 @@ Modify cmFortranLexer.cxx: /* IWYU pragma: no_forward_declare yyguts_t */ +#ifndef __clang_analyzer__ /* Suppress clang scan-build warnings */ + #undef YY_NO_UNPUT #define cmFortranLexer_cxx @@ -2610,3 +2612,5 @@ YY_BUFFER_STATE cmFortranLexer_GetCurrentBuffer(yyscan_t yyscanner) struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return YY_CURRENT_BUFFER; } + +#endif /* __clang_analyzer__ */ diff --git a/Source/LexerParser/cmFortranLexer.in.l b/Source/LexerParser/cmFortranLexer.in.l index b7e837b..f752f37 100644 --- a/Source/LexerParser/cmFortranLexer.in.l +++ b/Source/LexerParser/cmFortranLexer.in.l @@ -27,6 +27,8 @@ Modify cmFortranLexer.cxx: /* IWYU pragma: no_forward_declare yyguts_t */ +#ifndef __clang_analyzer__ /* Suppress clang scan-build warnings */ + #undef YY_NO_UNPUT #define cmFortranLexer_cxx @@ -183,3 +185,5 @@ YY_BUFFER_STATE cmFortranLexer_GetCurrentBuffer(yyscan_t yyscanner) struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return YY_CURRENT_BUFFER; } + +#endif /* __clang_analyzer__ */ https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=613323a78bf33e22f510e41c8733fe2bc8df606a commit 613323a78bf33e22f510e41c8733fe2bc8df606a Author: Kyle Edwards AuthorDate: Fri Jan 11 16:31:52 2019 -0500 Commit: Kyle Edwards CommitDate: Mon Jan 14 09:53:12 2019 -0500 cmGlobalUnixMakefileGenerator3: Fix memory leak warning this->Makefiles.empty() is called twice, leading clang scan-build to falsely believe that the delete statement was causing a memory leak. Fix this by using a unique_ptr to hold the temporary cmMakefile. This also has the benefit of making the code exception-safe. diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index db72353..ceee500 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -7,6 +7,7 @@ #include #include +#include "cmAlgorithms.h" #include "cmDocumentationEntry.h" #include "cmGeneratedFileStream.h" #include "cmGeneratorTarget.h" @@ -494,6 +495,7 @@ void cmGlobalUnixMakefileGenerator3::GenerateBuildCommand( const std::string& targetName, const std::string& /*config*/, bool fast, int jobs, bool /*verbose*/, std::vector const& makeOptions) { + std::unique_ptr mfu; cmMakefile* mf; if (!this->Makefiles.empty()) { mf = this->Makefiles[0]; @@ -504,7 +506,8 @@ void cmGlobalUnixMakefileGenerator3::GenerateBuildCommand( snapshot.GetDirectory().SetCurrentBinary( this->CMakeInstance->GetHomeOutputDirectory()); snapshot.SetDefaultDefinitions(); - mf = new cmMakefile(this, snapshot); + mfu = cm::make_unique(this, snapshot); + mf = mfu.get(); } makeCommand.push_back(this->SelectMakeProgram(makeProgram)); @@ -529,9 +532,6 @@ void cmGlobalUnixMakefileGenerator3::GenerateBuildCommand( cmSystemTools::ConvertToOutputSlashes(tname); makeCommand.push_back(std::move(tname)); } - if (this->Makefiles.empty()) { - delete mf; - } } void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules( https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bf2503089b19d1462be7838ed7364361481587d4 commit bf2503089b19d1462be7838ed7364361481587d4 Author: Kyle Edwards AuthorDate: Fri Jan 11 16:22:37 2019 -0500 Commit: Kyle Edwards CommitDate: Mon Jan 14 09:53:12 2019 -0500 liblzma: fix undefined shift result When a 32-bit integer is shifted left by 32 bits, the result is undefined. Shift a 64-bit integer instead. diff --git a/Utilities/cmliblzma/liblzma/simple/x86.c b/Utilities/cmliblzma/liblzma/simple/x86.c index 23d0c42..b38cebf 100644 --- a/Utilities/cmliblzma/liblzma/simple/x86.c +++ b/Utilities/cmliblzma/liblzma/simple/x86.c @@ -97,7 +97,7 @@ x86_code(void *simple_ptr, uint32_t now_pos, bool is_encoder, if (!Test86MSByte(b)) break; - src = dest ^ ((1u << (32 - i * 8)) - 1); + src = dest ^ ((1ull << (32 - i * 8)) - 1); } buffer[buffer_pos + 4] https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ee555c2a33258a7b272f049aca369edf4d86fa7c commit ee555c2a33258a7b272f049aca369edf4d86fa7c Author: Kyle Edwards AuthorDate: Fri Jan 11 16:04:26 2019 -0500 Commit: Kyle Edwards CommitDate: Mon Jan 14 09:53:12 2019 -0500 libuv: fix clang scan-build warning diff --git a/Utilities/cmlibuv/src/unix/process.c b/Utilities/cmlibuv/src/unix/process.c index 1bded8d..f2a5065 100644 --- a/Utilities/cmlibuv/src/unix/process.c +++ b/Utilities/cmlibuv/src/unix/process.c @@ -334,7 +334,7 @@ static void uv__process_child_init(const uv_process_options_t* options, use_fd = open("/dev/null", fd == 0 ? O_RDONLY : O_RDWR); close_fd = use_fd; - if (use_fd == -1) { + if (use_fd < 0) { uv__write_int(error_fd, UV__ERR(errno)); _exit(127); } ----------------------------------------------------------------------- Summary of changes: Source/LexerParser/cmCommandArgumentLexer.cxx | 4 ++++ Source/LexerParser/cmCommandArgumentLexer.in.l | 4 ++++ Source/LexerParser/cmDependsJavaLexer.cxx | 6 ++++++ Source/LexerParser/cmDependsJavaLexer.in.l | 6 ++++++ Source/LexerParser/cmExprLexer.cxx | 6 ++++++ Source/LexerParser/cmExprLexer.in.l | 6 ++++++ Source/LexerParser/cmFortranLexer.cxx | 4 ++++ Source/LexerParser/cmFortranLexer.in.l | 4 ++++ Source/cmGlobalUnixMakefileGenerator3.cxx | 8 ++++---- Utilities/cmliblzma/liblzma/simple/x86.c | 2 +- Utilities/cmlibuv/src/unix/process.c | 2 +- 11 files changed, 46 insertions(+), 6 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Tue Jan 15 11:43:06 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 15 Jan 2019 11:43:06 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-900-gd4a42dd Message-ID: <20190115164306.E4EB4113791@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via d4a42dd4a87c9caa222a7a40150db937258698d2 (commit) via cd0881be61149346649f3aef9b69d58bd7a2549a (commit) from f3b7652efcdd9a2e248ed2ec83ce7fc10944f194 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d4a42dd4a87c9caa222a7a40150db937258698d2 commit d4a42dd4a87c9caa222a7a40150db937258698d2 Merge: f3b7652 cd0881b Author: Brad King AuthorDate: Tue Jan 15 16:38:10 2019 +0000 Commit: Kitware Robot CommitDate: Tue Jan 15 11:38:24 2019 -0500 Merge topic 'iwyu-clang-6' cd0881be61 IWYU: Update CMake code for IWYU built with Clang 6 Acked-by: Kitware Robot Merge-request: !2810 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cd0881be61149346649f3aef9b69d58bd7a2549a commit cd0881be61149346649f3aef9b69d58bd7a2549a Author: Brad King AuthorDate: Tue Jan 15 09:59:46 2019 -0500 Commit: Brad King CommitDate: Tue Jan 15 10:00:50 2019 -0500 IWYU: Update CMake code for IWYU built with Clang 6 IWYU now correctly requires `` for `std::move`. It also requires a container header when used via a range-based for loop. diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index ee1070f..b43f1c9 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -10,6 +10,7 @@ #include "cmWorkingDirectory.h" #include +#include #include #include #include diff --git a/Source/CPack/cmCPackExternalGenerator.cxx b/Source/CPack/cmCPackExternalGenerator.cxx index 9f7b236..ff69418 100644 --- a/Source/CPack/cmCPackExternalGenerator.cxx +++ b/Source/CPack/cmCPackExternalGenerator.cxx @@ -13,6 +13,7 @@ #include "cmsys/FStream.hxx" +#include #include #include diff --git a/Source/CPack/cmCPackSTGZGenerator.cxx b/Source/CPack/cmCPackSTGZGenerator.cxx index ef0d118..e55ea87 100644 --- a/Source/CPack/cmCPackSTGZGenerator.cxx +++ b/Source/CPack/cmCPackSTGZGenerator.cxx @@ -6,6 +6,7 @@ #include #include #include +#include #include "cmCPackGenerator.h" #include "cmCPackLog.h" diff --git a/Source/CTest/cmParseMumpsCoverage.cxx b/Source/CTest/cmParseMumpsCoverage.cxx index 18412ba..488d237 100644 --- a/Source/CTest/cmParseMumpsCoverage.cxx +++ b/Source/CTest/cmParseMumpsCoverage.cxx @@ -9,6 +9,7 @@ #include #include #include +#include cmParseMumpsCoverage::cmParseMumpsCoverage( cmCTestCoverageHandlerContainer& cont, cmCTest* ctest) diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx index c4cf046..7737f65 100644 --- a/Source/CTest/cmProcess.cxx +++ b/Source/CTest/cmProcess.cxx @@ -7,7 +7,6 @@ #include "cmCTestTestHandler.h" #include "cmsys/Process.h" -#include #include #include #include @@ -15,6 +14,7 @@ #if !defined(_WIN32) # include #endif +#include #define CM_PROCESS_BUF_SIZE 65536 diff --git a/Source/cmAuxSourceDirectoryCommand.cxx b/Source/cmAuxSourceDirectoryCommand.cxx index 1f9f580..106e7a7 100644 --- a/Source/cmAuxSourceDirectoryCommand.cxx +++ b/Source/cmAuxSourceDirectoryCommand.cxx @@ -5,6 +5,7 @@ #include "cmsys/Directory.hxx" #include #include +#include #include "cmAlgorithms.h" #include "cmMakefile.h" diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index 93115b6..3821144 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -4,6 +4,7 @@ #include "cmAlgorithms.h" #include "cmExportSet.h" +#include "cmExportSetMap.h" #include "cmGeneratedFileStream.h" #include "cmGeneratorExpression.h" #include "cmGeneratorTarget.h" @@ -21,8 +22,6 @@ #include #include -class cmExportSetMap; - cmExportInstallFileGenerator::cmExportInstallFileGenerator( cmInstallExportGenerator* iegen) : IEGen(iegen) diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index e7f3ada..84fcb95 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -5,6 +5,7 @@ #include "cmsys/RegularExpression.hxx" #include #include +#include #include #include #include diff --git a/Source/cmFileAPICMakeFiles.cxx b/Source/cmFileAPICMakeFiles.cxx index 799a047..5590bc2 100644 --- a/Source/cmFileAPICMakeFiles.cxx +++ b/Source/cmFileAPICMakeFiles.cxx @@ -12,6 +12,7 @@ #include "cm_jsoncpp_value.h" #include +#include namespace { diff --git a/Source/cmFileAPICache.cxx b/Source/cmFileAPICache.cxx index 074994a..f96bc90 100644 --- a/Source/cmFileAPICache.cxx +++ b/Source/cmFileAPICache.cxx @@ -10,6 +10,7 @@ #include #include +#include #include namespace { diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index fc9c1d2..475eee4 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -17,6 +17,7 @@ #include #include #include +#include #include #include "cmAlgorithms.h" diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index 5a5d036..bcf876d 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -7,6 +7,7 @@ #include #include #include +#include #include "cmGlobalGenerator.h" #include "cmMakefile.h" diff --git a/Source/cmIncludeDirectoryCommand.cxx b/Source/cmIncludeDirectoryCommand.cxx index caec67d..549a263 100644 --- a/Source/cmIncludeDirectoryCommand.cxx +++ b/Source/cmIncludeDirectoryCommand.cxx @@ -4,6 +4,7 @@ #include #include +#include #include "cmGeneratorExpression.h" #include "cmMakefile.h" diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx index d441e41..4cc081c 100644 --- a/Source/cmInstallExportGenerator.cxx +++ b/Source/cmInstallExportGenerator.cxx @@ -3,6 +3,7 @@ #include "cmInstallExportGenerator.h" #include +#include #include #include diff --git a/Source/cmJsonObjects.cxx b/Source/cmJsonObjects.cxx index 0da6f4f..bb56714 100644 --- a/Source/cmJsonObjects.cxx +++ b/Source/cmJsonObjects.cxx @@ -14,6 +14,7 @@ #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmProperty.h" +#include "cmPropertyMap.h" #include "cmSourceFile.h" #include "cmState.h" #include "cmStateDirectory.h" diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index 9b63d24..3644da1 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -12,6 +12,7 @@ #include #include #include // required for atoi +#include #include "cmAlgorithms.h" #include "cmGeneratorExpression.h" diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index 846b12c..92eeb2e 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -6,6 +6,7 @@ #include // IWYU pragma: keep #include #include +#include #include #include "cmGeneratedFileStream.h" diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 2d2915c..0c2d7b3 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -6,6 +6,7 @@ #include // IWYU pragma: keep #include #include +#include #include #include "cmGeneratedFileStream.h" diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 324afbf..b62da66 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -9,6 +9,7 @@ #include // IWYU pragma: keep #include #include +#include #include "cmAlgorithms.h" #include "cmCustomCommandGenerator.h" diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 228c9fb..1ef12d0 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -10,6 +10,7 @@ #include #include // IWYU pragma: keep #include +#include #include "cmAlgorithms.h" #include "cmComputeLinkInformation.h" diff --git a/Source/cmPipeConnection.cxx b/Source/cmPipeConnection.cxx index 3dab2f0..999d6f3 100644 --- a/Source/cmPipeConnection.cxx +++ b/Source/cmPipeConnection.cxx @@ -2,7 +2,7 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmPipeConnection.h" -#include +#include #include "cmServer.h" diff --git a/Source/cmQtAutoGen.cxx b/Source/cmQtAutoGen.cxx index 000529d..2786646 100644 --- a/Source/cmQtAutoGen.cxx +++ b/Source/cmQtAutoGen.cxx @@ -9,6 +9,7 @@ #include #include #include +#include // - Static variables diff --git a/Source/cmQtAutoGenerator.cxx b/Source/cmQtAutoGenerator.cxx index 734b2d7..f2f4cad 100644 --- a/Source/cmQtAutoGenerator.cxx +++ b/Source/cmQtAutoGenerator.cxx @@ -14,6 +14,7 @@ #include "cmake.h" #include +#include // -- Class methods diff --git a/Source/cmQtAutoGeneratorMocUic.cxx b/Source/cmQtAutoGeneratorMocUic.cxx index e6ee85b..9658e97 100644 --- a/Source/cmQtAutoGeneratorMocUic.cxx +++ b/Source/cmQtAutoGeneratorMocUic.cxx @@ -1,19 +1,21 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmQtAutoGeneratorMocUic.h" -#include "cmQtAutoGen.h" #include #include +#include #include #include #include +#include #include #include #include "cmAlgorithms.h" #include "cmCryptoHash.h" #include "cmMakefile.h" +#include "cmQtAutoGen.h" #include "cmSystemTools.h" #include "cmake.h" diff --git a/Source/cmQtAutoGeneratorMocUic.h b/Source/cmQtAutoGeneratorMocUic.h index edf597c..9ec1def 100644 --- a/Source/cmQtAutoGeneratorMocUic.h +++ b/Source/cmQtAutoGeneratorMocUic.h @@ -11,7 +11,6 @@ #include "cm_uv.h" #include "cmsys/RegularExpression.hxx" -#include #include #include #include @@ -21,6 +20,7 @@ #include #include #include +#include #include class cmMakefile; diff --git a/Source/cmServerConnection.cxx b/Source/cmServerConnection.cxx index 1fc8cf8..5caa019 100644 --- a/Source/cmServerConnection.cxx +++ b/Source/cmServerConnection.cxx @@ -7,13 +7,13 @@ #include "cmServerDictionary.h" #include "cm_uv.h" -#include #ifdef _WIN32 # include "io.h" #else # include #endif #include +#include cmStdIoConnection::cmStdIoConnection( cmConnectionBufferStrategy* bufferStrategy) diff --git a/Source/cmString.hxx b/Source/cmString.hxx index e5ece52..49bad78 100644 --- a/Source/cmString.hxx +++ b/Source/cmString.hxx @@ -15,6 +15,7 @@ #include #include #include +#include namespace cm { diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx index e4ced6e..1e2ddc7 100644 --- a/Source/cmTestGenerator.cxx +++ b/Source/cmTestGenerator.cxx @@ -11,12 +11,11 @@ #include "cmLocalGenerator.h" #include "cmOutputConverter.h" #include "cmProperty.h" +#include "cmPropertyMap.h" #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmTest.h" -class cmPropertyMap; - cmTestGenerator::cmTestGenerator( cmTest* test, std::vector const& configurations) : cmScriptGenerator("CTEST_CONFIGURATION_TYPE", configurations) diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 7287594..24e3dc8 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -44,6 +44,7 @@ #include #include #include +#include class cmConnection; diff --git a/Tests/CMakeLib/testUVRAII.cxx b/Tests/CMakeLib/testUVRAII.cxx index e165ff7..1c1da76 100644 --- a/Tests/CMakeLib/testUVRAII.cxx +++ b/Tests/CMakeLib/testUVRAII.cxx @@ -1,9 +1,9 @@ #include "cmUVHandlePtr.h" -#include #include #include #include +#include #include "cm_uv.h" diff --git a/Utilities/IWYU/mapping.imp b/Utilities/IWYU/mapping.imp index c5231bb..aee8a69 100644 --- a/Utilities/IWYU/mapping.imp +++ b/Utilities/IWYU/mapping.imp @@ -55,6 +55,9 @@ # HACK: iwyu wrongly thinks that is needed for std::hash { symbol: [ "std::hash", private, "", public ] }, + # HACK: iwyu thinks we use a libstdc++ private type + { symbol: [ "__gnu_cxx::size_t", private, "", public ] }, + # __decay_and_strip is used internally in the C++11 standard library. # IWYU does not classify it as internal and suggests to add . # To ignore it, we simply map it to a file that is included anyway. ----------------------------------------------------------------------- Summary of changes: Source/CPack/cmCPackArchiveGenerator.cxx | 1 + Source/CPack/cmCPackExternalGenerator.cxx | 1 + Source/CPack/cmCPackSTGZGenerator.cxx | 1 + Source/CTest/cmParseMumpsCoverage.cxx | 1 + Source/CTest/cmProcess.cxx | 2 +- Source/cmAuxSourceDirectoryCommand.cxx | 1 + Source/cmExportInstallFileGenerator.cxx | 3 +-- Source/cmExtraEclipseCDT4Generator.cxx | 1 + Source/cmFileAPICMakeFiles.cxx | 1 + Source/cmFileAPICache.cxx | 1 + Source/cmFileCommand.cxx | 1 + Source/cmFindLibraryCommand.cxx | 1 + Source/cmIncludeDirectoryCommand.cxx | 1 + Source/cmInstallExportGenerator.cxx | 1 + Source/cmJsonObjects.cxx | 1 + Source/cmListCommand.cxx | 1 + Source/cmMakefileExecutableTargetGenerator.cxx | 1 + Source/cmMakefileLibraryTargetGenerator.cxx | 1 + Source/cmNinjaNormalTargetGenerator.cxx | 1 + Source/cmNinjaTargetGenerator.cxx | 1 + Source/cmPipeConnection.cxx | 2 +- Source/cmQtAutoGen.cxx | 1 + Source/cmQtAutoGenerator.cxx | 1 + Source/cmQtAutoGeneratorMocUic.cxx | 4 +++- Source/cmQtAutoGeneratorMocUic.h | 2 +- Source/cmServerConnection.cxx | 2 +- Source/cmString.hxx | 1 + Source/cmTestGenerator.cxx | 3 +-- Source/cmcmd.cxx | 1 + Tests/CMakeLib/testUVRAII.cxx | 2 +- Utilities/IWYU/mapping.imp | 3 +++ 31 files changed, 35 insertions(+), 10 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Tue Jan 15 13:13:05 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 15 Jan 2019 13:13:05 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-907-gb2084a3 Message-ID: <20190115181305.C9AE3FBDFF@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via b2084a330d73f92b7d55d22921b2e2d9e1d462cc (commit) via 5d3b8eed4bf7d4b4b2534861aa96f517479596af (commit) via f7f15a77ea81eb51d5544859189563c708e487a7 (commit) via 97d21092944354cce5de9a68a7d9bc637cda085d (commit) via 0d887397367b4b8c01a584e8e1a4b3192ca7af18 (commit) via a4841e12c0e3865a585774b118e7b9840bc1b253 (commit) via 6845e2559d66be8d2c67d936ca597ade05b4ebbc (commit) from d4a42dd4a87c9caa222a7a40150db937258698d2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b2084a330d73f92b7d55d22921b2e2d9e1d462cc commit b2084a330d73f92b7d55d22921b2e2d9e1d462cc Merge: 5d3b8ee 6845e25 Author: Brad King AuthorDate: Tue Jan 15 18:11:23 2019 +0000 Commit: Kitware Robot CommitDate: Tue Jan 15 13:12:08 2019 -0500 Merge topic 'deprecate-policy-old' 6845e2559d Add deprecation warnings for policies CMP0065 and below Acked-by: Kitware Robot Merge-request: !2793 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5d3b8eed4bf7d4b4b2534861aa96f517479596af commit 5d3b8eed4bf7d4b4b2534861aa96f517479596af Merge: f7f15a7 0d88739 Author: Brad King AuthorDate: Tue Jan 15 18:10:12 2019 +0000 Commit: Kitware Robot CommitDate: Tue Jan 15 13:11:08 2019 -0500 Merge topic 'update-kwsys' 0d88739736 Merge branch 'upstream-KWSys' into update-kwsys a4841e12c0 KWSys 2019-01-14 (1541d849) Acked-by: Kitware Robot Merge-request: !2801 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f7f15a77ea81eb51d5544859189563c708e487a7 commit f7f15a77ea81eb51d5544859189563c708e487a7 Merge: d4a42dd 97d2109 Author: Brad King AuthorDate: Tue Jan 15 18:10:02 2019 +0000 Commit: Kitware Robot CommitDate: Tue Jan 15 13:10:08 2019 -0500 Merge topic 'FindBoost-test-env' 97d2109294 Tests: Make RunCMake.FindBoost robust to Boost_ROOT in environment Acked-by: Kitware Robot Merge-request: !2802 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=97d21092944354cce5de9a68a7d9bc637cda085d commit 97d21092944354cce5de9a68a7d9bc637cda085d Author: Brad King AuthorDate: Mon Jan 14 07:44:32 2019 -0500 Commit: Brad King CommitDate: Mon Jan 14 07:44:32 2019 -0500 Tests: Make RunCMake.FindBoost robust to Boost_ROOT in environment Remove the environment variable within the test to avoid CMP0074 behavior. diff --git a/Tests/RunCMake/FindBoost/RunCMakeTest.cmake b/Tests/RunCMake/FindBoost/RunCMakeTest.cmake index 5d0577b..eef350c 100644 --- a/Tests/RunCMake/FindBoost/RunCMakeTest.cmake +++ b/Tests/RunCMake/FindBoost/RunCMakeTest.cmake @@ -1,4 +1,5 @@ include(RunCMake) +unset(ENV{Boost_ROOT}) run_cmake(CMakePackage) run_cmake(NoCXX) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0d887397367b4b8c01a584e8e1a4b3192ca7af18 commit 0d887397367b4b8c01a584e8e1a4b3192ca7af18 Merge: 848dc85 a4841e1 Author: Brad King AuthorDate: Mon Jan 14 07:38:40 2019 -0500 Commit: Brad King CommitDate: Mon Jan 14 07:38:40 2019 -0500 Merge branch 'upstream-KWSys' into update-kwsys * upstream-KWSys: KWSys 2019-01-14 (1541d849) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a4841e12c0e3865a585774b118e7b9840bc1b253 commit a4841e12c0e3865a585774b118e7b9840bc1b253 Author: KWSys Upstream AuthorDate: Mon Jan 14 07:36:32 2019 -0500 Commit: Brad King CommitDate: Mon Jan 14 07:38:39 2019 -0500 KWSys 2019-01-14 (1541d849) Code extracted from: https://gitlab.kitware.com/utils/kwsys.git at commit 1541d8496d0ae0e7c10eabcedb55db95f72afa4a (master). Upstream Shortlog ----------------- Sean McBride (1): f44cbf93 Fixed clang -Wextra-semi-stmt warnings diff --git a/ProcessUNIX.c b/ProcessUNIX.c index 094c2ee..f65690b 100644 --- a/ProcessUNIX.c +++ b/ProcessUNIX.c @@ -1162,7 +1162,7 @@ static int kwsysProcessWaitForPipe(kwsysProcess* cp, char** data, int* length, case KWSYSPE_PIPE_STDERR: wd->PipeId = kwsysProcess_Pipe_STDERR; break; - }; + } return 1; } } else if (n < 0 && errno == EAGAIN) { diff --git a/testCommandLineArguments.cxx b/testCommandLineArguments.cxx index ef87436..15f9c02 100644 --- a/testCommandLineArguments.cxx +++ b/testCommandLineArguments.cxx @@ -165,25 +165,26 @@ int testCommandLineArguments(int argc, char* argv[]) } size_t cc; #define CompareTwoLists(list1, list_valid, lsize) \ - if (list1.size() != lsize) { \ - std::cerr << "Problem setting " #list1 ". Size is: " << list1.size() \ - << " should be: " << lsize << std::endl; \ - res = 1; \ - } else { \ - std::cout << #list1 " argument set:"; \ - for (cc = 0; cc < lsize; ++cc) { \ - std::cout << " " << list1[cc]; \ - if (!CompareTwoItemsOnList(list1[cc], list_valid[cc])) { \ - std::cerr << "Problem setting " #list1 ". Value of " << cc \ - << " is: [" << list1[cc] << "] <> [" << list_valid[cc] \ - << "]" << std::endl; \ - res = 1; \ - break; \ + do { \ + if (list1.size() != lsize) { \ + std::cerr << "Problem setting " #list1 ". Size is: " << list1.size() \ + << " should be: " << lsize << std::endl; \ + res = 1; \ + } else { \ + std::cout << #list1 " argument set:"; \ + for (cc = 0; cc < lsize; ++cc) { \ + std::cout << " " << list1[cc]; \ + if (!CompareTwoItemsOnList(list1[cc], list_valid[cc])) { \ + std::cerr << "Problem setting " #list1 ". Value of " << cc \ + << " is: [" << list1[cc] << "] <> [" << list_valid[cc] \ + << "]" << std::endl; \ + res = 1; \ + break; \ + } \ } \ + std::cout << std::endl; \ } \ - std::cout << std::endl; \ - } - + } while (0) CompareTwoLists(numbers_argument, valid_numbers, 10); CompareTwoLists(doubles_argument, valid_doubles, 3); CompareTwoLists(bools_argument, valid_bools, 3); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6845e2559d66be8d2c67d936ca597ade05b4ebbc commit 6845e2559d66be8d2c67d936ca597ade05b4ebbc Author: Brad King AuthorDate: Fri Jan 11 14:10:15 2019 -0500 Commit: Brad King CommitDate: Fri Jan 11 14:47:20 2019 -0500 Add deprecation warnings for policies CMP0065 and below The OLD behaviors of all policies are deprecated, but only by documentation. Add an explicit deprecation diagnostic for some policies to encourage projects to port away from setting policies to OLD. diff --git a/Help/release/dev/deprecate-policy-old.rst b/Help/release/dev/deprecate-policy-old.rst new file mode 100644 index 0000000..2c99780 --- /dev/null +++ b/Help/release/dev/deprecate-policy-old.rst @@ -0,0 +1,8 @@ +deprecate-policy-old +-------------------- + +* An explicit deprecation diagnostic was added for policies ``CMP0064`` + and ``CMP0065`` (``CMP0063`` and below were already deprecated). + The :manual:`cmake-policies(7)` manual explains that the OLD behaviors + of all policies are deprecated and that projects should port to the + NEW behaviors. diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 68a5101..891ca61 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4232,7 +4232,11 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id, // Deprecate old policies, especially those that require a lot // of code to maintain the old behavior. - if (status == cmPolicies::OLD && id <= cmPolicies::CMP0063) { + if (status == cmPolicies::OLD && id <= cmPolicies::CMP0065 && + !(this->GetCMakeInstance()->GetIsInTryCompile() && + ( + // Policies set by cmCoreTryCompile::TryCompileCode. + id == cmPolicies::CMP0065))) { this->IssueMessage(cmake::DEPRECATION_WARNING, cmPolicies::GetPolicyDeprecatedWarning(id)); } diff --git a/Tests/RunCMake/CMP0064/CMP0064-OLD-stderr.txt b/Tests/RunCMake/CMP0064/CMP0064-OLD-stderr.txt new file mode 100644 index 0000000..987a503 --- /dev/null +++ b/Tests/RunCMake/CMP0064/CMP0064-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0064-OLD.cmake:1 \(cmake_policy\): + The OLD behavior for policy CMP0064 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ ----------------------------------------------------------------------- Summary of changes: Help/release/dev/deprecate-policy-old.rst | 8 +++++ Source/cmMakefile.cxx | 6 +++- Source/kwsys/ProcessUNIX.c | 2 +- Source/kwsys/testCommandLineArguments.cxx | 35 +++++++++++----------- .../CMP0064-OLD-stderr.txt} | 4 +-- Tests/RunCMake/FindBoost/RunCMakeTest.cmake | 1 + 6 files changed, 35 insertions(+), 21 deletions(-) create mode 100644 Help/release/dev/deprecate-policy-old.rst copy Tests/RunCMake/{CMP0039/CMP0039-OLD-stderr.txt => CMP0064/CMP0064-OLD-stderr.txt} (74%) hooks/post-receive -- CMake From kwrobot at kitware.com Tue Jan 15 13:23:03 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 15 Jan 2019 13:23:03 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-924-g67422bf Message-ID: <20190115182303.95229112F03@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 67422bf579e5c274794f131f008bec4ec1e7d4b9 (commit) via d7835e4d0e6858eeff12c6e8d09a42db6acad4bd (commit) via 1d328d8119482ca658434c7eddc07178fd363ae0 (commit) via 88b90fb1ff8b5cef816cedcf6dd378cc706806d6 (commit) via 4cf301ca77ccb487f0ef5172d6525667896dc84a (commit) via bf1a1caefeceaaad8f86e613e086b244a569456b (commit) via 11e43a19a47797ed539924022d7c54b2f92125e9 (commit) via e01d04b3a1aade55f4e086c47624869b77639544 (commit) via 414aa6c81ec62ab2f728fab31aa189ce674484a4 (commit) via 59c408d053cfe90273db04c3804ed91d7ad59d8f (commit) via 214a0bc924b35cc18adddc603bea58d456e74e64 (commit) via 77303314dcd58cc820c5e9ad9c30c0428d59b45a (commit) via 57862079d8956d30711559eadbf0da31b39917f1 (commit) via 4308eb3d165dfc473182021c12ec877e388f60a2 (commit) via 5b1364a2e39cd799d663c597bafa4222be888088 (commit) via 10a1477b631d9173a32827a315aebf1941c87564 (commit) via 971d490e5b22449a9d770e8675799698f857a452 (commit) from b2084a330d73f92b7d55d22921b2e2d9e1d462cc (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=67422bf579e5c274794f131f008bec4ec1e7d4b9 commit 67422bf579e5c274794f131f008bec4ec1e7d4b9 Merge: d7835e4 414aa6c Author: Brad King AuthorDate: Tue Jan 15 18:21:14 2019 +0000 Commit: Kitware Robot CommitDate: Tue Jan 15 13:21:21 2019 -0500 Merge topic 'simplify-boolean-expr' 414aa6c81e clang-tidy: Simplify boolean expressions Acked-by: Kitware Robot Merge-request: !2740 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d7835e4d0e6858eeff12c6e8d09a42db6acad4bd commit d7835e4d0e6858eeff12c6e8d09a42db6acad4bd Merge: 1d328d8 7730331 Author: Brad King AuthorDate: Tue Jan 15 18:19:56 2019 +0000 Commit: Kitware Robot CommitDate: Tue Jan 15 13:20:01 2019 -0500 Merge topic 'fix-source-group-CMakeLists.txt' 77303314dc Restore support for a custom source group for CMakeLists.txt Acked-by: Kitware Robot Merge-request: !2803 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1d328d8119482ca658434c7eddc07178fd363ae0 commit 1d328d8119482ca658434c7eddc07178fd363ae0 Merge: 88b90fb 59c408d Author: Brad King AuthorDate: Tue Jan 15 18:18:34 2019 +0000 Commit: Kitware Robot CommitDate: Tue Jan 15 13:18:54 2019 -0500 Merge topic 'extendwhitelist' 59c408d053 cmTargetPropertyComputer: whitelist 'MANUALLY_ADDED_DEPENDENCIES'. Acked-by: Kitware Robot Merge-request: !2808 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=88b90fb1ff8b5cef816cedcf6dd378cc706806d6 commit 88b90fb1ff8b5cef816cedcf6dd378cc706806d6 Merge: 4cf301c 214a0bc Author: Brad King AuthorDate: Tue Jan 15 18:17:58 2019 +0000 Commit: Kitware Robot CommitDate: Tue Jan 15 13:18:04 2019 -0500 Merge topic 'rel-win7' 214a0bc924 Utilities/Release: Build for Windows 7 and above Acked-by: Kitware Robot Merge-request: !2807 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4cf301ca77ccb487f0ef5172d6525667896dc84a commit 4cf301ca77ccb487f0ef5172d6525667896dc84a Merge: bf1a1ca 5b1364a Author: Brad King AuthorDate: Tue Jan 15 18:16:41 2019 +0000 Commit: Kitware Robot CommitDate: Tue Jan 15 13:16:46 2019 -0500 Merge topic 'vs10_cs_cf_support' 5b1364a2e3 cmVisualStudio10TargetGenerator: Fix .NET Compact Framework projects. Acked-by: Kitware Robot Merge-request: !2715 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bf1a1caefeceaaad8f86e613e086b244a569456b commit bf1a1caefeceaaad8f86e613e086b244a569456b Merge: 11e43a1 10a1477 Author: Brad King AuthorDate: Tue Jan 15 18:15:37 2019 +0000 Commit: Kitware Robot CommitDate: Tue Jan 15 13:15:44 2019 -0500 Merge topic 'check-fortran-run' 10a1477b63 CheckFortranSourceRuns: Add module to check if Fortran code runs Acked-by: Kitware Robot Merge-request: !2714 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=11e43a19a47797ed539924022d7c54b2f92125e9 commit 11e43a19a47797ed539924022d7c54b2f92125e9 Merge: e01d04b 5786207 Author: Brad King AuthorDate: Tue Jan 15 18:12:42 2019 +0000 Commit: Kitware Robot CommitDate: Tue Jan 15 13:14:25 2019 -0500 Merge topic 'refactor-cmDocumentation' 57862079d8 cmDocumentation: Get rid of raw pointers in AllSections map 4308eb3d16 cmDocumentationSection: Remove unused parameter in constructor Acked-by: Kitware Robot Merge-request: !2692 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e01d04b3a1aade55f4e086c47624869b77639544 commit e01d04b3a1aade55f4e086c47624869b77639544 Merge: b2084a3 971d490 Author: Brad King AuthorDate: Tue Jan 15 18:12:05 2019 +0000 Commit: Kitware Robot CommitDate: Tue Jan 15 13:13:17 2019 -0500 Merge topic 'curl-IPv6' 971d490e5b curl: do not disable IPv6 support Acked-by: Kitware Robot Merge-request: !2762 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=414aa6c81ec62ab2f728fab31aa189ce674484a4 commit 414aa6c81ec62ab2f728fab31aa189ce674484a4 Author: Regina Pfeifer AuthorDate: Thu Dec 13 19:41:05 2018 +0100 Commit: Brad King CommitDate: Tue Jan 15 11:40:25 2019 -0500 clang-tidy: Simplify boolean expressions diff --git a/.clang-tidy b/.clang-tidy index dc60714..3ae249f 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -32,7 +32,6 @@ readability-*,\ -readability-inconsistent-declaration-parameter-name,\ -readability-named-parameter,\ -readability-redundant-declaration,\ --readability-simplify-boolean-expr,\ " HeaderFilterRegex: 'Source/cm[^/]*\.(h|hxx|cxx)$' CheckOptions: diff --git a/Source/CPack/OSXScriptLauncher.cxx b/Source/CPack/OSXScriptLauncher.cxx index d3de02b..4966d09 100644 --- a/Source/CPack/OSXScriptLauncher.cxx +++ b/Source/CPack/OSXScriptLauncher.cxx @@ -46,8 +46,7 @@ int main(int argc, char* argv[]) // get the file system path of the url as a cstring // in an encoding suitable for posix apis - if (CFURLGetFileSystemRepresentation(scriptFileURL, true, path, PATH_MAX) == - false) { + if (!CFURLGetFileSystemRepresentation(scriptFileURL, true, path, PATH_MAX)) { DebugError("CFURLGetFileSystemRepresentation failed"); return 1; } diff --git a/Source/CPack/cmCPackFreeBSDGenerator.cxx b/Source/CPack/cmCPackFreeBSDGenerator.cxx index 2fcd1a8..1e6b118 100644 --- a/Source/CPack/cmCPackFreeBSDGenerator.cxx +++ b/Source/CPack/cmCPackFreeBSDGenerator.cxx @@ -257,13 +257,8 @@ void cmCPackFreeBSDGenerator::write_manifest_fields( static bool ignore_file(const std::string& filename) { struct stat statbuf; - - if (!((stat(filename.c_str(), &statbuf) >= 0) && - ((statbuf.st_mode & S_IFMT) == S_IFREG))) { - return true; - } - // May be other reasons to return false - return false; + return stat(filename.c_str(), &statbuf) < 0 || + (statbuf.st_mode & S_IFMT) != S_IFREG; } // Write the given list of @p files to the manifest stream @p s, diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx index 56eb2bf..5d6f301 100644 --- a/Source/cmGeneratorExpressionDAGChecker.cxx +++ b/Source/cmGeneratorExpressionDAGChecker.cxx @@ -55,7 +55,7 @@ void cmGeneratorExpressionDAGChecker::Initialize() if (CheckResult == DAG && (CM_FOR_EACH_TRANSITIVE_PROPERTY_METHOD( - TEST_TRANSITIVE_PROPERTY_METHOD) false)) // NOLINT(clang-tidy) + TEST_TRANSITIVE_PROPERTY_METHOD) false)) // NOLINT(*) #undef TEST_TRANSITIVE_PROPERTY_METHOD { std::map>::const_iterator diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index eb3df16..627e66d 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -1257,7 +1257,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode #define TRANSITIVE_PROPERTY_COMPARE(PROPERTY) \ (#PROPERTY == propertyName || "INTERFACE_" #PROPERTY == propertyName) || if (CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME( - TRANSITIVE_PROPERTY_COMPARE) false) { // NOLINT(clang-tidy) + TRANSITIVE_PROPERTY_COMPARE) false) { // NOLINT(*) reportError( context, content->GetOriginalExpression(), "$ expression in link libraries " diff --git a/Source/cmMachO.cxx b/Source/cmMachO.cxx index 7294c1c..7368812 100644 --- a/Source/cmMachO.cxx +++ b/Source/cmMachO.cxx @@ -52,10 +52,7 @@ bool peek(cmsys::ifstream& fin, T& v) template bool read(cmsys::ifstream& fin, T& v) { - if (!fin.read(reinterpret_cast(&v), sizeof(T))) { - return false; - } - return true; + return !!fin.read(reinterpret_cast(&v), sizeof(T)); } // read from the file and fill multiple data structures where @@ -67,10 +64,7 @@ bool read(cmsys::ifstream& fin, std::vector& v) if (v.empty()) { return true; } - if (!fin.read(reinterpret_cast(&v[0]), sizeof(T) * v.size())) { - return false; - } - return true; + return !!fin.read(reinterpret_cast(&v[0]), sizeof(T) * v.size()); } } diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index e4d2c82..5ac080a 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -1231,11 +1231,7 @@ bool cmQtAutoGenInitializer::SetupCustomTargets() } // Write AUTORCC info files - if (this->Rcc.Enabled && !this->SetupWriteRccInfo()) { - return false; - } - - return true; + return !this->Rcc.Enabled || this->SetupWriteRccInfo(); } bool cmQtAutoGenInitializer::SetupWriteAutogenInfo() diff --git a/Source/cmServer.cxx b/Source/cmServer.cxx index fe0bdc9..f7d3879 100644 --- a/Source/cmServer.cxx +++ b/Source/cmServer.cxx @@ -417,7 +417,7 @@ static void __start_thread(void* arg) auto server = static_cast(arg); std::string error; bool success = server->Serve(&error); - if (!success || error.empty() == false) { + if (!success || !error.empty()) { std::cerr << "Error during serve: " << error << std::endl; } } diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx index c3df313..08f4d1a 100644 --- a/Source/cmSourceGroupCommand.cxx +++ b/Source/cmSourceGroupCommand.cxx @@ -254,16 +254,12 @@ bool cmSourceGroupCommand::InitialPass(std::vector const& args, bool cmSourceGroupCommand::checkArgumentsPreconditions( const ParsedArguments& parsedArguments, std::string& errorMsg) const { - if (!checkSingleParameterArgumentPreconditions(kPrefixOptionName, - parsedArguments, errorMsg) || - !checkSingleParameterArgumentPreconditions(kTreeOptionName, - parsedArguments, errorMsg) || - !checkSingleParameterArgumentPreconditions(kRegexOptionName, - parsedArguments, errorMsg)) { - return false; - } - - return true; + return checkSingleParameterArgumentPreconditions( + kPrefixOptionName, parsedArguments, errorMsg) && + checkSingleParameterArgumentPreconditions(kTreeOptionName, parsedArguments, + errorMsg) && + checkSingleParameterArgumentPreconditions(kRegexOptionName, + parsedArguments, errorMsg); } bool cmSourceGroupCommand::processTree(ParsedArguments& parsedArguments, @@ -286,12 +282,8 @@ bool cmSourceGroupCommand::processTree(ParsedArguments& parsedArguments, std::set sourceGroupPaths = getSourceGroupFilesPaths(root, filesVector); - if (!addFilesToItsSourceGroups(root, sourceGroupPaths, prefix, - *(this->Makefile), errorMsg)) { - return false; - } - - return true; + return addFilesToItsSourceGroups(root, sourceGroupPaths, prefix, + *(this->Makefile), errorMsg); } bool cmSourceGroupCommand::checkSingleParameterArgumentPreconditions( https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=59c408d053cfe90273db04c3804ed91d7ad59d8f commit 59c408d053cfe90273db04c3804ed91d7ad59d8f Author: Sebastian Lipponer AuthorDate: Mon Jan 14 19:46:59 2019 +0100 Commit: Sebastian Lipponer CommitDate: Mon Jan 14 20:59:33 2019 +0100 cmTargetPropertyComputer: whitelist 'MANUALLY_ADDED_DEPENDENCIES'. diff --git a/Help/manual/cmake-buildsystem.7.rst b/Help/manual/cmake-buildsystem.7.rst index 4fc484b..a1328f2 100644 --- a/Help/manual/cmake-buildsystem.7.rst +++ b/Help/manual/cmake-buildsystem.7.rst @@ -978,6 +978,7 @@ are: * Built-in properties matching ``COMPATIBLE_INTERFACE_*`` * ``EXPORT_NAME`` * ``IMPORTED`` +* ``MANUALLY_ADDED_DEPENDENCIES`` * ``NAME`` * Properties matching ``IMPORTED_LIBNAME_*`` * Properties matching ``MAP_IMPORTED_CONFIG_*`` diff --git a/Source/cmTargetPropertyComputer.cxx b/Source/cmTargetPropertyComputer.cxx index 06ce0b1..e1765ff 100644 --- a/Source/cmTargetPropertyComputer.cxx +++ b/Source/cmTargetPropertyComputer.cxx @@ -65,6 +65,7 @@ bool cmTargetPropertyComputer::WhiteListedInterfaceProperty( builtIns.insert("EXPORT_NAME"); builtIns.insert("IMPORTED"); builtIns.insert("IMPORTED_GLOBAL"); + builtIns.insert("MANUALLY_ADDED_DEPENDENCIES"); builtIns.insert("NAME"); builtIns.insert("TYPE"); } diff --git a/Tests/InterfaceLibrary/CMakeLists.txt b/Tests/InterfaceLibrary/CMakeLists.txt index 3db210a..6aae09a 100644 --- a/Tests/InterfaceLibrary/CMakeLists.txt +++ b/Tests/InterfaceLibrary/CMakeLists.txt @@ -31,6 +31,7 @@ add_library(item_real STATIC item.cpp) add_library(item_iface INTERFACE IMPORTED) set_property(TARGET item_iface PROPERTY IMPORTED_LIBNAME item_real) add_dependencies(item_iface item_real) +get_property(item_iface_dependencies TARGET item_iface PROPERTY MANUALLY_ADDED_DEPENDENCIES) link_directories(${CMAKE_CURRENT_BINARY_DIR}) add_executable(InterfaceLibrary definetestexe.cpp) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=214a0bc924b35cc18adddc603bea58d456e74e64 commit 214a0bc924b35cc18adddc603bea58d456e74e64 Author: Brad King AuthorDate: Mon Jan 14 14:16:22 2019 -0500 Commit: Brad King CommitDate: Mon Jan 14 14:17:01 2019 -0500 Utilities/Release: Build for Windows 7 and above Drop support for Windows XP and Windows Vista. Upstream libuv has done this, and since that is a dependency of ours we will soon need to do so also. diff --git a/Help/release/dev/rel-win7.rst b/Help/release/dev/rel-win7.rst new file mode 100644 index 0000000..f7a745c --- /dev/null +++ b/Help/release/dev/rel-win7.rst @@ -0,0 +1,6 @@ +rel-win7 +-------- + +* Support for running CMake on Windows XP and Windows Vista has been dropped. + The precompiled Windows binaries provided on ``cmake.org`` now require + Windows 7 or higher. diff --git a/Utilities/Release/win32_release.cmake b/Utilities/Release/win32_release.cmake index 2e817d9..c03c665 100644 --- a/Utilities/Release/win32_release.cmake +++ b/Utilities/Release/win32_release.cmake @@ -25,13 +25,13 @@ BUILD_QtDialog:BOOL=TRUE CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:STRING=3 CMAKE_C_FLAGS_RELEASE:STRING=-MT -O2 -Ob2 -DNDEBUG CMAKE_CXX_FLAGS_RELEASE:STRING=-MT -O2 -Ob2 -DNDEBUG -CMAKE_EXE_LINKER_FLAGS:STRING=-machine:x86 -subsystem:console,5.01 +CMAKE_EXE_LINKER_FLAGS:STRING=-machine:x86 -subsystem:console,6.01 CMake_QT_STATIC_QWindowsIntegrationPlugin_LIBRARIES:STRING=${qt_win_libs} CMAKE_PREFIX_PATH:STRING=${qt_prefix} CMake_TEST_Qt4:BOOL=OFF CMake_TEST_Qt5:BOOL=OFF ") -set(ppflags "-D_WIN32_WINNT=0x501 -DNTDDI_VERSION=0x05010000 -D_USING_V110_SDK71_") +set(ppflags "-D_WIN32_WINNT=0x601 -DNTDDI_VERSION=0x06010000 -D_USING_V110_SDK71_") set(CFLAGS "${ppflags}") set(CXXFLAGS "${ppflags}") set(ENV ". ~/rel/env32") diff --git a/Utilities/Release/win64_release.cmake b/Utilities/Release/win64_release.cmake index 33af830..8417206 100644 --- a/Utilities/Release/win64_release.cmake +++ b/Utilities/Release/win64_release.cmake @@ -25,13 +25,13 @@ BUILD_QtDialog:BOOL=TRUE CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:STRING=3 CMAKE_C_FLAGS_RELEASE:STRING=-MT -O2 -Ob2 -DNDEBUG CMAKE_CXX_FLAGS_RELEASE:STRING=-MT -O2 -Ob2 -DNDEBUG -CMAKE_EXE_LINKER_FLAGS:STRING=-machine:x64 -subsystem:console,5.02 +CMAKE_EXE_LINKER_FLAGS:STRING=-machine:x64 -subsystem:console,6.01 CMake_QT_STATIC_QWindowsIntegrationPlugin_LIBRARIES:STRING=${qt_win_libs} CMAKE_PREFIX_PATH:STRING=${qt_prefix} CMake_TEST_Qt4:BOOL=OFF CMake_TEST_Qt5:BOOL=OFF ") -set(ppflags "-D_WIN32_WINNT=0x502 -DNTDDI_VERSION=0x05020000 -D_USING_V110_SDK71_") +set(ppflags "-D_WIN32_WINNT=0x601 -DNTDDI_VERSION=0x06010000 -D_USING_V110_SDK71_") set(CFLAGS "${ppflags}") set(CXXFLAGS "${ppflags}") set(ENV ". ~/rel/env64") https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=77303314dcd58cc820c5e9ad9c30c0428d59b45a commit 77303314dcd58cc820c5e9ad9c30c0428d59b45a Author: Brad King AuthorDate: Mon Jan 14 08:25:12 2019 -0500 Commit: Brad King CommitDate: Mon Jan 14 08:43:30 2019 -0500 Restore support for a custom source group for CMakeLists.txt Since commit v3.11.0-rc1~467^2 (VS,Xcode: Add CMakeLists.txt sources without mutating targets, 2017-10-18) we do not add `CMakeLists.txt` to target sources but instead generate references to them directly. This accidentally dropped generation of the `.vcxproj.filters` entry for a source group in which `CMakeLists.txt` is the only member. Fixes: #18795 diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index b0e70ff..1b145d3 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1419,6 +1419,14 @@ void cmVisualStudio10TargetGenerator::WriteGroups() groupsUsed.insert(sourceGroup); } + if (cmSourceFile const* srcCMakeLists = + this->LocalGenerator->CreateVCProjBuildRule()) { + std::string const& source = srcCMakeLists->GetFullPath(); + cmSourceGroup* sourceGroup = + this->Makefile->FindSourceGroup(source, sourceGroups); + groupsUsed.insert(sourceGroup); + } + this->AddMissingSourceGroups(groupsUsed, sourceGroups); // Write out group file diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake index db375ae..c796840 100644 --- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake +++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake @@ -1,6 +1,7 @@ include(RunCMake) run_cmake(ExplicitCMakeLists) +run_cmake(SourceGroupCMakeLists) run_cmake(VsConfigurationType) run_cmake(VsTargetsFileReferences) diff --git a/Tests/RunCMake/VS10Project/SourceGroupCMakeLists-check.cmake b/Tests/RunCMake/VS10Project/SourceGroupCMakeLists-check.cmake new file mode 100644 index 0000000..c2a94bb --- /dev/null +++ b/Tests/RunCMake/VS10Project/SourceGroupCMakeLists-check.cmake @@ -0,0 +1,33 @@ +set(vcFiltersFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj.filters") +if(NOT EXISTS "${vcFiltersFile}") + set(RunCMake_TEST_FAILED "Filters file ${vcFiltersFile} does not exist.") + return() +endif() + +set(foundFileFilter 0) +set(foundFilter 0) +file(STRINGS "${vcFiltersFile}" lines) +foreach(line IN LISTS lines) + if(line MATCHES "CMakeListsSourceGroup") + set(rule "${CMAKE_MATCH_1}") + if(foundFileFilter) + set(RunCMake_TEST_FAILED "Multiple files listed with filter for CMakeListsSourceGroup.") + return() + endif() + set(foundFileFilter 1) + endif() + if(line MATCHES " AuthorDate: Fri Nov 30 20:08:50 2018 +0100 Commit: Brad King CommitDate: Fri Jan 11 14:51:32 2019 -0500 cmDocumentation: Get rid of raw pointers in AllSections map Also simplify a lot of logic around adding sections into it. Prefer move sematics over references. diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index a85a134..fafb079 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -2,7 +2,6 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmDocumentation.h" -#include "cmAlgorithms.h" #include "cmDocumentationEntry.h" #include "cmDocumentationSection.h" #include "cmRST.h" @@ -55,11 +54,6 @@ cmDocumentation::cmDocumentation() this->ShowGenerators = true; } -cmDocumentation::~cmDocumentation() -{ - cmDeleteAll(this->AllSections); -} - bool cmDocumentation::PrintVersion(std::ostream& os) { /* clang-format off */ @@ -174,20 +168,16 @@ void cmDocumentation::WarnFormFromFilename( void cmDocumentation::addCommonStandardDocSections() { - cmDocumentationSection* sec; - - sec = new cmDocumentationSection("Options"); - sec->Append(cmDocumentationStandardOptions); - this->AllSections["Options"] = sec; + cmDocumentationSection sec{ "Options" }; + sec.Append(cmDocumentationStandardOptions); + this->AllSections.emplace("Options", std::move(sec)); } void cmDocumentation::addCMakeStandardDocSections() { - cmDocumentationSection* sec; - - sec = new cmDocumentationSection("Generators"); - sec->Append(cmDocumentationGeneratorsHeader); - this->AllSections["Generators"] = sec; + cmDocumentationSection sec{ "Generators" }; + sec.Append(cmDocumentationGeneratorsHeader); + this->AllSections.emplace("Generators", std::move(sec)); } void cmDocumentation::addCTestStandardDocSections() @@ -199,11 +189,7 @@ void cmDocumentation::addCTestStandardDocSections() void cmDocumentation::addCPackStandardDocSections() { - cmDocumentationSection* sec; - - sec = new cmDocumentationSection("Generators"); - sec->Append(cmDocumentationGeneratorsHeader); - this->AllSections["Generators"] = sec; + addCMakeStandardDocSections(); } bool cmDocumentation::CheckOptions(int argc, const char* const* argv, @@ -364,85 +350,59 @@ void cmDocumentation::SetName(const std::string& name) } void cmDocumentation::SetSection(const char* name, - cmDocumentationSection* section) + cmDocumentationSection section) { - if (this->AllSections.find(name) != this->AllSections.end()) { - delete this->AllSections[name]; - } - this->AllSections[name] = section; + this->SectionAtName(name) = std::move(section); } void cmDocumentation::SetSection(const char* name, std::vector& docs) { - cmDocumentationSection* sec = new cmDocumentationSection(name); - sec->Append(docs); - this->SetSection(name, sec); + cmDocumentationSection sec{ name }; + sec.Append(docs); + this->SetSection(name, std::move(sec)); } void cmDocumentation::SetSection(const char* name, const char* docs[][2]) { - cmDocumentationSection* sec = new cmDocumentationSection(name); - sec->Append(docs); - this->SetSection(name, sec); + cmDocumentationSection sec{ name }; + sec.Append(docs); + this->SetSection(name, std::move(sec)); } void cmDocumentation::SetSections( - std::map& sections) + std::map sections) { - for (auto const& s : sections) { - this->SetSection(s.first.c_str(), s.second); + for (auto& s : sections) { + this->SetSection(s.first.c_str(), std::move(s.second)); } } +cmDocumentationSection& cmDocumentation::SectionAtName(const char* name) +{ + return this->AllSections.emplace(name, cmDocumentationSection{ name }) + .first->second; +} void cmDocumentation::PrependSection(const char* name, const char* docs[][2]) { - cmDocumentationSection* sec = nullptr; - if (this->AllSections.find(name) == this->AllSections.end()) { - sec = new cmDocumentationSection(name); - this->SetSection(name, sec); - } else { - sec = this->AllSections[name]; - } - sec->Prepend(docs); + this->SectionAtName(name).Prepend(docs); } void cmDocumentation::PrependSection(const char* name, std::vector& docs) { - cmDocumentationSection* sec = nullptr; - if (this->AllSections.find(name) == this->AllSections.end()) { - sec = new cmDocumentationSection(name); - this->SetSection(name, sec); - } else { - sec = this->AllSections[name]; - } - sec->Prepend(docs); + this->SectionAtName(name).Prepend(docs); } void cmDocumentation::AppendSection(const char* name, const char* docs[][2]) { - cmDocumentationSection* sec = nullptr; - if (this->AllSections.find(name) == this->AllSections.end()) { - sec = new cmDocumentationSection(name); - this->SetSection(name, sec); - } else { - sec = this->AllSections[name]; - } - sec->Append(docs); + this->SectionAtName(name).Append(docs); } void cmDocumentation::AppendSection(const char* name, std::vector& docs) { - cmDocumentationSection* sec = nullptr; - if (this->AllSections.find(name) == this->AllSections.end()) { - sec = new cmDocumentationSection(name); - this->SetSection(name, sec); - } else { - sec = this->AllSections[name]; - } - sec->Append(docs); + this->SectionAtName(name).Append(docs); } void cmDocumentation::AppendSection(const char* name, @@ -625,11 +585,10 @@ bool cmDocumentation::PrintHelpListPolicies(std::ostream& os) bool cmDocumentation::PrintHelpListGenerators(std::ostream& os) { - std::map::iterator si; - si = this->AllSections.find("Generators"); + const auto si = this->AllSections.find("Generators"); if (si != this->AllSections.end()) { this->Formatter.SetIndent(" "); - this->Formatter.PrintSection(os, *si->second); + this->Formatter.PrintSection(os, si->second); } return true; } @@ -655,29 +614,27 @@ bool cmDocumentation::PrintHelpListVariables(std::ostream& os) bool cmDocumentation::PrintUsage(std::ostream& os) { - std::map::iterator si; - si = this->AllSections.find("Usage"); + const auto si = this->AllSections.find("Usage"); if (si != this->AllSections.end()) { - this->Formatter.PrintSection(os, *si->second); + this->Formatter.PrintSection(os, si->second); } return true; } bool cmDocumentation::PrintHelp(std::ostream& os) { - std::map::iterator si; - si = this->AllSections.find("Usage"); + auto si = this->AllSections.find("Usage"); if (si != this->AllSections.end()) { - this->Formatter.PrintSection(os, *si->second); + this->Formatter.PrintSection(os, si->second); } si = this->AllSections.find("Options"); if (si != this->AllSections.end()) { - this->Formatter.PrintSection(os, *si->second); + this->Formatter.PrintSection(os, si->second); } if (this->ShowGenerators) { si = this->AllSections.find("Generators"); if (si != this->AllSections.end()) { - this->Formatter.PrintSection(os, *si->second); + this->Formatter.PrintSection(os, si->second); } } return true; diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h index 153bad6..b2ff01a 100644 --- a/Source/cmDocumentation.h +++ b/Source/cmDocumentation.h @@ -6,13 +6,13 @@ #include "cmConfigure.h" // IWYU pragma: keep #include "cmDocumentationFormatter.h" +#include "cmDocumentationSection.h" #include #include #include #include -class cmDocumentationSection; struct cmDocumentationEntry; /** Class to generate documentation. */ @@ -21,8 +21,6 @@ class cmDocumentation : public cmDocumentationEnums public: cmDocumentation(); - ~cmDocumentation(); - /** * Check command line arguments for documentation options. Returns * true if documentation options are found, and false otherwise. @@ -52,11 +50,11 @@ public: /** Set a section of the documentation. Typical sections include Name, Usage, Description, Options */ - void SetSection(const char* sectionName, cmDocumentationSection* section); + void SetSection(const char* sectionName, cmDocumentationSection section); void SetSection(const char* sectionName, std::vector& docs); void SetSection(const char* sectionName, const char* docs[][2]); - void SetSections(std::map& sections); + void SetSections(std::map sections); /** Add the documentation to the beginning/end of the section */ void PrependSection(const char* sectionName, const char* docs[][2]); @@ -110,7 +108,8 @@ private: bool ShowGenerators; std::string NameString; - std::map AllSections; + std::map AllSections; + cmDocumentationSection& SectionAtName(const char* name); std::string CurrentArgument; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4308eb3d165dfc473182021c12ec877e388f60a2 commit 4308eb3d165dfc473182021c12ec877e388f60a2 Author: Artur Ryt AuthorDate: Fri Nov 30 20:08:44 2018 +0100 Commit: Brad King CommitDate: Fri Jan 11 14:51:30 2019 -0500 cmDocumentationSection: Remove unused parameter in constructor diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index 2dfba04..a85a134 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -176,7 +176,7 @@ void cmDocumentation::addCommonStandardDocSections() { cmDocumentationSection* sec; - sec = new cmDocumentationSection("Options", "OPTIONS"); + sec = new cmDocumentationSection("Options"); sec->Append(cmDocumentationStandardOptions); this->AllSections["Options"] = sec; } @@ -185,7 +185,7 @@ void cmDocumentation::addCMakeStandardDocSections() { cmDocumentationSection* sec; - sec = new cmDocumentationSection("Generators", "GENERATORS"); + sec = new cmDocumentationSection("Generators"); sec->Append(cmDocumentationGeneratorsHeader); this->AllSections["Generators"] = sec; } @@ -201,7 +201,7 @@ void cmDocumentation::addCPackStandardDocSections() { cmDocumentationSection* sec; - sec = new cmDocumentationSection("Generators", "GENERATORS"); + sec = new cmDocumentationSection("Generators"); sec->Append(cmDocumentationGeneratorsHeader); this->AllSections["Generators"] = sec; } @@ -375,16 +375,14 @@ void cmDocumentation::SetSection(const char* name, void cmDocumentation::SetSection(const char* name, std::vector& docs) { - cmDocumentationSection* sec = - new cmDocumentationSection(name, cmSystemTools::UpperCase(name).c_str()); + cmDocumentationSection* sec = new cmDocumentationSection(name); sec->Append(docs); this->SetSection(name, sec); } void cmDocumentation::SetSection(const char* name, const char* docs[][2]) { - cmDocumentationSection* sec = - new cmDocumentationSection(name, cmSystemTools::UpperCase(name).c_str()); + cmDocumentationSection* sec = new cmDocumentationSection(name); sec->Append(docs); this->SetSection(name, sec); } @@ -401,8 +399,7 @@ void cmDocumentation::PrependSection(const char* name, const char* docs[][2]) { cmDocumentationSection* sec = nullptr; if (this->AllSections.find(name) == this->AllSections.end()) { - sec = - new cmDocumentationSection(name, cmSystemTools::UpperCase(name).c_str()); + sec = new cmDocumentationSection(name); this->SetSection(name, sec); } else { sec = this->AllSections[name]; @@ -415,8 +412,7 @@ void cmDocumentation::PrependSection(const char* name, { cmDocumentationSection* sec = nullptr; if (this->AllSections.find(name) == this->AllSections.end()) { - sec = - new cmDocumentationSection(name, cmSystemTools::UpperCase(name).c_str()); + sec = new cmDocumentationSection(name); this->SetSection(name, sec); } else { sec = this->AllSections[name]; @@ -428,8 +424,7 @@ void cmDocumentation::AppendSection(const char* name, const char* docs[][2]) { cmDocumentationSection* sec = nullptr; if (this->AllSections.find(name) == this->AllSections.end()) { - sec = - new cmDocumentationSection(name, cmSystemTools::UpperCase(name).c_str()); + sec = new cmDocumentationSection(name); this->SetSection(name, sec); } else { sec = this->AllSections[name]; @@ -442,8 +437,7 @@ void cmDocumentation::AppendSection(const char* name, { cmDocumentationSection* sec = nullptr; if (this->AllSections.find(name) == this->AllSections.end()) { - sec = - new cmDocumentationSection(name, cmSystemTools::UpperCase(name).c_str()); + sec = new cmDocumentationSection(name); this->SetSection(name, sec); } else { sec = this->AllSections[name]; diff --git a/Source/cmDocumentationSection.h b/Source/cmDocumentationSection.h index d9e8187..7031b52 100644 --- a/Source/cmDocumentationSection.h +++ b/Source/cmDocumentationSection.h @@ -19,7 +19,7 @@ class cmDocumentationSection { public: /** Create a cmSection, with a special name for man-output mode. */ - cmDocumentationSection(const char* name, const char*) + explicit cmDocumentationSection(const char* name) : Name(name) { } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5b1364a2e39cd799d663c597bafa4222be888088 commit 5b1364a2e39cd799d663c597bafa4222be888088 Author: Wil Stark AuthorDate: Thu Dec 6 16:31:20 2018 -0800 Commit: Wil Stark CommitDate: Fri Jan 11 09:08:55 2019 -0800 cmVisualStudio10TargetGenerator: Fix .NET Compact Framework projects. Fixes: #18672 diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index b0e70ff..5140648 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -297,6 +297,11 @@ std::ostream& cmVisualStudio10TargetGenerator::Elem::WriteString( "$(UserRootDir)\\Microsoft.CSharp.$(Platform).user.props" #define VS10_CSharp_TARGETS "$(MSBuildToolsPath)\\Microsoft.CSharp.targets" +#define VS10_CSharp_NETCF_TARGETS \ + "$(MSBuildExtensionsPath)\\Microsoft\\$(TargetFrameworkIdentifier)\\" \ + "$(TargetFrameworkTargetsVersion)\\Microsoft.$(TargetFrameworkIdentifier)" \ + ".CSharp.targets" + void cmVisualStudio10TargetGenerator::Generate() { // do not generate external ms projects @@ -480,9 +485,31 @@ void cmVisualStudio10TargetGenerator::Generate() targetFrameworkVersion = this->GeneratorTarget->GetProperty( "DOTNET_TARGET_FRAMEWORK_VERSION"); } + if (!targetFrameworkVersion && this->ProjectType == csproj && + this->GlobalGenerator->TargetsWindowsCE() && + this->GlobalGenerator->GetVersion() == + cmGlobalVisualStudioGenerator::VS12) { + // VS12 .NETCF default to .NET framework 3.9 + targetFrameworkVersion = "v3.9"; + } if (targetFrameworkVersion) { e1.Element("TargetFrameworkVersion", targetFrameworkVersion); } + if (this->ProjectType == csproj && + this->GlobalGenerator->TargetsWindowsCE()) { + const char* targetFrameworkId = this->GeneratorTarget->GetProperty( + "VS_TARGET_FRAMEWORK_IDENTIFIER"); + if (!targetFrameworkId) { + targetFrameworkId = "WindowsEmbeddedCompact"; + } + e1.Element("TargetFrameworkIdentifier", targetFrameworkId); + const char* targetFrameworkVer = this->GeneratorTarget->GetProperty( + "VS_TARGET_FRAMEWORKS_TARGET_VERSION"); + if (!targetFrameworkVer) { + targetFrameworkVer = "v8.0"; + } + e1.Element("TargetFrameworkTargetsVersion", targetFrameworkVer); + } } // Disable the project upgrade prompt that is displayed the first time a @@ -638,7 +665,11 @@ void cmVisualStudio10TargetGenerator::Generate() Elem(e0, "Import").Attribute("Project", VS10_CXX_TARGETS); break; case csproj: - Elem(e0, "Import").Attribute("Project", VS10_CSharp_TARGETS); + if (this->GlobalGenerator->TargetsWindowsCE()) { + Elem(e0, "Import").Attribute("Project", VS10_CSharp_NETCF_TARGETS); + } else { + Elem(e0, "Import").Attribute("Project", VS10_CSharp_TARGETS); + } break; } diff --git a/Tests/RunCMake/VS10ProjectWinCE/RunCMakeTest.cmake b/Tests/RunCMake/VS10ProjectWinCE/RunCMakeTest.cmake index b35ee90..2c9067f 100644 --- a/Tests/RunCMake/VS10ProjectWinCE/RunCMakeTest.cmake +++ b/Tests/RunCMake/VS10ProjectWinCE/RunCMakeTest.cmake @@ -6,3 +6,4 @@ set(RunCMake_GENERATOR_INSTANCE "") set(RunCMake_TEST_OPTIONS -DCMAKE_SYSTEM_NAME=WindowsCE ) run_cmake(VsCEDebuggerDeploy) +run_cmake(VSCSharpCFProject) diff --git a/Tests/RunCMake/VS10ProjectWinCE/VsCSharpCFProject-check.cmake b/Tests/RunCMake/VS10ProjectWinCE/VsCSharpCFProject-check.cmake new file mode 100644 index 0000000..618896e --- /dev/null +++ b/Tests/RunCMake/VS10ProjectWinCE/VsCSharpCFProject-check.cmake @@ -0,0 +1,54 @@ +# +# Check C# Compact Framework project for required elements. +# +set(csProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.csproj") +if(NOT EXISTS "${csProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${csProjectFile} does not exist.") + return() +endif() + +if( NOT ${CMAKE_SYSTEM_NAME} STREQUAL "WindowsCE" ) + set(RunCMake_TEST_FAILED "Test only valid for WindowsCE") + return() +endif() + +set(FoundTargetFrameworkTargetsVersion FALSE) +set(FoundDotNetFrameworkVersion FALSE) +set(FoundTargetFrameworkIdentifier FALSE) +set(FoundCFTargetsImport FALSE) + + +file(STRINGS "${csProjectFile}" lines) +foreach(line IN LISTS lines) + #message(STATUS ${line}) + if(line MATCHES "^ *WindowsEmbeddedCompact *$") + set(FoundTargetFrameworkIdentifier TRUE) + elseif(line MATCHES " *v3.9 *$") + set(FoundDotNetFrameworkVersion TRUE) + elseif(line MATCHES " *v8.0 *$") + set(FoundTargetFrameworkTargetsVersion TRUE) + elseif( line MATCHES " * *" ) + set(FoundCFTargetsImport TRUE) + endif() +endforeach() + + +if(NOT FoundTargetFrameworkTargetsVersion) + set(RunCMake_TEST_FAILED "TargetFrameworkIdentifier not found or not set correctly.") + return() +endif() + +if(NOT FoundDotNetFrameworkVersion) + set(RunCMake_TEST_FAILED "TargetFrameworkVersion not found or not set correctly.") + return() +endif() + +if(NOT FoundTargetFrameworkIdentifier) + set(RunCMake_TEST_FAILED "TargetFrameworkTargetsVersion not found or not set correctly.") + return() +endif() + +if(NOT FoundCFTargetsImport) + set(RunCMake_TEST_FAILED "Import of Compact Framework targets file not found or not set correctly.") + return() +endif() diff --git a/Tests/RunCMake/VS10ProjectWinCE/VsCSharpCFProject.cmake b/Tests/RunCMake/VS10ProjectWinCE/VsCSharpCFProject.cmake new file mode 100644 index 0000000..fb2acbb --- /dev/null +++ b/Tests/RunCMake/VS10ProjectWinCE/VsCSharpCFProject.cmake @@ -0,0 +1,8 @@ +enable_language(CSharp) + +add_library(foo SHARED foo.cs ) + +set_target_properties(foo + PROPERTIES + DOTNET_TARGET_FRAMEWORK_VERSION "v3.9" +) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=10a1477b631d9173a32827a315aebf1941c87564 commit 10a1477b631d9173a32827a315aebf1941c87564 Author: Michael Hirsch, Ph.D AuthorDate: Thu Dec 6 15:09:54 2018 -0500 Commit: Brad King CommitDate: Thu Jan 10 14:09:12 2019 -0500 CheckFortranSourceRuns: Add module to check if Fortran code runs Add a Fortran equivalent to the existing `Check{C,CXX}SourceRuns` modules. diff --git a/Help/manual/cmake-modules.7.rst b/Help/manual/cmake-modules.7.rst index 940186a..71a8b00 100644 --- a/Help/manual/cmake-modules.7.rst +++ b/Help/manual/cmake-modules.7.rst @@ -28,6 +28,7 @@ These modules are loaded using the :command:`include` command. /module/CheckFortranCompilerFlag /module/CheckFortranFunctionExists /module/CheckFortranSourceCompiles + /module/CheckFortranSourceRuns /module/CheckFunctionExists /module/CheckIPOSupported /module/CheckIncludeFileCXX diff --git a/Help/module/CheckFortranSourceRuns.rst b/Help/module/CheckFortranSourceRuns.rst new file mode 100644 index 0000000..a1bff70 --- /dev/null +++ b/Help/module/CheckFortranSourceRuns.rst @@ -0,0 +1 @@ +.. cmake-module:: ../../Modules/CheckFortranSourceRuns.cmake diff --git a/Help/release/dev/check-fortran-run.rst b/Help/release/dev/check-fortran-run.rst new file mode 100644 index 0000000..b5f6558 --- /dev/null +++ b/Help/release/dev/check-fortran-run.rst @@ -0,0 +1,6 @@ +check-fortran-run +----------------- + +* A :module:`CheckFortranSourceRuns` module was added to provide a + :command:`check_fortran_source_runs` command to check if a Fortran + source snippet compiles and runs. diff --git a/Modules/CheckFortranSourceCompiles.cmake b/Modules/CheckFortranSourceCompiles.cmake index b3e83dd..1820407 100644 --- a/Modules/CheckFortranSourceCompiles.cmake +++ b/Modules/CheckFortranSourceCompiles.cmake @@ -26,7 +26,8 @@ Check if given Fortran source compiles and links into an executable. if anything in the output matches any of the specified regular expressions. By default, the test source file will be given a ``.F`` file extension. The - ``SRC_EXT`` option can be used to override this with ``.`` instead. + ``SRC_EXT`` option can be used to override this with ``.`` instead-- + ``.F90`` is a typical choice. The underlying check is performed by the :command:`try_compile` command. The compile and link commands can be influenced by setting any of the following diff --git a/Modules/CheckFortranSourceCompiles.cmake b/Modules/CheckFortranSourceRuns.cmake similarity index 72% copy from Modules/CheckFortranSourceCompiles.cmake copy to Modules/CheckFortranSourceRuns.cmake index b3e83dd..58d90d7 100644 --- a/Modules/CheckFortranSourceCompiles.cmake +++ b/Modules/CheckFortranSourceRuns.cmake @@ -2,35 +2,32 @@ # file Copyright.txt or https://cmake.org/licensing for details. #[=======================================================================[.rst: -CheckFortranSourceCompiles --------------------------- +CheckFortranSourceRuns +---------------------- -Check if given Fortran source compiles and links into an executable. +Check if given Fortran source compiles and links into an executable and can +subsequently be run. -.. command:: check_fortran_source_compiles +.. command:: check_fortran_source_runs .. code-block:: cmake - check_fortran_source_compiles( - [FAIL_REGEX ...] - [SRC_EXT ] - ) + check_fortran_source_runs( + [SRC_EXT ]) - Checks that the source supplied in ```` can be compiled as a Fortran - source file and linked as an executable (so it must contain at least a - ``PROGRAM`` entry point). The result will be stored in the internal cache - variable ````, with a boolean true value for success and boolean - false for failure. + Check that the source supplied in ```` can be compiled as a Fortran source + file, linked as an executable and then run. The ```` must contain at + least ``program; end program`` statements. If the ```` could be built and run + successfully, the internal cache variable specified by ```` will + be set to 1, otherwise it will be set to an value that evaluates to boolean + false (e.g. an empty string or an error message). - If ``FAIL_REGEX`` is provided, then failure is determined by checking - if anything in the output matches any of the specified regular expressions. - - By default, the test source file will be given a ``.F`` file extension. The + By default, the test source file will be given a ``.F90`` file extension. The ``SRC_EXT`` option can be used to override this with ``.`` instead. - The underlying check is performed by the :command:`try_compile` command. The + The underlying check is performed by the :command:`try_run` command. The compile and link commands can be influenced by setting any of the following - variables prior to calling ``check_fortran_source_compiles()``: + variables prior to calling ``check_fortran_source_runs()``: ``CMAKE_REQUIRED_FLAGS`` Additional flags to pass to the compiler. Note that the contents of @@ -46,17 +43,17 @@ Check if given Fortran source compiles and links into an executable. ``CMAKE_REQUIRED_INCLUDES`` A :ref:`;-list ` of header search paths to pass to the compiler. These will be the only header search paths used by - ``try_compile()``, i.e. the contents of the :prop_dir:`INCLUDE_DIRECTORIES` + ``try_run()``, i.e. the contents of the :prop_dir:`INCLUDE_DIRECTORIES` directory property will be ignored. ``CMAKE_REQUIRED_LINK_OPTIONS`` A :ref:`;-list ` of options to add to the link - command (see :command:`try_compile` for further details). + command (see :command:`try_run` for further details). ``CMAKE_REQUIRED_LIBRARIES`` A :ref:`;-list ` of libraries to add to the link command. These can be the name of system libraries or they can be - :ref:`Imported Targets ` (see :command:`try_compile` for + :ref:`Imported Targets ` (see :command:`try_run` for further details). ``CMAKE_REQUIRED_QUIET`` @@ -73,13 +70,12 @@ Check if given Fortran source compiles and links into an executable. include_guard(GLOBAL) -macro(CHECK_Fortran_SOURCE_COMPILES SOURCE VAR) +macro(CHECK_Fortran_SOURCE_RUNS SOURCE VAR) if(NOT DEFINED "${VAR}") - set(_FAIL_REGEX) set(_SRC_EXT) set(_key) foreach(arg ${ARGN}) - if("${arg}" MATCHES "^(FAIL_REGEX|SRC_EXT)$") + if("${arg}" MATCHES "^(SRC_EXT)$") set(_key "${arg}") elseif(_key) list(APPEND _${_key} "${arg}") @@ -88,7 +84,7 @@ macro(CHECK_Fortran_SOURCE_COMPILES SOURCE VAR) endif() endforeach() if(NOT _SRC_EXT) - set(_SRC_EXT F) + set(_SRC_EXT F90) endif() set(MACRO_CHECK_FUNCTION_DEFINITIONS "-D${VAR} ${CMAKE_REQUIRED_FLAGS}") @@ -116,23 +112,23 @@ macro(CHECK_Fortran_SOURCE_COMPILES SOURCE VAR) if(NOT CMAKE_REQUIRED_QUIET) message(STATUS "Performing Test ${VAR}") endif() - try_compile(${VAR} + try_run(${VAR}_EXITCODE ${VAR}_COMPILED ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.${_SRC_EXT} COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} ${CHECK_Fortran_SOURCE_COMPILES_ADD_LINK_OPTIONS} ${CHECK_Fortran_SOURCE_COMPILES_ADD_LIBRARIES} CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} + -DCMAKE_SKIP_RPATH:BOOL=${CMAKE_SKIP_RPATH} "${CHECK_Fortran_SOURCE_COMPILES_ADD_INCLUDES}" - OUTPUT_VARIABLE OUTPUT) - - foreach(_regex ${_FAIL_REGEX}) - if("${OUTPUT}" MATCHES "${_regex}") - set(${VAR} 0) - endif() - endforeach() + COMPILE_OUTPUT_VARIABLE OUTPUT) - if(${VAR}) + # if it did not compile make the return value fail code of 1 + if(NOT ${VAR}_COMPILED) + set(${VAR}_EXITCODE 1) + endif() + # if the return value was 0 then it worked + if("${${VAR}_EXITCODE}" EQUAL 0) set(${VAR} 1 CACHE INTERNAL "Test ${VAR}") if(NOT CMAKE_REQUIRED_QUIET) message(STATUS "Performing Test ${VAR} - Success") @@ -140,15 +136,22 @@ macro(CHECK_Fortran_SOURCE_COMPILES SOURCE VAR) file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Performing Fortran SOURCE FILE Test ${VAR} succeeded with the following output:\n" "${OUTPUT}\n" + "Return value: ${${VAR}}\n" "Source file was:\n${SOURCE}\n") else() + if(CMAKE_CROSSCOMPILING AND "${${VAR}_EXITCODE}" MATCHES "FAILED_TO_RUN") + set(${VAR} "${${VAR}_EXITCODE}") + else() + set(${VAR} "" CACHE INTERNAL "Test ${VAR}") + endif() + if(NOT CMAKE_REQUIRED_QUIET) message(STATUS "Performing Test ${VAR} - Failed") endif() - set(${VAR} "" CACHE INTERNAL "Test ${VAR}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Performing Fortran SOURCE FILE Test ${VAR} failed with the following output:\n" "${OUTPUT}\n" + "Return value: ${${VAR}_EXITCODE}\n" "Source file was:\n${SOURCE}\n") endif() endif() diff --git a/Tests/FortranOnly/CMakeLists.txt b/Tests/FortranOnly/CMakeLists.txt index 59e6d59..77f6041 100644 --- a/Tests/FortranOnly/CMakeLists.txt +++ b/Tests/FortranOnly/CMakeLists.txt @@ -70,8 +70,15 @@ if(NOT CMAKE_Fortran_COMPILER_ID STREQUAL XL) include(CheckFortranCompilerFlag) CHECK_Fortran_COMPILER_FLAG(-_this_is_not_a_flag_ Fortran_BOGUS_FLAG) if (Fortran_BOGUS_FLAG) - message (SEND_ERROR "CHECK_Fortran_COMPILER_FLAG() succeeded, but should have failed") - endif () + message(SEND_ERROR "CHECK_Fortran_COMPILER_FLAG() succeeded, but should have failed") + endif() + + unset(Fortran_RUN_FLAG CACHE) + include(CheckFortranSourceRuns) + check_fortran_source_runs("program a; end program" Fortran_RUN_FLAG SRC_EXT F90) + if(NOT Fortran_RUN_FLAG) + message(SEND_ERROR "CHECK_Fortran_SOURCE_RUNS() failed") + endif() endif() # Test generation of preprocessed sources. https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=971d490e5b22449a9d770e8675799698f857a452 commit 971d490e5b22449a9d770e8675799698f857a452 Author: Rechi Rechi AuthorDate: Fri Dec 28 23:26:52 2018 +0100 Commit: Brad King CommitDate: Thu Jan 10 13:54:25 2019 -0500 curl: do not disable IPv6 support Allow curl's detection of IPv6 to proceed when building in CMake. diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt index 9ae7aa3..1c96497 100644 --- a/Utilities/cmcurl/CMakeLists.txt +++ b/Utilities/cmcurl/CMakeLists.txt @@ -29,7 +29,7 @@ set(DISABLED_THREADSAFE OFF CACHE INTERNAL "Curl can use thread-safe functions") set(ENABLE_ARES OFF CACHE INTERNAL "No curl c-ares support") set(ENABLE_CURLDEBUG OFF CACHE INTERNAL "No curl TrackMemory features") set(ENABLE_DEBUG OFF CACHE INTERNAL "No curl debug features") -set(ENABLE_IPV6 OFF CACHE INTERNAL "No curl IPv6 support") +set(ENABLE_IPV6 ON CACHE INTERNAL "Enable curl IPv6 support detection") set(ENABLE_MANUAL OFF CACHE INTERNAL "No curl built-in manual") set(ENABLE_THREADED_RESOLVER OFF CACHE INTERNAL "No curl POSIX threaded DNS lookup") set(ENABLE_UNIX_SOCKETS OFF CACHE INTERNAL "No curl Unix domain sockets support") ----------------------------------------------------------------------- Summary of changes: .clang-tidy | 1 - Help/manual/cmake-buildsystem.7.rst | 1 + Help/manual/cmake-modules.7.rst | 1 + Help/module/CheckFortranSourceRuns.rst | 1 + Help/release/dev/check-fortran-run.rst | 6 ++ Help/release/dev/rel-win7.rst | 6 ++ Modules/CheckFortranSourceCompiles.cmake | 3 +- ...Compiles.cmake => CheckFortranSourceRuns.cmake} | 75 ++++++------- Source/CPack/OSXScriptLauncher.cxx | 3 +- Source/CPack/cmCPackFreeBSDGenerator.cxx | 9 +- Source/cmDocumentation.cxx | 119 ++++++--------------- Source/cmDocumentation.h | 11 +- Source/cmDocumentationSection.h | 2 +- Source/cmGeneratorExpressionDAGChecker.cxx | 2 +- Source/cmGeneratorExpressionNode.cxx | 2 +- Source/cmMachO.cxx | 10 +- Source/cmQtAutoGenInitializer.cxx | 6 +- Source/cmServer.cxx | 2 +- Source/cmSourceGroupCommand.cxx | 24 ++--- Source/cmTargetPropertyComputer.cxx | 1 + Source/cmVisualStudio10TargetGenerator.cxx | 41 ++++++- Tests/FortranOnly/CMakeLists.txt | 11 +- Tests/InterfaceLibrary/CMakeLists.txt | 1 + Tests/RunCMake/VS10Project/RunCMakeTest.cmake | 1 + .../VS10Project/SourceGroupCMakeLists-check.cmake | 33 ++++++ .../VS10Project/SourceGroupCMakeLists.cmake | 3 + Tests/RunCMake/VS10ProjectWinCE/RunCMakeTest.cmake | 1 + .../VS10ProjectWinCE/VsCSharpCFProject-check.cmake | 54 ++++++++++ .../VS10ProjectWinCE/VsCSharpCFProject.cmake | 8 ++ Utilities/Release/win32_release.cmake | 4 +- Utilities/Release/win64_release.cmake | 4 +- Utilities/cmcurl/CMakeLists.txt | 2 +- 32 files changed, 270 insertions(+), 178 deletions(-) create mode 100644 Help/module/CheckFortranSourceRuns.rst create mode 100644 Help/release/dev/check-fortran-run.rst create mode 100644 Help/release/dev/rel-win7.rst copy Modules/{CheckFortranSourceCompiles.cmake => CheckFortranSourceRuns.cmake} (72%) create mode 100644 Tests/RunCMake/VS10Project/SourceGroupCMakeLists-check.cmake create mode 100644 Tests/RunCMake/VS10Project/SourceGroupCMakeLists.cmake create mode 100644 Tests/RunCMake/VS10ProjectWinCE/VsCSharpCFProject-check.cmake create mode 100644 Tests/RunCMake/VS10ProjectWinCE/VsCSharpCFProject.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Tue Jan 15 13:33:06 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 15 Jan 2019 13:33:06 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-931-gda566d4 Message-ID: <20190115183306.7B04811F98A@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via da566d4de885130e182edc80f13691f5ca24bb61 (commit) via 41b0c0dc739c34550b8e9054b9a88405afb6518d (commit) via 2119c33b7e7b5fc348c0b4b24e402bcacb18d5db (commit) via 57e48f16f2c3b73fb27057267c8092a41005bb75 (commit) via bdef729646a5a559c295ef9c0fb83eb8a6b34905 (commit) via 68d316e0cf278021d9fa4553471d29803d09a394 (commit) via d8ed309d0529d9a7b28da561c3640290a8041b68 (commit) from 67422bf579e5c274794f131f008bec4ec1e7d4b9 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=da566d4de885130e182edc80f13691f5ca24bb61 commit da566d4de885130e182edc80f13691f5ca24bb61 Merge: 41b0c0d 2119c33 Author: Brad King AuthorDate: Tue Jan 15 18:25:56 2019 +0000 Commit: Kitware Robot CommitDate: Tue Jan 15 13:26:02 2019 -0500 Merge topic 'fetchcontent-uses-terminal' 2119c33b7e FetchContent: Give access to the terminal for download and update Acked-by: Kitware Robot Acked-by: Michael Hirsch, Ph.D. Merge-request: !2800 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=41b0c0dc739c34550b8e9054b9a88405afb6518d commit 41b0c0dc739c34550b8e9054b9a88405afb6518d Merge: 67422bf 57e48f1 Author: Brad King AuthorDate: Tue Jan 15 18:23:29 2019 +0000 Commit: Kitware Robot CommitDate: Tue Jan 15 13:23:38 2019 -0500 Merge topic 'vs2019' 57e48f16f2 VS: Add Visual Studio 16 2019 generator bdef729646 VS: Parameterize VS 2017 generator to support future versions 68d316e0cf VS: Rename VS 2017 generator sources to be version-independent d8ed309d05 VS: Parameterize cmVSSetupAPIHelper instances with VS version Acked-by: Kitware Robot Merge-request: !2789 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2119c33b7e7b5fc348c0b4b24e402bcacb18d5db commit 2119c33b7e7b5fc348c0b4b24e402bcacb18d5db Author: Craig Scott AuthorDate: Mon Jan 14 22:56:19 2019 +1100 Commit: Craig Scott CommitDate: Mon Jan 14 23:32:18 2019 +1100 FetchContent: Give access to the terminal for download and update A main scenario where this is needed is when a git operation needs the password to a private key and asks for it on the console. Without this change, such operations can appear to hang indefinitely with no prompt if QUIET is in effect (which it is by default). Another scenario this addresses is when progress of a download or update should be shown. Without this change, all such progress is buffered with some generators and will only be shown at the end, which defeats the purpose of logging any progress to begin with. Relates: #18238 diff --git a/Modules/FetchContent.cmake b/Modules/FetchContent.cmake index 98cdf6c..c65ae9e 100644 --- a/Modules/FetchContent.cmake +++ b/Modules/FetchContent.cmake @@ -691,6 +691,13 @@ function(__FetchContent_directPopulate contentName) BUILD_COMMAND INSTALL_COMMAND TEST_COMMAND + # We force both of these to be ON since we are always executing serially + # and we want all steps to have access to the terminal in case they + # need input from the command line (e.g. ask for a private key password) + # or they want to provide timely progress. We silently absorb and + # discard these if they are set by the caller. + USES_TERMINAL_DOWNLOAD + USES_TERMINAL_UPDATE ) set(multiValueArgs "") diff --git a/Modules/FetchContent/CMakeLists.cmake.in b/Modules/FetchContent/CMakeLists.cmake.in index 9a7a771..0095b11 100644 --- a/Modules/FetchContent/CMakeLists.cmake.in +++ b/Modules/FetchContent/CMakeLists.cmake.in @@ -18,4 +18,6 @@ ExternalProject_Add(${contentName}-populate BUILD_COMMAND "" INSTALL_COMMAND "" TEST_COMMAND "" + USES_TERMINAL_DOWNLOAD YES + USES_TERMINAL_UPDATE YES ) diff --git a/Tests/RunCMake/FetchContent/CMakeLists.txt b/Tests/RunCMake/FetchContent/CMakeLists.txt index d3137f6..3cc2e43 100644 --- a/Tests/RunCMake/FetchContent/CMakeLists.txt +++ b/Tests/RunCMake/FetchContent/CMakeLists.txt @@ -1,3 +1,7 @@ cmake_minimum_required(VERSION 3.9) project(${RunCMake_TEST} NONE) + +# Tests assume no previous downloads in the output directory +file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/_deps) + include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/FetchContent/RunCMakeTest.cmake b/Tests/RunCMake/FetchContent/RunCMakeTest.cmake index 621fb8b..9c1ab66 100644 --- a/Tests/RunCMake/FetchContent/RunCMakeTest.cmake +++ b/Tests/RunCMake/FetchContent/RunCMakeTest.cmake @@ -10,6 +10,7 @@ run_cmake(SameGenerator) run_cmake(VarDefinitions) run_cmake(GetProperties) run_cmake(DirOverrides) +run_cmake(UsesTerminalOverride) # We need to pass through CMAKE_GENERATOR and CMAKE_MAKE_PROGRAM # to ensure the test can run on machines where the build tool diff --git a/Tests/RunCMake/FetchContent/UsesTerminalOverride-stdout.txt b/Tests/RunCMake/FetchContent/UsesTerminalOverride-stdout.txt new file mode 100644 index 0000000..3718d64 --- /dev/null +++ b/Tests/RunCMake/FetchContent/UsesTerminalOverride-stdout.txt @@ -0,0 +1,2 @@ +Logged from t1 download step ++.*Logged from t2 download step diff --git a/Tests/RunCMake/FetchContent/UsesTerminalOverride.cmake b/Tests/RunCMake/FetchContent/UsesTerminalOverride.cmake new file mode 100644 index 0000000..99d9719 --- /dev/null +++ b/Tests/RunCMake/FetchContent/UsesTerminalOverride.cmake @@ -0,0 +1,17 @@ +include(FetchContent) + +set(FETCHCONTENT_QUIET NO) + +FetchContent_Declare( + t1 + DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E echo "Logged from t1 download step" + USES_TERMINAL_DOWNLOAD NO + +) +FetchContent_Populate(t1) + +FetchContent_Populate( + t2 + DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E echo "Logged from t2 download step" + USES_TERMINAL_DOWNLOAD NO +) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=57e48f16f2c3b73fb27057267c8092a41005bb75 commit 57e48f16f2c3b73fb27057267c8092a41005bb75 Author: Brad King AuthorDate: Wed Jan 9 14:30:10 2019 -0500 Commit: Brad King CommitDate: Fri Jan 11 11:04:51 2019 -0500 VS: Add Visual Studio 16 2019 generator Add this generator *without* support for specifying the target architecture in the generator name. cmake-gui will be taught to provide a field for this, and command-line builds can use -A. Also, teach this generator to select a default target architecture based on the host architecture. Fixes: #18689 Inspired-by: Egor Pugin diff --git a/Help/generator/Visual Studio 16 2019.rst b/Help/generator/Visual Studio 16 2019.rst new file mode 100644 index 0000000..6f2bc56 --- /dev/null +++ b/Help/generator/Visual Studio 16 2019.rst @@ -0,0 +1,49 @@ +Visual Studio 16 2019 +--------------------- + +Generates Visual Studio 16 (VS 2019) project files. + +Project Types +^^^^^^^^^^^^^ + +Only Visual C++ and C# projects may be generated. Other types of +projects (JavaScript, Powershell, Python, etc.) are not supported. + +Instance Selection +^^^^^^^^^^^^^^^^^^ + +VS 2019 supports multiple installations on the same machine. +The :variable:`CMAKE_GENERATOR_INSTANCE` variable may be set as a +cache entry containing the absolute path to a Visual Studio instance. +If the value is not specified explicitly by the user or a toolchain file, +CMake queries the Visual Studio Installer to locate VS instances, chooses +one, and sets the variable as a cache entry to hold the value persistently. + +When CMake first chooses an instance, if the ``VS160COMNTOOLS`` environment +variable is set and points to the ``Common7/Tools`` directory within +one of the instances, that instance will be used. Otherwise, if more +than one instance is installed we do not define which one is chosen +by default. + +Platform Selection +^^^^^^^^^^^^^^^^^^ + +The default target platform name (architecture) is that of the host. + +The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set, perhaps +via the :manual:`cmake(1)` ``-A`` option, to specify a target platform +name (architecture). For example: + +* ``cmake -G "Visual Studio 16 2019" -A Win32`` +* ``cmake -G "Visual Studio 16 2019" -A x64`` +* ``cmake -G "Visual Studio 16 2019" -A ARM`` +* ``cmake -G "Visual Studio 16 2019" -A ARM64`` + +Toolset Selection +^^^^^^^^^^^^^^^^^ + +The ``v142`` toolset that comes with Visual Studio 16 2019 is selected by +default. The :variable:`CMAKE_GENERATOR_TOOLSET` option may be set, perhaps +via the :manual:`cmake(1)` ``-T`` option, to specify another toolset. + +.. include:: VS_TOOLSET_HOST_ARCH.txt diff --git a/Help/manual/cmake-generators.7.rst b/Help/manual/cmake-generators.7.rst index 1de10c4..41f7652 100644 --- a/Help/manual/cmake-generators.7.rst +++ b/Help/manual/cmake-generators.7.rst @@ -87,6 +87,7 @@ Visual Studio Generators /generator/Visual Studio 12 2013 /generator/Visual Studio 14 2015 /generator/Visual Studio 15 2017 + /generator/Visual Studio 16 2019 Other Generators ^^^^^^^^^^^^^^^^ diff --git a/Help/release/dev/vs2019.rst b/Help/release/dev/vs2019.rst new file mode 100644 index 0000000..1ffdeec --- /dev/null +++ b/Help/release/dev/vs2019.rst @@ -0,0 +1,13 @@ +vs2019 +------ + +* The :generator:`Visual Studio 16 2019` generator was added. This is + experimental and based on "Visual Studio 2019 Preview 1.1" because this + version of VS has not been released. + + The VS 2019 generator differs from generators for earlier versions + in that it does not provide variants that specify the target platform + in the generator name. Instead :variable:`CMAKE_GENERATOR_PLATFORM` + must be used, e.g. through the ``-A`` command-line option. Furthermore, + the default target platform (architecture) is now based on the *host* + platform. diff --git a/Help/variable/MSVC_VERSION.rst b/Help/variable/MSVC_VERSION.rst index 4ef43d8..45df37f 100644 --- a/Help/variable/MSVC_VERSION.rst +++ b/Help/variable/MSVC_VERSION.rst @@ -18,6 +18,7 @@ Known version numbers are:: 1800 = VS 12.0 (v120 toolset) 1900 = VS 14.0 (v140 toolset) 1910-1919 = VS 15.0 (v141 toolset) + 1920-1929 = VS 16.0 (v142 toolset) See also the :variable:`CMAKE__COMPILER_VERSION` and :variable:`MSVC_TOOLSET_VERSION` variable. diff --git a/Source/cmCMakeHostSystemInformationCommand.cxx b/Source/cmCMakeHostSystemInformationCommand.cxx index ddc32c0..54f08bb 100644 --- a/Source/cmCMakeHostSystemInformationCommand.cxx +++ b/Source/cmCMakeHostSystemInformationCommand.cxx @@ -145,6 +145,22 @@ bool cmCMakeHostSystemInformationCommand::GetValue( if (vsSetupAPIHelper.GetVSInstanceInfo(value)) { cmSystemTools::ConvertToUnixSlashes(value); } + } else if (key == "VS_16_DIR") { + // If generating for the VS 16 IDE, use the same instance. + cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator(); + if (cmHasLiteralPrefix(gg->GetName(), "Visual Studio 16 ")) { + cmGlobalVisualStudioVersionedGenerator* vs16gen = + static_cast(gg); + if (vs16gen->GetVSInstance(value)) { + return true; + } + } + + // Otherwise, find a VS 16 instance ourselves. + cmVSSetupAPIHelper vsSetupAPIHelper(16); + if (vsSetupAPIHelper.GetVSInstanceInfo(value)) { + cmSystemTools::ConvertToUnixSlashes(value); + } #endif } else { std::string e = "does not recognize " + key; diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index a6bec4b..2932970 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -1032,6 +1032,8 @@ const char* cmGlobalVisualStudio10Generator::GetToolsVersion() const return "14.0"; case cmGlobalVisualStudioGenerator::VS15: return "15.0"; + case cmGlobalVisualStudioGenerator::VS16: + return "16.0"; } return ""; } diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index dc8de03..57510df 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -86,6 +86,8 @@ const char* cmGlobalVisualStudioGenerator::GetIDEVersion() const return "14.0"; case cmGlobalVisualStudioGenerator::VS15: return "15.0"; + case cmGlobalVisualStudioGenerator::VS16: + return "16.0"; } return ""; } @@ -139,6 +141,15 @@ void cmGlobalVisualStudioGenerator::WriteSLNHeader(std::ostream& fout) fout << "# Visual Studio 15\n"; } break; + case cmGlobalVisualStudioGenerator::VS16: + // Visual Studio 16 writes .sln format 12.00 + fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n"; + if (this->ExpressEdition) { + fout << "# Visual Studio Express 16 for Windows Desktop\n"; + } else { + fout << "# Visual Studio 16\n"; + } + break; } } diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index d44f5a5..039191c 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -38,7 +38,8 @@ public: VS12 = 120, /* VS13 = 130 was skipped */ VS14 = 140, - VS15 = 150 + VS15 = 150, + VS16 = 160 }; virtual ~cmGlobalVisualStudioGenerator(); diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx index 7d04be2..f06c019 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx +++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx @@ -8,6 +8,16 @@ #include "cmMakefile.h" #include "cmVSSetupHelper.h" +#if defined(_M_ARM64) +# define HOST_PLATFORM_NAME "ARM64"; +#elif defined(_M_ARM) +# define HOST_PLATFORM_NAME "ARM"; +#elif defined(_M_IA64) +# define HOST_PLATFORM_NAME "Itanium"; +#else +# include "cmsys/SystemInformation.hxx" +#endif + static unsigned int VSVersionToMajor( cmGlobalVisualStudioGenerator::VSVersion v) { @@ -24,10 +34,35 @@ static unsigned int VSVersionToMajor( return 14; case cmGlobalVisualStudioGenerator::VS15: return 15; + case cmGlobalVisualStudioGenerator::VS16: + return 16; } return 0; } +static const char* VSVersionToToolset( + cmGlobalVisualStudioGenerator::VSVersion v) +{ + switch (v) { + case cmGlobalVisualStudioGenerator::VS9: + return "v90"; + case cmGlobalVisualStudioGenerator::VS10: + return "v100"; + case cmGlobalVisualStudioGenerator::VS11: + return "v110"; + case cmGlobalVisualStudioGenerator::VS12: + return "v120"; + case cmGlobalVisualStudioGenerator::VS14: + return "v140"; + case cmGlobalVisualStudioGenerator::VS15: + return "v141"; + case cmGlobalVisualStudioGenerator::VS16: + // FIXME: VS 2019 Preview 1.1 uses v141 but preview 2 will use v142. + return "v141"; + } + return ""; +} + static const char vs15generatorName[] = "Visual Studio 15 2017"; // Map generator name without year to name with year. @@ -99,18 +134,88 @@ cmGlobalVisualStudioVersionedGenerator::NewFactory15() return new Factory15; } +static const char vs16generatorName[] = "Visual Studio 16 2019"; + +// Map generator name without year to name with year. +static const char* cmVS16GenName(const std::string& name, std::string& genName) +{ + if (strncmp(name.c_str(), vs16generatorName, + sizeof(vs16generatorName) - 6) != 0) { + return 0; + } + const char* p = name.c_str() + sizeof(vs16generatorName) - 6; + if (cmHasLiteralPrefix(p, " 2019")) { + p += 5; + } + genName = std::string(vs16generatorName) + p; + return p; +} + +class cmGlobalVisualStudioVersionedGenerator::Factory16 + : public cmGlobalGeneratorFactory +{ +public: + virtual cmGlobalGenerator* CreateGlobalGenerator(const std::string& name, + cmake* cm) const + { + std::string genName; + const char* p = cmVS16GenName(name, genName); + if (!p) { + return 0; + } + if (!*p) { + return new cmGlobalVisualStudioVersionedGenerator( + cmGlobalVisualStudioGenerator::VS16, cm, genName, ""); + } + return 0; + } + + virtual void GetDocumentation(cmDocumentationEntry& entry) const + { + entry.Name = std::string(vs16generatorName); + entry.Brief = "Generates Visual Studio 2019 project files. " + "Use -A option to specify architecture."; + } + + virtual void GetGenerators(std::vector& names) const + { + names.push_back(vs16generatorName); + } + + bool SupportsToolset() const override { return true; } + bool SupportsPlatform() const override { return true; } +}; + +cmGlobalGeneratorFactory* +cmGlobalVisualStudioVersionedGenerator::NewFactory16() +{ + return new Factory16; +} + cmGlobalVisualStudioVersionedGenerator::cmGlobalVisualStudioVersionedGenerator( VSVersion version, cmake* cm, const std::string& name, std::string const& platformInGeneratorName) : cmGlobalVisualStudio14Generator(cm, name, platformInGeneratorName) , vsSetupAPIHelper(VSVersionToMajor(version)) { - this->ExpressEdition = false; - this->DefaultPlatformToolset = "v141"; - this->DefaultCLFlagTableName = "v141"; - this->DefaultCSharpFlagTableName = "v141"; - this->DefaultLinkFlagTableName = "v141"; this->Version = version; + this->ExpressEdition = false; + this->DefaultPlatformToolset = VSVersionToToolset(this->Version); + this->DefaultCLFlagTableName = VSVersionToToolset(this->Version); + this->DefaultCSharpFlagTableName = VSVersionToToolset(this->Version); + this->DefaultLinkFlagTableName = VSVersionToToolset(this->Version); + if (this->Version >= cmGlobalVisualStudioGenerator::VS16) { +#ifdef HOST_PLATFORM_NAME + this->DefaultPlatformName = HOST_PLATFORM_NAME; +#else + cmsys::SystemInformation info; + if (info.Is64Bits()) { + this->DefaultPlatformName = "x64"; + } else { + this->DefaultPlatformName = "Win32"; + } +#endif + } } bool cmGlobalVisualStudioVersionedGenerator::MatchesGeneratorName( @@ -129,6 +234,11 @@ bool cmGlobalVisualStudioVersionedGenerator::MatchesGeneratorName( return genName == this->GetName(); } break; + case cmGlobalVisualStudioGenerator::VS16: + if (cmVS16GenName(name, genName)) { + return genName == this->GetName(); + } + break; } return false; } @@ -239,7 +349,7 @@ bool cmGlobalVisualStudioVersionedGenerator::SelectWindowsStoreToolset( if (cmHasLiteralPrefix(this->SystemVersion, "10.0")) { if (this->IsWindowsStoreToolsetInstalled() && this->IsWindowsDesktopToolsetInstalled()) { - toolset = "v141"; // VS 15 uses v141 toolset + toolset = VSVersionToToolset(this->Version); return true; } else { return false; @@ -296,6 +406,10 @@ std::string cmGlobalVisualStudioVersionedGenerator::FindMSBuildCommand() // Ask Visual Studio Installer tool. std::string vs; if (vsSetupAPIHelper.GetVSInstanceInfo(vs)) { + msbuild = vs + "/MSBuild/Current/Bin/MSBuild.exe"; + if (cmSystemTools::FileExists(msbuild)) { + return msbuild; + } msbuild = vs + "/MSBuild/15.0/Bin/MSBuild.exe"; if (cmSystemTools::FileExists(msbuild)) { return msbuild; diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.h b/Source/cmGlobalVisualStudioVersionedGenerator.h index 531f5a6..466816b 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.h +++ b/Source/cmGlobalVisualStudioVersionedGenerator.h @@ -20,6 +20,7 @@ class cmGlobalVisualStudioVersionedGenerator { public: static cmGlobalGeneratorFactory* NewFactory15(); + static cmGlobalGeneratorFactory* NewFactory16(); bool MatchesGeneratorName(const std::string& name) const override; @@ -57,6 +58,8 @@ protected: private: class Factory15; friend class Factory15; + class Factory16; + friend class Factory16; mutable cmVSSetupAPIHelper vsSetupAPIHelper; }; #endif diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index afe9230..5c3e533 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -70,6 +70,7 @@ void cmVisualStudioGeneratorOptions::FixExceptionHandlingDefault() case cmGlobalVisualStudioGenerator::VS12: case cmGlobalVisualStudioGenerator::VS14: case cmGlobalVisualStudioGenerator::VS15: + case cmGlobalVisualStudioGenerator::VS16: // by default VS puts empty // for a project, to make our projects look the same put a new line // and space over for the closing as the default diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 1d062f4..1541810 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1538,7 +1538,9 @@ void cmake::CreateDefaultGlobalGenerator() "\\Setup\\VC;ProductDir", // ";InstallDir" // }; - if (cmVSSetupAPIHelper(15).IsVSInstalled()) { + if (cmVSSetupAPIHelper(16).IsVSInstalled()) { + found = "Visual Studio 16 2019"; + } else if (cmVSSetupAPIHelper(15).IsVSInstalled()) { found = "Visual Studio 15 2017"; } else { for (VSVersionedGenerator const* g = cm::cbegin(vsGenerators); @@ -1793,6 +1795,8 @@ void cmake::AddDefaultGenerators() #if defined(_WIN32) && !defined(__CYGWIN__) # if !defined(CMAKE_BOOT_MINGW) this->Generators.push_back( + cmGlobalVisualStudioVersionedGenerator::NewFactory16()); + this->Generators.push_back( cmGlobalVisualStudioVersionedGenerator::NewFactory15()); this->Generators.push_back(cmGlobalVisualStudio14Generator::NewFactory()); this->Generators.push_back(cmGlobalVisualStudio12Generator::NewFactory()); diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 5afa242..2b6519a 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -334,7 +334,7 @@ if (GTK2_FOUND) endif() if("${CMAKE_GENERATOR}" MATCHES "Visual Studio") - add_RunCMake_test(include_external_msproject) + add_RunCMake_test(include_external_msproject -DVS_PLATFORM_NAME=${CMAKE_VS_PLATFORM_NAME}) if("${CMAKE_GENERATOR}" MATCHES "Visual Studio (9|10)" AND NOT CMAKE_VS_DEVENV_COMMAND) set(NO_USE_FOLDERS 1) endif() diff --git a/Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake index 27250cb..27ede06 100644 --- a/Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake @@ -3,7 +3,7 @@ include(RunCMake) set(RunCMake_GENERATOR_PLATFORM "") run_cmake(NoPlatform) -if("${RunCMake_GENERATOR}" MATCHES "^Visual Studio ([89]|1[01245])( 20[0-9][0-9])?$") +if("${RunCMake_GENERATOR}" MATCHES "^Visual Studio ([89]|1[012456])( 20[0-9][0-9])?$") set(RunCMake_GENERATOR_PLATFORM "x64") run_cmake(x64Platform) else() @@ -17,7 +17,7 @@ set(RunCMake_TEST_OPTIONS -A "Extra Platform") run_cmake(TwoPlatforms) unset(RunCMake_TEST_OPTIONS) -if("${RunCMake_GENERATOR}" MATCHES "^Visual Studio ([89]|1[01245])( 20[0-9][0-9])?$") +if("${RunCMake_GENERATOR}" MATCHES "^Visual Studio ([89]|1[012456])( 20[0-9][0-9])?$") set(RunCMake_TEST_OPTIONS -DCMAKE_TOOLCHAIN_FILE=${RunCMake_SOURCE_DIR}/TestPlatform-toolchain.cmake) run_cmake(TestPlatformToolchain) unset(RunCMake_TEST_OPTIONS) diff --git a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake index d1738a0..ccf58b4 100644 --- a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake @@ -3,7 +3,7 @@ include(RunCMake) set(RunCMake_GENERATOR_TOOLSET "") run_cmake(NoToolset) -if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[01245]") +if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[012456]") set(RunCMake_GENERATOR_TOOLSET "Test Toolset") run_cmake(TestToolset) set(RunCMake_GENERATOR_TOOLSET "Test Toolset,cuda=Test Cuda") @@ -12,7 +12,7 @@ if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[01245]") run_cmake(TestToolsetCudaOnly) set(RunCMake_GENERATOR_TOOLSET "cuda=Test Cuda") run_cmake(TestToolsetCudaOnly) - if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[245]") + if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[2456]") set(RunCMake_GENERATOR_TOOLSET "Test Toolset,host=x64") run_cmake(TestToolsetHostArchBoth) set(RunCMake_GENERATOR_TOOLSET ",host=x64") @@ -25,7 +25,7 @@ if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[01245]") run_cmake(BadToolsetHostArch) set(RunCMake_GENERATOR_TOOLSET "Test Toolset,host=x64,host=x64") run_cmake(BadToolsetHostArchTwice) - if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 15") + if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[56]") set(RunCMake_GENERATOR_TOOLSET "Test Toolset,version=Test Toolset Version") run_cmake(TestToolsetVersionBoth) set(RunCMake_GENERATOR_TOOLSET ",version=Test Toolset Version") @@ -59,7 +59,7 @@ set(RunCMake_TEST_OPTIONS -T "Extra Toolset") run_cmake(TwoToolsets) unset(RunCMake_TEST_OPTIONS) -if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[01245]|Xcode") +if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[012456]|Xcode") set(RunCMake_TEST_OPTIONS -DCMAKE_TOOLCHAIN_FILE=${RunCMake_SOURCE_DIR}/TestToolset-toolchain.cmake) run_cmake(TestToolsetToolchain) unset(RunCMake_TEST_OPTIONS) diff --git a/Tests/RunCMake/include_external_msproject/check_utils.cmake b/Tests/RunCMake/include_external_msproject/check_utils.cmake index e9e9cac..0a2ba63 100644 --- a/Tests/RunCMake/include_external_msproject/check_utils.cmake +++ b/Tests/RunCMake/include_external_msproject/check_utils.cmake @@ -100,6 +100,8 @@ function(check_project test name guid type platform imported_release_config_name set(platform "${RunCMake_GENERATOR_PLATFORM}") elseif("${RunCMake_GENERATOR}" MATCHES "Win64") set(platform "x64") + elseif(VS_PLATFORM_NAME) + set(platform "${VS_PLATFORM_NAME}") else() set(platform "Win32") endif() diff --git a/Tests/VSExternalInclude/CMakeLists.txt b/Tests/VSExternalInclude/CMakeLists.txt index 7465243..8ca7252 100644 --- a/Tests/VSExternalInclude/CMakeLists.txt +++ b/Tests/VSExternalInclude/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required (VERSION 2.6) project(VSExternalInclude) -if(${CMAKE_GENERATOR} MATCHES "Visual Studio 1[01245]") +if(${CMAKE_GENERATOR} MATCHES "Visual Studio 1[012456]") set(PROJECT_EXT vcxproj) else() set(PROJECT_EXT vcproj) @@ -55,7 +55,7 @@ add_dependencies(VSExternalInclude lib2) # and the sln file can no longer be the only source # of that depend. So, for VS 10 make the executable # depend on lib1 and lib2 -if(${CMAKE_GENERATOR} MATCHES "Visual Studio 1[01245]") +if(${CMAKE_GENERATOR} MATCHES "Visual Studio 1[012456]") add_dependencies(VSExternalInclude lib1) endif() https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bdef729646a5a559c295ef9c0fb83eb8a6b34905 commit bdef729646a5a559c295ef9c0fb83eb8a6b34905 Author: Brad King AuthorDate: Wed Jan 9 11:39:32 2019 -0500 Commit: Brad King CommitDate: Fri Jan 11 10:37:41 2019 -0500 VS: Parameterize VS 2017 generator to support future versions diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx index 354af72..7d04be2 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx +++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx @@ -8,6 +8,26 @@ #include "cmMakefile.h" #include "cmVSSetupHelper.h" +static unsigned int VSVersionToMajor( + cmGlobalVisualStudioGenerator::VSVersion v) +{ + switch (v) { + case cmGlobalVisualStudioGenerator::VS9: + return 9; + case cmGlobalVisualStudioGenerator::VS10: + return 10; + case cmGlobalVisualStudioGenerator::VS11: + return 11; + case cmGlobalVisualStudioGenerator::VS12: + return 12; + case cmGlobalVisualStudioGenerator::VS14: + return 14; + case cmGlobalVisualStudioGenerator::VS15: + return 15; + } + return 0; +} + static const char vs15generatorName[] = "Visual Studio 15 2017"; // Map generator name without year to name with year. @@ -38,16 +58,19 @@ public: return 0; } if (!*p) { - return new cmGlobalVisualStudioVersionedGenerator(cm, genName, ""); + return new cmGlobalVisualStudioVersionedGenerator( + cmGlobalVisualStudioGenerator::VS15, cm, genName, ""); } if (*p++ != ' ') { return 0; } if (strcmp(p, "Win64") == 0) { - return new cmGlobalVisualStudioVersionedGenerator(cm, genName, "x64"); + return new cmGlobalVisualStudioVersionedGenerator( + cmGlobalVisualStudioGenerator::VS15, cm, genName, "x64"); } if (strcmp(p, "ARM") == 0) { - return new cmGlobalVisualStudioVersionedGenerator(cm, genName, "ARM"); + return new cmGlobalVisualStudioVersionedGenerator( + cmGlobalVisualStudioGenerator::VS15, cm, genName, "ARM"); } return 0; } @@ -77,25 +100,35 @@ cmGlobalVisualStudioVersionedGenerator::NewFactory15() } cmGlobalVisualStudioVersionedGenerator::cmGlobalVisualStudioVersionedGenerator( - cmake* cm, const std::string& name, + VSVersion version, cmake* cm, const std::string& name, std::string const& platformInGeneratorName) : cmGlobalVisualStudio14Generator(cm, name, platformInGeneratorName) - , vsSetupAPIHelper(15) + , vsSetupAPIHelper(VSVersionToMajor(version)) { this->ExpressEdition = false; this->DefaultPlatformToolset = "v141"; this->DefaultCLFlagTableName = "v141"; this->DefaultCSharpFlagTableName = "v141"; this->DefaultLinkFlagTableName = "v141"; - this->Version = VS15; + this->Version = version; } bool cmGlobalVisualStudioVersionedGenerator::MatchesGeneratorName( const std::string& name) const { std::string genName; - if (cmVS15GenName(name, genName)) { - return genName == this->GetName(); + switch (this->Version) { + case cmGlobalVisualStudioGenerator::VS9: + case cmGlobalVisualStudioGenerator::VS10: + case cmGlobalVisualStudioGenerator::VS11: + case cmGlobalVisualStudioGenerator::VS12: + case cmGlobalVisualStudioGenerator::VS14: + break; + case cmGlobalVisualStudioGenerator::VS15: + if (cmVS15GenName(name, genName)) { + return genName == this->GetName(); + } + break; } return false; } diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.h b/Source/cmGlobalVisualStudioVersionedGenerator.h index 2ffd568..531f5a6 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.h +++ b/Source/cmGlobalVisualStudioVersionedGenerator.h @@ -32,7 +32,7 @@ public: protected: cmGlobalVisualStudioVersionedGenerator( - cmake* cm, const std::string& name, + VSVersion version, cmake* cm, const std::string& name, std::string const& platformInGeneratorName); bool InitializeWindows(cmMakefile* mf) override; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=68d316e0cf278021d9fa4553471d29803d09a394 commit 68d316e0cf278021d9fa4553471d29803d09a394 Author: Brad King AuthorDate: Wed Jan 9 10:26:49 2019 -0500 Commit: Brad King CommitDate: Fri Jan 11 10:37:39 2019 -0500 VS: Rename VS 2017 generator sources to be version-independent Rename `cmGlobalVisualStudio{15 => Versioned}Generator`. Rename `Factory` to `Factory15` since that part still needs to be version-specific. diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 91c45bc..c87ceba 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -696,10 +696,10 @@ if (WIN32) cmGlobalVisualStudio12Generator.cxx cmGlobalVisualStudio14Generator.h cmGlobalVisualStudio14Generator.cxx - cmGlobalVisualStudio15Generator.h - cmGlobalVisualStudio15Generator.cxx cmGlobalVisualStudioGenerator.cxx cmGlobalVisualStudioGenerator.h + cmGlobalVisualStudioVersionedGenerator.h + cmGlobalVisualStudioVersionedGenerator.cxx cmIDEFlagTable.h cmIDEOptions.cxx cmIDEOptions.h diff --git a/Source/cmCMakeHostSystemInformationCommand.cxx b/Source/cmCMakeHostSystemInformationCommand.cxx index a2423ac..ddc32c0 100644 --- a/Source/cmCMakeHostSystemInformationCommand.cxx +++ b/Source/cmCMakeHostSystemInformationCommand.cxx @@ -10,7 +10,7 @@ #if defined(_WIN32) # include "cmAlgorithms.h" # include "cmGlobalGenerator.h" -# include "cmGlobalVisualStudio15Generator.h" +# include "cmGlobalVisualStudioVersionedGenerator.h" # include "cmSystemTools.h" # include "cmVSSetupHelper.h" # define HAVE_VS_SETUP_HELPER @@ -133,8 +133,8 @@ bool cmCMakeHostSystemInformationCommand::GetValue( // If generating for the VS 15 IDE, use the same instance. cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator(); if (cmHasLiteralPrefix(gg->GetName(), "Visual Studio 15 ")) { - cmGlobalVisualStudio15Generator* vs15gen = - static_cast(gg); + cmGlobalVisualStudioVersionedGenerator* vs15gen = + static_cast(gg); if (vs15gen->GetVSInstance(value)) { return true; } diff --git a/Source/cmGlobalVisualStudio15Generator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx similarity index 81% rename from Source/cmGlobalVisualStudio15Generator.cxx rename to Source/cmGlobalVisualStudioVersionedGenerator.cxx index f9fcbdf..354af72 100644 --- a/Source/cmGlobalVisualStudio15Generator.cxx +++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx @@ -1,6 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#include "cmGlobalVisualStudio15Generator.h" +#include "cmGlobalVisualStudioVersionedGenerator.h" #include "cmAlgorithms.h" #include "cmDocumentationEntry.h" @@ -25,7 +25,7 @@ static const char* cmVS15GenName(const std::string& name, std::string& genName) return p; } -class cmGlobalVisualStudio15Generator::Factory +class cmGlobalVisualStudioVersionedGenerator::Factory15 : public cmGlobalGeneratorFactory { public: @@ -38,16 +38,16 @@ public: return 0; } if (!*p) { - return new cmGlobalVisualStudio15Generator(cm, genName, ""); + return new cmGlobalVisualStudioVersionedGenerator(cm, genName, ""); } if (*p++ != ' ') { return 0; } if (strcmp(p, "Win64") == 0) { - return new cmGlobalVisualStudio15Generator(cm, genName, "x64"); + return new cmGlobalVisualStudioVersionedGenerator(cm, genName, "x64"); } if (strcmp(p, "ARM") == 0) { - return new cmGlobalVisualStudio15Generator(cm, genName, "ARM"); + return new cmGlobalVisualStudioVersionedGenerator(cm, genName, "ARM"); } return 0; } @@ -70,12 +70,13 @@ public: bool SupportsPlatform() const override { return true; } }; -cmGlobalGeneratorFactory* cmGlobalVisualStudio15Generator::NewFactory() +cmGlobalGeneratorFactory* +cmGlobalVisualStudioVersionedGenerator::NewFactory15() { - return new Factory; + return new Factory15; } -cmGlobalVisualStudio15Generator::cmGlobalVisualStudio15Generator( +cmGlobalVisualStudioVersionedGenerator::cmGlobalVisualStudioVersionedGenerator( cmake* cm, const std::string& name, std::string const& platformInGeneratorName) : cmGlobalVisualStudio14Generator(cm, name, platformInGeneratorName) @@ -89,7 +90,7 @@ cmGlobalVisualStudio15Generator::cmGlobalVisualStudio15Generator( this->Version = VS15; } -bool cmGlobalVisualStudio15Generator::MatchesGeneratorName( +bool cmGlobalVisualStudioVersionedGenerator::MatchesGeneratorName( const std::string& name) const { std::string genName; @@ -99,7 +100,7 @@ bool cmGlobalVisualStudio15Generator::MatchesGeneratorName( return false; } -bool cmGlobalVisualStudio15Generator::SetGeneratorInstance( +bool cmGlobalVisualStudioVersionedGenerator::SetGeneratorInstance( std::string const& i, cmMakefile* mf) { if (!i.empty()) { @@ -141,12 +142,13 @@ bool cmGlobalVisualStudio15Generator::SetGeneratorInstance( return true; } -bool cmGlobalVisualStudio15Generator::GetVSInstance(std::string& dir) const +bool cmGlobalVisualStudioVersionedGenerator::GetVSInstance( + std::string& dir) const { return vsSetupAPIHelper.GetVSInstanceInfo(dir); } -bool cmGlobalVisualStudio15Generator::IsDefaultToolset( +bool cmGlobalVisualStudioVersionedGenerator::IsDefaultToolset( const std::string& version) const { if (version.empty()) { @@ -167,7 +169,7 @@ bool cmGlobalVisualStudio15Generator::IsDefaultToolset( return false; } -std::string cmGlobalVisualStudio15Generator::GetAuxiliaryToolset() const +std::string cmGlobalVisualStudioVersionedGenerator::GetAuxiliaryToolset() const { const char* version = this->GetPlatformToolsetVersion(); if (version) { @@ -186,7 +188,7 @@ std::string cmGlobalVisualStudio15Generator::GetAuxiliaryToolset() const return {}; } -bool cmGlobalVisualStudio15Generator::InitializeWindows(cmMakefile* mf) +bool cmGlobalVisualStudioVersionedGenerator::InitializeWindows(cmMakefile* mf) { // If the Win 8.1 SDK is installed then we can select a SDK matching // the target Windows version. @@ -198,7 +200,7 @@ bool cmGlobalVisualStudio15Generator::InitializeWindows(cmMakefile* mf) return this->SelectWindows10SDK(mf, false); } -bool cmGlobalVisualStudio15Generator::SelectWindowsStoreToolset( +bool cmGlobalVisualStudioVersionedGenerator::SelectWindowsStoreToolset( std::string& toolset) const { if (cmHasLiteralPrefix(this->SystemVersion, "10.0")) { @@ -214,17 +216,19 @@ bool cmGlobalVisualStudio15Generator::SelectWindowsStoreToolset( toolset); } -bool cmGlobalVisualStudio15Generator::IsWindowsDesktopToolsetInstalled() const +bool cmGlobalVisualStudioVersionedGenerator::IsWindowsDesktopToolsetInstalled() + const { return vsSetupAPIHelper.IsVSInstalled(); } -bool cmGlobalVisualStudio15Generator::IsWindowsStoreToolsetInstalled() const +bool cmGlobalVisualStudioVersionedGenerator::IsWindowsStoreToolsetInstalled() + const { return vsSetupAPIHelper.IsWin10SDKInstalled(); } -bool cmGlobalVisualStudio15Generator::IsWin81SDKInstalled() const +bool cmGlobalVisualStudioVersionedGenerator::IsWin81SDKInstalled() const { // Does the VS installer tool know about one? if (vsSetupAPIHelper.IsWin81SDKInstalled()) { @@ -246,12 +250,13 @@ bool cmGlobalVisualStudio15Generator::IsWin81SDKInstalled() const return false; } -std::string cmGlobalVisualStudio15Generator::GetWindows10SDKMaxVersion() const +std::string cmGlobalVisualStudioVersionedGenerator::GetWindows10SDKMaxVersion() + const { return std::string(); } -std::string cmGlobalVisualStudio15Generator::FindMSBuildCommand() +std::string cmGlobalVisualStudioVersionedGenerator::FindMSBuildCommand() { std::string msbuild; @@ -268,7 +273,7 @@ std::string cmGlobalVisualStudio15Generator::FindMSBuildCommand() return msbuild; } -std::string cmGlobalVisualStudio15Generator::FindDevEnvCommand() +std::string cmGlobalVisualStudioVersionedGenerator::FindDevEnvCommand() { std::string devenv; diff --git a/Source/cmGlobalVisualStudio15Generator.h b/Source/cmGlobalVisualStudioVersionedGenerator.h similarity index 75% rename from Source/cmGlobalVisualStudio15Generator.h rename to Source/cmGlobalVisualStudioVersionedGenerator.h index da85d23..2ffd568 100644 --- a/Source/cmGlobalVisualStudio15Generator.h +++ b/Source/cmGlobalVisualStudioVersionedGenerator.h @@ -1,7 +1,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGlobalVisualStudio15Generator_h -#define cmGlobalVisualStudio15Generator_h +#ifndef cmGlobalVisualStudioVersionedGenerator_h +#define cmGlobalVisualStudioVersionedGenerator_h #include "cmConfigure.h" // IWYU pragma: keep @@ -14,11 +14,12 @@ class cmGlobalGeneratorFactory; class cmake; -/** \class cmGlobalVisualStudio15Generator */ -class cmGlobalVisualStudio15Generator : public cmGlobalVisualStudio14Generator +/** \class cmGlobalVisualStudioVersionedGenerator */ +class cmGlobalVisualStudioVersionedGenerator + : public cmGlobalVisualStudio14Generator { public: - static cmGlobalGeneratorFactory* NewFactory(); + static cmGlobalGeneratorFactory* NewFactory15(); bool MatchesGeneratorName(const std::string& name) const override; @@ -30,8 +31,9 @@ public: std::string GetAuxiliaryToolset() const override; protected: - cmGlobalVisualStudio15Generator(cmake* cm, const std::string& name, - std::string const& platformInGeneratorName); + cmGlobalVisualStudioVersionedGenerator( + cmake* cm, const std::string& name, + std::string const& platformInGeneratorName); bool InitializeWindows(cmMakefile* mf) override; bool SelectWindowsStoreToolset(std::string& toolset) const override; @@ -53,8 +55,8 @@ protected: std::string FindDevEnvCommand() override; private: - class Factory; - friend class Factory; + class Factory15; + friend class Factory15; mutable cmVSSetupAPIHelper vsSetupAPIHelper; }; #endif diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 195956b..1d062f4 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -55,8 +55,8 @@ # include "cmGlobalVisualStudio11Generator.h" # include "cmGlobalVisualStudio12Generator.h" # include "cmGlobalVisualStudio14Generator.h" -# include "cmGlobalVisualStudio15Generator.h" # include "cmGlobalVisualStudio9Generator.h" +# include "cmGlobalVisualStudioVersionedGenerator.h" # include "cmVSSetupHelper.h" # define CMAKE_HAVE_VS_GENERATORS @@ -1792,7 +1792,8 @@ void cmake::AddDefaultGenerators() { #if defined(_WIN32) && !defined(__CYGWIN__) # if !defined(CMAKE_BOOT_MINGW) - this->Generators.push_back(cmGlobalVisualStudio15Generator::NewFactory()); + this->Generators.push_back( + cmGlobalVisualStudioVersionedGenerator::NewFactory15()); this->Generators.push_back(cmGlobalVisualStudio14Generator::NewFactory()); this->Generators.push_back(cmGlobalVisualStudio12Generator::NewFactory()); this->Generators.push_back(cmGlobalVisualStudio11Generator::NewFactory()); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d8ed309d0529d9a7b28da561c3640290a8041b68 commit d8ed309d0529d9a7b28da561c3640290a8041b68 Author: Brad King AuthorDate: Wed Jan 9 09:40:53 2019 -0500 Commit: Brad King CommitDate: Fri Jan 11 10:37:38 2019 -0500 VS: Parameterize cmVSSetupAPIHelper instances with VS version diff --git a/Source/cmCMakeHostSystemInformationCommand.cxx b/Source/cmCMakeHostSystemInformationCommand.cxx index 8822942..a2423ac 100644 --- a/Source/cmCMakeHostSystemInformationCommand.cxx +++ b/Source/cmCMakeHostSystemInformationCommand.cxx @@ -141,7 +141,7 @@ bool cmCMakeHostSystemInformationCommand::GetValue( } // Otherwise, find a VS 15 instance ourselves. - cmVSSetupAPIHelper vsSetupAPIHelper; + cmVSSetupAPIHelper vsSetupAPIHelper(15); if (vsSetupAPIHelper.GetVSInstanceInfo(value)) { cmSystemTools::ConvertToUnixSlashes(value); } diff --git a/Source/cmGlobalVisualStudio15Generator.cxx b/Source/cmGlobalVisualStudio15Generator.cxx index eb49e87..f9fcbdf 100644 --- a/Source/cmGlobalVisualStudio15Generator.cxx +++ b/Source/cmGlobalVisualStudio15Generator.cxx @@ -79,6 +79,7 @@ cmGlobalVisualStudio15Generator::cmGlobalVisualStudio15Generator( cmake* cm, const std::string& name, std::string const& platformInGeneratorName) : cmGlobalVisualStudio14Generator(cm, name, platformInGeneratorName) + , vsSetupAPIHelper(15) { this->ExpressEdition = false; this->DefaultPlatformToolset = "v141"; @@ -215,7 +216,7 @@ bool cmGlobalVisualStudio15Generator::SelectWindowsStoreToolset( bool cmGlobalVisualStudio15Generator::IsWindowsDesktopToolsetInstalled() const { - return vsSetupAPIHelper.IsVS2017Installed(); + return vsSetupAPIHelper.IsVSInstalled(); } bool cmGlobalVisualStudio15Generator::IsWindowsStoreToolsetInstalled() const diff --git a/Source/cmVSSetupHelper.cxx b/Source/cmVSSetupHelper.cxx index d80b5a2..9187c29 100644 --- a/Source/cmVSSetupHelper.cxx +++ b/Source/cmVSSetupHelper.cxx @@ -57,8 +57,9 @@ std::string VSInstanceInfo::GetInstallLocation() const return loc; } -cmVSSetupAPIHelper::cmVSSetupAPIHelper() - : setupConfig(NULL) +cmVSSetupAPIHelper::cmVSSetupAPIHelper(unsigned int version) + : Version(version) + , setupConfig(NULL) , setupConfig2(NULL) , setupHelper(NULL) , initializationFailure(false) @@ -88,7 +89,7 @@ bool cmVSSetupAPIHelper::SetVSInstance(std::string const& vsInstallLocation) return this->EnumerateAndChooseVSInstance(); } -bool cmVSSetupAPIHelper::IsVS2017Installed() +bool cmVSSetupAPIHelper::IsVSInstalled() { return this->EnumerateAndChooseVSInstance(); } @@ -312,11 +313,11 @@ bool cmVSSetupAPIHelper::EnumerateAndChooseVSInstance() return false; std::string envVSCommonToolsDir; + std::string envVSCommonToolsDirEnvName = + "VS" + std::to_string(this->Version) + "0COMNTOOLS"; - // FIXME: When we support VS versions beyond 2017, the version - // to choose will be passed in by the caller. We need to map that - // to a per-version name of this environment variable. - if (cmSystemTools::GetEnv("VS150COMNTOOLS", envVSCommonToolsDir)) { + if (cmSystemTools::GetEnv(envVSCommonToolsDirEnvName.c_str(), + envVSCommonToolsDir)) { cmSystemTools::ConvertToUnixSlashes(envVSCommonToolsDir); } @@ -328,8 +329,7 @@ bool cmVSSetupAPIHelper::EnumerateAndChooseVSInstance() return false; } - // FIXME: Add a way for caller to specify other versions. - std::wstring wantVersion = std::to_wstring(15) + L'.'; + std::wstring const wantVersion = std::to_wstring(this->Version) + L'.'; SmartCOMPtr instance; while (SUCCEEDED(enumInstances->Next(1, &instance, NULL)) && instance) { diff --git a/Source/cmVSSetupHelper.h b/Source/cmVSSetupHelper.h index b9cca45..4748a7a 100644 --- a/Source/cmVSSetupHelper.h +++ b/Source/cmVSSetupHelper.h @@ -120,12 +120,12 @@ struct VSInstanceInfo class cmVSSetupAPIHelper { public: - cmVSSetupAPIHelper(); + cmVSSetupAPIHelper(unsigned int version); ~cmVSSetupAPIHelper(); bool SetVSInstance(std::string const& vsInstallLocation); - bool IsVS2017Installed(); + bool IsVSInstalled(); bool GetVSInstanceInfo(std::string& vsInstallLocation); bool GetVCToolsetVersion(std::string& vsToolsetVersion); bool IsWin10SDKInstalled(); @@ -140,6 +140,8 @@ private: int ChooseVSInstance(const std::vector& vecVSInstances); bool EnumerateAndChooseVSInstance(); + unsigned int Version; + // COM ptrs to query about VS instances SmartCOMPtr setupConfig; SmartCOMPtr setupConfig2; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index e1bae34..195956b 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1538,8 +1538,7 @@ void cmake::CreateDefaultGlobalGenerator() "\\Setup\\VC;ProductDir", // ";InstallDir" // }; - cmVSSetupAPIHelper vsSetupAPIHelper; - if (vsSetupAPIHelper.IsVS2017Installed()) { + if (cmVSSetupAPIHelper(15).IsVSInstalled()) { found = "Visual Studio 15 2017"; } else { for (VSVersionedGenerator const* g = cm::cbegin(vsGenerators); ----------------------------------------------------------------------- Summary of changes: ...tudio 15 2017.rst => Visual Studio 16 2019.rst} | 30 +-- Help/manual/cmake-generators.7.rst | 1 + Help/release/dev/vs2019.rst | 13 ++ Help/variable/MSVC_VERSION.rst | 1 + Modules/FetchContent.cmake | 7 + Modules/FetchContent/CMakeLists.cmake.in | 2 + Source/CMakeLists.txt | 4 +- Source/cmCMakeHostSystemInformationCommand.cxx | 24 ++- Source/cmGlobalVisualStudio10Generator.cxx | 2 + Source/cmGlobalVisualStudioGenerator.cxx | 11 ++ Source/cmGlobalVisualStudioGenerator.h | 3 +- ... => cmGlobalVisualStudioVersionedGenerator.cxx} | 215 ++++++++++++++++++--- ....h => cmGlobalVisualStudioVersionedGenerator.h} | 23 ++- Source/cmVSSetupHelper.cxx | 18 +- Source/cmVSSetupHelper.h | 6 +- Source/cmVisualStudioGeneratorOptions.cxx | 1 + Source/cmake.cxx | 12 +- Tests/RunCMake/CMakeLists.txt | 2 +- Tests/RunCMake/FetchContent/CMakeLists.txt | 4 + Tests/RunCMake/FetchContent/RunCMakeTest.cmake | 1 + .../FetchContent/UsesTerminalOverride-stdout.txt | 2 + .../FetchContent/UsesTerminalOverride.cmake | 17 ++ .../RunCMake/GeneratorPlatform/RunCMakeTest.cmake | 4 +- Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake | 8 +- .../include_external_msproject/check_utils.cmake | 2 + Tests/VSExternalInclude/CMakeLists.txt | 4 +- 26 files changed, 326 insertions(+), 91 deletions(-) copy Help/generator/{Visual Studio 15 2017.rst => Visual Studio 16 2019.rst} (60%) create mode 100644 Help/release/dev/vs2019.rst rename Source/{cmGlobalVisualStudio15Generator.cxx => cmGlobalVisualStudioVersionedGenerator.cxx} (50%) rename Source/{cmGlobalVisualStudio15Generator.h => cmGlobalVisualStudioVersionedGenerator.h} (71%) create mode 100644 Tests/RunCMake/FetchContent/UsesTerminalOverride-stdout.txt create mode 100644 Tests/RunCMake/FetchContent/UsesTerminalOverride.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Wed Jan 16 00:03:06 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 16 Jan 2019 00:03:06 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-932-g7721b70 Message-ID: <20190116050306.DE95E11554A@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 7721b70e231c94188a8f5643fddad661fe6f1eb1 (commit) from da566d4de885130e182edc80f13691f5ca24bb61 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7721b70e231c94188a8f5643fddad661fe6f1eb1 commit 7721b70e231c94188a8f5643fddad661fe6f1eb1 Author: Kitware Robot AuthorDate: Wed Jan 16 00:01:07 2019 -0500 Commit: Kitware Robot CommitDate: Wed Jan 16 00:01:07 2019 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 7ae4417..1a300f2 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 13) -set(CMake_VERSION_PATCH 20190115) +set(CMake_VERSION_PATCH 20190116) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Wed Jan 16 09:53:10 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 16 Jan 2019 09:53:10 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-944-gbd54cc7 Message-ID: <20190116145310.857FE11F5B3@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via bd54cc774a5b14720a9e741fc40192ea11106443 (commit) via e2c39e05732409d60e7921b45a70dd8b9aa24b5a (commit) via e44cc45530b002546bae11a34e77a3a730fd14e4 (commit) via a8b447d72e13b3356893737adba0a46ea065f70d (commit) via 68a30b50a5894d0425122ae4bbfd40b0492ff116 (commit) via cc2a5261f82c21e15899bba0d9b508fcacda7879 (commit) via b056bc34258267c4ae59c72e3777d0a0f0b5a1b1 (commit) via b90e6134a7af7d6f81a410fac52f17c7585509eb (commit) via 5fe18eee1392c312612fad0e6f408ea7cb1ef29d (commit) via f2f166133402ad5f7998e0fef93b04f56c2f6d07 (commit) via b2343ff08682e23f61be27c4faf02f8e2c37abcf (commit) via c8ba777f6dfd7a5d8a4c4fa7b420bbdb5b93b366 (commit) from 7721b70e231c94188a8f5643fddad661fe6f1eb1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bd54cc774a5b14720a9e741fc40192ea11106443 commit bd54cc774a5b14720a9e741fc40192ea11106443 Merge: e2c39e0 b056bc3 Author: Brad King AuthorDate: Wed Jan 16 14:52:22 2019 +0000 Commit: Kitware Robot CommitDate: Wed Jan 16 09:52:45 2019 -0500 Merge topic 'semi-warnings' b056bc3425 Fix most clang -Wextra-semi-stmt warnings in C++ files Acked-by: Kitware Robot Merge-request: !2795 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e2c39e05732409d60e7921b45a70dd8b9aa24b5a commit e2c39e05732409d60e7921b45a70dd8b9aa24b5a Merge: e44cc45 b90e613 Author: Brad King AuthorDate: Wed Jan 16 14:52:01 2019 +0000 Commit: Kitware Robot CommitDate: Wed Jan 16 09:52:10 2019 -0500 Merge topic 'swift' b90e6134a7 Ninja: add new placeholder `SWIFT_AUXILIARY_SOURCES` Acked-by: Kitware Robot Acked-by: Cristian Hancila Acked-by: Aaron Dierking Merge-request: !2797 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e44cc45530b002546bae11a34e77a3a730fd14e4 commit e44cc45530b002546bae11a34e77a3a730fd14e4 Merge: a8b447d 5fe18ee Author: Brad King AuthorDate: Wed Jan 16 14:51:26 2019 +0000 Commit: Kitware Robot CommitDate: Wed Jan 16 09:51:33 2019 -0500 Merge topic 'autogen_adaptive_warning' 5fe18eee13 Autogen: Adaptive missing Qt warning f2f1661334 Autogen: Add and use QtAutoGen::Tools method b2343ff086 Autogen: Fix rcc validity check Acked-by: Kitware Robot Merge-request: !2806 diff --cc Source/cmQtAutoGenGlobalInitializer.cxx index cdd96ce,0b1995d..431c5bc --- a/Source/cmQtAutoGenGlobalInitializer.cxx +++ b/Source/cmQtAutoGenGlobalInitializer.cxx @@@ -102,27 -102,21 +102,21 @@@ cmQtAutoGenGlobalInitializer::cmQtAutoG std::string msg = "AUTOGEN: No valid Qt version found for target "; msg += target->GetName(); msg += ". "; - { - std::vector lst; - if (mocDisabled) { - lst.emplace_back("AUTOMOC"); - } - if (uicDisabled) { - lst.emplace_back("AUTOUIC"); - } - if (rccDisabled) { - lst.emplace_back("AUTORCC"); - } - msg += cmJoin(lst, ", "); - } + msg += cmQtAutoGen::Tools(mocDisabled, uicDisabled, rccDisabled); msg += " disabled. Consider adding:\n"; - if (uicDisabled) { - msg += " find_package(Qt5 COMPONENTS Widgets)\n"; - } else { - msg += " find_package(Qt5 COMPONENTS Core)\n"; + { + std::string version = (qtVersion.second == 0) + ? std::string("") + : std::to_string(qtVersion.second); + std::string comp = uicDisabled ? "Widgets" : "Core"; + msg += " find_package(Qt"; + msg += version; + msg += " COMPONENTS "; + msg += comp; + msg += ")\n"; } msg += "to your CMakeLists.txt file."; - target->Makefile->IssueMessage(cmake::AUTHOR_WARNING, msg); + target->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, msg); } if (mocIsValid || uicIsValid || rccIsValid) { // Create autogen target initializer https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a8b447d72e13b3356893737adba0a46ea065f70d commit a8b447d72e13b3356893737adba0a46ea065f70d Merge: 68a30b5 c8ba777 Author: Brad King AuthorDate: Wed Jan 16 14:49:54 2019 +0000 Commit: Kitware Robot CommitDate: Wed Jan 16 09:50:00 2019 -0500 Merge topic 'support_per_toolset_json_flags' c8ba777f6d GlobalVisualStudio10Generator: Support non-standard toolset json flag files. Acked-by: Kitware Robot Merge-request: !2772 diff --cc Source/cmGlobalVisualStudio10Generator.h index 7f7c516,ab55f06..7c8918a --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@@ -140,9 -140,13 +140,11 @@@ protected virtual bool SelectWindowsPhoneToolset(std::string& toolset) const; virtual bool SelectWindowsStoreToolset(std::string& toolset) const; - const char* GetIDEVersion() override { return "10.0"; } - std::string const& GetMSBuildCommand(); - cmIDEFlagTable const* LoadFlagTable(std::string const& flagTableName, + cmIDEFlagTable const* LoadFlagTable(std::string const& optionsName, + std::string const& toolsetName, + std::string const& defaultName, std::string const& table) const; std::string GeneratorToolset; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=68a30b50a5894d0425122ae4bbfd40b0492ff116 commit 68a30b50a5894d0425122ae4bbfd40b0492ff116 Merge: 7721b70 cc2a526 Author: Brad King AuthorDate: Wed Jan 16 14:47:00 2019 +0000 Commit: Kitware Robot CommitDate: Wed Jan 16 09:47:14 2019 -0500 Merge topic 'messenger-no-cmake' cc2a5261f8 Factor out enum MessageType into dedicated header Acked-by: Kitware Robot Merge-request: !2654 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cc2a5261f82c21e15899bba0d9b508fcacda7879 commit cc2a5261f82c21e15899bba0d9b508fcacda7879 Author: Bruno Manganelli AuthorDate: Thu Nov 22 03:36:50 2018 +0000 Commit: Brad King CommitDate: Wed Jan 16 08:16:31 2019 -0500 Factor out enum MessageType into dedicated header Reduce the number of files relying on `cmake.h`. diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index c87ceba..9e753e6 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -298,6 +298,7 @@ set(SRCS cmMakefileExecutableTargetGenerator.cxx cmMakefileLibraryTargetGenerator.cxx cmMakefileUtilityTargetGenerator.cxx + cmMessageType.h cmMessenger.cxx cmMessenger.h cmMSVC60LinkLineComputer.cxx diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx index 65b4976..32f7496 100644 --- a/Source/CTest/cmCTestBuildCommand.cxx +++ b/Source/CTest/cmCTestBuildCommand.cxx @@ -7,6 +7,7 @@ #include "cmCTestGenericHandler.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmSystemTools.h" #include "cmake.h" @@ -95,7 +96,7 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler() std::string e = "could not create generator named \""; e += cmakeGeneratorName; e += "\""; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e); cmSystemTools::SetFatalErrorOccured(); return nullptr; } diff --git a/Source/CTest/cmCTestHandlerCommand.cxx b/Source/CTest/cmCTestHandlerCommand.cxx index c63694d..57a14ef 100644 --- a/Source/CTest/cmCTestHandlerCommand.cxx +++ b/Source/CTest/cmCTestHandlerCommand.cxx @@ -5,9 +5,9 @@ #include "cmCTest.h" #include "cmCTestGenericHandler.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmSystemTools.h" #include "cmWorkingDirectory.h" -#include "cmake.h" #include #include @@ -289,7 +289,7 @@ bool cmCTestHandlerCommand::CheckArgumentValue(std::string const& arg) if (this->Values[k]) { std::ostringstream e; e << "Called with more than one value for " << this->Arguments[k]; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); this->ArgumentDoing = ArgumentDoingError; return true; } diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx index 43bd636..76a1830 100644 --- a/Source/CTest/cmCTestSubmitCommand.cxx +++ b/Source/CTest/cmCTestSubmitCommand.cxx @@ -6,8 +6,8 @@ #include "cmCTestGenericHandler.h" #include "cmCTestSubmitHandler.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmSystemTools.h" -#include "cmake.h" #include @@ -203,7 +203,7 @@ bool cmCTestSubmitCommand::CheckArgumentValue(std::string const& arg) } else { std::ostringstream e; e << "Part name \"" << arg << "\" is invalid."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); this->ArgumentDoing = ArgumentDoingError; } return true; @@ -216,7 +216,7 @@ bool cmCTestSubmitCommand::CheckArgumentValue(std::string const& arg) std::ostringstream e; e << "File \"" << arg << "\" does not exist. Cannot submit " << "a non-existent file."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); this->ArgumentDoing = ArgumentDoingError; } return true; diff --git a/Source/CTest/cmCTestUploadCommand.cxx b/Source/CTest/cmCTestUploadCommand.cxx index ec78c1e..2fe2cd3 100644 --- a/Source/CTest/cmCTestUploadCommand.cxx +++ b/Source/CTest/cmCTestUploadCommand.cxx @@ -9,8 +9,8 @@ #include "cmCTestGenericHandler.h" #include "cmCTestUploadHandler.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmSystemTools.h" -#include "cmake.h" cmCTestGenericHandler* cmCTestUploadCommand::InitializeHandler() { @@ -58,7 +58,7 @@ bool cmCTestUploadCommand::CheckArgumentValue(std::string const& arg) std::ostringstream e; e << "File \"" << arg << "\" does not exist. Cannot submit " << "a non-existent file."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); this->ArgumentDoing = ArgumentDoingError; return false; } diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx index 53f5593..a840f17 100644 --- a/Source/cmAddCustomCommandCommand.cxx +++ b/Source/cmAddCustomCommandCommand.cxx @@ -10,11 +10,11 @@ #include "cmCustomCommandLines.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmPolicies.h" #include "cmSourceFile.h" #include "cmSystemTools.h" #include "cmTarget.h" -#include "cmake.h" class cmExecutionStatus; @@ -361,7 +361,7 @@ bool cmAddCustomCommandCommand::InitialPass( } else { bool issueMessage = true; std::ostringstream e; - cmake::MessageType messageType = cmake::AUTHOR_WARNING; + MessageType messageType = MessageType::AUTHOR_WARNING; switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0050)) { case cmPolicies::WARN: e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0050) << "\n"; @@ -372,7 +372,7 @@ bool cmAddCustomCommandCommand::InitialPass( case cmPolicies::REQUIRED_ALWAYS: case cmPolicies::REQUIRED_IF_USED: case cmPolicies::NEW: - messageType = cmake::FATAL_ERROR; + messageType = MessageType::FATAL_ERROR; break; } @@ -380,7 +380,7 @@ bool cmAddCustomCommandCommand::InitialPass( e << "The SOURCE signatures of add_custom_command are no longer " "supported."; this->Makefile->IssueMessage(messageType, e.str()); - if (messageType == cmake::FATAL_ERROR) { + if (messageType == MessageType::FATAL_ERROR) { return false; } } diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx index ddd9b70..8240d3e 100644 --- a/Source/cmAddCustomTargetCommand.cxx +++ b/Source/cmAddCustomTargetCommand.cxx @@ -9,10 +9,10 @@ #include "cmGeneratorExpression.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmTarget.h" -#include "cmake.h" class cmExecutionStatus; @@ -183,19 +183,19 @@ bool cmAddCustomTargetCommand::InitialPass( if (commandLines.empty() && !byproducts.empty()) { this->Makefile->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, "BYPRODUCTS may not be specified without any COMMAND"); return true; } if (commandLines.empty() && uses_terminal) { this->Makefile->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, "USES_TERMINAL may not be specified without any COMMAND"); return true; } if (commandLines.empty() && command_expand_lists) { this->Makefile->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, "COMMAND_EXPAND_LISTS may not be specified without any COMMAND"); return true; } diff --git a/Source/cmAddDependenciesCommand.cxx b/Source/cmAddDependenciesCommand.cxx index a73b57e..021bd29 100644 --- a/Source/cmAddDependenciesCommand.cxx +++ b/Source/cmAddDependenciesCommand.cxx @@ -5,8 +5,8 @@ #include #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmTarget.h" -#include "cmake.h" class cmExecutionStatus; @@ -24,7 +24,7 @@ bool cmAddDependenciesCommand::InitialPass( std::ostringstream e; e << "Cannot add target-level dependencies to alias target \"" << target_name << "\".\n"; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); } if (cmTarget* target = this->Makefile->FindTargetToUse(target_name)) { std::vector::const_iterator s = args.begin(); @@ -40,7 +40,7 @@ bool cmAddDependenciesCommand::InitialPass( << "by the add_executable, add_library, or add_custom_target commands. " << "If you want to add file-level dependencies see the DEPENDS option " << "of the add_custom_target and add_custom_command commands."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); } return true; diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx index fae8063..5149333 100644 --- a/Source/cmAddLibraryCommand.cxx +++ b/Source/cmAddLibraryCommand.cxx @@ -7,11 +7,11 @@ #include "cmGeneratorExpression.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmState.h" #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmTarget.h" -#include "cmake.h" class cmExecutionStatus; @@ -259,7 +259,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector const& args, << (type == cmStateEnums::SHARED_LIBRARY ? "SHARED" : "MODULE") << " option but the target platform does not support dynamic linking. " "Building a STATIC library instead. This may lead to problems."; - this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str()); + this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, w.str()); type = cmStateEnums::STATIC_LIBRARY; } @@ -275,7 +275,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector const& args, if (!this->Makefile->GetGlobalGenerator()->HasKnownObjectFileLocation( &reason)) { this->Makefile->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, "The OBJECT library type may not be used for IMPORTED libraries" + reason + "."); return true; @@ -307,7 +307,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector const& args, // A non-imported target may not have UNKNOWN type. if (type == cmStateEnums::UNKNOWN_LIBRARY) { this->Makefile->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, "The UNKNOWN library type may be used only for IMPORTED libraries."); return true; } diff --git a/Source/cmBreakCommand.cxx b/Source/cmBreakCommand.cxx index 3772c6f..d07898f 100644 --- a/Source/cmBreakCommand.cxx +++ b/Source/cmBreakCommand.cxx @@ -6,8 +6,8 @@ #include "cmExecutionStatus.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmPolicies.h" -#include "cmake.h" // cmBreakCommand bool cmBreakCommand::InitialPass(std::vector const& args, @@ -16,7 +16,7 @@ bool cmBreakCommand::InitialPass(std::vector const& args, if (!this->Makefile->IsLoopBlock()) { bool issueMessage = true; std::ostringstream e; - cmake::MessageType messageType = cmake::AUTHOR_WARNING; + MessageType messageType = MessageType::AUTHOR_WARNING; switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0055)) { case cmPolicies::WARN: e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0055) << "\n"; @@ -27,7 +27,7 @@ bool cmBreakCommand::InitialPass(std::vector const& args, case cmPolicies::REQUIRED_ALWAYS: case cmPolicies::REQUIRED_IF_USED: case cmPolicies::NEW: - messageType = cmake::FATAL_ERROR; + messageType = MessageType::FATAL_ERROR; break; } @@ -35,7 +35,7 @@ bool cmBreakCommand::InitialPass(std::vector const& args, e << "A BREAK command was found outside of a proper " "FOREACH or WHILE loop scope."; this->Makefile->IssueMessage(messageType, e.str()); - if (messageType == cmake::FATAL_ERROR) { + if (messageType == MessageType::FATAL_ERROR) { return false; } } @@ -46,7 +46,7 @@ bool cmBreakCommand::InitialPass(std::vector const& args, if (!args.empty()) { bool issueMessage = true; std::ostringstream e; - cmake::MessageType messageType = cmake::AUTHOR_WARNING; + MessageType messageType = MessageType::AUTHOR_WARNING; switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0055)) { case cmPolicies::WARN: e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0055) << "\n"; @@ -57,14 +57,14 @@ bool cmBreakCommand::InitialPass(std::vector const& args, case cmPolicies::REQUIRED_ALWAYS: case cmPolicies::REQUIRED_IF_USED: case cmPolicies::NEW: - messageType = cmake::FATAL_ERROR; + messageType = MessageType::FATAL_ERROR; break; } if (issueMessage) { e << "The BREAK command does not accept any arguments."; this->Makefile->IssueMessage(messageType, e.str()); - if (messageType == cmake::FATAL_ERROR) { + if (messageType == MessageType::FATAL_ERROR) { return false; } } diff --git a/Source/cmBuildCommand.cxx b/Source/cmBuildCommand.cxx index fd87600..428a0b2 100644 --- a/Source/cmBuildCommand.cxx +++ b/Source/cmBuildCommand.cxx @@ -6,9 +6,9 @@ #include "cmGlobalGenerator.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmStateTypes.h" #include "cmSystemTools.h" -#include "cmake.h" class cmExecutionStatus; @@ -84,7 +84,7 @@ bool cmBuildCommand::MainSignature(std::vector const& args) if (!project_name.empty()) { this->Makefile->IssueMessage( - cmake::AUTHOR_WARNING, + MessageType::AUTHOR_WARNING, "Ignoring PROJECT_NAME option because it has no effect."); } diff --git a/Source/cmCMakeMinimumRequired.cxx b/Source/cmCMakeMinimumRequired.cxx index 2b51976..4218d81 100644 --- a/Source/cmCMakeMinimumRequired.cxx +++ b/Source/cmCMakeMinimumRequired.cxx @@ -6,9 +6,9 @@ #include #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmSystemTools.h" #include "cmVersion.h" -#include "cmake.h" class cmExecutionStatus; @@ -96,7 +96,7 @@ bool cmCMakeMinimumRequired::InitialPass(std::vector const& args, e << "CMake " << version_min << " or higher is required. You are running version " << cmVersion::GetCMakeVersion(); - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); cmSystemTools::SetFatalErrorOccured(); return true; } @@ -108,7 +108,7 @@ bool cmCMakeMinimumRequired::InitialPass(std::vector const& args, if (required_major < 2 || (required_major == 2 && required_minor < 4)) { this->Makefile->IssueMessage( - cmake::AUTHOR_WARNING, + MessageType::AUTHOR_WARNING, "Compatibility with CMake < 2.4 is not supported by CMake >= 3.0."); this->Makefile->SetPolicyVersion("2.4", version_max); } else { diff --git a/Source/cmCMakePolicyCommand.cxx b/Source/cmCMakePolicyCommand.cxx index 3209ea5..ac30e1a 100644 --- a/Source/cmCMakePolicyCommand.cxx +++ b/Source/cmCMakePolicyCommand.cxx @@ -5,10 +5,10 @@ #include #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmPolicies.h" #include "cmState.h" #include "cmStateTypes.h" -#include "cmake.h" class cmExecutionStatus; @@ -146,7 +146,7 @@ bool cmCMakePolicyCommand::HandleGetMode(std::vector const& args) << "The call to cmake_policy(GET " << id << " ...) at which this " << "error appears requests the policy, and this version of CMake " << "requires that the policy be set to NEW before it is checked."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); } } diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index 1d9621c..264c63c 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -347,7 +347,7 @@ static void addLinkLibrary(cmMakefile* mf, std::string const& target, std::ostringstream e; e << "Attempt to add link library \"" << lib << "\" to target \"" << target << "\" which is not built in this directory."; - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); return; } @@ -362,7 +362,7 @@ static void addLinkLibrary(cmMakefile* mf, std::string const& target, << " may not be linked into another target. " << "One may link only to STATIC or SHARED libraries, or " << "to executables with the ENABLE_EXPORTS property set."; - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); } t->AddLinkLibrary(*mf, lib, llt); diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 6ccb3a8..e1d312b 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -11,6 +11,7 @@ #include #include "cmGeneratedFileStream.h" +#include "cmMessageType.h" #include "cmMessenger.h" #include "cmState.h" #include "cmSystemTools.h" @@ -478,7 +479,7 @@ void cmCacheManager::OutputNewlineTruncationWarning(std::ostream& fout, std::string message = "Value of "; message += key; message += " contained a newline; truncating"; - messenger->IssueMessage(cmake::WARNING, message); + messenger->IssueMessage(MessageType::WARNING, message); } std::string comment = "WARNING: Value of "; diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 29483f9..4274cb4 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -8,6 +8,7 @@ #include "cmGlobalGenerator.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmOrderDirectories.h" #include "cmOutputConverter.h" #include "cmPolicies.h" @@ -522,7 +523,7 @@ bool cmComputeLinkInformation::Compute() "name." ; /* clang-format on */ - this->CMakeInstance->IssueMessage(cmake::AUTHOR_WARNING, w.str(), + this->CMakeInstance->IssueMessage(MessageType::AUTHOR_WARNING, w.str(), this->Target->GetBacktrace()); } @@ -1382,7 +1383,7 @@ void cmComputeLinkInformation::HandleBadFullItem(std::string const& item, << " " << item << "\n" << "which is a full-path but not a valid library file name."; /* clang-format on */ - this->CMakeInstance->IssueMessage(cmake::AUTHOR_WARNING, w.str(), + this->CMakeInstance->IssueMessage(MessageType::AUTHOR_WARNING, w.str(), this->Target->GetBacktrace()); } } @@ -1401,7 +1402,7 @@ void cmComputeLinkInformation::HandleBadFullItem(std::string const& item, << " " << item << "\n" << "which is a full-path but not a valid library file name."; /* clang-format on */ - this->CMakeInstance->IssueMessage(cmake::FATAL_ERROR, e.str(), + this->CMakeInstance->IssueMessage(MessageType::FATAL_ERROR, e.str(), this->Target->GetBacktrace()); } break; } @@ -1424,7 +1425,7 @@ bool cmComputeLinkInformation::FinishLinkerSearchDirectories() "CMP0003-WARNING-GIVEN", "1"); std::ostringstream w; this->PrintLinkPolicyDiagnosis(w); - this->CMakeInstance->IssueMessage(cmake::AUTHOR_WARNING, w.str(), + this->CMakeInstance->IssueMessage(MessageType::AUTHOR_WARNING, w.str(), this->Target->GetBacktrace()); } case cmPolicies::OLD: @@ -1439,7 +1440,7 @@ bool cmComputeLinkInformation::FinishLinkerSearchDirectories() std::ostringstream e; e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0003) << "\n"; this->PrintLinkPolicyDiagnosis(e); - this->CMakeInstance->IssueMessage(cmake::FATAL_ERROR, e.str(), + this->CMakeInstance->IssueMessage(MessageType::FATAL_ERROR, e.str(), this->Target->GetBacktrace()); return false; } diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index f8ac333..fde9750 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -9,6 +9,7 @@ #include "cmListFileCache.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmPolicies.h" #include "cmSourceFile.h" #include "cmState.h" @@ -217,7 +218,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) depender->GetType() != cmStateEnums::MODULE_LIBRARY && depender->GetType() != cmStateEnums::OBJECT_LIBRARY) { this->GlobalGenerator->GetCMakeInstance()->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, "Only executables and libraries may reference target objects.", depender->GetBacktrace()); return; @@ -314,7 +315,7 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index, if (!dependee && !linking && (depender->GetType() != cmStateEnums::GLOBAL_TARGET)) { - cmake::MessageType messageType = cmake::AUTHOR_WARNING; + MessageType messageType = MessageType::AUTHOR_WARNING; bool issueMessage = false; std::ostringstream e; switch (depender->GetPolicyStatusCMP0046()) { @@ -327,7 +328,7 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index, case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: issueMessage = true; - messageType = cmake::FATAL_ERROR; + messageType = MessageType::FATAL_ERROR; } if (issueMessage) { cmake* cm = this->GlobalGenerator->GetCMakeInstance(); diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx index 3b4206f..33b9cf1 100644 --- a/Source/cmConditionEvaluator.cxx +++ b/Source/cmConditionEvaluator.cxx @@ -11,8 +11,10 @@ #include "cmAlgorithms.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmState.h" #include "cmSystemTools.h" +#include "cmake.h" class cmCommand; class cmTest; @@ -81,7 +83,7 @@ cmConditionEvaluator::cmConditionEvaluator(cmMakefile& makefile, bool cmConditionEvaluator::IsTrue( const std::vector& args, std::string& errorString, - cmake::MessageType& status) + MessageType& status) { errorString.clear(); @@ -123,7 +125,7 @@ bool cmConditionEvaluator::IsTrue( // now at the end there should only be one argument left if (newArgs.size() != 1) { errorString = "Unknown arguments specified"; - status = cmake::FATAL_ERROR; + status = MessageType::FATAL_ERROR; return false; } @@ -155,7 +157,7 @@ const char* cmConditionEvaluator::GetDefinitionIfUnquoted( "Since the policy is not set the OLD behavior will be used."; this->Makefile.GetCMakeInstance()->IssueMessage( - cmake::AUTHOR_WARNING, e.str(), this->Backtrace); + MessageType::AUTHOR_WARNING, e.str(), this->Backtrace); } } @@ -199,7 +201,7 @@ bool cmConditionEvaluator::IsKeyword(std::string const& keyword, "Since the policy is not set the OLD behavior will be used."; this->Makefile.GetCMakeInstance()->IssueMessage( - cmake::AUTHOR_WARNING, e.str(), this->Backtrace); + MessageType::AUTHOR_WARNING, e.str(), this->Backtrace); } } @@ -269,7 +271,7 @@ bool cmConditionEvaluator::GetBooleanValueOld( // returns the resulting boolean value bool cmConditionEvaluator::GetBooleanValueWithAutoDereference( cmExpandedCommandArgument& newArg, std::string& errorString, - cmake::MessageType& status, bool oneArg) const + MessageType& status, bool oneArg) const { // Use the policy if it is set. if (this->Policy12Status == cmPolicies::NEW) { @@ -288,7 +290,7 @@ bool cmConditionEvaluator::GetBooleanValueWithAutoDereference( errorString = "An argument named \"" + newArg.GetValue() + "\" appears in a conditional statement. " + cmPolicies::GetPolicyWarning(cmPolicies::CMP0012); - status = cmake::AUTHOR_WARNING; + status = MessageType::AUTHOR_WARNING; CM_FALLTHROUGH; case cmPolicies::OLD: return oldResult; @@ -297,7 +299,7 @@ bool cmConditionEvaluator::GetBooleanValueWithAutoDereference( errorString = "An argument named \"" + newArg.GetValue() + "\" appears in a conditional statement. " + cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0012); - status = cmake::FATAL_ERROR; + status = MessageType::FATAL_ERROR; } case cmPolicies::NEW: break; @@ -362,7 +364,7 @@ void cmConditionEvaluator::HandleBinaryOp(bool value, int& reducible, // level 0 processes parenthetical expressions bool cmConditionEvaluator::HandleLevel0(cmArgumentList& newArgs, std::string& errorString, - cmake::MessageType& status) + MessageType& status) { int reducible; do { @@ -386,7 +388,7 @@ bool cmConditionEvaluator::HandleLevel0(cmArgumentList& newArgs, } if (depth) { errorString = "mismatched parenthesis in condition"; - status = cmake::FATAL_ERROR; + status = MessageType::FATAL_ERROR; return false; } // store the reduced args in this vector @@ -419,7 +421,7 @@ bool cmConditionEvaluator::HandleLevel0(cmArgumentList& newArgs, //========================================================================= // level one handles most predicates except for NOT bool cmConditionEvaluator::HandleLevel1(cmArgumentList& newArgs, std::string&, - cmake::MessageType&) + MessageType&) { int reducible; do { @@ -485,7 +487,7 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList& newArgs, std::string&, "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.IssueMessage(MessageType::AUTHOR_WARNING, e.str()); } // is a variable defined if (this->IsKeyword(keyDEFINED, *arg) && argP1 != newArgs.end()) { @@ -516,7 +518,7 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList& newArgs, std::string&, // level two handles most binary operations except for AND OR bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs, std::string& errorString, - cmake::MessageType& status) + MessageType& status) { int reducible; std::string def_buf; @@ -547,7 +549,7 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs, std::ostringstream error; error << "Regular expression \"" << rex << "\" cannot compile"; errorString = error.str(); - status = cmake::FATAL_ERROR; + status = MessageType::FATAL_ERROR; return false; } if (regEntry.find(def)) { @@ -682,7 +684,7 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs, "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.IssueMessage(MessageType::AUTHOR_WARNING, e.str()); } } @@ -696,7 +698,7 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs, // level 3 handles NOT bool cmConditionEvaluator::HandleLevel3(cmArgumentList& newArgs, std::string& errorString, - cmake::MessageType& status) + MessageType& status) { int reducible; do { @@ -722,7 +724,7 @@ bool cmConditionEvaluator::HandleLevel3(cmArgumentList& newArgs, // level 4 handles AND OR bool cmConditionEvaluator::HandleLevel4(cmArgumentList& newArgs, std::string& errorString, - cmake::MessageType& status) + MessageType& status) { int reducible; bool lhs; diff --git a/Source/cmConditionEvaluator.h b/Source/cmConditionEvaluator.h index 50f4edc..fc87a2d 100644 --- a/Source/cmConditionEvaluator.h +++ b/Source/cmConditionEvaluator.h @@ -11,8 +11,8 @@ #include "cmExpandedCommandArgument.h" #include "cmListFileCache.h" +#include "cmMessageType.h" #include "cmPolicies.h" -#include "cmake.h" class cmMakefile; @@ -28,7 +28,7 @@ public: // arguments were valid, and if so, was the response true. If there is // an error, the errorString will be set. bool IsTrue(const std::vector& args, - std::string& errorString, cmake::MessageType& status); + std::string& errorString, MessageType& status); private: // Filter the given variable definition based on policy CMP0054. @@ -48,7 +48,7 @@ private: bool GetBooleanValueWithAutoDereference(cmExpandedCommandArgument& newArg, std::string& errorString, - cmake::MessageType& status, + MessageType& status, bool oneArg = false) const; void IncrementArguments(cmArgumentList& newArgs, @@ -66,19 +66,18 @@ private: cmArgumentList::iterator& argP2); bool HandleLevel0(cmArgumentList& newArgs, std::string& errorString, - cmake::MessageType& status); + MessageType& status); - bool HandleLevel1(cmArgumentList& newArgs, std::string&, - cmake::MessageType&); + bool HandleLevel1(cmArgumentList& newArgs, std::string&, MessageType&); bool HandleLevel2(cmArgumentList& newArgs, std::string& errorString, - cmake::MessageType& status); + MessageType& status); bool HandleLevel3(cmArgumentList& newArgs, std::string& errorString, - cmake::MessageType& status); + MessageType& status); bool HandleLevel4(cmArgumentList& newArgs, std::string& errorString, - cmake::MessageType& status); + MessageType& status); cmMakefile& Makefile; cmListFileContext ExecutionContext; diff --git a/Source/cmConfigureFileCommand.cxx b/Source/cmConfigureFileCommand.cxx index 305262d..8224a0f 100644 --- a/Source/cmConfigureFileCommand.cxx +++ b/Source/cmConfigureFileCommand.cxx @@ -5,8 +5,8 @@ #include #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmSystemTools.h" -#include "cmake.h" class cmExecutionStatus; @@ -89,7 +89,7 @@ bool cmConfigureFileCommand::InitialPass(std::vector const& args, if (!unknown_args.empty()) { std::string msg = "configure_file called with unknown argument(s):\n"; msg += unknown_args; - this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, msg); + this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, msg); } if (!this->ConfigureFile()) { diff --git a/Source/cmContinueCommand.cxx b/Source/cmContinueCommand.cxx index 2298a05..48f1f41 100644 --- a/Source/cmContinueCommand.cxx +++ b/Source/cmContinueCommand.cxx @@ -4,15 +4,15 @@ #include "cmExecutionStatus.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmSystemTools.h" -#include "cmake.h" // cmContinueCommand bool cmContinueCommand::InitialPass(std::vector const& args, cmExecutionStatus& status) { if (!this->Makefile->IsLoopBlock()) { - this->Makefile->IssueMessage(cmake::FATAL_ERROR, + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, "A CONTINUE command was found outside of a " "proper FOREACH or WHILE loop scope."); cmSystemTools::SetFatalErrorOccured(); @@ -22,7 +22,7 @@ bool cmContinueCommand::InitialPass(std::vector const& args, status.SetContinueInvoked(); if (!args.empty()) { - this->Makefile->IssueMessage(cmake::FATAL_ERROR, + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, "The CONTINUE command does not accept any " "arguments."); cmSystemTools::SetFatalErrorOccured(); diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index f9b494e..a483fd1 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -13,6 +13,7 @@ #include "cmExportTryCompileFileGenerator.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmOutputConverter.h" #include "cmPolicies.h" #include "cmState.h" @@ -96,7 +97,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv, targetType = cmStateEnums::STATIC_LIBRARY; } else { this->Makefile->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, std::string("Invalid value '") + tt + "' for " "CMAKE_TRY_COMPILE_TARGET_TYPE. Only " @@ -238,7 +239,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv, CM_FALLTHROUGH; default: this->Makefile->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, "Only libraries may be used as try_compile or try_run IMPORTED " "LINK_LIBRARIES. Got " + std::string(tgt->GetName()) + @@ -297,93 +298,95 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv, } else { std::ostringstream m; m << "try_compile given unknown argument \"" << argv[i] << "\"."; - this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, m.str()); + this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, m.str()); } } if (didCopyFile && copyFile.empty()) { - this->Makefile->IssueMessage(cmake::FATAL_ERROR, + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, "COPY_FILE must be followed by a file path"); return -1; } if (didCopyFileError && copyFileError.empty()) { this->Makefile->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, "COPY_FILE_ERROR must be followed by a variable name"); return -1; } if (didCopyFileError && !didCopyFile) { this->Makefile->IssueMessage( - cmake::FATAL_ERROR, "COPY_FILE_ERROR may be used only with COPY_FILE"); + MessageType::FATAL_ERROR, + "COPY_FILE_ERROR may be used only with COPY_FILE"); return -1; } if (didOutputVariable && outputVariable.empty()) { this->Makefile->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, "OUTPUT_VARIABLE must be followed by a variable name"); return -1; } if (useSources && sources.empty()) { this->Makefile->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, "SOURCES must be followed by at least one source file"); return -1; } if (didCStandard && !this->SrcFileSignature) { this->Makefile->IssueMessage( - cmake::FATAL_ERROR, "C_STANDARD allowed only in source file signature."); + MessageType::FATAL_ERROR, + "C_STANDARD allowed only in source file signature."); return -1; } if (didCxxStandard && !this->SrcFileSignature) { this->Makefile->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, "CXX_STANDARD allowed only in source file signature."); return -1; } if (didCudaStandard && !this->SrcFileSignature) { this->Makefile->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, "CUDA_STANDARD allowed only in source file signature."); return -1; } if (didCStandardRequired && !this->SrcFileSignature) { this->Makefile->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, "C_STANDARD_REQUIRED allowed only in source file signature."); return -1; } if (didCxxStandardRequired && !this->SrcFileSignature) { this->Makefile->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, "CXX_STANDARD_REQUIRED allowed only in source file signature."); return -1; } if (didCudaStandardRequired && !this->SrcFileSignature) { this->Makefile->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, "CUDA_STANDARD_REQUIRED allowed only in source file signature."); return -1; } if (didCExtensions && !this->SrcFileSignature) { this->Makefile->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, "C_EXTENSIONS allowed only in source file signature."); return -1; } if (didCxxExtensions && !this->SrcFileSignature) { this->Makefile->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, "CXX_EXTENSIONS allowed only in source file signature."); return -1; } if (didCudaExtensions && !this->SrcFileSignature) { this->Makefile->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, "CUDA_EXTENSIONS allowed only in source file signature."); return -1; } @@ -397,13 +400,13 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv, // only valid for srcfile signatures if (!compileDefs.empty()) { this->Makefile->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, "COMPILE_DEFINITIONS specified on a srcdir type TRY_COMPILE"); return -1; } if (!copyFile.empty()) { this->Makefile->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, "COPY_FILE specified on a srcdir type TRY_COMPILE"); return -1; } @@ -416,7 +419,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv, std::ostringstream e; e << "Attempt at a recursive or nested TRY_COMPILE in directory\n" << " " << this->BinaryDirectory << "\n"; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); return -1; } @@ -450,7 +453,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv, gg->GetEnabledLanguages(langs); err << cmJoin(langs, " "); err << "\nSee project() command to enable other languages."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, err.str()); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, err.str()); return -1; } } @@ -471,7 +474,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv, << " " << outFileName << "\n" << cmSystemTools::GetLastSystemError(); /* clang-format on */ - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); return -1; } @@ -522,7 +525,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv, "(e.g. CMAKE_C_FLAGS_DEBUG) in the test project." ; /* clang-format on */ - this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str()); + this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, w.str()); } case cmPolicies::OLD: // OLD behavior is to do nothing. @@ -530,7 +533,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv, case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: this->Makefile->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0066)); CM_FALLTHROUGH; case cmPolicies::NEW: { @@ -559,7 +562,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv, "in the test project." ; /* clang-format on */ - this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str()); + this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, w.str()); } case cmPolicies::OLD: // OLD behavior is to do nothing. @@ -567,7 +570,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv, case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: this->Makefile->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0056)); CM_FALLTHROUGH; case cmPolicies::NEW: @@ -606,7 +609,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv, tcfg.SetConfig(tcConfig); if (!tcfg.GenerateImportFile()) { - this->Makefile->IssueMessage(cmake::FATAL_ERROR, + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, "could not write export file."); fclose(fout); return -1; @@ -734,7 +737,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv, case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: this->Makefile->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0067)); case cmPolicies::NEW: // NEW behavior is to honor the language standard variables. @@ -796,7 +799,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv, for (std::string const& vi : this->WarnCMP0067) { w << " " << vi << "\n"; } - this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str()); + this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, w.str()); } if (testC) { @@ -905,7 +908,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv, emsg << this->FindErrorMessage.c_str(); } if (copyFileError.empty()) { - this->Makefile->IssueMessage(cmake::FATAL_ERROR, emsg.str()); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, emsg.str()); return -1; } copyFileErrorMessage = emsg.str(); diff --git a/Source/cmDisallowedCommand.cxx b/Source/cmDisallowedCommand.cxx index ce1965d..418d98c 100644 --- a/Source/cmDisallowedCommand.cxx +++ b/Source/cmDisallowedCommand.cxx @@ -3,7 +3,7 @@ #include "cmDisallowedCommand.h" #include "cmMakefile.h" -#include "cmake.h" +#include "cmMessageType.h" class cmExecutionStatus; @@ -12,7 +12,7 @@ bool cmDisallowedCommand::InitialPass(std::vector const& args, { switch (this->Makefile->GetPolicyStatus(this->Policy)) { case cmPolicies::WARN: - this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, + this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, cmPolicies::GetPolicyWarning(this->Policy)); break; case cmPolicies::OLD: @@ -20,7 +20,7 @@ bool cmDisallowedCommand::InitialPass(std::vector const& args, case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: case cmPolicies::NEW: - this->Makefile->IssueMessage(cmake::FATAL_ERROR, this->Message); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, this->Message); return true; } diff --git a/Source/cmExportBuildAndroidMKGenerator.cxx b/Source/cmExportBuildAndroidMKGenerator.cxx index d12ad7f..ced27c9 100644 --- a/Source/cmExportBuildAndroidMKGenerator.cxx +++ b/Source/cmExportBuildAndroidMKGenerator.cxx @@ -11,11 +11,11 @@ #include "cmGeneratorTarget.h" #include "cmLinkItem.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmPolicies.h" #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmTarget.h" -#include "cmake.h" cmExportBuildAndroidMKGenerator::cmExportBuildAndroidMKGenerator() { @@ -92,7 +92,7 @@ void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties( } w << " set to OLD for target " << target->Target->GetName() << ". " << "The export will only work with CMP0022 set to NEW."; - target->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str()); + target->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, w.str()); } if (!properties.empty()) { os << "LOCAL_CPP_FEATURES := rtti exceptions\n"; diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index 024e641..012355b 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -9,6 +9,7 @@ #include "cmGlobalGenerator.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmPolicies.h" #include "cmStateTypes.h" #include "cmSystemTools.h" @@ -55,7 +56,7 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os) std::ostringstream e; e << "given target \"" << te->GetName() << "\" more than once."; this->LG->GetGlobalGenerator()->GetCMakeInstance()->IssueMessage( - cmake::FATAL_ERROR, e.str(), + MessageType::FATAL_ERROR, e.str(), this->LG->GetMakefile()->GetBacktrace()); return false; } @@ -110,7 +111,7 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os) std::string errorMessage; if (!this->PopulateExportProperties(gte, properties, errorMessage)) { this->LG->GetGlobalGenerator()->GetCMakeInstance()->IssueMessage( - cmake::FATAL_ERROR, errorMessage, + MessageType::FATAL_ERROR, errorMessage, this->LG->GetMakefile()->GetBacktrace()); return false; } @@ -328,7 +329,8 @@ void cmExportBuildFileGenerator::ComplainAboutMissingTarget( << "consider using the APPEND option with multiple separate calls."; this->LG->GetGlobalGenerator()->GetCMakeInstance()->IssueMessage( - cmake::FATAL_ERROR, e.str(), this->LG->GetMakefile()->GetBacktrace()); + MessageType::FATAL_ERROR, e.str(), + this->LG->GetMakefile()->GetBacktrace()); } std::string cmExportBuildFileGenerator::InstallNameDir( diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx index 3706a3c..722831a 100644 --- a/Source/cmExportCommand.cxx +++ b/Source/cmExportCommand.cxx @@ -12,10 +12,10 @@ #include "cmGeneratedFileStream.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmTarget.h" -#include "cmake.h" class cmExecutionStatus; @@ -279,7 +279,7 @@ void cmExportCommand::ReportRegistryError(std::string const& msg, e << "Windows reported:\n" << " " << cmsys::Encoding::ToNarrow(winmsg); } - this->Makefile->IssueMessage(cmake::WARNING, e.str()); + this->Makefile->IssueMessage(MessageType::WARNING, e.str()); } void cmExportCommand::StorePackageRegistryWin(std::string const& package, @@ -347,7 +347,7 @@ void cmExportCommand::StorePackageRegistryDir(std::string const& package, << " " << fname << "\n" << cmSystemTools::GetLastSystemError() << "\n"; /* clang-format on */ - this->Makefile->IssueMessage(cmake::WARNING, e.str()); + this->Makefile->IssueMessage(MessageType::WARNING, e.str()); } } } diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index df27c62..c6b66a3 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -9,6 +9,7 @@ #include "cmLinkItem.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmOutputConverter.h" #include "cmPolicies.h" #include "cmProperty.h" @@ -17,7 +18,6 @@ #include "cmSystemTools.h" #include "cmTarget.h" #include "cmTargetExport.h" -#include "cmake.h" #include "cmsys/FStream.hxx" #include @@ -214,13 +214,13 @@ static bool checkInterfaceDirs(const std::string& prepro, if (genexPos == 0) { continue; } - cmake::MessageType messageType = cmake::FATAL_ERROR; + MessageType messageType = MessageType::FATAL_ERROR; std::ostringstream e; if (genexPos != std::string::npos) { if (prop == "INTERFACE_INCLUDE_DIRECTORIES") { switch (target->GetPolicyStatusCMP0041()) { case cmPolicies::WARN: - messageType = cmake::WARNING; + messageType = MessageType::WARNING; e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0041) << "\n"; break; case cmPolicies::OLD: @@ -275,8 +275,8 @@ static bool checkInterfaceDirs(const std::string& prepro, << (inBinary ? "build" : "source") << " tree:\n \"" << (inBinary ? topBinaryDir : topSourceDir) << "\"" << std::endl; - target->GetLocalGenerator()->IssueMessage(cmake::AUTHOR_WARNING, - s.str()); + target->GetLocalGenerator()->IssueMessage( + MessageType::AUTHOR_WARNING, s.str()); CM_FALLTHROUGH; } case cmPolicies::OLD: @@ -390,7 +390,7 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface( "depend on the configuration, policy values or the link interface " "are " "not supported. Consider using target_include_directories instead."; - lg->IssueMessage(cmake::FATAL_ERROR, e.str()); + lg->IssueMessage(MessageType::FATAL_ERROR, e.str()); return; } @@ -520,7 +520,7 @@ void getCompatibleInterfaceProperties(cmGeneratorTarget* target, e << "Exporting the target \"" << target->GetName() << "\" is not " "allowed since its linker language cannot be determined"; - lg->IssueMessage(cmake::FATAL_ERROR, e.str()); + lg->IssueMessage(MessageType::FATAL_ERROR, e.str()); return; } @@ -727,7 +727,8 @@ void cmExportFileGenerator::ResolveTargetsInGeneratorExpression( this->ReplaceInstallPrefix(input); if (!errorString.empty()) { - target->GetLocalGenerator()->IssueMessage(cmake::FATAL_ERROR, errorString); + target->GetLocalGenerator()->IssueMessage(MessageType::FATAL_ERROR, + errorString); } } @@ -780,7 +781,7 @@ void cmExportFileGenerator::SetImportLinkInterface( "but also has old-style LINK_INTERFACE_LIBRARIES properties " "populated, but it was exported without the " "EXPORT_LINK_INTERFACE_LIBRARIES to export the old-style properties"; - lg->IssueMessage(cmake::FATAL_ERROR, e.str()); + lg->IssueMessage(MessageType::FATAL_ERROR, e.str()); return; } diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 84fcb95..38f69f1 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -16,6 +16,7 @@ #include "cmGlobalGenerator.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmSourceFile.h" #include "cmSourceGroup.h" #include "cmState.h" @@ -134,7 +135,7 @@ void cmExtraEclipseCDT4Generator::Generate() if (!this->GenerateSourceProject && (mf->IsOn("ECLIPSE_CDT4_GENERATE_SOURCE_PROJECT"))) { mf->IssueMessage( - cmake::WARNING, + MessageType::WARNING, "ECLIPSE_CDT4_GENERATE_SOURCE_PROJECT is set to TRUE, " "but this variable is not supported anymore since CMake 2.8.7.\n" "Enable CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT instead."); @@ -142,7 +143,7 @@ void cmExtraEclipseCDT4Generator::Generate() if (cmSystemTools::IsSubDirectory(this->HomeOutputDirectory, this->HomeDirectory)) { - mf->IssueMessage(cmake::WARNING, + mf->IssueMessage(MessageType::WARNING, "The build directory is a subdirectory " "of the source directory.\n" "This is not supported well by Eclipse. It is strongly " diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index 0a1886a..739a177 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -14,6 +14,7 @@ #include "cmGlobalGenerator.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmSourceFile.h" #include "cmStateTypes.h" #include "cmSystemTools.h" @@ -154,7 +155,7 @@ void cmExtraSublimeTextGenerator::CreateNewProjectFile( e << "Could not parse Env Vars specified in " "\"CMAKE_SUBLIME_TEXT_2_ENV_SETTINGS\"" << ", corrupted string " << t; - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); } } fout << "\n\t\t}"; diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 475eee4..5c93068 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -32,6 +32,7 @@ #include "cmInstallType.h" #include "cmListFileCache.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmPolicies.h" #include "cmSystemTools.h" #include "cmTimestamp.h" @@ -834,13 +835,13 @@ bool cmFileCommand::HandleGlobCommand(std::vector const& args, // Generated build system depends on glob results if (!configureDepends && warnConfigureLate) { this->Makefile->IssueMessage( - cmake::AUTHOR_WARNING, + MessageType::AUTHOR_WARNING, "CONFIGURE_DEPENDS flag was given after a glob expression was " "already evaluated."); } if (workingMode != cmake::NORMAL_MODE) { this->Makefile->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, "CONFIGURE_DEPENDS is invalid for script and find package modes."); return false; } @@ -871,12 +872,12 @@ bool cmFileCommand::HandleGlobCommand(std::vector const& args, for (cmsys::Glob::Message const& globMessage : globMessages) { if (globMessage.type == cmsys::Glob::cyclicRecursion) { this->Makefile->IssueMessage( - cmake::AUTHOR_WARNING, + MessageType::AUTHOR_WARNING, "Cyclic recursion detected while globbing for '" + *i + "':\n" + globMessage.content); } else { this->Makefile->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, "Error has occurred while globbing for '" + *i + "' - " + globMessage.content); shouldExit = true; @@ -925,7 +926,7 @@ bool cmFileCommand::HandleGlobCommand(std::vector const& args, // symlinks without being explicitly asked to: warn the author. if (warnFollowedSymlinks) { this->Makefile->IssueMessage( - cmake::AUTHOR_WARNING, + MessageType::AUTHOR_WARNING, cmPolicies::GetPolicyWarning(cmPolicies::CMP0009)); } break; @@ -2853,7 +2854,7 @@ bool cmFileCommand::HandleDownloadCommand(std::vector const& args) // Do not return error for compatibility reason. std::string err = "Unexpected argument: "; err += *i; - this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, err); + this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, err); } ++i; } @@ -3169,7 +3170,7 @@ bool cmFileCommand::HandleUploadCommand(std::vector const& args) // Do not return error for compatibility reason. std::string err = "Unexpected argument: "; err += *i; - this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, err); + this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, err); } ++i; @@ -3427,7 +3428,8 @@ bool cmFileCommand::HandleLockCommand(std::vector const& args) // Parse arguments if (args.size() < 2) { this->Makefile->IssueMessage( - cmake::FATAL_ERROR, "sub-command LOCK requires at least two arguments."); + MessageType::FATAL_ERROR, + "sub-command LOCK requires at least two arguments."); return false; } @@ -3441,7 +3443,7 @@ bool cmFileCommand::HandleLockCommand(std::vector const& args) ++i; const char* merr = "expected FUNCTION, FILE or PROCESS after GUARD"; if (i >= args.size()) { - this->Makefile->IssueMessage(cmake::FATAL_ERROR, merr); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, merr); return false; } if (args[i] == "FUNCTION") { @@ -3453,7 +3455,7 @@ bool cmFileCommand::HandleLockCommand(std::vector const& args) } else { std::ostringstream e; e << merr << ", but got:\n \"" << args[i] << "\"."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); return false; } @@ -3461,14 +3463,15 @@ bool cmFileCommand::HandleLockCommand(std::vector const& args) ++i; if (i >= args.size()) { this->Makefile->IssueMessage( - cmake::FATAL_ERROR, "expected variable name after RESULT_VARIABLE"); + MessageType::FATAL_ERROR, + "expected variable name after RESULT_VARIABLE"); return false; } resultVariable = args[i]; } else if (args[i] == "TIMEOUT") { ++i; if (i >= args.size()) { - this->Makefile->IssueMessage(cmake::FATAL_ERROR, + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, "expected timeout value after TIMEOUT"); return false; } @@ -3477,7 +3480,7 @@ bool cmFileCommand::HandleLockCommand(std::vector const& args) scanned < 0) { std::ostringstream e; e << "TIMEOUT value \"" << args[i] << "\" is not an unsigned integer."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); return false; } timeout = static_cast(scanned); @@ -3485,7 +3488,7 @@ bool cmFileCommand::HandleLockCommand(std::vector const& args) std::ostringstream e; e << "expected DIRECTORY, RELEASE, GUARD, RESULT_VARIABLE or TIMEOUT\n"; e << "but got: \"" << args[i] << "\"."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); return false; } } @@ -3507,7 +3510,7 @@ bool cmFileCommand::HandleLockCommand(std::vector const& args) std::ostringstream e; e << "directory\n \"" << parentDir << "\"\ncreation failed "; e << "(check permissions)."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); cmSystemTools::SetFatalErrorOccured(); return false; } @@ -3515,7 +3518,7 @@ bool cmFileCommand::HandleLockCommand(std::vector const& args) if (!file) { std::ostringstream e; e << "file\n \"" << path << "\"\ncreation failed (check permissions)."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); cmSystemTools::SetFatalErrorOccured(); return false; } @@ -3550,7 +3553,7 @@ bool cmFileCommand::HandleLockCommand(std::vector const& args) if (resultVariable.empty() && !fileLockResult.IsOk()) { std::ostringstream e; e << "error locking file\n \"" << path << "\"\n" << result << "."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); cmSystemTools::SetFatalErrorOccured(); return false; } diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 3d9cd08..8dc7ca2 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -21,12 +21,12 @@ #include "cmAlgorithms.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmPolicies.h" #include "cmSearchPath.h" #include "cmState.h" #include "cmStateTypes.h" #include "cmVersion.h" -#include "cmake.h" #if defined(__HAIKU__) # include @@ -384,7 +384,8 @@ bool cmFindPackageCommand::InitialPass(std::vector const& args, if (this->Version.empty() && this->VersionExact) { this->VersionExact = false; this->Makefile->IssueMessage( - cmake::AUTHOR_WARNING, "Ignoring EXACT since no version is requested."); + MessageType::AUTHOR_WARNING, + "Ignoring EXACT since no version is requested."); } if (this->Version.empty() || components.empty()) { @@ -473,7 +474,7 @@ bool cmFindPackageCommand::InitialPass(std::vector const& args, case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: this->Makefile->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0074)); break; case cmPolicies::NEW: { @@ -536,7 +537,7 @@ bool cmFindPackageCommand::InitialPass(std::vector const& args, } aw << "\n" "(Variable CMAKE_FIND_PACKAGE_WARN_NO_MODULE enabled this warning.)"; - this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, aw.str()); + this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, aw.str()); } // No find module. Assume the project has a CMake config file. Use @@ -667,7 +668,7 @@ bool cmFindPackageCommand::FindModule(bool& found) case cmPolicies::WARN: { std::ostringstream e; e << cmPolicies::GetPolicyWarning(it->second) << "\n"; - this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, e.str()); + this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, e.str()); CM_FALLTHROUGH; } case cmPolicies::OLD: @@ -736,7 +737,8 @@ bool cmFindPackageCommand::HandlePackageMode() // Sanity check. if (fileFound && this->FileFound.empty()) { this->Makefile->IssueMessage( - cmake::INTERNAL_ERROR, "fileFound is true but FileFound is empty!"); + MessageType::INTERNAL_ERROR, + "fileFound is true but FileFound is empty!"); fileFound = false; } } @@ -887,14 +889,15 @@ bool cmFindPackageCommand::HandlePackageMode() } } - this->Makefile->IssueMessage( - this->Required ? cmake::FATAL_ERROR : cmake::WARNING, e.str()); + this->Makefile->IssueMessage(this->Required ? MessageType::FATAL_ERROR + : MessageType::WARNING, + e.str()); if (this->Required) { cmSystemTools::SetFatalErrorOccured(); } if (!aw.str().empty()) { - this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, aw.str()); + this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, aw.str()); } } // output result if in config mode but not in quiet mode diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx index 739c9c0..3047167 100644 --- a/Source/cmForEachCommand.cxx +++ b/Source/cmForEachCommand.cxx @@ -10,8 +10,8 @@ #include "cmAlgorithms.h" #include "cmExecutionStatus.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmSystemTools.h" -#include "cmake.h" cmForEachFunctionBlocker::cmForEachFunctionBlocker(cmMakefile* mf) : Makefile(mf) @@ -210,7 +210,7 @@ bool cmForEachCommand::HandleInMode(std::vector const& args) std::ostringstream e; e << "Unknown argument:\n" << " " << args[i] << "\n"; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); return true; } } diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx index 5d6f301..61b798b 100644 --- a/Source/cmGeneratorExpressionDAGChecker.cxx +++ b/Source/cmGeneratorExpressionDAGChecker.cxx @@ -7,6 +7,7 @@ #include "cmGeneratorExpressionEvaluator.h" #include "cmGeneratorTarget.h" #include "cmLocalGenerator.h" +#include "cmMessageType.h" #include "cmake.h" #include @@ -99,8 +100,8 @@ void cmGeneratorExpressionDAGChecker::ReportError( << " " << expr << "\n" << "Self reference on target \"" << context->HeadTarget->GetName() << "\".\n"; - context->LG->GetCMakeInstance()->IssueMessage(cmake::FATAL_ERROR, e.str(), - parent->Backtrace); + context->LG->GetCMakeInstance()->IssueMessage(MessageType::FATAL_ERROR, + e.str(), parent->Backtrace); return; } @@ -111,8 +112,8 @@ void cmGeneratorExpressionDAGChecker::ReportError( << " " << expr << "\n" << "Dependency loop found."; /* clang-format on */ - context->LG->GetCMakeInstance()->IssueMessage(cmake::FATAL_ERROR, e.str(), - context->Backtrace); + context->LG->GetCMakeInstance()->IssueMessage(MessageType::FATAL_ERROR, + e.str(), context->Backtrace); } int loopStep = 1; @@ -122,8 +123,8 @@ void cmGeneratorExpressionDAGChecker::ReportError( << " " << (parent->Content ? parent->Content->GetOriginalExpression() : expr) << "\n"; - context->LG->GetCMakeInstance()->IssueMessage(cmake::FATAL_ERROR, e.str(), - parent->Backtrace); + context->LG->GetCMakeInstance()->IssueMessage(MessageType::FATAL_ERROR, + e.str(), parent->Backtrace); parent = parent->Parent; ++loopStep; } diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx index e7a55e0..1c33a6e 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.cxx +++ b/Source/cmGeneratorExpressionEvaluationFile.cxx @@ -12,10 +12,10 @@ #include "cmListFileCache.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmSourceFile.h" #include "cmSourceFileLocationKind.h" #include "cmSystemTools.h" -#include "cmake.h" cmGeneratorExpressionEvaluationFile::cmGeneratorExpressionEvaluationFile( const std::string& input, @@ -48,7 +48,7 @@ void cmGeneratorExpressionEvaluationFile::Generate( << "\" did " "not evaluate to valid content. Got \"" << condResult << "\"."; - lg->IssueMessage(cmake::FATAL_ERROR, e.str()); + lg->IssueMessage(MessageType::FATAL_ERROR, e.str()); return; } } @@ -77,7 +77,7 @@ void cmGeneratorExpressionEvaluationFile::Generate( "This is generally caused by the content evaluating the " "configuration type, language, or location of object files:\n " << outputFileName; - lg->IssueMessage(cmake::FATAL_ERROR, e.str()); + lg->IssueMessage(MessageType::FATAL_ERROR, e.str()); return; } @@ -137,7 +137,7 @@ void cmGeneratorExpressionEvaluationFile::Generate(cmLocalGenerator* lg) if (!fin) { std::ostringstream e; e << "Evaluation file \"" << inputFileName << "\" cannot be read."; - lg->IssueMessage(cmake::FATAL_ERROR, e.str()); + lg->IssueMessage(MessageType::FATAL_ERROR, e.str()); return; } @@ -204,7 +204,7 @@ std::string cmGeneratorExpressionEvaluationFile::FixRelativePath( "undefined behavior will be used." ; /* clang-format on */ - lg->IssueMessage(cmake::AUTHOR_WARNING, w.str()); + lg->IssueMessage(MessageType::AUTHOR_WARNING, w.str()); } CM_FALLTHROUGH; case cmPolicies::OLD: diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 627e66d..fe1b055 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -12,6 +12,7 @@ #include "cmLinkItem.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmOutputConverter.h" #include "cmPolicies.h" #include "cmStateTypes.h" @@ -304,7 +305,7 @@ static const struct InListNode : public cmGeneratorExpressionNode << "\nSearch Item:\n \"" << parameters.front() << "\"\nList:\n \"" << parameters[1] << "\"\n"; context->LG->GetCMakeInstance()->IssueMessage( - cmake::AUTHOR_WARNING, e.str(), context->Backtrace); + MessageType ::AUTHOR_WARNING, e.str(), context->Backtrace); return "0"; } if (values.empty()) { @@ -632,7 +633,7 @@ struct CompilerIdNode : public cmGeneratorExpressionNode std::ostringstream e; e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0044); context->LG->GetCMakeInstance()->IssueMessage( - cmake::AUTHOR_WARNING, e.str(), context->Backtrace); + MessageType::AUTHOR_WARNING, e.str(), context->Backtrace); CM_FALLTHROUGH; } case cmPolicies::OLD: @@ -1654,7 +1655,7 @@ static const struct TargetPolicyNode : public cmGeneratorExpressionNode switch (statusForTarget(context->HeadTarget, policy)) { case cmPolicies::WARN: lg->IssueMessage( - cmake::AUTHOR_WARNING, + MessageType::AUTHOR_WARNING, cmPolicies::GetPolicyWarning(policyForString(policy))); CM_FALLTHROUGH; case cmPolicies::REQUIRED_IF_USED: @@ -2096,6 +2097,6 @@ void reportError(cmGeneratorExpressionContext* context, << " " << expr << "\n" << result; /* clang-format on */ - context->LG->GetCMakeInstance()->IssueMessage(cmake::FATAL_ERROR, e.str(), - context->Backtrace); + context->LG->GetCMakeInstance()->IssueMessage(MessageType::FATAL_ERROR, + e.str(), context->Backtrace); } diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 80d81d5..c2773fc 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -25,6 +25,7 @@ #include "cmGlobalGenerator.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmPropertyMap.h" #include "cmSourceFile.h" #include "cmSourceFileLocation.h" @@ -340,7 +341,7 @@ std::string cmGeneratorTarget::GetOutputName( // An empty map entry indicates we have been called recursively // from the above block. this->LocalGenerator->GetCMakeInstance()->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, "Target '" + this->GetName() + "' OUTPUT_NAME depends on itself.", this->GetBacktrace()); } @@ -512,7 +513,7 @@ const char* cmGeneratorTarget::GetLinkPIEProperty( case cmPolicies::WARN: { std::ostringstream e; e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0083); - this->LocalGenerator->IssueMessage(cmake::AUTHOR_WARNING, e.str()); + this->LocalGenerator->IssueMessage(MessageType::AUTHOR_WARNING, e.str()); CM_FALLTHROUGH; } case cmPolicies::OLD: @@ -559,7 +560,7 @@ bool cmGeneratorTarget::IsIPOEnabled(std::string const& lang, w << "INTERPROCEDURAL_OPTIMIZATION property will be ignored for target " << "'" << this->GetName() << "'."; this->LocalGenerator->GetCMakeInstance()->IssueMessage( - cmake::AUTHOR_WARNING, w.str(), this->GetBacktrace()); + MessageType::AUTHOR_WARNING, w.str(), this->GetBacktrace()); this->PolicyReportedCMP0069 = true; } @@ -590,7 +591,7 @@ bool cmGeneratorTarget::IsIPOEnabled(std::string const& lang, this->PolicyReportedCMP0069 = true; this->LocalGenerator->GetCMakeInstance()->IssueMessage( - cmake::FATAL_ERROR, message, this->GetBacktrace()); + MessageType::FATAL_ERROR, message, this->GetBacktrace()); return false; } @@ -924,7 +925,7 @@ static bool processSources( if (fullPath.empty()) { if (!e.empty()) { cmake* cm = tgt->GetLocalGenerator()->GetCMakeInstance(); - cm->IssueMessage(cmake::FATAL_ERROR, e, tgt->GetBacktrace()); + cm->IssueMessage(MessageType::FATAL_ERROR, e, tgt->GetBacktrace()); } return contextDependent; } @@ -939,7 +940,8 @@ static bool processSources( err << "Found relative path while evaluating sources of \"" << tgt->GetName() << "\":\n \"" << src << "\"\n"; } - tgt->GetLocalGenerator()->IssueMessage(cmake::FATAL_ERROR, err.str()); + tgt->GetLocalGenerator()->IssueMessage(MessageType::FATAL_ERROR, + err.str()); return contextDependent; } src = fullPath; @@ -955,7 +957,7 @@ static bool processSources( } if (!usedSources.empty()) { tgt->GetLocalGenerator()->GetCMakeInstance()->IssueMessage( - cmake::LOG, + MessageType::LOG, std::string("Used sources for target ") + tgt->GetName() + ":\n" + usedSources, entry->ge->GetBacktrace()); @@ -1129,7 +1131,7 @@ cmGeneratorTarget::KindedSources const& cmGeneratorTarget::GetKindedSources( << "\" use a generator expression that depends on the " "SOURCES themselves."; this->GlobalGenerator->GetCMakeInstance()->IssueMessage( - cmake::FATAL_ERROR, e.str(), this->GetBacktrace()); + MessageType::FATAL_ERROR, e.str(), this->GetBacktrace()); static KindedSources empty; return empty; } @@ -1230,7 +1232,7 @@ void cmGeneratorTarget::ComputeKindedSources(KindedSources& files, e << "but may contain only sources that compile, header files, and " "other files that would not affect linking of a normal library."; this->GlobalGenerator->GetCMakeInstance()->IssueMessage( - cmake::FATAL_ERROR, e.str(), this->GetBacktrace()); + MessageType::FATAL_ERROR, e.str(), this->GetBacktrace()); } } @@ -1388,7 +1390,7 @@ bool cmGeneratorTarget::NeedRelinkBeforeInstall( /* clang-format on */ cmake* cm = this->LocalGenerator->GetCMakeInstance(); - cm->IssueMessage(cmake::FATAL_ERROR, w.str(), this->GetBacktrace()); + cm->IssueMessage(MessageType::FATAL_ERROR, w.str(), this->GetBacktrace()); } return have_rpath; @@ -1519,7 +1521,7 @@ bool cmGeneratorTarget::HasMacOSXRpathInstallNameDir( w << " less than 10.5 or because CMake's platform configuration is"; w << " corrupt."; cmake* cm = this->LocalGenerator->GetCMakeInstance(); - cm->IssueMessage(cmake::FATAL_ERROR, w.str(), this->GetBacktrace()); + cm->IssueMessage(MessageType::FATAL_ERROR, w.str(), this->GetBacktrace()); } return true; @@ -1819,13 +1821,13 @@ public: if (!item.Target) { if (item.AsStr().find("::") != std::string::npos) { bool noMessage = false; - cmake::MessageType messageType = cmake::FATAL_ERROR; + MessageType messageType = MessageType::FATAL_ERROR; std::ostringstream e; switch (this->Target->GetLocalGenerator()->GetPolicyStatus( cmPolicies::CMP0028)) { case cmPolicies::WARN: { e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0028) << "\n"; - messageType = cmake::AUTHOR_WARNING; + messageType = MessageType::AUTHOR_WARNING; } break; case cmPolicies::OLD: noMessage = true; @@ -1928,7 +1930,7 @@ public: } e << "Set the LINKER_LANGUAGE property for this target."; cmake* cm = this->Target->GetLocalGenerator()->GetCMakeInstance(); - cm->IssueMessage(cmake::FATAL_ERROR, e.str(), + cm->IssueMessage(MessageType::FATAL_ERROR, e.str(), this->Target->GetBacktrace()); } return *this->Preferred.begin(); @@ -2053,7 +2055,7 @@ cmGeneratorTarget::CompileInfo const* cmGeneratorTarget::GetCompileInfo( msg += this->GetName(); msg += " which has type "; msg += cmState::GetTargetTypeName(this->GetType()); - this->LocalGenerator->IssueMessage(cmake::INTERNAL_ERROR, msg); + this->LocalGenerator->IssueMessage(MessageType::INTERNAL_ERROR, msg); return nullptr; } @@ -2239,7 +2241,7 @@ cmTargetTraceDependencies::cmTargetTraceDependencies(cmGeneratorTarget* target) << "\"\ndepends on the sources of a target it is used in. This " "is a dependency loop and is not allowed."; this->GeneratorTarget->LocalGenerator->IssueMessage( - cmake::FATAL_ERROR, e.str()); + MessageType::FATAL_ERROR, e.str()); return; } if (emitted.insert(sf).second && @@ -2551,14 +2553,14 @@ static void processIncludeDirectories( for (std::string& entryInclude : entryIncludes) { if (fromImported && !cmSystemTools::FileExists(entryInclude)) { std::ostringstream e; - cmake::MessageType messageType = cmake::FATAL_ERROR; + MessageType messageType = MessageType::FATAL_ERROR; if (checkCMP0027) { switch (tgt->GetPolicyStatusCMP0027()) { case cmPolicies::WARN: e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0027) << "\n"; CM_FALLTHROUGH; case cmPolicies::OLD: - messageType = cmake::AUTHOR_WARNING; + messageType = MessageType::AUTHOR_WARNING; break; case cmPolicies::REQUIRED_ALWAYS: case cmPolicies::REQUIRED_IF_USED: @@ -2584,7 +2586,7 @@ static void processIncludeDirectories( if (!cmSystemTools::FileIsFullPath(entryInclude)) { std::ostringstream e; bool noMessage = false; - cmake::MessageType messageType = cmake::FATAL_ERROR; + MessageType messageType = MessageType::FATAL_ERROR; if (!targetName.empty()) { /* clang-format off */ e << "Target \"" << targetName << "\" contains relative " @@ -2595,7 +2597,7 @@ static void processIncludeDirectories( switch (tgt->GetPolicyStatusCMP0021()) { case cmPolicies::WARN: { e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0021) << "\n"; - messageType = cmake::AUTHOR_WARNING; + messageType = MessageType::AUTHOR_WARNING; } break; case cmPolicies::OLD: noMessage = true; @@ -2611,7 +2613,7 @@ static void processIncludeDirectories( } if (!noMessage) { tgt->GetLocalGenerator()->IssueMessage(messageType, e.str()); - if (messageType == cmake::FATAL_ERROR) { + if (messageType == MessageType::FATAL_ERROR) { return; } } @@ -2631,7 +2633,7 @@ static void processIncludeDirectories( } if (!usedIncludes.empty()) { tgt->GetLocalGenerator()->GetCMakeInstance()->IssueMessage( - cmake::LOG, + MessageType::LOG, std::string("Used includes for target ") + tgt->GetName() + ":\n" + usedIncludes, entry->ge->GetBacktrace()); @@ -2744,7 +2746,7 @@ static void processOptionsInternal( } if (!usedOptions.empty()) { tgt->GetLocalGenerator()->GetCMakeInstance()->IssueMessage( - cmake::LOG, + MessageType::LOG, std::string("Used ") + logName + std::string(" for target ") + tgt->GetName() + ":\n" + usedOptions, entry->ge->GetBacktrace()); @@ -2946,7 +2948,8 @@ std::vector> cmGeneratorTarget::GetCompileDefinitions( case cmPolicies::WARN: { std::ostringstream e; e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0043); - this->LocalGenerator->IssueMessage(cmake::AUTHOR_WARNING, e.str()); + this->LocalGenerator->IssueMessage(MessageType::AUTHOR_WARNING, + e.str()); CM_FALLTHROUGH; } case cmPolicies::OLD: { @@ -3085,7 +3088,7 @@ std::vector> cmGeneratorTarget::GetLinkOptions( return item.find(SHELL) != std::string::npos; }) != linkerOptions.end()) { this->LocalGenerator->GetCMakeInstance()->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, "'SHELL:' prefix is not supported as part of 'LINKER:' arguments.", this->GetBacktrace()); return result; @@ -3219,7 +3222,7 @@ void processLinkDirectories( if (!cmSystemTools::FileIsFullPath(entryDirectory)) { std::ostringstream e; bool noMessage = false; - cmake::MessageType messageType = cmake::FATAL_ERROR; + MessageType messageType = MessageType::FATAL_ERROR; if (!targetName.empty()) { /* clang-format off */ e << "Target \"" << targetName << "\" contains relative " @@ -3230,7 +3233,7 @@ void processLinkDirectories( switch (tgt->GetPolicyStatusCMP0081()) { case cmPolicies::WARN: { e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0081) << "\n"; - messageType = cmake::AUTHOR_WARNING; + messageType = MessageType::AUTHOR_WARNING; } break; case cmPolicies::OLD: noMessage = true; @@ -3247,7 +3250,7 @@ void processLinkDirectories( } if (!noMessage) { tgt->GetLocalGenerator()->IssueMessage(messageType, e.str()); - if (messageType == cmake::FATAL_ERROR) { + if (messageType == MessageType::FATAL_ERROR) { return; } } @@ -3265,7 +3268,7 @@ void processLinkDirectories( } if (!usedDirectories.empty()) { tgt->GetLocalGenerator()->GetCMakeInstance()->IssueMessage( - cmake::LOG, + MessageType::LOG, std::string("Used link directories for target ") + tgt->GetName() + ":\n" + usedDirectories, entry->ge->GetBacktrace()); @@ -3511,7 +3514,7 @@ std::string cmGeneratorTarget::NormalGetRealName( if (this->IsImported()) { std::string msg = "NormalGetRealName called on imported target: "; msg += this->GetName(); - this->LocalGenerator->IssueMessage(cmake::INTERNAL_ERROR, msg); + this->LocalGenerator->IssueMessage(MessageType::INTERNAL_ERROR, msg); } if (this->GetType() == cmStateEnums::EXECUTABLE) { @@ -3545,7 +3548,7 @@ void cmGeneratorTarget::GetLibraryNames(std::string& name, std::string& soName, if (this->IsImported()) { std::string msg = "GetLibraryNames called on imported target: "; msg += this->GetName(); - this->LocalGenerator->IssueMessage(cmake::INTERNAL_ERROR, msg); + this->LocalGenerator->IssueMessage(MessageType::INTERNAL_ERROR, msg); return; } @@ -3622,7 +3625,7 @@ void cmGeneratorTarget::GetExecutableNames(std::string& name, if (this->IsImported()) { std::string msg = "GetExecutableNames called on imported target: "; msg += this->GetName(); - this->LocalGenerator->IssueMessage(cmake::INTERNAL_ERROR, msg); + this->LocalGenerator->IssueMessage(MessageType::INTERNAL_ERROR, msg); } // This versioning is supported only for executables and then only @@ -4123,7 +4126,8 @@ void checkPropertyConsistency(cmGeneratorTarget const* depender, "This is not allowed. Only user-defined properties may appear " "listed in the " << propName << " property."; - depender->GetLocalGenerator()->IssueMessage(cmake::FATAL_ERROR, e.str()); + depender->GetLocalGenerator()->IssueMessage(MessageType::FATAL_ERROR, + e.str()); return; } if (emitted.insert(p).second) { @@ -4263,7 +4267,7 @@ void cmGeneratorTarget::CheckPropertyCompatibility( "in a boolean interpretation, a numeric minimum, a numeric maximum " "or a " "string interpretation, but not a mixture."; - this->LocalGenerator->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->LocalGenerator->IssueMessage(MessageType::FATAL_ERROR, e.str()); } } @@ -4863,7 +4867,8 @@ void cmGeneratorTarget::ReportPropertyOrigin( areport += result; areport += "\"):\n" + report; - this->LocalGenerator->GetCMakeInstance()->IssueMessage(cmake::LOG, areport); + this->LocalGenerator->GetCMakeInstance()->IssueMessage(MessageType::LOG, + areport); } void cmGeneratorTarget::LookupLinkItems(std::vector const& names, @@ -5092,7 +5097,7 @@ cmGeneratorTarget::OutputInfo const* cmGeneratorTarget::GetOutputInfo( msg += this->GetName(); msg += " which has type "; msg += cmState::GetTargetTypeName(this->GetType()); - this->LocalGenerator->IssueMessage(cmake::INTERNAL_ERROR, msg); + this->LocalGenerator->IssueMessage(MessageType::INTERNAL_ERROR, msg); return nullptr; } @@ -5123,7 +5128,7 @@ cmGeneratorTarget::OutputInfo const* cmGeneratorTarget::GetOutputInfo( // An empty map entry indicates we have been called recursively // from the above block. this->LocalGenerator->GetCMakeInstance()->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, "Target '" + this->GetName() + "' OUTPUT_DIRECTORY depends on itself.", this->GetBacktrace()); return nullptr; @@ -5343,7 +5348,7 @@ void cmGeneratorTarget::ComputeLinkInterfaceLibraries( linkIfaceProp << ":\n" " " << explicitLibraries << "\n"; /* clang-format on */ - this->LocalGenerator->IssueMessage(cmake::AUTHOR_WARNING, w.str()); + this->LocalGenerator->IssueMessage(MessageType::AUTHOR_WARNING, w.str()); this->PolicyWarnedCMP0022 = true; } } @@ -5412,7 +5417,8 @@ void cmGeneratorTarget::ComputeLinkInterfaceLibraries( "Link implementation:\n" " " << oldLibraries << "\n"; /* clang-format on */ - this->LocalGenerator->IssueMessage(cmake::AUTHOR_WARNING, w.str()); + this->LocalGenerator->IssueMessage(MessageType::AUTHOR_WARNING, + w.str()); this->PolicyWarnedCMP0022 = true; } } @@ -5720,7 +5726,7 @@ bool cmGeneratorTarget::GetConfigCommonSourceFiles( "Config \"" << *it << "\":\n" " " << thisConfigFiles << "\n"; /* clang-format on */ - this->LocalGenerator->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->LocalGenerator->IssueMessage(MessageType::FATAL_ERROR, e.str()); return false; } } @@ -5778,7 +5784,8 @@ std::string cmGeneratorTarget::CheckCMP0004(std::string const& item) const w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0004) << "\n" << "Target \"" << this->GetName() << "\" links to item \"" << item << "\" which has leading or trailing whitespace."; - cm->IssueMessage(cmake::AUTHOR_WARNING, w.str(), this->GetBacktrace()); + cm->IssueMessage(MessageType::AUTHOR_WARNING, w.str(), + this->GetBacktrace()); } case cmPolicies::OLD: break; @@ -5787,7 +5794,8 @@ std::string cmGeneratorTarget::CheckCMP0004(std::string const& item) const e << "Target \"" << this->GetName() << "\" links to item \"" << item << "\" which has leading or trailing whitespace. " << "This is now an error according to policy CMP0004."; - cm->IssueMessage(cmake::FATAL_ERROR, e.str(), this->GetBacktrace()); + cm->IssueMessage(MessageType::FATAL_ERROR, e.str(), + this->GetBacktrace()); } break; case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: { @@ -5795,7 +5803,8 @@ std::string cmGeneratorTarget::CheckCMP0004(std::string const& item) const e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0004) << "\n" << "Target \"" << this->GetName() << "\" links to item \"" << item << "\" which has leading or trailing whitespace."; - cm->IssueMessage(cmake::FATAL_ERROR, e.str(), this->GetBacktrace()); + cm->IssueMessage(MessageType::FATAL_ERROR, e.str(), + this->GetBacktrace()); } break; } } @@ -5959,12 +5968,12 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries( if (name == this->GetName() || name.empty()) { if (name == this->GetName()) { bool noMessage = false; - cmake::MessageType messageType = cmake::FATAL_ERROR; + MessageType messageType = MessageType::FATAL_ERROR; std::ostringstream e; switch (this->GetPolicyStatusCMP0038()) { case cmPolicies::WARN: { e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0038) << "\n"; - messageType = cmake::AUTHOR_WARNING; + messageType = MessageType::AUTHOR_WARNING; } break; case cmPolicies::OLD: noMessage = true; @@ -5979,7 +5988,7 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries( e << "Target \"" << this->GetName() << "\" links to itself."; this->LocalGenerator->GetCMakeInstance()->IssueMessage( messageType, e.str(), this->GetBacktrace()); - if (messageType == cmake::FATAL_ERROR) { + if (messageType == MessageType::FATAL_ERROR) { return; } } diff --git a/Source/cmGetDirectoryPropertyCommand.cxx b/Source/cmGetDirectoryPropertyCommand.cxx index 0d4d653..a92eb71 100644 --- a/Source/cmGetDirectoryPropertyCommand.cxx +++ b/Source/cmGetDirectoryPropertyCommand.cxx @@ -4,9 +4,9 @@ #include "cmGlobalGenerator.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmPolicies.h" #include "cmSystemTools.h" -#include "cmake.h" class cmExecutionStatus; @@ -76,7 +76,7 @@ bool cmGetDirectoryPropertyCommand::InitialPass( switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0059)) { case cmPolicies::WARN: this->Makefile->IssueMessage( - cmake::AUTHOR_WARNING, + MessageType::AUTHOR_WARNING, cmPolicies::GetPolicyWarning(cmPolicies::CMP0059)); CM_FALLTHROUGH; case cmPolicies::OLD: diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx index 1d812bd..039f439 100644 --- a/Source/cmGetPropertyCommand.cxx +++ b/Source/cmGetPropertyCommand.cxx @@ -8,6 +8,7 @@ #include "cmInstalledFile.h" #include "cmListFileCache.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmPolicies.h" #include "cmProperty.h" #include "cmPropertyDefinition.h" @@ -230,7 +231,7 @@ bool cmGetPropertyCommand::HandleDirectoryMode() if (this->PropertyName == "DEFINITIONS") { switch (mf->GetPolicyStatus(cmPolicies::CMP0059)) { case cmPolicies::WARN: - mf->IssueMessage(cmake::AUTHOR_WARNING, + mf->IssueMessage(MessageType::AUTHOR_WARNING, cmPolicies::GetPolicyWarning(cmPolicies::CMP0059)); CM_FALLTHROUGH; case cmPolicies::OLD: diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx index ec485aa..fc0e9c6 100644 --- a/Source/cmGetTargetPropertyCommand.cxx +++ b/Source/cmGetTargetPropertyCommand.cxx @@ -6,10 +6,10 @@ #include "cmListFileCache.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmPolicies.h" #include "cmTarget.h" #include "cmTargetPropertyComputer.h" -#include "cmake.h" class cmExecutionStatus; class cmMessenger; @@ -52,7 +52,7 @@ bool cmGetTargetPropertyCommand::InitialPass( } else { bool issueMessage = false; std::ostringstream e; - cmake::MessageType messageType = cmake::AUTHOR_WARNING; + MessageType messageType = MessageType::AUTHOR_WARNING; switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0045)) { case cmPolicies::WARN: issueMessage = true; @@ -63,13 +63,13 @@ bool cmGetTargetPropertyCommand::InitialPass( case cmPolicies::REQUIRED_ALWAYS: case cmPolicies::NEW: issueMessage = true; - messageType = cmake::FATAL_ERROR; + messageType = MessageType::FATAL_ERROR; } if (issueMessage) { e << "get_target_property() called with non-existent target \"" << targetName << "\"."; this->Makefile->IssueMessage(messageType, e.str()); - if (messageType == cmake::FATAL_ERROR) { + if (messageType == MessageType::FATAL_ERROR) { return false; } } diff --git a/Source/cmGlobalBorlandMakefileGenerator.cxx b/Source/cmGlobalBorlandMakefileGenerator.cxx index 2389103..56714b1 100644 --- a/Source/cmGlobalBorlandMakefileGenerator.cxx +++ b/Source/cmGlobalBorlandMakefileGenerator.cxx @@ -5,6 +5,7 @@ #include "cmDocumentationEntry.h" #include "cmLocalUnixMakefileGenerator3.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmState.h" #include "cmake.h" diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 47c53e7..85c2345 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -32,6 +32,7 @@ #include "cmLocalGenerator.h" #include "cmMSVC60LinkLineComputer.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmOutputConverter.h" #include "cmPolicies.h" #include "cmSourceFile.h" @@ -137,7 +138,7 @@ bool cmGlobalGenerator::SetGeneratorInstance(std::string const& i, " " << i << "\n" "was specified."; /* clang-format on */ - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); return false; } @@ -157,7 +158,7 @@ bool cmGlobalGenerator::SetGeneratorPlatform(std::string const& p, " " << p << "\n" "was specified."; /* clang-format on */ - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); return false; } @@ -176,7 +177,7 @@ bool cmGlobalGenerator::SetGeneratorToolset(std::string const& ts, " " << ts << "\n" "was specified."; /* clang-format on */ - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); return false; } @@ -319,8 +320,8 @@ bool cmGlobalGenerator::CheckTargetsForMissingSources() const if (srcs.empty()) { std::ostringstream e; e << "No SOURCES given to target: " << target->GetName(); - this->GetCMakeInstance()->IssueMessage(cmake::FATAL_ERROR, e.str(), - target->GetBacktrace()); + this->GetCMakeInstance()->IssueMessage( + MessageType::FATAL_ERROR, e.str(), target->GetBacktrace()); failed = true; } } @@ -454,7 +455,7 @@ void cmGlobalGenerator::EnableLanguage( e << "Language '" << li << "' is currently being enabled. " "Recursive call not allowed."; - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); cmSystemTools::SetFatalErrorOccured(); return; } @@ -471,7 +472,7 @@ void cmGlobalGenerator::EnableLanguage( std::ostringstream e; e << "The test project needs language " << lang << " which is not enabled."; - this->TryCompileOuterMakefile->IssueMessage(cmake::FATAL_ERROR, + this->TryCompileOuterMakefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); cmSystemTools::SetFatalErrorOccured(); return; @@ -775,7 +776,7 @@ void cmGlobalGenerator::EnableLanguage( if (!this->CMakeInstance->GetIsInTryCompile()) { this->PrintCompilerAdvice(noCompiler, lang, mf->GetDefinition(compilerEnv)); - mf->IssueMessage(cmake::FATAL_ERROR, noCompiler.str()); + mf->IssueMessage(MessageType::FATAL_ERROR, noCompiler.str()); fatalError = true; } } @@ -903,7 +904,7 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility( " compiler id \"AppleClang\" to \"Clang\" for compatibility." ; /* clang-format on */ - mf->IssueMessage(cmake::AUTHOR_WARNING, w.str()); + mf->IssueMessage(MessageType::AUTHOR_WARNING, w.str()); } CM_FALLTHROUGH; case cmPolicies::OLD: @@ -913,7 +914,7 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility( case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: mf->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0025)); case cmPolicies::NEW: // NEW behavior is to keep AppleClang. @@ -933,7 +934,7 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility( " compiler id \"QCC\" to \"GNU\" for compatibility." ; /* clang-format on */ - mf->IssueMessage(cmake::AUTHOR_WARNING, w.str()); + mf->IssueMessage(MessageType::AUTHOR_WARNING, w.str()); } CM_FALLTHROUGH; case cmPolicies::OLD: @@ -948,7 +949,7 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility( case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: mf->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0047)); CM_FALLTHROUGH; case cmPolicies::NEW: @@ -1410,13 +1411,13 @@ void cmGlobalGenerator::Generate() if (!this->GenerateCPackPropertiesFile()) { this->GetCMakeInstance()->IssueMessage( - cmake::FATAL_ERROR, "Could not write CPack properties file."); + MessageType::FATAL_ERROR, "Could not write CPack properties file."); } for (auto& buildExpSet : this->BuildExportSets) { if (!buildExpSet.second->GenerateImportFile()) { if (!cmSystemTools::GetErrorOccuredFlag()) { - this->GetCMakeInstance()->IssueMessage(cmake::FATAL_ERROR, + this->GetCMakeInstance()->IssueMessage(MessageType::FATAL_ERROR, "Could not write export file."); } return; @@ -1439,7 +1440,8 @@ void cmGlobalGenerator::Generate() for (std::string const& t : this->CMP0042WarnTargets) { w << " " << t << "\n"; } - this->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING, w.str()); + this->GetCMakeInstance()->IssueMessage(MessageType::AUTHOR_WARNING, + w.str()); } if (!this->CMP0068WarnTargets.empty()) { @@ -1455,7 +1457,8 @@ void cmGlobalGenerator::Generate() for (std::string const& t : this->CMP0068WarnTargets) { w << " " << t << "\n"; } - this->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING, w.str()); + this->GetCMakeInstance()->IssueMessage(MessageType::AUTHOR_WARNING, + w.str()); } this->CMakeInstance->UpdateProgress("Generating done", -1); @@ -2233,7 +2236,7 @@ bool cmGlobalGenerator::CheckCMP0037(std::string const& targetName, if (!tgt) { return true; } - cmake::MessageType messageType = cmake::AUTHOR_WARNING; + MessageType messageType = MessageType::AUTHOR_WARNING; std::ostringstream e; bool issueMessage = false; switch (tgt->GetPolicyStatusCMP0037()) { @@ -2247,18 +2250,18 @@ bool cmGlobalGenerator::CheckCMP0037(std::string const& targetName, case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: issueMessage = true; - messageType = cmake::FATAL_ERROR; + messageType = MessageType::FATAL_ERROR; break; } if (issueMessage) { e << "The target name \"" << targetName << "\" is reserved " << reason << "."; - if (messageType == cmake::AUTHOR_WARNING) { + if (messageType == MessageType::AUTHOR_WARNING) { e << " It may result in undefined behavior."; } this->GetCMakeInstance()->IssueMessage(messageType, e.str(), tgt->GetBacktrace()); - if (messageType == cmake::FATAL_ERROR) { + if (messageType == MessageType::FATAL_ERROR) { return false; } } @@ -2453,7 +2456,7 @@ void cmGlobalGenerator::AddGlobalTarget_Install( bool skipInstallRules = mf->IsOn("CMAKE_SKIP_INSTALL_RULES"); if (this->InstallTargetEnabled && skipInstallRules) { this->CMakeInstance->IssueMessage( - cmake::WARNING, + MessageType::WARNING, "CMAKE_SKIP_INSTALL_RULES was enabled even though " "installation rules have been specified", mf->GetBacktrace()); diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index a9742c5..831c4a9 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -12,6 +12,7 @@ #include "cmLocalGhsMultiGenerator.h" #include "cmMakefile.h" #include "cmVersion.h" +#include "cmake.h" const char* cmGlobalGhsMultiGenerator::FILE_EXTENSION = ".gpj"; const char* cmGlobalGhsMultiGenerator::DEFAULT_BUILD_PROGRAM = "gbuild.exe"; diff --git a/Source/cmGlobalJOMMakefileGenerator.cxx b/Source/cmGlobalJOMMakefileGenerator.cxx index 0f41ea1..9c805a8 100644 --- a/Source/cmGlobalJOMMakefileGenerator.cxx +++ b/Source/cmGlobalJOMMakefileGenerator.cxx @@ -6,6 +6,7 @@ #include "cmLocalUnixMakefileGenerator3.h" #include "cmMakefile.h" #include "cmState.h" +#include "cmake.h" cmGlobalJOMMakefileGenerator::cmGlobalJOMMakefileGenerator(cmake* cm) : cmGlobalUnixMakefileGenerator3(cm) diff --git a/Source/cmGlobalMSYSMakefileGenerator.cxx b/Source/cmGlobalMSYSMakefileGenerator.cxx index 3f22382..3c24556 100644 --- a/Source/cmGlobalMSYSMakefileGenerator.cxx +++ b/Source/cmGlobalMSYSMakefileGenerator.cxx @@ -7,6 +7,7 @@ #include "cmDocumentationEntry.h" #include "cmLocalUnixMakefileGenerator3.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmState.h" #include "cmake.h" diff --git a/Source/cmGlobalMinGWMakefileGenerator.cxx b/Source/cmGlobalMinGWMakefileGenerator.cxx index 3c3a5d1..c6d46e9 100644 --- a/Source/cmGlobalMinGWMakefileGenerator.cxx +++ b/Source/cmGlobalMinGWMakefileGenerator.cxx @@ -6,6 +6,7 @@ #include "cmLocalUnixMakefileGenerator3.h" #include "cmMakefile.h" #include "cmState.h" +#include "cmake.h" cmGlobalMinGWMakefileGenerator::cmGlobalMinGWMakefileGenerator(cmake* cm) : cmGlobalUnixMakefileGenerator3(cm) diff --git a/Source/cmGlobalNMakeMakefileGenerator.cxx b/Source/cmGlobalNMakeMakefileGenerator.cxx index eb66bd1..5235be7 100644 --- a/Source/cmGlobalNMakeMakefileGenerator.cxx +++ b/Source/cmGlobalNMakeMakefileGenerator.cxx @@ -6,6 +6,7 @@ #include "cmLocalUnixMakefileGenerator3.h" #include "cmMakefile.h" #include "cmState.h" +#include "cmake.h" cmGlobalNMakeMakefileGenerator::cmGlobalNMakeMakefileGenerator(cmake* cm) : cmGlobalUnixMakefileGenerator3(cm) diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index dcd2585..57d341a 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -23,6 +23,7 @@ #include "cmLocalGenerator.h" #include "cmLocalNinjaGenerator.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmNinjaLinkLineComputer.h" #include "cmOutputConverter.h" #include "cmState.h" @@ -502,7 +503,8 @@ void cmGlobalNinjaGenerator::Generate() msg << "The detected version of Ninja (" << this->NinjaVersion; msg << ") is less than the version of Ninja required by CMake ("; msg << cmGlobalNinjaGenerator::RequiredNinjaVersion() << ")."; - this->GetCMakeInstance()->IssueMessage(cmake::FATAL_ERROR, msg.str()); + this->GetCMakeInstance()->IssueMessage(MessageType::FATAL_ERROR, + msg.str()); return; } this->OpenBuildFileStream(); @@ -554,7 +556,7 @@ bool cmGlobalNinjaGenerator::FindMakeProgram(cmMakefile* mf) if (!cmSystemTools::RunSingleCommand(command, &version, &error, nullptr, nullptr, cmSystemTools::OUTPUT_NONE)) { - mf->IssueMessage(cmake::FATAL_ERROR, + mf->IssueMessage(MessageType::FATAL_ERROR, "Running\n '" + cmJoin(command, "' '") + "'\n" "failed with:\n " + @@ -634,7 +636,7 @@ bool cmGlobalNinjaGenerator::CheckFortran(cmMakefile* mf) const ; /* clang-format on */ } - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); cmSystemTools::SetFatalErrorOccured(); return false; } @@ -1300,7 +1302,8 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os) "options to the custom commands that produce these files." ; /* clang-format on */ - this->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING, w.str()); + this->GetCMakeInstance()->IssueMessage(MessageType::AUTHOR_WARNING, + w.str()); } } @@ -1428,7 +1431,8 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os) << "\n"; msg << "Any pre-check scripts, such as those generated for file(GLOB " "CONFIGURE_DEPENDS), will not be run by Ninja."; - this->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING, msg.str()); + this->GetCMakeInstance()->IssueMessage(MessageType::AUTHOR_WARNING, + msg.str()); } std::sort(implicitDeps.begin(), implicitDeps.end()); diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 2932970..f6c8012 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -7,6 +7,7 @@ #include "cmGeneratorTarget.h" #include "cmLocalVisualStudio10Generator.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmSourceFile.h" #include "cmVersion.h" #include "cmVisualStudioSlnData.h" @@ -179,7 +180,7 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset( std::ostringstream e; e << this->GetName() << " Windows CE version '" << this->SystemVersion << "' requires CMAKE_GENERATOR_TOOLSET to be set."; - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); return false; } @@ -252,7 +253,7 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset( "contains an invalid version specification." ; /* clang-format on */ - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); // Clear the configured tool-set this->GeneratorToolsetVersion.clear(); @@ -279,7 +280,7 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset( " " << toolsetPath; ; /* clang-format on */ - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); // Clear the configured tool-set this->GeneratorToolsetVersion.clear(); @@ -333,7 +334,7 @@ bool cmGlobalVisualStudio10Generator::ParseGeneratorToolset( "that contains a field after the first ',' with no '='." ; /* clang-format on */ - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); return false; } std::string const key = fi->substr(0, pos); @@ -349,7 +350,7 @@ bool cmGlobalVisualStudio10Generator::ParseGeneratorToolset( "that contains duplicate field key '" << key << "'." ; /* clang-format on */ - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); return false; } if (!this->ProcessGeneratorToolsetField(key, value)) { @@ -363,7 +364,7 @@ bool cmGlobalVisualStudio10Generator::ParseGeneratorToolset( "that contains invalid field '" << *fi << "'." ; /* clang-format on */ - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); return false; } } @@ -411,12 +412,12 @@ bool cmGlobalVisualStudio10Generator::InitializeSystem(cmMakefile* mf) std::ostringstream e; e << "CMAKE_SYSTEM_NAME is 'Android' but CMAKE_GENERATOR " << "specifies a platform too: '" << this->GetName() << "'"; - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); return false; } std::string v = this->GetInstalledNsightTegraVersion(); if (v.empty()) { - mf->IssueMessage(cmake::FATAL_ERROR, + mf->IssueMessage(MessageType::FATAL_ERROR, "CMAKE_SYSTEM_NAME is 'Android' but " "'NVIDIA Nsight Tegra Visual Studio Edition' " "is not installed."); @@ -442,7 +443,7 @@ bool cmGlobalVisualStudio10Generator::InitializeWindowsCE(cmMakefile* mf) std::ostringstream e; e << "CMAKE_SYSTEM_NAME is 'WindowsCE' but CMAKE_GENERATOR " << "specifies a platform too: '" << this->GetName() << "'"; - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); return false; } @@ -455,7 +456,7 @@ bool cmGlobalVisualStudio10Generator::InitializeWindowsPhone(cmMakefile* mf) { std::ostringstream e; e << this->GetName() << " does not support Windows Phone."; - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); return false; } @@ -463,7 +464,7 @@ bool cmGlobalVisualStudio10Generator::InitializeWindowsStore(cmMakefile* mf) { std::ostringstream e; e << this->GetName() << " does not support Windows Store."; - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); return false; } @@ -524,7 +525,7 @@ void cmGlobalVisualStudio10Generator::Generate() "To avoid this problem CMake must use a full path for this file " "which then triggers the VS 10 property dialog bug."; /* clang-format on */ - lg->IssueMessage(cmake::WARNING, e.str().c_str()); + lg->IssueMessage(MessageType::WARNING, e.str().c_str()); } } @@ -707,7 +708,7 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf) // Prepare the work directory. if (!cmSystemTools::MakeDirectory(wd)) { std::string e = "Failed to make directory:\n " + wd; - mf->IssueMessage(cmake::FATAL_ERROR, e.c_str()); + mf->IssueMessage(MessageType::FATAL_ERROR, e.c_str()); cmSystemTools::SetFatalErrorOccured(); return false; } @@ -829,7 +830,7 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf) if (ret != 0) { e << "Exit code: " << ret << "\n"; } - mf->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); + mf->IssueMessage(MessageType::FATAL_ERROR, e.str().c_str()); cmSystemTools::SetFatalErrorOccured(); return false; } @@ -973,7 +974,7 @@ bool cmGlobalVisualStudio10Generator::Find64BitTools(cmMakefile* mf) << "Install the Microsoft Windows SDK v7.1 to get 64-bit tools:\n" << " http://msdn.microsoft.com/en-us/windows/bb980924.aspx"; /* clang-format on */ - mf->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); + mf->IssueMessage(MessageType::FATAL_ERROR, e.str().c_str()); cmSystemTools::SetFatalErrorOccured(); return false; } @@ -1154,7 +1155,7 @@ cmIDEFlagTable const* cmGlobalVisualStudio10Generator::LoadFlagTable( e << "JSON flag table \"" << filename << "\" could not be loaded.\n"; /* clang-format on */ - mf->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); + mf->IssueMessage(MessageType::FATAL_ERROR, e.str().c_str()); } return ret; } diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index 07318cf..36eb492 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -133,7 +133,7 @@ bool cmGlobalVisualStudio11Generator::InitializeWindowsPhone(cmMakefile* mf) << "Desktop SDK as well as the Windows Phone '" << this->SystemVersion << "' SDK. Please make sure that you have both installed"; } - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); return false; } return true; @@ -151,7 +151,7 @@ bool cmGlobalVisualStudio11Generator::InitializeWindowsStore(cmMakefile* mf) << "Desktop SDK as well as the Windows Store '" << this->SystemVersion << "' SDK. Please make sure that you have both installed"; } - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); return false; } return true; diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx index f9da68c..61034a7 100644 --- a/Source/cmGlobalVisualStudio12Generator.cxx +++ b/Source/cmGlobalVisualStudio12Generator.cxx @@ -129,7 +129,7 @@ bool cmGlobalVisualStudio12Generator::InitializeWindowsPhone(cmMakefile* mf) << "Desktop SDK as well as the Windows Phone '" << this->SystemVersion << "' SDK. Please make sure that you have both installed"; } - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); return false; } return true; @@ -149,7 +149,7 @@ bool cmGlobalVisualStudio12Generator::InitializeWindowsStore(cmMakefile* mf) << "Desktop SDK as well as the Windows Store '" << this->SystemVersion << "' SDK. Please make sure that you have both installed"; } - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); return false; } return true; diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx index 8f7dac9..5ea5e67 100644 --- a/Source/cmGlobalVisualStudio14Generator.cxx +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -126,7 +126,7 @@ bool cmGlobalVisualStudio14Generator::InitializeWindowsStore(cmMakefile* mf) << "Desktop SDK as well as the Windows Store '" << this->SystemVersion << "' SDK. Please make sure that you have both installed"; } - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); return false; } if (cmHasLiteralPrefix(this->SystemVersion, "10.0")) { @@ -144,7 +144,7 @@ bool cmGlobalVisualStudio14Generator::SelectWindows10SDK(cmMakefile* mf, std::ostringstream e; e << "Could not find an appropriate version of the Windows 10 SDK" << " installed on this machine"; - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); return false; } if (!cmSystemTools::VersionCompareEqual(this->WindowsTargetPlatformVersion, diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index 8694df2..16796cf 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -6,7 +6,7 @@ #include "cmGeneratorTarget.h" #include "cmLocalVisualStudio7Generator.h" #include "cmMakefile.h" -#include "cmake.h" +#include "cmMessageType.h" cmGlobalVisualStudio71Generator::cmGlobalVisualStudio71Generator( cmake* cm, const std::string& platformName) diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 5855177..cae46e1 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -6,6 +6,7 @@ #include "cmGeneratorTarget.h" #include "cmLocalVisualStudio7Generator.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmState.h" #include "cmUuid.h" #include "cmake.h" diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 55284c9..4d165c2 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -7,6 +7,7 @@ #include "cmGeneratorTarget.h" #include "cmLocalVisualStudio7Generator.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmSourceFile.h" #include "cmVisualStudioWCEPlatformParser.h" #include "cmake.h" diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx index e784595..445b40c 100644 --- a/Source/cmGlobalVisualStudio9Generator.cxx +++ b/Source/cmGlobalVisualStudio9Generator.cxx @@ -5,8 +5,8 @@ #include "cmDocumentationEntry.h" #include "cmLocalVisualStudio7Generator.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmVisualStudioWCEPlatformParser.h" -#include "cmake.h" static const char vs9generatorName[] = "Visual Studio 9 2008"; diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 57510df..41d961c 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -19,6 +19,7 @@ #include "cmSourceFile.h" #include "cmState.h" #include "cmTarget.h" +#include "cmake.h" cmGlobalVisualStudioGenerator::cmGlobalVisualStudioGenerator( cmake* cm, std::string const& platformInGeneratorName) @@ -523,7 +524,7 @@ std::string cmGlobalVisualStudioGenerator::GetStartupProjectName( return startup; } else { root->GetMakefile()->IssueMessage( - cmake::AUTHOR_WARNING, + MessageType::AUTHOR_WARNING, "Directory property VS_STARTUP_PROJECT specifies target " "'" + startup + "' that does not exist. Ignoring."); diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx index f06c019..99f9503 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx +++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx @@ -7,6 +7,7 @@ #include "cmLocalVisualStudio10Generator.h" #include "cmMakefile.h" #include "cmVSSetupHelper.h" +#include "cmake.h" #if defined(_M_ARM64) # define HOST_PLATFORM_NAME "ARM64"; @@ -256,7 +257,7 @@ bool cmGlobalVisualStudioVersionedGenerator::SetGeneratorInstance( "could not find specified instance of Visual Studio:\n" " " << i; /* clang-format on */ - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); return false; } } @@ -270,7 +271,7 @@ bool cmGlobalVisualStudioVersionedGenerator::SetGeneratorInstance( " " << this->GetName() << "\n" "could not find any instance of Visual Studio.\n"; /* clang-format on */ - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); return false; } diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index d6ab769..6618351 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -21,6 +21,7 @@ #include "cmLocalGenerator.h" #include "cmLocalXCodeGenerator.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmOutputConverter.h" #include "cmSourceFile.h" #include "cmSourceGroup.h" @@ -201,7 +202,7 @@ cmGlobalGenerator* cmGlobalXCodeGenerator::Factory::CreateGlobalGenerator( unsigned int version_number = 10 * v[0] + v[1]; if (version_number < 30) { - cm->IssueMessage(cmake::FATAL_ERROR, + cm->IssueMessage(MessageType::FATAL_ERROR, "Xcode " + version_string + " not supported."); return nullptr; } @@ -263,7 +264,7 @@ bool cmGlobalXCodeGenerator::SetGeneratorToolset(std::string const& ts, " " << ts << "\n" "that was specified."; /* clang-format on */ - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); return false; } this->GeneratorToolset = ts; @@ -774,7 +775,7 @@ public: "specified for source:\n" " " << this->SourceFile->GetFullPath() << "\n"; /* clang-format on */ - this->LocalGenerator->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->LocalGenerator->IssueMessage(MessageType::FATAL_ERROR, e.str()); } return processed; diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx index 5d952da..d1f8f58 100644 --- a/Source/cmIfCommand.cxx +++ b/Source/cmIfCommand.cxx @@ -6,6 +6,7 @@ #include "cmExecutionStatus.h" #include "cmExpandedCommandArgument.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmOutputConverter.h" #include "cmSystemTools.h" #include "cmake.h" @@ -60,7 +61,7 @@ bool cmIfFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff, if (this->ElseSeen) { cmListFileBacktrace bt = mf.GetBacktrace(func); mf.GetCMakeInstance()->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, "A duplicate ELSE command was found inside an IF block.", bt); cmSystemTools::SetFatalErrorOccured(); return true; @@ -79,7 +80,7 @@ bool cmIfFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff, if (this->ElseSeen) { cmListFileBacktrace bt = mf.GetBacktrace(func); mf.GetCMakeInstance()->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, "An ELSEIF command was found after an ELSE command.", bt); cmSystemTools::SetFatalErrorOccured(); return true; @@ -98,7 +99,7 @@ bool cmIfFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff, std::vector expandedArguments; mf.ExpandArguments(func.Arguments, expandedArguments); - cmake::MessageType messType; + MessageType messType; cmListFileContext conditionContext = cmListFileContext::FromCommandContext( @@ -115,7 +116,7 @@ bool cmIfFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff, err += errorString; cmListFileBacktrace bt = mf.GetBacktrace(func); mf.GetCMakeInstance()->IssueMessage(messType, err, bt); - if (messType == cmake::FATAL_ERROR) { + if (messType == MessageType::FATAL_ERROR) { cmSystemTools::SetFatalErrorOccured(); return true; } @@ -181,7 +182,7 @@ bool cmIfCommand::InvokeInitialPass( std::vector expandedArguments; this->Makefile->ExpandArguments(args, expandedArguments); - cmake::MessageType status; + MessageType status; cmConditionEvaluator conditionEvaluator( *(this->Makefile), this->Makefile->GetExecutionContext(), @@ -193,8 +194,8 @@ bool cmIfCommand::InvokeInitialPass( if (!errorString.empty()) { std::string err = "if " + cmIfCommandError(expandedArguments); err += errorString; - if (status == cmake::FATAL_ERROR) { - this->Makefile->IssueMessage(cmake::FATAL_ERROR, err); + if (status == MessageType::FATAL_ERROR) { + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, err); cmSystemTools::SetFatalErrorOccured(); return true; } diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx index f862578..594c310 100644 --- a/Source/cmIncludeCommand.cxx +++ b/Source/cmIncludeCommand.cxx @@ -6,9 +6,9 @@ #include "cmGlobalGenerator.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmPolicies.h" #include "cmSystemTools.h" -#include "cmake.h" class cmExecutionStatus; @@ -58,7 +58,7 @@ bool cmIncludeCommand::InitialPass(std::vector const& args, } if (fname.empty()) { - this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, + this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, "include() given empty file name (ignored)."); return true; } @@ -80,7 +80,7 @@ bool cmIncludeCommand::InitialPass(std::vector const& args, if (gg->IsExportedTargetsFile(fname_abs)) { const char* modal = nullptr; std::ostringstream e; - cmake::MessageType messageType = cmake::AUTHOR_WARNING; + MessageType messageType = MessageType::AUTHOR_WARNING; switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0024)) { case cmPolicies::WARN: @@ -92,7 +92,7 @@ bool cmIncludeCommand::InitialPass(std::vector const& args, case cmPolicies::REQUIRED_ALWAYS: case cmPolicies::NEW: modal = "may"; - messageType = cmake::FATAL_ERROR; + messageType = MessageType::FATAL_ERROR; } if (modal) { e << "The file\n " << fname_abs @@ -103,7 +103,7 @@ bool cmIncludeCommand::InitialPass(std::vector const& args, "include() command. Use ALIAS targets instead to refer to targets " "by alternative names.\n"; this->Makefile->IssueMessage(messageType, e.str()); - if (messageType == cmake::FATAL_ERROR) { + if (messageType == MessageType::FATAL_ERROR) { return false; } } diff --git a/Source/cmIncludeExternalMSProjectCommand.cxx b/Source/cmIncludeExternalMSProjectCommand.cxx index c9217d3..b224d09 100644 --- a/Source/cmIncludeExternalMSProjectCommand.cxx +++ b/Source/cmIncludeExternalMSProjectCommand.cxx @@ -8,6 +8,7 @@ # include "cmStateTypes.h" # include "cmSystemTools.h" # include "cmTarget.h" +# include "cmake.h" #endif class cmExecutionStatus; diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index 7c8458a..c6f4064 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -23,12 +23,12 @@ #include "cmInstallTargetGenerator.h" #include "cmListFileCache.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmPolicies.h" #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmTarget.h" #include "cmTargetExport.h" -#include "cmake.h" class cmExecutionStatus; @@ -864,7 +864,7 @@ bool cmInstallCommand::HandleFilesMode(std::vector const& args) if (gg->IsExportedTargetsFile(file)) { const char* modal = nullptr; std::ostringstream e; - cmake::MessageType messageType = cmake::AUTHOR_WARNING; + MessageType messageType = MessageType::AUTHOR_WARNING; switch (status) { case cmPolicies::WARN: @@ -876,7 +876,7 @@ bool cmInstallCommand::HandleFilesMode(std::vector const& args) case cmPolicies::REQUIRED_ALWAYS: case cmPolicies::NEW: modal = "may"; - messageType = cmake::FATAL_ERROR; + messageType = MessageType::FATAL_ERROR; } if (modal) { e << "The file\n " << file @@ -887,7 +887,7 @@ bool cmInstallCommand::HandleFilesMode(std::vector const& args) "install() command. Use the install(EXPORT) mechanism " "instead. See the cmake-packages(7) manual for more.\n"; this->Makefile->IssueMessage(messageType, e.str()); - if (messageType == cmake::FATAL_ERROR) { + if (messageType == MessageType::FATAL_ERROR) { return false; } } @@ -1495,7 +1495,7 @@ bool cmInstallCommand::CheckCMP0006(bool& failure) switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0006)) { case cmPolicies::WARN: this->Makefile->IssueMessage( - cmake::AUTHOR_WARNING, + MessageType::AUTHOR_WARNING, cmPolicies::GetPolicyWarning(cmPolicies::CMP0006)); CM_FALLTHROUGH; case cmPolicies::OLD: @@ -1508,7 +1508,7 @@ bool cmInstallCommand::CheckCMP0006(bool& failure) case cmPolicies::REQUIRED_ALWAYS: failure = true; this->Makefile->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0006)); break; } diff --git a/Source/cmInstallExportAndroidMKGenerator.cxx b/Source/cmInstallExportAndroidMKGenerator.cxx index dd85b88..85b7021 100644 --- a/Source/cmInstallExportAndroidMKGenerator.cxx +++ b/Source/cmInstallExportAndroidMKGenerator.cxx @@ -13,7 +13,7 @@ #include "cmInstallTargetGenerator.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" -#include "cmake.h" +#include "cmMessageType.h" cmInstallExportAndroidMKGenerator::cmInstallExportAndroidMKGenerator( cmExportSet* exportSet, const char* destination, diff --git a/Source/cmInstallScriptGenerator.cxx b/Source/cmInstallScriptGenerator.cxx index b93debb..12e87c7 100644 --- a/Source/cmInstallScriptGenerator.cxx +++ b/Source/cmInstallScriptGenerator.cxx @@ -7,9 +7,9 @@ #include "cmGeneratorExpression.h" #include "cmLocalGenerator.h" +#include "cmMessageType.h" #include "cmPolicies.h" #include "cmScriptGenerator.h" -#include "cmake.h" cmInstallScriptGenerator::cmInstallScriptGenerator(const char* script, bool code, @@ -39,7 +39,7 @@ void cmInstallScriptGenerator::Compute(cmLocalGenerator* lg) switch (this->LocalGenerator->GetPolicyStatus(cmPolicies::CMP0087)) { case cmPolicies::WARN: this->LocalGenerator->IssueMessage( - cmake::AUTHOR_WARNING, + MessageType::AUTHOR_WARNING, cmPolicies::GetPolicyWarning(cmPolicies::CMP0087)); CM_FALLTHROUGH; case cmPolicies::OLD: diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index ea3d522..86c6a58 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -15,6 +15,7 @@ #include "cmInstallType.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmTarget.h" @@ -91,7 +92,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig( case cmStateEnums::GLOBAL_TARGET: case cmStateEnums::UNKNOWN_LIBRARY: this->Target->GetLocalGenerator()->IssueMessage( - cmake::INTERNAL_ERROR, + MessageType::INTERNAL_ERROR, "cmInstallTargetGenerator created with non-installable target."); return; } @@ -695,7 +696,7 @@ void cmInstallTargetGenerator::AddChrpathPatchRule( << "Therefore, runtime paths will not be changed when installing. " << "CMAKE_BUILD_WITH_INSTALL_RPATH may be used to work around" " this limitation."; - mf->IssueMessage(cmake::WARNING, msg.str()); + mf->IssueMessage(MessageType::WARNING, msg.str()); } else { // Note: These paths are kept unique to avoid // install_name_tool corruption. diff --git a/Source/cmLinkDirectoriesCommand.cxx b/Source/cmLinkDirectoriesCommand.cxx index 10425fd..7850977 100644 --- a/Source/cmLinkDirectoriesCommand.cxx +++ b/Source/cmLinkDirectoriesCommand.cxx @@ -7,9 +7,9 @@ #include "cmAlgorithms.h" #include "cmGeneratorExpression.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmPolicies.h" #include "cmSystemTools.h" -#include "cmake.h" class cmExecutionStatus; @@ -59,7 +59,7 @@ void cmLinkDirectoriesCommand::AddLinkDir( switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0015)) { case cmPolicies::WARN: e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0015); - this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, e.str()); + this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, e.str()); break; case cmPolicies::OLD: // OLD behavior does not convert @@ -67,7 +67,7 @@ void cmLinkDirectoriesCommand::AddLinkDir( case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0015); - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); CM_FALLTHROUGH; case cmPolicies::NEW: // NEW behavior converts diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index 3644da1..b826795 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -17,10 +17,10 @@ #include "cmAlgorithms.h" #include "cmGeneratorExpression.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmPolicies.h" #include "cmStringReplaceHelper.h" #include "cmSystemTools.h" -#include "cmake.h" class cmExecutionStatus; @@ -123,7 +123,7 @@ bool cmListCommand::GetList(std::vector& list, warn += " List has value = ["; warn += listString; warn += "]."; - this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, warn); + this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, warn); return true; } case cmPolicies::OLD: @@ -138,7 +138,7 @@ bool cmListCommand::GetList(std::vector& list, case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: this->Makefile->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0007)); return false; } diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index 4689f42..9aa1f32 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -3,11 +3,11 @@ #include "cmListFileCache.h" #include "cmListFileLexer.h" +#include "cmMessageType.h" #include "cmMessenger.h" #include "cmOutputConverter.h" #include "cmState.h" #include "cmSystemTools.h" -#include "cmake.h" #include #include @@ -66,7 +66,8 @@ cmListFileParser::~cmListFileParser() void cmListFileParser::IssueFileOpenError(const std::string& text) const { - this->Messenger->IssueMessage(cmake::FATAL_ERROR, text, this->Backtrace); + this->Messenger->IssueMessage(MessageType::FATAL_ERROR, text, + this->Backtrace); } void cmListFileParser::IssueError(const std::string& text) const @@ -76,7 +77,7 @@ void cmListFileParser::IssueError(const std::string& text) const lfc.Line = cmListFileLexer_GetCurrentLine(this->Lexer); cmListFileBacktrace lfbt = this->Backtrace; lfbt = lfbt.Push(lfc); - this->Messenger->IssueMessage(cmake::FATAL_ERROR, text, lfbt); + this->Messenger->IssueMessage(MessageType::FATAL_ERROR, text, lfbt); cmSystemTools::SetFatalErrorOccured(); } @@ -254,7 +255,7 @@ bool cmListFileParser::ParseFunction(const char* name, long line) lfbt = lfbt.Push(lfc); error << "Parse error. Function missing ending \")\". " << "End of file reached."; - this->Messenger->IssueMessage(cmake::FATAL_ERROR, error.str(), lfbt); + this->Messenger->IssueMessage(MessageType::FATAL_ERROR, error.str(), lfbt); return false; } @@ -279,10 +280,10 @@ bool cmListFileParser::AddArgument(cmListFileLexer_Token* token, << "Argument not separated from preceding token by whitespace."; /* clang-format on */ if (isError) { - this->Messenger->IssueMessage(cmake::FATAL_ERROR, m.str(), lfbt); + this->Messenger->IssueMessage(MessageType::FATAL_ERROR, m.str(), lfbt); return false; } - this->Messenger->IssueMessage(cmake::AUTHOR_WARNING, m.str(), lfbt); + this->Messenger->IssueMessage(MessageType::AUTHOR_WARNING, m.str(), lfbt); return true; } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 8fac039..797add9 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -165,7 +165,7 @@ cmLocalGenerator::~cmLocalGenerator() cmDeleteAll(this->OwnedImportedGeneratorTargets); } -void cmLocalGenerator::IssueMessage(cmake::MessageType t, +void cmLocalGenerator::IssueMessage(MessageType t, std::string const& text) const { this->GetCMakeInstance()->IssueMessage(t, text, this->DirectoryBacktrace); @@ -190,14 +190,14 @@ void cmLocalGenerator::ComputeObjectMaxPath() w << "CMAKE_OBJECT_PATH_MAX is set to " << pmax << ", which is less than the minimum of 128. " << "The value will be ignored."; - this->IssueMessage(cmake::AUTHOR_WARNING, w.str()); + this->IssueMessage(MessageType::AUTHOR_WARNING, w.str()); } } else { std::ostringstream w; w << "CMAKE_OBJECT_PATH_MAX is set to \"" << plen << "\", which fails to parse as a positive integer. " << "The value will be ignored."; - this->IssueMessage(cmake::AUTHOR_WARNING, w.str()); + this->IssueMessage(MessageType::AUTHOR_WARNING, w.str()); } } this->ObjectMaxPathViolations.clear(); @@ -565,7 +565,7 @@ void cmLocalGenerator::GenerateInstallRules() "CMAKE_POLICY_WARNING_CMP0082")) { std::ostringstream e; e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0082) << "\n"; - this->IssueMessage(cmake::AUTHOR_WARNING, e.str()); + this->IssueMessage(MessageType::AUTHOR_WARNING, e.str()); } CM_FALLTHROUGH; case cmPolicies::OLD: { @@ -874,7 +874,7 @@ void cmLocalGenerator::AddCompileOptions(std::string& flags, "on " "and be depended on by the link implementation." << std::endl; - this->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->IssueMessage(MessageType::FATAL_ERROR, e.str()); return; } } @@ -1387,7 +1387,7 @@ std::string cmLocalGenerator::GetLinkLibsCMP0065( "additional flags may be added to export symbols on all " "executables regardless of their ENABLE_EXPORTS property."; /* clang-format on */ - this->IssueMessage(cmake::AUTHOR_WARNING, w.str()); + this->IssueMessage(MessageType::AUTHOR_WARNING, w.str()); } CM_FALLTHROUGH; case cmPolicies::OLD: @@ -1397,7 +1397,7 @@ std::string cmLocalGenerator::GetLinkLibsCMP0065( case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: this->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0065)); CM_FALLTHROUGH; case cmPolicies::NEW: @@ -1670,7 +1670,7 @@ void cmLocalGenerator::AddCompilerRequirementFlag( << (ext ? "(with compiler extensions)" : "") << ", but CMake " "does not know the compile flags to use to enable it."; - this->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->IssueMessage(MessageType::FATAL_ERROR, e.str()); } else { std::vector optVec; cmSystemTools::ExpandListArgument(opt, optVec); @@ -1709,7 +1709,7 @@ void cmLocalGenerator::AddCompilerRequirementFlag( std::string e = lang + "_STANDARD is set to invalid value '" + standard + "'"; this->GetGlobalGenerator()->GetCMakeInstance()->IssueMessage( - cmake::FATAL_ERROR, e, target->GetBacktrace()); + MessageType::FATAL_ERROR, e, target->GetBacktrace()); return; } @@ -1719,7 +1719,7 @@ void cmLocalGenerator::AddCompilerRequirementFlag( std::string e = "CMAKE_" + lang + "_STANDARD_DEFAULT is set to invalid value '" + std::string(defaultStd) + "'"; - this->IssueMessage(cmake::INTERNAL_ERROR, e); + this->IssueMessage(MessageType::INTERNAL_ERROR, e); return; } @@ -1857,7 +1857,7 @@ void cmLocalGenerator::AddVisibilityPresetFlags( "For compatibility CMake is not honoring them for this target."; /* clang-format on */ target->GetLocalGenerator()->GetCMakeInstance()->IssueMessage( - cmake::AUTHOR_WARNING, w.str(), target->GetBacktrace()); + MessageType::AUTHOR_WARNING, w.str(), target->GetBacktrace()); } } @@ -1916,7 +1916,7 @@ bool cmLocalGenerator::GetShouldUseOldFlags(bool shared, << flagsVar << " was removed.\n" << cmPolicies::GetPolicyWarning(cmPolicies::CMP0018); - this->IssueMessage(cmake::AUTHOR_WARNING, e.str()); + this->IssueMessage(MessageType::AUTHOR_WARNING, e.str()); CM_FALLTHROUGH; } case cmPolicies::OLD: @@ -2130,7 +2130,7 @@ void cmLocalGenerator::AppendIncludeDirectories( << sourceFile.GetLocation().GetName() << "\":\n \"" << include << "\"\n"; - this->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->IssueMessage(MessageType::FATAL_ERROR, e.str()); return; } @@ -2500,7 +2500,7 @@ std::string& cmLocalGenerator::CreateSafeUniqueObjectFileName( << "cannot be safely placed under this directory. " << "The build may not work correctly."; /* clang-format on */ - this->IssueMessage(cmake::WARNING, m.str()); + this->IssueMessage(MessageType::WARNING, m.str()); } } #else diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 2fa0070..dc54314 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -14,10 +14,10 @@ #include #include "cmListFileCache.h" +#include "cmMessageType.h" #include "cmOutputConverter.h" #include "cmPolicies.h" #include "cmStateSnapshot.h" -#include "cmake.h" class cmComputeLinkInformation; class cmCustomCommandGenerator; @@ -28,6 +28,7 @@ class cmMakefile; class cmRulePlaceholderExpander; class cmSourceFile; class cmState; +class cmake; /** \class cmLocalGenerator * \brief Create required build files for a directory. @@ -359,7 +360,7 @@ public: bool IsMinGWMake() const; bool IsNMake() const; - void IssueMessage(cmake::MessageType t, std::string const& text) const; + void IssueMessage(MessageType t, std::string const& text) const; void CreateEvaluationFileOutputs(const std::string& config); void ProcessEvaluationFiles(std::vector& generatedFiles); diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx index 0c2c64e..d45c335 100644 --- a/Source/cmLocalVisualStudio10Generator.cxx +++ b/Source/cmLocalVisualStudio10Generator.cxx @@ -7,6 +7,7 @@ #include "cmMakefile.h" #include "cmVisualStudio10TargetGenerator.h" #include "cmXMLParser.h" +#include "cmake.h" #include "cm_expat.h" diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index fee9dd6..677d033 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -6,6 +6,7 @@ #include "cmGeneratorTarget.h" #include "cmGlobalVisualStudio7Generator.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmSourceFile.h" #include "cmSystemTools.h" #include "cmXMLParser.h" diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 891ca61..274c631 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -30,6 +30,7 @@ #include "cmInstallGenerator.h" // IWYU pragma: keep #include "cmInstallSubdirectoryGenerator.h" #include "cmListFileCache.h" +#include "cmMessageType.h" #include "cmSourceFile.h" #include "cmSourceFileLocation.h" #include "cmState.h" @@ -129,11 +130,11 @@ cmDirectoryId cmMakefile::GetDirectoryId() const return std::string(buf); } -void cmMakefile::IssueMessage(cmake::MessageType t, - std::string const& text) const +void cmMakefile::IssueMessage(MessageType t, std::string const& text) const { if (!this->ExecutionStatusStack.empty()) { - if ((t == cmake::FATAL_ERROR) || (t == cmake::INTERNAL_ERROR)) { + if ((t == MessageType::FATAL_ERROR) || + (t == MessageType::INTERNAL_ERROR)) { this->ExecutionStatusStack.back()->SetNestedError(); } } @@ -143,7 +144,7 @@ void cmMakefile::IssueMessage(cmake::MessageType t, bool cmMakefile::CheckCMP0037(std::string const& targetName, cmStateEnums::TargetType targetType) const { - cmake::MessageType messageType = cmake::AUTHOR_WARNING; + MessageType messageType = MessageType::AUTHOR_WARNING; std::ostringstream e; bool issueMessage = false; switch (this->GetPolicyStatus(cmPolicies::CMP0037)) { @@ -159,7 +160,7 @@ bool cmMakefile::CheckCMP0037(std::string const& targetName, case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: issueMessage = true; - messageType = cmake::FATAL_ERROR; + messageType = MessageType::FATAL_ERROR; break; } if (issueMessage) { @@ -169,7 +170,7 @@ bool cmMakefile::CheckCMP0037(std::string const& targetName, "in undefined behavior."; this->IssueMessage(messageType, e.str()); - if (messageType == cmake::FATAL_ERROR) { + if (messageType == MessageType::FATAL_ERROR) { return false; } } @@ -198,7 +199,7 @@ void cmMakefile::MaybeWarnCMP0074(std::string const& pkg) << " " << env << "\n"; } w << "For compatibility, CMake is ignoring the variable."; - this->IssueMessage(cmake::AUTHOR_WARNING, w.str()); + this->IssueMessage(MessageType::AUTHOR_WARNING, w.str()); } } @@ -381,7 +382,7 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff, // The command invocation requested that we report an error. std::string const error = std::string(lff.Name.Original) + " " + pcmd->GetError(); - this->IssueMessage(cmake::FATAL_ERROR, error); + this->IssueMessage(MessageType::FATAL_ERROR, error); } result = false; if (this->GetCMakeInstance()->GetWorkingMode() != cmake::NORMAL_MODE) { @@ -397,7 +398,7 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff, std::string error = "Unknown CMake command \""; error += lff.Name.Original; error += "\"."; - this->IssueMessage(cmake::FATAL_ERROR, error); + this->IssueMessage(MessageType::FATAL_ERROR, error); result = false; cmSystemTools::SetFatalErrorOccured(); } @@ -509,7 +510,7 @@ void cmMakefile::IncludeScope::EnforceCMP0011() << "affects policy settings. " << "CMake is implying the NO_POLICY_SCOPE option for compatibility, " << "so the effects are applied to the including context."; - this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str()); + this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, w.str()); } break; case cmPolicies::REQUIRED_IF_USED: @@ -521,7 +522,7 @@ void cmMakefile::IncludeScope::EnforceCMP0011() << this->Makefile->GetExecutionFilePath() << "\n" << "affects policy settings, so it requires this policy to be set."; /* clang-format on */ - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); } break; case cmPolicies::OLD: case cmPolicies::NEW: @@ -665,7 +666,7 @@ void cmMakefile::EnforceDirectoryLevelRules() const case cmPolicies::WARN: // Warn because the user did not provide a minimum required // version. - this->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING, + this->GetCMakeInstance()->IssueMessage(MessageType::AUTHOR_WARNING, msg.str(), this->Backtrace); case cmPolicies::OLD: // OLD behavior is to use policy version 2.4 set in @@ -675,8 +676,8 @@ void cmMakefile::EnforceDirectoryLevelRules() const case cmPolicies::REQUIRED_ALWAYS: case cmPolicies::NEW: // NEW behavior is to issue an error. - this->GetCMakeInstance()->IssueMessage(cmake::FATAL_ERROR, msg.str(), - this->Backtrace); + this->GetCMakeInstance()->IssueMessage(MessageType::FATAL_ERROR, + msg.str(), this->Backtrace); cmSystemTools::SetFatalErrorOccured(); return; } @@ -764,7 +765,7 @@ void cmMakefile::ConfigureFinalPass() if (oldValue && cmSystemTools::VersionCompare(cmSystemTools::OP_LESS, oldValue, "2.4")) { this->GetCMakeInstance()->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, "You have set CMAKE_BACKWARDS_COMPATIBILITY to a CMake version less " "than 2.4. This version of CMake only supports backwards compatibility " "with CMake 2.4 or later. For compatibility with older versions please " @@ -785,7 +786,7 @@ void cmMakefile::AddCustomCommandToTarget( cmTargets::iterator ti = this->Targets.find(target); if (ti == this->Targets.end()) { - cmake::MessageType messageType = cmake::AUTHOR_WARNING; + MessageType messageType = MessageType::AUTHOR_WARNING; bool issueMessage = false; std::ostringstream e; switch (this->GetPolicyStatus(cmPolicies::CMP0040)) { @@ -798,7 +799,7 @@ void cmMakefile::AddCustomCommandToTarget( case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: issueMessage = true; - messageType = cmake::FATAL_ERROR; + messageType = MessageType::FATAL_ERROR; } if (issueMessage) { @@ -826,7 +827,7 @@ void cmMakefile::AddCustomCommandToTarget( e << "Target \"" << target << "\" is an OBJECT library " "that may not have PRE_BUILD, PRE_LINK, or POST_BUILD commands."; - this->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->IssueMessage(MessageType::FATAL_ERROR, e.str()); return; } if (t.GetType() == cmStateEnums::INTERFACE_LIBRARY) { @@ -834,7 +835,7 @@ void cmMakefile::AddCustomCommandToTarget( e << "Target \"" << target << "\" is an INTERFACE library " "that may not have PRE_BUILD, PRE_LINK, or POST_BUILD commands."; - this->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->IssueMessage(MessageType::FATAL_ERROR, e.str()); return; } @@ -886,7 +887,7 @@ cmSourceFile* cmMakefile::AddCustomCommandToOutput( if (!cl.empty() && !cl[0].empty() && cl[0][0] == '"') { std::ostringstream e; e << "COMMAND may not contain literal quotes:\n " << cl[0] << "\n"; - this->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->IssueMessage(MessageType::FATAL_ERROR, e.str()); return nullptr; } } @@ -1278,7 +1279,7 @@ bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove) // This definition has a non-trivial value. switch (this->GetPolicyStatus(cmPolicies::CMP0005)) { case cmPolicies::WARN: - this->IssueMessage(cmake::AUTHOR_WARNING, + this->IssueMessage(MessageType::AUTHOR_WARNING, cmPolicies::GetPolicyWarning(cmPolicies::CMP0005)); CM_FALLTHROUGH; case cmPolicies::OLD: @@ -1288,7 +1289,7 @@ bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove) case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: this->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0005)); return false; case cmPolicies::NEW: @@ -1617,7 +1618,7 @@ void cmMakefile::ConfigureSubDirectory(cmMakefile* mf) << "\n" << cmPolicies::GetPolicyWarning(cmPolicies::CMP0014); /* clang-format on */ - this->IssueMessage(cmake::AUTHOR_WARNING, e.str()); + this->IssueMessage(MessageType::AUTHOR_WARNING, e.str()); case cmPolicies::OLD: // OLD behavior does not warn. break; @@ -1627,7 +1628,7 @@ void cmMakefile::ConfigureSubDirectory(cmMakefile* mf) CM_FALLTHROUGH; case cmPolicies::NEW: // NEW behavior prints the error. - this->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->IssueMessage(MessageType::FATAL_ERROR, e.str()); } return; } @@ -1849,7 +1850,7 @@ void cmMakefile::MaybeWarnUninitialized(std::string const& variable, (sourceFilename && this->IsProjectFile(sourceFilename))) { std::ostringstream msg; msg << "uninitialized variable \'" << variable << "\'"; - this->IssueMessage(cmake::AUTHOR_WARNING, msg.str()); + this->IssueMessage(MessageType::AUTHOR_WARNING, msg.str()); } } } @@ -1868,7 +1869,7 @@ void cmMakefile::LogUnused(const char* reason, const std::string& name) const if (this->CheckSystemVars || this->IsProjectFile(path.c_str())) { std::ostringstream msg; msg << "unused variable (" << reason << ") \'" << name << "\'"; - this->IssueMessage(cmake::AUTHOR_WARNING, msg.str()); + this->IssueMessage(MessageType::AUTHOR_WARNING, msg.str()); } } } @@ -2274,8 +2275,8 @@ void cmMakefile::ExpandVariablesCMP0019() << "The following variable evaluations were encountered:\n" << w.str(); /* clang-format on */ - this->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING, m.str(), - this->Backtrace); + this->GetCMakeInstance()->IssueMessage(MessageType::AUTHOR_WARNING, + m.str(), this->Backtrace); } } @@ -2494,7 +2495,7 @@ const std::string& cmMakefile::ExpandVariablesInString( const char* filename, long line, bool removeEmpty, bool replaceAt) const { bool compareResults = false; - cmake::MessageType mtype = cmake::LOG; + MessageType mtype = MessageType::LOG; std::string errorstr; std::string original; @@ -2502,7 +2503,7 @@ const std::string& cmMakefile::ExpandVariablesInString( if (atOnly && (!noEscapes || !removeEmpty)) { // This case should never be called. At-only is for // configure-file/string which always does no escapes. - this->IssueMessage(cmake::INTERNAL_ERROR, + this->IssueMessage(MessageType::INTERNAL_ERROR, "ExpandVariablesInString @ONLY called " "on something with escapes."); return source; @@ -2511,7 +2512,7 @@ const std::string& cmMakefile::ExpandVariablesInString( // Variables used in the WARN case. std::string newResult; std::string newErrorstr; - cmake::MessageType newError = cmake::LOG; + MessageType newError = MessageType::LOG; switch (this->GetPolicyStatus(cmPolicies::CMP0053)) { case cmPolicies::WARN: { @@ -2544,8 +2545,8 @@ const std::string& cmMakefile::ExpandVariablesInString( } // If it's an error in either case, just report the error... - if (mtype != cmake::LOG) { - if (mtype == cmake::FATAL_ERROR) { + if (mtype != MessageType::LOG) { + if (mtype == MessageType::FATAL_ERROR) { cmSystemTools::SetFatalErrorOccured(); } this->IssueMessage(mtype, errorstr); @@ -2584,20 +2585,20 @@ const std::string& cmMakefile::ExpandVariablesInString( msg += "Using the old result for compatibility since the policy is not set."; - this->IssueMessage(cmake::AUTHOR_WARNING, msg); + this->IssueMessage(MessageType::AUTHOR_WARNING, msg); } return source; } -cmake::MessageType cmMakefile::ExpandVariablesInStringOld( +MessageType cmMakefile::ExpandVariablesInStringOld( std::string& errorstr, std::string& source, bool escapeQuotes, bool noEscapes, bool atOnly, const char* filename, long line, bool removeEmpty, bool replaceAt) const { // Fast path strings without any special characters. if (source.find_first_of("$@\\") == std::string::npos) { - return cmake::LOG; + return MessageType::LOG; } // Special-case the @ONLY mode. @@ -2636,7 +2637,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringOld( // Append the rest of the unchanged part of the string. source.append(in); - return cmake::LOG; + return MessageType::LOG; } // This method replaces ${VAR} and @VAR@ where VAR is looked up @@ -2653,7 +2654,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringOld( parser.SetRemoveEmpty(removeEmpty); int res = parser.ParseString(source.c_str(), 0); const char* emsg = parser.GetError(); - cmake::MessageType mtype = cmake::LOG; + MessageType mtype = MessageType::LOG; if (res && !emsg[0]) { source = parser.GetResult(); } else { @@ -2676,7 +2677,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringOld( // parser reported an error message without failing because the // helper implementation is unhappy, which has always reported an // error. - mtype = cmake::FATAL_ERROR; + mtype = MessageType::FATAL_ERROR; if (!res) { // This is a real argument parsing error. Use policy CMP0010 to // decide whether it is an error. @@ -2686,7 +2687,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringOld( CM_FALLTHROUGH; case cmPolicies::OLD: // OLD behavior is to just warn and continue. - mtype = cmake::AUTHOR_WARNING; + mtype = MessageType::AUTHOR_WARNING; break; case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: @@ -2723,7 +2724,7 @@ bool cmMakefile::IsProjectFile(const char* filename) const cmake::GetCMakeFilesDirectory())); } -cmake::MessageType cmMakefile::ExpandVariablesInStringNew( +MessageType cmMakefile::ExpandVariablesInStringNew( std::string& errorstr, std::string& source, bool escapeQuotes, bool noEscapes, bool atOnly, const char* filename, long line, bool replaceAt) const @@ -2740,7 +2741,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew( std::vector openstack; bool error = false; bool done = false; - cmake::MessageType mtype = cmake::LOG; + MessageType mtype = MessageType::LOG; cmState* state = this->GetCMakeInstance()->GetState(); @@ -2819,7 +2820,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew( std::string(next, this->cmNamedCurly.end()) + "{} is not supported. Only ${}, $ENV{}, " "and $CACHE{} are allowed."; - mtype = cmake::FATAL_ERROR; + mtype = MessageType::FATAL_ERROR; error = true; } } @@ -2927,7 +2928,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew( errorstr += "\') in a variable name: " "'" + result.substr(openstack.back().loc) + "'"; - mtype = cmake::FATAL_ERROR; + mtype = MessageType::FATAL_ERROR; error = true; } break; @@ -2958,7 +2959,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew( emsg << "when parsing string\n" << " " << source << "\n"; emsg << errorstr; - mtype = cmake::FATAL_ERROR; + mtype = MessageType::FATAL_ERROR; errorstr = emsg.str(); } else { // Append the rest of the unchanged part of the string. @@ -3052,7 +3053,7 @@ void cmMakefile::PopFunctionBlockerBarrier(bool reportError) << " " << lfc << "\n" << "is not closed."; /* clang-format on */ - this->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->IssueMessage(MessageType::FATAL_ERROR, e.str()); reportError = false; } } @@ -3205,7 +3206,7 @@ std::unique_ptr cmMakefile::RemoveFunctionBlocker( << " " << closingContext << "\n" << "with mis-matching arguments."; /* clang-format on */ - this->IssueMessage(cmake::AUTHOR_WARNING, e.str()); + this->IssueMessage(MessageType::AUTHOR_WARNING, e.str()); } cmFunctionBlocker* b = *pos; this->FunctionBlockers.erase(pos); @@ -3362,7 +3363,7 @@ int cmMakefile::TryCompile(const std::string& srcdir, // use the cmake object instead of calling cmake cmWorkingDirectory workdir(bindir); if (workdir.Failed()) { - this->IssueMessage(cmake::FATAL_ERROR, + this->IssueMessage(MessageType::FATAL_ERROR, "Failed to set working directory to " + bindir + " : " + std::strerror(workdir.GetLastResult())); cmSystemTools::SetFatalErrorOccured(); @@ -3378,7 +3379,7 @@ int cmMakefile::TryCompile(const std::string& srcdir, cmGlobalGenerator* gg = cm.CreateGlobalGenerator(this->GetGlobalGenerator()->GetName()); if (!gg) { - this->IssueMessage(cmake::INTERNAL_ERROR, + this->IssueMessage(MessageType::INTERNAL_ERROR, "Global generator '" + this->GetGlobalGenerator()->GetName() + "' could not be created."); @@ -3444,7 +3445,7 @@ int cmMakefile::TryCompile(const std::string& srcdir, cmStateEnums::INTERNAL); } if (cm.Configure() != 0) { - this->IssueMessage(cmake::FATAL_ERROR, + this->IssueMessage(MessageType::FATAL_ERROR, "Failed to configure test project build system."); cmSystemTools::SetFatalErrorOccured(); this->IsSourceFileTryCompile = false; @@ -3452,7 +3453,7 @@ int cmMakefile::TryCompile(const std::string& srcdir, } if (cm.Generate() != 0) { - this->IssueMessage(cmake::FATAL_ERROR, + this->IssueMessage(MessageType::FATAL_ERROR, "Failed to generate test project build system."); cmSystemTools::SetFatalErrorOccured(); this->IsSourceFileTryCompile = false; @@ -3584,7 +3585,7 @@ std::string cmMakefile::GetModulesFile(const char* filename, << cmPolicies::GetPolicyWarning(cmPolicies::CMP0017); /* clang-format on */ - this->IssueMessage(cmake::AUTHOR_WARNING, e.str()); + this->IssueMessage(MessageType::AUTHOR_WARNING, e.str()); CM_FALLTHROUGH; } case cmPolicies::OLD: @@ -3740,7 +3741,7 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile, std::ostringstream e; e << "File starts with a Byte-Order-Mark that is not UTF-8:\n " << sinfile; - this->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->IssueMessage(MessageType::FATAL_ERROR, e.str()); return 0; } // rewind to copy BOM to output file @@ -3937,7 +3938,7 @@ void cmMakefile::RaiseScope(const std::string& var, const char* varDef) if (!this->StateSnapshot.RaiseScope(var, varDef)) { std::ostringstream m; m << "Cannot set \"" << var << "\": current scope has no parent."; - this->IssueMessage(cmake::AUTHOR_WARNING, m.str()); + this->IssueMessage(MessageType::AUTHOR_WARNING, m.str()); return; } @@ -4022,7 +4023,7 @@ bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg, // target names must be globally unique switch (this->GetPolicyStatus(cmPolicies::CMP0002)) { case cmPolicies::WARN: - this->IssueMessage(cmake::AUTHOR_WARNING, + this->IssueMessage(MessageType::AUTHOR_WARNING, cmPolicies::GetPolicyWarning(cmPolicies::CMP0002)); CM_FALLTHROUGH; case cmPolicies::OLD: @@ -4030,7 +4031,7 @@ bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg, case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: this->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0002)); return true; case cmPolicies::NEW: @@ -4109,7 +4110,7 @@ bool cmMakefile::EnforceUniqueDir(const std::string& srcPath, << "to work accidentally and is being allowed for " << "compatibility."; /* clang-format on */ - this->IssueMessage(cmake::AUTHOR_WARNING, e.str()); + this->IssueMessage(MessageType::AUTHOR_WARNING, e.str()); CM_FALLTHROUGH; case cmPolicies::OLD: // OLD behavior does not warn. @@ -4128,7 +4129,7 @@ bool cmMakefile::EnforceUniqueDir(const std::string& srcPath, << " " << srcPath << "\n" << "Specify a unique binary directory name."; /* clang-format on */ - this->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->IssueMessage(MessageType::FATAL_ERROR, e.str()); break; } @@ -4213,7 +4214,7 @@ bool cmMakefile::SetPolicy(const char* id, cmPolicies::PolicyStatus status) if (!cmPolicies::GetPolicyID(id, /* out */ pid)) { std::ostringstream e; e << "Policy \"" << id << "\" is not known to this version of CMake."; - this->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->IssueMessage(MessageType::FATAL_ERROR, e.str()); return false; } return this->SetPolicy(pid, status); @@ -4226,7 +4227,7 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id, if (status != cmPolicies::NEW && cmPolicies::GetPolicyStatus(id) == cmPolicies::REQUIRED_ALWAYS) { std::string msg = cmPolicies::GetRequiredAlwaysPolicyError(id); - this->IssueMessage(cmake::FATAL_ERROR, msg); + this->IssueMessage(MessageType::FATAL_ERROR, msg); return false; } @@ -4237,7 +4238,7 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id, ( // Policies set by cmCoreTryCompile::TryCompileCode. id == cmPolicies::CMP0065))) { - this->IssueMessage(cmake::DEPRECATION_WARNING, + this->IssueMessage(MessageType::DEPRECATION_WARNING, cmPolicies::GetPolicyDeprecatedWarning(id)); } @@ -4264,7 +4265,7 @@ void cmMakefile::PushPolicy(bool weak, cmPolicies::PolicyMap const& pm) void cmMakefile::PopPolicy() { if (!this->StateSnapshot.PopPolicy()) { - this->IssueMessage(cmake::FATAL_ERROR, + this->IssueMessage(MessageType::FATAL_ERROR, "cmake_policy POP without matching PUSH"); } } @@ -4276,7 +4277,7 @@ void cmMakefile::PopSnapshot(bool reportError) // reject any still-open nested policy scopes with an error. while (!this->StateSnapshot.CanPopPolicyScope()) { if (reportError) { - this->IssueMessage(cmake::FATAL_ERROR, + this->IssueMessage(MessageType::FATAL_ERROR, "cmake_policy PUSH without matching POP"); reportError = false; } @@ -4369,7 +4370,7 @@ bool cmMakefile::AddRequiredTargetFeature(cmTarget* target, if (error) { *error = e.str(); } else { - this->GetCMakeInstance()->IssueMessage(cmake::FATAL_ERROR, e.str(), + this->GetCMakeInstance()->IssueMessage(MessageType::FATAL_ERROR, e.str(), this->Backtrace); } return false; @@ -4416,7 +4417,7 @@ bool cmMakefile::CompileFeatureKnown(cmTarget const* target, if (error) { *error = e.str(); } else { - this->GetCMakeInstance()->IssueMessage(cmake::FATAL_ERROR, e.str(), + this->GetCMakeInstance()->IssueMessage(MessageType::FATAL_ERROR, e.str(), this->Backtrace); } return false; @@ -4436,7 +4437,7 @@ const char* cmMakefile::CompileFeaturesAvailable(const std::string& lang, if (error) { *error = e.str(); } else { - this->GetCMakeInstance()->IssueMessage(cmake::FATAL_ERROR, e.str(), + this->GetCMakeInstance()->IssueMessage(MessageType::FATAL_ERROR, e.str(), this->Backtrace); } return nullptr; @@ -4459,7 +4460,7 @@ const char* cmMakefile::CompileFeaturesAvailable(const std::string& lang, if (error) { *error = e.str(); } else { - this->GetCMakeInstance()->IssueMessage(cmake::FATAL_ERROR, e.str(), + this->GetCMakeInstance()->IssueMessage(MessageType::FATAL_ERROR, e.str(), this->Backtrace); } return nullptr; @@ -4484,7 +4485,7 @@ bool cmMakefile::HaveCStandardAvailable(cmTarget const* target, std::ostringstream e; e << "CMAKE_C_STANDARD_DEFAULT is not set. COMPILE_FEATURES support " "not fully configured for this compiler."; - this->IssueMessage(cmake::INTERNAL_ERROR, e.str()); + this->IssueMessage(MessageType::INTERNAL_ERROR, e.str()); // Return true so the caller does not try to lookup the default standard. return true; } @@ -4494,7 +4495,7 @@ bool cmMakefile::HaveCStandardAvailable(cmTarget const* target, e << "The CMAKE_C_STANDARD_DEFAULT variable contains an " "invalid value: \"" << defaultCStandard << "\"."; - this->IssueMessage(cmake::INTERNAL_ERROR, e.str()); + this->IssueMessage(MessageType::INTERNAL_ERROR, e.str()); return false; } @@ -4514,7 +4515,7 @@ bool cmMakefile::HaveCStandardAvailable(cmTarget const* target, std::ostringstream e; e << "The C_STANDARD property on target \"" << target->GetName() << "\" contained an invalid value: \"" << existingCStandard << "\"."; - this->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->IssueMessage(MessageType::FATAL_ERROR, e.str()); return false; } @@ -4568,7 +4569,7 @@ bool cmMakefile::HaveCxxStandardAvailable(cmTarget const* target, std::ostringstream e; e << "CMAKE_CXX_STANDARD_DEFAULT is not set. COMPILE_FEATURES support " "not fully configured for this compiler."; - this->IssueMessage(cmake::INTERNAL_ERROR, e.str()); + this->IssueMessage(MessageType::INTERNAL_ERROR, e.str()); // Return true so the caller does not try to lookup the default standard. return true; } @@ -4578,7 +4579,7 @@ bool cmMakefile::HaveCxxStandardAvailable(cmTarget const* target, e << "The CMAKE_CXX_STANDARD_DEFAULT variable contains an " "invalid value: \"" << defaultCxxStandard << "\"."; - this->IssueMessage(cmake::INTERNAL_ERROR, e.str()); + this->IssueMessage(MessageType::INTERNAL_ERROR, e.str()); return false; } @@ -4602,7 +4603,7 @@ bool cmMakefile::HaveCxxStandardAvailable(cmTarget const* target, std::ostringstream e; e << "The CXX_STANDARD property on target \"" << target->GetName() << "\" contained an invalid value: \"" << existingCxxStandard << "\"."; - this->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->IssueMessage(MessageType::FATAL_ERROR, e.str()); return false; } @@ -4682,8 +4683,8 @@ bool cmMakefile::AddRequiredTargetCxxFeature(cmTarget* target, if (error) { *error = e.str(); } else { - this->GetCMakeInstance()->IssueMessage(cmake::FATAL_ERROR, e.str(), - this->Backtrace); + this->GetCMakeInstance()->IssueMessage(MessageType::FATAL_ERROR, + e.str(), this->Backtrace); } return false; } @@ -4703,8 +4704,8 @@ bool cmMakefile::AddRequiredTargetCxxFeature(cmTarget* target, if (error) { *error = e.str(); } else { - this->GetCMakeInstance()->IssueMessage(cmake::FATAL_ERROR, e.str(), - this->Backtrace); + this->GetCMakeInstance()->IssueMessage(MessageType::FATAL_ERROR, + e.str(), this->Backtrace); } return false; } @@ -4781,8 +4782,8 @@ bool cmMakefile::AddRequiredTargetCFeature(cmTarget* target, if (error) { *error = e.str(); } else { - this->GetCMakeInstance()->IssueMessage(cmake::FATAL_ERROR, e.str(), - this->Backtrace); + this->GetCMakeInstance()->IssueMessage(MessageType::FATAL_ERROR, + e.str(), this->Backtrace); } return false; } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 1607735..ec36972 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -18,13 +18,13 @@ #include "cmAlgorithms.h" #include "cmListFileCache.h" +#include "cmMessageType.h" #include "cmNewLineStyle.h" #include "cmPolicies.h" #include "cmSourceFileLocationKind.h" #include "cmStateSnapshot.h" #include "cmStateTypes.h" #include "cmTarget.h" -#include "cmake.h" #if defined(CMAKE_BUILD_WITH_CMAKE) # include "cmSourceGroup.h" @@ -46,6 +46,7 @@ class cmState; class cmTest; class cmTestGenerator; class cmVariableWatch; +class cmake; /** A type-safe wrapper for a string representing a directory id. */ class cmDirectoryId @@ -793,7 +794,7 @@ public: cmMakefile* Makefile; }; - void IssueMessage(cmake::MessageType t, std::string const& text) const; + void IssueMessage(MessageType t, std::string const& text) const; /** Set whether or not to report a CMP0000 violation. */ void SetCheckCMP0000(bool b) { this->CheckCMP0000 = b; } @@ -982,15 +983,18 @@ private: friend class BuildsystemFileScope; // CMP0053 == old - cmake::MessageType ExpandVariablesInStringOld( - std::string& errorstr, std::string& source, bool escapeQuotes, - bool noEscapes, bool atOnly, const char* filename, long line, - bool removeEmpty, bool replaceAt) const; + MessageType ExpandVariablesInStringOld(std::string& errorstr, + std::string& source, + bool escapeQuotes, bool noEscapes, + bool atOnly, const char* filename, + long line, bool removeEmpty, + bool replaceAt) const; // CMP0053 == new - cmake::MessageType ExpandVariablesInStringNew( - std::string& errorstr, std::string& source, bool escapeQuotes, - bool noEscapes, bool atOnly, const char* filename, long line, - bool replaceAt) const; + MessageType ExpandVariablesInStringNew(std::string& errorstr, + std::string& source, + bool escapeQuotes, bool noEscapes, + bool atOnly, const char* filename, + long line, bool replaceAt) const; /** * Old version of GetSourceFileWithOutput(const std::string&) kept for * backward-compatibility. It implements a linear search and support diff --git a/Source/cmMathCommand.cxx b/Source/cmMathCommand.cxx index a50e5fc..48b9a27 100644 --- a/Source/cmMathCommand.cxx +++ b/Source/cmMathCommand.cxx @@ -4,8 +4,8 @@ #include "cmExprParserHelper.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cm_kwiml.h" -#include "cmake.h" #include @@ -104,7 +104,7 @@ bool cmMathCommand::HandleExprCommand(std::vector const& args) std::string const& w = helper.GetWarning(); if (!w.empty()) { - this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w); + this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, w); } this->Makefile->AddDefinition(outputVariable, buffer); diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx index 5a341bd..4c26c66 100644 --- a/Source/cmMessageCommand.cxx +++ b/Source/cmMessageCommand.cxx @@ -4,9 +4,9 @@ #include "cmAlgorithms.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmMessenger.h" #include "cmSystemTools.h" -#include "cmake.h" class cmExecutionStatus; @@ -20,26 +20,26 @@ bool cmMessageCommand::InitialPass(std::vector const& args, } std::vector::const_iterator i = args.begin(); - cmake::MessageType type = cmake::MESSAGE; + MessageType type = MessageType::MESSAGE; bool status = false; bool fatal = false; if (*i == "SEND_ERROR") { - type = cmake::FATAL_ERROR; + type = MessageType::FATAL_ERROR; ++i; } else if (*i == "FATAL_ERROR") { fatal = true; - type = cmake::FATAL_ERROR; + type = MessageType::FATAL_ERROR; ++i; } else if (*i == "WARNING") { - type = cmake::WARNING; + type = MessageType::WARNING; ++i; } else if (*i == "AUTHOR_WARNING") { if (this->Makefile->IsSet("CMAKE_SUPPRESS_DEVELOPER_ERRORS") && !this->Makefile->IsOn("CMAKE_SUPPRESS_DEVELOPER_ERRORS")) { fatal = true; - type = cmake::AUTHOR_ERROR; + type = MessageType::AUTHOR_ERROR; } else if (!this->Makefile->IsOn("CMAKE_SUPPRESS_DEVELOPER_WARNINGS")) { - type = cmake::AUTHOR_WARNING; + type = MessageType::AUTHOR_WARNING; } else { return true; } @@ -50,10 +50,10 @@ bool cmMessageCommand::InitialPass(std::vector const& args, } else if (*i == "DEPRECATION") { if (this->Makefile->IsOn("CMAKE_ERROR_DEPRECATED")) { fatal = true; - type = cmake::DEPRECATION_ERROR; + type = MessageType::DEPRECATION_ERROR; } else if ((!this->Makefile->IsSet("CMAKE_WARN_DEPRECATED") || this->Makefile->IsOn("CMAKE_WARN_DEPRECATED"))) { - type = cmake::DEPRECATION_WARNING; + type = MessageType::DEPRECATION_WARNING; } else { return true; } @@ -62,7 +62,7 @@ bool cmMessageCommand::InitialPass(std::vector const& args, std::string message = cmJoin(cmMakeRange(i, args.end()), std::string()); - if (type != cmake::MESSAGE) { + if (type != MessageType::MESSAGE) { // we've overridden the message type, above, so display it directly cmMessenger* m = this->Makefile->GetMessenger(); m->DisplayMessage(type, message, this->Makefile->GetBacktrace()); diff --git a/Source/cmMessageType.h b/Source/cmMessageType.h new file mode 100644 index 0000000..b57b86b --- /dev/null +++ b/Source/cmMessageType.h @@ -0,0 +1,21 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#ifndef cmMessageType_h +#define cmMessageType_h + +#include "cmConfigure.h" // IWYU pragma: keep + +enum class MessageType +{ + AUTHOR_WARNING, + AUTHOR_ERROR, + FATAL_ERROR, + INTERNAL_ERROR, + MESSAGE, + WARNING, + LOG, + DEPRECATION_ERROR, + DEPRECATION_WARNING +}; + +#endif diff --git a/Source/cmMessenger.cxx b/Source/cmMessenger.cxx index 880cf4b..3d788f6 100644 --- a/Source/cmMessenger.cxx +++ b/Source/cmMessenger.cxx @@ -12,47 +12,47 @@ #include -cmake::MessageType cmMessenger::ConvertMessageType(cmake::MessageType t) const +MessageType cmMessenger::ConvertMessageType(MessageType t) const { bool warningsAsErrors; - if (t == cmake::AUTHOR_WARNING || t == cmake::AUTHOR_ERROR) { + if (t == MessageType::AUTHOR_WARNING || t == MessageType::AUTHOR_ERROR) { warningsAsErrors = this->GetDevWarningsAsErrors(); - if (warningsAsErrors && t == cmake::AUTHOR_WARNING) { - t = cmake::AUTHOR_ERROR; - } else if (!warningsAsErrors && t == cmake::AUTHOR_ERROR) { - t = cmake::AUTHOR_WARNING; + if (warningsAsErrors && t == MessageType::AUTHOR_WARNING) { + t = MessageType::AUTHOR_ERROR; + } else if (!warningsAsErrors && t == MessageType::AUTHOR_ERROR) { + t = MessageType::AUTHOR_WARNING; } - } else if (t == cmake::DEPRECATION_WARNING || - t == cmake::DEPRECATION_ERROR) { + } else if (t == MessageType::DEPRECATION_WARNING || + t == MessageType::DEPRECATION_ERROR) { warningsAsErrors = this->GetDeprecatedWarningsAsErrors(); - if (warningsAsErrors && t == cmake::DEPRECATION_WARNING) { - t = cmake::DEPRECATION_ERROR; - } else if (!warningsAsErrors && t == cmake::DEPRECATION_ERROR) { - t = cmake::DEPRECATION_WARNING; + if (warningsAsErrors && t == MessageType::DEPRECATION_WARNING) { + t = MessageType::DEPRECATION_ERROR; + } else if (!warningsAsErrors && t == MessageType::DEPRECATION_ERROR) { + t = MessageType::DEPRECATION_WARNING; } } return t; } -bool cmMessenger::IsMessageTypeVisible(cmake::MessageType t) const +bool cmMessenger::IsMessageTypeVisible(MessageType t) const { bool isVisible = true; - if (t == cmake::DEPRECATION_ERROR) { + if (t == MessageType::DEPRECATION_ERROR) { if (!this->GetDeprecatedWarningsAsErrors()) { isVisible = false; } - } else if (t == cmake::DEPRECATION_WARNING) { + } else if (t == MessageType::DEPRECATION_WARNING) { if (this->GetSuppressDeprecatedWarnings()) { isVisible = false; } - } else if (t == cmake::AUTHOR_ERROR) { + } else if (t == MessageType::AUTHOR_ERROR) { if (!this->GetDevWarningsAsErrors()) { isVisible = false; } - } else if (t == cmake::AUTHOR_WARNING) { + } else if (t == MessageType::AUTHOR_WARNING) { if (this->GetSuppressDevWarnings()) { isVisible = false; } @@ -61,22 +61,22 @@ bool cmMessenger::IsMessageTypeVisible(cmake::MessageType t) const return isVisible; } -static bool printMessagePreamble(cmake::MessageType t, std::ostream& msg) +static bool printMessagePreamble(MessageType t, std::ostream& msg) { // Construct the message header. - if (t == cmake::FATAL_ERROR) { + if (t == MessageType::FATAL_ERROR) { msg << "CMake Error"; - } else if (t == cmake::INTERNAL_ERROR) { + } else if (t == MessageType::INTERNAL_ERROR) { msg << "CMake Internal Error (please report a bug)"; - } else if (t == cmake::LOG) { + } else if (t == MessageType::LOG) { msg << "CMake Debug Log"; - } else if (t == cmake::DEPRECATION_ERROR) { + } else if (t == MessageType::DEPRECATION_ERROR) { msg << "CMake Deprecation Error"; - } else if (t == cmake::DEPRECATION_WARNING) { + } else if (t == MessageType::DEPRECATION_WARNING) { msg << "CMake Deprecation Warning"; - } else if (t == cmake::AUTHOR_WARNING) { + } else if (t == MessageType::AUTHOR_WARNING) { msg << "CMake Warning (dev)"; - } else if (t == cmake::AUTHOR_ERROR) { + } else if (t == MessageType::AUTHOR_ERROR) { msg << "CMake Error (dev)"; } else { msg << "CMake Warning"; @@ -92,13 +92,13 @@ void printMessageText(std::ostream& msg, std::string const& text) formatter.PrintFormatted(msg, text.c_str()); } -void displayMessage(cmake::MessageType t, std::ostringstream& msg) +void displayMessage(MessageType t, std::ostringstream& msg) { // Add a note about warning suppression. - if (t == cmake::AUTHOR_WARNING) { + if (t == MessageType::AUTHOR_WARNING) { msg << "This warning is for project developers. Use -Wno-dev to suppress " "it."; - } else if (t == cmake::AUTHOR_ERROR) { + } else if (t == MessageType::AUTHOR_ERROR) { msg << "This error is for project developers. Use -Wno-error=dev to " "suppress " "it."; @@ -109,7 +109,7 @@ void displayMessage(cmake::MessageType t, std::ostringstream& msg) #if defined(CMAKE_BUILD_WITH_CMAKE) // Add a C++ stack trace to internal errors. - if (t == cmake::INTERNAL_ERROR) { + if (t == MessageType::INTERNAL_ERROR) { std::string stack = cmsys::SystemInformation::GetProgramStack(0, 0); if (!stack.empty()) { if (cmHasLiteralPrefix(stack, "WARNING:")) { @@ -121,8 +121,8 @@ void displayMessage(cmake::MessageType t, std::ostringstream& msg) #endif // Output the message. - if (t == cmake::FATAL_ERROR || t == cmake::INTERNAL_ERROR || - t == cmake::DEPRECATION_ERROR || t == cmake::AUTHOR_ERROR) { + if (t == MessageType::FATAL_ERROR || t == MessageType::INTERNAL_ERROR || + t == MessageType::DEPRECATION_ERROR || t == MessageType::AUTHOR_ERROR) { cmSystemTools::SetErrorOccured(); cmSystemTools::Message(msg.str().c_str(), "Error"); } else { @@ -130,13 +130,13 @@ void displayMessage(cmake::MessageType t, std::ostringstream& msg) } } -void cmMessenger::IssueMessage(cmake::MessageType t, const std::string& text, +void cmMessenger::IssueMessage(MessageType t, const std::string& text, const cmListFileBacktrace& backtrace) const { bool force = false; if (!force) { // override the message type, if needed, for warnings and errors - cmake::MessageType override = this->ConvertMessageType(t); + MessageType override = this->ConvertMessageType(t); if (override != t) { t = override; force = true; @@ -149,7 +149,7 @@ void cmMessenger::IssueMessage(cmake::MessageType t, const std::string& text, this->DisplayMessage(t, text, backtrace); } -void cmMessenger::DisplayMessage(cmake::MessageType t, const std::string& text, +void cmMessenger::DisplayMessage(MessageType t, const std::string& text, const cmListFileBacktrace& backtrace) const { std::ostringstream msg; diff --git a/Source/cmMessenger.h b/Source/cmMessenger.h index e947eaa..cf15adf 100644 --- a/Source/cmMessenger.h +++ b/Source/cmMessenger.h @@ -6,7 +6,7 @@ #include "cmConfigure.h" // IWYU pragma: keep #include "cmListFileCache.h" -#include "cmake.h" +#include "cmMessageType.h" #include @@ -14,10 +14,10 @@ class cmMessenger { public: void IssueMessage( - cmake::MessageType t, std::string const& text, + MessageType t, std::string const& text, cmListFileBacktrace const& backtrace = cmListFileBacktrace()) const; - void DisplayMessage(cmake::MessageType t, std::string const& text, + void DisplayMessage(MessageType t, std::string const& text, cmListFileBacktrace const& backtrace) const; void SetSuppressDevWarnings(bool suppress) @@ -49,8 +49,8 @@ public: } private: - bool IsMessageTypeVisible(cmake::MessageType t) const; - cmake::MessageType ConvertMessageType(cmake::MessageType t) const; + bool IsMessageTypeVisible(MessageType t) const; + MessageType ConvertMessageType(MessageType t) const; bool SuppressDevWarnings = false; bool SuppressDeprecatedWarnings = false; diff --git a/Source/cmOptionCommand.cxx b/Source/cmOptionCommand.cxx index 006211d..52f63a3 100644 --- a/Source/cmOptionCommand.cxx +++ b/Source/cmOptionCommand.cxx @@ -6,12 +6,12 @@ #include "cmAlgorithms.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmPolicies.h" #include "cmState.h" #include "cmStateSnapshot.h" #include "cmStateTypes.h" #include "cmSystemTools.h" -#include "cmake.h" class cmExecutionStatus; @@ -81,7 +81,7 @@ bool cmOptionCommand::InitialPass(std::vector const& args, "For compatibility with older versions of CMake, option " "is clearing the normal variable '" << args[0] << "'."; - this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str()); + this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, w.str()); } } return true; diff --git a/Source/cmOrderDirectories.cxx b/Source/cmOrderDirectories.cxx index 7fd7732..961e2b2 100644 --- a/Source/cmOrderDirectories.cxx +++ b/Source/cmOrderDirectories.cxx @@ -5,6 +5,7 @@ #include "cmAlgorithms.h" #include "cmGeneratorTarget.h" #include "cmGlobalGenerator.h" +#include "cmMessageType.h" #include "cmSystemTools.h" #include "cmake.h" @@ -475,7 +476,7 @@ void cmOrderDirectories::FindImplicitConflicts() << " libraries in implicit directories:\n" << text << "Some of these libraries may not be found correctly."; this->GlobalGenerator->GetCMakeInstance()->IssueMessage( - cmake::WARNING, w.str(), this->Target->GetBacktrace()); + MessageType::WARNING, w.str(), this->Target->GetBacktrace()); } void cmOrderDirectories::OrderDirectories() @@ -544,7 +545,7 @@ void cmOrderDirectories::DiagnoseCycle() } e << "Some of these libraries may not be found correctly."; this->GlobalGenerator->GetCMakeInstance()->IssueMessage( - cmake::WARNING, e.str(), this->Target->GetBacktrace()); + MessageType::WARNING, e.str(), this->Target->GetBacktrace()); } bool cmOrderDirectories::IsSameDirectory(std::string const& l, diff --git a/Source/cmParseArgumentsCommand.cxx b/Source/cmParseArgumentsCommand.cxx index 2d61cc3..a2bf841 100644 --- a/Source/cmParseArgumentsCommand.cxx +++ b/Source/cmParseArgumentsCommand.cxx @@ -9,8 +9,8 @@ #include "cmAlgorithms.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmSystemTools.h" -#include "cmake.h" class cmExecutionStatus; @@ -46,7 +46,7 @@ bool cmParseArgumentsCommand::InitialPass(std::vector const& args, if (*argIter == "PARSE_ARGV") { if (args.size() != 6) { this->Makefile->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, "PARSE_ARGV must be called with exactly 6 arguments."); cmSystemTools::SetFatalErrorOccured(); return true; @@ -54,7 +54,7 @@ bool cmParseArgumentsCommand::InitialPass(std::vector const& args, parseFromArgV = true; argIter++; // move past PARSE_ARGV if (!cmSystemTools::StringToULong(argIter->c_str(), &argvStart)) { - this->Makefile->IssueMessage(cmake::FATAL_ERROR, + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, "PARSE_ARGV index '" + *argIter + "' is not an unsigned integer"); cmSystemTools::SetFatalErrorOccured(); @@ -86,7 +86,8 @@ bool cmParseArgumentsCommand::InitialPass(std::vector const& args, cmSystemTools::ExpandListArgument(*argIter++, list); for (std::string const& iter : list) { if (!used_keywords.insert(iter).second) { - this->GetMakefile()->IssueMessage(cmake::WARNING, dup_warning + iter); + this->GetMakefile()->IssueMessage(MessageType::WARNING, + dup_warning + iter); } options[iter]; // default initialize } @@ -96,7 +97,8 @@ bool cmParseArgumentsCommand::InitialPass(std::vector const& args, cmSystemTools::ExpandListArgument(*argIter++, list); for (std::string const& iter : list) { if (!used_keywords.insert(iter).second) { - this->GetMakefile()->IssueMessage(cmake::WARNING, dup_warning + iter); + this->GetMakefile()->IssueMessage(MessageType::WARNING, + dup_warning + iter); } singleValArgs[iter]; // default initialize } @@ -106,7 +108,8 @@ bool cmParseArgumentsCommand::InitialPass(std::vector const& args, cmSystemTools::ExpandListArgument(*argIter++, list); for (std::string const& iter : list) { if (!used_keywords.insert(iter).second) { - this->GetMakefile()->IssueMessage(cmake::WARNING, dup_warning + iter); + this->GetMakefile()->IssueMessage(MessageType::WARNING, + dup_warning + iter); } multiValArgs[iter]; // default initialize } @@ -131,7 +134,7 @@ bool cmParseArgumentsCommand::InitialPass(std::vector const& args, std::string argc = this->Makefile->GetSafeDefinition("ARGC"); unsigned long count; if (!cmSystemTools::StringToULong(argc.c_str(), &count)) { - this->Makefile->IssueMessage(cmake::FATAL_ERROR, + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, "PARSE_ARGV called with ARGC='" + argc + "' that is not an unsigned integer"); cmSystemTools::SetFatalErrorOccured(); @@ -142,7 +145,7 @@ bool cmParseArgumentsCommand::InitialPass(std::vector const& args, argName << "ARGV" << i; const char* arg = this->Makefile->GetDefinition(argName.str()); if (!arg) { - this->Makefile->IssueMessage(cmake::FATAL_ERROR, + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, "PARSE_ARGV called with " + argName.str() + " not set"); cmSystemTools::SetFatalErrorOccured(); diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 5caea7d..0a234c5 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -2,11 +2,11 @@ #include "cmAlgorithms.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmState.h" #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmVersion.h" -#include "cmake.h" #include #include @@ -128,7 +128,7 @@ static void DiagnoseAncientPolicies( << "Please either update your CMakeLists.txt files to conform to " << "the new behavior or use an older version of CMake that still " << "supports the old behavior."; - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); } static bool GetPolicyDefault(cmMakefile* mf, std::string const& policy, @@ -146,7 +146,7 @@ static bool GetPolicyDefault(cmMakefile* mf, std::string const& policy, std::ostringstream e; e << defaultVar << " has value \"" << defaultValue << "\" but must be \"OLD\", \"NEW\", or \"\" (empty)."; - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); return false; } @@ -167,14 +167,14 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile* mf, std::ostringstream e; e << "Invalid policy version value \"" << version_min << "\". " << "A numeric major.minor[.patch[.tweak]] must be given."; - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); return false; } // it is an error if the policy version is less than 2.4 if (minMajor < 2 || (minMajor == 2 && minMinor < 4)) { mf->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, "Compatibility with CMake < 2.4 is not supported by CMake >= 3.0. " "For compatibility with older versions please use any CMake 2.8.x " "release or lower."); @@ -199,7 +199,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile* mf, << "This is not allowed because the greater version may have new " << "policies not known to this CMake. " << "You may need a newer CMake version to build this project."; - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); return false; } @@ -218,7 +218,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile* mf, std::ostringstream e; e << "Invalid policy max version value \"" << version_max << "\". " << "A numeric major.minor[.patch[.tweak]] must be given."; - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); return false; } @@ -232,7 +232,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile* mf, e << "Policy VERSION range \"" << version_min << "..." << version_max << "\"" << " specifies a larger minimum than maximum."; - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); return false; } diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx index 8f565c8..14e92c6 100644 --- a/Source/cmProjectCommand.cxx +++ b/Source/cmProjectCommand.cxx @@ -9,10 +9,10 @@ #include "cmAlgorithms.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmPolicies.h" #include "cmStateTypes.h" #include "cmSystemTools.h" -#include "cmake.h" class cmExecutionStatus; @@ -90,7 +90,8 @@ bool cmProjectCommand::InitialPass(std::vector const& args, if (args[i] == "LANGUAGES") { if (haveLanguages) { this->Makefile->IssueMessage( - cmake::FATAL_ERROR, "LANGUAGES may be specified at most once."); + MessageType::FATAL_ERROR, + "LANGUAGES may be specified at most once."); cmSystemTools::SetFatalErrorOccured(); return true; } @@ -105,11 +106,11 @@ bool cmProjectCommand::InitialPass(std::vector const& args, "keyword: "; msg += cmJoin(languages, ", "); msg += '.'; - this->Makefile->IssueMessage(cmake::WARNING, msg); + this->Makefile->IssueMessage(MessageType::WARNING, msg); } } else if (args[i] == "VERSION") { if (haveVersion) { - this->Makefile->IssueMessage(cmake::FATAL_ERROR, + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, "VERSION may be specified at most once."); cmSystemTools::SetFatalErrorOccured(); return true; @@ -121,7 +122,7 @@ bool cmProjectCommand::InitialPass(std::vector const& args, doing = DoingVersion; missedValueReporter = [this, &resetReporter]() { this->Makefile->IssueMessage( - cmake::WARNING, + MessageType::WARNING, "VERSION keyword not followed by a value or was followed by a " "value that expanded to nothing."); resetReporter(); @@ -129,7 +130,8 @@ bool cmProjectCommand::InitialPass(std::vector const& args, } else if (args[i] == "DESCRIPTION") { if (haveDescription) { this->Makefile->IssueMessage( - cmake::FATAL_ERROR, "DESCRIPTION may be specified at most once."); + MessageType::FATAL_ERROR, + "DESCRIPTION may be specified at most once."); cmSystemTools::SetFatalErrorOccured(); return true; } @@ -140,7 +142,7 @@ bool cmProjectCommand::InitialPass(std::vector const& args, doing = DoingDescription; missedValueReporter = [this, &resetReporter]() { this->Makefile->IssueMessage( - cmake::WARNING, + MessageType::WARNING, "DESCRIPTION keyword not followed by a value or was followed " "by a value that expanded to nothing."); resetReporter(); @@ -148,7 +150,8 @@ bool cmProjectCommand::InitialPass(std::vector const& args, } else if (args[i] == "HOMEPAGE_URL") { if (haveHomepage) { this->Makefile->IssueMessage( - cmake::FATAL_ERROR, "HOMEPAGE_URL may be specified at most once."); + MessageType::FATAL_ERROR, + "HOMEPAGE_URL may be specified at most once."); cmSystemTools::SetFatalErrorOccured(); return true; } @@ -156,7 +159,7 @@ bool cmProjectCommand::InitialPass(std::vector const& args, doing = DoingHomepage; missedValueReporter = [this, &resetReporter]() { this->Makefile->IssueMessage( - cmake::WARNING, + MessageType::WARNING, "HOMEPAGE_URL keyword not followed by a value or was followed " "by a value that expanded to nothing."); resetReporter(); @@ -188,7 +191,7 @@ bool cmProjectCommand::InitialPass(std::vector const& args, if ((haveVersion || haveDescription || haveHomepage) && !haveLanguages && !languages.empty()) { this->Makefile->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, "project with VERSION, DESCRIPTION or HOMEPAGE_URL must " "use LANGUAGES before language names."); cmSystemTools::SetFatalErrorOccured(); @@ -204,7 +207,7 @@ bool cmProjectCommand::InitialPass(std::vector const& args, // Set project VERSION variables to given values if (cmp0048 == cmPolicies::OLD || cmp0048 == cmPolicies::WARN) { this->Makefile->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, "VERSION not allowed unless CMP0048 is set to NEW"); cmSystemTools::SetFatalErrorOccured(); return true; @@ -214,7 +217,7 @@ bool cmProjectCommand::InitialPass(std::vector const& args, "^([0-9]+(\\.[0-9]+(\\.[0-9]+(\\.[0-9]+)?)?)?)?$"); if (!vx.find(version)) { std::string e = "VERSION \"" + version + "\" format invalid."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e); cmSystemTools::SetFatalErrorOccured(); return true; } @@ -296,7 +299,7 @@ bool cmProjectCommand::InitialPass(std::vector const& args, std::ostringstream w; w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0048) << "\nThe following variable(s) would be set to empty:" << vw; - this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str()); + this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, w.str()); } } diff --git a/Source/cmQtAutoGenGlobalInitializer.cxx b/Source/cmQtAutoGenGlobalInitializer.cxx index f4cf3e0..cdd96ce 100644 --- a/Source/cmQtAutoGenGlobalInitializer.cxx +++ b/Source/cmQtAutoGenGlobalInitializer.cxx @@ -9,11 +9,11 @@ #include "cmGeneratorTarget.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmState.h" #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmTarget.h" -#include "cmake.h" #include #include @@ -122,7 +122,7 @@ cmQtAutoGenGlobalInitializer::cmQtAutoGenGlobalInitializer( msg += " find_package(Qt5 COMPONENTS Core)\n"; } msg += "to your CMakeLists.txt file."; - target->Makefile->IssueMessage(cmake::AUTHOR_WARNING, msg); + target->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, msg); } if (mocIsValid || uicIsValid || rccIsValid) { // Create autogen target initializer diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index 5ac080a..38a4ec2 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -16,6 +16,7 @@ #include "cmListFileCache.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmOutputConverter.h" #include "cmPolicies.h" #include "cmProcessOutput.h" @@ -842,7 +843,7 @@ bool cmQtAutoGenInitializer::InitScanFiles() msg += ":\n set_property(SOURCE file.h PROPERTY "; msg += property; msg += " ON)\n"; - makefile->IssueMessage(cmake::AUTHOR_WARNING, msg); + makefile->IssueMessage(MessageType::AUTHOR_WARNING, msg); } } } diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index 5d1f3f0..efc6bb5 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -7,6 +7,7 @@ #include "cmCustomCommand.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmProperty.h" #include "cmState.h" #include "cmSystemTools.h" @@ -179,7 +180,8 @@ bool cmSourceFile::FindFullPath(std::string* error) if (error) { *error = e.str(); } else { - this->Location.GetMakefile()->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->Location.GetMakefile()->IssueMessage(MessageType::FATAL_ERROR, + e.str()); } this->FindFullPathFailed = true; return false; diff --git a/Source/cmSourceFileLocation.cxx b/Source/cmSourceFileLocation.cxx index 90b9123..3dab638 100644 --- a/Source/cmSourceFileLocation.cxx +++ b/Source/cmSourceFileLocation.cxx @@ -5,6 +5,7 @@ #include "cmAlgorithms.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmSystemTools.h" #include "cmake.h" @@ -194,7 +195,7 @@ bool cmSourceFileLocation::Matches(cmSourceFileLocation const& loc) // This can occur when referencing a source file from a different // directory. This is not yet allowed. this->Makefile->IssueMessage( - cmake::INTERNAL_ERROR, + MessageType::INTERNAL_ERROR, "Matches error: Each side has a directory relative to a different " "location. This can occur when referencing a source file from a " "different directory. This is not yet allowed."); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 688f73b..a94cf6a 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -17,6 +17,7 @@ #include "cmGlobalGenerator.h" #include "cmListFileCache.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmMessenger.h" #include "cmOutputConverter.h" #include "cmProperty.h" @@ -99,7 +100,7 @@ const char* cmTargetPropertyComputer::GetSources( bool addContent = false; bool noMessage = true; std::ostringstream e; - cmake::MessageType messageType = cmake::AUTHOR_WARNING; + MessageType messageType = MessageType::AUTHOR_WARNING; switch (context.GetBottom().GetPolicy(cmPolicies::CMP0051)) { case cmPolicies::WARN: e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0051) << "\n"; @@ -570,7 +571,7 @@ std::string cmTarget::ProcessSourceItemCMP0049(const std::string& s) if (src != s) { std::ostringstream e; bool noMessage = false; - cmake::MessageType messageType = cmake::AUTHOR_WARNING; + MessageType messageType = MessageType::AUTHOR_WARNING; switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0049)) { case cmPolicies::WARN: e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0049) << "\n"; @@ -581,7 +582,7 @@ std::string cmTarget::ProcessSourceItemCMP0049(const std::string& s) case cmPolicies::REQUIRED_ALWAYS: case cmPolicies::REQUIRED_IF_USED: case cmPolicies::NEW: - messageType = cmake::FATAL_ERROR; + messageType = MessageType::FATAL_ERROR; } if (!noMessage) { e << "Legacy variable expansion in source file \"" << s @@ -589,7 +590,7 @@ std::string cmTarget::ProcessSourceItemCMP0049(const std::string& s) << "\". This behavior will be removed in a " "future version of CMake."; this->Makefile->IssueMessage(messageType, e.str()); - if (messageType == cmake::FATAL_ERROR) { + if (messageType == MessageType::FATAL_ERROR) { return ""; } } @@ -933,40 +934,40 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) if (prop == propMANUALLY_ADDED_DEPENDENCIES) { std::ostringstream e; e << "MANUALLY_ADDED_DEPENDENCIES property is read-only\n"; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); return; } if (prop == propNAME) { std::ostringstream e; e << "NAME property is read-only\n"; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); return; } if (prop == propTYPE) { std::ostringstream e; e << "TYPE property is read-only\n"; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); return; } if (prop == propEXPORT_NAME && this->IsImported()) { std::ostringstream e; e << "EXPORT_NAME property can't be set on imported targets (\"" << this->Name << "\")\n"; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); return; } if (prop == propSOURCES && this->IsImported()) { std::ostringstream e; e << "SOURCES property can't be set on imported targets (\"" << this->Name << "\")\n"; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); return; } if (prop == propIMPORTED_GLOBAL && !this->IsImported()) { std::ostringstream e; e << "IMPORTED_GLOBAL property can't be set on non-imported targets (\"" << this->Name << "\")\n"; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); return; } @@ -1039,7 +1040,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) std::ostringstream e; e << "IMPORTED_GLOBAL property can't be set to FALSE on targets (\"" << this->Name << "\")\n"; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); return; } /* no need to change anything if value does not change */ @@ -1056,7 +1057,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) e << "CUDA_PTX_COMPILATION property can only be applied to OBJECT " "targets (\"" << this->Name << "\")\n"; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); return; } else { this->Properties.SetProperty(prop, value); @@ -1074,21 +1075,21 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value, if (prop == "NAME") { std::ostringstream e; e << "NAME property is read-only\n"; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); return; } if (prop == "EXPORT_NAME" && this->IsImported()) { std::ostringstream e; e << "EXPORT_NAME property can't be set on imported targets (\"" << this->Name << "\")\n"; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); return; } if (prop == "SOURCES" && this->IsImported()) { std::ostringstream e; e << "SOURCES property can't be set on imported targets (\"" << this->Name << "\")\n"; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); return; } if (prop == "IMPORTED_GLOBAL") { @@ -1096,7 +1097,7 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value, e << "IMPORTED_GLOBAL property can't be appended, only set on imported " "targets (\"" << this->Name << "\")\n"; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); return; } if (prop == "INCLUDE_DIRECTORIES") { @@ -1146,7 +1147,7 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value, this->Internal->SourceEntries.push_back(value); this->Internal->SourceBacktraces.push_back(lfbt); } else if (cmHasLiteralPrefix(prop, "IMPORTED_LIBNAME")) { - this->Makefile->IssueMessage(cmake::FATAL_ERROR, + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, prop + " property may not be APPENDed."); } else { this->Properties.AppendProperty(prop, value, asString); @@ -1283,7 +1284,7 @@ static void cmTargetCheckLINK_INTERFACE_LIBRARIES(const std::string& prop, << "the LINK_INTERFACE_LIBRARIES and LINK_INTERFACE_LIBRARIES_DEBUG " << "properties accordingly."; } - context->IssueMessage(cmake::FATAL_ERROR, e.str()); + context->IssueMessage(MessageType::FATAL_ERROR, e.str()); } static void cmTargetCheckINTERFACE_LINK_LIBRARIES(const char* value, @@ -1305,7 +1306,7 @@ static void cmTargetCheckINTERFACE_LINK_LIBRARIES(const char* value, "property may contain configuration-sensitive generator-expressions " "which may be used to specify per-configuration rules."; - context->IssueMessage(cmake::FATAL_ERROR, e.str()); + context->IssueMessage(MessageType::FATAL_ERROR, e.str()); } static void cmTargetCheckIMPORTED_GLOBAL(const cmTarget* target, @@ -1319,7 +1320,7 @@ static void cmTargetCheckIMPORTED_GLOBAL(const cmTarget* target, e << "Attempt to promote imported target \"" << target->GetName() << "\" to global scope (by setting IMPORTED_GLOBAL) " "which is not built in this directory."; - context->IssueMessage(cmake::FATAL_ERROR, e.str()); + context->IssueMessage(MessageType::FATAL_ERROR, e.str()); } } @@ -1683,21 +1684,21 @@ bool cmTarget::CheckImportedLibName(std::string const& prop, if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY || !this->IsImported()) { this->Makefile->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, prop + " property may be set only on imported INTERFACE library targets."); return false; } if (!value.empty()) { if (value[0] == '-') { - this->Makefile->IssueMessage(cmake::FATAL_ERROR, + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, prop + " property value\n " + value + "\nmay not start with '-'."); return false; } std::string::size_type bad = value.find_first_of(":/\\;"); if (bad != std::string::npos) { - this->Makefile->IssueMessage(cmake::FATAL_ERROR, + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, prop + " property value\n " + value + "\nmay not contain '" + value.substr(bad, 1) + "'."); diff --git a/Source/cmTargetCompileDefinitionsCommand.cxx b/Source/cmTargetCompileDefinitionsCommand.cxx index 4e716dc..c4dc838 100644 --- a/Source/cmTargetCompileDefinitionsCommand.cxx +++ b/Source/cmTargetCompileDefinitionsCommand.cxx @@ -6,8 +6,8 @@ #include "cmAlgorithms.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmTarget.h" -#include "cmake.h" class cmExecutionStatus; @@ -24,7 +24,7 @@ void cmTargetCompileDefinitionsCommand::HandleMissingTarget( e << "Cannot specify compile definitions for target \"" << name << "\" " "which is not built by this project."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); } std::string cmTargetCompileDefinitionsCommand::Join( diff --git a/Source/cmTargetCompileFeaturesCommand.cxx b/Source/cmTargetCompileFeaturesCommand.cxx index f58e404..c9e394b 100644 --- a/Source/cmTargetCompileFeaturesCommand.cxx +++ b/Source/cmTargetCompileFeaturesCommand.cxx @@ -6,7 +6,7 @@ #include "cmAlgorithms.h" #include "cmMakefile.h" -#include "cmake.h" +#include "cmMessageType.h" class cmExecutionStatus; class cmTarget; @@ -24,7 +24,7 @@ void cmTargetCompileFeaturesCommand::HandleMissingTarget( e << "Cannot specify compile features for target \"" << name << "\" " "which is not built by this project."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); } std::string cmTargetCompileFeaturesCommand::Join( diff --git a/Source/cmTargetCompileOptionsCommand.cxx b/Source/cmTargetCompileOptionsCommand.cxx index 4df3630..8b4763a 100644 --- a/Source/cmTargetCompileOptionsCommand.cxx +++ b/Source/cmTargetCompileOptionsCommand.cxx @@ -7,8 +7,8 @@ #include "cmAlgorithms.h" #include "cmListFileCache.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmTarget.h" -#include "cmake.h" class cmExecutionStatus; @@ -24,7 +24,7 @@ void cmTargetCompileOptionsCommand::HandleMissingTarget( std::ostringstream e; e << "Cannot specify compile options for target \"" << name << "\" which is not built by this project."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); } std::string cmTargetCompileOptionsCommand::Join( diff --git a/Source/cmTargetIncludeDirectoriesCommand.cxx b/Source/cmTargetIncludeDirectoriesCommand.cxx index af142aa..d6918c0 100644 --- a/Source/cmTargetIncludeDirectoriesCommand.cxx +++ b/Source/cmTargetIncludeDirectoriesCommand.cxx @@ -8,9 +8,9 @@ #include "cmGeneratorExpression.h" #include "cmListFileCache.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmSystemTools.h" #include "cmTarget.h" -#include "cmake.h" class cmExecutionStatus; @@ -27,7 +27,7 @@ void cmTargetIncludeDirectoriesCommand::HandleMissingTarget( std::ostringstream e; e << "Cannot specify include directories for target \"" << name << "\" which is not built by this project."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); } std::string cmTargetIncludeDirectoriesCommand::Join( diff --git a/Source/cmTargetLinkDirectoriesCommand.cxx b/Source/cmTargetLinkDirectoriesCommand.cxx index bca3e45..269f751 100644 --- a/Source/cmTargetLinkDirectoriesCommand.cxx +++ b/Source/cmTargetLinkDirectoriesCommand.cxx @@ -8,9 +8,9 @@ #include "cmGeneratorExpression.h" #include "cmListFileCache.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmSystemTools.h" #include "cmTarget.h" -#include "cmake.h" class cmExecutionStatus; @@ -26,7 +26,7 @@ void cmTargetLinkDirectoriesCommand::HandleMissingTarget( std::ostringstream e; e << "Cannot specify link directories for target \"" << name << "\" which is not built by this project."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); } std::string cmTargetLinkDirectoriesCommand::Join( diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index eebf7a0..5c7b95c 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -8,6 +8,7 @@ #include "cmGeneratorExpression.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmPolicies.h" #include "cmState.h" #include "cmStateTypes.h" @@ -51,7 +52,7 @@ bool cmTargetLinkLibrariesCommand::InitialPass( } } if (!this->Target) { - cmake::MessageType t = cmake::FATAL_ERROR; // fail by default + MessageType t = MessageType::FATAL_ERROR; // fail by default std::ostringstream e; e << "Cannot specify link libraries for target \"" << args[0] << "\" " << "which is not built by this project."; @@ -60,7 +61,7 @@ bool cmTargetLinkLibrariesCommand::InitialPass( if (args.size() < 2) { switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0016)) { case cmPolicies::WARN: - t = cmake::AUTHOR_WARNING; + t = MessageType::AUTHOR_WARNING; // Print the warning. e << "\n" << "CMake does not support this but it used to work accidentally " @@ -69,7 +70,7 @@ bool cmTargetLinkLibrariesCommand::InitialPass( << cmPolicies::GetPolicyWarning(cmPolicies::CMP0016); break; case cmPolicies::OLD: // OLD behavior does not warn. - t = cmake::MESSAGE; + t = MessageType::MESSAGE; break; case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: @@ -81,11 +82,11 @@ bool cmTargetLinkLibrariesCommand::InitialPass( } // Now actually print the message. switch (t) { - case cmake::AUTHOR_WARNING: - this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, e.str()); + case MessageType::AUTHOR_WARNING: + this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, e.str()); break; - case cmake::FATAL_ERROR: - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + case MessageType::FATAL_ERROR: + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); cmSystemTools::SetFatalErrorOccured(); break; default: @@ -98,7 +99,7 @@ bool cmTargetLinkLibrariesCommand::InitialPass( if (this->Target->GetType() == cmStateEnums::UTILITY) { std::ostringstream e; const char* modal = nullptr; - cmake::MessageType messageType = cmake::AUTHOR_WARNING; + MessageType messageType = MessageType::AUTHOR_WARNING; switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0039)) { case cmPolicies::WARN: e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0039) << "\n"; @@ -109,13 +110,13 @@ bool cmTargetLinkLibrariesCommand::InitialPass( case cmPolicies::REQUIRED_IF_USED: case cmPolicies::NEW: modal = "must"; - messageType = cmake::FATAL_ERROR; + messageType = MessageType::FATAL_ERROR; } if (modal) { e << "Utility target \"" << this->Target->GetName() << "\" " << modal << " not be used as the target of a target_link_libraries call."; this->Makefile->IssueMessage(messageType, e.str()); - if (messageType == cmake::FATAL_ERROR) { + if (messageType == MessageType::FATAL_ERROR) { return false; } } @@ -141,7 +142,7 @@ bool cmTargetLinkLibrariesCommand::InitialPass( this->CurrentProcessingState = ProcessingPlainLinkInterface; if (i != 1) { this->Makefile->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, "The LINK_INTERFACE_LIBRARIES option must appear as the second " "argument, just after the target name."); return true; @@ -152,7 +153,7 @@ bool cmTargetLinkLibrariesCommand::InitialPass( this->CurrentProcessingState != ProcessingKeywordPublicInterface && this->CurrentProcessingState != ProcessingKeywordLinkInterface) { this->Makefile->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, "The INTERFACE, PUBLIC or PRIVATE option must appear as the second " "argument, just after the target name."); return true; @@ -163,7 +164,7 @@ bool cmTargetLinkLibrariesCommand::InitialPass( this->CurrentProcessingState != ProcessingPlainPrivateInterface && this->CurrentProcessingState != ProcessingPlainPublicInterface) { this->Makefile->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, "The LINK_PUBLIC or LINK_PRIVATE option must appear as the second " "argument, just after the target name."); return true; @@ -175,7 +176,7 @@ bool cmTargetLinkLibrariesCommand::InitialPass( this->CurrentProcessingState != ProcessingKeywordPublicInterface && this->CurrentProcessingState != ProcessingKeywordLinkInterface) { this->Makefile->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, "The INTERFACE, PUBLIC or PRIVATE option must appear as the second " "argument, just after the target name."); return true; @@ -186,7 +187,7 @@ bool cmTargetLinkLibrariesCommand::InitialPass( this->CurrentProcessingState != ProcessingPlainPublicInterface && this->CurrentProcessingState != ProcessingPlainPrivateInterface) { this->Makefile->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, "The LINK_PUBLIC or LINK_PRIVATE option must appear as the second " "argument, just after the target name."); return true; @@ -198,7 +199,7 @@ bool cmTargetLinkLibrariesCommand::InitialPass( this->CurrentProcessingState != ProcessingKeywordPublicInterface && this->CurrentProcessingState != ProcessingKeywordLinkInterface) { this->Makefile->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, "The INTERFACE, PUBLIC or PRIVATE option must appear as the second " "argument, just after the target name."); return true; @@ -258,7 +259,7 @@ bool cmTargetLinkLibrariesCommand::InitialPass( std::ostringstream e; e << "The \"" << cmTargetLinkLibrariesCommand::LinkLibraryTypeNames[llt] << "\" argument must be followed by a library."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); cmSystemTools::SetFatalErrorOccured(); } @@ -290,7 +291,7 @@ void cmTargetLinkLibrariesCommand::LinkLibraryTypeSpecifierWarning(int left, << cmTargetLinkLibrariesCommand::LinkLibraryTypeNames[right] << "\" instead of a library name. " << "The first specifier will be ignored."; - this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str()); + this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, w.str()); } bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib, @@ -299,7 +300,7 @@ bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib, if (this->Target->GetType() == cmStateEnums::INTERFACE_LIBRARY && this->CurrentProcessingState != ProcessingKeywordLinkInterface) { this->Makefile->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, "INTERFACE library can only be used with the INTERFACE keyword of " "target_link_libraries"); return false; @@ -307,7 +308,7 @@ bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib, if (this->Target->IsImported() && this->CurrentProcessingState != ProcessingKeywordLinkInterface) { this->Makefile->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, "IMPORTED library can only be used with the INTERFACE keyword of " "target_link_libraries"); return false; @@ -325,7 +326,7 @@ bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib, sig, this->Makefile->GetExecutionContext())) { std::ostringstream e; const char* modal = nullptr; - cmake::MessageType messageType = cmake::AUTHOR_WARNING; + MessageType messageType = MessageType::AUTHOR_WARNING; switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0023)) { case cmPolicies::WARN: e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0023) << "\n"; @@ -336,7 +337,7 @@ bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib, case cmPolicies::REQUIRED_IF_USED: case cmPolicies::NEW: modal = "must"; - messageType = cmake::FATAL_ERROR; + messageType = MessageType::FATAL_ERROR; } if (modal) { @@ -355,7 +356,7 @@ bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib, ? cmTarget::PlainTLLSignature : cmTarget::KeywordTLLSignature); this->Makefile->IssueMessage(messageType, e.str()); - if (messageType == cmake::FATAL_ERROR) { + if (messageType == MessageType::FATAL_ERROR) { return false; } } @@ -408,7 +409,7 @@ bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib, << this->Target->GetName() << "\" which is not built in this directory.\n" << "This is allowed only when policy CMP0079 is set to NEW."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); return false; } @@ -426,7 +427,7 @@ bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib, << " may not be linked into another target. One may link only to " "INTERFACE, OBJECT, STATIC or SHARED libraries, or to executables " "with the ENABLE_EXPORTS property set."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); } this->Target->AddLinkLibrary(*this->Makefile, lib, libRef, llt); @@ -442,7 +443,7 @@ bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib, "which the target was created rather than in this calling " "directory."; /* clang-format on */ - this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str()); + this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, w.str()); } // Handle (additional) case where the command was called with PRIVATE / diff --git a/Source/cmTargetLinkOptionsCommand.cxx b/Source/cmTargetLinkOptionsCommand.cxx index d6ed5ae..5366486 100644 --- a/Source/cmTargetLinkOptionsCommand.cxx +++ b/Source/cmTargetLinkOptionsCommand.cxx @@ -7,8 +7,8 @@ #include "cmAlgorithms.h" #include "cmListFileCache.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmTarget.h" -#include "cmake.h" class cmExecutionStatus; @@ -23,7 +23,7 @@ void cmTargetLinkOptionsCommand::HandleMissingTarget(const std::string& name) std::ostringstream e; e << "Cannot specify link options for target \"" << name << "\" which is not built by this project."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); } std::string cmTargetLinkOptionsCommand::Join( diff --git a/Source/cmTargetPropertyComputer.cxx b/Source/cmTargetPropertyComputer.cxx index e1765ff..d2c3496 100644 --- a/Source/cmTargetPropertyComputer.cxx +++ b/Source/cmTargetPropertyComputer.cxx @@ -7,10 +7,10 @@ #include #include +#include "cmMessageType.h" #include "cmMessenger.h" #include "cmPolicies.h" #include "cmStateSnapshot.h" -#include "cmake.h" bool cmTargetPropertyComputer::HandleLocationPropertyPolicy( std::string const& tgtName, cmMessenger* messenger, @@ -18,7 +18,7 @@ bool cmTargetPropertyComputer::HandleLocationPropertyPolicy( { std::ostringstream e; const char* modal = nullptr; - cmake::MessageType messageType = cmake::AUTHOR_WARNING; + MessageType messageType = MessageType::AUTHOR_WARNING; switch (context.GetBottom().GetPolicy(cmPolicies::CMP0026)) { case cmPolicies::WARN: e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0026) << "\n"; @@ -29,7 +29,7 @@ bool cmTargetPropertyComputer::HandleLocationPropertyPolicy( case cmPolicies::REQUIRED_IF_USED: case cmPolicies::NEW: modal = "may"; - messageType = cmake::FATAL_ERROR; + messageType = MessageType::FATAL_ERROR; } if (modal) { @@ -41,7 +41,7 @@ bool cmTargetPropertyComputer::HandleLocationPropertyPolicy( messenger->IssueMessage(messageType, e.str(), context); } - return messageType != cmake::FATAL_ERROR; + return messageType != MessageType::FATAL_ERROR; } bool cmTargetPropertyComputer::WhiteListedInterfaceProperty( @@ -101,7 +101,7 @@ bool cmTargetPropertyComputer::PassesWhitelist( e << "INTERFACE_LIBRARY targets may only have whitelisted properties. " "The property \"" << prop << "\" is not allowed."; - messenger->IssueMessage(cmake::FATAL_ERROR, e.str(), context); + messenger->IssueMessage(MessageType::FATAL_ERROR, e.str(), context); return false; } return true; diff --git a/Source/cmTargetSourcesCommand.cxx b/Source/cmTargetSourcesCommand.cxx index 7429053..11e288f 100644 --- a/Source/cmTargetSourcesCommand.cxx +++ b/Source/cmTargetSourcesCommand.cxx @@ -7,10 +7,10 @@ #include "cmAlgorithms.h" #include "cmGeneratorExpression.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmPolicies.h" #include "cmSystemTools.h" #include "cmTarget.h" -#include "cmake.h" class cmExecutionStatus; @@ -34,7 +34,7 @@ void cmTargetSourcesCommand::HandleMissingTarget(const std::string& name) e << "Cannot specify sources for target \"" << name << "\" " "which is not built by this project."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); } std::string cmTargetSourcesCommand::Join( @@ -99,7 +99,7 @@ std::vector cmTargetSourcesCommand::ConvertToAbsoluteContent( case cmPolicies::REQUIRED_ALWAYS: case cmPolicies::REQUIRED_IF_USED: this->Makefile->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0076)); break; case cmPolicies::NEW: { @@ -117,7 +117,7 @@ std::vector cmTargetSourcesCommand::ConvertToAbsoluteContent( e << "A private source from a directory other than that of target \"" << tgt->GetName() << "\" has a relative path."; } - this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, e.str()); + this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, e.str()); } return useAbsoluteContent ? absoluteContent : content; diff --git a/Source/cmTryCompileCommand.cxx b/Source/cmTryCompileCommand.cxx index 3ff84ce..05b3f05 100644 --- a/Source/cmTryCompileCommand.cxx +++ b/Source/cmTryCompileCommand.cxx @@ -3,6 +3,7 @@ #include "cmTryCompileCommand.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmake.h" class cmExecutionStatus; @@ -18,7 +19,7 @@ bool cmTryCompileCommand::InitialPass(std::vector const& argv, if (this->Makefile->GetCMakeInstance()->GetWorkingMode() == cmake::FIND_PACKAGE_MODE) { this->Makefile->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, "The TRY_COMPILE() command is not supported in --find-package mode."); return false; } diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx index fafbd24..e224a27 100644 --- a/Source/cmTryRunCommand.cxx +++ b/Source/cmTryRunCommand.cxx @@ -7,6 +7,7 @@ #include "cmDuration.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmState.h" #include "cmStateTypes.h" #include "cmSystemTools.h" @@ -25,7 +26,7 @@ bool cmTryRunCommand::InitialPass(std::vector const& argv, if (this->Makefile->GetCMakeInstance()->GetWorkingMode() == cmake::FIND_PACKAGE_MODE) { this->Makefile->IssueMessage( - cmake::FATAL_ERROR, + MessageType::FATAL_ERROR, "The TRY_RUN() command is not supported in --find-package mode."); return false; } diff --git a/Source/cmVariableWatchCommand.cxx b/Source/cmVariableWatchCommand.cxx index e080df1..03e0059 100644 --- a/Source/cmVariableWatchCommand.cxx +++ b/Source/cmVariableWatchCommand.cxx @@ -7,6 +7,7 @@ #include "cmExecutionStatus.h" #include "cmListFileCache.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmSystemTools.h" #include "cmVariableWatch.h" #include "cmake.h" @@ -70,7 +71,7 @@ static void cmVariableWatchCommandVariableAccessed(const std::string& variable, msg << "Variable \"" << variable << "\" was accessed using " << accessString << " with value \"" << (newValue ? newValue : "") << "\"."; - makefile->IssueMessage(cmake::LOG, msg.str()); + makefile->IssueMessage(MessageType::LOG, msg.str()); } data->InCallback = false; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 655d6f0..dd90269 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -6,6 +6,7 @@ #include "cmComputeLinkInformation.h" #include "cmCustomCommandGenerator.h" #include "cmGeneratedFileStream.h" +#include "cmGeneratorExpression.h" #include "cmGeneratorTarget.h" #include "cmGlobalVisualStudio10Generator.h" #include "cmLocalVisualStudio10Generator.h" @@ -320,8 +321,7 @@ void cmVisualStudio10TargetGenerator::Generate() this->GeneratorTarget->GetName() + "\" is of type STATIC_LIBRARY. This is discouraged (and may be " "disabled in future). Make it a SHARED library instead."; - this->Makefile->IssueMessage(cmake::MessageType::DEPRECATION_WARNING, - message); + this->Makefile->IssueMessage(MessageType::DEPRECATION_WARNING, message); } this->ProjectType = csproj; this->Managed = true; @@ -2590,7 +2590,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( "\" the /clr compiler flag was added manually. " + "Set usage of C++/CLI by setting COMMON_LANGUAGE_RUNTIME " "target property."; - this->Makefile->IssueMessage(cmake::MessageType::WARNING, message); + this->Makefile->IssueMessage(MessageType::WARNING, message); } } if (auto* clr = diff --git a/Source/cmWhileCommand.cxx b/Source/cmWhileCommand.cxx index 9d43d19..a01fa6f 100644 --- a/Source/cmWhileCommand.cxx +++ b/Source/cmWhileCommand.cxx @@ -6,8 +6,8 @@ #include "cmExecutionStatus.h" #include "cmExpandedCommandArgument.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmSystemTools.h" -#include "cmake.h" #include // IWYU pragma: keep @@ -45,7 +45,7 @@ bool cmWhileFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff, std::vector expandedArguments; mf.ExpandArguments(this->Args, expandedArguments); - cmake::MessageType messageType; + MessageType messageType; cmListFileContext execContext = this->GetStartingContext(); @@ -72,7 +72,7 @@ bool cmWhileFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff, err += errorString; err += ")."; mf.IssueMessage(messageType, err); - if (messageType == cmake::FATAL_ERROR) { + if (messageType == MessageType::FATAL_ERROR) { cmSystemTools::SetFatalErrorOccured(); return true; } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index dfdcf8a..c65bd2e 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2465,7 +2465,7 @@ static bool cmakeCheckStampList(const char* stampList, bool verbose) return true; } -void cmake::IssueMessage(cmake::MessageType t, std::string const& text, +void cmake::IssueMessage(MessageType t, std::string const& text, cmListFileBacktrace const& backtrace) const { this->Messenger->IssueMessage(t, text, backtrace); @@ -2692,7 +2692,7 @@ void cmake::RunCheckForUnusedVariables() } } if (haveUnused) { - this->IssueMessage(cmake::WARNING, msg.str()); + this->IssueMessage(MessageType::WARNING, msg.str()); } #endif } diff --git a/Source/cmake.h b/Source/cmake.h index 3c06c56..9891857 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -14,6 +14,7 @@ #include "cmInstalledFile.h" #include "cmListFileCache.h" +#include "cmMessageType.h" #include "cmStateSnapshot.h" #include "cmStateTypes.h" @@ -68,19 +69,6 @@ public: RoleProject // all commands }; - enum MessageType - { - AUTHOR_WARNING, - AUTHOR_ERROR, - FATAL_ERROR, - INTERNAL_ERROR, - MESSAGE, - WARNING, - LOG, - DEPRECATION_ERROR, - DEPRECATION_WARNING - }; - enum DiagLevel { DIAG_IGNORE, @@ -433,7 +421,7 @@ public: /** Display a message to the user. */ void IssueMessage( - cmake::MessageType t, std::string const& text, + MessageType t, std::string const& text, cmListFileBacktrace const& backtrace = cmListFileBacktrace()) const; ///! run the --build option @@ -549,13 +537,13 @@ private: * Convert a message type between a warning and an error, based on the state * of the error output CMake variables, in the cache. */ - cmake::MessageType ConvertMessageType(cmake::MessageType t) const; + MessageType ConvertMessageType(MessageType t) const; /* * Check if messages of this type should be output, based on the state of the * warning and error output CMake variables, in the cache. */ - bool IsMessageTypeVisible(cmake::MessageType t) const; + bool IsMessageTypeVisible(MessageType t) const; }; #define CMAKE_STANDARD_OPTIONS_TABLE \ https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b056bc34258267c4ae59c72e3777d0a0f0b5a1b1 commit b056bc34258267c4ae59c72e3777d0a0f0b5a1b1 Author: Sean McBride AuthorDate: Fri Jan 11 16:58:56 2019 -0500 Commit: Brad King CommitDate: Tue Jan 15 14:09:46 2019 -0500 Fix most clang -Wextra-semi-stmt warnings in C++ files Suppress one in code generated by flex. diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in index 18e0078..823ee3c 100644 --- a/CTestCustom.cmake.in +++ b/CTestCustom.cmake.in @@ -52,6 +52,7 @@ list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION "(Lexer|Parser).*warning.*conversion.*may (alter its value|change the sign)" "(Lexer|Parser).*warning.*(statement is unreachable|will never be executed)" "(Lexer|Parser).*warning.*variable.*was set but never used" + "LexerParser.*warning.*empty expression statement has no effect; remove unnecessary" "PGC-W-0095-Type cast required for this conversion.*ProcessUNIX.c" "[Qq]t([Cc]ore|[Gg]ui|[Ww]idgets).*warning.*conversion.*may alter its value" "warning:.*is.*very unsafe.*consider using.*" diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index b43f1c9..1756218 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -112,13 +112,15 @@ int cmCPackArchiveGenerator::addOneComponentToArchive( return 0; \ } \ cmArchiveWrite archive(gf, this->Compress, this->ArchiveFormat); \ - if (!(archive)) { \ - cmCPackLogger(cmCPackLog::LOG_ERROR, \ - "Problem to create archive <" \ - << (filename) << ">, ERROR = " << (archive).GetError() \ - << std::endl); \ - return 0; \ - } + do { \ + if (!(archive)) { \ + cmCPackLogger(cmCPackLog::LOG_ERROR, \ + "Problem to create archive <" \ + << (filename) << ">, ERROR = " << (archive).GetError() \ + << std::endl); \ + return 0; \ + } \ + } while (false) int cmCPackArchiveGenerator::PackageComponents(bool ignoreGroup) { diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index 539a0ce..361883c 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -357,14 +357,18 @@ int cmCTestBuildHandler::ProcessHandler() // Pre-compile regular expressions objects for all regular expressions #define cmCTestBuildHandlerPopulateRegexVector(strings, regexes) \ - regexes.clear(); \ - cmCTestOptionalLog(this->CTest, DEBUG, \ - this << "Add " #regexes << std::endl, this->Quiet); \ - for (std::string const& s : (strings)) { \ + do { \ + regexes.clear(); \ cmCTestOptionalLog(this->CTest, DEBUG, \ - "Add " #strings ": " << s << std::endl, this->Quiet); \ - (regexes).push_back(s.c_str()); \ - } + this << "Add " #regexes << std::endl, this->Quiet); \ + for (std::string const& s : (strings)) { \ + cmCTestOptionalLog(this->CTest, DEBUG, \ + "Add " #strings ": " << s << std::endl, \ + this->Quiet); \ + (regexes).push_back(s.c_str()); \ + } \ + } while (false) + cmCTestBuildHandlerPopulateRegexVector(this->CustomErrorMatches, this->ErrorMatchRegex); cmCTestBuildHandlerPopulateRegexVector(this->CustomErrorExceptions, diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 1d9a5f7..fbd1038 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -57,7 +57,6 @@ public: { this->CommandLineStrings.clear(); this->CommandLineStrings.push_back(command); - ; } void AddArgument(const char* arg) { diff --git a/Source/LexerParser/cmCommandArgumentLexer.cxx b/Source/LexerParser/cmCommandArgumentLexer.cxx index c96f8b3..5879912 100644 --- a/Source/LexerParser/cmCommandArgumentLexer.cxx +++ b/Source/LexerParser/cmCommandArgumentLexer.cxx @@ -671,7 +671,7 @@ Modify cmCommandArgumentLexer.cxx: /* Replace the lexer input function. */ #undef YY_INPUT #define YY_INPUT(buf, result, max_size) \ - { result = yyextra->LexInput(buf, max_size); } + do { result = yyextra->LexInput(buf, max_size); } while (0) /* Include the set of tokens from the parser. */ #include "cmCommandArgumentParserTokens.h" diff --git a/Source/LexerParser/cmCommandArgumentLexer.in.l b/Source/LexerParser/cmCommandArgumentLexer.in.l index 79275dd..010d54b 100644 --- a/Source/LexerParser/cmCommandArgumentLexer.in.l +++ b/Source/LexerParser/cmCommandArgumentLexer.in.l @@ -25,7 +25,7 @@ Modify cmCommandArgumentLexer.cxx: /* Replace the lexer input function. */ #undef YY_INPUT #define YY_INPUT(buf, result, max_size) \ - { result = yyextra->LexInput(buf, max_size); } + do { result = yyextra->LexInput(buf, max_size); } while (0) /* Include the set of tokens from the parser. */ #include "cmCommandArgumentParserTokens.h" diff --git a/Source/LexerParser/cmDependsJavaLexer.cxx b/Source/LexerParser/cmDependsJavaLexer.cxx index ed6eea9..d703e3c 100644 --- a/Source/LexerParser/cmDependsJavaLexer.cxx +++ b/Source/LexerParser/cmDependsJavaLexer.cxx @@ -869,7 +869,7 @@ Modify cmDependsJavaLexer.cxx: /* Replace the lexer input function. */ #undef YY_INPUT #define YY_INPUT(buf, result, max_size) \ - { result = yyextra->LexInput(buf, max_size); } + do { result = yyextra->LexInput(buf, max_size); } while (0) /* Include the set of tokens from the parser. */ #include "cmDependsJavaParserTokens.h" diff --git a/Source/LexerParser/cmDependsJavaLexer.in.l b/Source/LexerParser/cmDependsJavaLexer.in.l index b48d1bd..3dd3c22 100644 --- a/Source/LexerParser/cmDependsJavaLexer.in.l +++ b/Source/LexerParser/cmDependsJavaLexer.in.l @@ -27,7 +27,7 @@ Modify cmDependsJavaLexer.cxx: /* Replace the lexer input function. */ #undef YY_INPUT #define YY_INPUT(buf, result, max_size) \ - { result = yyextra->LexInput(buf, max_size); } + do { result = yyextra->LexInput(buf, max_size); } while (0) /* Include the set of tokens from the parser. */ #include "cmDependsJavaParserTokens.h" diff --git a/Source/LexerParser/cmDependsJavaParser.cxx b/Source/LexerParser/cmDependsJavaParser.cxx index 5400a10..e83afa9 100644 --- a/Source/LexerParser/cmDependsJavaParser.cxx +++ b/Source/LexerParser/cmDependsJavaParser.cxx @@ -107,7 +107,7 @@ static void cmDependsJava_yyerror(yyscan_t yyscanner, const char* message); #define YYMAXDEPTH 1000000 -#define jpCheckEmpty(cnt) yyGetParser->CheckEmpty(__LINE__, cnt, yyvsp); +#define jpCheckEmpty(cnt) yyGetParser->CheckEmpty(__LINE__, cnt, yyvsp) #define jpElementStart(cnt) yyGetParser->PrepareElement(&yyval) #define jpStoreClass(str) yyGetParser->AddClassFound(str); yyGetParser->DeallocateParserType(&(str)) /* Disable some warnings in the generated code. */ diff --git a/Source/LexerParser/cmDependsJavaParser.y b/Source/LexerParser/cmDependsJavaParser.y index a4e9c5d..d15cffc 100644 --- a/Source/LexerParser/cmDependsJavaParser.y +++ b/Source/LexerParser/cmDependsJavaParser.y @@ -36,7 +36,7 @@ static void cmDependsJava_yyerror(yyscan_t yyscanner, const char* message); #define YYMAXDEPTH 1000000 -#define jpCheckEmpty(cnt) yyGetParser->CheckEmpty(__LINE__, cnt, yyvsp); +#define jpCheckEmpty(cnt) yyGetParser->CheckEmpty(__LINE__, cnt, yyvsp) #define jpElementStart(cnt) yyGetParser->PrepareElement(&yyval) #define jpStoreClass(str) yyGetParser->AddClassFound(str); yyGetParser->DeallocateParserType(&(str)) /* Disable some warnings in the generated code. */ diff --git a/Source/LexerParser/cmExprLexer.cxx b/Source/LexerParser/cmExprLexer.cxx index fd0f745..72e59b6 100644 --- a/Source/LexerParser/cmExprLexer.cxx +++ b/Source/LexerParser/cmExprLexer.cxx @@ -671,7 +671,7 @@ Modify cmExprLexer.cxx: /* Replace the lexer input function. */ #undef YY_INPUT #define YY_INPUT(buf, result, max_size) \ - { result = yyextra->LexInput(buf, max_size); } + do { result = yyextra->LexInput(buf, max_size); } while (0) /* Include the set of tokens from the parser. */ #include "cmExprParserTokens.h" diff --git a/Source/LexerParser/cmExprLexer.in.l b/Source/LexerParser/cmExprLexer.in.l index 89d1381..f8a4224 100644 --- a/Source/LexerParser/cmExprLexer.in.l +++ b/Source/LexerParser/cmExprLexer.in.l @@ -25,7 +25,7 @@ Modify cmExprLexer.cxx: /* Replace the lexer input function. */ #undef YY_INPUT #define YY_INPUT(buf, result, max_size) \ - { result = yyextra->LexInput(buf, max_size); } + do { result = yyextra->LexInput(buf, max_size); } while (0) /* Include the set of tokens from the parser. */ #include "cmExprParserTokens.h" diff --git a/Source/LexerParser/cmFortranLexer.cxx b/Source/LexerParser/cmFortranLexer.cxx index f12df29..bcda77c 100644 --- a/Source/LexerParser/cmFortranLexer.cxx +++ b/Source/LexerParser/cmFortranLexer.cxx @@ -848,7 +848,7 @@ Modify cmFortranLexer.cxx: /* Replace the lexer input function. */ #undef YY_INPUT #define YY_INPUT(buf, result, max_size) \ - { result = cmFortranParser_Input(yyextra, buf, max_size); } + do { result = cmFortranParser_Input(yyextra, buf, max_size); } while (0) /* Include the set of tokens from the parser. */ #include "cmFortranParserTokens.h" diff --git a/Source/LexerParser/cmFortranLexer.in.l b/Source/LexerParser/cmFortranLexer.in.l index f752f37..3d38a7d 100644 --- a/Source/LexerParser/cmFortranLexer.in.l +++ b/Source/LexerParser/cmFortranLexer.in.l @@ -37,7 +37,7 @@ Modify cmFortranLexer.cxx: /* Replace the lexer input function. */ #undef YY_INPUT #define YY_INPUT(buf, result, max_size) \ - { result = cmFortranParser_Input(yyextra, buf, max_size); } + do { result = cmFortranParser_Input(yyextra, buf, max_size); } while (0) /* Include the set of tokens from the parser. */ #include "cmFortranParserTokens.h" diff --git a/Source/LexerParser/cmListFileLexer.c b/Source/LexerParser/cmListFileLexer.c index eb37337..c726415 100644 --- a/Source/LexerParser/cmListFileLexer.c +++ b/Source/LexerParser/cmListFileLexer.c @@ -805,7 +805,7 @@ static void cmListFileLexerDestroy(cmListFileLexer* lexer); /* Replace the lexer input function. */ #undef YY_INPUT #define YY_INPUT(buf, result, max_size) \ - { result = cmListFileLexerInput(cmListFileLexer_yyget_extra(yyscanner), buf, max_size); } + do { result = cmListFileLexerInput(cmListFileLexer_yyget_extra(yyscanner), buf, max_size); } while (0) /*--------------------------------------------------------------------------*/ diff --git a/Source/LexerParser/cmListFileLexer.in.l b/Source/LexerParser/cmListFileLexer.in.l index 23c7e49..6a6fb5f 100644 --- a/Source/LexerParser/cmListFileLexer.in.l +++ b/Source/LexerParser/cmListFileLexer.in.l @@ -57,7 +57,7 @@ static void cmListFileLexerDestroy(cmListFileLexer* lexer); /* Replace the lexer input function. */ #undef YY_INPUT #define YY_INPUT(buf, result, max_size) \ - { result = cmListFileLexerInput(cmListFileLexer_yyget_extra(yyscanner), buf, max_size); } + do { result = cmListFileLexerInput(cmListFileLexer_yyget_extra(yyscanner), buf, max_size); } while (0) /*--------------------------------------------------------------------------*/ %} diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx index 3f2e784..6e5109a 100644 --- a/Source/cmArchiveWrite.cxx +++ b/Source/cmArchiveWrite.cxx @@ -135,7 +135,7 @@ cmArchiveWrite::cmArchiveWrite(std::ostream& os, Compress c, return; } break; - }; + } #if !defined(_WIN32) || defined(__CYGWIN__) if (archive_read_disk_set_standard_lookup(this->Disk) != ARCHIVE_OK) { this->Error = "archive_read_disk_set_standard_lookup: "; diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 225c99f..65c0d91 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -2853,9 +2853,11 @@ static const char* cmCTestStringLogType[] = { "DEBUG", nullptr }; #define cmCTestLogOutputFileLine(stream) \ - if (this->ShowLineNumbers) { \ - (stream) << std::endl << file << ":" << line << " "; \ - } + do { \ + if (this->ShowLineNumbers) { \ + (stream) << std::endl << file << ":" << line << " "; \ + } \ + } while (false) void cmCTest::InitStreams() { diff --git a/Source/cmCurl.cxx b/Source/cmCurl.cxx index 0482898..0004f66 100644 --- a/Source/cmCurl.cxx +++ b/Source/cmCurl.cxx @@ -14,11 +14,13 @@ #endif #define check_curl_result(result, errstr) \ - if ((result) != CURLE_OK && (result) != CURLE_NOT_BUILT_IN) { \ - e += e.empty() ? "" : "\n"; \ - e += (errstr); \ - e += ::curl_easy_strerror(result); \ - } + do { \ + if ((result) != CURLE_OK && (result) != CURLE_NOT_BUILT_IN) { \ + e += e.empty() ? "" : "\n"; \ + e += (errstr); \ + e += ::curl_easy_strerror(result); \ + } \ + } while (false) std::string cmCurlSetCAInfo(::CURL* curl, const char* cafile) { diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index fafb079..6a817b4 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -139,10 +139,12 @@ bool cmDocumentation::PrintRequestedDocumentation(std::ostream& os) } #define GET_OPT_ARGUMENT(target) \ - if ((i + 1 < argc) && !this->IsOption(argv[i + 1])) { \ - (target) = argv[i + 1]; \ - i = i + 1; \ - }; + do { \ + if ((i + 1 < argc) && !this->IsOption(argv[i + 1])) { \ + (target) = argv[i + 1]; \ + i = i + 1; \ + }; \ + } while (false) void cmDocumentation::WarnFormFromFilename( cmDocumentation::RequestedHelpItem& request, bool& result) diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 84fcb95..5cd4735 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -382,7 +382,6 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile() xml.StartElement("natures"); xml.Element("nature", "org.eclipse.cdt.make.core.makeNature"); xml.Element("nature", "org.eclipse.cdt.make.core.ScannerConfigNature"); - ; for (std::string const& n : this->Natures) { xml.Element("nature", n); diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 475eee4..bbdf022 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -2699,12 +2699,14 @@ private: #endif #define check_curl_result(result, errstr) \ - if (result != CURLE_OK) { \ - std::string e(errstr); \ - e += ::curl_easy_strerror(result); \ - this->SetError(e); \ - return false; \ - } + do { \ + if (result != CURLE_OK) { \ + std::string e(errstr); \ + e += ::curl_easy_strerror(result); \ + this->SetError(e); \ + return false; \ + } \ + } while (false) bool cmFileCommand::HandleDownloadCommand(std::vector const& args) { diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 80d81d5..44941f6 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -435,14 +435,14 @@ static void handleSystemIncludesDep( /* clang-format off */ #define IMPLEMENT_VISIT(KIND) \ - { \ + do { \ KindedSources const& kinded = this->GetKindedSources(config); \ for (SourceAndKind const& s : kinded.Sources) { \ if (s.Kind == KIND) { \ data.push_back(s.Source.Value); \ } \ } \ - } + } while (false) /* clang-format on */ void cmGeneratorTarget::GetObjectSources( diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index 754fa7d..199c8e2 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -198,12 +198,12 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName, std::cout << "Reading GraphViz options file: " << inFileName << std::endl; #define __set_if_set(var, cmakeDefinition) \ - { \ + do { \ const char* value = mf.GetDefinition(cmakeDefinition); \ if (value) { \ (var) = value; \ } \ - } + } while (false) __set_if_set(this->GraphType, "GRAPHVIZ_GRAPH_TYPE"); __set_if_set(this->GraphName, "GRAPHVIZ_GRAPH_NAME"); @@ -211,12 +211,12 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName, __set_if_set(this->GraphNodePrefix, "GRAPHVIZ_NODE_PREFIX"); #define __set_bool_if_set(var, cmakeDefinition) \ - { \ + do { \ const char* value = mf.GetDefinition(cmakeDefinition); \ if (value) { \ (var) = mf.IsOn(cmakeDefinition); \ } \ - } + } while (false) __set_bool_if_set(this->GenerateForExecutables, "GRAPHVIZ_EXECUTABLES"); __set_bool_if_set(this->GenerateForStaticLibs, "GRAPHVIZ_STATIC_LIBS"); diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 24e3dc8..b645ef1 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -1021,7 +1021,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) std::string config; if (args.size() > 3) { config = args[3]; - }; + } return autoGen.Run(infoFile, config) ? 0 : 1; } #endif @@ -1485,7 +1485,7 @@ int cmcmd::ExecuteLinkScript(std::vector& args) break; default: break; - }; + } } // Free the process instance. diff --git a/Tests/CMakeLib/testString.cxx b/Tests/CMakeLib/testString.cxx index 2aa1459..af5e41e 100644 --- a/Tests/CMakeLib/testString.cxx +++ b/Tests/CMakeLib/testString.cxx @@ -16,10 +16,12 @@ #include #define ASSERT_TRUE(x) \ - if (!(x)) { \ - std::cout << "ASSERT_TRUE(" #x ") failed on line " << __LINE__ << "\n"; \ - return false; \ - } + do { \ + if (!(x)) { \ + std::cout << "ASSERT_TRUE(" #x ") failed on line " << __LINE__ << "\n"; \ + return false; \ + } \ + } while (false) static bool testConstructDefault() { @@ -144,7 +146,6 @@ static bool testConstructFromCStr() { std::cout << "testConstructFromCStr()\n"; return testFromCStr(cstr); - ; } static bool testAssignFromCStr() @@ -153,7 +154,6 @@ static bool testAssignFromCStr() cm::String str; str = cstr; return testFromCStr(str); - ; } static const std::string stdstr = "abc"; diff --git a/Tests/CMakeLib/testSystemTools.cxx b/Tests/CMakeLib/testSystemTools.cxx index 623ad28..96a4819 100644 --- a/Tests/CMakeLib/testSystemTools.cxx +++ b/Tests/CMakeLib/testSystemTools.cxx @@ -16,11 +16,13 @@ failed = 1 #define cmAssert(exp, m) \ - if ((exp)) { \ - cmPassed(m); \ - } else { \ - cmFailed(m); \ - } + do { \ + if ((exp)) { \ + cmPassed(m); \ + } else { \ + cmFailed(m); \ + } \ + } while (false) int testSystemTools(int /*unused*/, char* /*unused*/ []) { https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b90e6134a7af7d6f81a410fac52f17c7585509eb commit b90e6134a7af7d6f81a410fac52f17c7585509eb Author: Saleem Abdulrasool AuthorDate: Fri Jan 11 16:36:49 2019 -0800 Commit: Saleem Abdulrasool CommitDate: Tue Jan 15 09:13:33 2019 -0800 Ninja: add new placeholder `SWIFT_AUXILIARY_SOURCES` The swift compilation model requires all sources for the module to be listed for the compiler to type check across them. Provide a placeholder to allow enumerating the remainder of the swift sources in a target for the language compile rule. Issue: #18800 diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 1ef12d0..5013be5 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -19,6 +19,7 @@ #include "cmGeneratorExpression.h" #include "cmGeneratorTarget.h" #include "cmGlobalNinjaGenerator.h" +#include "cmListFileCache.h" // for BT #include "cmLocalGenerator.h" #include "cmLocalNinjaGenerator.h" #include "cmMakefile.h" @@ -430,6 +431,9 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang) vars.TargetCompilePDB = "$TARGET_COMPILE_PDB"; vars.ObjectDir = "$OBJECT_DIR"; vars.ObjectFileDir = "$OBJECT_FILE_DIR"; + if (lang == "Swift") { + vars.SwiftAuxiliarySources = "$SWIFT_AUXILIARY_SOURCES"; + } // For some cases we do an explicit preprocessor invocation. bool const explicitPP = this->NeedExplicitPreprocessing(lang); @@ -900,6 +904,20 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement( vars["FLAGS"] = this->ComputeFlagsForObject(source, language); vars["DEFINES"] = this->ComputeDefines(source, language); vars["INCLUDES"] = this->ComputeIncludes(source, language); + // The swift compiler needs all the sources besides the one being compiled in + // order to do the type checking. List all these "auxiliary" sources. + if (language == "Swift") { + std::string aux_sources; + cmGeneratorTarget::KindedSources const& sources = + this->GeneratorTarget->GetKindedSources(this->GetConfigName()); + for (cmGeneratorTarget::SourceAndKind const& src : sources.Sources) { + if (src.Source.Value == source) { + continue; + } + aux_sources += " " + this->GetSourceFilePath(src.Source.Value); + } + vars["SWIFT_AUXILIARY_SOURCES"] = aux_sources; + } if (!this->NeedDepTypeMSVC(language)) { bool replaceExt(false); diff --git a/Source/cmRulePlaceholderExpander.cxx b/Source/cmRulePlaceholderExpander.cxx index 0dfb797..4b74ff0 100644 --- a/Source/cmRulePlaceholderExpander.cxx +++ b/Source/cmRulePlaceholderExpander.cxx @@ -162,6 +162,11 @@ std::string cmRulePlaceholderExpander::ExpandRuleVariable( } } } + if (replaceValues.SwiftAuxiliarySources) { + if (variable == "SWIFT_AUXILIARY_SOURCES") { + return replaceValues.SwiftAuxiliarySources; + } + } if (variable == "TARGET_SONAME" || variable == "SONAME_FLAG" || variable == "TARGET_INSTALLNAME_DIR") { // All these variables depend on TargetSOName diff --git a/Source/cmRulePlaceholderExpander.h b/Source/cmRulePlaceholderExpander.h index a7d8cee..a936747 100644 --- a/Source/cmRulePlaceholderExpander.h +++ b/Source/cmRulePlaceholderExpander.h @@ -58,6 +58,7 @@ public: const char* Includes; const char* DependencyFile; const char* FilterPrefix; + const char* SwiftAuxiliarySources; }; // Expand rule variables in CMake of the type found in language rules https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5fe18eee1392c312612fad0e6f408ea7cb1ef29d commit 5fe18eee1392c312612fad0e6f408ea7cb1ef29d Author: Sebastian Holtermann AuthorDate: Mon Jan 14 18:32:17 2019 +0100 Commit: Sebastian Holtermann CommitDate: Tue Jan 15 10:15:03 2019 +0100 Autogen: Adaptive missing Qt warning This makes the warning message for a missing Qt use the requested Qt version in the message text. diff --git a/Source/cmQtAutoGenGlobalInitializer.cxx b/Source/cmQtAutoGenGlobalInitializer.cxx index a5a8423..0b1995d 100644 --- a/Source/cmQtAutoGenGlobalInitializer.cxx +++ b/Source/cmQtAutoGenGlobalInitializer.cxx @@ -85,8 +85,8 @@ cmQtAutoGenGlobalInitializer::cmQtAutoGenGlobalInitializer( // We support Qt4, Qt5 and Qt6 auto qtVersion = cmQtAutoGenInitializer::GetQtVersion(target); - bool const validQt = (qtVersion.Major == 4) || - (qtVersion.Major == 5) || (qtVersion.Major == 6); + bool const validQt = (qtVersion.first.Major == 4) || + (qtVersion.first.Major == 5) || (qtVersion.first.Major == 6); bool const mocAvailable = (validQt || !mocExec.empty()); bool const uicAvailable = (validQt || !uicExec.empty()); @@ -104,10 +104,16 @@ cmQtAutoGenGlobalInitializer::cmQtAutoGenGlobalInitializer( msg += ". "; msg += cmQtAutoGen::Tools(mocDisabled, uicDisabled, rccDisabled); msg += " disabled. Consider adding:\n"; - if (uicDisabled) { - msg += " find_package(Qt5 COMPONENTS Widgets)\n"; - } else { - msg += " find_package(Qt5 COMPONENTS Core)\n"; + { + std::string version = (qtVersion.second == 0) + ? std::string("") + : std::to_string(qtVersion.second); + std::string comp = uicDisabled ? "Widgets" : "Core"; + msg += " find_package(Qt"; + msg += version; + msg += " COMPONENTS "; + msg += comp; + msg += ")\n"; } msg += "to your CMakeLists.txt file."; target->Makefile->IssueMessage(cmake::AUTHOR_WARNING, msg); @@ -115,7 +121,7 @@ cmQtAutoGenGlobalInitializer::cmQtAutoGenGlobalInitializer( if (mocIsValid || uicIsValid || rccIsValid) { // Create autogen target initializer Initializers_.emplace_back(cm::make_unique( - this, target, qtVersion, mocIsValid, uicIsValid, rccIsValid, + this, target, qtVersion.first, mocIsValid, uicIsValid, rccIsValid, globalAutoGenTarget, globalAutoRccTarget)); } } diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index e4d2c82..7721e91 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -1409,32 +1409,31 @@ static std::vector GetKnownQtVersions( return result; } -cmQtAutoGenInitializer::IntegerVersion cmQtAutoGenInitializer::GetQtVersion( - cmGeneratorTarget const* target) +std::pair +cmQtAutoGenInitializer::GetQtVersion(cmGeneratorTarget const* target) { - auto knownQtVersions = GetKnownQtVersions(target); - if (knownQtVersions.empty()) { - return cmQtAutoGenInitializer::IntegerVersion(); // No Qt - } - - // Pick a version from the known versions: - auto targetVersion = CharPtrToInt( - target->GetLinkInterfaceDependentStringProperty("QT_MAJOR_VERSION", "")); + std::pair res( + IntegerVersion(), + CharPtrToInt(target->GetLinkInterfaceDependentStringProperty( + "QT_MAJOR_VERSION", ""))); - if (targetVersion == 0) { - // No specific version was requested by the target: - // Use highest known Qt version. - return knownQtVersions.at(0); - } - - for (auto it : knownQtVersions) { - if (it.Major == targetVersion) { - return it; + auto knownQtVersions = GetKnownQtVersions(target); + if (!knownQtVersions.empty()) { + if (res.second == 0) { + // No specific version was requested by the target: + // Use highest known Qt version. + res.first = knownQtVersions.at(0); + } else { + // Pick a version from the known versions: + for (auto it : knownQtVersions) { + if (it.Major == res.second) { + res.first = it; + break; + } + } } } - - // Requested version was not found - return cmQtAutoGenInitializer::IntegerVersion(); + return res; } std::pair GetQtExecutable( diff --git a/Source/cmQtAutoGenInitializer.h b/Source/cmQtAutoGenInitializer.h index 5cef1b3..47f157c 100644 --- a/Source/cmQtAutoGenInitializer.h +++ b/Source/cmQtAutoGenInitializer.h @@ -11,6 +11,7 @@ #include #include #include +#include #include class cmGeneratorTarget; @@ -76,7 +77,9 @@ public: }; public: - static IntegerVersion GetQtVersion(cmGeneratorTarget const* target); + /// @return The detected Qt version and the required Qt major version + static std::pair GetQtVersion( + cmGeneratorTarget const* target); cmQtAutoGenInitializer(cmQtAutoGenGlobalInitializer* globalInitializer, cmGeneratorTarget* target, diff --git a/Tests/RunCMake/Autogen/NoQt-stderr.txt b/Tests/RunCMake/Autogen/NoQt-stderr.txt index 66b6cae..1c6660a 100644 --- a/Tests/RunCMake/Autogen/NoQt-stderr.txt +++ b/Tests/RunCMake/Autogen/NoQt-stderr.txt @@ -2,7 +2,7 @@ AUTOGEN: No valid Qt version found for target main. AUTOMOC, AUTOUIC and AUTORCC disabled. Consider adding: - find_package\(Qt5 COMPONENTS Widgets\) + find_package\(Qt COMPONENTS Widgets\) to your CMakeLists.txt file. This warning is for project developers. Use -Wno-dev to suppress it. https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f2f166133402ad5f7998e0fef93b04f56c2f6d07 commit f2f166133402ad5f7998e0fef93b04f56c2f6d07 Author: Sebastian Holtermann AuthorDate: Mon Jan 14 17:33:03 2019 +0100 Commit: Sebastian Holtermann CommitDate: Tue Jan 15 09:52:35 2019 +0100 Autogen: Add and use QtAutoGen::Tools method diff --git a/Source/cmQtAutoGen.cxx b/Source/cmQtAutoGen.cxx index 000529d..9dc5fa8 100644 --- a/Source/cmQtAutoGen.cxx +++ b/Source/cmQtAutoGen.cxx @@ -99,6 +99,41 @@ std::string cmQtAutoGen::GeneratorNameUpper(GeneratorT genType) return cmSystemTools::UpperCase(cmQtAutoGen::GeneratorName(genType)); } +std::string cmQtAutoGen::Tools(bool moc, bool uic, bool rcc) +{ + std::string res; + std::vector lst; + if (moc) { + lst.emplace_back("AUTOMOC"); + } + if (uic) { + lst.emplace_back("AUTOUIC"); + } + if (rcc) { + lst.emplace_back("AUTORCC"); + } + switch (lst.size()) { + case 1: + res += lst.at(0); + break; + case 2: + res += lst.at(0); + res += " and "; + res += lst.at(1); + break; + case 3: + res += lst.at(0); + res += ", "; + res += lst.at(1); + res += " and "; + res += lst.at(2); + break; + default: + break; + } + return res; +} + std::string cmQtAutoGen::Quoted(std::string const& text) { static const char* rep[18] = { "\\", "\\\\", "\"", "\\\"", "\a", "\\a", diff --git a/Source/cmQtAutoGen.h b/Source/cmQtAutoGen.h index 4118dc7..96d1946 100644 --- a/Source/cmQtAutoGen.h +++ b/Source/cmQtAutoGen.h @@ -60,6 +60,9 @@ public: /// @brief Returns the generator name in upper case static std::string GeneratorNameUpper(GeneratorT genType); + /// @brief Returns a string with the requested tool names + static std::string Tools(bool moc, bool uic, bool rcc); + /// @brief Returns the string escaped and enclosed in quotes static std::string Quoted(std::string const& text); diff --git a/Source/cmQtAutoGenGlobalInitializer.cxx b/Source/cmQtAutoGenGlobalInitializer.cxx index d1cbd0d..a5a8423 100644 --- a/Source/cmQtAutoGenGlobalInitializer.cxx +++ b/Source/cmQtAutoGenGlobalInitializer.cxx @@ -102,19 +102,7 @@ cmQtAutoGenGlobalInitializer::cmQtAutoGenGlobalInitializer( std::string msg = "AUTOGEN: No valid Qt version found for target "; msg += target->GetName(); msg += ". "; - { - std::vector lst; - if (mocDisabled) { - lst.emplace_back("AUTOMOC"); - } - if (uicDisabled) { - lst.emplace_back("AUTOUIC"); - } - if (rccDisabled) { - lst.emplace_back("AUTORCC"); - } - msg += cmJoin(lst, ", "); - } + msg += cmQtAutoGen::Tools(mocDisabled, uicDisabled, rccDisabled); msg += " disabled. Consider adding:\n"; if (uicDisabled) { msg += " find_package(Qt5 COMPONENTS Widgets)\n"; diff --git a/Tests/RunCMake/Autogen/NoQt-stderr.txt b/Tests/RunCMake/Autogen/NoQt-stderr.txt index 6b4a933..66b6cae 100644 --- a/Tests/RunCMake/Autogen/NoQt-stderr.txt +++ b/Tests/RunCMake/Autogen/NoQt-stderr.txt @@ -1,5 +1,5 @@ ^CMake Warning \(dev\) in CMakeLists.txt: - AUTOGEN: No valid Qt version found for target main. AUTOMOC, AUTOUIC, + AUTOGEN: No valid Qt version found for target main. AUTOMOC, AUTOUIC and AUTORCC disabled. Consider adding: find_package\(Qt5 COMPONENTS Widgets\) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b2343ff08682e23f61be27c4faf02f8e2c37abcf commit b2343ff08682e23f61be27c4faf02f8e2c37abcf Author: Sebastian Holtermann AuthorDate: Mon Jan 14 17:04:44 2019 +0100 Commit: Sebastian Holtermann CommitDate: Mon Jan 14 17:04:44 2019 +0100 Autogen: Fix rcc validity check diff --git a/Source/cmQtAutoGenGlobalInitializer.cxx b/Source/cmQtAutoGenGlobalInitializer.cxx index f4cf3e0..d1cbd0d 100644 --- a/Source/cmQtAutoGenGlobalInitializer.cxx +++ b/Source/cmQtAutoGenGlobalInitializer.cxx @@ -93,7 +93,7 @@ cmQtAutoGenGlobalInitializer::cmQtAutoGenGlobalInitializer( bool const rccAvailable = (validQt || !rccExec.empty()); bool const mocIsValid = (moc && mocAvailable); bool const uicIsValid = (uic && uicAvailable); - bool const rccIsValid = (rcc && uicAvailable); + bool const rccIsValid = (rcc && rccAvailable); // Disabled AUTOMOC/UIC/RCC warning bool const mocDisabled = (moc && !mocAvailable); bool const uicDisabled = (uic && !uicAvailable); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c8ba777f6dfd7a5d8a4c4fa7b420bbdb5b93b366 commit c8ba777f6dfd7a5d8a4c4fa7b420bbdb5b93b366 Author: Stephan Szabo AuthorDate: Thu Jan 3 12:54:24 2019 -0800 Commit: Stephan Szabo CommitDate: Thu Jan 3 13:25:19 2019 -0800 GlobalVisualStudio10Generator: Support non-standard toolset json flag files. If given a toolset that does not have an explicit mapping in cmVisualStudio10ToolsetOptions, check for a json flag file using the toolset name before trying the default toolset for the generator. diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index c9c6938..f18798d 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -1123,14 +1123,32 @@ static cmIDEFlagTable const* cmLoadFlagTableJson( return ret; } +static std::string cmGetFlagTableName(std::string const& toolsetName, + std::string const& table) +{ + return cmSystemTools::GetCMakeRoot() + "/Templates/MSBuild/FlagTables/" + + toolsetName + "_" + table + ".json"; +} + cmIDEFlagTable const* cmGlobalVisualStudio10Generator::LoadFlagTable( - std::string const& flagTableName, std::string const& table) const + std::string const& optionsName, std::string const& toolsetName, + std::string const& defaultName, std::string const& table) const { cmIDEFlagTable const* ret = nullptr; - std::string filename = cmSystemTools::GetCMakeRoot() + - "/Templates/MSBuild/FlagTables/" + flagTableName + "_" + table + ".json"; - ret = cmLoadFlagTableJson(filename); + std::string filename; + if (!optionsName.empty()) { + filename = cmGetFlagTableName(optionsName, table); + ret = cmLoadFlagTableJson(filename); + } else { + filename = cmGetFlagTableName(toolsetName, table); + if (cmSystemTools::FileExists(filename)) { + ret = cmLoadFlagTableJson(filename); + } else { + filename = cmGetFlagTableName(defaultName, table); + ret = cmLoadFlagTableJson(filename); + } + } if (!ret) { cmMakefile* mf = this->GetCurrentMakefile(); @@ -1147,71 +1165,95 @@ cmIDEFlagTable const* cmGlobalVisualStudio10Generator::LoadFlagTable( cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetClFlagTable() const { - std::string flagTableName = this->ToolsetOptions.GetClFlagTableName( - this->GetPlatformName(), this->GetPlatformToolsetString(), - this->DefaultCLFlagTableName); - - return LoadFlagTable(flagTableName, "CL"); + std::string optionsName = this->ToolsetOptions.GetClFlagTableName( + this->GetPlatformName(), this->GetPlatformToolsetString()); + std::string toolsetName = this->ToolsetOptions.GetToolsetName( + this->GetPlatformName(), this->GetPlatformToolsetString()); + std::string defaultName = this->ToolsetOptions.GetToolsetName( + this->GetPlatformName(), this->DefaultCLFlagTableName); + return LoadFlagTable(optionsName, toolsetName, defaultName, "CL"); } cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetCSharpFlagTable() const { - std::string flagTableName = this->ToolsetOptions.GetCSharpFlagTableName( - this->GetPlatformName(), this->GetPlatformToolsetString(), - this->DefaultCSharpFlagTableName); - - return LoadFlagTable(flagTableName, "CSharp"); + std::string optionsName = this->ToolsetOptions.GetCSharpFlagTableName( + this->GetPlatformName(), this->GetPlatformToolsetString()); + std::string toolsetName = this->ToolsetOptions.GetToolsetName( + this->GetPlatformName(), this->GetPlatformToolsetString()); + std::string defaultName = this->ToolsetOptions.GetToolsetName( + this->GetPlatformName(), this->DefaultCSharpFlagTableName); + return LoadFlagTable(optionsName, toolsetName, defaultName, "CSharp"); } cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetRcFlagTable() const { - std::string flagTableName = this->ToolsetOptions.GetRcFlagTableName( - this->GetPlatformName(), this->GetPlatformToolsetString(), - this->DefaultRCFlagTableName); - - return LoadFlagTable(flagTableName, "RC"); + std::string optionsName = this->ToolsetOptions.GetRcFlagTableName( + this->GetPlatformName(), this->GetPlatformToolsetString()); + std::string toolsetName = this->ToolsetOptions.GetToolsetName( + this->GetPlatformName(), this->GetPlatformToolsetString()); + std::string defaultName = this->ToolsetOptions.GetToolsetName( + this->GetPlatformName(), this->DefaultRCFlagTableName); + return LoadFlagTable(optionsName, toolsetName, defaultName, "RC"); } cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetLibFlagTable() const { - std::string flagTableName = this->ToolsetOptions.GetLibFlagTableName( - this->GetPlatformName(), this->GetPlatformToolsetString(), - this->DefaultLibFlagTableName); - - return LoadFlagTable(flagTableName, "LIB"); + std::string optionsName = this->ToolsetOptions.GetLibFlagTableName( + this->GetPlatformName(), this->GetPlatformToolsetString()); + std::string toolsetName = this->ToolsetOptions.GetToolsetName( + this->GetPlatformName(), this->GetPlatformToolsetString()); + std::string defaultName = this->ToolsetOptions.GetToolsetName( + this->GetPlatformName(), this->DefaultLibFlagTableName); + return LoadFlagTable(optionsName, toolsetName, defaultName, "LIB"); } cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetLinkFlagTable() const { - std::string flagTableName = this->ToolsetOptions.GetLinkFlagTableName( - this->GetPlatformName(), this->GetPlatformToolsetString(), - this->DefaultLinkFlagTableName); - - return LoadFlagTable(flagTableName, "Link"); + std::string optionsName = this->ToolsetOptions.GetLinkFlagTableName( + this->GetPlatformName(), this->GetPlatformToolsetString()); + std::string toolsetName = this->ToolsetOptions.GetToolsetName( + this->GetPlatformName(), this->GetPlatformToolsetString()); + std::string defaultName = this->ToolsetOptions.GetToolsetName( + this->GetPlatformName(), this->DefaultLinkFlagTableName); + return LoadFlagTable(optionsName, toolsetName, defaultName, "Link"); } cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetCudaFlagTable() const { - return LoadFlagTable(this->DefaultCudaFlagTableName, "Cuda"); + std::string toolsetName = this->ToolsetOptions.GetToolsetName( + this->GetPlatformName(), this->GetPlatformToolsetString()); + std::string defaultName = this->ToolsetOptions.GetToolsetName( + this->GetPlatformName(), this->DefaultCudaFlagTableName); + return LoadFlagTable("", toolsetName, defaultName, "Cuda"); } cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetCudaHostFlagTable() const { - return LoadFlagTable(this->DefaultCudaHostFlagTableName, "CudaHost"); + std::string toolsetName = this->ToolsetOptions.GetToolsetName( + this->GetPlatformName(), this->GetPlatformToolsetString()); + std::string defaultName = this->ToolsetOptions.GetToolsetName( + this->GetPlatformName(), this->DefaultCudaHostFlagTableName); + return LoadFlagTable("", toolsetName, defaultName, "CudaHost"); } cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetMasmFlagTable() const { - std::string flagTableName = this->ToolsetOptions.GetMasmFlagTableName( - this->GetPlatformName(), this->GetPlatformToolsetString(), - this->DefaultMasmFlagTableName); - - return LoadFlagTable(flagTableName, "MASM"); + std::string optionsName = this->ToolsetOptions.GetMasmFlagTableName( + this->GetPlatformName(), this->GetPlatformToolsetString()); + std::string toolsetName = this->ToolsetOptions.GetToolsetName( + this->GetPlatformName(), this->GetPlatformToolsetString()); + std::string defaultName = this->ToolsetOptions.GetToolsetName( + this->GetPlatformName(), this->DefaultMasmFlagTableName); + return LoadFlagTable(optionsName, toolsetName, defaultName, "MASM"); } cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetNasmFlagTable() const { - return LoadFlagTable(this->DefaultNasmFlagTableName, "NASM"); + std::string toolsetName = this->ToolsetOptions.GetToolsetName( + this->GetPlatformName(), this->GetPlatformToolsetString()); + std::string defaultName = this->ToolsetOptions.GetToolsetName( + this->GetPlatformName(), this->DefaultNasmFlagTableName); + return LoadFlagTable("", toolsetName, defaultName, "NASM"); } diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 15244ac..ab55f06 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -144,7 +144,9 @@ protected: std::string const& GetMSBuildCommand(); - cmIDEFlagTable const* LoadFlagTable(std::string const& flagTableName, + cmIDEFlagTable const* LoadFlagTable(std::string const& optionsName, + std::string const& toolsetName, + std::string const& defaultName, std::string const& table) const; std::string GeneratorToolset; diff --git a/Source/cmVisualStudio10ToolsetOptions.cxx b/Source/cmVisualStudio10ToolsetOptions.cxx index f71b8b7..39063ed 100644 --- a/Source/cmVisualStudio10ToolsetOptions.cxx +++ b/Source/cmVisualStudio10ToolsetOptions.cxx @@ -7,8 +7,7 @@ #include "cmVisualStudioGeneratorOptions.h" std::string cmVisualStudio10ToolsetOptions::GetClFlagTableName( - std::string const& name, std::string const& toolset, - std::string const& defaultToolset) const + std::string const& name, std::string const& toolset) const { std::string const useToolset = this->GetToolsetName(name, toolset); @@ -23,13 +22,12 @@ std::string cmVisualStudio10ToolsetOptions::GetClFlagTableName( } else if (useToolset == "v100") { return "v10"; } else { - return this->GetToolsetName(name, defaultToolset); + return ""; } } std::string cmVisualStudio10ToolsetOptions::GetCSharpFlagTableName( - std::string const& name, std::string const& toolset, - std::string const& defaultToolset) const + std::string const& name, std::string const& toolset) const { std::string const useToolset = this->GetToolsetName(name, toolset); @@ -44,13 +42,12 @@ std::string cmVisualStudio10ToolsetOptions::GetCSharpFlagTableName( } else if (useToolset == "v100") { return "v10"; } else { - return this->GetToolsetName(name, defaultToolset); + return ""; } } std::string cmVisualStudio10ToolsetOptions::GetRcFlagTableName( - std::string const& name, std::string const& toolset, - std::string const& defaultToolset) const + std::string const& name, std::string const& toolset) const { std::string const useToolset = this->GetToolsetName(name, toolset); @@ -63,13 +60,12 @@ std::string cmVisualStudio10ToolsetOptions::GetRcFlagTableName( } else if (useToolset == "v100") { return "v10"; } else { - return this->GetToolsetName(name, defaultToolset); + return ""; } } std::string cmVisualStudio10ToolsetOptions::GetLibFlagTableName( - std::string const& name, std::string const& toolset, - std::string const& defaultToolset) const + std::string const& name, std::string const& toolset) const { std::string const useToolset = this->GetToolsetName(name, toolset); @@ -82,13 +78,12 @@ std::string cmVisualStudio10ToolsetOptions::GetLibFlagTableName( } else if (useToolset == "v100") { return "v10"; } else { - return this->GetToolsetName(name, defaultToolset); + return ""; } } std::string cmVisualStudio10ToolsetOptions::GetLinkFlagTableName( - std::string const& name, std::string const& toolset, - std::string const& defaultToolset) const + std::string const& name, std::string const& toolset) const { std::string const useToolset = this->GetToolsetName(name, toolset); @@ -103,13 +98,12 @@ std::string cmVisualStudio10ToolsetOptions::GetLinkFlagTableName( } else if (useToolset == "v100") { return "v10"; } else { - return this->GetToolsetName(name, defaultToolset); + return ""; } } std::string cmVisualStudio10ToolsetOptions::GetMasmFlagTableName( - std::string const& name, std::string const& toolset, - std::string const& defaultToolset) const + std::string const& name, std::string const& toolset) const { std::string const useToolset = this->GetToolsetName(name, toolset); @@ -122,7 +116,7 @@ std::string cmVisualStudio10ToolsetOptions::GetMasmFlagTableName( } else if (useToolset == "v100") { return "v10"; } else { - return this->GetToolsetName(name, defaultToolset); + return ""; } } diff --git a/Source/cmVisualStudio10ToolsetOptions.h b/Source/cmVisualStudio10ToolsetOptions.h index 43946f0..875a35b 100644 --- a/Source/cmVisualStudio10ToolsetOptions.h +++ b/Source/cmVisualStudio10ToolsetOptions.h @@ -16,25 +16,17 @@ class cmVisualStudio10ToolsetOptions { public: std::string GetClFlagTableName(std::string const& name, - std::string const& toolset, - std::string const& defaultToolset) const; + std::string const& toolset) const; std::string GetCSharpFlagTableName(std::string const& name, - std::string const& toolset, - std::string const& defaultToolset) const; + std::string const& toolset) const; std::string GetRcFlagTableName(std::string const& name, - std::string const& toolset, - std::string const& defaultToolset) const; + std::string const& toolset) const; std::string GetLibFlagTableName(std::string const& name, - std::string const& toolset, - std::string const& defaultToolset) const; + std::string const& toolset) const; std::string GetLinkFlagTableName(std::string const& name, - std::string const& toolset, - std::string const& defaultToolset) const; + std::string const& toolset) const; std::string GetMasmFlagTableName(std::string const& name, - std::string const& toolset, - std::string const& defaultToolset) const; - -private: + std::string const& toolset) const; std::string GetToolsetName(std::string const& name, std::string const& toolset) const; }; ----------------------------------------------------------------------- Summary of changes: CTestCustom.cmake.in | 1 + Source/CMakeLists.txt | 1 + Source/CPack/cmCPackArchiveGenerator.cxx | 16 ++- Source/CTest/cmCTestBuildCommand.cxx | 3 +- Source/CTest/cmCTestBuildHandler.cxx | 18 ++- Source/CTest/cmCTestCoverageHandler.cxx | 1 - Source/CTest/cmCTestHandlerCommand.cxx | 4 +- Source/CTest/cmCTestSubmitCommand.cxx | 6 +- Source/CTest/cmCTestUploadCommand.cxx | 4 +- Source/LexerParser/cmCommandArgumentLexer.cxx | 2 +- Source/LexerParser/cmCommandArgumentLexer.in.l | 2 +- Source/LexerParser/cmDependsJavaLexer.cxx | 2 +- Source/LexerParser/cmDependsJavaLexer.in.l | 2 +- Source/LexerParser/cmDependsJavaParser.cxx | 2 +- Source/LexerParser/cmDependsJavaParser.y | 2 +- Source/LexerParser/cmExprLexer.cxx | 2 +- Source/LexerParser/cmExprLexer.in.l | 2 +- Source/LexerParser/cmFortranLexer.cxx | 2 +- Source/LexerParser/cmFortranLexer.in.l | 2 +- Source/LexerParser/cmListFileLexer.c | 2 +- Source/LexerParser/cmListFileLexer.in.l | 2 +- Source/cmAddCustomCommandCommand.cxx | 8 +- Source/cmAddCustomTargetCommand.cxx | 8 +- Source/cmAddDependenciesCommand.cxx | 6 +- Source/cmAddLibraryCommand.cxx | 8 +- Source/cmArchiveWrite.cxx | 2 +- Source/cmBreakCommand.cxx | 14 +- Source/cmBuildCommand.cxx | 4 +- Source/cmCMakeMinimumRequired.cxx | 6 +- Source/cmCMakePolicyCommand.cxx | 4 +- Source/cmCPluginAPI.cxx | 4 +- Source/cmCTest.cxx | 8 +- Source/cmCacheManager.cxx | 3 +- Source/cmComputeLinkInformation.cxx | 11 +- Source/cmComputeTargetDepends.cxx | 7 +- Source/cmConditionEvaluator.cxx | 34 ++--- Source/cmConditionEvaluator.h | 17 ++- Source/cmConfigureFileCommand.cxx | 4 +- Source/cmContinueCommand.cxx | 6 +- Source/cmCoreTryCompile.cxx | 63 +++++---- Source/cmCurl.cxx | 12 +- Source/cmDisallowedCommand.cxx | 6 +- Source/cmDocumentation.cxx | 10 +- Source/cmExportBuildAndroidMKGenerator.cxx | 4 +- Source/cmExportBuildFileGenerator.cxx | 8 +- Source/cmExportCommand.cxx | 6 +- Source/cmExportFileGenerator.cxx | 19 +-- Source/cmExtraEclipseCDT4Generator.cxx | 6 +- Source/cmExtraSublimeTextGenerator.cxx | 3 +- Source/cmFileCommand.cxx | 51 +++---- Source/cmFindPackageCommand.cxx | 21 +-- Source/cmForEachCommand.cxx | 4 +- Source/cmGeneratorExpressionDAGChecker.cxx | 13 +- Source/cmGeneratorExpressionEvaluationFile.cxx | 10 +- Source/cmGeneratorExpressionNode.cxx | 11 +- Source/cmGeneratorTarget.cxx | 105 +++++++------- Source/cmGetDirectoryPropertyCommand.cxx | 4 +- Source/cmGetPropertyCommand.cxx | 3 +- Source/cmGetTargetPropertyCommand.cxx | 8 +- Source/cmGlobalBorlandMakefileGenerator.cxx | 1 + Source/cmGlobalGenerator.cxx | 45 +++--- Source/cmGlobalGhsMultiGenerator.cxx | 1 + Source/cmGlobalJOMMakefileGenerator.cxx | 1 + Source/cmGlobalMSYSMakefileGenerator.cxx | 1 + Source/cmGlobalMinGWMakefileGenerator.cxx | 1 + Source/cmGlobalNMakeMakefileGenerator.cxx | 1 + Source/cmGlobalNinjaGenerator.cxx | 14 +- Source/cmGlobalVisualStudio10Generator.cxx | 149 ++++++++++++-------- Source/cmGlobalVisualStudio10Generator.h | 4 +- Source/cmGlobalVisualStudio11Generator.cxx | 4 +- Source/cmGlobalVisualStudio12Generator.cxx | 4 +- Source/cmGlobalVisualStudio14Generator.cxx | 4 +- Source/cmGlobalVisualStudio71Generator.cxx | 2 +- Source/cmGlobalVisualStudio7Generator.cxx | 1 + Source/cmGlobalVisualStudio8Generator.cxx | 1 + Source/cmGlobalVisualStudio9Generator.cxx | 2 +- Source/cmGlobalVisualStudioGenerator.cxx | 3 +- Source/cmGlobalVisualStudioVersionedGenerator.cxx | 5 +- Source/cmGlobalXCodeGenerator.cxx | 7 +- Source/cmGraphVizWriter.cxx | 8 +- Source/cmIfCommand.cxx | 15 +- Source/cmIncludeCommand.cxx | 10 +- Source/cmIncludeExternalMSProjectCommand.cxx | 1 + Source/cmInstallCommand.cxx | 12 +- Source/cmInstallExportAndroidMKGenerator.cxx | 2 +- Source/cmInstallScriptGenerator.cxx | 4 +- Source/cmInstallTargetGenerator.cxx | 5 +- Source/cmLinkDirectoriesCommand.cxx | 6 +- Source/cmListCommand.cxx | 6 +- Source/cmListFileCache.cxx | 13 +- Source/cmLocalGenerator.cxx | 28 ++-- Source/cmLocalGenerator.h | 5 +- Source/cmLocalVisualStudio10Generator.cxx | 1 + Source/cmLocalVisualStudio7Generator.cxx | 1 + Source/cmMakefile.cxx | 159 +++++++++++----------- Source/cmMakefile.h | 24 ++-- Source/cmMathCommand.cxx | 4 +- Source/cmMessageCommand.cxx | 20 +-- Source/cmMessageType.h | 21 +++ Source/cmMessenger.cxx | 68 ++++----- Source/cmMessenger.h | 10 +- Source/cmNinjaTargetGenerator.cxx | 18 +++ Source/cmOptionCommand.cxx | 4 +- Source/cmOrderDirectories.cxx | 5 +- Source/cmParseArgumentsCommand.cxx | 19 +-- Source/cmPolicies.cxx | 16 +-- Source/cmProjectCommand.cxx | 29 ++-- Source/cmQtAutoGen.cxx | 35 +++++ Source/cmQtAutoGen.h | 3 + Source/cmQtAutoGenGlobalInitializer.cxx | 40 +++--- Source/cmQtAutoGenInitializer.cxx | 46 +++---- Source/cmQtAutoGenInitializer.h | 5 +- Source/cmRulePlaceholderExpander.cxx | 5 + Source/cmRulePlaceholderExpander.h | 1 + Source/cmSourceFile.cxx | 4 +- Source/cmSourceFileLocation.cxx | 3 +- Source/cmTarget.cxx | 47 +++---- Source/cmTargetCompileDefinitionsCommand.cxx | 4 +- Source/cmTargetCompileFeaturesCommand.cxx | 4 +- Source/cmTargetCompileOptionsCommand.cxx | 4 +- Source/cmTargetIncludeDirectoriesCommand.cxx | 4 +- Source/cmTargetLinkDirectoriesCommand.cxx | 4 +- Source/cmTargetLinkLibrariesCommand.cxx | 53 ++++---- Source/cmTargetLinkOptionsCommand.cxx | 4 +- Source/cmTargetPropertyComputer.cxx | 10 +- Source/cmTargetSourcesCommand.cxx | 8 +- Source/cmTryCompileCommand.cxx | 3 +- Source/cmTryRunCommand.cxx | 3 +- Source/cmVariableWatchCommand.cxx | 3 +- Source/cmVisualStudio10TargetGenerator.cxx | 6 +- Source/cmVisualStudio10ToolsetOptions.cxx | 30 ++-- Source/cmVisualStudio10ToolsetOptions.h | 20 +-- Source/cmWhileCommand.cxx | 6 +- Source/cmake.cxx | 4 +- Source/cmake.h | 20 +-- Source/cmcmd.cxx | 4 +- Tests/CMakeLib/testString.cxx | 12 +- Tests/CMakeLib/testSystemTools.cxx | 12 +- Tests/RunCMake/Autogen/NoQt-stderr.txt | 4 +- 139 files changed, 983 insertions(+), 792 deletions(-) create mode 100644 Source/cmMessageType.h hooks/post-receive -- CMake From kwrobot at kitware.com Wed Jan 16 10:03:05 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 16 Jan 2019 10:03:05 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-947-gc59eae7 Message-ID: <20190116150305.80A66125B94@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via c59eae7ebc5423c2b06befd762f8639b0f23b7a0 (commit) via 270965e0c7dadccc3564f7ab825cd4e618a15e42 (commit) via 7414d422b267718e737637fefa01b94502febb0e (commit) from bd54cc774a5b14720a9e741fc40192ea11106443 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c59eae7ebc5423c2b06befd762f8639b0f23b7a0 commit c59eae7ebc5423c2b06befd762f8639b0f23b7a0 Merge: bd54cc7 270965e Author: Brad King AuthorDate: Wed Jan 16 14:53:52 2019 +0000 Commit: Kitware Robot CommitDate: Wed Jan 16 09:53:58 2019 -0500 Merge topic 'iar-avr' 270965e0c7 IAR: Update compiler modules to support AVR systems 7414d422b2 IAR: Parse INFO strings from the binary format of AVR systems Acked-by: Kitware Robot Merge-request: !2792 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=270965e0c7dadccc3564f7ab825cd4e618a15e42 commit 270965e0c7dadccc3564f7ab825cd4e618a15e42 Author: Ethan Slattery AuthorDate: Thu Jan 10 17:26:37 2019 -0800 Commit: Brad King CommitDate: Tue Jan 15 13:59:01 2019 -0500 IAR: Update compiler modules to support AVR systems Fixes: #18557 diff --git a/Modules/Compiler/IAR-C.cmake b/Modules/Compiler/IAR-C.cmake index 2ed8818..b5e61f0 100644 --- a/Modules/Compiler/IAR-C.cmake +++ b/Modules/Compiler/IAR-C.cmake @@ -29,7 +29,19 @@ if("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM") __compiler_check_default_language_standard(C 1.10 90 6.10 99 8.10 11) elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR") + if(NOT CMAKE_C_COMPILER_VERSION) + message(FATAL_ERROR "CMAKE_C_COMPILER_VERSION not detected. This should be automatic.") + endif() + + set(CMAKE_C_EXTENSION_COMPILE_OPTION -e) + + set(CMAKE_C90_STANDARD_COMPILE_OPTION --c89) + set(CMAKE_C90_EXTENSION_COMPILE_OPTION -e) + set(CMAKE_C99_STANDARD_COMPILE_OPTION "") + set(CMAKE_C99_EXTENSION_COMPILE_OPTION -e) + __compiler_iar_AVR(C) + __compiler_check_default_language_standard(C 7.10 99) set(CMAKE_C_OUTPUT_EXTENSION ".r90") if(NOT CMAKE_C_LINK_FLAGS) @@ -43,6 +55,7 @@ elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR") get_filename_component(_compilerDir "${CMAKE_C_COMPILER}" PATH) get_filename_component(_compilerDir "${_compilerDir}" PATH) include_directories("${_compilerDir}/inc" ) + include_directories("${_compilerDir}/inc/Atmel" ) else() message(FATAL_ERROR "CMAKE_C_COMPILER_ARCHITECTURE_ID not detected as \"AVR\" or \"ARM\". This should be automatic.") diff --git a/Modules/Compiler/IAR-CXX.cmake b/Modules/Compiler/IAR-CXX.cmake index 5b783b2..b7076f5 100644 --- a/Modules/Compiler/IAR-CXX.cmake +++ b/Modules/Compiler/IAR-CXX.cmake @@ -38,7 +38,27 @@ if("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM") __compiler_check_default_language_standard(CXX 6.10 98 8.10 14) elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR") + # "embedded C++" --EC++ is probably closest to CXX98 but with no support for: + # Templates, multiple inheritance, virtual inheritance, exceptions, RTTI, C++ style casts, + # Namespaces, the mutable attribute, no STL, any library features related to the above features. + # + # "(extended) embedded C++" --EEC++ Mode but DOES NOT support any normal C++ standard + # probably closest to CXX98 but with no RTTI and no exceptions, and the library + # provided is not in the standard namespace + if(NOT CMAKE_IAR_CXX_FLAG) + if(NOT CMAKE_CXX_COMPILER_VERSION) + message(FATAL_ERROR "CMAKE_CXX_COMPILER_VERSION not detected. This should be automatic.") + endif() + set(CMAKE_IAR_CXX_FLAG --eec++) + endif() + + set(CMAKE_CXX_EXTENSION_COMPILE_OPTION -e) + set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "") + set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION -e) + __compiler_iar_AVR(CXX) + __compiler_check_default_language_standard(CXX 7.10 98) + set(CMAKE_CXX_OUTPUT_EXTENSION ".r90") if(NOT CMAKE_CXX_LINK_FLAGS) set(CMAKE_CXX_LINK_FLAGS "-Fmotorola") @@ -51,6 +71,7 @@ elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR") get_filename_component(_compilerDir "${CMAKE_C_COMPILER}" PATH) get_filename_component(_compilerDir "${_compilerDir}" PATH) include_directories("${_compilerDir}/inc") + include_directories("${_compilerDir}/inc/Atmel") else() message(FATAL_ERROR "CMAKE_CXX_COMPILER_ARCHITECTURE_ID not detected as \"AVR\" or \"ARM\". This should be automatic." ) diff --git a/Modules/Compiler/IAR-DetermineCompiler.cmake b/Modules/Compiler/IAR-DetermineCompiler.cmake index a1bffeb..43477ac 100644 --- a/Modules/Compiler/IAR-DetermineCompiler.cmake +++ b/Modules/Compiler/IAR-DetermineCompiler.cmake @@ -1,4 +1,4 @@ -# IAR Systems compiler for embedded systems. +# IAR Systems compiler for ARM embedded systems. # http://www.iar.com # http://supp.iar.com/FilesPublic/UPDINFO/004916/arm/doc/EWARM_DevelopmentGuide.ENU.pdf # @@ -9,13 +9,31 @@ # __ICCARM__ An integer that is set to 1 when the code is compiled with the IAR C/C++ Compiler for ARM # __VER__ An integer that identifies the version number of the IAR compiler in use. For example, # version 5.11.3 is returned as 5011003. +# +# IAR Systems Compiler for AVR embedded systems +# http://supp.iar.com/FilesPublic/UPDINFO/007051/ew/doc/EWAVR_CompilerReference.pdf +# +# __IAR_SYSTEMS_ICC__ An integer that identifies the IAR compiler platform. +# __ICCAVR__ An integer that is set to 1 when the code is compiled with the IAR C/C++ Compiler for AVR +# __VER__ An integer that identifies the version number of the IAR compiler in use. +# The value is calculated by (100 * VERSION_MAJOR + VERSION_MINOR). For example the version +# 3.34 is given as 334 +# __SUBVERSION__ An integer that identifies the subversion number of the compiler version number +# for example 3 in 1.2.3.4. THis is used as the patch version, as seen when running iccavr +# from the command line +# set(_compiler_id_pp_test "defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)") set(_compiler_id_version_compute " -# if defined(__VER__) +# if defined(__VER__) && defined(__ICCARM__) # define @PREFIX at COMPILER_VERSION_MAJOR @MACRO_DEC@((__VER__) / 1000000) # define @PREFIX at COMPILER_VERSION_MINOR @MACRO_DEC@(((__VER__) / 1000) % 1000) # define @PREFIX at COMPILER_VERSION_PATCH @MACRO_DEC@((__VER__) % 1000) # define @PREFIX at COMPILER_VERSION_INTERNAL @MACRO_DEC@(__IAR_SYSTEMS_ICC__) +# elif defined(__VER__) && defined(__ICCAVR__) +# define @PREFIX at COMPILER_VERSION_MAJOR @MACRO_DEC@((__VER__) / 100) +# define @PREFIX at COMPILER_VERSION_MINOR @MACRO_DEC@((__VER__) - (((__VER__) / 100)*100)) +# define @PREFIX at COMPILER_VERSION_PATCH @MACRO_DEC@(__SUBVERSION__) +# define @PREFIX at COMPILER_VERSION_INTERNAL @MACRO_DEC@(__IAR_SYSTEMS_ICC__) # endif") diff --git a/Modules/Compiler/IAR.cmake b/Modules/Compiler/IAR.cmake index 43243b9..bbcdea2 100644 --- a/Modules/Compiler/IAR.cmake +++ b/Modules/Compiler/IAR.cmake @@ -68,6 +68,27 @@ endmacro() macro(__compiler_iar_AVR lang) set(CMAKE_EXECUTABLE_SUFFIX ".bin") + if (${lang} STREQUAL "C" OR ${lang} STREQUAL "CXX") + + set(CMAKE_${lang}_COMPILE_OBJECT " ${CMAKE_IAR_${lang}_FLAG} --silent -o ") + set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE " ${CMAKE_IAR_${lang}_FLAG} --silent --preprocess=cnl ") + set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE " ${CMAKE_IAR_${lang}_FLAG} --silent -lAH -o .dummy") + + set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "-f ") + set(CMAKE_DEPFILE_FLAGS_${lang} "--dependencies=ns ") + + string(APPEND CMAKE_${lang}_FLAGS_INIT " ") + string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -r") + string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -Ohz -DNDEBUG") + string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -Oh -DNDEBUG") + string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -Oh -r -DNDEBUG") + endif() + + set(CMAKE_${lang}_LINK_EXECUTABLE "\"${CMAKE_IAR_LINKER}\" -S -o ") + set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "\"${CMAKE_IAR_AR}\" ") + set(CMAKE_${lang}_ARCHIVE_CREATE "\"${CMAKE_IAR_AR}\" ") + set(CMAKE_${lang}_ARCHIVE_APPEND "") + set(CMAKE_${lang}_ARCHIVE_FINISH "") set(CMAKE_LIBRARY_PATH_FLAG "-I") https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7414d422b267718e737637fefa01b94502febb0e commit 7414d422b267718e737637fefa01b94502febb0e Author: Ethan Slattery AuthorDate: Wed Nov 7 19:24:17 2018 -0500 Commit: Brad King CommitDate: Tue Jan 15 13:58:53 2019 -0500 IAR: Parse INFO strings from the binary format of AVR systems Teach `CMakeDetermineCompilerId` to recognize and parse the IAR-AVR binary format so we can recognize this compiler id. Issue: #18557 diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 050d3e7..f987d9a 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -523,7 +523,7 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) file(STRINGS ${file} CMAKE_${lang}_COMPILER_ID_STRINGS LIMIT_COUNT 38 ${CMAKE_${lang}_COMPILER_ID_STRINGS_PARAMETERS} - REGEX "INFO:[A-Za-z0-9_]+\\[[^]]*\\]") + REGEX ".?I.?N.?F.?O.?:.?[A-Za-z0-9_]+\\[[^]]*\\]") set(COMPILER_ID_TWICE) # With the IAR Compiler, some strings are found twice, first time as incomplete # list like "?". Remove the incomplete copies. @@ -531,6 +531,12 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) # In C# binaries, some strings are found more than once. list(REMOVE_DUPLICATES CMAKE_${lang}_COMPILER_ID_STRINGS) foreach(info ${CMAKE_${lang}_COMPILER_ID_STRINGS}) + # The IAR-AVR compiler uses a binary format that places a '6' + # character (0x34) before each character in the string. Strip + # out these characters without removing any legitamate characters. + if("${info}" MATCHES "(.)I.N.F.O.:.") + string(REGEX REPLACE "${CMAKE_MATCH_1}(.)" "\\1" info "${info}") + endif() if("${info}" MATCHES "INFO:compiler\\[([^]\"]*)\\]") if(COMPILER_ID) set(COMPILER_ID_TWICE 1) ----------------------------------------------------------------------- Summary of changes: Modules/CMakeDetermineCompilerId.cmake | 8 +++++++- Modules/Compiler/IAR-C.cmake | 13 +++++++++++++ Modules/Compiler/IAR-CXX.cmake | 21 +++++++++++++++++++++ Modules/Compiler/IAR-DetermineCompiler.cmake | 22 ++++++++++++++++++++-- Modules/Compiler/IAR.cmake | 21 +++++++++++++++++++++ 5 files changed, 82 insertions(+), 3 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Wed Jan 16 15:23:08 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 16 Jan 2019 15:23:08 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-949-g9e84e14 Message-ID: <20190116202308.54AD9111989@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 9e84e14db7e50925a3d7c3995737213d4d8b3921 (commit) via 74dc68b4063193850c2d081139ca72355a39f5c5 (commit) from c59eae7ebc5423c2b06befd762f8639b0f23b7a0 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9e84e14db7e50925a3d7c3995737213d4d8b3921 commit 9e84e14db7e50925a3d7c3995737213d4d8b3921 Merge: c59eae7 74dc68b Author: Craig Scott AuthorDate: Wed Jan 16 20:18:12 2019 +0000 Commit: Kitware Robot CommitDate: Wed Jan 16 15:20:59 2019 -0500 Merge topic 'qt_wrap_command_deprecations' 74dc68b406 qt_wrap_*: Add deprecation notes to command docs Acked-by: Kitware Robot Reviewed-by: Brad King Merge-request: !2738 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=74dc68b4063193850c2d081139ca72355a39f5c5 commit 74dc68b4063193850c2d081139ca72355a39f5c5 Author: Tobias Hunger AuthorDate: Thu Dec 13 16:21:43 2018 +0100 Commit: Craig Scott CommitDate: Wed Jan 16 08:08:38 2019 +1100 qt_wrap_*: Add deprecation notes to command docs Co-authored-by: Craig Scott diff --git a/Help/command/qt_wrap_cpp.rst b/Help/command/qt_wrap_cpp.rst index c04c7a6..ce11c2d 100644 --- a/Help/command/qt_wrap_cpp.rst +++ b/Help/command/qt_wrap_cpp.rst @@ -1,7 +1,16 @@ qt_wrap_cpp ----------- -Create Qt Wrappers. +.. deprecated:: 3.14 + + This command was originally added to support Qt 3 before the + :command:`add_custom_command()` command was sufficiently mature. The + :module:`FindQt4` module provides the ``qt4_wrap_cpp()`` macro, which + should be used instead for Qt 4 projects. For projects using Qt 5 or + later, use the equivalent macro provided by Qt itself (e.g. Qt 5 provides + ``qt5_wrap_cpp()``). + +Manually create Qt Wrappers. .. code-block:: cmake @@ -9,3 +18,6 @@ Create Qt Wrappers. Produces 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. + +Consider updating the project to use the :prop_tgt:`AUTOMOC` target property +instead for a more automated way of invoking the ``moc`` tool. diff --git a/Help/command/qt_wrap_ui.rst b/Help/command/qt_wrap_ui.rst index 9a8863d..efbbc54 100644 --- a/Help/command/qt_wrap_ui.rst +++ b/Help/command/qt_wrap_ui.rst @@ -1,7 +1,16 @@ qt_wrap_ui ---------- -Create Qt user interfaces Wrappers. +.. deprecated:: 3.14 + + This command was originally added to support Qt 3 before the + :command:`add_custom_command()` command was sufficiently mature. The + :module:`FindQt4` module provides the ``qt4_wrap_ui()`` macro, which + should be used instead for Qt 4 projects. For projects using Qt 5 or + later, use the equivalent macro provided by Qt itself (e.g. Qt 5 provides + ``qt5_wrap_ui()``). + +Manually create Qt user interfaces Wrappers. .. code-block:: cmake @@ -12,3 +21,6 @@ Produces .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. + +Consider updating the project to use the :prop_tgt:`AUTOUIC` target property +instead for a more automated way of invoking the ``uic`` tool. diff --git a/Help/manual/cmake-commands.7.rst b/Help/manual/cmake-commands.7.rst index aec9ba5..683a821 100644 --- a/Help/manual/cmake-commands.7.rst +++ b/Help/manual/cmake-commands.7.rst @@ -100,8 +100,6 @@ These commands are available only in CMake projects. /command/link_libraries /command/load_cache /command/project - /command/qt_wrap_cpp - /command/qt_wrap_ui /command/remove_definitions /command/set_source_files_properties /command/set_target_properties @@ -145,9 +143,10 @@ These commands are available only in CTest scripts. Deprecated Commands =================== -These commands are deprecated since CMake version 3.0. -They are available only for backward compatibility. -Do not use them in new code. +These commands are deprecated and are only made available to maintain +backward compatibility. The documentation of each command states the +CMake version in which it was deprecated. Do not use these commands +in new code. .. toctree:: :maxdepth: 1 @@ -161,6 +160,8 @@ Do not use them in new code. /command/load_command /command/make_directory /command/output_required_files + /command/qt_wrap_cpp + /command/qt_wrap_ui /command/remove /command/subdir_depends /command/subdirs ----------------------------------------------------------------------- Summary of changes: Help/command/qt_wrap_cpp.rst | 14 +++++++++++++- Help/command/qt_wrap_ui.rst | 14 +++++++++++++- Help/manual/cmake-commands.7.rst | 11 ++++++----- 3 files changed, 32 insertions(+), 7 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Jan 17 00:03:06 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 17 Jan 2019 00:03:06 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-950-gc144db1 Message-ID: <20190117050306.7D722127810@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via c144db1b8ca1ea2e3dad397123f110956a439030 (commit) from 9e84e14db7e50925a3d7c3995737213d4d8b3921 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c144db1b8ca1ea2e3dad397123f110956a439030 commit c144db1b8ca1ea2e3dad397123f110956a439030 Author: Kitware Robot AuthorDate: Thu Jan 17 00:01:06 2019 -0500 Commit: Kitware Robot CommitDate: Thu Jan 17 00:01:06 2019 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 1a300f2..dd9eccd 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 13) -set(CMake_VERSION_PATCH 20190116) +set(CMake_VERSION_PATCH 20190117) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Jan 17 11:13:07 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 17 Jan 2019 11:13:07 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-954-gbd3685b Message-ID: <20190117161307.116B311E603@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via bd3685b6cfac90bb553df0330e1732c066fe7dca (commit) via 9e3e93fc6f642e2cf0c1f11753ff8e2267d49ded (commit) via 22b43b0009f37c41b310dd26a4ecb00361975aaa (commit) via a541d113e606b05073810bb1b5dd5a7a8fd2eec8 (commit) from c144db1b8ca1ea2e3dad397123f110956a439030 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bd3685b6cfac90bb553df0330e1732c066fe7dca commit bd3685b6cfac90bb553df0330e1732c066fe7dca Merge: 9e3e93f 22b43b0 Author: Brad King AuthorDate: Thu Jan 17 16:07:05 2019 +0000 Commit: Kitware Robot CommitDate: Thu Jan 17 11:07:11 2019 -0500 Merge topic 'vs-debug-utility-targets' 22b43b0009 VS: Add support for VS_DEBUGGER_* properties on custom targets Acked-by: Kitware Robot Merge-request: !2794 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9e3e93fc6f642e2cf0c1f11753ff8e2267d49ded commit 9e3e93fc6f642e2cf0c1f11753ff8e2267d49ded Merge: c144db1 a541d11 Author: Brad King AuthorDate: Thu Jan 17 16:05:57 2019 +0000 Commit: Kitware Robot CommitDate: Thu Jan 17 11:06:04 2019 -0500 Merge topic 'fix_csharp_defines' a541d113e6 VS: Honor target_compile_definitions for C# projects Acked-by: Kitware Robot Merge-request: !2809 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=22b43b0009f37c41b310dd26a4ecb00361975aaa commit 22b43b0009f37c41b310dd26a4ecb00361975aaa Author: Nils Gladitz AuthorDate: Fri Jan 11 21:29:58 2019 +0100 Commit: Brad King CommitDate: Wed Jan 16 10:21:01 2019 -0500 VS: Add support for VS_DEBUGGER_* properties on custom targets Visual studio itself supports the corresponding `LocalDebugger*` properties on utility targets; support generating them from CMake as well. diff --git a/Help/release/dev/vs-debug-utility-targets.rst b/Help/release/dev/vs-debug-utility-targets.rst new file mode 100644 index 0000000..02e5262 --- /dev/null +++ b/Help/release/dev/vs-debug-utility-targets.rst @@ -0,0 +1,6 @@ +vs-debug-utility-targets +------------------------ + +* :ref:`Visual Studio Generators` for VS 2010 and above learned + to support the ``VS_DEBUGGER_*`` properties on targets created + via :command:`add_custom_target`. diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index dd90269..c685918 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2283,6 +2283,58 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions( e1.Element("_ProjectFileVersion", "10.0.20506.1"); for (std::string const& config : this->Configurations) { const std::string cond = this->CalcCondition(config); + + if (ttype <= cmStateEnums::UTILITY) { + if (const char* workingDir = this->GeneratorTarget->GetProperty( + "VS_DEBUGGER_WORKING_DIRECTORY")) { + cmGeneratorExpression ge; + std::unique_ptr cge = + ge.Parse(workingDir); + std::string genWorkingDir = + cge->Evaluate(this->LocalGenerator, config); + + e1.WritePlatformConfigTag("LocalDebuggerWorkingDirectory", cond, + genWorkingDir); + } + + if (const char* environment = + this->GeneratorTarget->GetProperty("VS_DEBUGGER_ENVIRONMENT")) { + cmGeneratorExpression ge; + std::unique_ptr cge = + ge.Parse(environment); + std::string genEnvironment = + cge->Evaluate(this->LocalGenerator, config); + + e1.WritePlatformConfigTag("LocalDebuggerEnvironment", cond, + genEnvironment); + } + + if (const char* debuggerCommand = + this->GeneratorTarget->GetProperty("VS_DEBUGGER_COMMAND")) { + + cmGeneratorExpression ge; + std::unique_ptr cge = + ge.Parse(debuggerCommand); + std::string genDebuggerCommand = + cge->Evaluate(this->LocalGenerator, config); + + e1.WritePlatformConfigTag("LocalDebuggerCommand", cond, + genDebuggerCommand); + } + + if (const char* commandArguments = this->GeneratorTarget->GetProperty( + "VS_DEBUGGER_COMMAND_ARGUMENTS")) { + cmGeneratorExpression ge; + std::unique_ptr cge = + ge.Parse(commandArguments); + std::string genCommandArguments = + cge->Evaluate(this->LocalGenerator, config); + + e1.WritePlatformConfigTag("LocalDebuggerCommandArguments", cond, + genCommandArguments); + } + } + if (ttype >= cmStateEnums::UTILITY) { e1.WritePlatformConfigTag( "IntDir", cond, "$(Platform)\\$(Configuration)\\$(ProjectName)\\"); @@ -2347,55 +2399,6 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions( e1.WritePlatformConfigTag("ExcludePath", cond, sdkExcludeDirectories); } - if (const char* workingDir = this->GeneratorTarget->GetProperty( - "VS_DEBUGGER_WORKING_DIRECTORY")) { - cmGeneratorExpression ge; - std::unique_ptr cge = - ge.Parse(workingDir); - std::string genWorkingDir = - cge->Evaluate(this->LocalGenerator, config); - - e1.WritePlatformConfigTag("LocalDebuggerWorkingDirectory", cond, - genWorkingDir); - } - - if (const char* environment = - this->GeneratorTarget->GetProperty("VS_DEBUGGER_ENVIRONMENT")) { - cmGeneratorExpression ge; - std::unique_ptr cge = - ge.Parse(environment); - std::string genEnvironment = - cge->Evaluate(this->LocalGenerator, config); - - e1.WritePlatformConfigTag("LocalDebuggerEnvironment", cond, - genEnvironment); - } - - if (const char* debuggerCommand = - this->GeneratorTarget->GetProperty("VS_DEBUGGER_COMMAND")) { - - cmGeneratorExpression ge; - std::unique_ptr cge = - ge.Parse(debuggerCommand); - std::string genDebuggerCommand = - cge->Evaluate(this->LocalGenerator, config); - - e1.WritePlatformConfigTag("LocalDebuggerCommand", cond, - genDebuggerCommand); - } - - if (const char* commandArguments = this->GeneratorTarget->GetProperty( - "VS_DEBUGGER_COMMAND_ARGUMENTS")) { - cmGeneratorExpression ge; - std::unique_ptr cge = - ge.Parse(commandArguments); - std::string genCommandArguments = - cge->Evaluate(this->LocalGenerator, config); - - e1.WritePlatformConfigTag("LocalDebuggerCommandArguments", cond, - genCommandArguments); - } - std::string name = cmSystemTools::GetFilenameWithoutLastExtension(targetNameFull); e1.WritePlatformConfigTag("TargetName", cond, name); diff --git a/Tests/RunCMake/VS10Project/VsDebuggerCommand-check.cmake b/Tests/RunCMake/VS10Project/VsDebuggerCommand-check.cmake index 440f9f2..00288d4 100644 --- a/Tests/RunCMake/VS10Project/VsDebuggerCommand-check.cmake +++ b/Tests/RunCMake/VS10Project/VsDebuggerCommand-check.cmake @@ -1,22 +1,24 @@ -set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj") -if(NOT EXISTS "${vcProjectFile}") - set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.") - return() -endif() +foreach(target foo bar) + set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/${target}.vcxproj") + if(NOT EXISTS "${vcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.") + return() + endif() -set(debuggerCommandSet FALSE) + set(debuggerCommandSet FALSE) -file(STRINGS "${vcProjectFile}" lines) -foreach(line IN LISTS lines) - if(line MATCHES "^ *]*>([^<>]+)$") - if("${CMAKE_MATCH_1}" STREQUAL "my-debugger-command foo") - message(STATUS "foo.vcxproj has debugger command set") - set(debuggerCommandSet TRUE) + file(STRINGS "${vcProjectFile}" lines) + foreach(line IN LISTS lines) + if(line MATCHES "^ *]*>([^<>]+)$") + if("${CMAKE_MATCH_1}" STREQUAL "my-debugger-command foo") + message(STATUS "${target}.vcxproj has debugger command set") + set(debuggerCommandSet TRUE) + endif() endif() + endforeach() + + if(NOT debuggerCommandSet) + set(RunCMake_TEST_FAILED "LocalDebuggerCommand not found or not set correctly.") + return() endif() endforeach() - -if(NOT debuggerCommandSet) - set(RunCMake_TEST_FAILED "LocalDebuggerCommand not found or not set correctly.") - return() -endif() diff --git a/Tests/RunCMake/VS10Project/VsDebuggerCommand.cmake b/Tests/RunCMake/VS10Project/VsDebuggerCommand.cmake index 5dcb6d1..54f9154 100644 --- a/Tests/RunCMake/VS10Project/VsDebuggerCommand.cmake +++ b/Tests/RunCMake/VS10Project/VsDebuggerCommand.cmake @@ -1,5 +1,6 @@ enable_language(CXX) add_library(foo foo.cpp) +add_custom_target(bar) -set_target_properties(foo PROPERTIES +set_target_properties(foo bar PROPERTIES VS_DEBUGGER_COMMAND "my-debugger-command $") diff --git a/Tests/RunCMake/VS10Project/VsDebuggerCommandArguments-check.cmake b/Tests/RunCMake/VS10Project/VsDebuggerCommandArguments-check.cmake index b2e0a43..87555d1 100644 --- a/Tests/RunCMake/VS10Project/VsDebuggerCommandArguments-check.cmake +++ b/Tests/RunCMake/VS10Project/VsDebuggerCommandArguments-check.cmake @@ -1,22 +1,24 @@ -set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj") -if(NOT EXISTS "${vcProjectFile}") - set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.") - return() -endif() +foreach(target foo bar) + set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/${target}.vcxproj") + if(NOT EXISTS "${vcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.") + return() + endif() -set(debuggerCommandArgumentsSet FALSE) + set(debuggerCommandArgumentsSet FALSE) -file(STRINGS "${vcProjectFile}" lines) -foreach(line IN LISTS lines) - if(line MATCHES "^ *]*>([^<>]+)$") - if("${CMAKE_MATCH_1}" STREQUAL "my-debugger-command-arguments foo") - message(STATUS "foo.vcxproj has debugger command arguments set") - set(debuggerCommandArgumentsSet TRUE) + file(STRINGS "${vcProjectFile}" lines) + foreach(line IN LISTS lines) + if(line MATCHES "^ *]*>([^<>]+)$") + if("${CMAKE_MATCH_1}" STREQUAL "my-debugger-command-arguments foo") + message(STATUS "${target}.vcxproj has debugger command arguments set") + set(debuggerCommandArgumentsSet TRUE) + endif() endif() + endforeach() + + if(NOT debuggerCommandArgumentsSet) + set(RunCMake_TEST_FAILED "LocalDebuggerCommandArguments not found or not set correctly.") + return() endif() endforeach() - -if(NOT debuggerCommandArgumentsSet) - set(RunCMake_TEST_FAILED "LocalDebuggerCommandArguments not found or not set correctly.") - return() -endif() diff --git a/Tests/RunCMake/VS10Project/VsDebuggerCommandArguments.cmake b/Tests/RunCMake/VS10Project/VsDebuggerCommandArguments.cmake index aa87cdc..1f7d0be 100644 --- a/Tests/RunCMake/VS10Project/VsDebuggerCommandArguments.cmake +++ b/Tests/RunCMake/VS10Project/VsDebuggerCommandArguments.cmake @@ -1,5 +1,6 @@ enable_language(CXX) add_library(foo foo.cpp) +add_custom_target(bar) -set_target_properties(foo PROPERTIES +set_target_properties(foo bar PROPERTIES VS_DEBUGGER_COMMAND_ARGUMENTS "my-debugger-command-arguments $") diff --git a/Tests/RunCMake/VS10Project/VsDebuggerEnvironment-check.cmake b/Tests/RunCMake/VS10Project/VsDebuggerEnvironment-check.cmake index 2427ad4..fee121a 100644 --- a/Tests/RunCMake/VS10Project/VsDebuggerEnvironment-check.cmake +++ b/Tests/RunCMake/VS10Project/VsDebuggerEnvironment-check.cmake @@ -1,22 +1,24 @@ -set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj") -if(NOT EXISTS "${vcProjectFile}") - set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.") - return() -endif() +foreach(target foo bar) + set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/${target}.vcxproj") + if(NOT EXISTS "${vcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.") + return() + endif() -set(debuggerEnvironmentSet FALSE) + set(debuggerEnvironmentSet FALSE) -file(STRINGS "${vcProjectFile}" lines) -foreach(line IN LISTS lines) - if(line MATCHES "^ *]*>([^<>]+)$") - if("${CMAKE_MATCH_1}" STREQUAL "my-debugger-environment foo") - message(STATUS "foo.vcxproj has debugger environment set") - set(debuggerEnvironmentSet TRUE) + file(STRINGS "${vcProjectFile}" lines) + foreach(line IN LISTS lines) + if(line MATCHES "^ *]*>([^<>]+)$") + if("${CMAKE_MATCH_1}" STREQUAL "my-debugger-environment foo") + message(STATUS "${target}.vcxproj has debugger environment set") + set(debuggerEnvironmentSet TRUE) + endif() endif() + endforeach() + + if(NOT debuggerEnvironmentSet) + set(RunCMake_TEST_FAILED "LocalDebuggerEnvironment not found or not set correctly.") + return() endif() endforeach() - -if(NOT debuggerEnvironmentSet) - set(RunCMake_TEST_FAILED "LocalDebuggerEnvironment not found or not set correctly.") - return() -endif() diff --git a/Tests/RunCMake/VS10Project/VsDebuggerEnvironment.cmake b/Tests/RunCMake/VS10Project/VsDebuggerEnvironment.cmake index d5bec4c..c594f35 100644 --- a/Tests/RunCMake/VS10Project/VsDebuggerEnvironment.cmake +++ b/Tests/RunCMake/VS10Project/VsDebuggerEnvironment.cmake @@ -1,5 +1,6 @@ enable_language(CXX) add_library(foo foo.cpp) +add_custom_target(bar) -set_target_properties(foo PROPERTIES +set_target_properties(foo bar PROPERTIES VS_DEBUGGER_ENVIRONMENT "my-debugger-environment $") diff --git a/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir-check.cmake b/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir-check.cmake index 6a142f8..9d3f2a8 100644 --- a/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir-check.cmake +++ b/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir-check.cmake @@ -1,22 +1,24 @@ -set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj") -if(NOT EXISTS "${vcProjectFile}") - set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.") - return() -endif() +foreach(target foo bar) + set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/${target}.vcxproj") + if(NOT EXISTS "${vcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.") + return() + endif() -set(debuggerWorkDirSet FALSE) + set(debuggerWorkDirSet FALSE) -file(STRINGS "${vcProjectFile}" lines) -foreach(line IN LISTS lines) - if(line MATCHES "^ *]*>([^<>]+)$") - if("${CMAKE_MATCH_1}" STREQUAL "my-debugger-directory foo") - message(STATUS "foo.vcxproj has debugger working dir set") - set(debuggerWorkDirSet TRUE) + file(STRINGS "${vcProjectFile}" lines) + foreach(line IN LISTS lines) + if(line MATCHES "^ *]*>([^<>]+)$") + if("${CMAKE_MATCH_1}" STREQUAL "my-debugger-directory foo") + message(STATUS "${target}.vcxproj has debugger working dir set") + set(debuggerWorkDirSet TRUE) + endif() endif() + endforeach() + + if(NOT debuggerWorkDirSet) + set(RunCMake_TEST_FAILED "LocalDebuggerWorkingDirectory not found or not set correctly.") + return() endif() endforeach() - -if(NOT debuggerWorkDirSet) - set(RunCMake_TEST_FAILED "LocalDebuggerWorkingDirectory not found or not set correctly.") - return() -endif() diff --git a/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir.cmake b/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir.cmake index 36daed0..69ed85c 100644 --- a/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir.cmake +++ b/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir.cmake @@ -1,5 +1,6 @@ enable_language(CXX) add_library(foo foo.cpp) +add_custom_target(bar) -set_target_properties(foo PROPERTIES +set_target_properties(foo bar PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "my-debugger-directory $") https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a541d113e606b05073810bb1b5dd5a7a8fd2eec8 commit a541d113e606b05073810bb1b5dd5a7a8fd2eec8 Author: Wil Stark AuthorDate: Mon Jan 14 13:52:25 2019 -0800 Commit: Wil Stark CommitDate: Tue Jan 15 21:29:59 2019 -0800 VS: Honor target_compile_definitions for C# projects Fixes: #18698 diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 655d6f0..35d48f6 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2620,6 +2620,10 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( } clOptions.AddDefines(targetDefines); + if (this->ProjectType == csproj) { + clOptions.AppendFlag("DefineConstants", targetDefines); + } + // Get includes for this target if (!this->LangForClCompile.empty()) { clOptions.AddIncludes( diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake index c796840..7c1ed4e 100644 --- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake +++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake @@ -14,5 +14,6 @@ run_cmake(VsCSharpCustomTags) run_cmake(VsCSharpReferenceProps) run_cmake(VsCSharpWithoutSources) run_cmake(VsCSharpDeployFiles) +run_cmake(VSCSharpDefines) run_cmake(VsSdkDirectories) run_cmake(VsGlobals) diff --git a/Tests/RunCMake/VS10Project/VsCSharpDefines-check.cmake b/Tests/RunCMake/VS10Project/VsCSharpDefines-check.cmake new file mode 100644 index 0000000..152bf9c --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsCSharpDefines-check.cmake @@ -0,0 +1,64 @@ +# +# Check C# VS project for required elements. +# +set(csProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.csproj") +if(NOT EXISTS "${csProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${csProjectFile} does not exist.") + return() +endif() + + +set(inDebug FALSE) +set(inRelease FALSE) +set(debugOK FALSE) +set(releaseOK FALSE) + + +file(STRINGS "${csProjectFile}" lines) +foreach(line IN LISTS lines) + #message(STATUS ${line}) + if(line MATCHES "^ * *$") + set(inRelease FALSE) + set(inDebug FALSE) + elseif(inDebug AND + (line MATCHES "^ *.*MY_FOO_DEFINE.* *$") AND + (line MATCHES "^ *.*DEFINE_ONLY_FOR_DEBUG.* *$") AND + (line MATCHES "^ *.*MY_BAR_ASSIGNMENT=bar.* *$") AND + (NOT (line MATCHES "^ *.*DEFINE_ONLY_FOR_RELEASE.* *$")) + ) + set(debugOK TRUE) + elseif(inRelease AND + (line MATCHES "^ *.*MY_FOO_DEFINE.* *$") AND + (line MATCHES "^ *.*DEFINE_ONLY_FOR_RELEASE.* *$") AND + (line MATCHES "^ *.*MY_BAR_ASSIGNMENT=bar.* *$") AND + (NOT (line MATCHES "^ *.*DEFINE_ONLY_FOR_DEBUG.* *$")) + ) + set(releaseOK TRUE) + endif() +endforeach() + +function(print_csprojfile) + file(STRINGS "${csProjectFile}" lines) + foreach(line IN LISTS lines) + message(STATUS ${line}) + endforeach() +endfunction() + + +if(NOT debugOK) + message(STATUS "Failed to set Debug configuration defines correctly.") + set(RunCMake_TEST_FAILED "Failed to set Debug configuration defines correctly.") + print_csprojfile() + return() +endif() + +if(NOT releaseOK) + message(STATUS "Failed to set Release configuration defines correctly.") + set(RunCMake_TEST_FAILED "Failed to set Release configuration defines correctly.") + print_csprojfile() + return() +endif() diff --git a/Tests/RunCMake/VS10Project/VsCSharpDefines.cmake b/Tests/RunCMake/VS10Project/VsCSharpDefines.cmake new file mode 100644 index 0000000..62c19c5 --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsCSharpDefines.cmake @@ -0,0 +1,18 @@ +enable_language(CSharp) + +add_library(foo SHARED + foo.cs) + +set_target_properties(foo PROPERTIES + LINKER_LANGUAGE CSharp) + + +# Issue 18698 +target_compile_definitions( + foo + PUBLIC + MY_FOO_DEFINE + "MY_BAR_ASSIGNMENT=bar" + $<$:DEFINE_ONLY_FOR_DEBUG> + $<$:DEFINE_ONLY_FOR_RELEASE> +) ----------------------------------------------------------------------- Summary of changes: Help/release/dev/vs-debug-utility-targets.rst | 6 ++ Source/cmVisualStudio10TargetGenerator.cxx | 105 +++++++++++---------- Tests/RunCMake/VS10Project/RunCMakeTest.cmake | 1 + .../VS10Project/VsCSharpDefines-check.cmake | 64 +++++++++++++ Tests/RunCMake/VS10Project/VsCSharpDefines.cmake | 18 ++++ .../VS10Project/VsDebuggerCommand-check.cmake | 36 +++---- Tests/RunCMake/VS10Project/VsDebuggerCommand.cmake | 3 +- .../VsDebuggerCommandArguments-check.cmake | 36 +++---- .../VS10Project/VsDebuggerCommandArguments.cmake | 3 +- .../VS10Project/VsDebuggerEnvironment-check.cmake | 36 +++---- .../VS10Project/VsDebuggerEnvironment.cmake | 3 +- .../VS10Project/VsDebuggerWorkingDir-check.cmake | 36 +++---- .../VS10Project/VsDebuggerWorkingDir.cmake | 3 +- 13 files changed, 229 insertions(+), 121 deletions(-) create mode 100644 Help/release/dev/vs-debug-utility-targets.rst create mode 100644 Tests/RunCMake/VS10Project/VsCSharpDefines-check.cmake create mode 100644 Tests/RunCMake/VS10Project/VsCSharpDefines.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Thu Jan 17 11:53:04 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 17 Jan 2019 11:53:04 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-956-g68e20f6 Message-ID: <20190117165304.0830B1135D2@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 68e20f674a48be38d60e129f600faf7c483f2b97 (commit) via 4568d046c46a7357ab48ddfb1117bad39e65572c (commit) from bd3685b6cfac90bb553df0330e1732c066fe7dca (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=68e20f674a48be38d60e129f600faf7c483f2b97 commit 68e20f674a48be38d60e129f600faf7c483f2b97 Merge: bd3685b 4568d04 Author: Brad King AuthorDate: Thu Jan 17 16:43:02 2019 +0000 Commit: Kitware Robot CommitDate: Thu Jan 17 11:43:09 2019 -0500 Merge topic 'cmake_role-global-property' 4568d046c4 Properties: Add CMAKE_ROLE global property Acked-by: Kitware Robot Merge-request: !2805 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4568d046c46a7357ab48ddfb1117bad39e65572c commit 4568d046c46a7357ab48ddfb1117bad39e65572c Author: Kyle Edwards AuthorDate: Mon Jan 14 12:27:14 2019 -0500 Commit: Kyle Edwards CommitDate: Thu Jan 17 09:44:29 2019 -0500 Properties: Add CMAKE_ROLE global property This property allows scripts to determine whether they're in project mode, script mode, find-package mode, CTest, or CPack. diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index df8f12c..02aaf4a 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -23,6 +23,7 @@ Properties of Global Scope /prop_gbl/AUTORCC_SOURCE_GROUP /prop_gbl/CMAKE_C_KNOWN_FEATURES /prop_gbl/CMAKE_CXX_KNOWN_FEATURES + /prop_gbl/CMAKE_ROLE /prop_gbl/DEBUG_CONFIGURATIONS /prop_gbl/DISABLED_FEATURES /prop_gbl/ENABLED_FEATURES diff --git a/Help/prop_gbl/CMAKE_ROLE.rst b/Help/prop_gbl/CMAKE_ROLE.rst new file mode 100644 index 0000000..27512fa --- /dev/null +++ b/Help/prop_gbl/CMAKE_ROLE.rst @@ -0,0 +1,20 @@ +CMAKE_ROLE +---------- + +Tells what mode the current running script is in. Could be one of several +values: + +``PROJECT`` + Running in project mode (processing a ``CMakeLists.txt`` file). + +``SCRIPT`` + Running in ``-P`` script mode. + +``FIND_PACKAGE`` + Running in ``--find-package`` mode. + +``CTEST`` + Running in CTest script mode. + +``CPACK`` + Running in CPack. diff --git a/Help/release/dev/cmake_role-global-property.rst b/Help/release/dev/cmake_role-global-property.rst new file mode 100644 index 0000000..7b1fa0b --- /dev/null +++ b/Help/release/dev/cmake_role-global-property.rst @@ -0,0 +1,6 @@ +cmake_role-global-property +-------------------------- + +* A new global property, :prop_gbl:`CMAKE_ROLE`, was added to allow scripts to + determine whether they're running in project mode, script mode, find-package + mode, CTest, or CPack. diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index acd6650..b205105 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -18,6 +18,7 @@ #include "cmGeneratedFileStream.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" +#include "cmState.h" #include "cmStateSnapshot.h" #include "cmVersion.h" #include "cmWorkingDirectory.h" @@ -690,7 +691,7 @@ int cmCPackGenerator::InstallCMakeProject( "- Install component: " << component << std::endl); } - cmake cm(cmake::RoleScript); + cmake cm(cmake::RoleScript, cmState::CPack); cm.SetHomeDirectory(""); cm.SetHomeOutputDirectory(""); cm.GetCurrentSnapshot().SetDefaultDefinitions(); diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index 4e49727..db9a0e7 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -24,6 +24,7 @@ #include "cmDocumentationFormatter.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" +#include "cmState.h" #include "cmStateSnapshot.h" #include "cmSystemTools.h" #include "cmake.h" @@ -208,7 +209,7 @@ int main(int argc, char const* const* argv) cmCPack_Log(&log, cmCPackLog::LOG_VERBOSE, "Read CPack config file: " << cpackConfigFile << std::endl); - cmake cminst(cmake::RoleScript); + cmake cminst(cmake::RoleScript, cmState::CPack); cminst.SetHomeDirectory(""); cminst.SetHomeOutputDirectory(""); cminst.SetProgressCallback(cpackProgressCallback, nullptr); diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index 668a387..d49fba2 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -6,6 +6,7 @@ #include "cmCTestTestHandler.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" +#include "cmState.h" #include "cmSystemTools.h" #include "cmWorkingDirectory.h" #include "cmake.h" @@ -163,7 +164,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) return 1; } - cmake cm(cmake::RoleProject); + cmake cm(cmake::RoleProject, cmState::CTest); cm.SetHomeDirectory(""); cm.SetHomeOutputDirectory(""); std::string cmakeOutString; diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx index 6cd1c09..4facea2 100644 --- a/Source/CTest/cmCTestLaunch.cxx +++ b/Source/CTest/cmCTestLaunch.cxx @@ -15,6 +15,7 @@ #include "cmGlobalGenerator.h" #include "cmMakefile.h" #include "cmProcessOutput.h" +#include "cmState.h" #include "cmStateSnapshot.h" #include "cmSystemTools.h" #include "cmXMLWriter.h" @@ -610,7 +611,7 @@ int cmCTestLaunch::Main(int argc, const char* const argv[]) void cmCTestLaunch::LoadConfig() { - cmake cm(cmake::RoleScript); + cmake cm(cmake::RoleScript, cmState::CTest); cm.SetHomeDirectory(""); cm.SetHomeOutputDirectory(""); cm.GetCurrentSnapshot().SetDefaultDefinitions(); diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 30192c2..aa37ff9 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -280,7 +280,7 @@ void cmCTestScriptHandler::CreateCMake() delete this->GlobalGenerator; delete this->Makefile; } - this->CMake = new cmake(cmake::RoleScript); + this->CMake = new cmake(cmake::RoleScript, cmState::CTest); this->CMake->SetHomeDirectory(""); this->CMake->SetHomeOutputDirectory(""); this->CMake->GetCurrentSnapshot().SetDefaultDefinitions(); diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 9fd2299..acbe465 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -1676,7 +1676,7 @@ void cmCTestTestHandler::GetListOfTests() } cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Constructing a list of tests" << std::endl, this->Quiet); - cmake cm(cmake::RoleScript); + cmake cm(cmake::RoleScript, cmState::CTest); cm.SetHomeDirectory(""); cm.SetHomeOutputDirectory(""); cm.GetCurrentSnapshot().SetDefaultDefinitions(); diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx index a3e0717..6dc692e 100644 --- a/Source/CursesDialog/ccmake.cxx +++ b/Source/CursesDialog/ccmake.cxx @@ -6,6 +6,7 @@ #include "cmCursesStandardIncludes.h" #include "cmDocumentation.h" #include "cmDocumentationEntry.h" +#include "cmState.h" #include "cmSystemTools.h" #include "cmake.h" @@ -83,7 +84,7 @@ int main(int argc, char const* const* argv) cmDocumentation doc; doc.addCMakeStandardDocSections(); if (doc.CheckOptions(argc, argv)) { - cmake hcm(cmake::RoleInternal); + cmake hcm(cmake::RoleInternal, cmState::Unknown); hcm.SetHomeDirectory(""); hcm.SetHomeOutputDirectory(""); hcm.AddCMakePaths(); diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index 931797a..a75d913 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -41,7 +41,7 @@ cmCursesMainForm::cmCursesMainForm(std::vector const& args, "Welcome to ccmake, curses based user interface for CMake."); this->HelpMessage.push_back(""); this->HelpMessage.push_back(s_ConstHelpMessage); - this->CMakeInstance = new cmake(cmake::RoleProject); + this->CMakeInstance = new cmake(cmake::RoleProject, cmState::Project); this->CMakeInstance->SetCMakeEditCommand( cmSystemTools::GetCMakeCursesCommand()); diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx index 98cf8b0..b4307bb 100644 --- a/Source/QtDialog/CMakeSetup.cxx +++ b/Source/QtDialog/CMakeSetup.cxx @@ -64,7 +64,7 @@ int main(int argc, char** argv) doc.addCMakeStandardDocSections(); if (argc2 > 1 && doc.CheckOptions(argc2, argv2)) { // Construct and print requested documentation. - cmake hcm(cmake::RoleInternal); + cmake hcm(cmake::RoleInternal, cmState::Unknown); hcm.SetHomeDirectory(""); hcm.SetHomeOutputDirectory(""); hcm.AddCMakePaths(); diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index 0133b88..9a6784e 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -27,7 +27,7 @@ QCMake::QCMake(QObject* p) cmSystemTools::SetStdoutCallback(QCMake::stdoutCallback, this); cmSystemTools::SetStderrCallback(QCMake::stderrCallback, this); - this->CMakeInstance = new cmake(cmake::RoleProject); + this->CMakeInstance = new cmake(cmake::RoleProject, cmState::Project); this->CMakeInstance->SetCMakeEditCommand( cmSystemTools::GetCMakeGUICommand()); this->CMakeInstance->SetProgressCallback(QCMake::progressCallback, this); diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 65c0d91..1c0d9f6 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -429,7 +429,7 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command) } } - cmake cm(cmake::RoleScript); + cmake cm(cmake::RoleScript, cmState::CTest); cm.SetHomeDirectory(""); cm.SetHomeOutputDirectory(""); cm.GetCurrentSnapshot().SetDefaultDefinitions(); diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 57d341a..e7b0981 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -1939,7 +1939,7 @@ int cmcmd_cmake_ninja_dyndep(std::vector::const_iterator argBeg, } } - cmake cm(cmake::RoleInternal); + cmake cm(cmake::RoleInternal, cmState::Unknown); cm.SetHomeDirectory(dir_top_src); cm.SetHomeOutputDirectory(dir_top_bld); std::unique_ptr ggd( diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index 199c8e2..4b60279 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -13,6 +13,7 @@ #include "cmGlobalGenerator.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" +#include "cmState.h" #include "cmStateSnapshot.h" #include "cmSystemTools.h" #include "cmTarget.h" @@ -172,7 +173,7 @@ cmGraphVizWriter::cmGraphVizWriter(const cmGlobalGenerator* globalGenerator) void cmGraphVizWriter::ReadSettings(const char* settingsFileName, const char* fallbackSettingsFileName) { - cmake cm(cmake::RoleScript); + cmake cm(cmake::RoleScript, cmState::Unknown); cm.SetHomeDirectory(""); cm.SetHomeOutputDirectory(""); cm.GetCurrentSnapshot().SetDefaultDefinitions(); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 274c631..3ff576e 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3374,7 +3374,7 @@ int cmMakefile::TryCompile(const std::string& srcdir, // make sure the same generator is used // use this program as the cmake to be run, it should not // be run that way but the cmake object requires a vailid path - cmake cm(cmake::RoleProject); + cmake cm(cmake::RoleProject, cmState::Project); cm.SetIsInTryCompile(true); cmGlobalGenerator* gg = cm.CreateGlobalGenerator(this->GetGlobalGenerator()->GetName()); diff --git a/Source/cmQtAutoGenerator.cxx b/Source/cmQtAutoGenerator.cxx index f2f4cad..c5d5d7c 100644 --- a/Source/cmQtAutoGenerator.cxx +++ b/Source/cmQtAutoGenerator.cxx @@ -8,6 +8,7 @@ #include "cmAlgorithms.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" +#include "cmState.h" #include "cmStateDirectory.h" #include "cmStateSnapshot.h" #include "cmSystemTools.h" @@ -686,7 +687,7 @@ bool cmQtAutoGenerator::Run(std::string const& infoFile, bool success = false; { - cmake cm(cmake::RoleScript); + cmake cm(cmake::RoleScript, cmState::Unknown); cm.SetHomeOutputDirectory(InfoDir()); cm.SetHomeDirectory(InfoDir()); cm.GetCurrentSnapshot().SetDefaultDefinitions(); diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx index 6dbfd10..11a3f46 100644 --- a/Source/cmServerProtocol.cxx +++ b/Source/cmServerProtocol.cxx @@ -130,7 +130,8 @@ bool cmServerProtocol::Activate(cmServer* server, { assert(server); this->m_Server = server; - this->m_CMakeInstance = cm::make_unique(cmake::RoleProject); + this->m_CMakeInstance = + cm::make_unique(cmake::RoleProject, cmState::Project); const bool result = this->DoActivate(request, errorMessage); if (!result) { this->m_CMakeInstance = nullptr; diff --git a/Source/cmState.cxx b/Source/cmState.cxx index f664000..cf170b0 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -539,6 +539,9 @@ const char* cmState::GetGlobalProperty(const std::string& prop) std::string langs; langs = cmJoin(this->EnabledLanguages, ";"); this->SetGlobalProperty("ENABLED_LANGUAGES", langs.c_str()); + } else if (prop == "CMAKE_ROLE") { + std::string mode = this->GetModeString(); + this->SetGlobalProperty("CMAKE_ROLE", mode.c_str()); } #define STRING_LIST_ELEMENT(F) ";" #F if (prop == "CMAKE_C_KNOWN_FEATURES") { @@ -643,6 +646,40 @@ unsigned int cmState::GetCacheMinorVersion() const return this->CacheManager->GetCacheMinorVersion(); } +cmState::Mode cmState::GetMode() const +{ + return this->CurrentMode; +} + +std::string cmState::GetModeString() const +{ + return ModeToString(this->CurrentMode); +} + +void cmState::SetMode(cmState::Mode mode) +{ + this->CurrentMode = mode; +} + +std::string cmState::ModeToString(cmState::Mode mode) +{ + switch (mode) { + case Project: + return "PROJECT"; + case Script: + return "SCRIPT"; + case FindPackage: + return "FIND_PACKAGE"; + case CTest: + return "CTEST"; + case CPack: + return "CPACK"; + case Unknown: + return "UNKNOWN"; + } + return "UNKNOWN"; +} + std::string const& cmState::GetBinaryDirectory() const { return this->BinaryDirectory; diff --git a/Source/cmState.h b/Source/cmState.h index abe93ed..dfd6d2c 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -35,6 +35,16 @@ public: cmState(); ~cmState(); + enum Mode + { + Unknown, + Project, + Script, + FindPackage, + CTest, + CPack, + }; + static const char* GetTargetTypeName(cmStateEnums::TargetType targetType); cmStateSnapshot CreateBaseSnapshot(); @@ -166,6 +176,12 @@ public: unsigned int GetCacheMajorVersion() const; unsigned int GetCacheMinorVersion() const; + Mode GetMode() const; + std::string GetModeString() const; + void SetMode(Mode mode); + + static std::string ModeToString(Mode mode); + private: friend class cmake; void AddCacheEntry(const std::string& key, const char* value, @@ -210,6 +226,7 @@ private: bool MinGWMake = false; bool NMake = false; bool MSYSShell = false; + Mode CurrentMode = Unknown; }; #endif diff --git a/Source/cmake.cxx b/Source/cmake.cxx index c65bd2e..9fcfbde 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -126,7 +126,7 @@ void cmWarnUnusedCliWarning(const std::string& variable, int /*unused*/, cm->MarkCliAsUsed(variable); } -cmake::cmake(Role role) +cmake::cmake(Role role, cmState::Mode mode) { this->Trace = false; this->TraceExpand = false; @@ -140,6 +140,7 @@ cmake::cmake(Role role) this->FileComparison = new cmFileTimeComparison; this->State = new cmState; + this->State->SetMode(mode); this->CurrentSnapshot = this->State->CreateBaseSnapshot(); this->Messenger = new cmMessenger; @@ -2023,7 +2024,8 @@ int cmake::CheckBuildSystem() // Read the rerun check file and use it to decide whether to do the // global generate. - cmake cm(RoleScript); // Actually, all we need is the `set` command. + // Actually, all we need is the `set` command. + cmake cm(RoleScript, cmState::Unknown); cm.SetHomeDirectory(""); cm.SetHomeOutputDirectory(""); cm.GetCurrentSnapshot().SetDefaultDefinitions(); diff --git a/Source/cmake.h b/Source/cmake.h index 9891857..cd8c622 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -15,6 +15,7 @@ #include "cmInstalledFile.h" #include "cmListFileCache.h" #include "cmMessageType.h" +#include "cmState.h" #include "cmStateSnapshot.h" #include "cmStateTypes.h" @@ -29,7 +30,6 @@ class cmGlobalGenerator; class cmGlobalGeneratorFactory; class cmMakefile; class cmMessenger; -class cmState; class cmVariableWatch; struct cmDocumentationEntry; @@ -113,7 +113,7 @@ public: static const int DEFAULT_BUILD_PARALLEL_LEVEL = 0; /// Default constructor - cmake(Role role); + cmake(Role role, cmState::Mode mode); /// Destructor ~cmake(); diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index e52f2b3..84d1414 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -217,7 +217,7 @@ int do_cmake(int ac, char const* const* av) doc.addCMakeStandardDocSections(); if (doc.CheckOptions(ac, av)) { // Construct and print requested documentation. - cmake hcm(cmake::RoleInternal); + cmake hcm(cmake::RoleInternal, cmState::Unknown); hcm.SetHomeDirectory(""); hcm.SetHomeOutputDirectory(""); hcm.AddCMakePaths(); @@ -299,7 +299,7 @@ int do_cmake(int ac, char const* const* av) } } if (sysinfo) { - cmake cm(cmake::RoleProject); + cmake cm(cmake::RoleProject, cmState::Project); cm.SetHomeDirectory(""); cm.SetHomeOutputDirectory(""); int ret = cm.GetSystemInformation(args); @@ -307,7 +307,19 @@ int do_cmake(int ac, char const* const* av) } cmake::Role const role = workingMode == cmake::SCRIPT_MODE ? cmake::RoleScript : cmake::RoleProject; - cmake cm(role); + cmState::Mode mode = cmState::Unknown; + switch (workingMode) { + case cmake::NORMAL_MODE: + mode = cmState::Project; + break; + case cmake::SCRIPT_MODE: + mode = cmState::Script; + break; + case cmake::FIND_PACKAGE_MODE: + mode = cmState::FindPackage; + break; + } + cmake cm(role, mode); cm.SetHomeDirectory(""); cm.SetHomeOutputDirectory(""); cmSystemTools::SetMessageCallback(cmakemainMessageCallback, &cm); @@ -463,7 +475,7 @@ static int do_build(int ac, char const* const* av) return 1; } - cmake cm(cmake::RoleInternal); + cmake cm(cmake::RoleInternal, cmState::Unknown); cmSystemTools::SetMessageCallback(cmakemainMessageCallback, &cm); cm.SetProgressCallback(cmakemainProgressCallback, &cm); return cm.Build(jobs, dir, target, config, nativeOptions, clean); @@ -501,7 +513,7 @@ static int do_open(int ac, char const* const* av) return 1; } - cmake cm(cmake::RoleInternal); + cmake cm(cmake::RoleInternal, cmState::Unknown); cmSystemTools::SetMessageCallback(cmakemainMessageCallback, &cm); cm.SetProgressCallback(cmakemainProgressCallback, &cm); return cm.Open(dir, false) ? 0 : 1; diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index b645ef1..ee8df35 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -9,6 +9,7 @@ #include "cmMakefile.h" #include "cmQtAutoGeneratorMocUic.h" #include "cmQtAutoGeneratorRcc.h" +#include "cmState.h" #include "cmStateDirectory.h" #include "cmStateSnapshot.h" #include "cmSystemTools.h" @@ -721,7 +722,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) std::cerr << "-E capabilities accepts no additional arguments\n"; return 1; } - cmake cm(cmake::RoleInternal); + cmake cm(cmake::RoleInternal, cmState::Unknown); #if defined(CMAKE_BUILD_WITH_CMAKE) std::cout << cm.ReportCapabilities(true); #else @@ -898,7 +899,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) const bool verbose = isCMakeVerbose(); // Create a cmake object instance to process dependencies. - cmake cm(cmake::RoleScript); // All we need is the `set` command. + // All we need is the `set` command. + cmake cm(cmake::RoleScript, cmState::Unknown); std::string gen; std::string homeDir; std::string startDir; diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 358521b..c8653b4 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -155,6 +155,7 @@ add_RunCMake_test(BuildDepends) if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja") add_RunCMake_test(Byproducts) endif() +add_RunCMake_test(CMakeRoleGlobalProperty) if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja") add_RunCMake_test(CompilerChange) endif() diff --git a/Tests/RunCMake/CMakeRoleGlobalProperty/CMakeLists.txt b/Tests/RunCMake/CMakeRoleGlobalProperty/CMakeLists.txt new file mode 100644 index 0000000..44025d3 --- /dev/null +++ b/Tests/RunCMake/CMakeRoleGlobalProperty/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.12) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMakeRoleGlobalProperty/CMakeLists.txt.in b/Tests/RunCMake/CMakeRoleGlobalProperty/CMakeLists.txt.in new file mode 100644 index 0000000..913239c --- /dev/null +++ b/Tests/RunCMake/CMakeRoleGlobalProperty/CMakeLists.txt.in @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.1) +project(CTestStart at CASE_NAME@ NONE) +include(CTest) +add_test(NAME RunCMakeVersion COMMAND "${CMAKE_COMMAND}" --version) diff --git a/Tests/RunCMake/CMakeRoleGlobalProperty/FindDummyPackage.cmake b/Tests/RunCMake/CMakeRoleGlobalProperty/FindDummyPackage.cmake new file mode 100644 index 0000000..8299042 --- /dev/null +++ b/Tests/RunCMake/CMakeRoleGlobalProperty/FindDummyPackage.cmake @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.12) + +get_property(role GLOBAL PROPERTY CMAKE_ROLE) +if(NOT role STREQUAL "FIND_PACKAGE") + message(SEND_ERROR "CMAKE_ROLE property is \"${role}\", should be \"FIND_PACKAGE\"") +endif() + +set(DummyPackage_FOUND 1) diff --git a/Tests/RunCMake/CMakeRoleGlobalProperty/Project.cmake b/Tests/RunCMake/CMakeRoleGlobalProperty/Project.cmake new file mode 100644 index 0000000..c0b6a48 --- /dev/null +++ b/Tests/RunCMake/CMakeRoleGlobalProperty/Project.cmake @@ -0,0 +1,6 @@ +get_property(role GLOBAL PROPERTY CMAKE_ROLE) +if(NOT role STREQUAL "PROJECT") + message(SEND_ERROR "CMAKE_ROLE property is \"${role}\", should be \"PROJECT\"") +endif() + +add_subdirectory(sub) diff --git a/Tests/RunCMake/CMakeRoleGlobalProperty/RunCMakeTest.cmake b/Tests/RunCMake/CMakeRoleGlobalProperty/RunCMakeTest.cmake new file mode 100644 index 0000000..b840317 --- /dev/null +++ b/Tests/RunCMake/CMakeRoleGlobalProperty/RunCMakeTest.cmake @@ -0,0 +1,7 @@ +include(RunCMake) +include(RunCTest) + +run_cmake(Project) +run_cmake_command(Script "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_LIST_DIR}/Script.cmake") +run_cmake_command(FindPackage "${CMAKE_COMMAND}" --find-package -DNAME=DummyPackage -DCOMPILER_ID=GNU -DLANGUAGE=CXX -DMODE=EXIST "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}") +run_ctest(CTest) diff --git a/Tests/RunCMake/CMakeRoleGlobalProperty/Script.cmake b/Tests/RunCMake/CMakeRoleGlobalProperty/Script.cmake new file mode 100644 index 0000000..371edbc --- /dev/null +++ b/Tests/RunCMake/CMakeRoleGlobalProperty/Script.cmake @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.12) + +get_property(role GLOBAL PROPERTY CMAKE_ROLE) +if(NOT role STREQUAL "SCRIPT") + message(SEND_ERROR "CMAKE_ROLE property is \"${role}\", should be \"SCRIPT\"") +endif() diff --git a/Tests/RunCMake/CMakeRoleGlobalProperty/sub/CMakeLists.txt b/Tests/RunCMake/CMakeRoleGlobalProperty/sub/CMakeLists.txt new file mode 100644 index 0000000..8ecf671 --- /dev/null +++ b/Tests/RunCMake/CMakeRoleGlobalProperty/sub/CMakeLists.txt @@ -0,0 +1,4 @@ +get_property(role GLOBAL PROPERTY CMAKE_ROLE) +if(NOT role STREQUAL "PROJECT") + message(SEND_ERROR "CMAKE_ROLE property is \"${role}\", should be \"PROJECT\"") +endif() diff --git a/Tests/RunCMake/CMakeRoleGlobalProperty/test.cmake.in b/Tests/RunCMake/CMakeRoleGlobalProperty/test.cmake.in new file mode 100644 index 0000000..4e2c085 --- /dev/null +++ b/Tests/RunCMake/CMakeRoleGlobalProperty/test.cmake.in @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.12) +set(CTEST_RUN_CURRENT_SCRIPT 0) + +get_property(role GLOBAL PROPERTY CMAKE_ROLE) +if(NOT role STREQUAL "CTEST") + message(SEND_ERROR "CMAKE_ROLE property is \"${role}\", should be \"CTEST\"") +endif() diff --git a/Tests/RunCMake/CPack/tests/EXTERNAL/create_package.cmake b/Tests/RunCMake/CPack/tests/EXTERNAL/create_package.cmake index 2d7f993..6f7c4c2 100644 --- a/Tests/RunCMake/CPack/tests/EXTERNAL/create_package.cmake +++ b/Tests/RunCMake/CPack/tests/EXTERNAL/create_package.cmake @@ -1,5 +1,10 @@ message("This script could run an external packaging tool") +get_property(role GLOBAL PROPERTY CMAKE_ROLE) +if(NOT role STREQUAL "CPACK") + message(SEND_ERROR "CMAKE_ROLE property is \"${role}\", should be \"CPACK\"") +endif() + function(expect_variable VAR) if(NOT ${VAR}) message(FATAL_ERROR "${VAR} is unexpectedly not set") ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-properties.7.rst | 1 + Help/prop_gbl/CMAKE_ROLE.rst | 20 ++++++++++++ Help/release/dev/cmake_role-global-property.rst | 6 ++++ Source/CPack/cmCPackGenerator.cxx | 3 +- Source/CPack/cpack.cxx | 3 +- Source/CTest/cmCTestBuildAndTestHandler.cxx | 3 +- Source/CTest/cmCTestLaunch.cxx | 3 +- Source/CTest/cmCTestScriptHandler.cxx | 2 +- Source/CTest/cmCTestTestHandler.cxx | 2 +- Source/CursesDialog/ccmake.cxx | 3 +- Source/CursesDialog/cmCursesMainForm.cxx | 2 +- Source/QtDialog/CMakeSetup.cxx | 2 +- Source/QtDialog/QCMake.cxx | 2 +- Source/cmCTest.cxx | 2 +- Source/cmGlobalNinjaGenerator.cxx | 2 +- Source/cmGraphVizWriter.cxx | 3 +- Source/cmMakefile.cxx | 2 +- Source/cmQtAutoGenerator.cxx | 3 +- Source/cmServerProtocol.cxx | 3 +- Source/cmState.cxx | 37 ++++++++++++++++++++++ Source/cmState.h | 17 ++++++++++ Source/cmake.cxx | 6 ++-- Source/cmake.h | 4 +-- Source/cmakemain.cxx | 22 ++++++++++--- Source/cmcmd.cxx | 6 ++-- Tests/RunCMake/CMakeLists.txt | 1 + .../CMakeLists.txt | 0 .../CMakeLists.txt.in | 0 .../CMakeRoleGlobalProperty/FindDummyPackage.cmake | 8 +++++ .../RunCMake/CMakeRoleGlobalProperty/Project.cmake | 6 ++++ .../CMakeRoleGlobalProperty/RunCMakeTest.cmake | 7 ++++ .../RunCMake/CMakeRoleGlobalProperty/Script.cmake | 6 ++++ .../CMakeRoleGlobalProperty/sub/CMakeLists.txt | 4 +++ .../RunCMake/CMakeRoleGlobalProperty/test.cmake.in | 7 ++++ .../CPack/tests/EXTERNAL/create_package.cmake | 5 +++ 35 files changed, 176 insertions(+), 27 deletions(-) create mode 100644 Help/prop_gbl/CMAKE_ROLE.rst create mode 100644 Help/release/dev/cmake_role-global-property.rst copy Tests/RunCMake/{WriteBasicConfigVersionFile => CMakeRoleGlobalProperty}/CMakeLists.txt (100%) copy Tests/RunCMake/{ctest_start => CMakeRoleGlobalProperty}/CMakeLists.txt.in (100%) create mode 100644 Tests/RunCMake/CMakeRoleGlobalProperty/FindDummyPackage.cmake create mode 100644 Tests/RunCMake/CMakeRoleGlobalProperty/Project.cmake create mode 100644 Tests/RunCMake/CMakeRoleGlobalProperty/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/CMakeRoleGlobalProperty/Script.cmake create mode 100644 Tests/RunCMake/CMakeRoleGlobalProperty/sub/CMakeLists.txt create mode 100644 Tests/RunCMake/CMakeRoleGlobalProperty/test.cmake.in hooks/post-receive -- CMake From kwrobot at kitware.com Fri Jan 18 00:03:07 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 18 Jan 2019 00:03:07 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-957-g92d1321 Message-ID: <20190118050307.28402127ABA@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 92d132100a0097c867eaa73f4bcca59670cca4f3 (commit) from 68e20f674a48be38d60e129f600faf7c483f2b97 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=92d132100a0097c867eaa73f4bcca59670cca4f3 commit 92d132100a0097c867eaa73f4bcca59670cca4f3 Author: Kitware Robot AuthorDate: Fri Jan 18 00:01:05 2019 -0500 Commit: Kitware Robot CommitDate: Fri Jan 18 00:01:05 2019 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index dd9eccd..245bd71 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 13) -set(CMake_VERSION_PATCH 20190117) +set(CMake_VERSION_PATCH 20190118) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Fri Jan 18 07:03:07 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 18 Jan 2019 07:03:07 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-981-ga61c061 Message-ID: <20190118120307.A985C127C08@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via a61c061b6143cb6d8920b1b5796a867c0f104556 (commit) via 65a3abf999b30117447c2e62581fbcaec56aadd9 (commit) via 2e7d4029f42430ac7339d15ae7b6f849b0f7e429 (commit) via 1c08652580ce3641f38f173074215bb12705ce63 (commit) via 00c7e006a5554911986ec4afe8b03e929d7b72e2 (commit) via 21ab58d3f8782e80145f14eb6e72926c9d17afc6 (commit) via 72e0c115b771fe9e3f4b5a5b6bd3bcdade77a7cb (commit) via 436cc5e991c7be07610d7902a5ce2a00221ca0a2 (commit) via 4a1ec0de3d2102918284eff13763f2aa3d20d119 (commit) via 1a66acdef268865e5816bd56176274034769b1b5 (commit) via 0c9e47d7cdb498f9bc29231587030e0840c9f00c (commit) via 80443184317e97999da63d71549aa1b89997dc3d (commit) via 73092b2213495e06ef2ecfbf5fcca850874d6c88 (commit) via 14f3ba205989a422f1668073a325b057cece0b32 (commit) via 702121c5f3eceeb6b74ede845f1e1297cf113c47 (commit) via b2a72ec72d609547d2278701a56237822c0dcc92 (commit) via 595932c4f0570ab6bdef0a50a321877ffa9c50e4 (commit) via 2ed2d6b46f9fb8f0742ce60bef16f1d636008136 (commit) via ead7117afda23d7cf0c1466ce5229d06240d3de0 (commit) via e7825386e2e9e69728e5a5c3dcbc94814bb7cb1c (commit) via 447b57a2676b5bb7e9f97b15c9fe5fe7d3817a86 (commit) via 6436080996ae6f2482fdeefcc639dc36fefedfd8 (commit) via 5cef3c61fc815393248762c14ba1878aae68394d (commit) via a42e40e78dc3d9c4289a3c9640cae94ecd034373 (commit) from 92d132100a0097c867eaa73f4bcca59670cca4f3 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a61c061b6143cb6d8920b1b5796a867c0f104556 commit a61c061b6143cb6d8920b1b5796a867c0f104556 Merge: 65a3abf 1c08652 Author: Brad King AuthorDate: Fri Jan 18 12:01:55 2019 +0000 Commit: Kitware Robot CommitDate: Fri Jan 18 07:02:01 2019 -0500 Merge topic 'automoc-test-in-place' 1c08652580 Tests: Fix Qt4And5Automoc tests to work on in-source build Acked-by: Kitware Robot Merge-request: !2817 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=65a3abf999b30117447c2e62581fbcaec56aadd9 commit 65a3abf999b30117447c2e62581fbcaec56aadd9 Merge: 2e7d402 21ab58d Author: Brad King AuthorDate: Fri Jan 18 11:58:23 2019 +0000 Commit: Kitware Robot CommitDate: Fri Jan 18 06:58:35 2019 -0500 Merge topic 'GHS_updates' 21ab58d3f8 GHS: Update test suite 72e0c115b7 GHS: Add Compiler ID detection 436cc5e991 GHS: try_compile() now uses GHS platform variables 4a1ec0de3d GHS: Fix toolset selection 1a66acdef2 GHS: Append ".gpj" to target name when generating build command 0c9e47d7cd GHS: Integrity Application updates 8044318431 GHS: Add support for some of the source file properties 73092b2213 GHS: Add support for object libraries ... Acked-by: Kitware Robot Merge-request: !2231 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2e7d4029f42430ac7339d15ae7b6f849b0f7e429 commit 2e7d4029f42430ac7339d15ae7b6f849b0f7e429 Merge: 92d1321 00c7e00 Author: Brad King AuthorDate: Fri Jan 18 11:55:46 2019 +0000 Commit: Kitware Robot CommitDate: Fri Jan 18 06:55:52 2019 -0500 Merge topic 'remove-duplicate-link' 00c7e006a5 Help: Remove duplicate reference to IMPORTED_LINK_DEPENDENT_LIBRARIES_ Acked-by: Kitware Robot Merge-request: !2818 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1c08652580ce3641f38f173074215bb12705ce63 commit 1c08652580ce3641f38f173074215bb12705ce63 Author: Brad King AuthorDate: Thu Jan 17 10:15:44 2019 -0500 Commit: Brad King CommitDate: Thu Jan 17 12:58:41 2019 -0500 Tests: Fix Qt4And5Automoc tests to work on in-source build Use a distinctly-named build directory for each case so that neither one uses its own source tree as the build tree. Fixes: #18159 diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 6b166d6..e9b497f 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1362,18 +1362,18 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4Targets") if(Qt5Widgets_FOUND AND NOT Qt5Widgets_VERSION VERSION_LESS 5.1.0) - add_test(Qt4And5Automoc ${CMAKE_CTEST_COMMAND} + add_test(Qt4And5AutomocForward ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/Qt4And5Automoc" - "${CMake_BINARY_DIR}/Tests/Qt4And5Automoc" + "${CMake_BINARY_DIR}/Tests/Qt4And5AutomocForward" ${build_generator_args} --build-project Qt4And5Automoc - --build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt4And5Automoc" + --build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt4And5AutomocForward" --force-new-ctest-process --build-options ${build_options} --test-command ${CMAKE_CTEST_COMMAND} -V ) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4And5Automoc") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4And5AutomocForward") add_test(Qt4And5AutomocReverse ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/Qt4And5Automoc" https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=00c7e006a5554911986ec4afe8b03e929d7b72e2 commit 00c7e006a5554911986ec4afe8b03e929d7b72e2 Author: Kyle Edwards AuthorDate: Thu Jan 17 10:21:25 2019 -0500 Commit: Kyle Edwards CommitDate: Thu Jan 17 10:21:25 2019 -0500 Help: Remove duplicate reference to IMPORTED_LINK_DEPENDENT_LIBRARIES_ diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index df8f12c..4a25878 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -204,7 +204,6 @@ Properties on Targets /prop_tgt/IMPORTED_LIBNAME_CONFIG /prop_tgt/IMPORTED_LIBNAME /prop_tgt/IMPORTED_LINK_DEPENDENT_LIBRARIES_CONFIG - /prop_tgt/IMPORTED_LINK_DEPENDENT_LIBRARIES_CONFIG /prop_tgt/IMPORTED_LINK_DEPENDENT_LIBRARIES /prop_tgt/IMPORTED_LINK_INTERFACE_LANGUAGES_CONFIG /prop_tgt/IMPORTED_LINK_INTERFACE_LANGUAGES https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=21ab58d3f8782e80145f14eb6e72926c9d17afc6 commit 21ab58d3f8782e80145f14eb6e72926c9d17afc6 Author: Fred Baksik AuthorDate: Tue Jan 8 23:52:12 2019 -0500 Commit: Fred Baksik CommitDate: Wed Jan 16 10:42:08 2019 -0500 GHS: Update test suite -- Allow for testing default toolset settings If CMake_TEST_GreenHillsMULTI_config is not defined then just run the GHS tests using defaults. -- Handle paths that contain spaces -- Update test suite to use "-non_shared" linker option Fixes linking issue if GHS is not shipped with shared libraries -- Other minor cleanup diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index 4588901..19605e4 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -532,6 +532,7 @@ void cmGhsMultiTargetGenerator::WriteObjectLangOverride( } } } + void cmGhsMultiTargetGenerator::WriteReferences(std::ostream& fout) { // This only applies to INTEGRITY Applications diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 87bd27e..d78811d 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -2260,11 +2260,18 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release endif() if (CMake_TEST_GreenHillsMULTI) - macro(add_test_GhsMulti test_name test_dir bin_sub_dir build_opts test_cmd) - separate_arguments(_build_opts UNIX_COMMAND ${build_opts}) - separate_arguments(_test_cmd UNIX_COMMAND ${test_cmd}) + macro(add_test_GhsMulti test_name test_dir bin_sub_dir build_opts) + separate_arguments(_ghs_build_opts UNIX_COMMAND ${build_opts}) separate_arguments(_ghs_toolset_extra UNIX_COMMAND ${ghs_toolset_extra}) - add_test(NAME GhsMulti.${ghs_config_name}.${test_name} + if(${ARGC} GREATER 4) + set(_ghs_test_command --test-command ${ARGN}) + endif() + if(ghs_config_name STREQUAL "__default__") + set(_ghs_test_name "${test_name}") + else() + set(_ghs_test_name "${ghs_config_name}.${test_name}") + endif() + add_test(NAME GhsMulti.${_ghs_test_name} COMMAND ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/GhsMulti/${test_dir}" @@ -2273,51 +2280,71 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release --build-project test --build-config $ --build-options ${ghs_target_arch} ${ghs_toolset_name} ${ghs_toolset_root} ${ghs_target_platform} - ${ghs_os_root} ${ghs_os_dir} ${ghs_bsp_name} ${_build_opts} ${_ghs_toolset_extra} - --test-command ${_test_cmd} + ${ghs_os_root} ${ghs_os_dir} ${ghs_bsp_name} ${_ghs_build_opts} ${_ghs_toolset_extra} + ${_ghs_test_command} ) - endmacro () + unset(_ghs_build_opts) + unset(_ghs_toolset_extra) + unset(_ghs_test_command) + unset(_ghs_test_name) + endmacro() macro(add_test_GhsMulti_rename_install test_name) add_test_GhsMulti( ${test_name} GhsMultiRenameInstall ${test_name} - "-DCMAKE_INSTALL_PREFIX=. -DRUN_TEST=${test_name}" "${CMAKE_CMAKE_COMMAND} -P ./cmake_install.cmake") - endmacro () + "-DCMAKE_INSTALL_PREFIX=. -DRUN_TEST=${test_name}" ${CMAKE_CMAKE_COMMAND} -P ./cmake_install.cmake) + endmacro() + #unset ghs config variables + unset(ghs_config_name) + unset(ghs_target_arch) + unset(ghs_toolset_root) + unset(ghs_toolset_name) + unset(ghs_os_root) + unset(ghs_os_dir) + unset(ghs_target_platform) + unset(ghs_bsp_name) + unset(ghs_toolset_extra) + if(NOT CMake_TEST_GreenHillsMULTI_config) + #if list of config settings not defined then just run once as default + set(CMake_TEST_GreenHillsMULTI_config "__default__") + endif() foreach(ghs_file IN LISTS CMake_TEST_GreenHillsMULTI_config) # source GHS tools config file - if(IS_ABSOLUTE ${ghs_file}) - include(${ghs_file}) - else() - include(${CMAKE_BINARY_DIR}/${ghs_file}) + if(NOT ghs_file STREQUAL "__default__") + if(IS_ABSOLUTE ${ghs_file}) + include(${ghs_file}) + else() + include(${CMAKE_BINARY_DIR}/${ghs_file}) + endif() + endif() + if(NOT ghs_config_name) + set(ghs_config_name "__default__") endif() # test integrity build if (NOT ghs_skip_integrity AND (NOT ghs_target_platform OR ghs_target_platform MATCHES "integrity")) - add_test_GhsMulti(integrityDDInt GhsMultiIntegrity/GhsMultiIntegrityDDInt "" "" "") - add_test_GhsMulti(integrityMonolith GhsMultiIntegrity/GhsMultiIntegrityMonolith "" "" "") - add_test_GhsMulti(integrityDD GhsMultiIntegrity/GhsMultiIntegrityDD "" "" "") - endif () - add_test_GhsMulti(duplicate_source_filenames GhsMultiDuplicateSourceFilenames "" "" "") + add_test_GhsMulti(integrityDDInt GhsMultiIntegrity/GhsMultiIntegrityDDInt "" "") + add_test_GhsMulti(integrityMonolith GhsMultiIntegrity/GhsMultiIntegrityMonolith "" "") + add_test_GhsMulti(integrityDD GhsMultiIntegrity/GhsMultiIntegrityDD "" "") + endif() + add_test_GhsMulti(duplicate_source_filenames GhsMultiDuplicateSourceFilenames "" "") add_test_GhsMulti_rename_install(SINGLE_EXEC) add_test_GhsMulti_rename_install(SINGLE_EXEC_RENAMED) add_test_GhsMulti_rename_install(EXEC_AND_LIB) - add_test_GhsMulti(multiple_source_groups GhsMultiSrcGroups Default "" "") - add_test_GhsMulti(multiple_source_groups_folders GhsMultiSrcGroups PropFolders "-DTEST_PROP=ON" "") - add_test_GhsMulti(multiple_source_groups_all_folders GhsMultiSrcGroups AllFolders "-DGHS_NO_SOURCE_GROUP_FILE=ON" "") - add_test_GhsMulti(unsupported_targets GhsMultiUnsupportedTargets "" "" "") - set_tests_properties(GhsMulti.${ghs_config_name}.unsupported_targets PROPERTIES TIMEOUT 15) - add_test_GhsMulti(object_library GhsMultiObjectLibrary "" "" "") - set_tests_properties(GhsMulti.${ghs_config_name}.object_library PROPERTIES TIMEOUT 15) + add_test_GhsMulti(multiple_source_groups GhsMultiSrcGroups Default "") + add_test_GhsMulti(multiple_source_groups_folders GhsMultiSrcGroups PropFolders "-DTEST_PROP=ON") + add_test_GhsMulti(multiple_source_groups_all_folders GhsMultiSrcGroups AllFolders "-DGHS_NO_SOURCE_GROUP_FILE=ON") + add_test_GhsMulti(unsupported_targets GhsMultiUnsupportedTargets "" "") + add_test_GhsMulti(object_library GhsMultiObjectLibrary "" "") add_test_GhsMulti(exclude GhsMultiExclude "" "" - "${CMAKE_CMAKE_COMMAND} -P ${CMake_SOURCE_DIR}/Tests/GhsMulti/GhsMultiExclude/verify.cmake") - add_test_GhsMulti(interface GhsMultiInterface "" "" "") - set_tests_properties(GhsMulti.${ghs_config_name}.interface PROPERTIES TIMEOUT 15) - add_test_GhsMulti(transitive_link_test GhsMultiLinkTest TransitiveLink "-DRUN_TEST=NO_FLAGS" "") - add_test_GhsMulti(flags_link_test GhsMultiLinkTest FlagsCheck "-DRUN_TEST=CHECK_FLAGS" "") - add_test_GhsMulti(sub_link_test GhsMultiLinkTestSub "" "" "") + ${CMAKE_CMAKE_COMMAND} -P ${CMake_SOURCE_DIR}/Tests/GhsMulti/GhsMultiExclude/verify.cmake) + add_test_GhsMulti(interface GhsMultiInterface "" "") + add_test_GhsMulti(transitive_link_test GhsMultiLinkTest TransitiveLink "-DRUN_TEST=NO_FLAGS") + add_test_GhsMulti(flags_link_test GhsMultiLinkTest FlagsCheck "-DRUN_TEST=CHECK_FLAGS") + add_test_GhsMulti(sub_link_test GhsMultiLinkTestSub "" "") add_test_GhsMulti(multiple_projects GhsMultiMultipleProjects "" "" - "${CMAKE_CMAKE_COMMAND} -P ${CMake_SOURCE_DIR}/Tests/GhsMulti/GhsMultiMultipleProjects/verify.cmake") - add_test_GhsMulti(compiler_options_none GhsMultiCompilerOptions None "-DRUN_TEST=RELEASE_FLAGS -DRUN_TEST_BUILD_TYPE=\"\"" "") - add_test_GhsMulti(compiler_options_kernel GhsMultiCompilerOptions Kernel "-DRUN_TEST=KERNEL_FLAGS -DRUN_TEST_BUILD_TYPE=DEBUG" "") - add_test_GhsMulti(try_compile_copy GhsMultiCopyFile "" "" "") - add_test_GhsMulti(ghs_platform GhsMultiPlatform "" "" "") + ${CMAKE_CMAKE_COMMAND} -P ${CMake_SOURCE_DIR}/Tests/GhsMulti/GhsMultiMultipleProjects/verify.cmake) + add_test_GhsMulti(compiler_options_none GhsMultiCompilerOptions None "-DRUN_TEST=RELEASE_FLAGS -DRUN_TEST_BUILD_TYPE=\"\"") + add_test_GhsMulti(compiler_options_kernel GhsMultiCompilerOptions Kernel "-DRUN_TEST=KERNEL_FLAGS -DRUN_TEST_BUILD_TYPE=DEBUG") + add_test_GhsMulti(try_compile_copy GhsMultiCopyFile "" "") + add_test_GhsMulti(ghs_platform GhsMultiPlatform "" "") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/GhsMulti/${ghs_config_name}") #unset ghs config variables unset(ghs_config_name) @@ -2329,8 +2356,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release unset(ghs_target_platform) unset(ghs_bsp_name) unset(ghs_toolset_extra) - endforeach(ghs_file) - endif () + endforeach() + endif() if(tegra AND NOT "${CMake_SOURCE_DIR};${CMake_BINARY_DIR}" MATCHES " ") macro(add_test_VSNsightTegra name generator) diff --git a/Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt.in b/Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt.in index d425631..fc24d90 100644 --- a/Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt.in +++ b/Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt.in @@ -5,24 +5,28 @@ cmake_minimum_required(VERSION 3.12 FATAL_ERROR) project(test C) +if(CMAKE_C_COMPILER_ID STREQUAL "GHS") + add_link_options("-non_shared") +endif() + if(RUN_TEST STREQUAL "RELEASE_FLAGS") -#RELEASE flags used when CMAKE_BUILD_TYPE is undefined -string(APPEND CMAKE_C_FLAGS_RELEASE " -unexpected_release_option") -add_executable(test_none test.c) + #RELEASE flags used when CMAKE_BUILD_TYPE is undefined + string(APPEND CMAKE_C_FLAGS_RELEASE " -unexpected_release_option") + add_executable(test_none test.c) endif() if(RUN_TEST STREQUAL "KERNEL_FLAGS") -#DEBUG flag missing when -kernel is added as a compile option -string(APPEND CMAKE_C_FLAGS_DEBUG " -required-debug-option") + #DEBUG flag missing when -kernel is added as a compile option + string(APPEND CMAKE_C_FLAGS_DEBUG " -required-debug-option") -add_executable(K1 test.c) + add_executable(K1 test.c) -add_executable(K2 test.c) -target_compile_options(K2 PRIVATE -kernel) + add_executable(K2 test.c) + target_compile_options(K2 PRIVATE -kernel) -add_executable(K3 test.c) -target_compile_options(K3 PRIVATE -kernel=fast) + add_executable(K3 test.c) + target_compile_options(K3 PRIVATE -kernel=fast) -add_executable(K4 test.c) -target_link_options(K4 PRIVATE -kernel) + add_executable(K4 test.c) + target_link_options(K4 PRIVATE -kernel) endif() diff --git a/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/CMakeLists.txt b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/CMakeLists.txt index 520e65f..a1f152f 100644 --- a/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/CMakeLists.txt +++ b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/CMakeLists.txt @@ -12,6 +12,6 @@ add_library(libdemo add_executable(demo main.c) target_link_libraries(demo libdemo) -if(GHSMULTI) - target_compile_options(demo PUBLIC "-non_shared") +if(CMAKE_C_COMPILER_ID STREQUAL "GHS") + target_link_options(demo PRIVATE "-non_shared") endif() diff --git a/Tests/GhsMulti/GhsMultiExclude/CMakeLists.txt b/Tests/GhsMulti/GhsMultiExclude/CMakeLists.txt index 329cb3f..0448cf2 100644 --- a/Tests/GhsMulti/GhsMultiExclude/CMakeLists.txt +++ b/Tests/GhsMulti/GhsMultiExclude/CMakeLists.txt @@ -5,6 +5,10 @@ cmake_minimum_required(VERSION 3.12 FATAL_ERROR) project(test C) +if(CMAKE_C_COMPILER_ID STREQUAL "GHS") + add_link_options("-non_shared") +endif() + add_library(lib1 lib1.c) set_target_properties( lib1 PROPERTIES EXCLUDE_FROM_ALL yes ) diff --git a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDD/CMakeLists.txt b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDD/CMakeLists.txt index 3d0642d..d4cbf04 100644 --- a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDD/CMakeLists.txt +++ b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDD/CMakeLists.txt @@ -5,6 +5,8 @@ cmake_minimum_required(VERSION 3.12 FATAL_ERROR) project(test C) +add_link_options("-non_shared") + # create virtual AS add_executable(vas exe.c) target_link_libraries(vas lib) diff --git a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/CMakeLists.txt b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/CMakeLists.txt index 741fece..c5db155 100644 --- a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/CMakeLists.txt +++ b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/CMakeLists.txt @@ -3,6 +3,8 @@ cmake_minimum_required(VERSION 3.12 FATAL_ERROR) +add_link_options("-non_shared") + project(test C) # create virtual AS diff --git a/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt b/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt index dfb72ce..da80b51 100644 --- a/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt +++ b/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt @@ -37,7 +37,7 @@ if (RUN_TEST STREQUAL "NO_FLAGS") endif() else() unset(fileName CACHE) - find_file (fileName exe1.gpj + find_file(fileName exe1.gpj ${CMAKE_CURRENT_BINARY_DIR}/link_build ${CMAKE_CURRENT_BINARY_DIR}/link_build/exe1 ) @@ -50,12 +50,12 @@ else() -lcsl1 csl2 -clinkexe1 -clinkexe2 -special-lib2-public-link) - foreach( opt IN LISTS expected_flags ) + foreach(opt IN LISTS expected_flags) string(FIND "${fileText}" "${opt}" opt_found) if ( opt_found EQUAL -1 ) message(SEND_ERROR "Could not find: ${opt}") endif() - endforeach(opt) + endforeach() unset(fileName CACHE) find_file (fileName lib1.gpj @@ -67,12 +67,12 @@ else() set(expected_flags -clinkexeA1 -clinkexeA2 -static-lib-flags1 -static-lib-flags2) - foreach( opt IN LISTS expected_flags ) + foreach(opt IN LISTS expected_flags) string(FIND "${fileText}" "${opt}" opt_found) - if ( opt_found EQUAL -1 ) + if (opt_found EQUAL -1) message(SEND_ERROR "Could not find: ${opt}") endif() - endforeach(opt) + endforeach() unset(fileName CACHE) find_file (fileName lib2.gpj @@ -83,10 +83,10 @@ else() file(STRINGS ${fileName} fileText) set(expected_flags -clinkexeA1 -clinkexeA2) - foreach( opt IN LISTS expected_flags ) + foreach(opt IN LISTS expected_flags) string(FIND "${fileText}" "${opt}" opt_found) if ( opt_found EQUAL -1 ) message(SEND_ERROR "Could not find: ${opt}") endif() - endforeach(opt) + endforeach() endif() diff --git a/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt.in b/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt.in index 4cf86a2..58c2115 100644 --- a/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt.in +++ b/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt.in @@ -5,31 +5,39 @@ cmake_minimum_required(VERSION 3.12 FATAL_ERROR) project(test C) -if( RUN_TEST STREQUAL "CHECK_FLAGS" ) -add_link_options(-add-link-options1 -add-link-options2) -link_directories(link_directories_used1 link_directories_used2 "c:/absolute") -link_libraries(link_libraries_used1 link_libraries_used2 ) -set( CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} -lcsl1 csl2" ) -set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -clinkexe1 -clinkexe2") +if(CMAKE_C_COMPILER_ID STREQUAL "GHS") + add_link_options("-non_shared") +endif() + +if(RUN_TEST STREQUAL "CHECK_FLAGS") + add_link_options(-add-link-options1 -add-link-options2) + link_directories(link_directories_used1 link_directories_used2 "c:/absolute") + link_libraries(link_libraries_used1 link_libraries_used2 ) + set( CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} -lcsl1 csl2" ) + set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -clinkexe1 -clinkexe2") endif() add_executable(exe1 exe1.c) target_link_libraries(exe1 lib1) -if( RUN_TEST STREQUAL "CHECK_FLAGS" ) -set_property( TARGET exe1 APPEND_STRING PROPERTY LINK_FLAGS "--link-flag-prop1 --link-flag-prop2") -set_property( TARGET exe1 APPEND PROPERTY LINK_OPTIONS --link-opt-prop1 --link-opt-prop2) + +if(RUN_TEST STREQUAL "CHECK_FLAGS") + set_property(TARGET exe1 APPEND_STRING PROPERTY LINK_FLAGS "--link-flag-prop1 --link-flag-prop2") + set_property(TARGET exe1 APPEND PROPERTY LINK_OPTIONS --link-opt-prop1 --link-opt-prop2) endif() -if( RUN_TEST STREQUAL "CHECK_FLAGS" ) -set( CMAKE_STATIC_LINKER_FLAGS ${CMAKE_STATIC_LINKER_FLAGS} "-clinkexeA1 -clinkexeA2") +if(RUN_TEST STREQUAL "CHECK_FLAGS") + set(CMAKE_STATIC_LINKER_FLAGS ${CMAKE_STATIC_LINKER_FLAGS} "-clinkexeA1 -clinkexeA2") endif() + add_library(lib1 STATIC func2.c func3.c func4.c) target_link_libraries(lib1 lib2) -if( RUN_TEST STREQUAL "CHECK_FLAGS" ) -set_property( TARGET lib1 APPEND_STRING PROPERTY STATIC_LIBRARY_FLAGS "-static-lib-flags1 -static-lib-flags2") + +if(RUN_TEST STREQUAL "CHECK_FLAGS") + set_property(TARGET lib1 APPEND_STRING PROPERTY STATIC_LIBRARY_FLAGS "-static-lib-flags1 -static-lib-flags2") endif() add_library(lib2 STATIC func5.c func6.c func7.c) -if( RUN_TEST STREQUAL "CHECK_FLAGS" ) -target_link_options(lib2 PUBLIC -special-lib2-public-link) + +if(RUN_TEST STREQUAL "CHECK_FLAGS") + target_link_options(lib2 PUBLIC -special-lib2-public-link) endif() diff --git a/Tests/GhsMulti/GhsMultiLinkTestSub/sub_exe/CMakeLists.txt b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_exe/CMakeLists.txt index 55f693d..f49e33d 100644 --- a/Tests/GhsMulti/GhsMultiLinkTestSub/sub_exe/CMakeLists.txt +++ b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_exe/CMakeLists.txt @@ -7,3 +7,6 @@ project(test C) add_executable(exe1 exe1.c) target_link_libraries(exe1 lib1) +if(CMAKE_C_COMPILER_ID STREQUAL "GHS") + target_link_options(exe1 PRIVATE "-non_shared") +endif() diff --git a/Tests/GhsMulti/GhsMultiMultipleProjects/CMakeLists.txt b/Tests/GhsMulti/GhsMultiMultipleProjects/CMakeLists.txt index d01c4d2..9e077a9 100644 --- a/Tests/GhsMulti/GhsMultiMultipleProjects/CMakeLists.txt +++ b/Tests/GhsMulti/GhsMultiMultipleProjects/CMakeLists.txt @@ -5,6 +5,10 @@ cmake_minimum_required(VERSION 3.12 FATAL_ERROR) project(test C) +if(CMAKE_C_COMPILER_ID STREQUAL "GHS") + add_link_options("-non_shared") +endif() + add_library(lib1 lib1.c) add_executable(exe1 exe1.c) target_link_libraries(exe1 lib1) diff --git a/Tests/GhsMulti/GhsMultiMultipleProjects/verify.cmake b/Tests/GhsMulti/GhsMultiMultipleProjects/verify.cmake index e00cbb3..3855215 100644 --- a/Tests/GhsMulti/GhsMultiMultipleProjects/verify.cmake +++ b/Tests/GhsMulti/GhsMultiMultipleProjects/verify.cmake @@ -3,13 +3,13 @@ #test project was generated unset(fileName CACHE) -find_file (fileName lib3.gpj +find_file(fileName lib3.gpj ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/lib3 ${CMAKE_CURRENT_BINARY_DIR}/examples ) -if ( fileName ) +if (fileName) message("Found target lib3: ${fileName}") else() message(SEND_ERROR "Could not find target lib3: ${fileName}") @@ -23,7 +23,7 @@ find_file (fileName exe3.gpj ${CMAKE_CURRENT_BINARY_DIR}/examples ) -if ( fileName ) +if (fileName) message("Found target exe3: ${fileName}") else() message(SEND_ERROR "Could not find target exe3: ${fileName}") @@ -37,7 +37,7 @@ find_file (fileName lib3.a ${CMAKE_CURRENT_BINARY_DIR}/examples ) -if ( fileName ) +if (fileName) message(SEND_ERROR "Found target lib3: ${fileName}") else() message("Could not find target lib3: ${fileName}") @@ -51,7 +51,7 @@ find_file (fileName NAMES exe3.as exe3 ${CMAKE_CURRENT_BINARY_DIR}/examples ) -if ( fileName ) +if (fileName) message(SEND_ERROR "Found target exe3: ${fileName}") else() message("Could not find target exe3: ${fileName}") diff --git a/Tests/GhsMulti/GhsMultiObjectLibrary/CMakeLists.txt b/Tests/GhsMulti/GhsMultiObjectLibrary/CMakeLists.txt index 7fe91bc..a025814 100644 --- a/Tests/GhsMulti/GhsMultiObjectLibrary/CMakeLists.txt +++ b/Tests/GhsMulti/GhsMultiObjectLibrary/CMakeLists.txt @@ -8,3 +8,6 @@ project(test C) add_library(obj1 OBJECT testObj.c testObj.h sub/testObj.c testObj2.c) add_executable(exe1 exe.c $) +if(CMAKE_C_COMPILER_ID STREQUAL "GHS") + target_link_options(exe1 PRIVATE "-non_shared") +endif() diff --git a/Tests/GhsMulti/GhsMultiPlatform/CMakeLists.txt b/Tests/GhsMulti/GhsMultiPlatform/CMakeLists.txt index 222aa17..b177887 100644 --- a/Tests/GhsMulti/GhsMultiPlatform/CMakeLists.txt +++ b/Tests/GhsMulti/GhsMultiPlatform/CMakeLists.txt @@ -5,9 +5,12 @@ cmake_minimum_required(VERSION 3.12 FATAL_ERROR) project(test) +message("PLATFORM_ID = ${PLATFORM_ID}") + message("CMAKE_C_COMPILER = ${CMAKE_C_COMPILER}") message("CMAKE_C_COMPILER_ID = ${CMAKE_C_COMPILER_ID}") message("CMAKE_C_COMPILER_VERSION = ${CMAKE_C_COMPILER_VERSION}") +message("CMAKE_C_COMPILER_VERSION_INTERNAL = ${CMAKE_C_COMPILER_VERSION_INTERNAL}") message("CMAKE_C_PLATFORM_ID = ${CMAKE_C_PLATFORM_ID}") message("CMAKE_C_COMPILER_ARCHITECTURE_ID = ${CMAKE_C_COMPILER_ARCHITECTURE_ID}") message("CMAKE_C_COMPILER_ABI = ${CMAKE_C_COMPILER_ABI}") @@ -16,6 +19,7 @@ message("CMAKE_C_STANDARD_COMPUTED_DEFAULT = ${CMAKE_C_STANDARD_COMPUTED_DEFAULT message("CMAKE_CXX_COMPILER = ${CMAKE_CXX_COMPILER}") message("CMAKE_CXX_COMPILER_ID = ${CMAKE_CXX_COMPILER_ID}") message("CMAKE_CXX_COMPILER_VERSION = ${CMAKE_CXX_COMPILER_VERSION}") +message("CMAKE_CXX_COMPILER_VERSION_INTERNAL = ${CMAKE_CXX_COMPILER_VERSION_INTERNAL}") message("CMAKE_CXX_PLATFORM_ID = ${CMAKE_CXX_PLATFORM_ID}") message("CMAKE_CXX_COMPILER_ARCHITECTURE_ID = ${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}") message("CMAKE_CXX_COMPILER_ABI = ${CMAKE_CXX_COMPILER_ABI}") diff --git a/Tests/GhsMulti/GhsMultiPlatform/file1.c b/Tests/GhsMulti/GhsMultiPlatform/file1.c index 6f7c837..4132aa4 100644 --- a/Tests/GhsMulti/GhsMultiPlatform/file1.c +++ b/Tests/GhsMulti/GhsMultiPlatform/file1.c @@ -1,6 +1,4 @@ -#include - int main(void) { - printf("Testing...\n"); + return -42; } diff --git a/Tests/GhsMulti/GhsMultiRenameInstall/CMakeLists.txt b/Tests/GhsMulti/GhsMultiRenameInstall/CMakeLists.txt index f10b2f0..f5792b4 100644 --- a/Tests/GhsMulti/GhsMultiRenameInstall/CMakeLists.txt +++ b/Tests/GhsMulti/GhsMultiRenameInstall/CMakeLists.txt @@ -7,29 +7,33 @@ project(test C) set(targets_to_install "") -if( RUN_TEST STREQUAL "SINGLE_EXEC" ) -add_executable(exe1 exe.c) -set(targets_to_install ${targets_to_install} exe1) +if(CMAKE_C_COMPILER_ID STREQUAL "GHS") + add_link_options("-non_shared") endif() -if( RUN_TEST STREQUAL "SINGLE_EXEC_RENAMED" ) -set(name new_name) -add_executable(exe1 exe.c) -set_property(TARGET exe1 PROPERTY RUNTIME_OUTPUT_DIRECTORY ${name}_bin_$) -set_property(TARGET exe1 PROPERTY OUTPUT_NAME ${name}_$) -set_property(TARGET exe1 PROPERTY SUFFIX .bin) -set(targets_to_install ${targets_to_install} exe1) +if(RUN_TEST STREQUAL "SINGLE_EXEC") + add_executable(exe1 exe.c) + set(targets_to_install ${targets_to_install} exe1) endif() -if( RUN_TEST STREQUAL "EXEC_AND_LIB" ) -add_library(lib1 lib1.c) -set_property(TARGET lib1 PROPERTY ARCHIVE_OUTPUT_DIRECTORY forced-$) -set_property(TARGET lib1 PROPERTY SUFFIX .LL) -set_property(TARGET lib1 PROPERTY OUTPUT_NAME lib1_$) +if(RUN_TEST STREQUAL "SINGLE_EXEC_RENAMED") + set(name new_name) + add_executable(exe1 exe.c) + set_property(TARGET exe1 PROPERTY RUNTIME_OUTPUT_DIRECTORY ${name}_bin_$) + set_property(TARGET exe1 PROPERTY OUTPUT_NAME ${name}_$) + set_property(TARGET exe1 PROPERTY SUFFIX .bin) + set(targets_to_install ${targets_to_install} exe1) +endif() + +if(RUN_TEST STREQUAL "EXEC_AND_LIB") + add_library(lib1 lib1.c) + set_property(TARGET lib1 PROPERTY ARCHIVE_OUTPUT_DIRECTORY forced-$) + set_property(TARGET lib1 PROPERTY SUFFIX .LL) + set_property(TARGET lib1 PROPERTY OUTPUT_NAME lib1_$) -add_executable(exe1 exe1.c) -target_link_libraries(exe1 lib1) -set(targets_to_install ${targets_to_install} exe1 lib1) + add_executable(exe1 exe1.c) + target_link_libraries(exe1 lib1) + set(targets_to_install ${targets_to_install} exe1 lib1) endif() install(TARGETS ${targets_to_install} diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/CMakeLists.txt b/Tests/GhsMulti/GhsMultiSrcGroups/CMakeLists.txt index a4f84ca..93a1afc 100644 --- a/Tests/GhsMulti/GhsMultiSrcGroups/CMakeLists.txt +++ b/Tests/GhsMulti/GhsMultiSrcGroups/CMakeLists.txt @@ -35,6 +35,9 @@ add_executable(groups if(TEST_PROP) set_target_properties(groups PROPERTIES GHS_NO_SOURCE_GROUP_FILE ON) endif() +if(CMAKE_C_COMPILER_ID MATCHES "GHS") + target_link_options(groups PRIVATE "-non_shared") +endif() source_group( gC FILES sub/testOBJ.h testOBJ.c testOBJ.h sub/testOBJ.c ) source_group( gA FILES test1.c test1.h) source_group( gB test[65].c ) diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/cmake.rule b/Tests/GhsMulti/GhsMultiSrcGroups/cmake.rule index 8b13789..c6cac69 100644 --- a/Tests/GhsMulti/GhsMultiSrcGroups/cmake.rule +++ b/Tests/GhsMulti/GhsMultiSrcGroups/cmake.rule @@ -1 +1 @@ - +empty diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/object.o b/Tests/GhsMulti/GhsMultiSrcGroups/object.o index 8b13789..c6cac69 100644 --- a/Tests/GhsMulti/GhsMultiSrcGroups/object.o +++ b/Tests/GhsMulti/GhsMultiSrcGroups/object.o @@ -1 +1 @@ - +empty diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/resource.pdf b/Tests/GhsMulti/GhsMultiSrcGroups/resource.pdf index 8b13789..e69de29 100644 --- a/Tests/GhsMulti/GhsMultiSrcGroups/resource.pdf +++ b/Tests/GhsMulti/GhsMultiSrcGroups/resource.pdf @@ -1 +0,0 @@ - https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=72e0c115b771fe9e3f4b5a5b6bd3bcdade77a7cb commit 72e0c115b771fe9e3f4b5a5b6bd3bcdade77a7cb Author: Fred Baksik AuthorDate: Tue Jan 8 23:52:12 2019 -0500 Commit: Fred Baksik CommitDate: Wed Jan 16 10:42:04 2019 -0500 GHS: Add Compiler ID detection -- Detect GHS compiler and version Detect ARCHITECTURE_ID for PPC / ARM / 86 targets Detect PLATFORM_ID for Integrity and Integrity178 platforms Using defines specified in the documents for the compilers: 201416 PPC / 201754 ARM / 201714 86 -- Fallback C/CXX compiler ID to GHS if not otherwise detected and using GHS MULTI generator Works around issue with some GHS compilers not setting __ghs__ compiler define -- Tweak Compiler ID checking so major id of 002017 is not replaced with 217 -- Prefer try_compile() library targets when testing for working GHS compilers -- Avoid CMake errors if reading past end of file for checking if file is PE executable diff --git a/Help/variable/CMAKE_LANG_COMPILER_ID.rst b/Help/variable/CMAKE_LANG_COMPILER_ID.rst index 2264269..033e81c 100644 --- a/Help/variable/CMAKE_LANG_COMPILER_ID.rst +++ b/Help/variable/CMAKE_LANG_COMPILER_ID.rst @@ -19,6 +19,7 @@ include: Embarcadero, Borland = Embarcadero (embarcadero.com) G95 = G95 Fortran (g95.org) GNU = GNU Compiler Collection (gcc.gnu.org) + GHS = Green Hills Software (www.ghs.com) HP = Hewlett-Packard Compiler (hp.com) IAR = IAR Systems (iar.com) Intel = Intel Compiler (intel.com) diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake index 9b2a91f..4d0c681 100644 --- a/Modules/CMakeCompilerIdDetection.cmake +++ b/Modules/CMakeCompilerIdDetection.cmake @@ -63,6 +63,7 @@ function(compiler_id_detection outvar lang) Cray TI Fujitsu + GHS ) if (lang STREQUAL C) list(APPEND ordered_compilers diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake index 1a0d8a6..4f355f3 100644 --- a/Modules/CMakeDetermineCCompiler.cmake +++ b/Modules/CMakeDetermineCCompiler.cmake @@ -31,6 +31,7 @@ if(NOT CMAKE_C_COMPILER_NAMES) endif() if(${CMAKE_GENERATOR} MATCHES "Visual Studio") +elseif("${CMAKE_GENERATOR}" MATCHES "Green Hills MULTI") elseif("${CMAKE_GENERATOR}" MATCHES "Xcode") set(CMAKE_C_COMPILER_XCODE_TYPE sourcecode.c.c) _cmake_find_compiler_path(C) diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake index 0a0c37b..96b4209 100644 --- a/Modules/CMakeDetermineCXXCompiler.cmake +++ b/Modules/CMakeDetermineCXXCompiler.cmake @@ -30,6 +30,7 @@ if(NOT CMAKE_CXX_COMPILER_NAMES) endif() if(${CMAKE_GENERATOR} MATCHES "Visual Studio") +elseif("${CMAKE_GENERATOR}" MATCHES "Green Hills MULTI") elseif("${CMAKE_GENERATOR}" MATCHES "Xcode") set(CMAKE_CXX_COMPILER_XCODE_TYPE sourcecode.cpp.cpp) _cmake_find_compiler_path(CXX) diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake index 604ac27..d88f2ed 100644 --- a/Modules/CMakeDetermineCompilerABI.cmake +++ b/Modules/CMakeDetermineCompilerABI.cmake @@ -7,6 +7,7 @@ # code. include(${CMAKE_ROOT}/Modules/CMakeParseImplicitLinkInfo.cmake) +include(CMakeTestCompilerCommon) function(CMAKE_DETERMINE_COMPILER_ABI lang src) if(NOT DEFINED CMAKE_${lang}_ABI_COMPILED) @@ -23,6 +24,7 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src) # from which we might detect implicit link libraries. list(APPEND CMAKE_FLAGS "-DCMAKE_${lang}_STANDARD_LIBRARIES=") endif() + __TestCompiler_setTryCompileTargetType() try_compile(CMAKE_${lang}_ABI_COMPILED ${CMAKE_BINARY_DIR} ${src} CMAKE_FLAGS ${CMAKE_FLAGS} diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index f987d9a..2a0dbd3 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -52,6 +52,13 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) endforeach() endif() + # If the compiler is still unknown, fallback to GHS + if(NOT CMAKE_${lang}_COMPILER_ID AND "${CMAKE_GENERATOR}" MATCHES "Green Hills MULTI") + set(CMAKE_${lang}_COMPILER_ID GHS) + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "The ${lang} compiler identification is falling back to GHS.\n\n") + endif() + # CUDA < 7.5 is missing version macros if(lang STREQUAL "CUDA" AND CMAKE_${lang}_COMPILER_ID STREQUAL "NVIDIA" @@ -391,6 +398,40 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS} separate_arguments(CMAKE_${lang}_XCODE_ARCHS) set(CMAKE_${lang}_XCODE_ARCHS "${CMAKE_${lang}_XCODE_ARCHS}" PARENT_SCOPE) endif() + elseif("${CMAKE_GENERATOR}" MATCHES "Green Hills MULTI") + set(id_dir ${CMAKE_${lang}_COMPILER_ID_DIR}) + set(id_src "${src}") + if (GHS_PRIMARY_TARGET) + set(ghs_primary_target "${GHS_PRIMARY_TARGET}") + else() + set(ghs_primary_target "${CMAKE_GENERATOR_PLATFORM}_${GHS_TARGET_PLATFORM}.tgt") + endif() + if ("${GHS_TARGET_PLATFORM}" MATCHES "integrity") + set(bsp_name "macro GHS_BSP=${GHS_BSP_NAME}") + set(os_dir "macro GHS_OS=${GHS_OS_DIR}") + endif() + set(command "${CMAKE_MAKE_PROGRAM}" "-commands" "-top" "GHS_default.gpj") + configure_file(${CMAKE_ROOT}/Modules/CompilerId/GHS_default.gpj.in + ${id_dir}/GHS_default.gpj @ONLY) + configure_file(${CMAKE_ROOT}/Modules/CompilerId/GHS_lib.gpj.in + ${id_dir}/GHS_lib.gpj @ONLY) + execute_process(COMMAND ${command} + WORKING_DIRECTORY ${id_dir} + OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT + ERROR_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT + RESULT_VARIABLE CMAKE_${lang}_COMPILER_ID_RESULT + ) + # Match the compiler location line printed out. + set(ghs_toolpath "${CMAKE_MAKE_PROGRAM}") + string(REPLACE "/gbuild.exe" "/" ghs_toolpath ${ghs_toolpath}) + string(REPLACE / "\\\\" ghs_toolpath ${ghs_toolpath}) + if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "(${ghs_toolpath}[^ ]*)") + set(_comp "${CMAKE_MATCH_1}.exe") + if(EXISTS "${_comp}") + file(TO_CMAKE_PATH "${_comp}" _comp) + set(CMAKE_${lang}_COMPILER_ID_TOOL "${_comp}" PARENT_SCOPE) + endif() + endif() else() execute_process( COMMAND "${CMAKE_${lang}_COMPILER}" @@ -550,7 +591,7 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) set(ARCHITECTURE_ID "${CMAKE_MATCH_1}") endif() if("${info}" MATCHES "INFO:compiler_version\\[([^]\"]*)\\]") - string(REGEX REPLACE "^0+([0-9])" "\\1" COMPILER_VERSION "${CMAKE_MATCH_1}") + string(REGEX REPLACE "^0+([0-9]+)" "\\1" COMPILER_VERSION "${CMAKE_MATCH_1}") string(REGEX REPLACE "\\.0+([0-9])" ".\\1" COMPILER_VERSION "${COMPILER_VERSION}") endif() if("${info}" MATCHES "INFO:compiler_version_internal\\[([^]\"]*)\\]") @@ -602,26 +643,28 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) if(WIN32) # The offset to the PE signature is stored at 0x3c. file(READ ${file} peoffsethex LIMIT 1 OFFSET 60 HEX) - string(SUBSTRING "${peoffsethex}" 0 1 peoffsethex1) - string(SUBSTRING "${peoffsethex}" 1 1 peoffsethex2) - set(peoffsetexpression "${peoffsethex1} * 16 + ${peoffsethex2}") - string(REPLACE "a" "10" peoffsetexpression "${peoffsetexpression}") - string(REPLACE "b" "11" peoffsetexpression "${peoffsetexpression}") - string(REPLACE "c" "12" peoffsetexpression "${peoffsetexpression}") - string(REPLACE "d" "13" peoffsetexpression "${peoffsetexpression}") - string(REPLACE "e" "14" peoffsetexpression "${peoffsetexpression}") - string(REPLACE "f" "15" peoffsetexpression "${peoffsetexpression}") - math(EXPR peoffset "${peoffsetexpression}") - - file(READ ${file} peheader LIMIT 6 OFFSET ${peoffset} HEX) - if(peheader STREQUAL "50450000a201") - set(ARCHITECTURE_ID "SH3") - elseif(peheader STREQUAL "50450000a301") - set(ARCHITECTURE_ID "SH3DSP") - elseif(peheader STREQUAL "50450000a601") - set(ARCHITECTURE_ID "SH4") - elseif(peheader STREQUAL "50450000a801") - set(ARCHITECTURE_ID "SH5") + if(NOT peoffsethex STREQUAL "") + string(SUBSTRING "${peoffsethex}" 0 1 peoffsethex1) + string(SUBSTRING "${peoffsethex}" 1 1 peoffsethex2) + set(peoffsetexpression "${peoffsethex1} * 16 + ${peoffsethex2}") + string(REPLACE "a" "10" peoffsetexpression "${peoffsetexpression}") + string(REPLACE "b" "11" peoffsetexpression "${peoffsetexpression}") + string(REPLACE "c" "12" peoffsetexpression "${peoffsetexpression}") + string(REPLACE "d" "13" peoffsetexpression "${peoffsetexpression}") + string(REPLACE "e" "14" peoffsetexpression "${peoffsetexpression}") + string(REPLACE "f" "15" peoffsetexpression "${peoffsetexpression}") + math(EXPR peoffset "${peoffsetexpression}") + + file(READ ${file} peheader LIMIT 6 OFFSET ${peoffset} HEX) + if(peheader STREQUAL "50450000a201") + set(ARCHITECTURE_ID "SH3") + elseif(peheader STREQUAL "50450000a301") + set(ARCHITECTURE_ID "SH3DSP") + elseif(peheader STREQUAL "50450000a601") + set(ARCHITECTURE_ID "SH4") + elseif(peheader STREQUAL "50450000a801") + set(ARCHITECTURE_ID "SH5") + endif() endif() endif() diff --git a/Modules/CMakePlatformId.h.in b/Modules/CMakePlatformId.h.in index c2b5aa9..3cb7f24 100644 --- a/Modules/CMakePlatformId.h.in +++ b/Modules/CMakePlatformId.h.in @@ -91,6 +91,14 @@ # define PLATFORM_ID # endif +#elif defined(__INTEGRITY) +# if defined(INT_178B) +# define PLATFORM_ID "Integrity178" + +# else /* regular Integrity */ +# define PLATFORM_ID "Integrity" +# endif + #else /* unknown platform */ # define PLATFORM_ID @@ -154,6 +162,26 @@ # else /* unknown architecture */ # define ARCHITECTURE_ID "" # endif + +#elif defined(__ghs__) +# if defined(__PPC64__) +# define ARCHITECTURE_ID "PPC64" + +# elif defined(__ppc__) +# define ARCHITECTURE_ID "PPC" + +# elif defined(__ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__x86_64__) +# define ARCHITECTURE_ID "x64" + +# elif defined(__i386__) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif #else # define ARCHITECTURE_ID #endif diff --git a/Modules/CMakeTestCCompiler.cmake b/Modules/CMakeTestCCompiler.cmake index e34ae75..f74a1c6 100644 --- a/Modules/CMakeTestCCompiler.cmake +++ b/Modules/CMakeTestCCompiler.cmake @@ -22,6 +22,7 @@ unset(CMAKE_C_COMPILER_WORKS CACHE) # any makefiles or projects. if(NOT CMAKE_C_COMPILER_WORKS) PrintTestCompilerStatus("C" "") + __TestCompiler_setTryCompileTargetType() file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler.c "#ifdef __cplusplus\n" "# error \"The CMAKE_C_COMPILER is set to a C++ compiler\"\n" @@ -41,6 +42,7 @@ if(NOT CMAKE_C_COMPILER_WORKS) set(CMAKE_C_COMPILER_WORKS ${CMAKE_C_COMPILER_WORKS}) unset(CMAKE_C_COMPILER_WORKS CACHE) set(C_TEST_WAS_RUN 1) + __TestCompiler_restoreTryCompileTargetType() endif() if(NOT CMAKE_C_COMPILER_WORKS) diff --git a/Modules/CMakeTestCXXCompiler.cmake b/Modules/CMakeTestCXXCompiler.cmake index e4d49ae..fe6bd25 100644 --- a/Modules/CMakeTestCXXCompiler.cmake +++ b/Modules/CMakeTestCXXCompiler.cmake @@ -22,6 +22,7 @@ unset(CMAKE_CXX_COMPILER_WORKS CACHE) # any makefiles or projects. if(NOT CMAKE_CXX_COMPILER_WORKS) PrintTestCompilerStatus("CXX" "") + __TestCompiler_setTryCompileTargetType() file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCXXCompiler.cxx "#ifndef __cplusplus\n" "# error \"The CMAKE_CXX_COMPILER is set to a C compiler\"\n" @@ -34,6 +35,7 @@ if(NOT CMAKE_CXX_COMPILER_WORKS) set(CMAKE_CXX_COMPILER_WORKS ${CMAKE_CXX_COMPILER_WORKS}) unset(CMAKE_CXX_COMPILER_WORKS CACHE) set(CXX_TEST_WAS_RUN 1) + __TestCompiler_restoreTryCompileTargetType() endif() if(NOT CMAKE_CXX_COMPILER_WORKS) diff --git a/Modules/CMakeTestCompilerCommon.cmake b/Modules/CMakeTestCompilerCommon.cmake index f76076f..6ee5175 100644 --- a/Modules/CMakeTestCompilerCommon.cmake +++ b/Modules/CMakeTestCompilerCommon.cmake @@ -5,3 +5,23 @@ function(PrintTestCompilerStatus LANG MSG) message(STATUS "Check for working ${LANG} compiler: ${CMAKE_${LANG}_COMPILER}${MSG}") endfunction() + +# if required set the target type if not already explicitly set +macro(__TestCompiler_setTryCompileTargetType) + if(NOT CMAKE_TRY_COMPILE_TARGET_TYPE) + if("${CMAKE_GENERATOR}" MATCHES "Green Hills MULTI") + #prefer static libraries to avoid linking issues + set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) + set(__CMAKE_TEST_COMPILER_TARGET_TYPE_RESTORE 1) + endif() + endif() +endmacro() + +# restore the original value +# -- not necessary if __TestCompiler_setTryCompileTargetType() was used in function scope +macro(__TestCompiler_restoreTryCompileTargetType) + if(__CMAKE_TEST_COMPILER_TARGET_TYPE_RESTORE) + unset(CMAKE_TRY_COMPILE_TARGET_TYPE) + unset(__CMAKE_TEST_COMPILER_TARGET_TYPE_RESTORE) + endif() +endmacro() diff --git a/Modules/Compiler/GHS-DetermineCompiler.cmake b/Modules/Compiler/GHS-DetermineCompiler.cmake index 56d24e2..368b375 100644 --- a/Modules/Compiler/GHS-DetermineCompiler.cmake +++ b/Modules/Compiler/GHS-DetermineCompiler.cmake @@ -1,6 +1,9 @@ -set(_compiler_id_pp_test "defined(__INTEGRITY)") +set(_compiler_id_pp_test "defined(__ghs__)") set(_compiler_id_version_compute " -# define @PREFIX at COMPILER_VERSION_MAJOR @MACRO_DEC@(__INTEGRITY_MAJOR_VERSION) -# define @PREFIX at COMPILER_VERSION_MINOR @MACRO_DEC@(__INTEGRITY_MINOR_VERSION) -# define @PREFIX at COMPILER_VERSION_PATCH @MACRO_DEC@(__INTEGRITY_PATCH_VERSION)") +/* __GHS_VERSION_NUMBER = VVVVRP */ +# ifdef __GHS_VERSION_NUMBER +# define @PREFIX at COMPILER_VERSION_MAJOR @MACRO_DEC@(__GHS_VERSION_NUMBER / 100) +# define @PREFIX at COMPILER_VERSION_MINOR @MACRO_DEC@(__GHS_VERSION_NUMBER / 10 % 10) +# define @PREFIX at COMPILER_VERSION_PATCH @MACRO_DEC@(__GHS_VERSION_NUMBER % 10) +# endif") diff --git a/Modules/CompilerId/GHS_default.gpj.in b/Modules/CompilerId/GHS_default.gpj.in new file mode 100644 index 0000000..b5cea5c --- /dev/null +++ b/Modules/CompilerId/GHS_default.gpj.in @@ -0,0 +1,8 @@ +#!gbuild + at bsp_name@ + at os_dir@ +primaryTarget=@ghs_primary_target@ +[Project] + {isdefined(GHS_BSP)} -bsp $GHS_BSP + {isdefined(GHS_OS)} -os_dir $GHS_OS +GHS_lib.gpj [Library] diff --git a/Modules/CompilerId/GHS_lib.gpj.in b/Modules/CompilerId/GHS_lib.gpj.in new file mode 100644 index 0000000..149b981 --- /dev/null +++ b/Modules/CompilerId/GHS_lib.gpj.in @@ -0,0 +1,3 @@ +#!gbuild +[Library] + at id_src@ diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 82543e7..557efec 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -104,24 +104,6 @@ bool cmGlobalGhsMultiGenerator::SetGeneratorToolset(std::string const& ts, mf->AddDefinition("CMAKE_SYSTEM_VERSION", tsp.c_str()); - // FIXME: compiler detection not implemented - // gbuild uses the primaryTarget setting in the top-level project - // file to determine which compiler to use. Because compiler - // detection is not implemented these variables must be - // set to skip past these tests. However cmake will verify that - // the executable pointed to by CMAKE__COMPILER exists. - // To pass this additional check gbuild is used as a place holder for the - // actual compiler. - mf->AddDefinition("CMAKE_C_COMPILER", gbuild.c_str()); - mf->AddDefinition("CMAKE_C_COMPILER_ID_RUN", "TRUE"); - mf->AddDefinition("CMAKE_C_COMPILER_ID", "GHS"); - mf->AddDefinition("CMAKE_C_COMPILER_FORCED", "TRUE"); - - mf->AddDefinition("CMAKE_CXX_COMPILER", gbuild.c_str()); - mf->AddDefinition("CMAKE_CXX_COMPILER_ID_RUN", "TRUE"); - mf->AddDefinition("CMAKE_CXX_COMPILER_ID", "GHS"); - mf->AddDefinition("CMAKE_CXX_COMPILER_FORCED", "TRUE"); - return true; } diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 7c48d04..87bd27e 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -2317,6 +2317,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release add_test_GhsMulti(compiler_options_none GhsMultiCompilerOptions None "-DRUN_TEST=RELEASE_FLAGS -DRUN_TEST_BUILD_TYPE=\"\"" "") add_test_GhsMulti(compiler_options_kernel GhsMultiCompilerOptions Kernel "-DRUN_TEST=KERNEL_FLAGS -DRUN_TEST_BUILD_TYPE=DEBUG" "") add_test_GhsMulti(try_compile_copy GhsMultiCopyFile "" "" "") + add_test_GhsMulti(ghs_platform GhsMultiPlatform "" "" "") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/GhsMulti/${ghs_config_name}") #unset ghs config variables unset(ghs_config_name) diff --git a/Tests/GhsMulti/GhsMultiPlatform/CMakeLists.txt b/Tests/GhsMulti/GhsMultiPlatform/CMakeLists.txt new file mode 100644 index 0000000..222aa17 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiPlatform/CMakeLists.txt @@ -0,0 +1,30 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +cmake_minimum_required(VERSION 3.12 FATAL_ERROR) + +project(test) + +message("CMAKE_C_COMPILER = ${CMAKE_C_COMPILER}") +message("CMAKE_C_COMPILER_ID = ${CMAKE_C_COMPILER_ID}") +message("CMAKE_C_COMPILER_VERSION = ${CMAKE_C_COMPILER_VERSION}") +message("CMAKE_C_PLATFORM_ID = ${CMAKE_C_PLATFORM_ID}") +message("CMAKE_C_COMPILER_ARCHITECTURE_ID = ${CMAKE_C_COMPILER_ARCHITECTURE_ID}") +message("CMAKE_C_COMPILER_ABI = ${CMAKE_C_COMPILER_ABI}") +message("CMAKE_C_STANDARD_COMPUTED_DEFAULT = ${CMAKE_C_STANDARD_COMPUTED_DEFAULT}") + +message("CMAKE_CXX_COMPILER = ${CMAKE_CXX_COMPILER}") +message("CMAKE_CXX_COMPILER_ID = ${CMAKE_CXX_COMPILER_ID}") +message("CMAKE_CXX_COMPILER_VERSION = ${CMAKE_CXX_COMPILER_VERSION}") +message("CMAKE_CXX_PLATFORM_ID = ${CMAKE_CXX_PLATFORM_ID}") +message("CMAKE_CXX_COMPILER_ARCHITECTURE_ID = ${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}") +message("CMAKE_CXX_COMPILER_ABI = ${CMAKE_CXX_COMPILER_ABI}") +message("CMAKE_CXX_STANDARD_COMPUTED_DEFAULT = ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT}") + +if(CMAKE_C_COMPILER AND NOT CMAKE_C_COMPILER_ID STREQUAL "GHS") + message(FATAL_ERROR "CMAKE_C_COMPILER_ID != GHS") +endif() + +if(CMAKE_CXX_COMPILER AND NOT CMAKE_CXX_COMPILER_ID STREQUAL "GHS") + message(FATAL_ERROR "CMAKE_CXX_COMPILER_ID != GHS") +endif() diff --git a/Tests/GhsMulti/GhsMultiPlatform/file1.c b/Tests/GhsMulti/GhsMultiPlatform/file1.c new file mode 100644 index 0000000..6f7c837 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiPlatform/file1.c @@ -0,0 +1,6 @@ +#include + +int main(void) +{ + printf("Testing...\n"); +} https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=436cc5e991c7be07610d7902a5ce2a00221ca0a2 commit 436cc5e991c7be07610d7902a5ce2a00221ca0a2 Author: Fred Baksik AuthorDate: Tue Jan 8 23:52:12 2019 -0500 Commit: Fred Baksik CommitDate: Wed Jan 16 10:42:00 2019 -0500 GHS: try_compile() now uses GHS platform variables -- Forward GHS platform variables to try_compile() CMAKE_TRY_COMPILE_PLATFORM_VARIABLES only worked for source signature try_compile() -- Update tests to no longer add GHS platform variables to try_compile() -- Avoid linker error in GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt by building library diff --git a/Help/command/try_compile.rst b/Help/command/try_compile.rst index cf9e06f..77f42a1 100644 --- a/Help/command/try_compile.rst +++ b/Help/command/try_compile.rst @@ -168,3 +168,6 @@ then the language standard variables are honored: Their values are used to set the corresponding target properties in the generated project (unless overridden by an explicit option). + +For the :generator:`Green Hills MULTI` generator the GHS toolset and target +system customization cache variables are also propagated into the test project. diff --git a/Help/generator/Green Hills MULTI.rst b/Help/generator/Green Hills MULTI.rst index 2794598..bfe671f 100644 --- a/Help/generator/Green Hills MULTI.rst +++ b/Help/generator/Green Hills MULTI.rst @@ -17,13 +17,14 @@ Both absolute and relative paths are valid. Relative paths use ``GHS_TOOLSET_ROO as the root. If the toolset is not specified then the latest toolset found in ``GHS_TOOLSET_ROOT`` will be used. +Cache variables that are used for toolset and target system customization: + * ``GHS_TARGET_PLATFORM`` | Defaults to ``integrity``. | Usual values are ``integrity``, ``threadx``, ``uvelosity``, ``velosity``, ``vxworks``, ``standalone``. - * ``GHS_PRIMARY_TARGET`` | Sets ``primaryTarget`` entry in project file. diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index a483fd1..137b25f 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -57,6 +57,12 @@ static std::string const kCMAKE_TRY_COMPILE_PLATFORM_VARIABLES = "CMAKE_TRY_COMPILE_PLATFORM_VARIABLES"; static std::string const kCMAKE_WARN_DEPRECATED = "CMAKE_WARN_DEPRECATED"; +/* GHS Multi platform variables */ +static std::set ghs_platform_vars{ + "GHS_TARGET_PLATFORM", "GHS_PRIMARY_TARGET", "GHS_TOOLSET_ROOT", + "GHS_OS_ROOT", "GHS_OS_DIR", "GHS_BSP_NAME" +}; + static void writeProperty(FILE* fout, std::string const& targetName, std::string const& prop, std::string const& value) { @@ -869,6 +875,16 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv, projectName = "CMAKE_TRY_COMPILE"; } + if (this->Makefile->GetState()->UseGhsMultiIDE()) { + // Forward the GHS variables to the inner project cache. + for (std::string const& var : ghs_platform_vars) { + if (const char* val = this->Makefile->GetDefinition(var)) { + std::string flag = "-D" + var + "=" + val; + cmakeFlags.push_back(std::move(flag)); + } + } + } + bool erroroc = cmSystemTools::GetErrorOccuredFlag(); cmSystemTools::ResetErrorOccuredFlag(); std::string output; diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 25a4d21..82543e7 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -11,6 +11,7 @@ #include "cmGhsMultiTargetGenerator.h" #include "cmLocalGhsMultiGenerator.h" #include "cmMakefile.h" +#include "cmState.h" #include "cmVersion.h" #include "cmake.h" @@ -21,6 +22,7 @@ const char* cmGlobalGhsMultiGenerator::DEFAULT_TOOLSET_ROOT = "C:/ghs"; cmGlobalGhsMultiGenerator::cmGlobalGhsMultiGenerator(cmake* cm) : cmGlobalGenerator(cm) { + cm->GetState()->SetGhsMultiIDE(true); } cmGlobalGhsMultiGenerator::~cmGlobalGhsMultiGenerator() diff --git a/Source/cmState.cxx b/Source/cmState.cxx index f664000..94a84e5 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -593,6 +593,16 @@ bool cmState::UseWindowsVSIDE() const return this->WindowsVSIDE; } +void cmState::SetGhsMultiIDE(bool ghsMultiIDE) +{ + this->GhsMultiIDE = ghsMultiIDE; +} + +bool cmState::UseGhsMultiIDE() const +{ + return this->GhsMultiIDE; +} + void cmState::SetWatcomWMake(bool watcomWMake) { this->WatcomWMake = watcomWMake; diff --git a/Source/cmState.h b/Source/cmState.h index abe93ed..b60eece 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -154,6 +154,8 @@ public: bool UseWindowsShell() const; void SetWindowsVSIDE(bool windowsVSIDE); bool UseWindowsVSIDE() const; + void SetGhsMultiIDE(bool ghsMultiIDE); + bool UseGhsMultiIDE() const; void SetWatcomWMake(bool watcomWMake); bool UseWatcomWMake() const; void SetMinGWMake(bool minGWMake); @@ -206,6 +208,7 @@ private: bool IsGeneratorMultiConfig = false; bool WindowsShell = false; bool WindowsVSIDE = false; + bool GhsMultiIDE = false; bool WatcomWMake = false; bool MinGWMake = false; bool NMake = false; diff --git a/Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt b/Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt index 1436cbb..4a3f5c2 100644 --- a/Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt +++ b/Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt @@ -14,14 +14,12 @@ file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test.c ) message("Building project") +set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR}/build ${CMAKE_CURRENT_BINARY_DIR}/src test - CMAKE_FLAGS -DGHS_BSP_NAME=${GHS_BSP_NAME} - -DGHS_OS_ROOT=${GHS_OS_ROOT} - -DGHS_TOOLSET_ROOT=${GHS_TOOLSET_ROOT} - -DGHS_TARGET_PLATFORM=${GHS_TARGET_PLATFORM} + CMAKE_FLAGS -DRUN_TEST=${RUN_TEST} -DCMAKE_BUILD_TYPE=${RUN_TEST_BUILD_TYPE} OUTPUT_VARIABLE OUTPUT) diff --git a/Tests/GhsMulti/GhsMultiCopyFile/CMakeLists.txt b/Tests/GhsMulti/GhsMultiCopyFile/CMakeLists.txt index 46d833b..d6d007d 100644 --- a/Tests/GhsMulti/GhsMultiCopyFile/CMakeLists.txt +++ b/Tests/GhsMulti/GhsMultiCopyFile/CMakeLists.txt @@ -9,11 +9,6 @@ set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR}/build ${CMAKE_CURRENT_SOURCE_DIR}/test.c - CMAKE_FLAGS -DGHS_BSP_NAME=${GHS_BSP_NAME} - -DGHS_OS_ROOT=${GHS_OS_ROOT} - -DGHS_OS_DIR=${GHS_OS_DIR} - -DGHS_TOOLSET_ROOT=${GHS_TOOLSET_ROOT} - -DGHS_TARGET_PLATFORM=${GHS_TARGET_PLATFORM} OUTPUT_VARIABLE OUTPUT COPY_FILE "${CMAKE_CURRENT_BINARY_DIR}/test_library" ) diff --git a/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt b/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt index 9b23493..dfb72ce 100644 --- a/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt +++ b/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt @@ -25,11 +25,7 @@ try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR}/link_build ${CMAKE_CURRENT_BINARY_DIR}/link_src test - CMAKE_FLAGS -DGHS_BSP_NAME=${GHS_BSP_NAME} - -DGHS_OS_ROOT=${GHS_OS_ROOT} - -DGHS_OS_DIR=${GHS_OS_DIR} - -DGHS_TOOLSET_ROOT=${GHS_TOOLSET_ROOT} - -DGHS_TARGET_PLATFORM=${GHS_TARGET_PLATFORM} + CMAKE_FLAGS -DRUN_TEST=${RUN_TEST} -DCMAKE_EXE_LINKER_FLAGS=${CMAKE_EXE_LINKER_FLAGS} OUTPUT_VARIABLE OUTPUT) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4a1ec0de3d2102918284eff13763f2aa3d20d119 commit 4a1ec0de3d2102918284eff13763f2aa3d20d119 Author: Fred Baksik AuthorDate: Tue Jan 8 12:15:59 2019 -0500 Commit: Fred Baksik CommitDate: Wed Jan 16 10:41:56 2019 -0500 GHS: Fix toolset selection -- Allow -T to accept full or partial paths -- Use "C:/ghs" if GHS_TOOLSET_ROOT is empty string -- Put more information in error messages diff --git a/Help/generator/Green Hills MULTI.rst b/Help/generator/Green Hills MULTI.rst index f382f6f..2794598 100644 --- a/Help/generator/Green Hills MULTI.rst +++ b/Help/generator/Green Hills MULTI.rst @@ -12,9 +12,10 @@ The ``-A `` can be supplied for setting the target architecture. ```` usually is one of "arm", "ppc", "86", etcetera. If the target architecture is not specified then the default architecture of "arm" will be used. -The ``-T `` can be supplied for setting the toolset to be used. -All toolsets are expected to be located at ``GHS_TOOLSET_ROOT``. -If the toolset is not specified then the latest toolset will be used. +The ``-T `` option can be used to set the directory location of the toolset. +Both absolute and relative paths are valid. Relative paths use ``GHS_TOOLSET_ROOT`` +as the root. If the toolset is not specified then the latest toolset found in +``GHS_TOOLSET_ROOT`` will be used. * ``GHS_TARGET_PLATFORM`` @@ -30,7 +31,7 @@ If the toolset is not specified then the latest toolset will be used. * ``GHS_TOOLSET_ROOT`` - | Root path for ``toolset``. + | Root path for ``toolset`` searches. | Defaults to ``C:/ghs``. * ``GHS_OS_ROOT`` diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 664d967..25a4d21 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -55,43 +55,44 @@ void cmGlobalGhsMultiGenerator::ComputeTargetObjectDirectory( bool cmGlobalGhsMultiGenerator::SetGeneratorToolset(std::string const& ts, cmMakefile* mf) { - std::string tsp; /* toolset path */ - std::string tsn = ts; /* toolset name */ + std::string tsp; /* toolset path */ - GetToolset(mf, tsp, tsn); + this->GetToolset(mf, tsp, ts); /* no toolset was found */ - if (tsn.empty()) { + if (tsp.empty()) { return false; } else if (ts.empty()) { std::string message; message = "Green Hills MULTI: -T not specified; defaulting to \""; - message += tsn; + message += tsp; message += "\""; cmSystemTools::Message(message.c_str()); - /* store the toolset for later use + /* store the full toolset for later use * -- already done if -T was specified */ - mf->AddCacheDefinition("CMAKE_GENERATOR_TOOLSET", tsn.c_str(), - "Name of generator toolset.", + mf->AddCacheDefinition("CMAKE_GENERATOR_TOOLSET", tsp.c_str(), + "Location of generator toolset.", cmStateEnums::INTERNAL); } /* set the build tool to use */ + std::string gbuild(tsp + ((tsp.back() == '/') ? "" : "/") + + DEFAULT_BUILD_PROGRAM); const char* prevTool = mf->GetDefinition("CMAKE_MAKE_PROGRAM"); - std::string gbuild(tsp + "/" + tsn + "/" + DEFAULT_BUILD_PROGRAM); /* check if the toolset changed from last generate */ if (prevTool != NULL && (gbuild != prevTool)) { - std::string message = "generator toolset: "; + std::string message = "toolset build tool: "; message += gbuild; - message += "\nDoes not match the toolset used previously: "; + message += "\nDoes not match the previously used build tool: "; message += prevTool; message += "\nEither remove the CMakeCache.txt file and CMakeFiles " "directory or choose a different binary directory."; cmSystemTools::Error(message.c_str()); + return false; } else { /* store the toolset that is being used for this build */ mf->AddCacheDefinition("CMAKE_MAKE_PROGRAM", gbuild.c_str(), @@ -99,7 +100,7 @@ bool cmGlobalGhsMultiGenerator::SetGeneratorToolset(std::string const& ts, true); } - mf->AddDefinition("CMAKE_SYSTEM_VERSION", tsn.c_str()); + mf->AddDefinition("CMAKE_SYSTEM_VERSION", tsp.c_str()); // FIXME: compiler detection not implemented // gbuild uses the primaryTarget setting in the top-level project @@ -172,11 +173,11 @@ bool cmGlobalGhsMultiGenerator::FindMakeProgram(cmMakefile* /*mf*/) } void cmGlobalGhsMultiGenerator::GetToolset(cmMakefile* mf, std::string& tsd, - std::string& ts) + const std::string& ts) { const char* ghsRoot = mf->GetDefinition("GHS_TOOLSET_ROOT"); - if (!ghsRoot) { + if (!ghsRoot || ghsRoot[0] == '\0') { ghsRoot = DEFAULT_TOOLSET_ROOT; } tsd = ghsRoot; @@ -185,20 +186,29 @@ void cmGlobalGhsMultiGenerator::GetToolset(cmMakefile* mf, std::string& tsd, std::vector output; // Use latest? version + if (tsd.back() != '/') { + tsd += "/"; + } cmSystemTools::Glob(tsd, "comp_[^;]+", output); if (output.empty()) { - cmSystemTools::Error("GHS toolset not found in ", tsd.c_str()); - ts = ""; + std::string msg = + "No GHS toolsets found in GHS_TOOLSET_ROOT \"" + tsd + "\"."; + cmSystemTools::Error(msg.c_str()); + tsd = ""; } else { - ts = output.back(); + tsd += output.back(); } } else { - std::string tryPath = tsd + std::string("/") + ts; + std::string tryPath; + /* CollapseCombinedPath will check if ts is an absolute path */ + tryPath = cmSystemTools::CollapseCombinedPath(tsd, ts); if (!cmSystemTools::FileExists(tryPath)) { - cmSystemTools::Error("GHS toolset \"", ts.c_str(), "\" not found in ", - tsd.c_str()); - ts = ""; + std::string msg = "GHS toolset \"" + tryPath + "\" not found."; + cmSystemTools::Error(msg.c_str()); + tsd = ""; + } else { + tsd = tryPath; } } } diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h index d926575..9332567 100644 --- a/Source/cmGlobalGhsMultiGenerator.h +++ b/Source/cmGlobalGhsMultiGenerator.h @@ -99,7 +99,7 @@ protected: std::vector()) override; private: - void GetToolset(cmMakefile* mf, std::string& tsd, std::string& ts); + void GetToolset(cmMakefile* mf, std::string& tsd, const std::string& ts); /* top-level project */ void OutputTopLevelProject(cmLocalGenerator* root, https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1a66acdef268865e5816bd56176274034769b1b5 commit 1a66acdef268865e5816bd56176274034769b1b5 Author: Fred Baksik AuthorDate: Sat Jan 5 15:10:24 2019 -0500 Commit: Fred Baksik CommitDate: Wed Jan 16 10:41:53 2019 -0500 GHS: Append ".gpj" to target name when generating build command -- Add test demonstrating issue -- In the case of executable targets the target name is usually the same as used in "-o filename" But for static libraries the target name is usually "-o libname.a" "gbuild.exe target" will build whatever target matches against even the output from the compiler or linker But the targets in "cmake --build . --target name" should be target names in CMakeLists.txt not the actual filenames So change the "name" to "name.gpj" so it matches the target name in CMakeLists.txt. Fixes #15975 diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index e850e05..664d967 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -413,7 +413,11 @@ void cmGlobalGhsMultiGenerator::GenerateBuildCommand( if (targetName == "clean") { makeCommand.push_back("-clean"); } else { - makeCommand.push_back(targetName); + if (targetName.compare(targetName.size() - 4, 4, ".gpj") == 0) { + makeCommand.push_back(targetName); + } else { + makeCommand.push_back(targetName + ".gpj"); + } } } } diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 99f5a8f..7c48d04 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -2316,6 +2316,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release "${CMAKE_CMAKE_COMMAND} -P ${CMake_SOURCE_DIR}/Tests/GhsMulti/GhsMultiMultipleProjects/verify.cmake") add_test_GhsMulti(compiler_options_none GhsMultiCompilerOptions None "-DRUN_TEST=RELEASE_FLAGS -DRUN_TEST_BUILD_TYPE=\"\"" "") add_test_GhsMulti(compiler_options_kernel GhsMultiCompilerOptions Kernel "-DRUN_TEST=KERNEL_FLAGS -DRUN_TEST_BUILD_TYPE=DEBUG" "") + add_test_GhsMulti(try_compile_copy GhsMultiCopyFile "" "" "") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/GhsMulti/${ghs_config_name}") #unset ghs config variables unset(ghs_config_name) diff --git a/Tests/GhsMulti/GhsMultiCopyFile/CMakeLists.txt b/Tests/GhsMulti/GhsMultiCopyFile/CMakeLists.txt new file mode 100644 index 0000000..46d833b --- /dev/null +++ b/Tests/GhsMulti/GhsMultiCopyFile/CMakeLists.txt @@ -0,0 +1,35 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +cmake_minimum_required(VERSION 3.12 FATAL_ERROR) + +project(test C) + +set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) +try_compile(RESULT + ${CMAKE_CURRENT_BINARY_DIR}/build + ${CMAKE_CURRENT_SOURCE_DIR}/test.c + CMAKE_FLAGS -DGHS_BSP_NAME=${GHS_BSP_NAME} + -DGHS_OS_ROOT=${GHS_OS_ROOT} + -DGHS_OS_DIR=${GHS_OS_DIR} + -DGHS_TOOLSET_ROOT=${GHS_TOOLSET_ROOT} + -DGHS_TARGET_PLATFORM=${GHS_TARGET_PLATFORM} + OUTPUT_VARIABLE OUTPUT + COPY_FILE "${CMAKE_CURRENT_BINARY_DIR}/test_library" +) + +message(STATUS "Output from build:\n${OUTPUT}") + +if(NOT RESULT) + message(SEND_ERROR "try_compile() failed") +endif() + +if(EXISTS "${CMAKE_CURRENT_BINARY_DIR}/test_library") + if (IS_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test_library") + message(SEND_ERROR "library is folder !") + else() + message(STATUS "library seems okay") + endif() +else() + message(SEND_ERROR "library is not found !") +endif() diff --git a/Tests/GhsMulti/GhsMultiCopyFile/test.c b/Tests/GhsMulti/GhsMultiCopyFile/test.c new file mode 100644 index 0000000..5c657b5 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiCopyFile/test.c @@ -0,0 +1,4 @@ +int lib(int x) +{ + return -x; +} https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0c9e47d7cdb498f9bc29231587030e0840c9f00c commit 0c9e47d7cdb498f9bc29231587030e0840c9f00c Author: Fred Baksik AuthorDate: Sat Jan 5 11:01:23 2019 -0500 Commit: Fred Baksik CommitDate: Wed Jan 16 10:41:49 2019 -0500 GHS: Integrity Application updates -- Check the property "ghs_integrity_app" on executables to set [INTEGRITY Application] If the property is not set then check if an integrate file is one of the source files (.int file). Dynamic Downloads that do not have an integrate file can use this property along with setting the compiler flag "-dynamic". -- Remove parsing for -dynamic flag; it is only used to print a comment The MULTI GUI will show if it is a Monolith or Dynamic Download application -- Use project references to specify which executables are part of the Integrity Application Usually Implicit Dependency Analysis will ensure that executable targets become part of the application. This does not work for Dynamic Download without integrate files. Use `add_dependencies(dd vas)` to mark that the vas target is part of dd target. -- Update file locations in the Integrate files. diff --git a/Help/generator/Green Hills MULTI.rst b/Help/generator/Green Hills MULTI.rst index 4ee1427..f382f6f 100644 --- a/Help/generator/Green Hills MULTI.rst +++ b/Help/generator/Green Hills MULTI.rst @@ -18,37 +18,46 @@ If the toolset is not specified then the latest toolset will be used. * ``GHS_TARGET_PLATFORM`` -Default to ``integrity``. -Usual values are ``integrity``, ``threadx``, ``uvelosity``, -``velosity``, ``vxworks``, ``standalone``. + | Defaults to ``integrity``. + | Usual values are ``integrity``, ``threadx``, ``uvelosity``, ``velosity``, + ``vxworks``, ``standalone``. + * ``GHS_PRIMARY_TARGET`` -Sets ``primaryTarget`` field in project file. -Defaults to ``_.tgt``. + | Sets ``primaryTarget`` entry in project file. + | Defaults to ``_.tgt``. * ``GHS_TOOLSET_ROOT`` -Default to ``C:/ghs``. Root path for ``toolset``. + | Root path for ``toolset``. + | Defaults to ``C:/ghs``. * ``GHS_OS_ROOT`` -Default to ``C:/ghs``. Root path for RTOS searches. + | Root path for RTOS searches. + | Defaults to ``C:/ghs``. * ``GHS_OS_DIR`` -Default to latest platform OS installation at ``GHS_OS_ROOT``. Set this value if -a specific RTOS is to be used. + | Sets ``-os_dir`` entry in project file. + | Defaults to latest platform OS installation at ``GHS_OS_ROOT``. Set this value if + a specific RTOS is to be used. * ``GHS_BSP_NAME`` -Defaults to ``sim`` if not set by user. + | Sets ``-bsp`` entry in project file. + | Defaults to ``sim`` for ``integrity`` platforms. Customizations are available through the following cache variables: * ``GHS_CUSTOMIZATION`` * ``GHS_GPJ_MACROS`` +The following properties are available: + +* :prop_tgt:`GHS_INTEGRITY_APP` + .. note:: This generator is deemed experimental as of CMake |release| and is still a work in progress. Future versions of CMake diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index df8f12c..3a80887 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -193,6 +193,7 @@ Properties on Targets /prop_tgt/FRAMEWORK /prop_tgt/FRAMEWORK_VERSION /prop_tgt/GENERATOR_FILE_NAME + /prop_tgt/GHS_INTEGRITY_APP /prop_tgt/GNUtoMS /prop_tgt/HAS_CXX /prop_tgt/IMPLICIT_DEPENDS_INCLUDE_TRANSFORM diff --git a/Help/prop_tgt/GHS_INTEGRITY_APP.rst b/Help/prop_tgt/GHS_INTEGRITY_APP.rst new file mode 100644 index 0000000..7643038 --- /dev/null +++ b/Help/prop_tgt/GHS_INTEGRITY_APP.rst @@ -0,0 +1,10 @@ +GHS_INTEGRITY_APP +----------------- + +``ON`` / ``OFF`` boolean to determine if an executable target should +be treated as an `Integrity Application`. + +If no value is set and if a `.int` file is added as a source file to the +executable target it will be treated as an `Integrity Application`. + +Supported on :generator:`Green Hills MULTI`. diff --git a/Help/variable/GHS-MULTI.rst b/Help/variable/GHS-MULTI.rst index 0f91be8..fe3b17e 100644 --- a/Help/variable/GHS-MULTI.rst +++ b/Help/variable/GHS-MULTI.rst @@ -1,4 +1,4 @@ GHS-MULTI --------- -True when using Green Hills MULTI +``True`` when using :generator:`Green Hills MULTI` generator. diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index 8da21c6..4588901 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -13,15 +13,11 @@ #include "cmSourceGroup.h" #include "cmTarget.h" -std::string const cmGhsMultiTargetGenerator::DDOption("-dynamic"); - cmGhsMultiTargetGenerator::cmGhsMultiTargetGenerator(cmGeneratorTarget* target) : GeneratorTarget(target) , LocalGenerator( static_cast(target->GetLocalGenerator())) , Makefile(target->Target->GetMakefile()) - , TargetGroup(DetermineIfTargetGroup(target)) - , DynamicDownload(false) , Name(target->GetName()) { // Store the configuration name that is being used @@ -50,8 +46,7 @@ void cmGhsMultiTargetGenerator::Generate() this->GeneratorTarget->GetExecutableNames( targetName, this->TargetNameReal, targetNameImport, targetNamePDB, this->ConfigName); - if (cmGhsMultiTargetGenerator::DetermineIfTargetGroup( - this->GeneratorTarget)) { + if (cmGhsMultiTargetGenerator::DetermineIfIntegrityApp()) { this->TagType = GhsMultiGpj::INTERGRITY_APPLICATION; } else { this->TagType = GhsMultiGpj::PROGRAM; @@ -126,11 +121,7 @@ void cmGhsMultiTargetGenerator::GenerateTarget() const std::string language( this->GeneratorTarget->GetLinkerLanguage(this->ConfigName)); - this->DynamicDownload = - this->DetermineIfDynamicDownload(this->ConfigName, language); - if (this->DynamicDownload) { - fout << "#component integrity_dynamic_download" << std::endl; - } + this->WriteTargetSpecifics(fout, this->ConfigName); this->SetCompilerFlags(this->ConfigName, language); this->WriteCompilerFlags(fout, this->ConfigName, language); @@ -139,7 +130,7 @@ void cmGhsMultiTargetGenerator::GenerateTarget() this->WriteTargetLinkLine(fout, this->ConfigName); this->WriteCustomCommands(fout); this->WriteSources(fout); - + this->WriteReferences(fout); fout.Close(); } @@ -541,36 +532,49 @@ void cmGhsMultiTargetGenerator::WriteObjectLangOverride( } } } - -bool cmGhsMultiTargetGenerator::DetermineIfTargetGroup( - const cmGeneratorTarget* target) +void cmGhsMultiTargetGenerator::WriteReferences(std::ostream& fout) { - bool output = false; - std::vector sources; - std::string config = - target->Target->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE"); - target->GetSourceFiles(sources, config); - for (std::vector::const_iterator sources_i = sources.begin(); - sources.end() != sources_i; ++sources_i) { - if ("int" == (*sources_i)->GetExtension()) { - output = true; - } + // This only applies to INTEGRITY Applications + if (this->TagType != GhsMultiGpj::INTERGRITY_APPLICATION) { + return; + } + + // Get the targets that this one depends upon + cmTargetDependSet unordered = + this->GetGlobalGenerator()->GetTargetDirectDepends(this->GeneratorTarget); + cmGlobalGhsMultiGenerator::OrderedTargetDependSet ordered(unordered, + this->Name); + for (auto& t : ordered) { + std::string tname = t->GetName(); + std::string tpath = t->LocalGenerator->GetCurrentBinaryDirectory(); + std::string rootpath = this->LocalGenerator->GetCurrentBinaryDirectory(); + std::string outpath = + this->LocalGenerator->ConvertToRelativePath(rootpath, tpath) + "/" + + tname + "REF" + cmGlobalGhsMultiGenerator::FILE_EXTENSION; + + fout << outpath; + fout << " "; + GhsMultiGpj::WriteGpjTag(GhsMultiGpj::REFERENCE, fout); + + // Tell the global generator that a refernce project needs to be created + t->Target->SetProperty("GHS_REFERENCE_PROJECT", "ON"); } - return output; } -bool cmGhsMultiTargetGenerator::DetermineIfDynamicDownload( - std::string const& config, const std::string& language) +bool cmGhsMultiTargetGenerator::DetermineIfIntegrityApp(void) { - std::vector options; - bool output = false; - this->GeneratorTarget->GetCompileOptions(options, config, language); - for (std::vector::const_iterator options_i = options.begin(); - options_i != options.end(); ++options_i) { - std::string option = *options_i; - if (this->DDOption == option) { - output = true; + const char* p = this->GeneratorTarget->GetProperty("ghs_integrity_app"); + if (p) { + return cmSystemTools::IsOn( + this->GeneratorTarget->GetProperty("ghs_integrity_app")); + } else { + std::vector sources; + this->GeneratorTarget->GetSourceFiles(sources, this->ConfigName); + for (auto& sf : sources) { + if ("int" == sf->GetExtension()) { + return true; + } } + return false; } - return output; } diff --git a/Source/cmGhsMultiTargetGenerator.h b/Source/cmGhsMultiTargetGenerator.h index 0ab5cc3..a241cc6 100644 --- a/Source/cmGhsMultiTargetGenerator.h +++ b/Source/cmGhsMultiTargetGenerator.h @@ -29,8 +29,6 @@ private: void GenerateTarget(); - bool IsTargetGroup() const { return this->TargetGroup; } - void WriteTargetSpecifics(std::ostream& fout, const std::string& config); void WriteCompilerFlags(std::ostream& fout, const std::string& config, @@ -54,19 +52,14 @@ private: void WriteSources(std::ostream& fout_proj); void WriteSourceProperty(std::ostream& fout, const cmSourceFile* sf, std::string propName, std::string propFlag); + void WriteReferences(std::ostream& fout); static void WriteObjectLangOverride(std::ostream& fout, const cmSourceFile* sourceFile); - static bool DetermineIfTargetGroup(const cmGeneratorTarget* target); - bool DetermineIfDynamicDownload(std::string const& config, - const std::string& language); - + bool DetermineIfIntegrityApp(void); cmGeneratorTarget* GeneratorTarget; cmLocalGhsMultiGenerator* LocalGenerator; cmMakefile* Makefile; - bool TargetGroup; - bool DynamicDownload; - static std::string const DDOption; std::map FlagsByLanguage; std::map DefinesByLanguage; diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 85c2345..a5c90bf 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -302,7 +302,8 @@ bool cmGlobalGenerator::CheckTargetsForMissingSources() const for (cmGeneratorTarget* target : targets) { if (target->GetType() == cmStateEnums::TargetType::GLOBAL_TARGET || target->GetType() == cmStateEnums::TargetType::INTERFACE_LIBRARY || - target->GetType() == cmStateEnums::TargetType::UTILITY) { + target->GetType() == cmStateEnums::TargetType::UTILITY || + cmSystemTools::IsOn(target->GetProperty("ghs_integrity_app"))) { continue; } diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index f2f43e3..e850e05 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -315,8 +315,26 @@ void cmGlobalGhsMultiGenerator::WriteSubProjects( if (cmSystemTools::IsOn(target->GetProperty("EXCLUDE_FROM_ALL"))) { fout << "{comment} "; } - fout << dir << projName << FILE_EXTENSION; + std::string projFile = dir + projName + FILE_EXTENSION; + fout << projFile; fout << " " << projType << std::endl; + + if (cmSystemTools::IsOn(target->GetProperty("GHS_REFERENCE_PROJECT"))) { + // create reference project + std::string fname = dir; + fname += target->GetName(); + fname += "REF"; + fname += FILE_EXTENSION; + + cmGeneratedFileStream fref(fname.c_str()); + fref.SetCopyIfDifferent(true); + + this->WriteFileHeader(fref); + GhsMultiGpj::WriteGpjTag(GhsMultiGpj::REFERENCE, fref); + fref << " :reference=" << projFile << std::endl; + + fref.Close(); + } } } } diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index f06bfbf..99f5a8f 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -2292,6 +2292,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release if (NOT ghs_skip_integrity AND (NOT ghs_target_platform OR ghs_target_platform MATCHES "integrity")) add_test_GhsMulti(integrityDDInt GhsMultiIntegrity/GhsMultiIntegrityDDInt "" "" "") add_test_GhsMulti(integrityMonolith GhsMultiIntegrity/GhsMultiIntegrityMonolith "" "" "") + add_test_GhsMulti(integrityDD GhsMultiIntegrity/GhsMultiIntegrityDD "" "" "") endif () add_test_GhsMulti(duplicate_source_filenames GhsMultiDuplicateSourceFilenames "" "" "") add_test_GhsMulti_rename_install(SINGLE_EXEC) diff --git a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDD/CMakeLists.txt b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDD/CMakeLists.txt new file mode 100644 index 0000000..3d0642d --- /dev/null +++ b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDD/CMakeLists.txt @@ -0,0 +1,17 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +cmake_minimum_required(VERSION 3.12 FATAL_ERROR) + +project(test C) + +# create virtual AS +add_executable(vas exe.c) +target_link_libraries(vas lib) +add_library(lib func.c) + +# create dynamic download INTEGRITY application +add_executable(dynamic) +set_target_properties(dynamic PROPERTIES ghs_integrity_app ON) +target_compile_options(dynamic PRIVATE -dynamic) +add_dependencies(dynamic vas) diff --git a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDD/exe.c b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDD/exe.c new file mode 100644 index 0000000..29ad70a --- /dev/null +++ b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDD/exe.c @@ -0,0 +1,5 @@ +extern int func(void); +int main(void) +{ + return func(); +} diff --git a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDD/func.c b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDD/func.c new file mode 100644 index 0000000..b35e9cc --- /dev/null +++ b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDD/func.c @@ -0,0 +1,4 @@ +int func(void) +{ + return 2; +} diff --git a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/Int/AppDD.int b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/Int/AppDD.int index 9e22b5e..5035d58 100644 --- a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/Int/AppDD.int +++ b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/Int/AppDD.int @@ -7,6 +7,6 @@ Kernel EndKernel AddressSpace App - Filename "App/App.as" + Filename "App/App" Language C EndAddressSpace diff --git a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/test.int b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/test.int index 161345b..361793a 100644 --- a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/test.int +++ b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/test.int @@ -1,8 +1,8 @@ Kernel - Filename kernel/kernel.as + Filename kernel EndKernel AddressSpace App - Filename "vas/vas.as" + Filename vas Language C EndAddressSpace https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=80443184317e97999da63d71549aa1b89997dc3d commit 80443184317e97999da63d71549aa1b89997dc3d Author: Fred Baksik AuthorDate: Sat Jan 5 11:01:23 2019 -0500 Commit: Fred Baksik CommitDate: Wed Jan 16 10:41:45 2019 -0500 GHS: Add support for some of the source file properties -- INCLUDE_DIRECTORIES, COMPILE_DEFINITIONS, and COMPILE_OPTIONS diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index 72f308a..8da21c6 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -367,6 +367,21 @@ void cmGhsMultiTargetGenerator::WriteCustomCommandsHelper( } } +void cmGhsMultiTargetGenerator::WriteSourceProperty(std::ostream& fout, + const cmSourceFile* sf, + std::string propName, + std::string propFlag) +{ + const char* prop = sf->GetProperty(propName); + if (prop) { + std::vector list; + cmSystemTools::ExpandListArgument(prop, list); + for (auto& p : list) { + fout << " " << propFlag << p << std::endl; + } + } +} + void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj) { /* vector of all sources for this target */ @@ -494,6 +509,11 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj) "bsp" != si->GetExtension()) { this->WriteObjectLangOverride(*fout, si); } + + this->WriteSourceProperty(*fout, si, "INCLUDE_DIRECTORIES", "-I"); + this->WriteSourceProperty(*fout, si, "COMPILE_DEFINITIONS", "-D"); + this->WriteSourceProperty(*fout, si, "COMPILE_OPTIONS", ""); + /* to avoid clutter in the gui only print out the objectName if it has * been renamed */ std::string objectName = this->GeneratorTarget->GetObjectName(si); diff --git a/Source/cmGhsMultiTargetGenerator.h b/Source/cmGhsMultiTargetGenerator.h index c713cc4..0ab5cc3 100644 --- a/Source/cmGhsMultiTargetGenerator.h +++ b/Source/cmGhsMultiTargetGenerator.h @@ -52,7 +52,8 @@ private: std::ostream& fout, std::vector const& commandsSet, cmTarget::CustomCommandType commandType); void WriteSources(std::ostream& fout_proj); - + void WriteSourceProperty(std::ostream& fout, const cmSourceFile* sf, + std::string propName, std::string propFlag); static void WriteObjectLangOverride(std::ostream& fout, const cmSourceFile* sourceFile); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=73092b2213495e06ef2ecfbf5fcca850874d6c88 commit 73092b2213495e06ef2ecfbf5fcca850874d6c88 Author: Fred Baksik AuthorDate: Sat Jan 5 11:01:22 2019 -0500 Commit: Fred Baksik CommitDate: Wed Jan 16 10:41:42 2019 -0500 GHS: Add support for object libraries diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index 5e6224f..72f308a 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -76,10 +76,15 @@ void cmGhsMultiTargetGenerator::Generate() return; } case cmStateEnums::OBJECT_LIBRARY: { - std::string msg = "add_library( OBJECT ...) not supported: "; - msg += this->Name; - cmSystemTools::Message(msg.c_str()); - return; + std::string targetName; + std::string targetNameSO; + std::string targetNameImport; + std::string targetNamePDB; + this->GeneratorTarget->GetLibraryNames( + targetName, targetNameSO, this->TargetNameReal, targetNameImport, + targetNamePDB, this->ConfigName); + this->TagType = GhsMultiGpj::SUBPROJECT; + break; } case cmStateEnums::MODULE_LIBRARY: { std::string msg = "add_library( MODULE ...) not supported: "; @@ -151,11 +156,13 @@ void cmGhsMultiTargetGenerator::WriteTargetSpecifics(std::ostream& fout, std::string outpath; std::string rootpath = this->LocalGenerator->GetCurrentBinaryDirectory(); - // set target binary file destination - outpath = this->GeneratorTarget->GetDirectory(config); - outpath = this->LocalGenerator->ConvertToRelativePath(rootpath, outpath); - fout << " :binDirRelative=\"" << outpath << "\"" << std::endl; - fout << " -o \"" << this->TargetNameReal << "\"" << std::endl; + if (this->TagType != GhsMultiGpj::SUBPROJECT) { + // set target binary file destination + outpath = this->GeneratorTarget->GetDirectory(config); + outpath = this->LocalGenerator->ConvertToRelativePath(rootpath, outpath); + fout << " :binDirRelative=\"" << outpath << "\"" << std::endl; + fout << " -o \"" << this->TargetNameReal << "\"" << std::endl; + } // set target object file destination outpath = this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget); @@ -360,52 +367,6 @@ void cmGhsMultiTargetGenerator::WriteCustomCommandsHelper( } } -std::map -cmGhsMultiTargetGenerator::GetObjectNames( - std::vector* const objectSources, - cmLocalGhsMultiGenerator* const localGhsMultiGenerator, - cmGeneratorTarget* const generatorTarget) -{ - std::map> filenameToSource; - std::map sourceToFilename; - for (std::vector::const_iterator sf = objectSources->begin(); - sf != objectSources->end(); ++sf) { - const std::string filename = - cmSystemTools::GetFilenameName((*sf)->GetFullPath()); - const std::string lower_filename = cmSystemTools::LowerCase(filename); - filenameToSource[lower_filename].push_back(*sf); - sourceToFilename[*sf] = lower_filename; - } - - std::vector duplicateSources; - for (std::map>::const_iterator - msvSourceI = filenameToSource.begin(); - msvSourceI != filenameToSource.end(); ++msvSourceI) { - if (msvSourceI->second.size() > 1) { - duplicateSources.insert(duplicateSources.end(), - msvSourceI->second.begin(), - msvSourceI->second.end()); - } - } - - std::map objectNamesCorrected; - - for (std::vector::const_iterator sf = - duplicateSources.begin(); - sf != duplicateSources.end(); ++sf) { - std::string const longestObjectDirectory( - cmGhsMultiTargetGenerator::ComputeLongestObjectDirectory( - localGhsMultiGenerator, generatorTarget, *sf)); - std::string objFilenameName = - localGhsMultiGenerator->GetObjectFileNameWithoutTarget( - **sf, longestObjectDirectory); - cmsys::SystemTools::ReplaceString(objFilenameName, "/", "_"); - objectNamesCorrected[*sf] = objFilenameName; - } - - return objectNamesCorrected; -} - void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj) { /* vector of all sources for this target */ @@ -473,11 +434,6 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj) }); } - /* get all the object names for these sources */ - std::map objectNames = - cmGhsMultiTargetGenerator::GetObjectNames(&sources, this->LocalGenerator, - this->GeneratorTarget); - /* list of open project files */ std::vector gfiles; @@ -537,10 +493,13 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj) if ("ld" != si->GetExtension() && "int" != si->GetExtension() && "bsp" != si->GetExtension()) { this->WriteObjectLangOverride(*fout, si); - if (objectNames.end() != objectNames.find(si)) { - *fout << " -o \"" << objectNames.find(si)->second << "\"" - << std::endl; - } + } + /* to avoid clutter in the gui only print out the objectName if it has + * been renamed */ + std::string objectName = this->GeneratorTarget->GetObjectName(si); + if (!objectName.empty() && + this->GeneratorTarget->HasExplicitObjectName(si)) { + *fout << " -o " << objectName << std::endl; } } } @@ -563,30 +522,6 @@ void cmGhsMultiTargetGenerator::WriteObjectLangOverride( } } -std::string cmGhsMultiTargetGenerator::ComputeLongestObjectDirectory( - cmLocalGhsMultiGenerator const* localGhsMultiGenerator, - cmGeneratorTarget* const generatorTarget, cmSourceFile* const sourceFile) -{ - std::string dir_max; - dir_max += - localGhsMultiGenerator->GetMakefile()->GetCurrentBinaryDirectory(); - dir_max += "/"; - dir_max += generatorTarget->Target->GetName(); - dir_max += "/"; - std::vector sourceGroups( - localGhsMultiGenerator->GetMakefile()->GetSourceGroups()); - std::string const& sourceFullPath = sourceFile->GetFullPath(); - cmSourceGroup* sourceGroup = - localGhsMultiGenerator->GetMakefile()->FindSourceGroup(sourceFullPath, - sourceGroups); - std::string const& sgPath = sourceGroup->GetFullName(); - dir_max += sgPath; - dir_max += "/Objs/libs/"; - dir_max += generatorTarget->Target->GetName(); - dir_max += "/"; - return dir_max; -} - bool cmGhsMultiTargetGenerator::DetermineIfTargetGroup( const cmGeneratorTarget* target) { diff --git a/Source/cmGhsMultiTargetGenerator.h b/Source/cmGhsMultiTargetGenerator.h index 5d67112..c713cc4 100644 --- a/Source/cmGhsMultiTargetGenerator.h +++ b/Source/cmGhsMultiTargetGenerator.h @@ -52,17 +52,10 @@ private: std::ostream& fout, std::vector const& commandsSet, cmTarget::CustomCommandType commandType); void WriteSources(std::ostream& fout_proj); - static std::map GetObjectNames( - std::vector* objectSources, - cmLocalGhsMultiGenerator* localGhsMultiGenerator, - cmGeneratorTarget* generatorTarget); + static void WriteObjectLangOverride(std::ostream& fout, const cmSourceFile* sourceFile); - static std::string ComputeLongestObjectDirectory( - cmLocalGhsMultiGenerator const* localGhsMultiGenerator, - cmGeneratorTarget* generatorTarget, cmSourceFile* const sourceFile); - static bool DetermineIfTargetGroup(const cmGeneratorTarget* target); bool DetermineIfDynamicDownload(std::string const& config, const std::string& language); diff --git a/Source/cmLocalGhsMultiGenerator.cxx b/Source/cmLocalGhsMultiGenerator.cxx index b539a1c..125e8b5 100644 --- a/Source/cmLocalGhsMultiGenerator.cxx +++ b/Source/cmLocalGhsMultiGenerator.cxx @@ -7,6 +7,7 @@ #include "cmGhsMultiTargetGenerator.h" #include "cmGlobalGhsMultiGenerator.h" #include "cmMakefile.h" +#include "cmSourceFile.h" cmLocalGhsMultiGenerator::cmLocalGhsMultiGenerator(cmGlobalGenerator* gg, cmMakefile* mf) @@ -56,3 +57,44 @@ void cmLocalGhsMultiGenerator::Generate() } } } + +void cmLocalGhsMultiGenerator::ComputeObjectFilenames( + std::map& mapping, + cmGeneratorTarget const* gt) +{ + std::string dir_max; + dir_max += this->GetCurrentBinaryDirectory(); + dir_max += "/"; + dir_max += this->GetTargetDirectory(gt); + dir_max += "/"; + + // Count the number of object files with each name. Note that + // filesystem may not be case sensitive. + std::map counts; + + for (auto const& si : mapping) { + cmSourceFile const* sf = si.first; + std::string objectNameLower = cmSystemTools::LowerCase( + cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath())); + objectNameLower += this->GlobalGenerator->GetLanguageOutputExtension(*sf); + counts[objectNameLower] += 1; + } + + // For all source files producing duplicate names we need unique + // object name computation. + for (auto& si : mapping) { + cmSourceFile const* sf = si.first; + std::string objectName = + cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath()); + objectName += this->GlobalGenerator->GetLanguageOutputExtension(*sf); + + if (counts[cmSystemTools::LowerCase(objectName)] > 1) { + const_cast(gt)->AddExplicitObjectName(sf); + bool keptSourceExtension; + objectName = this->GetObjectFileNameWithoutTarget(*sf, dir_max, + &keptSourceExtension); + cmsys::SystemTools::ReplaceString(objectName, "/", "_"); + } + si.second = objectName; + } +} diff --git a/Source/cmLocalGhsMultiGenerator.h b/Source/cmLocalGhsMultiGenerator.h index 1f55420..d5bec42 100644 --- a/Source/cmLocalGhsMultiGenerator.h +++ b/Source/cmLocalGhsMultiGenerator.h @@ -28,6 +28,10 @@ public: std::string GetTargetDirectory( cmGeneratorTarget const* target) const override; + void ComputeObjectFilenames( + std::map& mapping, + cmGeneratorTarget const* gt = nullptr) override; + private: void GenerateTargetsDepthFirst(cmGeneratorTarget* target, std::vector& remaining); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=14f3ba205989a422f1668073a325b057cece0b32 commit 14f3ba205989a422f1668073a325b057cece0b32 Author: Fred Baksik AuthorDate: Sat Jan 5 11:01:22 2019 -0500 Commit: Fred Baksik CommitDate: Wed Jan 16 10:41:38 2019 -0500 GHS: EXCLUDE_FROM_ALL updates -- Excluded targets should be generated but not included in build ALL -- Use the correct source list for this configuration when writing sources diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index 0cd6312..5e6224f 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -108,56 +108,34 @@ void cmGhsMultiTargetGenerator::Generate() void cmGhsMultiTargetGenerator::GenerateTarget() { - // Skip if empty or not included in build - if (!this->GetSources().empty() && this->IncludeThisTarget()) { - - // Open the filestream in copy-if-different mode. - std::string fname = this->LocalGenerator->GetCurrentBinaryDirectory(); - fname += "/"; - fname += this->Name; - fname += cmGlobalGhsMultiGenerator::FILE_EXTENSION; - cmGeneratedFileStream fout(fname.c_str()); - fout.SetCopyIfDifferent(true); - - this->GetGlobalGenerator()->WriteFileHeader(fout); - GhsMultiGpj::WriteGpjTag(this->TagType, fout); - const std::string language( - this->GeneratorTarget->GetLinkerLanguage(this->ConfigName)); - this->DynamicDownload = - this->DetermineIfDynamicDownload(this->ConfigName, language); - if (this->DynamicDownload) { - fout << "#component integrity_dynamic_download" << std::endl; - } - this->WriteTargetSpecifics(fout, this->ConfigName); - this->SetCompilerFlags(this->ConfigName, language); - this->WriteCompilerFlags(fout, this->ConfigName, language); - this->WriteCompilerDefinitions(fout, this->ConfigName, language); - this->WriteIncludes(fout, this->ConfigName, language); - this->WriteTargetLinkLine(fout, this->ConfigName); - this->WriteCustomCommands(fout); - this->WriteSources(fout); - - fout.Close(); - } -} - -bool cmGhsMultiTargetGenerator::IncludeThisTarget() -{ - bool output = true; - char const* excludeFromAll = - this->GeneratorTarget->GetProperty("EXCLUDE_FROM_ALL"); - if (NULL != excludeFromAll && '1' == excludeFromAll[0] && - '\0' == excludeFromAll[1]) { - output = false; + // Open the filestream in copy-if-different mode. + std::string fname = this->LocalGenerator->GetCurrentBinaryDirectory(); + fname += "/"; + fname += this->Name; + fname += cmGlobalGhsMultiGenerator::FILE_EXTENSION; + cmGeneratedFileStream fout(fname.c_str()); + fout.SetCopyIfDifferent(true); + + this->GetGlobalGenerator()->WriteFileHeader(fout); + GhsMultiGpj::WriteGpjTag(this->TagType, fout); + + const std::string language( + this->GeneratorTarget->GetLinkerLanguage(this->ConfigName)); + this->DynamicDownload = + this->DetermineIfDynamicDownload(this->ConfigName, language); + if (this->DynamicDownload) { + fout << "#component integrity_dynamic_download" << std::endl; } - return output; -} - -std::vector cmGhsMultiTargetGenerator::GetSources() const -{ - std::vector output; - this->GeneratorTarget->GetSourceFiles(output, this->ConfigName); - return output; + this->WriteTargetSpecifics(fout, this->ConfigName); + this->SetCompilerFlags(this->ConfigName, language); + this->WriteCompilerFlags(fout, this->ConfigName, language); + this->WriteCompilerDefinitions(fout, this->ConfigName, language); + this->WriteIncludes(fout, this->ConfigName, language); + this->WriteTargetLinkLine(fout, this->ConfigName); + this->WriteCustomCommands(fout); + this->WriteSources(fout); + + fout.Close(); } cmGlobalGhsMultiGenerator* cmGhsMultiTargetGenerator::GetGlobalGenerator() @@ -431,7 +409,8 @@ cmGhsMultiTargetGenerator::GetObjectNames( void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj) { /* vector of all sources for this target */ - std::vector sources = this->GetSources(); + std::vector sources; + this->GeneratorTarget->GetSourceFiles(sources, this->ConfigName); /* vector of all groups defined for this target * -- but the vector is not expanded with sub groups or in any useful order diff --git a/Source/cmGhsMultiTargetGenerator.h b/Source/cmGhsMultiTargetGenerator.h index 343044a..5d67112 100644 --- a/Source/cmGhsMultiTargetGenerator.h +++ b/Source/cmGhsMultiTargetGenerator.h @@ -24,9 +24,6 @@ public: virtual void Generate(); - bool IncludeThisTarget(); - std::vector GetSources() const; - private: cmGlobalGhsMultiGenerator* GetGlobalGenerator() const; diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 452a610..f2f43e3 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -311,6 +311,10 @@ void cmGlobalGhsMultiGenerator::WriteSubProjects( dir += "/"; } } + + if (cmSystemTools::IsOn(target->GetProperty("EXCLUDE_FROM_ALL"))) { + fout << "{comment} "; + } fout << dir << projName << FILE_EXTENSION; fout << " " << projType << std::endl; } @@ -441,21 +445,6 @@ void cmGlobalGhsMultiGenerator::WriteHighLevelDirectives(std::ostream& fout) } } -bool cmGlobalGhsMultiGenerator::IsTgtForBuild(const cmGeneratorTarget* tgt) -{ - const std::string config = - tgt->Target->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE"); - std::vector tgtSources; - tgt->GetSourceFiles(tgtSources, config); - bool tgtInBuild = true; - char const* excludeFromAll = tgt->GetProperty("EXCLUDE_FROM_ALL"); - if (NULL != excludeFromAll && '1' == excludeFromAll[0] && - '\0' == excludeFromAll[1]) { - tgtInBuild = false; - } - return !tgtSources.empty() && tgtInBuild; -} - std::string cmGlobalGhsMultiGenerator::trimQuotes(std::string const& str) { std::string result; diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h index 71c0b48..d926575 100644 --- a/Source/cmGlobalGhsMultiGenerator.h +++ b/Source/cmGlobalGhsMultiGenerator.h @@ -111,8 +111,6 @@ private: void WriteSubProjects(std::ostream& fout, cmLocalGenerator* root, std::vector& generators); - bool IsTgtForBuild(const cmGeneratorTarget* tgt); - std::string trimQuotes(std::string const& str); static const char* DEFAULT_BUILD_PROGRAM; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=702121c5f3eceeb6b74ede845f1e1297cf113c47 commit 702121c5f3eceeb6b74ede845f1e1297cf113c47 Author: Fred Baksik AuthorDate: Sat Jan 5 11:01:22 2019 -0500 Commit: Fred Baksik CommitDate: Wed Jan 16 10:41:35 2019 -0500 GHS: Use the correct compiler flags for CMAKE_BUILD_TYPE -- Do not use CMAKE_C_FLAGS_RELEASE flags when CMAKE_BUILD_TYPE is empty if CMAKE_BUILD_TYPE was not set the generator would use Release settings this does not match the documented behavior of CMAKE_BUILD_TYPE -- CMAKE_C_FLAGS_ not used when -kernel is present Fixes issue where CMAKE_C_FLAGS_ is ignored when -kernel option is present as a compiler option When the -kernel option is added to an executable it uses a different set of language flags This does not occur -kernel= is used or if it is added as part of a link flag The variables CMAKE__GHS_KERNEL_FLAGS_ are removed NOTE: By default this only added the flag -ldebug which links in the debugger library. -- Separate compiler options by newlines diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index e464b0c..122be3a 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -482,11 +482,6 @@ Variables for Languages /variable/CMAKE_LANG_FLAGS_RELEASE_INIT /variable/CMAKE_LANG_FLAGS_RELWITHDEBINFO /variable/CMAKE_LANG_FLAGS_RELWITHDEBINFO_INIT - /variable/CMAKE_LANG_GHS_KERNEL_FLAGS_CONFIG - /variable/CMAKE_LANG_GHS_KERNEL_FLAGS_DEBUG - /variable/CMAKE_LANG_GHS_KERNEL_FLAGS_MINSIZEREL - /variable/CMAKE_LANG_GHS_KERNEL_FLAGS_RELEASE - /variable/CMAKE_LANG_GHS_KERNEL_FLAGS_RELWITHDEBINFO /variable/CMAKE_LANG_IGNORE_EXTENSIONS /variable/CMAKE_LANG_IMPLICIT_INCLUDE_DIRECTORIES /variable/CMAKE_LANG_IMPLICIT_LINK_DIRECTORIES diff --git a/Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_CONFIG.rst b/Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_CONFIG.rst deleted file mode 100644 index 8ed1c02..0000000 --- a/Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_CONFIG.rst +++ /dev/null @@ -1,5 +0,0 @@ -CMAKE__GHS_KERNEL_FLAGS_ --------------------------------------- - -GHS kernel flags for language ```` when building for the ```` -configuration. diff --git a/Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_DEBUG.rst b/Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_DEBUG.rst deleted file mode 100644 index 4fea67a..0000000 --- a/Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_DEBUG.rst +++ /dev/null @@ -1,5 +0,0 @@ -CMAKE__GHS_KERNEL_FLAGS_DEBUG ------------------------------------ - -This variable is the ``Debug`` variant of the -:variable:`CMAKE__GHS_KERNEL_FLAGS_` variable. diff --git a/Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_MINSIZEREL.rst b/Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_MINSIZEREL.rst deleted file mode 100644 index 31f87f2..0000000 --- a/Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_MINSIZEREL.rst +++ /dev/null @@ -1,5 +0,0 @@ -CMAKE__GHS_KERNEL_FLAGS_MINSIZEREL ----------------------------------------- - -This variable is the ``MinSizeRel`` variant of the -:variable:`CMAKE__GHS_KERNEL_FLAGS_` variable. diff --git a/Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_RELEASE.rst b/Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_RELEASE.rst deleted file mode 100644 index 1acd198..0000000 --- a/Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_RELEASE.rst +++ /dev/null @@ -1,5 +0,0 @@ -CMAKE__GHS_KERNEL_FLAGS_RELEASE -------------------------------------- - -This variable is the ``Release`` variant of the -:variable:`CMAKE__GHS_KERNEL_FLAGS_` variable. diff --git a/Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_RELWITHDEBINFO.rst b/Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_RELWITHDEBINFO.rst deleted file mode 100644 index ac1b6bc..0000000 --- a/Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_RELWITHDEBINFO.rst +++ /dev/null @@ -1,5 +0,0 @@ -CMAKE__GHS_KERNEL_FLAGS_RELWITHDEBINFO --------------------------------------------- - -This variable is the ``RelWithDebInfo`` variant of the -:variable:`CMAKE__GHS_KERNEL_FLAGS_` variable. diff --git a/Modules/Compiler/GHS-C.cmake b/Modules/Compiler/GHS-C.cmake index c30bdec..a825b0b 100644 --- a/Modules/Compiler/GHS-C.cmake +++ b/Modules/Compiler/GHS-C.cmake @@ -8,23 +8,3 @@ string(APPEND CMAKE_C_FLAGS_DEBUG_INIT " -Odebug -g") string(APPEND CMAKE_C_FLAGS_MINSIZEREL_INIT " -Ospace") string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " -O") string(APPEND CMAKE_C_FLAGS_RELWITHDEBINFO_INIT " -O -g") - -set(CMAKE_C_GHS_KERNEL_FLAGS_DEBUG_INIT "-ldebug ${CMAKE_C_FLAGS_DEBUG_INIT}") -set(CMAKE_C_GHS_KERNEL_FLAGS_MINSIZEREL_INIT "${CMAKE_C_FLAGS_MINSIZEREL_INIT}") -set(CMAKE_C_GHS_KERNEL_FLAGS_RELEASE_INIT "${CMAKE_C_FLAGS_RELEASE_INIT}") -set(CMAKE_C_GHS_KERNEL_FLAGS_RELWITHDEBINFO_INIT - "-ldebug ${CMAKE_C_FLAGS_RELWITHDEBINFO_INIT}") - -if(NOT CMAKE_NOT_USING_CONFIG_FLAGS) - set (CMAKE_C_GHS_KERNEL_FLAGS_DEBUG "${CMAKE_C_GHS_KERNEL_FLAGS_DEBUG_INIT}" - CACHE STRING "Kernel flags used by the compiler during debug builds.") - set (CMAKE_C_GHS_KERNEL_FLAGS_MINSIZEREL - "${CMAKE_C_GHS_KERNEL_FLAGS_MINSIZEREL_INIT}" CACHE STRING - "Kernel flags used by the compiler during release builds for minimum size.") - set (CMAKE_C_GHS_KERNEL_FLAGS_RELEASE - "${CMAKE_C_GHS_KERNEL_FLAGS_RELEASE_INIT}" - CACHE STRING "Kernel flags used by the compiler during release builds.") - set (CMAKE_C_GHS_KERNEL_FLAGS_RELWITHDEBINFO - "${CMAKE_C_GHS_KERNEL_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING - "Kernel flags used by the compiler during release builds with debug info.") -endif() diff --git a/Modules/Compiler/GHS-CXX.cmake b/Modules/Compiler/GHS-CXX.cmake index b3018a7..07b5044 100644 --- a/Modules/Compiler/GHS-CXX.cmake +++ b/Modules/Compiler/GHS-CXX.cmake @@ -8,27 +8,3 @@ string(APPEND CMAKE_CXX_FLAGS_DEBUG_INIT " -Odebug -g") string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL_INIT " -Ospace") string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " -O") string(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT " -O -g") - -set(CMAKE_CXX_GHS_KERNEL_FLAGS_DEBUG_INIT - "-ldebug ${CMAKE_CXX_FLAGS_DEBUG_INIT}") -set(CMAKE_CXX_GHS_KERNEL_FLAGS_MINSIZEREL_INIT - "${CMAKE_CXX_FLAGS_MINSIZEREL_INIT}") -set(CMAKE_CXX_GHS_KERNEL_FLAGS_RELEASE_INIT - "${CMAKE_CXX_FLAGS_RELEASE_INIT}") -set(CMAKE_CXX_GHS_KERNEL_FLAGS_RELWITHDEBINFO_INIT - "-ldebug ${CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT}") - -if(NOT CMAKE_NOT_USING_CONFIG_FLAGS) - set (CMAKE_CXX_GHS_KERNEL_FLAGS_DEBUG - "${CMAKE_CXX_GHS_KERNEL_FLAGS_DEBUG_INIT}" - CACHE STRING "Kernel flags used by the compiler during debug builds.") - set (CMAKE_CXX_GHS_KERNEL_FLAGS_MINSIZEREL - "${CMAKE_CXX_GHS_KERNEL_FLAGS_MINSIZEREL_INIT}" CACHE STRING - "Kernel flags used by the compiler during release builds for minimum size.") - set (CMAKE_CXX_GHS_KERNEL_FLAGS_RELEASE - "${CMAKE_CXX_GHS_KERNEL_FLAGS_RELEASE_INIT}" - CACHE STRING "Kernel flags used by the compiler during release builds.") - set (CMAKE_CXX_GHS_KERNEL_FLAGS_RELWITHDEBINFO - "${CMAKE_CXX_GHS_KERNEL_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING - "Kernel flags used by the compiler during release builds with debug info.") -endif() diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index 305e494..0cd6312 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -121,25 +121,19 @@ void cmGhsMultiTargetGenerator::GenerateTarget() this->GetGlobalGenerator()->WriteFileHeader(fout); GhsMultiGpj::WriteGpjTag(this->TagType, fout); - - std::string config = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); - if (0 == config.length()) { - config = "RELEASE"; - } const std::string language( - this->GeneratorTarget->GetLinkerLanguage(config)); - config = cmSystemTools::UpperCase(config); - this->DynamicDownload = this->DetermineIfDynamicDownload(config, language); + this->GeneratorTarget->GetLinkerLanguage(this->ConfigName)); + this->DynamicDownload = + this->DetermineIfDynamicDownload(this->ConfigName, language); if (this->DynamicDownload) { fout << "#component integrity_dynamic_download" << std::endl; } - bool const notKernel = this->IsNotKernel(config, language); - this->WriteTargetSpecifics(fout, config, notKernel); - this->SetCompilerFlags(config, language, notKernel); - this->WriteCompilerFlags(fout, config, language); - this->WriteCompilerDefinitions(fout, config, language); - this->WriteIncludes(fout, config, language); - this->WriteTargetLinkLine(fout, config); + this->WriteTargetSpecifics(fout, this->ConfigName); + this->SetCompilerFlags(this->ConfigName, language); + this->WriteCompilerFlags(fout, this->ConfigName, language); + this->WriteCompilerDefinitions(fout, this->ConfigName, language); + this->WriteIncludes(fout, this->ConfigName, language); + this->WriteTargetLinkLine(fout, this->ConfigName); this->WriteCustomCommands(fout); this->WriteSources(fout); @@ -162,8 +156,7 @@ bool cmGhsMultiTargetGenerator::IncludeThisTarget() std::vector cmGhsMultiTargetGenerator::GetSources() const { std::vector output; - std::string config = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); - this->GeneratorTarget->GetSourceFiles(output, config); + this->GeneratorTarget->GetSourceFiles(output, this->ConfigName); return output; } @@ -175,8 +168,7 @@ cmGlobalGhsMultiGenerator* cmGhsMultiTargetGenerator::GetGlobalGenerator() } void cmGhsMultiTargetGenerator::WriteTargetSpecifics(std::ostream& fout, - const std::string& config, - bool const notKernel) + const std::string& config) { std::string outpath; std::string rootpath = this->LocalGenerator->GetCurrentBinaryDirectory(); @@ -193,8 +185,7 @@ void cmGhsMultiTargetGenerator::WriteTargetSpecifics(std::ostream& fout, } void cmGhsMultiTargetGenerator::SetCompilerFlags(std::string const& config, - const std::string& language, - bool const notKernel) + const std::string& language) { std::map::iterator i = this->FlagsByLanguage.find(language); @@ -202,14 +193,9 @@ void cmGhsMultiTargetGenerator::SetCompilerFlags(std::string const& config, std::string flags; const char* lang = language.c_str(); - if (notKernel) { - this->LocalGenerator->AddLanguageFlags(flags, this->GeneratorTarget, - lang, config); - } else { - this->LocalGenerator->AddLanguageFlags(flags, this->GeneratorTarget, - lang + std::string("_GHS_KERNEL"), - config); - } + this->LocalGenerator->AddLanguageFlags(flags, this->GeneratorTarget, lang, + config); + this->LocalGenerator->AddCMP0018Flags(flags, this->GeneratorTarget, lang, config); this->LocalGenerator->AddVisibilityPresetFlags( @@ -260,7 +246,11 @@ void cmGhsMultiTargetGenerator::WriteCompilerFlags(std::ostream& fout, this->FlagsByLanguage.find(language); if (flagsByLangI != this->FlagsByLanguage.end()) { if (!flagsByLangI->second.empty()) { - fout << " " << flagsByLangI->second << std::endl; + std::vector ghsCompFlags = + cmSystemTools::ParseArguments(flagsByLangI->second.c_str()); + for (auto& f : ghsCompFlags) { + fout << " " << f << std::endl; + } } } } @@ -618,17 +608,6 @@ std::string cmGhsMultiTargetGenerator::ComputeLongestObjectDirectory( return dir_max; } -bool cmGhsMultiTargetGenerator::IsNotKernel(std::string const& config, - const std::string& language) -{ - bool output; - std::vector options; - this->GeneratorTarget->GetCompileOptions(options, config, language); - output = - options.end() == std::find(options.begin(), options.end(), "-kernel"); - return output; -} - bool cmGhsMultiTargetGenerator::DetermineIfTargetGroup( const cmGeneratorTarget* target) { diff --git a/Source/cmGhsMultiTargetGenerator.h b/Source/cmGhsMultiTargetGenerator.h index 358e1f4..343044a 100644 --- a/Source/cmGhsMultiTargetGenerator.h +++ b/Source/cmGhsMultiTargetGenerator.h @@ -34,15 +34,16 @@ private: bool IsTargetGroup() const { return this->TargetGroup; } - void WriteTargetSpecifics(std::ostream& fout, const std::string& config, - bool notKernel); + void WriteTargetSpecifics(std::ostream& fout, const std::string& config); + void WriteCompilerFlags(std::ostream& fout, const std::string& config, const std::string& language); void WriteCompilerDefinitions(std::ostream& fout, const std::string& config, const std::string& language); - void SetCompilerFlags(std::string const& config, const std::string& language, - bool const notKernel); + void SetCompilerFlags(std::string const& config, + const std::string& language); + std::string GetDefines(const std::string& langugae, std::string const& config); @@ -65,7 +66,6 @@ private: cmLocalGhsMultiGenerator const* localGhsMultiGenerator, cmGeneratorTarget* generatorTarget, cmSourceFile* const sourceFile); - bool IsNotKernel(std::string const& config, const std::string& language); static bool DetermineIfTargetGroup(const cmGeneratorTarget* target); bool DetermineIfDynamicDownload(std::string const& config, const std::string& language); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b2a72ec72d609547d2278701a56237822c0dcc92 commit b2a72ec72d609547d2278701a56237822c0dcc92 Author: Fred Baksik AuthorDate: Sat Jan 5 11:01:22 2019 -0500 Commit: Fred Baksik CommitDate: Wed Jan 16 10:41:31 2019 -0500 GHS: Cleanup unused file handling functions and file output updates -- File handling cleanup -- Rename some functions to clarify what they do -- Update to source file path conversion; only perform conversion when using windows diff --git a/Source/cmGhsMultiGpj.cxx b/Source/cmGhsMultiGpj.cxx index c0f37ba..c1f0742 100644 --- a/Source/cmGhsMultiGpj.cxx +++ b/Source/cmGhsMultiGpj.cxx @@ -29,10 +29,9 @@ const char* GhsMultiGpj::GetGpjTag(Types const gpjType) return tag; } -void GhsMultiGpj::WriteGpjTag(Types const gpjType, - cmGeneratedFileStream* const filestream) +void GhsMultiGpj::WriteGpjTag(Types const gpjType, std::ostream& fout) { char const* tag; tag = GhsMultiGpj::GetGpjTag(gpjType); - *filestream << tag << std::endl; + fout << tag << std::endl; } diff --git a/Source/cmGhsMultiGpj.h b/Source/cmGhsMultiGpj.h index 014f6b6..6d59225 100644 --- a/Source/cmGhsMultiGpj.h +++ b/Source/cmGhsMultiGpj.h @@ -4,6 +4,7 @@ #define cmGhsMultiGpj_h #include "cmConfigure.h" // IWYU pragma: keep +#include class cmGeneratedFileStream; @@ -20,8 +21,7 @@ public: SUBPROJECT }; - static void WriteGpjTag(Types const gpjType, - cmGeneratedFileStream* filestream); + static void WriteGpjTag(Types const gpjType, std::ostream& fout); static const char* GetGpjTag(Types const gpjType); }; diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index a58e59a..305e494 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -24,19 +24,6 @@ cmGhsMultiTargetGenerator::cmGhsMultiTargetGenerator(cmGeneratorTarget* target) , DynamicDownload(false) , Name(target->GetName()) { - this->RelBuildFilePath = this->GetRelBuildFilePath(target); - - this->RelOutputFileName = this->RelBuildFilePath + target->GetName() + ".a"; - - this->RelBuildFileName = this->RelBuildFilePath; - this->RelBuildFileName += this->GetBuildFileName(target); - - std::string absPathToRoot = this->GetAbsPathToRoot(target); - absPathToRoot = this->AddSlashIfNeededToPath(absPathToRoot); - this->AbsBuildFilePath = absPathToRoot + this->RelBuildFilePath; - this->AbsBuildFileName = absPathToRoot + this->RelBuildFileName; - this->AbsOutputFileName = absPathToRoot + this->RelOutputFileName; - // Store the configuration name that is being used if (const char* config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE")) { // Use the build type given by the user. @@ -49,64 +36,6 @@ cmGhsMultiTargetGenerator::cmGhsMultiTargetGenerator(cmGeneratorTarget* target) cmGhsMultiTargetGenerator::~cmGhsMultiTargetGenerator() { - cmDeleteAll(this->FolderBuildStreams); -} - -std::string cmGhsMultiTargetGenerator::GetRelBuildFilePath( - const cmGeneratorTarget* target) -{ - std::string output = target->GetEffectiveFolderName(); - cmSystemTools::ConvertToUnixSlashes(output); - if (!output.empty()) { - output += "/"; - } - output += target->GetName() + "/"; - return output; -} - -std::string cmGhsMultiTargetGenerator::GetAbsPathToRoot( - const cmGeneratorTarget* target) -{ - return target->GetLocalGenerator()->GetBinaryDirectory(); -} - -std::string cmGhsMultiTargetGenerator::GetAbsBuildFilePath( - const cmGeneratorTarget* target) -{ - std::string output; - output = cmGhsMultiTargetGenerator::GetAbsPathToRoot(target); - output = cmGhsMultiTargetGenerator::AddSlashIfNeededToPath(output); - output += cmGhsMultiTargetGenerator::GetRelBuildFilePath(target); - return output; -} - -std::string cmGhsMultiTargetGenerator::GetRelBuildFileName( - const cmGeneratorTarget* target) -{ - std::string output; - output = cmGhsMultiTargetGenerator::GetRelBuildFilePath(target); - output = cmGhsMultiTargetGenerator::AddSlashIfNeededToPath(output); - output += cmGhsMultiTargetGenerator::GetBuildFileName(target); - return output; -} - -std::string cmGhsMultiTargetGenerator::GetBuildFileName( - const cmGeneratorTarget* target) -{ - std::string output; - output = target->GetName(); - output += cmGlobalGhsMultiGenerator::FILE_EXTENSION; - return output; -} - -std::string cmGhsMultiTargetGenerator::AddSlashIfNeededToPath( - std::string const& input) -{ - std::string output(input); - if (!cmHasLiteralSuffix(output, "/")) { - output += "/"; - } - return output; } void cmGhsMultiTargetGenerator::Generate() @@ -190,7 +119,8 @@ void cmGhsMultiTargetGenerator::GenerateTarget() cmGeneratedFileStream fout(fname.c_str()); fout.SetCopyIfDifferent(true); - cmGlobalGhsMultiGenerator::OpenBuildFileStream(&fout); + this->GetGlobalGenerator()->WriteFileHeader(fout); + GhsMultiGpj::WriteGpjTag(this->TagType, fout); std::string config = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); if (0 == config.length()) { @@ -203,9 +133,6 @@ void cmGhsMultiTargetGenerator::GenerateTarget() if (this->DynamicDownload) { fout << "#component integrity_dynamic_download" << std::endl; } - GhsMultiGpj::WriteGpjTag(this->TagType, &fout); - cmGlobalGhsMultiGenerator::WriteDisclaimer(&fout); - bool const notKernel = this->IsNotKernel(config, language); this->WriteTargetSpecifics(fout, config, notKernel); this->SetCompilerFlags(config, language, notKernel); @@ -614,11 +541,10 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj) f->SetCopyIfDifferent(true); gfiles.push_back(f); fout = f; - cmGlobalGhsMultiGenerator::OpenBuildFileStream(f); - *fout << "[Subproject]" << std::endl; - cmGlobalGhsMultiGenerator::WriteDisclaimer(f); + this->GetGlobalGenerator()->WriteFileHeader(*f); + GhsMultiGpj::WriteGpjTag(GhsMultiGpj::SUBPROJECT, *f); fout_proj << lpath << " "; - fout_proj << "[Subproject]" << std::endl; + GhsMultiGpj::WriteGpjTag(GhsMultiGpj::SUBPROJECT, fout_proj); } if (useProjectFile) { @@ -631,21 +557,17 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj) /* output rule for each source file */ for (const cmSourceFile* si : groupFiles[sg]) { - std::string fullSourcePath(si->GetFullPath()); - if (si->GetExtension() == "int" || si->GetExtension() == "bsp") { - *fout << fullSourcePath << std::endl; - } else { - // WORKAROUND: GHS MULTI needs the path to use backslashes without - // quotes - // to open files in search as of version 6.1.6 - cmsys::SystemTools::ReplaceString(fullSourcePath, "/", "\\"); - *fout << fullSourcePath << std::endl; - } + // Convert filename to native system + // WORKAROUND: GHS MULTI 6.1.4 and 6.1.6 are known to need backslash on + // windows when opening some files from the search window. + std::string fname(si->GetFullPath()); + cmSystemTools::ConvertToOutputSlashes(fname); + *fout << fname << std::endl; if ("ld" != si->GetExtension() && "int" != si->GetExtension() && "bsp" != si->GetExtension()) { - this->WriteObjectLangOverride(fout, si); + this->WriteObjectLangOverride(*fout, si); if (objectNames.end() != objectNames.find(si)) { *fout << " -o \"" << objectNames.find(si)->second << "\"" << std::endl; @@ -660,65 +582,18 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj) } void cmGhsMultiTargetGenerator::WriteObjectLangOverride( - std::ostream* fout, const cmSourceFile* sourceFile) + std::ostream& fout, const cmSourceFile* sourceFile) { const char* rawLangProp = sourceFile->GetProperty("LANGUAGE"); if (NULL != rawLangProp) { std::string sourceLangProp(rawLangProp); std::string extension(sourceFile->GetExtension()); if ("CXX" == sourceLangProp && ("c" == extension || "C" == extension)) { - *fout << " -dotciscxx" << std::endl; + fout << " -dotciscxx" << std::endl; } } } -std::string cmGhsMultiTargetGenerator::GetOutputDirectory( - const std::string& config) const -{ - std::string outputDir(AbsBuildFilePath); - - const char* runtimeOutputProp = - this->GeneratorTarget->GetProperty("RUNTIME_OUTPUT_DIRECTORY"); - if (NULL != runtimeOutputProp) { - outputDir = runtimeOutputProp; - } - - std::string configCapped(cmSystemTools::UpperCase(config)); - const char* runtimeOutputSProp = this->GeneratorTarget->GetProperty( - "RUNTIME_OUTPUT_DIRECTORY_" + configCapped); - if (NULL != runtimeOutputSProp) { - outputDir = runtimeOutputSProp; - } - cmSystemTools::ConvertToUnixSlashes(outputDir); - - if (!outputDir.empty()) { - outputDir += "/"; - } - - return outputDir; -} - -std::string cmGhsMultiTargetGenerator::GetOutputFilename( - const std::string& config) const -{ - std::string outputFilename(this->GeneratorTarget->GetName()); - - const char* outputNameProp = - this->GeneratorTarget->GetProperty("OUTPUT_NAME"); - if (NULL != outputNameProp) { - outputFilename = outputNameProp; - } - - std::string configCapped(cmSystemTools::UpperCase(config)); - const char* outputNameSProp = - this->GeneratorTarget->GetProperty(configCapped + "_OUTPUT_NAME"); - if (NULL != outputNameSProp) { - outputFilename = outputNameSProp; - } - - return outputFilename; -} - std::string cmGhsMultiTargetGenerator::ComputeLongestObjectDirectory( cmLocalGhsMultiGenerator const* localGhsMultiGenerator, cmGeneratorTarget* const generatorTarget, cmSourceFile* const sourceFile) diff --git a/Source/cmGhsMultiTargetGenerator.h b/Source/cmGhsMultiTargetGenerator.h index df1c683..358e1f4 100644 --- a/Source/cmGhsMultiTargetGenerator.h +++ b/Source/cmGhsMultiTargetGenerator.h @@ -26,36 +26,10 @@ public: bool IncludeThisTarget(); std::vector GetSources() const; - const char* GetAbsBuildFilePath() const - { - return this->AbsBuildFilePath.c_str(); - } - const char* GetRelBuildFileName() const - { - return this->RelBuildFileName.c_str(); - } - const char* GetAbsBuildFileName() const - { - return this->AbsBuildFileName.c_str(); - } - const char* GetAbsOutputFileName() const - { - return this->AbsOutputFileName.c_str(); - } - - static std::string GetRelBuildFilePath(const cmGeneratorTarget* target); - static std::string GetAbsPathToRoot(const cmGeneratorTarget* target); - static std::string GetAbsBuildFilePath(const cmGeneratorTarget* target); - static std::string GetRelBuildFileName(const cmGeneratorTarget* target); - static std::string GetBuildFileName(const cmGeneratorTarget* target); - static std::string AddSlashIfNeededToPath(std::string const& input); private: cmGlobalGhsMultiGenerator* GetGlobalGenerator() const; - cmGeneratedFileStream* GetFolderBuildStreams() - { - return this->FolderBuildStreams[""]; - }; + void GenerateTarget(); bool IsTargetGroup() const { return this->TargetGroup; } @@ -84,10 +58,9 @@ private: std::vector* objectSources, cmLocalGhsMultiGenerator* localGhsMultiGenerator, cmGeneratorTarget* generatorTarget); - static void WriteObjectLangOverride(std::ostream* fout, + static void WriteObjectLangOverride(std::ostream& fout, const cmSourceFile* sourceFile); - std::string GetOutputDirectory(const std::string& config) const; - std::string GetOutputFilename(const std::string& config) const; + static std::string ComputeLongestObjectDirectory( cmLocalGhsMultiGenerator const* localGhsMultiGenerator, cmGeneratorTarget* generatorTarget, cmSourceFile* const sourceFile); @@ -100,13 +73,6 @@ private: cmGeneratorTarget* GeneratorTarget; cmLocalGhsMultiGenerator* LocalGenerator; cmMakefile* Makefile; - std::string AbsBuildFilePath; - std::string RelBuildFilePath; - std::string AbsBuildFileName; - std::string RelBuildFileName; - std::string RelOutputFileName; - std::string AbsOutputFileName; - std::map FolderBuildStreams; bool TargetGroup; bool DynamicDownload; static std::string const DDOption; diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 7d1e594..452a610 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -25,7 +25,6 @@ cmGlobalGhsMultiGenerator::cmGlobalGhsMultiGenerator(cmake* cm) cmGlobalGhsMultiGenerator::~cmGlobalGhsMultiGenerator() { - cmDeleteAll(TargetFolderBuildStreams); } cmLocalGenerator* cmGlobalGhsMultiGenerator::CreateLocalGenerator( @@ -204,40 +203,28 @@ void cmGlobalGhsMultiGenerator::GetToolset(cmMakefile* mf, std::string& tsd, } } -void cmGlobalGhsMultiGenerator::OpenBuildFileStream( - std::string const& filepath, cmGeneratedFileStream** filestream) -{ - // Get a stream where to generate things. - if (NULL == *filestream) { - *filestream = new cmGeneratedFileStream(filepath.c_str()); - if (NULL != *filestream) { - OpenBuildFileStream(*filestream); - } - } -} - -void cmGlobalGhsMultiGenerator::OpenBuildFileStream( - cmGeneratedFileStream* filestream) -{ - *filestream << "#!gbuild" << std::endl; -} -/* temporary until all file handling is cleaned up */ -void cmGlobalGhsMultiGenerator::OpenBuildFileStream(std::ostream& fout) +void cmGlobalGhsMultiGenerator::WriteFileHeader(std::ostream& fout) { fout << "#!gbuild" << std::endl; + fout << "#" << std::endl + << "# CMAKE generated file: DO NOT EDIT!" << std::endl + << "# Generated by \"" << this->GetActualName() << "\"" + << " Generator, CMake Version " << cmVersion::GetMajorVersion() << "." + << cmVersion::GetMinorVersion() << std::endl + << "#" << std::endl + << std::endl; } void cmGlobalGhsMultiGenerator::WriteTopLevelProject( std::ostream& fout, cmLocalGenerator* root, std::vector& generators) { - OpenBuildFileStream(fout); + WriteFileHeader(fout); this->WriteMacros(fout); this->WriteHighLevelDirectives(fout); - // GhsMultiGpj::WriteGpjTag(GhsMultiGpj::PROJECT, &fout); - fout << "[Project]" << std::endl; - this->WriteDisclaimer(&fout); + GhsMultiGpj::WriteGpjTag(GhsMultiGpj::PROJECT, fout); + fout << "# Top Level Project File" << std::endl; // Specify BSP option if supplied by user @@ -330,17 +317,6 @@ void cmGlobalGhsMultiGenerator::WriteSubProjects( } } -void cmGlobalGhsMultiGenerator::CloseBuildFileStream( - cmGeneratedFileStream** filestream) -{ - if (filestream) { - delete *filestream; - *filestream = NULL; - } else { - cmSystemTools::Error("Build file stream was not open."); - } -} - void cmGlobalGhsMultiGenerator::Generate() { // first do the superclass method @@ -465,116 +441,6 @@ void cmGlobalGhsMultiGenerator::WriteHighLevelDirectives(std::ostream& fout) } } -void cmGlobalGhsMultiGenerator::WriteDisclaimer(std::ostream* os) -{ - (*os) << "#" << std::endl - << "# CMAKE generated file: DO NOT EDIT!" << std::endl - << "# Generated by \"" << GetActualName() << "\"" - << " Generator, CMake Version " << cmVersion::GetMajorVersion() << "." - << cmVersion::GetMinorVersion() << std::endl - << "#" << std::endl; -} - -void cmGlobalGhsMultiGenerator::AddFilesUpToPath( - cmGeneratedFileStream* mainBuildFile, - std::map* targetFolderBuildStreams, - char const* homeOutputDirectory, std::string const& path, - GhsMultiGpj::Types projType, std::string const& relPath) -{ - std::string workingPath(path); - cmSystemTools::ConvertToUnixSlashes(workingPath); - std::vector splitPath = cmSystemTools::SplitString(workingPath); - std::string workingRelPath(relPath); - cmSystemTools::ConvertToUnixSlashes(workingRelPath); - if (!workingRelPath.empty()) { - workingRelPath += "/"; - } - std::string pathUpTo; - for (std::vector::const_iterator splitPathI = splitPath.begin(); - splitPath.end() != splitPathI; ++splitPathI) { - pathUpTo += *splitPathI; - if (targetFolderBuildStreams->end() == - targetFolderBuildStreams->find(pathUpTo)) { - AddFilesUpToPathNewBuildFile( - mainBuildFile, targetFolderBuildStreams, homeOutputDirectory, pathUpTo, - splitPath.begin() == splitPathI, workingRelPath, projType); - } - AddFilesUpToPathAppendNextFile(targetFolderBuildStreams, pathUpTo, - splitPathI, splitPath.end(), projType); - pathUpTo += "/"; - } -} - -void cmGlobalGhsMultiGenerator::Open( - std::string const& mapKeyName, std::string const& fileName, - std::map* fileMap) -{ - if (fileMap->end() == fileMap->find(fileName)) { - cmGeneratedFileStream* temp(new cmGeneratedFileStream); - temp->open(fileName.c_str()); - (*fileMap)[mapKeyName] = temp; - } -} - -void cmGlobalGhsMultiGenerator::AddFilesUpToPathNewBuildFile( - cmGeneratedFileStream* mainBuildFile, - std::map* targetFolderBuildStreams, - char const* homeOutputDirectory, std::string const& pathUpTo, - bool const isFirst, std::string const& relPath, - GhsMultiGpj::Types const projType) -{ - // create folders up to file path - std::string absPath = std::string(homeOutputDirectory) + "/" + relPath; - std::string newPath = absPath + pathUpTo; - if (!cmSystemTools::FileExists(newPath.c_str())) { - cmSystemTools::MakeDirectory(newPath.c_str()); - } - - // Write out to filename for first time - std::string relFilename(GetFileNameFromPath(pathUpTo)); - std::string absFilename = absPath + relFilename; - Open(pathUpTo, absFilename, targetFolderBuildStreams); - OpenBuildFileStream((*targetFolderBuildStreams)[pathUpTo]); - GhsMultiGpj::WriteGpjTag(projType, (*targetFolderBuildStreams)[pathUpTo]); - WriteDisclaimer((*targetFolderBuildStreams)[pathUpTo]); - - // Add to main build file - if (isFirst) { - *mainBuildFile << relFilename << " "; - GhsMultiGpj::WriteGpjTag(projType, mainBuildFile); - } -} - -void cmGlobalGhsMultiGenerator::AddFilesUpToPathAppendNextFile( - std::map* targetFolderBuildStreams, - std::string const& pathUpTo, - std::vector::const_iterator splitPathI, - std::vector::const_iterator end, - GhsMultiGpj::Types const projType) -{ - std::vector::const_iterator splitPathNextI = splitPathI + 1; - if (end != splitPathNextI && - targetFolderBuildStreams->end() == - targetFolderBuildStreams->find(pathUpTo + "/" + *splitPathNextI)) { - std::string nextFilename(*splitPathNextI); - nextFilename = GetFileNameFromPath(nextFilename); - *(*targetFolderBuildStreams)[pathUpTo] << nextFilename << " "; - GhsMultiGpj::WriteGpjTag(projType, (*targetFolderBuildStreams)[pathUpTo]); - } -} - -std::string cmGlobalGhsMultiGenerator::GetFileNameFromPath( - std::string const& path) -{ - std::string output(path); - if (!path.empty()) { - cmSystemTools::ConvertToUnixSlashes(output); - std::vector splitPath = cmSystemTools::SplitString(output); - output += "/" + splitPath.back() + FILE_EXTENSION; - } - return output; -} - bool cmGlobalGhsMultiGenerator::IsTgtForBuild(const cmGeneratorTarget* tgt) { const std::string config = diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h index d992f89..71c0b48 100644 --- a/Source/cmGlobalGhsMultiGenerator.h +++ b/Source/cmGlobalGhsMultiGenerator.h @@ -65,29 +65,8 @@ public: void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const override; - cmGeneratedFileStream* GetBuildFileStream() - { - return this->TargetFolderBuildStreams[""]; - } - - static void OpenBuildFileStream(std::string const& filepath, - cmGeneratedFileStream** filestream); - static void OpenBuildFileStream(cmGeneratedFileStream* filestream); - void OpenBuildFileStream(std::ostream& fout); - static void CloseBuildFileStream(cmGeneratedFileStream** filestream); - /// Write the common disclaimer text at the top of each build file. - static void WriteDisclaimer(std::ostream* os); - std::vector GetLibDirs() { return this->LibDirs; } - - static void AddFilesUpToPath( - cmGeneratedFileStream* mainBuildFile, - std::map* targetFolderBuildStreams, - char const* homeOutputDirectory, std::string const& path, - GhsMultiGpj::Types projType, std::string const& relPath = ""); - static void Open(std::string const& mapKeyName, std::string const& fileName, - std::map* fileMap); - - static std::string trimQuotes(std::string const& str); + // Write the common disclaimer text at the top of each build file. + void WriteFileHeader(std::ostream& fout); // Target dependency sorting class TargetSet : public std::set @@ -132,24 +111,9 @@ private: void WriteSubProjects(std::ostream& fout, cmLocalGenerator* root, std::vector& generators); - static void AddFilesUpToPathNewBuildFile( - cmGeneratedFileStream* mainBuildFile, - std::map* targetFolderBuildStreams, - char const* homeOutputDirectory, std::string const& pathUpTo, bool isFirst, - std::string const& relPath, GhsMultiGpj::Types projType); - static void AddFilesUpToPathAppendNextFile( - std::map* targetFolderBuildStreams, - std::string const& pathUpTo, - std::vector::const_iterator splitPathI, - std::vector::const_iterator end, GhsMultiGpj::Types projType); - static std::string GetFileNameFromPath(std::string const& path); - bool IsTgtForBuild(const cmGeneratorTarget* tgt); - std::vector TargetSubProjects; - std::map TargetFolderBuildStreams; - - std::vector LibDirs; + std::string trimQuotes(std::string const& str); static const char* DEFAULT_BUILD_PROGRAM; static const char* DEFAULT_TOOLSET_ROOT; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=595932c4f0570ab6bdef0a50a321877ffa9c50e4 commit 595932c4f0570ab6bdef0a50a321877ffa9c50e4 Author: Fred Baksik AuthorDate: Sat Jan 5 11:01:21 2019 -0500 Commit: Fred Baksik CommitDate: Wed Jan 16 10:41:27 2019 -0500 GHS: Update the link line processing -- add missing executable linker libs from: CMAKE_C_STANDARD_LIBRARIES -- add missed transitive link libraries -- add skipped library linker options -- The linker expects -l../relative/path/to/lib.a to be relative to the top-level project Because there can be multiple top-level projects convert the path to an absolute path to target diff --git a/Modules/Compiler/GHS.cmake b/Modules/Compiler/GHS.cmake index 0583a23..b41c3eb 100644 --- a/Modules/Compiler/GHS.cmake +++ b/Modules/Compiler/GHS.cmake @@ -4,5 +4,5 @@ endif() set(__COMPILER_GHS 1) set(CMAKE_EXECUTABLE_SUFFIX "") -set(CMAKE_LIBRARY_PATH_TERMINATOR "\n") -set(CMAKE_LIBRARY_PATH_FLAG " -L") +set(CMAKE_LIBRARY_PATH_TERMINATOR "") +set(CMAKE_LIBRARY_PATH_FLAG "") diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index 7d2af09..a58e59a 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -212,9 +212,7 @@ void cmGhsMultiTargetGenerator::GenerateTarget() this->WriteCompilerFlags(fout, config, language); this->WriteCompilerDefinitions(fout, config, language); this->WriteIncludes(fout, config, language); - if (this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE) { - this->WriteTargetLinkLibraries(fout, config, language); - } + this->WriteTargetLinkLine(fout, config); this->WriteCustomCommands(fout); this->WriteSources(fout); @@ -367,59 +365,55 @@ void cmGhsMultiTargetGenerator::WriteIncludes(std::ostream& fout, } } -void cmGhsMultiTargetGenerator::WriteTargetLinkLibraries( - std::ostream& fout, std::string const& config, std::string const& language) +void cmGhsMultiTargetGenerator::WriteTargetLinkLine(std::ostream& fout, + std::string const& config) { - // library directories - cmTargetDependSet tds = - this->GetGlobalGenerator()->GetTargetDirectDepends(this->GeneratorTarget); - for (cmTargetDependSet::iterator tdsI = tds.begin(); tdsI != tds.end(); - ++tdsI) { - const cmGeneratorTarget* tg = *tdsI; - fout << " -L\"" << GetAbsBuildFilePath(tg) << "\"" << std::endl; - } - // library targets - cmTarget::LinkLibraryVectorType llv = - this->GeneratorTarget->Target->GetOriginalLinkLibraries(); - for (cmTarget::LinkLibraryVectorType::const_iterator llvI = llv.begin(); - llvI != llv.end(); ++llvI) { - std::string libName = llvI->first; - // if it is a user defined target get the full path to the lib - cmTarget* tg(GetGlobalGenerator()->FindTarget(libName)); - if (NULL != tg) { - libName = tg->GetName() + ".a"; - } - fout << " -l\"" << libName << "\"" << std::endl; + if (this->TagType == GhsMultiGpj::INTERGRITY_APPLICATION) { + return; } - if (!this->TargetGroup) { - std::string linkLibraries; - std::string flags; - std::string linkFlags; - std::string frameworkPath; - std::string linkPath; - std::string createRule = - this->GeneratorTarget->GetCreateRuleVariable(language, config); - bool useWatcomQuote = - this->Makefile->IsOn(createRule + "_USE_WATCOM_QUOTE"); - std::unique_ptr linkLineComputer( - this->GetGlobalGenerator()->CreateLinkLineComputer( - this->LocalGenerator, - this->LocalGenerator->GetStateSnapshot().GetDirectory())); - linkLineComputer->SetUseWatcomQuote(useWatcomQuote); - - this->LocalGenerator->GetTargetFlags( - linkLineComputer.get(), config, linkLibraries, flags, linkFlags, - frameworkPath, linkPath, this->GeneratorTarget); - linkFlags = cmSystemTools::TrimWhitespace(linkFlags); - - if (!linkPath.empty()) { - linkPath = " " + linkPath.substr(0U, linkPath.size() - 1U); - fout << linkPath; - } + std::string linkLibraries; + std::string flags; + std::string linkFlags; + std::string frameworkPath; + std::string linkPath; + + std::unique_ptr linkLineComputer( + this->GetGlobalGenerator()->CreateLinkLineComputer( + this->LocalGenerator, + this->LocalGenerator->GetStateSnapshot().GetDirectory())); + + this->LocalGenerator->GetTargetFlags( + linkLineComputer.get(), config, linkLibraries, flags, linkFlags, + frameworkPath, linkPath, this->GeneratorTarget); - if (!linkFlags.empty()) { - fout << " " << linkFlags << std::endl; + // write out link options + std::vector lopts = + cmSystemTools::ParseArguments(linkFlags.c_str()); + for (auto& l : lopts) { + fout << " " << l << std::endl; + } + + // write out link search paths + // must be quoted for paths that contain spaces + std::vector lpath = + cmSystemTools::ParseArguments(linkPath.c_str()); + for (auto& l : lpath) { + fout << " -L\"" << l << "\"" << std::endl; + } + + // write out link libs + // must be quoted for filepaths that contains spaces + std::string cbd = this->LocalGenerator->GetCurrentBinaryDirectory(); + + std::vector llibs = + cmSystemTools::ParseArguments(linkLibraries.c_str()); + for (auto& l : llibs) { + if (l.compare(0, 2, "-l") == 0) { + fout << " \"" << l << "\"" << std::endl; + } else { + std::string rl = cmSystemTools::CollapseCombinedPath(cbd, l); + fout << " -l\"" << rl << "\"" << std::endl; } } } diff --git a/Source/cmGhsMultiTargetGenerator.h b/Source/cmGhsMultiTargetGenerator.h index 4523498..df1c683 100644 --- a/Source/cmGhsMultiTargetGenerator.h +++ b/Source/cmGhsMultiTargetGenerator.h @@ -74,8 +74,7 @@ private: void WriteIncludes(std::ostream& fout, const std::string& config, const std::string& language); - void WriteTargetLinkLibraries(std::ostream& fout, std::string const& config, - std::string const& language); + void WriteTargetLinkLine(std::ostream& fout, std::string const& config); void WriteCustomCommands(std::ostream& fout); void WriteCustomCommandsHelper( std::ostream& fout, std::vector const& commandsSet, https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2ed2d6b46f9fb8f0742ce60bef16f1d636008136 commit 2ed2d6b46f9fb8f0742ce60bef16f1d636008136 Author: Fred Baksik AuthorDate: Sat Jan 5 11:01:21 2019 -0500 Commit: Fred Baksik CommitDate: Wed Jan 16 10:41:24 2019 -0500 GHS: Place build system outputs per target output directives -- Set output and object file locations -- Suffixes are no longer being forced but will now follow the target properties By default GHS tools have no suffix for executable files so CMAKE_EXECUTABLE_SUFFIX was changed to meet this behavior -- Remove #if 0 blocked out code; it has been replaced. Forcing the -relprog option has been removed from non-kernel executable targets. The default value of this option (if it is even available) is determined by the tool-chain for the specified target and platform (Some tool-chains default to -locatedprogram). The use of -relprog can have unexpected results as it cannot always produce a fully relocated executable. -- Clarify use of CMAKE_BUILD_TYPE to control build configuration diff --git a/Help/generator/Green Hills MULTI.rst b/Help/generator/Green Hills MULTI.rst index 1b4960d..4ee1427 100644 --- a/Help/generator/Green Hills MULTI.rst +++ b/Help/generator/Green Hills MULTI.rst @@ -3,6 +3,9 @@ Green Hills MULTI Generates Green Hills MULTI project files (experimental, work-in-progress). +The buildsystem has predetermined build-configuration settings that can be controlled +via the :variable:`CMAKE_BUILD_TYPE` variable. + Customizations that are used to pick toolset and target system: The ``-A `` can be supplied for setting the target architecture. diff --git a/Modules/Compiler/GHS.cmake b/Modules/Compiler/GHS.cmake index e6a867d..0583a23 100644 --- a/Modules/Compiler/GHS.cmake +++ b/Modules/Compiler/GHS.cmake @@ -3,6 +3,6 @@ if(__COMPILER_GHS) endif() set(__COMPILER_GHS 1) -set(CMAKE_EXECUTABLE_SUFFIX ".as") +set(CMAKE_EXECUTABLE_SUFFIX "") set(CMAKE_LIBRARY_PATH_TERMINATOR "\n") set(CMAKE_LIBRARY_PATH_FLAG " -L") diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index 0e0607d..7d2af09 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -2,6 +2,7 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmGhsMultiTargetGenerator.h" +#include "cmComputeLinkInformation.h" #include "cmGeneratedFileStream.h" #include "cmGeneratorTarget.h" #include "cmGlobalGhsMultiGenerator.h" @@ -35,6 +36,15 @@ cmGhsMultiTargetGenerator::cmGhsMultiTargetGenerator(cmGeneratorTarget* target) this->AbsBuildFilePath = absPathToRoot + this->RelBuildFilePath; this->AbsBuildFileName = absPathToRoot + this->RelBuildFileName; this->AbsOutputFileName = absPathToRoot + this->RelOutputFileName; + + // Store the configuration name that is being used + if (const char* config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE")) { + // Use the build type given by the user. + this->ConfigName = config; + } else { + // No configuration type given. + this->ConfigName.clear(); + } } cmGhsMultiTargetGenerator::~cmGhsMultiTargetGenerator() @@ -104,6 +114,13 @@ void cmGhsMultiTargetGenerator::Generate() // Determine type of target for this project switch (this->GeneratorTarget->GetType()) { case cmStateEnums::EXECUTABLE: { + // Get the name of the executable to generate. + std::string targetName; + std::string targetNameImport; + std::string targetNamePDB; + this->GeneratorTarget->GetExecutableNames( + targetName, this->TargetNameReal, targetNameImport, targetNamePDB, + this->ConfigName); if (cmGhsMultiTargetGenerator::DetermineIfTargetGroup( this->GeneratorTarget)) { this->TagType = GhsMultiGpj::INTERGRITY_APPLICATION; @@ -113,6 +130,13 @@ void cmGhsMultiTargetGenerator::Generate() break; } case cmStateEnums::STATIC_LIBRARY: { + std::string targetName; + std::string targetNameSO; + std::string targetNameImport; + std::string targetNamePDB; + this->GeneratorTarget->GetLibraryNames( + targetName, targetNameSO, this->TargetNameReal, targetNameImport, + targetNamePDB, this->ConfigName); this->TagType = GhsMultiGpj::LIBRARY; break; } @@ -143,6 +167,7 @@ void cmGhsMultiTargetGenerator::Generate() default: return; } + // Tell the global generator the name of the project file this->GeneratorTarget->Target->SetProperty("GENERATOR_FILE_NAME", this->Name.c_str()); @@ -182,7 +207,7 @@ void cmGhsMultiTargetGenerator::GenerateTarget() cmGlobalGhsMultiGenerator::WriteDisclaimer(&fout); bool const notKernel = this->IsNotKernel(config, language); - this->WriteTypeSpecifics(fout, config, notKernel); + this->WriteTargetSpecifics(fout, config, notKernel); this->SetCompilerFlags(config, language, notKernel); this->WriteCompilerFlags(fout, config, language); this->WriteCompilerDefinitions(fout, config, language); @@ -224,34 +249,22 @@ cmGlobalGhsMultiGenerator* cmGhsMultiTargetGenerator::GetGlobalGenerator() this->LocalGenerator->GetGlobalGenerator()); } -void cmGhsMultiTargetGenerator::WriteTypeSpecifics(std::ostream& fout, - const std::string& config, - bool const notKernel) +void cmGhsMultiTargetGenerator::WriteTargetSpecifics(std::ostream& fout, + const std::string& config, + bool const notKernel) { - std::string outputDir(this->GetOutputDirectory(config)); - std::string outputFilename(this->GetOutputFilename(config)); - - if (this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY) { - std::string const& static_library_suffix = - this->Makefile->GetSafeDefinition("CMAKE_STATIC_LIBRARY_SUFFIX"); - fout << " -o \"" << outputDir << outputFilename << static_library_suffix - << "\"" << std::endl; - } else if (this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE) { - if (notKernel && !this->IsTargetGroup()) { - fout << " -relprog" << std::endl; - } - if (this->IsTargetGroup()) { - fout << " -o \"" << outputDir << outputFilename << ".elf\"" - << std::endl; - fout << " :extraOutputFile=\"" << outputDir << outputFilename - << ".elf.ael\"" << std::endl; - } else { - std::string const executable_suffix = - this->Makefile->GetSafeDefinition("CMAKE_EXECUTABLE_SUFFIX"); - fout << " -o \"" << outputDir << outputFilename << executable_suffix - << "\"" << std::endl; - } - } + std::string outpath; + std::string rootpath = this->LocalGenerator->GetCurrentBinaryDirectory(); + + // set target binary file destination + outpath = this->GeneratorTarget->GetDirectory(config); + outpath = this->LocalGenerator->ConvertToRelativePath(rootpath, outpath); + fout << " :binDirRelative=\"" << outpath << "\"" << std::endl; + fout << " -o \"" << this->TargetNameReal << "\"" << std::endl; + + // set target object file destination + outpath = this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget); + fout << " :outputDirRelative=\"" << outpath << "\"" << std::endl; } void cmGhsMultiTargetGenerator::SetCompilerFlags(std::string const& config, @@ -643,8 +656,6 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj) *fout << " -o \"" << objectNames.find(si)->second << "\"" << std::endl; } - - this->WriteObjectDir(*fout, this->AbsBuildFilePath); } } } @@ -667,18 +678,6 @@ void cmGhsMultiTargetGenerator::WriteObjectLangOverride( } } -void cmGhsMultiTargetGenerator::WriteObjectDir(std::ostream& fout, - std::string const& dir) -{ - std::string workingDir(dir); - cmSystemTools::ConvertToUnixSlashes(workingDir); - if (!workingDir.empty()) { - workingDir += "/"; - } - workingDir += "Objs"; - fout << " -object_dir=\"" << workingDir << "\"" << std::endl; -} - std::string cmGhsMultiTargetGenerator::GetOutputDirectory( const std::string& config) const { diff --git a/Source/cmGhsMultiTargetGenerator.h b/Source/cmGhsMultiTargetGenerator.h index 6ba110a..4523498 100644 --- a/Source/cmGhsMultiTargetGenerator.h +++ b/Source/cmGhsMultiTargetGenerator.h @@ -60,8 +60,8 @@ private: bool IsTargetGroup() const { return this->TargetGroup; } - void WriteTypeSpecifics(std::ostream& fout, const std::string& config, - bool notKernel); + void WriteTargetSpecifics(std::ostream& fout, const std::string& config, + bool notKernel); void WriteCompilerFlags(std::ostream& fout, const std::string& config, const std::string& language); void WriteCompilerDefinitions(std::ostream& fout, const std::string& config, @@ -87,7 +87,6 @@ private: cmGeneratorTarget* generatorTarget); static void WriteObjectLangOverride(std::ostream* fout, const cmSourceFile* sourceFile); - static void WriteObjectDir(std::ostream& fout, std::string const& dir); std::string GetOutputDirectory(const std::string& config) const; std::string GetOutputFilename(const std::string& config) const; static std::string ComputeLongestObjectDirectory( @@ -115,8 +114,10 @@ private: std::map FlagsByLanguage; std::map DefinesByLanguage; + std::string TargetNameReal; GhsMultiGpj::Types TagType; std::string const Name; + std::string ConfigName; /* CMAKE_BUILD_TYPE */ }; #endif // ! cmGhsMultiTargetGenerator_h diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index f0f1154..7d1e594 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -41,6 +41,18 @@ void cmGlobalGhsMultiGenerator::GetDocumentation(cmDocumentationEntry& entry) "Generates Green Hills MULTI files (experimental, work-in-progress)."; } +void cmGlobalGhsMultiGenerator::ComputeTargetObjectDirectory( + cmGeneratorTarget* gt) const +{ + // Compute full path to object file directory for this target. + std::string dir; + dir += gt->LocalGenerator->GetCurrentBinaryDirectory(); + dir += "/"; + dir += gt->LocalGenerator->GetTargetDirectory(gt); + dir += "/"; + gt->ObjectDirectory = dir; +} + bool cmGlobalGhsMultiGenerator::SetGeneratorToolset(std::string const& ts, cmMakefile* mf) { diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h index 8b81ba3..d992f89 100644 --- a/Source/cmGlobalGhsMultiGenerator.h +++ b/Source/cmGlobalGhsMultiGenerator.h @@ -63,6 +63,8 @@ public: */ bool FindMakeProgram(cmMakefile* mf) override; + void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const override; + cmGeneratedFileStream* GetBuildFileStream() { return this->TargetFolderBuildStreams[""]; diff --git a/Source/cmLocalGhsMultiGenerator.cxx b/Source/cmLocalGhsMultiGenerator.cxx index 3679c3e..b539a1c 100644 --- a/Source/cmLocalGhsMultiGenerator.cxx +++ b/Source/cmLocalGhsMultiGenerator.cxx @@ -18,6 +18,15 @@ cmLocalGhsMultiGenerator::~cmLocalGhsMultiGenerator() { } +std::string cmLocalGhsMultiGenerator::GetTargetDirectory( + cmGeneratorTarget const* target) const +{ + std::string dir; + dir += target->GetName(); + dir += ".dir"; + return dir; +} + void cmLocalGhsMultiGenerator::GenerateTargetsDepthFirst( cmGeneratorTarget* target, std::vector& remaining) { diff --git a/Source/cmLocalGhsMultiGenerator.h b/Source/cmLocalGhsMultiGenerator.h index 8e88205..1f55420 100644 --- a/Source/cmLocalGhsMultiGenerator.h +++ b/Source/cmLocalGhsMultiGenerator.h @@ -25,6 +25,9 @@ public: */ virtual void Generate(); + std::string GetTargetDirectory( + cmGeneratorTarget const* target) const override; + private: void GenerateTargetsDepthFirst(cmGeneratorTarget* target, std::vector& remaining); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ead7117afda23d7cf0c1466ce5229d06240d3de0 commit ead7117afda23d7cf0c1466ce5229d06240d3de0 Author: Fred Baksik AuthorDate: Sat Jan 5 11:01:21 2019 -0500 Commit: Fred Baksik CommitDate: Wed Jan 16 10:41:20 2019 -0500 GHS: Update the top-level project generation -- Sort targets by name -- Generate a top-level project for each project command named as project.top.gpj Use the target set for the current project instead of assuming all targets -- Add support for building projects not in binary root -- Directly create files and pass ostream -- Do no generate project files for UTILITY targets; this was never supported -- Do no generate project files for OBJECT, SHARED, or MODULE libraries; this was never supported -- Update GHS tags to support project types NOTE: The default tag is changed to "" because "[ ]" is an invalid token in project file diff --git a/Source/cmGhsMultiGpj.cxx b/Source/cmGhsMultiGpj.cxx index f58cfc1..c0f37ba 100644 --- a/Source/cmGhsMultiGpj.cxx +++ b/Source/cmGhsMultiGpj.cxx @@ -4,31 +4,35 @@ #include "cmGeneratedFileStream.h" -void GhsMultiGpj::WriteGpjTag(Types const gpjType, - cmGeneratedFileStream* const filestream) +static const char* GHS_TAG[] = { "[INTEGRITY Application]", + "[Library]", + "[Project]", + "[Program]", + "[Reference]", + "[Subproject]" }; + +const char* GhsMultiGpj::GetGpjTag(Types const gpjType) { char const* tag; switch (gpjType) { case INTERGRITY_APPLICATION: - tag = "INTEGRITY Application"; - break; case LIBRARY: - tag = "Library"; - break; case PROJECT: - tag = "Project"; - break; case PROGRAM: - tag = "Program"; - break; case REFERENCE: - tag = "Reference"; - break; case SUBPROJECT: - tag = "Subproject"; + tag = GHS_TAG[gpjType]; break; default: tag = ""; } - *filestream << "[" << tag << "]" << std::endl; + return tag; +} + +void GhsMultiGpj::WriteGpjTag(Types const gpjType, + cmGeneratedFileStream* const filestream) +{ + char const* tag; + tag = GhsMultiGpj::GetGpjTag(gpjType); + *filestream << tag << std::endl; } diff --git a/Source/cmGhsMultiGpj.h b/Source/cmGhsMultiGpj.h index b1eead1..014f6b6 100644 --- a/Source/cmGhsMultiGpj.h +++ b/Source/cmGhsMultiGpj.h @@ -22,6 +22,8 @@ public: static void WriteGpjTag(Types const gpjType, cmGeneratedFileStream* filestream); + + static const char* GetGpjTag(Types const gpjType); }; #endif // ! cmGhsMultiGpjType_h diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index 4fcc63d..0e0607d 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -101,10 +101,59 @@ std::string cmGhsMultiTargetGenerator::AddSlashIfNeededToPath( void cmGhsMultiTargetGenerator::Generate() { + // Determine type of target for this project + switch (this->GeneratorTarget->GetType()) { + case cmStateEnums::EXECUTABLE: { + if (cmGhsMultiTargetGenerator::DetermineIfTargetGroup( + this->GeneratorTarget)) { + this->TagType = GhsMultiGpj::INTERGRITY_APPLICATION; + } else { + this->TagType = GhsMultiGpj::PROGRAM; + } + break; + } + case cmStateEnums::STATIC_LIBRARY: { + this->TagType = GhsMultiGpj::LIBRARY; + break; + } + case cmStateEnums::SHARED_LIBRARY: { + std::string msg = "add_library( SHARED ...) not supported: "; + msg += this->Name; + cmSystemTools::Message(msg.c_str()); + return; + } + case cmStateEnums::OBJECT_LIBRARY: { + std::string msg = "add_library( OBJECT ...) not supported: "; + msg += this->Name; + cmSystemTools::Message(msg.c_str()); + return; + } + case cmStateEnums::MODULE_LIBRARY: { + std::string msg = "add_library( MODULE ...) not supported: "; + msg += this->Name; + cmSystemTools::Message(msg.c_str()); + return; + } + case cmStateEnums::UTILITY: { + std::string msg = "add_custom_target( ...) not supported: "; + msg += this->Name; + cmSystemTools::Message(msg.c_str()); + return; + } + default: + return; + } // Tell the global generator the name of the project file this->GeneratorTarget->Target->SetProperty("GENERATOR_FILE_NAME", this->Name.c_str()); + this->GeneratorTarget->Target->SetProperty( + "GENERATOR_FILE_NAME_EXT", GhsMultiGpj::GetGpjTag(this->TagType)); + + this->GenerateTarget(); +} +void cmGhsMultiTargetGenerator::GenerateTarget() +{ // Skip if empty or not included in build if (!this->GetSources().empty() && this->IncludeThisTarget()) { @@ -129,7 +178,7 @@ void cmGhsMultiTargetGenerator::Generate() if (this->DynamicDownload) { fout << "#component integrity_dynamic_download" << std::endl; } - GhsMultiGpj::WriteGpjTag(this->GetGpjTag(), &fout); + GhsMultiGpj::WriteGpjTag(this->TagType, &fout); cmGlobalGhsMultiGenerator::WriteDisclaimer(&fout); bool const notKernel = this->IsNotKernel(config, language); @@ -168,25 +217,6 @@ std::vector cmGhsMultiTargetGenerator::GetSources() const return output; } -GhsMultiGpj::Types cmGhsMultiTargetGenerator::GetGpjTag() const -{ - return cmGhsMultiTargetGenerator::GetGpjTag(this->GeneratorTarget); -} - -GhsMultiGpj::Types cmGhsMultiTargetGenerator::GetGpjTag( - const cmGeneratorTarget* target) -{ - GhsMultiGpj::Types output; - if (cmGhsMultiTargetGenerator::DetermineIfTargetGroup(target)) { - output = GhsMultiGpj::INTERGRITY_APPLICATION; - } else if (target->GetType() == cmStateEnums::STATIC_LIBRARY) { - output = GhsMultiGpj::LIBRARY; - } else { - output = GhsMultiGpj::PROGRAM; - } - return output; -} - cmGlobalGhsMultiGenerator* cmGhsMultiTargetGenerator::GetGlobalGenerator() const { diff --git a/Source/cmGhsMultiTargetGenerator.h b/Source/cmGhsMultiTargetGenerator.h index a54901d..6ba110a 100644 --- a/Source/cmGhsMultiTargetGenerator.h +++ b/Source/cmGhsMultiTargetGenerator.h @@ -26,8 +26,6 @@ public: bool IncludeThisTarget(); std::vector GetSources() const; - GhsMultiGpj::Types GetGpjTag() const; - static GhsMultiGpj::Types GetGpjTag(const cmGeneratorTarget* target); const char* GetAbsBuildFilePath() const { return this->AbsBuildFilePath.c_str(); @@ -58,6 +56,8 @@ private: { return this->FolderBuildStreams[""]; }; + void GenerateTarget(); + bool IsTargetGroup() const { return this->TargetGroup; } void WriteTypeSpecifics(std::ostream& fout, const std::string& config, @@ -114,6 +114,8 @@ private: static std::string const DDOption; std::map FlagsByLanguage; std::map DefinesByLanguage; + + GhsMultiGpj::Types TagType; std::string const Name; }; diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 92b7661..f0f1154 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -209,25 +209,24 @@ void cmGlobalGhsMultiGenerator::OpenBuildFileStream( { *filestream << "#!gbuild" << std::endl; } +/* temporary until all file handling is cleaned up */ +void cmGlobalGhsMultiGenerator::OpenBuildFileStream(std::ostream& fout) +{ + fout << "#!gbuild" << std::endl; +} -void cmGlobalGhsMultiGenerator::OpenBuildFileStream() +void cmGlobalGhsMultiGenerator::WriteTopLevelProject( + std::ostream& fout, cmLocalGenerator* root, + std::vector& generators) { - // Compute GHS MULTI's build file path. - std::string buildFilePath = - this->GetCMakeInstance()->GetHomeOutputDirectory(); - buildFilePath += "/"; - buildFilePath += - this->GetCMakeInstance()->GetCurrentSnapshot().GetProjectName(); - buildFilePath += FILE_EXTENSION; - - this->Open(std::string(""), buildFilePath, &this->TargetFolderBuildStreams); - OpenBuildFileStream(GetBuildFileStream()); - - this->WriteMacros(); - this->WriteHighLevelDirectives(); - GhsMultiGpj::WriteGpjTag(GhsMultiGpj::PROJECT, this->GetBuildFileStream()); - this->WriteDisclaimer(this->GetBuildFileStream()); - *this->GetBuildFileStream() << "# Top Level Project File" << std::endl; + OpenBuildFileStream(fout); + + this->WriteMacros(fout); + this->WriteHighLevelDirectives(fout); + // GhsMultiGpj::WriteGpjTag(GhsMultiGpj::PROJECT, &fout); + fout << "[Project]" << std::endl; + this->WriteDisclaimer(&fout); + fout << "# Top Level Project File" << std::endl; // Specify BSP option if supplied by user // -- not all platforms require this entry in the project file @@ -256,7 +255,7 @@ void cmGlobalGhsMultiGenerator::OpenBuildFileStream() } if (!cmSystemTools::IsOff(bspName.c_str())) { - *this->GetBuildFileStream() << " -bsp " << bspName << std::endl; + fout << " -bsp " << bspName << std::endl; } // Specify OS DIR if supplied by user @@ -276,8 +275,46 @@ void cmGlobalGhsMultiGenerator::OpenBuildFileStream() if (!cmSystemTools::IsOff(osDir.c_str()) || platform.find("integrity") != std::string::npos) { std::replace(osDir.begin(), osDir.end(), '\\', '/'); - *this->GetBuildFileStream() - << " " << osDirOption << "\"" << osDir << "\"" << std::endl; + fout << " " << osDirOption << "\"" << osDir << "\"" << std::endl; + } + + WriteSubProjects(fout, root, generators); +} + +void cmGlobalGhsMultiGenerator::WriteSubProjects( + std::ostream& fout, cmLocalGenerator* root, + std::vector& generators) +{ + // Collect all targets under this root generator and the transitive + // closure of their dependencies. + TargetDependSet projectTargets; + TargetDependSet originalTargets; + this->GetTargetSets(projectTargets, originalTargets, root, generators); + OrderedTargetDependSet orderedProjectTargets(projectTargets, ""); + + // write out all the sub-projects + std::string rootBinaryDir = root->GetCurrentBinaryDirectory(); + for (cmGeneratorTarget const* target : orderedProjectTargets) { + if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) { + continue; + } + + const char* projName = target->GetProperty("GENERATOR_FILE_NAME"); + const char* projType = target->GetProperty("GENERATOR_FILE_NAME_EXT"); + if (projName && projType) { + cmLocalGenerator* lg = target->GetLocalGenerator(); + std::string dir = lg->GetCurrentBinaryDirectory(); + dir = root->ConvertToRelativePath(rootBinaryDir, dir.c_str()); + if (dir == ".") { + dir.clear(); + } else { + if (dir.back() != '/') { + dir += "/"; + } + } + fout << dir << projName << FILE_EXTENSION; + fout << " " << projType << std::endl; + } } } @@ -294,27 +331,43 @@ void cmGlobalGhsMultiGenerator::CloseBuildFileStream( void cmGlobalGhsMultiGenerator::Generate() { + // first do the superclass method this->cmGlobalGenerator::Generate(); - if (!this->LocalGenerators.empty()) { - this->OpenBuildFileStream(); + // output top-level projects + for (auto& it : this->ProjectMap) { + this->OutputTopLevelProject(it.second[0], it.second); + } +} - // Build all the folder build files - for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i) { - cmLocalGhsMultiGenerator* lg = - static_cast(this->LocalGenerators[i]); - const std::vector& tgts = lg->GetGeneratorTargets(); - this->UpdateBuildFiles(tgts); - } +void cmGlobalGhsMultiGenerator::OutputTopLevelProject( + cmLocalGenerator* root, std::vector& generators) +{ + if (generators.empty()) { + return; } - cmDeleteAll(TargetFolderBuildStreams); - this->TargetFolderBuildStreams.clear(); + /* Name top-level projects as filename.top.gpj to avoid name clashes + * with target projects. This avoid the issue where the project has + * the same name as the executable target. + */ + std::string fname = root->GetCurrentBinaryDirectory(); + fname += "/"; + fname += root->GetProjectName(); + fname += ".top"; + fname += FILE_EXTENSION; + + cmGeneratedFileStream fout(fname.c_str()); + fout.SetCopyIfDifferent(true); + + this->WriteTopLevelProject(fout, root, generators); + + fout.Close(); } void cmGlobalGhsMultiGenerator::GenerateBuildCommand( std::vector& makeCommand, const std::string& makeProgram, - const std::string& projectName, const std::string& /*projectDir*/, + const std::string& projectName, const std::string& projectDir, const std::string& targetName, const std::string& /*config*/, bool /*fast*/, int jobs, bool /*verbose*/, std::vector const& makeOptions) { @@ -332,8 +385,20 @@ void cmGlobalGhsMultiGenerator::GenerateBuildCommand( makeCommand.insert(makeCommand.end(), makeOptions.begin(), makeOptions.end()); + + /* determine which top-project file to use */ + std::string proj = projectName + ".top" + FILE_EXTENSION; + std::vector files; + cmSystemTools::Glob(projectDir, ".*\\.top\\.gpj", files); + if (!files.empty()) { + auto p = std::find(files.begin(), files.end(), proj); + if (p == files.end()) { + proj = files.at(0); + } + } + makeCommand.push_back("-top"); - makeCommand.push_back(projectName + FILE_EXTENSION); + makeCommand.push_back(proj); if (!targetName.empty()) { if (targetName == "clean") { makeCommand.push_back("-clean"); @@ -343,7 +408,7 @@ void cmGlobalGhsMultiGenerator::GenerateBuildCommand( } } -void cmGlobalGhsMultiGenerator::WriteMacros() +void cmGlobalGhsMultiGenerator::WriteMacros(std::ostream& fout) { char const* ghsGpjMacros = this->GetCMakeInstance()->GetCacheDefinition("GHS_GPJ_MACROS"); @@ -353,12 +418,12 @@ void cmGlobalGhsMultiGenerator::WriteMacros() for (std::vector::const_iterator expandedListI = expandedList.begin(); expandedListI != expandedList.end(); ++expandedListI) { - *this->GetBuildFileStream() << "macro " << *expandedListI << std::endl; + fout << "macro " << *expandedListI << std::endl; } } } -void cmGlobalGhsMultiGenerator::WriteHighLevelDirectives() +void cmGlobalGhsMultiGenerator::WriteHighLevelDirectives(std::ostream& fout) { /* set primary target */ std::string tgt; @@ -378,13 +443,12 @@ void cmGlobalGhsMultiGenerator::WriteHighLevelDirectives() tgt += ".tgt"; } - *this->GetBuildFileStream() << "primaryTarget=" << tgt << std::endl; + fout << "primaryTarget=" << tgt << std::endl; char const* const customization = this->GetCMakeInstance()->GetCacheDefinition("GHS_CUSTOMIZATION"); if (NULL != customization && strlen(customization) > 0) { - *this->GetBuildFileStream() - << "customization=" << trimQuotes(customization) << std::endl; + fout << "customization=" << trimQuotes(customization) << std::endl; this->GetCMakeInstance()->MarkCliAsUsed("GHS_CUSTOMIZATION"); } } @@ -499,33 +563,6 @@ std::string cmGlobalGhsMultiGenerator::GetFileNameFromPath( return output; } -void cmGlobalGhsMultiGenerator::UpdateBuildFiles( - const std::vector& tgts) -{ - for (std::vector::const_iterator tgtsI = tgts.begin(); - tgtsI != tgts.end(); ++tgtsI) { - const cmGeneratorTarget* tgt = *tgtsI; - if (IsTgtForBuild(tgt)) { - std::string folderName = tgt->GetEffectiveFolderName(); - if (this->TargetFolderBuildStreams.end() == - this->TargetFolderBuildStreams.find(folderName)) { - this->AddFilesUpToPath( - GetBuildFileStream(), &this->TargetFolderBuildStreams, - this->GetCMakeInstance()->GetHomeOutputDirectory().c_str(), - folderName, GhsMultiGpj::PROJECT); - } - std::vector splitPath = cmSystemTools::SplitString( - cmGhsMultiTargetGenerator::GetRelBuildFileName(tgt)); - std::string foldNameRelBuildFile(*(splitPath.end() - 2) + "/" + - splitPath.back()); - *this->TargetFolderBuildStreams[folderName] << foldNameRelBuildFile - << " "; - GhsMultiGpj::WriteGpjTag(cmGhsMultiTargetGenerator::GetGpjTag(tgt), - this->TargetFolderBuildStreams[folderName]); - } - } -} - bool cmGlobalGhsMultiGenerator::IsTgtForBuild(const cmGeneratorTarget* tgt) { const std::string config = @@ -552,3 +589,25 @@ std::string cmGlobalGhsMultiGenerator::trimQuotes(std::string const& str) } return result; } + +bool cmGlobalGhsMultiGenerator::TargetCompare::operator()( + cmGeneratorTarget const* l, cmGeneratorTarget const* r) const +{ + // Make sure a given named target is ordered first, + // e.g. to set ALL_BUILD as the default active project. + // When the empty string is named this is a no-op. + if (r->GetName() == this->First) { + return false; + } + if (l->GetName() == this->First) { + return true; + } + return l->GetName() < r->GetName(); +} + +cmGlobalGhsMultiGenerator::OrderedTargetDependSet::OrderedTargetDependSet( + TargetDependSet const& targets, std::string const& first) + : derived(TargetCompare(first)) +{ + this->insert(targets.begin(), targets.end()); +} diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h index e0d428e..8b81ba3 100644 --- a/Source/cmGlobalGhsMultiGenerator.h +++ b/Source/cmGlobalGhsMultiGenerator.h @@ -71,6 +71,7 @@ public: static void OpenBuildFileStream(std::string const& filepath, cmGeneratedFileStream** filestream); static void OpenBuildFileStream(cmGeneratedFileStream* filestream); + void OpenBuildFileStream(std::ostream& fout); static void CloseBuildFileStream(cmGeneratedFileStream** filestream); /// Write the common disclaimer text at the top of each build file. static void WriteDisclaimer(std::ostream* os); @@ -86,6 +87,24 @@ public: static std::string trimQuotes(std::string const& str); + // Target dependency sorting + class TargetSet : public std::set + { + }; + class TargetCompare + { + std::string First; + + public: + TargetCompare(std::string const& first) + : First(first) + { + } + bool operator()(cmGeneratorTarget const* l, + cmGeneratorTarget const* r) const; + }; + class OrderedTargetDependSet; + protected: void Generate() override; void GenerateBuildCommand(std::vector& makeCommand, @@ -100,10 +119,16 @@ protected: private: void GetToolset(cmMakefile* mf, std::string& tsd, std::string& ts); - void OpenBuildFileStream(); - void WriteMacros(); - void WriteHighLevelDirectives(); + /* top-level project */ + void OutputTopLevelProject(cmLocalGenerator* root, + std::vector& generators); + void WriteTopLevelProject(std::ostream& fout, cmLocalGenerator* root, + std::vector& generators); + void WriteMacros(std::ostream& fout); + void WriteHighLevelDirectives(std::ostream& fout); + void WriteSubProjects(std::ostream& fout, cmLocalGenerator* root, + std::vector& generators); static void AddFilesUpToPathNewBuildFile( cmGeneratedFileStream* mainBuildFile, @@ -116,7 +141,7 @@ private: std::vector::const_iterator splitPathI, std::vector::const_iterator end, GhsMultiGpj::Types projType); static std::string GetFileNameFromPath(std::string const& path); - void UpdateBuildFiles(const std::vector& tgts); + bool IsTgtForBuild(const cmGeneratorTarget* tgt); std::vector TargetSubProjects; @@ -128,4 +153,17 @@ private: static const char* DEFAULT_TOOLSET_ROOT; }; +class cmGlobalGhsMultiGenerator::OrderedTargetDependSet + : public std::multiset +{ + typedef std::multiset + derived; + +public: + typedef cmGlobalGenerator::TargetDependSet TargetDependSet; + OrderedTargetDependSet(TargetDependSet const&, std::string const& first); +}; + #endif https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e7825386e2e9e69728e5a5c3dcbc94814bb7cb1c commit e7825386e2e9e69728e5a5c3dcbc94814bb7cb1c Author: Fred Baksik AuthorDate: Sat Jan 5 11:01:21 2019 -0500 Commit: Fred Baksik CommitDate: Wed Jan 16 10:41:15 2019 -0500 GHS: Cleanup how source files are listed -- Sort the items of the project files, previously they were unsorted The layout is similar to Visual Studio projects -- Do not make a make a tree of directories and projects files The main project file is in the binary folder The sub-project files are located in the project object directory This is similar to the Makefile generator -- Allow the creation of a single project file If the variable or target property GHS_NO_SOURCE_GROUP_FILE is set then all sources will be listed in the main project file diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index 20f3f9e..4fcc63d 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -9,8 +9,8 @@ #include "cmLocalGhsMultiGenerator.h" #include "cmMakefile.h" #include "cmSourceFile.h" +#include "cmSourceGroup.h" #include "cmTarget.h" -#include std::string const cmGhsMultiTargetGenerator::DDOption("-dynamic"); @@ -106,8 +106,7 @@ void cmGhsMultiTargetGenerator::Generate() this->Name.c_str()); // Skip if empty or not included in build - std::vector objectSources = this->GetSources(); - if (!objectSources.empty() && this->IncludeThisTarget()) { + if (!this->GetSources().empty() && this->IncludeThisTarget()) { // Open the filestream in copy-if-different mode. std::string fname = this->LocalGenerator->GetCurrentBinaryDirectory(); @@ -143,13 +142,7 @@ void cmGhsMultiTargetGenerator::Generate() this->WriteTargetLinkLibraries(fout, config, language); } this->WriteCustomCommands(fout); - - std::map objectNames = - cmGhsMultiTargetGenerator::GetObjectNames( - &objectSources, this->LocalGenerator, this->GeneratorTarget); -#if 0 /* temp stub - this generates its own files */ - this->WriteSources(objectSources, objectNames); -#endif + this->WriteSources(fout); fout.Close(); } @@ -481,44 +474,154 @@ cmGhsMultiTargetGenerator::GetObjectNames( return objectNamesCorrected; } -void cmGhsMultiTargetGenerator::WriteSources( - std::vector const& objectSources, - std::map const& objectNames) +void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj) { - for (const cmSourceFile* sf : objectSources) { - std::vector sourceGroups(this->Makefile->GetSourceGroups()); - std::string const& sourceFullPath = sf->GetFullPath(); + /* vector of all sources for this target */ + std::vector sources = this->GetSources(); + + /* vector of all groups defined for this target + * -- but the vector is not expanded with sub groups or in any useful order + */ + std::vector sourceGroups = this->Makefile->GetSourceGroups(); + + /* for each source file assign it to its group */ + std::map> groupFiles; + std::set groupNames; + for (auto& sf : sources) { cmSourceGroup* sourceGroup = - this->Makefile->FindSourceGroup(sourceFullPath, sourceGroups); - std::string sgPath = sourceGroup->GetFullName(); - cmSystemTools::ConvertToUnixSlashes(sgPath); - cmGlobalGhsMultiGenerator::AddFilesUpToPath( - this->GetFolderBuildStreams(), &this->FolderBuildStreams, - this->LocalGenerator->GetBinaryDirectory().c_str(), sgPath, - GhsMultiGpj::SUBPROJECT, this->RelBuildFilePath); - - std::string fullSourcePath(sf->GetFullPath()); - if (sf->GetExtension() == "int" || sf->GetExtension() == "bsp") { - *this->FolderBuildStreams[sgPath] << fullSourcePath << std::endl; + this->Makefile->FindSourceGroup(sf->GetFullPath(), sourceGroups); + std::string gn = sourceGroup->GetFullName(); + groupFiles[gn].push_back(sf); + groupNames.insert(gn); + } + + /* list of known groups and the order they are displayed in a project file */ + const std::vector standardGroups = { + "Header Files", "Source Files", "CMake Rules", + "Object Files", "Object Libraries", "Resources" + }; + + /* list of groups in the order they are displayed in a project file*/ + std::vector groupFilesList(groupFiles.size()); + + /* put the groups in the order they should be listed + * - standard groups first, and then everything else + * in the order used by std::map. + */ + int i = 0; + for (const std::string& gn : standardGroups) { + auto n = groupNames.find(gn); + if (n != groupNames.end()) { + groupFilesList[i] = *n; + i += 1; + groupNames.erase(gn); + } + } + + { /* catch-all group - is last item */ + std::string gn = ""; + auto n = groupNames.find(gn); + if (n != groupNames.end()) { + groupFilesList.back() = *n; + groupNames.erase(gn); + } + } + + for (auto& n : groupNames) { + groupFilesList[i] = n; + i += 1; + } + + /* sort the files within each group */ + for (auto& n : groupFilesList) { + std::sort(groupFiles[n].begin(), groupFiles[n].end(), + [](cmSourceFile* l, cmSourceFile* r) { + return l->GetFullPath() < r->GetFullPath(); + }); + } + + /* get all the object names for these sources */ + std::map objectNames = + cmGhsMultiTargetGenerator::GetObjectNames(&sources, this->LocalGenerator, + this->GeneratorTarget); + + /* list of open project files */ + std::vector gfiles; + + /* write files into the proper project file + * -- groups go into main project file + * unless FOLDER property or variable is set. + */ + for (auto& sg : groupFilesList) { + std::ostream* fout; + bool useProjectFile = + cmSystemTools::IsOn( + this->GeneratorTarget->GetProperty("GHS_NO_SOURCE_GROUP_FILE")) || + cmSystemTools::IsOn( + this->Makefile->GetDefinition("GHS_NO_SOURCE_GROUP_FILE")); + if (useProjectFile || sg.empty()) { + fout = &fout_proj; } else { - // WORKAROUND: GHS MULTI needs the path to use backslashes without quotes - // to open files in search as of version 6.1.6 - cmsys::SystemTools::ReplaceString(fullSourcePath, "/", "\\"); - *this->FolderBuildStreams[sgPath] << fullSourcePath << std::endl; + // Open the filestream in copy-if-different mode. + std::string gname = sg; + cmsys::SystemTools::ReplaceString(gname, "\\", "_"); + std::string lpath = + this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget); + lpath += "/"; + lpath += gname; + lpath += cmGlobalGhsMultiGenerator::FILE_EXTENSION; + std::string fpath = this->LocalGenerator->GetCurrentBinaryDirectory(); + fpath += "/"; + fpath += lpath; + cmGeneratedFileStream* f = new cmGeneratedFileStream(fpath.c_str()); + f->SetCopyIfDifferent(true); + gfiles.push_back(f); + fout = f; + cmGlobalGhsMultiGenerator::OpenBuildFileStream(f); + *fout << "[Subproject]" << std::endl; + cmGlobalGhsMultiGenerator::WriteDisclaimer(f); + fout_proj << lpath << " "; + fout_proj << "[Subproject]" << std::endl; + } + + if (useProjectFile) { + if (sg.empty()) { + *fout << "{comment} Others" << std::endl; + } else { + *fout << "{comment} " << sg << std::endl; + } } - if ("ld" != sf->GetExtension() && "int" != sf->GetExtension() && - "bsp" != sf->GetExtension()) { - this->WriteObjectLangOverride(this->FolderBuildStreams[sgPath], sf); - if (objectNames.end() != objectNames.find(sf)) { - *this->FolderBuildStreams[sgPath] - << " -o \"" << objectNames.find(sf)->second << "\"" << std::endl; + /* output rule for each source file */ + for (const cmSourceFile* si : groupFiles[sg]) { + std::string fullSourcePath(si->GetFullPath()); + + if (si->GetExtension() == "int" || si->GetExtension() == "bsp") { + *fout << fullSourcePath << std::endl; + } else { + // WORKAROUND: GHS MULTI needs the path to use backslashes without + // quotes + // to open files in search as of version 6.1.6 + cmsys::SystemTools::ReplaceString(fullSourcePath, "/", "\\"); + *fout << fullSourcePath << std::endl; } - this->WriteObjectDir(this->FolderBuildStreams[sgPath], - this->AbsBuildFilePath + sgPath); + if ("ld" != si->GetExtension() && "int" != si->GetExtension() && + "bsp" != si->GetExtension()) { + this->WriteObjectLangOverride(fout, si); + if (objectNames.end() != objectNames.find(si)) { + *fout << " -o \"" << objectNames.find(si)->second << "\"" + << std::endl; + } + + this->WriteObjectDir(*fout, this->AbsBuildFilePath); + } } } + + for (cmGeneratedFileStream* f : gfiles) { + f->Close(); + } } void cmGhsMultiTargetGenerator::WriteObjectLangOverride( @@ -534,8 +637,8 @@ void cmGhsMultiTargetGenerator::WriteObjectLangOverride( } } -void cmGhsMultiTargetGenerator::WriteObjectDir( - cmGeneratedFileStream* fileStream, std::string const& dir) +void cmGhsMultiTargetGenerator::WriteObjectDir(std::ostream& fout, + std::string const& dir) { std::string workingDir(dir); cmSystemTools::ConvertToUnixSlashes(workingDir); @@ -543,7 +646,7 @@ void cmGhsMultiTargetGenerator::WriteObjectDir( workingDir += "/"; } workingDir += "Objs"; - *fileStream << " -object_dir=\"" << workingDir << "\"" << std::endl; + fout << " -object_dir=\"" << workingDir << "\"" << std::endl; } std::string cmGhsMultiTargetGenerator::GetOutputDirectory( diff --git a/Source/cmGhsMultiTargetGenerator.h b/Source/cmGhsMultiTargetGenerator.h index a80d6b2..a54901d 100644 --- a/Source/cmGhsMultiTargetGenerator.h +++ b/Source/cmGhsMultiTargetGenerator.h @@ -80,17 +80,14 @@ private: void WriteCustomCommandsHelper( std::ostream& fout, std::vector const& commandsSet, cmTarget::CustomCommandType commandType); - void WriteSources( - std::vector const& objectSources, - std::map const& objectNames); + void WriteSources(std::ostream& fout_proj); static std::map GetObjectNames( std::vector* objectSources, cmLocalGhsMultiGenerator* localGhsMultiGenerator, cmGeneratorTarget* generatorTarget); static void WriteObjectLangOverride(std::ostream* fout, const cmSourceFile* sourceFile); - static void WriteObjectDir(cmGeneratedFileStream* fileStream, - std::string const& dir); + static void WriteObjectDir(std::ostream& fout, std::string const& dir); std::string GetOutputDirectory(const std::string& config) const; std::string GetOutputFilename(const std::string& config) const; static std::string ComputeLongestObjectDirectory( diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 1bdb6f3..f06bfbf 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -2298,7 +2298,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release add_test_GhsMulti_rename_install(SINGLE_EXEC_RENAMED) add_test_GhsMulti_rename_install(EXEC_AND_LIB) add_test_GhsMulti(multiple_source_groups GhsMultiSrcGroups Default "" "") - add_test_GhsMulti(multiple_source_groups_folders GhsMultiSrcGroups Folders "-DCMAKE_FOLDER=ON" "") + add_test_GhsMulti(multiple_source_groups_folders GhsMultiSrcGroups PropFolders "-DTEST_PROP=ON" "") + add_test_GhsMulti(multiple_source_groups_all_folders GhsMultiSrcGroups AllFolders "-DGHS_NO_SOURCE_GROUP_FILE=ON" "") add_test_GhsMulti(unsupported_targets GhsMultiUnsupportedTargets "" "" "") set_tests_properties(GhsMulti.${ghs_config_name}.unsupported_targets PROPERTIES TIMEOUT 15) add_test_GhsMulti(object_library GhsMultiObjectLibrary "" "" "") diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/CMakeLists.txt b/Tests/GhsMulti/GhsMultiSrcGroups/CMakeLists.txt index 5043e7f..a4f84ca 100644 --- a/Tests/GhsMulti/GhsMultiSrcGroups/CMakeLists.txt +++ b/Tests/GhsMulti/GhsMultiSrcGroups/CMakeLists.txt @@ -32,6 +32,9 @@ add_executable(groups standard.h ) +if(TEST_PROP) + set_target_properties(groups PROPERTIES GHS_NO_SOURCE_GROUP_FILE ON) +endif() source_group( gC FILES sub/testOBJ.h testOBJ.c testOBJ.h sub/testOBJ.c ) source_group( gA FILES test1.c test1.h) source_group( gB test[65].c ) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=447b57a2676b5bb7e9f97b15c9fe5fe7d3817a86 commit 447b57a2676b5bb7e9f97b15c9fe5fe7d3817a86 Author: Fred Baksik AuthorDate: Sat Jan 5 11:01:20 2019 -0500 Commit: Fred Baksik CommitDate: Wed Jan 16 10:41:11 2019 -0500 GHS: Update binary structure so that install scripts work GHS doesn't follow the binary structure that VS or Makefiles use Also setting binary location outputs do not work -- Update to act like Visual Studio Generator and use its project layout -- Fix open/close issues where open() was used instead of Open() Now passes the file handle to all function that require it -- Avoid triggering MULTI reloads; use SetCopyIfDifferent mode diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index 1a25633..20f3f9e 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -21,6 +21,7 @@ cmGhsMultiTargetGenerator::cmGhsMultiTargetGenerator(cmGeneratorTarget* target) , Makefile(target->Target->GetMakefile()) , TargetGroup(DetermineIfTargetGroup(target)) , DynamicDownload(false) + , Name(target->GetName()) { this->RelBuildFilePath = this->GetRelBuildFilePath(target); @@ -100,15 +101,24 @@ std::string cmGhsMultiTargetGenerator::AddSlashIfNeededToPath( void cmGhsMultiTargetGenerator::Generate() { + // Tell the global generator the name of the project file + this->GeneratorTarget->Target->SetProperty("GENERATOR_FILE_NAME", + this->Name.c_str()); + + // Skip if empty or not included in build std::vector objectSources = this->GetSources(); if (!objectSources.empty() && this->IncludeThisTarget()) { - if (!cmSystemTools::FileExists(this->AbsBuildFilePath.c_str())) { - cmSystemTools::MakeDirectory(this->AbsBuildFilePath.c_str()); - } - cmGlobalGhsMultiGenerator::Open(std::string(""), this->AbsBuildFileName, - &this->FolderBuildStreams); - cmGlobalGhsMultiGenerator::OpenBuildFileStream( - this->GetFolderBuildStreams()); + + // Open the filestream in copy-if-different mode. + std::string fname = this->LocalGenerator->GetCurrentBinaryDirectory(); + fname += "/"; + fname += this->Name; + fname += cmGlobalGhsMultiGenerator::FILE_EXTENSION; + cmGeneratedFileStream fout(fname.c_str()); + fout.SetCopyIfDifferent(true); + + cmGlobalGhsMultiGenerator::OpenBuildFileStream(&fout); + std::string config = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); if (0 == config.length()) { config = "RELEASE"; @@ -118,28 +128,30 @@ void cmGhsMultiTargetGenerator::Generate() config = cmSystemTools::UpperCase(config); this->DynamicDownload = this->DetermineIfDynamicDownload(config, language); if (this->DynamicDownload) { - *this->GetFolderBuildStreams() - << "#component integrity_dynamic_download" << std::endl; + fout << "#component integrity_dynamic_download" << std::endl; } - GhsMultiGpj::WriteGpjTag(this->GetGpjTag(), this->GetFolderBuildStreams()); - cmGlobalGhsMultiGenerator::WriteDisclaimer(this->GetFolderBuildStreams()); + GhsMultiGpj::WriteGpjTag(this->GetGpjTag(), &fout); + cmGlobalGhsMultiGenerator::WriteDisclaimer(&fout); bool const notKernel = this->IsNotKernel(config, language); - this->WriteTypeSpecifics(config, notKernel); + this->WriteTypeSpecifics(fout, config, notKernel); this->SetCompilerFlags(config, language, notKernel); - this->WriteCompilerFlags(config, language); - this->WriteCompilerDefinitions(config, language); - this->WriteIncludes(config, language); + this->WriteCompilerFlags(fout, config, language); + this->WriteCompilerDefinitions(fout, config, language); + this->WriteIncludes(fout, config, language); if (this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE) { - this->WriteTargetLinkLibraries(config, language); + this->WriteTargetLinkLibraries(fout, config, language); } - this->WriteCustomCommands(); + this->WriteCustomCommands(fout); std::map objectNames = cmGhsMultiTargetGenerator::GetObjectNames( &objectSources, this->LocalGenerator, this->GeneratorTarget); - +#if 0 /* temp stub - this generates its own files */ this->WriteSources(objectSources, objectNames); +#endif + + fout.Close(); } } @@ -189,7 +201,8 @@ cmGlobalGhsMultiGenerator* cmGhsMultiTargetGenerator::GetGlobalGenerator() this->LocalGenerator->GetGlobalGenerator()); } -void cmGhsMultiTargetGenerator::WriteTypeSpecifics(const std::string& config, +void cmGhsMultiTargetGenerator::WriteTypeSpecifics(std::ostream& fout, + const std::string& config, bool const notKernel) { std::string outputDir(this->GetOutputDirectory(config)); @@ -198,25 +211,22 @@ void cmGhsMultiTargetGenerator::WriteTypeSpecifics(const std::string& config, if (this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY) { std::string const& static_library_suffix = this->Makefile->GetSafeDefinition("CMAKE_STATIC_LIBRARY_SUFFIX"); - *this->GetFolderBuildStreams() - << " -o \"" << outputDir << outputFilename << static_library_suffix - << "\"" << std::endl; + fout << " -o \"" << outputDir << outputFilename << static_library_suffix + << "\"" << std::endl; } else if (this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE) { if (notKernel && !this->IsTargetGroup()) { - *this->GetFolderBuildStreams() << " -relprog" << std::endl; + fout << " -relprog" << std::endl; } if (this->IsTargetGroup()) { - *this->GetFolderBuildStreams() - << " -o \"" << outputDir << outputFilename << ".elf\"" << std::endl; - *this->GetFolderBuildStreams() - << " :extraOutputFile=\"" << outputDir << outputFilename - << ".elf.ael\"" << std::endl; + fout << " -o \"" << outputDir << outputFilename << ".elf\"" + << std::endl; + fout << " :extraOutputFile=\"" << outputDir << outputFilename + << ".elf.ael\"" << std::endl; } else { std::string const executable_suffix = this->Makefile->GetSafeDefinition("CMAKE_EXECUTABLE_SUFFIX"); - *this->GetFolderBuildStreams() - << " -o \"" << outputDir << outputFilename << executable_suffix - << "\"" << std::endl; + fout << " -o \"" << outputDir << outputFilename << executable_suffix + << "\"" << std::endl; } } } @@ -281,21 +291,21 @@ std::string cmGhsMultiTargetGenerator::GetDefines(const std::string& language, return i->second; } -void cmGhsMultiTargetGenerator::WriteCompilerFlags(std::string const&, +void cmGhsMultiTargetGenerator::WriteCompilerFlags(std::ostream& fout, + std::string const&, const std::string& language) { std::map::iterator flagsByLangI = this->FlagsByLanguage.find(language); if (flagsByLangI != this->FlagsByLanguage.end()) { if (!flagsByLangI->second.empty()) { - *this->GetFolderBuildStreams() - << " " << flagsByLangI->second << std::endl; + fout << " " << flagsByLangI->second << std::endl; } } } void cmGhsMultiTargetGenerator::WriteCompilerDefinitions( - const std::string& config, const std::string& language) + std::ostream& fout, const std::string& config, const std::string& language) { std::vector compileDefinitions; this->GeneratorTarget->GetCompileDefinitions(compileDefinitions, config, @@ -303,11 +313,12 @@ void cmGhsMultiTargetGenerator::WriteCompilerDefinitions( for (std::vector::const_iterator cdI = compileDefinitions.begin(); cdI != compileDefinitions.end(); ++cdI) { - *this->GetFolderBuildStreams() << " -D" << (*cdI) << std::endl; + fout << " -D" << (*cdI) << std::endl; } } -void cmGhsMultiTargetGenerator::WriteIncludes(const std::string& config, +void cmGhsMultiTargetGenerator::WriteIncludes(std::ostream& fout, + const std::string& config, const std::string& language) { std::vector includes; @@ -316,13 +327,12 @@ void cmGhsMultiTargetGenerator::WriteIncludes(const std::string& config, for (std::vector::const_iterator includes_i = includes.begin(); includes_i != includes.end(); ++includes_i) { - *this->GetFolderBuildStreams() - << " -I\"" << *includes_i << "\"" << std::endl; + fout << " -I\"" << *includes_i << "\"" << std::endl; } } void cmGhsMultiTargetGenerator::WriteTargetLinkLibraries( - std::string const& config, std::string const& language) + std::ostream& fout, std::string const& config, std::string const& language) { // library directories cmTargetDependSet tds = @@ -330,8 +340,7 @@ void cmGhsMultiTargetGenerator::WriteTargetLinkLibraries( for (cmTargetDependSet::iterator tdsI = tds.begin(); tdsI != tds.end(); ++tdsI) { const cmGeneratorTarget* tg = *tdsI; - *this->GetFolderBuildStreams() - << " -L\"" << GetAbsBuildFilePath(tg) << "\"" << std::endl; + fout << " -L\"" << GetAbsBuildFilePath(tg) << "\"" << std::endl; } // library targets cmTarget::LinkLibraryVectorType llv = @@ -344,8 +353,7 @@ void cmGhsMultiTargetGenerator::WriteTargetLinkLibraries( if (NULL != tg) { libName = tg->GetName() + ".a"; } - *this->GetFolderBuildStreams() - << " -l\"" << libName << "\"" << std::endl; + fout << " -l\"" << libName << "\"" << std::endl; } if (!this->TargetGroup) { @@ -371,25 +379,25 @@ void cmGhsMultiTargetGenerator::WriteTargetLinkLibraries( if (!linkPath.empty()) { linkPath = " " + linkPath.substr(0U, linkPath.size() - 1U); - *this->GetFolderBuildStreams() << linkPath; + fout << linkPath; } if (!linkFlags.empty()) { - *this->GetFolderBuildStreams() << " " << linkFlags << std::endl; + fout << " " << linkFlags << std::endl; } } } -void cmGhsMultiTargetGenerator::WriteCustomCommands() +void cmGhsMultiTargetGenerator::WriteCustomCommands(std::ostream& fout) { - WriteCustomCommandsHelper(this->GeneratorTarget->GetPreBuildCommands(), + WriteCustomCommandsHelper(fout, this->GeneratorTarget->GetPreBuildCommands(), cmTarget::PRE_BUILD); - WriteCustomCommandsHelper(this->GeneratorTarget->GetPostBuildCommands(), - cmTarget::POST_BUILD); + WriteCustomCommandsHelper( + fout, this->GeneratorTarget->GetPostBuildCommands(), cmTarget::POST_BUILD); } void cmGhsMultiTargetGenerator::WriteCustomCommandsHelper( - std::vector const& commandsSet, + std::ostream& fout, std::vector const& commandsSet, cmTarget::CustomCommandType const commandType) { for (std::vector::const_iterator commandsSetI = @@ -400,10 +408,10 @@ void cmGhsMultiTargetGenerator::WriteCustomCommandsHelper( commandI != commands.end(); ++commandI) { switch (commandType) { case cmTarget::PRE_BUILD: - *this->GetFolderBuildStreams() << " :preexecShellSafe="; + fout << " :preexecShellSafe="; break; case cmTarget::POST_BUILD: - *this->GetFolderBuildStreams() << " :postexecShellSafe="; + fout << " :postexecShellSafe="; break; default: assert("Only pre and post are supported"); @@ -414,15 +422,14 @@ void cmGhsMultiTargetGenerator::WriteCustomCommandsHelper( std::string subCommandE = this->LocalGenerator->EscapeForShell(*commandLineI, true); if (!command.empty()) { - *this->GetFolderBuildStreams() - << (command.begin() == commandLineI ? "'" : " "); + fout << (command.begin() == commandLineI ? "'" : " "); // Need to double escape backslashes cmSystemTools::ReplaceString(subCommandE, "\\", "\\\\"); } - *this->GetFolderBuildStreams() << subCommandE; + fout << subCommandE; } if (!command.empty()) { - *this->GetFolderBuildStreams() << "'" << std::endl; + fout << "'" << std::endl; } } } @@ -515,14 +522,14 @@ void cmGhsMultiTargetGenerator::WriteSources( } void cmGhsMultiTargetGenerator::WriteObjectLangOverride( - cmGeneratedFileStream* fileStream, const cmSourceFile* sourceFile) + std::ostream* fout, const cmSourceFile* sourceFile) { const char* rawLangProp = sourceFile->GetProperty("LANGUAGE"); if (NULL != rawLangProp) { std::string sourceLangProp(rawLangProp); std::string extension(sourceFile->GetExtension()); if ("CXX" == sourceLangProp && ("c" == extension || "C" == extension)) { - *fileStream << " -dotciscxx" << std::endl; + *fout << " -dotciscxx" << std::endl; } } } diff --git a/Source/cmGhsMultiTargetGenerator.h b/Source/cmGhsMultiTargetGenerator.h index e936b08..a80d6b2 100644 --- a/Source/cmGhsMultiTargetGenerator.h +++ b/Source/cmGhsMultiTargetGenerator.h @@ -60,10 +60,11 @@ private: }; bool IsTargetGroup() const { return this->TargetGroup; } - void WriteTypeSpecifics(const std::string& config, bool notKernel); - void WriteCompilerFlags(const std::string& config, + void WriteTypeSpecifics(std::ostream& fout, const std::string& config, + bool notKernel); + void WriteCompilerFlags(std::ostream& fout, const std::string& config, const std::string& language); - void WriteCompilerDefinitions(const std::string& config, + void WriteCompilerDefinitions(std::ostream& fout, const std::string& config, const std::string& language); void SetCompilerFlags(std::string const& config, const std::string& language, @@ -71,12 +72,13 @@ private: std::string GetDefines(const std::string& langugae, std::string const& config); - void WriteIncludes(const std::string& config, const std::string& language); - void WriteTargetLinkLibraries(std::string const& config, + void WriteIncludes(std::ostream& fout, const std::string& config, + const std::string& language); + void WriteTargetLinkLibraries(std::ostream& fout, std::string const& config, std::string const& language); - void WriteCustomCommands(); + void WriteCustomCommands(std::ostream& fout); void WriteCustomCommandsHelper( - std::vector const& commandsSet, + std::ostream& fout, std::vector const& commandsSet, cmTarget::CustomCommandType commandType); void WriteSources( std::vector const& objectSources, @@ -85,7 +87,7 @@ private: std::vector* objectSources, cmLocalGhsMultiGenerator* localGhsMultiGenerator, cmGeneratorTarget* generatorTarget); - static void WriteObjectLangOverride(cmGeneratedFileStream* fileStream, + static void WriteObjectLangOverride(std::ostream* fout, const cmSourceFile* sourceFile); static void WriteObjectDir(cmGeneratedFileStream* fileStream, std::string const& dir); @@ -115,6 +117,7 @@ private: static std::string const DDOption; std::map FlagsByLanguage; std::map DefinesByLanguage; + std::string const Name; }; #endif // ! cmGhsMultiTargetGenerator_h diff --git a/Source/cmLocalGhsMultiGenerator.cxx b/Source/cmLocalGhsMultiGenerator.cxx index ab6774e..3679c3e 100644 --- a/Source/cmLocalGhsMultiGenerator.cxx +++ b/Source/cmLocalGhsMultiGenerator.cxx @@ -18,16 +18,32 @@ cmLocalGhsMultiGenerator::~cmLocalGhsMultiGenerator() { } -void cmLocalGhsMultiGenerator::Generate() +void cmLocalGhsMultiGenerator::GenerateTargetsDepthFirst( + cmGeneratorTarget* target, std::vector& remaining) { - const std::vector& tgts = this->GetGeneratorTargets(); + if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) { + return; + } + // Find this target in the list of remaining targets. + auto it = std::find(remaining.begin(), remaining.end(), target); + if (it == remaining.end()) { + // This target was already handled. + return; + } + // Remove this target from the list of remaining targets because + // we are handling it now. + *it = nullptr; - for (std::vector::const_iterator l = tgts.begin(); - l != tgts.end(); ++l) { - if ((*l)->GetType() == cmStateEnums::INTERFACE_LIBRARY) { - continue; + cmGhsMultiTargetGenerator tg(target); + tg.Generate(); +} + +void cmLocalGhsMultiGenerator::Generate() +{ + std::vector remaining = this->GetGeneratorTargets(); + for (auto& t : remaining) { + if (t) { + GenerateTargetsDepthFirst(t, remaining); } - cmGhsMultiTargetGenerator tg(*l); - tg.Generate(); } } diff --git a/Source/cmLocalGhsMultiGenerator.h b/Source/cmLocalGhsMultiGenerator.h index aa842d7..8e88205 100644 --- a/Source/cmLocalGhsMultiGenerator.h +++ b/Source/cmLocalGhsMultiGenerator.h @@ -24,6 +24,10 @@ public: * Generate the makefile for this directory. */ virtual void Generate(); + +private: + void GenerateTargetsDepthFirst(cmGeneratorTarget* target, + std::vector& remaining); }; #endif https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6436080996ae6f2482fdeefcc639dc36fefedfd8 commit 6436080996ae6f2482fdeefcc639dc36fefedfd8 Author: Fred Baksik AuthorDate: Sat Jan 5 11:01:20 2019 -0500 Commit: Fred Baksik CommitDate: Wed Jan 16 10:41:07 2019 -0500 GHS: Have the top-level project name follow the specified project name diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 2d875c7..92b7661 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -216,7 +216,8 @@ void cmGlobalGhsMultiGenerator::OpenBuildFileStream() std::string buildFilePath = this->GetCMakeInstance()->GetHomeOutputDirectory(); buildFilePath += "/"; - buildFilePath += "default"; + buildFilePath += + this->GetCMakeInstance()->GetCurrentSnapshot().GetProjectName(); buildFilePath += FILE_EXTENSION; this->Open(std::string(""), buildFilePath, &this->TargetFolderBuildStreams); @@ -313,7 +314,7 @@ void cmGlobalGhsMultiGenerator::Generate() void cmGlobalGhsMultiGenerator::GenerateBuildCommand( std::vector& makeCommand, const std::string& makeProgram, - const std::string& /*projectName*/, const std::string& /*projectDir*/, + const std::string& projectName, const std::string& /*projectDir*/, const std::string& targetName, const std::string& /*config*/, bool /*fast*/, int jobs, bool /*verbose*/, std::vector const& makeOptions) { @@ -331,6 +332,8 @@ void cmGlobalGhsMultiGenerator::GenerateBuildCommand( makeCommand.insert(makeCommand.end(), makeOptions.begin(), makeOptions.end()); + makeCommand.push_back("-top"); + makeCommand.push_back(projectName + FILE_EXTENSION); if (!targetName.empty()) { if (targetName == "clean") { makeCommand.push_back("-clean"); diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h index 4ab4c56..e0d428e 100644 --- a/Source/cmGlobalGhsMultiGenerator.h +++ b/Source/cmGlobalGhsMultiGenerator.h @@ -13,7 +13,7 @@ class cmGeneratedFileStream; class cmGlobalGhsMultiGenerator : public cmGlobalGenerator { public: - /// The default name of GHS MULTI's build file. Typically: monolith.gpj. + // The default filename extension of GHS MULTI's build files. static const char* FILE_EXTENSION; cmGlobalGhsMultiGenerator(cmake* cm); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5cef3c61fc815393248762c14ba1878aae68394d commit 5cef3c61fc815393248762c14ba1878aae68394d Author: Fred Baksik AuthorDate: Sat Jan 5 11:01:20 2019 -0500 Commit: Fred Baksik CommitDate: Wed Jan 16 10:41:03 2019 -0500 GHS: Update test suite -- Update test suite so that CMake can use multiple toolsets CMake_TEST_GreenHillsMULTI_config ghs_config_name ghs_target_arch ghs_tools ghs_toolset_name ghs_os_root ghs_os_dir ghs_target_platform ghs_bsp_name -- Change ARM Integrity test to generic Integrity test Add Monolithic build test -- Add other GHS generator tests diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 6b166d6..1bdb6f3 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -2260,31 +2260,72 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release endif() if (CMake_TEST_GreenHillsMULTI) - macro(add_test_GhsMulti name primaryTarget bspName) - add_test(NAME GhsMulti.${name} COMMAND ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/GhsMulti" - "${CMake_BINARY_DIR}/Tests/GhsMulti/${name}" - --build-generator "Green Hills MULTI" - --build-project ReturnNum - --build-config $ - --build-options -DGHS_PRIMARY_TARGET=${primaryTarget} - -DGHS_BSP_NAME=${bspName} - ) - endmacro () - add_test_GhsMulti("arm_integrity_simarm" "arm_integrity.tgt" "simarm") - add_test_GhsMulti("arm64_integrity_simarm" "arm64_integrity.tgt" "simarm") - add_test(NAME GhsMulti.duplicate_source_filenames + macro(add_test_GhsMulti test_name test_dir bin_sub_dir build_opts test_cmd) + separate_arguments(_build_opts UNIX_COMMAND ${build_opts}) + separate_arguments(_test_cmd UNIX_COMMAND ${test_cmd}) + separate_arguments(_ghs_toolset_extra UNIX_COMMAND ${ghs_toolset_extra}) + add_test(NAME GhsMulti.${ghs_config_name}.${test_name} COMMAND ${CMAKE_CTEST_COMMAND} --build-and-test - "${CMake_SOURCE_DIR}/Tests/GhsMultiDuplicateSourceFilenames" - "${CMake_BINARY_DIR}/Tests/GhsMultiDuplicateSourceFilenames" + "${CMake_SOURCE_DIR}/Tests/GhsMulti/${test_dir}" + "${CMake_BINARY_DIR}/Tests/GhsMulti/${ghs_config_name}/${test_dir}/${bin_sub_dir}" --build-generator "Green Hills MULTI" - --build-project ReturnNum + --build-project test --build-config $ - --build-options -DGHS_PRIMARY_TARGET=arm_integrity.tgt - -DGHS_BSP_NAME="simarm" + --build-options ${ghs_target_arch} ${ghs_toolset_name} ${ghs_toolset_root} ${ghs_target_platform} + ${ghs_os_root} ${ghs_os_dir} ${ghs_bsp_name} ${_build_opts} ${_ghs_toolset_extra} + --test-command ${_test_cmd} ) + endmacro () + macro(add_test_GhsMulti_rename_install test_name) + add_test_GhsMulti( ${test_name} GhsMultiRenameInstall ${test_name} + "-DCMAKE_INSTALL_PREFIX=. -DRUN_TEST=${test_name}" "${CMAKE_CMAKE_COMMAND} -P ./cmake_install.cmake") + endmacro () + foreach(ghs_file IN LISTS CMake_TEST_GreenHillsMULTI_config) + # source GHS tools config file + if(IS_ABSOLUTE ${ghs_file}) + include(${ghs_file}) + else() + include(${CMAKE_BINARY_DIR}/${ghs_file}) + endif() + # test integrity build + if (NOT ghs_skip_integrity AND (NOT ghs_target_platform OR ghs_target_platform MATCHES "integrity")) + add_test_GhsMulti(integrityDDInt GhsMultiIntegrity/GhsMultiIntegrityDDInt "" "" "") + add_test_GhsMulti(integrityMonolith GhsMultiIntegrity/GhsMultiIntegrityMonolith "" "" "") + endif () + add_test_GhsMulti(duplicate_source_filenames GhsMultiDuplicateSourceFilenames "" "" "") + add_test_GhsMulti_rename_install(SINGLE_EXEC) + add_test_GhsMulti_rename_install(SINGLE_EXEC_RENAMED) + add_test_GhsMulti_rename_install(EXEC_AND_LIB) + add_test_GhsMulti(multiple_source_groups GhsMultiSrcGroups Default "" "") + add_test_GhsMulti(multiple_source_groups_folders GhsMultiSrcGroups Folders "-DCMAKE_FOLDER=ON" "") + add_test_GhsMulti(unsupported_targets GhsMultiUnsupportedTargets "" "" "") + set_tests_properties(GhsMulti.${ghs_config_name}.unsupported_targets PROPERTIES TIMEOUT 15) + add_test_GhsMulti(object_library GhsMultiObjectLibrary "" "" "") + set_tests_properties(GhsMulti.${ghs_config_name}.object_library PROPERTIES TIMEOUT 15) + add_test_GhsMulti(exclude GhsMultiExclude "" "" + "${CMAKE_CMAKE_COMMAND} -P ${CMake_SOURCE_DIR}/Tests/GhsMulti/GhsMultiExclude/verify.cmake") + add_test_GhsMulti(interface GhsMultiInterface "" "" "") + set_tests_properties(GhsMulti.${ghs_config_name}.interface PROPERTIES TIMEOUT 15) + add_test_GhsMulti(transitive_link_test GhsMultiLinkTest TransitiveLink "-DRUN_TEST=NO_FLAGS" "") + add_test_GhsMulti(flags_link_test GhsMultiLinkTest FlagsCheck "-DRUN_TEST=CHECK_FLAGS" "") + add_test_GhsMulti(sub_link_test GhsMultiLinkTestSub "" "" "") + add_test_GhsMulti(multiple_projects GhsMultiMultipleProjects "" "" + "${CMAKE_CMAKE_COMMAND} -P ${CMake_SOURCE_DIR}/Tests/GhsMulti/GhsMultiMultipleProjects/verify.cmake") + add_test_GhsMulti(compiler_options_none GhsMultiCompilerOptions None "-DRUN_TEST=RELEASE_FLAGS -DRUN_TEST_BUILD_TYPE=\"\"" "") + add_test_GhsMulti(compiler_options_kernel GhsMultiCompilerOptions Kernel "-DRUN_TEST=KERNEL_FLAGS -DRUN_TEST_BUILD_TYPE=DEBUG" "") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/GhsMulti/${ghs_config_name}") + #unset ghs config variables + unset(ghs_config_name) + unset(ghs_target_arch) + unset(ghs_toolset_root) + unset(ghs_toolset_name) + unset(ghs_os_root) + unset(ghs_os_dir) + unset(ghs_target_platform) + unset(ghs_bsp_name) + unset(ghs_toolset_extra) + endforeach(ghs_file) endif () if(tegra AND NOT "${CMake_SOURCE_DIR};${CMake_BINARY_DIR}" MATCHES " ") diff --git a/Tests/GhsMulti/CMakeLists.txt b/Tests/GhsMulti/CMakeLists.txt deleted file mode 100644 index 6e15ba9..0000000 --- a/Tests/GhsMulti/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(ReturnNum) - -add_subdirectory(ReturnNum) diff --git a/Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt b/Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt new file mode 100644 index 0000000..1436cbb --- /dev/null +++ b/Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt @@ -0,0 +1,94 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +cmake_minimum_required(VERSION 3.12 FATAL_ERROR) + +project(test C) + +message("Copy project") +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt.in + ${CMAKE_CURRENT_BINARY_DIR}/src/CMakeLists.txt COPYONLY) + +file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test.c + DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/src +) + +message("Building project") +try_compile(RESULT + ${CMAKE_CURRENT_BINARY_DIR}/build + ${CMAKE_CURRENT_BINARY_DIR}/src + test + CMAKE_FLAGS -DGHS_BSP_NAME=${GHS_BSP_NAME} + -DGHS_OS_ROOT=${GHS_OS_ROOT} + -DGHS_TOOLSET_ROOT=${GHS_TOOLSET_ROOT} + -DGHS_TARGET_PLATFORM=${GHS_TARGET_PLATFORM} + -DRUN_TEST=${RUN_TEST} + -DCMAKE_BUILD_TYPE=${RUN_TEST_BUILD_TYPE} + OUTPUT_VARIABLE OUTPUT) + +message("Output from build:\n${OUTPUT}") +if (RUN_TEST STREQUAL "RELEASE_FLAGS") + find_file (fileName test_none.gpj + ${CMAKE_CURRENT_BINARY_DIR}/build + ${CMAKE_CURRENT_BINARY_DIR}/build/test_none + ) + message("Parsing project file: ${fileName}") + file(STRINGS ${fileName} fileText) + set(opt "-unexpected_release_option") + string(FIND "${fileText}" "${opt}" opt_found) + if ( NOT opt_found EQUAL -1 ) + message(SEND_ERROR "Release option found: ${opt}") + endif() +else() + unset(fileName CACHE) + find_file (fileName K1.gpj + ${CMAKE_CURRENT_BINARY_DIR}/build + ${CMAKE_CURRENT_BINARY_DIR}/build/K1 + ) + message("Parsing project file: ${fileName}") + file(STRINGS ${fileName} fileText) + set(opt "-required-debug-option") + string(FIND "${fileText}" "${opt}" opt_found) + if ( opt_found EQUAL -1 ) + message(SEND_ERROR "Missing debug option: ${opt}") + endif() + + unset(fileName CACHE) + find_file (fileName K2.gpj + ${CMAKE_CURRENT_BINARY_DIR}/build + ${CMAKE_CURRENT_BINARY_DIR}/build/K2 + ) + message("Parsing project file: ${fileName}") + file(STRINGS ${fileName} fileText) + set(opt "-required-debug-option") + string(FIND "${fileText}" "${opt}" opt_found) + if ( opt_found EQUAL -1 ) + message(SEND_ERROR "Missing debug option: ${opt}") + endif() + + unset(fileName CACHE) + find_file (fileName K3.gpj + ${CMAKE_CURRENT_BINARY_DIR}/build + ${CMAKE_CURRENT_BINARY_DIR}/build/K3 + ) + message("Parsing project file: ${fileName}") + file(STRINGS ${fileName} fileText) + set(opt "-required-debug-option") + string(FIND "${fileText}" "${opt}" opt_found) + if ( opt_found EQUAL -1 ) + message(SEND_ERROR "Missing debug option: ${opt}") + endif() + + unset(fileName CACHE) + find_file (fileName K4.gpj + ${CMAKE_CURRENT_BINARY_DIR}/build + ${CMAKE_CURRENT_BINARY_DIR}/build/K4 + ) + message("Parsing project file: ${fileName}") + file(STRINGS ${fileName} fileText) + set(opt "-required-debug-option") + string(FIND "${fileText}" "${opt}" opt_found) + if ( opt_found EQUAL -1 ) + message(SEND_ERROR "Missing debug option: ${opt}") + endif() +endif() diff --git a/Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt.in b/Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt.in new file mode 100644 index 0000000..d425631 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt.in @@ -0,0 +1,28 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +cmake_minimum_required(VERSION 3.12 FATAL_ERROR) + +project(test C) + +if(RUN_TEST STREQUAL "RELEASE_FLAGS") +#RELEASE flags used when CMAKE_BUILD_TYPE is undefined +string(APPEND CMAKE_C_FLAGS_RELEASE " -unexpected_release_option") +add_executable(test_none test.c) +endif() + +if(RUN_TEST STREQUAL "KERNEL_FLAGS") +#DEBUG flag missing when -kernel is added as a compile option +string(APPEND CMAKE_C_FLAGS_DEBUG " -required-debug-option") + +add_executable(K1 test.c) + +add_executable(K2 test.c) +target_compile_options(K2 PRIVATE -kernel) + +add_executable(K3 test.c) +target_compile_options(K3 PRIVATE -kernel=fast) + +add_executable(K4 test.c) +target_link_options(K4 PRIVATE -kernel) +endif() diff --git a/Tests/GhsMulti/GhsMultiCompilerOptions/test.c b/Tests/GhsMulti/GhsMultiCompilerOptions/test.c new file mode 100644 index 0000000..95f2e8e --- /dev/null +++ b/Tests/GhsMulti/GhsMultiCompilerOptions/test.c @@ -0,0 +1,4 @@ +int main(void) +{ + return -1; +} diff --git a/Tests/GhsMultiDuplicateSourceFilenames/CMakeLists.txt b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/CMakeLists.txt similarity index 83% rename from Tests/GhsMultiDuplicateSourceFilenames/CMakeLists.txt rename to Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/CMakeLists.txt index 82a014b..520e65f 100644 --- a/Tests/GhsMultiDuplicateSourceFilenames/CMakeLists.txt +++ b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/CMakeLists.txt @@ -1,11 +1,13 @@ cmake_minimum_required(VERSION 3.5) -project(demo C) +project(test C) add_library(libdemo test.c + testCase.c subfolder_test.c subfolder_test_0.c "subfolder/test.c" + subfolder/testcase.c ) add_executable(demo main.c) diff --git a/Tests/GhsMultiDuplicateSourceFilenames/main.c b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/main.c similarity index 73% rename from Tests/GhsMultiDuplicateSourceFilenames/main.c rename to Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/main.c index d5b7914..d4ef7bb 100644 --- a/Tests/GhsMultiDuplicateSourceFilenames/main.c +++ b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/main.c @@ -2,6 +2,8 @@ int test_a(void); int test_b(void); int test_c(void); int test_d(void); +int test_e(void); +int test_f(void); int main(int argc, char* argv[]) { @@ -9,5 +11,7 @@ int main(int argc, char* argv[]) test_b(); test_c(); test_d(); + test_e(); + test_f(); return 0; } diff --git a/Tests/GhsMultiDuplicateSourceFilenames/subfolder/test.c b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder/test.c similarity index 96% copy from Tests/GhsMultiDuplicateSourceFilenames/subfolder/test.c copy to Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder/test.c index e1e1759..5d857dd 100644 --- a/Tests/GhsMultiDuplicateSourceFilenames/subfolder/test.c +++ b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder/test.c @@ -1,4 +1,3 @@ - int test_b() { return 2; diff --git a/Tests/GhsMultiDuplicateSourceFilenames/test.c b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder/testcase.c similarity index 53% copy from Tests/GhsMultiDuplicateSourceFilenames/test.c copy to Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder/testcase.c index 5ffcbdf..66ee6f3 100644 --- a/Tests/GhsMultiDuplicateSourceFilenames/test.c +++ b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder/testcase.c @@ -1,5 +1,4 @@ - -int test_a() +int test_f() { return 1; } diff --git a/Tests/GhsMultiDuplicateSourceFilenames/subfolder_test.c b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder_test.c similarity index 96% rename from Tests/GhsMultiDuplicateSourceFilenames/subfolder_test.c rename to Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder_test.c index c552e6a..83589ba 100644 --- a/Tests/GhsMultiDuplicateSourceFilenames/subfolder_test.c +++ b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder_test.c @@ -1,4 +1,3 @@ - int test_c() { return 1; diff --git a/Tests/GhsMultiDuplicateSourceFilenames/subfolder_test_0.c b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder_test_0.c similarity index 96% rename from Tests/GhsMultiDuplicateSourceFilenames/subfolder_test_0.c rename to Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder_test_0.c index 170b33d..82f9a52 100644 --- a/Tests/GhsMultiDuplicateSourceFilenames/subfolder_test_0.c +++ b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder_test_0.c @@ -1,4 +1,3 @@ - int test_d() { return 1; diff --git a/Tests/GhsMultiDuplicateSourceFilenames/test.c b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/test.c similarity index 96% copy from Tests/GhsMultiDuplicateSourceFilenames/test.c copy to Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/test.c index 5ffcbdf..feba80e 100644 --- a/Tests/GhsMultiDuplicateSourceFilenames/test.c +++ b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/test.c @@ -1,4 +1,3 @@ - int test_a() { return 1; diff --git a/Tests/GhsMultiDuplicateSourceFilenames/test.c b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/testCase.c similarity index 53% rename from Tests/GhsMultiDuplicateSourceFilenames/test.c rename to Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/testCase.c index 5ffcbdf..943c19d 100644 --- a/Tests/GhsMultiDuplicateSourceFilenames/test.c +++ b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/testCase.c @@ -1,5 +1,4 @@ - -int test_a() +int test_e() { return 1; } diff --git a/Tests/GhsMulti/GhsMultiExclude/CMakeLists.txt b/Tests/GhsMulti/GhsMultiExclude/CMakeLists.txt new file mode 100644 index 0000000..329cb3f --- /dev/null +++ b/Tests/GhsMulti/GhsMultiExclude/CMakeLists.txt @@ -0,0 +1,13 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +cmake_minimum_required(VERSION 3.12 FATAL_ERROR) + +project(test C) + +add_library(lib1 lib1.c) +set_target_properties( lib1 PROPERTIES EXCLUDE_FROM_ALL yes ) + +add_library(lib2 EXCLUDE_FROM_ALL lib1.c) + +add_executable(exe1 exe1.c) diff --git a/Tests/GhsMulti/GhsMultiExclude/exe1.c b/Tests/GhsMulti/GhsMultiExclude/exe1.c new file mode 100644 index 0000000..8488f4e --- /dev/null +++ b/Tests/GhsMulti/GhsMultiExclude/exe1.c @@ -0,0 +1,4 @@ +int main(void) +{ + return 0; +} diff --git a/Tests/GhsMultiDuplicateSourceFilenames/subfolder/test.c b/Tests/GhsMulti/GhsMultiExclude/lib1.c similarity index 51% copy from Tests/GhsMultiDuplicateSourceFilenames/subfolder/test.c copy to Tests/GhsMulti/GhsMultiExclude/lib1.c index e1e1759..b35e9cc 100644 --- a/Tests/GhsMultiDuplicateSourceFilenames/subfolder/test.c +++ b/Tests/GhsMulti/GhsMultiExclude/lib1.c @@ -1,5 +1,4 @@ - -int test_b() +int func(void) { return 2; } diff --git a/Tests/GhsMulti/GhsMultiExclude/verify.cmake b/Tests/GhsMulti/GhsMultiExclude/verify.cmake new file mode 100644 index 0000000..0467b5a --- /dev/null +++ b/Tests/GhsMulti/GhsMultiExclude/verify.cmake @@ -0,0 +1,54 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#test project was generated +unset(fileName CACHE) +find_file (fileName lib1.gpj + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR}/lib1 + ) + +if (fileName) + message("Found target lib1: ${fileName}") +else() + message(SEND_ERROR "Could not find target lib1: ${fileName}") +endif() + +#test project was built +unset(fileName CACHE) +find_file (fileName lib1.a + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR}/lib1 + ) + +if (fileName) + message(SEND_ERROR "Found target lib1: ${fileName}") +else() + message("Could not find target lib1: ${fileName}") +endif() + +#test project was generated +unset(fileName CACHE) +find_file (fileName lib2.gpj + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR}/lib2 + ) + +if (fileName) + message("Found target lib2 ${fileName}") +else() + message(SEND_ERROR "Could not find target lib2: ${fileName}") +endif() + +#test project was built +unset(fileName CACHE) +find_file (fileName lib2.a + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR}/lib2 + ) + +if (fileName) + message(SEND_ERROR "Found target lib2: ${fileName}") +else() + message("Could not find target lib2: ${fileName}") +endif() diff --git a/Tests/GhsMulti/ReturnNum/App/CMakeLists.txt b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/App/CMakeLists.txt similarity index 58% rename from Tests/GhsMulti/ReturnNum/App/CMakeLists.txt rename to Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/App/CMakeLists.txt index 2adbd4e..e431217 100644 --- a/Tests/GhsMulti/ReturnNum/App/CMakeLists.txt +++ b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/App/CMakeLists.txt @@ -1,4 +1,4 @@ -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../Lib) add_executable(App Main.c) +target_include_directories(App PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../Lib) target_link_libraries(App Lib) target_compile_options(App PUBLIC "-non_shared") diff --git a/Tests/GhsMulti/ReturnNum/App/Main.c b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/App/Main.c similarity index 100% rename from Tests/GhsMulti/ReturnNum/App/Main.c rename to Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/App/Main.c diff --git a/Tests/GhsMulti/ReturnNum/CMakeLists.txt b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/CMakeLists.txt similarity index 56% rename from Tests/GhsMulti/ReturnNum/CMakeLists.txt rename to Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/CMakeLists.txt index 7bcc5f9..92254e6 100644 --- a/Tests/GhsMulti/ReturnNum/CMakeLists.txt +++ b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/CMakeLists.txt @@ -1,3 +1,6 @@ +cmake_minimum_required(VERSION 3.1) +project(test) + add_subdirectory(App) add_subdirectory(Int) add_subdirectory(Lib) diff --git a/Tests/GhsMulti/ReturnNum/Int/AppDD.int b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/Int/AppDD.int similarity index 100% rename from Tests/GhsMulti/ReturnNum/Int/AppDD.int rename to Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/Int/AppDD.int diff --git a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/Int/CMakeLists.txt b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/Int/CMakeLists.txt new file mode 100644 index 0000000..d173c01 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/Int/CMakeLists.txt @@ -0,0 +1 @@ +add_executable(AppDD AppDD.int) diff --git a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/Lib/CMakeLists.txt b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/Lib/CMakeLists.txt new file mode 100644 index 0000000..00e0f59 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/Lib/CMakeLists.txt @@ -0,0 +1 @@ +add_library(Lib HelperFun.c HelperFun.h) diff --git a/Tests/GhsMulti/ReturnNum/Lib/HelperFun.c b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/Lib/HelperFun.c similarity index 100% rename from Tests/GhsMulti/ReturnNum/Lib/HelperFun.c rename to Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/Lib/HelperFun.c diff --git a/Tests/GhsMulti/ReturnNum/Lib/HelperFun.h b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/Lib/HelperFun.h similarity index 100% rename from Tests/GhsMulti/ReturnNum/Lib/HelperFun.h rename to Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/Lib/HelperFun.h diff --git a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/CMakeLists.txt b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/CMakeLists.txt new file mode 100644 index 0000000..741fece --- /dev/null +++ b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/CMakeLists.txt @@ -0,0 +1,18 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +cmake_minimum_required(VERSION 3.12 FATAL_ERROR) + +project(test C) + +# create virtual AS +add_executable(vas exe.c) +target_link_libraries(vas lib) +add_library(lib func.c) + +# create kernel +add_executable(kernel kernel.c) +target_link_options(kernel PRIVATE -kernel) + +# create monolith INTEGRITY application +add_executable(monolith test.int) diff --git a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/exe.c b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/exe.c new file mode 100644 index 0000000..29ad70a --- /dev/null +++ b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/exe.c @@ -0,0 +1,5 @@ +extern int func(void); +int main(void) +{ + return func(); +} diff --git a/Tests/GhsMultiDuplicateSourceFilenames/subfolder/test.c b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/func.c similarity index 53% copy from Tests/GhsMultiDuplicateSourceFilenames/subfolder/test.c copy to Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/func.c index e1e1759..c302418 100644 --- a/Tests/GhsMultiDuplicateSourceFilenames/subfolder/test.c +++ b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/func.c @@ -1,5 +1,5 @@ -int test_b() +int func(void) { return 2; } diff --git a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/kernel.c b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/kernel.c new file mode 100644 index 0000000..d1bce33 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/kernel.c @@ -0,0 +1,15 @@ +#include "INTEGRITY.h" +#include "boottable.h" + +void main() +{ + Exit(0); +} + +/* This global table will be filled in during the Integrate phase with */ +/* information about the AddressSpaces, Tasks, and Objects that are to be */ +/* created. If you do not plan to use Integrate, you may omit this file from + */ +/* the kernel, and the boot table code will then not be included. */ + +GlobalTable TheGlobalTable = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; diff --git a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/test.int b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/test.int new file mode 100644 index 0000000..161345b --- /dev/null +++ b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/test.int @@ -0,0 +1,8 @@ +Kernel + Filename kernel/kernel.as +EndKernel + +AddressSpace App + Filename "vas/vas.as" + Language C +EndAddressSpace diff --git a/Tests/GhsMulti/GhsMultiInterface/CMakeLists.txt b/Tests/GhsMulti/GhsMultiInterface/CMakeLists.txt new file mode 100644 index 0000000..fa0dce0 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiInterface/CMakeLists.txt @@ -0,0 +1,8 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +cmake_minimum_required(VERSION 3.12 FATAL_ERROR) + +project(test C) + +add_library(iface INTERFACE) diff --git a/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt b/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt new file mode 100644 index 0000000..9b23493 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt @@ -0,0 +1,96 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +cmake_minimum_required(VERSION 3.12 FATAL_ERROR) + +project(test C) + +message("Copy project") +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt.in + ${CMAKE_CURRENT_BINARY_DIR}/link_src/CMakeLists.txt COPYONLY) + +file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/exe1.c + ${CMAKE_CURRENT_SOURCE_DIR}/exe1.h + ${CMAKE_CURRENT_SOURCE_DIR}/func2.c + ${CMAKE_CURRENT_SOURCE_DIR}/func3.c + ${CMAKE_CURRENT_SOURCE_DIR}/func4.c + ${CMAKE_CURRENT_SOURCE_DIR}/func5.c + ${CMAKE_CURRENT_SOURCE_DIR}/func6.c + ${CMAKE_CURRENT_SOURCE_DIR}/func7.c + DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/link_src +) + +message("Building project") +try_compile(RESULT + ${CMAKE_CURRENT_BINARY_DIR}/link_build + ${CMAKE_CURRENT_BINARY_DIR}/link_src + test + CMAKE_FLAGS -DGHS_BSP_NAME=${GHS_BSP_NAME} + -DGHS_OS_ROOT=${GHS_OS_ROOT} + -DGHS_OS_DIR=${GHS_OS_DIR} + -DGHS_TOOLSET_ROOT=${GHS_TOOLSET_ROOT} + -DGHS_TARGET_PLATFORM=${GHS_TARGET_PLATFORM} + -DRUN_TEST=${RUN_TEST} + -DCMAKE_EXE_LINKER_FLAGS=${CMAKE_EXE_LINKER_FLAGS} + OUTPUT_VARIABLE OUTPUT) + +message("Output from build:\n${OUTPUT}") +if (RUN_TEST STREQUAL "NO_FLAGS") + if(NOT RESULT) + message(SEND_ERROR "Could not build test project (1)!") + endif() +else() + unset(fileName CACHE) + find_file (fileName exe1.gpj + ${CMAKE_CURRENT_BINARY_DIR}/link_build + ${CMAKE_CURRENT_BINARY_DIR}/link_build/exe1 + ) + message("Parsing project file: ${fileName}") + file(STRINGS ${fileName} fileText) + set(expected_flags + -add-link-options1 -add-link-options2 + link_directories_used1 link_directories_used2 "c:/absolute" + link_libraries_used1 link_libraries_used2 + -lcsl1 csl2 + -clinkexe1 -clinkexe2 + -special-lib2-public-link) + foreach( opt IN LISTS expected_flags ) + string(FIND "${fileText}" "${opt}" opt_found) + if ( opt_found EQUAL -1 ) + message(SEND_ERROR "Could not find: ${opt}") + endif() + endforeach(opt) + + unset(fileName CACHE) + find_file (fileName lib1.gpj + ${CMAKE_CURRENT_BINARY_DIR}/link_build + ${CMAKE_CURRENT_BINARY_DIR}/link_build/lib1 + ) + message("Parsing project file: ${fileName}") + file(STRINGS ${fileName} fileText) + set(expected_flags + -clinkexeA1 -clinkexeA2 + -static-lib-flags1 -static-lib-flags2) + foreach( opt IN LISTS expected_flags ) + string(FIND "${fileText}" "${opt}" opt_found) + if ( opt_found EQUAL -1 ) + message(SEND_ERROR "Could not find: ${opt}") + endif() + endforeach(opt) + + unset(fileName CACHE) + find_file (fileName lib2.gpj + ${CMAKE_CURRENT_BINARY_DIR}/link_build + ${CMAKE_CURRENT_BINARY_DIR}/link_build/lib2 + ) + message("Parsing project file: ${fileName}") + file(STRINGS ${fileName} fileText) + set(expected_flags + -clinkexeA1 -clinkexeA2) + foreach( opt IN LISTS expected_flags ) + string(FIND "${fileText}" "${opt}" opt_found) + if ( opt_found EQUAL -1 ) + message(SEND_ERROR "Could not find: ${opt}") + endif() + endforeach(opt) +endif() diff --git a/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt.in b/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt.in new file mode 100644 index 0000000..4cf86a2 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt.in @@ -0,0 +1,35 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +cmake_minimum_required(VERSION 3.12 FATAL_ERROR) + +project(test C) + +if( RUN_TEST STREQUAL "CHECK_FLAGS" ) +add_link_options(-add-link-options1 -add-link-options2) +link_directories(link_directories_used1 link_directories_used2 "c:/absolute") +link_libraries(link_libraries_used1 link_libraries_used2 ) +set( CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} -lcsl1 csl2" ) +set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -clinkexe1 -clinkexe2") +endif() + +add_executable(exe1 exe1.c) +target_link_libraries(exe1 lib1) +if( RUN_TEST STREQUAL "CHECK_FLAGS" ) +set_property( TARGET exe1 APPEND_STRING PROPERTY LINK_FLAGS "--link-flag-prop1 --link-flag-prop2") +set_property( TARGET exe1 APPEND PROPERTY LINK_OPTIONS --link-opt-prop1 --link-opt-prop2) +endif() + +if( RUN_TEST STREQUAL "CHECK_FLAGS" ) +set( CMAKE_STATIC_LINKER_FLAGS ${CMAKE_STATIC_LINKER_FLAGS} "-clinkexeA1 -clinkexeA2") +endif() +add_library(lib1 STATIC func2.c func3.c func4.c) +target_link_libraries(lib1 lib2) +if( RUN_TEST STREQUAL "CHECK_FLAGS" ) +set_property( TARGET lib1 APPEND_STRING PROPERTY STATIC_LIBRARY_FLAGS "-static-lib-flags1 -static-lib-flags2") +endif() + +add_library(lib2 STATIC func5.c func6.c func7.c) +if( RUN_TEST STREQUAL "CHECK_FLAGS" ) +target_link_options(lib2 PUBLIC -special-lib2-public-link) +endif() diff --git a/Tests/GhsMulti/GhsMultiLinkTest/exe1.c b/Tests/GhsMulti/GhsMultiLinkTest/exe1.c new file mode 100644 index 0000000..f21c126 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiLinkTest/exe1.c @@ -0,0 +1,6 @@ +#include "exe1.h" + +int main(void) +{ + return func2a() + func3a() + func4a() + func5a() + func6a() + func7a(); +} diff --git a/Tests/GhsMulti/GhsMultiLinkTest/exe1.h b/Tests/GhsMulti/GhsMultiLinkTest/exe1.h new file mode 100644 index 0000000..e2b1725 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiLinkTest/exe1.h @@ -0,0 +1,6 @@ +extern int func2a(void); +extern int func3a(void); +extern int func4a(void); +extern int func5a(void); +extern int func6a(void); +extern int func7a(void); diff --git a/Tests/GhsMulti/GhsMultiLinkTest/func2.c b/Tests/GhsMulti/GhsMultiLinkTest/func2.c new file mode 100644 index 0000000..8f66fba --- /dev/null +++ b/Tests/GhsMulti/GhsMultiLinkTest/func2.c @@ -0,0 +1,4 @@ +int func2a(void) +{ + return 2; +} diff --git a/Tests/GhsMulti/GhsMultiLinkTest/func3.c b/Tests/GhsMulti/GhsMultiLinkTest/func3.c new file mode 100644 index 0000000..57c7a6f --- /dev/null +++ b/Tests/GhsMulti/GhsMultiLinkTest/func3.c @@ -0,0 +1,4 @@ +int func3a(void) +{ + return 1; +} diff --git a/Tests/GhsMulti/GhsMultiLinkTest/func4.c b/Tests/GhsMulti/GhsMultiLinkTest/func4.c new file mode 100644 index 0000000..109fd7b --- /dev/null +++ b/Tests/GhsMulti/GhsMultiLinkTest/func4.c @@ -0,0 +1,4 @@ +int func4a(void) +{ + return 1; +} diff --git a/Tests/GhsMulti/GhsMultiLinkTest/func5.c b/Tests/GhsMulti/GhsMultiLinkTest/func5.c new file mode 100644 index 0000000..f28a705 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiLinkTest/func5.c @@ -0,0 +1,4 @@ +int func5a(void) +{ + return 1; +} diff --git a/Tests/GhsMulti/GhsMultiLinkTest/func6.c b/Tests/GhsMulti/GhsMultiLinkTest/func6.c new file mode 100644 index 0000000..bf77406 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiLinkTest/func6.c @@ -0,0 +1,4 @@ +int func6a(void) +{ + return 1; +} diff --git a/Tests/GhsMulti/GhsMultiLinkTest/func7.c b/Tests/GhsMulti/GhsMultiLinkTest/func7.c new file mode 100644 index 0000000..6a4a9a1 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiLinkTest/func7.c @@ -0,0 +1,4 @@ +int func7a(void) +{ + return 1; +} diff --git a/Tests/GhsMulti/GhsMultiLinkTestSub/CMakeLists.txt b/Tests/GhsMulti/GhsMultiLinkTestSub/CMakeLists.txt new file mode 100644 index 0000000..145dac0 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiLinkTestSub/CMakeLists.txt @@ -0,0 +1,9 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +cmake_minimum_required(VERSION 3.12 FATAL_ERROR) + +project(test C) + +add_subdirectory(sub_exe) +add_subdirectory(sub_lib) diff --git a/Tests/GhsMulti/GhsMultiLinkTestSub/sub_exe/CMakeLists.txt b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_exe/CMakeLists.txt new file mode 100644 index 0000000..55f693d --- /dev/null +++ b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_exe/CMakeLists.txt @@ -0,0 +1,9 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +cmake_minimum_required(VERSION 3.12 FATAL_ERROR) + +project(test C) + +add_executable(exe1 exe1.c) +target_link_libraries(exe1 lib1) diff --git a/Tests/GhsMulti/GhsMultiLinkTestSub/sub_exe/exe1.c b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_exe/exe1.c new file mode 100644 index 0000000..f21c126 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_exe/exe1.c @@ -0,0 +1,6 @@ +#include "exe1.h" + +int main(void) +{ + return func2a() + func3a() + func4a() + func5a() + func6a() + func7a(); +} diff --git a/Tests/GhsMulti/GhsMultiLinkTestSub/sub_exe/exe1.h b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_exe/exe1.h new file mode 100644 index 0000000..e2b1725 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_exe/exe1.h @@ -0,0 +1,6 @@ +extern int func2a(void); +extern int func3a(void); +extern int func4a(void); +extern int func5a(void); +extern int func6a(void); +extern int func7a(void); diff --git a/Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/CMakeLists.txt b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/CMakeLists.txt new file mode 100644 index 0000000..9039730 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/CMakeLists.txt @@ -0,0 +1,7 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +add_library(lib1 STATIC func2.c func3.c func4.c) +target_link_libraries(lib1 lib2) + +add_library(lib2 STATIC func5.c func6.c func7.c) diff --git a/Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func2.c b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func2.c new file mode 100644 index 0000000..8f66fba --- /dev/null +++ b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func2.c @@ -0,0 +1,4 @@ +int func2a(void) +{ + return 2; +} diff --git a/Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func3.c b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func3.c new file mode 100644 index 0000000..57c7a6f --- /dev/null +++ b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func3.c @@ -0,0 +1,4 @@ +int func3a(void) +{ + return 1; +} diff --git a/Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func4.c b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func4.c new file mode 100644 index 0000000..109fd7b --- /dev/null +++ b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func4.c @@ -0,0 +1,4 @@ +int func4a(void) +{ + return 1; +} diff --git a/Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func5.c b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func5.c new file mode 100644 index 0000000..f28a705 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func5.c @@ -0,0 +1,4 @@ +int func5a(void) +{ + return 1; +} diff --git a/Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func6.c b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func6.c new file mode 100644 index 0000000..bf77406 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func6.c @@ -0,0 +1,4 @@ +int func6a(void) +{ + return 1; +} diff --git a/Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func7.c b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func7.c new file mode 100644 index 0000000..6a4a9a1 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func7.c @@ -0,0 +1,4 @@ +int func7a(void) +{ + return 1; +} diff --git a/Tests/GhsMulti/GhsMultiMultipleProjects/CMakeLists.txt b/Tests/GhsMulti/GhsMultiMultipleProjects/CMakeLists.txt new file mode 100644 index 0000000..d01c4d2 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiMultipleProjects/CMakeLists.txt @@ -0,0 +1,13 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +cmake_minimum_required(VERSION 3.12 FATAL_ERROR) + +project(test C) + +add_library(lib1 lib1.c) +add_executable(exe1 exe1.c) +target_link_libraries(exe1 lib1) + +add_subdirectory(sub) +add_subdirectory(sub2 examples EXCLUDE_FROM_ALL) diff --git a/Tests/GhsMulti/GhsMultiMultipleProjects/exe1.c b/Tests/GhsMulti/GhsMultiMultipleProjects/exe1.c new file mode 100644 index 0000000..b9cdd61 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiMultipleProjects/exe1.c @@ -0,0 +1,5 @@ +extern int lib1_func(void); +int main(void) +{ + return lib1_func(); +} diff --git a/Tests/GhsMulti/GhsMultiMultipleProjects/lib1.c b/Tests/GhsMulti/GhsMultiMultipleProjects/lib1.c new file mode 100644 index 0000000..5100945 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiMultipleProjects/lib1.c @@ -0,0 +1,4 @@ +int lib1_func(void) +{ + return 2; +} diff --git a/Tests/GhsMulti/GhsMultiMultipleProjects/sub/CMakeLists.txt b/Tests/GhsMulti/GhsMultiMultipleProjects/sub/CMakeLists.txt new file mode 100644 index 0000000..0d83bc3 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiMultipleProjects/sub/CMakeLists.txt @@ -0,0 +1,10 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +cmake_minimum_required(VERSION 3.12 FATAL_ERROR) + +project(test2 C) + +add_library(lib2 lib2.c) +add_executable(exe2 exe2.c) +target_link_libraries(exe2 lib1 lib2) diff --git a/Tests/GhsMulti/GhsMultiMultipleProjects/sub/exe2.c b/Tests/GhsMulti/GhsMultiMultipleProjects/sub/exe2.c new file mode 100644 index 0000000..9238cf3 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiMultipleProjects/sub/exe2.c @@ -0,0 +1,6 @@ +extern int func(void); +extern int lib1_func(void); +int main(void) +{ + return func() + lib1_func(); +} diff --git a/Tests/GhsMultiDuplicateSourceFilenames/subfolder/test.c b/Tests/GhsMulti/GhsMultiMultipleProjects/sub/lib2.c similarity index 51% copy from Tests/GhsMultiDuplicateSourceFilenames/subfolder/test.c copy to Tests/GhsMulti/GhsMultiMultipleProjects/sub/lib2.c index e1e1759..b35e9cc 100644 --- a/Tests/GhsMultiDuplicateSourceFilenames/subfolder/test.c +++ b/Tests/GhsMulti/GhsMultiMultipleProjects/sub/lib2.c @@ -1,5 +1,4 @@ - -int test_b() +int func(void) { return 2; } diff --git a/Tests/GhsMulti/GhsMultiMultipleProjects/sub2/CMakeLists.txt b/Tests/GhsMulti/GhsMultiMultipleProjects/sub2/CMakeLists.txt new file mode 100644 index 0000000..e42e7fb --- /dev/null +++ b/Tests/GhsMulti/GhsMultiMultipleProjects/sub2/CMakeLists.txt @@ -0,0 +1,10 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +cmake_minimum_required(VERSION 3.12 FATAL_ERROR) + +project(test3 C) + +add_library(lib3 lib3.c) +add_executable(exe3 exe3.c) +target_link_libraries(exe3 lib1 lib3) diff --git a/Tests/GhsMulti/GhsMultiMultipleProjects/sub2/exe3.c b/Tests/GhsMulti/GhsMultiMultipleProjects/sub2/exe3.c new file mode 100644 index 0000000..9238cf3 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiMultipleProjects/sub2/exe3.c @@ -0,0 +1,6 @@ +extern int func(void); +extern int lib1_func(void); +int main(void) +{ + return func() + lib1_func(); +} diff --git a/Tests/GhsMultiDuplicateSourceFilenames/subfolder/test.c b/Tests/GhsMulti/GhsMultiMultipleProjects/sub2/lib3.c similarity index 51% copy from Tests/GhsMultiDuplicateSourceFilenames/subfolder/test.c copy to Tests/GhsMulti/GhsMultiMultipleProjects/sub2/lib3.c index e1e1759..b35e9cc 100644 --- a/Tests/GhsMultiDuplicateSourceFilenames/subfolder/test.c +++ b/Tests/GhsMulti/GhsMultiMultipleProjects/sub2/lib3.c @@ -1,5 +1,4 @@ - -int test_b() +int func(void) { return 2; } diff --git a/Tests/GhsMulti/GhsMultiMultipleProjects/verify.cmake b/Tests/GhsMulti/GhsMultiMultipleProjects/verify.cmake new file mode 100644 index 0000000..e00cbb3 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiMultipleProjects/verify.cmake @@ -0,0 +1,58 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#test project was generated +unset(fileName CACHE) +find_file (fileName lib3.gpj + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR}/lib3 + ${CMAKE_CURRENT_BINARY_DIR}/examples + ) + +if ( fileName ) + message("Found target lib3: ${fileName}") +else() + message(SEND_ERROR "Could not find target lib3: ${fileName}") +endif() + +#test project was generated +unset(fileName CACHE) +find_file (fileName exe3.gpj + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR}/exe3 + ${CMAKE_CURRENT_BINARY_DIR}/examples + ) + +if ( fileName ) + message("Found target exe3: ${fileName}") +else() + message(SEND_ERROR "Could not find target exe3: ${fileName}") +endif() + +#test project was not built +unset(fileName CACHE) +find_file (fileName lib3.a + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR}/lib3 + ${CMAKE_CURRENT_BINARY_DIR}/examples + ) + +if ( fileName ) + message(SEND_ERROR "Found target lib3: ${fileName}") +else() + message("Could not find target lib3: ${fileName}") +endif() + +unset(fileName CACHE) +find_file (fileName NAMES exe3.as exe3 + HINTS + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR}/exe3 + ${CMAKE_CURRENT_BINARY_DIR}/examples + ) + +if ( fileName ) + message(SEND_ERROR "Found target exe3: ${fileName}") +else() + message("Could not find target exe3: ${fileName}") +endif() diff --git a/Tests/GhsMulti/GhsMultiObjectLibrary/CMakeLists.txt b/Tests/GhsMulti/GhsMultiObjectLibrary/CMakeLists.txt new file mode 100644 index 0000000..7fe91bc --- /dev/null +++ b/Tests/GhsMulti/GhsMultiObjectLibrary/CMakeLists.txt @@ -0,0 +1,10 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +cmake_minimum_required(VERSION 3.12 FATAL_ERROR) + +project(test C) + +add_library(obj1 OBJECT testObj.c testObj.h sub/testObj.c testObj2.c) + +add_executable(exe1 exe.c $) diff --git a/Tests/GhsMulti/GhsMultiObjectLibrary/exe.c b/Tests/GhsMulti/GhsMultiObjectLibrary/exe.c new file mode 100644 index 0000000..c2c5a19 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiObjectLibrary/exe.c @@ -0,0 +1,8 @@ +extern int funcOBJ(void); +extern int funcOBJ2(void); +extern int funcOBJs(void); + +int main(void) +{ + return funcOBJ() + funcOBJ2() + funcOBJs(); +} diff --git a/Tests/GhsMulti/GhsMultiObjectLibrary/sub/testOBJ.c b/Tests/GhsMulti/GhsMultiObjectLibrary/sub/testOBJ.c new file mode 100644 index 0000000..5228ef2 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiObjectLibrary/sub/testOBJ.c @@ -0,0 +1,4 @@ +int funcOBJs(void) +{ + return 2; +} diff --git a/Tests/GhsMulti/GhsMultiObjectLibrary/testOBJ.c b/Tests/GhsMulti/GhsMultiObjectLibrary/testOBJ.c new file mode 100644 index 0000000..ec6f2c3 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiObjectLibrary/testOBJ.c @@ -0,0 +1,4 @@ +int funcOBJ(void) +{ + return 2; +} diff --git a/Tests/GhsMulti/GhsMultiObjectLibrary/testOBJ.h b/Tests/GhsMulti/GhsMultiObjectLibrary/testOBJ.h new file mode 100644 index 0000000..9aef431 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiObjectLibrary/testOBJ.h @@ -0,0 +1 @@ +extern int funcOBJ(void); diff --git a/Tests/GhsMulti/GhsMultiObjectLibrary/testOBJ2.c b/Tests/GhsMulti/GhsMultiObjectLibrary/testOBJ2.c new file mode 100644 index 0000000..b6a9b93 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiObjectLibrary/testOBJ2.c @@ -0,0 +1,4 @@ +int funcOBJ2(void) +{ + return 2; +} diff --git a/Tests/GhsMulti/GhsMultiRenameInstall/CMakeLists.txt b/Tests/GhsMulti/GhsMultiRenameInstall/CMakeLists.txt new file mode 100644 index 0000000..f10b2f0 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiRenameInstall/CMakeLists.txt @@ -0,0 +1,38 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +cmake_minimum_required(VERSION 3.12 FATAL_ERROR) + +project(test C) + +set(targets_to_install "") + +if( RUN_TEST STREQUAL "SINGLE_EXEC" ) +add_executable(exe1 exe.c) +set(targets_to_install ${targets_to_install} exe1) +endif() + +if( RUN_TEST STREQUAL "SINGLE_EXEC_RENAMED" ) +set(name new_name) +add_executable(exe1 exe.c) +set_property(TARGET exe1 PROPERTY RUNTIME_OUTPUT_DIRECTORY ${name}_bin_$) +set_property(TARGET exe1 PROPERTY OUTPUT_NAME ${name}_$) +set_property(TARGET exe1 PROPERTY SUFFIX .bin) +set(targets_to_install ${targets_to_install} exe1) +endif() + +if( RUN_TEST STREQUAL "EXEC_AND_LIB" ) +add_library(lib1 lib1.c) +set_property(TARGET lib1 PROPERTY ARCHIVE_OUTPUT_DIRECTORY forced-$) +set_property(TARGET lib1 PROPERTY SUFFIX .LL) +set_property(TARGET lib1 PROPERTY OUTPUT_NAME lib1_$) + +add_executable(exe1 exe1.c) +target_link_libraries(exe1 lib1) +set(targets_to_install ${targets_to_install} exe1 lib1) +endif() + +install(TARGETS ${targets_to_install} + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib/static) diff --git a/Tests/GhsMulti/GhsMultiRenameInstall/exe.c b/Tests/GhsMulti/GhsMultiRenameInstall/exe.c new file mode 100644 index 0000000..8488f4e --- /dev/null +++ b/Tests/GhsMulti/GhsMultiRenameInstall/exe.c @@ -0,0 +1,4 @@ +int main(void) +{ + return 0; +} diff --git a/Tests/GhsMulti/GhsMultiRenameInstall/exe1.c b/Tests/GhsMulti/GhsMultiRenameInstall/exe1.c new file mode 100644 index 0000000..29ad70a --- /dev/null +++ b/Tests/GhsMulti/GhsMultiRenameInstall/exe1.c @@ -0,0 +1,5 @@ +extern int func(void); +int main(void) +{ + return func(); +} diff --git a/Tests/GhsMultiDuplicateSourceFilenames/subfolder/test.c b/Tests/GhsMulti/GhsMultiRenameInstall/lib1.c similarity index 51% rename from Tests/GhsMultiDuplicateSourceFilenames/subfolder/test.c rename to Tests/GhsMulti/GhsMultiRenameInstall/lib1.c index e1e1759..b35e9cc 100644 --- a/Tests/GhsMultiDuplicateSourceFilenames/subfolder/test.c +++ b/Tests/GhsMulti/GhsMultiRenameInstall/lib1.c @@ -1,5 +1,4 @@ - -int test_b() +int func(void) { return 2; } diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/Atest3.c b/Tests/GhsMulti/GhsMultiSrcGroups/Atest3.c new file mode 100644 index 0000000..9c9c1d9 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/Atest3.c @@ -0,0 +1,4 @@ +int funcA3a(void) +{ + return 1; +} diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/CMakeLists.txt b/Tests/GhsMulti/GhsMultiSrcGroups/CMakeLists.txt new file mode 100644 index 0000000..5043e7f --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/CMakeLists.txt @@ -0,0 +1,39 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +cmake_minimum_required(VERSION 3.12 FATAL_ERROR) + +project(test C) + +#set(CMAKE_FOLDER ON) +add_executable(groups + test1.c + test1.h + test2a.c + test4.c + test5.c + test6.c + test7.c + standard.h + testOBJ.c + testOBJ.h + sub/testOBJ.c + sub/testOBJ.h + textfile.txt + textfile2.txt + test3.c + Atest3.c +# object.o + resource.pdf + cmake.rule + s5.h + s2.h + s4.h + standard.h + ) + +source_group( gC FILES sub/testOBJ.h testOBJ.c testOBJ.h sub/testOBJ.c ) +source_group( gA FILES test1.c test1.h) +source_group( gB test[65].c ) +source_group( gC\\gD FILES test7.c ) +source_group( docs FILES textfile.txt ) diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/cmake.rule b/Tests/GhsMulti/GhsMultiSrcGroups/cmake.rule new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/cmake.rule @@ -0,0 +1 @@ + diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/object.o b/Tests/GhsMulti/GhsMultiSrcGroups/object.o new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/object.o @@ -0,0 +1 @@ + diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/resource.pdf b/Tests/GhsMulti/GhsMultiSrcGroups/resource.pdf new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/resource.pdf @@ -0,0 +1 @@ + diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/s2.h b/Tests/GhsMulti/GhsMultiSrcGroups/s2.h new file mode 100644 index 0000000..e2b1725 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/s2.h @@ -0,0 +1,6 @@ +extern int func2a(void); +extern int func3a(void); +extern int func4a(void); +extern int func5a(void); +extern int func6a(void); +extern int func7a(void); diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/s4.h b/Tests/GhsMulti/GhsMultiSrcGroups/s4.h new file mode 100644 index 0000000..e2b1725 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/s4.h @@ -0,0 +1,6 @@ +extern int func2a(void); +extern int func3a(void); +extern int func4a(void); +extern int func5a(void); +extern int func6a(void); +extern int func7a(void); diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/s5.h b/Tests/GhsMulti/GhsMultiSrcGroups/s5.h new file mode 100644 index 0000000..e2b1725 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/s5.h @@ -0,0 +1,6 @@ +extern int func2a(void); +extern int func3a(void); +extern int func4a(void); +extern int func5a(void); +extern int func6a(void); +extern int func7a(void); diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/standard.h b/Tests/GhsMulti/GhsMultiSrcGroups/standard.h new file mode 100644 index 0000000..2773a55 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/standard.h @@ -0,0 +1 @@ +#define somthing diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/sub/testOBJ.c b/Tests/GhsMulti/GhsMultiSrcGroups/sub/testOBJ.c new file mode 100644 index 0000000..90ea9b9 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/sub/testOBJ.c @@ -0,0 +1,6 @@ +#include "testOBJ.h" + +int funcOBJsub(void) +{ + return func2a() + func3a() + func4a() + func5a() + func6a() + func7a(); +} diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/sub/testOBJ.h b/Tests/GhsMulti/GhsMultiSrcGroups/sub/testOBJ.h new file mode 100644 index 0000000..e2b1725 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/sub/testOBJ.h @@ -0,0 +1,6 @@ +extern int func2a(void); +extern int func3a(void); +extern int func4a(void); +extern int func5a(void); +extern int func6a(void); +extern int func7a(void); diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/test1.c b/Tests/GhsMulti/GhsMultiSrcGroups/test1.c new file mode 100644 index 0000000..94f818a --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/test1.c @@ -0,0 +1,6 @@ +#include "test1.h" + +int main(void) +{ + return func2a() + func3a() + func4a() + func5a() + func6a() + func7a(); +} diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/test1.h b/Tests/GhsMulti/GhsMultiSrcGroups/test1.h new file mode 100644 index 0000000..e2b1725 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/test1.h @@ -0,0 +1,6 @@ +extern int func2a(void); +extern int func3a(void); +extern int func4a(void); +extern int func5a(void); +extern int func6a(void); +extern int func7a(void); diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/test2a.c b/Tests/GhsMulti/GhsMultiSrcGroups/test2a.c new file mode 100644 index 0000000..8f66fba --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/test2a.c @@ -0,0 +1,4 @@ +int func2a(void) +{ + return 2; +} diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/test3.c b/Tests/GhsMulti/GhsMultiSrcGroups/test3.c new file mode 100644 index 0000000..57c7a6f --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/test3.c @@ -0,0 +1,4 @@ +int func3a(void) +{ + return 1; +} diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/test3.h b/Tests/GhsMulti/GhsMultiSrcGroups/test3.h new file mode 100644 index 0000000..2773a55 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/test3.h @@ -0,0 +1 @@ +#define somthing diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/test4.c b/Tests/GhsMulti/GhsMultiSrcGroups/test4.c new file mode 100644 index 0000000..109fd7b --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/test4.c @@ -0,0 +1,4 @@ +int func4a(void) +{ + return 1; +} diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/test5.c b/Tests/GhsMulti/GhsMultiSrcGroups/test5.c new file mode 100644 index 0000000..f28a705 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/test5.c @@ -0,0 +1,4 @@ +int func5a(void) +{ + return 1; +} diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/test6.c b/Tests/GhsMulti/GhsMultiSrcGroups/test6.c new file mode 100644 index 0000000..bf77406 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/test6.c @@ -0,0 +1,4 @@ +int func6a(void) +{ + return 1; +} diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/test7.c b/Tests/GhsMulti/GhsMultiSrcGroups/test7.c new file mode 100644 index 0000000..6a4a9a1 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/test7.c @@ -0,0 +1,4 @@ +int func7a(void) +{ + return 1; +} diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/testOBJ.c b/Tests/GhsMulti/GhsMultiSrcGroups/testOBJ.c new file mode 100644 index 0000000..e86e2a4 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/testOBJ.c @@ -0,0 +1,11 @@ +extern int func2a(void); +extern int func3a(void); +extern int func4a(void); +extern int func5a(void); +extern int func6a(void); +extern int func7a(void); + +int funcOBJ(void) +{ + return func2a() + func3a() + func4a() + func5a() + func6a() + func7a(); +} diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/testOBJ.h b/Tests/GhsMulti/GhsMultiSrcGroups/testOBJ.h new file mode 100644 index 0000000..e2b1725 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/testOBJ.h @@ -0,0 +1,6 @@ +extern int func2a(void); +extern int func3a(void); +extern int func4a(void); +extern int func5a(void); +extern int func6a(void); +extern int func7a(void); diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/textfile.txt b/Tests/GhsMulti/GhsMultiSrcGroups/textfile.txt new file mode 100644 index 0000000..48cdce8 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/textfile.txt @@ -0,0 +1 @@ +placeholder diff --git a/Tests/GhsMulti/GhsMultiSrcGroups/textfile2.txt b/Tests/GhsMulti/GhsMultiSrcGroups/textfile2.txt new file mode 100644 index 0000000..48cdce8 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiSrcGroups/textfile2.txt @@ -0,0 +1 @@ +placeholder diff --git a/Tests/GhsMulti/GhsMultiUnsupportedTargets/CMakeLists.txt b/Tests/GhsMulti/GhsMultiUnsupportedTargets/CMakeLists.txt new file mode 100644 index 0000000..ed3094b --- /dev/null +++ b/Tests/GhsMulti/GhsMultiUnsupportedTargets/CMakeLists.txt @@ -0,0 +1,12 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +cmake_minimum_required(VERSION 3.12 FATAL_ERROR) + +project(test C) + +add_custom_target(testTarget ALL echo this is a test) + +add_library(sharedLib SHARED file.c) + +add_library(moduleLib MODULE file.c) diff --git a/Tests/GhsMulti/GhsMultiUnsupportedTargets/file.c b/Tests/GhsMulti/GhsMultiUnsupportedTargets/file.c new file mode 100644 index 0000000..6a4a9a1 --- /dev/null +++ b/Tests/GhsMulti/GhsMultiUnsupportedTargets/file.c @@ -0,0 +1,4 @@ +int func7a(void) +{ + return 1; +} diff --git a/Tests/GhsMulti/ReturnNum/Int/CMakeLists.txt b/Tests/GhsMulti/ReturnNum/Int/CMakeLists.txt deleted file mode 100644 index 44c5de1..0000000 --- a/Tests/GhsMulti/ReturnNum/Int/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_executable(AppDD AppDD.int Default.bsp) diff --git a/Tests/GhsMulti/ReturnNum/Int/Default.bsp b/Tests/GhsMulti/ReturnNum/Int/Default.bsp deleted file mode 100644 index 224ec29..0000000 --- a/Tests/GhsMulti/ReturnNum/Int/Default.bsp +++ /dev/null @@ -1,35 +0,0 @@ -# Target description File for the Integrate utility for use with the -# INTEGRITY real-time operating system by Green Hills Software. -# Before editing this file, refer to your Integrate documentation. -# default.bsp is appropriate for INTEGRITY applications which are -# fully linked with the kernel (for RAM or ROM) or dynamically downloaded. -# -# MinimumAddress must match the value of .ramend in the linker directives -# file used for the KernelSpace program - see default.ld for more info. -# The MaximumAddress used here allows memory mappings to be specified -# for up to the 16 MB mark in RAM. Intex will not permit programs -# that require more memory for its mappings. If the board has less -# memory, this number can be reduced by the user. - -Target - MinimumAddress .ramend - MaximumAddress .ramlimit - Clock StandardTick - EndClock - Clock HighResTimer - EndClock - IODevice "SerialDev0" - InitialKernelObjects 200 - DefaultStartIt false - DefaultMaxPriority 255 - DefaultPriority 127 - DefaultWeight 1 - DefaultMaxWeight 255 - DefaultHeapSize 0x10000 - LastVirtualAddress 0x3fffffff - PageSize 0x1000 - ArchitectedPageSize 0x1000 - ArchitectedPageSize 0x10000 - ArchitectedPageSize 0x100000 - DefaultMemoryRegionSize 0x20000 -EndTarget diff --git a/Tests/GhsMulti/ReturnNum/Lib/CMakeLists.txt b/Tests/GhsMulti/ReturnNum/Lib/CMakeLists.txt deleted file mode 100644 index 9c822da..0000000 --- a/Tests/GhsMulti/ReturnNum/Lib/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_library(Lib HelperFun.c HelperFun.h) \ No newline at end of file https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a42e40e78dc3d9c4289a3c9640cae94ecd034373 commit a42e40e78dc3d9c4289a3c9640cae94ecd034373 Author: Fred Baksik AuthorDate: Sat Jan 5 11:01:19 2019 -0500 Commit: Fred Baksik CommitDate: Wed Jan 16 10:40:59 2019 -0500 GHS: Only print bsp and os directives if specified by user -- standalone platforms will not build if bsp/os is specified in project file -- integrity platforms will always print these directives because they are required -- cleanup -os_dir setting allow customization of the actual setting because it is determined by tool-set customization files remove variable that was set but never used -- add message when using default values diff --git a/Modules/Platform/GHS-MULTI-Initialize.cmake b/Modules/Platform/GHS-MULTI-Initialize.cmake index 9b384df..25004c6 100644 --- a/Modules/Platform/GHS-MULTI-Initialize.cmake +++ b/Modules/Platform/GHS-MULTI-Initialize.cmake @@ -9,6 +9,9 @@ mark_as_advanced(GHS_OS_ROOT) set(GHS_OS_DIR "NOTFOUND" CACHE PATH "GHS platform OS directory") mark_as_advanced(GHS_OS_DIR) +set(GHS_OS_DIR_OPTION "-os_dir " CACHE STRING "GHS compiler os option") +mark_as_advanced(GHS_OS_DIR) + #set GHS_OS_DIR if not set by user if ( NOT GHS_OS_DIR ) if (EXISTS ${GHS_OS_ROOT}) @@ -23,8 +26,11 @@ if ( NOT GHS_OS_DIR ) endif () #filter based on platform name - if (GHS_TARGET_PLATFORM STREQUAL "integrity") + if (GHS_TARGET_PLATFORM MATCHES "integrity") list(FILTER GHS_CANDIDATE_OS_DIRS INCLUDE REGEX "int[0-9][0-9][0-9][0-9a-z].*") + else() #fall-back for standalone + unset(GHS_CANDIDATE_OS_DIRS) + set(GHS_OS_DIR "IGNORE") endif () if (GHS_CANDIDATE_OS_DIRS) diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 831c4a9..2d875c7 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -20,7 +20,6 @@ const char* cmGlobalGhsMultiGenerator::DEFAULT_TOOLSET_ROOT = "C:/ghs"; cmGlobalGhsMultiGenerator::cmGlobalGhsMultiGenerator(cmake* cm) : cmGlobalGenerator(cm) - , OSDirRelative(false) { } @@ -130,6 +129,8 @@ bool cmGlobalGhsMultiGenerator::SetGeneratorPlatform(std::string const& p, const char* tgtPlatform = mf->GetDefinition("GHS_TARGET_PLATFORM"); if (tgtPlatform == nullptr) { + cmSystemTools::Message("Green Hills MULTI: GHS_TARGET_PLATFORM not " + "specified; defaulting to \"integrity\""); tgtPlatform = "integrity"; } @@ -221,45 +222,62 @@ void cmGlobalGhsMultiGenerator::OpenBuildFileStream() this->Open(std::string(""), buildFilePath, &this->TargetFolderBuildStreams); OpenBuildFileStream(GetBuildFileStream()); - char const* osDir = - this->GetCMakeInstance()->GetCacheDefinition("GHS_OS_DIR"); - if (NULL == osDir) { - osDir = ""; - cmSystemTools::Error("GHS_OS_DIR cache variable must be set"); - } else { - this->GetCMakeInstance()->MarkCliAsUsed("GHS_OS_DIR"); - } - std::string fOSDir(this->trimQuotes(osDir)); - std::replace(fOSDir.begin(), fOSDir.end(), '\\', '/'); - if (!fOSDir.empty() && ('c' == fOSDir[0] || 'C' == fOSDir[0])) { - this->OSDirRelative = false; - } else { - this->OSDirRelative = true; + this->WriteMacros(); + this->WriteHighLevelDirectives(); + GhsMultiGpj::WriteGpjTag(GhsMultiGpj::PROJECT, this->GetBuildFileStream()); + this->WriteDisclaimer(this->GetBuildFileStream()); + *this->GetBuildFileStream() << "# Top Level Project File" << std::endl; + + // Specify BSP option if supplied by user + // -- not all platforms require this entry in the project file + // integrity platforms require this field; use default if needed + std::string platform; + if (const char* p = + this->GetCMakeInstance()->GetCacheDefinition("GHS_TARGET_PLATFORM")) { + platform = p; } std::string bspName; - char const* bspCache = - this->GetCMakeInstance()->GetCacheDefinition("GHS_BSP_NAME"); - if (bspCache) { + if (char const* bspCache = + this->GetCMakeInstance()->GetCacheDefinition("GHS_BSP_NAME")) { bspName = bspCache; this->GetCMakeInstance()->MarkCliAsUsed("GHS_BSP_NAME"); + } else { + bspName = "IGNORE"; } - if (bspName.empty() || bspName.compare("IGNORE") == 0) { + + if (platform.find("integrity") != std::string::npos && + cmSystemTools::IsOff(bspName.c_str())) { const char* a = this->GetCMakeInstance()->GetCacheDefinition("CMAKE_GENERATOR_PLATFORM"); bspName = "sim"; bspName += (a ? a : ""); } - this->WriteMacros(); - this->WriteHighLevelDirectives(); + if (!cmSystemTools::IsOff(bspName.c_str())) { + *this->GetBuildFileStream() << " -bsp " << bspName << std::endl; + } - GhsMultiGpj::WriteGpjTag(GhsMultiGpj::PROJECT, this->GetBuildFileStream()); - this->WriteDisclaimer(this->GetBuildFileStream()); - *this->GetBuildFileStream() << "# Top Level Project File" << std::endl; - *this->GetBuildFileStream() << " -bsp " << bspName << std::endl; + // Specify OS DIR if supplied by user + // -- not all platforms require this entry in the project file + std::string osDir; + std::string osDirOption; + if (char const* osDirCache = + this->GetCMakeInstance()->GetCacheDefinition("GHS_OS_DIR")) { + osDir = osDirCache; + } + + if (char const* osDirOptionCache = + this->GetCMakeInstance()->GetCacheDefinition("GHS_OS_DIR_OPTION")) { + osDirOption = osDirOptionCache; + } - this->WriteCompilerOptions(fOSDir); + if (!cmSystemTools::IsOff(osDir.c_str()) || + platform.find("integrity") != std::string::npos) { + std::replace(osDir.begin(), osDir.end(), '\\', '/'); + *this->GetBuildFileStream() + << " " << osDirOption << "\"" << osDir << "\"" << std::endl; + } } void cmGlobalGhsMultiGenerator::CloseBuildFileStream( @@ -368,12 +386,6 @@ void cmGlobalGhsMultiGenerator::WriteHighLevelDirectives() } } -void cmGlobalGhsMultiGenerator::WriteCompilerOptions(std::string const& fOSDir) -{ - *this->GetBuildFileStream() - << " -os_dir=\"" << fOSDir << "\"" << std::endl; -} - void cmGlobalGhsMultiGenerator::WriteDisclaimer(std::ostream* os) { (*os) << "#" << std::endl diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h index a5aff73..4ab4c56 100644 --- a/Source/cmGlobalGhsMultiGenerator.h +++ b/Source/cmGlobalGhsMultiGenerator.h @@ -85,7 +85,6 @@ public: std::map* fileMap); static std::string trimQuotes(std::string const& str); - inline bool IsOSDirRelative() { return this->OSDirRelative; } protected: void Generate() override; @@ -105,7 +104,6 @@ private: void WriteMacros(); void WriteHighLevelDirectives(); - void WriteCompilerOptions(std::string const& fOSDir); static void AddFilesUpToPathNewBuildFile( cmGeneratedFileStream* mainBuildFile, @@ -126,7 +124,6 @@ private: std::vector LibDirs; - bool OSDirRelative; static const char* DEFAULT_BUILD_PROGRAM; static const char* DEFAULT_TOOLSET_ROOT; }; ----------------------------------------------------------------------- Summary of changes: Help/command/try_compile.rst | 3 + Help/generator/Green Hills MULTI.rst | 40 +- Help/manual/cmake-properties.7.rst | 2 +- Help/manual/cmake-variables.7.rst | 5 - Help/prop_tgt/GHS_INTEGRITY_APP.rst | 10 + Help/variable/CMAKE_LANG_COMPILER_ID.rst | 1 + .../CMAKE_LANG_GHS_KERNEL_FLAGS_CONFIG.rst | 5 - .../variable/CMAKE_LANG_GHS_KERNEL_FLAGS_DEBUG.rst | 5 - .../CMAKE_LANG_GHS_KERNEL_FLAGS_MINSIZEREL.rst | 5 - .../CMAKE_LANG_GHS_KERNEL_FLAGS_RELEASE.rst | 5 - .../CMAKE_LANG_GHS_KERNEL_FLAGS_RELWITHDEBINFO.rst | 5 - Help/variable/GHS-MULTI.rst | 2 +- Modules/CMakeCompilerIdDetection.cmake | 1 + Modules/CMakeDetermineCCompiler.cmake | 1 + Modules/CMakeDetermineCXXCompiler.cmake | 1 + Modules/CMakeDetermineCompilerABI.cmake | 2 + Modules/CMakeDetermineCompilerId.cmake | 85 ++- Modules/CMakePlatformId.h.in | 28 + Modules/CMakeTestCCompiler.cmake | 2 + Modules/CMakeTestCXXCompiler.cmake | 2 + Modules/CMakeTestCompilerCommon.cmake | 20 + Modules/Compiler/GHS-C.cmake | 20 - Modules/Compiler/GHS-CXX.cmake | 24 - Modules/Compiler/GHS-DetermineCompiler.cmake | 11 +- Modules/Compiler/GHS.cmake | 6 +- Modules/CompilerId/GHS_default.gpj.in | 8 + Modules/CompilerId/GHS_lib.gpj.in | 3 + Modules/Platform/GHS-MULTI-Initialize.cmake | 8 +- Source/cmCoreTryCompile.cxx | 16 + Source/cmGhsMultiGpj.cxx | 31 +- Source/cmGhsMultiGpj.h | 6 +- Source/cmGhsMultiTargetGenerator.cxx | 798 ++++++++++----------- Source/cmGhsMultiTargetGenerator.h | 100 +-- Source/cmGlobalGenerator.cxx | 3 +- Source/cmGlobalGhsMultiGenerator.cxx | 505 ++++++------- Source/cmGlobalGhsMultiGenerator.h | 99 ++- Source/cmLocalGhsMultiGenerator.cxx | 81 ++- Source/cmLocalGhsMultiGenerator.h | 11 + Source/cmState.cxx | 10 + Source/cmState.h | 3 + Tests/CMakeLists.txt | 122 +++- Tests/GhsMulti/CMakeLists.txt | 4 - .../GhsMultiCompilerOptions/CMakeLists.txt | 92 +++ .../GhsMultiCompilerOptions/CMakeLists.txt.in | 32 + Tests/GhsMulti/GhsMultiCompilerOptions/test.c | 4 + Tests/GhsMulti/GhsMultiCopyFile/CMakeLists.txt | 30 + Tests/GhsMulti/GhsMultiCopyFile/test.c | 4 + .../CMakeLists.txt | 8 +- .../GhsMultiDuplicateSourceFilenames/main.c | 4 + .../subfolder/test.c | 1 - .../subfolder/testcase.c} | 3 +- .../subfolder_test.c | 1 - .../subfolder_test_0.c | 1 - .../GhsMultiDuplicateSourceFilenames/test.c | 1 - .../GhsMultiDuplicateSourceFilenames/testCase.c} | 3 +- Tests/GhsMulti/GhsMultiExclude/CMakeLists.txt | 17 + .../GhsMultiExclude/exe1.c} | 0 .../test.c => GhsMulti/GhsMultiExclude/lib1.c} | 3 +- Tests/GhsMulti/GhsMultiExclude/verify.cmake | 54 ++ .../GhsMultiIntegrityDD/CMakeLists.txt | 19 + .../GhsMultiIntegrity/GhsMultiIntegrityDD/exe.c | 5 + .../GhsMultiIntegrity/GhsMultiIntegrityDD/func.c} | 3 +- .../GhsMultiIntegrityDDInt}/App/CMakeLists.txt | 2 +- .../GhsMultiIntegrityDDInt}/App/Main.c | 0 .../GhsMultiIntegrityDDInt}/CMakeLists.txt | 3 + .../GhsMultiIntegrityDDInt}/Int/AppDD.int | 2 +- .../GhsMultiIntegrityDDInt/Int/CMakeLists.txt | 1 + .../GhsMultiIntegrityDDInt/Lib/CMakeLists.txt | 1 + .../GhsMultiIntegrityDDInt}/Lib/HelperFun.c | 0 .../GhsMultiIntegrityDDInt}/Lib/HelperFun.h | 0 .../GhsMultiIntegrityMonolith/CMakeLists.txt | 20 + .../GhsMultiIntegrityMonolith/exe.c | 5 + .../GhsMultiIntegrityMonolith/func.c} | 2 +- .../GhsMultiIntegrityMonolith/kernel.c | 15 + .../GhsMultiIntegrityMonolith/test.int | 8 + Tests/GhsMulti/GhsMultiInterface/CMakeLists.txt | 8 + Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt | 92 +++ Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt.in | 43 ++ Tests/GhsMulti/GhsMultiLinkTest/exe1.c | 6 + Tests/GhsMulti/GhsMultiLinkTest/exe1.h | 6 + Tests/GhsMulti/GhsMultiLinkTest/func2.c | 4 + Tests/GhsMulti/GhsMultiLinkTest/func3.c | 4 + Tests/GhsMulti/GhsMultiLinkTest/func4.c | 4 + Tests/GhsMulti/GhsMultiLinkTest/func5.c | 4 + Tests/GhsMulti/GhsMultiLinkTest/func6.c | 4 + Tests/GhsMulti/GhsMultiLinkTest/func7.c | 4 + Tests/GhsMulti/GhsMultiLinkTestSub/CMakeLists.txt | 9 + .../GhsMultiLinkTestSub/sub_exe/CMakeLists.txt | 12 + Tests/GhsMulti/GhsMultiLinkTestSub/sub_exe/exe1.c | 6 + Tests/GhsMulti/GhsMultiLinkTestSub/sub_exe/exe1.h | 6 + .../GhsMultiLinkTestSub/sub_lib/CMakeLists.txt | 7 + Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func2.c | 4 + Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func3.c | 4 + Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func4.c | 4 + Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func5.c | 4 + Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func6.c | 4 + Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func7.c | 4 + .../GhsMultiMultipleProjects/CMakeLists.txt | 17 + Tests/GhsMulti/GhsMultiMultipleProjects/exe1.c | 5 + Tests/GhsMulti/GhsMultiMultipleProjects/lib1.c | 4 + .../GhsMultiMultipleProjects/sub/CMakeLists.txt | 10 + Tests/GhsMulti/GhsMultiMultipleProjects/sub/exe2.c | 6 + .../GhsMultiMultipleProjects/sub/lib2.c} | 3 +- .../GhsMultiMultipleProjects/sub2/CMakeLists.txt | 10 + .../GhsMulti/GhsMultiMultipleProjects/sub2/exe3.c | 6 + .../GhsMultiMultipleProjects/sub2/lib3.c} | 3 +- .../GhsMulti/GhsMultiMultipleProjects/verify.cmake | 58 ++ .../GhsMulti/GhsMultiObjectLibrary/CMakeLists.txt | 13 + Tests/GhsMulti/GhsMultiObjectLibrary/exe.c | 8 + Tests/GhsMulti/GhsMultiObjectLibrary/sub/testOBJ.c | 4 + Tests/GhsMulti/GhsMultiObjectLibrary/testOBJ.c | 4 + Tests/GhsMulti/GhsMultiObjectLibrary/testOBJ.h | 1 + Tests/GhsMulti/GhsMultiObjectLibrary/testOBJ2.c | 4 + Tests/GhsMulti/GhsMultiPlatform/CMakeLists.txt | 34 + Tests/GhsMulti/GhsMultiPlatform/file1.c | 4 + .../GhsMulti/GhsMultiRenameInstall/CMakeLists.txt | 42 ++ .../GhsMultiRenameInstall/exe.c} | 0 Tests/GhsMulti/GhsMultiRenameInstall/exe1.c | 5 + .../GhsMultiRenameInstall/lib1.c} | 3 +- Tests/GhsMulti/GhsMultiSrcGroups/Atest3.c | 4 + Tests/GhsMulti/GhsMultiSrcGroups/CMakeLists.txt | 45 ++ Tests/GhsMulti/GhsMultiSrcGroups/cmake.rule | 1 + Tests/GhsMulti/GhsMultiSrcGroups/object.o | 1 + .../GhsMultiSrcGroups/resource.pdf} | 0 Tests/GhsMulti/GhsMultiSrcGroups/s2.h | 6 + Tests/GhsMulti/GhsMultiSrcGroups/s4.h | 6 + Tests/GhsMulti/GhsMultiSrcGroups/s5.h | 6 + Tests/GhsMulti/GhsMultiSrcGroups/standard.h | 1 + Tests/GhsMulti/GhsMultiSrcGroups/sub/testOBJ.c | 6 + Tests/GhsMulti/GhsMultiSrcGroups/sub/testOBJ.h | 6 + Tests/GhsMulti/GhsMultiSrcGroups/test1.c | 6 + Tests/GhsMulti/GhsMultiSrcGroups/test1.h | 6 + Tests/GhsMulti/GhsMultiSrcGroups/test2a.c | 4 + Tests/GhsMulti/GhsMultiSrcGroups/test3.c | 4 + Tests/GhsMulti/GhsMultiSrcGroups/test3.h | 1 + Tests/GhsMulti/GhsMultiSrcGroups/test4.c | 4 + Tests/GhsMulti/GhsMultiSrcGroups/test5.c | 4 + Tests/GhsMulti/GhsMultiSrcGroups/test6.c | 4 + Tests/GhsMulti/GhsMultiSrcGroups/test7.c | 4 + Tests/GhsMulti/GhsMultiSrcGroups/testOBJ.c | 11 + Tests/GhsMulti/GhsMultiSrcGroups/testOBJ.h | 6 + Tests/GhsMulti/GhsMultiSrcGroups/textfile.txt | 1 + Tests/GhsMulti/GhsMultiSrcGroups/textfile2.txt | 1 + .../GhsMultiUnsupportedTargets/CMakeLists.txt | 12 + Tests/GhsMulti/GhsMultiUnsupportedTargets/file.c | 4 + Tests/GhsMulti/ReturnNum/Int/CMakeLists.txt | 1 - Tests/GhsMulti/ReturnNum/Int/Default.bsp | 35 - Tests/GhsMulti/ReturnNum/Lib/CMakeLists.txt | 1 - 148 files changed, 2055 insertions(+), 1066 deletions(-) create mode 100644 Help/prop_tgt/GHS_INTEGRITY_APP.rst delete mode 100644 Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_CONFIG.rst delete mode 100644 Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_DEBUG.rst delete mode 100644 Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_MINSIZEREL.rst delete mode 100644 Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_RELEASE.rst delete mode 100644 Help/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_RELWITHDEBINFO.rst create mode 100644 Modules/CompilerId/GHS_default.gpj.in create mode 100644 Modules/CompilerId/GHS_lib.gpj.in delete mode 100644 Tests/GhsMulti/CMakeLists.txt create mode 100644 Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt create mode 100644 Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt.in create mode 100644 Tests/GhsMulti/GhsMultiCompilerOptions/test.c create mode 100644 Tests/GhsMulti/GhsMultiCopyFile/CMakeLists.txt create mode 100644 Tests/GhsMulti/GhsMultiCopyFile/test.c rename Tests/{ => GhsMulti}/GhsMultiDuplicateSourceFilenames/CMakeLists.txt (58%) rename Tests/{ => GhsMulti}/GhsMultiDuplicateSourceFilenames/main.c (73%) copy Tests/{ => GhsMulti}/GhsMultiDuplicateSourceFilenames/subfolder/test.c (96%) copy Tests/{GhsMultiDuplicateSourceFilenames/test.c => GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder/testcase.c} (53%) rename Tests/{ => GhsMulti}/GhsMultiDuplicateSourceFilenames/subfolder_test.c (96%) rename Tests/{ => GhsMulti}/GhsMultiDuplicateSourceFilenames/subfolder_test_0.c (96%) copy Tests/{ => GhsMulti}/GhsMultiDuplicateSourceFilenames/test.c (96%) rename Tests/{GhsMultiDuplicateSourceFilenames/test.c => GhsMulti/GhsMultiDuplicateSourceFilenames/testCase.c} (53%) create mode 100644 Tests/GhsMulti/GhsMultiExclude/CMakeLists.txt copy Tests/{Wrapping/wrapFLTK.cxx => GhsMulti/GhsMultiExclude/exe1.c} (100%) copy Tests/{GhsMultiDuplicateSourceFilenames/subfolder/test.c => GhsMulti/GhsMultiExclude/lib1.c} (51%) create mode 100644 Tests/GhsMulti/GhsMultiExclude/verify.cmake create mode 100644 Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDD/CMakeLists.txt create mode 100644 Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDD/exe.c copy Tests/{GhsMultiDuplicateSourceFilenames/subfolder/test.c => GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDD/func.c} (51%) rename Tests/GhsMulti/{ReturnNum => GhsMultiIntegrity/GhsMultiIntegrityDDInt}/App/CMakeLists.txt (58%) rename Tests/GhsMulti/{ReturnNum => GhsMultiIntegrity/GhsMultiIntegrityDDInt}/App/Main.c (100%) rename Tests/GhsMulti/{ReturnNum => GhsMultiIntegrity/GhsMultiIntegrityDDInt}/CMakeLists.txt (56%) rename Tests/GhsMulti/{ReturnNum => GhsMultiIntegrity/GhsMultiIntegrityDDInt}/Int/AppDD.int (90%) create mode 100644 Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/Int/CMakeLists.txt create mode 100644 Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityDDInt/Lib/CMakeLists.txt rename Tests/GhsMulti/{ReturnNum => GhsMultiIntegrity/GhsMultiIntegrityDDInt}/Lib/HelperFun.c (100%) rename Tests/GhsMulti/{ReturnNum => GhsMultiIntegrity/GhsMultiIntegrityDDInt}/Lib/HelperFun.h (100%) create mode 100644 Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/CMakeLists.txt create mode 100644 Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/exe.c copy Tests/{GhsMultiDuplicateSourceFilenames/subfolder/test.c => GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/func.c} (53%) create mode 100644 Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/kernel.c create mode 100644 Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/test.int create mode 100644 Tests/GhsMulti/GhsMultiInterface/CMakeLists.txt create mode 100644 Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt create mode 100644 Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt.in create mode 100644 Tests/GhsMulti/GhsMultiLinkTest/exe1.c create mode 100644 Tests/GhsMulti/GhsMultiLinkTest/exe1.h create mode 100644 Tests/GhsMulti/GhsMultiLinkTest/func2.c create mode 100644 Tests/GhsMulti/GhsMultiLinkTest/func3.c create mode 100644 Tests/GhsMulti/GhsMultiLinkTest/func4.c create mode 100644 Tests/GhsMulti/GhsMultiLinkTest/func5.c create mode 100644 Tests/GhsMulti/GhsMultiLinkTest/func6.c create mode 100644 Tests/GhsMulti/GhsMultiLinkTest/func7.c create mode 100644 Tests/GhsMulti/GhsMultiLinkTestSub/CMakeLists.txt create mode 100644 Tests/GhsMulti/GhsMultiLinkTestSub/sub_exe/CMakeLists.txt create mode 100644 Tests/GhsMulti/GhsMultiLinkTestSub/sub_exe/exe1.c create mode 100644 Tests/GhsMulti/GhsMultiLinkTestSub/sub_exe/exe1.h create mode 100644 Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/CMakeLists.txt create mode 100644 Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func2.c create mode 100644 Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func3.c create mode 100644 Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func4.c create mode 100644 Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func5.c create mode 100644 Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func6.c create mode 100644 Tests/GhsMulti/GhsMultiLinkTestSub/sub_lib/func7.c create mode 100644 Tests/GhsMulti/GhsMultiMultipleProjects/CMakeLists.txt create mode 100644 Tests/GhsMulti/GhsMultiMultipleProjects/exe1.c create mode 100644 Tests/GhsMulti/GhsMultiMultipleProjects/lib1.c create mode 100644 Tests/GhsMulti/GhsMultiMultipleProjects/sub/CMakeLists.txt create mode 100644 Tests/GhsMulti/GhsMultiMultipleProjects/sub/exe2.c copy Tests/{GhsMultiDuplicateSourceFilenames/subfolder/test.c => GhsMulti/GhsMultiMultipleProjects/sub/lib2.c} (51%) create mode 100644 Tests/GhsMulti/GhsMultiMultipleProjects/sub2/CMakeLists.txt create mode 100644 Tests/GhsMulti/GhsMultiMultipleProjects/sub2/exe3.c copy Tests/{GhsMultiDuplicateSourceFilenames/subfolder/test.c => GhsMulti/GhsMultiMultipleProjects/sub2/lib3.c} (51%) create mode 100644 Tests/GhsMulti/GhsMultiMultipleProjects/verify.cmake create mode 100644 Tests/GhsMulti/GhsMultiObjectLibrary/CMakeLists.txt create mode 100644 Tests/GhsMulti/GhsMultiObjectLibrary/exe.c create mode 100644 Tests/GhsMulti/GhsMultiObjectLibrary/sub/testOBJ.c create mode 100644 Tests/GhsMulti/GhsMultiObjectLibrary/testOBJ.c create mode 100644 Tests/GhsMulti/GhsMultiObjectLibrary/testOBJ.h create mode 100644 Tests/GhsMulti/GhsMultiObjectLibrary/testOBJ2.c create mode 100644 Tests/GhsMulti/GhsMultiPlatform/CMakeLists.txt create mode 100644 Tests/GhsMulti/GhsMultiPlatform/file1.c create mode 100644 Tests/GhsMulti/GhsMultiRenameInstall/CMakeLists.txt copy Tests/{Wrapping/wrapFLTK.cxx => GhsMulti/GhsMultiRenameInstall/exe.c} (100%) create mode 100644 Tests/GhsMulti/GhsMultiRenameInstall/exe1.c rename Tests/{GhsMultiDuplicateSourceFilenames/subfolder/test.c => GhsMulti/GhsMultiRenameInstall/lib1.c} (51%) create mode 100644 Tests/GhsMulti/GhsMultiSrcGroups/Atest3.c create mode 100644 Tests/GhsMulti/GhsMultiSrcGroups/CMakeLists.txt create mode 100644 Tests/GhsMulti/GhsMultiSrcGroups/cmake.rule create mode 100644 Tests/GhsMulti/GhsMultiSrcGroups/object.o copy Tests/{Wrapping/vtkIncluded.cxx => GhsMulti/GhsMultiSrcGroups/resource.pdf} (100%) create mode 100644 Tests/GhsMulti/GhsMultiSrcGroups/s2.h create mode 100644 Tests/GhsMulti/GhsMultiSrcGroups/s4.h create mode 100644 Tests/GhsMulti/GhsMultiSrcGroups/s5.h create mode 100644 Tests/GhsMulti/GhsMultiSrcGroups/standard.h create mode 100644 Tests/GhsMulti/GhsMultiSrcGroups/sub/testOBJ.c create mode 100644 Tests/GhsMulti/GhsMultiSrcGroups/sub/testOBJ.h create mode 100644 Tests/GhsMulti/GhsMultiSrcGroups/test1.c create mode 100644 Tests/GhsMulti/GhsMultiSrcGroups/test1.h create mode 100644 Tests/GhsMulti/GhsMultiSrcGroups/test2a.c create mode 100644 Tests/GhsMulti/GhsMultiSrcGroups/test3.c create mode 100644 Tests/GhsMulti/GhsMultiSrcGroups/test3.h create mode 100644 Tests/GhsMulti/GhsMultiSrcGroups/test4.c create mode 100644 Tests/GhsMulti/GhsMultiSrcGroups/test5.c create mode 100644 Tests/GhsMulti/GhsMultiSrcGroups/test6.c create mode 100644 Tests/GhsMulti/GhsMultiSrcGroups/test7.c create mode 100644 Tests/GhsMulti/GhsMultiSrcGroups/testOBJ.c create mode 100644 Tests/GhsMulti/GhsMultiSrcGroups/testOBJ.h create mode 100644 Tests/GhsMulti/GhsMultiSrcGroups/textfile.txt create mode 100644 Tests/GhsMulti/GhsMultiSrcGroups/textfile2.txt create mode 100644 Tests/GhsMulti/GhsMultiUnsupportedTargets/CMakeLists.txt create mode 100644 Tests/GhsMulti/GhsMultiUnsupportedTargets/file.c delete mode 100644 Tests/GhsMulti/ReturnNum/Int/CMakeLists.txt delete mode 100644 Tests/GhsMulti/ReturnNum/Int/Default.bsp delete mode 100644 Tests/GhsMulti/ReturnNum/Lib/CMakeLists.txt hooks/post-receive -- CMake From kwrobot at kitware.com Sat Jan 19 00:03:06 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Sat, 19 Jan 2019 00:03:06 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-982-gc902e77 Message-ID: <20190119050306.C2E3B127A4B@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via c902e775ec3fc2f3c6f6c4273142bfe6f73f4c57 (commit) from a61c061b6143cb6d8920b1b5796a867c0f104556 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c902e775ec3fc2f3c6f6c4273142bfe6f73f4c57 commit c902e775ec3fc2f3c6f6c4273142bfe6f73f4c57 Author: Kitware Robot AuthorDate: Sat Jan 19 00:01:07 2019 -0500 Commit: Kitware Robot CommitDate: Sat Jan 19 00:01:07 2019 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 245bd71..acaeacf 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 13) -set(CMake_VERSION_PATCH 20190118) +set(CMake_VERSION_PATCH 20190119) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Sun Jan 20 00:03:05 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Sun, 20 Jan 2019 00:03:05 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-983-g41e02ea Message-ID: <20190120050305.F2ABE125BD7@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 41e02ea3b82c2c1a302096d3032dc2f52f52b686 (commit) from c902e775ec3fc2f3c6f6c4273142bfe6f73f4c57 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=41e02ea3b82c2c1a302096d3032dc2f52f52b686 commit 41e02ea3b82c2c1a302096d3032dc2f52f52b686 Author: Kitware Robot AuthorDate: Sun Jan 20 00:01:04 2019 -0500 Commit: Kitware Robot CommitDate: Sun Jan 20 00:01:04 2019 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index acaeacf..e2a72e4 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 13) -set(CMake_VERSION_PATCH 20190119) +set(CMake_VERSION_PATCH 20190120) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jan 21 00:03:04 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 21 Jan 2019 00:03:04 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-984-g7ac3844 Message-ID: <20190121050304.E808A11E603@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 7ac3844ab5a09ad4018c40569ccdc07c313eb407 (commit) from 41e02ea3b82c2c1a302096d3032dc2f52f52b686 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7ac3844ab5a09ad4018c40569ccdc07c313eb407 commit 7ac3844ab5a09ad4018c40569ccdc07c313eb407 Author: Kitware Robot AuthorDate: Mon Jan 21 00:01:06 2019 -0500 Commit: Kitware Robot CommitDate: Mon Jan 21 00:01:06 2019 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index e2a72e4..62f5f70 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 13) -set(CMake_VERSION_PATCH 20190120) +set(CMake_VERSION_PATCH 20190121) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jan 21 07:53:06 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 21 Jan 2019 07:53:06 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-1015-g9ea2f0e Message-ID: <20190121125306.A68FEA2C37@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 9ea2f0eb948548aab2fc865d62a658e0c78e90f9 (commit) via 4dba5d6ce251257259874bce394b2fba954e200c (commit) via 7e5f9b192e9c3ed7130e1e52b7f9d3243f51e2ab (commit) via 15fe5c4c9d90aa03e146fe8b9585e82c4f3b5ffe (commit) via 0526ae4415f61c5a2adfd78e05b797de1d44fba6 (commit) via d704cc34071f0c6f95099670c94c7f1940ab7fa2 (commit) via d1aa2e11092acdcc22b333e219187026d38549a5 (commit) via fefae527c8c54d249c44313d9b09cdb0157e2f5d (commit) via 0ffe8f8844bb74e785feec84e4871ec139185625 (commit) via ef61997b1be5c2f542472f8eb48dac62cd26bf5c (commit) via cae9d2a61afea3948c8dfaf1f7dbc39ebaa71055 (commit) via 7370b02c36b45bcd92b6c5bb7cc65ecff75b9b2b (commit) via 62fec84ad7b44b7c54130e9eb3686f4fbc22672e (commit) via 2e5307a2a45d456b7fb52e4d3fab1416dc9a1bd8 (commit) via 75a7a237465e37215525831f942a3904d20d1380 (commit) via fecbc87608f4b1429721292d3414bde9eb9f073f (commit) via 2915a75615bab216753c902fa716b11f9fc5de83 (commit) via d6475daa79810e332c3d2d1659e3d73250717219 (commit) via 938f06fda69a0f4ef04b2ed43a945a3c901b9750 (commit) via 65e725c95756a4e2348e9fb52b3d5aca7ee21115 (commit) via 65f1fc9d6329feb2d48ee986d4243166a66049af (commit) via 2bedd5fb7c02987ad209f96889e2578a16806e01 (commit) via 0f08ed89362d207e18b06e806f127cd683b79141 (commit) via 593d986470ce1938436da312e0c93e3c9c07017e (commit) via 9a3d85cfc501fe3c1655e4a6ae9fd08fd9a1fbb7 (commit) via e68ea269d72773e53db0c6c6848f6f69f3fd7329 (commit) via 45aa9c65a13105ff505e18f5029ef794b7aef9ab (commit) via 8bb7562f1a4e75fa5cd00f4ebd868d1494b63e7a (commit) via 81650e488c734702384ef903630838015a3f81b1 (commit) via b773e58099b2fc8ebdf8319172fb018d0139396d (commit) via a5e948a36f5d1c1cf6a0ea34b04bbc4b6058e7d9 (commit) from 7ac3844ab5a09ad4018c40569ccdc07c313eb407 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9ea2f0eb948548aab2fc865d62a658e0c78e90f9 commit 9ea2f0eb948548aab2fc865d62a658e0c78e90f9 Merge: 4dba5d6 0ffe8f8 Author: Brad King AuthorDate: Mon Jan 21 12:52:34 2019 +0000 Commit: Kitware Robot CommitDate: Mon Jan 21 07:52:40 2019 -0500 Merge topic 'swift-module-name' 0ffe8f8844 Ninja: support `SWIFT_MODULE_NAME` property Acked-by: Kitware Robot Merge-request: !2813 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4dba5d6ce251257259874bce394b2fba954e200c commit 4dba5d6ce251257259874bce394b2fba954e200c Merge: 7e5f9b1 ef61997 Author: Brad King AuthorDate: Mon Jan 21 12:51:46 2019 +0000 Commit: Kitware Robot CommitDate: Mon Jan 21 07:51:54 2019 -0500 Merge topic 'use-emplace' ef61997b1b clang-tidy: Use emplace 2e5307a2a4 CTestSVN: Accept std::string in SVNInfo constructor Acked-by: Kitware Robot Merge-request: !2811 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7e5f9b192e9c3ed7130e1e52b7f9d3243f51e2ab commit 7e5f9b192e9c3ed7130e1e52b7f9d3243f51e2ab Merge: 15fe5c4 cae9d2a Author: Brad King AuthorDate: Mon Jan 21 12:50:54 2019 +0000 Commit: Kitware Robot CommitDate: Mon Jan 21 07:51:08 2019 -0500 Merge topic 'ctest-json-polish' cae9d2a61a CTest: Teach --show-only= to reject unknown values 7370b02c36 CTest: Teach --show-only=json-v1 to filter out not-available tests 62fec84ad7 Tests: Fix RunCMake.CTestCommandLine case when no python is found 75a7a23746 Tests: Rename RunCMake.CTestCommandLine show-only test cases fecbc87608 Tests: Fix RunCMake.CTestCommandLine to actually check json-v1 Acked-by: Kitware Robot Merge-request: !2812 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=15fe5c4c9d90aa03e146fe8b9585e82c4f3b5ffe commit 15fe5c4c9d90aa03e146fe8b9585e82c4f3b5ffe Merge: d704cc3 0526ae4 Author: Brad King AuthorDate: Mon Jan 21 12:50:16 2019 +0000 Commit: Kitware Robot CommitDate: Mon Jan 21 07:50:23 2019 -0500 Merge topic 'FindCURL-typo' 0526ae4415 FindCURL: fix component failure when no pkg-config Acked-by: Kitware Robot Merge-request: !2826 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0526ae4415f61c5a2adfd78e05b797de1d44fba6 commit 0526ae4415f61c5a2adfd78e05b797de1d44fba6 Author: Hiroshi Miura AuthorDate: Fri Jan 18 21:52:42 2019 +0900 Commit: Brad King CommitDate: Mon Jan 21 07:49:00 2019 -0500 FindCURL: fix component failure when no pkg-config find_package(CURL COMPONENTS foo) fails when there is no pkg-config module because of variable name typo. Signed-off-by: Hiroshi Miura Fixes: #18802 diff --git a/Modules/FindCURL.cmake b/Modules/FindCURL.cmake index d28dfea..b1989b1 100644 --- a/Modules/FindCURL.cmake +++ b/Modules/FindCURL.cmake @@ -110,12 +110,12 @@ if(CURL_FIND_COMPONENTS) OUTPUT_VARIABLE CURL_CONFIG_FEATURES_STRING ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) - string(REPLACE "\n" ";" CURL_CONFIG_FEATURES "${CURL_CONFIG_FEATURES_STRING}") + string(REPLACE "\n" ";" CURL_SUPPORTED_FEATURES "${CURL_CONFIG_FEATURES_STRING}") execute_process(COMMAND ${CURL_CONFIG_EXECUTABLE} --protocols OUTPUT_VARIABLE CURL_CONFIG_PROTOCOLS_STRING ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) - string(REPLACE "\n" ";" CURL_CONFIG_PROTOCOLS "${CURL_CONFIG_PROTOCOLS_STRING}") + string(REPLACE "\n" ";" CURL_SUPPORTED_PROTOCOLS "${CURL_CONFIG_PROTOCOLS_STRING}") endif() endif() https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d704cc34071f0c6f95099670c94c7f1940ab7fa2 commit d704cc34071f0c6f95099670c94c7f1940ab7fa2 Merge: d1aa2e1 0f08ed8 Author: Brad King AuthorDate: Mon Jan 21 12:48:19 2019 +0000 Commit: Kitware Robot CommitDate: Mon Jan 21 07:48:26 2019 -0500 Merge topic 'command_file_link' 0f08ed8936 cmSystemTools: Silence CreateLink and CreateSymlink errors 593d986470 Tests: Avoid cross-device links in CREATE_LINK test 9a3d85cfc5 Tests: Skip symlink tests on Windows e68ea269d7 Tests: CREATE_LINK subcommand negative test case 45aa9c65a1 Tests: file CREATE_LINK subcommand test cases 8bb7562f1a Help: Add documentation for file(CREATE_LINK) subcommand 81650e488c cmFileCommand: Add CREATE_LINK subcommand Acked-by: Kitware Robot Merge-request: !2759 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d1aa2e11092acdcc22b333e219187026d38549a5 commit d1aa2e11092acdcc22b333e219187026d38549a5 Merge: fefae52 b773e58 Author: Brad King AuthorDate: Mon Jan 21 12:47:22 2019 +0000 Commit: Kitware Robot CommitDate: Mon Jan 21 07:47:29 2019 -0500 Merge topic 'find-package-resolve-symlinks' b773e58099 find_package: add test coverage for CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS a5e948a36f find_package: optionally resolve symlinks when discovering packages Acked-by: Kitware Robot Merge-request: !2798 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fefae527c8c54d249c44313d9b09cdb0157e2f5d commit fefae527c8c54d249c44313d9b09cdb0157e2f5d Merge: 7ac3844 2915a75 Author: Brad King AuthorDate: Mon Jan 21 12:46:13 2019 +0000 Commit: Kitware Robot CommitDate: Mon Jan 21 07:46:20 2019 -0500 Merge topic 'submit-url' 2915a75615 CTest: Add documentation and release notes for SubmitURL d6475daa79 Modules/CTest: Set SubmitURL 938f06fda6 ctest_submit: Add parameter SUBMIT_URL 65e725c957 CTest: Add option SubmitURL 65f1fc9d63 CTest: Add function GetSubmitURL 2bedd5fb7c ctest_submit: Remove submit method from log output Acked-by: Kitware Robot Merge-request: !2719 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0ffe8f8844bb74e785feec84e4871ec139185625 commit 0ffe8f8844bb74e785feec84e4871ec139185625 Author: Saleem Abdulrasool AuthorDate: Wed Jan 16 11:42:10 2019 -0800 Commit: Brad King CommitDate: Fri Jan 18 07:52:17 2019 -0500 Ninja: support `SWIFT_MODULE_NAME` property Add a new `SWIFT_MODULE_NAME` property that defaults to the target name. This is needed as otherwise, the first source file determines the module name. Issue: #18800 diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 5013be5..c959a04 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -433,6 +433,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang) vars.ObjectFileDir = "$OBJECT_FILE_DIR"; if (lang == "Swift") { vars.SwiftAuxiliarySources = "$SWIFT_AUXILIARY_SOURCES"; + vars.SwiftModuleName = "$SWIFT_MODULE_NAME"; } // For some cases we do an explicit preprocessor invocation. @@ -904,9 +905,9 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement( vars["FLAGS"] = this->ComputeFlagsForObject(source, language); vars["DEFINES"] = this->ComputeDefines(source, language); vars["INCLUDES"] = this->ComputeIncludes(source, language); - // The swift compiler needs all the sources besides the one being compiled in - // order to do the type checking. List all these "auxiliary" sources. if (language == "Swift") { + // The swift compiler needs all the sources besides the one being compiled + // in order to do the type checking. List all these "auxiliary" sources. std::string aux_sources; cmGeneratorTarget::KindedSources const& sources = this->GeneratorTarget->GetKindedSources(this->GetConfigName()); @@ -917,6 +918,8 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement( aux_sources += " " + this->GetSourceFilePath(src.Source.Value); } vars["SWIFT_AUXILIARY_SOURCES"] = aux_sources; + + vars["SWIFT_MODULE_NAME"] = this->GeneratorTarget->GetName(); } if (!this->NeedDepTypeMSVC(language)) { diff --git a/Source/cmRulePlaceholderExpander.cxx b/Source/cmRulePlaceholderExpander.cxx index 4b74ff0..c3e8ff5 100644 --- a/Source/cmRulePlaceholderExpander.cxx +++ b/Source/cmRulePlaceholderExpander.cxx @@ -167,6 +167,11 @@ std::string cmRulePlaceholderExpander::ExpandRuleVariable( return replaceValues.SwiftAuxiliarySources; } } + if (replaceValues.SwiftModuleName) { + if (variable == "SWIFT_MODULE_NAME") { + return replaceValues.SwiftModuleName; + } + } if (variable == "TARGET_SONAME" || variable == "SONAME_FLAG" || variable == "TARGET_INSTALLNAME_DIR") { // All these variables depend on TargetSOName diff --git a/Source/cmRulePlaceholderExpander.h b/Source/cmRulePlaceholderExpander.h index a936747..7aa63db 100644 --- a/Source/cmRulePlaceholderExpander.h +++ b/Source/cmRulePlaceholderExpander.h @@ -59,6 +59,7 @@ public: const char* DependencyFile; const char* FilterPrefix; const char* SwiftAuxiliarySources; + const char* SwiftModuleName; }; // Expand rule variables in CMake of the type found in language rules https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ef61997b1be5c2f542472f8eb48dac62cd26bf5c commit ef61997b1be5c2f542472f8eb48dac62cd26bf5c Author: Regina Pfeifer AuthorDate: Wed Jan 16 07:13:07 2019 +0100 Commit: Brad King CommitDate: Thu Jan 17 13:12:02 2019 -0500 clang-tidy: Use emplace diff --git a/.clang-tidy b/.clang-tidy index 3ae249f..aef99dc 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -15,7 +15,6 @@ modernize-*,\ -modernize-raw-string-literal,\ -modernize-return-braced-init-list,\ -modernize-use-auto,\ --modernize-use-emplace,\ -modernize-use-equals-default,\ -modernize-use-equals-delete,\ -modernize-use-noexcept,\ diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx index 326d26c..be4a18e 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.cxx +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx @@ -71,8 +71,8 @@ int cmCPackDragNDropGenerator::InitializeInternal() // Starting with Xcode 4.3, look in "/Applications/Xcode.app" first: // std::vector paths; - paths.push_back("/Applications/Xcode.app/Contents/Developer/Tools"); - paths.push_back("/Developer/Tools"); + paths.emplace_back("/Applications/Xcode.app/Contents/Developer/Tools"); + paths.emplace_back("/Developer/Tools"); const std::string hdiutil_path = cmSystemTools::FindProgram("hdiutil", std::vector(), false); diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index b205105..f7f3f24 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -1036,7 +1036,8 @@ int cmCPackGenerator::DoPackage() * may update this during PackageFiles. * (either putting several names or updating the provided one) */ - packageFileNames.push_back(tempPackageFileName ? tempPackageFileName : ""); + packageFileNames.emplace_back(tempPackageFileName ? tempPackageFileName + : ""); toplevel = tempDirectory; { // scope that enables package generators to run internal scripts with // latest CMake policies enabled diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index d02aa5a..4b865ca 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -610,7 +610,7 @@ bool cmCPackNSISGenerator::GetListOfSubdirectories( } } } - dirs.push_back(topdir); + dirs.emplace_back(topdir); return true; } diff --git a/Source/CPack/cmCPackPackageMakerGenerator.cxx b/Source/CPack/cmCPackPackageMakerGenerator.cxx index a24dd30..28e0561 100644 --- a/Source/CPack/cmCPackPackageMakerGenerator.cxx +++ b/Source/CPack/cmCPackPackageMakerGenerator.cxx @@ -340,16 +340,16 @@ int cmCPackPackageMakerGenerator::InitializeInternal() // If found, save result in the CPACK_INSTALLER_PROGRAM variable. std::vector paths; - paths.push_back("/Applications/Xcode.app/Contents/Applications" - "/PackageMaker.app/Contents/MacOS"); - paths.push_back("/Applications/Utilities" - "/PackageMaker.app/Contents/MacOS"); - paths.push_back("/Applications" - "/PackageMaker.app/Contents/MacOS"); - paths.push_back("/Developer/Applications/Utilities" - "/PackageMaker.app/Contents/MacOS"); - paths.push_back("/Developer/Applications" - "/PackageMaker.app/Contents/MacOS"); + paths.emplace_back("/Applications/Xcode.app/Contents/Applications" + "/PackageMaker.app/Contents/MacOS"); + paths.emplace_back("/Applications/Utilities" + "/PackageMaker.app/Contents/MacOS"); + paths.emplace_back("/Applications" + "/PackageMaker.app/Contents/MacOS"); + paths.emplace_back("/Developer/Applications/Utilities" + "/PackageMaker.app/Contents/MacOS"); + paths.emplace_back("/Developer/Applications" + "/PackageMaker.app/Contents/MacOS"); std::string pkgPath; const char* inst_program = this->GetOption("CPACK_INSTALLER_PROGRAM"); diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index d49fba2..6496af8 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -232,7 +232,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) // do the build if (this->BuildTargets.empty()) { - this->BuildTargets.push_back(""); + this->BuildTargets.emplace_back(); } for (std::string const& tar : this->BuildTargets) { cmDuration remainingTime = std::chrono::seconds(0); diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index 361883c..d07bd21 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -341,17 +341,17 @@ int cmCTestBuildHandler::ProcessHandler() // warnings and warning exceptions. std::vector::size_type cc; for (cc = 0; cmCTestErrorMatches[cc]; cc++) { - this->CustomErrorMatches.push_back(cmCTestErrorMatches[cc]); + this->CustomErrorMatches.emplace_back(cmCTestErrorMatches[cc]); } for (cc = 0; cmCTestErrorExceptions[cc]; cc++) { - this->CustomErrorExceptions.push_back(cmCTestErrorExceptions[cc]); + this->CustomErrorExceptions.emplace_back(cmCTestErrorExceptions[cc]); } for (cc = 0; cmCTestWarningMatches[cc]; cc++) { - this->CustomWarningMatches.push_back(cmCTestWarningMatches[cc]); + this->CustomWarningMatches.emplace_back(cmCTestWarningMatches[cc]); } for (cc = 0; cmCTestWarningExceptions[cc]; cc++) { - this->CustomWarningExceptions.push_back(cmCTestWarningExceptions[cc]); + this->CustomWarningExceptions.emplace_back(cmCTestWarningExceptions[cc]); } // Pre-compile regular expressions objects for all regular expressions @@ -365,7 +365,7 @@ int cmCTestBuildHandler::ProcessHandler() cmCTestOptionalLog(this->CTest, DEBUG, \ "Add " #strings ": " << s << std::endl, \ this->Quiet); \ - (regexes).push_back(s.c_str()); \ + (regexes).emplace_back(s); \ } \ } while (false) @@ -1034,7 +1034,7 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, size_t length, } } else { // Otherwise store pre-context for the next error - this->PreContext.push_back(line); + this->PreContext.emplace_back(line); if (this->PreContext.size() > this->MaxPreContext) { this->PreContext.erase(this->PreContext.begin(), this->PreContext.end() - diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index fbd1038..6c68f46 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -56,12 +56,12 @@ public: void SetCommand(const char* command) { this->CommandLineStrings.clear(); - this->CommandLineStrings.push_back(command); + this->CommandLineStrings.emplace_back(command); } void AddArgument(const char* arg) { if (arg) { - this->CommandLineStrings.push_back(arg); + this->CommandLineStrings.emplace_back(arg); } } void SetWorkingDirectory(const char* dir) { this->WorkingDirectory = dir; } @@ -316,8 +316,7 @@ int cmCTestCoverageHandler::ProcessHandler() // setup the regex exclude stuff this->CustomCoverageExcludeRegex.clear(); for (std::string const& rex : this->CustomCoverageExclude) { - this->CustomCoverageExcludeRegex.push_back( - cmsys::RegularExpression(rex.c_str())); + this->CustomCoverageExcludeRegex.emplace_back(rex); } if (this->HandleBullseyeCoverage(&cont)) { @@ -1005,7 +1004,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage( std::vector basecovargs = cmSystemTools::ParseArguments(gcovExtraFlags.c_str()); basecovargs.insert(basecovargs.begin(), gcovCommand); - basecovargs.push_back("-o"); + basecovargs.emplace_back("-o"); // files is a list of *.da and *.gcda files with coverage data in them. // These are binary files that you give as input to gcov so that it will diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx index 4facea2..5218993 100644 --- a/Source/CTest/cmCTestLaunch.cxx +++ b/Source/CTest/cmCTestLaunch.cxx @@ -146,7 +146,7 @@ void cmCTestLaunch::HandleRealArg(const char* arg) return; } #endif - this->RealArgs.push_back(arg); + this->RealArgs.emplace_back(arg); } void cmCTestLaunch::ComputeFileNames() @@ -534,9 +534,9 @@ void cmCTestLaunch::LoadScrapeRules() // Common compiler warning formats. These are much simpler than the // full log-scraping expressions because we do not need to extract // file and line information. - this->RegexWarning.push_back("(^|[ :])[Ww][Aa][Rr][Nn][Ii][Nn][Gg]"); - this->RegexWarning.push_back("(^|[ :])[Rr][Ee][Mm][Aa][Rr][Kk]"); - this->RegexWarning.push_back("(^|[ :])[Nn][Oo][Tt][Ee]"); + this->RegexWarning.emplace_back("(^|[ :])[Ww][Aa][Rr][Nn][Ii][Nn][Gg]"); + this->RegexWarning.emplace_back("(^|[ :])[Rr][Ee][Mm][Aa][Rr][Kk]"); + this->RegexWarning.emplace_back("(^|[ :])[Nn][Oo][Tt][Ee]"); // Load custom match rules given to us by CTest. this->LoadScrapeRules("Warning", this->RegexWarning); diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index 9c9532a..8ba59d3 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -261,8 +261,8 @@ void cmCTestMemCheckHandler::InitializeResultsVectors() }; this->GlobalResults.clear(); for (int i = 0; cmCTestMemCheckResultStrings[i] != nullptr; ++i) { - this->ResultStrings.push_back(cmCTestMemCheckResultStrings[i]); - this->ResultStringsLong.push_back(cmCTestMemCheckResultLongStrings[i]); + this->ResultStrings.emplace_back(cmCTestMemCheckResultStrings[i]); + this->ResultStringsLong.emplace_back(cmCTestMemCheckResultLongStrings[i]); this->GlobalResults.push_back(0); } } @@ -528,11 +528,11 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() switch (this->MemoryTesterStyle) { case cmCTestMemCheckHandler::VALGRIND: { if (this->MemoryTesterOptions.empty()) { - this->MemoryTesterOptions.push_back("-q"); - this->MemoryTesterOptions.push_back("--tool=memcheck"); - this->MemoryTesterOptions.push_back("--leak-check=yes"); - this->MemoryTesterOptions.push_back("--show-reachable=yes"); - this->MemoryTesterOptions.push_back("--num-callers=50"); + this->MemoryTesterOptions.emplace_back("-q"); + this->MemoryTesterOptions.emplace_back("--tool=memcheck"); + this->MemoryTesterOptions.emplace_back("--leak-check=yes"); + this->MemoryTesterOptions.emplace_back("--show-reachable=yes"); + this->MemoryTesterOptions.emplace_back("--num-callers=50"); } if (!this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile") .empty()) { @@ -586,11 +586,11 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() std::string dpbdFile = this->CTest->GetBinaryDir() + "/Testing/Temporary/MemoryChecker.??.DPbd"; this->BoundsCheckerDPBDFile = dpbdFile; - this->MemoryTesterDynamicOptions.push_back("/B"); + this->MemoryTesterDynamicOptions.emplace_back("/B"); this->MemoryTesterDynamicOptions.push_back(std::move(dpbdFile)); - this->MemoryTesterDynamicOptions.push_back("/X"); + this->MemoryTesterDynamicOptions.emplace_back("/X"); this->MemoryTesterDynamicOptions.push_back(this->MemoryTesterOutputFile); - this->MemoryTesterOptions.push_back("/M"); + this->MemoryTesterOptions.emplace_back("/M"); break; } // these are almost the same but the env var used is different @@ -604,8 +604,8 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() // The MemoryTesterDynamicOptions is setup with the -E env // Then the MemoryTesterEnvironmentVariable gets the // TSAN_OPTIONS string with the log_path in it. - this->MemoryTesterDynamicOptions.push_back("-E"); - this->MemoryTesterDynamicOptions.push_back("env"); + this->MemoryTesterDynamicOptions.emplace_back("-E"); + this->MemoryTesterDynamicOptions.emplace_back("env"); std::string envVar; std::string extraOptions; std::string suppressionsOption; diff --git a/Source/CTest/cmCTestP4.cxx b/Source/CTest/cmCTestP4.cxx index 511dbd2..c0bdc17 100644 --- a/Source/CTest/cmCTestP4.cxx +++ b/Source/CTest/cmCTestP4.cxx @@ -307,20 +307,20 @@ void cmCTestP4::SetP4Options(std::vector& CommandOptions) { if (P4Options.empty()) { const char* p4 = this->CommandLineTool.c_str(); - P4Options.push_back(p4); + P4Options.emplace_back(p4); // The CTEST_P4_CLIENT variable sets the P4 client used when issuing // Perforce commands, if it's different from the default one. std::string client = this->CTest->GetCTestConfiguration("P4Client"); if (!client.empty()) { - P4Options.push_back("-c"); + P4Options.emplace_back("-c"); P4Options.push_back(client); } // Set the message language to be English, in case the P4 admin // has localized them - P4Options.push_back("-L"); - P4Options.push_back("en"); + P4Options.emplace_back("-L"); + P4Options.emplace_back("en"); // The CTEST_P4_OPTIONS variable adds additional Perforce command line // options before the main command diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx index 21f5e1c..afde61c 100644 --- a/Source/CTest/cmCTestSVN.cxx +++ b/Source/CTest/cmCTestSVN.cxx @@ -532,7 +532,7 @@ bool cmCTestSVN::LoadRepositories() } // Info for root repository - this->Repositories.emplace_back(""); + this->Repositories.emplace_back(); this->RootInfo = &(this->Repositories.back()); // Run "svn status" to get the list of external repositories diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index aa37ff9..3eac903 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -135,7 +135,7 @@ cmCTestScriptHandler::~cmCTestScriptHandler() void cmCTestScriptHandler::AddConfigurationScript(const char* script, bool pscope) { - this->ConfigurationScripts.push_back(script); + this->ConfigurationScripts.emplace_back(script); this->ScriptProcessScope.push_back(pscope); } @@ -450,7 +450,7 @@ int cmCTestScriptHandler::ExtractVariables() updateVar, " specified without specifying CTEST_CVS_COMMAND."); return 12; } - this->ExtraUpdates.push_back(updateVal); + this->ExtraUpdates.emplace_back(updateVal); } } diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 3042480..8ba3774 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -861,7 +861,7 @@ int cmCTestSubmitHandler::ProcessHandler() // Submit Done.xml last if (this->SubmitPart[cmCTest::PartDone]) { - files.push_back("Done.xml"); + files.emplace_back("Done.xml"); } if (ofs) { diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index acbe465..f86a4cd 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -1524,7 +1524,7 @@ void cmCTestTestHandler::AddConfigurations( } tempPath = filepath + filename; attempted.push_back(tempPath); - attemptedConfigs.push_back(""); + attemptedConfigs.emplace_back(); if (!ctest->GetConfigType().empty()) { tempPath = filepath; @@ -1547,32 +1547,32 @@ void cmCTestTestHandler::AddConfigurations( tempPath += "Release/"; tempPath += filename; attempted.push_back(tempPath); - attemptedConfigs.push_back("Release"); + attemptedConfigs.emplace_back("Release"); tempPath = filepath; tempPath += "Debug/"; tempPath += filename; attempted.push_back(tempPath); - attemptedConfigs.push_back("Debug"); + attemptedConfigs.emplace_back("Debug"); tempPath = filepath; tempPath += "MinSizeRel/"; tempPath += filename; attempted.push_back(tempPath); - attemptedConfigs.push_back("MinSizeRel"); + attemptedConfigs.emplace_back("MinSizeRel"); tempPath = filepath; tempPath += "RelWithDebInfo/"; tempPath += filename; attempted.push_back(tempPath); - attemptedConfigs.push_back("RelWithDebInfo"); + attemptedConfigs.emplace_back("RelWithDebInfo"); tempPath = filepath; tempPath += "Deployment/"; tempPath += filename; attempted.push_back(tempPath); - attemptedConfigs.push_back("Deployment"); + attemptedConfigs.emplace_back("Deployment"); tempPath = filepath; tempPath += "Development/"; tempPath += filename; attempted.push_back(tempPath); - attemptedConfigs.push_back("Deployment"); + attemptedConfigs.emplace_back("Deployment"); } } diff --git a/Source/CTest/cmParseDelphiCoverage.cxx b/Source/CTest/cmParseDelphiCoverage.cxx index cc81979..d99de06 100644 --- a/Source/CTest/cmParseDelphiCoverage.cxx +++ b/Source/CTest/cmParseDelphiCoverage.cxx @@ -44,7 +44,7 @@ public: // Check that the begin is the first non-space string on the line if ((beginPos == line.find_first_not_of(' ')) && beginPos != std::string::npos) { - beginSet.push_back("begin"); + beginSet.emplace_back("begin"); coverageVector.push_back(-1); continue; } diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx index 6dc692e..856723a 100644 --- a/Source/CursesDialog/ccmake.cxx +++ b/Source/CursesDialog/ccmake.cxx @@ -109,7 +109,7 @@ int main(int argc, char const* const* argv) if (strcmp(argv[j], "-debug") == 0) { debug = true; } else { - args.push_back(argv[j]); + args.emplace_back(argv[j]); } } diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index a75d913..55ef375 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -37,10 +37,10 @@ cmCursesMainForm::cmCursesMainForm(std::vector const& args, this->AdvancedMode = false; this->NumberOfVisibleEntries = 0; this->OkToGenerate = false; - this->HelpMessage.push_back( + this->HelpMessage.emplace_back( "Welcome to ccmake, curses based user interface for CMake."); - this->HelpMessage.push_back(""); - this->HelpMessage.push_back(s_ConstHelpMessage); + this->HelpMessage.emplace_back(); + this->HelpMessage.emplace_back(s_ConstHelpMessage); this->CMakeInstance = new cmake(cmake::RoleProject, cmState::Project); this->CMakeInstance->SetCMakeEditCommand( cmSystemTools::GetCMakeCursesCommand()); @@ -652,7 +652,7 @@ int cmCursesMainForm::Generate() void cmCursesMainForm::AddError(const char* message, const char* /*unused*/) { - this->Errors.push_back(message); + this->Errors.emplace_back(message); } void cmCursesMainForm::RemoveEntry(const char* value) diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index 264c63c..8ed43f9 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -181,7 +181,7 @@ void CCONV cmAddExecutable(void* arg, const char* exename, int numSrcs, std::vector srcs2; int i; for (i = 0; i < numSrcs; ++i) { - srcs2.push_back(srcs[i]); + srcs2.emplace_back(srcs[i]); } cmTarget* tg = mf->AddExecutable(exename, srcs2); if (win32) { @@ -393,7 +393,7 @@ void CCONV cmAddLibrary(void* arg, const char* libname, int shared, std::vector srcs2; int i; for (i = 0; i < numSrcs; ++i) { - srcs2.push_back(srcs[i]); + srcs2.emplace_back(srcs[i]); } mf->AddLibrary( libname, @@ -419,8 +419,7 @@ int CCONV cmExecuteCommand(void* arg, const char* name, int numArgs, lff.Name = name; for (int i = 0; i < numArgs; ++i) { // Assume all arguments are quoted. - lff.Arguments.push_back( - cmListFileArgument(args[i], cmListFileArgument::Quoted, 0)); + lff.Arguments.emplace_back(args[i], cmListFileArgument::Quoted, 0); } cmExecutionStatus status; return mf->ExecuteCommand(lff, status); @@ -436,7 +435,7 @@ void CCONV cmExpandSourceListArguments(void* arg, int numArgs, std::vector result; int i; for (i = 0; i < numArgs; ++i) { - result.push_back(args[i]); + result.emplace_back(args[i]); } int resargc = static_cast(result.size()); char** resargv = nullptr; @@ -627,7 +626,7 @@ void CCONV cmSourceFileAddDepend(void* arg, const char* depend) if (cmSourceFile* rsf = sf->RealSourceFile) { rsf->AddDepend(depend); } else { - sf->Depends.push_back(depend); + sf->Depends.emplace_back(depend); } } @@ -647,10 +646,10 @@ void CCONV cmSourceFileSetName(void* arg, const char* name, const char* dir, std::vector headerExts; int i; for (i = 0; i < numSourceExtensions; ++i) { - sourceExts.push_back(sourceExtensions[i]); + sourceExts.emplace_back(sourceExtensions[i]); } for (i = 0; i < numHeaderExtensions; ++i) { - headerExts.push_back(headerExtensions[i]); + headerExts.emplace_back(headerExtensions[i]); } // Save the original name given. diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 1c0d9f6..aa24ace 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -1176,12 +1176,12 @@ int cmCTest::RunTest(std::vector argv, std::string* output, if (strcmp(i, "--build-generator") == 0 && timeout != cmCTest::MaxDuration() && timeout > cmDuration::zero()) { - args.push_back("--test-timeout"); + args.emplace_back("--test-timeout"); std::ostringstream msg; msg << cmDurationTo(timeout); args.push_back(msg.str()); } - args.push_back(i); + args.emplace_back(i); } } if (log) { @@ -2690,7 +2690,7 @@ void cmCTest::SetSpecificTrack(const char* track) void cmCTest::AddSubmitFile(Part part, const char* name) { - this->Parts[part].SubmitFiles.push_back(name); + this->Parts[part].SubmitFiles.emplace_back(name); } void cmCTest::AddCTestConfigurationOverwrite(const std::string& overStr) diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 4274cb4..87bc150 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -884,12 +884,12 @@ void cmComputeLinkInformation::AddLinkExtension(const char* e, LinkType type) { if (e && *e) { if (type == LinkStatic) { - this->StaticLinkExtensions.push_back(e); + this->StaticLinkExtensions.emplace_back(e); } if (type == LinkShared) { - this->SharedLinkExtensions.push_back(e); + this->SharedLinkExtensions.emplace_back(e); } - this->LinkExtensions.push_back(e); + this->LinkExtensions.emplace_back(e); } } diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index a483fd1..c4e83df 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -1005,12 +1005,12 @@ void cmCoreTryCompile::FindOutputFile(const std::string& targetName, tmp += config; searchDirs.push_back(std::move(tmp)); } - searchDirs.push_back("/Debug"); + searchDirs.emplace_back("/Debug"); #if defined(__APPLE__) std::string app = "/Debug/" + targetName + ".app"; searchDirs.push_back(std::move(app)); #endif - searchDirs.push_back("/Development"); + searchDirs.emplace_back("/Development"); for (std::string const& sdir : searchDirs) { std::string command = this->BinaryDirectory; diff --git a/Source/cmDependsJavaParserHelper.cxx b/Source/cmDependsJavaParserHelper.cxx index 02db119..792db48 100644 --- a/Source/cmDependsJavaParserHelper.cxx +++ b/Source/cmDependsJavaParserHelper.cxx @@ -68,7 +68,7 @@ void cmDependsJavaParserHelper::AddClassFound(const char* sclass) return; } } - this->ClassesFound.push_back(sclass); + this->ClassesFound.emplace_back(sclass); } void cmDependsJavaParserHelper::AddPackagesImport(const char* sclass) @@ -78,7 +78,7 @@ void cmDependsJavaParserHelper::AddPackagesImport(const char* sclass) return; } } - this->PackagesImport.push_back(sclass); + this->PackagesImport.emplace_back(sclass); } void cmDependsJavaParserHelper::SafePrintMissing(const char* str, int line, diff --git a/Source/cmExecuteProcessCommand.cxx b/Source/cmExecuteProcessCommand.cxx index 679a648..8de012a 100644 --- a/Source/cmExecuteProcessCommand.cxx +++ b/Source/cmExecuteProcessCommand.cxx @@ -54,7 +54,7 @@ bool cmExecuteProcessCommand::InitialPass(std::vector const& args, if (args[i] == "COMMAND") { doing_command = true; command_index = cmds.size(); - cmds.push_back(std::vector()); + cmds.emplace_back(); } else if (args[i] == "OUTPUT_VARIABLE") { doing_command = false; if (++i < args.size()) { @@ -327,15 +327,15 @@ bool cmExecuteProcessCommand::InitialPass(std::vector const& args, cmsysProcess_GetExitValueByIndex(cp, static_cast(i)); char buf[16]; sprintf(buf, "%d", exitCode); - res.push_back(buf); + res.emplace_back(buf); } break; case kwsysProcess_StateByIndex_Exception: - res.push_back(cmsysProcess_GetExceptionStringByIndex( + res.emplace_back(cmsysProcess_GetExceptionStringByIndex( cp, static_cast(i))); break; case kwsysProcess_StateByIndex_Error: default: - res.push_back("Error getting the child return code"); + res.emplace_back("Error getting the child return code"); break; } } diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx index 009f0e3..39051b9 100644 --- a/Source/cmFindCommon.cxx +++ b/Source/cmFindCommon.cxx @@ -178,13 +178,13 @@ void cmFindCommon::RerootPaths(std::vector& paths) cmSystemTools::ExpandListArgument(rootPath, roots); } if (sysrootCompile) { - roots.push_back(sysrootCompile); + roots.emplace_back(sysrootCompile); } if (sysrootLink) { - roots.push_back(sysrootLink); + roots.emplace_back(sysrootLink); } if (sysroot) { - roots.push_back(sysroot); + roots.emplace_back(sysroot); } for (std::string& r : roots) { cmSystemTools::ConvertToUnixSlashes(r); diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 8dc7ca2..26f8f87 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -1848,7 +1848,7 @@ private: } for (std::string const& n : this->Names) { if (cmsysString_strncasecmp(fname, n.c_str(), n.length()) == 0) { - matches.push_back(fname); + matches.emplace_back(fname); } } } @@ -1907,7 +1907,7 @@ private: for (std::string name : this->Names) { name += this->Extension; if (cmsysString_strcasecmp(fname, name.c_str()) == 0) { - matches.push_back(fname); + matches.emplace_back(fname); } } } @@ -2070,16 +2070,16 @@ bool cmFindPackageCommand::SearchPrefix(std::string const& prefix_in) common.push_back("lib/" + this->LibraryArchitecture); } if (this->UseLib32Paths) { - common.push_back("lib32"); + common.emplace_back("lib32"); } if (this->UseLib64Paths) { - common.push_back("lib64"); + common.emplace_back("lib64"); } if (this->UseLibx32Paths) { - common.push_back("libx32"); + common.emplace_back("libx32"); } - common.push_back("lib"); - common.push_back("share"); + common.emplace_back("lib"); + common.emplace_back("share"); // PREFIX/(lib/ARCH|lib*|share)/cmake/(Foo|foo|FOO).*/ { diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx index 3047167..e359def 100644 --- a/Source/cmForEachCommand.cxx +++ b/Source/cmForEachCommand.cxx @@ -164,7 +164,7 @@ bool cmForEachCommand::InitialPass(std::vector const& args, break; } sprintf(buffer, "%d", cc); - range.push_back(buffer); + range.emplace_back(buffer); if (cc == stop) { break; } diff --git a/Source/cmGeneratorExpressionLexer.cxx b/Source/cmGeneratorExpressionLexer.cxx index 242915d..dd1e243 100644 --- a/Source/cmGeneratorExpressionLexer.cxx +++ b/Source/cmGeneratorExpressionLexer.cxx @@ -20,8 +20,8 @@ std::vector cmGeneratorExpressionLexer::Tokenize( std::vector result; if (input.find('$') == std::string::npos) { - result.push_back(cmGeneratorExpressionToken( - cmGeneratorExpressionToken::Text, input.c_str(), input.size())); + result.emplace_back(cmGeneratorExpressionToken::Text, input.c_str(), + input.size()); return result; } diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 6515dfa..e06d1f2 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -319,7 +319,7 @@ std::string cmGeneratorTarget::GetOutputName( props.push_back(configUpper + "_OUTPUT_NAME"); } // OUTPUT_NAME - props.push_back("OUTPUT_NAME"); + props.emplace_back("OUTPUT_NAME"); std::string outName; for (std::string const& p : props) { @@ -988,7 +988,7 @@ std::vector> cmGeneratorTarget::GetSourceFilePaths( item.back() == '>') { continue; } - files.push_back(item); + files.emplace_back(item); } } return files; @@ -3260,7 +3260,7 @@ void processLinkDirectories( // in case projects set the LINK_DIRECTORIES property directly. cmSystemTools::ConvertToUnixSlashes(entryDirectory); if (uniqueDirectories.insert(entryDirectory).second) { - directories.push_back(entryDirectory); + directories.emplace_back(entryDirectory); if (debugDirectories) { usedDirectories += " * " + entryDirectory + "\n"; } @@ -3838,7 +3838,7 @@ std::string cmGeneratorTarget::GetPDBName(const std::string& config) const } // PDB_NAME - props.push_back("PDB_NAME"); + props.emplace_back("PDB_NAME"); for (std::string const& p : props) { if (const char* outName = this->GetProperty(p)) { diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 85c2345..ccb3aa4 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1761,7 +1761,7 @@ void cmGlobalGenerator::GenerateBuildCommand( bool /*unused*/, int /*unused*/, bool /*unused*/, std::vector const& /*unused*/) { - makeCommand.push_back( + makeCommand.emplace_back( "cmGlobalGenerator::GenerateBuildCommand not implemented"); } @@ -2313,12 +2313,12 @@ void cmGlobalGenerator::AddGlobalTarget_Package( singleLine.push_back("./CPackConfig.cmake"); gti.CommandLines.push_back(std::move(singleLine)); if (this->GetPreinstallTargetName()) { - gti.Depends.push_back(this->GetPreinstallTargetName()); + gti.Depends.emplace_back(this->GetPreinstallTargetName()); } else { const char* noPackageAll = mf->GetDefinition("CMAKE_SKIP_PACKAGE_ALL_DEPENDENCY"); if (!noPackageAll || cmSystemTools::IsOff(noPackageAll)) { - gti.Depends.push_back(this->GetAllTargetName()); + gti.Depends.emplace_back(this->GetAllTargetName()); } } targets.push_back(std::move(gti)); @@ -2483,12 +2483,12 @@ void cmGlobalGenerator::AddGlobalTarget_Install( gti.UsesTerminal = true; cmCustomCommandLine singleLine; if (this->GetPreinstallTargetName()) { - gti.Depends.push_back(this->GetPreinstallTargetName()); + gti.Depends.emplace_back(this->GetPreinstallTargetName()); } else { const char* noall = mf->GetDefinition("CMAKE_SKIP_INSTALL_ALL_DEPENDENCY"); if (!noall || cmSystemTools::IsOff(noall)) { - gti.Depends.push_back(this->GetAllTargetName()); + gti.Depends.emplace_back(this->GetAllTargetName()); } } if (mf->GetDefinition("CMake_BINARY_DIR") && diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index e7b0981..23dbd76 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -550,7 +550,7 @@ bool cmGlobalNinjaGenerator::FindMakeProgram(cmMakefile* mf) this->NinjaCommand = ninjaCommand; std::vector command; command.push_back(this->NinjaCommand); - command.push_back("--version"); + command.emplace_back("--version"); std::string version; std::string error; if (!cmSystemTools::RunSingleCommand(command, &version, &error, nullptr, @@ -681,12 +681,12 @@ void cmGlobalNinjaGenerator::GenerateBuildCommand( makeCommand.push_back(this->SelectMakeProgram(makeProgram)); if (verbose) { - makeCommand.push_back("-v"); + makeCommand.emplace_back("-v"); } if ((jobs != cmake::NO_BUILD_PARALLEL_LEVEL) && (jobs != cmake::DEFAULT_BUILD_PARALLEL_LEVEL)) { - makeCommand.push_back("-j"); + makeCommand.emplace_back("-j"); makeCommand.push_back(std::to_string(jobs)); } @@ -694,8 +694,8 @@ void cmGlobalNinjaGenerator::GenerateBuildCommand( makeOptions.end()); if (!targetName.empty()) { if (targetName == "clean") { - makeCommand.push_back("-t"); - makeCommand.push_back("clean"); + makeCommand.emplace_back("-t"); + makeCommand.emplace_back("clean"); } else { makeCommand.push_back(targetName); } diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index ceee500..52bb046 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -216,7 +216,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainMakefile2() // Just depend on the all target to drive the build. std::vector depends; std::vector no_commands; - depends.push_back("all"); + depends.emplace_back("all"); // Write the rule. lg->WriteMakeRule(makefileStream, @@ -513,7 +513,7 @@ void cmGlobalUnixMakefileGenerator3::GenerateBuildCommand( makeCommand.push_back(this->SelectMakeProgram(makeProgram)); if (jobs != cmake::NO_BUILD_PARALLEL_LEVEL) { - makeCommand.push_back("-j"); + makeCommand.emplace_back("-j"); if (jobs != cmake::DEFAULT_BUILD_PARALLEL_LEVEL) { makeCommand.push_back(std::to_string(jobs)); } @@ -542,7 +542,7 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules( bool regenerate = !this->GlobalSettingIsOn("CMAKE_SUPPRESS_REGENERATION"); if (regenerate) { - depends.push_back("cmake_check_build_system"); + depends.emplace_back("cmake_check_build_system"); } // write the target convenience rules @@ -577,7 +577,7 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules( commands.push_back(lg->GetRecursiveMakeCall(tmp.c_str(), name)); depends.clear(); if (regenerate) { - depends.push_back("cmake_check_build_system"); + depends.emplace_back("cmake_check_build_system"); } lg->WriteMakeRule(ruleFileStream, "Build rule for target.", name, depends, commands, true); @@ -631,7 +631,7 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2( bool regenerate = !this->GlobalSettingIsOn("CMAKE_SUPPRESS_REGENERATION"); if (regenerate) { - depends.push_back("cmake_check_build_system"); + depends.emplace_back("cmake_check_build_system"); } // for each target Generate the rule files for each target. @@ -740,7 +740,7 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2( } depends.clear(); if (regenerate) { - depends.push_back("cmake_check_build_system"); + depends.emplace_back("cmake_check_build_system"); } localName = lg->GetRelativeTargetDirectory(gtarget); localName += "/rule"; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 6618351..80ccd73 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -329,14 +329,14 @@ void cmGlobalXCodeGenerator::GenerateBuildCommand( int jobs, bool /*verbose*/, std::vector const& makeOptions) { // now build the test - makeCommand.push_back( + makeCommand.emplace_back( this->SelectMakeProgram(makeProgram, this->GetXcodeBuildCommand())); - makeCommand.push_back("-project"); + makeCommand.emplace_back("-project"); std::string projectArg = projectName; projectArg += ".xcode"; projectArg += "proj"; - makeCommand.push_back(projectArg); + makeCommand.emplace_back(projectArg); bool clean = false; std::string realTarget = targetName; @@ -345,23 +345,23 @@ void cmGlobalXCodeGenerator::GenerateBuildCommand( realTarget = "ALL_BUILD"; } if (clean) { - makeCommand.push_back("clean"); + makeCommand.emplace_back("clean"); } else { - makeCommand.push_back("build"); + makeCommand.emplace_back("build"); } - makeCommand.push_back("-target"); + makeCommand.emplace_back("-target"); if (!realTarget.empty()) { - makeCommand.push_back(realTarget); + makeCommand.emplace_back(realTarget); } else { - makeCommand.push_back("ALL_BUILD"); + makeCommand.emplace_back("ALL_BUILD"); } - makeCommand.push_back("-configuration"); - makeCommand.push_back(!config.empty() ? config : "Debug"); + makeCommand.emplace_back("-configuration"); + makeCommand.emplace_back(!config.empty() ? config : "Debug"); if (jobs != cmake::NO_BUILD_PARALLEL_LEVEL) { - makeCommand.push_back("-jobs"); + makeCommand.emplace_back("-jobs"); if (jobs != cmake::DEFAULT_BUILD_PARALLEL_LEVEL) { - makeCommand.push_back(std::to_string(jobs)); + makeCommand.emplace_back(std::to_string(jobs)); } } @@ -1051,7 +1051,7 @@ void cmGlobalXCodeGenerator::SetCurrentLocalGenerator(cmLocalGenerator* gen) this->CurrentConfigurationTypes.clear(); this->CurrentMakefile->GetConfigurations(this->CurrentConfigurationTypes); if (this->CurrentConfigurationTypes.empty()) { - this->CurrentConfigurationTypes.push_back(""); + this->CurrentConfigurationTypes.emplace_back(); } } diff --git a/Source/cmJsonObjects.cxx b/Source/cmJsonObjects.cxx index bb56714..135fd25 100644 --- a/Source/cmJsonObjects.cxx +++ b/Source/cmJsonObjects.cxx @@ -49,7 +49,7 @@ std::vector getConfigurations(const cmake* cm) makefiles[0]->GetConfigurations(configurations); if (configurations.empty()) { - configurations.push_back(""); + configurations.emplace_back(); } return configurations; } @@ -292,10 +292,10 @@ static Json::Value DumpSourceFilesList( lg->AppendIncludeDirectories(includes, evaluatedIncludes, *file); for (const auto& include : includes) { - fileData.IncludePathList.push_back( - std::make_pair(include, - target->IsSystemIncludeDirectory( - include, config, fileData.Language))); + fileData.IncludePathList.emplace_back( + include, + target->IsSystemIncludeDirectory(include, config, + fileData.Language)); } } @@ -580,8 +580,8 @@ static Json::Value DumpTarget(cmGeneratorTarget* target, std::vector includePathList; lg->GetIncludeDirectories(includePathList, target, lang, config, true); for (std::string const& i : includePathList) { - ld.IncludePathList.push_back( - std::make_pair(i, target->IsSystemIncludeDirectory(i, config, lang))); + ld.IncludePathList.emplace_back( + i, target->IsSystemIncludeDirectory(i, config, lang)); } } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 797add9..97e684b 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1684,19 +1684,19 @@ void cmLocalGenerator::AddCompilerRequirementFlag( static std::map> langStdMap; if (langStdMap.empty()) { // Maintain sorted order, most recent first. - langStdMap["CXX"].push_back("20"); - langStdMap["CXX"].push_back("17"); - langStdMap["CXX"].push_back("14"); - langStdMap["CXX"].push_back("11"); - langStdMap["CXX"].push_back("98"); - - langStdMap["C"].push_back("11"); - langStdMap["C"].push_back("99"); - langStdMap["C"].push_back("90"); - - langStdMap["CUDA"].push_back("14"); - langStdMap["CUDA"].push_back("11"); - langStdMap["CUDA"].push_back("98"); + langStdMap["CXX"].emplace_back("20"); + langStdMap["CXX"].emplace_back("17"); + langStdMap["CXX"].emplace_back("14"); + langStdMap["CXX"].emplace_back("11"); + langStdMap["CXX"].emplace_back("98"); + + langStdMap["C"].emplace_back("11"); + langStdMap["C"].emplace_back("99"); + langStdMap["C"].emplace_back("90"); + + langStdMap["CUDA"].emplace_back("14"); + langStdMap["CUDA"].emplace_back("11"); + langStdMap["CUDA"].emplace_back("98"); } std::string standard(standardProp); diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 707a1b5..9f42a92 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -318,7 +318,7 @@ void cmLocalUnixMakefileGenerator3::WriteObjectConvenienceRule( // Add a rule to drive the rule below. std::vector depends; - depends.push_back(output); + depends.emplace_back(output); std::vector no_commands; this->WriteMakeRule(ruleFileStream, nullptr, outNoExt, depends, no_commands, true, true); @@ -685,7 +685,7 @@ void cmLocalUnixMakefileGenerator3::WriteSpecialTargetsTop( } // Add a fake suffix to keep HP happy. Must be max 32 chars for SGI make. std::vector depends; - depends.push_back(".hpux_make_needs_suffix_list"); + depends.emplace_back(".hpux_make_needs_suffix_list"); this->WriteMakeRule(makefileStream, nullptr, ".SUFFIXES", depends, no_commands, false); if (this->IsWatcomWMake()) { @@ -852,7 +852,7 @@ void cmLocalUnixMakefileGenerator3::AppendRuleDepend( const char* nodep = this->Makefile->GetDefinition("CMAKE_SKIP_RULE_DEPENDENCY"); if (!nodep || cmSystemTools::IsOff(nodep)) { - depends.push_back(ruleFileName); + depends.emplace_back(ruleFileName); } } @@ -1507,7 +1507,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules( // Just depend on the all target to drive the build. std::vector depends; std::vector no_commands; - depends.push_back("all"); + depends.emplace_back("all"); // Write the rule. this->WriteMakeRule(ruleFileStream, @@ -1571,7 +1571,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules( (targetName == "install/strip")) { // Provide a fast install target that does not depend on all // but has the same command. - depends.push_back("preinstall/fast"); + depends.emplace_back("preinstall/fast"); } else { // Just forward to the real target so at least it will work. depends.push_back(targetName); @@ -1593,7 +1593,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules( bool regenerate = !this->GlobalGenerator->GlobalSettingIsOn("CMAKE_SUPPRESS_REGENERATION"); if (regenerate) { - depends.push_back("cmake_check_build_system"); + depends.emplace_back("cmake_check_build_system"); } std::string progressDir = this->GetBinaryDirectory(); @@ -1643,7 +1643,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules( depends, commands, true); commands.clear(); depends.clear(); - depends.push_back("clean"); + depends.emplace_back("clean"); this->WriteMakeRule(ruleFileStream, "The main clean target", "clean/fast", depends, commands, true); @@ -1656,10 +1656,10 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules( this->Makefile->GetDefinition("CMAKE_SKIP_INSTALL_ALL_DEPENDENCY"); if (!noall || cmSystemTools::IsOff(noall)) { // Drive the build before installing. - depends.push_back("all"); + depends.emplace_back("all"); } else if (regenerate) { // At least make sure the build system is up to date. - depends.push_back("cmake_check_build_system"); + depends.emplace_back("cmake_check_build_system"); } commands.push_back( this->GetRecursiveMakeCall(mf2Dir.c_str(), recursiveTarget)); diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 23d93a3..411c0c3 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -94,7 +94,7 @@ bool cmMacroHelperCommand::InvokeInitialPass( char argvName[60]; for (unsigned int j = 0; j < expandedArgs.size(); ++j) { sprintf(argvName, "${ARGV%u}", j); - argVs.push_back(argvName); + argVs.emplace_back(argvName); } // Invoke all the functions that were collected in the block. cmListFileFunction newLFF; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 3ff576e..9e9b6af 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2099,7 +2099,7 @@ void cmMakefile::AddSourceGroup(const std::vector& name, if (i == -1) { // group does not exist nor belong to any existing group // add its first component - this->SourceGroups.push_back(cmSourceGroup(name[0], regex)); + this->SourceGroups.emplace_back(name[0], regex); sg = this->GetSourceGroup(currentName); i = 0; // last component found } diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index d1dcd81..1207646 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -816,7 +816,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile( lang_has_assembly && this->LocalGenerator->GetCreateAssemblySourceRules(); if (do_preprocess_rules || do_assembly_rules) { std::vector force_depends; - force_depends.push_back("cmake_force"); + force_depends.emplace_back("cmake_force"); std::string::size_type dot_pos = relativeObj.rfind('.'); std::string relativeObjBase = relativeObj.substr(0, dot_pos); dot_pos = obj.rfind('.'); diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index b62da66..8f6a23a 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -377,7 +377,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile) cmEraseIf(linkCmds, cmNinjaRemoveNoOpCommands()); linkCmds.insert(linkCmds.begin(), "$PRE_LINK"); - linkCmds.push_back("$POST_BUILD"); + linkCmds.emplace_back("$POST_BUILD"); std::string linkCmd = this->GetLocalGenerator()->BuildCommandLine(linkCmds); @@ -405,7 +405,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile) std::vector commandLines; commandLines.push_back(cmakeCommand + " -E cmake_symlink_executable $in $out"); - commandLines.push_back("$POST_BUILD"); + commandLines.emplace_back("$POST_BUILD"); this->GetGlobalGenerator()->AddRule( "CMAKE_SYMLINK_EXECUTABLE", @@ -423,7 +423,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile) std::vector commandLines; commandLines.push_back(cmakeCommand + " -E cmake_symlink_library $in $SONAME $out"); - commandLines.push_back("$POST_BUILD"); + commandLines.emplace_back("$POST_BUILD"); this->GetGlobalGenerator()->AddRule( "CMAKE_SYMLINK_LIBRARY", diff --git a/Source/cmParseArgumentsCommand.cxx b/Source/cmParseArgumentsCommand.cxx index a2bf841..796974c 100644 --- a/Source/cmParseArgumentsCommand.cxx +++ b/Source/cmParseArgumentsCommand.cxx @@ -151,7 +151,7 @@ bool cmParseArgumentsCommand::InitialPass(std::vector const& args, cmSystemTools::SetFatalErrorOccured(); return true; } - list.push_back(arg); + list.emplace_back(arg); } } diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx index 14e92c6..2fe9fe8 100644 --- a/Source/cmProjectCommand.cxx +++ b/Source/cmProjectCommand.cxx @@ -198,7 +198,7 @@ bool cmProjectCommand::InitialPass(std::vector const& args, return true; } if (haveLanguages && languages.empty()) { - languages.push_back("NONE"); + languages.emplace_back("NONE"); } cmPolicies::PolicyStatus cmp0048 = @@ -264,22 +264,22 @@ bool cmProjectCommand::InitialPass(std::vector const& args, } else if (cmp0048 != cmPolicies::OLD) { // Set project VERSION variables to empty std::vector vv; - vv.push_back("PROJECT_VERSION"); - vv.push_back("PROJECT_VERSION_MAJOR"); - vv.push_back("PROJECT_VERSION_MINOR"); - vv.push_back("PROJECT_VERSION_PATCH"); - vv.push_back("PROJECT_VERSION_TWEAK"); + vv.emplace_back("PROJECT_VERSION"); + vv.emplace_back("PROJECT_VERSION_MAJOR"); + vv.emplace_back("PROJECT_VERSION_MINOR"); + vv.emplace_back("PROJECT_VERSION_PATCH"); + vv.emplace_back("PROJECT_VERSION_TWEAK"); vv.push_back(projectName + "_VERSION"); vv.push_back(projectName + "_VERSION_MAJOR"); vv.push_back(projectName + "_VERSION_MINOR"); vv.push_back(projectName + "_VERSION_PATCH"); vv.push_back(projectName + "_VERSION_TWEAK"); if (this->Makefile->IsRootMakefile()) { - vv.push_back("CMAKE_PROJECT_VERSION"); - vv.push_back("CMAKE_PROJECT_VERSION_MAJOR"); - vv.push_back("CMAKE_PROJECT_VERSION_MINOR"); - vv.push_back("CMAKE_PROJECT_VERSION_PATCH"); - vv.push_back("CMAKE_PROJECT_VERSION_TWEAK"); + vv.emplace_back("CMAKE_PROJECT_VERSION"); + vv.emplace_back("CMAKE_PROJECT_VERSION_MAJOR"); + vv.emplace_back("CMAKE_PROJECT_VERSION_MINOR"); + vv.emplace_back("CMAKE_PROJECT_VERSION_PATCH"); + vv.emplace_back("CMAKE_PROJECT_VERSION_TWEAK"); } std::string vw; for (std::string const& i : vv) { @@ -315,8 +315,8 @@ bool cmProjectCommand::InitialPass(std::vector const& args, if (languages.empty()) { // if no language is specified do c and c++ - languages.push_back("C"); - languages.push_back("CXX"); + languages.emplace_back("C"); + languages.emplace_back("CXX"); } this->Makefile->EnableLanguage(languages, false); std::string extraInclude = "CMAKE_PROJECT_" + projectName + "_INCLUDE"; diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index 9fa8a89..1f61632 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -1482,7 +1482,7 @@ std::pair GetQtExecutable( if (cmSystemTools::FileExists(result, true)) { std::vector command; command.push_back(result); - command.push_back("-h"); + command.emplace_back("-h"); std::string stdOut; std::string stdErr; int retVal = 0; @@ -1546,9 +1546,9 @@ bool cmQtAutoGenInitializer::GetRccExecutable() if (this->QtVersion.Major == 5 || this->QtVersion.Major == 6) { if (stdOut.find("--list") != std::string::npos) { - this->Rcc.ListOptions.push_back("--list"); + this->Rcc.ListOptions.emplace_back("--list"); } else { - this->Rcc.ListOptions.push_back("-list"); + this->Rcc.ListOptions.emplace_back("-list"); } } return true; diff --git a/Source/cmQtAutoGeneratorMocUic.cxx b/Source/cmQtAutoGeneratorMocUic.cxx index 9658e97..56ce5b6 100644 --- a/Source/cmQtAutoGeneratorMocUic.cxx +++ b/Source/cmQtAutoGeneratorMocUic.cxx @@ -844,10 +844,10 @@ void cmQtAutoGeneratorMocUic::JobMocT::GenerateMoc(WorkerT& wrk) wrk.Moc().AllOptions.end()); // Add predefs include if (!wrk.Moc().PredefsFileAbs.empty()) { - cmd.push_back("--include"); + cmd.emplace_back("--include"); cmd.push_back(wrk.Moc().PredefsFileAbs); } - cmd.push_back("-o"); + cmd.emplace_back("-o"); cmd.push_back(BuildFile); cmd.push_back(SourceFile); @@ -963,7 +963,7 @@ void cmQtAutoGeneratorMocUic::JobUicT::GenerateUic(WorkerT& wrk) } cmd.insert(cmd.end(), allOpts.begin(), allOpts.end()); } - cmd.push_back("-o"); + cmd.emplace_back("-o"); cmd.push_back(BuildFile); cmd.push_back(SourceFile); @@ -1288,7 +1288,7 @@ bool cmQtAutoGeneratorMocUic::Init(cmMakefile* makefile) std::string& error) { if (!key.empty()) { if (!exp.empty()) { - Moc_.DependFilters.push_back(KeyExpT()); + Moc_.DependFilters.emplace_back(); KeyExpT& filter(Moc_.DependFilters.back()); if (filter.Exp.compile(exp)) { filter.Key = key; @@ -1506,7 +1506,7 @@ bool cmQtAutoGeneratorMocUic::Init(cmMakefile* makefile) } // Append framework includes for (std::string const& path : frameworkPaths) { - Moc_.Includes.push_back("-F"); + Moc_.Includes.emplace_back("-F"); Moc_.Includes.push_back(path); } } diff --git a/Source/cmQtAutoGeneratorRcc.cxx b/Source/cmQtAutoGeneratorRcc.cxx index 29dc7a0..f7af99e 100644 --- a/Source/cmQtAutoGeneratorRcc.cxx +++ b/Source/cmQtAutoGeneratorRcc.cxx @@ -603,7 +603,7 @@ bool cmQtAutoGeneratorRcc::GenerateRcc() std::vector cmd; cmd.push_back(RccExecutable_); cmd.insert(cmd.end(), Options_.begin(), Options_.end()); - cmd.push_back("-o"); + cmd.emplace_back("-o"); cmd.push_back(RccFileOutput_); cmd.push_back(QrcFile_); // We're done here if the process fails to start diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx index f0f92aa..2866a39 100644 --- a/Source/cmRST.cxx +++ b/Source/cmRST.cxx @@ -178,7 +178,7 @@ void cmRST::ProcessLine(std::string const& line) // Record the literal lines to output after whole block. // Ignore the language spec and record the opening line as blank. this->Directive = DirectiveCodeBlock; - this->MarkupLines.push_back(""); + this->MarkupLines.emplace_back(); } else if (this->ReplaceDirective.find(line)) { // Record the replace directive content. this->Directive = DirectiveReplace; @@ -221,7 +221,7 @@ void cmRST::ProcessLine(std::string const& line) // Record the literal lines to output after whole block. this->Markup = MarkupNormal; this->Directive = DirectiveLiteralBlock; - this->MarkupLines.push_back(""); + this->MarkupLines.emplace_back(); this->OutputLine("", false); } // Print non-markup lines. diff --git a/Source/cmSetSourceFilesPropertiesCommand.cxx b/Source/cmSetSourceFilesPropertiesCommand.cxx index 8445b02..9388e7c 100644 --- a/Source/cmSetSourceFilesPropertiesCommand.cxx +++ b/Source/cmSetSourceFilesPropertiesCommand.cxx @@ -53,17 +53,17 @@ bool cmSetSourceFilesPropertiesCommand::RunCommand( for (j = propbeg; j != propend; ++j) { // old style allows for specifier before PROPERTIES keyword if (*j == "ABSTRACT") { - propertyPairs.push_back("ABSTRACT"); - propertyPairs.push_back("1"); + propertyPairs.emplace_back("ABSTRACT"); + propertyPairs.emplace_back("1"); } else if (*j == "WRAP_EXCLUDE") { - propertyPairs.push_back("WRAP_EXCLUDE"); - propertyPairs.push_back("1"); + propertyPairs.emplace_back("WRAP_EXCLUDE"); + propertyPairs.emplace_back("1"); } else if (*j == "GENERATED") { generated = true; - propertyPairs.push_back("GENERATED"); - propertyPairs.push_back("1"); + propertyPairs.emplace_back("GENERATED"); + propertyPairs.emplace_back("1"); } else if (*j == "COMPILE_FLAGS") { - propertyPairs.push_back("COMPILE_FLAGS"); + propertyPairs.emplace_back("COMPILE_FLAGS"); ++j; if (j == propend) { errors = "called with incorrect number of arguments " @@ -72,7 +72,7 @@ bool cmSetSourceFilesPropertiesCommand::RunCommand( } propertyPairs.push_back(*j); } else if (*j == "OBJECT_DEPENDS") { - propertyPairs.push_back("OBJECT_DEPENDS"); + propertyPairs.emplace_back("OBJECT_DEPENDS"); ++j; if (j == propend) { errors = "called with incorrect number of arguments " diff --git a/Source/cmSiteNameCommand.cxx b/Source/cmSiteNameCommand.cxx index 7f33b7a..01758ee 100644 --- a/Source/cmSiteNameCommand.cxx +++ b/Source/cmSiteNameCommand.cxx @@ -19,12 +19,12 @@ bool cmSiteNameCommand::InitialPass(std::vector const& args, return false; } std::vector paths; - paths.push_back("/usr/bsd"); - paths.push_back("/usr/sbin"); - paths.push_back("/usr/bin"); - paths.push_back("/bin"); - paths.push_back("/sbin"); - paths.push_back("/usr/local/bin"); + paths.emplace_back("/usr/bsd"); + paths.emplace_back("/usr/sbin"); + paths.emplace_back("/usr/bin"); + paths.emplace_back("/bin"); + paths.emplace_back("/sbin"); + paths.emplace_back("/usr/local/bin"); const char* cacheValue = this->Makefile->GetDefinition(args[0]); if (cacheValue) { diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx index 08f4d1a..34ded38 100644 --- a/Source/cmSourceGroupCommand.cxx +++ b/Source/cmSourceGroupCommand.cxx @@ -105,7 +105,7 @@ bool addFilesToItsSourceGroups(const std::string& root, tokenizedPath.pop_back(); if (tokenizedPath.empty()) { - tokenizedPath.push_back(""); + tokenizedPath.emplace_back(); } sg = makefile.GetOrCreateSourceGroup(tokenizedPath); diff --git a/Source/cmStringReplaceHelper.cxx b/Source/cmStringReplaceHelper.cxx index 69b7ced..f50cf58 100644 --- a/Source/cmStringReplaceHelper.cxx +++ b/Source/cmStringReplaceHelper.cxx @@ -85,10 +85,12 @@ void cmStringReplaceHelper::ParseReplaceExpression() auto r = this->ReplaceExpression.find('\\', l); if (r == std::string::npos) { r = this->ReplaceExpression.length(); - this->Replacements.push_back(this->ReplaceExpression.substr(l, r - l)); + this->Replacements.emplace_back( + this->ReplaceExpression.substr(l, r - l)); } else { if (r - l > 0) { - this->Replacements.push_back(this->ReplaceExpression.substr(l, r - l)); + this->Replacements.emplace_back( + this->ReplaceExpression.substr(l, r - l)); } if (r == (this->ReplaceExpression.length() - 1)) { this->ValidReplaceExpression = false; @@ -97,11 +99,11 @@ void cmStringReplaceHelper::ParseReplaceExpression() } if ((this->ReplaceExpression[r + 1] >= '0') && (this->ReplaceExpression[r + 1] <= '9')) { - this->Replacements.push_back(this->ReplaceExpression[r + 1] - '0'); + this->Replacements.emplace_back(this->ReplaceExpression[r + 1] - '0'); } else if (this->ReplaceExpression[r + 1] == 'n') { - this->Replacements.push_back("\n"); + this->Replacements.emplace_back("\n"); } else if (this->ReplaceExpression[r + 1] == '\\') { - this->Replacements.push_back("\\"); + this->Replacements.emplace_back("\\"); } else { this->ValidReplaceExpression = false; std::ostringstream error; diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index be65853..aa85c4a 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -534,7 +534,7 @@ public: void Store(std::vector& args) const { for (char** arg = this->ArgV; arg && *arg; ++arg) { - args.push_back(*arg); + args.emplace_back(*arg); } } }; @@ -1586,7 +1586,7 @@ std::vector cmSystemTools::GetEnvironmentVariables() std::vector env; int cc; for (cc = 0; environ[cc]; ++cc) { - env.push_back(environ[cc]); + env.emplace_back(environ[cc]); } return env; } @@ -3063,7 +3063,7 @@ std::vector cmSystemTools::tokenize(const std::string& str, } while (tokend != std::string::npos); if (tokens.empty()) { - tokens.push_back(""); + tokens.emplace_back(); } return tokens; } diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index a94cf6a..7c3827c 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -731,7 +731,7 @@ bool cmTarget::PushTLLCommandTrace(TLLSignature signature, } } if (this->TLLCommands.empty() || this->TLLCommands.back().second != lfc) { - this->TLLCommands.push_back(std::make_pair(signature, lfc)); + this->TLLCommands.emplace_back(signature, lfc); } return ret; } @@ -975,7 +975,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) this->Internal->IncludeDirectoriesEntries.clear(); this->Internal->IncludeDirectoriesBacktraces.clear(); if (value) { - this->Internal->IncludeDirectoriesEntries.push_back(value); + this->Internal->IncludeDirectoriesEntries.emplace_back(value); cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); this->Internal->IncludeDirectoriesBacktraces.push_back(lfbt); } @@ -983,7 +983,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) this->Internal->CompileOptionsEntries.clear(); this->Internal->CompileOptionsBacktraces.clear(); if (value) { - this->Internal->CompileOptionsEntries.push_back(value); + this->Internal->CompileOptionsEntries.emplace_back(value); cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); this->Internal->CompileOptionsBacktraces.push_back(lfbt); } @@ -991,7 +991,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) this->Internal->CompileFeaturesEntries.clear(); this->Internal->CompileFeaturesBacktraces.clear(); if (value) { - this->Internal->CompileFeaturesEntries.push_back(value); + this->Internal->CompileFeaturesEntries.emplace_back(value); cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); this->Internal->CompileFeaturesBacktraces.push_back(lfbt); } @@ -999,7 +999,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) this->Internal->CompileDefinitionsEntries.clear(); this->Internal->CompileDefinitionsBacktraces.clear(); if (value) { - this->Internal->CompileDefinitionsEntries.push_back(value); + this->Internal->CompileDefinitionsEntries.emplace_back(value); cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); this->Internal->CompileDefinitionsBacktraces.push_back(lfbt); } @@ -1007,7 +1007,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) this->Internal->LinkOptionsEntries.clear(); this->Internal->LinkOptionsBacktraces.clear(); if (value) { - this->Internal->LinkOptionsEntries.push_back(value); + this->Internal->LinkOptionsEntries.emplace_back(value); cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); this->Internal->LinkOptionsBacktraces.push_back(lfbt); } @@ -1015,7 +1015,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) this->Internal->LinkDirectoriesEntries.clear(); this->Internal->LinkDirectoriesBacktraces.clear(); if (value) { - this->Internal->LinkDirectoriesEntries.push_back(value); + this->Internal->LinkDirectoriesEntries.emplace_back(value); cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); this->Internal->LinkDirectoriesBacktraces.push_back(lfbt); } @@ -1024,7 +1024,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) this->Internal->LinkImplementationPropertyBacktraces.clear(); if (value) { cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - this->Internal->LinkImplementationPropertyEntries.push_back(value); + this->Internal->LinkImplementationPropertyEntries.emplace_back(value); this->Internal->LinkImplementationPropertyBacktraces.push_back(lfbt); } } else if (prop == propSOURCES) { @@ -1032,7 +1032,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) this->Internal->SourceBacktraces.clear(); if (value) { cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - this->Internal->SourceEntries.push_back(value); + this->Internal->SourceEntries.emplace_back(value); this->Internal->SourceBacktraces.push_back(lfbt); } } else if (prop == propIMPORTED_GLOBAL) { @@ -1102,49 +1102,49 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value, } if (prop == "INCLUDE_DIRECTORIES") { if (value && *value) { - this->Internal->IncludeDirectoriesEntries.push_back(value); + this->Internal->IncludeDirectoriesEntries.emplace_back(value); cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); this->Internal->IncludeDirectoriesBacktraces.push_back(lfbt); } } else if (prop == "COMPILE_OPTIONS") { if (value && *value) { - this->Internal->CompileOptionsEntries.push_back(value); + this->Internal->CompileOptionsEntries.emplace_back(value); cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); this->Internal->CompileOptionsBacktraces.push_back(lfbt); } } else if (prop == "COMPILE_FEATURES") { if (value && *value) { - this->Internal->CompileFeaturesEntries.push_back(value); + this->Internal->CompileFeaturesEntries.emplace_back(value); cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); this->Internal->CompileFeaturesBacktraces.push_back(lfbt); } } else if (prop == "COMPILE_DEFINITIONS") { if (value && *value) { - this->Internal->CompileDefinitionsEntries.push_back(value); + this->Internal->CompileDefinitionsEntries.emplace_back(value); cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); this->Internal->CompileDefinitionsBacktraces.push_back(lfbt); } } else if (prop == "LINK_OPTIONS") { if (value && *value) { - this->Internal->LinkOptionsEntries.push_back(value); + this->Internal->LinkOptionsEntries.emplace_back(value); cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); this->Internal->LinkOptionsBacktraces.push_back(lfbt); } } else if (prop == "LINK_DIRECTORIES") { if (value && *value) { - this->Internal->LinkDirectoriesEntries.push_back(value); + this->Internal->LinkDirectoriesEntries.emplace_back(value); cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); this->Internal->LinkDirectoriesBacktraces.push_back(lfbt); } } else if (prop == "LINK_LIBRARIES") { if (value && *value) { cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - this->Internal->LinkImplementationPropertyEntries.push_back(value); + this->Internal->LinkImplementationPropertyEntries.emplace_back(value); this->Internal->LinkImplementationPropertyBacktraces.push_back(lfbt); } } else if (prop == "SOURCES") { cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - this->Internal->SourceEntries.push_back(value); + this->Internal->SourceEntries.emplace_back(value); this->Internal->SourceBacktraces.push_back(lfbt); } else if (cmHasLiteralPrefix(prop, "IMPORTED_LIBNAME")) { this->Makefile->IssueMessage(MessageType::FATAL_ERROR, diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx index e224a27..10a6d9a 100644 --- a/Source/cmTryRunCommand.cxx +++ b/Source/cmTryRunCommand.cxx @@ -101,11 +101,11 @@ bool cmTryRunCommand::InitialPass(std::vector const& argv, bool captureRunOutput = false; if (!this->OutputVariable.empty()) { captureRunOutput = true; - tryCompile.push_back("OUTPUT_VARIABLE"); + tryCompile.emplace_back("OUTPUT_VARIABLE"); tryCompile.push_back(this->OutputVariable); } if (!this->CompileOutputVariable.empty()) { - tryCompile.push_back("OUTPUT_VARIABLE"); + tryCompile.emplace_back("OUTPUT_VARIABLE"); tryCompile.push_back(this->CompileOutputVariable); } if (!this->RunOutputVariable.empty()) { diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 9fcfbde..06edeba 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -179,31 +179,31 @@ cmake::cmake(Role role, cmState::Mode mode) // these are used to find files when the extension // is not given // The "c" extension MUST precede the "C" extension. - this->SourceFileExtensions.push_back("c"); - this->SourceFileExtensions.push_back("C"); - - this->SourceFileExtensions.push_back("c++"); - this->SourceFileExtensions.push_back("cc"); - this->SourceFileExtensions.push_back("cpp"); - this->SourceFileExtensions.push_back("cxx"); - this->SourceFileExtensions.push_back("cu"); - this->SourceFileExtensions.push_back("m"); - this->SourceFileExtensions.push_back("M"); - this->SourceFileExtensions.push_back("mm"); + this->SourceFileExtensions.emplace_back("c"); + this->SourceFileExtensions.emplace_back("C"); + + this->SourceFileExtensions.emplace_back("c++"); + this->SourceFileExtensions.emplace_back("cc"); + this->SourceFileExtensions.emplace_back("cpp"); + this->SourceFileExtensions.emplace_back("cxx"); + this->SourceFileExtensions.emplace_back("cu"); + this->SourceFileExtensions.emplace_back("m"); + this->SourceFileExtensions.emplace_back("M"); + this->SourceFileExtensions.emplace_back("mm"); std::copy(this->SourceFileExtensions.begin(), this->SourceFileExtensions.end(), std::inserter(this->SourceFileExtensionsSet, this->SourceFileExtensionsSet.end())); - this->HeaderFileExtensions.push_back("h"); - this->HeaderFileExtensions.push_back("hh"); - this->HeaderFileExtensions.push_back("h++"); - this->HeaderFileExtensions.push_back("hm"); - this->HeaderFileExtensions.push_back("hpp"); - this->HeaderFileExtensions.push_back("hxx"); - this->HeaderFileExtensions.push_back("in"); - this->HeaderFileExtensions.push_back("txx"); + this->HeaderFileExtensions.emplace_back("h"); + this->HeaderFileExtensions.emplace_back("hh"); + this->HeaderFileExtensions.emplace_back("h++"); + this->HeaderFileExtensions.emplace_back("hm"); + this->HeaderFileExtensions.emplace_back("hpp"); + this->HeaderFileExtensions.emplace_back("hxx"); + this->HeaderFileExtensions.emplace_back("in"); + this->HeaderFileExtensions.emplace_back("txx"); std::copy(this->HeaderFileExtensions.begin(), this->HeaderFileExtensions.end(), @@ -2485,7 +2485,7 @@ std::vector cmake::GetDebugConfigs() } // If no configurations were specified, use a default list. if (configs.empty()) { - configs.push_back("DEBUG"); + configs.emplace_back("DEBUG"); } return configs; } diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 84d1414..5a04eab 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -106,7 +106,7 @@ static int do_command(int ac, char const* const* av) { std::vector args; args.reserve(ac - 1); - args.push_back(av[0]); + args.emplace_back(av[0]); args.insert(args.end(), av + 2, av + ac); return cmcmd::ExecuteCMakeCommand(args); } @@ -288,14 +288,14 @@ int do_cmake(int ac, char const* const* av) return 1; } workingMode = cmake::SCRIPT_MODE; - args.push_back(av[i]); + args.emplace_back(av[i]); i++; - args.push_back(av[i]); + args.emplace_back(av[i]); } else if (cmHasLiteralPrefix(av[i], "--find-package")) { workingMode = cmake::FIND_PACKAGE_MODE; - args.push_back(av[i]); + args.emplace_back(av[i]); } else { - args.push_back(av[i]); + args.emplace_back(av[i]); } } if (sysinfo) { @@ -386,7 +386,7 @@ static int do_build(int ac, char const* const* av) Doing doing = DoingDir; for (int i = 2; i < ac; ++i) { if (doing == DoingNative) { - nativeOptions.push_back(av[i]); + nativeOptions.emplace_back(av[i]); } else if ((strcmp(av[i], "-j") == 0) || (strcmp(av[i], "--parallel") == 0)) { jobs = cmake::DEFAULT_BUILD_PARALLEL_LEVEL; diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index ee8df35..26f7509 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -201,7 +201,7 @@ static int HandleTidy(const std::string& runCmd, const std::string& sourceFile, std::vector tidy_cmd; cmSystemTools::ExpandListArgument(runCmd, tidy_cmd, true); tidy_cmd.push_back(sourceFile); - tidy_cmd.push_back("--"); + tidy_cmd.emplace_back("--"); tidy_cmd.insert(tidy_cmd.end(), orig_cmd.begin(), orig_cmd.end()); // Run the tidy command line. Capture its stdout and hide its stderr. @@ -228,9 +228,9 @@ static int HandleLWYU(const std::string& runCmd, // Construct the ldd -r -u (link what you use lwyu) command line // ldd -u -r lwuy target std::vector lwyu_cmd; - lwyu_cmd.push_back("ldd"); - lwyu_cmd.push_back("-u"); - lwyu_cmd.push_back("-r"); + lwyu_cmd.emplace_back("ldd"); + lwyu_cmd.emplace_back("-u"); + lwyu_cmd.emplace_back("-r"); lwyu_cmd.push_back(runCmd); // Run the ldd -u -r command line. @@ -1733,7 +1733,7 @@ bool cmVSLink::Parse(std::vector::const_iterator argBeg, } if (this->LinkGeneratesManifest) { - this->LinkCommand.push_back("/MANIFEST"); + this->LinkCommand.emplace_back("/MANIFEST"); this->LinkCommand.push_back("/MANIFESTFILE:" + this->LinkerManifestFile); } @@ -1881,8 +1881,8 @@ int cmVSLink::RunMT(std::string const& out, bool notify) { std::vector mtCommand; mtCommand.push_back(this->MtPath.empty() ? "mt" : this->MtPath); - mtCommand.push_back("/nologo"); - mtCommand.push_back("/manifest"); + mtCommand.emplace_back("/nologo"); + mtCommand.emplace_back("/manifest"); if (this->LinkGeneratesManifest) { mtCommand.push_back(this->LinkerManifestFile); } @@ -1892,7 +1892,7 @@ int cmVSLink::RunMT(std::string const& out, bool notify) if (notify) { // Add an undocumented option that enables a special return // code to notify us when the manifest is modified. - mtCommand.push_back("/notify_update"); + mtCommand.emplace_back("/notify_update"); } int mtRet = 0; if (!RunCommand("MT", mtCommand, this->Verbose, FORMAT_HEX, &mtRet, diff --git a/Source/ctest.cxx b/Source/ctest.cxx index 8ba126f..4a2531a 100644 --- a/Source/ctest.cxx +++ b/Source/ctest.cxx @@ -208,7 +208,7 @@ int main(int argc, char const* const* argv) std::vector args; args.reserve(argc); for (int i = 0; i < argc; ++i) { - args.push_back(argv[i]); + args.emplace_back(argv[i]); } // run ctest std::string output; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cae9d2a61afea3948c8dfaf1f7dbc39ebaa71055 commit cae9d2a61afea3948c8dfaf1f7dbc39ebaa71055 Author: Brad King AuthorDate: Wed Jan 16 14:32:29 2019 -0500 Commit: Brad King CommitDate: Thu Jan 17 12:01:07 2019 -0500 CTest: Teach --show-only= to reject unknown values diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 65c0d91..ccd74c0 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -1944,6 +1944,9 @@ bool cmCTest::HandleCommandLineArguments(size_t& i, this->Quiet = true; this->OutputAsJson = true; this->OutputAsJsonVersion = 1; + } else if (format != "human") { + errormsg = "'--show-only=' given unknown value '" + format + "'"; + return false; } } diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index 82bd963..d524f41 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -203,6 +203,8 @@ function(run_ShowOnly) set_tests_properties(ShowOnly PROPERTIES WILL_FAIL true _BACKTRACE_TRIPLES \"file1;1;add_test;file0;;\") add_test(ShowOnlyNotAvailable NOT_AVAILABLE) ") + run_cmake_command(show-only_human ${CMAKE_CTEST_COMMAND} --show-only=human) + run_cmake_command(show-only_bad ${CMAKE_CTEST_COMMAND} --show-only=bad) run_cmake_command(show-only_json-v1 ${CMAKE_CTEST_COMMAND} --show-only=json-v1) endfunction() run_ShowOnly() diff --git a/Tests/RunCMake/CTestCommandLine/show-only_bad-result.txt b/Tests/RunCMake/CTestCommandLine/show-only_bad-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/show-only_bad-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CTestCommandLine/show-only_bad-stderr.txt b/Tests/RunCMake/CTestCommandLine/show-only_bad-stderr.txt new file mode 100644 index 0000000..cc55ab3 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/show-only_bad-stderr.txt @@ -0,0 +1 @@ +^CMake Error: '--show-only=' given unknown value 'bad'$ diff --git a/Tests/RunCMake/CTestCommandLine/show-only_human-stdout.txt b/Tests/RunCMake/CTestCommandLine/show-only_human-stdout.txt new file mode 100644 index 0000000..1332149 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/show-only_human-stdout.txt @@ -0,0 +1 @@ +Test #1: ShowOnly https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7370b02c36b45bcd92b6c5bb7cc65ecff75b9b2b commit 7370b02c36b45bcd92b6c5bb7cc65ecff75b9b2b Author: Brad King AuthorDate: Wed Jan 16 14:18:42 2019 -0500 Commit: Brad King CommitDate: Thu Jan 17 12:01:07 2019 -0500 CTest: Teach --show-only=json-v1 to filter out not-available tests Avoid exposing the internal special value that we use to track tests not available in the tested configuration. This also prevents clients from having to do the filtering themselves. diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index 8867323..320647a 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -1039,6 +1039,11 @@ void cmCTestMultiProcessHandler::PrintOutputAsJson() testRun.SetTestProperties(&p); testRun.ComputeArguments(); + // Skip tests not available in this configuration. + if (p.Args.size() >= 2 && p.Args[1] == "NOT_AVAILABLE") { + continue; + } + Json::Value testInfo = DumpCTestInfo(testRun, p, backtraceGraph); tests.append(testInfo); } diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index 52002ce..82bd963 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -201,6 +201,7 @@ function(run_ShowOnly) file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" " add_test(ShowOnly \"${CMAKE_COMMAND}\" -E echo) set_tests_properties(ShowOnly PROPERTIES WILL_FAIL true _BACKTRACE_TRIPLES \"file1;1;add_test;file0;;\") + add_test(ShowOnlyNotAvailable NOT_AVAILABLE) ") run_cmake_command(show-only_json-v1 ${CMAKE_CTEST_COMMAND} --show-only=json-v1) endfunction() https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=62fec84ad7b44b7c54130e9eb3686f4fbc22672e commit 62fec84ad7b44b7c54130e9eb3686f4fbc22672e Author: Brad King AuthorDate: Thu Jan 17 11:59:20 2019 -0500 Commit: Brad King CommitDate: Thu Jan 17 12:01:07 2019 -0500 Tests: Fix RunCMake.CTestCommandLine case when no python is found Do not try to run the python checks if the python executable is not available. diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index c8ea3fc..52002ce 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -175,6 +175,9 @@ endfunction() run_TestStdin() function(show_only_json_check_python v) + if(RunCMake_TEST_FAILED OR NOT PYTHON_EXECUTABLE) + return() + endif() set(json_file "${RunCMake_TEST_BINARY_DIR}/ctest.json") file(WRITE "${json_file}" "${actual_stdout}") set(actual_stdout "" PARENT_SCOPE) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2e5307a2a45d456b7fb52e4d3fab1416dc9a1bd8 commit 2e5307a2a45d456b7fb52e4d3fab1416dc9a1bd8 Author: Brad King AuthorDate: Wed Jan 16 13:26:47 2019 -0500 Commit: Brad King CommitDate: Thu Jan 17 11:43:56 2019 -0500 CTestSVN: Accept std::string in SVNInfo constructor diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx index 6c439e9..21f5e1c 100644 --- a/Source/CTest/cmCTestSVN.cxx +++ b/Source/CTest/cmCTestSVN.cxx @@ -521,7 +521,7 @@ private: } else { local_path = path; } - this->SVN->Repositories.emplace_back(local_path.c_str()); + this->SVN->Repositories.emplace_back(local_path); } }; diff --git a/Source/CTest/cmCTestSVN.h b/Source/CTest/cmCTestSVN.h index a467ede..5c8505d 100644 --- a/Source/CTest/cmCTestSVN.h +++ b/Source/CTest/cmCTestSVN.h @@ -41,7 +41,7 @@ private: struct SVNInfo { - SVNInfo(const char* path) + SVNInfo(std::string const& path = std::string()) : LocalPath(path) { } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=75a7a237465e37215525831f942a3904d20d1380 commit 75a7a237465e37215525831f942a3904d20d1380 Author: Brad King AuthorDate: Thu Jan 17 10:57:15 2019 -0500 Commit: Brad King CommitDate: Thu Jan 17 10:57:51 2019 -0500 Tests: Rename RunCMake.CTestCommandLine show-only test cases The current name was chosen from an earlier design iteration of the command-line option name. Rename the case to match the final name. diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index cae14b1..c8ea3fc 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -174,12 +174,12 @@ function(run_TestStdin) endfunction() run_TestStdin() -function(ShowAsJson_check_python v) +function(show_only_json_check_python v) set(json_file "${RunCMake_TEST_BINARY_DIR}/ctest.json") file(WRITE "${json_file}" "${actual_stdout}") set(actual_stdout "" PARENT_SCOPE) execute_process( - COMMAND ${PYTHON_EXECUTABLE} "${RunCMake_SOURCE_DIR}/ShowAsJson${v}-check.py" "${json_file}" + COMMAND ${PYTHON_EXECUTABLE} "${RunCMake_SOURCE_DIR}/show-only_json-v${v}_check.py" "${json_file}" RESULT_VARIABLE result OUTPUT_VARIABLE output ERROR_VARIABLE output @@ -190,15 +190,15 @@ function(ShowAsJson_check_python v) endif() endfunction() -function(run_ShowAsJson) - set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/ShowAsJson) +function(run_ShowOnly) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/ShowOnly) set(RunCMake_TEST_NO_CLEAN 1) file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" " - add_test(ShowAsJson \"${CMAKE_COMMAND}\" -E echo) - set_tests_properties(ShowAsJson PROPERTIES WILL_FAIL true _BACKTRACE_TRIPLES \"file1;1;add_test;file0;;\") + add_test(ShowOnly \"${CMAKE_COMMAND}\" -E echo) + set_tests_properties(ShowOnly PROPERTIES WILL_FAIL true _BACKTRACE_TRIPLES \"file1;1;add_test;file0;;\") ") - run_cmake_command(ShowAsJsonVersionOne ${CMAKE_CTEST_COMMAND} --show-only=json-v1) + run_cmake_command(show-only_json-v1 ${CMAKE_CTEST_COMMAND} --show-only=json-v1) endfunction() -run_ShowAsJson() +run_ShowOnly() diff --git a/Tests/RunCMake/CTestCommandLine/ShowAsJsonVersionOne-check.cmake b/Tests/RunCMake/CTestCommandLine/ShowAsJsonVersionOne-check.cmake deleted file mode 100644 index f8bcd2c..0000000 --- a/Tests/RunCMake/CTestCommandLine/ShowAsJsonVersionOne-check.cmake +++ /dev/null @@ -1 +0,0 @@ -ShowAsJson_check_python(1) diff --git a/Tests/RunCMake/CTestCommandLine/show-only_json-v1-check.cmake b/Tests/RunCMake/CTestCommandLine/show-only_json-v1-check.cmake new file mode 100644 index 0000000..f9234f8 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/show-only_json-v1-check.cmake @@ -0,0 +1 @@ +show_only_json_check_python(1) diff --git a/Tests/RunCMake/CTestCommandLine/ShowAsJson1-check.py b/Tests/RunCMake/CTestCommandLine/show-only_json-v1_check.py similarity index 97% rename from Tests/RunCMake/CTestCommandLine/ShowAsJson1-check.py rename to Tests/RunCMake/CTestCommandLine/show-only_json-v1_check.py index d794e7d..4dff90c 100644 --- a/Tests/RunCMake/CTestCommandLine/ShowAsJson1-check.py +++ b/Tests/RunCMake/CTestCommandLine/show-only_json-v1_check.py @@ -1,4 +1,4 @@ -from ShowAsJson_check import * +from show_only_json_check import * def check_kind(k): assert is_string(k) @@ -77,7 +77,7 @@ def check_workingdir_property(p): assert is_string(p["name"]) assert is_string(p["value"]) assert p["name"] == "WORKING_DIRECTORY" - assert p["value"].endswith("Tests/RunCMake/CTestCommandLine/ShowAsJson") + assert p["value"].endswith("Tests/RunCMake/CTestCommandLine/ShowOnly") def check_properties(p): assert is_list(p) @@ -95,7 +95,7 @@ def check_tests(t): assert test["backtrace"] == 1 check_command(test["command"]) assert is_string(test["name"]) - assert test["name"] == "ShowAsJson" + assert test["name"] == "ShowOnly" check_properties(test["properties"]) assert is_dict(ctest_json) diff --git a/Tests/RunCMake/CTestCommandLine/ShowAsJson_check.py b/Tests/RunCMake/CTestCommandLine/show_only_json_check.py similarity index 100% rename from Tests/RunCMake/CTestCommandLine/ShowAsJson_check.py rename to Tests/RunCMake/CTestCommandLine/show_only_json_check.py https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fecbc87608f4b1429721292d3414bde9eb9f073f commit fecbc87608f4b1429721292d3414bde9eb9f073f Author: Brad King AuthorDate: Wed Jan 16 14:08:50 2019 -0500 Commit: Brad King CommitDate: Wed Jan 16 14:10:15 2019 -0500 Tests: Fix RunCMake.CTestCommandLine to actually check json-v1 Add a file missing from commit 67209a9291 (Tests: Add cases for ctest --show-only=json-v1, 2018-11-01) to actually hook up the content check. diff --git a/Tests/RunCMake/CTestCommandLine/ShowAsJsonVersionOne-check.cmake b/Tests/RunCMake/CTestCommandLine/ShowAsJsonVersionOne-check.cmake new file mode 100644 index 0000000..f8bcd2c --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/ShowAsJsonVersionOne-check.cmake @@ -0,0 +1 @@ +ShowAsJson_check_python(1) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2915a75615bab216753c902fa716b11f9fc5de83 commit 2915a75615bab216753c902fa716b11f9fc5de83 Author: Regina Pfeifer AuthorDate: Fri Jan 11 14:18:12 2019 +0100 Commit: Brad King CommitDate: Wed Jan 16 10:34:08 2019 -0500 CTest: Add documentation and release notes for SubmitURL diff --git a/Help/command/ctest_submit.rst b/Help/command/ctest_submit.rst index 426475c..fba03fd 100644 --- a/Help/command/ctest_submit.rst +++ b/Help/command/ctest_submit.rst @@ -6,6 +6,7 @@ Perform the :ref:`CTest Submit Step` as a :ref:`Dashboard Client`. :: ctest_submit([PARTS ...] [FILES ...] + [SUBMIT_URL ] [HTTPHEADER
] [RETRY_COUNT ] [RETRY_DELAY ] @@ -39,6 +40,10 @@ The options are: Specify an explicit list of specific files to be submitted. Each individual file must exist at the time of the call. +``SUBMIT_URL `` + The ``http`` or ``https`` URL of the dashboard server to send the submission + to. If not given, the :variable:`CTEST_SUBMIT_URL` variable is used. + ``HTTPHEADER `` Specify HTTP header to be included in the request to CDash during submission. This suboption can be repeated several times. @@ -68,6 +73,7 @@ Submit to CDash Upload API :: ctest_submit(CDASH_UPLOAD [CDASH_UPLOAD_TYPE ] + [SUBMIT_URL ] [HTTPHEADER
] [RETRY_COUNT ] [RETRY_DELAY ] @@ -80,5 +86,5 @@ with a content hash of the file. If CDash does not already have the file, then it is uploaded. Along with the file, a CDash type string is specified to tell CDash which handler to use to process the data. -This signature accepts the ``HTTPHEADER``, ``RETRY_COUNT``, ``RETRY_DELAY``, -``RETURN_VALUE`` and ``QUIET`` options as described above. +This signature accepts the ``SUBMIT_URL``, ``HTTPHEADER``, ``RETRY_COUNT``, +``RETRY_DELAY``, ``RETURN_VALUE`` and ``QUIET`` options as described above. diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index e464b0c..e09ace5 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -574,6 +574,7 @@ Variables for CTest /variable/CTEST_RUN_CURRENT_SCRIPT /variable/CTEST_SCP_COMMAND /variable/CTEST_SITE + /variable/CTEST_SUBMIT_URL /variable/CTEST_SOURCE_DIRECTORY /variable/CTEST_SVN_COMMAND /variable/CTEST_SVN_OPTIONS diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst index 8490e3d..bcf75ac 100644 --- a/Help/manual/ctest.1.rst +++ b/Help/manual/ctest.1.rst @@ -1109,38 +1109,45 @@ Configuration settings include: * :module:`CTest` module variable: ``CTEST_CURL_OPTIONS`` ``DropLocation`` - The path on the dashboard server to send the submission. + Legacy option. When ``SubmitURL`` is not set, it is constructed from + ``DropMethod``, ``DropSiteUser``, ``DropSitePassword``, ``DropSite``, and + ``DropLocation``. * `CTest Script`_ variable: :variable:`CTEST_DROP_LOCATION` * :module:`CTest` module variable: ``DROP_LOCATION`` if set, else ``CTEST_DROP_LOCATION`` ``DropMethod`` - Specify the method by which results should be submitted to the - dashboard server. The value may be ``http`` or ``https``. + Legacy option. When ``SubmitURL`` is not set, it is constructed from + ``DropMethod``, ``DropSiteUser``, ``DropSitePassword``, ``DropSite``, and + ``DropLocation``. * `CTest Script`_ variable: :variable:`CTEST_DROP_METHOD` * :module:`CTest` module variable: ``DROP_METHOD`` if set, else ``CTEST_DROP_METHOD`` ``DropSite`` - The dashboard server name. + Legacy option. When ``SubmitURL`` is not set, it is constructed from + ``DropMethod``, ``DropSiteUser``, ``DropSitePassword``, ``DropSite``, and + ``DropLocation``. * `CTest Script`_ variable: :variable:`CTEST_DROP_SITE` * :module:`CTest` module variable: ``DROP_SITE`` if set, else ``CTEST_DROP_SITE`` ``DropSitePassword`` - The dashboard server login password, if any - (for ``ftp``, ``http``, and ``https``). + Legacy option. When ``SubmitURL`` is not set, it is constructed from + ``DropMethod``, ``DropSiteUser``, ``DropSitePassword``, ``DropSite``, and + ``DropLocation``. * `CTest Script`_ variable: :variable:`CTEST_DROP_SITE_PASSWORD` * :module:`CTest` module variable: ``DROP_SITE_PASSWORD`` if set, else ``CTEST_DROP_SITE_PASWORD`` ``DropSiteUser`` - The dashboard server login user name, if any - (for ``ftp``, ``http``, and ``https``). + Legacy option. When ``SubmitURL`` is not set, it is constructed from + ``DropMethod``, ``DropSiteUser``, ``DropSitePassword``, ``DropSite``, and + ``DropLocation``. * `CTest Script`_ variable: :variable:`CTEST_DROP_SITE_USER` * :module:`CTest` module variable: ``DROP_SITE_USER`` if set, @@ -1166,6 +1173,14 @@ Configuration settings include: * :module:`CTest` module variable: ``SITE``, initialized by the :command:`site_name` command +``SubmitURL`` + The ``http`` or ``https`` URL of the dashboard server to send the submission + to. + + * `CTest Script`_ variable: :variable:`CTEST_SUBMIT_URL` + * :module:`CTest` module variable: ``SUBMIT_URL`` if set, + else ``CTEST_SUBMIT_URL`` + ``TriggerSite`` Legacy option. Not used. diff --git a/Help/release/dev/ctest-submit-url.rst b/Help/release/dev/ctest-submit-url.rst new file mode 100644 index 0000000..f848877 --- /dev/null +++ b/Help/release/dev/ctest-submit-url.rst @@ -0,0 +1,7 @@ +ctest-submit-url +---------------- + +* CTest learned to accept the dashboard server submission URL from a single + variable. See the ``SubmitURL`` setting in :manual:`ctest(1)`, + the :variable:`CTEST_SUBMIT_URL` variable, and the ``SUBMIT_URL`` + argument of the :command:`ctest_submit` command. diff --git a/Help/variable/CTEST_SUBMIT_URL.rst b/Help/variable/CTEST_SUBMIT_URL.rst new file mode 100644 index 0000000..7d84da4 --- /dev/null +++ b/Help/variable/CTEST_SUBMIT_URL.rst @@ -0,0 +1,5 @@ +CTEST_SUBMIT_URL +---------------- + +Specify the CTest ``SubmitURL`` setting +in a :manual:`ctest(1)` dashboard client script. diff --git a/Modules/CTest.cmake b/Modules/CTest.cmake index 648e473..d100704 100644 --- a/Modules/CTest.cmake +++ b/Modules/CTest.cmake @@ -28,10 +28,7 @@ To enable submissions to a CDash server, create a ``CTestConfig.cmake`` file at the top of the project with content such as:: set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC") - set(CTEST_DROP_METHOD "http") - set(CTEST_DROP_SITE "my.cdash.org") - set(CTEST_DROP_LOCATION "/submit.php?project=MyProject") - set(CTEST_DROP_SITE_CDASH TRUE) + set(CTEST_SUBMIT_URL "http://my.cdash.org/submit.php?project=MyProject") (the CDash server can provide the file to a project administrator who configures ``MyProject``). Settings in the config file are shared by https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d6475daa79810e332c3d2d1659e3d73250717219 commit d6475daa79810e332c3d2d1659e3d73250717219 Author: Regina Pfeifer AuthorDate: Sat Dec 8 00:01:20 2018 +0100 Commit: Brad King CommitDate: Wed Jan 16 10:34:08 2019 -0500 Modules/CTest: Set SubmitURL diff --git a/Modules/CTest.cmake b/Modules/CTest.cmake index 8848bdd..648e473 100644 --- a/Modules/CTest.cmake +++ b/Modules/CTest.cmake @@ -89,6 +89,7 @@ if(BUILD_TESTING) if(EXISTS "${PROJECT_SOURCE_DIR}/CTestConfig.cmake") include("${PROJECT_SOURCE_DIR}/CTestConfig.cmake") SET_IF_SET_AND_NOT_SET(NIGHTLY_START_TIME "${CTEST_NIGHTLY_START_TIME}") + SET_IF_SET_AND_NOT_SET(SUBMIT_URL "${CTEST_SUBMIT_URL}") SET_IF_SET_AND_NOT_SET(DROP_METHOD "${CTEST_DROP_METHOD}") SET_IF_SET_AND_NOT_SET(DROP_SITE "${CTEST_DROP_SITE}") SET_IF_SET_AND_NOT_SET(DROP_SITE_USER "${CTEST_DROP_SITE_USER}") @@ -111,6 +112,18 @@ if(BUILD_TESTING) endif() SET_IF_NOT_SET (NIGHTLY_START_TIME "00:00:00 EDT") + if(NOT SUBMIT_URL) + set(SUBMIT_URL "${DROP_METHOD}://") + if(DROP_SITE_USER) + string(APPEND SUBMIT_URL "${DROP_SITE_USER}") + if(DROP_SITE_PASSWORD) + string(APPEND SUBMIT_URL ":${DROP_SITE_PASSWORD}") + endif() + string(APPEND SUBMIT_URL "@") + endif() + string(APPEND SUBMIT_URL "${DROP_SITE}${DROP_SITE_LOCATION}") + endif() + find_program(CVSCOMMAND cvs ) set(CVS_UPDATE_OPTIONS "-d -A -P" CACHE STRING "Options passed to the cvs update command.") diff --git a/Modules/DartConfiguration.tcl.in b/Modules/DartConfiguration.tcl.in index 24e7b55..e4513b3 100644 --- a/Modules/DartConfiguration.tcl.in +++ b/Modules/DartConfiguration.tcl.in @@ -20,12 +20,7 @@ BuildName: @BUILDNAME@ LabelsForSubprojects: @CTEST_LABELS_FOR_SUBPROJECTS@ # Submission information -DropSite: @DROP_SITE@ -DropLocation: @DROP_LOCATION@ -DropSiteUser: @DROP_SITE_USER@ -DropSitePassword: @DROP_SITE_PASSWORD@ -DropSiteMode: @DROP_SITE_MODE@ -DropMethod: @DROP_METHOD@ +SubmitURL: @SUBMIT_URL@ # Dashboard start time NightlyStartTime: @NIGHTLY_START_TIME@ https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=938f06fda69a0f4ef04b2ed43a945a3c901b9750 commit 938f06fda69a0f4ef04b2ed43a945a3c901b9750 Author: Regina Pfeifer AuthorDate: Wed Nov 28 22:31:25 2018 +0100 Commit: Brad King CommitDate: Wed Jan 16 10:34:08 2019 -0500 ctest_submit: Add parameter SUBMIT_URL diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx index e1fe765..00c0610 100644 --- a/Source/CTest/cmCTestSubmitCommand.cxx +++ b/Source/CTest/cmCTestSubmitCommand.cxx @@ -15,7 +15,9 @@ class cmExecutionStatus; cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler() { - const char* submitURL = this->Makefile->GetDefinition("CTEST_SUBMIT_URL"); + const char* submitURL = !this->SubmitURL.empty() + ? this->SubmitURL.c_str() + : this->Makefile->GetDefinition("CTEST_SUBMIT_URL"); if (submitURL) { this->CTest->SetCTestConfiguration("SubmitURL", submitURL, this->Quiet); @@ -174,6 +176,11 @@ bool cmCTestSubmitCommand::CheckArgumentKeyword(std::string const& arg) return true; } + if (arg == "SUBMIT_URL") { + this->ArgumentDoing = ArgumentDoingSubmitURL; + return true; + } + if (arg == "INTERNAL_TEST_CHECKSUM") { this->InternalTest = true; return true; @@ -239,6 +246,12 @@ bool cmCTestSubmitCommand::CheckArgumentValue(std::string const& arg) return true; } + if (this->ArgumentDoing == ArgumentDoingSubmitURL) { + this->ArgumentDoing = ArgumentDoingNone; + this->SubmitURL = arg; + return true; + } + // Look for other arguments. return this->Superclass::CheckArgumentValue(arg); } diff --git a/Source/CTest/cmCTestSubmitCommand.h b/Source/CTest/cmCTestSubmitCommand.h index c4b84ce..0caccd6 100644 --- a/Source/CTest/cmCTestSubmitCommand.h +++ b/Source/CTest/cmCTestSubmitCommand.h @@ -71,6 +71,7 @@ protected: ArgumentDoingCDashUpload, ArgumentDoingCDashUploadType, ArgumentDoingHttpHeader, + ArgumentDoingSubmitURL, ArgumentDoingLast2 }; @@ -85,6 +86,7 @@ protected: std::string CDashUploadFile; std::string CDashUploadType; std::vector HttpHeaders; + std::string SubmitURL; }; #endif https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=65e725c95756a4e2348e9fb52b3d5aca7ee21115 commit 65e725c95756a4e2348e9fb52b3d5aca7ee21115 Author: Regina Pfeifer AuthorDate: Wed Nov 28 22:29:02 2018 +0100 Commit: Brad King CommitDate: Wed Jan 16 10:34:08 2019 -0500 CTest: Add option SubmitURL Fixes: #18610 diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx index 76a1830..e1fe765 100644 --- a/Source/CTest/cmCTestSubmitCommand.cxx +++ b/Source/CTest/cmCTestSubmitCommand.cxx @@ -15,36 +15,26 @@ class cmExecutionStatus; cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler() { - const char* ctestDropMethod = - this->Makefile->GetDefinition("CTEST_DROP_METHOD"); - const char* ctestDropSite = this->Makefile->GetDefinition("CTEST_DROP_SITE"); - const char* ctestDropLocation = - this->Makefile->GetDefinition("CTEST_DROP_LOCATION"); - if (!ctestDropMethod) { - ctestDropMethod = "http"; - } + const char* submitURL = this->Makefile->GetDefinition("CTEST_SUBMIT_URL"); - if (!ctestDropSite) { - // error: CDash requires CTEST_DROP_SITE definition - // in CTestConfig.cmake - } - if (!ctestDropLocation) { - // error: CDash requires CTEST_DROP_LOCATION definition - // in CTestConfig.cmake + if (submitURL) { + this->CTest->SetCTestConfiguration("SubmitURL", submitURL, this->Quiet); + } else { + this->CTest->SetCTestConfigurationFromCMakeVariable( + this->Makefile, "DropMethod", "CTEST_DROP_METHOD", this->Quiet); + this->CTest->SetCTestConfigurationFromCMakeVariable( + this->Makefile, "DropSiteUser", "CTEST_DROP_SITE_USER", this->Quiet); + this->CTest->SetCTestConfigurationFromCMakeVariable( + this->Makefile, "DropSitePassword", "CTEST_DROP_SITE_PASSWORD", + this->Quiet); + this->CTest->SetCTestConfigurationFromCMakeVariable( + this->Makefile, "DropSite", "CTEST_DROP_SITE", this->Quiet); + this->CTest->SetCTestConfigurationFromCMakeVariable( + this->Makefile, "DropLocation", "CTEST_DROP_LOCATION", this->Quiet); } - this->CTest->SetCTestConfiguration("DropMethod", ctestDropMethod, - this->Quiet); - this->CTest->SetCTestConfiguration("DropSite", ctestDropSite, this->Quiet); - this->CTest->SetCTestConfiguration("DropLocation", ctestDropLocation, - this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable( this->Makefile, "CurlOptions", "CTEST_CURL_OPTIONS", this->Quiet); - this->CTest->SetCTestConfigurationFromCMakeVariable( - this->Makefile, "DropSiteUser", "CTEST_DROP_SITE_USER", this->Quiet); - this->CTest->SetCTestConfigurationFromCMakeVariable( - this->Makefile, "DropSitePassword", "CTEST_DROP_SITE_PASSWORD", - this->Quiet); const char* notesFilesVariable = this->Makefile->GetDefinition("CTEST_NOTES_FILES"); diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 881da48..219ad14 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -2628,8 +2628,8 @@ void cmCTest::SetCTestConfiguration(const char* name, const char* value, std::string cmCTest::GetSubmitURL() { - std::string url; - { + std::string url = this->GetCTestConfiguration("SubmitURL"); + if (url.empty()) { std::string method = this->GetCTestConfiguration("DropMethod"); std::string user = this->GetCTestConfiguration("DropSiteUser"); std::string password = this->GetCTestConfiguration("DropSitePassword"); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=65f1fc9d6329feb2d48ee986d4243166a66049af commit 65f1fc9d6329feb2d48ee986d4243166a66049af Author: Regina Pfeifer AuthorDate: Wed Nov 28 22:11:14 2018 +0100 Commit: Brad King CommitDate: Wed Jan 16 10:34:08 2019 -0500 CTest: Add function GetSubmitURL diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 7b51059..600194a 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -494,23 +494,6 @@ void cmCTestSubmitHandler::ParseResponse( } } -void cmCTestSubmitHandler::ConstructCDashURL(std::string& dropMethod, - std::string& url) -{ - dropMethod = this->CTest->GetCTestConfiguration("DropMethod"); - url = dropMethod; - url += "://"; - if (!this->CTest->GetCTestConfiguration("DropSiteUser").empty()) { - url += this->CTest->GetCTestConfiguration("DropSiteUser"); - if (!this->CTest->GetCTestConfiguration("DropSitePassword").empty()) { - url += ":" + this->CTest->GetCTestConfiguration("DropSitePassword"); - } - url += "@"; - } - url += this->CTest->GetCTestConfiguration("DropSite") + - this->CTest->GetCTestConfiguration("DropLocation"); -} - int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file, std::string const& typeString) { @@ -531,9 +514,7 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file, curl.SetCurlOptions(args); curl.SetTimeOutSeconds(SUBMIT_TIMEOUT_IN_SECONDS_DEFAULT); curl.SetHttpHeaders(this->HttpHeaders); - std::string dropMethod; - std::string url; - this->ConstructCDashURL(dropMethod, url); + std::string url = this->CTest->GetSubmitURL(); std::string fields; std::string::size_type pos = url.find('?'); if (pos != std::string::npos) { @@ -878,23 +859,7 @@ int cmCTestSubmitHandler::ProcessHandler() } this->SetLogFile(&ofs); - std::string dropMethod(this->CTest->GetCTestConfiguration("DropMethod")); - - if (dropMethod.empty()) { - dropMethod = "http"; - } - - std::string url = dropMethod; - url += "://"; - if (!this->CTest->GetCTestConfiguration("DropSiteUser").empty()) { - url += this->CTest->GetCTestConfiguration("DropSiteUser"); - if (!this->CTest->GetCTestConfiguration("DropSitePassword").empty()) { - url += ":" + this->CTest->GetCTestConfiguration("DropSitePassword"); - } - url += "@"; - } - url += this->CTest->GetCTestConfiguration("DropSite") + - this->CTest->GetCTestConfiguration("DropLocation"); + std::string url = this->CTest->GetSubmitURL(); cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " SubmitURL: " << url << '\n', this->Quiet); if (!this->SubmitUsingHTTP(buildDirectory + "/Testing/" + diff --git a/Source/CTest/cmCTestSubmitHandler.h b/Source/CTest/cmCTestSubmitHandler.h index 393e826..58f4f97 100644 --- a/Source/CTest/cmCTestSubmitHandler.h +++ b/Source/CTest/cmCTestSubmitHandler.h @@ -48,8 +48,6 @@ public: this->HttpHeaders = v; } - void ConstructCDashURL(std::string& dropMethod, std::string& url); - private: void SetLogFile(std::ostream* ost) { this->LogFile = ost; } diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 65c0d91..881da48 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -2626,6 +2626,32 @@ void cmCTest::SetCTestConfiguration(const char* name, const char* value, this->CTestConfiguration[name] = value; } +std::string cmCTest::GetSubmitURL() +{ + std::string url; + { + std::string method = this->GetCTestConfiguration("DropMethod"); + std::string user = this->GetCTestConfiguration("DropSiteUser"); + std::string password = this->GetCTestConfiguration("DropSitePassword"); + std::string site = this->GetCTestConfiguration("DropSite"); + std::string location = this->GetCTestConfiguration("DropLocation"); + + url = method.empty() ? "http" : method; + url += "://"; + if (!user.empty()) { + url += user; + if (!password.empty()) { + url += ':'; + url += password; + } + url += '@'; + } + url += site; + url += location; + } + return url; +} + std::string cmCTest::GetCurrentTag() { return this->CurrentTag; diff --git a/Source/cmCTest.h b/Source/cmCTest.h index 2b40ca3..a82f400 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -176,6 +176,8 @@ public: bool suppress = false); void EmptyCTestConfiguration(); + std::string GetSubmitURL(); + /** * constructor and destructor */ https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2bedd5fb7c02987ad209f96889e2578a16806e01 commit 2bedd5fb7c02987ad209f96889e2578a16806e01 Author: Regina Pfeifer AuthorDate: Mon Dec 10 10:10:14 2018 +0100 Commit: Brad King CommitDate: Wed Jan 16 10:34:08 2019 -0500 ctest_submit: Remove submit method from log output diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 3042480..7b51059 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -162,7 +162,6 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP( /* In windows, this will init the winsock stuff */ ::curl_global_init(CURL_GLOBAL_ALL); - std::string dropMethod(this->CTest->GetCTestConfiguration("DropMethod")); std::string curlopt(this->CTest->GetCTestConfiguration("CurlOptions")); std::vector args; cmSystemTools::ExpandListArgument(curlopt, args); @@ -503,12 +502,8 @@ void cmCTestSubmitHandler::ConstructCDashURL(std::string& dropMethod, url += "://"; if (!this->CTest->GetCTestConfiguration("DropSiteUser").empty()) { url += this->CTest->GetCTestConfiguration("DropSiteUser"); - cmCTestOptionalLog( - this->CTest, HANDLER_OUTPUT, - this->CTest->GetCTestConfiguration("DropSiteUser").c_str(), this->Quiet); if (!this->CTest->GetCTestConfiguration("DropSitePassword").empty()) { url += ":" + this->CTest->GetCTestConfiguration("DropSitePassword"); - cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, ":******", this->Quiet); } url += "@"; } @@ -545,7 +540,8 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file, fields = url.substr(pos + 1); url = url.substr(0, pos); } - if (!(dropMethod == "http" || dropMethod == "https")) { + if (!cmHasLiteralPrefix(url, "http://") && + !cmHasLiteralPrefix(url, "https://")) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Only http and https are supported for CDASH_UPLOAD\n"); return -1; @@ -872,10 +868,7 @@ int cmCTestSubmitHandler::ProcessHandler() cnt++; } } - cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, - "Submit files (using " - << this->CTest->GetCTestConfiguration("DropMethod") - << ")" << std::endl, + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "Submit files\n", this->Quiet); const char* specificTrack = this->CTest->GetSpecificTrack(); if (specificTrack) { @@ -891,66 +884,42 @@ int cmCTestSubmitHandler::ProcessHandler() dropMethod = "http"; } - if (dropMethod == "http" || dropMethod == "https") { - std::string url = dropMethod; - url += "://"; - ofs << "Using drop method: " << dropMethod << std::endl; - cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, - " Using HTTP submit method" << std::endl - << " Drop site:" << url, - this->Quiet); - if (!this->CTest->GetCTestConfiguration("DropSiteUser").empty()) { - url += this->CTest->GetCTestConfiguration("DropSiteUser"); - cmCTestOptionalLog( - this->CTest, HANDLER_OUTPUT, - this->CTest->GetCTestConfiguration("DropSiteUser").c_str(), - this->Quiet); - if (!this->CTest->GetCTestConfiguration("DropSitePassword").empty()) { - url += ":" + this->CTest->GetCTestConfiguration("DropSitePassword"); - cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, ":******", - this->Quiet); - } - url += "@"; - cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "@", this->Quiet); + std::string url = dropMethod; + url += "://"; + if (!this->CTest->GetCTestConfiguration("DropSiteUser").empty()) { + url += this->CTest->GetCTestConfiguration("DropSiteUser"); + if (!this->CTest->GetCTestConfiguration("DropSitePassword").empty()) { + url += ":" + this->CTest->GetCTestConfiguration("DropSitePassword"); } - url += this->CTest->GetCTestConfiguration("DropSite") + - this->CTest->GetCTestConfiguration("DropLocation"); + url += "@"; + } + url += this->CTest->GetCTestConfiguration("DropSite") + + this->CTest->GetCTestConfiguration("DropLocation"); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " SubmitURL: " << url << '\n', this->Quiet); + if (!this->SubmitUsingHTTP(buildDirectory + "/Testing/" + + this->CTest->GetCurrentTag(), + files, prefix, url)) { + cmCTestLog(this->CTest, ERROR_MESSAGE, + " Problems when submitting via HTTP\n"); + ofs << " Problems when submitting via HTTP\n"; + return -1; + } + if (this->HasErrors) { + cmCTestLog(this->CTest, HANDLER_OUTPUT, + " Errors occurred during submission.\n"); + ofs << " Errors occurred during submission.\n"; + } else { cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, - this->CTest->GetCTestConfiguration("DropSite") - << this->CTest->GetCTestConfiguration("DropLocation") + " Submission successful" + << (this->HasWarnings ? ", with warnings." : "") << std::endl, this->Quiet); - if (!this->SubmitUsingHTTP(buildDirectory + "/Testing/" + - this->CTest->GetCurrentTag(), - files, prefix, url)) { - cmCTestLog(this->CTest, ERROR_MESSAGE, - " Problems when submitting via HTTP" << std::endl); - ofs << " Problems when submitting via HTTP" << std::endl; - return -1; - } - if (this->HasErrors) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, - " Errors occurred during " - "submission." - << std::endl); - ofs << " Errors occurred during submission. " << std::endl; - } else { - cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, - " Submission successful" - << (this->HasWarnings ? ", with warnings." : "") - << std::endl, - this->Quiet); - ofs << " Submission successful" - << (this->HasWarnings ? ", with warnings." : "") << std::endl; - } - - return 0; + ofs << " Submission successful" + << (this->HasWarnings ? ", with warnings." : "") << std::endl; } - cmCTestLog(this->CTest, ERROR_MESSAGE, - " Unknown submission method: \"" << dropMethod << "\"" - << std::endl); - return -1; + return 0; } std::string cmCTestSubmitHandler::GetSubmitResultsPrefix() diff --git a/Tests/RunCMake/ctest_submit/FailDrop-http-stdout.txt b/Tests/RunCMake/ctest_submit/FailDrop-http-stdout.txt index c7f35c5..c9111b0 100644 --- a/Tests/RunCMake/ctest_submit/FailDrop-http-stdout.txt +++ b/Tests/RunCMake/ctest_submit/FailDrop-http-stdout.txt @@ -1,3 +1,2 @@ -Submit files \(using http\) - Using HTTP submit method - Drop site:http:// +Submit files + SubmitURL: http://-no-site- diff --git a/Tests/RunCMake/ctest_submit/FailDrop-https-stdout.txt b/Tests/RunCMake/ctest_submit/FailDrop-https-stdout.txt index 19f8234..2c67eb9 100644 --- a/Tests/RunCMake/ctest_submit/FailDrop-https-stdout.txt +++ b/Tests/RunCMake/ctest_submit/FailDrop-https-stdout.txt @@ -1,3 +1,2 @@ -Submit files \(using https\) - Using HTTP submit method - Drop site:https:// +Submit files + SubmitURL: https://-no-site- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0f08ed89362d207e18b06e806f127cd683b79141 commit 0f08ed89362d207e18b06e806f127cd683b79141 Author: Tushar Maheshwari AuthorDate: Tue Jan 15 20:34:46 2019 +0530 Commit: Brad King CommitDate: Wed Jan 16 10:03:35 2019 -0500 cmSystemTools: Silence CreateLink and CreateSymlink errors If provided, report errors to a std::string. This allows "silent" fallback to another flow, like COPY_ON_ERROR. diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 2cdf827..999af54 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -3760,34 +3760,32 @@ bool cmFileCommand::HandleCreateLinkCommand( // Check if the command requires a symbolic link. if (symbolicArg.IsEnabled()) { - completed = cmSystemTools::CreateSymlink(fileName, newFileName); + completed = cmSystemTools::CreateSymlink(fileName, newFileName, &result); } else { - completed = cmSystemTools::CreateLink(fileName, newFileName); + completed = cmSystemTools::CreateLink(fileName, newFileName, &result); } - if (!completed) { - // The link method did not succeed. Get the error message. - result = "Link failed: " + cmSystemTools::GetLastSystemError(); - - // Check if copy-on-error is enabled in the arguments. - if (copyOnErrorArg.IsEnabled()) { - completed = - cmSystemTools::cmCopyFile(fileName.c_str(), newFileName.c_str()); - if (!completed) { - result = "Copy failed: " + cmSystemTools::GetLastSystemError(); - } + // Check if copy-on-error is enabled in the arguments. + if (!completed && copyOnErrorArg.IsEnabled()) { + completed = + cmSystemTools::cmCopyFile(fileName.c_str(), newFileName.c_str()); + if (!completed) { + result = "Copy failed: " + cmSystemTools::GetLastSystemError(); } } // Check if the operation was successful. if (completed) { result = "0"; + } else if (resultVar.empty()) { + // The operation failed and the result is not reported in a variable. + this->SetError(result); + return false; } if (!resultVar.empty()) { this->Makefile->AddDefinition(resultVar, result.c_str()); - return true; } - return completed; + return true; } diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index a1c8c03..52957c1 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -3114,7 +3114,8 @@ std::string cmSystemTools::EncodeURL(std::string const& in, bool escapeSlashes) } bool cmSystemTools::CreateSymlink(const std::string& origName, - const std::string& newName) + const std::string& newName, + std::string* errorMessage) { uv_fs_t req; int flags = 0; @@ -3128,7 +3129,11 @@ bool cmSystemTools::CreateSymlink(const std::string& origName, if (err) { std::string e = "failed to create symbolic link '" + newName + "': " + uv_strerror(err); - cmSystemTools::Error(e.c_str()); + if (errorMessage) { + *errorMessage = std::move(e); + } else { + cmSystemTools::Error(e.c_str()); + } return false; } @@ -3136,7 +3141,8 @@ bool cmSystemTools::CreateSymlink(const std::string& origName, } bool cmSystemTools::CreateLink(const std::string& origName, - const std::string& newName) + const std::string& newName, + std::string* errorMessage) { uv_fs_t req; int err = @@ -3144,7 +3150,11 @@ bool cmSystemTools::CreateLink(const std::string& origName, if (err) { std::string e = "failed to create link '" + newName + "': " + uv_strerror(err); - cmSystemTools::Error(e.c_str()); + if (errorMessage) { + *errorMessage = std::move(e); + } else { + cmSystemTools::Error(e.c_str()); + } return false; } diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 15f27e5..489811d 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -528,12 +528,14 @@ public: /** Create a symbolic link if the platform supports it. Returns whether creation succeeded. */ static bool CreateSymlink(const std::string& origName, - const std::string& newName); + const std::string& newName, + std::string* errorMessage = nullptr); /** Create a hard link if the platform supports it. Returns whether creation succeeded. */ static bool CreateLink(const std::string& origName, - const std::string& newName); + const std::string& newName, + std::string* errorMessage = nullptr); private: static bool s_ForceUnixPaths; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=593d986470ce1938436da312e0c93e3c9c07017e commit 593d986470ce1938436da312e0c93e3c9c07017e Author: Tushar Maheshwari AuthorDate: Sun Jan 13 21:05:58 2019 +0530 Commit: Brad King CommitDate: Wed Jan 16 10:03:35 2019 -0500 Tests: Avoid cross-device links in CREATE_LINK test Add a test for COPY_ON_ERROR to cover that scenario. diff --git a/Tests/RunCMake/file/CREATE_LINK-COPY_ON_ERROR.cmake b/Tests/RunCMake/file/CREATE_LINK-COPY_ON_ERROR.cmake new file mode 100644 index 0000000..777ef4e --- /dev/null +++ b/Tests/RunCMake/file/CREATE_LINK-COPY_ON_ERROR.cmake @@ -0,0 +1,11 @@ +# Use COPY_ON_ERROR to handle the case where the source and destination +# directory are on different devices. Cross-device links are not permitted +# and the following command falls back to copying the file if link fails. +file(CREATE_LINK + ${CMAKE_CURRENT_LIST_FILE} TestCreateLink.cmake + RESULT result + COPY_ON_ERROR + ) +if(NOT result STREQUAL "0") + message(SEND_ERROR "COPY_ON_ERROR failed: '${result}'") +endif() diff --git a/Tests/RunCMake/file/CREATE_LINK.cmake b/Tests/RunCMake/file/CREATE_LINK.cmake index b7c090e..ca61646 100644 --- a/Tests/RunCMake/file/CREATE_LINK.cmake +++ b/Tests/RunCMake/file/CREATE_LINK.cmake @@ -1,4 +1,11 @@ -file(CREATE_LINK ${CMAKE_CURRENT_LIST_FILE} TestLink.cmake RESULT result) +# start with a file in the same directory to avoid cross-device links +set(test_file ${CMAKE_CURRENT_BINARY_DIR}/CreateLinkTest.txt) +file(TOUCH ${test_file}) + +file(CREATE_LINK + ${test_file} ${CMAKE_CURRENT_BINARY_DIR}/TestCreateLink.txt + RESULT result + ) if(NOT result STREQUAL "0") message(SEND_ERROR "Hard link result='${result}'") endif() diff --git a/Tests/RunCMake/file/RunCMakeTest.cmake b/Tests/RunCMake/file/RunCMakeTest.cmake index bbabddd..128e8f3 100644 --- a/Tests/RunCMake/file/RunCMakeTest.cmake +++ b/Tests/RunCMake/file/RunCMakeTest.cmake @@ -1,6 +1,7 @@ include(RunCMake) run_cmake(CREATE_LINK) +run_cmake(CREATE_LINK-COPY_ON_ERROR) run_cmake(CREATE_LINK-noarg) run_cmake(CREATE_LINK-noexist) run_cmake(DOWNLOAD-hash-mismatch) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9a3d85cfc501fe3c1655e4a6ae9fd08fd9a1fbb7 commit 9a3d85cfc501fe3c1655e4a6ae9fd08fd9a1fbb7 Author: Tushar Maheshwari AuthorDate: Fri Jan 11 18:37:05 2019 +0530 Commit: Brad King CommitDate: Wed Jan 16 10:03:35 2019 -0500 Tests: Skip symlink tests on Windows diff --git a/Tests/RunCMake/file/CREATE_LINK-noexist.cmake b/Tests/RunCMake/file/CREATE_LINK-SYMBOLIC-noexist.cmake similarity index 53% copy from Tests/RunCMake/file/CREATE_LINK-noexist.cmake copy to Tests/RunCMake/file/CREATE_LINK-SYMBOLIC-noexist.cmake index 1c4dc12..61aaf38 100644 --- a/Tests/RunCMake/file/CREATE_LINK-noexist.cmake +++ b/Tests/RunCMake/file/CREATE_LINK-SYMBOLIC-noexist.cmake @@ -1,8 +1,3 @@ -file(CREATE_LINK does_not_exist.txt TestLink.txt RESULT result) -if(NOT result STREQUAL "0") - message("Hard link error: ${result}") -endif() - file(CREATE_LINK does_not_exist.txt TestSymLink.txt RESULT sym_result SYMBOLIC) if(NOT sym_result STREQUAL "0") message("Symlink fail: ${sym_result}") diff --git a/Tests/RunCMake/file/CREATE_LINK.cmake b/Tests/RunCMake/file/CREATE_LINK-SYMBOLIC.cmake similarity index 53% copy from Tests/RunCMake/file/CREATE_LINK.cmake copy to Tests/RunCMake/file/CREATE_LINK-SYMBOLIC.cmake index 1d65b69..77b899c 100644 --- a/Tests/RunCMake/file/CREATE_LINK.cmake +++ b/Tests/RunCMake/file/CREATE_LINK-SYMBOLIC.cmake @@ -1,8 +1,3 @@ -file(CREATE_LINK ${CMAKE_CURRENT_LIST_FILE} TestLink.cmake RESULT result) -if(NOT result STREQUAL "0") - message(SEND_ERROR "Hard link result='${result}'") -endif() - file(CREATE_LINK ${CMAKE_CURRENT_LIST_FILE} TestSymLink.cmake RESULT sym_result SYMBOLIC) if(NOT sym_result STREQUAL "0") message(SEND_ERROR "Symlink result='${sym_result}'") diff --git a/Tests/RunCMake/file/CREATE_LINK-noexist.cmake b/Tests/RunCMake/file/CREATE_LINK-noexist.cmake index 1c4dc12..5ee2580 100644 --- a/Tests/RunCMake/file/CREATE_LINK-noexist.cmake +++ b/Tests/RunCMake/file/CREATE_LINK-noexist.cmake @@ -2,8 +2,3 @@ file(CREATE_LINK does_not_exist.txt TestLink.txt RESULT result) if(NOT result STREQUAL "0") message("Hard link error: ${result}") endif() - -file(CREATE_LINK does_not_exist.txt TestSymLink.txt RESULT sym_result SYMBOLIC) -if(NOT sym_result STREQUAL "0") - message("Symlink fail: ${sym_result}") -endif() diff --git a/Tests/RunCMake/file/CREATE_LINK.cmake b/Tests/RunCMake/file/CREATE_LINK.cmake index 1d65b69..b7c090e 100644 --- a/Tests/RunCMake/file/CREATE_LINK.cmake +++ b/Tests/RunCMake/file/CREATE_LINK.cmake @@ -2,8 +2,3 @@ file(CREATE_LINK ${CMAKE_CURRENT_LIST_FILE} TestLink.cmake RESULT result) if(NOT result STREQUAL "0") message(SEND_ERROR "Hard link result='${result}'") endif() - -file(CREATE_LINK ${CMAKE_CURRENT_LIST_FILE} TestSymLink.cmake RESULT sym_result SYMBOLIC) -if(NOT sym_result STREQUAL "0") - message(SEND_ERROR "Symlink result='${sym_result}'") -endif() diff --git a/Tests/RunCMake/file/RunCMakeTest.cmake b/Tests/RunCMake/file/RunCMakeTest.cmake index 4259680..bbabddd 100644 --- a/Tests/RunCMake/file/RunCMakeTest.cmake +++ b/Tests/RunCMake/file/RunCMakeTest.cmake @@ -56,6 +56,8 @@ run_cmake_command(GLOB-error-CONFIGURE_DEPENDS-SCRIPT_MODE ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/GLOB-error-CONFIGURE_DEPENDS-SCRIPT_MODE.cmake) if(NOT WIN32 OR CYGWIN) + run_cmake(CREATE_LINK-SYMBOLIC) + run_cmake(CREATE_LINK-SYMBOLIC-noexist) run_cmake(GLOB_RECURSE-cyclic-recursion) run_cmake(INSTALL-SYMLINK) run_cmake(READ_SYMLINK) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e68ea269d72773e53db0c6c6848f6f69f3fd7329 commit e68ea269d72773e53db0c6c6848f6f69f3fd7329 Author: Tushar Maheshwari AuthorDate: Thu Dec 27 22:05:32 2018 +0530 Commit: Brad King CommitDate: Wed Jan 16 10:03:35 2019 -0500 Tests: CREATE_LINK subcommand negative test case diff --git a/Tests/RunCMake/file/CREATE_LINK-noarg-result.txt b/Tests/RunCMake/file/CREATE_LINK-noarg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/CREATE_LINK-noarg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/CREATE_LINK-noarg-stderr.txt b/Tests/RunCMake/file/CREATE_LINK-noarg-stderr.txt new file mode 100644 index 0000000..12494f8 --- /dev/null +++ b/Tests/RunCMake/file/CREATE_LINK-noarg-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at CREATE_LINK-noarg\.cmake:[0-9]+ \(file\): + file CREATE_LINK must be called with at least two additional arguments +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/file/CREATE_LINK-noarg.cmake b/Tests/RunCMake/file/CREATE_LINK-noarg.cmake new file mode 100644 index 0000000..65002fa --- /dev/null +++ b/Tests/RunCMake/file/CREATE_LINK-noarg.cmake @@ -0,0 +1 @@ +file(CREATE_LINK ${CMAKE_CURRENT_LIST_FILE}) diff --git a/Tests/RunCMake/file/RunCMakeTest.cmake b/Tests/RunCMake/file/RunCMakeTest.cmake index 0962c17..4259680 100644 --- a/Tests/RunCMake/file/RunCMakeTest.cmake +++ b/Tests/RunCMake/file/RunCMakeTest.cmake @@ -1,6 +1,7 @@ include(RunCMake) run_cmake(CREATE_LINK) +run_cmake(CREATE_LINK-noarg) run_cmake(CREATE_LINK-noexist) run_cmake(DOWNLOAD-hash-mismatch) run_cmake(DOWNLOAD-unused-argument) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=45aa9c65a13105ff505e18f5029ef794b7aef9ab commit 45aa9c65a13105ff505e18f5029ef794b7aef9ab Author: Tushar Maheshwari AuthorDate: Thu Dec 27 21:36:31 2018 +0530 Commit: Brad King CommitDate: Wed Jan 16 10:03:35 2019 -0500 Tests: file CREATE_LINK subcommand test cases diff --git a/Tests/RunCMake/file/CREATE_LINK-noexist-stderr.txt b/Tests/RunCMake/file/CREATE_LINK-noexist-stderr.txt new file mode 100644 index 0000000..97eee4f --- /dev/null +++ b/Tests/RunCMake/file/CREATE_LINK-noexist-stderr.txt @@ -0,0 +1 @@ +Hard link error: Cannot hard link 'does_not_exist.txt' as it does not exist. diff --git a/Tests/RunCMake/file/CREATE_LINK-noexist.cmake b/Tests/RunCMake/file/CREATE_LINK-noexist.cmake new file mode 100644 index 0000000..1c4dc12 --- /dev/null +++ b/Tests/RunCMake/file/CREATE_LINK-noexist.cmake @@ -0,0 +1,9 @@ +file(CREATE_LINK does_not_exist.txt TestLink.txt RESULT result) +if(NOT result STREQUAL "0") + message("Hard link error: ${result}") +endif() + +file(CREATE_LINK does_not_exist.txt TestSymLink.txt RESULT sym_result SYMBOLIC) +if(NOT sym_result STREQUAL "0") + message("Symlink fail: ${sym_result}") +endif() diff --git a/Tests/RunCMake/file/CREATE_LINK.cmake b/Tests/RunCMake/file/CREATE_LINK.cmake new file mode 100644 index 0000000..1d65b69 --- /dev/null +++ b/Tests/RunCMake/file/CREATE_LINK.cmake @@ -0,0 +1,9 @@ +file(CREATE_LINK ${CMAKE_CURRENT_LIST_FILE} TestLink.cmake RESULT result) +if(NOT result STREQUAL "0") + message(SEND_ERROR "Hard link result='${result}'") +endif() + +file(CREATE_LINK ${CMAKE_CURRENT_LIST_FILE} TestSymLink.cmake RESULT sym_result SYMBOLIC) +if(NOT sym_result STREQUAL "0") + message(SEND_ERROR "Symlink result='${sym_result}'") +endif() diff --git a/Tests/RunCMake/file/RunCMakeTest.cmake b/Tests/RunCMake/file/RunCMakeTest.cmake index b872824..0962c17 100644 --- a/Tests/RunCMake/file/RunCMakeTest.cmake +++ b/Tests/RunCMake/file/RunCMakeTest.cmake @@ -1,5 +1,7 @@ include(RunCMake) +run_cmake(CREATE_LINK) +run_cmake(CREATE_LINK-noexist) run_cmake(DOWNLOAD-hash-mismatch) run_cmake(DOWNLOAD-unused-argument) run_cmake(DOWNLOAD-httpheader-not-set) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8bb7562f1a4e75fa5cd00f4ebd868d1494b63e7a commit 8bb7562f1a4e75fa5cd00f4ebd868d1494b63e7a Author: Tushar Maheshwari AuthorDate: Thu Dec 27 20:59:51 2018 +0530 Commit: Brad King CommitDate: Wed Jan 16 10:03:35 2019 -0500 Help: Add documentation for file(CREATE_LINK) subcommand diff --git a/Help/command/file.rst b/Help/command/file.rst index 6e2a6dd..db4d6fc 100644 --- a/Help/command/file.rst +++ b/Help/command/file.rst @@ -27,6 +27,7 @@ Synopsis file({`COPY`_ | `INSTALL`_} ... DESTINATION [...]) file(`SIZE`_ ) file(`READ_SYMLINK`_ ) + file(`CREATE_LINK`_ [...]) `Path Conversion`_ file(`RELATIVE_PATH`_ ) @@ -368,6 +369,28 @@ could do something like this: set(result "${dir}/${result}") endif() +.. _CREATE_LINK: + +.. code-block:: cmake + + file(CREATE_LINK + [RESULT ] [COPY_ON_ERROR] [SYMBOLIC]) + +Create a link to ```` at ````. + +It is a hard link by default. This can be changed to symbolic links by +using ``SYMBOLIC``. The original file needs to exist for hard links. + +The ```` variable, if specified, gets the status of the operation. +It is set to ``0`` in case of success. Otherwise, it contains the error +generated. In case of failures, if ``RESULT`` is not specified, a fatal error +is emitted. + +Specifying ``COPY_ON_ERROR`` enables copying the file as a fallback if +creating the link fails. + +Overwrites the ```` if it exists. + Path Conversion ^^^^^^^^^^^^^^^ https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=81650e488c734702384ef903630838015a3f81b1 commit 81650e488c734702384ef903630838015a3f81b1 Author: Tushar Maheshwari AuthorDate: Thu Dec 27 17:28:30 2018 +0530 Commit: Brad King CommitDate: Wed Jan 16 10:03:35 2019 -0500 cmFileCommand: Add CREATE_LINK subcommand This brings the functionality of `cmake -E create_symlink` and more to scripts. The default behavior is to create hard links. The `SYMBOLIC` argument can be used to create symlinks instead. The `COPY_ON_ERROR` argument enables a fallback to copying the file in case the link fails. The `RESULT ` retrieves the error message generated by the system. It is set to "0" on success. Fixes: #16926 diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index db2fde8..2cdf827 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -185,6 +185,9 @@ bool cmFileCommand::InitialPass(std::vector const& args, if (subCommand == "READ_SYMLINK") { return this->HandleReadSymlinkCommand(args); } + if (subCommand == "CREATE_LINK") { + return this->HandleCreateLinkCommand(args); + } std::string e = "does not recognize sub-command " + subCommand; this->SetError(e); @@ -3670,3 +3673,121 @@ bool cmFileCommand::HandleReadSymlinkCommand( return true; } + +bool cmFileCommand::HandleCreateLinkCommand( + std::vector const& args) +{ + if (args.size() < 3) { + this->SetError("CREATE_LINK must be called with at least two additional " + "arguments"); + return false; + } + + cmCommandArgumentsHelper argHelper; + cmCommandArgumentGroup group; + + cmCAString linkArg(&argHelper, "CREATE_LINK"); + cmCAString fileArg(&argHelper, nullptr); + cmCAString newFileArg(&argHelper, nullptr); + + cmCAString resultArg(&argHelper, "RESULT", &group); + cmCAEnabler copyOnErrorArg(&argHelper, "COPY_ON_ERROR", &group); + cmCAEnabler symbolicArg(&argHelper, "SYMBOLIC", &group); + + linkArg.Follows(nullptr); + fileArg.Follows(&linkArg); + newFileArg.Follows(&fileArg); + group.Follows(&newFileArg); + + std::vector unconsumedArgs; + argHelper.Parse(&args, &unconsumedArgs); + + if (!unconsumedArgs.empty()) { + this->SetError("unknown argument: \"" + unconsumedArgs.front() + '\"'); + return false; + } + + std::string fileName = fileArg.GetString(); + std::string newFileName = newFileArg.GetString(); + + // Output variable for storing the result. + const std::string& resultVar = resultArg.GetString(); + + // The system error message generated in the operation. + std::string result; + + // Check if the paths are distinct. + if (fileName == newFileName) { + result = "CREATE_LINK cannot use same file and newfile"; + if (!resultVar.empty()) { + this->Makefile->AddDefinition(resultVar, result.c_str()); + return true; + } + this->SetError(result); + return false; + } + + // Hard link requires original file to exist. + if (!symbolicArg.IsEnabled() && !cmSystemTools::FileExists(fileName)) { + result = "Cannot hard link \'" + fileName + "\' as it does not exist."; + if (!resultVar.empty()) { + this->Makefile->AddDefinition(resultVar, result.c_str()); + return true; + } + this->SetError(result); + return false; + } + + // Check if the new file already exists and remove it. + if ((cmSystemTools::FileExists(newFileName) || + cmSystemTools::FileIsSymlink(newFileName)) && + !cmSystemTools::RemoveFile(newFileName)) { + std::ostringstream e; + e << "Failed to create link '" << newFileName + << "' because existing path cannot be removed: " + << cmSystemTools::GetLastSystemError() << "\n"; + + if (!resultVar.empty()) { + this->Makefile->AddDefinition(resultVar, e.str().c_str()); + return true; + } + this->SetError(e.str()); + return false; + } + + // Whether the operation completed successfully. + bool completed = false; + + // Check if the command requires a symbolic link. + if (symbolicArg.IsEnabled()) { + completed = cmSystemTools::CreateSymlink(fileName, newFileName); + } else { + completed = cmSystemTools::CreateLink(fileName, newFileName); + } + + if (!completed) { + // The link method did not succeed. Get the error message. + result = "Link failed: " + cmSystemTools::GetLastSystemError(); + + // Check if copy-on-error is enabled in the arguments. + if (copyOnErrorArg.IsEnabled()) { + completed = + cmSystemTools::cmCopyFile(fileName.c_str(), newFileName.c_str()); + if (!completed) { + result = "Copy failed: " + cmSystemTools::GetLastSystemError(); + } + } + } + + // Check if the operation was successful. + if (completed) { + result = "0"; + } + + if (!resultVar.empty()) { + this->Makefile->AddDefinition(resultVar, result.c_str()); + return true; + } + + return completed; +} diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h index fe05c98..12c5115 100644 --- a/Source/cmFileCommand.h +++ b/Source/cmFileCommand.h @@ -61,6 +61,7 @@ protected: bool HandleLockCommand(std::vector const& args); bool HandleSizeCommand(std::vector const& args); bool HandleReadSymlinkCommand(std::vector const& args); + bool HandleCreateLinkCommand(std::vector const& args); private: void AddEvaluationFile(const std::string& inputName, diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index be65853..a1c8c03 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -3134,3 +3134,19 @@ bool cmSystemTools::CreateSymlink(const std::string& origName, return true; } + +bool cmSystemTools::CreateLink(const std::string& origName, + const std::string& newName) +{ + uv_fs_t req; + int err = + uv_fs_link(nullptr, &req, origName.c_str(), newName.c_str(), nullptr); + if (err) { + std::string e = + "failed to create link '" + newName + "': " + uv_strerror(err); + cmSystemTools::Error(e.c_str()); + return false; + } + + return true; +} diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index c0999e7..15f27e5 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -530,6 +530,11 @@ public: static bool CreateSymlink(const std::string& origName, const std::string& newName); + /** Create a hard link if the platform supports it. Returns whether + creation succeeded. */ + static bool CreateLink(const std::string& origName, + const std::string& newName); + private: static bool s_ForceUnixPaths; static bool s_RunCommandHideConsole; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b773e58099b2fc8ebdf8319172fb018d0139396d commit b773e58099b2fc8ebdf8319172fb018d0139396d Author: David Aguilar AuthorDate: Tue Jan 15 12:12:32 2019 -0800 Commit: Brad King CommitDate: Wed Jan 16 09:59:46 2019 -0500 find_package: add test coverage for CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt index 6a80df5..f8b36c5 100644 --- a/Tests/FindPackageTest/CMakeLists.txt +++ b/Tests/FindPackageTest/CMakeLists.txt @@ -188,6 +188,37 @@ find_package(ArchC 3.1 EXACT NAMES zot) find_package(ArchD 4.0 EXACT NAMES zot) unset(CMAKE_LIBRARY_ARCHITECTURE) +# Test find_package() with CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS enabled +if(UNIX) + # Create ./symlink pointing back here. + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink + . "${CMAKE_CURRENT_SOURCE_DIR}/symlink") + # Make find_package search through the symlink + set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/symlink") + + # First, test the default behavior where symlinks are preserved. + set(SetFoundResolved_DIR "") + find_package(SetFoundResolved) + # The result must preserve the /symlink/ path. + set(SetFoundResolved_EXPECTED "${CMAKE_CURRENT_SOURCE_DIR}/symlink/cmake") + if(NOT "${SetFoundResolved_DIR}" STREQUAL "${SetFoundResolved_EXPECTED}") + message(SEND_ERROR "SetFoundResolved_DIR set by find_package() is set to \"${SetFoundResolved_DIR}\" (expected \"${SetFoundResolved_EXPECTED}\")") + endif() + + # Resolve symlinks when finding the package. + set(CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS TRUE) + set(SetFoundResolved_DIR "") + find_package(SetFoundResolved) + # ./symlink points back here so it should be gone when resolved. + set(SetFoundResolved_EXPECTED "${CMAKE_CURRENT_SOURCE_DIR}/cmake") + if(NOT "${SetFoundResolved_DIR}" STREQUAL "${SetFoundResolved_EXPECTED}") + message(SEND_ERROR "SetFoundResolved_DIR set by find_package() is set to \"${SetFoundResolved_DIR}\" (expected \"${SetFoundResolved_EXPECTED}\")") + endif() + # Cleanup. + unset(CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS) + file(REMOVE "${CMAKE_CURRENT_SOURCE_DIR}/symlink") +endif() + # Test _DIR environment variable. # We erase the main prefix path to ensure the env var is used. set(CMAKE_PREFIX_PATH) diff --git a/Tests/FindPackageTest/cmake/SetFoundResolvedConfig.cmake b/Tests/FindPackageTest/cmake/SetFoundResolvedConfig.cmake new file mode 100644 index 0000000..b2cf87c --- /dev/null +++ b/Tests/FindPackageTest/cmake/SetFoundResolvedConfig.cmake @@ -0,0 +1 @@ +set(SetFoundResolved_DIR "${CMAKE_CURRENT_LIST_DIR}") diff --git a/Tests/RunCMake/find_package/PackageRoot/ResolvedConfig.cmake b/Tests/RunCMake/find_package/PackageRoot/ResolvedConfig.cmake new file mode 100644 index 0000000..4496a05 --- /dev/null +++ b/Tests/RunCMake/find_package/PackageRoot/ResolvedConfig.cmake @@ -0,0 +1 @@ +set(Resolved_DIR "${CMAKE_CURRENT_LIST_DIR}") diff --git a/Tests/RunCMake/find_package/RunCMakeTest.cmake b/Tests/RunCMake/find_package/RunCMakeTest.cmake index e9f3558..066523e 100644 --- a/Tests/RunCMake/find_package/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_package/RunCMakeTest.cmake @@ -26,3 +26,6 @@ run_cmake(WrongVersionConfig) run_cmake(CMP0084-OLD) run_cmake(CMP0084-WARN) run_cmake(CMP0084-NEW) +if(UNIX) + run_cmake(SetFoundResolved) +endif() diff --git a/Tests/RunCMake/find_package/SetFoundResolved-stderr.txt b/Tests/RunCMake/find_package/SetFoundResolved-stderr.txt new file mode 100644 index 0000000..ea94be5 --- /dev/null +++ b/Tests/RunCMake/find_package/SetFoundResolved-stderr.txt @@ -0,0 +1,10 @@ +CMake Warning at SetFoundResolved.cmake:10 \(message\): + .*/Tests/RunCMake/find_package/symlink +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + + +CMake Warning at SetFoundResolved.cmake:15 \(message\): + .*/Tests/RunCMake/find_package/PackageRoot +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/find_package/SetFoundResolved.cmake b/Tests/RunCMake/find_package/SetFoundResolved.cmake new file mode 100644 index 0000000..8d56513 --- /dev/null +++ b/Tests/RunCMake/find_package/SetFoundResolved.cmake @@ -0,0 +1,17 @@ +# Create ./symlink pointing back here. +execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink + PackageRoot "${CMAKE_CURRENT_SOURCE_DIR}/symlink") + +# Make find_package search through the symlink. +set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/symlink") + +# Test preservation of symlinks. +find_package(Resolved) +message(WARNING "${Resolved_DIR}") + +# Test resolving symlinks. +set(CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS ON) +find_package(Resolved) +message(WARNING "${Resolved_DIR}") + +file(REMOVE "${CMAKE_CURRENT_SOURCE_DIR}/symlink") https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a5e948a36f5d1c1cf6a0ea34b04bbc4b6058e7d9 commit a5e948a36f5d1c1cf6a0ea34b04bbc4b6058e7d9 Author: David Aguilar AuthorDate: Thu Dec 20 16:41:04 2018 -0800 Commit: Brad King CommitDate: Wed Jan 16 09:59:46 2019 -0500 find_package: optionally resolve symlinks when discovering packages Teach find_package() to resolve symlinks when constructing relocatable prefix paths from discovered cmake config files. The `CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS` variable enables this behavior when set to `TRUE`. Fixes: #18704 diff --git a/Help/command/find_package.rst b/Help/command/find_package.rst index cafef8c..54d5f68 100644 --- a/Help/command/find_package.rst +++ b/Help/command/find_package.rst @@ -354,6 +354,11 @@ enabled. .. include:: FIND_XXX_ROOT.txt .. include:: FIND_XXX_ORDER.txt +By default the value stored in the result variable will be the path at +which the file is found. The :variable:`CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS` +variable may be set to ``TRUE`` before calling ``find_package`` in order +to resolve symbolic links and store the real path to the file. + Every non-REQUIRED ``find_package`` call can be disabled by setting the :variable:`CMAKE_DISABLE_FIND_PACKAGE_` variable to ``TRUE``. diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index e464b0c..0bbe914 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -170,6 +170,7 @@ Variables that Change Behavior /variable/CMAKE_FIND_NO_INSTALL_PREFIX /variable/CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY /variable/CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY + /variable/CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS /variable/CMAKE_FIND_PACKAGE_WARN_NO_MODULE /variable/CMAKE_FIND_ROOT_PATH /variable/CMAKE_FIND_ROOT_PATH_MODE_INCLUDE diff --git a/Help/release/dev/find-package-resolve-symlinks.rst b/Help/release/dev/find-package-resolve-symlinks.rst new file mode 100644 index 0000000..7adb9fe --- /dev/null +++ b/Help/release/dev/find-package-resolve-symlinks.rst @@ -0,0 +1,6 @@ +find-package-resolve-symlinks +----------------------------- + +* The :command:`find_package` command learned to optionally resolve + symbolic links in the paths to package configuration files. + See the :variable:`CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS` variable. diff --git a/Help/variable/CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS.rst b/Help/variable/CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS.rst new file mode 100644 index 0000000..dfbde20 --- /dev/null +++ b/Help/variable/CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS.rst @@ -0,0 +1,10 @@ +CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS +----------------------------------- + +Set to ``TRUE`` to tell :command:`find_package` calls to resolve symbolic +links in the value of ``_DIR``. + +This is helpful in use cases where the package search path points at a +proxy directory in which symlinks to the real package locations appear. +This is not enabled by default because there are also common use cases +in which the symlinks should be preserved. diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 8dc7ca2..2567b7a 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -95,6 +95,7 @@ cmFindPackageCommand::cmFindPackageCommand() this->UseLib32Paths = false; this->UseLib64Paths = false; this->UseLibx32Paths = false; + this->UseRealPath = false; this->PolicyScope = true; this->VersionMajor = 0; this->VersionMinor = 0; @@ -195,6 +196,11 @@ bool cmFindPackageCommand::InitialPass(std::vector const& args, this->NoSystemRegistry = true; } + // Check whether we should resolve symlinks when finding packages + if (this->Makefile->IsOn("CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS")) { + this->UseRealPath = true; + } + // Check if Sorting should be enabled if (const char* so = this->Makefile->GetDefinition("CMAKE_FIND_PACKAGE_SORT_ORDER")) { @@ -1502,6 +1508,10 @@ bool cmFindPackageCommand::FindConfigFile(std::string const& dir, fprintf(stderr, "Checking file [%s]\n", file.c_str()); } if (cmSystemTools::FileExists(file, true) && this->CheckVersion(file)) { + // Allow resolving symlinks when the config file is found through a link + if (this->UseRealPath) { + file = cmSystemTools::GetRealPath(file); + } return true; } } diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h index 05bad49..83d8431 100644 --- a/Source/cmFindPackageCommand.h +++ b/Source/cmFindPackageCommand.h @@ -178,6 +178,7 @@ private: bool UseLib32Paths; bool UseLib64Paths; bool UseLibx32Paths; + bool UseRealPath; bool PolicyScope; std::string LibraryArchitecture; std::vector Names; ----------------------------------------------------------------------- Summary of changes: .clang-tidy | 1 - Help/command/ctest_submit.rst | 10 +- Help/command/file.rst | 23 ++++ Help/command/find_package.rst | 5 + Help/manual/cmake-variables.7.rst | 2 + Help/manual/ctest.1.rst | 31 ++++-- Help/release/dev/ctest-submit-url.rst | 7 ++ Help/release/dev/find-package-resolve-symlinks.rst | 6 ++ .../CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS.rst | 10 ++ Help/variable/CTEST_SUBMIT_URL.rst | 5 + Modules/CTest.cmake | 18 +++- Modules/DartConfiguration.tcl.in | 7 +- Modules/FindCURL.cmake | 4 +- Source/CPack/cmCPackDragNDropGenerator.cxx | 4 +- Source/CPack/cmCPackGenerator.cxx | 3 +- Source/CPack/cmCPackNSISGenerator.cxx | 2 +- Source/CPack/cmCPackPackageMakerGenerator.cxx | 20 ++-- Source/CTest/cmCTestBuildAndTestHandler.cxx | 2 +- Source/CTest/cmCTestBuildHandler.cxx | 12 +-- Source/CTest/cmCTestCoverageHandler.cxx | 9 +- Source/CTest/cmCTestLaunch.cxx | 8 +- Source/CTest/cmCTestMemCheckHandler.cxx | 24 ++--- Source/CTest/cmCTestMultiProcessHandler.cxx | 5 + Source/CTest/cmCTestP4.cxx | 8 +- Source/CTest/cmCTestSVN.cxx | 4 +- Source/CTest/cmCTestSVN.h | 2 +- Source/CTest/cmCTestScriptHandler.cxx | 4 +- Source/CTest/cmCTestSubmitCommand.cxx | 53 ++++----- Source/CTest/cmCTestSubmitCommand.h | 2 + Source/CTest/cmCTestSubmitHandler.cxx | 116 +++++--------------- Source/CTest/cmCTestSubmitHandler.h | 2 - Source/CTest/cmCTestTestHandler.cxx | 14 +-- Source/CTest/cmParseDelphiCoverage.cxx | 2 +- Source/CursesDialog/ccmake.cxx | 2 +- Source/CursesDialog/cmCursesMainForm.cxx | 8 +- Source/cmCPluginAPI.cxx | 15 ++- Source/cmCTest.cxx | 35 +++++- Source/cmCTest.h | 2 + Source/cmComputeLinkInformation.cxx | 6 +- Source/cmCoreTryCompile.cxx | 4 +- Source/cmDependsJavaParserHelper.cxx | 4 +- Source/cmExecuteProcessCommand.cxx | 8 +- Source/cmFileCommand.cxx | 119 +++++++++++++++++++++ Source/cmFileCommand.h | 1 + Source/cmFindCommon.cxx | 6 +- Source/cmFindPackageCommand.cxx | 24 +++-- Source/cmFindPackageCommand.h | 1 + Source/cmForEachCommand.cxx | 2 +- Source/cmGeneratorExpressionLexer.cxx | 4 +- Source/cmGeneratorTarget.cxx | 8 +- Source/cmGlobalGenerator.cxx | 10 +- Source/cmGlobalNinjaGenerator.cxx | 10 +- Source/cmGlobalUnixMakefileGenerator3.cxx | 12 +-- Source/cmGlobalXCodeGenerator.cxx | 26 ++--- Source/cmJsonObjects.cxx | 14 +-- Source/cmLocalGenerator.cxx | 26 ++--- Source/cmLocalUnixMakefileGenerator3.cxx | 18 ++-- Source/cmMacroCommand.cxx | 2 +- Source/cmMakefile.cxx | 2 +- Source/cmMakefileTargetGenerator.cxx | 2 +- Source/cmNinjaNormalTargetGenerator.cxx | 6 +- Source/cmNinjaTargetGenerator.cxx | 7 +- Source/cmParseArgumentsCommand.cxx | 2 +- Source/cmProjectCommand.cxx | 26 ++--- Source/cmQtAutoGenInitializer.cxx | 6 +- Source/cmQtAutoGeneratorMocUic.cxx | 10 +- Source/cmQtAutoGeneratorRcc.cxx | 2 +- Source/cmRST.cxx | 4 +- Source/cmRulePlaceholderExpander.cxx | 5 + Source/cmRulePlaceholderExpander.h | 1 + Source/cmSetSourceFilesPropertiesCommand.cxx | 16 +-- Source/cmSiteNameCommand.cxx | 12 +-- Source/cmSourceGroupCommand.cxx | 2 +- Source/cmStringReplaceHelper.cxx | 12 ++- Source/cmSystemTools.cxx | 36 ++++++- Source/cmSystemTools.h | 9 +- Source/cmTarget.cxx | 34 +++--- Source/cmTryRunCommand.cxx | 4 +- Source/cmake.cxx | 40 +++---- Source/cmakemain.cxx | 12 +-- Source/cmcmd.cxx | 16 +-- Source/ctest.cxx | 2 +- Tests/FindPackageTest/CMakeLists.txt | 31 ++++++ .../cmake/SetFoundResolvedConfig.cmake | 1 + Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake | 22 ++-- .../show-only_bad-result.txt} | 0 .../CTestCommandLine/show-only_bad-stderr.txt | 1 + .../CTestCommandLine/show-only_human-stdout.txt | 1 + .../CTestCommandLine/show-only_json-v1-check.cmake | 1 + ...AsJson1-check.py => show-only_json-v1_check.py} | 6 +- ...ShowAsJson_check.py => show_only_json_check.py} | 0 .../RunCMake/ctest_submit/FailDrop-http-stdout.txt | 5 +- .../ctest_submit/FailDrop-https-stdout.txt | 5 +- .../RunCMake/file/CREATE_LINK-COPY_ON_ERROR.cmake | 11 ++ .../file/CREATE_LINK-SYMBOLIC-noexist.cmake | 4 + Tests/RunCMake/file/CREATE_LINK-SYMBOLIC.cmake | 4 + .../CREATE_LINK-noarg-result.txt} | 0 Tests/RunCMake/file/CREATE_LINK-noarg-stderr.txt | 4 + Tests/RunCMake/file/CREATE_LINK-noarg.cmake | 1 + Tests/RunCMake/file/CREATE_LINK-noexist-stderr.txt | 1 + Tests/RunCMake/file/CREATE_LINK-noexist.cmake | 4 + Tests/RunCMake/file/CREATE_LINK.cmake | 11 ++ Tests/RunCMake/file/RunCMakeTest.cmake | 6 ++ .../find_package/PackageRoot/ResolvedConfig.cmake | 1 + Tests/RunCMake/find_package/RunCMakeTest.cmake | 3 + .../find_package/SetFoundResolved-stderr.txt | 10 ++ Tests/RunCMake/find_package/SetFoundResolved.cmake | 17 +++ 107 files changed, 778 insertions(+), 432 deletions(-) create mode 100644 Help/release/dev/ctest-submit-url.rst create mode 100644 Help/release/dev/find-package-resolve-symlinks.rst create mode 100644 Help/variable/CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS.rst create mode 100644 Help/variable/CTEST_SUBMIT_URL.rst create mode 100644 Tests/FindPackageTest/cmake/SetFoundResolvedConfig.cmake copy Tests/RunCMake/{while/MissingArgument-result.txt => CTestCommandLine/show-only_bad-result.txt} (100%) create mode 100644 Tests/RunCMake/CTestCommandLine/show-only_bad-stderr.txt create mode 100644 Tests/RunCMake/CTestCommandLine/show-only_human-stdout.txt create mode 100644 Tests/RunCMake/CTestCommandLine/show-only_json-v1-check.cmake rename Tests/RunCMake/CTestCommandLine/{ShowAsJson1-check.py => show-only_json-v1_check.py} (97%) rename Tests/RunCMake/CTestCommandLine/{ShowAsJson_check.py => show_only_json_check.py} (100%) create mode 100644 Tests/RunCMake/file/CREATE_LINK-COPY_ON_ERROR.cmake create mode 100644 Tests/RunCMake/file/CREATE_LINK-SYMBOLIC-noexist.cmake create mode 100644 Tests/RunCMake/file/CREATE_LINK-SYMBOLIC.cmake copy Tests/RunCMake/{while/MissingArgument-result.txt => file/CREATE_LINK-noarg-result.txt} (100%) create mode 100644 Tests/RunCMake/file/CREATE_LINK-noarg-stderr.txt create mode 100644 Tests/RunCMake/file/CREATE_LINK-noarg.cmake create mode 100644 Tests/RunCMake/file/CREATE_LINK-noexist-stderr.txt create mode 100644 Tests/RunCMake/file/CREATE_LINK-noexist.cmake create mode 100644 Tests/RunCMake/file/CREATE_LINK.cmake create mode 100644 Tests/RunCMake/find_package/PackageRoot/ResolvedConfig.cmake create mode 100644 Tests/RunCMake/find_package/SetFoundResolved-stderr.txt create mode 100644 Tests/RunCMake/find_package/SetFoundResolved.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jan 21 08:03:06 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 21 Jan 2019 08:03:06 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-1031-g02f7e99 Message-ID: <20190121130306.96B1E111D55@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 02f7e997e939dbd0c753514edcd580083cebd37c (commit) via c7428e1729239264af84cb9ecb6f05f0b1e04e84 (commit) via 177b5fb61b6d1fc64c70ea3bf65652ccad690dd5 (commit) via 55a2dc3055e8c5f2189c763eb3fd4c9c754d1c05 (commit) via eadaf0c8c3b4112d38a19b20a9d303e83640373d (commit) via 1fba410ecf168ab4af500943608a5fb4fad5dc06 (commit) via 264bdac185f85e0508982df1b6efd7c3b8a1d1a4 (commit) via a080914274b32ac53f2449602811aebca7cc7d29 (commit) via 1ed4d48dcf71df4e8a352bc476262a79d75e299a (commit) via a42b700cc254e284892821dea06ac265744a0939 (commit) via c09ec7998148e3c69bf0c7fd2d626a6ccc23e37e (commit) via 25caf7bafeb18d9394eb2d13686970c68e9ad88c (commit) via 5b3af28e4532eadf92dee229870cadc94be9c635 (commit) via 1136275ae16cb0cc182e50f73d646445580b2634 (commit) via 1e1209729b26312cb511d5995bd57b6f5d35235e (commit) via 4fcb0d0213112bb2fdb04bb27e82543b93cfe41d (commit) from 9ea2f0eb948548aab2fc865d62a658e0c78e90f9 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=02f7e997e939dbd0c753514edcd580083cebd37c commit 02f7e997e939dbd0c753514edcd580083cebd37c Merge: c7428e1 c09ec79 Author: Brad King AuthorDate: Mon Jan 21 12:58:03 2019 +0000 Commit: Kitware Robot CommitDate: Mon Jan 21 07:58:10 2019 -0500 Merge topic 'ExternalProject-non-cmake-source-subdir' c09ec79981 ExternalProject: support SOURCE_SUBDIR for BUILD_IN_SOURCE Acked-by: Kitware Robot Merge-request: !2823 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c7428e1729239264af84cb9ecb6f05f0b1e04e84 commit c7428e1729239264af84cb9ecb6f05f0b1e04e84 Merge: 177b5fb 25caf7b Author: Brad King AuthorDate: Mon Jan 21 12:57:20 2019 +0000 Commit: Kitware Robot CommitDate: Mon Jan 21 07:57:33 2019 -0500 Merge topic 'read-list-file' 25caf7bafe cmMakefile::ReadListFile() accepts std::string argument Acked-by: Kitware Robot Merge-request: !2821 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=177b5fb61b6d1fc64c70ea3bf65652ccad690dd5 commit 177b5fb61b6d1fc64c70ea3bf65652ccad690dd5 Merge: 55a2dc3 a080914 Author: Brad King AuthorDate: Mon Jan 21 12:56:52 2019 +0000 Commit: Kitware Robot CommitDate: Mon Jan 21 07:56:59 2019 -0500 Merge topic 'fortran-compiler-id' a080914274 Fortran: Add compiler ID/Version generator expressions Acked-by: Kitware Robot Merge-request: !2804 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=55a2dc3055e8c5f2189c763eb3fd4c9c754d1c05 commit 55a2dc3055e8c5f2189c763eb3fd4c9c754d1c05 Merge: eadaf0c 5b3af28 Author: Brad King AuthorDate: Mon Jan 21 12:54:36 2019 +0000 Commit: Kitware Robot CommitDate: Mon Jan 21 07:54:45 2019 -0500 Merge topic 'update-libuv' 5b3af28e45 libuv: Update CMake-internal buildsystem 1136275ae1 libuv: Include uv/ headers from each other without any path 1e1209729b Merge branch 'upstream-libuv' into update-libuv 4fcb0d0213 libuv 2019-01-15 (f84c5e69) Acked-by: Kitware Robot Merge-request: !2822 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=eadaf0c8c3b4112d38a19b20a9d303e83640373d commit eadaf0c8c3b4112d38a19b20a9d303e83640373d Merge: 1fba410 264bdac Author: Brad King AuthorDate: Mon Jan 21 12:53:47 2019 +0000 Commit: Kitware Robot CommitDate: Mon Jan 21 07:54:06 2019 -0500 Merge topic 'cmake-role-fix' 264bdac185 CMAKE_ROLE: Fix value for ctest --build-and-test Acked-by: Kitware Robot Merge-request: !2820 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1fba410ecf168ab4af500943608a5fb4fad5dc06 commit 1fba410ecf168ab4af500943608a5fb4fad5dc06 Merge: 9ea2f0e 1ed4d48 Author: Brad King AuthorDate: Mon Jan 21 12:53:14 2019 +0000 Commit: Kitware Robot CommitDate: Mon Jan 21 07:53:23 2019 -0500 Merge topic 'autogen_mocs_compilation_first' 1ed4d48dcf Autogen: Prepend instead of append `mocs_compilation.cpp` to the sources list a42b700cc2 cmTarget,cmGeneratorTarget: Add optional `before` parameter to AddSource Acked-by: Kitware Robot Acked-by: Peter Wu Merge-request: !2815 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=264bdac185f85e0508982df1b6efd7c3b8a1d1a4 commit 264bdac185f85e0508982df1b6efd7c3b8a1d1a4 Author: Kyle Edwards AuthorDate: Thu Jan 17 12:02:11 2019 -0500 Commit: Kyle Edwards CommitDate: Fri Jan 18 10:15:25 2019 -0500 CMAKE_ROLE: Fix value for ctest --build-and-test --build-and-test builds a CMake project, so CMAKE_ROLE should be PROJECT. Fix this and add a test case. diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index d49fba2..9f45545 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -164,7 +164,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) return 1; } - cmake cm(cmake::RoleProject, cmState::CTest); + cmake cm(cmake::RoleProject, cmState::Project); cm.SetHomeDirectory(""); cm.SetHomeOutputDirectory(""); std::string cmakeOutString; diff --git a/Tests/RunCMake/CMakeRoleGlobalProperty/BuildAndTest/CMakeLists.txt b/Tests/RunCMake/CMakeRoleGlobalProperty/BuildAndTest/CMakeLists.txt new file mode 100644 index 0000000..332b023 --- /dev/null +++ b/Tests/RunCMake/CMakeRoleGlobalProperty/BuildAndTest/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.12) +project(CMakeRoleGlobalPropertyBuildAndTest NONE) +include(CTest) + +get_property(role GLOBAL PROPERTY CMAKE_ROLE) +if(NOT role STREQUAL "PROJECT") + message(SEND_ERROR "CMAKE_ROLE property is \"${role}\", should be \"PROJECT\"") +endif() + +add_test(NAME RunCMakeVersion COMMAND "${CMAKE_COMMAND}" --version) diff --git a/Tests/RunCMake/CMakeRoleGlobalProperty/CMakeLists.txt.in b/Tests/RunCMake/CMakeRoleGlobalProperty/CMakeLists.txt.in index 913239c..bb8f9c1 100644 --- a/Tests/RunCMake/CMakeRoleGlobalProperty/CMakeLists.txt.in +++ b/Tests/RunCMake/CMakeRoleGlobalProperty/CMakeLists.txt.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) -project(CTestStart at CASE_NAME@ NONE) +cmake_minimum_required(VERSION 3.12) +project(CMakeRoleGlobalProperty at CASE_NAME@ NONE) include(CTest) add_test(NAME RunCMakeVersion COMMAND "${CMAKE_COMMAND}" --version) diff --git a/Tests/RunCMake/CMakeRoleGlobalProperty/RunCMakeTest.cmake b/Tests/RunCMake/CMakeRoleGlobalProperty/RunCMakeTest.cmake index b840317..3cbd51d 100644 --- a/Tests/RunCMake/CMakeRoleGlobalProperty/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMakeRoleGlobalProperty/RunCMakeTest.cmake @@ -5,3 +5,10 @@ run_cmake(Project) run_cmake_command(Script "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_LIST_DIR}/Script.cmake") run_cmake_command(FindPackage "${CMAKE_COMMAND}" --find-package -DNAME=DummyPackage -DCOMPILER_ID=GNU -DLANGUAGE=CXX -DMODE=EXIST "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}") run_ctest(CTest) +run_cmake_command(BuildAndTest "${CMAKE_CTEST_COMMAND}" + --build-and-test + "${RunCMake_SOURCE_DIR}/BuildAndTest" + "${RunCMake_BINARY_DIR}/BuildAndTest-build" + --build-project CMakeRoleGlobalPropertyBuildAndTest + --build-generator "${RunCMake_GENERATOR}" + ) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a080914274b32ac53f2449602811aebca7cc7d29 commit a080914274b32ac53f2449602811aebca7cc7d29 Author: Andrew Paprocki AuthorDate: Mon Jan 14 09:12:38 2019 -0500 Commit: Brad King CommitDate: Fri Jan 18 08:56:13 2019 -0500 Fortran: Add compiler ID/Version generator expressions Adds `Fortran_COMPILER_ID` and `Fortran_COMPILER_VERSION` generator expression support to match equivalent `C_COMPILER_ID`, `CXX_COMPILER_ID`, `C_COMPILER_VERSION`, and `CXX_COMPILER_VERSION` support. This is very helpful in the case where the C/C++ compiler suite is a different type of compiler from the platform Fortran compiler and projects use generator expressions to assign compiler flags and definitions. (e.g. `GNU` C/C++ and `SunPro` Fortran on Linux) diff --git a/Auxiliary/vim/syntax/cmake.vim b/Auxiliary/vim/syntax/cmake.vim index 1083036..7e029de 100644 --- a/Auxiliary/vim/syntax/cmake.vim +++ b/Auxiliary/vim/syntax/cmake.vim @@ -2212,6 +2212,8 @@ syn keyword cmakeGeneratorExpressions contained \ DEBUG_MODE \ EXPORT \ FOO_EXTRA_THINGS + \ Fortran_COMPILER_ID + \ Fortran_COMPILER_VERSION \ GENEX_EVAL \ GNU \ IF diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index 63e43e1..7f484a4 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -122,12 +122,19 @@ Variable Queries ``1`` if the CMake-id of the CXX compiler matches ``compiler_id``, otherwise ``0``. See also the :variable:`CMAKE__COMPILER_ID` variable. +``$`` + ``1`` if the CMake-id of the Fortran compiler matches ``compiler_id``, + otherwise ``0``. + See also the :variable:`CMAKE__COMPILER_ID` variable. ``$`` ``1`` if the version of the C compiler matches ``version``, otherwise ``0``. See also the :variable:`CMAKE__COMPILER_VERSION` variable. ``$`` ``1`` if the version of the CXX compiler matches ``version``, otherwise ``0``. See also the :variable:`CMAKE__COMPILER_VERSION` variable. +``$`` + ``1`` if the version of the Fortran compiler matches ``version``, otherwise ``0``. + See also the :variable:`CMAKE__COMPILER_VERSION` variable. ``$`` ``1`` if the ``policy`` was NEW when the 'head' target was created, else ``0``. If the ``policy`` was not set, the warning message for the policy @@ -339,12 +346,18 @@ Variable Queries ``$`` The CMake-id of the CXX compiler used. See also the :variable:`CMAKE__COMPILER_ID` variable. +``$`` + The CMake-id of the Fortran compiler used. + See also the :variable:`CMAKE__COMPILER_ID` variable. ``$`` The version of the C compiler used. See also the :variable:`CMAKE__COMPILER_VERSION` variable. ``$`` The version of the CXX compiler used. See also the :variable:`CMAKE__COMPILER_VERSION` variable. +``$`` + The version of the Fortran compiler used. + See also the :variable:`CMAKE__COMPILER_VERSION` variable. ``$`` The compile language of source files when evaluating compile options. See :ref:`the related boolean expression diff --git a/Help/release/dev/fortran-compiler-id.rst b/Help/release/dev/fortran-compiler-id.rst new file mode 100644 index 0000000..1ea3bf9 --- /dev/null +++ b/Help/release/dev/fortran-compiler-id.rst @@ -0,0 +1,5 @@ +Fortran_COMPILER_ID +------------------- + +* The ``$`` and ``$`` + :manual:`generator expressions ` were added. diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index fe1b055..6a3f73d 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -692,6 +692,28 @@ static const struct CXXCompilerIdNode : public CompilerIdNode } } cxxCompilerIdNode; +static const struct FortranCompilerIdNode : public CompilerIdNode +{ + FortranCompilerIdNode() {} + + std::string Evaluate( + const std::vector& parameters, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content, + cmGeneratorExpressionDAGChecker* dagChecker) const override + { + if (!context->HeadTarget) { + reportError( + context, content->GetOriginalExpression(), + "$ may only be used with binary targets. It may " + "not be used with add_custom_command or add_custom_target."); + return std::string(); + } + return this->EvaluateWithLanguage(parameters, context, content, dagChecker, + "Fortran"); + } +} fortranCompilerIdNode; + struct CompilerVersionNode : public cmGeneratorExpressionNode { CompilerVersionNode() {} @@ -773,6 +795,28 @@ static const struct CxxCompilerVersionNode : public CompilerVersionNode } } cxxCompilerVersionNode; +static const struct FortranCompilerVersionNode : public CompilerVersionNode +{ + FortranCompilerVersionNode() {} + + std::string Evaluate( + const std::vector& parameters, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content, + cmGeneratorExpressionDAGChecker* dagChecker) const override + { + if (!context->HeadTarget) { + reportError( + context, content->GetOriginalExpression(), + "$ may only be used with binary targets. " + "It may not be used with add_custom_command or add_custom_target."); + return std::string(); + } + return this->EvaluateWithLanguage(parameters, context, content, dagChecker, + "Fortran"); + } +} fortranCompilerVersionNode; + struct PlatformIdNode : public cmGeneratorExpressionNode { PlatformIdNode() {} @@ -2024,6 +2068,7 @@ const cmGeneratorExpressionNode* cmGeneratorExpressionNode::GetNode( nodeMap["NOT"] = ¬Node; nodeMap["C_COMPILER_ID"] = &cCompilerIdNode; nodeMap["CXX_COMPILER_ID"] = &cxxCompilerIdNode; + nodeMap["Fortran_COMPILER_ID"] = &fortranCompilerIdNode; nodeMap["VERSION_GREATER"] = &versionGreaterNode; nodeMap["VERSION_GREATER_EQUAL"] = &versionGreaterEqNode; nodeMap["VERSION_LESS"] = &versionLessNode; @@ -2031,6 +2076,7 @@ const cmGeneratorExpressionNode* cmGeneratorExpressionNode::GetNode( nodeMap["VERSION_EQUAL"] = &versionEqualNode; nodeMap["C_COMPILER_VERSION"] = &cCompilerVersionNode; nodeMap["CXX_COMPILER_VERSION"] = &cxxCompilerVersionNode; + nodeMap["Fortran_COMPILER_VERSION"] = &fortranCompilerVersionNode; nodeMap["PLATFORM_ID"] = &platformIdNode; nodeMap["COMPILE_FEATURES"] = &compileFeaturesNode; nodeMap["CONFIGURATION"] = &configurationNode; diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 7338993..a6b24ee 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -436,6 +436,9 @@ if(BUILD_TESTING) ADD_TEST_MACRO(PolicyScope PolicyScope) ADD_TEST_MACRO(EmptyLibrary EmptyLibrary) ADD_TEST_MACRO(CompileDefinitions CompileDefinitions) + if(CMAKE_Fortran_COMPILER) + set(CompileOptions_BUILD_OPTIONS -DTEST_FORTRAN=1) + endif() ADD_TEST_MACRO(CompileOptions CompileOptions) ADD_TEST_MACRO(CompatibleInterface CompatibleInterface) ADD_TEST_MACRO(AliasTarget AliasTarget) diff --git a/Tests/CompileOptions/CMakeLists.txt b/Tests/CompileOptions/CMakeLists.txt index c9f1710..15a993c 100644 --- a/Tests/CompileOptions/CMakeLists.txt +++ b/Tests/CompileOptions/CMakeLists.txt @@ -4,6 +4,10 @@ project(CompileOptions) add_library(testlib other.cpp) +if(TEST_FORTRAN) + enable_language(Fortran) +endif() + add_executable(CompileOptions main.cpp) macro(get_compiler_test_genex lst lang) @@ -13,6 +17,9 @@ endmacro() get_compiler_test_genex(c_tests C) get_compiler_test_genex(cxx_tests CXX) +if(TEST_FORTRAN) + get_compiler_test_genex(fortran_tests Fortran) +endif() set_property(TARGET CompileOptions PROPERTY COMPILE_OPTIONS "-DTEST_DEFINE" @@ -21,6 +28,7 @@ set_property(TARGET CompileOptions PROPERTY COMPILE_OPTIONS "SHELL:" # produces no options ${c_tests} ${cxx_tests} + ${fortran_tests} ) if(BORLAND OR WATCOM) # these compilers do not support separate -D flags @@ -54,3 +62,12 @@ target_compile_definitions(CompileOptions "EXPECTED_C_COMPILER_VERSION=\"${CMAKE_C_COMPILER_VERSION}\"" "EXPECTED_CXX_COMPILER_VERSION=\"${CMAKE_CXX_COMPILER_VERSION}\"" ) + +if(TEST_FORTRAN) + # Definitions for the C++ code to test the values + target_compile_definitions(CompileOptions + PRIVATE + "TEST_FORTRAN" + "EXPECTED_Fortran_COMPILER_VERSION=\"${CMAKE_Fortran_COMPILER_VERSION}\"" + ) +endif() diff --git a/Tests/CompileOptions/main.cpp b/Tests/CompileOptions/main.cpp index 1379940..d94a169 100644 --- a/Tests/CompileOptions/main.cpp +++ b/Tests/CompileOptions/main.cpp @@ -47,10 +47,17 @@ int main() #endif && strcmp(EXPECTED_C_COMPILER_VERSION, TEST_C_COMPILER_VERSION) == 0 && - strcmp(EXPECTED_CXX_COMPILER_VERSION, TEST_CXX_COMPILER_VERSION) == - 0 && - TEST_C_COMPILER_VERSION_EQUALITY == 1 && - TEST_CXX_COMPILER_VERSION_EQUALITY == 1) + strcmp(EXPECTED_CXX_COMPILER_VERSION, TEST_CXX_COMPILER_VERSION) == 0 +#ifdef TEST_FORTRAN + && strcmp(EXPECTED_Fortran_COMPILER_VERSION, + TEST_Fortran_COMPILER_VERSION) == 0 +#endif + && TEST_C_COMPILER_VERSION_EQUALITY == 1 && + TEST_CXX_COMPILER_VERSION_EQUALITY == 1 +#ifdef TEST_FORTRAN + && TEST_Fortran_COMPILER_VERSION_EQUALITY == 1 +#endif + ) ? 0 : 1; } diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-Fortran_COMPILER_ID-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-Fortran_COMPILER_ID-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-Fortran_COMPILER_ID-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-Fortran_COMPILER_ID-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-Fortran_COMPILER_ID-stderr.txt new file mode 100644 index 0000000..fc13248 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-Fortran_COMPILER_ID-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at NonValidTarget-Fortran_COMPILER_ID.cmake:1 \(add_custom_command\): + Error evaluating generator expression: + + \$ + + \$ may only be used with binary targets. It may not be + used with add_custom_command or add_custom_target. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-Fortran_COMPILER_ID.cmake b/Tests/RunCMake/GeneratorExpression/NonValidTarget-Fortran_COMPILER_ID.cmake new file mode 100644 index 0000000..88a0bfb --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-Fortran_COMPILER_ID.cmake @@ -0,0 +1,4 @@ +add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/copied_file.c" + COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/empty.c" "${CMAKE_CURRENT_BINARY_DIR}/copied_file$.c" +) +add_custom_target(drive DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/copied_file.c") diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-Fortran_COMPILER_VERSION-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-Fortran_COMPILER_VERSION-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-Fortran_COMPILER_VERSION-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-Fortran_COMPILER_VERSION-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-Fortran_COMPILER_VERSION-stderr.txt new file mode 100644 index 0000000..f8a4120 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-Fortran_COMPILER_VERSION-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at NonValidTarget-Fortran_COMPILER_VERSION.cmake:1 \(add_custom_command\): + Error evaluating generator expression: + + \$ + + \$ may only be used with binary targets. It may + not be used with add_custom_command or add_custom_target. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-Fortran_COMPILER_VERSION.cmake b/Tests/RunCMake/GeneratorExpression/NonValidTarget-Fortran_COMPILER_VERSION.cmake new file mode 100644 index 0000000..34a4884 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-Fortran_COMPILER_VERSION.cmake @@ -0,0 +1,4 @@ +add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/copied_file.c" + COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/empty.c" "${CMAKE_CURRENT_BINARY_DIR}/copied_file$.c" +) +add_custom_target(drive DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/copied_file.c") diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index 013117e..8a5604c 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -15,8 +15,10 @@ run_cmake(BadSHELL_PATH) run_cmake(CMP0044-WARN) run_cmake(NonValidTarget-C_COMPILER_ID) run_cmake(NonValidTarget-CXX_COMPILER_ID) +run_cmake(NonValidTarget-Fortran_COMPILER_ID) run_cmake(NonValidTarget-C_COMPILER_VERSION) run_cmake(NonValidTarget-CXX_COMPILER_VERSION) +run_cmake(NonValidTarget-Fortran_COMPILER_VERSION) run_cmake(NonValidTarget-TARGET_BUNDLE_DIR) run_cmake(NonValidTarget-TARGET_BUNDLE_CONTENT_DIR) run_cmake(NonValidTarget-TARGET_PROPERTY) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1ed4d48dcf71df4e8a352bc476262a79d75e299a commit 1ed4d48dcf71df4e8a352bc476262a79d75e299a Author: Sebastian Holtermann AuthorDate: Thu Jan 17 11:19:42 2019 +0100 Commit: Sebastian Holtermann CommitDate: Fri Jan 18 13:47:23 2019 +0100 Autogen: Prepend instead of append `mocs_compilation.cpp` to the sources list `mocs_compilation.cpp` easily takes a long time to compile when it contains multiple `moc` files. When it was appended like before we ran into the situation that all smaller sources were already compiled when `mocs_compilation.cpp` got compiled at last. In that case a single core was busy but all remaining cores stayed idle. To optimize CPU core utilization we now prepend `mocs_compilation.cpp` to the sources list instead of appending it. This allows smaller source files to get compiled *while* the long lasting `mocs_compilation.cpp` gets compiled. Closes #18793 diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index 9fa8a89..3ae6d9a 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -963,7 +963,7 @@ bool cmQtAutoGenInitializer::InitAutogenTarget() // Files provided by the autogen target std::vector autogenProvides; if (this->Moc.Enabled) { - this->AddGeneratedSource(this->Moc.MocsCompilation, GeneratorT::MOC); + this->AddGeneratedSource(this->Moc.MocsCompilation, GeneratorT::MOC, true); autogenProvides.push_back(this->Moc.MocsCompilation); } @@ -1356,7 +1356,8 @@ bool cmQtAutoGenInitializer::SetupWriteRccInfo() } void cmQtAutoGenInitializer::AddGeneratedSource(std::string const& filename, - GeneratorT genType) + GeneratorT genType, + bool prepend) { // Register source file in makefile cmMakefile* makefile = this->Target->Target->GetMakefile(); @@ -1370,7 +1371,7 @@ void cmQtAutoGenInitializer::AddGeneratedSource(std::string const& filename, AddToSourceGroup(makefile, filename, genType); // Add source file to target - this->Target->AddSource(filename); + this->Target->AddSource(filename, prepend); } static unsigned int CharPtrToInt(const char* const input) diff --git a/Source/cmQtAutoGenInitializer.h b/Source/cmQtAutoGenInitializer.h index 47f157c..eefbaf0 100644 --- a/Source/cmQtAutoGenInitializer.h +++ b/Source/cmQtAutoGenInitializer.h @@ -102,7 +102,8 @@ private: bool SetupWriteAutogenInfo(); bool SetupWriteRccInfo(); - void AddGeneratedSource(std::string const& filename, GeneratorT genType); + void AddGeneratedSource(std::string const& filename, GeneratorT genType, + bool prepend = false); bool GetMocExecutable(); bool GetUicExecutable(); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a42b700cc254e284892821dea06ac265744a0939 commit a42b700cc254e284892821dea06ac265744a0939 Author: Sebastian Holtermann AuthorDate: Thu Jan 17 11:14:38 2019 +0100 Commit: Sebastian Holtermann CommitDate: Fri Jan 18 13:47:23 2019 +0100 cmTarget,cmGeneratorTarget: Add optional `before` parameter to AddSource The new optional `before` parameter in `cmTarget::AddSource` and `cmGeneratorTarget::AddSource` allows to prepend a source file to the sources list instead of appending it. diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 6515dfa..24d04b1 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -355,20 +355,22 @@ void cmGeneratorTarget::ClearSourcesCache() this->Objects.clear(); } -void cmGeneratorTarget::AddSourceCommon(const std::string& src) +void cmGeneratorTarget::AddSourceCommon(const std::string& src, bool before) { cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); cmGeneratorExpression ge(lfbt); std::unique_ptr cge = ge.Parse(src); cge->SetEvaluateForBuildsystem(true); - this->SourceEntries.push_back(new TargetPropertyEntry(std::move(cge))); + this->SourceEntries.insert(before ? this->SourceEntries.begin() + : this->SourceEntries.end(), + new TargetPropertyEntry(std::move(cge))); this->ClearSourcesCache(); } -void cmGeneratorTarget::AddSource(const std::string& src) +void cmGeneratorTarget::AddSource(const std::string& src, bool before) { - this->Target->AddSource(src); - this->AddSourceCommon(src); + this->Target->AddSource(src, before); + this->AddSourceCommon(src, before); } void cmGeneratorTarget::AddTracedSources(std::vector const& srcs) @@ -387,12 +389,10 @@ void cmGeneratorTarget::AddIncludeDirectory(const std::string& src, cmGeneratorExpression ge(lfbt); std::unique_ptr cge = ge.Parse(src); cge->SetEvaluateForBuildsystem(true); - // Insert before begin/end - std::vector::iterator pos = before - ? this->IncludeDirectoriesEntries.begin() - : this->IncludeDirectoriesEntries.end(); this->IncludeDirectoriesEntries.insert( - pos, new TargetPropertyEntry(std::move(cge))); + before ? this->IncludeDirectoriesEntries.begin() + : this->IncludeDirectoriesEntries.end(), + new TargetPropertyEntry(std::move(cge))); } std::vector const* cmGeneratorTarget::GetSourceDepends( diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index cfd1df0..d9221f0 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -536,7 +536,7 @@ public: */ void ClearSourcesCache(); - void AddSource(const std::string& src); + void AddSource(const std::string& src, bool before = false); void AddTracedSources(std::vector const& srcs); /** @@ -694,7 +694,7 @@ public: const char* GetSourcesProperty() const; private: - void AddSourceCommon(const std::string& src); + void AddSourceCommon(const std::string& src, bool before = false); std::string CreateFortranModuleDirectory( std::string const& working_dir) const; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index a94cf6a..25f021b 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -662,7 +662,7 @@ public: } }; -cmSourceFile* cmTarget::AddSource(const std::string& src) +cmSourceFile* cmTarget::AddSource(const std::string& src, bool before) { cmSourceFileLocation sfl(this->Makefile, src, cmSourceFileLocationKind::Known); @@ -671,8 +671,14 @@ cmSourceFile* cmTarget::AddSource(const std::string& src) TargetPropertyEntryFinder(sfl)) == this->Internal->SourceEntries.end()) { cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - this->Internal->SourceEntries.push_back(src); - this->Internal->SourceBacktraces.push_back(lfbt); + this->Internal->SourceEntries.insert( + before ? this->Internal->SourceEntries.begin() + : this->Internal->SourceEntries.end(), + src); + this->Internal->SourceBacktraces.insert( + before ? this->Internal->SourceBacktraces.begin() + : this->Internal->SourceBacktraces.end(), + lfbt); } if (cmGeneratorExpression::Find(src) != std::string::npos) { return nullptr; diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 655cefd..24b3742 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -123,7 +123,7 @@ public: void AddSources(std::vector const& srcs); void AddTracedSources(std::vector const& srcs); cmSourceFile* AddSourceCMP0049(const std::string& src); - cmSourceFile* AddSource(const std::string& src); + cmSourceFile* AddSource(const std::string& src, bool before = false); //* how we identify a library, by name and type typedef std::pair LibraryID; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c09ec7998148e3c69bf0c7fd2d626a6ccc23e37e commit c09ec7998148e3c69bf0c7fd2d626a6ccc23e37e Author: Ben Boeckel AuthorDate: Thu Jan 17 13:34:45 2019 -0500 Commit: Ben Boeckel CommitDate: Thu Jan 17 13:40:30 2019 -0500 ExternalProject: support SOURCE_SUBDIR for BUILD_IN_SOURCE diff --git a/Help/release/dev/ExternalProject-non-cmake-source-subdir.rst b/Help/release/dev/ExternalProject-non-cmake-source-subdir.rst new file mode 100644 index 0000000..29fe2ad --- /dev/null +++ b/Help/release/dev/ExternalProject-non-cmake-source-subdir.rst @@ -0,0 +1,7 @@ +ExternalProject-non-cmake-source-subdir +--------------------------------------- + +* The :module:`ExternalProject` module's ``ExternalProject_Add`` command + learned to apply ``SOURCE_SUBDIR`` when ``BUILD_IN_SOURCE`` is also used. + The ``BUILD_COMMAND`` is run in the given ``SOURCE_SUBDIR`` of the + ``SOURCE_DIR``. diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index e763bab..c5d6b45 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -425,7 +425,9 @@ External Project Definition can be used to point to an alternative directory within the source tree to use as the top of the CMake source tree instead. This must be a relative path and it will be interpreted as being relative to - ``SOURCE_DIR``. + ``SOURCE_DIR``. When ``BUILD_IN_SOURCE 1`` is specified, the + ``BUILD_COMMAND`` is used to point to an alternative directory within the + source tree. **Build Step Options:** If the configure step assumed the external project uses CMake as its build @@ -1676,7 +1678,11 @@ function(_ep_set_directories name) endif() if(build_in_source) get_property(source_dir TARGET ${name} PROPERTY _EP_SOURCE_DIR) - set_property(TARGET ${name} PROPERTY _EP_BINARY_DIR "${source_dir}") + if(source_subdir) + set_property(TARGET ${name} PROPERTY _EP_BINARY_DIR "${source_dir}/${source_subdir}") + else() + set_property(TARGET ${name} PROPERTY _EP_BINARY_DIR "${source_dir}") + endif() endif() # Make the directories at CMake configure time *and* add a custom command diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 6b166d6..ef60c51 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1635,6 +1635,18 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ExternalProjectSourceSubdir") + add_test(NAME ExternalProjectSourceSubdirNotCMake + COMMAND ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/ExternalProjectSourceSubdirNotCMake" + "${CMake_BINARY_DIR}/Tests/ExternalProjectSourceSubdirNotCMake" + ${build_generator_args} + --build-project ExternalProjectSourceSubdirNotCMake + --force-new-ctest-process + --build-options ${build_options} + ) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ExternalProjectSourceSubdirNotCMake") + add_test(ExternalProjectLocal ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/ExternalProjectLocal" diff --git a/Tests/ExternalProjectSourceSubdirNotCMake/CMakeLists.txt b/Tests/ExternalProjectSourceSubdirNotCMake/CMakeLists.txt new file mode 100644 index 0000000..f64df1a --- /dev/null +++ b/Tests/ExternalProjectSourceSubdirNotCMake/CMakeLists.txt @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 3.6) +project(ExternalProjectSourceSubdirNotCMake NONE) +include(ExternalProject) + +find_program(MAKE_EXECUTABLE + NAMES gmake make) + +if (NOT MAKE_EXECUTABLE) + message("No `make` executable found; skipping") + return () +endif () + +ExternalProject_Add(Example + SOURCE_SUBDIR subdir + BUILD_IN_SOURCE 1 + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Example + CONFIGURE_COMMAND "" + BUILD_COMMAND "${MAKE_EXECUTABLE}" + INSTALL_COMMAND "" + ) diff --git a/Tests/ExternalProjectSourceSubdirNotCMake/Example/subdir/Makefile b/Tests/ExternalProjectSourceSubdirNotCMake/Example/subdir/Makefile new file mode 100644 index 0000000..cab3b8f --- /dev/null +++ b/Tests/ExternalProjectSourceSubdirNotCMake/Example/subdir/Makefile @@ -0,0 +1,2 @@ +all: + echo "complete" https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=25caf7bafeb18d9394eb2d13686970c68e9ad88c commit 25caf7bafeb18d9394eb2d13686970c68e9ad88c Author: Vitaly Stakhovsky AuthorDate: Thu Jan 17 12:36:07 2019 -0500 Commit: Vitaly Stakhovsky CommitDate: Thu Jan 17 12:36:07 2019 -0500 cmMakefile::ReadListFile() accepts std::string argument Same for cmMakefile::ReadDependentFile(); some cleanup diff --git a/Source/CPack/cmCPackExternalGenerator.cxx b/Source/CPack/cmCPackExternalGenerator.cxx index ff69418..9dc9853 100644 --- a/Source/CPack/cmCPackExternalGenerator.cxx +++ b/Source/CPack/cmCPackExternalGenerator.cxx @@ -68,7 +68,7 @@ int cmCPackExternalGenerator::PackageFiles() return 0; } - int res = this->MakefileMap->ReadListFile(packageScript); + bool res = this->MakefileMap->ReadListFile(packageScript); if (cmSystemTools::GetErrorOccuredFlag() || !res) { return 0; diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index b205105..70a7faa 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -498,7 +498,7 @@ int cmCPackGenerator::InstallProjectViaInstallScript( tempInstallDirectory.c_str()); this->SetOptionIfNotSet("CMAKE_CURRENT_SOURCE_DIR", tempInstallDirectory.c_str()); - int res = this->MakefileMap->ReadListFile(installScript.c_str()); + bool res = this->MakefileMap->ReadListFile(installScript); if (cmSystemTools::GetErrorOccuredFlag() || !res) { return 0; } @@ -851,7 +851,7 @@ int cmCPackGenerator::InstallCMakeProject( mf.AddDefinition("CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION", "1"); } // do installation - int res = mf.ReadListFile(installFile.c_str()); + bool res = mf.ReadListFile(installFile); // forward definition of CMAKE_ABSOLUTE_DESTINATION_FILES // to CPack (may be used by generators like CPack RPM or DEB) // in order to transparently handle ABSOLUTE PATH @@ -927,7 +927,7 @@ bool cmCPackGenerator::ReadListFile(const char* moduleName) { bool retval; std::string fullPath = this->MakefileMap->GetModulesFile(moduleName); - retval = this->MakefileMap->ReadListFile(fullPath.c_str()); + retval = this->MakefileMap->ReadListFile(fullPath); // include FATAL_ERROR and ERROR in the return status retval = retval && (!cmSystemTools::GetErrorOccuredFlag()); return retval; diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index db9a0e7..d4c867b 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -256,7 +256,7 @@ int main(int argc, char const* const* argv) // paths, so FIND_XXX() commands can be used in scripts std::string systemFile = globalMF.GetModulesFile("CMakeDetermineSystem.cmake"); - if (!globalMF.ReadListFile(systemFile.c_str())) { + if (!globalMF.ReadListFile(systemFile)) { cmCPack_Log(&log, cmCPackLog::LOG_ERROR, "Error reading CMakeDetermineSystem.cmake" << std::endl); return 1; @@ -264,7 +264,7 @@ int main(int argc, char const* const* argv) systemFile = globalMF.GetModulesFile("CMakeSystemSpecificInformation.cmake"); - if (!globalMF.ReadListFile(systemFile.c_str())) { + if (!globalMF.ReadListFile(systemFile)) { cmCPack_Log(&log, cmCPackLog::LOG_ERROR, "Error reading CMakeSystemSpecificInformation.cmake" << std::endl); @@ -280,7 +280,7 @@ int main(int argc, char const* const* argv) cmCPack_Log(&log, cmCPackLog::LOG_VERBOSE, "Read CPack configuration file: " << cpackConfigFile << std::endl); - if (!globalMF.ReadListFile(cpackConfigFile.c_str())) { + if (!globalMF.ReadListFile(cpackConfigFile)) { cmCPack_Log(&log, cmCPackLog::LOG_ERROR, "Problem reading CPack config file: \"" << cpackConfigFile << "\"" << std::endl); diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx index 4facea2..465d619 100644 --- a/Source/CTest/cmCTestLaunch.cxx +++ b/Source/CTest/cmCTestLaunch.cxx @@ -619,7 +619,7 @@ void cmCTestLaunch::LoadConfig() cmMakefile mf(&gg, cm.GetCurrentSnapshot()); std::string fname = this->LogDir; fname += "CTestLaunchConfig.cmake"; - if (cmSystemTools::FileExists(fname) && mf.ReadListFile(fname.c_str())) { + if (cmSystemTools::FileExists(fname) && mf.ReadListFile(fname)) { this->SourceDir = mf.GetSafeDefinition("CTEST_SOURCE_DIRECTORY"); cmSystemTools::ConvertToUnixSlashes(this->SourceDir); } diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index aa37ff9..57841e4 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -373,7 +373,7 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg) ctest scripting easier. */ std::string systemFile = this->Makefile->GetModulesFile("CTestScriptMode.cmake"); - if (!this->Makefile->ReadListFile(systemFile.c_str()) || + if (!this->Makefile->ReadListFile(systemFile) || cmSystemTools::GetErrorOccuredFlag()) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Error in read:" << systemFile << "\n"); @@ -388,7 +388,7 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg) } // finally read in the script - if (!this->Makefile->ReadListFile(script.c_str()) || + if (!this->Makefile->ReadListFile(script) || cmSystemTools::GetErrorOccuredFlag()) { // Reset the error flag so that it can run more than // one script with an error when you use ctest_run_script. diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index acbe465..e33c937 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -104,7 +104,7 @@ bool cmCTestSubdirCommand::InitialPass(std::vector const& args, } fname += "/"; fname += testFilename; - readit = this->Makefile->ReadDependentFile(fname.c_str()); + readit = this->Makefile->ReadDependentFile(fname); } if (!readit) { std::string m = "Could not find include file: "; @@ -170,7 +170,7 @@ bool cmCTestAddSubdirectoryCommand::InitialPass( } fname += "/"; fname += testFilename; - readit = this->Makefile->ReadDependentFile(fname.c_str()); + readit = this->Makefile->ReadDependentFile(fname); } if (!readit) { std::string m = "Could not find include file: "; diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 1c0d9f6..cd9cbfb 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -640,7 +640,7 @@ bool cmCTest::InitializeFromCommand(cmCTestStartCommand* command) " Reading ctest configuration file: " << fname << std::endl, command->ShouldBeQuiet()); - bool readit = mf->ReadDependentFile(fname.c_str()); + bool readit = mf->ReadDependentFile(fname); if (!readit) { std::string m = "Could not find include file: "; m += fname; @@ -2469,8 +2469,7 @@ int cmCTest::ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf) bool erroroc = cmSystemTools::GetErrorOccuredFlag(); cmSystemTools::ResetErrorOccuredFlag(); - if (!mf->ReadListFile(fname.c_str()) || - cmSystemTools::GetErrorOccuredFlag()) { + if (!mf->ReadListFile(fname) || cmSystemTools::GetErrorOccuredFlag()) { cmCTestLog(this, ERROR_MESSAGE, "Problem reading custom configuration: " << fname << std::endl); @@ -2489,15 +2488,13 @@ int cmCTest::ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf) gl.RecurseOn(); gl.FindFiles(rexpr); std::vector& files = gl.GetFiles(); - std::vector::iterator fileIt; - for (fileIt = files.begin(); fileIt != files.end(); ++fileIt) { + for (const std::string& file : files) { cmCTestLog(this, DEBUG, - "* Read custom CTest configuration file: " << *fileIt + "* Read custom CTest configuration file: " << file << std::endl); - if (!mf->ReadListFile(fileIt->c_str()) || - cmSystemTools::GetErrorOccuredFlag()) { + if (!mf->ReadListFile(file) || cmSystemTools::GetErrorOccuredFlag()) { cmCTestLog(this, ERROR_MESSAGE, - "Problem reading custom configuration: " << *fileIt + "Problem reading custom configuration: " << file << std::endl); } } diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 85c2345..8f28179 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -355,7 +355,7 @@ bool cmGlobalGenerator::FindMakeProgram(cmMakefile* mf) std::string setMakeProgram = mf->GetModulesFile(this->FindMakeProgramFile.c_str()); if (!setMakeProgram.empty()) { - mf->ReadListFile(setMakeProgram.c_str()); + mf->ReadListFile(setMakeProgram); } } if (!mf->GetDefinition("CMAKE_MAKE_PROGRAM") || @@ -522,7 +522,7 @@ void cmGlobalGenerator::EnableLanguage( if (readCMakeSystem) { fpath += "/CMakeSystem.cmake"; if (cmSystemTools::FileExists(fpath)) { - mf->ReadListFile(fpath.c_str()); + mf->ReadListFile(fpath); } } // Load the CMakeDetermineSystem.cmake file and find out @@ -551,12 +551,12 @@ void cmGlobalGenerator::EnableLanguage( #endif // Read the DetermineSystem file std::string systemFile = mf->GetModulesFile("CMakeDetermineSystem.cmake"); - mf->ReadListFile(systemFile.c_str()); + mf->ReadListFile(systemFile); // load the CMakeSystem.cmake from the binary directory // this file is configured by the CMakeDetermineSystem.cmake file fpath = rootBin; fpath += "/CMakeSystem.cmake"; - mf->ReadListFile(fpath.c_str()); + mf->ReadListFile(fpath); } if (readCMakeSystem) { @@ -603,7 +603,7 @@ void cmGlobalGenerator::EnableLanguage( // **** Load the system specific initialization if not yet loaded if (!mf->GetDefinition("CMAKE_SYSTEM_SPECIFIC_INITIALIZE_LOADED")) { fpath = mf->GetModulesFile("CMakeSystemSpecificInitialize.cmake"); - if (!mf->ReadListFile(fpath.c_str())) { + if (!mf->ReadListFile(fpath)) { cmSystemTools::Error("Could not find cmake module file: " "CMakeSystemSpecificInitialize.cmake"); } @@ -635,7 +635,7 @@ void cmGlobalGenerator::EnableLanguage( // version of CMake then try to load the configured file first // to avoid duplicate compiler tests. if (cmSystemTools::FileExists(fpath)) { - if (!mf->ReadListFile(fpath.c_str())) { + if (!mf->ReadListFile(fpath)) { cmSystemTools::Error("Could not find cmake module file: ", fpath.c_str()); } @@ -662,7 +662,7 @@ void cmGlobalGenerator::EnableLanguage( determineCompiler += "Compiler.cmake"; std::string determineFile = mf->GetModulesFile(determineCompiler.c_str()); - if (!mf->ReadListFile(determineFile.c_str())) { + if (!mf->ReadListFile(determineFile)) { cmSystemTools::Error("Could not find cmake module file: ", determineCompiler.c_str()); } @@ -696,7 +696,7 @@ void cmGlobalGenerator::EnableLanguage( fpath += "/CMake"; fpath += lang; fpath += "Compiler.cmake"; - if (!mf->ReadListFile(fpath.c_str())) { + if (!mf->ReadListFile(fpath)) { cmSystemTools::Error("Could not find cmake module file: ", fpath.c_str()); } @@ -713,7 +713,7 @@ void cmGlobalGenerator::EnableLanguage( // **** Load the system specific information if not yet loaded if (!mf->GetDefinition("CMAKE_SYSTEM_SPECIFIC_INFORMATION_LOADED")) { fpath = mf->GetModulesFile("CMakeSystemSpecificInformation.cmake"); - if (!mf->ReadListFile(fpath.c_str())) { + if (!mf->ReadListFile(fpath)) { cmSystemTools::Error("Could not find cmake module file: " "CMakeSystemSpecificInformation.cmake"); } @@ -793,7 +793,7 @@ void cmGlobalGenerator::EnableLanguage( if (informationFile.empty()) { cmSystemTools::Error("Could not find cmake module file: ", fpath.c_str()); - } else if (!mf->ReadListFile(informationFile.c_str())) { + } else if (!mf->ReadListFile(informationFile)) { cmSystemTools::Error("Could not process cmake module file: ", informationFile.c_str()); } @@ -814,7 +814,7 @@ void cmGlobalGenerator::EnableLanguage( testLang += lang; testLang += "Compiler.cmake"; std::string ifpath = mf->GetModulesFile(testLang.c_str()); - if (!mf->ReadListFile(ifpath.c_str())) { + if (!mf->ReadListFile(ifpath)) { cmSystemTools::Error("Could not find cmake module file: ", testLang.c_str()); } @@ -852,7 +852,7 @@ void cmGlobalGenerator::EnableLanguage( projectCompatibility += mf->GetSafeDefinition("PROJECT_NAME"); projectCompatibility += "Compatibility.cmake"; if (cmSystemTools::FileExists(projectCompatibility)) { - mf->ReadListFile(projectCompatibility.c_str()); + mf->ReadListFile(projectCompatibility); } // Inform any extra generator of the new language. if (this->ExtraGenerator) { diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx index 594c310..a67d09e 100644 --- a/Source/cmIncludeCommand.cxx +++ b/Source/cmIncludeCommand.cxx @@ -120,8 +120,7 @@ bool cmIncludeCommand::InitialPass(std::vector const& args, return true; } - bool readit = - this->Makefile->ReadDependentFile(listFile.c_str(), noPolicyScope); + bool readit = this->Makefile->ReadDependentFile(listFile, noPolicyScope); // add the location of the included file if a result variable was given if (!resultVarName.empty()) { diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 707a1b5..eddbaa9 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1364,8 +1364,7 @@ bool cmLocalUnixMakefileGenerator3::ScanDependencies( std::string dirInfoFile = this->GetCurrentBinaryDirectory(); dirInfoFile += cmake::GetCMakeFilesDirectory(); dirInfoFile += "/CMakeDirectoryInformation.cmake"; - if (mf->ReadListFile(dirInfoFile.c_str()) && - !cmSystemTools::GetErrorOccuredFlag()) { + if (mf->ReadListFile(dirInfoFile) && !cmSystemTools::GetErrorOccuredFlag()) { haveDirectoryInfo = true; } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 3ff576e..fa1769d 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -533,7 +533,8 @@ void cmMakefile::IncludeScope::EnforceCMP0011() } } -bool cmMakefile::ReadDependentFile(const char* filename, bool noPolicyScope) +bool cmMakefile::ReadDependentFile(const std::string& filename, + bool noPolicyScope) { this->AddDefinition("CMAKE_PARENT_LIST_FILE", this->GetDefinition("CMAKE_CURRENT_LIST_FILE")); @@ -586,7 +587,7 @@ private: bool ReportError; }; -bool cmMakefile::ReadListFile(const char* filename) +bool cmMakefile::ReadListFile(const std::string& filename) { std::string filenametoread = cmSystemTools::CollapseFullPath( filename, this->GetCurrentSourceDirectory()); diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index ec36972..abe2cd1 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -86,11 +86,10 @@ public: cmDirectoryId GetDirectoryId() const; - bool ReadListFile(const char* filename); + bool ReadListFile(const std::string& filename); - bool ReadDependentFile(const char* filename, bool noPolicyScope = true); - - bool ProcessBuildsystemFile(const char* filename); + bool ReadDependentFile(const std::string& filename, + bool noPolicyScope = true); /** * Add a function blocker to this makefile diff --git a/Source/cmQtAutoGeneratorMocUic.cxx b/Source/cmQtAutoGeneratorMocUic.cxx index 9658e97..b22ebd5 100644 --- a/Source/cmQtAutoGeneratorMocUic.cxx +++ b/Source/cmQtAutoGeneratorMocUic.cxx @@ -1213,7 +1213,7 @@ bool cmQtAutoGeneratorMocUic::Init(cmMakefile* makefile) }; // -- Read info file - if (!makefile->ReadListFile(InfoFile().c_str())) { + if (!makefile->ReadListFile(InfoFile())) { Log().ErrorFile(GeneratorT::GEN, InfoFile(), "File processing failed"); return false; } diff --git a/Source/cmQtAutoGeneratorRcc.cxx b/Source/cmQtAutoGeneratorRcc.cxx index 29dc7a0..eb46892 100644 --- a/Source/cmQtAutoGeneratorRcc.cxx +++ b/Source/cmQtAutoGeneratorRcc.cxx @@ -58,7 +58,7 @@ bool cmQtAutoGeneratorRcc::Init(cmMakefile* makefile) }; // -- Read info file - if (!makefile->ReadListFile(InfoFile().c_str())) { + if (!makefile->ReadListFile(InfoFile())) { Log().ErrorFile(GeneratorT::RCC, InfoFile(), "File processing failed"); return false; } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 9fcfbde..12d39f0 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -533,7 +533,7 @@ bool cmake::FindPackage(const std::vector& args) mf->SetArgcArgv(args); std::string systemFile = mf->GetModulesFile("CMakeFindPackageMode.cmake"); - mf->ReadListFile(systemFile.c_str()); + mf->ReadListFile(systemFile); std::string language = mf->GetSafeDefinition("LANGUAGE"); std::string mode = mf->GetSafeDefinition("MODE"); @@ -2031,7 +2031,7 @@ int cmake::CheckBuildSystem() cm.GetCurrentSnapshot().SetDefaultDefinitions(); cmGlobalGenerator gg(&cm); cmMakefile mf(&gg, cm.GetCurrentSnapshot()); - if (!mf.ReadListFile(this->CheckBuildSystemArgument.c_str()) || + if (!mf.ReadListFile(this->CheckBuildSystemArgument) || cmSystemTools::GetErrorOccuredFlag()) { if (verbose) { std::ostringstream msg; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5b3af28e4532eadf92dee229870cadc94be9c635 commit 5b3af28e4532eadf92dee229870cadc94be9c635 Author: Brad King AuthorDate: Thu Jan 17 10:21:14 2019 -0500 Commit: Brad King CommitDate: Thu Jan 17 11:29:44 2019 -0500 libuv: Update CMake-internal buildsystem diff --git a/Utilities/IWYU/mapping.imp b/Utilities/IWYU/mapping.imp index aee8a69..482a08d 100644 --- a/Utilities/IWYU/mapping.imp +++ b/Utilities/IWYU/mapping.imp @@ -97,7 +97,7 @@ { include: [ "", private, "\"cm_jsoncpp_writer.h\"", public ] }, { include: [ "", private, "\"cm_rhash.h\"", public ] }, { include: [ "", private, "\"cm_uv.h\"", public ] }, - { include: [ "@", private, "\"cm_uv.h\"", public ] }, + { include: [ "@", private, "\"cm_uv.h\"", public ] }, { include: [ "", private, "\"cm_kwiml.h\"", public ] }, { include: [ "", private, "\"cm_kwiml.h\"", public ] }, { include: [ "", private, "\"cm_zlib.h\"", public ] }, @@ -114,7 +114,7 @@ { include: [ "\"cmjsoncpp/include/json/writer.h\"", private, "\"cm_jsoncpp_writer.h\"", public ] }, { include: [ "\"cmlibrhash/librhash/rhash.h\"", private, "\"cm_rhash.h\"", public ] }, { include: [ "\"cmlibuv/include/uv.h\"", private, "\"cm_uv.h\"", public ] }, - { include: [ "@\"cmlibuv/include/uv-.+\\.h\"", private, "\"cm_uv.h\"", public ] }, + { include: [ "@\"cmlibuv/include/uv/.+\\.h\"", private, "\"cm_uv.h\"", public ] }, { include: [ "\"KWIML/include/kwiml/abi.h\"", private, "\"cm_kwiml.h\"", public ] }, { include: [ "\"KWIML/include/kwiml/int.h\"", private, "\"cm_kwiml.h\"", public ] }, { include: [ "\"cmzlib/cm_zlib_mangle.h\"", private, "\"cm_zlib.h\"", public ] }, diff --git a/Utilities/cmlibuv/CMakeLists.txt b/Utilities/cmlibuv/CMakeLists.txt index a503041..a62c516 100644 --- a/Utilities/cmlibuv/CMakeLists.txt +++ b/Utilities/cmlibuv/CMakeLists.txt @@ -14,16 +14,21 @@ set(uv_libraries ${CMAKE_THREAD_LIBS_INIT}) set(uv_includes include src) set(uv_headers include/uv.h - include/uv-errno.h - include/uv-threadpool.h - include/uv-version.h + include/uv/errno.h + include/uv/threadpool.h + include/uv/version.h ) set(uv_sources src/fs-poll.c src/heap-inl.h + src/idna.c + src/idna.h src/inet.c src/queue.h + src/strscpy.c + src/strscpy.h src/threadpool.c + src/timer.c src/uv-common.c src/uv-common.h src/uv-data-getter-setters.c @@ -45,7 +50,7 @@ if(WIN32) _WIN32_WINNT=0x0600 ) list(APPEND uv_headers - include/uv-win.h + include/uv/win.h include/tree.h ) list(APPEND uv_sources @@ -67,7 +72,6 @@ if(WIN32) src/win/poll.c src/win/process-stdio.c src/win/process.c - src/win/req.c src/win/req-inl.h src/win/signal.c src/win/snprintf.c @@ -75,7 +79,6 @@ if(WIN32) src/win/stream-inl.h src/win/tcp.c src/win/thread.c - src/win/timer.c src/win/tty.c src/win/udp.c src/win/util.c @@ -89,7 +92,7 @@ else() src/unix ) list(APPEND uv_headers - include/uv-unix.h + include/uv/unix.h ) list(APPEND uv_sources src/unix/async.c @@ -110,7 +113,6 @@ else() src/unix/stream.c src/unix/tcp.c src/unix/thread.c - src/unix/timer.c src/unix/tty.c src/unix/udp.c ) @@ -121,7 +123,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "AIX") perfstat ) list(APPEND uv_headers - include/uv-aix.h + include/uv/aix.h ) list(APPEND uv_defines _ALL_SOURCE @@ -139,7 +141,7 @@ if(CMAKE_SYSTEM_NAME MATCHES "CYGWIN") list(APPEND uv_libraries ) list(APPEND uv_headers - include/uv-posix.h + include/uv/posix.h ) list(APPEND uv_defines ) @@ -158,8 +160,7 @@ endif() if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") list(APPEND uv_headers - include/uv-darwin.h - include/pthread-barrier.h + include/uv/darwin.h ) list(APPEND uv_defines _DARWIN_USE_64_BIT_INODE=1 @@ -178,7 +179,7 @@ endif() if(CMAKE_SYSTEM_NAME STREQUAL "Linux") list(APPEND uv_libraries dl rt) list(APPEND uv_headers - include/uv-linux.h + include/uv/linux.h ) list(APPEND uv_defines _GNU_SOURCE) list(APPEND uv_sources @@ -198,10 +199,11 @@ if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") kvm ) list(APPEND uv_headers - include/uv-bsd.h + include/uv/bsd.h ) list(APPEND uv_sources src/unix/bsd-ifaddrs.c + src/unix/bsd-proctitle.c src/unix/freebsd.c src/unix/kqueue.c src/unix/posix-hrtime.c @@ -214,10 +216,11 @@ if(CMAKE_SYSTEM_NAME STREQUAL "kFreeBSD") kvm ) list(APPEND uv_headers - include/uv-bsd.h + include/uv/bsd.h ) list(APPEND uv_sources src/unix/bsd-ifaddrs.c + src/unix/bsd-proctitle.c src/unix/freebsd.c src/unix/kqueue.c src/unix/posix-hrtime.c @@ -229,10 +232,11 @@ if(CMAKE_SYSTEM_NAME STREQUAL "NetBSD") kvm ) list(APPEND uv_headers - include/uv-bsd.h + include/uv/bsd.h ) list(APPEND uv_sources src/unix/bsd-ifaddrs.c + src/unix/bsd-proctitle.c src/unix/netbsd.c src/unix/kqueue.c src/unix/posix-hrtime.c @@ -244,10 +248,11 @@ if(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") kvm ) list(APPEND uv_headers - include/uv-bsd.h + include/uv/bsd.h ) list(APPEND uv_sources src/unix/bsd-ifaddrs.c + src/unix/bsd-proctitle.c src/unix/openbsd.c src/unix/kqueue.c src/unix/posix-hrtime.c @@ -263,7 +268,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "SunOS") rt ) list(APPEND uv_headers - include/uv-sunos.h + include/uv/sunos.h ) list(APPEND uv_defines __EXTENSIONS__ diff --git a/Utilities/cmlibuv/src/unix/cmake-bootstrap.c b/Utilities/cmlibuv/src/unix/cmake-bootstrap.c index 4f32d03..309ec79 100644 --- a/Utilities/cmlibuv/src/unix/cmake-bootstrap.c +++ b/Utilities/cmlibuv/src/unix/cmake-bootstrap.c @@ -46,6 +46,7 @@ void uv__async_stop(uv_loop_t* loop) { } void uv__work_submit(uv_loop_t* loop, struct uv__work* w, + enum uv__work_kind kind, void (*work)(struct uv__work* w), void (*done)(struct uv__work* w, int status)) { abort(); diff --git a/bootstrap b/bootstrap index dcc3a83..901bc10 100755 --- a/bootstrap +++ b/bootstrap @@ -491,8 +491,11 @@ KWSYS_FILES="\ if ${cmake_system_mingw}; then LIBUV_C_SOURCES="\ src/fs-poll.c \ + src/idna.c src/inet.c \ src/threadpool.c \ + src/strscpy.c \ + src/timer.c \ src/uv-common.c \ src/win/async.c \ src/win/core.c \ @@ -509,12 +512,10 @@ if ${cmake_system_mingw}; then src/win/poll.c \ src/win/process-stdio.c \ src/win/process.c \ - src/win/req.c \ src/win/signal.c \ src/win/stream.c \ src/win/tcp.c \ src/win/thread.c \ - src/win/timer.c \ src/win/tty.c \ src/win/udp.c \ src/win/util.c \ @@ -523,6 +524,8 @@ if ${cmake_system_mingw}; then " else LIBUV_C_SOURCES="\ + src/strscpy.c \ + src/timer.c \ src/uv-common.c \ src/unix/cmake-bootstrap.c \ src/unix/core.c \ @@ -537,7 +540,6 @@ else src/unix/process.c \ src/unix/signal.c \ src/unix/stream.c \ - src/unix/timer.c \ " fi https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1136275ae16cb0cc182e50f73d646445580b2634 commit 1136275ae16cb0cc182e50f73d646445580b2634 Author: Brad King AuthorDate: Thu Jan 17 10:20:58 2019 -0500 Commit: Brad King CommitDate: Thu Jan 17 10:27:14 2019 -0500 libuv: Include uv/ headers from each other without any path Headers in `uv/` can include each other without the `uv/` prefix. Using the prefix assumes that the location of `uv/` is in the include file search path, but it is possible to include `uv.h` via a longer path. diff --git a/Utilities/cmlibuv/include/uv/unix.h b/Utilities/cmlibuv/include/uv/unix.h index d10c9bd..3c1b363 100644 --- a/Utilities/cmlibuv/include/uv/unix.h +++ b/Utilities/cmlibuv/include/uv/unix.h @@ -42,32 +42,32 @@ #include #include -#include "uv/threadpool.h" +#include "threadpool.h" #ifdef CMAKE_BOOTSTRAP -# include "uv/posix.h" +# include "posix.h" #elif defined(__linux__) -# include "uv/linux.h" +# include "linux.h" #elif defined (__MVS__) -# include "uv/os390.h" +# include "os390.h" #elif defined(__PASE__) -# include "uv/posix.h" +# include "posix.h" #elif defined(_AIX) -# include "uv/aix.h" +# include "aix.h" #elif defined(__sun) -# include "uv/sunos.h" +# include "sunos.h" #elif defined(__APPLE__) -# include "uv/darwin.h" +# include "darwin.h" #elif defined(__DragonFly__) || \ defined(__FreeBSD__) || \ defined(__FreeBSD_kernel__) || \ defined(__OpenBSD__) || \ defined(__NetBSD__) -# include "uv/bsd.h" +# include "bsd.h" #elif defined(__CYGWIN__) || defined(__MSYS__) -# include "uv/posix.h" +# include "posix.h" #elif defined(__GNU__) -# include "uv/posix.h" +# include "posix.h" #endif #ifndef NI_MAXHOST diff --git a/Utilities/cmlibuv/include/uv/win.h b/Utilities/cmlibuv/include/uv/win.h index ff24ea0..f3d3809 100644 --- a/Utilities/cmlibuv/include/uv/win.h +++ b/Utilities/cmlibuv/include/uv/win.h @@ -54,13 +54,13 @@ typedef struct pollfd { #include #if defined(_MSC_VER) && _MSC_VER < 1600 -# include "uv/stdint-msvc2008.h" +# include "stdint-msvc2008.h" #else # include #endif -#include "uv/tree.h" -#include "uv/threadpool.h" +#include "tree.h" +#include "threadpool.h" #define MAX_PIPENAME_LEN 256 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1e1209729b26312cb511d5995bd57b6f5d35235e commit 1e1209729b26312cb511d5995bd57b6f5d35235e Merge: c59eae7 4fcb0d0 Author: Brad King AuthorDate: Wed Jan 16 15:00:33 2019 -0500 Commit: Brad King CommitDate: Thu Jan 17 10:26:32 2019 -0500 Merge branch 'upstream-libuv' into update-libuv * upstream-libuv: libuv 2019-01-15 (f84c5e69) diff --cc Utilities/cmlibuv/include/uv.h index 74fa00d,0000000..e6dc736 mode 100644,000000..100644 --- a/Utilities/cmlibuv/include/uv.h +++ b/Utilities/cmlibuv/include/uv.h @@@ -1,1599 -1,0 +1,1653 @@@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +/* See https://github.com/libuv/libuv#documentation for documentation. */ + +#ifndef UV_H +#define UV_H + +/* Include KWSys Large File Support configuration. */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _WIN32 + /* Windows - set up dll import/export decorators. */ +# if defined(BUILDING_UV_SHARED) + /* Building shared library. */ +# define UV_EXTERN __declspec(dllexport) +# elif defined(USING_UV_SHARED) + /* Using shared library. */ +# define UV_EXTERN __declspec(dllimport) +# else + /* Building static library. */ +# define UV_EXTERN /* nothing */ +# endif +#elif __GNUC__ >= 4 +# define UV_EXTERN __attribute__((visibility("default"))) +#else +# define UV_EXTERN /* nothing */ +#endif + - #include "uv-errno.h" - #include "uv-version.h" ++#include "uv/errno.h" ++#include "uv/version.h" +#include +#include + +#if defined(_MSC_VER) && _MSC_VER < 1600 - # include "stdint-msvc2008.h" ++# include "uv/stdint-msvc2008.h" +#else +# include +#endif + +#if defined(_WIN32) - # include "uv-win.h" ++# include "uv/win.h" +#else - # include "uv-unix.h" ++# include "uv/unix.h" +#endif + +/* Expand this list if necessary. */ +#define UV_ERRNO_MAP(XX) \ + XX(E2BIG, "argument list too long") \ + XX(EACCES, "permission denied") \ + XX(EADDRINUSE, "address already in use") \ + XX(EADDRNOTAVAIL, "address not available") \ + XX(EAFNOSUPPORT, "address family not supported") \ + XX(EAGAIN, "resource temporarily unavailable") \ + XX(EAI_ADDRFAMILY, "address family not supported") \ + XX(EAI_AGAIN, "temporary failure") \ + XX(EAI_BADFLAGS, "bad ai_flags value") \ + XX(EAI_BADHINTS, "invalid value for hints") \ + XX(EAI_CANCELED, "request canceled") \ + XX(EAI_FAIL, "permanent failure") \ + XX(EAI_FAMILY, "ai_family not supported") \ + XX(EAI_MEMORY, "out of memory") \ + XX(EAI_NODATA, "no address") \ + XX(EAI_NONAME, "unknown node or service") \ + XX(EAI_OVERFLOW, "argument buffer overflow") \ + XX(EAI_PROTOCOL, "resolved protocol is unknown") \ + XX(EAI_SERVICE, "service not available for socket type") \ + XX(EAI_SOCKTYPE, "socket type not supported") \ + XX(EALREADY, "connection already in progress") \ + XX(EBADF, "bad file descriptor") \ + XX(EBUSY, "resource busy or locked") \ + XX(ECANCELED, "operation canceled") \ + XX(ECHARSET, "invalid Unicode character") \ + XX(ECONNABORTED, "software caused connection abort") \ + XX(ECONNREFUSED, "connection refused") \ + XX(ECONNRESET, "connection reset by peer") \ + XX(EDESTADDRREQ, "destination address required") \ + XX(EEXIST, "file already exists") \ + XX(EFAULT, "bad address in system call argument") \ + XX(EFBIG, "file too large") \ + XX(EHOSTUNREACH, "host is unreachable") \ + XX(EINTR, "interrupted system call") \ + XX(EINVAL, "invalid argument") \ + XX(EIO, "i/o error") \ + XX(EISCONN, "socket is already connected") \ + XX(EISDIR, "illegal operation on a directory") \ + XX(ELOOP, "too many symbolic links encountered") \ + XX(EMFILE, "too many open files") \ + XX(EMSGSIZE, "message too long") \ + XX(ENAMETOOLONG, "name too long") \ + XX(ENETDOWN, "network is down") \ + XX(ENETUNREACH, "network is unreachable") \ + XX(ENFILE, "file table overflow") \ + XX(ENOBUFS, "no buffer space available") \ + XX(ENODEV, "no such device") \ + XX(ENOENT, "no such file or directory") \ + XX(ENOMEM, "not enough memory") \ + XX(ENONET, "machine is not on the network") \ + XX(ENOPROTOOPT, "protocol not available") \ + XX(ENOSPC, "no space left on device") \ + XX(ENOSYS, "function not implemented") \ + XX(ENOTCONN, "socket is not connected") \ + XX(ENOTDIR, "not a directory") \ + XX(ENOTEMPTY, "directory not empty") \ + XX(ENOTSOCK, "socket operation on non-socket") \ + XX(ENOTSUP, "operation not supported on socket") \ + XX(EPERM, "operation not permitted") \ + XX(EPIPE, "broken pipe") \ + XX(EPROTO, "protocol error") \ + XX(EPROTONOSUPPORT, "protocol not supported") \ + XX(EPROTOTYPE, "protocol wrong type for socket") \ + XX(ERANGE, "result too large") \ + XX(EROFS, "read-only file system") \ + XX(ESHUTDOWN, "cannot send after transport endpoint shutdown") \ + XX(ESPIPE, "invalid seek") \ + XX(ESRCH, "no such process") \ + XX(ETIMEDOUT, "connection timed out") \ + XX(ETXTBSY, "text file is busy") \ + XX(EXDEV, "cross-device link not permitted") \ + XX(UNKNOWN, "unknown error") \ + XX(EOF, "end of file") \ + XX(ENXIO, "no such device or address") \ + XX(EMLINK, "too many links") \ + XX(EHOSTDOWN, "host is down") \ + XX(EREMOTEIO, "remote I/O error") \ + XX(ENOTTY, "inappropriate ioctl for device") \ ++ XX(EFTYPE, "inappropriate file type or format") \ + +#define UV_HANDLE_TYPE_MAP(XX) \ + XX(ASYNC, async) \ + XX(CHECK, check) \ + XX(FS_EVENT, fs_event) \ + XX(FS_POLL, fs_poll) \ + XX(HANDLE, handle) \ + XX(IDLE, idle) \ + XX(NAMED_PIPE, pipe) \ + XX(POLL, poll) \ + XX(PREPARE, prepare) \ + XX(PROCESS, process) \ + XX(STREAM, stream) \ + XX(TCP, tcp) \ + XX(TIMER, timer) \ + XX(TTY, tty) \ + XX(UDP, udp) \ + XX(SIGNAL, signal) \ + +#define UV_REQ_TYPE_MAP(XX) \ + XX(REQ, req) \ + XX(CONNECT, connect) \ + XX(WRITE, write) \ + XX(SHUTDOWN, shutdown) \ + XX(UDP_SEND, udp_send) \ + XX(FS, fs) \ + XX(WORK, work) \ + XX(GETADDRINFO, getaddrinfo) \ + XX(GETNAMEINFO, getnameinfo) \ + +typedef enum { +#define XX(code, _) UV_ ## code = UV__ ## code, + UV_ERRNO_MAP(XX) +#undef XX + UV_ERRNO_MAX = UV__EOF - 1 +} uv_errno_t; + +typedef enum { + UV_UNKNOWN_HANDLE = 0, +#define XX(uc, lc) UV_##uc, + UV_HANDLE_TYPE_MAP(XX) +#undef XX + UV_FILE, + UV_HANDLE_TYPE_MAX +} uv_handle_type; + +typedef enum { + UV_UNKNOWN_REQ = 0, +#define XX(uc, lc) UV_##uc, + UV_REQ_TYPE_MAP(XX) +#undef XX + UV_REQ_TYPE_PRIVATE + UV_REQ_TYPE_MAX +} uv_req_type; + + +/* Handle types. */ +typedef struct uv_loop_s uv_loop_t; +typedef struct uv_handle_s uv_handle_t; +typedef struct uv_stream_s uv_stream_t; +typedef struct uv_tcp_s uv_tcp_t; +typedef struct uv_udp_s uv_udp_t; +typedef struct uv_pipe_s uv_pipe_t; +typedef struct uv_tty_s uv_tty_t; +typedef struct uv_poll_s uv_poll_t; +typedef struct uv_timer_s uv_timer_t; +typedef struct uv_prepare_s uv_prepare_t; +typedef struct uv_check_s uv_check_t; +typedef struct uv_idle_s uv_idle_t; +typedef struct uv_async_s uv_async_t; +typedef struct uv_process_s uv_process_t; +typedef struct uv_fs_event_s uv_fs_event_t; +typedef struct uv_fs_poll_s uv_fs_poll_t; +typedef struct uv_signal_s uv_signal_t; + +/* Request types. */ +typedef struct uv_req_s uv_req_t; +typedef struct uv_getaddrinfo_s uv_getaddrinfo_t; +typedef struct uv_getnameinfo_s uv_getnameinfo_t; +typedef struct uv_shutdown_s uv_shutdown_t; +typedef struct uv_write_s uv_write_t; +typedef struct uv_connect_s uv_connect_t; +typedef struct uv_udp_send_s uv_udp_send_t; +typedef struct uv_fs_s uv_fs_t; +typedef struct uv_work_s uv_work_t; + +/* None of the above. */ +typedef struct uv_cpu_info_s uv_cpu_info_t; +typedef struct uv_interface_address_s uv_interface_address_t; +typedef struct uv_dirent_s uv_dirent_t; +typedef struct uv_passwd_s uv_passwd_t; ++typedef struct uv_utsname_s uv_utsname_t; + +typedef enum { + UV_LOOP_BLOCK_SIGNAL +} uv_loop_option; + +typedef enum { + UV_RUN_DEFAULT = 0, + UV_RUN_ONCE, + UV_RUN_NOWAIT +} uv_run_mode; + + +UV_EXTERN unsigned int uv_version(void); +UV_EXTERN const char* uv_version_string(void); + +typedef void* (*uv_malloc_func)(size_t size); +typedef void* (*uv_realloc_func)(void* ptr, size_t size); +typedef void* (*uv_calloc_func)(size_t count, size_t size); +typedef void (*uv_free_func)(void* ptr); + +UV_EXTERN int uv_replace_allocator(uv_malloc_func malloc_func, + uv_realloc_func realloc_func, + uv_calloc_func calloc_func, + uv_free_func free_func); + +UV_EXTERN uv_loop_t* uv_default_loop(void); +UV_EXTERN int uv_loop_init(uv_loop_t* loop); +UV_EXTERN int uv_loop_close(uv_loop_t* loop); +/* + * NOTE: + * This function is DEPRECATED (to be removed after 0.12), users should + * allocate the loop manually and use uv_loop_init instead. + */ +UV_EXTERN uv_loop_t* uv_loop_new(void); +/* + * NOTE: + * This function is DEPRECATED (to be removed after 0.12). Users should use + * uv_loop_close and free the memory manually instead. + */ +UV_EXTERN void uv_loop_delete(uv_loop_t*); +UV_EXTERN size_t uv_loop_size(void); +UV_EXTERN int uv_loop_alive(const uv_loop_t* loop); +UV_EXTERN int uv_loop_configure(uv_loop_t* loop, uv_loop_option option, ...); +UV_EXTERN int uv_loop_fork(uv_loop_t* loop); + +UV_EXTERN int uv_run(uv_loop_t*, uv_run_mode mode); +UV_EXTERN void uv_stop(uv_loop_t*); + +UV_EXTERN void uv_ref(uv_handle_t*); +UV_EXTERN void uv_unref(uv_handle_t*); +UV_EXTERN int uv_has_ref(const uv_handle_t*); + +UV_EXTERN void uv_update_time(uv_loop_t*); +UV_EXTERN uint64_t uv_now(const uv_loop_t*); + +UV_EXTERN int uv_backend_fd(const uv_loop_t*); +UV_EXTERN int uv_backend_timeout(const uv_loop_t*); + +typedef void (*uv_alloc_cb)(uv_handle_t* handle, + size_t suggested_size, + uv_buf_t* buf); +typedef void (*uv_read_cb)(uv_stream_t* stream, + ssize_t nread, + const uv_buf_t* buf); +typedef void (*uv_write_cb)(uv_write_t* req, int status); +typedef void (*uv_connect_cb)(uv_connect_t* req, int status); +typedef void (*uv_shutdown_cb)(uv_shutdown_t* req, int status); +typedef void (*uv_connection_cb)(uv_stream_t* server, int status); +typedef void (*uv_close_cb)(uv_handle_t* handle); +typedef void (*uv_poll_cb)(uv_poll_t* handle, int status, int events); +typedef void (*uv_timer_cb)(uv_timer_t* handle); +typedef void (*uv_async_cb)(uv_async_t* handle); +typedef void (*uv_prepare_cb)(uv_prepare_t* handle); +typedef void (*uv_check_cb)(uv_check_t* handle); +typedef void (*uv_idle_cb)(uv_idle_t* handle); +typedef void (*uv_exit_cb)(uv_process_t*, int64_t exit_status, int term_signal); +typedef void (*uv_walk_cb)(uv_handle_t* handle, void* arg); +typedef void (*uv_fs_cb)(uv_fs_t* req); +typedef void (*uv_work_cb)(uv_work_t* req); +typedef void (*uv_after_work_cb)(uv_work_t* req, int status); +typedef void (*uv_getaddrinfo_cb)(uv_getaddrinfo_t* req, + int status, + struct addrinfo* res); +typedef void (*uv_getnameinfo_cb)(uv_getnameinfo_t* req, + int status, + const char* hostname, + const char* service); + +typedef struct { + long tv_sec; + long tv_nsec; +} uv_timespec_t; + + +typedef struct { + uint64_t st_dev; + uint64_t st_mode; + uint64_t st_nlink; + uint64_t st_uid; + uint64_t st_gid; + uint64_t st_rdev; + uint64_t st_ino; + uint64_t st_size; + uint64_t st_blksize; + uint64_t st_blocks; + uint64_t st_flags; + uint64_t st_gen; + uv_timespec_t st_atim; + uv_timespec_t st_mtim; + uv_timespec_t st_ctim; + uv_timespec_t st_birthtim; +} uv_stat_t; + + +typedef void (*uv_fs_event_cb)(uv_fs_event_t* handle, + const char* filename, + int events, + int status); + +typedef void (*uv_fs_poll_cb)(uv_fs_poll_t* handle, + int status, + const uv_stat_t* prev, + const uv_stat_t* curr); + +typedef void (*uv_signal_cb)(uv_signal_t* handle, int signum); + + +typedef enum { + UV_LEAVE_GROUP = 0, + UV_JOIN_GROUP +} uv_membership; + + +UV_EXTERN int uv_translate_sys_error(int sys_errno); + +UV_EXTERN const char* uv_strerror(int err); ++UV_EXTERN char* uv_strerror_r(int err, char* buf, size_t buflen); ++ +UV_EXTERN const char* uv_err_name(int err); ++UV_EXTERN char* uv_err_name_r(int err, char* buf, size_t buflen); + + +#define UV_REQ_FIELDS \ + /* public */ \ + void* data; \ + /* read-only */ \ + uv_req_type type; \ + /* private */ \ + void* reserved[6]; \ + UV_REQ_PRIVATE_FIELDS \ + +/* Abstract base class of all requests. */ +struct uv_req_s { + UV_REQ_FIELDS +}; + + +/* Platform-specific request types. */ +UV_PRIVATE_REQ_TYPES + + +UV_EXTERN int uv_shutdown(uv_shutdown_t* req, + uv_stream_t* handle, + uv_shutdown_cb cb); + +struct uv_shutdown_s { + UV_REQ_FIELDS + uv_stream_t* handle; + uv_shutdown_cb cb; + UV_SHUTDOWN_PRIVATE_FIELDS +}; + + +#define UV_HANDLE_FIELDS \ + /* public */ \ + void* data; \ + /* read-only */ \ + uv_loop_t* loop; \ + uv_handle_type type; \ + /* private */ \ + uv_close_cb close_cb; \ + void* handle_queue[2]; \ + union { \ + int fd; \ + void* reserved[4]; \ + } u; \ + UV_HANDLE_PRIVATE_FIELDS \ + +/* The abstract base class of all handles. */ +struct uv_handle_s { + UV_HANDLE_FIELDS +}; + +UV_EXTERN size_t uv_handle_size(uv_handle_type type); +UV_EXTERN uv_handle_type uv_handle_get_type(const uv_handle_t* handle); +UV_EXTERN const char* uv_handle_type_name(uv_handle_type type); +UV_EXTERN void* uv_handle_get_data(const uv_handle_t* handle); +UV_EXTERN uv_loop_t* uv_handle_get_loop(const uv_handle_t* handle); +UV_EXTERN void uv_handle_set_data(uv_handle_t* handle, void* data); + +UV_EXTERN size_t uv_req_size(uv_req_type type); +UV_EXTERN void* uv_req_get_data(const uv_req_t* req); +UV_EXTERN void uv_req_set_data(uv_req_t* req, void* data); +UV_EXTERN uv_req_type uv_req_get_type(const uv_req_t* req); +UV_EXTERN const char* uv_req_type_name(uv_req_type type); + +UV_EXTERN int uv_is_active(const uv_handle_t* handle); + +UV_EXTERN void uv_walk(uv_loop_t* loop, uv_walk_cb walk_cb, void* arg); + +/* Helpers for ad hoc debugging, no API/ABI stability guaranteed. */ +UV_EXTERN void uv_print_all_handles(uv_loop_t* loop, FILE* stream); +UV_EXTERN void uv_print_active_handles(uv_loop_t* loop, FILE* stream); + +UV_EXTERN void uv_close(uv_handle_t* handle, uv_close_cb close_cb); + +UV_EXTERN int uv_send_buffer_size(uv_handle_t* handle, int* value); +UV_EXTERN int uv_recv_buffer_size(uv_handle_t* handle, int* value); + +UV_EXTERN int uv_fileno(const uv_handle_t* handle, uv_os_fd_t* fd); + +UV_EXTERN uv_buf_t uv_buf_init(char* base, unsigned int len); + + +#define UV_STREAM_FIELDS \ + /* number of bytes queued for writing */ \ + size_t write_queue_size; \ + uv_alloc_cb alloc_cb; \ + uv_read_cb read_cb; \ + /* private */ \ + UV_STREAM_PRIVATE_FIELDS + +/* + * uv_stream_t is a subclass of uv_handle_t. + * + * uv_stream is an abstract class. + * + * uv_stream_t is the parent class of uv_tcp_t, uv_pipe_t and uv_tty_t. + */ +struct uv_stream_s { + UV_HANDLE_FIELDS + UV_STREAM_FIELDS +}; + +UV_EXTERN size_t uv_stream_get_write_queue_size(const uv_stream_t* stream); + +UV_EXTERN int uv_listen(uv_stream_t* stream, int backlog, uv_connection_cb cb); +UV_EXTERN int uv_accept(uv_stream_t* server, uv_stream_t* client); + +UV_EXTERN int uv_read_start(uv_stream_t*, + uv_alloc_cb alloc_cb, + uv_read_cb read_cb); +UV_EXTERN int uv_read_stop(uv_stream_t*); + +UV_EXTERN int uv_write(uv_write_t* req, + uv_stream_t* handle, + const uv_buf_t bufs[], + unsigned int nbufs, + uv_write_cb cb); +UV_EXTERN int uv_write2(uv_write_t* req, + uv_stream_t* handle, + const uv_buf_t bufs[], + unsigned int nbufs, + uv_stream_t* send_handle, + uv_write_cb cb); +UV_EXTERN int uv_try_write(uv_stream_t* handle, + const uv_buf_t bufs[], + unsigned int nbufs); + +/* uv_write_t is a subclass of uv_req_t. */ +struct uv_write_s { + UV_REQ_FIELDS + uv_write_cb cb; - uv_stream_t* send_handle; ++ uv_stream_t* send_handle; /* TODO: make private and unix-only in v2.x. */ + uv_stream_t* handle; + UV_WRITE_PRIVATE_FIELDS +}; + + +UV_EXTERN int uv_is_readable(const uv_stream_t* handle); +UV_EXTERN int uv_is_writable(const uv_stream_t* handle); + +UV_EXTERN int uv_stream_set_blocking(uv_stream_t* handle, int blocking); + +UV_EXTERN int uv_is_closing(const uv_handle_t* handle); + + +/* + * uv_tcp_t is a subclass of uv_stream_t. + * + * Represents a TCP stream or TCP server. + */ +struct uv_tcp_s { + UV_HANDLE_FIELDS + UV_STREAM_FIELDS + UV_TCP_PRIVATE_FIELDS +}; + +UV_EXTERN int uv_tcp_init(uv_loop_t*, uv_tcp_t* handle); +UV_EXTERN int uv_tcp_init_ex(uv_loop_t*, uv_tcp_t* handle, unsigned int flags); +UV_EXTERN int uv_tcp_open(uv_tcp_t* handle, uv_os_sock_t sock); +UV_EXTERN int uv_tcp_nodelay(uv_tcp_t* handle, int enable); +UV_EXTERN int uv_tcp_keepalive(uv_tcp_t* handle, + int enable, + unsigned int delay); +UV_EXTERN int uv_tcp_simultaneous_accepts(uv_tcp_t* handle, int enable); + +enum uv_tcp_flags { + /* Used with uv_tcp_bind, when an IPv6 address is used. */ + UV_TCP_IPV6ONLY = 1 +}; + +UV_EXTERN int uv_tcp_bind(uv_tcp_t* handle, + const struct sockaddr* addr, + unsigned int flags); +UV_EXTERN int uv_tcp_getsockname(const uv_tcp_t* handle, + struct sockaddr* name, + int* namelen); +UV_EXTERN int uv_tcp_getpeername(const uv_tcp_t* handle, + struct sockaddr* name, + int* namelen); +UV_EXTERN int uv_tcp_connect(uv_connect_t* req, + uv_tcp_t* handle, + const struct sockaddr* addr, + uv_connect_cb cb); + +/* uv_connect_t is a subclass of uv_req_t. */ +struct uv_connect_s { + UV_REQ_FIELDS + uv_connect_cb cb; + uv_stream_t* handle; + UV_CONNECT_PRIVATE_FIELDS +}; + + +/* + * UDP support. + */ + +enum uv_udp_flags { + /* Disables dual stack mode. */ + UV_UDP_IPV6ONLY = 1, + /* + * Indicates message was truncated because read buffer was too small. The + * remainder was discarded by the OS. Used in uv_udp_recv_cb. + */ + UV_UDP_PARTIAL = 2, + /* + * Indicates if SO_REUSEADDR will be set when binding the handle. + * This sets the SO_REUSEPORT socket flag on the BSDs and OS X. On other + * Unix platforms, it sets the SO_REUSEADDR flag. What that means is that + * multiple threads or processes can bind to the same address without error + * (provided they all set the flag) but only the last one to bind will receive + * any traffic, in effect "stealing" the port from the previous listener. + */ + UV_UDP_REUSEADDR = 4 +}; + +typedef void (*uv_udp_send_cb)(uv_udp_send_t* req, int status); +typedef void (*uv_udp_recv_cb)(uv_udp_t* handle, + ssize_t nread, + const uv_buf_t* buf, + const struct sockaddr* addr, + unsigned flags); + +/* uv_udp_t is a subclass of uv_handle_t. */ +struct uv_udp_s { + UV_HANDLE_FIELDS + /* read-only */ + /* + * Number of bytes queued for sending. This field strictly shows how much + * information is currently queued. + */ + size_t send_queue_size; + /* + * Number of send requests currently in the queue awaiting to be processed. + */ + size_t send_queue_count; + UV_UDP_PRIVATE_FIELDS +}; + +/* uv_udp_send_t is a subclass of uv_req_t. */ +struct uv_udp_send_s { + UV_REQ_FIELDS + uv_udp_t* handle; + uv_udp_send_cb cb; + UV_UDP_SEND_PRIVATE_FIELDS +}; + +UV_EXTERN int uv_udp_init(uv_loop_t*, uv_udp_t* handle); +UV_EXTERN int uv_udp_init_ex(uv_loop_t*, uv_udp_t* handle, unsigned int flags); +UV_EXTERN int uv_udp_open(uv_udp_t* handle, uv_os_sock_t sock); +UV_EXTERN int uv_udp_bind(uv_udp_t* handle, + const struct sockaddr* addr, + unsigned int flags); + +UV_EXTERN int uv_udp_getsockname(const uv_udp_t* handle, + struct sockaddr* name, + int* namelen); +UV_EXTERN int uv_udp_set_membership(uv_udp_t* handle, + const char* multicast_addr, + const char* interface_addr, + uv_membership membership); +UV_EXTERN int uv_udp_set_multicast_loop(uv_udp_t* handle, int on); +UV_EXTERN int uv_udp_set_multicast_ttl(uv_udp_t* handle, int ttl); +UV_EXTERN int uv_udp_set_multicast_interface(uv_udp_t* handle, + const char* interface_addr); +UV_EXTERN int uv_udp_set_broadcast(uv_udp_t* handle, int on); +UV_EXTERN int uv_udp_set_ttl(uv_udp_t* handle, int ttl); +UV_EXTERN int uv_udp_send(uv_udp_send_t* req, + uv_udp_t* handle, + const uv_buf_t bufs[], + unsigned int nbufs, + const struct sockaddr* addr, + uv_udp_send_cb send_cb); +UV_EXTERN int uv_udp_try_send(uv_udp_t* handle, + const uv_buf_t bufs[], + unsigned int nbufs, + const struct sockaddr* addr); +UV_EXTERN int uv_udp_recv_start(uv_udp_t* handle, + uv_alloc_cb alloc_cb, + uv_udp_recv_cb recv_cb); +UV_EXTERN int uv_udp_recv_stop(uv_udp_t* handle); +UV_EXTERN size_t uv_udp_get_send_queue_size(const uv_udp_t* handle); +UV_EXTERN size_t uv_udp_get_send_queue_count(const uv_udp_t* handle); + + +/* + * uv_tty_t is a subclass of uv_stream_t. + * + * Representing a stream for the console. + */ +struct uv_tty_s { + UV_HANDLE_FIELDS + UV_STREAM_FIELDS + UV_TTY_PRIVATE_FIELDS +}; + +typedef enum { + /* Initial/normal terminal mode */ + UV_TTY_MODE_NORMAL, + /* Raw input mode (On Windows, ENABLE_WINDOW_INPUT is also enabled) */ + UV_TTY_MODE_RAW, + /* Binary-safe I/O mode for IPC (Unix-only) */ + UV_TTY_MODE_IO +} uv_tty_mode_t; + +UV_EXTERN int uv_tty_init(uv_loop_t*, uv_tty_t*, uv_file fd, int readable); +UV_EXTERN int uv_tty_set_mode(uv_tty_t*, uv_tty_mode_t mode); +UV_EXTERN int uv_tty_reset_mode(void); +UV_EXTERN int uv_tty_get_winsize(uv_tty_t*, int* width, int* height); + +#ifdef __cplusplus +extern "C++" { + +inline int uv_tty_set_mode(uv_tty_t* handle, int mode) { + return uv_tty_set_mode(handle, static_cast(mode)); +} + +} +#endif + +UV_EXTERN uv_handle_type uv_guess_handle(uv_file file); + +/* + * uv_pipe_t is a subclass of uv_stream_t. + * + * Representing a pipe stream or pipe server. On Windows this is a Named + * Pipe. On Unix this is a Unix domain socket. + */ +struct uv_pipe_s { + UV_HANDLE_FIELDS + UV_STREAM_FIELDS + int ipc; /* non-zero if this pipe is used for passing handles */ + UV_PIPE_PRIVATE_FIELDS +}; + +UV_EXTERN int uv_pipe_init(uv_loop_t*, uv_pipe_t* handle, int ipc); +UV_EXTERN int uv_pipe_open(uv_pipe_t*, uv_file file); +UV_EXTERN int uv_pipe_bind(uv_pipe_t* handle, const char* name); +UV_EXTERN void uv_pipe_connect(uv_connect_t* req, + uv_pipe_t* handle, + const char* name, + uv_connect_cb cb); +UV_EXTERN int uv_pipe_getsockname(const uv_pipe_t* handle, + char* buffer, + size_t* size); +UV_EXTERN int uv_pipe_getpeername(const uv_pipe_t* handle, + char* buffer, + size_t* size); +UV_EXTERN void uv_pipe_pending_instances(uv_pipe_t* handle, int count); +UV_EXTERN int uv_pipe_pending_count(uv_pipe_t* handle); +UV_EXTERN uv_handle_type uv_pipe_pending_type(uv_pipe_t* handle); +UV_EXTERN int uv_pipe_chmod(uv_pipe_t* handle, int flags); + + +struct uv_poll_s { + UV_HANDLE_FIELDS + uv_poll_cb poll_cb; + UV_POLL_PRIVATE_FIELDS +}; + +enum uv_poll_event { + UV_READABLE = 1, + UV_WRITABLE = 2, + UV_DISCONNECT = 4, + UV_PRIORITIZED = 8 +}; + +UV_EXTERN int uv_poll_init(uv_loop_t* loop, uv_poll_t* handle, int fd); +UV_EXTERN int uv_poll_init_socket(uv_loop_t* loop, + uv_poll_t* handle, + uv_os_sock_t socket); +UV_EXTERN int uv_poll_start(uv_poll_t* handle, int events, uv_poll_cb cb); +UV_EXTERN int uv_poll_stop(uv_poll_t* handle); + + +struct uv_prepare_s { + UV_HANDLE_FIELDS + UV_PREPARE_PRIVATE_FIELDS +}; + +UV_EXTERN int uv_prepare_init(uv_loop_t*, uv_prepare_t* prepare); +UV_EXTERN int uv_prepare_start(uv_prepare_t* prepare, uv_prepare_cb cb); +UV_EXTERN int uv_prepare_stop(uv_prepare_t* prepare); + + +struct uv_check_s { + UV_HANDLE_FIELDS + UV_CHECK_PRIVATE_FIELDS +}; + +UV_EXTERN int uv_check_init(uv_loop_t*, uv_check_t* check); +UV_EXTERN int uv_check_start(uv_check_t* check, uv_check_cb cb); +UV_EXTERN int uv_check_stop(uv_check_t* check); + + +struct uv_idle_s { + UV_HANDLE_FIELDS + UV_IDLE_PRIVATE_FIELDS +}; + +UV_EXTERN int uv_idle_init(uv_loop_t*, uv_idle_t* idle); +UV_EXTERN int uv_idle_start(uv_idle_t* idle, uv_idle_cb cb); +UV_EXTERN int uv_idle_stop(uv_idle_t* idle); + + +struct uv_async_s { + UV_HANDLE_FIELDS + UV_ASYNC_PRIVATE_FIELDS +}; + +UV_EXTERN int uv_async_init(uv_loop_t*, + uv_async_t* async, + uv_async_cb async_cb); +UV_EXTERN int uv_async_send(uv_async_t* async); + + +/* + * uv_timer_t is a subclass of uv_handle_t. + * + * Used to get woken up at a specified time in the future. + */ +struct uv_timer_s { + UV_HANDLE_FIELDS + UV_TIMER_PRIVATE_FIELDS +}; + +UV_EXTERN int uv_timer_init(uv_loop_t*, uv_timer_t* handle); +UV_EXTERN int uv_timer_start(uv_timer_t* handle, + uv_timer_cb cb, + uint64_t timeout, + uint64_t repeat); +UV_EXTERN int uv_timer_stop(uv_timer_t* handle); +UV_EXTERN int uv_timer_again(uv_timer_t* handle); +UV_EXTERN void uv_timer_set_repeat(uv_timer_t* handle, uint64_t repeat); +UV_EXTERN uint64_t uv_timer_get_repeat(const uv_timer_t* handle); + + +/* + * uv_getaddrinfo_t is a subclass of uv_req_t. + * + * Request object for uv_getaddrinfo. + */ +struct uv_getaddrinfo_s { + UV_REQ_FIELDS + /* read-only */ + uv_loop_t* loop; + /* struct addrinfo* addrinfo is marked as private, but it really isn't. */ + UV_GETADDRINFO_PRIVATE_FIELDS +}; + + +UV_EXTERN int uv_getaddrinfo(uv_loop_t* loop, + uv_getaddrinfo_t* req, + uv_getaddrinfo_cb getaddrinfo_cb, + const char* node, + const char* service, + const struct addrinfo* hints); +UV_EXTERN void uv_freeaddrinfo(struct addrinfo* ai); + + +/* +* uv_getnameinfo_t is a subclass of uv_req_t. +* +* Request object for uv_getnameinfo. +*/ +struct uv_getnameinfo_s { + UV_REQ_FIELDS + /* read-only */ + uv_loop_t* loop; + /* host and service are marked as private, but they really aren't. */ + UV_GETNAMEINFO_PRIVATE_FIELDS +}; + +UV_EXTERN int uv_getnameinfo(uv_loop_t* loop, + uv_getnameinfo_t* req, + uv_getnameinfo_cb getnameinfo_cb, + const struct sockaddr* addr, + int flags); + + +/* uv_spawn() options. */ +typedef enum { + UV_IGNORE = 0x00, + UV_CREATE_PIPE = 0x01, + UV_INHERIT_FD = 0x02, + UV_INHERIT_STREAM = 0x04, + + /* + * When UV_CREATE_PIPE is specified, UV_READABLE_PIPE and UV_WRITABLE_PIPE + * determine the direction of flow, from the child process' perspective. Both + * flags may be specified to create a duplex data stream. + */ + UV_READABLE_PIPE = 0x10, - UV_WRITABLE_PIPE = 0x20 ++ UV_WRITABLE_PIPE = 0x20, ++ ++ /* ++ * Open the child pipe handle in overlapped mode on Windows. ++ * On Unix it is silently ignored. ++ */ ++ UV_OVERLAPPED_PIPE = 0x40 +} uv_stdio_flags; + +typedef struct uv_stdio_container_s { + uv_stdio_flags flags; + + union { + uv_stream_t* stream; + int fd; + } data; +} uv_stdio_container_t; + +typedef struct uv_process_options_s { + uv_exit_cb exit_cb; /* Called after the process exits. */ + const char* file; /* Path to program to execute. */ + /* + * Command line arguments. args[0] should be the path to the program. On + * Windows this uses CreateProcess which concatenates the arguments into a + * string this can cause some strange errors. See the note at + * windows_verbatim_arguments. + */ + char** args; + /* + * This will be set as the environ variable in the subprocess. If this is + * NULL then the parents environ will be used. + */ + char** env; + /* + * If non-null this represents a directory the subprocess should execute + * in. Stands for current working directory. + */ + const char* cwd; + /* + * Various flags that control how uv_spawn() behaves. See the definition of + * `enum uv_process_flags` below. + */ + unsigned int flags; + /* + * The `stdio` field points to an array of uv_stdio_container_t structs that + * describe the file descriptors that will be made available to the child + * process. The convention is that stdio[0] points to stdin, fd 1 is used for + * stdout, and fd 2 is stderr. + * + * Note that on windows file descriptors greater than 2 are available to the + * child process only if the child processes uses the MSVCRT runtime. + */ + int stdio_count; + uv_stdio_container_t* stdio; + /* + * Libuv can change the child process' user/group id. This happens only when + * the appropriate bits are set in the flags fields. This is not supported on + * windows; uv_spawn() will fail and set the error to UV_ENOTSUP. + */ + uv_uid_t uid; + uv_gid_t gid; + /* + Libuv can set the child process' CPU affinity mask. This happens when + `cpumask` is non-NULL. It must point to an array of char values + of length `cpumask_size`, whose value must be at least that returned by + uv_cpumask_size(). Each byte in the mask can be either zero (false) + or non-zero (true) to indicate whether the corresponding processor at + that index is included. + + If enabled on an unsupported platform, uv_spawn() will fail with + UV_ENOTSUP. + */ + char* cpumask; + size_t cpumask_size; +} uv_process_options_t; + +/* + * These are the flags that can be used for the uv_process_options.flags field. + */ +enum uv_process_flags { + /* + * Set the child process' user id. The user id is supplied in the `uid` field + * of the options struct. This does not work on windows; setting this flag + * will cause uv_spawn() to fail. + */ + UV_PROCESS_SETUID = (1 << 0), + /* + * Set the child process' group id. The user id is supplied in the `gid` + * field of the options struct. This does not work on windows; setting this + * flag will cause uv_spawn() to fail. + */ + UV_PROCESS_SETGID = (1 << 1), + /* + * Do not wrap any arguments in quotes, or perform any other escaping, when + * converting the argument list into a command line string. This option is + * only meaningful on Windows systems. On Unix it is silently ignored. + */ + UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS = (1 << 2), + /* + * Spawn the child process in a detached state - this will make it a process + * group leader, and will effectively enable the child to keep running after + * the parent exits. Note that the child process will still keep the + * parent's event loop alive unless the parent process calls uv_unref() on + * the child's process handle. + */ + UV_PROCESS_DETACHED = (1 << 3), + /* ++ * Hide the subprocess window that would normally be created. This option is ++ * only meaningful on Windows systems. On Unix it is silently ignored. ++ */ ++ UV_PROCESS_WINDOWS_HIDE = (1 << 4), ++ /* + * Hide the subprocess console window that would normally be created. This + * option is only meaningful on Windows systems. On Unix it is silently + * ignored. + */ - UV_PROCESS_WINDOWS_HIDE = (1 << 4) ++ UV_PROCESS_WINDOWS_HIDE_CONSOLE = (1 << 5), ++ /* ++ * Hide the subprocess GUI window that would normally be created. This ++ * option is only meaningful on Windows systems. On Unix it is silently ++ * ignored. ++ */ ++ UV_PROCESS_WINDOWS_HIDE_GUI = (1 << 6) +}; + +/* + * uv_process_t is a subclass of uv_handle_t. + */ +struct uv_process_s { + UV_HANDLE_FIELDS + uv_exit_cb exit_cb; + int pid; + UV_PROCESS_PRIVATE_FIELDS +}; + +UV_EXTERN int uv_spawn(uv_loop_t* loop, + uv_process_t* handle, + const uv_process_options_t* options); +UV_EXTERN int uv_process_kill(uv_process_t*, int signum); +UV_EXTERN int uv_kill(int pid, int signum); +UV_EXTERN uv_pid_t uv_process_get_pid(const uv_process_t*); + + +/* + * uv_work_t is a subclass of uv_req_t. + */ +struct uv_work_s { + UV_REQ_FIELDS + uv_loop_t* loop; + uv_work_cb work_cb; + uv_after_work_cb after_work_cb; + UV_WORK_PRIVATE_FIELDS +}; + +UV_EXTERN int uv_queue_work(uv_loop_t* loop, + uv_work_t* req, + uv_work_cb work_cb, + uv_after_work_cb after_work_cb); + +UV_EXTERN int uv_cancel(uv_req_t* req); + + ++struct uv_cpu_times_s { ++ uint64_t user; ++ uint64_t nice; ++ uint64_t sys; ++ uint64_t idle; ++ uint64_t irq; ++}; ++ +struct uv_cpu_info_s { + char* model; + int speed; - struct uv_cpu_times_s { - uint64_t user; - uint64_t nice; - uint64_t sys; - uint64_t idle; - uint64_t irq; - } cpu_times; ++ struct uv_cpu_times_s cpu_times; +}; + +struct uv_interface_address_s { + char* name; + char phys_addr[6]; + int is_internal; + union { + struct sockaddr_in address4; + struct sockaddr_in6 address6; + } address; + union { + struct sockaddr_in netmask4; + struct sockaddr_in6 netmask6; + } netmask; +}; + +struct uv_passwd_s { + char* username; + long uid; + long gid; + char* shell; + char* homedir; +}; + ++struct uv_utsname_s { ++ char sysname[256]; ++ char release[256]; ++ char version[256]; ++ char machine[256]; ++ /* This struct does not contain the nodename and domainname fields present in ++ the utsname type. domainname is a GNU extension. Both fields are referred ++ to as meaningless in the docs. */ ++}; ++ +typedef enum { + UV_DIRENT_UNKNOWN, + UV_DIRENT_FILE, + UV_DIRENT_DIR, + UV_DIRENT_LINK, + UV_DIRENT_FIFO, + UV_DIRENT_SOCKET, + UV_DIRENT_CHAR, + UV_DIRENT_BLOCK +} uv_dirent_type_t; + +struct uv_dirent_s { + const char* name; + uv_dirent_type_t type; +}; + +UV_EXTERN char** uv_setup_args(int argc, char** argv); +UV_EXTERN int uv_get_process_title(char* buffer, size_t size); +UV_EXTERN int uv_set_process_title(const char* title); +UV_EXTERN int uv_resident_set_memory(size_t* rss); +UV_EXTERN int uv_uptime(double* uptime); +UV_EXTERN uv_os_fd_t uv_get_osfhandle(int fd); ++UV_EXTERN int uv_open_osfhandle(uv_os_fd_t os_fd); + +typedef struct { + long tv_sec; + long tv_usec; +} uv_timeval_t; + +typedef struct { + uv_timeval_t ru_utime; /* user CPU time used */ + uv_timeval_t ru_stime; /* system CPU time used */ + uint64_t ru_maxrss; /* maximum resident set size */ + uint64_t ru_ixrss; /* integral shared memory size */ + uint64_t ru_idrss; /* integral unshared data size */ + uint64_t ru_isrss; /* integral unshared stack size */ + uint64_t ru_minflt; /* page reclaims (soft page faults) */ + uint64_t ru_majflt; /* page faults (hard page faults) */ + uint64_t ru_nswap; /* swaps */ + uint64_t ru_inblock; /* block input operations */ + uint64_t ru_oublock; /* block output operations */ + uint64_t ru_msgsnd; /* IPC messages sent */ + uint64_t ru_msgrcv; /* IPC messages received */ + uint64_t ru_nsignals; /* signals received */ + uint64_t ru_nvcsw; /* voluntary context switches */ + uint64_t ru_nivcsw; /* involuntary context switches */ +} uv_rusage_t; + +UV_EXTERN int uv_getrusage(uv_rusage_t* rusage); + +UV_EXTERN int uv_os_homedir(char* buffer, size_t* size); +UV_EXTERN int uv_os_tmpdir(char* buffer, size_t* size); +UV_EXTERN int uv_os_get_passwd(uv_passwd_t* pwd); +UV_EXTERN void uv_os_free_passwd(uv_passwd_t* pwd); +UV_EXTERN uv_pid_t uv_os_getpid(void); +UV_EXTERN uv_pid_t uv_os_getppid(void); + ++#define UV_PRIORITY_LOW 19 ++#define UV_PRIORITY_BELOW_NORMAL 10 ++#define UV_PRIORITY_NORMAL 0 ++#define UV_PRIORITY_ABOVE_NORMAL -7 ++#define UV_PRIORITY_HIGH -14 ++#define UV_PRIORITY_HIGHEST -20 ++ ++UV_EXTERN int uv_os_getpriority(uv_pid_t pid, int* priority); ++UV_EXTERN int uv_os_setpriority(uv_pid_t pid, int priority); ++ +UV_EXTERN int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count); +UV_EXTERN void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count); +UV_EXTERN int uv_cpumask_size(void); + +UV_EXTERN int uv_interface_addresses(uv_interface_address_t** addresses, + int* count); +UV_EXTERN void uv_free_interface_addresses(uv_interface_address_t* addresses, + int count); + +UV_EXTERN int uv_os_getenv(const char* name, char* buffer, size_t* size); +UV_EXTERN int uv_os_setenv(const char* name, const char* value); +UV_EXTERN int uv_os_unsetenv(const char* name); + +UV_EXTERN int uv_os_gethostname(char* buffer, size_t* size); + ++UV_EXTERN int uv_os_uname(uv_utsname_t* buffer); ++ + +typedef enum { + UV_FS_UNKNOWN = -1, + UV_FS_CUSTOM, + UV_FS_OPEN, + UV_FS_CLOSE, + UV_FS_READ, + UV_FS_WRITE, + UV_FS_SENDFILE, + UV_FS_STAT, + UV_FS_LSTAT, + UV_FS_FSTAT, + UV_FS_FTRUNCATE, + UV_FS_UTIME, + UV_FS_FUTIME, + UV_FS_ACCESS, + UV_FS_CHMOD, + UV_FS_FCHMOD, + UV_FS_FSYNC, + UV_FS_FDATASYNC, + UV_FS_UNLINK, + UV_FS_RMDIR, + UV_FS_MKDIR, + UV_FS_MKDTEMP, + UV_FS_RENAME, + UV_FS_SCANDIR, + UV_FS_LINK, + UV_FS_SYMLINK, + UV_FS_READLINK, + UV_FS_CHOWN, + UV_FS_FCHOWN, + UV_FS_REALPATH, - UV_FS_COPYFILE ++ UV_FS_COPYFILE, ++ UV_FS_LCHOWN +} uv_fs_type; + +/* uv_fs_t is a subclass of uv_req_t. */ +struct uv_fs_s { + UV_REQ_FIELDS + uv_fs_type fs_type; + uv_loop_t* loop; + uv_fs_cb cb; + ssize_t result; + void* ptr; + const char* path; + uv_stat_t statbuf; /* Stores the result of uv_fs_stat() and uv_fs_fstat(). */ + UV_FS_PRIVATE_FIELDS +}; + +UV_EXTERN uv_fs_type uv_fs_get_type(const uv_fs_t*); +UV_EXTERN ssize_t uv_fs_get_result(const uv_fs_t*); +UV_EXTERN void* uv_fs_get_ptr(const uv_fs_t*); +UV_EXTERN const char* uv_fs_get_path(const uv_fs_t*); +UV_EXTERN uv_stat_t* uv_fs_get_statbuf(uv_fs_t*); + +UV_EXTERN void uv_fs_req_cleanup(uv_fs_t* req); +UV_EXTERN int uv_fs_close(uv_loop_t* loop, + uv_fs_t* req, + uv_file file, + uv_fs_cb cb); +UV_EXTERN int uv_fs_open(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + int flags, + int mode, + uv_fs_cb cb); +UV_EXTERN int uv_fs_read(uv_loop_t* loop, + uv_fs_t* req, + uv_file file, + const uv_buf_t bufs[], + unsigned int nbufs, + int64_t offset, + uv_fs_cb cb); +UV_EXTERN int uv_fs_unlink(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + uv_fs_cb cb); +UV_EXTERN int uv_fs_write(uv_loop_t* loop, + uv_fs_t* req, + uv_file file, + const uv_buf_t bufs[], + unsigned int nbufs, + int64_t offset, + uv_fs_cb cb); +/* + * This flag can be used with uv_fs_copyfile() to return an error if the + * destination already exists. + */ +#define UV_FS_COPYFILE_EXCL 0x0001 + +/* + * This flag can be used with uv_fs_copyfile() to attempt to create a reflink. + * If copy-on-write is not supported, a fallback copy mechanism is used. + */ +#define UV_FS_COPYFILE_FICLONE 0x0002 + +/* + * This flag can be used with uv_fs_copyfile() to attempt to create a reflink. + * If copy-on-write is not supported, an error is returned. + */ +#define UV_FS_COPYFILE_FICLONE_FORCE 0x0004 + +UV_EXTERN int uv_fs_copyfile(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + const char* new_path, + int flags, + uv_fs_cb cb); +UV_EXTERN int uv_fs_mkdir(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + int mode, + uv_fs_cb cb); +UV_EXTERN int uv_fs_mkdtemp(uv_loop_t* loop, + uv_fs_t* req, + const char* tpl, + uv_fs_cb cb); +UV_EXTERN int uv_fs_rmdir(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + uv_fs_cb cb); +UV_EXTERN int uv_fs_scandir(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + int flags, + uv_fs_cb cb); +UV_EXTERN int uv_fs_scandir_next(uv_fs_t* req, + uv_dirent_t* ent); +UV_EXTERN int uv_fs_stat(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + uv_fs_cb cb); +UV_EXTERN int uv_fs_fstat(uv_loop_t* loop, + uv_fs_t* req, + uv_file file, + uv_fs_cb cb); +UV_EXTERN int uv_fs_rename(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + const char* new_path, + uv_fs_cb cb); +UV_EXTERN int uv_fs_fsync(uv_loop_t* loop, + uv_fs_t* req, + uv_file file, + uv_fs_cb cb); +UV_EXTERN int uv_fs_fdatasync(uv_loop_t* loop, + uv_fs_t* req, + uv_file file, + uv_fs_cb cb); +UV_EXTERN int uv_fs_ftruncate(uv_loop_t* loop, + uv_fs_t* req, + uv_file file, + int64_t offset, + uv_fs_cb cb); +UV_EXTERN int uv_fs_sendfile(uv_loop_t* loop, + uv_fs_t* req, + uv_file out_fd, + uv_file in_fd, + int64_t in_offset, + size_t length, + uv_fs_cb cb); +UV_EXTERN int uv_fs_access(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + int mode, + uv_fs_cb cb); +UV_EXTERN int uv_fs_chmod(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + int mode, + uv_fs_cb cb); +UV_EXTERN int uv_fs_utime(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + double atime, + double mtime, + uv_fs_cb cb); +UV_EXTERN int uv_fs_futime(uv_loop_t* loop, + uv_fs_t* req, + uv_file file, + double atime, + double mtime, + uv_fs_cb cb); +UV_EXTERN int uv_fs_lstat(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + uv_fs_cb cb); +UV_EXTERN int uv_fs_link(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + const char* new_path, + uv_fs_cb cb); + +/* + * This flag can be used with uv_fs_symlink() on Windows to specify whether + * path argument points to a directory. + */ +#define UV_FS_SYMLINK_DIR 0x0001 + +/* + * This flag can be used with uv_fs_symlink() on Windows to specify whether + * the symlink is to be created using junction points. + */ +#define UV_FS_SYMLINK_JUNCTION 0x0002 + +UV_EXTERN int uv_fs_symlink(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + const char* new_path, + int flags, + uv_fs_cb cb); +UV_EXTERN int uv_fs_readlink(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + uv_fs_cb cb); +UV_EXTERN int uv_fs_realpath(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + uv_fs_cb cb); +UV_EXTERN int uv_fs_fchmod(uv_loop_t* loop, + uv_fs_t* req, + uv_file file, + int mode, + uv_fs_cb cb); +UV_EXTERN int uv_fs_chown(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + uv_uid_t uid, + uv_gid_t gid, + uv_fs_cb cb); +UV_EXTERN int uv_fs_fchown(uv_loop_t* loop, + uv_fs_t* req, + uv_file file, + uv_uid_t uid, + uv_gid_t gid, + uv_fs_cb cb); ++UV_EXTERN int uv_fs_lchown(uv_loop_t* loop, ++ uv_fs_t* req, ++ const char* path, ++ uv_uid_t uid, ++ uv_gid_t gid, ++ uv_fs_cb cb); + + +enum uv_fs_event { + UV_RENAME = 1, + UV_CHANGE = 2 +}; + + +struct uv_fs_event_s { + UV_HANDLE_FIELDS + /* private */ + char* path; + UV_FS_EVENT_PRIVATE_FIELDS +}; + + +/* + * uv_fs_stat() based polling file watcher. + */ +struct uv_fs_poll_s { + UV_HANDLE_FIELDS + /* Private, don't touch. */ + void* poll_ctx; +}; + +UV_EXTERN int uv_fs_poll_init(uv_loop_t* loop, uv_fs_poll_t* handle); +UV_EXTERN int uv_fs_poll_start(uv_fs_poll_t* handle, + uv_fs_poll_cb poll_cb, + const char* path, + unsigned int interval); +UV_EXTERN int uv_fs_poll_stop(uv_fs_poll_t* handle); +UV_EXTERN int uv_fs_poll_getpath(uv_fs_poll_t* handle, + char* buffer, + size_t* size); + + +struct uv_signal_s { + UV_HANDLE_FIELDS + uv_signal_cb signal_cb; + int signum; + UV_SIGNAL_PRIVATE_FIELDS +}; + +UV_EXTERN int uv_signal_init(uv_loop_t* loop, uv_signal_t* handle); +UV_EXTERN int uv_signal_start(uv_signal_t* handle, + uv_signal_cb signal_cb, + int signum); +UV_EXTERN int uv_signal_start_oneshot(uv_signal_t* handle, + uv_signal_cb signal_cb, + int signum); +UV_EXTERN int uv_signal_stop(uv_signal_t* handle); + +UV_EXTERN void uv_loadavg(double avg[3]); + + +/* + * Flags to be passed to uv_fs_event_start(). + */ +enum uv_fs_event_flags { + /* + * By default, if the fs event watcher is given a directory name, we will + * watch for all events in that directory. This flags overrides this behavior + * and makes fs_event report only changes to the directory entry itself. This + * flag does not affect individual files watched. + * This flag is currently not implemented yet on any backend. + */ + UV_FS_EVENT_WATCH_ENTRY = 1, + + /* + * By default uv_fs_event will try to use a kernel interface such as inotify + * or kqueue to detect events. This may not work on remote filesystems such + * as NFS mounts. This flag makes fs_event fall back to calling stat() on a + * regular interval. + * This flag is currently not implemented yet on any backend. + */ + UV_FS_EVENT_STAT = 2, + + /* + * By default, event watcher, when watching directory, is not registering + * (is ignoring) changes in it's subdirectories. + * This flag will override this behaviour on platforms that support it. + */ + UV_FS_EVENT_RECURSIVE = 4 +}; + + +UV_EXTERN int uv_fs_event_init(uv_loop_t* loop, uv_fs_event_t* handle); +UV_EXTERN int uv_fs_event_start(uv_fs_event_t* handle, + uv_fs_event_cb cb, + const char* path, + unsigned int flags); +UV_EXTERN int uv_fs_event_stop(uv_fs_event_t* handle); +UV_EXTERN int uv_fs_event_getpath(uv_fs_event_t* handle, + char* buffer, + size_t* size); + +UV_EXTERN int uv_ip4_addr(const char* ip, int port, struct sockaddr_in* addr); +UV_EXTERN int uv_ip6_addr(const char* ip, int port, struct sockaddr_in6* addr); + +UV_EXTERN int uv_ip4_name(const struct sockaddr_in* src, char* dst, size_t size); +UV_EXTERN int uv_ip6_name(const struct sockaddr_in6* src, char* dst, size_t size); + +UV_EXTERN int uv_inet_ntop(int af, const void* src, char* dst, size_t size); +UV_EXTERN int uv_inet_pton(int af, const char* src, void* dst); + +#if defined(IF_NAMESIZE) +# define UV_IF_NAMESIZE (IF_NAMESIZE + 1) +#elif defined(IFNAMSIZ) +# define UV_IF_NAMESIZE (IFNAMSIZ + 1) +#else +# define UV_IF_NAMESIZE (16 + 1) +#endif + +UV_EXTERN int uv_if_indextoname(unsigned int ifindex, + char* buffer, + size_t* size); +UV_EXTERN int uv_if_indextoiid(unsigned int ifindex, + char* buffer, + size_t* size); + +UV_EXTERN int uv_exepath(char* buffer, size_t* size); + +UV_EXTERN int uv_cwd(char* buffer, size_t* size); + +UV_EXTERN int uv_chdir(const char* dir); + +UV_EXTERN uint64_t uv_get_free_memory(void); +UV_EXTERN uint64_t uv_get_total_memory(void); + +UV_EXTERN uint64_t uv_hrtime(void); + +UV_EXTERN void uv_disable_stdio_inheritance(void); + +UV_EXTERN int uv_dlopen(const char* filename, uv_lib_t* lib); +UV_EXTERN void uv_dlclose(uv_lib_t* lib); +UV_EXTERN int uv_dlsym(uv_lib_t* lib, const char* name, void** ptr); +UV_EXTERN const char* uv_dlerror(const uv_lib_t* lib); + +UV_EXTERN int uv_mutex_init(uv_mutex_t* handle); +UV_EXTERN int uv_mutex_init_recursive(uv_mutex_t* handle); +UV_EXTERN void uv_mutex_destroy(uv_mutex_t* handle); +UV_EXTERN void uv_mutex_lock(uv_mutex_t* handle); +UV_EXTERN int uv_mutex_trylock(uv_mutex_t* handle); +UV_EXTERN void uv_mutex_unlock(uv_mutex_t* handle); + +UV_EXTERN int uv_rwlock_init(uv_rwlock_t* rwlock); +UV_EXTERN void uv_rwlock_destroy(uv_rwlock_t* rwlock); +UV_EXTERN void uv_rwlock_rdlock(uv_rwlock_t* rwlock); +UV_EXTERN int uv_rwlock_tryrdlock(uv_rwlock_t* rwlock); +UV_EXTERN void uv_rwlock_rdunlock(uv_rwlock_t* rwlock); +UV_EXTERN void uv_rwlock_wrlock(uv_rwlock_t* rwlock); +UV_EXTERN int uv_rwlock_trywrlock(uv_rwlock_t* rwlock); +UV_EXTERN void uv_rwlock_wrunlock(uv_rwlock_t* rwlock); + +UV_EXTERN int uv_sem_init(uv_sem_t* sem, unsigned int value); +UV_EXTERN void uv_sem_destroy(uv_sem_t* sem); +UV_EXTERN void uv_sem_post(uv_sem_t* sem); +UV_EXTERN void uv_sem_wait(uv_sem_t* sem); +UV_EXTERN int uv_sem_trywait(uv_sem_t* sem); + +UV_EXTERN int uv_cond_init(uv_cond_t* cond); +UV_EXTERN void uv_cond_destroy(uv_cond_t* cond); +UV_EXTERN void uv_cond_signal(uv_cond_t* cond); +UV_EXTERN void uv_cond_broadcast(uv_cond_t* cond); + +UV_EXTERN int uv_barrier_init(uv_barrier_t* barrier, unsigned int count); +UV_EXTERN void uv_barrier_destroy(uv_barrier_t* barrier); +UV_EXTERN int uv_barrier_wait(uv_barrier_t* barrier); + +UV_EXTERN void uv_cond_wait(uv_cond_t* cond, uv_mutex_t* mutex); +UV_EXTERN int uv_cond_timedwait(uv_cond_t* cond, + uv_mutex_t* mutex, + uint64_t timeout); + +UV_EXTERN void uv_once(uv_once_t* guard, void (*callback)(void)); + +UV_EXTERN int uv_key_create(uv_key_t* key); +UV_EXTERN void uv_key_delete(uv_key_t* key); +UV_EXTERN void* uv_key_get(uv_key_t* key); +UV_EXTERN void uv_key_set(uv_key_t* key, void* value); + +typedef void (*uv_thread_cb)(void* arg); + +UV_EXTERN int uv_thread_create(uv_thread_t* tid, uv_thread_cb entry, void* arg); +UV_EXTERN uv_thread_t uv_thread_self(void); +UV_EXTERN int uv_thread_join(uv_thread_t *tid); +UV_EXTERN int uv_thread_equal(const uv_thread_t* t1, const uv_thread_t* t2); + +/* The presence of these unions force similar struct layout. */ +#define XX(_, name) uv_ ## name ## _t name; +union uv_any_handle { + UV_HANDLE_TYPE_MAP(XX) +}; + +union uv_any_req { + UV_REQ_TYPE_MAP(XX) +}; +#undef XX + + +struct uv_loop_s { + /* User data - use this for whatever. */ + void* data; + /* Loop reference counting. */ + unsigned int active_handles; + void* handle_queue[2]; + union { + void* unused[2]; + unsigned int count; + } active_reqs; + /* Internal flag to signal loop stop. */ + unsigned int stop_flag; + UV_LOOP_PRIVATE_FIELDS +}; + +UV_EXTERN void* uv_loop_get_data(const uv_loop_t*); +UV_EXTERN void uv_loop_set_data(uv_loop_t*, void* data); + +/* Don't export the private CPP symbols. */ +#undef UV_HANDLE_TYPE_PRIVATE +#undef UV_REQ_TYPE_PRIVATE +#undef UV_REQ_PRIVATE_FIELDS +#undef UV_STREAM_PRIVATE_FIELDS +#undef UV_TCP_PRIVATE_FIELDS +#undef UV_PREPARE_PRIVATE_FIELDS +#undef UV_CHECK_PRIVATE_FIELDS +#undef UV_IDLE_PRIVATE_FIELDS +#undef UV_ASYNC_PRIVATE_FIELDS +#undef UV_TIMER_PRIVATE_FIELDS +#undef UV_GETADDRINFO_PRIVATE_FIELDS +#undef UV_GETNAMEINFO_PRIVATE_FIELDS +#undef UV_FS_REQ_PRIVATE_FIELDS +#undef UV_WORK_PRIVATE_FIELDS +#undef UV_FS_EVENT_PRIVATE_FIELDS +#undef UV_SIGNAL_PRIVATE_FIELDS +#undef UV_LOOP_PRIVATE_FIELDS +#undef UV_LOOP_PRIVATE_PLATFORM_FIELDS +#undef UV__ERR + +#ifdef __cplusplus +} +#endif +#endif /* UV_H */ diff --cc Utilities/cmlibuv/include/uv/unix.h index 455674d,0000000..d10c9bd mode 100644,000000..100644 --- a/Utilities/cmlibuv/include/uv/unix.h +++ b/Utilities/cmlibuv/include/uv/unix.h @@@ -1,478 -1,0 +1,497 @@@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef UV_UNIX_H +#define UV_UNIX_H + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#if !defined(__MVS__) +#include +#endif +#include +#include + - #include "uv-threadpool.h" ++#include "uv/threadpool.h" + +#ifdef CMAKE_BOOTSTRAP - # include "uv-posix.h" ++# include "uv/posix.h" +#elif defined(__linux__) - # include "uv-linux.h" ++# include "uv/linux.h" +#elif defined (__MVS__) - # include "uv-os390.h" ++# include "uv/os390.h" +#elif defined(__PASE__) - # include "uv-posix.h" ++# include "uv/posix.h" +#elif defined(_AIX) - # include "uv-aix.h" ++# include "uv/aix.h" +#elif defined(__sun) - # include "uv-sunos.h" ++# include "uv/sunos.h" +#elif defined(__APPLE__) - # include "uv-darwin.h" ++# include "uv/darwin.h" +#elif defined(__DragonFly__) || \ + defined(__FreeBSD__) || \ + defined(__FreeBSD_kernel__) || \ + defined(__OpenBSD__) || \ + defined(__NetBSD__) - # include "uv-bsd.h" ++# include "uv/bsd.h" +#elif defined(__CYGWIN__) || defined(__MSYS__) - # include "uv-posix.h" - #endif - - #ifndef PTHREAD_BARRIER_SERIAL_THREAD - # include "pthread-barrier.h" ++# include "uv/posix.h" ++#elif defined(__GNU__) ++# include "uv/posix.h" +#endif + +#ifndef NI_MAXHOST +# define NI_MAXHOST 1025 +#endif + +#ifndef NI_MAXSERV +# define NI_MAXSERV 32 +#endif + +#ifndef UV_IO_PRIVATE_PLATFORM_FIELDS +# define UV_IO_PRIVATE_PLATFORM_FIELDS /* empty */ +#endif + +struct uv__io_s; +struct uv_loop_s; + +typedef void (*uv__io_cb)(struct uv_loop_s* loop, + struct uv__io_s* w, + unsigned int events); +typedef struct uv__io_s uv__io_t; + +struct uv__io_s { + uv__io_cb cb; + void* pending_queue[2]; + void* watcher_queue[2]; + unsigned int pevents; /* Pending event mask i.e. mask at next tick. */ + unsigned int events; /* Current event mask. */ + int fd; + UV_IO_PRIVATE_PLATFORM_FIELDS +}; + +#ifndef UV_PLATFORM_SEM_T +# define UV_PLATFORM_SEM_T sem_t +#endif + +#ifndef UV_PLATFORM_LOOP_FIELDS +# define UV_PLATFORM_LOOP_FIELDS /* empty */ +#endif + +#ifndef UV_PLATFORM_FS_EVENT_FIELDS +# define UV_PLATFORM_FS_EVENT_FIELDS /* empty */ +#endif + +#ifndef UV_STREAM_PRIVATE_PLATFORM_FIELDS +# define UV_STREAM_PRIVATE_PLATFORM_FIELDS /* empty */ +#endif + +/* Note: May be cast to struct iovec. See writev(2). */ +typedef struct uv_buf_t { + char* base; + size_t len; +} uv_buf_t; + +typedef int uv_file; +typedef int uv_os_sock_t; +typedef int uv_os_fd_t; +typedef pid_t uv_pid_t; + +#ifdef CMAKE_BOOTSTRAP +#define UV_ONCE_INIT 0 +typedef int uv_once_t; +typedef int uv_thread_t; +typedef int uv_mutex_t; +typedef int uv_rwlock_t; +typedef int uv_sem_t; +typedef int uv_cond_t; +typedef int uv_key_t; +typedef int uv_barrier_t; +#else +#define UV_ONCE_INIT PTHREAD_ONCE_INIT + +typedef pthread_once_t uv_once_t; +typedef pthread_t uv_thread_t; +typedef pthread_mutex_t uv_mutex_t; +typedef pthread_rwlock_t uv_rwlock_t; +typedef UV_PLATFORM_SEM_T uv_sem_t; +typedef pthread_cond_t uv_cond_t; +typedef pthread_key_t uv_key_t; ++ ++/* Note: guard clauses should match uv_barrier_init's in src/unix/thread.c. */ ++#if defined(_AIX) || !defined(PTHREAD_BARRIER_SERIAL_THREAD) ++/* TODO(bnoordhuis) Merge into uv_barrier_t in v2. */ ++struct _uv_barrier { ++ uv_mutex_t mutex; ++ uv_cond_t cond; ++ unsigned threshold; ++ unsigned in; ++ unsigned out; ++}; ++ ++typedef struct { ++ struct _uv_barrier* b; ++# if defined(PTHREAD_BARRIER_SERIAL_THREAD) ++ /* TODO(bnoordhuis) Remove padding in v2. */ ++ char pad[sizeof(pthread_barrier_t) - sizeof(struct _uv_barrier*)]; ++# endif ++} uv_barrier_t; ++#else +typedef pthread_barrier_t uv_barrier_t; +#endif + ++#endif + +/* Platform-specific definitions for uv_spawn support. */ +typedef gid_t uv_gid_t; +typedef uid_t uv_uid_t; + +typedef struct dirent uv__dirent_t; + +#if defined(DT_UNKNOWN) +# define HAVE_DIRENT_TYPES +# if defined(DT_REG) +# define UV__DT_FILE DT_REG +# else +# define UV__DT_FILE -1 +# endif +# if defined(DT_DIR) +# define UV__DT_DIR DT_DIR +# else +# define UV__DT_DIR -2 +# endif +# if defined(DT_LNK) +# define UV__DT_LINK DT_LNK +# else +# define UV__DT_LINK -3 +# endif +# if defined(DT_FIFO) +# define UV__DT_FIFO DT_FIFO +# else +# define UV__DT_FIFO -4 +# endif +# if defined(DT_SOCK) +# define UV__DT_SOCKET DT_SOCK +# else +# define UV__DT_SOCKET -5 +# endif +# if defined(DT_CHR) +# define UV__DT_CHAR DT_CHR +# else +# define UV__DT_CHAR -6 +# endif +# if defined(DT_BLK) +# define UV__DT_BLOCK DT_BLK +# else +# define UV__DT_BLOCK -7 +# endif +#endif + +/* Platform-specific definitions for uv_dlopen support. */ +#define UV_DYNAMIC /* empty */ + +typedef struct { + void* handle; + char* errmsg; +} uv_lib_t; + +#define UV_LOOP_PRIVATE_FIELDS \ + unsigned long flags; \ + int backend_fd; \ + void* pending_queue[2]; \ + void* watcher_queue[2]; \ + uv__io_t** watchers; \ + unsigned int nwatchers; \ + unsigned int nfds; \ + void* wq[2]; \ + uv_mutex_t wq_mutex; \ + uv_async_t wq_async; \ + uv_rwlock_t cloexec_lock; \ + uv_handle_t* closing_handles; \ + void* process_handles[2]; \ + void* prepare_handles[2]; \ + void* check_handles[2]; \ + void* idle_handles[2]; \ + void* async_handles[2]; \ + void (*async_unused)(void); /* TODO(bnoordhuis) Remove in libuv v2. */ \ + uv__io_t async_io_watcher; \ + int async_wfd; \ + struct { \ + void* min; \ + unsigned int nelts; \ + } timer_heap; \ + uint64_t timer_counter; \ + uint64_t time; \ + int signal_pipefd[2]; \ + uv__io_t signal_io_watcher; \ + uv_signal_t child_watcher; \ + int emfile_fd; \ + UV_PLATFORM_LOOP_FIELDS \ + +#define UV_REQ_TYPE_PRIVATE /* empty */ + +#define UV_REQ_PRIVATE_FIELDS /* empty */ + +#define UV_PRIVATE_REQ_TYPES /* empty */ + +#define UV_WRITE_PRIVATE_FIELDS \ + void* queue[2]; \ + unsigned int write_index; \ + uv_buf_t* bufs; \ + unsigned int nbufs; \ + int error; \ + uv_buf_t bufsml[4]; \ + +#define UV_CONNECT_PRIVATE_FIELDS \ + void* queue[2]; \ + +#define UV_SHUTDOWN_PRIVATE_FIELDS /* empty */ + +#define UV_UDP_SEND_PRIVATE_FIELDS \ + void* queue[2]; \ + struct sockaddr_storage addr; \ + unsigned int nbufs; \ + uv_buf_t* bufs; \ + ssize_t status; \ + uv_udp_send_cb send_cb; \ + uv_buf_t bufsml[4]; \ + +#define UV_HANDLE_PRIVATE_FIELDS \ + uv_handle_t* next_closing; \ + unsigned int flags; \ + +#define UV_STREAM_PRIVATE_FIELDS \ + uv_connect_t *connect_req; \ + uv_shutdown_t *shutdown_req; \ + uv__io_t io_watcher; \ + void* write_queue[2]; \ + void* write_completed_queue[2]; \ + uv_connection_cb connection_cb; \ + int delayed_error; \ + int accepted_fd; \ + void* queued_fds; \ + UV_STREAM_PRIVATE_PLATFORM_FIELDS \ + +#define UV_TCP_PRIVATE_FIELDS /* empty */ + +#define UV_UDP_PRIVATE_FIELDS \ + uv_alloc_cb alloc_cb; \ + uv_udp_recv_cb recv_cb; \ + uv__io_t io_watcher; \ + void* write_queue[2]; \ + void* write_completed_queue[2]; \ + +#define UV_PIPE_PRIVATE_FIELDS \ + const char* pipe_fname; /* strdup'ed */ + +#define UV_POLL_PRIVATE_FIELDS \ + uv__io_t io_watcher; + +#define UV_PREPARE_PRIVATE_FIELDS \ + uv_prepare_cb prepare_cb; \ + void* queue[2]; \ + +#define UV_CHECK_PRIVATE_FIELDS \ + uv_check_cb check_cb; \ + void* queue[2]; \ + +#define UV_IDLE_PRIVATE_FIELDS \ + uv_idle_cb idle_cb; \ + void* queue[2]; \ + +#define UV_ASYNC_PRIVATE_FIELDS \ + uv_async_cb async_cb; \ + void* queue[2]; \ + int pending; \ + +#define UV_TIMER_PRIVATE_FIELDS \ + uv_timer_cb timer_cb; \ + void* heap_node[3]; \ + uint64_t timeout; \ + uint64_t repeat; \ + uint64_t start_id; + +#define UV_GETADDRINFO_PRIVATE_FIELDS \ + struct uv__work work_req; \ + uv_getaddrinfo_cb cb; \ + struct addrinfo* hints; \ + char* hostname; \ + char* service; \ + struct addrinfo* addrinfo; \ + int retcode; + +#define UV_GETNAMEINFO_PRIVATE_FIELDS \ + struct uv__work work_req; \ + uv_getnameinfo_cb getnameinfo_cb; \ + struct sockaddr_storage storage; \ + int flags; \ + char host[NI_MAXHOST]; \ + char service[NI_MAXSERV]; \ + int retcode; + +#define UV_PROCESS_PRIVATE_FIELDS \ + void* queue[2]; \ + int status; \ + +#define UV_FS_PRIVATE_FIELDS \ + const char *new_path; \ + uv_file file; \ + int flags; \ + mode_t mode; \ + unsigned int nbufs; \ + uv_buf_t* bufs; \ + off_t off; \ + uv_uid_t uid; \ + uv_gid_t gid; \ + double atime; \ + double mtime; \ + struct uv__work work_req; \ + uv_buf_t bufsml[4]; \ + +#define UV_WORK_PRIVATE_FIELDS \ + struct uv__work work_req; + +#define UV_TTY_PRIVATE_FIELDS \ + struct termios orig_termios; \ + int mode; + +#define UV_SIGNAL_PRIVATE_FIELDS \ + /* RB_ENTRY(uv_signal_s) tree_entry; */ \ + struct { \ + struct uv_signal_s* rbe_left; \ + struct uv_signal_s* rbe_right; \ + struct uv_signal_s* rbe_parent; \ + int rbe_color; \ + } tree_entry; \ + /* Use two counters here so we don have to fiddle with atomics. */ \ + unsigned int caught_signals; \ + unsigned int dispatched_signals; + +#define UV_FS_EVENT_PRIVATE_FIELDS \ + uv_fs_event_cb cb; \ + UV_PLATFORM_FS_EVENT_FIELDS \ + +/* fs open() flags supported on this platform: */ +#if defined(O_APPEND) +# define UV_FS_O_APPEND O_APPEND +#else +# define UV_FS_O_APPEND 0 +#endif +#if defined(O_CREAT) +# define UV_FS_O_CREAT O_CREAT +#else +# define UV_FS_O_CREAT 0 +#endif +#if defined(O_DIRECT) +# define UV_FS_O_DIRECT O_DIRECT +#else +# define UV_FS_O_DIRECT 0 +#endif +#if defined(O_DIRECTORY) +# define UV_FS_O_DIRECTORY O_DIRECTORY +#else +# define UV_FS_O_DIRECTORY 0 +#endif +#if defined(O_DSYNC) +# define UV_FS_O_DSYNC O_DSYNC +#else +# define UV_FS_O_DSYNC 0 +#endif +#if defined(O_EXCL) +# define UV_FS_O_EXCL O_EXCL +#else +# define UV_FS_O_EXCL 0 +#endif +#if defined(O_EXLOCK) +# define UV_FS_O_EXLOCK O_EXLOCK +#else +# define UV_FS_O_EXLOCK 0 +#endif +#if defined(O_NOATIME) +# define UV_FS_O_NOATIME O_NOATIME +#else +# define UV_FS_O_NOATIME 0 +#endif +#if defined(O_NOCTTY) +# define UV_FS_O_NOCTTY O_NOCTTY +#else +# define UV_FS_O_NOCTTY 0 +#endif +#if defined(O_NOFOLLOW) +# define UV_FS_O_NOFOLLOW O_NOFOLLOW +#else +# define UV_FS_O_NOFOLLOW 0 +#endif +#if defined(O_NONBLOCK) +# define UV_FS_O_NONBLOCK O_NONBLOCK +#else +# define UV_FS_O_NONBLOCK 0 +#endif +#if defined(O_RDONLY) +# define UV_FS_O_RDONLY O_RDONLY +#else +# define UV_FS_O_RDONLY 0 +#endif +#if defined(O_RDWR) +# define UV_FS_O_RDWR O_RDWR +#else +# define UV_FS_O_RDWR 0 +#endif +#if defined(O_SYMLINK) +# define UV_FS_O_SYMLINK O_SYMLINK +#else +# define UV_FS_O_SYMLINK 0 +#endif +#if defined(O_SYNC) +# define UV_FS_O_SYNC O_SYNC +#else +# define UV_FS_O_SYNC 0 +#endif +#if defined(O_TRUNC) +# define UV_FS_O_TRUNC O_TRUNC +#else +# define UV_FS_O_TRUNC 0 +#endif +#if defined(O_WRONLY) +# define UV_FS_O_WRONLY O_WRONLY +#else +# define UV_FS_O_WRONLY 0 +#endif + +/* fs open() flags supported on other platforms: */ +#define UV_FS_O_RANDOM 0 +#define UV_FS_O_SHORT_LIVED 0 +#define UV_FS_O_SEQUENTIAL 0 +#define UV_FS_O_TEMPORARY 0 + +#endif /* UV_UNIX_H */ diff --cc Utilities/cmlibuv/include/uv/win.h index 6486aab,0000000..ff24ea0 mode 100644,000000..100644 --- a/Utilities/cmlibuv/include/uv/win.h +++ b/Utilities/cmlibuv/include/uv/win.h @@@ -1,687 -1,0 +1,696 @@@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef _WIN32_WINNT +# define _WIN32_WINNT 0x0600 +#endif + +#if !defined(_SSIZE_T_) && !defined(_SSIZE_T_DEFINED) +typedef intptr_t ssize_t; ++# define SSIZE_MAX INTPTR_MAX +# define _SSIZE_T_ +# define _SSIZE_T_DEFINED +#endif + +#include + +#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR) +typedef struct pollfd { + SOCKET fd; + short events; + short revents; +} WSAPOLLFD, *PWSAPOLLFD, *LPWSAPOLLFD; +#endif + +#ifndef LOCALE_INVARIANT +# define LOCALE_INVARIANT 0x007f +#endif + +#include +#include +#include + +#include +#include +#include +#include + +#if defined(_MSC_VER) && _MSC_VER < 1600 - # include "stdint-msvc2008.h" ++# include "uv/stdint-msvc2008.h" +#else +# include +#endif + - #include "tree.h" - #include "uv-threadpool.h" ++#include "uv/tree.h" ++#include "uv/threadpool.h" + +#define MAX_PIPENAME_LEN 256 + +#ifndef S_IFLNK +# define S_IFLNK 0xA000 +#endif + +/* Additional signals supported by uv_signal and or uv_kill. The CRT defines + * the following signals already: + * + * #define SIGINT 2 + * #define SIGILL 4 + * #define SIGABRT_COMPAT 6 + * #define SIGFPE 8 + * #define SIGSEGV 11 + * #define SIGTERM 15 + * #define SIGBREAK 21 + * #define SIGABRT 22 + * + * The additional signals have values that are common on other Unix + * variants (Linux and Darwin) + */ +#define SIGHUP 1 +#define SIGKILL 9 +#define SIGWINCH 28 + - /* The CRT defines SIGABRT_COMPAT as 6, which equals SIGABRT on many */ - /* unix-like platforms. However MinGW doesn't define it, so we do. */ ++/* Redefine NSIG to take SIGWINCH into consideration */ ++#if defined(NSIG) && NSIG <= SIGWINCH ++# undef NSIG ++#endif ++#ifndef NSIG ++# define NSIG SIGWINCH + 1 ++#endif ++ ++/* The CRT defines SIGABRT_COMPAT as 6, which equals SIGABRT on many unix-like ++ * platforms. However MinGW doesn't define it, so we do. */ +#ifndef SIGABRT_COMPAT +# define SIGABRT_COMPAT 6 +#endif + +/* + * Guids and typedefs for winsock extension functions + * Mingw32 doesn't have these :-( + */ +#ifndef WSAID_ACCEPTEX +# define WSAID_ACCEPTEX \ + {0xb5367df1, 0xcbac, 0x11cf, \ + {0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}} +#endif + +#ifndef WSAID_CONNECTEX +# define WSAID_CONNECTEX \ + {0x25a207b9, 0xddf3, 0x4660, \ + {0x8e, 0xe9, 0x76, 0xe5, 0x8c, 0x74, 0x06, 0x3e}} +#endif + +#ifndef WSAID_GETACCEPTEXSOCKADDRS +# define WSAID_GETACCEPTEXSOCKADDRS \ + {0xb5367df2, 0xcbac, 0x11cf, \ + {0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}} +#endif + +#ifndef WSAID_DISCONNECTEX +# define WSAID_DISCONNECTEX \ + {0x7fda2e11, 0x8630, 0x436f, \ + {0xa0, 0x31, 0xf5, 0x36, 0xa6, 0xee, 0xc1, 0x57}} +#endif + +#ifndef WSAID_TRANSMITFILE +# define WSAID_TRANSMITFILE \ + {0xb5367df0, 0xcbac, 0x11cf, \ + {0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}} +#endif + +#if (defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)) \ + || (defined(_MSC_VER) && _MSC_VER < 1500) + typedef BOOL (PASCAL *LPFN_ACCEPTEX) + (SOCKET sListenSocket, + SOCKET sAcceptSocket, + PVOID lpOutputBuffer, + DWORD dwReceiveDataLength, + DWORD dwLocalAddressLength, + DWORD dwRemoteAddressLength, + LPDWORD lpdwBytesReceived, + LPOVERLAPPED lpOverlapped); + + typedef BOOL (PASCAL *LPFN_CONNECTEX) + (SOCKET s, + const struct sockaddr* name, + int namelen, + PVOID lpSendBuffer, + DWORD dwSendDataLength, + LPDWORD lpdwBytesSent, + LPOVERLAPPED lpOverlapped); + + typedef void (PASCAL *LPFN_GETACCEPTEXSOCKADDRS) + (PVOID lpOutputBuffer, + DWORD dwReceiveDataLength, + DWORD dwLocalAddressLength, + DWORD dwRemoteAddressLength, + LPSOCKADDR* LocalSockaddr, + LPINT LocalSockaddrLength, + LPSOCKADDR* RemoteSockaddr, + LPINT RemoteSockaddrLength); + + typedef BOOL (PASCAL *LPFN_DISCONNECTEX) + (SOCKET hSocket, + LPOVERLAPPED lpOverlapped, + DWORD dwFlags, + DWORD reserved); + + typedef BOOL (PASCAL *LPFN_TRANSMITFILE) + (SOCKET hSocket, + HANDLE hFile, + DWORD nNumberOfBytesToWrite, + DWORD nNumberOfBytesPerSend, + LPOVERLAPPED lpOverlapped, + LPTRANSMIT_FILE_BUFFERS lpTransmitBuffers, + DWORD dwFlags); + + typedef PVOID RTL_SRWLOCK; + typedef RTL_SRWLOCK SRWLOCK, *PSRWLOCK; +#endif + +typedef int (WSAAPI* LPFN_WSARECV) + (SOCKET socket, + LPWSABUF buffers, + DWORD buffer_count, + LPDWORD bytes, + LPDWORD flags, + LPWSAOVERLAPPED overlapped, + LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine); + +typedef int (WSAAPI* LPFN_WSARECVFROM) + (SOCKET socket, + LPWSABUF buffers, + DWORD buffer_count, + LPDWORD bytes, + LPDWORD flags, + struct sockaddr* addr, + LPINT addr_len, + LPWSAOVERLAPPED overlapped, + LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine); + +#ifndef _NTDEF_ + typedef LONG NTSTATUS; + typedef NTSTATUS *PNTSTATUS; +#endif + +#ifndef RTL_CONDITION_VARIABLE_INIT + typedef PVOID CONDITION_VARIABLE, *PCONDITION_VARIABLE; +#endif + +typedef struct _AFD_POLL_HANDLE_INFO { + HANDLE Handle; + ULONG Events; + NTSTATUS Status; +} AFD_POLL_HANDLE_INFO, *PAFD_POLL_HANDLE_INFO; + +typedef struct _AFD_POLL_INFO { + LARGE_INTEGER Timeout; + ULONG NumberOfHandles; + ULONG Exclusive; + AFD_POLL_HANDLE_INFO Handles[1]; +} AFD_POLL_INFO, *PAFD_POLL_INFO; + +#define UV_MSAFD_PROVIDER_COUNT 3 + + +/** + * It should be possible to cast uv_buf_t[] to WSABUF[] + * see http://msdn.microsoft.com/en-us/library/ms741542(v=vs.85).aspx + */ +typedef struct uv_buf_t { + ULONG len; + char* base; +} uv_buf_t; + +typedef int uv_file; +typedef SOCKET uv_os_sock_t; +typedef HANDLE uv_os_fd_t; +typedef int uv_pid_t; + +typedef HANDLE uv_thread_t; + +typedef HANDLE uv_sem_t; + +typedef CRITICAL_SECTION uv_mutex_t; + +/* This condition variable implementation is based on the SetEvent solution + * (section 3.2) at http://www.cs.wustl.edu/~schmidt/win32-cv-1.html + * We could not use the SignalObjectAndWait solution (section 3.4) because + * it want the 2nd argument (type uv_mutex_t) of uv_cond_wait() and + * uv_cond_timedwait() to be HANDLEs, but we use CRITICAL_SECTIONs. + */ + +typedef union { + CONDITION_VARIABLE cond_var; + struct { + unsigned int waiters_count; + CRITICAL_SECTION waiters_count_lock; + HANDLE signal_event; + HANDLE broadcast_event; - } fallback; ++ } unused_; /* TODO: retained for ABI compatibility; remove me in v2.x. */ +} uv_cond_t; + +typedef union { + struct { + unsigned int num_readers_; + CRITICAL_SECTION num_readers_lock_; + HANDLE write_semaphore_; + } state_; + /* TODO: remove me in v2.x. */ + struct { + SRWLOCK unused_; + } unused1_; + /* TODO: remove me in v2.x. */ + struct { + uv_mutex_t unused1_; + uv_mutex_t unused2_; + } unused2_; +} uv_rwlock_t; + +typedef struct { + unsigned int n; + unsigned int count; + uv_mutex_t mutex; + uv_sem_t turnstile1; + uv_sem_t turnstile2; +} uv_barrier_t; + +typedef struct { + DWORD tls_index; +} uv_key_t; + +#define UV_ONCE_INIT { 0, NULL } + +typedef struct uv_once_s { + unsigned char ran; + HANDLE event; +} uv_once_t; + +/* Platform-specific definitions for uv_spawn support. */ +typedef unsigned char uv_uid_t; +typedef unsigned char uv_gid_t; + +typedef struct uv__dirent_s { + int d_type; + char d_name[1]; +} uv__dirent_t; + +#define HAVE_DIRENT_TYPES +#define UV__DT_DIR UV_DIRENT_DIR +#define UV__DT_FILE UV_DIRENT_FILE +#define UV__DT_LINK UV_DIRENT_LINK +#define UV__DT_FIFO UV_DIRENT_FIFO +#define UV__DT_SOCKET UV_DIRENT_SOCKET +#define UV__DT_CHAR UV_DIRENT_CHAR +#define UV__DT_BLOCK UV_DIRENT_BLOCK + +/* Platform-specific definitions for uv_dlopen support. */ +#define UV_DYNAMIC FAR WINAPI +typedef struct { + HMODULE handle; + char* errmsg; +} uv_lib_t; + - RB_HEAD(uv_timer_tree_s, uv_timer_s); - +#define UV_LOOP_PRIVATE_FIELDS \ + /* The loop's I/O completion port */ \ + HANDLE iocp; \ + /* The current time according to the event loop. in msecs. */ \ + uint64_t time; \ + /* Tail of a single-linked circular queue of pending reqs. If the queue */ \ + /* is empty, tail_ is NULL. If there is only one item, */ \ + /* tail_->next_req == tail_ */ \ + uv_req_t* pending_reqs_tail; \ + /* Head of a single-linked list of closed handles */ \ + uv_handle_t* endgame_handles; \ - /* The head of the timers tree */ \ - struct uv_timer_tree_s timers; \ ++ /* TODO(bnoordhuis) Stop heap-allocating |timer_heap| in libuv v2.x. */ \ ++ void* timer_heap; \ + /* Lists of active loop (prepare / check / idle) watchers */ \ + uv_prepare_t* prepare_handles; \ + uv_check_t* check_handles; \ + uv_idle_t* idle_handles; \ + /* This pointer will refer to the prepare/check/idle handle whose */ \ + /* callback is scheduled to be called next. This is needed to allow */ \ + /* safe removal from one of the lists above while that list being */ \ + /* iterated over. */ \ + uv_prepare_t* next_prepare_handle; \ + uv_check_t* next_check_handle; \ + uv_idle_t* next_idle_handle; \ + /* This handle holds the peer sockets for the fast variant of uv_poll_t */ \ + SOCKET poll_peer_sockets[UV_MSAFD_PROVIDER_COUNT]; \ + /* Counter to keep track of active tcp streams */ \ + unsigned int active_tcp_streams; \ + /* Counter to keep track of active udp streams */ \ + unsigned int active_udp_streams; \ + /* Counter to started timer */ \ + uint64_t timer_counter; \ + /* Threadpool */ \ + void* wq[2]; \ + uv_mutex_t wq_mutex; \ + uv_async_t wq_async; + +#define UV_REQ_TYPE_PRIVATE \ + /* TODO: remove the req suffix */ \ + UV_ACCEPT, \ + UV_FS_EVENT_REQ, \ + UV_POLL_REQ, \ + UV_PROCESS_EXIT, \ + UV_READ, \ + UV_UDP_RECV, \ + UV_WAKEUP, \ + UV_SIGNAL_REQ, + +#define UV_REQ_PRIVATE_FIELDS \ + union { \ + /* Used by I/O operations */ \ + struct { \ + OVERLAPPED overlapped; \ + size_t queued_bytes; \ + } io; \ + } u; \ + struct uv_req_s* next_req; + - #define UV_WRITE_PRIVATE_FIELDS \ - int ipc_header; \ - uv_buf_t write_buffer; \ - HANDLE event_handle; \ ++#define UV_WRITE_PRIVATE_FIELDS \ ++ int coalesced; \ ++ uv_buf_t write_buffer; \ ++ HANDLE event_handle; \ + HANDLE wait_handle; + +#define UV_CONNECT_PRIVATE_FIELDS \ + /* empty */ + +#define UV_SHUTDOWN_PRIVATE_FIELDS \ + /* empty */ + +#define UV_UDP_SEND_PRIVATE_FIELDS \ + /* empty */ + +#define UV_PRIVATE_REQ_TYPES \ + typedef struct uv_pipe_accept_s { \ + UV_REQ_FIELDS \ + HANDLE pipeHandle; \ + struct uv_pipe_accept_s* next_pending; \ + } uv_pipe_accept_t; \ + \ + typedef struct uv_tcp_accept_s { \ + UV_REQ_FIELDS \ + SOCKET accept_socket; \ + char accept_buffer[sizeof(struct sockaddr_storage) * 2 + 32]; \ + HANDLE event_handle; \ + HANDLE wait_handle; \ + struct uv_tcp_accept_s* next_pending; \ + } uv_tcp_accept_t; \ + \ + typedef struct uv_read_s { \ + UV_REQ_FIELDS \ + HANDLE event_handle; \ + HANDLE wait_handle; \ + } uv_read_t; + +#define uv_stream_connection_fields \ + unsigned int write_reqs_pending; \ + uv_shutdown_t* shutdown_req; + +#define uv_stream_server_fields \ + uv_connection_cb connection_cb; + +#define UV_STREAM_PRIVATE_FIELDS \ + unsigned int reqs_pending; \ + int activecnt; \ + uv_read_t read_req; \ + union { \ + struct { uv_stream_connection_fields } conn; \ + struct { uv_stream_server_fields } serv; \ + } stream; + +#define uv_tcp_server_fields \ + uv_tcp_accept_t* accept_reqs; \ + unsigned int processed_accepts; \ + uv_tcp_accept_t* pending_accepts; \ + LPFN_ACCEPTEX func_acceptex; + +#define uv_tcp_connection_fields \ + uv_buf_t read_buffer; \ + LPFN_CONNECTEX func_connectex; + +#define UV_TCP_PRIVATE_FIELDS \ + SOCKET socket; \ + int delayed_error; \ + union { \ + struct { uv_tcp_server_fields } serv; \ + struct { uv_tcp_connection_fields } conn; \ + } tcp; + +#define UV_UDP_PRIVATE_FIELDS \ + SOCKET socket; \ + unsigned int reqs_pending; \ + int activecnt; \ + uv_req_t recv_req; \ + uv_buf_t recv_buffer; \ + struct sockaddr_storage recv_from; \ + int recv_from_len; \ + uv_udp_recv_cb recv_cb; \ + uv_alloc_cb alloc_cb; \ + LPFN_WSARECV func_wsarecv; \ + LPFN_WSARECVFROM func_wsarecvfrom; + +#define uv_pipe_server_fields \ + int pending_instances; \ + uv_pipe_accept_t* accept_reqs; \ + uv_pipe_accept_t* pending_accepts; + +#define uv_pipe_connection_fields \ + uv_timer_t* eof_timer; \ - uv_write_t ipc_header_write_req; \ - int ipc_pid; \ - uint64_t remaining_ipc_rawdata_bytes; \ - struct { \ - void* queue[2]; \ - int queue_len; \ - } pending_ipc_info; \ ++ uv_write_t dummy; /* TODO: retained for ABI compat; remove this in v2.x. */ \ ++ DWORD ipc_remote_pid; \ ++ union { \ ++ uint32_t payload_remaining; \ ++ uint64_t dummy; /* TODO: retained for ABI compat; remove this in v2.x. */ \ ++ } ipc_data_frame; \ ++ void* ipc_xfer_queue[2]; \ ++ int ipc_xfer_queue_length; \ + uv_write_t* non_overlapped_writes_tail; \ - uv_mutex_t readfile_mutex; \ - volatile HANDLE readfile_thread; ++ CRITICAL_SECTION readfile_thread_lock; \ ++ volatile HANDLE readfile_thread_handle; + +#define UV_PIPE_PRIVATE_FIELDS \ + HANDLE handle; \ + WCHAR* name; \ + union { \ + struct { uv_pipe_server_fields } serv; \ + struct { uv_pipe_connection_fields } conn; \ + } pipe; + - /* TODO: put the parser states in an union - TTY handles are always */ - /* half-duplex so read-state can safely overlap write-state. */ ++/* TODO: put the parser states in an union - TTY handles are always half-duplex ++ * so read-state can safely overlap write-state. */ +#define UV_TTY_PRIVATE_FIELDS \ + HANDLE handle; \ + union { \ + struct { \ + /* Used for readable TTY handles */ \ + /* TODO: remove me in v2.x. */ \ + HANDLE unused_; \ + uv_buf_t read_line_buffer; \ + HANDLE read_raw_wait; \ + /* Fields used for translating win keystrokes into vt100 characters */ \ + char last_key[8]; \ + unsigned char last_key_offset; \ + unsigned char last_key_len; \ + WCHAR last_utf16_high_surrogate; \ + INPUT_RECORD last_input_record; \ + } rd; \ + struct { \ + /* Used for writable TTY handles */ \ + /* utf8-to-utf16 conversion state */ \ + unsigned int utf8_codepoint; \ + unsigned char utf8_bytes_left; \ + /* eol conversion state */ \ + unsigned char previous_eol; \ + /* ansi parser state */ \ + unsigned char ansi_parser_state; \ + unsigned char ansi_csi_argc; \ + unsigned short ansi_csi_argv[4]; \ + COORD saved_position; \ + WORD saved_attributes; \ + } wr; \ + } tty; + +#define UV_POLL_PRIVATE_FIELDS \ + SOCKET socket; \ + /* Used in fast mode */ \ + SOCKET peer_socket; \ + AFD_POLL_INFO afd_poll_info_1; \ + AFD_POLL_INFO afd_poll_info_2; \ + /* Used in fast and slow mode. */ \ + uv_req_t poll_req_1; \ + uv_req_t poll_req_2; \ + unsigned char submitted_events_1; \ + unsigned char submitted_events_2; \ + unsigned char mask_events_1; \ + unsigned char mask_events_2; \ + unsigned char events; + +#define UV_TIMER_PRIVATE_FIELDS \ - RB_ENTRY(uv_timer_s) tree_entry; \ - uint64_t due; \ ++ void* heap_node[3]; \ ++ int unused; \ ++ uint64_t timeout; \ + uint64_t repeat; \ + uint64_t start_id; \ + uv_timer_cb timer_cb; + +#define UV_ASYNC_PRIVATE_FIELDS \ + struct uv_req_s async_req; \ + uv_async_cb async_cb; \ + /* char to avoid alignment issues */ \ + char volatile async_sent; + +#define UV_PREPARE_PRIVATE_FIELDS \ + uv_prepare_t* prepare_prev; \ + uv_prepare_t* prepare_next; \ + uv_prepare_cb prepare_cb; + +#define UV_CHECK_PRIVATE_FIELDS \ + uv_check_t* check_prev; \ + uv_check_t* check_next; \ + uv_check_cb check_cb; + +#define UV_IDLE_PRIVATE_FIELDS \ + uv_idle_t* idle_prev; \ + uv_idle_t* idle_next; \ + uv_idle_cb idle_cb; + +#define UV_HANDLE_PRIVATE_FIELDS \ + uv_handle_t* endgame_next; \ + unsigned int flags; + +#define UV_GETADDRINFO_PRIVATE_FIELDS \ + struct uv__work work_req; \ + uv_getaddrinfo_cb getaddrinfo_cb; \ + void* alloc; \ + WCHAR* node; \ + WCHAR* service; \ + /* The addrinfoW field is used to store a pointer to the hints, and */ \ + /* later on to store the result of GetAddrInfoW. The final result will */ \ + /* be converted to struct addrinfo* and stored in the addrinfo field. */ \ + struct addrinfoW* addrinfow; \ + struct addrinfo* addrinfo; \ + int retcode; + +#define UV_GETNAMEINFO_PRIVATE_FIELDS \ + struct uv__work work_req; \ + uv_getnameinfo_cb getnameinfo_cb; \ + struct sockaddr_storage storage; \ + int flags; \ + char host[NI_MAXHOST]; \ + char service[NI_MAXSERV]; \ + int retcode; + +#define UV_PROCESS_PRIVATE_FIELDS \ + struct uv_process_exit_s { \ + UV_REQ_FIELDS \ + } exit_req; \ + BYTE* child_stdio_buffer; \ + int exit_signal; \ + HANDLE wait_handle; \ + HANDLE process_handle; \ + volatile char exit_cb_pending; + +#define UV_FS_PRIVATE_FIELDS \ + struct uv__work work_req; \ + int flags; \ + DWORD sys_errno_; \ + union { \ + /* TODO: remove me in 0.9. */ \ + WCHAR* pathw; \ + int fd; \ + } file; \ + union { \ + struct { \ + int mode; \ + WCHAR* new_pathw; \ + int file_flags; \ + int fd_out; \ + unsigned int nbufs; \ + uv_buf_t* bufs; \ + int64_t offset; \ + uv_buf_t bufsml[4]; \ + } info; \ + struct { \ + double atime; \ + double mtime; \ + } time; \ + } fs; + +#define UV_WORK_PRIVATE_FIELDS \ + struct uv__work work_req; + +#define UV_FS_EVENT_PRIVATE_FIELDS \ + struct uv_fs_event_req_s { \ + UV_REQ_FIELDS \ + } req; \ + HANDLE dir_handle; \ + int req_pending; \ + uv_fs_event_cb cb; \ + WCHAR* filew; \ + WCHAR* short_filew; \ + WCHAR* dirw; \ + char* buffer; + +#define UV_SIGNAL_PRIVATE_FIELDS \ + RB_ENTRY(uv_signal_s) tree_entry; \ + struct uv_req_s signal_req; \ + unsigned long pending_signum; + +#ifndef F_OK +#define F_OK 0 +#endif +#ifndef R_OK +#define R_OK 4 +#endif +#ifndef W_OK +#define W_OK 2 +#endif +#ifndef X_OK +#define X_OK 1 +#endif + +/* fs open() flags supported on this platform: */ +#define UV_FS_O_APPEND _O_APPEND +#define UV_FS_O_CREAT _O_CREAT +#define UV_FS_O_EXCL _O_EXCL +#define UV_FS_O_RANDOM _O_RANDOM +#define UV_FS_O_RDONLY _O_RDONLY +#define UV_FS_O_RDWR _O_RDWR +#define UV_FS_O_SEQUENTIAL _O_SEQUENTIAL +#define UV_FS_O_SHORT_LIVED _O_SHORT_LIVED +#define UV_FS_O_TEMPORARY _O_TEMPORARY +#define UV_FS_O_TRUNC _O_TRUNC +#define UV_FS_O_WRONLY _O_WRONLY + +/* fs open() flags supported on other platforms (or mapped on this platform): */ +#define UV_FS_O_DIRECT 0x02000000 /* FILE_FLAG_NO_BUFFERING */ +#define UV_FS_O_DIRECTORY 0 +#define UV_FS_O_DSYNC 0x04000000 /* FILE_FLAG_WRITE_THROUGH */ +#define UV_FS_O_EXLOCK 0x10000000 /* EXCLUSIVE SHARING MODE */ +#define UV_FS_O_NOATIME 0 +#define UV_FS_O_NOCTTY 0 +#define UV_FS_O_NOFOLLOW 0 +#define UV_FS_O_NONBLOCK 0 +#define UV_FS_O_SYMLINK 0 +#define UV_FS_O_SYNC 0x08000000 /* FILE_FLAG_WRITE_THROUGH */ diff --cc Utilities/cmlibuv/src/idna.c index 0000000,13ffac6..13ffac6 mode 000000,100644..100644 --- a/Utilities/cmlibuv/src/idna.c +++ b/Utilities/cmlibuv/src/idna.c diff --cc Utilities/cmlibuv/src/idna.h index 0000000,8e0c592..8e0c592 mode 000000,100644..100644 --- a/Utilities/cmlibuv/src/idna.h +++ b/Utilities/cmlibuv/src/idna.h diff --cc Utilities/cmlibuv/src/inet.c index 7c75e43,0000000..58238dc mode 100644,000000..100644 --- a/Utilities/cmlibuv/src/inet.c +++ b/Utilities/cmlibuv/src/inet.c @@@ -1,309 -1,0 +1,302 @@@ +/* + * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 1996-1999 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include "uv.h" +#include "uv-common.h" + +#include +#include + +#if defined(_MSC_VER) && _MSC_VER < 1600 - # include "stdint-msvc2008.h" ++# include "uv/stdint-msvc2008.h" +#else +# include +#endif + +#define UV__INET_ADDRSTRLEN 16 +#define UV__INET6_ADDRSTRLEN 46 + + +static int inet_ntop4(const unsigned char *src, char *dst, size_t size); +static int inet_ntop6(const unsigned char *src, char *dst, size_t size); +static int inet_pton4(const char *src, unsigned char *dst); +static int inet_pton6(const char *src, unsigned char *dst); + + +int uv_inet_ntop(int af, const void* src, char* dst, size_t size) { + switch (af) { + case AF_INET: + return (inet_ntop4(src, dst, size)); + case AF_INET6: + return (inet_ntop6(src, dst, size)); + default: + return UV_EAFNOSUPPORT; + } + /* NOTREACHED */ +} + + +static int inet_ntop4(const unsigned char *src, char *dst, size_t size) { + static const char fmt[] = "%u.%u.%u.%u"; + char tmp[UV__INET_ADDRSTRLEN]; + int l; + + l = snprintf(tmp, sizeof(tmp), fmt, src[0], src[1], src[2], src[3]); + if (l <= 0 || (size_t) l >= size) { + return UV_ENOSPC; + } - strncpy(dst, tmp, size); - dst[size - 1] = '\0'; ++ uv__strscpy(dst, tmp, size); + return 0; +} + + +static int inet_ntop6(const unsigned char *src, char *dst, size_t size) { + /* + * Note that int32_t and int16_t need only be "at least" large enough + * to contain a value of the specified size. On some systems, like + * Crays, there is no such thing as an integer variable with 16 bits. + * Keep this in mind if you think this function should have been coded + * to use pointer overlays. All the world's not a VAX. + */ + char tmp[UV__INET6_ADDRSTRLEN], *tp; + struct { int base, len; } best, cur; + unsigned int words[sizeof(struct in6_addr) / sizeof(uint16_t)]; + int i; + + /* + * Preprocess: + * Copy the input (bytewise) array into a wordwise array. + * Find the longest run of 0x00's in src[] for :: shorthanding. + */ + memset(words, '\0', sizeof words); + for (i = 0; i < (int) sizeof(struct in6_addr); i++) + words[i / 2] |= (src[i] << ((1 - (i % 2)) << 3)); + best.base = -1; + best.len = 0; + cur.base = -1; + cur.len = 0; + for (i = 0; i < (int) ARRAY_SIZE(words); i++) { + if (words[i] == 0) { + if (cur.base == -1) + cur.base = i, cur.len = 1; + else + cur.len++; + } else { + if (cur.base != -1) { + if (best.base == -1 || cur.len > best.len) + best = cur; + cur.base = -1; + } + } + } + if (cur.base != -1) { + if (best.base == -1 || cur.len > best.len) + best = cur; + } + if (best.base != -1 && best.len < 2) + best.base = -1; + + /* + * Format the result. + */ + tp = tmp; + for (i = 0; i < (int) ARRAY_SIZE(words); i++) { + /* Are we inside the best run of 0x00's? */ + if (best.base != -1 && i >= best.base && + i < (best.base + best.len)) { + if (i == best.base) + *tp++ = ':'; + continue; + } + /* Are we following an initial run of 0x00s or any real hex? */ + if (i != 0) + *tp++ = ':'; + /* Is this address an encapsulated IPv4? */ + if (i == 6 && best.base == 0 && (best.len == 6 || + (best.len == 7 && words[7] != 0x0001) || + (best.len == 5 && words[5] == 0xffff))) { + int err = inet_ntop4(src+12, tp, sizeof tmp - (tp - tmp)); + if (err) + return err; + tp += strlen(tp); + break; + } + tp += sprintf(tp, "%x", words[i]); + } + /* Was it a trailing run of 0x00's? */ + if (best.base != -1 && (best.base + best.len) == ARRAY_SIZE(words)) + *tp++ = ':'; + *tp++ = '\0'; - - /* - * Check for overflow, copy, and we're done. - */ - if ((size_t)(tp - tmp) > size) { ++ if (UV_E2BIG == uv__strscpy(dst, tmp, size)) + return UV_ENOSPC; - } - strcpy(dst, tmp); + return 0; +} + + +int uv_inet_pton(int af, const char* src, void* dst) { + if (src == NULL || dst == NULL) + return UV_EINVAL; + + switch (af) { + case AF_INET: + return (inet_pton4(src, dst)); + case AF_INET6: { + int len; + char tmp[UV__INET6_ADDRSTRLEN], *s, *p; + s = (char*) src; + p = strchr(src, '%'); + if (p != NULL) { + s = tmp; + len = p - src; + if (len > UV__INET6_ADDRSTRLEN-1) + return UV_EINVAL; + memcpy(s, src, len); + s[len] = '\0'; + } + return inet_pton6(s, dst); + } + default: + return UV_EAFNOSUPPORT; + } + /* NOTREACHED */ +} + + +static int inet_pton4(const char *src, unsigned char *dst) { + static const char digits[] = "0123456789"; + int saw_digit, octets, ch; + unsigned char tmp[sizeof(struct in_addr)], *tp; + + saw_digit = 0; + octets = 0; + *(tp = tmp) = 0; + while ((ch = *src++) != '\0') { + const char *pch; + + if ((pch = strchr(digits, ch)) != NULL) { + unsigned int nw = *tp * 10 + (pch - digits); + + if (saw_digit && *tp == 0) + return UV_EINVAL; + if (nw > 255) + return UV_EINVAL; + *tp = nw; + if (!saw_digit) { + if (++octets > 4) + return UV_EINVAL; + saw_digit = 1; + } + } else if (ch == '.' && saw_digit) { + if (octets == 4) + return UV_EINVAL; + *++tp = 0; + saw_digit = 0; + } else + return UV_EINVAL; + } + if (octets < 4) + return UV_EINVAL; + memcpy(dst, tmp, sizeof(struct in_addr)); + return 0; +} + + +static int inet_pton6(const char *src, unsigned char *dst) { + static const char xdigits_l[] = "0123456789abcdef", + xdigits_u[] = "0123456789ABCDEF"; + unsigned char tmp[sizeof(struct in6_addr)], *tp, *endp, *colonp; + const char *xdigits, *curtok; + int ch, seen_xdigits; + unsigned int val; + + memset((tp = tmp), '\0', sizeof tmp); + endp = tp + sizeof tmp; + colonp = NULL; + /* Leading :: requires some special handling. */ + if (*src == ':') + if (*++src != ':') + return UV_EINVAL; + curtok = src; + seen_xdigits = 0; + val = 0; + while ((ch = *src++) != '\0') { + const char *pch; + + if ((pch = strchr((xdigits = xdigits_l), ch)) == NULL) + pch = strchr((xdigits = xdigits_u), ch); + if (pch != NULL) { + val <<= 4; + val |= (pch - xdigits); + if (++seen_xdigits > 4) + return UV_EINVAL; + continue; + } + if (ch == ':') { + curtok = src; + if (!seen_xdigits) { + if (colonp) + return UV_EINVAL; + colonp = tp; + continue; + } else if (*src == '\0') { + return UV_EINVAL; + } + if (tp + sizeof(uint16_t) > endp) + return UV_EINVAL; + *tp++ = (unsigned char) (val >> 8) & 0xff; + *tp++ = (unsigned char) val & 0xff; + seen_xdigits = 0; + val = 0; + continue; + } + if (ch == '.' && ((tp + sizeof(struct in_addr)) <= endp)) { + int err = inet_pton4(curtok, tp); + if (err == 0) { + tp += sizeof(struct in_addr); + seen_xdigits = 0; + break; /*%< '\\0' was seen by inet_pton4(). */ + } + } + return UV_EINVAL; + } + if (seen_xdigits) { + if (tp + sizeof(uint16_t) > endp) + return UV_EINVAL; + *tp++ = (unsigned char) (val >> 8) & 0xff; + *tp++ = (unsigned char) val & 0xff; + } + if (colonp != NULL) { + /* + * Since some memmove()'s erroneously fail to handle + * overlapping regions, we'll do the shift by hand. + */ + const int n = tp - colonp; + int i; + + if (tp == endp) + return UV_EINVAL; + for (i = 1; i <= n; i++) { + endp[- i] = colonp[n - i]; + colonp[n - i] = 0; + } + tp = endp; + } + if (tp != endp) + return UV_EINVAL; + memcpy(dst, tmp, sizeof tmp); + return 0; +} diff --cc Utilities/cmlibuv/src/strscpy.c index 0000000,2a2bdce..2a2bdce mode 000000,100644..100644 --- a/Utilities/cmlibuv/src/strscpy.c +++ b/Utilities/cmlibuv/src/strscpy.c diff --cc Utilities/cmlibuv/src/strscpy.h index 0000000,fbe0a39..fbe0a39 mode 000000,100644..100644 --- a/Utilities/cmlibuv/src/strscpy.h +++ b/Utilities/cmlibuv/src/strscpy.h diff --cc Utilities/cmlibuv/src/unix/core.c index a357ef3,0000000..a8d6adb mode 100644,000000..100644 --- a/Utilities/cmlibuv/src/unix/core.c +++ b/Utilities/cmlibuv/src/unix/core.c @@@ -1,1354 -1,0 +1,1428 @@@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "internal.h" + +#include /* NULL */ +#include /* printf */ +#include +#include /* strerror */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* INT_MAX, PATH_MAX, IOV_MAX */ +#include /* writev */ +#include /* getrusage */ +#include +#include ++#include + +#ifdef __sun +# include /* MAXHOSTNAMELEN on Solaris */ +# include +# include +# include +#endif + +#ifdef __APPLE__ +# include /* _NSGetExecutablePath */ +# include +# if defined(O_CLOEXEC) +# define UV__O_CLOEXEC O_CLOEXEC +# endif +#endif + +#if defined(__DragonFly__) || \ + defined(__FreeBSD__) || \ + defined(__FreeBSD_kernel__) || \ + defined(__NetBSD__) +# include +# include +# include +# include +# include +# define UV__O_CLOEXEC O_CLOEXEC +# if defined(__FreeBSD__) && __FreeBSD__ >= 10 +# define uv__accept4 accept4 +# endif +# if defined(__NetBSD__) +# define uv__accept4(a, b, c, d) paccept((a), (b), (c), NULL, (d)) +# endif +# if (defined(__FreeBSD__) && __FreeBSD__ >= 10) || defined(__NetBSD__) +# define UV__SOCK_NONBLOCK SOCK_NONBLOCK +# define UV__SOCK_CLOEXEC SOCK_CLOEXEC +# endif +# if !defined(F_DUP2FD_CLOEXEC) && defined(_F_DUP2FD_CLOEXEC) +# define F_DUP2FD_CLOEXEC _F_DUP2FD_CLOEXEC +# endif +#endif + +#if defined(__ANDROID_API__) && __ANDROID_API__ < 21 +# include /* for dlsym */ +#endif + +#if defined(__MVS__) +#include +#endif + +#if !defined(__MVS__) +#include /* MAXHOSTNAMELEN on Linux and the BSDs */ +#endif + +/* Fallback for the maximum hostname length */ +#ifndef MAXHOSTNAMELEN +# define MAXHOSTNAMELEN 256 +#endif + +static int uv__run_pending(uv_loop_t* loop); + +/* Verify that uv_buf_t is ABI-compatible with struct iovec. */ +STATIC_ASSERT(sizeof(uv_buf_t) == sizeof(struct iovec)); +STATIC_ASSERT(sizeof(&((uv_buf_t*) 0)->base) == + sizeof(((struct iovec*) 0)->iov_base)); +STATIC_ASSERT(sizeof(&((uv_buf_t*) 0)->len) == + sizeof(((struct iovec*) 0)->iov_len)); +STATIC_ASSERT(offsetof(uv_buf_t, base) == offsetof(struct iovec, iov_base)); +STATIC_ASSERT(offsetof(uv_buf_t, len) == offsetof(struct iovec, iov_len)); + + +uint64_t uv_hrtime(void) { + return uv__hrtime(UV_CLOCK_PRECISE); +} + + +void uv_close(uv_handle_t* handle, uv_close_cb close_cb) { + assert(!uv__is_closing(handle)); + - handle->flags |= UV_CLOSING; ++ handle->flags |= UV_HANDLE_CLOSING; + handle->close_cb = close_cb; + + switch (handle->type) { + case UV_NAMED_PIPE: + uv__pipe_close((uv_pipe_t*)handle); + break; + + case UV_TTY: + uv__stream_close((uv_stream_t*)handle); + break; + + case UV_TCP: + uv__tcp_close((uv_tcp_t*)handle); + break; + + case UV_UDP: + uv__udp_close((uv_udp_t*)handle); + break; + + case UV_PREPARE: + uv__prepare_close((uv_prepare_t*)handle); + break; + + case UV_CHECK: + uv__check_close((uv_check_t*)handle); + break; + + case UV_IDLE: + uv__idle_close((uv_idle_t*)handle); + break; + + case UV_ASYNC: + uv__async_close((uv_async_t*)handle); + break; + + case UV_TIMER: + uv__timer_close((uv_timer_t*)handle); + break; + + case UV_PROCESS: + uv__process_close((uv_process_t*)handle); + break; + + case UV_FS_EVENT: + uv__fs_event_close((uv_fs_event_t*)handle); + break; + + case UV_POLL: + uv__poll_close((uv_poll_t*)handle); + break; + + case UV_FS_POLL: + uv__fs_poll_close((uv_fs_poll_t*)handle); + break; + + case UV_SIGNAL: + uv__signal_close((uv_signal_t*) handle); - /* Signal handles may not be closed immediately. The signal code will */ - /* itself close uv__make_close_pending whenever appropriate. */ ++ /* Signal handles may not be closed immediately. The signal code will ++ * itself close uv__make_close_pending whenever appropriate. */ + return; + + default: + assert(0); + } + + uv__make_close_pending(handle); +} + +int uv__socket_sockopt(uv_handle_t* handle, int optname, int* value) { + int r; + int fd; + socklen_t len; + + if (handle == NULL || value == NULL) + return UV_EINVAL; + + if (handle->type == UV_TCP || handle->type == UV_NAMED_PIPE) + fd = uv__stream_fd((uv_stream_t*) handle); + else if (handle->type == UV_UDP) + fd = ((uv_udp_t *) handle)->io_watcher.fd; + else + return UV_ENOTSUP; + + len = sizeof(*value); + + if (*value == 0) + r = getsockopt(fd, SOL_SOCKET, optname, value, &len); + else + r = setsockopt(fd, SOL_SOCKET, optname, (const void*) value, len); + + if (r < 0) + return UV__ERR(errno); + + return 0; +} + +void uv__make_close_pending(uv_handle_t* handle) { - assert(handle->flags & UV_CLOSING); - assert(!(handle->flags & UV_CLOSED)); ++ assert(handle->flags & UV_HANDLE_CLOSING); ++ assert(!(handle->flags & UV_HANDLE_CLOSED)); + handle->next_closing = handle->loop->closing_handles; + handle->loop->closing_handles = handle; +} + +int uv__getiovmax(void) { +#if defined(IOV_MAX) + return IOV_MAX; +#elif defined(_SC_IOV_MAX) + static int iovmax = -1; + if (iovmax == -1) { + iovmax = sysconf(_SC_IOV_MAX); + /* On some embedded devices (arm-linux-uclibc based ip camera), + * sysconf(_SC_IOV_MAX) can not get the correct value. The return + * value is -1 and the errno is EINPROGRESS. Degrade the value to 1. + */ + if (iovmax == -1) iovmax = 1; + } + return iovmax; +#else + return 1024; +#endif +} + + +static void uv__finish_close(uv_handle_t* handle) { - /* Note: while the handle is in the UV_CLOSING state now, it's still possible - * for it to be active in the sense that uv__is_active() returns true. ++ /* Note: while the handle is in the UV_HANDLE_CLOSING state now, it's still ++ * possible for it to be active in the sense that uv__is_active() returns ++ * true. ++ * + * A good example is when the user calls uv_shutdown(), immediately followed + * by uv_close(). The handle is considered active at this point because the + * completion of the shutdown req is still pending. + */ - assert(handle->flags & UV_CLOSING); - assert(!(handle->flags & UV_CLOSED)); - handle->flags |= UV_CLOSED; ++ assert(handle->flags & UV_HANDLE_CLOSING); ++ assert(!(handle->flags & UV_HANDLE_CLOSED)); ++ handle->flags |= UV_HANDLE_CLOSED; + + switch (handle->type) { + case UV_PREPARE: + case UV_CHECK: + case UV_IDLE: + case UV_ASYNC: + case UV_TIMER: + case UV_PROCESS: + case UV_FS_EVENT: + case UV_FS_POLL: + case UV_POLL: + case UV_SIGNAL: + break; + + case UV_NAMED_PIPE: + case UV_TCP: + case UV_TTY: + uv__stream_destroy((uv_stream_t*)handle); + break; + + case UV_UDP: + uv__udp_finish_close((uv_udp_t*)handle); + break; + + default: + assert(0); + break; + } + + uv__handle_unref(handle); + QUEUE_REMOVE(&handle->handle_queue); + + if (handle->close_cb) { + handle->close_cb(handle); + } +} + + +static void uv__run_closing_handles(uv_loop_t* loop) { + uv_handle_t* p; + uv_handle_t* q; + + p = loop->closing_handles; + loop->closing_handles = NULL; + + while (p) { + q = p->next_closing; + uv__finish_close(p); + p = q; + } +} + + +int uv_is_closing(const uv_handle_t* handle) { + return uv__is_closing(handle); +} + + +int uv_backend_fd(const uv_loop_t* loop) { + return loop->backend_fd; +} + + +int uv_backend_timeout(const uv_loop_t* loop) { + if (loop->stop_flag != 0) + return 0; + + if (!uv__has_active_handles(loop) && !uv__has_active_reqs(loop)) + return 0; + + if (!QUEUE_EMPTY(&loop->idle_handles)) + return 0; + + if (!QUEUE_EMPTY(&loop->pending_queue)) + return 0; + + if (loop->closing_handles) + return 0; + + return uv__next_timeout(loop); +} + + +static int uv__loop_alive(const uv_loop_t* loop) { + return uv__has_active_handles(loop) || + uv__has_active_reqs(loop) || + loop->closing_handles != NULL; +} + + +int uv_loop_alive(const uv_loop_t* loop) { + return uv__loop_alive(loop); +} + + +int uv_run(uv_loop_t* loop, uv_run_mode mode) { + int timeout; + int r; + int ran_pending; + + r = uv__loop_alive(loop); + if (!r) + uv__update_time(loop); + + while (r != 0 && loop->stop_flag == 0) { + uv__update_time(loop); + uv__run_timers(loop); + ran_pending = uv__run_pending(loop); + uv__run_idle(loop); + uv__run_prepare(loop); + + timeout = 0; + if ((mode == UV_RUN_ONCE && !ran_pending) || mode == UV_RUN_DEFAULT) + timeout = uv_backend_timeout(loop); + + uv__io_poll(loop, timeout); + uv__run_check(loop); + uv__run_closing_handles(loop); + + if (mode == UV_RUN_ONCE) { + /* UV_RUN_ONCE implies forward progress: at least one callback must have + * been invoked when it returns. uv__io_poll() can return without doing + * I/O (meaning: no callbacks) when its timeout expires - which means we + * have pending timers that satisfy the forward progress constraint. + * + * UV_RUN_NOWAIT makes no guarantees about progress so it's omitted from + * the check. + */ + uv__update_time(loop); + uv__run_timers(loop); + } + + r = uv__loop_alive(loop); + if (mode == UV_RUN_ONCE || mode == UV_RUN_NOWAIT) + break; + } + + /* The if statement lets gcc compile it to a conditional store. Avoids + * dirtying a cache line. + */ + if (loop->stop_flag != 0) + loop->stop_flag = 0; + + return r; +} + + +void uv_update_time(uv_loop_t* loop) { + uv__update_time(loop); +} + + +int uv_is_active(const uv_handle_t* handle) { + return uv__is_active(handle); +} + + +/* Open a socket in non-blocking close-on-exec mode, atomically if possible. */ +int uv__socket(int domain, int type, int protocol) { + int sockfd; + int err; + +#if defined(SOCK_NONBLOCK) && defined(SOCK_CLOEXEC) + sockfd = socket(domain, type | SOCK_NONBLOCK | SOCK_CLOEXEC, protocol); + if (sockfd != -1) + return sockfd; + + if (errno != EINVAL) + return UV__ERR(errno); +#endif + + sockfd = socket(domain, type, protocol); + if (sockfd == -1) + return UV__ERR(errno); + + err = uv__nonblock(sockfd, 1); + if (err == 0) + err = uv__cloexec(sockfd, 1); + + if (err) { + uv__close(sockfd); + return err; + } + +#if defined(SO_NOSIGPIPE) + { + int on = 1; + setsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE, &on, sizeof(on)); + } +#endif + + return sockfd; +} + +/* get a file pointer to a file in read-only and close-on-exec mode */ +FILE* uv__open_file(const char* path) { + int fd; + FILE* fp; + + fd = uv__open_cloexec(path, O_RDONLY); + if (fd < 0) + return NULL; + + fp = fdopen(fd, "r"); + if (fp == NULL) + uv__close(fd); + + return fp; +} + + +int uv__accept(int sockfd) { + int peerfd; + int err; + + assert(sockfd >= 0); + + while (1) { +#if defined(__linux__) || \ + (defined(__FreeBSD__) && __FreeBSD__ >= 10) || \ + defined(__NetBSD__) + static int no_accept4; + + if (no_accept4) + goto skip; + + peerfd = uv__accept4(sockfd, + NULL, + NULL, + UV__SOCK_NONBLOCK|UV__SOCK_CLOEXEC); + if (peerfd != -1) + return peerfd; + + if (errno == EINTR) + continue; + + if (errno != ENOSYS) + return UV__ERR(errno); + + no_accept4 = 1; +skip: +#endif + + peerfd = accept(sockfd, NULL, NULL); + if (peerfd == -1) { + if (errno == EINTR) + continue; + return UV__ERR(errno); + } + + err = uv__cloexec(peerfd, 1); + if (err == 0) + err = uv__nonblock(peerfd, 1); + + if (err) { + uv__close(peerfd); + return err; + } + + return peerfd; + } +} + + +int uv__close_nocheckstdio(int fd) { + int saved_errno; + int rc; + + assert(fd > -1); /* Catch uninitialized io_watcher.fd bugs. */ + + saved_errno = errno; + rc = close(fd); + if (rc == -1) { + rc = UV__ERR(errno); + if (rc == UV_EINTR || rc == UV__ERR(EINPROGRESS)) + rc = 0; /* The close is in progress, not an error. */ + errno = saved_errno; + } + + return rc; +} + + +int uv__close(int fd) { + assert(fd > STDERR_FILENO); /* Catch stdio close bugs. */ +#if defined(__MVS__) + SAVE_ERRNO(epoll_file_close(fd)); +#endif + return uv__close_nocheckstdio(fd); +} + + +int uv__nonblock_ioctl(int fd, int set) { + int r; + + do + r = ioctl(fd, FIONBIO, &set); + while (r == -1 && errno == EINTR); + + if (r) + return UV__ERR(errno); + + return 0; +} + + +#if !defined(__CYGWIN__) && !defined(__MSYS__) +int uv__cloexec_ioctl(int fd, int set) { + int r; + + do + r = ioctl(fd, set ? FIOCLEX : FIONCLEX); + while (r == -1 && errno == EINTR); + + if (r) + return UV__ERR(errno); + + return 0; +} +#endif + + +int uv__nonblock_fcntl(int fd, int set) { + int flags; + int r; + + do + r = fcntl(fd, F_GETFL); + while (r == -1 && errno == EINTR); + + if (r == -1) + return UV__ERR(errno); + + /* Bail out now if already set/clear. */ + if (!!(r & O_NONBLOCK) == !!set) + return 0; + + if (set) + flags = r | O_NONBLOCK; + else + flags = r & ~O_NONBLOCK; + + do + r = fcntl(fd, F_SETFL, flags); + while (r == -1 && errno == EINTR); + + if (r) + return UV__ERR(errno); + + return 0; +} + + +int uv__cloexec_fcntl(int fd, int set) { + int flags; + int r; + + do + r = fcntl(fd, F_GETFD); + while (r == -1 && errno == EINTR); + + if (r == -1) + return UV__ERR(errno); + + /* Bail out now if already set/clear. */ + if (!!(r & FD_CLOEXEC) == !!set) + return 0; + + if (set) + flags = r | FD_CLOEXEC; + else + flags = r & ~FD_CLOEXEC; + + do + r = fcntl(fd, F_SETFD, flags); + while (r == -1 && errno == EINTR); + + if (r) + return UV__ERR(errno); + + return 0; +} + + - /* This function is not execve-safe, there is a race window - * between the call to dup() and fcntl(FD_CLOEXEC). - */ - int uv__dup(int fd) { - int err; - - fd = dup(fd); - - if (fd == -1) - return UV__ERR(errno); - - err = uv__cloexec(fd, 1); - if (err) { - uv__close(fd); - return err; - } - - return fd; - } - - +ssize_t uv__recvmsg(int fd, struct msghdr* msg, int flags) { + struct cmsghdr* cmsg; + ssize_t rc; + int* pfd; + int* end; +#if defined(__linux__) + static int no_msg_cmsg_cloexec; + if (no_msg_cmsg_cloexec == 0) { + rc = recvmsg(fd, msg, flags | 0x40000000); /* MSG_CMSG_CLOEXEC */ + if (rc != -1) + return rc; + if (errno != EINVAL) + return UV__ERR(errno); + rc = recvmsg(fd, msg, flags); + if (rc == -1) + return UV__ERR(errno); + no_msg_cmsg_cloexec = 1; + } else { + rc = recvmsg(fd, msg, flags); + } +#else + rc = recvmsg(fd, msg, flags); +#endif + if (rc == -1) + return UV__ERR(errno); + if (msg->msg_controllen == 0) + return rc; + for (cmsg = CMSG_FIRSTHDR(msg); cmsg != NULL; cmsg = CMSG_NXTHDR(msg, cmsg)) + if (cmsg->cmsg_type == SCM_RIGHTS) + for (pfd = (int*) CMSG_DATA(cmsg), + end = (int*) ((char*) cmsg + cmsg->cmsg_len); + pfd < end; + pfd += 1) + uv__cloexec(*pfd, 1); + return rc; +} + + +int uv_cwd(char* buffer, size_t* size) { + if (buffer == NULL || size == NULL) + return UV_EINVAL; + + if (getcwd(buffer, *size) == NULL) + return UV__ERR(errno); + + *size = strlen(buffer); + if (*size > 1 && buffer[*size - 1] == '/') { + buffer[*size-1] = '\0'; + (*size)--; + } + + return 0; +} + + +int uv_chdir(const char* dir) { + if (chdir(dir)) + return UV__ERR(errno); + + return 0; +} + + +void uv_disable_stdio_inheritance(void) { + int fd; + + /* Set the CLOEXEC flag on all open descriptors. Unconditionally try the + * first 16 file descriptors. After that, bail out after the first error. + */ + for (fd = 0; ; fd++) + if (uv__cloexec(fd, 1) && fd > 15) + break; +} + + +int uv_fileno(const uv_handle_t* handle, uv_os_fd_t* fd) { + int fd_out; + + switch (handle->type) { + case UV_TCP: + case UV_NAMED_PIPE: + case UV_TTY: + fd_out = uv__stream_fd((uv_stream_t*) handle); + break; + + case UV_UDP: + fd_out = ((uv_udp_t *) handle)->io_watcher.fd; + break; + + case UV_POLL: + fd_out = ((uv_poll_t *) handle)->io_watcher.fd; + break; + + default: + return UV_EINVAL; + } + + if (uv__is_closing(handle) || fd_out == -1) + return UV_EBADF; + + *fd = fd_out; + return 0; +} + + +static int uv__run_pending(uv_loop_t* loop) { + QUEUE* q; + QUEUE pq; + uv__io_t* w; + + if (QUEUE_EMPTY(&loop->pending_queue)) + return 0; + + QUEUE_MOVE(&loop->pending_queue, &pq); + + while (!QUEUE_EMPTY(&pq)) { + q = QUEUE_HEAD(&pq); + QUEUE_REMOVE(q); + QUEUE_INIT(q); + w = QUEUE_DATA(q, uv__io_t, pending_queue); + w->cb(loop, w, POLLOUT); + } + + return 1; +} + + +static unsigned int next_power_of_two(unsigned int val) { + val -= 1; + val |= val >> 1; + val |= val >> 2; + val |= val >> 4; + val |= val >> 8; + val |= val >> 16; + val += 1; + return val; +} + +static void maybe_resize(uv_loop_t* loop, unsigned int len) { + uv__io_t** watchers; + void* fake_watcher_list; + void* fake_watcher_count; + unsigned int nwatchers; + unsigned int i; + + if (len <= loop->nwatchers) + return; + + /* Preserve fake watcher list and count at the end of the watchers */ + if (loop->watchers != NULL) { + fake_watcher_list = loop->watchers[loop->nwatchers]; + fake_watcher_count = loop->watchers[loop->nwatchers + 1]; + } else { + fake_watcher_list = NULL; + fake_watcher_count = NULL; + } + + nwatchers = next_power_of_two(len + 2) - 2; + watchers = uv__realloc(loop->watchers, + (nwatchers + 2) * sizeof(loop->watchers[0])); + + if (watchers == NULL) + abort(); + for (i = loop->nwatchers; i < nwatchers; i++) + watchers[i] = NULL; + watchers[nwatchers] = fake_watcher_list; + watchers[nwatchers + 1] = fake_watcher_count; + + loop->watchers = watchers; + loop->nwatchers = nwatchers; +} + + +void uv__io_init(uv__io_t* w, uv__io_cb cb, int fd) { + assert(cb != NULL); + assert(fd >= -1); + QUEUE_INIT(&w->pending_queue); + QUEUE_INIT(&w->watcher_queue); + w->cb = cb; + w->fd = fd; + w->events = 0; + w->pevents = 0; + +#if defined(UV_HAVE_KQUEUE) + w->rcount = 0; + w->wcount = 0; +#endif /* defined(UV_HAVE_KQUEUE) */ +} + + +void uv__io_start(uv_loop_t* loop, uv__io_t* w, unsigned int events) { + assert(0 == (events & ~(POLLIN | POLLOUT | UV__POLLRDHUP | UV__POLLPRI))); + assert(0 != events); + assert(w->fd >= 0); + assert(w->fd < INT_MAX); + + w->pevents |= events; + maybe_resize(loop, w->fd + 1); + +#if !defined(__sun) + /* The event ports backend needs to rearm all file descriptors on each and + * every tick of the event loop but the other backends allow us to + * short-circuit here if the event mask is unchanged. + */ + if (w->events == w->pevents) + return; +#endif + + if (QUEUE_EMPTY(&w->watcher_queue)) + QUEUE_INSERT_TAIL(&loop->watcher_queue, &w->watcher_queue); + + if (loop->watchers[w->fd] == NULL) { + loop->watchers[w->fd] = w; + loop->nfds++; + } +} + + +void uv__io_stop(uv_loop_t* loop, uv__io_t* w, unsigned int events) { + assert(0 == (events & ~(POLLIN | POLLOUT | UV__POLLRDHUP | UV__POLLPRI))); + assert(0 != events); + + if (w->fd == -1) + return; + + assert(w->fd >= 0); + + /* Happens when uv__io_stop() is called on a handle that was never started. */ + if ((unsigned) w->fd >= loop->nwatchers) + return; + + w->pevents &= ~events; + + if (w->pevents == 0) { + QUEUE_REMOVE(&w->watcher_queue); + QUEUE_INIT(&w->watcher_queue); + + if (loop->watchers[w->fd] != NULL) { + assert(loop->watchers[w->fd] == w); + assert(loop->nfds > 0); + loop->watchers[w->fd] = NULL; + loop->nfds--; + w->events = 0; + } + } + else if (QUEUE_EMPTY(&w->watcher_queue)) + QUEUE_INSERT_TAIL(&loop->watcher_queue, &w->watcher_queue); +} + + +void uv__io_close(uv_loop_t* loop, uv__io_t* w) { + uv__io_stop(loop, w, POLLIN | POLLOUT | UV__POLLRDHUP | UV__POLLPRI); + QUEUE_REMOVE(&w->pending_queue); + + /* Remove stale events for this file descriptor */ + uv__platform_invalidate_fd(loop, w->fd); +} + + +void uv__io_feed(uv_loop_t* loop, uv__io_t* w) { + if (QUEUE_EMPTY(&w->pending_queue)) + QUEUE_INSERT_TAIL(&loop->pending_queue, &w->pending_queue); +} + + +int uv__io_active(const uv__io_t* w, unsigned int events) { + assert(0 == (events & ~(POLLIN | POLLOUT | UV__POLLRDHUP | UV__POLLPRI))); + assert(0 != events); + return 0 != (w->pevents & events); +} + + ++int uv__fd_exists(uv_loop_t* loop, int fd) { ++ return (unsigned) fd < loop->nwatchers && loop->watchers[fd] != NULL; ++} ++ ++ +int uv_getrusage(uv_rusage_t* rusage) { + struct rusage usage; + + if (getrusage(RUSAGE_SELF, &usage)) + return UV__ERR(errno); + + rusage->ru_utime.tv_sec = usage.ru_utime.tv_sec; + rusage->ru_utime.tv_usec = usage.ru_utime.tv_usec; + + rusage->ru_stime.tv_sec = usage.ru_stime.tv_sec; + rusage->ru_stime.tv_usec = usage.ru_stime.tv_usec; + +#if !defined(__MVS__) + rusage->ru_maxrss = usage.ru_maxrss; + rusage->ru_ixrss = usage.ru_ixrss; + rusage->ru_idrss = usage.ru_idrss; + rusage->ru_isrss = usage.ru_isrss; + rusage->ru_minflt = usage.ru_minflt; + rusage->ru_majflt = usage.ru_majflt; + rusage->ru_nswap = usage.ru_nswap; + rusage->ru_inblock = usage.ru_inblock; + rusage->ru_oublock = usage.ru_oublock; + rusage->ru_msgsnd = usage.ru_msgsnd; + rusage->ru_msgrcv = usage.ru_msgrcv; + rusage->ru_nsignals = usage.ru_nsignals; + rusage->ru_nvcsw = usage.ru_nvcsw; + rusage->ru_nivcsw = usage.ru_nivcsw; +#endif + + return 0; +} + + +int uv__open_cloexec(const char* path, int flags) { + int err; + int fd; + +#if defined(UV__O_CLOEXEC) + static int no_cloexec; + + if (!no_cloexec) { + fd = open(path, flags | UV__O_CLOEXEC); + if (fd != -1) + return fd; + + if (errno != EINVAL) + return UV__ERR(errno); + + /* O_CLOEXEC not supported. */ + no_cloexec = 1; + } +#endif + + fd = open(path, flags); + if (fd == -1) + return UV__ERR(errno); + + err = uv__cloexec(fd, 1); + if (err) { + uv__close(fd); + return err; + } + + return fd; +} + + +int uv__dup2_cloexec(int oldfd, int newfd) { + int r; +#if (defined(__FreeBSD__) && __FreeBSD__ >= 10) || defined(__NetBSD__) + r = dup3(oldfd, newfd, O_CLOEXEC); + if (r == -1) + return UV__ERR(errno); + return r; +#elif defined(__FreeBSD__) && defined(F_DUP2FD_CLOEXEC) + r = fcntl(oldfd, F_DUP2FD_CLOEXEC, newfd); + if (r != -1) + return r; + if (errno != EINVAL) + return UV__ERR(errno); + /* Fall through. */ +#elif defined(__linux__) + static int no_dup3; + if (!no_dup3) { + do + r = uv__dup3(oldfd, newfd, UV__O_CLOEXEC); + while (r == -1 && errno == EBUSY); + if (r != -1) + return r; + if (errno != ENOSYS) + return UV__ERR(errno); + /* Fall through. */ + no_dup3 = 1; + } +#endif + { + int err; + do + r = dup2(oldfd, newfd); +#if defined(__linux__) + while (r == -1 && errno == EBUSY); +#else + while (0); /* Never retry. */ +#endif + + if (r == -1) + return UV__ERR(errno); + + err = uv__cloexec(newfd, 1); + if (err) { + uv__close(newfd); + return err; + } + + return r; + } +} + + +int uv_os_homedir(char* buffer, size_t* size) { + uv_passwd_t pwd; + size_t len; + int r; + + /* Check if the HOME environment variable is set first. The task of + performing input validation on buffer and size is taken care of by + uv_os_getenv(). */ + r = uv_os_getenv("HOME", buffer, size); + + if (r != UV_ENOENT) + return r; + + /* HOME is not set, so call uv__getpwuid_r() */ + r = uv__getpwuid_r(&pwd); + + if (r != 0) { + return r; + } + + len = strlen(pwd.homedir); + + if (len >= *size) { + *size = len + 1; + uv_os_free_passwd(&pwd); + return UV_ENOBUFS; + } + + memcpy(buffer, pwd.homedir, len + 1); + *size = len; + uv_os_free_passwd(&pwd); + + return 0; +} + + +int uv_os_tmpdir(char* buffer, size_t* size) { + const char* buf; + size_t len; + + if (buffer == NULL || size == NULL || *size == 0) + return UV_EINVAL; + +#define CHECK_ENV_VAR(name) \ + do { \ + buf = getenv(name); \ + if (buf != NULL) \ + goto return_buffer; \ + } \ + while (0) + + /* Check the TMPDIR, TMP, TEMP, and TEMPDIR environment variables in order */ + CHECK_ENV_VAR("TMPDIR"); + CHECK_ENV_VAR("TMP"); + CHECK_ENV_VAR("TEMP"); + CHECK_ENV_VAR("TEMPDIR"); + +#undef CHECK_ENV_VAR + + /* No temp environment variables defined */ + #if defined(__ANDROID__) + buf = "/data/local/tmp"; + #else + buf = "/tmp"; + #endif + +return_buffer: + len = strlen(buf); + + if (len >= *size) { + *size = len + 1; + return UV_ENOBUFS; + } + + /* The returned directory should not have a trailing slash. */ + if (len > 1 && buf[len - 1] == '/') { + len--; + } + + memcpy(buffer, buf, len + 1); + buffer[len] = '\0'; + *size = len; + + return 0; +} + + +int uv__getpwuid_r(uv_passwd_t* pwd) { + struct passwd pw; + struct passwd* result; + char* buf; + uid_t uid; + size_t bufsize; + size_t name_size; + size_t homedir_size; + size_t shell_size; + long initsize; + int r; +#if defined(__ANDROID_API__) && __ANDROID_API__ < 21 + int (*getpwuid_r)(uid_t, struct passwd*, char*, size_t, struct passwd**); + + getpwuid_r = dlsym(RTLD_DEFAULT, "getpwuid_r"); + if (getpwuid_r == NULL) + return UV_ENOSYS; +#endif + + if (pwd == NULL) + return UV_EINVAL; + + initsize = sysconf(_SC_GETPW_R_SIZE_MAX); + + if (initsize <= 0) + bufsize = 4096; + else + bufsize = (size_t) initsize; + + uid = geteuid(); + buf = NULL; + + for (;;) { + uv__free(buf); + buf = uv__malloc(bufsize); + + if (buf == NULL) + return UV_ENOMEM; + + r = getpwuid_r(uid, &pw, buf, bufsize, &result); + + if (r != ERANGE) + break; + + bufsize *= 2; + } + + if (r != 0) { + uv__free(buf); + return -r; + } + + if (result == NULL) { + uv__free(buf); + return UV_ENOENT; + } + + /* Allocate memory for the username, shell, and home directory */ + name_size = strlen(pw.pw_name) + 1; + homedir_size = strlen(pw.pw_dir) + 1; + shell_size = strlen(pw.pw_shell) + 1; + pwd->username = uv__malloc(name_size + homedir_size + shell_size); + + if (pwd->username == NULL) { + uv__free(buf); + return UV_ENOMEM; + } + + /* Copy the username */ + memcpy(pwd->username, pw.pw_name, name_size); + + /* Copy the home directory */ + pwd->homedir = pwd->username + name_size; + memcpy(pwd->homedir, pw.pw_dir, homedir_size); + + /* Copy the shell */ + pwd->shell = pwd->homedir + homedir_size; + memcpy(pwd->shell, pw.pw_shell, shell_size); + + /* Copy the uid and gid */ + pwd->uid = pw.pw_uid; + pwd->gid = pw.pw_gid; + + uv__free(buf); + + return 0; +} + + +void uv_os_free_passwd(uv_passwd_t* pwd) { + if (pwd == NULL) + return; + + /* + The memory for name, shell, and homedir are allocated in a single + uv__malloc() call. The base of the pointer is stored in pwd->username, so + that is the field that needs to be freed. + */ + uv__free(pwd->username); + pwd->username = NULL; + pwd->shell = NULL; + pwd->homedir = NULL; +} + + +int uv_os_get_passwd(uv_passwd_t* pwd) { + return uv__getpwuid_r(pwd); +} + + +int uv_translate_sys_error(int sys_errno) { + /* If < 0 then it's already a libuv error. */ + return sys_errno <= 0 ? sys_errno : -sys_errno; +} + + +int uv_os_getenv(const char* name, char* buffer, size_t* size) { + char* var; + size_t len; + + if (name == NULL || buffer == NULL || size == NULL || *size == 0) + return UV_EINVAL; + + var = getenv(name); + + if (var == NULL) + return UV_ENOENT; + + len = strlen(var); + + if (len >= *size) { + *size = len + 1; + return UV_ENOBUFS; + } + + memcpy(buffer, var, len + 1); + *size = len; + + return 0; +} + + +int uv_os_setenv(const char* name, const char* value) { + if (name == NULL || value == NULL) + return UV_EINVAL; + + if (setenv(name, value, 1) != 0) + return UV__ERR(errno); + + return 0; +} + + +int uv_os_unsetenv(const char* name) { + if (name == NULL) + return UV_EINVAL; + + if (unsetenv(name) != 0) + return UV__ERR(errno); + + return 0; +} + + +int uv_os_gethostname(char* buffer, size_t* size) { + /* + On some platforms, if the input buffer is not large enough, gethostname() + succeeds, but truncates the result. libuv can detect this and return ENOBUFS + instead by creating a large enough buffer and comparing the hostname length + to the size input. + */ + char buf[MAXHOSTNAMELEN + 1]; + size_t len; + + if (buffer == NULL || size == NULL || *size == 0) + return UV_EINVAL; + + if (gethostname(buf, sizeof(buf)) != 0) + return UV__ERR(errno); + + buf[sizeof(buf) - 1] = '\0'; /* Null terminate, just to be safe. */ + len = strlen(buf); + + if (len >= *size) { + *size = len + 1; + return UV_ENOBUFS; + } + + memcpy(buffer, buf, len + 1); + *size = len; + return 0; +} + + +int uv_cpumask_size(void) { +#if defined(__linux__) || defined(__FreeBSD__) + return CPU_SETSIZE; +#else + return UV_ENOTSUP; +#endif +} + + +uv_os_fd_t uv_get_osfhandle(int fd) { + return fd; +} + ++int uv_open_osfhandle(uv_os_fd_t os_fd) { ++ return os_fd; ++} + +uv_pid_t uv_os_getpid(void) { + return getpid(); +} + + +uv_pid_t uv_os_getppid(void) { + return getppid(); +} ++ ++ ++int uv_os_getpriority(uv_pid_t pid, int* priority) { ++ int r; ++ ++ if (priority == NULL) ++ return UV_EINVAL; ++ ++ errno = 0; ++ r = getpriority(PRIO_PROCESS, (int) pid); ++ ++ if (r == -1 && errno != 0) ++ return UV__ERR(errno); ++ ++ *priority = r; ++ return 0; ++} ++ ++ ++int uv_os_setpriority(uv_pid_t pid, int priority) { ++ if (priority < UV_PRIORITY_HIGHEST || priority > UV_PRIORITY_LOW) ++ return UV_EINVAL; ++ ++ if (setpriority(PRIO_PROCESS, (int) pid, priority) != 0) ++ return UV__ERR(errno); ++ ++ return 0; ++} ++ ++ ++int uv_os_uname(uv_utsname_t* buffer) { ++ struct utsname buf; ++ int r; ++ ++ if (buffer == NULL) ++ return UV_EINVAL; ++ ++ if (uname(&buf) == -1) { ++ r = UV__ERR(errno); ++ goto error; ++ } ++ ++ r = uv__strscpy(buffer->sysname, buf.sysname, sizeof(buffer->sysname)); ++ if (r == UV_E2BIG) ++ goto error; ++ ++#ifdef _AIX ++ r = snprintf(buffer->release, ++ sizeof(buffer->release), ++ "%s.%s", ++ buf.version, ++ buf.release); ++ if (r >= sizeof(buffer->release)) { ++ r = UV_E2BIG; ++ goto error; ++ } ++#else ++ r = uv__strscpy(buffer->release, buf.release, sizeof(buffer->release)); ++ if (r == UV_E2BIG) ++ goto error; ++#endif ++ ++ r = uv__strscpy(buffer->version, buf.version, sizeof(buffer->version)); ++ if (r == UV_E2BIG) ++ goto error; ++ ++#if defined(_AIX) || defined(__PASE__) ++ r = uv__strscpy(buffer->machine, "ppc64", sizeof(buffer->machine)); ++#else ++ r = uv__strscpy(buffer->machine, buf.machine, sizeof(buffer->machine)); ++#endif ++ ++ if (r == UV_E2BIG) ++ goto error; ++ ++ return 0; ++ ++error: ++ buffer->sysname[0] = '\0'; ++ buffer->release[0] = '\0'; ++ buffer->version[0] = '\0'; ++ buffer->machine[0] = '\0'; ++ return r; ++} diff --cc Utilities/cmlibuv/src/unix/fs.c index a6cc6db,0000000..bffc956 mode 100644,000000..100644 --- a/Utilities/cmlibuv/src/unix/fs.c +++ b/Utilities/cmlibuv/src/unix/fs.c @@@ -1,1596 -1,0 +1,1627 @@@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +/* Caveat emptor: this file deviates from the libuv convention of returning + * negated errno codes. Most uv_fs_*() functions map directly to the system + * call of the same name. For more complex wrappers, it's easier to just + * return -1 with errno set. The dispatcher in uv__fs_work() takes care of + * getting the errno to the right place (req->result or as the return value.) + */ + +#include "uv.h" +#include "internal.h" + +#include +#include +#include +#include +#include /* PATH_MAX */ + +#include +#include +#include +#include +#include +#include +#include +#include - #include +#include + +#if defined(__DragonFly__) || \ + defined(__FreeBSD__) || \ + defined(__FreeBSD_kernel_) || \ + defined(__OpenBSD__) || \ + defined(__NetBSD__) +# define HAVE_PREADV 1 +#else +# define HAVE_PREADV 0 +#endif + +#if defined(__linux__) || defined(__sun) +# include +#endif + +#if defined(__APPLE__) +# include ++# include +#elif defined(__linux__) && !defined(FICLONE) +# include +# define FICLONE _IOW(0x94, 9, int) +#endif + ++#if defined(_AIX) && !defined(_AIX71) ++# include ++#endif ++ ++#if defined(_AIX) && _XOPEN_SOURCE <= 600 ++extern char *mkdtemp(char *template); /* See issue #740 on AIX < 7 */ ++#endif ++ +#define INIT(subtype) \ + do { \ + if (req == NULL) \ + return UV_EINVAL; \ + UV_REQ_INIT(req, UV_FS); \ + req->fs_type = UV_FS_ ## subtype; \ + req->result = 0; \ + req->ptr = NULL; \ + req->loop = loop; \ + req->path = NULL; \ + req->new_path = NULL; \ + req->bufs = NULL; \ + req->cb = cb; \ + } \ + while (0) + +#define PATH \ + do { \ + assert(path != NULL); \ + if (cb == NULL) { \ + req->path = path; \ + } else { \ + req->path = uv__strdup(path); \ + if (req->path == NULL) \ + return UV_ENOMEM; \ + } \ + } \ + while (0) + +#define PATH2 \ + do { \ + if (cb == NULL) { \ + req->path = path; \ + req->new_path = new_path; \ + } else { \ + size_t path_len; \ + size_t new_path_len; \ + path_len = strlen(path) + 1; \ + new_path_len = strlen(new_path) + 1; \ + req->path = uv__malloc(path_len + new_path_len); \ + if (req->path == NULL) \ + return UV_ENOMEM; \ + req->new_path = req->path + path_len; \ + memcpy((void*) req->path, path, path_len); \ + memcpy((void*) req->new_path, new_path, new_path_len); \ + } \ + } \ + while (0) + +#define POST \ + do { \ + if (cb != NULL) { \ + uv__req_register(loop, req); \ - uv__work_submit(loop, &req->work_req, uv__fs_work, uv__fs_done); \ ++ uv__work_submit(loop, \ ++ &req->work_req, \ ++ UV__WORK_FAST_IO, \ ++ uv__fs_work, \ ++ uv__fs_done); \ + return 0; \ + } \ + else { \ + uv__fs_work(&req->work_req); \ + return req->result; \ + } \ + } \ + while (0) + + +static ssize_t uv__fs_fsync(uv_fs_t* req) { +#if defined(__APPLE__) + /* Apple's fdatasync and fsync explicitly do NOT flush the drive write cache + * to the drive platters. This is in contrast to Linux's fdatasync and fsync + * which do, according to recent man pages. F_FULLFSYNC is Apple's equivalent + * for flushing buffered data to permanent storage. If F_FULLFSYNC is not + * supported by the file system we should fall back to fsync(). This is the + * same approach taken by sqlite. + */ + int r; + + r = fcntl(req->file, F_FULLFSYNC); - if (r != 0 && errno == ENOTTY) ++ if (r != 0) + r = fsync(req->file); + return r; +#else + return fsync(req->file); +#endif +} + + +static ssize_t uv__fs_fdatasync(uv_fs_t* req) { +#if defined(__linux__) || defined(__sun) || defined(__NetBSD__) + return fdatasync(req->file); +#elif defined(__APPLE__) + /* See the comment in uv__fs_fsync. */ + return uv__fs_fsync(req); +#else + return fsync(req->file); +#endif +} + + +static ssize_t uv__fs_futime(uv_fs_t* req) { - #if defined(__linux__) ++#if defined(__linux__) \ ++ || defined(_AIX71) + /* utimesat() has nanosecond resolution but we stick to microseconds + * for the sake of consistency with other platforms. + */ - static int no_utimesat; + struct timespec ts[2]; - struct timeval tv[2]; - char path[sizeof("/proc/self/fd/") + 3 * sizeof(int)]; - int r; - - if (no_utimesat) - goto skip; - + ts[0].tv_sec = req->atime; + ts[0].tv_nsec = (uint64_t)(req->atime * 1000000) % 1000000 * 1000; + ts[1].tv_sec = req->mtime; + ts[1].tv_nsec = (uint64_t)(req->mtime * 1000000) % 1000000 * 1000; - - r = uv__utimesat(req->file, NULL, ts, 0); - if (r == 0) - return r; - - if (errno != ENOSYS) - return r; - - no_utimesat = 1; - - skip: - - tv[0].tv_sec = req->atime; - tv[0].tv_usec = (uint64_t)(req->atime * 1000000) % 1000000; - tv[1].tv_sec = req->mtime; - tv[1].tv_usec = (uint64_t)(req->mtime * 1000000) % 1000000; - snprintf(path, sizeof(path), "/proc/self/fd/%d", (int) req->file); - - r = utimes(path, tv); - if (r == 0) - return r; - - switch (errno) { - case ENOENT: - if (fcntl(req->file, F_GETFL) == -1 && errno == EBADF) - break; - /* Fall through. */ - - case EACCES: - case ENOTDIR: - errno = ENOSYS; - break; - } - - return r; - ++ return futimens(req->file, ts); +#elif defined(__APPLE__) \ + || defined(__DragonFly__) \ + || defined(__FreeBSD__) \ + || defined(__FreeBSD_kernel__) \ + || defined(__NetBSD__) \ + || defined(__OpenBSD__) \ + || defined(__sun) + struct timeval tv[2]; + tv[0].tv_sec = req->atime; + tv[0].tv_usec = (uint64_t)(req->atime * 1000000) % 1000000; + tv[1].tv_sec = req->mtime; + tv[1].tv_usec = (uint64_t)(req->mtime * 1000000) % 1000000; +# if defined(__sun) + return futimesat(req->file, NULL, tv); +# else + return futimes(req->file, tv); +# endif - #elif defined(_AIX71) - struct timespec ts[2]; - ts[0].tv_sec = req->atime; - ts[0].tv_nsec = (uint64_t)(req->atime * 1000000) % 1000000 * 1000; - ts[1].tv_sec = req->mtime; - ts[1].tv_nsec = (uint64_t)(req->mtime * 1000000) % 1000000 * 1000; - return futimens(req->file, ts); +#elif defined(__MVS__) + attrib_t atr; + memset(&atr, 0, sizeof(atr)); + atr.att_mtimechg = 1; + atr.att_atimechg = 1; + atr.att_mtime = req->mtime; + atr.att_atime = req->atime; + return __fchattr(req->file, &atr, sizeof(atr)); +#else + errno = ENOSYS; + return -1; +#endif +} + +#if defined(__sun) && (_XOPEN_SOURCE < 600 || defined(CMAKE_BOOTSTRAP)) +static char* uv__mkdtemp(char *template) +{ + if (!mktemp(template) || mkdir(template, 0700)) + return NULL; + return template; +} +#else +#define uv__mkdtemp mkdtemp +#endif + +static ssize_t uv__fs_mkdtemp(uv_fs_t* req) { + return uv__mkdtemp((char*) req->path) ? 0 : -1; +} + + +static ssize_t uv__fs_open(uv_fs_t* req) { + static int no_cloexec_support; + int r; + + /* Try O_CLOEXEC before entering locks */ + if (no_cloexec_support == 0) { +#ifdef O_CLOEXEC + r = open(req->path, req->flags | O_CLOEXEC, req->mode); + if (r >= 0) + return r; + if (errno != EINVAL) + return r; + no_cloexec_support = 1; +#endif /* O_CLOEXEC */ + } + + if (req->cb != NULL) + uv_rwlock_rdlock(&req->loop->cloexec_lock); + + r = open(req->path, req->flags, req->mode); + + /* In case of failure `uv__cloexec` will leave error in `errno`, + * so it is enough to just set `r` to `-1`. + */ + if (r >= 0 && uv__cloexec(r, 1) != 0) { + r = uv__close(r); + if (r != 0) + abort(); + r = -1; + } + + if (req->cb != NULL) + uv_rwlock_rdunlock(&req->loop->cloexec_lock); + + return r; +} + + +static ssize_t uv__fs_read(uv_fs_t* req) { +#if defined(__linux__) + static int no_preadv; +#endif ++ unsigned int iovmax; + ssize_t result; + - #if defined(_AIX) - struct stat buf; - if(fstat(req->file, &buf)) - return -1; - if(S_ISDIR(buf.st_mode)) { - errno = EISDIR; - return -1; - } - #endif /* defined(_AIX) */ ++ iovmax = uv__getiovmax(); ++ if (req->nbufs > iovmax) ++ req->nbufs = iovmax; ++ + if (req->off < 0) { + if (req->nbufs == 1) + result = read(req->file, req->bufs[0].base, req->bufs[0].len); + else + result = readv(req->file, (struct iovec*) req->bufs, req->nbufs); + } else { + if (req->nbufs == 1) { + result = pread(req->file, req->bufs[0].base, req->bufs[0].len, req->off); + goto done; + } + +#if HAVE_PREADV + result = preadv(req->file, (struct iovec*) req->bufs, req->nbufs, req->off); +#else +# if defined(__linux__) + if (no_preadv) retry: +# endif + { - off_t nread; - size_t index; - - nread = 0; - index = 0; - result = 1; - do { - if (req->bufs[index].len > 0) { - result = pread(req->file, - req->bufs[index].base, - req->bufs[index].len, - req->off + nread); - if (result > 0) - nread += result; - } - index++; - } while (index < req->nbufs && result > 0); - if (nread > 0) - result = nread; ++ result = pread(req->file, req->bufs[0].base, req->bufs[0].len, req->off); + } +# if defined(__linux__) + else { + result = uv__preadv(req->file, + (struct iovec*)req->bufs, + req->nbufs, + req->off); + if (result == -1 && errno == ENOSYS) { + no_preadv = 1; + goto retry; + } + } +# endif +#endif + } + +done: ++ /* Early cleanup of bufs allocation, since we're done with it. */ ++ if (req->bufs != req->bufsml) ++ uv__free(req->bufs); ++ ++ req->bufs = NULL; ++ req->nbufs = 0; ++ + return result; +} + + +#if defined(__APPLE__) && !defined(MAC_OS_X_VERSION_10_8) +#define UV_CONST_DIRENT uv__dirent_t +#else +#define UV_CONST_DIRENT const uv__dirent_t +#endif + + +static int uv__fs_scandir_filter(UV_CONST_DIRENT* dent) { + return strcmp(dent->d_name, ".") != 0 && strcmp(dent->d_name, "..") != 0; +} + + +static int uv__fs_scandir_sort(UV_CONST_DIRENT** a, UV_CONST_DIRENT** b) { + return strcmp((*a)->d_name, (*b)->d_name); +} + + +static ssize_t uv__fs_scandir(uv_fs_t* req) { + uv__dirent_t **dents; + int n; + + dents = NULL; + n = scandir(req->path, &dents, uv__fs_scandir_filter, uv__fs_scandir_sort); + + /* NOTE: We will use nbufs as an index field */ + req->nbufs = 0; + + if (n == 0) { + /* OS X still needs to deallocate some memory. + * Memory was allocated using the system allocator, so use free() here. + */ + free(dents); + dents = NULL; + } else if (n == -1) { + return n; + } + + req->ptr = dents; + + return n; +} + +#if defined(_POSIX_PATH_MAX) +# define UV__FS_PATH_MAX _POSIX_PATH_MAX +#elif defined(PATH_MAX) +# define UV__FS_PATH_MAX PATH_MAX +#else +# define UV__FS_PATH_MAX_FALLBACK 8192 +# define UV__FS_PATH_MAX UV__FS_PATH_MAX_FALLBACK +#endif + +static ssize_t uv__fs_pathmax_size(const char* path) { + ssize_t pathmax; + + pathmax = pathconf(path, _PC_PATH_MAX); + + if (pathmax == -1) + pathmax = UV__FS_PATH_MAX; + + return pathmax; +} + +static ssize_t uv__fs_readlink(uv_fs_t* req) { ++ ssize_t maxlen; + ssize_t len; + char* buf; ++ char* newbuf; + +#if defined(UV__FS_PATH_MAX_FALLBACK) + /* We may not have a real PATH_MAX. Read size of link. */ + struct stat st; + int ret; + ret = lstat(req->path, &st); + if (ret != 0) + return -1; + if (!S_ISLNK(st.st_mode)) { + errno = EINVAL; + return -1; + } + - len = st.st_size; ++ maxlen = st.st_size; + + /* According to readlink(2) lstat can report st_size == 0 + for some symlinks, such as those in /proc or /sys. */ - if (len == 0) - len = uv__fs_pathmax_size(req->path); ++ if (maxlen == 0) ++ maxlen = uv__fs_pathmax_size(req->path); +#else - len = uv__fs_pathmax_size(req->path); ++ maxlen = uv__fs_pathmax_size(req->path); +#endif + - buf = uv__malloc(len + 1); ++ buf = uv__malloc(maxlen); + + if (buf == NULL) { + errno = ENOMEM; + return -1; + } + +#if defined(__MVS__) - len = os390_readlink(req->path, buf, len); ++ len = os390_readlink(req->path, buf, maxlen); +#else - len = readlink(req->path, buf, len); ++ len = readlink(req->path, buf, maxlen); +#endif + - + if (len == -1) { + uv__free(buf); + return -1; + } + ++ /* Uncommon case: resize to make room for the trailing nul byte. */ ++ if (len == maxlen) { ++ newbuf = uv__realloc(buf, len + 1); ++ ++ if (newbuf == NULL) { ++ uv__free(buf); ++ return -1; ++ } ++ ++ buf = newbuf; ++ } ++ + buf[len] = '\0'; + req->ptr = buf; + + return 0; +} + +static ssize_t uv__fs_realpath(uv_fs_t* req) { + char* buf; + +#if defined(_POSIX_VERSION) && _POSIX_VERSION >= 200809L + buf = realpath(req->path, NULL); + if (buf == NULL) + return -1; +#else + ssize_t len; + + len = uv__fs_pathmax_size(req->path); + buf = uv__malloc(len + 1); + + if (buf == NULL) { + errno = ENOMEM; + return -1; + } + + if (realpath(req->path, buf) == NULL) { + uv__free(buf); + return -1; + } +#endif + + req->ptr = buf; + + return 0; +} + +static ssize_t uv__fs_sendfile_emul(uv_fs_t* req) { + struct pollfd pfd; + int use_pread; + off_t offset; + ssize_t nsent; + ssize_t nread; + ssize_t nwritten; + size_t buflen; + size_t len; + ssize_t n; + int in_fd; + int out_fd; + char buf[8192]; + + len = req->bufsml[0].len; + in_fd = req->flags; + out_fd = req->file; + offset = req->off; + use_pread = 1; + + /* Here are the rules regarding errors: + * + * 1. Read errors are reported only if nsent==0, otherwise we return nsent. + * The user needs to know that some data has already been sent, to stop + * them from sending it twice. + * + * 2. Write errors are always reported. Write errors are bad because they + * mean data loss: we've read data but now we can't write it out. + * + * We try to use pread() and fall back to regular read() if the source fd + * doesn't support positional reads, for example when it's a pipe fd. + * + * If we get EAGAIN when writing to the target fd, we poll() on it until + * it becomes writable again. + * + * FIXME: If we get a write error when use_pread==1, it should be safe to + * return the number of sent bytes instead of an error because pread() + * is, in theory, idempotent. However, special files in /dev or /proc + * may support pread() but not necessarily return the same data on + * successive reads. + * + * FIXME: There is no way now to signal that we managed to send *some* data + * before a write error. + */ + for (nsent = 0; (size_t) nsent < len; ) { + buflen = len - nsent; + + if (buflen > sizeof(buf)) + buflen = sizeof(buf); + + do + if (use_pread) + nread = pread(in_fd, buf, buflen, offset); + else + nread = read(in_fd, buf, buflen); + while (nread == -1 && errno == EINTR); + + if (nread == 0) + goto out; + + if (nread == -1) { + if (use_pread && nsent == 0 && (errno == EIO || errno == ESPIPE)) { + use_pread = 0; + continue; + } + + if (nsent == 0) + nsent = -1; + + goto out; + } + + for (nwritten = 0; nwritten < nread; ) { + do + n = write(out_fd, buf + nwritten, nread - nwritten); + while (n == -1 && errno == EINTR); + + if (n != -1) { + nwritten += n; + continue; + } + + if (errno != EAGAIN && errno != EWOULDBLOCK) { + nsent = -1; + goto out; + } + + pfd.fd = out_fd; + pfd.events = POLLOUT; + pfd.revents = 0; + + do + n = poll(&pfd, 1, -1); + while (n == -1 && errno == EINTR); + + if (n == -1 || (pfd.revents & ~POLLOUT) != 0) { + errno = EIO; + nsent = -1; + goto out; + } + } + + offset += nread; + nsent += nread; + } + +out: + if (nsent != -1) + req->off = offset; + + return nsent; +} + + +static ssize_t uv__fs_sendfile(uv_fs_t* req) { + int in_fd; + int out_fd; + + in_fd = req->flags; + out_fd = req->file; + +#if defined(__linux__) || defined(__sun) + { + off_t off; + ssize_t r; + + off = req->off; + r = sendfile(out_fd, in_fd, &off, req->bufsml[0].len); + + /* sendfile() on SunOS returns EINVAL if the target fd is not a socket but + * it still writes out data. Fortunately, we can detect it by checking if + * the offset has been updated. + */ + if (r != -1 || off > req->off) { + r = off - req->off; + req->off = off; + return r; + } + + if (errno == EINVAL || + errno == EIO || + errno == ENOTSOCK || + errno == EXDEV) { + errno = 0; + return uv__fs_sendfile_emul(req); + } + + return -1; + } +#elif defined(__APPLE__) || \ + defined(__DragonFly__) || \ + defined(__FreeBSD__) || \ + defined(__FreeBSD_kernel__) + { + off_t len; + ssize_t r; + + /* sendfile() on FreeBSD and Darwin returns EAGAIN if the target fd is in + * non-blocking mode and not all data could be written. If a non-zero + * number of bytes have been sent, we don't consider it an error. + */ + +#if defined(__FreeBSD__) || defined(__DragonFly__) + len = 0; + r = sendfile(in_fd, out_fd, req->off, req->bufsml[0].len, NULL, &len, 0); +#elif defined(__FreeBSD_kernel__) + len = 0; + r = bsd_sendfile(in_fd, + out_fd, + req->off, + req->bufsml[0].len, + NULL, + &len, + 0); +#else + /* The darwin sendfile takes len as an input for the length to send, + * so make sure to initialize it with the caller's value. */ + len = req->bufsml[0].len; + r = sendfile(in_fd, out_fd, req->off, &len, NULL, 0); +#endif + + /* + * The man page for sendfile(2) on DragonFly states that `len` contains + * a meaningful value ONLY in case of EAGAIN and EINTR. + * Nothing is said about it's value in case of other errors, so better + * not depend on the potential wrong assumption that is was not modified + * by the syscall. + */ + if (r == 0 || ((errno == EAGAIN || errno == EINTR) && len != 0)) { + req->off += len; + return (ssize_t) len; + } + + if (errno == EINVAL || + errno == EIO || + errno == ENOTSOCK || + errno == EXDEV) { + errno = 0; + return uv__fs_sendfile_emul(req); + } + + return -1; + } +#else + /* Squelch compiler warnings. */ + (void) &in_fd; + (void) &out_fd; + + return uv__fs_sendfile_emul(req); +#endif +} + + +static ssize_t uv__fs_utime(uv_fs_t* req) { ++#if defined(__linux__) \ ++ || defined(_AIX71) \ ++ || defined(__sun) ++ /* utimesat() has nanosecond resolution but we stick to microseconds ++ * for the sake of consistency with other platforms. ++ */ ++ struct timespec ts[2]; ++ ts[0].tv_sec = req->atime; ++ ts[0].tv_nsec = (uint64_t)(req->atime * 1000000) % 1000000 * 1000; ++ ts[1].tv_sec = req->mtime; ++ ts[1].tv_nsec = (uint64_t)(req->mtime * 1000000) % 1000000 * 1000; ++ return utimensat(AT_FDCWD, req->path, ts, 0); ++#elif defined(__APPLE__) \ ++ || defined(__DragonFly__) \ ++ || defined(__FreeBSD__) \ ++ || defined(__FreeBSD_kernel__) \ ++ || defined(__NetBSD__) \ ++ || defined(__OpenBSD__) ++ struct timeval tv[2]; ++ tv[0].tv_sec = req->atime; ++ tv[0].tv_usec = (uint64_t)(req->atime * 1000000) % 1000000; ++ tv[1].tv_sec = req->mtime; ++ tv[1].tv_usec = (uint64_t)(req->mtime * 1000000) % 1000000; ++ return utimes(req->path, tv); ++#elif defined(_AIX) \ ++ && !defined(_AIX71) + struct utimbuf buf; + buf.actime = req->atime; + buf.modtime = req->mtime; - return utime(req->path, &buf); /* TODO use utimes() where available */ ++ return utime(req->path, &buf); ++#elif defined(__MVS__) ++ attrib_t atr; ++ memset(&atr, 0, sizeof(atr)); ++ atr.att_mtimechg = 1; ++ atr.att_atimechg = 1; ++ atr.att_mtime = req->mtime; ++ atr.att_atime = req->atime; ++ return __lchattr((char*) req->path, &atr, sizeof(atr)); ++#else ++ errno = ENOSYS; ++ return -1; ++#endif +} + + +static ssize_t uv__fs_write(uv_fs_t* req) { +#if defined(__linux__) + static int no_pwritev; +#endif + ssize_t r; + + /* Serialize writes on OS X, concurrent write() and pwrite() calls result in + * data loss. We can't use a per-file descriptor lock, the descriptor may be + * a dup(). + */ +#if defined(__APPLE__) + static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; + + if (pthread_mutex_lock(&lock)) + abort(); +#endif + + if (req->off < 0) { + if (req->nbufs == 1) + r = write(req->file, req->bufs[0].base, req->bufs[0].len); + else + r = writev(req->file, (struct iovec*) req->bufs, req->nbufs); + } else { + if (req->nbufs == 1) { + r = pwrite(req->file, req->bufs[0].base, req->bufs[0].len, req->off); + goto done; + } +#if HAVE_PREADV + r = pwritev(req->file, (struct iovec*) req->bufs, req->nbufs, req->off); +#else +# if defined(__linux__) + if (no_pwritev) retry: +# endif + { - off_t written; - size_t index; - - written = 0; - index = 0; - r = 0; - do { - if (req->bufs[index].len > 0) { - r = pwrite(req->file, - req->bufs[index].base, - req->bufs[index].len, - req->off + written); - if (r > 0) - written += r; - } - index++; - } while (index < req->nbufs && r >= 0); - if (written > 0) - r = written; ++ r = pwrite(req->file, req->bufs[0].base, req->bufs[0].len, req->off); + } +# if defined(__linux__) + else { + r = uv__pwritev(req->file, + (struct iovec*) req->bufs, + req->nbufs, + req->off); + if (r == -1 && errno == ENOSYS) { + no_pwritev = 1; + goto retry; + } + } +# endif +#endif + } + +done: +#if defined(__APPLE__) + if (pthread_mutex_unlock(&lock)) + abort(); +#endif + + return r; +} + +static ssize_t uv__fs_copyfile(uv_fs_t* req) { +#if defined(__APPLE__) && !TARGET_OS_IPHONE + /* On macOS, use the native copyfile(3). */ ++ static int can_clone; + copyfile_flags_t flags; ++ char buf[64]; ++ size_t len; ++ int major; + + flags = COPYFILE_ALL; + + if (req->flags & UV_FS_COPYFILE_EXCL) + flags |= COPYFILE_EXCL; + - #ifdef COPYFILE_CLONE - if (req->flags & UV_FS_COPYFILE_FICLONE) - flags |= COPYFILE_CLONE; - #endif - ++ /* Check OS version. Cloning is only supported on macOS >= 10.12. */ + if (req->flags & UV_FS_COPYFILE_FICLONE_FORCE) { - #ifdef COPYFILE_CLONE_FORCE - flags |= COPYFILE_CLONE_FORCE; - #else - return UV_ENOSYS; - #endif ++ if (can_clone == 0) { ++ len = sizeof(buf); ++ if (sysctlbyname("kern.osrelease", buf, &len, NULL, 0)) ++ return UV__ERR(errno); ++ ++ if (1 != sscanf(buf, "%d", &major)) ++ abort(); ++ ++ can_clone = -1 + 2 * (major >= 16); /* macOS >= 10.12 */ ++ } ++ ++ if (can_clone < 0) ++ return UV_ENOSYS; + } + ++ /* copyfile() simply ignores COPYFILE_CLONE if it's not supported. */ ++ if (req->flags & UV_FS_COPYFILE_FICLONE) ++ flags |= 1 << 24; /* COPYFILE_CLONE */ ++ ++ if (req->flags & UV_FS_COPYFILE_FICLONE_FORCE) ++ flags |= 1 << 25; /* COPYFILE_CLONE_FORCE */ ++ + return copyfile(req->path, req->new_path, NULL, flags); +#else + uv_fs_t fs_req; + uv_file srcfd; + uv_file dstfd; + struct stat statsbuf; + int dst_flags; + int result; + int err; + size_t bytes_to_send; + int64_t in_offset; + + dstfd = -1; + err = 0; + + /* Open the source file. */ + srcfd = uv_fs_open(NULL, &fs_req, req->path, O_RDONLY, 0, NULL); + uv_fs_req_cleanup(&fs_req); + + if (srcfd < 0) + return srcfd; + + /* Get the source file's mode. */ + if (fstat(srcfd, &statsbuf)) { + err = UV__ERR(errno); + goto out; + } + + dst_flags = O_WRONLY | O_CREAT | O_TRUNC; + + if (req->flags & UV_FS_COPYFILE_EXCL) + dst_flags |= O_EXCL; + + /* Open the destination file. */ + dstfd = uv_fs_open(NULL, + &fs_req, + req->new_path, + dst_flags, + statsbuf.st_mode, + NULL); + uv_fs_req_cleanup(&fs_req); + + if (dstfd < 0) { + err = dstfd; + goto out; + } + + if (fchmod(dstfd, statsbuf.st_mode) == -1) { + err = UV__ERR(errno); + goto out; + } + +#ifdef FICLONE + if (req->flags & UV_FS_COPYFILE_FICLONE || + req->flags & UV_FS_COPYFILE_FICLONE_FORCE) { + if (ioctl(dstfd, FICLONE, srcfd) == -1) { + /* If an error occurred that the sendfile fallback also won't handle, or + this is a force clone then exit. Otherwise, fall through to try using + sendfile(). */ - if ((errno != ENOTTY && errno != EOPNOTSUPP && errno != EXDEV) || - req->flags & UV_FS_COPYFILE_FICLONE_FORCE) { - err = -errno; ++ if (errno != ENOTTY && errno != EOPNOTSUPP && errno != EXDEV) { ++ err = UV__ERR(errno); ++ goto out; ++ } else if (req->flags & UV_FS_COPYFILE_FICLONE_FORCE) { ++ err = UV_ENOTSUP; + goto out; + } + } else { + goto out; + } + } +#else + if (req->flags & UV_FS_COPYFILE_FICLONE_FORCE) { + err = UV_ENOSYS; + goto out; + } +#endif + + bytes_to_send = statsbuf.st_size; + in_offset = 0; + while (bytes_to_send != 0) { + err = uv_fs_sendfile(NULL, + &fs_req, + dstfd, + srcfd, + in_offset, + bytes_to_send, + NULL); + uv_fs_req_cleanup(&fs_req); + if (err < 0) + break; + bytes_to_send -= fs_req.result; + in_offset += fs_req.result; + } + +out: + if (err < 0) + result = err; + else + result = 0; + + /* Close the source file. */ + err = uv__close_nocheckstdio(srcfd); + + /* Don't overwrite any existing errors. */ + if (err != 0 && result == 0) + result = err; + + /* Close the destination file if it is open. */ + if (dstfd >= 0) { + err = uv__close_nocheckstdio(dstfd); + + /* Don't overwrite any existing errors. */ + if (err != 0 && result == 0) + result = err; + + /* Remove the destination file if something went wrong. */ + if (result != 0) { + uv_fs_unlink(NULL, &fs_req, req->new_path, NULL); + /* Ignore the unlink return value, as an error already happened. */ + uv_fs_req_cleanup(&fs_req); + } + } + - return result; ++ if (result == 0) ++ return 0; ++ ++ errno = UV__ERR(result); ++ return -1; +#endif +} + +static void uv__to_stat(struct stat* src, uv_stat_t* dst) { + dst->st_dev = src->st_dev; + dst->st_mode = src->st_mode; + dst->st_nlink = src->st_nlink; + dst->st_uid = src->st_uid; + dst->st_gid = src->st_gid; + dst->st_rdev = src->st_rdev; + dst->st_ino = src->st_ino; + dst->st_size = src->st_size; + dst->st_blksize = src->st_blksize; + dst->st_blocks = src->st_blocks; + +#if defined(__APPLE__) + dst->st_atim.tv_sec = src->st_atimespec.tv_sec; + dst->st_atim.tv_nsec = src->st_atimespec.tv_nsec; + dst->st_mtim.tv_sec = src->st_mtimespec.tv_sec; + dst->st_mtim.tv_nsec = src->st_mtimespec.tv_nsec; + dst->st_ctim.tv_sec = src->st_ctimespec.tv_sec; + dst->st_ctim.tv_nsec = src->st_ctimespec.tv_nsec; + dst->st_birthtim.tv_sec = src->st_birthtimespec.tv_sec; + dst->st_birthtim.tv_nsec = src->st_birthtimespec.tv_nsec; + dst->st_flags = src->st_flags; + dst->st_gen = src->st_gen; +#elif defined(__ANDROID__) + dst->st_atim.tv_sec = src->st_atime; + dst->st_atim.tv_nsec = src->st_atimensec; + dst->st_mtim.tv_sec = src->st_mtime; + dst->st_mtim.tv_nsec = src->st_mtimensec; + dst->st_ctim.tv_sec = src->st_ctime; + dst->st_ctim.tv_nsec = src->st_ctimensec; + dst->st_birthtim.tv_sec = src->st_ctime; + dst->st_birthtim.tv_nsec = src->st_ctimensec; + dst->st_flags = 0; + dst->st_gen = 0; +#elif !defined(_AIX) && ( \ + defined(__DragonFly__) || \ + defined(__FreeBSD__) || \ + defined(__OpenBSD__) || \ + defined(__NetBSD__) || \ + defined(_GNU_SOURCE) || \ + defined(_BSD_SOURCE) || \ + defined(_SVID_SOURCE) || \ + defined(_XOPEN_SOURCE) || \ + defined(_DEFAULT_SOURCE)) + dst->st_atim.tv_sec = src->st_atim.tv_sec; + dst->st_atim.tv_nsec = src->st_atim.tv_nsec; + dst->st_mtim.tv_sec = src->st_mtim.tv_sec; + dst->st_mtim.tv_nsec = src->st_mtim.tv_nsec; + dst->st_ctim.tv_sec = src->st_ctim.tv_sec; + dst->st_ctim.tv_nsec = src->st_ctim.tv_nsec; +# if defined(__FreeBSD__) || \ + defined(__NetBSD__) + dst->st_birthtim.tv_sec = src->st_birthtim.tv_sec; + dst->st_birthtim.tv_nsec = src->st_birthtim.tv_nsec; + dst->st_flags = src->st_flags; + dst->st_gen = src->st_gen; +# else + dst->st_birthtim.tv_sec = src->st_ctim.tv_sec; + dst->st_birthtim.tv_nsec = src->st_ctim.tv_nsec; + dst->st_flags = 0; + dst->st_gen = 0; +# endif +#else + dst->st_atim.tv_sec = src->st_atime; + dst->st_atim.tv_nsec = 0; + dst->st_mtim.tv_sec = src->st_mtime; + dst->st_mtim.tv_nsec = 0; + dst->st_ctim.tv_sec = src->st_ctime; + dst->st_ctim.tv_nsec = 0; + dst->st_birthtim.tv_sec = src->st_ctime; + dst->st_birthtim.tv_nsec = 0; + dst->st_flags = 0; + dst->st_gen = 0; +#endif +} + + +static int uv__fs_stat(const char *path, uv_stat_t *buf) { + struct stat pbuf; + int ret; + + ret = stat(path, &pbuf); + if (ret == 0) + uv__to_stat(&pbuf, buf); + + return ret; +} + + +static int uv__fs_lstat(const char *path, uv_stat_t *buf) { + struct stat pbuf; + int ret; + + ret = lstat(path, &pbuf); + if (ret == 0) + uv__to_stat(&pbuf, buf); + + return ret; +} + + +static int uv__fs_fstat(int fd, uv_stat_t *buf) { + struct stat pbuf; + int ret; + + ret = fstat(fd, &pbuf); + if (ret == 0) + uv__to_stat(&pbuf, buf); + + return ret; +} + ++static size_t uv__fs_buf_offset(uv_buf_t* bufs, size_t size) { ++ size_t offset; ++ /* Figure out which bufs are done */ ++ for (offset = 0; size > 0 && bufs[offset].len <= size; ++offset) ++ size -= bufs[offset].len; + - typedef ssize_t (*uv__fs_buf_iter_processor)(uv_fs_t* req); - static ssize_t uv__fs_buf_iter(uv_fs_t* req, uv__fs_buf_iter_processor process) { ++ /* Fix a partial read/write */ ++ if (size > 0) { ++ bufs[offset].base += size; ++ bufs[offset].len -= size; ++ } ++ return offset; ++} ++ ++static ssize_t uv__fs_write_all(uv_fs_t* req) { + unsigned int iovmax; + unsigned int nbufs; + uv_buf_t* bufs; + ssize_t total; + ssize_t result; + + iovmax = uv__getiovmax(); + nbufs = req->nbufs; + bufs = req->bufs; + total = 0; + + while (nbufs > 0) { + req->nbufs = nbufs; + if (req->nbufs > iovmax) + req->nbufs = iovmax; + - result = process(req); ++ do ++ result = uv__fs_write(req); ++ while (result < 0 && errno == EINTR); ++ + if (result <= 0) { + if (total == 0) + total = result; + break; + } + + if (req->off >= 0) + req->off += result; + ++ req->nbufs = uv__fs_buf_offset(req->bufs, result); + req->bufs += req->nbufs; + nbufs -= req->nbufs; + total += result; + } + - if (errno == EINTR && total == -1) - return total; - + if (bufs != req->bufsml) + uv__free(bufs); + + req->bufs = NULL; + req->nbufs = 0; + + return total; +} + + +static void uv__fs_work(struct uv__work* w) { + int retry_on_eintr; + uv_fs_t* req; + ssize_t r; + + req = container_of(w, uv_fs_t, work_req); - retry_on_eintr = !(req->fs_type == UV_FS_CLOSE); ++ retry_on_eintr = !(req->fs_type == UV_FS_CLOSE || ++ req->fs_type == UV_FS_READ); + + do { + errno = 0; + +#define X(type, action) \ + case UV_FS_ ## type: \ + r = action; \ + break; + + switch (req->fs_type) { + X(ACCESS, access(req->path, req->flags)); + X(CHMOD, chmod(req->path, req->mode)); + X(CHOWN, chown(req->path, req->uid, req->gid)); + X(CLOSE, close(req->file)); + X(COPYFILE, uv__fs_copyfile(req)); + X(FCHMOD, fchmod(req->file, req->mode)); + X(FCHOWN, fchown(req->file, req->uid, req->gid)); ++ X(LCHOWN, lchown(req->path, req->uid, req->gid)); + X(FDATASYNC, uv__fs_fdatasync(req)); + X(FSTAT, uv__fs_fstat(req->file, &req->statbuf)); + X(FSYNC, uv__fs_fsync(req)); + X(FTRUNCATE, ftruncate(req->file, req->off)); + X(FUTIME, uv__fs_futime(req)); + X(LSTAT, uv__fs_lstat(req->path, &req->statbuf)); + X(LINK, link(req->path, req->new_path)); + X(MKDIR, mkdir(req->path, req->mode)); + X(MKDTEMP, uv__fs_mkdtemp(req)); + X(OPEN, uv__fs_open(req)); - X(READ, uv__fs_buf_iter(req, uv__fs_read)); ++ X(READ, uv__fs_read(req)); + X(SCANDIR, uv__fs_scandir(req)); + X(READLINK, uv__fs_readlink(req)); + X(REALPATH, uv__fs_realpath(req)); + X(RENAME, rename(req->path, req->new_path)); + X(RMDIR, rmdir(req->path)); + X(SENDFILE, uv__fs_sendfile(req)); + X(STAT, uv__fs_stat(req->path, &req->statbuf)); + X(SYMLINK, symlink(req->path, req->new_path)); + X(UNLINK, unlink(req->path)); + X(UTIME, uv__fs_utime(req)); - X(WRITE, uv__fs_buf_iter(req, uv__fs_write)); ++ X(WRITE, uv__fs_write_all(req)); + default: abort(); + } +#undef X + } while (r == -1 && errno == EINTR && retry_on_eintr); + + if (r == -1) + req->result = UV__ERR(errno); + else + req->result = r; + + if (r == 0 && (req->fs_type == UV_FS_STAT || + req->fs_type == UV_FS_FSTAT || + req->fs_type == UV_FS_LSTAT)) { + req->ptr = &req->statbuf; + } +} + + +static void uv__fs_done(struct uv__work* w, int status) { + uv_fs_t* req; + + req = container_of(w, uv_fs_t, work_req); + uv__req_unregister(req->loop, req); + + if (status == UV_ECANCELED) { + assert(req->result == 0); + req->result = UV_ECANCELED; + } + + req->cb(req); +} + + +int uv_fs_access(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + int flags, + uv_fs_cb cb) { + INIT(ACCESS); + PATH; + req->flags = flags; + POST; +} + + +int uv_fs_chmod(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + int mode, + uv_fs_cb cb) { + INIT(CHMOD); + PATH; + req->mode = mode; + POST; +} + + +int uv_fs_chown(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + uv_uid_t uid, + uv_gid_t gid, + uv_fs_cb cb) { + INIT(CHOWN); + PATH; + req->uid = uid; + req->gid = gid; + POST; +} + + +int uv_fs_close(uv_loop_t* loop, uv_fs_t* req, uv_file file, uv_fs_cb cb) { + INIT(CLOSE); + req->file = file; + POST; +} + + +int uv_fs_fchmod(uv_loop_t* loop, + uv_fs_t* req, + uv_file file, + int mode, + uv_fs_cb cb) { + INIT(FCHMOD); + req->file = file; + req->mode = mode; + POST; +} + + +int uv_fs_fchown(uv_loop_t* loop, + uv_fs_t* req, + uv_file file, + uv_uid_t uid, + uv_gid_t gid, + uv_fs_cb cb) { + INIT(FCHOWN); + req->file = file; + req->uid = uid; + req->gid = gid; + POST; +} + + ++int uv_fs_lchown(uv_loop_t* loop, ++ uv_fs_t* req, ++ const char* path, ++ uv_uid_t uid, ++ uv_gid_t gid, ++ uv_fs_cb cb) { ++ INIT(LCHOWN); ++ PATH; ++ req->uid = uid; ++ req->gid = gid; ++ POST; ++} ++ ++ +int uv_fs_fdatasync(uv_loop_t* loop, uv_fs_t* req, uv_file file, uv_fs_cb cb) { + INIT(FDATASYNC); + req->file = file; + POST; +} + + +int uv_fs_fstat(uv_loop_t* loop, uv_fs_t* req, uv_file file, uv_fs_cb cb) { + INIT(FSTAT); + req->file = file; + POST; +} + + +int uv_fs_fsync(uv_loop_t* loop, uv_fs_t* req, uv_file file, uv_fs_cb cb) { + INIT(FSYNC); + req->file = file; + POST; +} + + +int uv_fs_ftruncate(uv_loop_t* loop, + uv_fs_t* req, + uv_file file, + int64_t off, + uv_fs_cb cb) { + INIT(FTRUNCATE); + req->file = file; + req->off = off; + POST; +} + + +int uv_fs_futime(uv_loop_t* loop, + uv_fs_t* req, + uv_file file, + double atime, + double mtime, + uv_fs_cb cb) { + INIT(FUTIME); + req->file = file; + req->atime = atime; + req->mtime = mtime; + POST; +} + + +int uv_fs_lstat(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) { + INIT(LSTAT); + PATH; + POST; +} + + +int uv_fs_link(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + const char* new_path, + uv_fs_cb cb) { + INIT(LINK); + PATH2; + POST; +} + + +int uv_fs_mkdir(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + int mode, + uv_fs_cb cb) { + INIT(MKDIR); + PATH; + req->mode = mode; + POST; +} + + +int uv_fs_mkdtemp(uv_loop_t* loop, + uv_fs_t* req, + const char* tpl, + uv_fs_cb cb) { + INIT(MKDTEMP); + req->path = uv__strdup(tpl); + if (req->path == NULL) + return UV_ENOMEM; + POST; +} + + +int uv_fs_open(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + int flags, + int mode, + uv_fs_cb cb) { + INIT(OPEN); + PATH; + req->flags = flags; + req->mode = mode; + POST; +} + + +int uv_fs_read(uv_loop_t* loop, uv_fs_t* req, + uv_file file, + const uv_buf_t bufs[], + unsigned int nbufs, + int64_t off, + uv_fs_cb cb) { + INIT(READ); + + if (bufs == NULL || nbufs == 0) + return UV_EINVAL; + + req->file = file; + + req->nbufs = nbufs; + req->bufs = req->bufsml; + if (nbufs > ARRAY_SIZE(req->bufsml)) + req->bufs = uv__malloc(nbufs * sizeof(*bufs)); + + if (req->bufs == NULL) + return UV_ENOMEM; + + memcpy(req->bufs, bufs, nbufs * sizeof(*bufs)); + + req->off = off; + POST; +} + + +int uv_fs_scandir(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + int flags, + uv_fs_cb cb) { + INIT(SCANDIR); + PATH; + req->flags = flags; + POST; +} + + +int uv_fs_readlink(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + uv_fs_cb cb) { + INIT(READLINK); + PATH; + POST; +} + + +int uv_fs_realpath(uv_loop_t* loop, + uv_fs_t* req, + const char * path, + uv_fs_cb cb) { + INIT(REALPATH); + PATH; + POST; +} + + +int uv_fs_rename(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + const char* new_path, + uv_fs_cb cb) { + INIT(RENAME); + PATH2; + POST; +} + + +int uv_fs_rmdir(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) { + INIT(RMDIR); + PATH; + POST; +} + + +int uv_fs_sendfile(uv_loop_t* loop, + uv_fs_t* req, + uv_file out_fd, + uv_file in_fd, + int64_t off, + size_t len, + uv_fs_cb cb) { + INIT(SENDFILE); + req->flags = in_fd; /* hack */ + req->file = out_fd; + req->off = off; + req->bufsml[0].len = len; + POST; +} + + +int uv_fs_stat(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) { + INIT(STAT); + PATH; + POST; +} + + +int uv_fs_symlink(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + const char* new_path, + int flags, + uv_fs_cb cb) { + INIT(SYMLINK); + PATH2; + req->flags = flags; + POST; +} + + +int uv_fs_unlink(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) { + INIT(UNLINK); + PATH; + POST; +} + + +int uv_fs_utime(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + double atime, + double mtime, + uv_fs_cb cb) { + INIT(UTIME); + PATH; + req->atime = atime; + req->mtime = mtime; + POST; +} + + +int uv_fs_write(uv_loop_t* loop, + uv_fs_t* req, + uv_file file, + const uv_buf_t bufs[], + unsigned int nbufs, + int64_t off, + uv_fs_cb cb) { + INIT(WRITE); + + if (bufs == NULL || nbufs == 0) + return UV_EINVAL; + + req->file = file; + + req->nbufs = nbufs; + req->bufs = req->bufsml; + if (nbufs > ARRAY_SIZE(req->bufsml)) + req->bufs = uv__malloc(nbufs * sizeof(*bufs)); + + if (req->bufs == NULL) + return UV_ENOMEM; + + memcpy(req->bufs, bufs, nbufs * sizeof(*bufs)); + + req->off = off; + POST; +} + + +void uv_fs_req_cleanup(uv_fs_t* req) { + if (req == NULL) + return; + + /* Only necessary for asychronous requests, i.e., requests with a callback. + * Synchronous ones don't copy their arguments and have req->path and + * req->new_path pointing to user-owned memory. UV_FS_MKDTEMP is the + * exception to the rule, it always allocates memory. + */ + if (req->path != NULL && (req->cb != NULL || req->fs_type == UV_FS_MKDTEMP)) + uv__free((void*) req->path); /* Memory is shared with req->new_path. */ + + req->path = NULL; + req->new_path = NULL; + + if (req->fs_type == UV_FS_SCANDIR && req->ptr != NULL) + uv__fs_scandir_cleanup(req); + + if (req->bufs != req->bufsml) + uv__free(req->bufs); + req->bufs = NULL; + + if (req->ptr != &req->statbuf) + uv__free(req->ptr); + req->ptr = NULL; +} + + +int uv_fs_copyfile(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + const char* new_path, + int flags, + uv_fs_cb cb) { + INIT(COPYFILE); + + if (flags & ~(UV_FS_COPYFILE_EXCL | + UV_FS_COPYFILE_FICLONE | + UV_FS_COPYFILE_FICLONE_FORCE)) { + return UV_EINVAL; + } + + PATH2; + req->flags = flags; + POST; +} diff --cc Utilities/cmlibuv/src/unix/getnameinfo.c index d9e6f79,0000000..b695081 mode 100644,000000..100644 --- a/Utilities/cmlibuv/src/unix/getnameinfo.c +++ b/Utilities/cmlibuv/src/unix/getnameinfo.c @@@ -1,120 -1,0 +1,121 @@@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to +* deal in the Software without restriction, including without limitation the +* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +* sell copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +* IN THE SOFTWARE. +*/ + +#include "uv.h" +#include "internal.h" + +#include +#include +#include +#include + + +static void uv__getnameinfo_work(struct uv__work* w) { + uv_getnameinfo_t* req; + int err; + socklen_t salen; + + req = container_of(w, uv_getnameinfo_t, work_req); + + if (req->storage.ss_family == AF_INET) + salen = sizeof(struct sockaddr_in); + else if (req->storage.ss_family == AF_INET6) + salen = sizeof(struct sockaddr_in6); + else + abort(); + + err = getnameinfo((struct sockaddr*) &req->storage, + salen, + req->host, + sizeof(req->host), + req->service, + sizeof(req->service), + req->flags); + req->retcode = uv__getaddrinfo_translate_error(err); +} + +static void uv__getnameinfo_done(struct uv__work* w, int status) { + uv_getnameinfo_t* req; + char* host; + char* service; + + req = container_of(w, uv_getnameinfo_t, work_req); + uv__req_unregister(req->loop, req); + host = service = NULL; + + if (status == UV_ECANCELED) { + assert(req->retcode == 0); + req->retcode = UV_EAI_CANCELED; + } else if (req->retcode == 0) { + host = req->host; + service = req->service; + } + + if (req->getnameinfo_cb) + req->getnameinfo_cb(req, req->retcode, host, service); +} + +/* +* Entry point for getnameinfo +* return 0 if a callback will be made +* return error code if validation fails +*/ +int uv_getnameinfo(uv_loop_t* loop, + uv_getnameinfo_t* req, + uv_getnameinfo_cb getnameinfo_cb, + const struct sockaddr* addr, + int flags) { + if (req == NULL || addr == NULL) + return UV_EINVAL; + + if (addr->sa_family == AF_INET) { + memcpy(&req->storage, + addr, + sizeof(struct sockaddr_in)); + } else if (addr->sa_family == AF_INET6) { + memcpy(&req->storage, + addr, + sizeof(struct sockaddr_in6)); + } else { + return UV_EINVAL; + } + + uv__req_init(loop, (uv_req_t*)req, UV_GETNAMEINFO); + + req->getnameinfo_cb = getnameinfo_cb; + req->flags = flags; + req->type = UV_GETNAMEINFO; + req->loop = loop; + req->retcode = 0; + + if (getnameinfo_cb) { + uv__work_submit(loop, + &req->work_req, ++ UV__WORK_SLOW_IO, + uv__getnameinfo_work, + uv__getnameinfo_done); + return 0; + } else { + uv__getnameinfo_work(&req->work_req); + uv__getnameinfo_done(&req->work_req, 0); + return req->retcode; + } +} diff --cc Utilities/cmlibuv/src/unix/internal.h index 89c6eb1,0000000..48fe6e8 mode 100644,000000..100644 --- a/Utilities/cmlibuv/src/unix/internal.h +++ b/Utilities/cmlibuv/src/unix/internal.h @@@ -1,362 -1,0 +1,319 @@@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef UV_UNIX_INTERNAL_H_ +#define UV_UNIX_INTERNAL_H_ + +#include "uv-common.h" + +#include +#include /* abort */ +#include /* strrchr */ +#include /* O_CLOEXEC, may be */ +#include +#include + +#if defined(__STRICT_ANSI__) +# define inline __inline +#endif + +#if defined(__linux__) +# include "linux-syscalls.h" +#endif /* __linux__ */ + +#if defined(__MVS__) +# include "os390-syscalls.h" +#endif /* __MVS__ */ + +#if defined(__sun) +# include +# include +#endif /* __sun */ + +#if defined(_AIX) +# define reqevents events +# define rtnevents revents +# include +#else +# include +#endif /* _AIX */ + +#if defined(__APPLE__) && !TARGET_OS_IPHONE +# include +#endif + +#if defined(CMAKE_BOOTSTRAP) +# undef pthread_atfork +# define pthread_atfork(prepare, parent, child) \ + uv__pthread_atfork(prepare, parent, child) +int uv__pthread_atfork(void (*prepare)(void), void (*parent)(void), + void (*child)(void)); +# undef pthread_sigmask +# define pthread_sigmask(how, set, oldset) \ + uv__pthread_sigmask(how, set, oldset) +int uv__pthread_sigmask(int how, const sigset_t* set, sigset_t* oset); +#elif defined(__ANDROID__) +int uv__pthread_sigmask(int how, const sigset_t* set, sigset_t* oset); +# ifdef pthread_sigmask +# undef pthread_sigmask +# endif +# define pthread_sigmask(how, set, oldset) uv__pthread_sigmask(how, set, oldset) +#endif + +#define ACCESS_ONCE(type, var) \ + (*(volatile type*) &(var)) + +#define ROUND_UP(a, b) \ + ((a) % (b) ? ((a) + (b)) - ((a) % (b)) : (a)) + +#define UNREACHABLE() \ + do { \ + assert(0 && "unreachable code"); \ + abort(); \ + } \ + while (0) + +#define SAVE_ERRNO(block) \ + do { \ + int _saved_errno = errno; \ + do { block; } while (0); \ + errno = _saved_errno; \ + } \ + while (0) + +/* The __clang__ and __INTEL_COMPILER checks are superfluous because they + * define __GNUC__. They are here to convey to you, dear reader, that these + * macros are enabled when compiling with clang or icc. + */ +#if defined(__clang__) || \ + defined(__GNUC__) || \ + defined(__INTEL_COMPILER) || \ + defined(__SUNPRO_C) +# define UV_DESTRUCTOR(declaration) __attribute__((destructor)) declaration +# define UV_UNUSED(declaration) __attribute__((unused)) declaration +#else +# define UV_DESTRUCTOR(declaration) declaration +# define UV_UNUSED(declaration) declaration +#endif + +/* Leans on the fact that, on Linux, POLLRDHUP == EPOLLRDHUP. */ +#ifdef POLLRDHUP +# define UV__POLLRDHUP POLLRDHUP +#else +# define UV__POLLRDHUP 0x2000 +#endif + +#ifdef POLLPRI +# define UV__POLLPRI POLLPRI +#else +# define UV__POLLPRI 0 +#endif + +#if !defined(O_CLOEXEC) && defined(__FreeBSD__) +/* + * It may be that we are just missing `__POSIX_VISIBLE >= 200809`. + * Try using fixed value const and give up, if it doesn't work + */ +# define O_CLOEXEC 0x00100000 +#endif + +typedef struct uv__stream_queued_fds_s uv__stream_queued_fds_t; + - /* handle flags */ - enum { - UV_CLOSING = 0x01, /* uv_close() called but not finished. */ - UV_CLOSED = 0x02, /* close(2) finished. */ - UV_STREAM_READING = 0x04, /* uv_read_start() called. */ - UV_STREAM_SHUTTING = 0x08, /* uv_shutdown() called but not complete. */ - UV_STREAM_SHUT = 0x10, /* Write side closed. */ - UV_STREAM_READABLE = 0x20, /* The stream is readable */ - UV_STREAM_WRITABLE = 0x40, /* The stream is writable */ - UV_STREAM_BLOCKING = 0x80, /* Synchronous writes. */ - UV_STREAM_READ_PARTIAL = 0x100, /* read(2) read less than requested. */ - UV_STREAM_READ_EOF = 0x200, /* read(2) read EOF. */ - UV_TCP_NODELAY = 0x400, /* Disable Nagle. */ - UV_TCP_KEEPALIVE = 0x800, /* Turn on keep-alive. */ - UV_TCP_SINGLE_ACCEPT = 0x1000, /* Only accept() when idle. */ - UV_HANDLE_IPV6 = 0x10000, /* Handle is bound to a IPv6 socket. */ - UV_UDP_PROCESSING = 0x20000, /* Handle is running the send callback queue. */ - UV_HANDLE_BOUND = 0x40000 /* Handle is bound to an address and port */ - }; - +/* loop flags */ +enum { + UV_LOOP_BLOCK_SIGPROF = 1 +}; + +/* flags of excluding ifaddr */ +enum { + UV__EXCLUDE_IFPHYS, + UV__EXCLUDE_IFADDR +}; + +typedef enum { + UV_CLOCK_PRECISE = 0, /* Use the highest resolution clock available. */ + UV_CLOCK_FAST = 1 /* Use the fastest clock with <= 1ms granularity. */ +} uv_clocktype_t; + +struct uv__stream_queued_fds_s { + unsigned int size; + unsigned int offset; + int fds[1]; +}; + + +#if defined(_AIX) || \ + defined(__APPLE__) || \ + defined(__DragonFly__) || \ + defined(__FreeBSD__) || \ + defined(__FreeBSD_kernel__) || \ + defined(__linux__) || \ + defined(__OpenBSD__) || \ + defined(__NetBSD__) +#define uv__cloexec uv__cloexec_ioctl +#define uv__nonblock uv__nonblock_ioctl +#else +#define uv__cloexec uv__cloexec_fcntl +#define uv__nonblock uv__nonblock_fcntl +#endif + +/* On Linux, uv__nonblock_fcntl() and uv__nonblock_ioctl() do not commute + * when O_NDELAY is not equal to O_NONBLOCK. Case in point: linux/sparc32 + * and linux/sparc64, where O_NDELAY is O_NONBLOCK + another bit. + * + * Libuv uses uv__nonblock_fcntl() directly sometimes so ensure that it + * commutes with uv__nonblock(). + */ +#if defined(__linux__) && O_NDELAY != O_NONBLOCK +#undef uv__nonblock +#define uv__nonblock uv__nonblock_fcntl +#endif + +/* core */ +int uv__cloexec_ioctl(int fd, int set); +int uv__cloexec_fcntl(int fd, int set); +int uv__nonblock_ioctl(int fd, int set); +int uv__nonblock_fcntl(int fd, int set); +int uv__close(int fd); /* preserves errno */ +int uv__close_nocheckstdio(int fd); +int uv__socket(int domain, int type, int protocol); - int uv__dup(int fd); +ssize_t uv__recvmsg(int fd, struct msghdr *msg, int flags); +void uv__make_close_pending(uv_handle_t* handle); +int uv__getiovmax(void); + +void uv__io_init(uv__io_t* w, uv__io_cb cb, int fd); +void uv__io_start(uv_loop_t* loop, uv__io_t* w, unsigned int events); +void uv__io_stop(uv_loop_t* loop, uv__io_t* w, unsigned int events); +void uv__io_close(uv_loop_t* loop, uv__io_t* w); +void uv__io_feed(uv_loop_t* loop, uv__io_t* w); +int uv__io_active(const uv__io_t* w, unsigned int events); +int uv__io_check_fd(uv_loop_t* loop, int fd); +void uv__io_poll(uv_loop_t* loop, int timeout); /* in milliseconds or -1 */ +int uv__io_fork(uv_loop_t* loop); ++int uv__fd_exists(uv_loop_t* loop, int fd); + +/* async */ +void uv__async_stop(uv_loop_t* loop); +int uv__async_fork(uv_loop_t* loop); + + +/* loop */ +void uv__run_idle(uv_loop_t* loop); +void uv__run_check(uv_loop_t* loop); +void uv__run_prepare(uv_loop_t* loop); + +/* stream */ +void uv__stream_init(uv_loop_t* loop, uv_stream_t* stream, + uv_handle_type type); +int uv__stream_open(uv_stream_t*, int fd, int flags); +void uv__stream_destroy(uv_stream_t* stream); +#if defined(__APPLE__) +int uv__stream_try_select(uv_stream_t* stream, int* fd); +#endif /* defined(__APPLE__) */ +void uv__server_io(uv_loop_t* loop, uv__io_t* w, unsigned int events); +int uv__accept(int sockfd); +int uv__dup2_cloexec(int oldfd, int newfd); +int uv__open_cloexec(const char* path, int flags); + +/* tcp */ +int uv_tcp_listen(uv_tcp_t* tcp, int backlog, uv_connection_cb cb); +int uv__tcp_nodelay(int fd, int on); +int uv__tcp_keepalive(int fd, int on, unsigned int delay); + +/* pipe */ +int uv_pipe_listen(uv_pipe_t* handle, int backlog, uv_connection_cb cb); + - /* timer */ - void uv__run_timers(uv_loop_t* loop); - int uv__next_timeout(const uv_loop_t* loop); - +/* signal */ +void uv__signal_close(uv_signal_t* handle); +void uv__signal_global_once_init(void); +void uv__signal_loop_cleanup(uv_loop_t* loop); +int uv__signal_loop_fork(uv_loop_t* loop); + +/* platform specific */ +uint64_t uv__hrtime(uv_clocktype_t type); +int uv__kqueue_init(uv_loop_t* loop); +int uv__platform_loop_init(uv_loop_t* loop); +void uv__platform_loop_delete(uv_loop_t* loop); +void uv__platform_invalidate_fd(uv_loop_t* loop, int fd); + +/* various */ +void uv__async_close(uv_async_t* handle); +void uv__check_close(uv_check_t* handle); +void uv__fs_event_close(uv_fs_event_t* handle); +void uv__idle_close(uv_idle_t* handle); +void uv__pipe_close(uv_pipe_t* handle); +void uv__poll_close(uv_poll_t* handle); +void uv__prepare_close(uv_prepare_t* handle); +void uv__process_close(uv_process_t* handle); +void uv__stream_close(uv_stream_t* handle); +void uv__tcp_close(uv_tcp_t* handle); - void uv__timer_close(uv_timer_t* handle); +void uv__udp_close(uv_udp_t* handle); +void uv__udp_finish_close(uv_udp_t* handle); +uv_handle_type uv__handle_type(int fd); +FILE* uv__open_file(const char* path); +int uv__getpwuid_r(uv_passwd_t* pwd); + + +#if defined(__APPLE__) && !defined(CMAKE_BOOTSTRAP) +int uv___stream_fd(const uv_stream_t* handle); +#define uv__stream_fd(handle) (uv___stream_fd((const uv_stream_t*) (handle))) +#else +#define uv__stream_fd(handle) ((handle)->io_watcher.fd) +#endif /* defined(__APPLE__) */ + +#ifdef UV__O_NONBLOCK +# define UV__F_NONBLOCK UV__O_NONBLOCK +#else +# define UV__F_NONBLOCK 1 +#endif + +int uv__make_socketpair(int fds[2], int flags); +int uv__make_pipe(int fds[2], int flags); + +#if defined(__APPLE__) + +int uv__fsevents_init(uv_fs_event_t* handle); +int uv__fsevents_close(uv_fs_event_t* handle); +void uv__fsevents_loop_delete(uv_loop_t* loop); + - /* OSX < 10.7 has no file events, polyfill them */ - #ifndef MAC_OS_X_VERSION_10_7 - - static const int kFSEventStreamCreateFlagFileEvents = 0x00000010; - static const int kFSEventStreamEventFlagItemCreated = 0x00000100; - static const int kFSEventStreamEventFlagItemRemoved = 0x00000200; - static const int kFSEventStreamEventFlagItemInodeMetaMod = 0x00000400; - static const int kFSEventStreamEventFlagItemRenamed = 0x00000800; - static const int kFSEventStreamEventFlagItemModified = 0x00001000; - static const int kFSEventStreamEventFlagItemFinderInfoMod = 0x00002000; - static const int kFSEventStreamEventFlagItemChangeOwner = 0x00004000; - static const int kFSEventStreamEventFlagItemXattrMod = 0x00008000; - static const int kFSEventStreamEventFlagItemIsFile = 0x00010000; - static const int kFSEventStreamEventFlagItemIsDir = 0x00020000; - static const int kFSEventStreamEventFlagItemIsSymlink = 0x00040000; - - #endif /* __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1070 */ - +#endif /* defined(__APPLE__) */ + +UV_UNUSED(static void uv__update_time(uv_loop_t* loop)) { + /* Use a fast time source if available. We only need millisecond precision. + */ + loop->time = uv__hrtime(UV_CLOCK_FAST) / 1000000; +} + +UV_UNUSED(static char* uv__basename_r(const char* path)) { + char* s; + + s = strrchr(path, '/'); + if (s == NULL) + return (char*) path; + + return s + 1; +} + +#if defined(__linux__) +int uv__inotify_fork(uv_loop_t* loop, void* old_watchers); +#endif + +#endif /* UV_UNIX_INTERNAL_H_ */ diff --cc Utilities/cmlibuv/src/unix/pipe.c index 42846b9,0000000..9657bc9 mode 100644,000000..100644 --- a/Utilities/cmlibuv/src/unix/pipe.c +++ b/Utilities/cmlibuv/src/unix/pipe.c @@@ -1,360 -1,0 +1,375 @@@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "internal.h" + +#include +#include +#include +#include +#include +#include + + +int uv_pipe_init(uv_loop_t* loop, uv_pipe_t* handle, int ipc) { + uv__stream_init(loop, (uv_stream_t*)handle, UV_NAMED_PIPE); + handle->shutdown_req = NULL; + handle->connect_req = NULL; + handle->pipe_fname = NULL; + handle->ipc = ipc; + return 0; +} + + +int uv_pipe_bind(uv_pipe_t* handle, const char* name) { + struct sockaddr_un saddr; + const char* pipe_fname = NULL; + int sockfd = -1; + int err; + + /* Already bound? */ + if (uv__stream_fd(handle) >= 0) + return UV_EINVAL; + + /* Make a copy of the file name, it outlives this function's scope. */ + pipe_fname = uv__strdup(name); + if (pipe_fname == NULL) + return UV_ENOMEM; + + /* We've got a copy, don't touch the original any more. */ + name = NULL; + + err = uv__socket(AF_UNIX, SOCK_STREAM, 0); + if (err < 0) + goto err_socket; + sockfd = err; + + memset(&saddr, 0, sizeof saddr); - strncpy(saddr.sun_path, pipe_fname, sizeof(saddr.sun_path) - 1); - saddr.sun_path[sizeof(saddr.sun_path) - 1] = '\0'; ++ uv__strscpy(saddr.sun_path, pipe_fname, sizeof(saddr.sun_path)); + saddr.sun_family = AF_UNIX; + + if (bind(sockfd, (struct sockaddr*)&saddr, sizeof saddr)) { + err = UV__ERR(errno); + /* Convert ENOENT to EACCES for compatibility with Windows. */ + if (err == UV_ENOENT) + err = UV_EACCES; + + uv__close(sockfd); + goto err_socket; + } + + /* Success. */ + handle->flags |= UV_HANDLE_BOUND; + handle->pipe_fname = pipe_fname; /* Is a strdup'ed copy. */ + handle->io_watcher.fd = sockfd; + return 0; + +err_socket: + uv__free((void*)pipe_fname); + return err; +} + + +int uv_pipe_listen(uv_pipe_t* handle, int backlog, uv_connection_cb cb) { + if (uv__stream_fd(handle) == -1) + return UV_EINVAL; + +#if defined(__MVS__) + /* On zOS, backlog=0 has undefined behaviour */ + if (backlog == 0) + backlog = 1; + else if (backlog < 0) + backlog = SOMAXCONN; +#endif + + if (listen(uv__stream_fd(handle), backlog)) + return UV__ERR(errno); + + handle->connection_cb = cb; + handle->io_watcher.cb = uv__server_io; + uv__io_start(handle->loop, &handle->io_watcher, POLLIN); + return 0; +} + + +void uv__pipe_close(uv_pipe_t* handle) { + if (handle->pipe_fname) { + /* + * Unlink the file system entity before closing the file descriptor. + * Doing it the other way around introduces a race where our process + * unlinks a socket with the same name that's just been created by + * another thread or process. + */ + unlink(handle->pipe_fname); + uv__free((void*)handle->pipe_fname); + handle->pipe_fname = NULL; + } + + uv__stream_close((uv_stream_t*)handle); +} + + +int uv_pipe_open(uv_pipe_t* handle, uv_file fd) { ++ int flags; ++ int mode; + int err; ++ flags = 0; ++ ++ if (uv__fd_exists(handle->loop, fd)) ++ return UV_EEXIST; ++ ++ do ++ mode = fcntl(fd, F_GETFL); ++ while (mode == -1 && errno == EINTR); ++ ++ if (mode == -1) ++ return UV__ERR(errno); /* according to docs, must be EBADF */ + + err = uv__nonblock(fd, 1); + if (err) + return err; + +#if defined(__APPLE__) && !defined(CMAKE_BOOTSTRAP) + err = uv__stream_try_select((uv_stream_t*) handle, &fd); + if (err) + return err; +#endif /* defined(__APPLE__) */ + - return uv__stream_open((uv_stream_t*)handle, - fd, - UV_STREAM_READABLE | UV_STREAM_WRITABLE); ++ mode &= O_ACCMODE; ++ if (mode != O_WRONLY) ++ flags |= UV_HANDLE_READABLE; ++ if (mode != O_RDONLY) ++ flags |= UV_HANDLE_WRITABLE; ++ ++ return uv__stream_open((uv_stream_t*)handle, fd, flags); +} + + +void uv_pipe_connect(uv_connect_t* req, + uv_pipe_t* handle, + const char* name, + uv_connect_cb cb) { + struct sockaddr_un saddr; + int new_sock; + int err; + int r; + + new_sock = (uv__stream_fd(handle) == -1); + + if (new_sock) { + err = uv__socket(AF_UNIX, SOCK_STREAM, 0); + if (err < 0) + goto out; + handle->io_watcher.fd = err; + } + + memset(&saddr, 0, sizeof saddr); - strncpy(saddr.sun_path, name, sizeof(saddr.sun_path) - 1); - saddr.sun_path[sizeof(saddr.sun_path) - 1] = '\0'; ++ uv__strscpy(saddr.sun_path, name, sizeof(saddr.sun_path)); + saddr.sun_family = AF_UNIX; + + do { + r = connect(uv__stream_fd(handle), + (struct sockaddr*)&saddr, sizeof saddr); + } + while (r == -1 && errno == EINTR); + + if (r == -1 && errno != EINPROGRESS) { + err = UV__ERR(errno); +#if defined(__CYGWIN__) || defined(__MSYS__) + /* EBADF is supposed to mean that the socket fd is bad, but + Cygwin reports EBADF instead of ENOTSOCK when the file is + not a socket. We do not expect to see a bad fd here + (e.g. due to new_sock), so translate the error. */ + if (err == UV_EBADF) + err = UV_ENOTSOCK; +#endif + goto out; + } + + err = 0; + if (new_sock) { + err = uv__stream_open((uv_stream_t*)handle, + uv__stream_fd(handle), - UV_STREAM_READABLE | UV_STREAM_WRITABLE); ++ UV_HANDLE_READABLE | UV_HANDLE_WRITABLE); + } + + if (err == 0) + uv__io_start(handle->loop, &handle->io_watcher, POLLIN | POLLOUT); + +out: + handle->delayed_error = err; + handle->connect_req = req; + + uv__req_init(handle->loop, req, UV_CONNECT); + req->handle = (uv_stream_t*)handle; + req->cb = cb; + QUEUE_INIT(&req->queue); + + /* Force callback to run on next tick in case of error. */ + if (err) + uv__io_feed(handle->loop, &handle->io_watcher); + +} + + +typedef int (*uv__peersockfunc)(int, struct sockaddr*, socklen_t*); + + +static int uv__pipe_getsockpeername(const uv_pipe_t* handle, + uv__peersockfunc func, + char* buffer, + size_t* size) { + struct sockaddr_un sa; + socklen_t addrlen; + int err; + + addrlen = sizeof(sa); + memset(&sa, 0, addrlen); + err = func(uv__stream_fd(handle), (struct sockaddr*) &sa, &addrlen); + if (err < 0) { + *size = 0; + return UV__ERR(errno); + } + +#if defined(__linux__) + if (sa.sun_path[0] == 0) + /* Linux abstract namespace */ + addrlen -= offsetof(struct sockaddr_un, sun_path); + else +#endif + addrlen = strlen(sa.sun_path); + + + if (addrlen >= *size) { + *size = addrlen + 1; + return UV_ENOBUFS; + } + + memcpy(buffer, sa.sun_path, addrlen); + *size = addrlen; + + /* only null-terminate if it's not an abstract socket */ + if (buffer[0] != '\0') + buffer[addrlen] = '\0'; + + return 0; +} + + +int uv_pipe_getsockname(const uv_pipe_t* handle, char* buffer, size_t* size) { + return uv__pipe_getsockpeername(handle, getsockname, buffer, size); +} + + +int uv_pipe_getpeername(const uv_pipe_t* handle, char* buffer, size_t* size) { + return uv__pipe_getsockpeername(handle, getpeername, buffer, size); +} + + +void uv_pipe_pending_instances(uv_pipe_t* handle, int count) { +} + + +int uv_pipe_pending_count(uv_pipe_t* handle) { + uv__stream_queued_fds_t* queued_fds; + + if (!handle->ipc) + return 0; + + if (handle->accepted_fd == -1) + return 0; + + if (handle->queued_fds == NULL) + return 1; + + queued_fds = handle->queued_fds; + return queued_fds->offset + 1; +} + + +uv_handle_type uv_pipe_pending_type(uv_pipe_t* handle) { + if (!handle->ipc) + return UV_UNKNOWN_HANDLE; + + if (handle->accepted_fd == -1) + return UV_UNKNOWN_HANDLE; + else + return uv__handle_type(handle->accepted_fd); +} + + +int uv_pipe_chmod(uv_pipe_t* handle, int mode) { + unsigned desired_mode; + struct stat pipe_stat; + char* name_buffer; + size_t name_len; + int r; + + if (handle == NULL || uv__stream_fd(handle) == -1) + return UV_EBADF; + + if (mode != UV_READABLE && + mode != UV_WRITABLE && + mode != (UV_WRITABLE | UV_READABLE)) + return UV_EINVAL; + + /* Unfortunately fchmod does not work on all platforms, we will use chmod. */ + name_len = 0; + r = uv_pipe_getsockname(handle, NULL, &name_len); + if (r != UV_ENOBUFS) + return r; + + name_buffer = uv__malloc(name_len); + if (name_buffer == NULL) + return UV_ENOMEM; + + r = uv_pipe_getsockname(handle, name_buffer, &name_len); + if (r != 0) { + uv__free(name_buffer); + return r; + } + + /* stat must be used as fstat has a bug on Darwin */ + if (stat(name_buffer, &pipe_stat) == -1) { + uv__free(name_buffer); + return -errno; + } + + desired_mode = 0; + if (mode & UV_READABLE) + desired_mode |= S_IRUSR | S_IRGRP | S_IROTH; + if (mode & UV_WRITABLE) + desired_mode |= S_IWUSR | S_IWGRP | S_IWOTH; + + /* Exit early if pipe already has desired mode. */ + if ((pipe_stat.st_mode & desired_mode) == desired_mode) { + uv__free(name_buffer); + return 0; + } + + pipe_stat.st_mode |= desired_mode; + + r = chmod(name_buffer, pipe_stat.st_mode); + uv__free(name_buffer); + + return r != -1 ? 0 : UV__ERR(errno); +} diff --cc Utilities/cmlibuv/src/unix/process.c index f2a5065,0000000..e9579f5 mode 100644,000000..100644 --- a/Utilities/cmlibuv/src/unix/process.c +++ b/Utilities/cmlibuv/src/unix/process.c @@@ -1,651 -1,0 +1,651 @@@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "internal.h" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#if defined(__APPLE__) && !TARGET_OS_IPHONE +# include +# define environ (*_NSGetEnviron()) +#else +extern char **environ; +#endif + +#if defined(__linux__) || defined(__GLIBC__) +# include +#endif + +#ifndef CMAKE_BOOTSTRAP +#if defined(__linux__) +# define uv__cpu_set_t cpu_set_t +#elif defined(__FreeBSD__) +# include +# include +# include +# define uv__cpu_set_t cpuset_t +#endif +#endif + +static void uv__chld(uv_signal_t* handle, int signum) { + uv_process_t* process; + uv_loop_t* loop; + int exit_status; + int term_signal; + int status; + pid_t pid; + QUEUE pending; + QUEUE* q; + QUEUE* h; + + assert(signum == SIGCHLD); + + QUEUE_INIT(&pending); + loop = handle->loop; + + h = &loop->process_handles; + q = QUEUE_HEAD(h); + while (q != h) { + process = QUEUE_DATA(q, uv_process_t, queue); + q = QUEUE_NEXT(q); + + do + pid = waitpid(process->pid, &status, WNOHANG); + while (pid == -1 && errno == EINTR); + + if (pid == 0) + continue; + + if (pid == -1) { + if (errno != ECHILD) + abort(); + continue; + } + + process->status = status; + QUEUE_REMOVE(&process->queue); + QUEUE_INSERT_TAIL(&pending, &process->queue); + } + + h = &pending; + q = QUEUE_HEAD(h); + while (q != h) { + process = QUEUE_DATA(q, uv_process_t, queue); + q = QUEUE_NEXT(q); + + QUEUE_REMOVE(&process->queue); + QUEUE_INIT(&process->queue); + uv__handle_stop(process); + + if (process->exit_cb == NULL) + continue; + + exit_status = 0; + if (WIFEXITED(process->status)) + exit_status = WEXITSTATUS(process->status); + + term_signal = 0; + if (WIFSIGNALED(process->status)) + term_signal = WTERMSIG(process->status); + + process->exit_cb(process, exit_status, term_signal); + } + assert(QUEUE_EMPTY(&pending)); +} + + +int uv__make_socketpair(int fds[2], int flags) { +#if defined(__linux__) + static int no_cloexec; + + if (no_cloexec) + goto skip; + + if (socketpair(AF_UNIX, SOCK_STREAM | UV__SOCK_CLOEXEC | flags, 0, fds) == 0) + return 0; + + /* Retry on EINVAL, it means SOCK_CLOEXEC is not supported. + * Anything else is a genuine error. + */ + if (errno != EINVAL) + return UV__ERR(errno); + + no_cloexec = 1; + +skip: +#endif + + if (socketpair(AF_UNIX, SOCK_STREAM, 0, fds)) + return UV__ERR(errno); + + uv__cloexec(fds[0], 1); + uv__cloexec(fds[1], 1); + + if (flags & UV__F_NONBLOCK) { + uv__nonblock(fds[0], 1); + uv__nonblock(fds[1], 1); + } + + return 0; +} + + +int uv__make_pipe(int fds[2], int flags) { +#if defined(__linux__) + static int no_pipe2; + + if (no_pipe2) + goto skip; + + if (uv__pipe2(fds, flags | UV__O_CLOEXEC) == 0) + return 0; + + if (errno != ENOSYS) + return UV__ERR(errno); + + no_pipe2 = 1; + +skip: +#endif + + if (pipe(fds)) + return UV__ERR(errno); + + uv__cloexec(fds[0], 1); + uv__cloexec(fds[1], 1); + + if (flags & UV__F_NONBLOCK) { + uv__nonblock(fds[0], 1); + uv__nonblock(fds[1], 1); + } + + return 0; +} + + +/* + * Used for initializing stdio streams like options.stdin_stream. Returns + * zero on success. See also the cleanup section in uv_spawn(). + */ +static int uv__process_init_stdio(uv_stdio_container_t* container, int fds[2]) { + int mask; + int fd; + + mask = UV_IGNORE | UV_CREATE_PIPE | UV_INHERIT_FD | UV_INHERIT_STREAM; + + switch (container->flags & mask) { + case UV_IGNORE: + return 0; + + case UV_CREATE_PIPE: + assert(container->data.stream != NULL); + if (container->data.stream->type != UV_NAMED_PIPE) + return UV_EINVAL; + else + return uv__make_socketpair(fds, 0); + + case UV_INHERIT_FD: + case UV_INHERIT_STREAM: + if (container->flags & UV_INHERIT_FD) + fd = container->data.fd; + else + fd = uv__stream_fd(container->data.stream); + + if (fd == -1) + return UV_EINVAL; + + fds[1] = fd; + return 0; + + default: + assert(0 && "Unexpected flags"); + return UV_EINVAL; + } +} + + +static int uv__process_open_stream(uv_stdio_container_t* container, + int pipefds[2]) { + int flags; + int err; + + if (!(container->flags & UV_CREATE_PIPE) || pipefds[0] < 0) + return 0; + + err = uv__close(pipefds[1]); + if (err != 0) + abort(); + + pipefds[1] = -1; + uv__nonblock(pipefds[0], 1); + + flags = 0; + if (container->flags & UV_WRITABLE_PIPE) - flags |= UV_STREAM_READABLE; ++ flags |= UV_HANDLE_READABLE; + if (container->flags & UV_READABLE_PIPE) - flags |= UV_STREAM_WRITABLE; ++ flags |= UV_HANDLE_WRITABLE; + + return uv__stream_open(container->data.stream, pipefds[0], flags); +} + + +static void uv__process_close_stream(uv_stdio_container_t* container) { + if (!(container->flags & UV_CREATE_PIPE)) return; + uv__stream_close((uv_stream_t*)container->data.stream); +} + + +static void uv__write_int(int fd, int val) { + ssize_t n; + + do + n = write(fd, &val, sizeof(val)); + while (n == -1 && errno == EINTR); + + if (n == -1 && errno == EPIPE) + return; /* parent process has quit */ + + assert(n == sizeof(val)); +} + + +#if !(defined(__APPLE__) && (TARGET_OS_TV || TARGET_OS_WATCH)) +/* execvp is marked __WATCHOS_PROHIBITED __TVOS_PROHIBITED, so must be + * avoided. Since this isn't called on those targets, the function + * doesn't even need to be defined for them. + */ +static void uv__process_child_init(const uv_process_options_t* options, + int stdio_count, + int (*pipes)[2], + int error_fd) { + sigset_t set; + int close_fd; + int use_fd; + int err; + int fd; + int n; +#ifndef CMAKE_BOOTSTRAP +#if defined(__linux__) || defined(__FreeBSD__) + int r; + int i; + int cpumask_size; + uv__cpu_set_t cpuset; +#endif +#endif + + if (options->flags & UV_PROCESS_DETACHED) + setsid(); + + /* First duplicate low numbered fds, since it's not safe to duplicate them, + * they could get replaced. Example: swapping stdout and stderr; without + * this fd 2 (stderr) would be duplicated into fd 1, thus making both + * stdout and stderr go to the same fd, which was not the intention. */ + for (fd = 0; fd < stdio_count; fd++) { + use_fd = pipes[fd][1]; + if (use_fd < 0 || use_fd >= fd) + continue; + pipes[fd][1] = fcntl(use_fd, F_DUPFD, stdio_count); + if (pipes[fd][1] == -1) { + uv__write_int(error_fd, UV__ERR(errno)); + _exit(127); + } + } + + for (fd = 0; fd < stdio_count; fd++) { + close_fd = pipes[fd][0]; + use_fd = pipes[fd][1]; + + if (use_fd < 0) { + if (fd >= 3) + continue; + else { + /* redirect stdin, stdout and stderr to /dev/null even if UV_IGNORE is + * set + */ + use_fd = open("/dev/null", fd == 0 ? O_RDONLY : O_RDWR); + close_fd = use_fd; + + if (use_fd < 0) { + uv__write_int(error_fd, UV__ERR(errno)); + _exit(127); + } + } + } + + if (fd == use_fd) + uv__cloexec_fcntl(use_fd, 0); + else + fd = dup2(use_fd, fd); + + if (fd == -1) { + uv__write_int(error_fd, UV__ERR(errno)); + _exit(127); + } + + if (fd <= 2) + uv__nonblock_fcntl(fd, 0); + + if (close_fd >= stdio_count) + uv__close(close_fd); + } + + for (fd = 0; fd < stdio_count; fd++) { + use_fd = pipes[fd][1]; + + if (use_fd >= stdio_count) + uv__close(use_fd); + } + + if (options->cwd != NULL && chdir(options->cwd)) { + uv__write_int(error_fd, UV__ERR(errno)); + _exit(127); + } + + if (options->flags & (UV_PROCESS_SETUID | UV_PROCESS_SETGID)) { + /* When dropping privileges from root, the `setgroups` call will + * remove any extraneous groups. If we don't call this, then + * even though our uid has dropped, we may still have groups + * that enable us to do super-user things. This will fail if we + * aren't root, so don't bother checking the return value, this + * is just done as an optimistic privilege dropping function. + */ + SAVE_ERRNO(setgroups(0, NULL)); + } + + if ((options->flags & UV_PROCESS_SETGID) && setgid(options->gid)) { + uv__write_int(error_fd, UV__ERR(errno)); + _exit(127); + } + + if ((options->flags & UV_PROCESS_SETUID) && setuid(options->uid)) { + uv__write_int(error_fd, UV__ERR(errno)); + _exit(127); + } + +#ifndef CMAKE_BOOTSTRAP +#if defined(__linux__) || defined(__FreeBSD__) + if (options->cpumask != NULL) { + cpumask_size = uv_cpumask_size(); + assert(options->cpumask_size >= (size_t)cpumask_size); + + CPU_ZERO(&cpuset); + for (i = 0; i < cpumask_size; ++i) { + if (options->cpumask[i]) { + CPU_SET(i, &cpuset); + } + } + + r = -pthread_setaffinity_np(pthread_self(), sizeof(cpuset), &cpuset); + if (r != 0) { + uv__write_int(error_fd, r); + _exit(127); + } + } +#endif +#endif + + if (options->env != NULL) { + environ = options->env; + } + + /* Reset signal disposition. Use a hard-coded limit because NSIG + * is not fixed on Linux: it's either 32, 34 or 64, depending on + * whether RT signals are enabled. We are not allowed to touch + * RT signal handlers, glibc uses them internally. + */ + for (n = 1; n < 32; n += 1) { + if (n == SIGKILL || n == SIGSTOP) + continue; /* Can't be changed. */ + + if (SIG_ERR != signal(n, SIG_DFL)) + continue; + + uv__write_int(error_fd, UV__ERR(errno)); + _exit(127); + } + + /* Reset signal mask. */ + sigemptyset(&set); + err = pthread_sigmask(SIG_SETMASK, &set, NULL); + + if (err != 0) { + uv__write_int(error_fd, UV__ERR(err)); + _exit(127); + } + + execvp(options->file, options->args); + uv__write_int(error_fd, UV__ERR(errno)); + _exit(127); +} +#endif + + +int uv_spawn(uv_loop_t* loop, + uv_process_t* process, + const uv_process_options_t* options) { +#if defined(__APPLE__) && (TARGET_OS_TV || TARGET_OS_WATCH) + /* fork is marked __WATCHOS_PROHIBITED __TVOS_PROHIBITED. */ + return UV_ENOSYS; +#else + int signal_pipe[2] = { -1, -1 }; + int pipes_storage[8][2]; + int (*pipes)[2]; + int stdio_count; + ssize_t r; + pid_t pid; + int err; + int exec_errorno; + int i; + int status; + + if (options->cpumask != NULL) { +#ifndef CMAKE_BOOTSTRAP +#if defined(__linux__) || defined(__FreeBSD__) + if (options->cpumask_size < (size_t)uv_cpumask_size()) { + return UV_EINVAL; + } +#else + return UV_ENOTSUP; +#endif +#else + return UV_ENOTSUP; +#endif + } + + assert(options->file != NULL); + assert(!(options->flags & ~(UV_PROCESS_DETACHED | + UV_PROCESS_SETGID | + UV_PROCESS_SETUID | + UV_PROCESS_WINDOWS_HIDE | + UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS))); + + uv__handle_init(loop, (uv_handle_t*)process, UV_PROCESS); + QUEUE_INIT(&process->queue); + + stdio_count = options->stdio_count; + if (stdio_count < 3) + stdio_count = 3; + + err = UV_ENOMEM; + pipes = pipes_storage; + if (stdio_count > (int) ARRAY_SIZE(pipes_storage)) + pipes = uv__malloc(stdio_count * sizeof(*pipes)); + + if (pipes == NULL) + goto error; + + for (i = 0; i < stdio_count; i++) { + pipes[i][0] = -1; + pipes[i][1] = -1; + } + + for (i = 0; i < options->stdio_count; i++) { + err = uv__process_init_stdio(options->stdio + i, pipes[i]); + if (err) + goto error; + } + + /* This pipe is used by the parent to wait until + * the child has called `execve()`. We need this + * to avoid the following race condition: + * + * if ((pid = fork()) > 0) { + * kill(pid, SIGTERM); + * } + * else if (pid == 0) { + * execve("/bin/cat", argp, envp); + * } + * + * The parent sends a signal immediately after forking. + * Since the child may not have called `execve()` yet, + * there is no telling what process receives the signal, + * our fork or /bin/cat. + * + * To avoid ambiguity, we create a pipe with both ends + * marked close-on-exec. Then, after the call to `fork()`, + * the parent polls the read end until it EOFs or errors with EPIPE. + */ + err = uv__make_pipe(signal_pipe, 0); + if (err) + goto error; + + uv_signal_start(&loop->child_watcher, uv__chld, SIGCHLD); + + /* Acquire write lock to prevent opening new fds in worker threads */ + uv_rwlock_wrlock(&loop->cloexec_lock); + pid = fork(); + + if (pid == -1) { + err = UV__ERR(errno); + uv_rwlock_wrunlock(&loop->cloexec_lock); + uv__close(signal_pipe[0]); + uv__close(signal_pipe[1]); + goto error; + } + + if (pid == 0) { + uv__process_child_init(options, stdio_count, pipes, signal_pipe[1]); + abort(); + } + + /* Release lock in parent process */ + uv_rwlock_wrunlock(&loop->cloexec_lock); + uv__close(signal_pipe[1]); + + process->status = 0; + exec_errorno = 0; + do + r = read(signal_pipe[0], &exec_errorno, sizeof(exec_errorno)); + while (r == -1 && errno == EINTR); + + if (r == 0) + ; /* okay, EOF */ + else if (r == sizeof(exec_errorno)) { + do + err = waitpid(pid, &status, 0); /* okay, read errorno */ + while (err == -1 && errno == EINTR); + assert(err == pid); + } else if (r == -1 && errno == EPIPE) { + do + err = waitpid(pid, &status, 0); /* okay, got EPIPE */ + while (err == -1 && errno == EINTR); + assert(err == pid); + } else + abort(); + + uv__close_nocheckstdio(signal_pipe[0]); + + for (i = 0; i < options->stdio_count; i++) { + err = uv__process_open_stream(options->stdio + i, pipes[i]); + if (err == 0) + continue; + + while (i--) + uv__process_close_stream(options->stdio + i); + + goto error; + } + + /* Only activate this handle if exec() happened successfully */ + if (exec_errorno == 0) { + QUEUE_INSERT_TAIL(&loop->process_handles, &process->queue); + uv__handle_start(process); + } + + process->pid = pid; + process->exit_cb = options->exit_cb; + + if (pipes != pipes_storage) + uv__free(pipes); + + return exec_errorno; + +error: + if (pipes != NULL) { + for (i = 0; i < stdio_count; i++) { + if (i < options->stdio_count) + if (options->stdio[i].flags & (UV_INHERIT_FD | UV_INHERIT_STREAM)) + continue; + if (pipes[i][0] != -1) + uv__close_nocheckstdio(pipes[i][0]); + if (pipes[i][1] != -1) + uv__close_nocheckstdio(pipes[i][1]); + } + + if (pipes != pipes_storage) + uv__free(pipes); + } + + return err; +#endif +} + + +int uv_process_kill(uv_process_t* process, int signum) { + return uv_kill(process->pid, signum); +} + + +int uv_kill(int pid, int signum) { + if (kill(pid, signum)) + return UV__ERR(errno); + else + return 0; +} + + +void uv__process_close(uv_process_t* handle) { + QUEUE_REMOVE(&handle->queue); + uv__handle_stop(handle); + if (QUEUE_EMPTY(&handle->loop->process_handles)) + uv_signal_stop(&handle->loop->child_watcher); +} diff --cc Utilities/cmlibuv/src/unix/stream.c index 9bdd1c5,0000000..4b9123f mode 100644,000000..100644 --- a/Utilities/cmlibuv/src/unix/stream.c +++ b/Utilities/cmlibuv/src/unix/stream.c @@@ -1,1702 -1,0 +1,1688 @@@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "internal.h" + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include /* IOV_MAX */ + +#if defined(__APPLE__) +# include +# include +# include + +/* Forward declaration */ +typedef struct uv__stream_select_s uv__stream_select_t; + +struct uv__stream_select_s { + uv_stream_t* stream; + uv_thread_t thread; + uv_sem_t close_sem; + uv_sem_t async_sem; + uv_async_t async; + int events; + int fake_fd; + int int_fd; + int fd; + fd_set* sread; + size_t sread_sz; + fd_set* swrite; + size_t swrite_sz; +}; - # define WRITE_RETRY_ON_ERROR(send_handle) \ ++ ++/* Due to a possible kernel bug at least in OS X 10.10 "Yosemite", ++ * EPROTOTYPE can be returned while trying to write to a socket that is ++ * shutting down. If we retry the write, we should get the expected EPIPE ++ * instead. ++ */ ++# define RETRY_ON_WRITE_ERROR(errno) (errno == EINTR || errno == EPROTOTYPE) ++# define IS_TRANSIENT_WRITE_ERROR(errno, send_handle) \ + (errno == EAGAIN || errno == EWOULDBLOCK || errno == ENOBUFS || \ - (errno == EMSGSIZE && send_handle)) ++ (errno == EMSGSIZE && send_handle != NULL)) +#else - # define WRITE_RETRY_ON_ERROR(send_handle) \ ++# define RETRY_ON_WRITE_ERROR(errno) (errno == EINTR) ++# define IS_TRANSIENT_WRITE_ERROR(errno, send_handle) \ + (errno == EAGAIN || errno == EWOULDBLOCK || errno == ENOBUFS) +#endif /* defined(__APPLE__) */ + +static void uv__stream_connect(uv_stream_t*); +static void uv__write(uv_stream_t* stream); +static void uv__read(uv_stream_t* stream); +static void uv__stream_io(uv_loop_t* loop, uv__io_t* w, unsigned int events); +static void uv__write_callbacks(uv_stream_t* stream); +static size_t uv__write_req_size(uv_write_t* req); + + +void uv__stream_init(uv_loop_t* loop, + uv_stream_t* stream, + uv_handle_type type) { + int err; + + uv__handle_init(loop, (uv_handle_t*)stream, type); + stream->read_cb = NULL; + stream->alloc_cb = NULL; + stream->close_cb = NULL; + stream->connection_cb = NULL; + stream->connect_req = NULL; + stream->shutdown_req = NULL; + stream->accepted_fd = -1; + stream->queued_fds = NULL; + stream->delayed_error = 0; + QUEUE_INIT(&stream->write_queue); + QUEUE_INIT(&stream->write_completed_queue); + stream->write_queue_size = 0; + + if (loop->emfile_fd == -1) { + err = uv__open_cloexec("/dev/null", O_RDONLY); + if (err < 0) + /* In the rare case that "/dev/null" isn't mounted open "/" + * instead. + */ + err = uv__open_cloexec("/", O_RDONLY); + if (err >= 0) + loop->emfile_fd = err; + } + +#if defined(__APPLE__) && !defined(CMAKE_BOOTSTRAP) + stream->select = NULL; +#endif /* defined(__APPLE_) */ + + uv__io_init(&stream->io_watcher, uv__stream_io, -1); +} + + +static void uv__stream_osx_interrupt_select(uv_stream_t* stream) { +#if defined(__APPLE__) && !defined(CMAKE_BOOTSTRAP) + /* Notify select() thread about state change */ + uv__stream_select_t* s; + int r; + + s = stream->select; + if (s == NULL) + return; + + /* Interrupt select() loop + * NOTE: fake_fd and int_fd are socketpair(), thus writing to one will + * emit read event on other side + */ + do + r = write(s->fake_fd, "x", 1); + while (r == -1 && errno == EINTR); + + assert(r == 1); +#else /* !defined(__APPLE__) */ + /* No-op on any other platform */ +#endif /* !defined(__APPLE__) */ +} + + +#if defined(__APPLE__) && !defined(CMAKE_BOOTSTRAP) +static void uv__stream_osx_select(void* arg) { + uv_stream_t* stream; + uv__stream_select_t* s; + char buf[1024]; + int events; + int fd; + int r; + int max_fd; + + stream = arg; + s = stream->select; + fd = s->fd; + + if (fd > s->int_fd) + max_fd = fd; + else + max_fd = s->int_fd; + + while (1) { + /* Terminate on semaphore */ + if (uv_sem_trywait(&s->close_sem) == 0) + break; + + /* Watch fd using select(2) */ + memset(s->sread, 0, s->sread_sz); + memset(s->swrite, 0, s->swrite_sz); + + if (uv__io_active(&stream->io_watcher, POLLIN)) + FD_SET(fd, s->sread); + if (uv__io_active(&stream->io_watcher, POLLOUT)) + FD_SET(fd, s->swrite); + FD_SET(s->int_fd, s->sread); + + /* Wait indefinitely for fd events */ + r = select(max_fd + 1, s->sread, s->swrite, NULL, NULL); + if (r == -1) { + if (errno == EINTR) + continue; + + /* XXX: Possible?! */ + abort(); + } + + /* Ignore timeouts */ + if (r == 0) + continue; + + /* Empty socketpair's buffer in case of interruption */ + if (FD_ISSET(s->int_fd, s->sread)) + while (1) { + r = read(s->int_fd, buf, sizeof(buf)); + + if (r == sizeof(buf)) + continue; + + if (r != -1) + break; + + if (errno == EAGAIN || errno == EWOULDBLOCK) + break; + + if (errno == EINTR) + continue; + + abort(); + } + + /* Handle events */ + events = 0; + if (FD_ISSET(fd, s->sread)) + events |= POLLIN; + if (FD_ISSET(fd, s->swrite)) + events |= POLLOUT; + + assert(events != 0 || FD_ISSET(s->int_fd, s->sread)); + if (events != 0) { + ACCESS_ONCE(int, s->events) = events; + + uv_async_send(&s->async); + uv_sem_wait(&s->async_sem); + + /* Should be processed at this stage */ - assert((s->events == 0) || (stream->flags & UV_CLOSING)); ++ assert((s->events == 0) || (stream->flags & UV_HANDLE_CLOSING)); + } + } +} + + +static void uv__stream_osx_select_cb(uv_async_t* handle) { + uv__stream_select_t* s; + uv_stream_t* stream; + int events; + + s = container_of(handle, uv__stream_select_t, async); + stream = s->stream; + + /* Get and reset stream's events */ + events = s->events; + ACCESS_ONCE(int, s->events) = 0; + + assert(events != 0); + assert(events == (events & (POLLIN | POLLOUT))); + + /* Invoke callback on event-loop */ + if ((events & POLLIN) && uv__io_active(&stream->io_watcher, POLLIN)) + uv__stream_io(stream->loop, &stream->io_watcher, POLLIN); + + if ((events & POLLOUT) && uv__io_active(&stream->io_watcher, POLLOUT)) + uv__stream_io(stream->loop, &stream->io_watcher, POLLOUT); + - if (stream->flags & UV_CLOSING) ++ if (stream->flags & UV_HANDLE_CLOSING) + return; + + /* NOTE: It is important to do it here, otherwise `select()` might be called + * before the actual `uv__read()`, leading to the blocking syscall + */ + uv_sem_post(&s->async_sem); +} + + +static void uv__stream_osx_cb_close(uv_handle_t* async) { + uv__stream_select_t* s; + + s = container_of(async, uv__stream_select_t, async); + uv__free(s); +} + + +int uv__stream_try_select(uv_stream_t* stream, int* fd) { + /* + * kqueue doesn't work with some files from /dev mount on osx. + * select(2) in separate thread for those fds + */ + + struct kevent filter[1]; + struct kevent events[1]; + struct timespec timeout; + uv__stream_select_t* s; + int fds[2]; + int err; + int ret; + int kq; + int old_fd; + int max_fd; + size_t sread_sz; + size_t swrite_sz; + + kq = kqueue(); + if (kq == -1) { + perror("(libuv) kqueue()"); + return UV__ERR(errno); + } + + EV_SET(&filter[0], *fd, EVFILT_READ, EV_ADD | EV_ENABLE, 0, 0, 0); + + /* Use small timeout, because we only want to capture EINVALs */ + timeout.tv_sec = 0; + timeout.tv_nsec = 1; + + do + ret = kevent(kq, filter, 1, events, 1, &timeout); + while (ret == -1 && errno == EINTR); + + uv__close(kq); + + if (ret == -1) + return UV__ERR(errno); + + if (ret == 0 || (events[0].flags & EV_ERROR) == 0 || events[0].data != EINVAL) + return 0; + + /* At this point we definitely know that this fd won't work with kqueue */ + + /* + * Create fds for io watcher and to interrupt the select() loop. + * NOTE: do it ahead of malloc below to allocate enough space for fd_sets + */ + if (socketpair(AF_UNIX, SOCK_STREAM, 0, fds)) + return UV__ERR(errno); + + max_fd = *fd; + if (fds[1] > max_fd) + max_fd = fds[1]; + + sread_sz = ROUND_UP(max_fd + 1, sizeof(uint32_t) * NBBY) / NBBY; + swrite_sz = sread_sz; + + s = uv__malloc(sizeof(*s) + sread_sz + swrite_sz); + if (s == NULL) { + err = UV_ENOMEM; + goto failed_malloc; + } + + s->events = 0; + s->fd = *fd; + s->sread = (fd_set*) ((char*) s + sizeof(*s)); + s->sread_sz = sread_sz; + s->swrite = (fd_set*) ((char*) s->sread + sread_sz); + s->swrite_sz = swrite_sz; + + err = uv_async_init(stream->loop, &s->async, uv__stream_osx_select_cb); + if (err) + goto failed_async_init; + - s->async.flags |= UV__HANDLE_INTERNAL; ++ s->async.flags |= UV_HANDLE_INTERNAL; + uv__handle_unref(&s->async); + + err = uv_sem_init(&s->close_sem, 0); + if (err != 0) + goto failed_close_sem_init; + + err = uv_sem_init(&s->async_sem, 0); + if (err != 0) + goto failed_async_sem_init; + + s->fake_fd = fds[0]; + s->int_fd = fds[1]; + + old_fd = *fd; + s->stream = stream; + stream->select = s; + *fd = s->fake_fd; + + err = uv_thread_create(&s->thread, uv__stream_osx_select, stream); + if (err != 0) + goto failed_thread_create; + + return 0; + +failed_thread_create: + s->stream = NULL; + stream->select = NULL; + *fd = old_fd; + + uv_sem_destroy(&s->async_sem); + +failed_async_sem_init: + uv_sem_destroy(&s->close_sem); + +failed_close_sem_init: + uv__close(fds[0]); + uv__close(fds[1]); + uv_close((uv_handle_t*) &s->async, uv__stream_osx_cb_close); + return err; + +failed_async_init: + uv__free(s); + +failed_malloc: + uv__close(fds[0]); + uv__close(fds[1]); + + return err; +} +#endif /* defined(__APPLE__) */ + + +int uv__stream_open(uv_stream_t* stream, int fd, int flags) { +#if defined(__APPLE__) + int enable; +#endif + + if (!(stream->io_watcher.fd == -1 || stream->io_watcher.fd == fd)) + return UV_EBUSY; + + assert(fd >= 0); + stream->flags |= flags; + + if (stream->type == UV_TCP) { - if ((stream->flags & UV_TCP_NODELAY) && uv__tcp_nodelay(fd, 1)) ++ if ((stream->flags & UV_HANDLE_TCP_NODELAY) && uv__tcp_nodelay(fd, 1)) + return UV__ERR(errno); + + /* TODO Use delay the user passed in. */ - if ((stream->flags & UV_TCP_KEEPALIVE) && uv__tcp_keepalive(fd, 1, 60)) ++ if ((stream->flags & UV_HANDLE_TCP_KEEPALIVE) && ++ uv__tcp_keepalive(fd, 1, 60)) { + return UV__ERR(errno); ++ } + } + +#if defined(__APPLE__) + enable = 1; + if (setsockopt(fd, SOL_SOCKET, SO_OOBINLINE, &enable, sizeof(enable)) && + errno != ENOTSOCK && + errno != EINVAL) { + return UV__ERR(errno); + } +#endif + + stream->io_watcher.fd = fd; + + return 0; +} + + +void uv__stream_flush_write_queue(uv_stream_t* stream, int error) { + uv_write_t* req; + QUEUE* q; + while (!QUEUE_EMPTY(&stream->write_queue)) { + q = QUEUE_HEAD(&stream->write_queue); + QUEUE_REMOVE(q); + + req = QUEUE_DATA(q, uv_write_t, queue); + req->error = error; + + QUEUE_INSERT_TAIL(&stream->write_completed_queue, &req->queue); + } +} + + +void uv__stream_destroy(uv_stream_t* stream) { + assert(!uv__io_active(&stream->io_watcher, POLLIN | POLLOUT)); - assert(stream->flags & UV_CLOSED); ++ assert(stream->flags & UV_HANDLE_CLOSED); + + if (stream->connect_req) { + uv__req_unregister(stream->loop, stream->connect_req); + stream->connect_req->cb(stream->connect_req, UV_ECANCELED); + stream->connect_req = NULL; + } + + uv__stream_flush_write_queue(stream, UV_ECANCELED); + uv__write_callbacks(stream); + + if (stream->shutdown_req) { + /* The ECANCELED error code is a lie, the shutdown(2) syscall is a + * fait accompli at this point. Maybe we should revisit this in v0.11. + * A possible reason for leaving it unchanged is that it informs the + * callee that the handle has been destroyed. + */ + uv__req_unregister(stream->loop, stream->shutdown_req); + stream->shutdown_req->cb(stream->shutdown_req, UV_ECANCELED); + stream->shutdown_req = NULL; + } + + assert(stream->write_queue_size == 0); +} + + +/* Implements a best effort approach to mitigating accept() EMFILE errors. + * We have a spare file descriptor stashed away that we close to get below + * the EMFILE limit. Next, we accept all pending connections and close them + * immediately to signal the clients that we're overloaded - and we are, but + * we still keep on trucking. + * + * There is one caveat: it's not reliable in a multi-threaded environment. + * The file descriptor limit is per process. Our party trick fails if another + * thread opens a file or creates a socket in the time window between us + * calling close() and accept(). + */ +static int uv__emfile_trick(uv_loop_t* loop, int accept_fd) { + int err; + int emfile_fd; + + if (loop->emfile_fd == -1) + return UV_EMFILE; + + uv__close(loop->emfile_fd); + loop->emfile_fd = -1; + + do { + err = uv__accept(accept_fd); + if (err >= 0) + uv__close(err); + } while (err >= 0 || err == UV_EINTR); + + emfile_fd = uv__open_cloexec("/", O_RDONLY); + if (emfile_fd >= 0) + loop->emfile_fd = emfile_fd; + + return err; +} + + +#if defined(UV_HAVE_KQUEUE) +# define UV_DEC_BACKLOG(w) w->rcount--; +#else +# define UV_DEC_BACKLOG(w) /* no-op */ +#endif /* defined(UV_HAVE_KQUEUE) */ + + +void uv__server_io(uv_loop_t* loop, uv__io_t* w, unsigned int events) { + uv_stream_t* stream; + int err; + + stream = container_of(w, uv_stream_t, io_watcher); + assert(events & POLLIN); + assert(stream->accepted_fd == -1); - assert(!(stream->flags & UV_CLOSING)); ++ assert(!(stream->flags & UV_HANDLE_CLOSING)); + + uv__io_start(stream->loop, &stream->io_watcher, POLLIN); + + /* connection_cb can close the server socket while we're + * in the loop so check it on each iteration. + */ + while (uv__stream_fd(stream) != -1) { + assert(stream->accepted_fd == -1); + +#if defined(UV_HAVE_KQUEUE) + if (w->rcount <= 0) + return; +#endif /* defined(UV_HAVE_KQUEUE) */ + + err = uv__accept(uv__stream_fd(stream)); + if (err < 0) { + if (err == UV_EAGAIN || err == UV__ERR(EWOULDBLOCK)) + return; /* Not an error. */ + + if (err == UV_ECONNABORTED) + continue; /* Ignore. Nothing we can do about that. */ + + if (err == UV_EMFILE || err == UV_ENFILE) { + err = uv__emfile_trick(loop, uv__stream_fd(stream)); + if (err == UV_EAGAIN || err == UV__ERR(EWOULDBLOCK)) + break; + } + + stream->connection_cb(stream, err); + continue; + } + + UV_DEC_BACKLOG(w) + stream->accepted_fd = err; + stream->connection_cb(stream, 0); + + if (stream->accepted_fd != -1) { + /* The user hasn't yet accepted called uv_accept() */ + uv__io_stop(loop, &stream->io_watcher, POLLIN); + return; + } + - if (stream->type == UV_TCP && (stream->flags & UV_TCP_SINGLE_ACCEPT)) { ++ if (stream->type == UV_TCP && ++ (stream->flags & UV_HANDLE_TCP_SINGLE_ACCEPT)) { + /* Give other processes a chance to accept connections. */ + struct timespec timeout = { 0, 1 }; + nanosleep(&timeout, NULL); + } + } +} + + +#undef UV_DEC_BACKLOG + + +int uv_accept(uv_stream_t* server, uv_stream_t* client) { + int err; + + assert(server->loop == client->loop); + + if (server->accepted_fd == -1) + return UV_EAGAIN; + + switch (client->type) { + case UV_NAMED_PIPE: + case UV_TCP: + err = uv__stream_open(client, + server->accepted_fd, - UV_STREAM_READABLE | UV_STREAM_WRITABLE); ++ UV_HANDLE_READABLE | UV_HANDLE_WRITABLE); + if (err) { + /* TODO handle error */ + uv__close(server->accepted_fd); + goto done; + } + break; + + case UV_UDP: + err = uv_udp_open((uv_udp_t*) client, server->accepted_fd); + if (err) { + uv__close(server->accepted_fd); + goto done; + } + break; + + default: + return UV_EINVAL; + } + + client->flags |= UV_HANDLE_BOUND; + +done: + /* Process queued fds */ + if (server->queued_fds != NULL) { + uv__stream_queued_fds_t* queued_fds; + + queued_fds = server->queued_fds; + + /* Read first */ + server->accepted_fd = queued_fds->fds[0]; + + /* All read, free */ + assert(queued_fds->offset > 0); + if (--queued_fds->offset == 0) { + uv__free(queued_fds); + server->queued_fds = NULL; + } else { + /* Shift rest */ + memmove(queued_fds->fds, + queued_fds->fds + 1, + queued_fds->offset * sizeof(*queued_fds->fds)); + } + } else { + server->accepted_fd = -1; + if (err == 0) + uv__io_start(server->loop, &server->io_watcher, POLLIN); + } + return err; +} + + +int uv_listen(uv_stream_t* stream, int backlog, uv_connection_cb cb) { + int err; + + switch (stream->type) { + case UV_TCP: + err = uv_tcp_listen((uv_tcp_t*)stream, backlog, cb); + break; + + case UV_NAMED_PIPE: + err = uv_pipe_listen((uv_pipe_t*)stream, backlog, cb); + break; + + default: + err = UV_EINVAL; + } + + if (err == 0) + uv__handle_start(stream); + + return err; +} + + +static void uv__drain(uv_stream_t* stream) { + uv_shutdown_t* req; + int err; + + assert(QUEUE_EMPTY(&stream->write_queue)); + uv__io_stop(stream->loop, &stream->io_watcher, POLLOUT); + uv__stream_osx_interrupt_select(stream); + + /* Shutdown? */ - if ((stream->flags & UV_STREAM_SHUTTING) && - !(stream->flags & UV_CLOSING) && - !(stream->flags & UV_STREAM_SHUT)) { ++ if ((stream->flags & UV_HANDLE_SHUTTING) && ++ !(stream->flags & UV_HANDLE_CLOSING) && ++ !(stream->flags & UV_HANDLE_SHUT)) { + assert(stream->shutdown_req); + + req = stream->shutdown_req; + stream->shutdown_req = NULL; - stream->flags &= ~UV_STREAM_SHUTTING; ++ stream->flags &= ~UV_HANDLE_SHUTTING; + uv__req_unregister(stream->loop, req); + + err = 0; + if (shutdown(uv__stream_fd(stream), SHUT_WR)) + err = UV__ERR(errno); + + if (err == 0) - stream->flags |= UV_STREAM_SHUT; ++ stream->flags |= UV_HANDLE_SHUT; + + if (req->cb != NULL) + req->cb(req, err); + } +} + + ++static ssize_t uv__writev(int fd, struct iovec* vec, size_t n) { ++ if (n == 1) ++ return write(fd, vec->iov_base, vec->iov_len); ++ else ++ return writev(fd, vec, n); ++} ++ ++ +static size_t uv__write_req_size(uv_write_t* req) { + size_t size; + + assert(req->bufs != NULL); + size = uv__count_bufs(req->bufs + req->write_index, + req->nbufs - req->write_index); + assert(req->handle->write_queue_size >= size); + + return size; +} + + ++/* Returns 1 if all write request data has been written, or 0 if there is still ++ * more data to write. ++ * ++ * Note: the return value only says something about the *current* request. ++ * There may still be other write requests sitting in the queue. ++ */ ++static int uv__write_req_update(uv_stream_t* stream, ++ uv_write_t* req, ++ size_t n) { ++ uv_buf_t* buf; ++ size_t len; ++ ++ assert(n <= stream->write_queue_size); ++ stream->write_queue_size -= n; ++ ++ buf = req->bufs + req->write_index; ++ ++ while (n > 0) { ++ len = n < buf->len ? n : buf->len; ++ buf->base += len; ++ buf->len -= len; ++ buf += (buf->len == 0); /* Advance to next buffer if this one is empty. */ ++ n -= len; ++ } ++ ++ req->write_index = buf - req->bufs; ++ ++ return req->write_index == req->nbufs; ++} ++ ++ +static void uv__write_req_finish(uv_write_t* req) { + uv_stream_t* stream = req->handle; + + /* Pop the req off tcp->write_queue. */ + QUEUE_REMOVE(&req->queue); + + /* Only free when there was no error. On error, we touch up write_queue_size + * right before making the callback. The reason we don't do that right away + * is that a write_queue_size > 0 is our only way to signal to the user that + * they should stop writing - which they should if we got an error. Something + * to revisit in future revisions of the libuv API. + */ + if (req->error == 0) { + if (req->bufs != req->bufsml) + uv__free(req->bufs); + req->bufs = NULL; + } + + /* Add it to the write_completed_queue where it will have its + * callback called in the near future. + */ + QUEUE_INSERT_TAIL(&stream->write_completed_queue, &req->queue); + uv__io_feed(stream->loop, &stream->io_watcher); +} + + +static int uv__handle_fd(uv_handle_t* handle) { + switch (handle->type) { + case UV_NAMED_PIPE: + case UV_TCP: + return ((uv_stream_t*) handle)->io_watcher.fd; + + case UV_UDP: + return ((uv_udp_t*) handle)->io_watcher.fd; + + default: + return -1; + } +} + +static void uv__write(uv_stream_t* stream) { + struct iovec* iov; + QUEUE* q; + uv_write_t* req; + int iovmax; + int iovcnt; + ssize_t n; + int err; + +start: + + assert(uv__stream_fd(stream) >= 0); + + if (QUEUE_EMPTY(&stream->write_queue)) + return; + + q = QUEUE_HEAD(&stream->write_queue); + req = QUEUE_DATA(q, uv_write_t, queue); + assert(req->handle == stream); + + /* + * Cast to iovec. We had to have our own uv_buf_t instead of iovec + * because Windows's WSABUF is not an iovec. + */ + assert(sizeof(uv_buf_t) == sizeof(struct iovec)); + iov = (struct iovec*) &(req->bufs[req->write_index]); + iovcnt = req->nbufs - req->write_index; + + iovmax = uv__getiovmax(); + + /* Limit iov count to avoid EINVALs from writev() */ + if (iovcnt > iovmax) + iovcnt = iovmax; + + /* + * Now do the actual writev. Note that we've been updating the pointers + * inside the iov each time we write. So there is no need to offset it. + */ + + if (req->send_handle) { + int fd_to_send; + struct msghdr msg; + struct cmsghdr *cmsg; + union { + char data[64]; + struct cmsghdr alias; + } scratch; + + if (uv__is_closing(req->send_handle)) { + err = UV_EBADF; + goto error; + } + + fd_to_send = uv__handle_fd((uv_handle_t*) req->send_handle); + + memset(&scratch, 0, sizeof(scratch)); + + assert(fd_to_send >= 0); + + msg.msg_name = NULL; + msg.msg_namelen = 0; + msg.msg_iov = iov; + msg.msg_iovlen = iovcnt; + msg.msg_flags = 0; + + msg.msg_control = &scratch.alias; + msg.msg_controllen = CMSG_SPACE(sizeof(fd_to_send)); + + cmsg = CMSG_FIRSTHDR(&msg); + cmsg->cmsg_level = SOL_SOCKET; + cmsg->cmsg_type = SCM_RIGHTS; + cmsg->cmsg_len = CMSG_LEN(sizeof(fd_to_send)); + + /* silence aliasing warning */ + { + void* pv = CMSG_DATA(cmsg); + int* pi = pv; + *pi = fd_to_send; + } + - do { ++ do + n = sendmsg(uv__stream_fd(stream), &msg, 0); - } - #if defined(__APPLE__) - /* - * Due to a possible kernel bug at least in OS X 10.10 "Yosemite", - * EPROTOTYPE can be returned while trying to write to a socket that is - * shutting down. If we retry the write, we should get the expected EPIPE - * instead. - */ - while (n == -1 && (errno == EINTR || errno == EPROTOTYPE)); - #else - while (n == -1 && errno == EINTR); - #endif - } else { - do { - if (iovcnt == 1) { - n = write(uv__stream_fd(stream), iov[0].iov_base, iov[0].iov_len); - } else { - n = writev(uv__stream_fd(stream), iov, iovcnt); - } - } - #if defined(__APPLE__) - /* - * Due to a possible kernel bug at least in OS X 10.10 "Yosemite", - * EPROTOTYPE can be returned while trying to write to a socket that is - * shutting down. If we retry the write, we should get the expected EPIPE - * instead. - */ - while (n == -1 && (errno == EINTR || errno == EPROTOTYPE)); - #else - while (n == -1 && errno == EINTR); - #endif - } ++ while (n == -1 && RETRY_ON_WRITE_ERROR(errno)); + - if (n < 0) { - if (!WRITE_RETRY_ON_ERROR(req->send_handle)) { - err = UV__ERR(errno); - goto error; - } else if (stream->flags & UV_STREAM_BLOCKING) { - /* If this is a blocking stream, try again. */ - goto start; - } ++ /* Ensure the handle isn't sent again in case this is a partial write. */ ++ if (n >= 0) ++ req->send_handle = NULL; + } else { - /* Successful write */ - - while (n >= 0) { - uv_buf_t* buf = &(req->bufs[req->write_index]); - size_t len = buf->len; - - assert(req->write_index < req->nbufs); - - if ((size_t)n < len) { - buf->base += n; - buf->len -= n; - stream->write_queue_size -= n; - n = 0; - - /* There is more to write. */ - if (stream->flags & UV_STREAM_BLOCKING) { - /* - * If we're blocking then we should not be enabling the write - * watcher - instead we need to try again. - */ - goto start; - } else { - /* Break loop and ensure the watcher is pending. */ - break; - } - - } else { - /* Finished writing the buf at index req->write_index. */ - req->write_index++; - - assert((size_t)n >= len); - n -= len; - - assert(stream->write_queue_size >= len); - stream->write_queue_size -= len; ++ do ++ n = uv__writev(uv__stream_fd(stream), iov, iovcnt); ++ while (n == -1 && RETRY_ON_WRITE_ERROR(errno)); ++ } + - if (req->write_index == req->nbufs) { - /* Then we're done! */ - assert(n == 0); - uv__write_req_finish(req); - /* TODO: start trying to write the next request. */ - return; - } - } - } ++ if (n == -1 && !IS_TRANSIENT_WRITE_ERROR(errno, req->send_handle)) { ++ err = UV__ERR(errno); ++ goto error; + } + - /* Either we've counted n down to zero or we've got EAGAIN. */ - assert(n == 0 || n == -1); ++ if (n > 0 && uv__write_req_update(stream, req, n)) { ++ uv__write_req_finish(req); ++ return; /* TODO(bnoordhuis) Start trying to write the next request. */ ++ } + - /* Only non-blocking streams should use the write_watcher. */ - assert(!(stream->flags & UV_STREAM_BLOCKING)); ++ /* If this is a blocking stream, try again. */ ++ if (stream->flags & UV_HANDLE_BLOCKING_WRITES) ++ goto start; + + /* We're not done. */ + uv__io_start(stream->loop, &stream->io_watcher, POLLOUT); + + /* Notify select() thread about state change */ + uv__stream_osx_interrupt_select(stream); + + return; + +error: + req->error = err; + uv__write_req_finish(req); + uv__io_stop(stream->loop, &stream->io_watcher, POLLOUT); + if (!uv__io_active(&stream->io_watcher, POLLIN)) + uv__handle_stop(stream); + uv__stream_osx_interrupt_select(stream); +} + + +static void uv__write_callbacks(uv_stream_t* stream) { + uv_write_t* req; + QUEUE* q; ++ QUEUE pq; ++ ++ if (QUEUE_EMPTY(&stream->write_completed_queue)) ++ return; ++ ++ QUEUE_MOVE(&stream->write_completed_queue, &pq); + - while (!QUEUE_EMPTY(&stream->write_completed_queue)) { ++ while (!QUEUE_EMPTY(&pq)) { + /* Pop a req off write_completed_queue. */ - q = QUEUE_HEAD(&stream->write_completed_queue); ++ q = QUEUE_HEAD(&pq); + req = QUEUE_DATA(q, uv_write_t, queue); + QUEUE_REMOVE(q); + uv__req_unregister(stream->loop, req); + + if (req->bufs != NULL) { + stream->write_queue_size -= uv__write_req_size(req); + if (req->bufs != req->bufsml) + uv__free(req->bufs); + req->bufs = NULL; + } + + /* NOTE: call callback AFTER freeing the request data. */ + if (req->cb) + req->cb(req, req->error); + } - - assert(QUEUE_EMPTY(&stream->write_completed_queue)); +} + + +uv_handle_type uv__handle_type(int fd) { + struct sockaddr_storage ss; + socklen_t sslen; + socklen_t len; + int type; + + memset(&ss, 0, sizeof(ss)); + sslen = sizeof(ss); + + if (getsockname(fd, (struct sockaddr*)&ss, &sslen)) + return UV_UNKNOWN_HANDLE; + + len = sizeof type; + + if (getsockopt(fd, SOL_SOCKET, SO_TYPE, &type, &len)) + return UV_UNKNOWN_HANDLE; + + if (type == SOCK_STREAM) { +#if defined(_AIX) || defined(__DragonFly__) + /* on AIX/DragonFly the getsockname call returns an empty sa structure + * for sockets of type AF_UNIX. For all other types it will + * return a properly filled in structure. + */ + if (sslen == 0) + return UV_NAMED_PIPE; +#endif + switch (ss.ss_family) { + case AF_UNIX: + return UV_NAMED_PIPE; + case AF_INET: + case AF_INET6: + return UV_TCP; + } + } + + if (type == SOCK_DGRAM && + (ss.ss_family == AF_INET || ss.ss_family == AF_INET6)) + return UV_UDP; + + return UV_UNKNOWN_HANDLE; +} + + +static void uv__stream_eof(uv_stream_t* stream, const uv_buf_t* buf) { - stream->flags |= UV_STREAM_READ_EOF; ++ stream->flags |= UV_HANDLE_READ_EOF; + uv__io_stop(stream->loop, &stream->io_watcher, POLLIN); + if (!uv__io_active(&stream->io_watcher, POLLOUT)) + uv__handle_stop(stream); + uv__stream_osx_interrupt_select(stream); + stream->read_cb(stream, UV_EOF, buf); - stream->flags &= ~UV_STREAM_READING; ++ stream->flags &= ~UV_HANDLE_READING; +} + + +static int uv__stream_queue_fd(uv_stream_t* stream, int fd) { + uv__stream_queued_fds_t* queued_fds; + unsigned int queue_size; + + queued_fds = stream->queued_fds; + if (queued_fds == NULL) { + queue_size = 8; + queued_fds = uv__malloc((queue_size - 1) * sizeof(*queued_fds->fds) + + sizeof(*queued_fds)); + if (queued_fds == NULL) + return UV_ENOMEM; + queued_fds->size = queue_size; + queued_fds->offset = 0; + stream->queued_fds = queued_fds; + + /* Grow */ + } else if (queued_fds->size == queued_fds->offset) { + queue_size = queued_fds->size + 8; + queued_fds = uv__realloc(queued_fds, + (queue_size - 1) * sizeof(*queued_fds->fds) + + sizeof(*queued_fds)); + + /* + * Allocation failure, report back. + * NOTE: if it is fatal - sockets will be closed in uv__stream_close + */ + if (queued_fds == NULL) + return UV_ENOMEM; + queued_fds->size = queue_size; + stream->queued_fds = queued_fds; + } + + /* Put fd in a queue */ + queued_fds->fds[queued_fds->offset++] = fd; + + return 0; +} + + +#define UV__CMSG_FD_COUNT 64 +#define UV__CMSG_FD_SIZE (UV__CMSG_FD_COUNT * sizeof(int)) + + +static int uv__stream_recv_cmsg(uv_stream_t* stream, struct msghdr* msg) { + struct cmsghdr* cmsg; + + for (cmsg = CMSG_FIRSTHDR(msg); cmsg != NULL; cmsg = CMSG_NXTHDR(msg, cmsg)) { + char* start; + char* end; + int err; + void* pv; + int* pi; + unsigned int i; + unsigned int count; + + if (cmsg->cmsg_type != SCM_RIGHTS) { + fprintf(stderr, "ignoring non-SCM_RIGHTS ancillary data: %d\n", + cmsg->cmsg_type); + continue; + } + + /* silence aliasing warning */ + pv = CMSG_DATA(cmsg); + pi = pv; + + /* Count available fds */ + start = (char*) cmsg; + end = (char*) cmsg + cmsg->cmsg_len; + count = 0; + while (start + CMSG_LEN(count * sizeof(*pi)) < end) + count++; + assert(start + CMSG_LEN(count * sizeof(*pi)) == end); + + for (i = 0; i < count; i++) { + /* Already has accepted fd, queue now */ + if (stream->accepted_fd != -1) { + err = uv__stream_queue_fd(stream, pi[i]); + if (err != 0) { + /* Close rest */ + for (; i < count; i++) + uv__close(pi[i]); + return err; + } + } else { + stream->accepted_fd = pi[i]; + } + } + } + + return 0; +} + + +#ifdef __clang__ +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wgnu-folding-constant" ++# pragma clang diagnostic ignored "-Wvla-extension" +#endif + +static void uv__read(uv_stream_t* stream) { + uv_buf_t buf; + ssize_t nread; + struct msghdr msg; + char cmsg_space[CMSG_SPACE(UV__CMSG_FD_SIZE)]; + int count; + int err; + int is_ipc; + - stream->flags &= ~UV_STREAM_READ_PARTIAL; ++ stream->flags &= ~UV_HANDLE_READ_PARTIAL; + + /* Prevent loop starvation when the data comes in as fast as (or faster than) + * we can read it. XXX Need to rearm fd if we switch to edge-triggered I/O. + */ + count = 32; + + is_ipc = stream->type == UV_NAMED_PIPE && ((uv_pipe_t*) stream)->ipc; + - /* XXX: Maybe instead of having UV_STREAM_READING we just test if ++ /* XXX: Maybe instead of having UV_HANDLE_READING we just test if + * tcp->read_cb is NULL or not? + */ + while (stream->read_cb - && (stream->flags & UV_STREAM_READING) ++ && (stream->flags & UV_HANDLE_READING) + && (count-- > 0)) { + assert(stream->alloc_cb != NULL); + + buf = uv_buf_init(NULL, 0); + stream->alloc_cb((uv_handle_t*)stream, 64 * 1024, &buf); + if (buf.base == NULL || buf.len == 0) { + /* User indicates it can't or won't handle the read. */ + stream->read_cb(stream, UV_ENOBUFS, &buf); + return; + } + + assert(buf.base != NULL); + assert(uv__stream_fd(stream) >= 0); + + if (!is_ipc) { + do { + nread = read(uv__stream_fd(stream), buf.base, buf.len); + } + while (nread < 0 && errno == EINTR); + } else { + /* ipc uses recvmsg */ + msg.msg_flags = 0; + msg.msg_iov = (struct iovec*) &buf; + msg.msg_iovlen = 1; + msg.msg_name = NULL; + msg.msg_namelen = 0; + /* Set up to receive a descriptor even if one isn't in the message */ + msg.msg_controllen = sizeof(cmsg_space); + msg.msg_control = cmsg_space; + + do { + nread = uv__recvmsg(uv__stream_fd(stream), &msg, 0); + } + while (nread < 0 && errno == EINTR); + } + + if (nread < 0) { + /* Error */ + if (errno == EAGAIN || errno == EWOULDBLOCK) { + /* Wait for the next one. */ - if (stream->flags & UV_STREAM_READING) { ++ if (stream->flags & UV_HANDLE_READING) { + uv__io_start(stream->loop, &stream->io_watcher, POLLIN); + uv__stream_osx_interrupt_select(stream); + } + stream->read_cb(stream, 0, &buf); +#if defined(__CYGWIN__) || defined(__MSYS__) + } else if (errno == ECONNRESET && stream->type == UV_NAMED_PIPE) { + uv__stream_eof(stream, &buf); + return; +#endif + } else { + /* Error. User should call uv_close(). */ + stream->read_cb(stream, UV__ERR(errno), &buf); - if (stream->flags & UV_STREAM_READING) { - stream->flags &= ~UV_STREAM_READING; ++ if (stream->flags & UV_HANDLE_READING) { ++ stream->flags &= ~UV_HANDLE_READING; + uv__io_stop(stream->loop, &stream->io_watcher, POLLIN); + if (!uv__io_active(&stream->io_watcher, POLLOUT)) + uv__handle_stop(stream); + uv__stream_osx_interrupt_select(stream); + } + } + return; + } else if (nread == 0) { + uv__stream_eof(stream, &buf); + return; + } else { + /* Successful read */ + ssize_t buflen = buf.len; + + if (is_ipc) { + err = uv__stream_recv_cmsg(stream, &msg); + if (err != 0) { + stream->read_cb(stream, err, &buf); + return; + } + } + +#if defined(__MVS__) + if (is_ipc && msg.msg_controllen > 0) { + uv_buf_t blankbuf; + int nread; + struct iovec *old; + + blankbuf.base = 0; + blankbuf.len = 0; + old = msg.msg_iov; + msg.msg_iov = (struct iovec*) &blankbuf; + nread = 0; + do { + nread = uv__recvmsg(uv__stream_fd(stream), &msg, 0); + err = uv__stream_recv_cmsg(stream, &msg); + if (err != 0) { + stream->read_cb(stream, err, &buf); + msg.msg_iov = old; + return; + } + } while (nread == 0 && msg.msg_controllen > 0); + msg.msg_iov = old; + } +#endif + stream->read_cb(stream, nread, &buf); + + /* Return if we didn't fill the buffer, there is no more data to read. */ + if (nread < buflen) { - stream->flags |= UV_STREAM_READ_PARTIAL; ++ stream->flags |= UV_HANDLE_READ_PARTIAL; + return; + } + } + } +} + + +#ifdef __clang__ +# pragma clang diagnostic pop +#endif + +#undef UV__CMSG_FD_COUNT +#undef UV__CMSG_FD_SIZE + + +int uv_shutdown(uv_shutdown_t* req, uv_stream_t* stream, uv_shutdown_cb cb) { + assert(stream->type == UV_TCP || + stream->type == UV_TTY || + stream->type == UV_NAMED_PIPE); + - if (!(stream->flags & UV_STREAM_WRITABLE) || - stream->flags & UV_STREAM_SHUT || - stream->flags & UV_STREAM_SHUTTING || ++ if (!(stream->flags & UV_HANDLE_WRITABLE) || ++ stream->flags & UV_HANDLE_SHUT || ++ stream->flags & UV_HANDLE_SHUTTING || + uv__is_closing(stream)) { + return UV_ENOTCONN; + } + + assert(uv__stream_fd(stream) >= 0); + + /* Initialize request */ + uv__req_init(stream->loop, req, UV_SHUTDOWN); + req->handle = stream; + req->cb = cb; + stream->shutdown_req = req; - stream->flags |= UV_STREAM_SHUTTING; ++ stream->flags |= UV_HANDLE_SHUTTING; + + uv__io_start(stream->loop, &stream->io_watcher, POLLOUT); + uv__stream_osx_interrupt_select(stream); + + return 0; +} + + +static void uv__stream_io(uv_loop_t* loop, uv__io_t* w, unsigned int events) { + uv_stream_t* stream; + + stream = container_of(w, uv_stream_t, io_watcher); + + assert(stream->type == UV_TCP || + stream->type == UV_NAMED_PIPE || + stream->type == UV_TTY); - assert(!(stream->flags & UV_CLOSING)); ++ assert(!(stream->flags & UV_HANDLE_CLOSING)); + + if (stream->connect_req) { + uv__stream_connect(stream); + return; + } + + assert(uv__stream_fd(stream) >= 0); + - /* Ignore POLLHUP here. Even it it's set, there may still be data to read. */ ++ /* Ignore POLLHUP here. Even if it's set, there may still be data to read. */ + if (events & (POLLIN | POLLERR | POLLHUP)) + uv__read(stream); + + if (uv__stream_fd(stream) == -1) + return; /* read_cb closed stream. */ + + /* Short-circuit iff POLLHUP is set, the user is still interested in read + * events and uv__read() reported a partial read but not EOF. If the EOF + * flag is set, uv__read() called read_cb with err=UV_EOF and we don't + * have to do anything. If the partial read flag is not set, we can't + * report the EOF yet because there is still data to read. + */ + if ((events & POLLHUP) && - (stream->flags & UV_STREAM_READING) && - (stream->flags & UV_STREAM_READ_PARTIAL) && - !(stream->flags & UV_STREAM_READ_EOF)) { ++ (stream->flags & UV_HANDLE_READING) && ++ (stream->flags & UV_HANDLE_READ_PARTIAL) && ++ !(stream->flags & UV_HANDLE_READ_EOF)) { + uv_buf_t buf = { NULL, 0 }; + uv__stream_eof(stream, &buf); + } + + if (uv__stream_fd(stream) == -1) + return; /* read_cb closed stream. */ + + if (events & (POLLOUT | POLLERR | POLLHUP)) { + uv__write(stream); + uv__write_callbacks(stream); + + /* Write queue drained. */ + if (QUEUE_EMPTY(&stream->write_queue)) + uv__drain(stream); + } +} + + +/** + * We get called here from directly following a call to connect(2). + * In order to determine if we've errored out or succeeded must call + * getsockopt. + */ +static void uv__stream_connect(uv_stream_t* stream) { + int error; + uv_connect_t* req = stream->connect_req; + socklen_t errorsize = sizeof(int); + + assert(stream->type == UV_TCP || stream->type == UV_NAMED_PIPE); + assert(req); + + if (stream->delayed_error) { + /* To smooth over the differences between unixes errors that + * were reported synchronously on the first connect can be delayed + * until the next tick--which is now. + */ + error = stream->delayed_error; + stream->delayed_error = 0; + } else { + /* Normal situation: we need to get the socket error from the kernel. */ + assert(uv__stream_fd(stream) >= 0); + getsockopt(uv__stream_fd(stream), + SOL_SOCKET, + SO_ERROR, + &error, + &errorsize); + error = UV__ERR(error); + } + + if (error == UV__ERR(EINPROGRESS)) + return; + + stream->connect_req = NULL; + uv__req_unregister(stream->loop, req); + + if (error < 0 || QUEUE_EMPTY(&stream->write_queue)) { + uv__io_stop(stream->loop, &stream->io_watcher, POLLOUT); + } + + if (req->cb) + req->cb(req, error); + + if (uv__stream_fd(stream) == -1) + return; + + if (error < 0) { + uv__stream_flush_write_queue(stream, UV_ECANCELED); + uv__write_callbacks(stream); + } +} + + +int uv_write2(uv_write_t* req, + uv_stream_t* stream, + const uv_buf_t bufs[], + unsigned int nbufs, + uv_stream_t* send_handle, + uv_write_cb cb) { + int empty_queue; + + assert(nbufs > 0); + assert((stream->type == UV_TCP || + stream->type == UV_NAMED_PIPE || + stream->type == UV_TTY) && + "uv_write (unix) does not yet support other types of streams"); + + if (uv__stream_fd(stream) < 0) + return UV_EBADF; + - if (!(stream->flags & UV_STREAM_WRITABLE)) ++ if (!(stream->flags & UV_HANDLE_WRITABLE)) + return -EPIPE; + + if (send_handle) { + if (stream->type != UV_NAMED_PIPE || !((uv_pipe_t*)stream)->ipc) + return UV_EINVAL; + + /* XXX We abuse uv_write2() to send over UDP handles to child processes. + * Don't call uv__stream_fd() on those handles, it's a macro that on OS X + * evaluates to a function that operates on a uv_stream_t with a couple of + * OS X specific fields. On other Unices it does (handle)->io_watcher.fd, + * which works but only by accident. + */ + if (uv__handle_fd((uv_handle_t*) send_handle) < 0) + return UV_EBADF; + +#if defined(__CYGWIN__) || defined(__MSYS__) + /* Cygwin recvmsg always sets msg_controllen to zero, so we cannot send it. + See https://github.com/mirror/newlib-cygwin/blob/86fc4bf0/winsup/cygwin/fhandler_socket.cc#L1736-L1743 */ + return UV_ENOSYS; +#endif + } + + /* It's legal for write_queue_size > 0 even when the write_queue is empty; + * it means there are error-state requests in the write_completed_queue that + * will touch up write_queue_size later, see also uv__write_req_finish(). + * We could check that write_queue is empty instead but that implies making + * a write() syscall when we know that the handle is in error mode. + */ + empty_queue = (stream->write_queue_size == 0); + + /* Initialize the req */ + uv__req_init(stream->loop, req, UV_WRITE); + req->cb = cb; + req->handle = stream; + req->error = 0; + req->send_handle = send_handle; + QUEUE_INIT(&req->queue); + + req->bufs = req->bufsml; + if (nbufs > ARRAY_SIZE(req->bufsml)) + req->bufs = uv__malloc(nbufs * sizeof(bufs[0])); + + if (req->bufs == NULL) + return UV_ENOMEM; + + memcpy(req->bufs, bufs, nbufs * sizeof(bufs[0])); + req->nbufs = nbufs; + req->write_index = 0; + stream->write_queue_size += uv__count_bufs(bufs, nbufs); + + /* Append the request to write_queue. */ + QUEUE_INSERT_TAIL(&stream->write_queue, &req->queue); + + /* If the queue was empty when this function began, we should attempt to + * do the write immediately. Otherwise start the write_watcher and wait + * for the fd to become writable. + */ + if (stream->connect_req) { + /* Still connecting, do nothing. */ + } + else if (empty_queue) { + uv__write(stream); + } + else { + /* + * blocking streams should never have anything in the queue. + * if this assert fires then somehow the blocking stream isn't being + * sufficiently flushed in uv__write. + */ - assert(!(stream->flags & UV_STREAM_BLOCKING)); ++ assert(!(stream->flags & UV_HANDLE_BLOCKING_WRITES)); + uv__io_start(stream->loop, &stream->io_watcher, POLLOUT); + uv__stream_osx_interrupt_select(stream); + } + + return 0; +} + + +/* The buffers to be written must remain valid until the callback is called. + * This is not required for the uv_buf_t array. + */ +int uv_write(uv_write_t* req, + uv_stream_t* handle, + const uv_buf_t bufs[], + unsigned int nbufs, + uv_write_cb cb) { + return uv_write2(req, handle, bufs, nbufs, NULL, cb); +} + + +void uv_try_write_cb(uv_write_t* req, int status) { + /* Should not be called */ + abort(); +} + + +int uv_try_write(uv_stream_t* stream, + const uv_buf_t bufs[], + unsigned int nbufs) { + int r; + int has_pollout; + size_t written; + size_t req_size; + uv_write_t req; + + /* Connecting or already writing some data */ + if (stream->connect_req != NULL || stream->write_queue_size != 0) + return UV_EAGAIN; + + has_pollout = uv__io_active(&stream->io_watcher, POLLOUT); + + r = uv_write(&req, stream, bufs, nbufs, uv_try_write_cb); + if (r != 0) + return r; + + /* Remove not written bytes from write queue size */ + written = uv__count_bufs(bufs, nbufs); + if (req.bufs != NULL) + req_size = uv__write_req_size(&req); + else + req_size = 0; + written -= req_size; + stream->write_queue_size -= req_size; + + /* Unqueue request, regardless of immediateness */ + QUEUE_REMOVE(&req.queue); + uv__req_unregister(stream->loop, &req); + if (req.bufs != req.bufsml) + uv__free(req.bufs); + req.bufs = NULL; + + /* Do not poll for writable, if we wasn't before calling this */ + if (!has_pollout) { + uv__io_stop(stream->loop, &stream->io_watcher, POLLOUT); + uv__stream_osx_interrupt_select(stream); + } + + if (written == 0 && req_size != 0) + return UV_EAGAIN; + else + return written; +} + + +int uv_read_start(uv_stream_t* stream, + uv_alloc_cb alloc_cb, + uv_read_cb read_cb) { + assert(stream->type == UV_TCP || stream->type == UV_NAMED_PIPE || + stream->type == UV_TTY); + - if (stream->flags & UV_CLOSING) ++ if (stream->flags & UV_HANDLE_CLOSING) + return UV_EINVAL; + - if (!(stream->flags & UV_STREAM_READABLE)) ++ if (!(stream->flags & UV_HANDLE_READABLE)) + return -ENOTCONN; + - /* The UV_STREAM_READING flag is irrelevant of the state of the tcp - it just ++ /* The UV_HANDLE_READING flag is irrelevant of the state of the tcp - it just + * expresses the desired state of the user. + */ - stream->flags |= UV_STREAM_READING; ++ stream->flags |= UV_HANDLE_READING; + + /* TODO: try to do the read inline? */ + /* TODO: keep track of tcp state. If we've gotten a EOF then we should + * not start the IO watcher. + */ + assert(uv__stream_fd(stream) >= 0); + assert(alloc_cb); + + stream->read_cb = read_cb; + stream->alloc_cb = alloc_cb; + + uv__io_start(stream->loop, &stream->io_watcher, POLLIN); + uv__handle_start(stream); + uv__stream_osx_interrupt_select(stream); + + return 0; +} + + +int uv_read_stop(uv_stream_t* stream) { - if (!(stream->flags & UV_STREAM_READING)) ++ if (!(stream->flags & UV_HANDLE_READING)) + return 0; + - stream->flags &= ~UV_STREAM_READING; ++ stream->flags &= ~UV_HANDLE_READING; + uv__io_stop(stream->loop, &stream->io_watcher, POLLIN); + if (!uv__io_active(&stream->io_watcher, POLLOUT)) + uv__handle_stop(stream); + uv__stream_osx_interrupt_select(stream); + + stream->read_cb = NULL; + stream->alloc_cb = NULL; + return 0; +} + + +int uv_is_readable(const uv_stream_t* stream) { - return !!(stream->flags & UV_STREAM_READABLE); ++ return !!(stream->flags & UV_HANDLE_READABLE); +} + + +int uv_is_writable(const uv_stream_t* stream) { - return !!(stream->flags & UV_STREAM_WRITABLE); ++ return !!(stream->flags & UV_HANDLE_WRITABLE); +} + + +#if defined(__APPLE__) && !defined(CMAKE_BOOTSTRAP) +int uv___stream_fd(const uv_stream_t* handle) { + const uv__stream_select_t* s; + + assert(handle->type == UV_TCP || + handle->type == UV_TTY || + handle->type == UV_NAMED_PIPE); + + s = handle->select; + if (s != NULL) + return s->fd; + + return handle->io_watcher.fd; +} +#endif /* defined(__APPLE__) */ + + +void uv__stream_close(uv_stream_t* handle) { + unsigned int i; + uv__stream_queued_fds_t* queued_fds; + +#if defined(__APPLE__) && !defined(CMAKE_BOOTSTRAP) + /* Terminate select loop first */ + if (handle->select != NULL) { + uv__stream_select_t* s; + + s = handle->select; + + uv_sem_post(&s->close_sem); + uv_sem_post(&s->async_sem); + uv__stream_osx_interrupt_select(handle); + uv_thread_join(&s->thread); + uv_sem_destroy(&s->close_sem); + uv_sem_destroy(&s->async_sem); + uv__close(s->fake_fd); + uv__close(s->int_fd); + uv_close((uv_handle_t*) &s->async, uv__stream_osx_cb_close); + + handle->select = NULL; + } +#endif /* defined(__APPLE__) */ + + uv__io_close(handle->loop, &handle->io_watcher); + uv_read_stop(handle); + uv__handle_stop(handle); ++ handle->flags &= ~(UV_HANDLE_READABLE | UV_HANDLE_WRITABLE); + + if (handle->io_watcher.fd != -1) { + /* Don't close stdio file descriptors. Nothing good comes from it. */ + if (handle->io_watcher.fd > STDERR_FILENO) + uv__close(handle->io_watcher.fd); + handle->io_watcher.fd = -1; + } + + if (handle->accepted_fd != -1) { + uv__close(handle->accepted_fd); + handle->accepted_fd = -1; + } + + /* Close all queued fds */ + if (handle->queued_fds != NULL) { + queued_fds = handle->queued_fds; + for (i = 0; i < queued_fds->offset; i++) + uv__close(queued_fds->fds[i]); + uv__free(handle->queued_fds); + handle->queued_fds = NULL; + } + + assert(!uv__io_active(&handle->io_watcher, POLLIN | POLLOUT)); +} + + +int uv_stream_set_blocking(uv_stream_t* handle, int blocking) { + /* Don't need to check the file descriptor, uv__nonblock() + * will fail with EBADF if it's not valid. + */ + return uv__nonblock(uv__stream_fd(handle), !blocking); +} diff --cc Utilities/cmlibuv/src/unix/sunos.c index b92888e,0000000..aac6504 mode 100644,000000..100644 --- a/Utilities/cmlibuv/src/unix/sunos.c +++ b/Utilities/cmlibuv/src/unix/sunos.c @@@ -1,825 -1,0 +1,834 @@@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "internal.h" + +#include +#include +#include +#include +#include +#include + +#if !defined(SUNOS_NO_IFADDRS) && _XOPEN_SOURCE < 600 +#define SUNOS_NO_IFADDRS +#endif + +#ifndef SUNOS_NO_IFADDRS +# include +#endif +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#define PORT_FIRED 0x69 +#define PORT_UNUSED 0x0 +#define PORT_LOADED 0x99 +#define PORT_DELETED -1 + +#if (!defined(_LP64)) && (_FILE_OFFSET_BITS - 0 == 64) +#define PROCFS_FILE_OFFSET_BITS_HACK 1 +#undef _FILE_OFFSET_BITS +#else +#define PROCFS_FILE_OFFSET_BITS_HACK 0 +#endif + +#include + +#if (PROCFS_FILE_OFFSET_BITS_HACK - 0 == 1) +#define _FILE_OFFSET_BITS 64 +#endif + + +int uv__platform_loop_init(uv_loop_t* loop) { + int err; + int fd; + + loop->fs_fd = -1; + loop->backend_fd = -1; + + fd = port_create(); + if (fd == -1) + return UV__ERR(errno); + + err = uv__cloexec(fd, 1); + if (err) { + uv__close(fd); + return err; + } + loop->backend_fd = fd; + + return 0; +} + + +void uv__platform_loop_delete(uv_loop_t* loop) { + if (loop->fs_fd != -1) { + uv__close(loop->fs_fd); + loop->fs_fd = -1; + } + + if (loop->backend_fd != -1) { + uv__close(loop->backend_fd); + loop->backend_fd = -1; + } +} + + +int uv__io_fork(uv_loop_t* loop) { +#if defined(PORT_SOURCE_FILE) + if (loop->fs_fd != -1) { + /* stop the watcher before we blow away its fileno */ + uv__io_stop(loop, &loop->fs_event_watcher, POLLIN); + } +#endif + uv__platform_loop_delete(loop); + return uv__platform_loop_init(loop); +} + + +void uv__platform_invalidate_fd(uv_loop_t* loop, int fd) { + struct port_event* events; + uintptr_t i; + uintptr_t nfds; + + assert(loop->watchers != NULL); + + events = (struct port_event*) loop->watchers[loop->nwatchers]; + nfds = (uintptr_t) loop->watchers[loop->nwatchers + 1]; + if (events == NULL) + return; + + /* Invalidate events with same file descriptor */ + for (i = 0; i < nfds; i++) + if ((int) events[i].portev_object == fd) + events[i].portev_object = -1; +} + + +int uv__io_check_fd(uv_loop_t* loop, int fd) { + if (port_associate(loop->backend_fd, PORT_SOURCE_FD, fd, POLLIN, 0)) + return UV__ERR(errno); + + if (port_dissociate(loop->backend_fd, PORT_SOURCE_FD, fd)) + abort(); + + return 0; +} + + +void uv__io_poll(uv_loop_t* loop, int timeout) { + struct port_event events[1024]; + struct port_event* pe; + struct timespec spec; + QUEUE* q; + uv__io_t* w; + sigset_t* pset; + sigset_t set; + uint64_t base; + uint64_t diff; + unsigned int nfds; + unsigned int i; + int saved_errno; + int have_signals; + int nevents; + int count; + int err; + int fd; + + if (loop->nfds == 0) { + assert(QUEUE_EMPTY(&loop->watcher_queue)); + return; + } + + while (!QUEUE_EMPTY(&loop->watcher_queue)) { + q = QUEUE_HEAD(&loop->watcher_queue); + QUEUE_REMOVE(q); + QUEUE_INIT(q); + + w = QUEUE_DATA(q, uv__io_t, watcher_queue); + assert(w->pevents != 0); + + if (port_associate(loop->backend_fd, PORT_SOURCE_FD, w->fd, w->pevents, 0)) + abort(); + + w->events = w->pevents; + } + + pset = NULL; + if (loop->flags & UV_LOOP_BLOCK_SIGPROF) { + pset = &set; + sigemptyset(pset); + sigaddset(pset, SIGPROF); + } + + assert(timeout >= -1); + base = loop->time; + count = 48; /* Benchmarks suggest this gives the best throughput. */ + + for (;;) { + if (timeout != -1) { + spec.tv_sec = timeout / 1000; + spec.tv_nsec = (timeout % 1000) * 1000000; + } + + /* Work around a kernel bug where nfds is not updated. */ + events[0].portev_source = 0; + + nfds = 1; + saved_errno = 0; + + if (pset != NULL) + pthread_sigmask(SIG_BLOCK, pset, NULL); + + err = port_getn(loop->backend_fd, + events, + ARRAY_SIZE(events), + &nfds, + timeout == -1 ? NULL : &spec); + + if (pset != NULL) + pthread_sigmask(SIG_UNBLOCK, pset, NULL); + + if (err) { + /* Work around another kernel bug: port_getn() may return events even + * on error. + */ + if (errno == EINTR || errno == ETIME) + saved_errno = errno; + else + abort(); + } + + /* Update loop->time unconditionally. It's tempting to skip the update when + * timeout == 0 (i.e. non-blocking poll) but there is no guarantee that the + * operating system didn't reschedule our process while in the syscall. + */ + SAVE_ERRNO(uv__update_time(loop)); + + if (events[0].portev_source == 0) { + if (timeout == 0) + return; + + if (timeout == -1) + continue; + + goto update_timeout; + } + + if (nfds == 0) { + assert(timeout != -1); + return; + } + + have_signals = 0; + nevents = 0; + + assert(loop->watchers != NULL); + loop->watchers[loop->nwatchers] = (void*) events; + loop->watchers[loop->nwatchers + 1] = (void*) (uintptr_t) nfds; + for (i = 0; i < nfds; i++) { + pe = events + i; + fd = pe->portev_object; + + /* Skip invalidated events, see uv__platform_invalidate_fd */ + if (fd == -1) + continue; + + assert(fd >= 0); + assert((unsigned) fd < loop->nwatchers); + + w = loop->watchers[fd]; + + /* File descriptor that we've stopped watching, ignore. */ + if (w == NULL) + continue; + + /* Run signal watchers last. This also affects child process watchers + * because those are implemented in terms of signal watchers. + */ + if (w == &loop->signal_io_watcher) + have_signals = 1; + else + w->cb(loop, w, pe->portev_events); + + nevents++; + + if (w != loop->watchers[fd]) + continue; /* Disabled by callback. */ + + /* Events Ports operates in oneshot mode, rearm timer on next run. */ + if (w->pevents != 0 && QUEUE_EMPTY(&w->watcher_queue)) + QUEUE_INSERT_TAIL(&loop->watcher_queue, &w->watcher_queue); + } + + if (have_signals != 0) + loop->signal_io_watcher.cb(loop, &loop->signal_io_watcher, POLLIN); + + loop->watchers[loop->nwatchers] = NULL; + loop->watchers[loop->nwatchers + 1] = NULL; + + if (have_signals != 0) + return; /* Event loop should cycle now so don't poll again. */ + + if (nevents != 0) { + if (nfds == ARRAY_SIZE(events) && --count != 0) { + /* Poll for more events but don't block this time. */ + timeout = 0; + continue; + } + return; + } + + if (saved_errno == ETIME) { + assert(timeout != -1); + return; + } + + if (timeout == 0) + return; + + if (timeout == -1) + continue; + +update_timeout: + assert(timeout > 0); + + diff = loop->time - base; + if (diff >= (uint64_t) timeout) + return; + + timeout -= diff; + } +} + + +uint64_t uv__hrtime(uv_clocktype_t type) { + return gethrtime(); +} + + +/* + * We could use a static buffer for the path manipulations that we need outside + * of the function, but this function could be called by multiple consumers and + * we don't want to potentially create a race condition in the use of snprintf. + */ +int uv_exepath(char* buffer, size_t* size) { + ssize_t res; + char buf[128]; + + if (buffer == NULL || size == NULL || *size == 0) + return UV_EINVAL; + + snprintf(buf, sizeof(buf), "/proc/%lu/path/a.out", (unsigned long) getpid()); + + res = *size - 1; + if (res > 0) + res = readlink(buf, buffer, res); + + if (res == -1) + return UV__ERR(errno); + + buffer[res] = '\0'; + *size = res; + return 0; +} + + +uint64_t uv_get_free_memory(void) { + return (uint64_t) sysconf(_SC_PAGESIZE) * sysconf(_SC_AVPHYS_PAGES); +} + + +uint64_t uv_get_total_memory(void) { + return (uint64_t) sysconf(_SC_PAGESIZE) * sysconf(_SC_PHYS_PAGES); +} + + +void uv_loadavg(double avg[3]) { + (void) getloadavg(avg, 3); +} + + +#if defined(PORT_SOURCE_FILE) + +static int uv__fs_event_rearm(uv_fs_event_t *handle) { + if (handle->fd == -1) + return UV_EBADF; + + if (port_associate(handle->loop->fs_fd, + PORT_SOURCE_FILE, + (uintptr_t) &handle->fo, + FILE_ATTRIB | FILE_MODIFIED, + handle) == -1) { + return UV__ERR(errno); + } + handle->fd = PORT_LOADED; + + return 0; +} + + +static void uv__fs_event_read(uv_loop_t* loop, + uv__io_t* w, + unsigned int revents) { + uv_fs_event_t *handle = NULL; + timespec_t timeout; + port_event_t pe; + int events; + int r; + + (void) w; + (void) revents; + + do { + uint_t n = 1; + + /* + * Note that our use of port_getn() here (and not port_get()) is deliberate: + * there is a bug in event ports (Sun bug 6456558) whereby a zeroed timeout + * causes port_get() to return success instead of ETIME when there aren't + * actually any events (!); by using port_getn() in lieu of port_get(), + * we can at least workaround the bug by checking for zero returned events + * and treating it as we would ETIME. + */ + do { + memset(&timeout, 0, sizeof timeout); + r = port_getn(loop->fs_fd, &pe, 1, &n, &timeout); + } + while (r == -1 && errno == EINTR); + + if ((r == -1 && errno == ETIME) || n == 0) + break; + + handle = (uv_fs_event_t*) pe.portev_user; + assert((r == 0) && "unexpected port_get() error"); + + events = 0; + if (pe.portev_events & (FILE_ATTRIB | FILE_MODIFIED)) + events |= UV_CHANGE; + if (pe.portev_events & ~(FILE_ATTRIB | FILE_MODIFIED)) + events |= UV_RENAME; + assert(events != 0); + handle->fd = PORT_FIRED; + handle->cb(handle, NULL, events, 0); + + if (handle->fd != PORT_DELETED) { + r = uv__fs_event_rearm(handle); + if (r != 0) + handle->cb(handle, NULL, 0, r); + } + } + while (handle->fd != PORT_DELETED); +} + + +int uv_fs_event_init(uv_loop_t* loop, uv_fs_event_t* handle) { + uv__handle_init(loop, (uv_handle_t*)handle, UV_FS_EVENT); + return 0; +} + + +int uv_fs_event_start(uv_fs_event_t* handle, + uv_fs_event_cb cb, + const char* path, + unsigned int flags) { + int portfd; + int first_run; + int err; + + if (uv__is_active(handle)) + return UV_EINVAL; + + first_run = 0; + if (handle->loop->fs_fd == -1) { + portfd = port_create(); + if (portfd == -1) + return UV__ERR(errno); + handle->loop->fs_fd = portfd; + first_run = 1; + } + + uv__handle_start(handle); + handle->path = uv__strdup(path); + handle->fd = PORT_UNUSED; + handle->cb = cb; + + memset(&handle->fo, 0, sizeof handle->fo); + handle->fo.fo_name = handle->path; + err = uv__fs_event_rearm(handle); + if (err != 0) { + uv_fs_event_stop(handle); + return err; + } + + if (first_run) { + uv__io_init(&handle->loop->fs_event_watcher, uv__fs_event_read, portfd); + uv__io_start(handle->loop, &handle->loop->fs_event_watcher, POLLIN); + } + + return 0; +} + + +int uv_fs_event_stop(uv_fs_event_t* handle) { + if (!uv__is_active(handle)) + return 0; + + if (handle->fd == PORT_FIRED || handle->fd == PORT_LOADED) { + port_dissociate(handle->loop->fs_fd, + PORT_SOURCE_FILE, + (uintptr_t) &handle->fo); + } + + handle->fd = PORT_DELETED; + uv__free(handle->path); + handle->path = NULL; + handle->fo.fo_name = NULL; + uv__handle_stop(handle); + + return 0; +} + +void uv__fs_event_close(uv_fs_event_t* handle) { + uv_fs_event_stop(handle); +} + +#else /* !defined(PORT_SOURCE_FILE) */ + +int uv_fs_event_init(uv_loop_t* loop, uv_fs_event_t* handle) { + return UV_ENOSYS; +} + + +int uv_fs_event_start(uv_fs_event_t* handle, + uv_fs_event_cb cb, + const char* filename, + unsigned int flags) { + return UV_ENOSYS; +} + + +int uv_fs_event_stop(uv_fs_event_t* handle) { + return UV_ENOSYS; +} + + +void uv__fs_event_close(uv_fs_event_t* handle) { + UNREACHABLE(); +} + +#endif /* defined(PORT_SOURCE_FILE) */ + + +int uv_resident_set_memory(size_t* rss) { + psinfo_t psinfo; + int err; + int fd; + + fd = open("/proc/self/psinfo", O_RDONLY); + if (fd == -1) + return UV__ERR(errno); + + /* FIXME(bnoordhuis) Handle EINTR. */ + err = UV_EINVAL; + if (read(fd, &psinfo, sizeof(psinfo)) == sizeof(psinfo)) { + *rss = (size_t)psinfo.pr_rssize * 1024; + err = 0; + } + uv__close(fd); + + return err; +} + + +int uv_uptime(double* uptime) { + kstat_ctl_t *kc; + kstat_t *ksp; + kstat_named_t *knp; + + long hz = sysconf(_SC_CLK_TCK); + + kc = kstat_open(); + if (kc == NULL) + return UV_EPERM; + + ksp = kstat_lookup(kc, (char*) "unix", 0, (char*) "system_misc"); + if (kstat_read(kc, ksp, NULL) == -1) { + *uptime = -1; + } else { + knp = (kstat_named_t*) kstat_data_lookup(ksp, (char*) "clk_intr"); + *uptime = knp->value.ul / hz; + } + kstat_close(kc); + + return 0; +} + + +int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) { + int lookup_instance; + kstat_ctl_t *kc; + kstat_t *ksp; + kstat_named_t *knp; + uv_cpu_info_t* cpu_info; + + kc = kstat_open(); + if (kc == NULL) + return UV_EPERM; + + /* Get count of cpus */ + lookup_instance = 0; + while ((ksp = kstat_lookup(kc, (char*) "cpu_info", lookup_instance, NULL))) { + lookup_instance++; + } + + *cpu_infos = uv__malloc(lookup_instance * sizeof(**cpu_infos)); + if (!(*cpu_infos)) { + kstat_close(kc); + return UV_ENOMEM; + } + + *count = lookup_instance; + + cpu_info = *cpu_infos; + lookup_instance = 0; + while ((ksp = kstat_lookup(kc, (char*) "cpu_info", lookup_instance, NULL))) { + if (kstat_read(kc, ksp, NULL) == -1) { + cpu_info->speed = 0; + cpu_info->model = NULL; + } else { + knp = kstat_data_lookup(ksp, (char*) "clock_MHz"); + assert(knp->data_type == KSTAT_DATA_INT32 || + knp->data_type == KSTAT_DATA_INT64); + cpu_info->speed = (knp->data_type == KSTAT_DATA_INT32) ? knp->value.i32 + : knp->value.i64; + + knp = kstat_data_lookup(ksp, (char*) "brand"); + assert(knp->data_type == KSTAT_DATA_STRING); + cpu_info->model = uv__strdup(KSTAT_NAMED_STR_PTR(knp)); + } + + lookup_instance++; + cpu_info++; + } + + cpu_info = *cpu_infos; + lookup_instance = 0; + for (;;) { + ksp = kstat_lookup(kc, (char*) "cpu", lookup_instance, (char*) "sys"); + + if (ksp == NULL) + break; + + if (kstat_read(kc, ksp, NULL) == -1) { + cpu_info->cpu_times.user = 0; + cpu_info->cpu_times.nice = 0; + cpu_info->cpu_times.sys = 0; + cpu_info->cpu_times.idle = 0; + cpu_info->cpu_times.irq = 0; + } else { + knp = kstat_data_lookup(ksp, (char*) "cpu_ticks_user"); + assert(knp->data_type == KSTAT_DATA_UINT64); + cpu_info->cpu_times.user = knp->value.ui64; + + knp = kstat_data_lookup(ksp, (char*) "cpu_ticks_kernel"); + assert(knp->data_type == KSTAT_DATA_UINT64); + cpu_info->cpu_times.sys = knp->value.ui64; + + knp = kstat_data_lookup(ksp, (char*) "cpu_ticks_idle"); + assert(knp->data_type == KSTAT_DATA_UINT64); + cpu_info->cpu_times.idle = knp->value.ui64; + + knp = kstat_data_lookup(ksp, (char*) "intr"); + assert(knp->data_type == KSTAT_DATA_UINT64); + cpu_info->cpu_times.irq = knp->value.ui64; + cpu_info->cpu_times.nice = 0; + } + + lookup_instance++; + cpu_info++; + } + + kstat_close(kc); + + return 0; +} + + +void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count) { + int i; + + for (i = 0; i < count; i++) { + uv__free(cpu_infos[i].model); + } + + uv__free(cpu_infos); +} + +#ifdef SUNOS_NO_IFADDRS +int uv_interface_addresses(uv_interface_address_t** addresses, int* count) { ++ *count = 0; ++ *addresses = NULL; + return UV_ENOSYS; +} +#else /* SUNOS_NO_IFADDRS */ +/* + * Inspired By: + * https://blogs.oracle.com/paulie/entry/retrieving_mac_address_in_solaris + * http://www.pauliesworld.org/project/getmac.c + */ +static int uv__set_phys_addr(uv_interface_address_t* address, + struct ifaddrs* ent) { + + struct sockaddr_dl* sa_addr; + int sockfd; - int i; ++ size_t i; + struct arpreq arpreq; + + /* This appears to only work as root */ + sa_addr = (struct sockaddr_dl*)(ent->ifa_addr); + memcpy(address->phys_addr, LLADDR(sa_addr), sizeof(address->phys_addr)); + for (i = 0; i < sizeof(address->phys_addr); i++) { ++ /* Check that all bytes of phys_addr are zero. */ + if (address->phys_addr[i] != 0) + return 0; + } + memset(&arpreq, 0, sizeof(arpreq)); + if (address->address.address4.sin_family == AF_INET) { + struct sockaddr_in* sin = ((struct sockaddr_in*)&arpreq.arp_pa); + sin->sin_addr.s_addr = address->address.address4.sin_addr.s_addr; + } else if (address->address.address4.sin_family == AF_INET6) { + struct sockaddr_in6* sin = ((struct sockaddr_in6*)&arpreq.arp_pa); + memcpy(sin->sin6_addr.s6_addr, + address->address.address6.sin6_addr.s6_addr, + sizeof(address->address.address6.sin6_addr.s6_addr)); + } else { + return 0; + } + + sockfd = socket(AF_INET, SOCK_DGRAM, 0); + if (sockfd < 0) + return UV__ERR(errno); + + if (ioctl(sockfd, SIOCGARP, (char*)&arpreq) == -1) { + uv__close(sockfd); + return UV__ERR(errno); + } + memcpy(address->phys_addr, arpreq.arp_ha.sa_data, sizeof(address->phys_addr)); + uv__close(sockfd); + return 0; +} + + +static int uv__ifaddr_exclude(struct ifaddrs *ent) { + if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING))) + return 1; + if (ent->ifa_addr == NULL) + return 1; + if (ent->ifa_addr->sa_family != AF_INET && + ent->ifa_addr->sa_family != AF_INET6) + return 1; + return 0; +} + +int uv_interface_addresses(uv_interface_address_t** addresses, int* count) { + uv_interface_address_t* address; + struct ifaddrs* addrs; + struct ifaddrs* ent; + ++ *count = 0; ++ *addresses = NULL; ++ + if (getifaddrs(&addrs)) + return UV__ERR(errno); + - *count = 0; - + /* Count the number of interfaces */ + for (ent = addrs; ent != NULL; ent = ent->ifa_next) { + if (uv__ifaddr_exclude(ent)) + continue; + (*count)++; + } + ++ if (*count == 0) { ++ freeifaddrs(addrs); ++ return 0; ++ } ++ + *addresses = uv__malloc(*count * sizeof(**addresses)); + if (!(*addresses)) { + freeifaddrs(addrs); + return UV_ENOMEM; + } + + address = *addresses; + + for (ent = addrs; ent != NULL; ent = ent->ifa_next) { + if (uv__ifaddr_exclude(ent)) + continue; + + address->name = uv__strdup(ent->ifa_name); + + if (ent->ifa_addr->sa_family == AF_INET6) { + address->address.address6 = *((struct sockaddr_in6*) ent->ifa_addr); + } else { + address->address.address4 = *((struct sockaddr_in*) ent->ifa_addr); + } + + if (ent->ifa_netmask->sa_family == AF_INET6) { + address->netmask.netmask6 = *((struct sockaddr_in6*) ent->ifa_netmask); + } else { + address->netmask.netmask4 = *((struct sockaddr_in*) ent->ifa_netmask); + } + + address->is_internal = !!((ent->ifa_flags & IFF_PRIVATE) || + (ent->ifa_flags & IFF_LOOPBACK)); + + uv__set_phys_addr(address, ent); + address++; + } + + freeifaddrs(addrs); + + return 0; +} +#endif /* SUNOS_NO_IFADDRS */ + +void uv_free_interface_addresses(uv_interface_address_t* addresses, + int count) { + int i; + + for (i = 0; i < count; i++) { + uv__free(addresses[i].name); + } + + uv__free(addresses); +} diff --cc Utilities/cmlibuv/src/unix/tty.c index e8ea302,0000000..b8bc283 mode 100644,000000..100644 --- a/Utilities/cmlibuv/src/unix/tty.c +++ b/Utilities/cmlibuv/src/unix/tty.c @@@ -1,369 -1,0 +1,364 @@@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "internal.h" +#include "spinlock.h" + +#include +#include +#include +#include +#include +#include + +#if defined(__MVS__) && !defined(IMAXBEL) +#define IMAXBEL 0 +#endif + +static int orig_termios_fd = -1; +static struct termios orig_termios; +static uv_spinlock_t termios_spinlock = UV_SPINLOCK_INITIALIZER; + +static int uv__tty_is_slave(const int fd) { + int result; +#if defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) + int dummy; + + result = ioctl(fd, TIOCGPTN, &dummy) != 0; +#elif defined(__APPLE__) + char dummy[256]; + + result = ioctl(fd, TIOCPTYGNAME, &dummy) != 0; +#elif defined(__NetBSD__) + /* + * NetBSD as an extension returns with ptsname(3) and ptsname_r(3) the slave + * device name for both descriptors, the master one and slave one. + * + * Implement function to compare major device number with pts devices. + * + * The major numbers are machine-dependent, on NetBSD/amd64 they are + * respectively: + * - master tty: ptc - major 6 + * - slave tty: pts - major 5 + */ + + struct stat sb; + /* Lookup device's major for the pts driver and cache it. */ + static devmajor_t pts = NODEVMAJOR; + + if (pts == NODEVMAJOR) { + pts = getdevmajor("pts", S_IFCHR); + if (pts == NODEVMAJOR) + abort(); + } + + /* Lookup stat structure behind the file descriptor. */ + if (fstat(fd, &sb) != 0) + abort(); + + /* Assert character device. */ + if (!S_ISCHR(sb.st_mode)) + abort(); + + /* Assert valid major. */ + if (major(sb.st_rdev) == NODEVMAJOR) + abort(); + + result = (pts == major(sb.st_rdev)); +#else + /* Fallback to ptsname + */ + result = ptsname(fd) == NULL; +#endif + return result; +} + - int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, int fd, int readable) { ++int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, int fd, int unused) { + uv_handle_type type; + int flags = 0; + int newfd = -1; + int r; + int saved_flags; ++ int mode; + char path[256]; ++ (void)unused; /* deprecated parameter is no longer needed */ + + /* File descriptors that refer to files cannot be monitored with epoll. + * That restriction also applies to character devices like /dev/random + * (but obviously not /dev/tty.) + */ + type = uv_guess_handle(fd); + if (type == UV_FILE || type == UV_UNKNOWN_HANDLE) + return UV_EINVAL; + ++ /* Save the fd flags in case we need to restore them due to an error. */ ++ do ++ saved_flags = fcntl(fd, F_GETFL); ++ while (saved_flags == -1 && errno == EINTR); ++ ++ if (saved_flags == -1) ++ return UV__ERR(errno); ++ mode = saved_flags & O_ACCMODE; ++ + /* Reopen the file descriptor when it refers to a tty. This lets us put the + * tty in non-blocking mode without affecting other processes that share it + * with us. + * + * Example: `node | cat` - if we put our fd 0 in non-blocking mode, it also + * affects fd 1 of `cat` because both file descriptors refer to the same + * struct file in the kernel. When we reopen our fd 0, it points to a + * different struct file, hence changing its properties doesn't affect + * other processes. + */ + if (type == UV_TTY) { + /* Reopening a pty in master mode won't work either because the reopened + * pty will be in slave mode (*BSD) or reopening will allocate a new + * master/slave pair (Linux). Therefore check if the fd points to a + * slave device. + */ + if (uv__tty_is_slave(fd) && ttyname_r(fd, path, sizeof(path)) == 0) - r = uv__open_cloexec(path, O_RDWR); ++ r = uv__open_cloexec(path, mode); + else + r = -1; + + if (r < 0) { + /* fallback to using blocking writes */ - if (!readable) - flags |= UV_STREAM_BLOCKING; ++ if (mode != O_RDONLY) ++ flags |= UV_HANDLE_BLOCKING_WRITES; + goto skip; + } + + newfd = r; + + r = uv__dup2_cloexec(newfd, fd); + if (r < 0 && r != UV_EINVAL) { + /* EINVAL means newfd == fd which could conceivably happen if another + * thread called close(fd) between our calls to isatty() and open(). + * That's a rather unlikely event but let's handle it anyway. + */ + uv__close(newfd); + return r; + } + + fd = newfd; + } + - #if defined(__APPLE__) - /* Save the fd flags in case we need to restore them due to an error. */ - do - saved_flags = fcntl(fd, F_GETFL); - while (saved_flags == -1 && errno == EINTR); - - if (saved_flags == -1) { - if (newfd != -1) - uv__close(newfd); - return UV__ERR(errno); - } - #endif - - /* Pacify the compiler. */ - (void) &saved_flags; - +skip: + uv__stream_init(loop, (uv_stream_t*) tty, UV_TTY); + + /* If anything fails beyond this point we need to remove the handle from + * the handle queue, since it was added by uv__handle_init in uv_stream_init. + */ + - if (!(flags & UV_STREAM_BLOCKING)) ++ if (!(flags & UV_HANDLE_BLOCKING_WRITES)) + uv__nonblock(fd, 1); + +#if defined(__APPLE__) + r = uv__stream_try_select((uv_stream_t*) tty, &fd); + if (r) { + int rc = r; + if (newfd != -1) + uv__close(newfd); + QUEUE_REMOVE(&tty->handle_queue); + do + r = fcntl(fd, F_SETFL, saved_flags); + while (r == -1 && errno == EINTR); + return rc; + } +#endif + - if (readable) - flags |= UV_STREAM_READABLE; - else - flags |= UV_STREAM_WRITABLE; ++ if (mode != O_WRONLY) ++ flags |= UV_HANDLE_READABLE; ++ if (mode != O_RDONLY) ++ flags |= UV_HANDLE_WRITABLE; + + uv__stream_open((uv_stream_t*) tty, fd, flags); + tty->mode = UV_TTY_MODE_NORMAL; + + return 0; +} + +static void uv__tty_make_raw(struct termios* tio) { + assert(tio != NULL); + +#if defined __sun || defined __MVS__ + /* + * This implementation of cfmakeraw for Solaris and derivatives is taken from + * http://www.perkin.org.uk/posts/solaris-portability-cfmakeraw.html. + */ + tio->c_iflag &= ~(IMAXBEL | IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | + IGNCR | ICRNL | IXON); + tio->c_oflag &= ~OPOST; + tio->c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN); + tio->c_cflag &= ~(CSIZE | PARENB); + tio->c_cflag |= CS8; +#else + cfmakeraw(tio); +#endif /* #ifdef __sun */ +} + +int uv_tty_set_mode(uv_tty_t* tty, uv_tty_mode_t mode) { + struct termios tmp; + int fd; + + if (tty->mode == (int) mode) + return 0; + + fd = uv__stream_fd(tty); + if (tty->mode == UV_TTY_MODE_NORMAL && mode != UV_TTY_MODE_NORMAL) { + if (tcgetattr(fd, &tty->orig_termios)) + return UV__ERR(errno); + + /* This is used for uv_tty_reset_mode() */ + uv_spinlock_lock(&termios_spinlock); + if (orig_termios_fd == -1) { + orig_termios = tty->orig_termios; + orig_termios_fd = fd; + } + uv_spinlock_unlock(&termios_spinlock); + } + + tmp = tty->orig_termios; + switch (mode) { + case UV_TTY_MODE_NORMAL: + break; + case UV_TTY_MODE_RAW: + tmp.c_iflag &= ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON); + tmp.c_oflag |= (ONLCR); + tmp.c_cflag |= (CS8); + tmp.c_lflag &= ~(ECHO | ICANON | IEXTEN | ISIG); + tmp.c_cc[VMIN] = 1; + tmp.c_cc[VTIME] = 0; + break; + case UV_TTY_MODE_IO: + uv__tty_make_raw(&tmp); + break; + } + + /* Apply changes after draining */ + if (tcsetattr(fd, TCSADRAIN, &tmp)) + return UV__ERR(errno); + + tty->mode = mode; + return 0; +} + + +int uv_tty_get_winsize(uv_tty_t* tty, int* width, int* height) { + struct winsize ws; + int err; + + do + err = ioctl(uv__stream_fd(tty), TIOCGWINSZ, &ws); + while (err == -1 && errno == EINTR); + + if (err == -1) + return UV__ERR(errno); + + *width = ws.ws_col; + *height = ws.ws_row; + + return 0; +} + + +uv_handle_type uv_guess_handle(uv_file file) { + struct sockaddr sa; + struct stat s; + socklen_t len; + int type; + + if (file < 0) + return UV_UNKNOWN_HANDLE; + + if (isatty(file)) + return UV_TTY; + + if (fstat(file, &s)) + return UV_UNKNOWN_HANDLE; + + if (S_ISREG(s.st_mode)) + return UV_FILE; + + if (S_ISCHR(s.st_mode)) + return UV_FILE; /* XXX UV_NAMED_PIPE? */ + + if (S_ISFIFO(s.st_mode)) + return UV_NAMED_PIPE; + + if (!S_ISSOCK(s.st_mode)) + return UV_UNKNOWN_HANDLE; + + len = sizeof(type); + if (getsockopt(file, SOL_SOCKET, SO_TYPE, &type, &len)) + return UV_UNKNOWN_HANDLE; + + len = sizeof(sa); + if (getsockname(file, &sa, &len)) + return UV_UNKNOWN_HANDLE; + + if (type == SOCK_DGRAM) + if (sa.sa_family == AF_INET || sa.sa_family == AF_INET6) + return UV_UDP; + + if (type == SOCK_STREAM) { +#if defined(_AIX) || defined(__DragonFly__) + /* on AIX/DragonFly the getsockname call returns an empty sa structure + * for sockets of type AF_UNIX. For all other types it will + * return a properly filled in structure. + */ + if (len == 0) + return UV_NAMED_PIPE; +#endif /* defined(_AIX) || defined(__DragonFly__) */ + + if (sa.sa_family == AF_INET || sa.sa_family == AF_INET6) + return UV_TCP; + if (sa.sa_family == AF_UNIX) + return UV_NAMED_PIPE; + } + + return UV_UNKNOWN_HANDLE; +} + + +/* This function is async signal-safe, meaning that it's safe to call from + * inside a signal handler _unless_ execution was inside uv_tty_set_mode()'s + * critical section when the signal was raised. + */ +int uv_tty_reset_mode(void) { + int saved_errno; + int err; + + saved_errno = errno; + if (!uv_spinlock_trylock(&termios_spinlock)) + return UV_EBUSY; /* In uv_tty_set_mode(). */ + + err = 0; + if (orig_termios_fd != -1) + if (tcsetattr(orig_termios_fd, TCSANOW, &orig_termios)) + err = UV__ERR(errno); + + uv_spinlock_unlock(&termios_spinlock); + errno = saved_errno; + + return err; +} diff --cc Utilities/cmlibuv/src/uv-common.c index 15dec08,0000000..907ebf2 mode 100644,000000..100644 --- a/Utilities/cmlibuv/src/uv-common.c +++ b/Utilities/cmlibuv/src/uv-common.c @@@ -1,666 -1,0 +1,696 @@@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "uv-common.h" + +#include +#include +#include +#include /* NULL */ +#include +#include /* malloc */ +#include /* memset */ + +#if defined(_WIN32) +# include /* malloc */ +#else +# include /* if_nametoindex */ +#endif + + +typedef struct { + uv_malloc_func local_malloc; + uv_realloc_func local_realloc; + uv_calloc_func local_calloc; + uv_free_func local_free; +} uv__allocator_t; + +static uv__allocator_t uv__allocator = { + malloc, + realloc, + calloc, + free, +}; + +char* uv__strdup(const char* s) { + size_t len = strlen(s) + 1; + char* m = uv__malloc(len); + if (m == NULL) + return NULL; + return memcpy(m, s, len); +} + +char* uv__strndup(const char* s, size_t n) { + char* m; + size_t len = strlen(s); + if (n < len) + len = n; + m = uv__malloc(len + 1); + if (m == NULL) + return NULL; + m[len] = '\0'; + return memcpy(m, s, len); +} + +void* uv__malloc(size_t size) { - return uv__allocator.local_malloc(size); ++ if (size > 0) ++ return uv__allocator.local_malloc(size); ++ return NULL; +} + +void uv__free(void* ptr) { + int saved_errno; + + /* Libuv expects that free() does not clobber errno. The system allocator + * honors that assumption but custom allocators may not be so careful. + */ + saved_errno = errno; + uv__allocator.local_free(ptr); + errno = saved_errno; +} + +void* uv__calloc(size_t count, size_t size) { + return uv__allocator.local_calloc(count, size); +} + +void* uv__realloc(void* ptr, size_t size) { - return uv__allocator.local_realloc(ptr, size); ++ if (size > 0) ++ return uv__allocator.local_realloc(ptr, size); ++ uv__free(ptr); ++ return NULL; +} + +int uv_replace_allocator(uv_malloc_func malloc_func, + uv_realloc_func realloc_func, + uv_calloc_func calloc_func, + uv_free_func free_func) { + if (malloc_func == NULL || realloc_func == NULL || + calloc_func == NULL || free_func == NULL) { + return UV_EINVAL; + } + + uv__allocator.local_malloc = malloc_func; + uv__allocator.local_realloc = realloc_func; + uv__allocator.local_calloc = calloc_func; + uv__allocator.local_free = free_func; + + return 0; +} + +#define XX(uc, lc) case UV_##uc: return sizeof(uv_##lc##_t); + +size_t uv_handle_size(uv_handle_type type) { + switch (type) { + UV_HANDLE_TYPE_MAP(XX) + default: + return -1; + } +} + +size_t uv_req_size(uv_req_type type) { + switch(type) { + UV_REQ_TYPE_MAP(XX) + default: + return -1; + } +} + +#undef XX + + +size_t uv_loop_size(void) { + return sizeof(uv_loop_t); +} + + +uv_buf_t uv_buf_init(char* base, unsigned int len) { + uv_buf_t buf; + buf.base = base; + buf.len = len; + return buf; +} + + +static const char* uv__unknown_err_code(int err) { + char buf[32]; + char* copy; + + snprintf(buf, sizeof(buf), "Unknown system error %d", err); + copy = uv__strdup(buf); + + return copy != NULL ? copy : "Unknown system error"; +} + ++#define UV_ERR_NAME_GEN_R(name, _) \ ++case UV_## name: \ ++ uv__strscpy(buf, #name, buflen); break; ++char* uv_err_name_r(int err, char* buf, size_t buflen) { ++ switch (err) { ++ UV_ERRNO_MAP(UV_ERR_NAME_GEN_R) ++ default: snprintf(buf, buflen, "Unknown system error %d", err); ++ } ++ return buf; ++} ++#undef UV_ERR_NAME_GEN_R ++ + +#define UV_ERR_NAME_GEN(name, _) case UV_ ## name: return #name; +const char* uv_err_name(int err) { + switch (err) { + UV_ERRNO_MAP(UV_ERR_NAME_GEN) + } + return uv__unknown_err_code(err); +} +#undef UV_ERR_NAME_GEN + + ++#define UV_STRERROR_GEN_R(name, msg) \ ++case UV_ ## name: \ ++ snprintf(buf, buflen, "%s", msg); break; ++char* uv_strerror_r(int err, char* buf, size_t buflen) { ++ switch (err) { ++ UV_ERRNO_MAP(UV_STRERROR_GEN_R) ++ default: snprintf(buf, buflen, "Unknown system error %d", err); ++ } ++ return buf; ++} ++#undef UV_STRERROR_GEN_R ++ ++ +#define UV_STRERROR_GEN(name, msg) case UV_ ## name: return msg; +const char* uv_strerror(int err) { + switch (err) { + UV_ERRNO_MAP(UV_STRERROR_GEN) + } + return uv__unknown_err_code(err); +} +#undef UV_STRERROR_GEN + +#if !defined(CMAKE_BOOTSTRAP) || defined(_WIN32) + +int uv_ip4_addr(const char* ip, int port, struct sockaddr_in* addr) { + memset(addr, 0, sizeof(*addr)); + addr->sin_family = AF_INET; + addr->sin_port = htons(port); + return uv_inet_pton(AF_INET, ip, &(addr->sin_addr.s_addr)); +} + + +int uv_ip6_addr(const char* ip, int port, struct sockaddr_in6* addr) { + char address_part[40]; + size_t address_part_size; + const char* zone_index; + + memset(addr, 0, sizeof(*addr)); + addr->sin6_family = AF_INET6; + addr->sin6_port = htons(port); + + zone_index = strchr(ip, '%'); + if (zone_index != NULL) { + address_part_size = zone_index - ip; + if (address_part_size >= sizeof(address_part)) + address_part_size = sizeof(address_part) - 1; + + memcpy(address_part, ip, address_part_size); + address_part[address_part_size] = '\0'; + ip = address_part; + + zone_index++; /* skip '%' */ + /* NOTE: unknown interface (id=0) is silently ignored */ +#ifdef _WIN32 + addr->sin6_scope_id = atoi(zone_index); +#else + addr->sin6_scope_id = if_nametoindex(zone_index); +#endif + } + + return uv_inet_pton(AF_INET6, ip, &addr->sin6_addr); +} + + +int uv_ip4_name(const struct sockaddr_in* src, char* dst, size_t size) { + return uv_inet_ntop(AF_INET, &src->sin_addr, dst, size); +} + + +int uv_ip6_name(const struct sockaddr_in6* src, char* dst, size_t size) { + return uv_inet_ntop(AF_INET6, &src->sin6_addr, dst, size); +} + + +int uv_tcp_bind(uv_tcp_t* handle, + const struct sockaddr* addr, + unsigned int flags) { + unsigned int addrlen; + + if (handle->type != UV_TCP) + return UV_EINVAL; + + if (addr->sa_family == AF_INET) + addrlen = sizeof(struct sockaddr_in); + else if (addr->sa_family == AF_INET6) + addrlen = sizeof(struct sockaddr_in6); + else + return UV_EINVAL; + + return uv__tcp_bind(handle, addr, addrlen, flags); +} + + +int uv_udp_bind(uv_udp_t* handle, + const struct sockaddr* addr, + unsigned int flags) { + unsigned int addrlen; + + if (handle->type != UV_UDP) + return UV_EINVAL; + + if (addr->sa_family == AF_INET) + addrlen = sizeof(struct sockaddr_in); + else if (addr->sa_family == AF_INET6) + addrlen = sizeof(struct sockaddr_in6); + else + return UV_EINVAL; + + return uv__udp_bind(handle, addr, addrlen, flags); +} + + +int uv_tcp_connect(uv_connect_t* req, + uv_tcp_t* handle, + const struct sockaddr* addr, + uv_connect_cb cb) { + unsigned int addrlen; + + if (handle->type != UV_TCP) + return UV_EINVAL; + + if (addr->sa_family == AF_INET) + addrlen = sizeof(struct sockaddr_in); + else if (addr->sa_family == AF_INET6) + addrlen = sizeof(struct sockaddr_in6); + else + return UV_EINVAL; + + return uv__tcp_connect(req, handle, addr, addrlen, cb); +} + + +int uv_udp_send(uv_udp_send_t* req, + uv_udp_t* handle, + const uv_buf_t bufs[], + unsigned int nbufs, + const struct sockaddr* addr, + uv_udp_send_cb send_cb) { + unsigned int addrlen; + + if (handle->type != UV_UDP) + return UV_EINVAL; + + if (addr->sa_family == AF_INET) + addrlen = sizeof(struct sockaddr_in); + else if (addr->sa_family == AF_INET6) + addrlen = sizeof(struct sockaddr_in6); + else + return UV_EINVAL; + + return uv__udp_send(req, handle, bufs, nbufs, addr, addrlen, send_cb); +} + + +int uv_udp_try_send(uv_udp_t* handle, + const uv_buf_t bufs[], + unsigned int nbufs, + const struct sockaddr* addr) { + unsigned int addrlen; + + if (handle->type != UV_UDP) + return UV_EINVAL; + + if (addr->sa_family == AF_INET) + addrlen = sizeof(struct sockaddr_in); + else if (addr->sa_family == AF_INET6) + addrlen = sizeof(struct sockaddr_in6); + else + return UV_EINVAL; + + return uv__udp_try_send(handle, bufs, nbufs, addr, addrlen); +} + + +int uv_udp_recv_start(uv_udp_t* handle, + uv_alloc_cb alloc_cb, + uv_udp_recv_cb recv_cb) { + if (handle->type != UV_UDP || alloc_cb == NULL || recv_cb == NULL) + return UV_EINVAL; + else + return uv__udp_recv_start(handle, alloc_cb, recv_cb); +} + + +int uv_udp_recv_stop(uv_udp_t* handle) { + if (handle->type != UV_UDP) + return UV_EINVAL; + else + return uv__udp_recv_stop(handle); +} + +#endif + +void uv_walk(uv_loop_t* loop, uv_walk_cb walk_cb, void* arg) { + QUEUE queue; + QUEUE* q; + uv_handle_t* h; + + QUEUE_MOVE(&loop->handle_queue, &queue); + while (!QUEUE_EMPTY(&queue)) { + q = QUEUE_HEAD(&queue); + h = QUEUE_DATA(q, uv_handle_t, handle_queue); + + QUEUE_REMOVE(q); + QUEUE_INSERT_TAIL(&loop->handle_queue, q); + - if (h->flags & UV__HANDLE_INTERNAL) continue; ++ if (h->flags & UV_HANDLE_INTERNAL) continue; + walk_cb(h, arg); + } +} + + +static void uv__print_handles(uv_loop_t* loop, int only_active, FILE* stream) { + const char* type; + QUEUE* q; + uv_handle_t* h; + + if (loop == NULL) + loop = uv_default_loop(); + + QUEUE_FOREACH(q, &loop->handle_queue) { + h = QUEUE_DATA(q, uv_handle_t, handle_queue); + + if (only_active && !uv__is_active(h)) + continue; + + switch (h->type) { +#define X(uc, lc) case UV_##uc: type = #lc; break; + UV_HANDLE_TYPE_MAP(X) +#undef X + default: type = ""; + } + + fprintf(stream, + "[%c%c%c] %-8s %p\n", - "R-"[!(h->flags & UV__HANDLE_REF)], - "A-"[!(h->flags & UV__HANDLE_ACTIVE)], - "I-"[!(h->flags & UV__HANDLE_INTERNAL)], ++ "R-"[!(h->flags & UV_HANDLE_REF)], ++ "A-"[!(h->flags & UV_HANDLE_ACTIVE)], ++ "I-"[!(h->flags & UV_HANDLE_INTERNAL)], + type, + (void*)h); + } +} + + +void uv_print_all_handles(uv_loop_t* loop, FILE* stream) { + uv__print_handles(loop, 0, stream); +} + + +void uv_print_active_handles(uv_loop_t* loop, FILE* stream) { + uv__print_handles(loop, 1, stream); +} + + +void uv_ref(uv_handle_t* handle) { + uv__handle_ref(handle); +} + + +void uv_unref(uv_handle_t* handle) { + uv__handle_unref(handle); +} + + +int uv_has_ref(const uv_handle_t* handle) { + return uv__has_ref(handle); +} + + +void uv_stop(uv_loop_t* loop) { + loop->stop_flag = 1; +} + + +uint64_t uv_now(const uv_loop_t* loop) { + return loop->time; +} + + + +size_t uv__count_bufs(const uv_buf_t bufs[], unsigned int nbufs) { + unsigned int i; + size_t bytes; + + bytes = 0; + for (i = 0; i < nbufs; i++) + bytes += (size_t) bufs[i].len; + + return bytes; +} + +int uv_recv_buffer_size(uv_handle_t* handle, int* value) { + return uv__socket_sockopt(handle, SO_RCVBUF, value); +} + +int uv_send_buffer_size(uv_handle_t* handle, int *value) { + return uv__socket_sockopt(handle, SO_SNDBUF, value); +} + +int uv_fs_event_getpath(uv_fs_event_t* handle, char* buffer, size_t* size) { + size_t required_len; + + if (!uv__is_active(handle)) { + *size = 0; + return UV_EINVAL; + } + + required_len = strlen(handle->path); + if (required_len >= *size) { + *size = required_len + 1; + return UV_ENOBUFS; + } + + memcpy(buffer, handle->path, required_len); + *size = required_len; + buffer[required_len] = '\0'; + + return 0; +} + +/* The windows implementation does not have the same structure layout as + * the unix implementation (nbufs is not directly inside req but is + * contained in a nested union/struct) so this function locates it. +*/ +static unsigned int* uv__get_nbufs(uv_fs_t* req) { +#ifdef _WIN32 + return &req->fs.info.nbufs; +#else + return &req->nbufs; +#endif +} + +/* uv_fs_scandir() uses the system allocator to allocate memory on non-Windows + * systems. So, the memory should be released using free(). On Windows, + * uv__malloc() is used, so use uv__free() to free memory. +*/ +#ifdef _WIN32 +# define uv__fs_scandir_free uv__free +#else +# define uv__fs_scandir_free free +#endif + +void uv__fs_scandir_cleanup(uv_fs_t* req) { + uv__dirent_t** dents; + + unsigned int* nbufs = uv__get_nbufs(req); + + dents = req->ptr; + if (*nbufs > 0 && *nbufs != (unsigned int) req->result) + (*nbufs)--; + for (; *nbufs < (unsigned int) req->result; (*nbufs)++) + uv__fs_scandir_free(dents[*nbufs]); + + uv__fs_scandir_free(req->ptr); + req->ptr = NULL; +} + + +int uv_fs_scandir_next(uv_fs_t* req, uv_dirent_t* ent) { + uv__dirent_t** dents; + uv__dirent_t* dent; + unsigned int* nbufs; + + /* Check to see if req passed */ + if (req->result < 0) + return req->result; + + /* Ptr will be null if req was canceled or no files found */ + if (!req->ptr) + return UV_EOF; + + nbufs = uv__get_nbufs(req); + assert(nbufs); + + dents = req->ptr; + + /* Free previous entity */ + if (*nbufs > 0) + uv__fs_scandir_free(dents[*nbufs - 1]); + + /* End was already reached */ + if (*nbufs == (unsigned int) req->result) { + uv__fs_scandir_free(dents); + req->ptr = NULL; + return UV_EOF; + } + + dent = dents[(*nbufs)++]; + + ent->name = dent->d_name; +#ifdef HAVE_DIRENT_TYPES + switch (dent->d_type) { + case UV__DT_DIR: + ent->type = UV_DIRENT_DIR; + break; + case UV__DT_FILE: + ent->type = UV_DIRENT_FILE; + break; + case UV__DT_LINK: + ent->type = UV_DIRENT_LINK; + break; + case UV__DT_FIFO: + ent->type = UV_DIRENT_FIFO; + break; + case UV__DT_SOCKET: + ent->type = UV_DIRENT_SOCKET; + break; + case UV__DT_CHAR: + ent->type = UV_DIRENT_CHAR; + break; + case UV__DT_BLOCK: + ent->type = UV_DIRENT_BLOCK; + break; + default: + ent->type = UV_DIRENT_UNKNOWN; + } +#else + ent->type = UV_DIRENT_UNKNOWN; +#endif + + return 0; +} + + +int uv_loop_configure(uv_loop_t* loop, uv_loop_option option, ...) { + va_list ap; + int err; + + va_start(ap, option); + /* Any platform-agnostic options should be handled here. */ + err = uv__loop_configure(loop, option, ap); + va_end(ap); + + return err; +} + + +static uv_loop_t default_loop_struct; +static uv_loop_t* default_loop_ptr; + + +uv_loop_t* uv_default_loop(void) { + if (default_loop_ptr != NULL) + return default_loop_ptr; + + if (uv_loop_init(&default_loop_struct)) + return NULL; + + default_loop_ptr = &default_loop_struct; + return default_loop_ptr; +} + + +uv_loop_t* uv_loop_new(void) { + uv_loop_t* loop; + + loop = uv__malloc(sizeof(*loop)); + if (loop == NULL) + return NULL; + + if (uv_loop_init(loop)) { + uv__free(loop); + return NULL; + } + + return loop; +} + + +int uv_loop_close(uv_loop_t* loop) { + QUEUE* q; + uv_handle_t* h; +#ifndef NDEBUG + void* saved_data; +#endif + + if (uv__has_active_reqs(loop)) + return UV_EBUSY; + + QUEUE_FOREACH(q, &loop->handle_queue) { + h = QUEUE_DATA(q, uv_handle_t, handle_queue); - if (!(h->flags & UV__HANDLE_INTERNAL)) ++ if (!(h->flags & UV_HANDLE_INTERNAL)) + return UV_EBUSY; + } + + uv__loop_close(loop); + +#ifndef NDEBUG + saved_data = loop->data; + memset(loop, -1, sizeof(*loop)); + loop->data = saved_data; +#endif + if (loop == default_loop_ptr) + default_loop_ptr = NULL; + + return 0; +} + + +void uv_loop_delete(uv_loop_t* loop) { + uv_loop_t* default_loop; + int err; + + default_loop = default_loop_ptr; + + err = uv_loop_close(loop); + (void) err; /* Squelch compiler warnings. */ + assert(err == 0); + if (loop != default_loop) + uv__free(loop); +} diff --cc Utilities/cmlibuv/src/win/core.c index b8aad11,0000000..58309c6 mode 100644,000000..100644 --- a/Utilities/cmlibuv/src/win/core.c +++ b/Utilities/cmlibuv/src/win/core.c @@@ -1,609 -1,0 +1,629 @@@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include +#include +#include +#include +#include +#include +#if defined(_MSC_VER) || defined(__MINGW64_VERSION_MAJOR) +#include +#endif + +#include "uv.h" +#include "internal.h" +#include "queue.h" +#include "handle-inl.h" ++#include "heap-inl.h" +#include "req-inl.h" + +/* uv_once initialization guards */ +static uv_once_t uv_init_guard_ = UV_ONCE_INIT; + + +#if defined(_DEBUG) && (defined(_MSC_VER) || defined(__MINGW64_VERSION_MAJOR)) +/* Our crt debug report handler allows us to temporarily disable asserts + * just for the current thread. + */ + +UV_THREAD_LOCAL int uv__crt_assert_enabled = TRUE; + +static int uv__crt_dbg_report_handler(int report_type, char *message, int *ret_val) { + if (uv__crt_assert_enabled || report_type != _CRT_ASSERT) + return FALSE; + + if (ret_val) { + /* Set ret_val to 0 to continue with normal execution. + * Set ret_val to 1 to trigger a breakpoint. + */ + + if(IsDebuggerPresent()) + *ret_val = 1; + else + *ret_val = 0; + } + + /* Don't call _CrtDbgReport. */ + return TRUE; +} +#else +UV_THREAD_LOCAL int uv__crt_assert_enabled = FALSE; +#endif + + +#if !defined(__MINGW32__) || __MSVCRT_VERSION__ >= 0x800 +static void uv__crt_invalid_parameter_handler(const wchar_t* expression, + const wchar_t* function, const wchar_t * file, unsigned int line, + uintptr_t reserved) { + /* No-op. */ +} +#endif + +static uv_loop_t** uv__loops; +static int uv__loops_size; +static int uv__loops_capacity; +#define UV__LOOPS_CHUNK_SIZE 8 +static uv_mutex_t uv__loops_lock; + +static void uv__loops_init(void) { + uv_mutex_init(&uv__loops_lock); +} + +static int uv__loops_add(uv_loop_t* loop) { + uv_loop_t** new_loops; + int new_capacity, i; + + uv_mutex_lock(&uv__loops_lock); + + if (uv__loops_size == uv__loops_capacity) { + new_capacity = uv__loops_capacity + UV__LOOPS_CHUNK_SIZE; + new_loops = uv__realloc(uv__loops, sizeof(uv_loop_t*) * new_capacity); + if (!new_loops) + goto failed_loops_realloc; + uv__loops = new_loops; + for (i = uv__loops_capacity; i < new_capacity; ++i) + uv__loops[i] = NULL; + uv__loops_capacity = new_capacity; + } + uv__loops[uv__loops_size] = loop; + ++uv__loops_size; + + uv_mutex_unlock(&uv__loops_lock); + return 0; + +failed_loops_realloc: + uv_mutex_unlock(&uv__loops_lock); + return ERROR_OUTOFMEMORY; +} + +static void uv__loops_remove(uv_loop_t* loop) { + int loop_index; + int smaller_capacity; + uv_loop_t** new_loops; + + uv_mutex_lock(&uv__loops_lock); + + for (loop_index = 0; loop_index < uv__loops_size; ++loop_index) { + if (uv__loops[loop_index] == loop) + break; + } + /* If loop was not found, ignore */ + if (loop_index == uv__loops_size) + goto loop_removed; + + uv__loops[loop_index] = uv__loops[uv__loops_size - 1]; + uv__loops[uv__loops_size - 1] = NULL; + --uv__loops_size; + + if (uv__loops_size == 0) { + uv__loops_capacity = 0; + uv__free(uv__loops); + uv__loops = NULL; + goto loop_removed; + } + + /* If we didn't grow to big skip downsizing */ + if (uv__loops_capacity < 4 * UV__LOOPS_CHUNK_SIZE) + goto loop_removed; + + /* Downsize only if more than half of buffer is free */ + smaller_capacity = uv__loops_capacity / 2; + if (uv__loops_size >= smaller_capacity) + goto loop_removed; + new_loops = uv__realloc(uv__loops, sizeof(uv_loop_t*) * smaller_capacity); + if (!new_loops) + goto loop_removed; + uv__loops = new_loops; + uv__loops_capacity = smaller_capacity; + +loop_removed: + uv_mutex_unlock(&uv__loops_lock); +} + +void uv__wake_all_loops(void) { + int i; + uv_loop_t* loop; + + uv_mutex_lock(&uv__loops_lock); + for (i = 0; i < uv__loops_size; ++i) { + loop = uv__loops[i]; + assert(loop); + if (loop->iocp != INVALID_HANDLE_VALUE) + PostQueuedCompletionStatus(loop->iocp, 0, 0, NULL); + } + uv_mutex_unlock(&uv__loops_lock); +} + +static void uv_init(void) { + /* Tell Windows that we will handle critical errors. */ + SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | + SEM_NOOPENFILEERRORBOX); + + /* Tell the CRT to not exit the application when an invalid parameter is + * passed. The main issue is that invalid FDs will trigger this behavior. + */ +#if !defined(__MINGW32__) || __MSVCRT_VERSION__ >= 0x800 + _set_invalid_parameter_handler(uv__crt_invalid_parameter_handler); +#endif + + /* We also need to setup our debug report handler because some CRT + * functions (eg _get_osfhandle) raise an assert when called with invalid + * FDs even though they return the proper error code in the release build. + */ +#if defined(_DEBUG) && (defined(_MSC_VER) || defined(__MINGW64_VERSION_MAJOR)) + _CrtSetReportHook(uv__crt_dbg_report_handler); +#endif + + /* Initialize tracking of all uv loops */ + uv__loops_init(); + + /* Fetch winapi function pointers. This must be done first because other + * initialization code might need these function pointers to be loaded. + */ + uv_winapi_init(); + + /* Initialize winsock */ + uv_winsock_init(); + + /* Initialize FS */ + uv_fs_init(); + + /* Initialize signal stuff */ + uv_signals_init(); + + /* Initialize console */ + uv_console_init(); + + /* Initialize utilities */ + uv__util_init(); + + /* Initialize system wakeup detection */ + uv__init_detect_system_wakeup(); +} + + +int uv_loop_init(uv_loop_t* loop) { ++ struct heap* timer_heap; + int err; + + /* Initialize libuv itself first */ + uv__once_init(); + + /* Create an I/O completion port */ + loop->iocp = CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, 0, 1); + if (loop->iocp == NULL) + return uv_translate_sys_error(GetLastError()); + + /* To prevent uninitialized memory access, loop->time must be initialized + * to zero before calling uv_update_time for the first time. + */ + loop->time = 0; + uv_update_time(loop); + + QUEUE_INIT(&loop->wq); + QUEUE_INIT(&loop->handle_queue); + loop->active_reqs.count = 0; + loop->active_handles = 0; + + loop->pending_reqs_tail = NULL; + + loop->endgame_handles = NULL; + - RB_INIT(&loop->timers); ++ loop->timer_heap = timer_heap = uv__malloc(sizeof(*timer_heap)); ++ if (timer_heap == NULL) { ++ err = UV_ENOMEM; ++ goto fail_timers_alloc; ++ } ++ ++ heap_init(timer_heap); + + loop->check_handles = NULL; + loop->prepare_handles = NULL; + loop->idle_handles = NULL; + + loop->next_prepare_handle = NULL; + loop->next_check_handle = NULL; + loop->next_idle_handle = NULL; + + memset(&loop->poll_peer_sockets, 0, sizeof loop->poll_peer_sockets); + + loop->active_tcp_streams = 0; + loop->active_udp_streams = 0; + + loop->timer_counter = 0; + loop->stop_flag = 0; + + err = uv_mutex_init(&loop->wq_mutex); + if (err) + goto fail_mutex_init; + + err = uv_async_init(loop, &loop->wq_async, uv__work_done); + if (err) + goto fail_async_init; + + uv__handle_unref(&loop->wq_async); - loop->wq_async.flags |= UV__HANDLE_INTERNAL; ++ loop->wq_async.flags |= UV_HANDLE_INTERNAL; + + err = uv__loops_add(loop); + if (err) + goto fail_async_init; + + return 0; + +fail_async_init: + uv_mutex_destroy(&loop->wq_mutex); + +fail_mutex_init: ++ uv__free(timer_heap); ++ loop->timer_heap = NULL; ++ ++fail_timers_alloc: + CloseHandle(loop->iocp); + loop->iocp = INVALID_HANDLE_VALUE; + + return err; +} + + ++void uv_update_time(uv_loop_t* loop) { ++ uint64_t new_time = uv__hrtime(1000); ++ assert(new_time >= loop->time); ++ loop->time = new_time; ++} ++ ++ +void uv__once_init(void) { + uv_once(&uv_init_guard_, uv_init); +} + + +void uv__loop_close(uv_loop_t* loop) { + size_t i; + + uv__loops_remove(loop); + + /* close the async handle without needing an extra loop iteration */ + assert(!loop->wq_async.async_sent); + loop->wq_async.close_cb = NULL; + uv__handle_closing(&loop->wq_async); + uv__handle_close(&loop->wq_async); + + for (i = 0; i < ARRAY_SIZE(loop->poll_peer_sockets); i++) { + SOCKET sock = loop->poll_peer_sockets[i]; + if (sock != 0 && sock != INVALID_SOCKET) + closesocket(sock); + } + + uv_mutex_lock(&loop->wq_mutex); + assert(QUEUE_EMPTY(&loop->wq) && "thread pool work queue not empty!"); + assert(!uv__has_active_reqs(loop)); + uv_mutex_unlock(&loop->wq_mutex); + uv_mutex_destroy(&loop->wq_mutex); + ++ uv__free(loop->timer_heap); ++ loop->timer_heap = NULL; ++ + CloseHandle(loop->iocp); +} + + +int uv__loop_configure(uv_loop_t* loop, uv_loop_option option, va_list ap) { + return UV_ENOSYS; +} + + +int uv_backend_fd(const uv_loop_t* loop) { + return -1; +} + + +int uv_loop_fork(uv_loop_t* loop) { + return UV_ENOSYS; +} + + +int uv_backend_timeout(const uv_loop_t* loop) { + if (loop->stop_flag != 0) + return 0; + + if (!uv__has_active_handles(loop) && !uv__has_active_reqs(loop)) + return 0; + + if (loop->pending_reqs_tail) + return 0; + + if (loop->endgame_handles) + return 0; + + if (loop->idle_handles) + return 0; + + return uv__next_timeout(loop); +} + + - static void uv_poll(uv_loop_t* loop, DWORD timeout) { ++static void uv__poll_wine(uv_loop_t* loop, DWORD timeout) { + DWORD bytes; + ULONG_PTR key; + OVERLAPPED* overlapped; + uv_req_t* req; + int repeat; + uint64_t timeout_time; + + timeout_time = loop->time + timeout; + + for (repeat = 0; ; repeat++) { + GetQueuedCompletionStatus(loop->iocp, + &bytes, + &key, + &overlapped, + timeout); + + if (overlapped) { + /* Package was dequeued */ + req = uv_overlapped_to_req(overlapped); + uv_insert_pending_req(loop, req); + + /* Some time might have passed waiting for I/O, + * so update the loop time here. + */ + uv_update_time(loop); + } else if (GetLastError() != WAIT_TIMEOUT) { + /* Serious error */ + uv_fatal_error(GetLastError(), "GetQueuedCompletionStatus"); + } else if (timeout > 0) { + /* GetQueuedCompletionStatus can occasionally return a little early. + * Make sure that the desired timeout target time is reached. + */ + uv_update_time(loop); + if (timeout_time > loop->time) { + timeout = (DWORD)(timeout_time - loop->time); + /* The first call to GetQueuedCompletionStatus should return very + * close to the target time and the second should reach it, but + * this is not stated in the documentation. To make sure a busy + * loop cannot happen, the timeout is increased exponentially + * starting on the third round. + */ + timeout += repeat ? (1 << (repeat - 1)) : 0; + continue; + } + } + break; + } +} + + - static void uv_poll_ex(uv_loop_t* loop, DWORD timeout) { ++static void uv__poll(uv_loop_t* loop, DWORD timeout) { + BOOL success; + uv_req_t* req; + OVERLAPPED_ENTRY overlappeds[128]; + ULONG count; + ULONG i; + int repeat; + uint64_t timeout_time; + + timeout_time = loop->time + timeout; + + for (repeat = 0; ; repeat++) { - success = pGetQueuedCompletionStatusEx(loop->iocp, - overlappeds, - ARRAY_SIZE(overlappeds), - &count, - timeout, - FALSE); ++ success = GetQueuedCompletionStatusEx(loop->iocp, ++ overlappeds, ++ ARRAY_SIZE(overlappeds), ++ &count, ++ timeout, ++ FALSE); + + if (success) { + for (i = 0; i < count; i++) { + /* Package was dequeued, but see if it is not a empty package + * meant only to wake us up. + */ + if (overlappeds[i].lpOverlapped) { + req = uv_overlapped_to_req(overlappeds[i].lpOverlapped); + uv_insert_pending_req(loop, req); + } + } + + /* Some time might have passed waiting for I/O, + * so update the loop time here. + */ + uv_update_time(loop); + } else if (GetLastError() != WAIT_TIMEOUT) { + /* Serious error */ + uv_fatal_error(GetLastError(), "GetQueuedCompletionStatusEx"); + } else if (timeout > 0) { + /* GetQueuedCompletionStatus can occasionally return a little early. + * Make sure that the desired timeout target time is reached. + */ + uv_update_time(loop); + if (timeout_time > loop->time) { + timeout = (DWORD)(timeout_time - loop->time); + /* The first call to GetQueuedCompletionStatus should return very + * close to the target time and the second should reach it, but + * this is not stated in the documentation. To make sure a busy + * loop cannot happen, the timeout is increased exponentially + * starting on the third round. + */ + timeout += repeat ? (1 << (repeat - 1)) : 0; + continue; + } + } + break; + } +} + + +static int uv__loop_alive(const uv_loop_t* loop) { + return uv__has_active_handles(loop) || + uv__has_active_reqs(loop) || + loop->endgame_handles != NULL; +} + + +int uv_loop_alive(const uv_loop_t* loop) { + return uv__loop_alive(loop); +} + + +int uv_run(uv_loop_t *loop, uv_run_mode mode) { + DWORD timeout; + int r; + int ran_pending; - void (*poll)(uv_loop_t* loop, DWORD timeout); - - if (pGetQueuedCompletionStatusEx) - poll = &uv_poll_ex; - else - poll = &uv_poll; + + r = uv__loop_alive(loop); + if (!r) + uv_update_time(loop); + + while (r != 0 && loop->stop_flag == 0) { + uv_update_time(loop); - uv_process_timers(loop); ++ uv__run_timers(loop); + + ran_pending = uv_process_reqs(loop); + uv_idle_invoke(loop); + uv_prepare_invoke(loop); + + timeout = 0; + if ((mode == UV_RUN_ONCE && !ran_pending) || mode == UV_RUN_DEFAULT) + timeout = uv_backend_timeout(loop); + - (*poll)(loop, timeout); ++ if (pGetQueuedCompletionStatusEx) ++ uv__poll(loop, timeout); ++ else ++ uv__poll_wine(loop, timeout); ++ + + uv_check_invoke(loop); + uv_process_endgames(loop); + + if (mode == UV_RUN_ONCE) { + /* UV_RUN_ONCE implies forward progress: at least one callback must have + * been invoked when it returns. uv__io_poll() can return without doing + * I/O (meaning: no callbacks) when its timeout expires - which means we + * have pending timers that satisfy the forward progress constraint. + * + * UV_RUN_NOWAIT makes no guarantees about progress so it's omitted from + * the check. + */ - uv_process_timers(loop); ++ uv__run_timers(loop); + } + + r = uv__loop_alive(loop); + if (mode == UV_RUN_ONCE || mode == UV_RUN_NOWAIT) + break; + } + + /* The if statement lets the compiler compile it to a conditional store. + * Avoids dirtying a cache line. + */ + if (loop->stop_flag != 0) + loop->stop_flag = 0; + + return r; +} + + +int uv_fileno(const uv_handle_t* handle, uv_os_fd_t* fd) { + uv_os_fd_t fd_out; + + switch (handle->type) { + case UV_TCP: + fd_out = (uv_os_fd_t)((uv_tcp_t*) handle)->socket; + break; + + case UV_NAMED_PIPE: + fd_out = ((uv_pipe_t*) handle)->handle; + break; + + case UV_TTY: + fd_out = ((uv_tty_t*) handle)->handle; + break; + + case UV_UDP: + fd_out = (uv_os_fd_t)((uv_udp_t*) handle)->socket; + break; + + case UV_POLL: + fd_out = (uv_os_fd_t)((uv_poll_t*) handle)->socket; + break; + + default: + return UV_EINVAL; + } + + if (uv_is_closing(handle) || fd_out == INVALID_HANDLE_VALUE) + return UV_EBADF; + + *fd = fd_out; + return 0; +} + + +int uv__socket_sockopt(uv_handle_t* handle, int optname, int* value) { + int r; + int len; + SOCKET socket; + + if (handle == NULL || value == NULL) + return UV_EINVAL; + + if (handle->type == UV_TCP) + socket = ((uv_tcp_t*) handle)->socket; + else if (handle->type == UV_UDP) + socket = ((uv_udp_t*) handle)->socket; + else + return UV_ENOTSUP; + + len = sizeof(*value); + + if (*value == 0) + r = getsockopt(socket, SOL_SOCKET, optname, (char*) value, &len); + else + r = setsockopt(socket, SOL_SOCKET, optname, (const char*) value, len); + + if (r == SOCKET_ERROR) + return uv_translate_sys_error(WSAGetLastError()); + + return 0; +} + +int uv_cpumask_size(void) { + return (int)(sizeof(DWORD_PTR) * 8); +} diff --cc Utilities/cmlibuv/src/win/internal.h index 849bc82,0000000..206ab5f mode 100644,000000..100644 --- a/Utilities/cmlibuv/src/win/internal.h +++ b/Utilities/cmlibuv/src/win/internal.h @@@ -1,404 -1,0 +1,338 @@@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef UV_WIN_INTERNAL_H_ +#define UV_WIN_INTERNAL_H_ + +#if defined(_MSC_VER) +# pragma warning(push,1) +#endif + +#include "uv.h" +#include "../uv-common.h" + - #include "tree.h" ++#include "uv/tree.h" +#include "winapi.h" +#include "winsock.h" + +#ifdef _MSC_VER +# define INLINE __inline +# define UV_THREAD_LOCAL __declspec( thread ) +#else +# define INLINE inline +# define UV_THREAD_LOCAL __thread +#endif + + +#ifdef _DEBUG + +extern UV_THREAD_LOCAL int uv__crt_assert_enabled; + +#define UV_BEGIN_DISABLE_CRT_ASSERT() \ + { \ + int uv__saved_crt_assert_enabled = uv__crt_assert_enabled; \ + uv__crt_assert_enabled = FALSE; + + +#define UV_END_DISABLE_CRT_ASSERT() \ + uv__crt_assert_enabled = uv__saved_crt_assert_enabled; \ + } + +#else +#define UV_BEGIN_DISABLE_CRT_ASSERT() +#define UV_END_DISABLE_CRT_ASSERT() +#endif + +/* - * Handles - * (also see handle-inl.h) - */ - - /* Used by all handles. */ - #define UV_HANDLE_CLOSED 0x00000002 - #define UV_HANDLE_ENDGAME_QUEUED 0x00000008 - - /* uv-common.h: #define UV__HANDLE_CLOSING 0x00000001 */ - /* uv-common.h: #define UV__HANDLE_ACTIVE 0x00000040 */ - /* uv-common.h: #define UV__HANDLE_REF 0x00000020 */ - /* uv-common.h: #define UV_HANDLE_INTERNAL 0x00000080 */ - - /* Used by streams and UDP handles. */ - #define UV_HANDLE_READING 0x00000100 - #define UV_HANDLE_BOUND 0x00000200 - #define UV_HANDLE_LISTENING 0x00000800 - #define UV_HANDLE_CONNECTION 0x00001000 - #define UV_HANDLE_READABLE 0x00008000 - #define UV_HANDLE_WRITABLE 0x00010000 - #define UV_HANDLE_READ_PENDING 0x00020000 - #define UV_HANDLE_SYNC_BYPASS_IOCP 0x00040000 - #define UV_HANDLE_ZERO_READ 0x00080000 - #define UV_HANDLE_EMULATE_IOCP 0x00100000 - #define UV_HANDLE_BLOCKING_WRITES 0x00200000 - #define UV_HANDLE_CANCELLATION_PENDING 0x00400000 - - /* Used by uv_tcp_t and uv_udp_t handles */ - #define UV_HANDLE_IPV6 0x01000000 - - /* Only used by uv_tcp_t handles. */ - #define UV_HANDLE_TCP_NODELAY 0x02000000 - #define UV_HANDLE_TCP_KEEPALIVE 0x04000000 - #define UV_HANDLE_TCP_SINGLE_ACCEPT 0x08000000 - #define UV_HANDLE_TCP_ACCEPT_STATE_CHANGING 0x10000000 - #define UV_HANDLE_TCP_SOCKET_CLOSED 0x20000000 - #define UV_HANDLE_SHARED_TCP_SOCKET 0x40000000 - - /* Only used by uv_pipe_t handles. */ - #define UV_HANDLE_NON_OVERLAPPED_PIPE 0x01000000 - #define UV_HANDLE_PIPESERVER 0x02000000 - #define UV_HANDLE_PIPE_READ_CANCELABLE 0x04000000 - - /* Only used by uv_tty_t handles. */ - #define UV_HANDLE_TTY_READABLE 0x01000000 - #define UV_HANDLE_TTY_RAW 0x02000000 - #define UV_HANDLE_TTY_SAVED_POSITION 0x04000000 - #define UV_HANDLE_TTY_SAVED_ATTRIBUTES 0x08000000 - - /* Only used by uv_poll_t handles. */ - #define UV_HANDLE_POLL_SLOW 0x02000000 - - - /* - * Requests: see req-inl.h - */ - - - /* - * Streams: see stream-inl.h - */ - - - /* + * TCP + */ + ++typedef enum { ++ UV__IPC_SOCKET_XFER_NONE = 0, ++ UV__IPC_SOCKET_XFER_TCP_CONNECTION, ++ UV__IPC_SOCKET_XFER_TCP_SERVER ++} uv__ipc_socket_xfer_type_t; ++ +typedef struct { + WSAPROTOCOL_INFOW socket_info; - int delayed_error; - } uv__ipc_socket_info_ex; ++ uint32_t delayed_error; ++} uv__ipc_socket_xfer_info_t; + +int uv_tcp_listen(uv_tcp_t* handle, int backlog, uv_connection_cb cb); +int uv_tcp_accept(uv_tcp_t* server, uv_tcp_t* client); +int uv_tcp_read_start(uv_tcp_t* handle, uv_alloc_cb alloc_cb, + uv_read_cb read_cb); +int uv_tcp_write(uv_loop_t* loop, uv_write_t* req, uv_tcp_t* handle, + const uv_buf_t bufs[], unsigned int nbufs, uv_write_cb cb); +int uv__tcp_try_write(uv_tcp_t* handle, const uv_buf_t bufs[], + unsigned int nbufs); + +void uv_process_tcp_read_req(uv_loop_t* loop, uv_tcp_t* handle, uv_req_t* req); +void uv_process_tcp_write_req(uv_loop_t* loop, uv_tcp_t* handle, + uv_write_t* req); +void uv_process_tcp_accept_req(uv_loop_t* loop, uv_tcp_t* handle, + uv_req_t* req); +void uv_process_tcp_connect_req(uv_loop_t* loop, uv_tcp_t* handle, + uv_connect_t* req); + +void uv_tcp_close(uv_loop_t* loop, uv_tcp_t* tcp); +void uv_tcp_endgame(uv_loop_t* loop, uv_tcp_t* handle); + - int uv_tcp_import(uv_tcp_t* tcp, uv__ipc_socket_info_ex* socket_info_ex, - int tcp_connection); - - int uv_tcp_duplicate_socket(uv_tcp_t* handle, int pid, - LPWSAPROTOCOL_INFOW protocol_info); ++int uv__tcp_xfer_export(uv_tcp_t* handle, ++ int pid, ++ uv__ipc_socket_xfer_type_t* xfer_type, ++ uv__ipc_socket_xfer_info_t* xfer_info); ++int uv__tcp_xfer_import(uv_tcp_t* tcp, ++ uv__ipc_socket_xfer_type_t xfer_type, ++ uv__ipc_socket_xfer_info_t* xfer_info); + + +/* + * UDP + */ +void uv_process_udp_recv_req(uv_loop_t* loop, uv_udp_t* handle, uv_req_t* req); +void uv_process_udp_send_req(uv_loop_t* loop, uv_udp_t* handle, + uv_udp_send_t* req); + +void uv_udp_close(uv_loop_t* loop, uv_udp_t* handle); +void uv_udp_endgame(uv_loop_t* loop, uv_udp_t* handle); + + +/* + * Pipes + */ +int uv_stdio_pipe_server(uv_loop_t* loop, uv_pipe_t* handle, DWORD access, + char* name, size_t nameSize); + +int uv_pipe_listen(uv_pipe_t* handle, int backlog, uv_connection_cb cb); +int uv_pipe_accept(uv_pipe_t* server, uv_stream_t* client); +int uv_pipe_read_start(uv_pipe_t* handle, uv_alloc_cb alloc_cb, + uv_read_cb read_cb); - int uv_pipe_write(uv_loop_t* loop, uv_write_t* req, uv_pipe_t* handle, - const uv_buf_t bufs[], unsigned int nbufs, uv_write_cb cb); - int uv_pipe_write2(uv_loop_t* loop, uv_write_t* req, uv_pipe_t* handle, - const uv_buf_t bufs[], unsigned int nbufs, uv_stream_t* send_handle, - uv_write_cb cb); - void uv__pipe_pause_read(uv_pipe_t* handle); - void uv__pipe_unpause_read(uv_pipe_t* handle); - void uv__pipe_stop_read(uv_pipe_t* handle); ++void uv__pipe_read_stop(uv_pipe_t* handle); ++int uv__pipe_write(uv_loop_t* loop, ++ uv_write_t* req, ++ uv_pipe_t* handle, ++ const uv_buf_t bufs[], ++ size_t nbufs, ++ uv_stream_t* send_handle, ++ uv_write_cb cb); + +void uv_process_pipe_read_req(uv_loop_t* loop, uv_pipe_t* handle, + uv_req_t* req); +void uv_process_pipe_write_req(uv_loop_t* loop, uv_pipe_t* handle, + uv_write_t* req); +void uv_process_pipe_accept_req(uv_loop_t* loop, uv_pipe_t* handle, + uv_req_t* raw_req); +void uv_process_pipe_connect_req(uv_loop_t* loop, uv_pipe_t* handle, + uv_connect_t* req); +void uv_process_pipe_shutdown_req(uv_loop_t* loop, uv_pipe_t* handle, + uv_shutdown_t* req); + +void uv_pipe_close(uv_loop_t* loop, uv_pipe_t* handle); +void uv_pipe_cleanup(uv_loop_t* loop, uv_pipe_t* handle); +void uv_pipe_endgame(uv_loop_t* loop, uv_pipe_t* handle); + + +/* + * TTY + */ +void uv_console_init(void); + +int uv_tty_read_start(uv_tty_t* handle, uv_alloc_cb alloc_cb, + uv_read_cb read_cb); +int uv_tty_read_stop(uv_tty_t* handle); +int uv_tty_write(uv_loop_t* loop, uv_write_t* req, uv_tty_t* handle, + const uv_buf_t bufs[], unsigned int nbufs, uv_write_cb cb); +int uv__tty_try_write(uv_tty_t* handle, const uv_buf_t bufs[], + unsigned int nbufs); +void uv_tty_close(uv_tty_t* handle); + +void uv_process_tty_read_req(uv_loop_t* loop, uv_tty_t* handle, + uv_req_t* req); +void uv_process_tty_write_req(uv_loop_t* loop, uv_tty_t* handle, + uv_write_t* req); +/* + * uv_process_tty_accept_req() is a stub to keep DELEGATE_STREAM_REQ working + * TODO: find a way to remove it + */ +void uv_process_tty_accept_req(uv_loop_t* loop, uv_tty_t* handle, + uv_req_t* raw_req); +/* + * uv_process_tty_connect_req() is a stub to keep DELEGATE_STREAM_REQ working + * TODO: find a way to remove it + */ +void uv_process_tty_connect_req(uv_loop_t* loop, uv_tty_t* handle, + uv_connect_t* req); + +void uv_tty_endgame(uv_loop_t* loop, uv_tty_t* handle); + + +/* + * Poll watchers + */ +void uv_process_poll_req(uv_loop_t* loop, uv_poll_t* handle, + uv_req_t* req); + +int uv_poll_close(uv_loop_t* loop, uv_poll_t* handle); +void uv_poll_endgame(uv_loop_t* loop, uv_poll_t* handle); + + +/* - * Timers - */ - void uv_timer_endgame(uv_loop_t* loop, uv_timer_t* handle); - - DWORD uv__next_timeout(const uv_loop_t* loop); - void uv_process_timers(uv_loop_t* loop); - - - /* + * Loop watchers + */ +void uv_loop_watcher_endgame(uv_loop_t* loop, uv_handle_t* handle); + +void uv_prepare_invoke(uv_loop_t* loop); +void uv_check_invoke(uv_loop_t* loop); +void uv_idle_invoke(uv_loop_t* loop); + +void uv__once_init(void); + + +/* + * Async watcher + */ +void uv_async_close(uv_loop_t* loop, uv_async_t* handle); +void uv_async_endgame(uv_loop_t* loop, uv_async_t* handle); + +void uv_process_async_wakeup_req(uv_loop_t* loop, uv_async_t* handle, + uv_req_t* req); + + +/* + * Signal watcher + */ +void uv_signals_init(void); +int uv__signal_dispatch(int signum); + +void uv_signal_close(uv_loop_t* loop, uv_signal_t* handle); +void uv_signal_endgame(uv_loop_t* loop, uv_signal_t* handle); + +void uv_process_signal_req(uv_loop_t* loop, uv_signal_t* handle, + uv_req_t* req); + + +/* + * Spawn + */ +void uv_process_proc_exit(uv_loop_t* loop, uv_process_t* handle); +void uv_process_close(uv_loop_t* loop, uv_process_t* handle); +void uv_process_endgame(uv_loop_t* loop, uv_process_t* handle); + + +/* + * Error + */ +int uv_translate_sys_error(int sys_errno); + + +/* + * FS + */ +void uv_fs_init(void); + + +/* + * FS Event + */ +void uv_process_fs_event_req(uv_loop_t* loop, uv_req_t* req, + uv_fs_event_t* handle); +void uv_fs_event_close(uv_loop_t* loop, uv_fs_event_t* handle); +void uv_fs_event_endgame(uv_loop_t* loop, uv_fs_event_t* handle); + + +/* + * Stat poller. + */ +void uv__fs_poll_endgame(uv_loop_t* loop, uv_fs_poll_t* handle); + + +/* + * Utilities. + */ +void uv__util_init(void); + +uint64_t uv__hrtime(double scale); - int uv_current_pid(void); +__declspec(noreturn) void uv_fatal_error(const int errorno, const char* syscall); +int uv__getpwuid_r(uv_passwd_t* pwd); +int uv__convert_utf16_to_utf8(const WCHAR* utf16, int utf16len, char** utf8); +int uv__convert_utf8_to_utf16(const char* utf8, int utf8len, WCHAR** utf16); + + +/* + * Process stdio handles. + */ +int uv__stdio_create(uv_loop_t* loop, + const uv_process_options_t* options, + BYTE** buffer_ptr); +void uv__stdio_destroy(BYTE* buffer); +void uv__stdio_noinherit(BYTE* buffer); +int uv__stdio_verify(BYTE* buffer, WORD size); +WORD uv__stdio_size(BYTE* buffer); +HANDLE uv__stdio_handle(BYTE* buffer, int fd); + + +/* + * Winapi and ntapi utility functions + */ +void uv_winapi_init(void); + + +/* + * Winsock utility functions + */ +void uv_winsock_init(void); + +int uv_ntstatus_to_winsock_error(NTSTATUS status); + +BOOL uv_get_acceptex_function(SOCKET socket, LPFN_ACCEPTEX* target); +BOOL uv_get_connectex_function(SOCKET socket, LPFN_CONNECTEX* target); + +int WSAAPI uv_wsarecv_workaround(SOCKET socket, WSABUF* buffers, + DWORD buffer_count, DWORD* bytes, DWORD* flags, WSAOVERLAPPED *overlapped, + LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine); +int WSAAPI uv_wsarecvfrom_workaround(SOCKET socket, WSABUF* buffers, + DWORD buffer_count, DWORD* bytes, DWORD* flags, struct sockaddr* addr, + int* addr_len, WSAOVERLAPPED *overlapped, + LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine); + +int WSAAPI uv_msafd_poll(SOCKET socket, AFD_POLL_INFO* info_in, + AFD_POLL_INFO* info_out, OVERLAPPED* overlapped); + +/* Whether there are any non-IFS LSPs stacked on TCP */ +extern int uv_tcp_non_ifs_lsp_ipv4; +extern int uv_tcp_non_ifs_lsp_ipv6; + +/* Ip address used to bind to any port at any interface */ +extern struct sockaddr_in uv_addr_ip4_any_; +extern struct sockaddr_in6 uv_addr_ip6_any_; + +/* + * Wake all loops with fake message + */ +void uv__wake_all_loops(void); + +/* + * Init system wake-up detection + */ +void uv__init_detect_system_wakeup(void); + +#endif /* UV_WIN_INTERNAL_H_ */ diff --cc Utilities/cmlibuv/src/win/process.c index 25cfe87,0000000..24037b3 mode 100644,000000..100644 --- a/Utilities/cmlibuv/src/win/process.c +++ b/Utilities/cmlibuv/src/win/process.c @@@ -1,1328 -1,0 +1,1338 @@@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include /* alloca */ + +#include "uv.h" +#include "internal.h" +#include "handle-inl.h" +#include "req-inl.h" + + +#define SIGKILL 9 + + +typedef struct env_var { + const WCHAR* const wide; + const WCHAR* const wide_eq; + const size_t len; /* including null or '=' */ +} env_var_t; + +#define E_V(str) { L##str, L##str L"=", sizeof(str) } + +static const env_var_t required_vars[] = { /* keep me sorted */ + E_V("HOMEDRIVE"), + E_V("HOMEPATH"), + E_V("LOGONSERVER"), + E_V("PATH"), + E_V("SYSTEMDRIVE"), + E_V("SYSTEMROOT"), + E_V("TEMP"), + E_V("USERDOMAIN"), + E_V("USERNAME"), + E_V("USERPROFILE"), + E_V("WINDIR"), +}; +static size_t n_required_vars = ARRAY_SIZE(required_vars); + + +static HANDLE uv_global_job_handle_; +static uv_once_t uv_global_job_handle_init_guard_ = UV_ONCE_INIT; + + +static void uv__init_global_job_handle(void) { + /* Create a job object and set it up to kill all contained processes when + * it's closed. Since this handle is made non-inheritable and we're not + * giving it to anyone, we're the only process holding a reference to it. + * That means that if this process exits it is closed and all the processes + * it contains are killed. All processes created with uv_spawn that are not + * spawned with the UV_PROCESS_DETACHED flag are assigned to this job. + * + * We're setting the JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK flag so only the + * processes that we explicitly add are affected, and *their* subprocesses + * are not. This ensures that our child processes are not limited in their + * ability to use job control on Windows versions that don't deal with + * nested jobs (prior to Windows 8 / Server 2012). It also lets our child + * processes created detached processes without explicitly breaking away + * from job control (which uv_spawn doesn't, either). + */ + SECURITY_ATTRIBUTES attr; + JOBOBJECT_EXTENDED_LIMIT_INFORMATION info; + + memset(&attr, 0, sizeof attr); + attr.bInheritHandle = FALSE; + + memset(&info, 0, sizeof info); + info.BasicLimitInformation.LimitFlags = + JOB_OBJECT_LIMIT_BREAKAWAY_OK | + JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK | + JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION | + JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE; + + uv_global_job_handle_ = CreateJobObjectW(&attr, NULL); + if (uv_global_job_handle_ == NULL) + uv_fatal_error(GetLastError(), "CreateJobObjectW"); + + if (!SetInformationJobObject(uv_global_job_handle_, + JobObjectExtendedLimitInformation, + &info, + sizeof info)) + uv_fatal_error(GetLastError(), "SetInformationJobObject"); +} + + +static int uv_utf8_to_utf16_alloc(const char* s, WCHAR** ws_ptr) { + int ws_len, r; + WCHAR* ws; + + ws_len = MultiByteToWideChar(CP_UTF8, + 0, + s, + -1, + NULL, + 0); + if (ws_len <= 0) { + return GetLastError(); + } + + ws = (WCHAR*) uv__malloc(ws_len * sizeof(WCHAR)); + if (ws == NULL) { + return ERROR_OUTOFMEMORY; + } + + r = MultiByteToWideChar(CP_UTF8, + 0, + s, + -1, + ws, + ws_len); + assert(r == ws_len); + + *ws_ptr = ws; + return 0; +} + + +static void uv_process_init(uv_loop_t* loop, uv_process_t* handle) { + uv__handle_init(loop, (uv_handle_t*) handle, UV_PROCESS); + handle->exit_cb = NULL; + handle->pid = 0; + handle->exit_signal = 0; + handle->wait_handle = INVALID_HANDLE_VALUE; + handle->process_handle = INVALID_HANDLE_VALUE; + handle->child_stdio_buffer = NULL; + handle->exit_cb_pending = 0; + + UV_REQ_INIT(&handle->exit_req, UV_PROCESS_EXIT); + handle->exit_req.data = handle; +} + + +/* + * Path search functions + */ + +/* + * Helper function for search_path + */ +static WCHAR* search_path_join_test(const WCHAR* dir, + size_t dir_len, + const WCHAR* name, + size_t name_len, + const WCHAR* ext, + size_t ext_len, + const WCHAR* cwd, + size_t cwd_len) { + WCHAR *result, *result_pos; + DWORD attrs; + if (dir_len > 2 && dir[0] == L'\\' && dir[1] == L'\\') { + /* It's a UNC path so ignore cwd */ + cwd_len = 0; + } else if (dir_len >= 1 && (dir[0] == L'/' || dir[0] == L'\\')) { + /* It's a full path without drive letter, use cwd's drive letter only */ + cwd_len = 2; + } else if (dir_len >= 2 && dir[1] == L':' && + (dir_len < 3 || (dir[2] != L'/' && dir[2] != L'\\'))) { + /* It's a relative path with drive letter (ext.g. D:../some/file) + * Replace drive letter in dir by full cwd if it points to the same drive, + * otherwise use the dir only. + */ + if (cwd_len < 2 || _wcsnicmp(cwd, dir, 2) != 0) { + cwd_len = 0; + } else { + dir += 2; + dir_len -= 2; + } + } else if (dir_len > 2 && dir[1] == L':') { + /* It's an absolute path with drive letter + * Don't use the cwd at all + */ + cwd_len = 0; + } + + /* Allocate buffer for output */ + result = result_pos = (WCHAR*)uv__malloc(sizeof(WCHAR) * + (cwd_len + 1 + dir_len + 1 + name_len + 1 + ext_len + 1)); + + /* Copy cwd */ + wcsncpy(result_pos, cwd, cwd_len); + result_pos += cwd_len; + + /* Add a path separator if cwd didn't end with one */ + if (cwd_len && wcsrchr(L"\\/:", result_pos[-1]) == NULL) { + result_pos[0] = L'\\'; + result_pos++; + } + + /* Copy dir */ + wcsncpy(result_pos, dir, dir_len); + result_pos += dir_len; + + /* Add a separator if the dir didn't end with one */ + if (dir_len && wcsrchr(L"\\/:", result_pos[-1]) == NULL) { + result_pos[0] = L'\\'; + result_pos++; + } + + /* Copy filename */ + wcsncpy(result_pos, name, name_len); + result_pos += name_len; + + if (ext_len) { + /* Add a dot if the filename didn't end with one */ + if (name_len && result_pos[-1] != '.') { + result_pos[0] = L'.'; + result_pos++; + } + + /* Copy extension */ + wcsncpy(result_pos, ext, ext_len); + result_pos += ext_len; + } + + /* Null terminator */ + result_pos[0] = L'\0'; + + attrs = GetFileAttributesW(result); + + if (attrs != INVALID_FILE_ATTRIBUTES && + !(attrs & FILE_ATTRIBUTE_DIRECTORY)) { + return result; + } + + uv__free(result); + return NULL; +} + + +/* + * Helper function for search_path + */ +static WCHAR* path_search_walk_ext(const WCHAR *dir, + size_t dir_len, + const WCHAR *name, + size_t name_len, + WCHAR *cwd, + size_t cwd_len, + int name_has_ext) { + WCHAR* result; + + /* If the name itself has a nonempty extension, try this extension first */ + if (name_has_ext) { + result = search_path_join_test(dir, dir_len, + name, name_len, + L"", 0, + cwd, cwd_len); + if (result != NULL) { + return result; + } + } + + /* Try .com extension */ + result = search_path_join_test(dir, dir_len, + name, name_len, + L"com", 3, + cwd, cwd_len); + if (result != NULL) { + return result; + } + + /* Try .exe extension */ + result = search_path_join_test(dir, dir_len, + name, name_len, + L"exe", 3, + cwd, cwd_len); + if (result != NULL) { + return result; + } + + return NULL; +} + + +/* + * search_path searches the system path for an executable filename - + * the windows API doesn't provide this as a standalone function nor as an + * option to CreateProcess. + * + * It tries to return an absolute filename. + * + * Furthermore, it tries to follow the semantics that cmd.exe, with this + * exception that PATHEXT environment variable isn't used. Since CreateProcess + * can start only .com and .exe files, only those extensions are tried. This + * behavior equals that of msvcrt's spawn functions. + * + * - Do not search the path if the filename already contains a path (either + * relative or absolute). + * + * - If there's really only a filename, check the current directory for file, + * then search all path directories. + * + * - If filename specified has *any* extension, search for the file with the + * specified extension first. + * + * - If the literal filename is not found in a directory, try *appending* + * (not replacing) .com first and then .exe. + * + * - The path variable may contain relative paths; relative paths are relative + * to the cwd. + * + * - Directories in path may or may not end with a trailing backslash. + * + * - CMD does not trim leading/trailing whitespace from path/pathex entries + * nor from the environment variables as a whole. + * + * - When cmd.exe cannot read a directory, it will just skip it and go on + * searching. However, unlike posix-y systems, it will happily try to run a + * file that is not readable/executable; if the spawn fails it will not + * continue searching. + * + * UNC path support: we are dealing with UNC paths in both the path and the + * filename. This is a deviation from what cmd.exe does (it does not let you + * start a program by specifying an UNC path on the command line) but this is + * really a pointless restriction. + * + */ +static WCHAR* search_path(const WCHAR *file, + WCHAR *cwd, + const WCHAR *path) { + int file_has_dir; + WCHAR* result = NULL; + WCHAR *file_name_start; + WCHAR *dot; + const WCHAR *dir_start, *dir_end, *dir_path; + size_t dir_len; + int name_has_ext; + + size_t file_len = wcslen(file); + size_t cwd_len = wcslen(cwd); + + /* If the caller supplies an empty filename, + * we're not gonna return c:\windows\.exe -- GFY! + */ + if (file_len == 0 + || (file_len == 1 && file[0] == L'.')) { + return NULL; + } + - /* Find the start of the filename so we can split the directory from the */ - /* name. */ ++ /* Find the start of the filename so we can split the directory from the ++ * name. */ + for (file_name_start = (WCHAR*)file + file_len; + file_name_start > file + && file_name_start[-1] != L'\\' + && file_name_start[-1] != L'/' + && file_name_start[-1] != L':'; + file_name_start--); + + file_has_dir = file_name_start != file; + + /* Check if the filename includes an extension */ + dot = wcschr(file_name_start, L'.'); + name_has_ext = (dot != NULL && dot[1] != L'\0'); + + if (file_has_dir) { + /* The file has a path inside, don't use path */ + result = path_search_walk_ext( + file, file_name_start - file, + file_name_start, file_len - (file_name_start - file), + cwd, cwd_len, + name_has_ext); + + } else { + dir_end = path; + + /* The file is really only a name; look in cwd first, then scan path */ + result = path_search_walk_ext(L"", 0, + file, file_len, + cwd, cwd_len, + name_has_ext); + + while (result == NULL) { + if (*dir_end == L'\0') { + break; + } + + /* Skip the separator that dir_end now points to */ + if (dir_end != path || *path == L';') { + dir_end++; + } + + /* Next slice starts just after where the previous one ended */ + dir_start = dir_end; + + /* If path is quoted, find quote end */ + if (*dir_start == L'"' || *dir_start == L'\'') { + dir_end = wcschr(dir_start + 1, *dir_start); + if (dir_end == NULL) { + dir_end = wcschr(dir_start, L'\0'); + } + } + /* Slice until the next ; or \0 is found */ + dir_end = wcschr(dir_end, L';'); + if (dir_end == NULL) { + dir_end = wcschr(dir_start, L'\0'); + } + + /* If the slice is zero-length, don't bother */ + if (dir_end - dir_start == 0) { + continue; + } + + dir_path = dir_start; + dir_len = dir_end - dir_start; + + /* Adjust if the path is quoted. */ + if (dir_path[0] == '"' || dir_path[0] == '\'') { + ++dir_path; + --dir_len; + } + + if (dir_path[dir_len - 1] == '"' || dir_path[dir_len - 1] == '\'') { + --dir_len; + } + + result = path_search_walk_ext(dir_path, dir_len, + file, file_len, + cwd, cwd_len, + name_has_ext); + } + } + + return result; +} + + +/* + * Quotes command line arguments + * Returns a pointer to the end (next char to be written) of the buffer + */ +WCHAR* quote_cmd_arg(const WCHAR *source, WCHAR *target) { + size_t len = wcslen(source); + size_t i; + int quote_hit; + WCHAR* start; + + if (len == 0) { + /* Need double quotation for empty argument */ + *(target++) = L'"'; + *(target++) = L'"'; + return target; + } + + if (NULL == wcspbrk(source, L" \t\"")) { + /* No quotation needed */ + wcsncpy(target, source, len); + target += len; + return target; + } + + if (NULL == wcspbrk(source, L"\"\\")) { + /* + * No embedded double quotes or backlashes, so I can just wrap + * quote marks around the whole thing. + */ + *(target++) = L'"'; + wcsncpy(target, source, len); + target += len; + *(target++) = L'"'; + return target; + } + + /* + * Expected input/output: + * input : hello"world + * output: "hello\"world" + * input : hello""world + * output: "hello\"\"world" + * input : hello\world + * output: hello\world + * input : hello\\world + * output: hello\\world + * input : hello\"world + * output: "hello\\\"world" + * input : hello\\"world + * output: "hello\\\\\"world" + * input : hello world\ + * output: "hello world\\" + */ + + *(target++) = L'"'; + start = target; + quote_hit = 1; + + for (i = len; i > 0; --i) { + *(target++) = source[i - 1]; + + if (quote_hit && source[i - 1] == L'\\') { + *(target++) = L'\\'; + } else if(source[i - 1] == L'"') { + quote_hit = 1; + *(target++) = L'\\'; + } else { + quote_hit = 0; + } + } + target[0] = L'\0'; + wcsrev(start); + *(target++) = L'"'; + return target; +} + + +int make_program_args(char** args, int verbatim_arguments, WCHAR** dst_ptr) { + char** arg; + WCHAR* dst = NULL; + WCHAR* temp_buffer = NULL; + size_t dst_len = 0; + size_t temp_buffer_len = 0; + WCHAR* pos; + int arg_count = 0; + int err = 0; + + /* Count the required size. */ + for (arg = args; *arg; arg++) { + DWORD arg_len; + + arg_len = MultiByteToWideChar(CP_UTF8, + 0, + *arg, + -1, + NULL, + 0); + if (arg_len == 0) { + return GetLastError(); + } + + dst_len += arg_len; + + if (arg_len > temp_buffer_len) + temp_buffer_len = arg_len; + + arg_count++; + } + - /* Adjust for potential quotes. Also assume the worst-case scenario */ - /* that every character needs escaping, so we need twice as much space. */ ++ /* Adjust for potential quotes. Also assume the worst-case scenario that ++ * every character needs escaping, so we need twice as much space. */ + dst_len = dst_len * 2 + arg_count * 2; + + /* Allocate buffer for the final command line. */ + dst = (WCHAR*) uv__malloc(dst_len * sizeof(WCHAR)); + if (dst == NULL) { + err = ERROR_OUTOFMEMORY; + goto error; + } + + /* Allocate temporary working buffer. */ + temp_buffer = (WCHAR*) uv__malloc(temp_buffer_len * sizeof(WCHAR)); + if (temp_buffer == NULL) { + err = ERROR_OUTOFMEMORY; + goto error; + } + + pos = dst; + for (arg = args; *arg; arg++) { + DWORD arg_len; + + /* Convert argument to wide char. */ + arg_len = MultiByteToWideChar(CP_UTF8, + 0, + *arg, + -1, + temp_buffer, + (int) (dst + dst_len - pos)); + if (arg_len == 0) { + err = GetLastError(); + goto error; + } + + if (verbatim_arguments) { + /* Copy verbatim. */ + wcscpy(pos, temp_buffer); + pos += arg_len - 1; + } else { + /* Quote/escape, if needed. */ + pos = quote_cmd_arg(temp_buffer, pos); + } + + *pos++ = *(arg + 1) ? L' ' : L'\0'; + } + + uv__free(temp_buffer); + + *dst_ptr = dst; + return 0; + +error: + uv__free(dst); + uv__free(temp_buffer); + return err; +} + + +int env_strncmp(const wchar_t* a, int na, const wchar_t* b) { + wchar_t* a_eq; + wchar_t* b_eq; + wchar_t* A; + wchar_t* B; + int nb; + int r; + + if (na < 0) { + a_eq = wcschr(a, L'='); + assert(a_eq); + na = (int)(long)(a_eq - a); + } else { + na--; + } + b_eq = wcschr(b, L'='); + assert(b_eq); + nb = b_eq - b; + + A = alloca((na+1) * sizeof(wchar_t)); + B = alloca((nb+1) * sizeof(wchar_t)); + + r = LCMapStringW(LOCALE_INVARIANT, LCMAP_UPPERCASE, a, na, A, na); + assert(r==na); + A[na] = L'\0'; + r = LCMapStringW(LOCALE_INVARIANT, LCMAP_UPPERCASE, b, nb, B, nb); + assert(r==nb); + B[nb] = L'\0'; + + while (1) { + wchar_t AA = *A++; + wchar_t BB = *B++; + if (AA < BB) { + return -1; + } else if (AA > BB) { + return 1; + } else if (!AA && !BB) { + return 0; + } + } +} + + +static int qsort_wcscmp(const void *a, const void *b) { + wchar_t* astr = *(wchar_t* const*)a; + wchar_t* bstr = *(wchar_t* const*)b; + return env_strncmp(astr, -1, bstr); +} + + +/* + * The way windows takes environment variables is different than what C does; + * Windows wants a contiguous block of null-terminated strings, terminated + * with an additional null. + * + * Windows has a few "essential" environment variables. winsock will fail + * to initialize if SYSTEMROOT is not defined; some APIs make reference to + * TEMP. SYSTEMDRIVE is probably also important. We therefore ensure that + * these get defined if the input environment block does not contain any + * values for them. + * + * Also add variables known to Cygwin to be required for correct + * subprocess operation in many cases: + * https://github.com/Alexpux/Cygwin/blob/b266b04fbbd3a595f02ea149e4306d3ab9b1fe3d/winsup/cygwin/environ.cc#L955 + * + */ +int make_program_env(char* env_block[], WCHAR** dst_ptr) { + WCHAR* dst; + WCHAR* ptr; + char** env; + size_t env_len = 0; + int len; + size_t i; + DWORD var_size; + size_t env_block_count = 1; /* 1 for null-terminator */ + WCHAR* dst_copy; + WCHAR** ptr_copy; + WCHAR** env_copy; + DWORD* required_vars_value_len = alloca(n_required_vars * sizeof(DWORD*)); + + /* first pass: determine size in UTF-16 */ + for (env = env_block; *env; env++) { + int len; + if (strchr(*env, '=')) { + len = MultiByteToWideChar(CP_UTF8, + 0, + *env, + -1, + NULL, + 0); + if (len <= 0) { + return GetLastError(); + } + env_len += len; + env_block_count++; + } + } + + /* second pass: copy to UTF-16 environment block */ + dst_copy = (WCHAR*)uv__malloc(env_len * sizeof(WCHAR)); + if (!dst_copy) { + return ERROR_OUTOFMEMORY; + } + env_copy = alloca(env_block_count * sizeof(WCHAR*)); + + ptr = dst_copy; + ptr_copy = env_copy; + for (env = env_block; *env; env++) { + if (strchr(*env, '=')) { + len = MultiByteToWideChar(CP_UTF8, + 0, + *env, + -1, + ptr, + (int) (env_len - (ptr - dst_copy))); + if (len <= 0) { + DWORD err = GetLastError(); + uv__free(dst_copy); + return err; + } + *ptr_copy++ = ptr; + ptr += len; + } + } + *ptr_copy = NULL; - assert(env_len == ptr - dst_copy); ++ assert(env_len == (size_t) (ptr - dst_copy)); + + /* sort our (UTF-16) copy */ + qsort(env_copy, env_block_count-1, sizeof(wchar_t*), qsort_wcscmp); + + /* third pass: check for required variables */ + for (ptr_copy = env_copy, i = 0; i < n_required_vars; ) { + int cmp; + if (!*ptr_copy) { + cmp = -1; + } else { + cmp = env_strncmp(required_vars[i].wide_eq, + required_vars[i].len, + *ptr_copy); + } + if (cmp < 0) { + /* missing required var */ + var_size = GetEnvironmentVariableW(required_vars[i].wide, NULL, 0); + required_vars_value_len[i] = var_size; + if (var_size != 0) { + env_len += required_vars[i].len; + env_len += var_size; + } + i++; + } else { + ptr_copy++; + if (cmp == 0) + i++; + } + } + + /* final pass: copy, in sort order, and inserting required variables */ + dst = uv__malloc((1+env_len) * sizeof(WCHAR)); + if (!dst) { + uv__free(dst_copy); + return ERROR_OUTOFMEMORY; + } + + for (ptr = dst, ptr_copy = env_copy, i = 0; + *ptr_copy || i < n_required_vars; + ptr += len) { + int cmp; + if (i >= n_required_vars) { + cmp = 1; + } else if (!*ptr_copy) { + cmp = -1; + } else { + cmp = env_strncmp(required_vars[i].wide_eq, + required_vars[i].len, + *ptr_copy); + } + if (cmp < 0) { + /* missing required var */ + len = required_vars_value_len[i]; + if (len) { + wcscpy(ptr, required_vars[i].wide_eq); + ptr += required_vars[i].len; + var_size = GetEnvironmentVariableW(required_vars[i].wide, + ptr, + (int) (env_len - (ptr - dst))); - if (var_size != len-1) { /* race condition? */ ++ if (var_size != (DWORD) (len - 1)) { /* TODO: handle race condition? */ + uv_fatal_error(GetLastError(), "GetEnvironmentVariableW"); + } + } + i++; + } else { + /* copy var from env_block */ + len = wcslen(*ptr_copy) + 1; + wmemcpy(ptr, *ptr_copy, len); + ptr_copy++; + if (cmp == 0) + i++; + } + } + + /* Terminate with an extra NULL. */ - assert(env_len == (ptr - dst)); ++ assert(env_len == (size_t) (ptr - dst)); + *ptr = L'\0'; + + uv__free(dst_copy); + *dst_ptr = dst; + return 0; +} + +/* + * Attempt to find the value of the PATH environment variable in the child's + * preprocessed environment. + * + * If found, a pointer into `env` is returned. If not found, NULL is returned. + */ +static WCHAR* find_path(WCHAR *env) { + for (; env != NULL && *env != 0; env += wcslen(env) + 1) { - if (wcsncmp(env, L"PATH=", 5) == 0) ++ if ((env[0] == L'P' || env[0] == L'p') && ++ (env[1] == L'A' || env[1] == L'a') && ++ (env[2] == L'T' || env[2] == L't') && ++ (env[3] == L'H' || env[3] == L'h') && ++ (env[4] == L'=')) { + return &env[5]; ++ } + } + + return NULL; +} + +/* + * Called on Windows thread-pool thread to indicate that + * a child process has exited. + */ +static void CALLBACK exit_wait_callback(void* data, BOOLEAN didTimeout) { + uv_process_t* process = (uv_process_t*) data; + uv_loop_t* loop = process->loop; + + assert(didTimeout == FALSE); + assert(process); + assert(!process->exit_cb_pending); + + process->exit_cb_pending = 1; + + /* Post completed */ + POST_COMPLETION_FOR_REQ(loop, &process->exit_req); +} + + +/* Called on main thread after a child process has exited. */ +void uv_process_proc_exit(uv_loop_t* loop, uv_process_t* handle) { + int64_t exit_code; + DWORD status; + + assert(handle->exit_cb_pending); + handle->exit_cb_pending = 0; + - /* If we're closing, don't call the exit callback. Just schedule a close */ - /* callback now. */ - if (handle->flags & UV__HANDLE_CLOSING) { ++ /* If we're closing, don't call the exit callback. Just schedule a close ++ * callback now. */ ++ if (handle->flags & UV_HANDLE_CLOSING) { + uv_want_endgame(loop, (uv_handle_t*) handle); + return; + } + + /* Unregister from process notification. */ + if (handle->wait_handle != INVALID_HANDLE_VALUE) { + UnregisterWait(handle->wait_handle); + handle->wait_handle = INVALID_HANDLE_VALUE; + } + - /* Set the handle to inactive: no callbacks will be made after the exit */ - /* callback.*/ ++ /* Set the handle to inactive: no callbacks will be made after the exit ++ * callback. */ + uv__handle_stop(handle); + + if (GetExitCodeProcess(handle->process_handle, &status)) { + exit_code = status; + } else { - /* Unable to to obtain the exit code. This should never happen. */ ++ /* Unable to obtain the exit code. This should never happen. */ + exit_code = uv_translate_sys_error(GetLastError()); + } + + /* Fire the exit callback. */ + if (handle->exit_cb) { + handle->exit_cb(handle, exit_code, handle->exit_signal); + } +} + + +void uv_process_close(uv_loop_t* loop, uv_process_t* handle) { + uv__handle_closing(handle); + + if (handle->wait_handle != INVALID_HANDLE_VALUE) { - /* This blocks until either the wait was cancelled, or the callback has */ - /* completed. */ ++ /* This blocks until either the wait was cancelled, or the callback has ++ * completed. */ + BOOL r = UnregisterWaitEx(handle->wait_handle, INVALID_HANDLE_VALUE); + if (!r) { + /* This should never happen, and if it happens, we can't recover... */ + uv_fatal_error(GetLastError(), "UnregisterWaitEx"); + } + + handle->wait_handle = INVALID_HANDLE_VALUE; + } + + if (!handle->exit_cb_pending) { + uv_want_endgame(loop, (uv_handle_t*)handle); + } +} + + +void uv_process_endgame(uv_loop_t* loop, uv_process_t* handle) { + assert(!handle->exit_cb_pending); - assert(handle->flags & UV__HANDLE_CLOSING); ++ assert(handle->flags & UV_HANDLE_CLOSING); + assert(!(handle->flags & UV_HANDLE_CLOSED)); + + /* Clean-up the process handle. */ + CloseHandle(handle->process_handle); + + uv__handle_close(handle); +} + + +int uv_spawn(uv_loop_t* loop, + uv_process_t* process, + const uv_process_options_t* options) { + int i; + int err = 0; + WCHAR* path = NULL, *alloc_path = NULL; + BOOL result; + WCHAR* application_path = NULL, *application = NULL, *arguments = NULL, + *env = NULL, *cwd = NULL; + STARTUPINFOW startup; + PROCESS_INFORMATION info; + DWORD process_flags; + + uv_process_init(loop, process); + process->exit_cb = options->exit_cb; + + if (options->flags & (UV_PROCESS_SETGID | UV_PROCESS_SETUID)) { + return UV_ENOTSUP; + } + + if (options->file == NULL || + options->args == NULL) { + return UV_EINVAL; + } + + if (options->cpumask != NULL) { + if (options->cpumask_size < (size_t)uv_cpumask_size()) { + return UV_EINVAL; + } + } + + assert(options->file != NULL); + assert(!(options->flags & ~(UV_PROCESS_DETACHED | + UV_PROCESS_SETGID | + UV_PROCESS_SETUID | + UV_PROCESS_WINDOWS_HIDE | ++ UV_PROCESS_WINDOWS_HIDE_CONSOLE | ++ UV_PROCESS_WINDOWS_HIDE_GUI | + UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS))); + + err = uv_utf8_to_utf16_alloc(options->file, &application); + if (err) + goto done; + + err = make_program_args( + options->args, + options->flags & UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS, + &arguments); + if (err) + goto done; + + if (options->env) { + err = make_program_env(options->env, &env); + if (err) + goto done; + } + + if (options->cwd) { + /* Explicit cwd */ + err = uv_utf8_to_utf16_alloc(options->cwd, &cwd); + if (err) + goto done; + + } else { + /* Inherit cwd */ + DWORD cwd_len, r; + + cwd_len = GetCurrentDirectoryW(0, NULL); + if (!cwd_len) { + err = GetLastError(); + goto done; + } + + cwd = (WCHAR*) uv__malloc(cwd_len * sizeof(WCHAR)); + if (cwd == NULL) { + err = ERROR_OUTOFMEMORY; + goto done; + } + + r = GetCurrentDirectoryW(cwd_len, cwd); + if (r == 0 || r >= cwd_len) { + err = GetLastError(); + goto done; + } + } + + /* Get PATH environment variable. */ + path = find_path(env); + if (path == NULL) { + DWORD path_len, r; + + path_len = GetEnvironmentVariableW(L"PATH", NULL, 0); + if (path_len == 0) { + err = GetLastError(); + goto done; + } + + alloc_path = (WCHAR*) uv__malloc(path_len * sizeof(WCHAR)); + if (alloc_path == NULL) { + err = ERROR_OUTOFMEMORY; + goto done; + } + path = alloc_path; + + r = GetEnvironmentVariableW(L"PATH", path, path_len); + if (r == 0 || r >= path_len) { + err = GetLastError(); + goto done; + } + } + + err = uv__stdio_create(loop, options, &process->child_stdio_buffer); + if (err) + goto done; + + application_path = search_path(application, + cwd, + path); + if (application_path == NULL) { + /* Not found. */ + err = ERROR_FILE_NOT_FOUND; + goto done; + } + + startup.cb = sizeof(startup); + startup.lpReserved = NULL; + startup.lpDesktop = NULL; + startup.lpTitle = NULL; + startup.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW; + + startup.cbReserved2 = uv__stdio_size(process->child_stdio_buffer); + startup.lpReserved2 = (BYTE*) process->child_stdio_buffer; + + startup.hStdInput = uv__stdio_handle(process->child_stdio_buffer, 0); + startup.hStdOutput = uv__stdio_handle(process->child_stdio_buffer, 1); + startup.hStdError = uv__stdio_handle(process->child_stdio_buffer, 2); + + process_flags = CREATE_UNICODE_ENVIRONMENT; + - if (options->flags & UV_PROCESS_WINDOWS_HIDE) { ++ if ((options->flags & UV_PROCESS_WINDOWS_HIDE_CONSOLE) || ++ (options->flags & UV_PROCESS_WINDOWS_HIDE)) { + /* Avoid creating console window if stdio is not inherited. */ + for (i = 0; i < options->stdio_count; i++) { + if (options->stdio[i].flags & UV_INHERIT_FD) + break; + if (i == options->stdio_count - 1) + process_flags |= CREATE_NO_WINDOW; + } - ++ } ++ if ((options->flags & UV_PROCESS_WINDOWS_HIDE_GUI) || ++ (options->flags & UV_PROCESS_WINDOWS_HIDE)) { + /* Use SW_HIDE to avoid any potential process window. */ + startup.wShowWindow = SW_HIDE; + } else { + startup.wShowWindow = SW_SHOWDEFAULT; + } + + if (options->flags & UV_PROCESS_DETACHED) { + /* Note that we're not setting the CREATE_BREAKAWAY_FROM_JOB flag. That + * means that libuv might not let you create a fully daemonized process + * when run under job control. However the type of job control that libuv + * itself creates doesn't trickle down to subprocesses so they can still + * daemonize. + * + * A reason to not do this is that CREATE_BREAKAWAY_FROM_JOB makes the + * CreateProcess call fail if we're under job control that doesn't allow + * breakaway. + */ + process_flags |= DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP; + } + + if (options->cpumask != NULL) { + /* Create the child in a suspended state so we have a chance to set + its process affinity before it runs. */ + process_flags |= CREATE_SUSPENDED; + } + + if (!CreateProcessW(application_path, + arguments, + NULL, + NULL, + 1, + process_flags, + env, + cwd, + &startup, + &info)) { + /* CreateProcessW failed. */ + err = GetLastError(); + goto done; + } + + if (options->cpumask != NULL) { + /* The child is currently suspended. Set its process affinity + or terminate it if we can't. */ + int i; + int cpumasksize; + DWORD_PTR sysmask; + DWORD_PTR oldmask; + DWORD_PTR newmask; + + cpumasksize = uv_cpumask_size(); + + if (!GetProcessAffinityMask(info.hProcess, &oldmask, &sysmask)) { + err = GetLastError(); + TerminateProcess(info.hProcess, 1); + goto done; + } + + newmask = 0; + for (i = 0; i < cpumasksize; i++) { + if (options->cpumask[i]) { + if (oldmask & (((DWORD_PTR)1) << i)) { + newmask |= ((DWORD_PTR)1) << i; + } else { + err = UV_EINVAL; + TerminateProcess(info.hProcess, 1); + goto done; + } + } + } + + if (!SetProcessAffinityMask(info.hProcess, newmask)) { + err = GetLastError(); + TerminateProcess(info.hProcess, 1); + goto done; + } + + /* The process affinity of the child is set. Let it run. */ + if (ResumeThread(info.hThread) == ((DWORD)-1)) { + err = GetLastError(); + TerminateProcess(info.hProcess, 1); + goto done; + } + } + - /* Spawn succeeded */ - /* Beyond this point, failure is reported asynchronously. */ ++ /* Spawn succeeded. Beyond this point, failure is reported asynchronously. */ + + process->process_handle = info.hProcess; + process->pid = info.dwProcessId; + - /* If the process isn't spawned as detached, assign to the global job */ - /* object so windows will kill it when the parent process dies. */ ++ /* If the process isn't spawned as detached, assign to the global job object ++ * so windows will kill it when the parent process dies. */ + if (!(options->flags & UV_PROCESS_DETACHED)) { + uv_once(&uv_global_job_handle_init_guard_, uv__init_global_job_handle); + + if (!AssignProcessToJobObject(uv_global_job_handle_, info.hProcess)) { + /* AssignProcessToJobObject might fail if this process is under job + * control and the job doesn't have the + * JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK flag set, on a Windows version + * that doesn't support nested jobs. + * + * When that happens we just swallow the error and continue without + * establishing a kill-child-on-parent-exit relationship, otherwise + * there would be no way for libuv applications run under job control + * to spawn processes at all. + */ + DWORD err = GetLastError(); + if (err != ERROR_ACCESS_DENIED) + uv_fatal_error(err, "AssignProcessToJobObject"); + } + } + + /* Set IPC pid to all IPC pipes. */ + for (i = 0; i < options->stdio_count; i++) { + const uv_stdio_container_t* fdopt = &options->stdio[i]; + if (fdopt->flags & UV_CREATE_PIPE && + fdopt->data.stream->type == UV_NAMED_PIPE && + ((uv_pipe_t*) fdopt->data.stream)->ipc) { - ((uv_pipe_t*) fdopt->data.stream)->pipe.conn.ipc_pid = info.dwProcessId; ++ ((uv_pipe_t*) fdopt->data.stream)->pipe.conn.ipc_remote_pid = ++ info.dwProcessId; + } + } + + /* Setup notifications for when the child process exits. */ + result = RegisterWaitForSingleObject(&process->wait_handle, + process->process_handle, exit_wait_callback, (void*)process, INFINITE, + WT_EXECUTEINWAITTHREAD | WT_EXECUTEONLYONCE); + if (!result) { + uv_fatal_error(GetLastError(), "RegisterWaitForSingleObject"); + } + + CloseHandle(info.hThread); + + assert(!err); + - /* Make the handle active. It will remain active until the exit callback */ - /* is made or the handle is closed, whichever happens first. */ ++ /* Make the handle active. It will remain active until the exit callback is ++ * made or the handle is closed, whichever happens first. */ + uv__handle_start(process); + + /* Cleanup, whether we succeeded or failed. */ + done: + uv__free(application); + uv__free(application_path); + uv__free(arguments); + uv__free(cwd); + uv__free(env); + uv__free(alloc_path); + + if (process->child_stdio_buffer != NULL) { + /* Clean up child stdio handles. */ + uv__stdio_destroy(process->child_stdio_buffer); + process->child_stdio_buffer = NULL; + } + + return uv_translate_sys_error(err); +} + + +static int uv__kill(HANDLE process_handle, int signum) { + if (signum < 0 || signum >= NSIG) { + return UV_EINVAL; + } + + switch (signum) { + case SIGTERM: + case SIGKILL: + case SIGINT: { - /* Unconditionally terminate the process. On Windows, killed processes */ - /* normally return 1. */ ++ /* Unconditionally terminate the process. On Windows, killed processes ++ * normally return 1. */ + DWORD status; + int err; + + if (TerminateProcess(process_handle, 1)) + return 0; + - /* If the process already exited before TerminateProcess was called, */ - /* TerminateProcess will fail with ERROR_ACCESS_DENIED. */ ++ /* If the process already exited before TerminateProcess was called,. ++ * TerminateProcess will fail with ERROR_ACCESS_DENIED. */ + err = GetLastError(); + if (err == ERROR_ACCESS_DENIED && + GetExitCodeProcess(process_handle, &status) && + status != STILL_ACTIVE) { + return UV_ESRCH; + } + + return uv_translate_sys_error(err); + } + + case 0: { + /* Health check: is the process still alive? */ + DWORD status; + + if (!GetExitCodeProcess(process_handle, &status)) + return uv_translate_sys_error(GetLastError()); + + if (status != STILL_ACTIVE) + return UV_ESRCH; + + return 0; + } + + default: + /* Unsupported signal. */ + return UV_ENOSYS; + } +} + + +int uv_process_kill(uv_process_t* process, int signum) { + int err; + + if (process->process_handle == INVALID_HANDLE_VALUE) { + return UV_EINVAL; + } + + err = uv__kill(process->process_handle, signum); + if (err) { + return err; /* err is already translated. */ + } + + process->exit_signal = signum; + + return 0; +} + + +int uv_kill(int pid, int signum) { + int err; + HANDLE process_handle; + + if (pid == 0) { + process_handle = GetCurrentProcess(); + } else { + process_handle = OpenProcess(PROCESS_TERMINATE | PROCESS_QUERY_INFORMATION, + FALSE, + pid); + } + + if (process_handle == NULL) { + err = GetLastError(); + if (err == ERROR_INVALID_PARAMETER) { + return UV_ESRCH; + } else { + return uv_translate_sys_error(err); + } + } + + err = uv__kill(process_handle, signum); + CloseHandle(process_handle); + + return err; /* err is already translated. */ +} diff --cc Utilities/cmlibuv/src/win/winapi.h index ae384b7,0000000..1e49b57 mode 100644,000000..100644 --- a/Utilities/cmlibuv/src/win/winapi.h +++ b/Utilities/cmlibuv/src/win/winapi.h @@@ -1,4802 -1,0 +1,4740 @@@ +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef UV_WIN_WINAPI_H_ +#define UV_WIN_WINAPI_H_ + +#include + + +/* + * Ntdll headers + */ +#ifndef STATUS_SEVERITY_SUCCESS +# define STATUS_SEVERITY_SUCCESS 0x0 +#endif + +#ifndef STATUS_SEVERITY_INFORMATIONAL +# define STATUS_SEVERITY_INFORMATIONAL 0x1 +#endif + +#ifndef STATUS_SEVERITY_WARNING +# define STATUS_SEVERITY_WARNING 0x2 +#endif + +#ifndef STATUS_SEVERITY_ERROR +# define STATUS_SEVERITY_ERROR 0x3 +#endif + +#ifndef FACILITY_NTWIN32 +# define FACILITY_NTWIN32 0x7 +#endif + +#ifndef NT_SUCCESS +# define NT_SUCCESS(status) (((NTSTATUS) (status)) >= 0) +#endif + +#ifndef NT_INFORMATION +# define NT_INFORMATION(status) ((((ULONG) (status)) >> 30) == 1) +#endif + +#ifndef NT_WARNING +# define NT_WARNING(status) ((((ULONG) (status)) >> 30) == 2) +#endif + +#ifndef NT_ERROR +# define NT_ERROR(status) ((((ULONG) (status)) >> 30) == 3) +#endif + +#ifndef STATUS_SUCCESS +# define STATUS_SUCCESS ((NTSTATUS) 0x00000000L) +#endif + +#ifndef STATUS_WAIT_0 +# define STATUS_WAIT_0 ((NTSTATUS) 0x00000000L) +#endif + +#ifndef STATUS_WAIT_1 +# define STATUS_WAIT_1 ((NTSTATUS) 0x00000001L) +#endif + +#ifndef STATUS_WAIT_2 +# define STATUS_WAIT_2 ((NTSTATUS) 0x00000002L) +#endif + +#ifndef STATUS_WAIT_3 +# define STATUS_WAIT_3 ((NTSTATUS) 0x00000003L) +#endif + +#ifndef STATUS_WAIT_63 +# define STATUS_WAIT_63 ((NTSTATUS) 0x0000003FL) +#endif + +#ifndef STATUS_ABANDONED +# define STATUS_ABANDONED ((NTSTATUS) 0x00000080L) +#endif + +#ifndef STATUS_ABANDONED_WAIT_0 +# define STATUS_ABANDONED_WAIT_0 ((NTSTATUS) 0x00000080L) +#endif + +#ifndef STATUS_ABANDONED_WAIT_63 +# define STATUS_ABANDONED_WAIT_63 ((NTSTATUS) 0x000000BFL) +#endif + +#ifndef STATUS_USER_APC +# define STATUS_USER_APC ((NTSTATUS) 0x000000C0L) +#endif + +#ifndef STATUS_KERNEL_APC +# define STATUS_KERNEL_APC ((NTSTATUS) 0x00000100L) +#endif + +#ifndef STATUS_ALERTED +# define STATUS_ALERTED ((NTSTATUS) 0x00000101L) +#endif + +#ifndef STATUS_TIMEOUT +# define STATUS_TIMEOUT ((NTSTATUS) 0x00000102L) +#endif + +#ifndef STATUS_PENDING +# define STATUS_PENDING ((NTSTATUS) 0x00000103L) +#endif + +#ifndef STATUS_REPARSE +# define STATUS_REPARSE ((NTSTATUS) 0x00000104L) +#endif + +#ifndef STATUS_MORE_ENTRIES +# define STATUS_MORE_ENTRIES ((NTSTATUS) 0x00000105L) +#endif + +#ifndef STATUS_NOT_ALL_ASSIGNED +# define STATUS_NOT_ALL_ASSIGNED ((NTSTATUS) 0x00000106L) +#endif + +#ifndef STATUS_SOME_NOT_MAPPED +# define STATUS_SOME_NOT_MAPPED ((NTSTATUS) 0x00000107L) +#endif + +#ifndef STATUS_OPLOCK_BREAK_IN_PROGRESS +# define STATUS_OPLOCK_BREAK_IN_PROGRESS ((NTSTATUS) 0x00000108L) +#endif + +#ifndef STATUS_VOLUME_MOUNTED +# define STATUS_VOLUME_MOUNTED ((NTSTATUS) 0x00000109L) +#endif + +#ifndef STATUS_RXACT_COMMITTED +# define STATUS_RXACT_COMMITTED ((NTSTATUS) 0x0000010AL) +#endif + +#ifndef STATUS_NOTIFY_CLEANUP +# define STATUS_NOTIFY_CLEANUP ((NTSTATUS) 0x0000010BL) +#endif + +#ifndef STATUS_NOTIFY_ENUM_DIR +# define STATUS_NOTIFY_ENUM_DIR ((NTSTATUS) 0x0000010CL) +#endif + +#ifndef STATUS_NO_QUOTAS_FOR_ACCOUNT +# define STATUS_NO_QUOTAS_FOR_ACCOUNT ((NTSTATUS) 0x0000010DL) +#endif + +#ifndef STATUS_PRIMARY_TRANSPORT_CONNECT_FAILED +# define STATUS_PRIMARY_TRANSPORT_CONNECT_FAILED ((NTSTATUS) 0x0000010EL) +#endif + +#ifndef STATUS_PAGE_FAULT_TRANSITION +# define STATUS_PAGE_FAULT_TRANSITION ((NTSTATUS) 0x00000110L) +#endif + +#ifndef STATUS_PAGE_FAULT_DEMAND_ZERO +# define STATUS_PAGE_FAULT_DEMAND_ZERO ((NTSTATUS) 0x00000111L) +#endif + +#ifndef STATUS_PAGE_FAULT_COPY_ON_WRITE +# define STATUS_PAGE_FAULT_COPY_ON_WRITE ((NTSTATUS) 0x00000112L) +#endif + +#ifndef STATUS_PAGE_FAULT_GUARD_PAGE +# define STATUS_PAGE_FAULT_GUARD_PAGE ((NTSTATUS) 0x00000113L) +#endif + +#ifndef STATUS_PAGE_FAULT_PAGING_FILE +# define STATUS_PAGE_FAULT_PAGING_FILE ((NTSTATUS) 0x00000114L) +#endif + +#ifndef STATUS_CACHE_PAGE_LOCKED +# define STATUS_CACHE_PAGE_LOCKED ((NTSTATUS) 0x00000115L) +#endif + +#ifndef STATUS_CRASH_DUMP +# define STATUS_CRASH_DUMP ((NTSTATUS) 0x00000116L) +#endif + +#ifndef STATUS_BUFFER_ALL_ZEROS +# define STATUS_BUFFER_ALL_ZEROS ((NTSTATUS) 0x00000117L) +#endif + +#ifndef STATUS_REPARSE_OBJECT +# define STATUS_REPARSE_OBJECT ((NTSTATUS) 0x00000118L) +#endif + +#ifndef STATUS_RESOURCE_REQUIREMENTS_CHANGED +# define STATUS_RESOURCE_REQUIREMENTS_CHANGED ((NTSTATUS) 0x00000119L) +#endif + +#ifndef STATUS_TRANSLATION_COMPLETE +# define STATUS_TRANSLATION_COMPLETE ((NTSTATUS) 0x00000120L) +#endif + +#ifndef STATUS_DS_MEMBERSHIP_EVALUATED_LOCALLY +# define STATUS_DS_MEMBERSHIP_EVALUATED_LOCALLY ((NTSTATUS) 0x00000121L) +#endif + +#ifndef STATUS_NOTHING_TO_TERMINATE +# define STATUS_NOTHING_TO_TERMINATE ((NTSTATUS) 0x00000122L) +#endif + +#ifndef STATUS_PROCESS_NOT_IN_JOB +# define STATUS_PROCESS_NOT_IN_JOB ((NTSTATUS) 0x00000123L) +#endif + +#ifndef STATUS_PROCESS_IN_JOB +# define STATUS_PROCESS_IN_JOB ((NTSTATUS) 0x00000124L) +#endif + +#ifndef STATUS_VOLSNAP_HIBERNATE_READY +# define STATUS_VOLSNAP_HIBERNATE_READY ((NTSTATUS) 0x00000125L) +#endif + +#ifndef STATUS_FSFILTER_OP_COMPLETED_SUCCESSFULLY +# define STATUS_FSFILTER_OP_COMPLETED_SUCCESSFULLY ((NTSTATUS) 0x00000126L) +#endif + +#ifndef STATUS_INTERRUPT_VECTOR_ALREADY_CONNECTED +# define STATUS_INTERRUPT_VECTOR_ALREADY_CONNECTED ((NTSTATUS) 0x00000127L) +#endif + +#ifndef STATUS_INTERRUPT_STILL_CONNECTED +# define STATUS_INTERRUPT_STILL_CONNECTED ((NTSTATUS) 0x00000128L) +#endif + +#ifndef STATUS_PROCESS_CLONED +# define STATUS_PROCESS_CLONED ((NTSTATUS) 0x00000129L) +#endif + +#ifndef STATUS_FILE_LOCKED_WITH_ONLY_READERS +# define STATUS_FILE_LOCKED_WITH_ONLY_READERS ((NTSTATUS) 0x0000012AL) +#endif + +#ifndef STATUS_FILE_LOCKED_WITH_WRITERS +# define STATUS_FILE_LOCKED_WITH_WRITERS ((NTSTATUS) 0x0000012BL) +#endif + +#ifndef STATUS_RESOURCEMANAGER_READ_ONLY +# define STATUS_RESOURCEMANAGER_READ_ONLY ((NTSTATUS) 0x00000202L) +#endif + +#ifndef STATUS_RING_PREVIOUSLY_EMPTY +# define STATUS_RING_PREVIOUSLY_EMPTY ((NTSTATUS) 0x00000210L) +#endif + +#ifndef STATUS_RING_PREVIOUSLY_FULL +# define STATUS_RING_PREVIOUSLY_FULL ((NTSTATUS) 0x00000211L) +#endif + +#ifndef STATUS_RING_PREVIOUSLY_ABOVE_QUOTA +# define STATUS_RING_PREVIOUSLY_ABOVE_QUOTA ((NTSTATUS) 0x00000212L) +#endif + +#ifndef STATUS_RING_NEWLY_EMPTY +# define STATUS_RING_NEWLY_EMPTY ((NTSTATUS) 0x00000213L) +#endif + +#ifndef STATUS_RING_SIGNAL_OPPOSITE_ENDPOINT +# define STATUS_RING_SIGNAL_OPPOSITE_ENDPOINT ((NTSTATUS) 0x00000214L) +#endif + +#ifndef STATUS_OPLOCK_SWITCHED_TO_NEW_HANDLE +# define STATUS_OPLOCK_SWITCHED_TO_NEW_HANDLE ((NTSTATUS) 0x00000215L) +#endif + +#ifndef STATUS_OPLOCK_HANDLE_CLOSED +# define STATUS_OPLOCK_HANDLE_CLOSED ((NTSTATUS) 0x00000216L) +#endif + +#ifndef STATUS_WAIT_FOR_OPLOCK +# define STATUS_WAIT_FOR_OPLOCK ((NTSTATUS) 0x00000367L) +#endif + +#ifndef STATUS_OBJECT_NAME_EXISTS +# define STATUS_OBJECT_NAME_EXISTS ((NTSTATUS) 0x40000000L) +#endif + +#ifndef STATUS_THREAD_WAS_SUSPENDED +# define STATUS_THREAD_WAS_SUSPENDED ((NTSTATUS) 0x40000001L) +#endif + +#ifndef STATUS_WORKING_SET_LIMIT_RANGE +# define STATUS_WORKING_SET_LIMIT_RANGE ((NTSTATUS) 0x40000002L) +#endif + +#ifndef STATUS_IMAGE_NOT_AT_BASE +# define STATUS_IMAGE_NOT_AT_BASE ((NTSTATUS) 0x40000003L) +#endif + +#ifndef STATUS_RXACT_STATE_CREATED +# define STATUS_RXACT_STATE_CREATED ((NTSTATUS) 0x40000004L) +#endif + +#ifndef STATUS_SEGMENT_NOTIFICATION +# define STATUS_SEGMENT_NOTIFICATION ((NTSTATUS) 0x40000005L) +#endif + +#ifndef STATUS_LOCAL_USER_SESSION_KEY +# define STATUS_LOCAL_USER_SESSION_KEY ((NTSTATUS) 0x40000006L) +#endif + +#ifndef STATUS_BAD_CURRENT_DIRECTORY +# define STATUS_BAD_CURRENT_DIRECTORY ((NTSTATUS) 0x40000007L) +#endif + +#ifndef STATUS_SERIAL_MORE_WRITES +# define STATUS_SERIAL_MORE_WRITES ((NTSTATUS) 0x40000008L) +#endif + +#ifndef STATUS_REGISTRY_RECOVERED +# define STATUS_REGISTRY_RECOVERED ((NTSTATUS) 0x40000009L) +#endif + +#ifndef STATUS_FT_READ_RECOVERY_FROM_BACKUP +# define STATUS_FT_READ_RECOVERY_FROM_BACKUP ((NTSTATUS) 0x4000000AL) +#endif + +#ifndef STATUS_FT_WRITE_RECOVERY +# define STATUS_FT_WRITE_RECOVERY ((NTSTATUS) 0x4000000BL) +#endif + +#ifndef STATUS_SERIAL_COUNTER_TIMEOUT +# define STATUS_SERIAL_COUNTER_TIMEOUT ((NTSTATUS) 0x4000000CL) +#endif + +#ifndef STATUS_NULL_LM_PASSWORD +# define STATUS_NULL_LM_PASSWORD ((NTSTATUS) 0x4000000DL) +#endif + +#ifndef STATUS_IMAGE_MACHINE_TYPE_MISMATCH +# define STATUS_IMAGE_MACHINE_TYPE_MISMATCH ((NTSTATUS) 0x4000000EL) +#endif + +#ifndef STATUS_RECEIVE_PARTIAL +# define STATUS_RECEIVE_PARTIAL ((NTSTATUS) 0x4000000FL) +#endif + +#ifndef STATUS_RECEIVE_EXPEDITED +# define STATUS_RECEIVE_EXPEDITED ((NTSTATUS) 0x40000010L) +#endif + +#ifndef STATUS_RECEIVE_PARTIAL_EXPEDITED +# define STATUS_RECEIVE_PARTIAL_EXPEDITED ((NTSTATUS) 0x40000011L) +#endif + +#ifndef STATUS_EVENT_DONE +# define STATUS_EVENT_DONE ((NTSTATUS) 0x40000012L) +#endif + +#ifndef STATUS_EVENT_PENDING +# define STATUS_EVENT_PENDING ((NTSTATUS) 0x40000013L) +#endif + +#ifndef STATUS_CHECKING_FILE_SYSTEM +# define STATUS_CHECKING_FILE_SYSTEM ((NTSTATUS) 0x40000014L) +#endif + +#ifndef STATUS_FATAL_APP_EXIT +# define STATUS_FATAL_APP_EXIT ((NTSTATUS) 0x40000015L) +#endif + +#ifndef STATUS_PREDEFINED_HANDLE +# define STATUS_PREDEFINED_HANDLE ((NTSTATUS) 0x40000016L) +#endif + +#ifndef STATUS_WAS_UNLOCKED +# define STATUS_WAS_UNLOCKED ((NTSTATUS) 0x40000017L) +#endif + +#ifndef STATUS_SERVICE_NOTIFICATION +# define STATUS_SERVICE_NOTIFICATION ((NTSTATUS) 0x40000018L) +#endif + +#ifndef STATUS_WAS_LOCKED +# define STATUS_WAS_LOCKED ((NTSTATUS) 0x40000019L) +#endif + +#ifndef STATUS_LOG_HARD_ERROR +# define STATUS_LOG_HARD_ERROR ((NTSTATUS) 0x4000001AL) +#endif + +#ifndef STATUS_ALREADY_WIN32 +# define STATUS_ALREADY_WIN32 ((NTSTATUS) 0x4000001BL) +#endif + +#ifndef STATUS_WX86_UNSIMULATE +# define STATUS_WX86_UNSIMULATE ((NTSTATUS) 0x4000001CL) +#endif + +#ifndef STATUS_WX86_CONTINUE +# define STATUS_WX86_CONTINUE ((NTSTATUS) 0x4000001DL) +#endif + +#ifndef STATUS_WX86_SINGLE_STEP +# define STATUS_WX86_SINGLE_STEP ((NTSTATUS) 0x4000001EL) +#endif + +#ifndef STATUS_WX86_BREAKPOINT +# define STATUS_WX86_BREAKPOINT ((NTSTATUS) 0x4000001FL) +#endif + +#ifndef STATUS_WX86_EXCEPTION_CONTINUE +# define STATUS_WX86_EXCEPTION_CONTINUE ((NTSTATUS) 0x40000020L) +#endif + +#ifndef STATUS_WX86_EXCEPTION_LASTCHANCE +# define STATUS_WX86_EXCEPTION_LASTCHANCE ((NTSTATUS) 0x40000021L) +#endif + +#ifndef STATUS_WX86_EXCEPTION_CHAIN +# define STATUS_WX86_EXCEPTION_CHAIN ((NTSTATUS) 0x40000022L) +#endif + +#ifndef STATUS_IMAGE_MACHINE_TYPE_MISMATCH_EXE +# define STATUS_IMAGE_MACHINE_TYPE_MISMATCH_EXE ((NTSTATUS) 0x40000023L) +#endif + +#ifndef STATUS_NO_YIELD_PERFORMED +# define STATUS_NO_YIELD_PERFORMED ((NTSTATUS) 0x40000024L) +#endif + +#ifndef STATUS_TIMER_RESUME_IGNORED +# define STATUS_TIMER_RESUME_IGNORED ((NTSTATUS) 0x40000025L) +#endif + +#ifndef STATUS_ARBITRATION_UNHANDLED +# define STATUS_ARBITRATION_UNHANDLED ((NTSTATUS) 0x40000026L) +#endif + +#ifndef STATUS_CARDBUS_NOT_SUPPORTED +# define STATUS_CARDBUS_NOT_SUPPORTED ((NTSTATUS) 0x40000027L) +#endif + +#ifndef STATUS_WX86_CREATEWX86TIB +# define STATUS_WX86_CREATEWX86TIB ((NTSTATUS) 0x40000028L) +#endif + +#ifndef STATUS_MP_PROCESSOR_MISMATCH +# define STATUS_MP_PROCESSOR_MISMATCH ((NTSTATUS) 0x40000029L) +#endif + +#ifndef STATUS_HIBERNATED +# define STATUS_HIBERNATED ((NTSTATUS) 0x4000002AL) +#endif + +#ifndef STATUS_RESUME_HIBERNATION +# define STATUS_RESUME_HIBERNATION ((NTSTATUS) 0x4000002BL) +#endif + +#ifndef STATUS_FIRMWARE_UPDATED +# define STATUS_FIRMWARE_UPDATED ((NTSTATUS) 0x4000002CL) +#endif + +#ifndef STATUS_DRIVERS_LEAKING_LOCKED_PAGES +# define STATUS_DRIVERS_LEAKING_LOCKED_PAGES ((NTSTATUS) 0x4000002DL) +#endif + +#ifndef STATUS_MESSAGE_RETRIEVED +# define STATUS_MESSAGE_RETRIEVED ((NTSTATUS) 0x4000002EL) +#endif + +#ifndef STATUS_SYSTEM_POWERSTATE_TRANSITION +# define STATUS_SYSTEM_POWERSTATE_TRANSITION ((NTSTATUS) 0x4000002FL) +#endif + +#ifndef STATUS_ALPC_CHECK_COMPLETION_LIST +# define STATUS_ALPC_CHECK_COMPLETION_LIST ((NTSTATUS) 0x40000030L) +#endif + +#ifndef STATUS_SYSTEM_POWERSTATE_COMPLEX_TRANSITION +# define STATUS_SYSTEM_POWERSTATE_COMPLEX_TRANSITION ((NTSTATUS) 0x40000031L) +#endif + +#ifndef STATUS_ACCESS_AUDIT_BY_POLICY +# define STATUS_ACCESS_AUDIT_BY_POLICY ((NTSTATUS) 0x40000032L) +#endif + +#ifndef STATUS_ABANDON_HIBERFILE +# define STATUS_ABANDON_HIBERFILE ((NTSTATUS) 0x40000033L) +#endif + +#ifndef STATUS_BIZRULES_NOT_ENABLED +# define STATUS_BIZRULES_NOT_ENABLED ((NTSTATUS) 0x40000034L) +#endif + +#ifndef STATUS_GUARD_PAGE_VIOLATION +# define STATUS_GUARD_PAGE_VIOLATION ((NTSTATUS) 0x80000001L) +#endif + +#ifndef STATUS_DATATYPE_MISALIGNMENT +# define STATUS_DATATYPE_MISALIGNMENT ((NTSTATUS) 0x80000002L) +#endif + +#ifndef STATUS_BREAKPOINT +# define STATUS_BREAKPOINT ((NTSTATUS) 0x80000003L) +#endif + +#ifndef STATUS_SINGLE_STEP +# define STATUS_SINGLE_STEP ((NTSTATUS) 0x80000004L) +#endif + +#ifndef STATUS_BUFFER_OVERFLOW +# define STATUS_BUFFER_OVERFLOW ((NTSTATUS) 0x80000005L) +#endif + +#ifndef STATUS_NO_MORE_FILES +# define STATUS_NO_MORE_FILES ((NTSTATUS) 0x80000006L) +#endif + +#ifndef STATUS_WAKE_SYSTEM_DEBUGGER +# define STATUS_WAKE_SYSTEM_DEBUGGER ((NTSTATUS) 0x80000007L) +#endif + +#ifndef STATUS_HANDLES_CLOSED +# define STATUS_HANDLES_CLOSED ((NTSTATUS) 0x8000000AL) +#endif + +#ifndef STATUS_NO_INHERITANCE +# define STATUS_NO_INHERITANCE ((NTSTATUS) 0x8000000BL) +#endif + +#ifndef STATUS_GUID_SUBSTITUTION_MADE +# define STATUS_GUID_SUBSTITUTION_MADE ((NTSTATUS) 0x8000000CL) +#endif + +#ifndef STATUS_PARTIAL_COPY +# define STATUS_PARTIAL_COPY ((NTSTATUS) 0x8000000DL) +#endif + +#ifndef STATUS_DEVICE_PAPER_EMPTY +# define STATUS_DEVICE_PAPER_EMPTY ((NTSTATUS) 0x8000000EL) +#endif + +#ifndef STATUS_DEVICE_POWERED_OFF +# define STATUS_DEVICE_POWERED_OFF ((NTSTATUS) 0x8000000FL) +#endif + +#ifndef STATUS_DEVICE_OFF_LINE +# define STATUS_DEVICE_OFF_LINE ((NTSTATUS) 0x80000010L) +#endif + +#ifndef STATUS_DEVICE_BUSY +# define STATUS_DEVICE_BUSY ((NTSTATUS) 0x80000011L) +#endif + +#ifndef STATUS_NO_MORE_EAS +# define STATUS_NO_MORE_EAS ((NTSTATUS) 0x80000012L) +#endif + +#ifndef STATUS_INVALID_EA_NAME +# define STATUS_INVALID_EA_NAME ((NTSTATUS) 0x80000013L) +#endif + +#ifndef STATUS_EA_LIST_INCONSISTENT +# define STATUS_EA_LIST_INCONSISTENT ((NTSTATUS) 0x80000014L) +#endif + +#ifndef STATUS_INVALID_EA_FLAG +# define STATUS_INVALID_EA_FLAG ((NTSTATUS) 0x80000015L) +#endif + +#ifndef STATUS_VERIFY_REQUIRED +# define STATUS_VERIFY_REQUIRED ((NTSTATUS) 0x80000016L) +#endif + +#ifndef STATUS_EXTRANEOUS_INFORMATION +# define STATUS_EXTRANEOUS_INFORMATION ((NTSTATUS) 0x80000017L) +#endif + +#ifndef STATUS_RXACT_COMMIT_NECESSARY +# define STATUS_RXACT_COMMIT_NECESSARY ((NTSTATUS) 0x80000018L) +#endif + +#ifndef STATUS_NO_MORE_ENTRIES +# define STATUS_NO_MORE_ENTRIES ((NTSTATUS) 0x8000001AL) +#endif + +#ifndef STATUS_FILEMARK_DETECTED +# define STATUS_FILEMARK_DETECTED ((NTSTATUS) 0x8000001BL) +#endif + +#ifndef STATUS_MEDIA_CHANGED +# define STATUS_MEDIA_CHANGED ((NTSTATUS) 0x8000001CL) +#endif + +#ifndef STATUS_BUS_RESET +# define STATUS_BUS_RESET ((NTSTATUS) 0x8000001DL) +#endif + +#ifndef STATUS_END_OF_MEDIA +# define STATUS_END_OF_MEDIA ((NTSTATUS) 0x8000001EL) +#endif + +#ifndef STATUS_BEGINNING_OF_MEDIA +# define STATUS_BEGINNING_OF_MEDIA ((NTSTATUS) 0x8000001FL) +#endif + +#ifndef STATUS_MEDIA_CHECK +# define STATUS_MEDIA_CHECK ((NTSTATUS) 0x80000020L) +#endif + +#ifndef STATUS_SETMARK_DETECTED +# define STATUS_SETMARK_DETECTED ((NTSTATUS) 0x80000021L) +#endif + +#ifndef STATUS_NO_DATA_DETECTED +# define STATUS_NO_DATA_DETECTED ((NTSTATUS) 0x80000022L) +#endif + +#ifndef STATUS_REDIRECTOR_HAS_OPEN_HANDLES +# define STATUS_REDIRECTOR_HAS_OPEN_HANDLES ((NTSTATUS) 0x80000023L) +#endif + +#ifndef STATUS_SERVER_HAS_OPEN_HANDLES +# define STATUS_SERVER_HAS_OPEN_HANDLES ((NTSTATUS) 0x80000024L) +#endif + +#ifndef STATUS_ALREADY_DISCONNECTED +# define STATUS_ALREADY_DISCONNECTED ((NTSTATUS) 0x80000025L) +#endif + +#ifndef STATUS_LONGJUMP +# define STATUS_LONGJUMP ((NTSTATUS) 0x80000026L) +#endif + +#ifndef STATUS_CLEANER_CARTRIDGE_INSTALLED +# define STATUS_CLEANER_CARTRIDGE_INSTALLED ((NTSTATUS) 0x80000027L) +#endif + +#ifndef STATUS_PLUGPLAY_QUERY_VETOED +# define STATUS_PLUGPLAY_QUERY_VETOED ((NTSTATUS) 0x80000028L) +#endif + +#ifndef STATUS_UNWIND_CONSOLIDATE +# define STATUS_UNWIND_CONSOLIDATE ((NTSTATUS) 0x80000029L) +#endif + +#ifndef STATUS_REGISTRY_HIVE_RECOVERED +# define STATUS_REGISTRY_HIVE_RECOVERED ((NTSTATUS) 0x8000002AL) +#endif + +#ifndef STATUS_DLL_MIGHT_BE_INSECURE +# define STATUS_DLL_MIGHT_BE_INSECURE ((NTSTATUS) 0x8000002BL) +#endif + +#ifndef STATUS_DLL_MIGHT_BE_INCOMPATIBLE +# define STATUS_DLL_MIGHT_BE_INCOMPATIBLE ((NTSTATUS) 0x8000002CL) +#endif + +#ifndef STATUS_STOPPED_ON_SYMLINK +# define STATUS_STOPPED_ON_SYMLINK ((NTSTATUS) 0x8000002DL) +#endif + +#ifndef STATUS_CANNOT_GRANT_REQUESTED_OPLOCK +# define STATUS_CANNOT_GRANT_REQUESTED_OPLOCK ((NTSTATUS) 0x8000002EL) +#endif + +#ifndef STATUS_NO_ACE_CONDITION +# define STATUS_NO_ACE_CONDITION ((NTSTATUS) 0x8000002FL) +#endif + +#ifndef STATUS_UNSUCCESSFUL +# define STATUS_UNSUCCESSFUL ((NTSTATUS) 0xC0000001L) +#endif + +#ifndef STATUS_NOT_IMPLEMENTED +# define STATUS_NOT_IMPLEMENTED ((NTSTATUS) 0xC0000002L) +#endif + +#ifndef STATUS_INVALID_INFO_CLASS +# define STATUS_INVALID_INFO_CLASS ((NTSTATUS) 0xC0000003L) +#endif + +#ifndef STATUS_INFO_LENGTH_MISMATCH +# define STATUS_INFO_LENGTH_MISMATCH ((NTSTATUS) 0xC0000004L) +#endif + +#ifndef STATUS_ACCESS_VIOLATION +# define STATUS_ACCESS_VIOLATION ((NTSTATUS) 0xC0000005L) +#endif + +#ifndef STATUS_IN_PAGE_ERROR +# define STATUS_IN_PAGE_ERROR ((NTSTATUS) 0xC0000006L) +#endif + +#ifndef STATUS_PAGEFILE_QUOTA +# define STATUS_PAGEFILE_QUOTA ((NTSTATUS) 0xC0000007L) +#endif + +#ifndef STATUS_INVALID_HANDLE +# define STATUS_INVALID_HANDLE ((NTSTATUS) 0xC0000008L) +#endif + +#ifndef STATUS_BAD_INITIAL_STACK +# define STATUS_BAD_INITIAL_STACK ((NTSTATUS) 0xC0000009L) +#endif + +#ifndef STATUS_BAD_INITIAL_PC +# define STATUS_BAD_INITIAL_PC ((NTSTATUS) 0xC000000AL) +#endif + +#ifndef STATUS_INVALID_CID +# define STATUS_INVALID_CID ((NTSTATUS) 0xC000000BL) +#endif + +#ifndef STATUS_TIMER_NOT_CANCELED +# define STATUS_TIMER_NOT_CANCELED ((NTSTATUS) 0xC000000CL) +#endif + +#ifndef STATUS_INVALID_PARAMETER +# define STATUS_INVALID_PARAMETER ((NTSTATUS) 0xC000000DL) +#endif + +#ifndef STATUS_NO_SUCH_DEVICE +# define STATUS_NO_SUCH_DEVICE ((NTSTATUS) 0xC000000EL) +#endif + +#ifndef STATUS_NO_SUCH_FILE +# define STATUS_NO_SUCH_FILE ((NTSTATUS) 0xC000000FL) +#endif + +#ifndef STATUS_INVALID_DEVICE_REQUEST +# define STATUS_INVALID_DEVICE_REQUEST ((NTSTATUS) 0xC0000010L) +#endif + +#ifndef STATUS_END_OF_FILE +# define STATUS_END_OF_FILE ((NTSTATUS) 0xC0000011L) +#endif + +#ifndef STATUS_WRONG_VOLUME +# define STATUS_WRONG_VOLUME ((NTSTATUS) 0xC0000012L) +#endif + +#ifndef STATUS_NO_MEDIA_IN_DEVICE +# define STATUS_NO_MEDIA_IN_DEVICE ((NTSTATUS) 0xC0000013L) +#endif + +#ifndef STATUS_UNRECOGNIZED_MEDIA +# define STATUS_UNRECOGNIZED_MEDIA ((NTSTATUS) 0xC0000014L) +#endif + +#ifndef STATUS_NONEXISTENT_SECTOR +# define STATUS_NONEXISTENT_SECTOR ((NTSTATUS) 0xC0000015L) +#endif + +#ifndef STATUS_MORE_PROCESSING_REQUIRED +# define STATUS_MORE_PROCESSING_REQUIRED ((NTSTATUS) 0xC0000016L) +#endif + +#ifndef STATUS_NO_MEMORY +# define STATUS_NO_MEMORY ((NTSTATUS) 0xC0000017L) +#endif + +#ifndef STATUS_CONFLICTING_ADDRESSES +# define STATUS_CONFLICTING_ADDRESSES ((NTSTATUS) 0xC0000018L) +#endif + +#ifndef STATUS_NOT_MAPPED_VIEW +# define STATUS_NOT_MAPPED_VIEW ((NTSTATUS) 0xC0000019L) +#endif + +#ifndef STATUS_UNABLE_TO_FREE_VM +# define STATUS_UNABLE_TO_FREE_VM ((NTSTATUS) 0xC000001AL) +#endif + +#ifndef STATUS_UNABLE_TO_DELETE_SECTION +# define STATUS_UNABLE_TO_DELETE_SECTION ((NTSTATUS) 0xC000001BL) +#endif + +#ifndef STATUS_INVALID_SYSTEM_SERVICE +# define STATUS_INVALID_SYSTEM_SERVICE ((NTSTATUS) 0xC000001CL) +#endif + +#ifndef STATUS_ILLEGAL_INSTRUCTION +# define STATUS_ILLEGAL_INSTRUCTION ((NTSTATUS) 0xC000001DL) +#endif + +#ifndef STATUS_INVALID_LOCK_SEQUENCE +# define STATUS_INVALID_LOCK_SEQUENCE ((NTSTATUS) 0xC000001EL) +#endif + +#ifndef STATUS_INVALID_VIEW_SIZE +# define STATUS_INVALID_VIEW_SIZE ((NTSTATUS) 0xC000001FL) +#endif + +#ifndef STATUS_INVALID_FILE_FOR_SECTION +# define STATUS_INVALID_FILE_FOR_SECTION ((NTSTATUS) 0xC0000020L) +#endif + +#ifndef STATUS_ALREADY_COMMITTED +# define STATUS_ALREADY_COMMITTED ((NTSTATUS) 0xC0000021L) +#endif + +#ifndef STATUS_ACCESS_DENIED +# define STATUS_ACCESS_DENIED ((NTSTATUS) 0xC0000022L) +#endif + +#ifndef STATUS_BUFFER_TOO_SMALL +# define STATUS_BUFFER_TOO_SMALL ((NTSTATUS) 0xC0000023L) +#endif + +#ifndef STATUS_OBJECT_TYPE_MISMATCH +# define STATUS_OBJECT_TYPE_MISMATCH ((NTSTATUS) 0xC0000024L) +#endif + +#ifndef STATUS_NONCONTINUABLE_EXCEPTION +# define STATUS_NONCONTINUABLE_EXCEPTION ((NTSTATUS) 0xC0000025L) +#endif + +#ifndef STATUS_INVALID_DISPOSITION +# define STATUS_INVALID_DISPOSITION ((NTSTATUS) 0xC0000026L) +#endif + +#ifndef STATUS_UNWIND +# define STATUS_UNWIND ((NTSTATUS) 0xC0000027L) +#endif + +#ifndef STATUS_BAD_STACK +# define STATUS_BAD_STACK ((NTSTATUS) 0xC0000028L) +#endif + +#ifndef STATUS_INVALID_UNWIND_TARGET +# define STATUS_INVALID_UNWIND_TARGET ((NTSTATUS) 0xC0000029L) +#endif + +#ifndef STATUS_NOT_LOCKED +# define STATUS_NOT_LOCKED ((NTSTATUS) 0xC000002AL) +#endif + +#ifndef STATUS_PARITY_ERROR +# define STATUS_PARITY_ERROR ((NTSTATUS) 0xC000002BL) +#endif + +#ifndef STATUS_UNABLE_TO_DECOMMIT_VM +# define STATUS_UNABLE_TO_DECOMMIT_VM ((NTSTATUS) 0xC000002CL) +#endif + +#ifndef STATUS_NOT_COMMITTED +# define STATUS_NOT_COMMITTED ((NTSTATUS) 0xC000002DL) +#endif + +#ifndef STATUS_INVALID_PORT_ATTRIBUTES +# define STATUS_INVALID_PORT_ATTRIBUTES ((NTSTATUS) 0xC000002EL) +#endif + +#ifndef STATUS_PORT_MESSAGE_TOO_LONG +# define STATUS_PORT_MESSAGE_TOO_LONG ((NTSTATUS) 0xC000002FL) +#endif + +#ifndef STATUS_INVALID_PARAMETER_MIX +# define STATUS_INVALID_PARAMETER_MIX ((NTSTATUS) 0xC0000030L) +#endif + +#ifndef STATUS_INVALID_QUOTA_LOWER +# define STATUS_INVALID_QUOTA_LOWER ((NTSTATUS) 0xC0000031L) +#endif + +#ifndef STATUS_DISK_CORRUPT_ERROR +# define STATUS_DISK_CORRUPT_ERROR ((NTSTATUS) 0xC0000032L) +#endif + +#ifndef STATUS_OBJECT_NAME_INVALID +# define STATUS_OBJECT_NAME_INVALID ((NTSTATUS) 0xC0000033L) +#endif + +#ifndef STATUS_OBJECT_NAME_NOT_FOUND +# define STATUS_OBJECT_NAME_NOT_FOUND ((NTSTATUS) 0xC0000034L) +#endif + +#ifndef STATUS_OBJECT_NAME_COLLISION +# define STATUS_OBJECT_NAME_COLLISION ((NTSTATUS) 0xC0000035L) +#endif + +#ifndef STATUS_PORT_DISCONNECTED +# define STATUS_PORT_DISCONNECTED ((NTSTATUS) 0xC0000037L) +#endif + +#ifndef STATUS_DEVICE_ALREADY_ATTACHED +# define STATUS_DEVICE_ALREADY_ATTACHED ((NTSTATUS) 0xC0000038L) +#endif + +#ifndef STATUS_OBJECT_PATH_INVALID +# define STATUS_OBJECT_PATH_INVALID ((NTSTATUS) 0xC0000039L) +#endif + +#ifndef STATUS_OBJECT_PATH_NOT_FOUND +# define STATUS_OBJECT_PATH_NOT_FOUND ((NTSTATUS) 0xC000003AL) +#endif + +#ifndef STATUS_OBJECT_PATH_SYNTAX_BAD +# define STATUS_OBJECT_PATH_SYNTAX_BAD ((NTSTATUS) 0xC000003BL) +#endif + +#ifndef STATUS_DATA_OVERRUN +# define STATUS_DATA_OVERRUN ((NTSTATUS) 0xC000003CL) +#endif + +#ifndef STATUS_DATA_LATE_ERROR +# define STATUS_DATA_LATE_ERROR ((NTSTATUS) 0xC000003DL) +#endif + +#ifndef STATUS_DATA_ERROR +# define STATUS_DATA_ERROR ((NTSTATUS) 0xC000003EL) +#endif + +#ifndef STATUS_CRC_ERROR +# define STATUS_CRC_ERROR ((NTSTATUS) 0xC000003FL) +#endif + +#ifndef STATUS_SECTION_TOO_BIG +# define STATUS_SECTION_TOO_BIG ((NTSTATUS) 0xC0000040L) +#endif + +#ifndef STATUS_PORT_CONNECTION_REFUSED +# define STATUS_PORT_CONNECTION_REFUSED ((NTSTATUS) 0xC0000041L) +#endif + +#ifndef STATUS_INVALID_PORT_HANDLE +# define STATUS_INVALID_PORT_HANDLE ((NTSTATUS) 0xC0000042L) +#endif + +#ifndef STATUS_SHARING_VIOLATION +# define STATUS_SHARING_VIOLATION ((NTSTATUS) 0xC0000043L) +#endif + +#ifndef STATUS_QUOTA_EXCEEDED +# define STATUS_QUOTA_EXCEEDED ((NTSTATUS) 0xC0000044L) +#endif + +#ifndef STATUS_INVALID_PAGE_PROTECTION +# define STATUS_INVALID_PAGE_PROTECTION ((NTSTATUS) 0xC0000045L) +#endif + +#ifndef STATUS_MUTANT_NOT_OWNED +# define STATUS_MUTANT_NOT_OWNED ((NTSTATUS) 0xC0000046L) +#endif + +#ifndef STATUS_SEMAPHORE_LIMIT_EXCEEDED +# define STATUS_SEMAPHORE_LIMIT_EXCEEDED ((NTSTATUS) 0xC0000047L) +#endif + +#ifndef STATUS_PORT_ALREADY_SET +# define STATUS_PORT_ALREADY_SET ((NTSTATUS) 0xC0000048L) +#endif + +#ifndef STATUS_SECTION_NOT_IMAGE +# define STATUS_SECTION_NOT_IMAGE ((NTSTATUS) 0xC0000049L) +#endif + +#ifndef STATUS_SUSPEND_COUNT_EXCEEDED +# define STATUS_SUSPEND_COUNT_EXCEEDED ((NTSTATUS) 0xC000004AL) +#endif + +#ifndef STATUS_THREAD_IS_TERMINATING +# define STATUS_THREAD_IS_TERMINATING ((NTSTATUS) 0xC000004BL) +#endif + +#ifndef STATUS_BAD_WORKING_SET_LIMIT +# define STATUS_BAD_WORKING_SET_LIMIT ((NTSTATUS) 0xC000004CL) +#endif + +#ifndef STATUS_INCOMPATIBLE_FILE_MAP +# define STATUS_INCOMPATIBLE_FILE_MAP ((NTSTATUS) 0xC000004DL) +#endif + +#ifndef STATUS_SECTION_PROTECTION +# define STATUS_SECTION_PROTECTION ((NTSTATUS) 0xC000004EL) +#endif + +#ifndef STATUS_EAS_NOT_SUPPORTED +# define STATUS_EAS_NOT_SUPPORTED ((NTSTATUS) 0xC000004FL) +#endif + +#ifndef STATUS_EA_TOO_LARGE +# define STATUS_EA_TOO_LARGE ((NTSTATUS) 0xC0000050L) +#endif + +#ifndef STATUS_NONEXISTENT_EA_ENTRY +# define STATUS_NONEXISTENT_EA_ENTRY ((NTSTATUS) 0xC0000051L) +#endif + +#ifndef STATUS_NO_EAS_ON_FILE +# define STATUS_NO_EAS_ON_FILE ((NTSTATUS) 0xC0000052L) +#endif + +#ifndef STATUS_EA_CORRUPT_ERROR +# define STATUS_EA_CORRUPT_ERROR ((NTSTATUS) 0xC0000053L) +#endif + +#ifndef STATUS_FILE_LOCK_CONFLICT +# define STATUS_FILE_LOCK_CONFLICT ((NTSTATUS) 0xC0000054L) +#endif + +#ifndef STATUS_LOCK_NOT_GRANTED +# define STATUS_LOCK_NOT_GRANTED ((NTSTATUS) 0xC0000055L) +#endif + +#ifndef STATUS_DELETE_PENDING +# define STATUS_DELETE_PENDING ((NTSTATUS) 0xC0000056L) +#endif + +#ifndef STATUS_CTL_FILE_NOT_SUPPORTED +# define STATUS_CTL_FILE_NOT_SUPPORTED ((NTSTATUS) 0xC0000057L) +#endif + +#ifndef STATUS_UNKNOWN_REVISION +# define STATUS_UNKNOWN_REVISION ((NTSTATUS) 0xC0000058L) +#endif + +#ifndef STATUS_REVISION_MISMATCH +# define STATUS_REVISION_MISMATCH ((NTSTATUS) 0xC0000059L) +#endif + +#ifndef STATUS_INVALID_OWNER +# define STATUS_INVALID_OWNER ((NTSTATUS) 0xC000005AL) +#endif + +#ifndef STATUS_INVALID_PRIMARY_GROUP +# define STATUS_INVALID_PRIMARY_GROUP ((NTSTATUS) 0xC000005BL) +#endif + +#ifndef STATUS_NO_IMPERSONATION_TOKEN +# define STATUS_NO_IMPERSONATION_TOKEN ((NTSTATUS) 0xC000005CL) +#endif + +#ifndef STATUS_CANT_DISABLE_MANDATORY +# define STATUS_CANT_DISABLE_MANDATORY ((NTSTATUS) 0xC000005DL) +#endif + +#ifndef STATUS_NO_LOGON_SERVERS +# define STATUS_NO_LOGON_SERVERS ((NTSTATUS) 0xC000005EL) +#endif + +#ifndef STATUS_NO_SUCH_LOGON_SESSION +# define STATUS_NO_SUCH_LOGON_SESSION ((NTSTATUS) 0xC000005FL) +#endif + +#ifndef STATUS_NO_SUCH_PRIVILEGE +# define STATUS_NO_SUCH_PRIVILEGE ((NTSTATUS) 0xC0000060L) +#endif + +#ifndef STATUS_PRIVILEGE_NOT_HELD +# define STATUS_PRIVILEGE_NOT_HELD ((NTSTATUS) 0xC0000061L) +#endif + +#ifndef STATUS_INVALID_ACCOUNT_NAME +# define STATUS_INVALID_ACCOUNT_NAME ((NTSTATUS) 0xC0000062L) +#endif + +#ifndef STATUS_USER_EXISTS +# define STATUS_USER_EXISTS ((NTSTATUS) 0xC0000063L) +#endif + +#ifndef STATUS_NO_SUCH_USER +# define STATUS_NO_SUCH_USER ((NTSTATUS) 0xC0000064L) +#endif + +#ifndef STATUS_GROUP_EXISTS +# define STATUS_GROUP_EXISTS ((NTSTATUS) 0xC0000065L) +#endif + +#ifndef STATUS_NO_SUCH_GROUP +# define STATUS_NO_SUCH_GROUP ((NTSTATUS) 0xC0000066L) +#endif + +#ifndef STATUS_MEMBER_IN_GROUP +# define STATUS_MEMBER_IN_GROUP ((NTSTATUS) 0xC0000067L) +#endif + +#ifndef STATUS_MEMBER_NOT_IN_GROUP +# define STATUS_MEMBER_NOT_IN_GROUP ((NTSTATUS) 0xC0000068L) +#endif + +#ifndef STATUS_LAST_ADMIN +# define STATUS_LAST_ADMIN ((NTSTATUS) 0xC0000069L) +#endif + +#ifndef STATUS_WRONG_PASSWORD +# define STATUS_WRONG_PASSWORD ((NTSTATUS) 0xC000006AL) +#endif + +#ifndef STATUS_ILL_FORMED_PASSWORD +# define STATUS_ILL_FORMED_PASSWORD ((NTSTATUS) 0xC000006BL) +#endif + +#ifndef STATUS_PASSWORD_RESTRICTION +# define STATUS_PASSWORD_RESTRICTION ((NTSTATUS) 0xC000006CL) +#endif + +#ifndef STATUS_LOGON_FAILURE +# define STATUS_LOGON_FAILURE ((NTSTATUS) 0xC000006DL) +#endif + +#ifndef STATUS_ACCOUNT_RESTRICTION +# define STATUS_ACCOUNT_RESTRICTION ((NTSTATUS) 0xC000006EL) +#endif + +#ifndef STATUS_INVALID_LOGON_HOURS +# define STATUS_INVALID_LOGON_HOURS ((NTSTATUS) 0xC000006FL) +#endif + +#ifndef STATUS_INVALID_WORKSTATION +# define STATUS_INVALID_WORKSTATION ((NTSTATUS) 0xC0000070L) +#endif + +#ifndef STATUS_PASSWORD_EXPIRED +# define STATUS_PASSWORD_EXPIRED ((NTSTATUS) 0xC0000071L) +#endif + +#ifndef STATUS_ACCOUNT_DISABLED +# define STATUS_ACCOUNT_DISABLED ((NTSTATUS) 0xC0000072L) +#endif + +#ifndef STATUS_NONE_MAPPED +# define STATUS_NONE_MAPPED ((NTSTATUS) 0xC0000073L) +#endif + +#ifndef STATUS_TOO_MANY_LUIDS_REQUESTED +# define STATUS_TOO_MANY_LUIDS_REQUESTED ((NTSTATUS) 0xC0000074L) +#endif + +#ifndef STATUS_LUIDS_EXHAUSTED +# define STATUS_LUIDS_EXHAUSTED ((NTSTATUS) 0xC0000075L) +#endif + +#ifndef STATUS_INVALID_SUB_AUTHORITY +# define STATUS_INVALID_SUB_AUTHORITY ((NTSTATUS) 0xC0000076L) +#endif + +#ifndef STATUS_INVALID_ACL +# define STATUS_INVALID_ACL ((NTSTATUS) 0xC0000077L) +#endif + +#ifndef STATUS_INVALID_SID +# define STATUS_INVALID_SID ((NTSTATUS) 0xC0000078L) +#endif + +#ifndef STATUS_INVALID_SECURITY_DESCR +# define STATUS_INVALID_SECURITY_DESCR ((NTSTATUS) 0xC0000079L) +#endif + +#ifndef STATUS_PROCEDURE_NOT_FOUND +# define STATUS_PROCEDURE_NOT_FOUND ((NTSTATUS) 0xC000007AL) +#endif + +#ifndef STATUS_INVALID_IMAGE_FORMAT +# define STATUS_INVALID_IMAGE_FORMAT ((NTSTATUS) 0xC000007BL) +#endif + +#ifndef STATUS_NO_TOKEN +# define STATUS_NO_TOKEN ((NTSTATUS) 0xC000007CL) +#endif + +#ifndef STATUS_BAD_INHERITANCE_ACL +# define STATUS_BAD_INHERITANCE_ACL ((NTSTATUS) 0xC000007DL) +#endif + +#ifndef STATUS_RANGE_NOT_LOCKED +# define STATUS_RANGE_NOT_LOCKED ((NTSTATUS) 0xC000007EL) +#endif + +#ifndef STATUS_DISK_FULL +# define STATUS_DISK_FULL ((NTSTATUS) 0xC000007FL) +#endif + +#ifndef STATUS_SERVER_DISABLED +# define STATUS_SERVER_DISABLED ((NTSTATUS) 0xC0000080L) +#endif + +#ifndef STATUS_SERVER_NOT_DISABLED +# define STATUS_SERVER_NOT_DISABLED ((NTSTATUS) 0xC0000081L) +#endif + +#ifndef STATUS_TOO_MANY_GUIDS_REQUESTED +# define STATUS_TOO_MANY_GUIDS_REQUESTED ((NTSTATUS) 0xC0000082L) +#endif + +#ifndef STATUS_GUIDS_EXHAUSTED +# define STATUS_GUIDS_EXHAUSTED ((NTSTATUS) 0xC0000083L) +#endif + +#ifndef STATUS_INVALID_ID_AUTHORITY +# define STATUS_INVALID_ID_AUTHORITY ((NTSTATUS) 0xC0000084L) +#endif + +#ifndef STATUS_AGENTS_EXHAUSTED +# define STATUS_AGENTS_EXHAUSTED ((NTSTATUS) 0xC0000085L) +#endif + +#ifndef STATUS_INVALID_VOLUME_LABEL +# define STATUS_INVALID_VOLUME_LABEL ((NTSTATUS) 0xC0000086L) +#endif + +#ifndef STATUS_SECTION_NOT_EXTENDED +# define STATUS_SECTION_NOT_EXTENDED ((NTSTATUS) 0xC0000087L) +#endif + +#ifndef STATUS_NOT_MAPPED_DATA +# define STATUS_NOT_MAPPED_DATA ((NTSTATUS) 0xC0000088L) +#endif + +#ifndef STATUS_RESOURCE_DATA_NOT_FOUND +# define STATUS_RESOURCE_DATA_NOT_FOUND ((NTSTATUS) 0xC0000089L) +#endif + +#ifndef STATUS_RESOURCE_TYPE_NOT_FOUND +# define STATUS_RESOURCE_TYPE_NOT_FOUND ((NTSTATUS) 0xC000008AL) +#endif + +#ifndef STATUS_RESOURCE_NAME_NOT_FOUND +# define STATUS_RESOURCE_NAME_NOT_FOUND ((NTSTATUS) 0xC000008BL) +#endif + +#ifndef STATUS_ARRAY_BOUNDS_EXCEEDED +# define STATUS_ARRAY_BOUNDS_EXCEEDED ((NTSTATUS) 0xC000008CL) +#endif + +#ifndef STATUS_FLOAT_DENORMAL_OPERAND +# define STATUS_FLOAT_DENORMAL_OPERAND ((NTSTATUS) 0xC000008DL) +#endif + +#ifndef STATUS_FLOAT_DIVIDE_BY_ZERO +# define STATUS_FLOAT_DIVIDE_BY_ZERO ((NTSTATUS) 0xC000008EL) +#endif + +#ifndef STATUS_FLOAT_INEXACT_RESULT +# define STATUS_FLOAT_INEXACT_RESULT ((NTSTATUS) 0xC000008FL) +#endif + +#ifndef STATUS_FLOAT_INVALID_OPERATION +# define STATUS_FLOAT_INVALID_OPERATION ((NTSTATUS) 0xC0000090L) +#endif + +#ifndef STATUS_FLOAT_OVERFLOW +# define STATUS_FLOAT_OVERFLOW ((NTSTATUS) 0xC0000091L) +#endif + +#ifndef STATUS_FLOAT_STACK_CHECK +# define STATUS_FLOAT_STACK_CHECK ((NTSTATUS) 0xC0000092L) +#endif + +#ifndef STATUS_FLOAT_UNDERFLOW +# define STATUS_FLOAT_UNDERFLOW ((NTSTATUS) 0xC0000093L) +#endif + +#ifndef STATUS_INTEGER_DIVIDE_BY_ZERO +# define STATUS_INTEGER_DIVIDE_BY_ZERO ((NTSTATUS) 0xC0000094L) +#endif + +#ifndef STATUS_INTEGER_OVERFLOW +# define STATUS_INTEGER_OVERFLOW ((NTSTATUS) 0xC0000095L) +#endif + +#ifndef STATUS_PRIVILEGED_INSTRUCTION +# define STATUS_PRIVILEGED_INSTRUCTION ((NTSTATUS) 0xC0000096L) +#endif + +#ifndef STATUS_TOO_MANY_PAGING_FILES +# define STATUS_TOO_MANY_PAGING_FILES ((NTSTATUS) 0xC0000097L) +#endif + +#ifndef STATUS_FILE_INVALID +# define STATUS_FILE_INVALID ((NTSTATUS) 0xC0000098L) +#endif + +#ifndef STATUS_ALLOTTED_SPACE_EXCEEDED +# define STATUS_ALLOTTED_SPACE_EXCEEDED ((NTSTATUS) 0xC0000099L) +#endif + +#ifndef STATUS_INSUFFICIENT_RESOURCES +# define STATUS_INSUFFICIENT_RESOURCES ((NTSTATUS) 0xC000009AL) +#endif + +#ifndef STATUS_DFS_EXIT_PATH_FOUND +# define STATUS_DFS_EXIT_PATH_FOUND ((NTSTATUS) 0xC000009BL) +#endif + +#ifndef STATUS_DEVICE_DATA_ERROR +# define STATUS_DEVICE_DATA_ERROR ((NTSTATUS) 0xC000009CL) +#endif + +#ifndef STATUS_DEVICE_NOT_CONNECTED +# define STATUS_DEVICE_NOT_CONNECTED ((NTSTATUS) 0xC000009DL) +#endif + +#ifndef STATUS_DEVICE_POWER_FAILURE +# define STATUS_DEVICE_POWER_FAILURE ((NTSTATUS) 0xC000009EL) +#endif + +#ifndef STATUS_FREE_VM_NOT_AT_BASE +# define STATUS_FREE_VM_NOT_AT_BASE ((NTSTATUS) 0xC000009FL) +#endif + +#ifndef STATUS_MEMORY_NOT_ALLOCATED +# define STATUS_MEMORY_NOT_ALLOCATED ((NTSTATUS) 0xC00000A0L) +#endif + +#ifndef STATUS_WORKING_SET_QUOTA +# define STATUS_WORKING_SET_QUOTA ((NTSTATUS) 0xC00000A1L) +#endif + +#ifndef STATUS_MEDIA_WRITE_PROTECTED +# define STATUS_MEDIA_WRITE_PROTECTED ((NTSTATUS) 0xC00000A2L) +#endif + +#ifndef STATUS_DEVICE_NOT_READY +# define STATUS_DEVICE_NOT_READY ((NTSTATUS) 0xC00000A3L) +#endif + +#ifndef STATUS_INVALID_GROUP_ATTRIBUTES +# define STATUS_INVALID_GROUP_ATTRIBUTES ((NTSTATUS) 0xC00000A4L) +#endif + +#ifndef STATUS_BAD_IMPERSONATION_LEVEL +# define STATUS_BAD_IMPERSONATION_LEVEL ((NTSTATUS) 0xC00000A5L) +#endif + +#ifndef STATUS_CANT_OPEN_ANONYMOUS +# define STATUS_CANT_OPEN_ANONYMOUS ((NTSTATUS) 0xC00000A6L) +#endif + +#ifndef STATUS_BAD_VALIDATION_CLASS +# define STATUS_BAD_VALIDATION_CLASS ((NTSTATUS) 0xC00000A7L) +#endif + +#ifndef STATUS_BAD_TOKEN_TYPE +# define STATUS_BAD_TOKEN_TYPE ((NTSTATUS) 0xC00000A8L) +#endif + +#ifndef STATUS_BAD_MASTER_BOOT_RECORD +# define STATUS_BAD_MASTER_BOOT_RECORD ((NTSTATUS) 0xC00000A9L) +#endif + +#ifndef STATUS_INSTRUCTION_MISALIGNMENT +# define STATUS_INSTRUCTION_MISALIGNMENT ((NTSTATUS) 0xC00000AAL) +#endif + +#ifndef STATUS_INSTANCE_NOT_AVAILABLE +# define STATUS_INSTANCE_NOT_AVAILABLE ((NTSTATUS) 0xC00000ABL) +#endif + +#ifndef STATUS_PIPE_NOT_AVAILABLE +# define STATUS_PIPE_NOT_AVAILABLE ((NTSTATUS) 0xC00000ACL) +#endif + +#ifndef STATUS_INVALID_PIPE_STATE +# define STATUS_INVALID_PIPE_STATE ((NTSTATUS) 0xC00000ADL) +#endif + +#ifndef STATUS_PIPE_BUSY +# define STATUS_PIPE_BUSY ((NTSTATUS) 0xC00000AEL) +#endif + +#ifndef STATUS_ILLEGAL_FUNCTION +# define STATUS_ILLEGAL_FUNCTION ((NTSTATUS) 0xC00000AFL) +#endif + +#ifndef STATUS_PIPE_DISCONNECTED +# define STATUS_PIPE_DISCONNECTED ((NTSTATUS) 0xC00000B0L) +#endif + +#ifndef STATUS_PIPE_CLOSING +# define STATUS_PIPE_CLOSING ((NTSTATUS) 0xC00000B1L) +#endif + +#ifndef STATUS_PIPE_CONNECTED +# define STATUS_PIPE_CONNECTED ((NTSTATUS) 0xC00000B2L) +#endif + +#ifndef STATUS_PIPE_LISTENING +# define STATUS_PIPE_LISTENING ((NTSTATUS) 0xC00000B3L) +#endif + +#ifndef STATUS_INVALID_READ_MODE +# define STATUS_INVALID_READ_MODE ((NTSTATUS) 0xC00000B4L) +#endif + +#ifndef STATUS_IO_TIMEOUT +# define STATUS_IO_TIMEOUT ((NTSTATUS) 0xC00000B5L) +#endif + +#ifndef STATUS_FILE_FORCED_CLOSED +# define STATUS_FILE_FORCED_CLOSED ((NTSTATUS) 0xC00000B6L) +#endif + +#ifndef STATUS_PROFILING_NOT_STARTED +# define STATUS_PROFILING_NOT_STARTED ((NTSTATUS) 0xC00000B7L) +#endif + +#ifndef STATUS_PROFILING_NOT_STOPPED +# define STATUS_PROFILING_NOT_STOPPED ((NTSTATUS) 0xC00000B8L) +#endif + +#ifndef STATUS_COULD_NOT_INTERPRET +# define STATUS_COULD_NOT_INTERPRET ((NTSTATUS) 0xC00000B9L) +#endif + +#ifndef STATUS_FILE_IS_A_DIRECTORY +# define STATUS_FILE_IS_A_DIRECTORY ((NTSTATUS) 0xC00000BAL) +#endif + +#ifndef STATUS_NOT_SUPPORTED +# define STATUS_NOT_SUPPORTED ((NTSTATUS) 0xC00000BBL) +#endif + +#ifndef STATUS_REMOTE_NOT_LISTENING +# define STATUS_REMOTE_NOT_LISTENING ((NTSTATUS) 0xC00000BCL) +#endif + +#ifndef STATUS_DUPLICATE_NAME +# define STATUS_DUPLICATE_NAME ((NTSTATUS) 0xC00000BDL) +#endif + +#ifndef STATUS_BAD_NETWORK_PATH +# define STATUS_BAD_NETWORK_PATH ((NTSTATUS) 0xC00000BEL) +#endif + +#ifndef STATUS_NETWORK_BUSY +# define STATUS_NETWORK_BUSY ((NTSTATUS) 0xC00000BFL) +#endif + +#ifndef STATUS_DEVICE_DOES_NOT_EXIST +# define STATUS_DEVICE_DOES_NOT_EXIST ((NTSTATUS) 0xC00000C0L) +#endif + +#ifndef STATUS_TOO_MANY_COMMANDS +# define STATUS_TOO_MANY_COMMANDS ((NTSTATUS) 0xC00000C1L) +#endif + +#ifndef STATUS_ADAPTER_HARDWARE_ERROR +# define STATUS_ADAPTER_HARDWARE_ERROR ((NTSTATUS) 0xC00000C2L) +#endif + +#ifndef STATUS_INVALID_NETWORK_RESPONSE +# define STATUS_INVALID_NETWORK_RESPONSE ((NTSTATUS) 0xC00000C3L) +#endif + +#ifndef STATUS_UNEXPECTED_NETWORK_ERROR +# define STATUS_UNEXPECTED_NETWORK_ERROR ((NTSTATUS) 0xC00000C4L) +#endif + +#ifndef STATUS_BAD_REMOTE_ADAPTER +# define STATUS_BAD_REMOTE_ADAPTER ((NTSTATUS) 0xC00000C5L) +#endif + +#ifndef STATUS_PRINT_QUEUE_FULL +# define STATUS_PRINT_QUEUE_FULL ((NTSTATUS) 0xC00000C6L) +#endif + +#ifndef STATUS_NO_SPOOL_SPACE +# define STATUS_NO_SPOOL_SPACE ((NTSTATUS) 0xC00000C7L) +#endif + +#ifndef STATUS_PRINT_CANCELLED +# define STATUS_PRINT_CANCELLED ((NTSTATUS) 0xC00000C8L) +#endif + +#ifndef STATUS_NETWORK_NAME_DELETED +# define STATUS_NETWORK_NAME_DELETED ((NTSTATUS) 0xC00000C9L) +#endif + +#ifndef STATUS_NETWORK_ACCESS_DENIED +# define STATUS_NETWORK_ACCESS_DENIED ((NTSTATUS) 0xC00000CAL) +#endif + +#ifndef STATUS_BAD_DEVICE_TYPE +# define STATUS_BAD_DEVICE_TYPE ((NTSTATUS) 0xC00000CBL) +#endif + +#ifndef STATUS_BAD_NETWORK_NAME +# define STATUS_BAD_NETWORK_NAME ((NTSTATUS) 0xC00000CCL) +#endif + +#ifndef STATUS_TOO_MANY_NAMES +# define STATUS_TOO_MANY_NAMES ((NTSTATUS) 0xC00000CDL) +#endif + +#ifndef STATUS_TOO_MANY_SESSIONS +# define STATUS_TOO_MANY_SESSIONS ((NTSTATUS) 0xC00000CEL) +#endif + +#ifndef STATUS_SHARING_PAUSED +# define STATUS_SHARING_PAUSED ((NTSTATUS) 0xC00000CFL) +#endif + +#ifndef STATUS_REQUEST_NOT_ACCEPTED +# define STATUS_REQUEST_NOT_ACCEPTED ((NTSTATUS) 0xC00000D0L) +#endif + +#ifndef STATUS_REDIRECTOR_PAUSED +# define STATUS_REDIRECTOR_PAUSED ((NTSTATUS) 0xC00000D1L) +#endif + +#ifndef STATUS_NET_WRITE_FAULT +# define STATUS_NET_WRITE_FAULT ((NTSTATUS) 0xC00000D2L) +#endif + +#ifndef STATUS_PROFILING_AT_LIMIT +# define STATUS_PROFILING_AT_LIMIT ((NTSTATUS) 0xC00000D3L) +#endif + +#ifndef STATUS_NOT_SAME_DEVICE +# define STATUS_NOT_SAME_DEVICE ((NTSTATUS) 0xC00000D4L) +#endif + +#ifndef STATUS_FILE_RENAMED +# define STATUS_FILE_RENAMED ((NTSTATUS) 0xC00000D5L) +#endif + +#ifndef STATUS_VIRTUAL_CIRCUIT_CLOSED +# define STATUS_VIRTUAL_CIRCUIT_CLOSED ((NTSTATUS) 0xC00000D6L) +#endif + +#ifndef STATUS_NO_SECURITY_ON_OBJECT +# define STATUS_NO_SECURITY_ON_OBJECT ((NTSTATUS) 0xC00000D7L) +#endif + +#ifndef STATUS_CANT_WAIT +# define STATUS_CANT_WAIT ((NTSTATUS) 0xC00000D8L) +#endif + +#ifndef STATUS_PIPE_EMPTY +# define STATUS_PIPE_EMPTY ((NTSTATUS) 0xC00000D9L) +#endif + +#ifndef STATUS_CANT_ACCESS_DOMAIN_INFO +# define STATUS_CANT_ACCESS_DOMAIN_INFO ((NTSTATUS) 0xC00000DAL) +#endif + +#ifndef STATUS_CANT_TERMINATE_SELF +# define STATUS_CANT_TERMINATE_SELF ((NTSTATUS) 0xC00000DBL) +#endif + +#ifndef STATUS_INVALID_SERVER_STATE +# define STATUS_INVALID_SERVER_STATE ((NTSTATUS) 0xC00000DCL) +#endif + +#ifndef STATUS_INVALID_DOMAIN_STATE +# define STATUS_INVALID_DOMAIN_STATE ((NTSTATUS) 0xC00000DDL) +#endif + +#ifndef STATUS_INVALID_DOMAIN_ROLE +# define STATUS_INVALID_DOMAIN_ROLE ((NTSTATUS) 0xC00000DEL) +#endif + +#ifndef STATUS_NO_SUCH_DOMAIN +# define STATUS_NO_SUCH_DOMAIN ((NTSTATUS) 0xC00000DFL) +#endif + +#ifndef STATUS_DOMAIN_EXISTS +# define STATUS_DOMAIN_EXISTS ((NTSTATUS) 0xC00000E0L) +#endif + +#ifndef STATUS_DOMAIN_LIMIT_EXCEEDED +# define STATUS_DOMAIN_LIMIT_EXCEEDED ((NTSTATUS) 0xC00000E1L) +#endif + +#ifndef STATUS_OPLOCK_NOT_GRANTED +# define STATUS_OPLOCK_NOT_GRANTED ((NTSTATUS) 0xC00000E2L) +#endif + +#ifndef STATUS_INVALID_OPLOCK_PROTOCOL +# define STATUS_INVALID_OPLOCK_PROTOCOL ((NTSTATUS) 0xC00000E3L) +#endif + +#ifndef STATUS_INTERNAL_DB_CORRUPTION +# define STATUS_INTERNAL_DB_CORRUPTION ((NTSTATUS) 0xC00000E4L) +#endif + +#ifndef STATUS_INTERNAL_ERROR +# define STATUS_INTERNAL_ERROR ((NTSTATUS) 0xC00000E5L) +#endif + +#ifndef STATUS_GENERIC_NOT_MAPPED +# define STATUS_GENERIC_NOT_MAPPED ((NTSTATUS) 0xC00000E6L) +#endif + +#ifndef STATUS_BAD_DESCRIPTOR_FORMAT +# define STATUS_BAD_DESCRIPTOR_FORMAT ((NTSTATUS) 0xC00000E7L) +#endif + +#ifndef STATUS_INVALID_USER_BUFFER +# define STATUS_INVALID_USER_BUFFER ((NTSTATUS) 0xC00000E8L) +#endif + +#ifndef STATUS_UNEXPECTED_IO_ERROR +# define STATUS_UNEXPECTED_IO_ERROR ((NTSTATUS) 0xC00000E9L) +#endif + +#ifndef STATUS_UNEXPECTED_MM_CREATE_ERR +# define STATUS_UNEXPECTED_MM_CREATE_ERR ((NTSTATUS) 0xC00000EAL) +#endif + +#ifndef STATUS_UNEXPECTED_MM_MAP_ERROR +# define STATUS_UNEXPECTED_MM_MAP_ERROR ((NTSTATUS) 0xC00000EBL) +#endif + +#ifndef STATUS_UNEXPECTED_MM_EXTEND_ERR +# define STATUS_UNEXPECTED_MM_EXTEND_ERR ((NTSTATUS) 0xC00000ECL) +#endif + +#ifndef STATUS_NOT_LOGON_PROCESS +# define STATUS_NOT_LOGON_PROCESS ((NTSTATUS) 0xC00000EDL) +#endif + +#ifndef STATUS_LOGON_SESSION_EXISTS +# define STATUS_LOGON_SESSION_EXISTS ((NTSTATUS) 0xC00000EEL) +#endif + +#ifndef STATUS_INVALID_PARAMETER_1 +# define STATUS_INVALID_PARAMETER_1 ((NTSTATUS) 0xC00000EFL) +#endif + +#ifndef STATUS_INVALID_PARAMETER_2 +# define STATUS_INVALID_PARAMETER_2 ((NTSTATUS) 0xC00000F0L) +#endif + +#ifndef STATUS_INVALID_PARAMETER_3 +# define STATUS_INVALID_PARAMETER_3 ((NTSTATUS) 0xC00000F1L) +#endif + +#ifndef STATUS_INVALID_PARAMETER_4 +# define STATUS_INVALID_PARAMETER_4 ((NTSTATUS) 0xC00000F2L) +#endif + +#ifndef STATUS_INVALID_PARAMETER_5 +# define STATUS_INVALID_PARAMETER_5 ((NTSTATUS) 0xC00000F3L) +#endif + +#ifndef STATUS_INVALID_PARAMETER_6 +# define STATUS_INVALID_PARAMETER_6 ((NTSTATUS) 0xC00000F4L) +#endif + +#ifndef STATUS_INVALID_PARAMETER_7 +# define STATUS_INVALID_PARAMETER_7 ((NTSTATUS) 0xC00000F5L) +#endif + +#ifndef STATUS_INVALID_PARAMETER_8 +# define STATUS_INVALID_PARAMETER_8 ((NTSTATUS) 0xC00000F6L) +#endif + +#ifndef STATUS_INVALID_PARAMETER_9 +# define STATUS_INVALID_PARAMETER_9 ((NTSTATUS) 0xC00000F7L) +#endif + +#ifndef STATUS_INVALID_PARAMETER_10 +# define STATUS_INVALID_PARAMETER_10 ((NTSTATUS) 0xC00000F8L) +#endif + +#ifndef STATUS_INVALID_PARAMETER_11 +# define STATUS_INVALID_PARAMETER_11 ((NTSTATUS) 0xC00000F9L) +#endif + +#ifndef STATUS_INVALID_PARAMETER_12 +# define STATUS_INVALID_PARAMETER_12 ((NTSTATUS) 0xC00000FAL) +#endif + +#ifndef STATUS_REDIRECTOR_NOT_STARTED +# define STATUS_REDIRECTOR_NOT_STARTED ((NTSTATUS) 0xC00000FBL) +#endif + +#ifndef STATUS_REDIRECTOR_STARTED +# define STATUS_REDIRECTOR_STARTED ((NTSTATUS) 0xC00000FCL) +#endif + +#ifndef STATUS_STACK_OVERFLOW +# define STATUS_STACK_OVERFLOW ((NTSTATUS) 0xC00000FDL) +#endif + +#ifndef STATUS_NO_SUCH_PACKAGE +# define STATUS_NO_SUCH_PACKAGE ((NTSTATUS) 0xC00000FEL) +#endif + +#ifndef STATUS_BAD_FUNCTION_TABLE +# define STATUS_BAD_FUNCTION_TABLE ((NTSTATUS) 0xC00000FFL) +#endif + +#ifndef STATUS_VARIABLE_NOT_FOUND +# define STATUS_VARIABLE_NOT_FOUND ((NTSTATUS) 0xC0000100L) +#endif + +#ifndef STATUS_DIRECTORY_NOT_EMPTY +# define STATUS_DIRECTORY_NOT_EMPTY ((NTSTATUS) 0xC0000101L) +#endif + +#ifndef STATUS_FILE_CORRUPT_ERROR +# define STATUS_FILE_CORRUPT_ERROR ((NTSTATUS) 0xC0000102L) +#endif + +#ifndef STATUS_NOT_A_DIRECTORY +# define STATUS_NOT_A_DIRECTORY ((NTSTATUS) 0xC0000103L) +#endif + +#ifndef STATUS_BAD_LOGON_SESSION_STATE +# define STATUS_BAD_LOGON_SESSION_STATE ((NTSTATUS) 0xC0000104L) +#endif + +#ifndef STATUS_LOGON_SESSION_COLLISION +# define STATUS_LOGON_SESSION_COLLISION ((NTSTATUS) 0xC0000105L) +#endif + +#ifndef STATUS_NAME_TOO_LONG +# define STATUS_NAME_TOO_LONG ((NTSTATUS) 0xC0000106L) +#endif + +#ifndef STATUS_FILES_OPEN +# define STATUS_FILES_OPEN ((NTSTATUS) 0xC0000107L) +#endif + +#ifndef STATUS_CONNECTION_IN_USE +# define STATUS_CONNECTION_IN_USE ((NTSTATUS) 0xC0000108L) +#endif + +#ifndef STATUS_MESSAGE_NOT_FOUND +# define STATUS_MESSAGE_NOT_FOUND ((NTSTATUS) 0xC0000109L) +#endif + +#ifndef STATUS_PROCESS_IS_TERMINATING +# define STATUS_PROCESS_IS_TERMINATING ((NTSTATUS) 0xC000010AL) +#endif + +#ifndef STATUS_INVALID_LOGON_TYPE +# define STATUS_INVALID_LOGON_TYPE ((NTSTATUS) 0xC000010BL) +#endif + +#ifndef STATUS_NO_GUID_TRANSLATION +# define STATUS_NO_GUID_TRANSLATION ((NTSTATUS) 0xC000010CL) +#endif + +#ifndef STATUS_CANNOT_IMPERSONATE +# define STATUS_CANNOT_IMPERSONATE ((NTSTATUS) 0xC000010DL) +#endif + +#ifndef STATUS_IMAGE_ALREADY_LOADED +# define STATUS_IMAGE_ALREADY_LOADED ((NTSTATUS) 0xC000010EL) +#endif + +#ifndef STATUS_ABIOS_NOT_PRESENT +# define STATUS_ABIOS_NOT_PRESENT ((NTSTATUS) 0xC000010FL) +#endif + +#ifndef STATUS_ABIOS_LID_NOT_EXIST +# define STATUS_ABIOS_LID_NOT_EXIST ((NTSTATUS) 0xC0000110L) +#endif + +#ifndef STATUS_ABIOS_LID_ALREADY_OWNED +# define STATUS_ABIOS_LID_ALREADY_OWNED ((NTSTATUS) 0xC0000111L) +#endif + +#ifndef STATUS_ABIOS_NOT_LID_OWNER +# define STATUS_ABIOS_NOT_LID_OWNER ((NTSTATUS) 0xC0000112L) +#endif + +#ifndef STATUS_ABIOS_INVALID_COMMAND +# define STATUS_ABIOS_INVALID_COMMAND ((NTSTATUS) 0xC0000113L) +#endif + +#ifndef STATUS_ABIOS_INVALID_LID +# define STATUS_ABIOS_INVALID_LID ((NTSTATUS) 0xC0000114L) +#endif + +#ifndef STATUS_ABIOS_SELECTOR_NOT_AVAILABLE +# define STATUS_ABIOS_SELECTOR_NOT_AVAILABLE ((NTSTATUS) 0xC0000115L) +#endif + +#ifndef STATUS_ABIOS_INVALID_SELECTOR +# define STATUS_ABIOS_INVALID_SELECTOR ((NTSTATUS) 0xC0000116L) +#endif + +#ifndef STATUS_NO_LDT +# define STATUS_NO_LDT ((NTSTATUS) 0xC0000117L) +#endif + +#ifndef STATUS_INVALID_LDT_SIZE +# define STATUS_INVALID_LDT_SIZE ((NTSTATUS) 0xC0000118L) +#endif + +#ifndef STATUS_INVALID_LDT_OFFSET +# define STATUS_INVALID_LDT_OFFSET ((NTSTATUS) 0xC0000119L) +#endif + +#ifndef STATUS_INVALID_LDT_DESCRIPTOR +# define STATUS_INVALID_LDT_DESCRIPTOR ((NTSTATUS) 0xC000011AL) +#endif + +#ifndef STATUS_INVALID_IMAGE_NE_FORMAT +# define STATUS_INVALID_IMAGE_NE_FORMAT ((NTSTATUS) 0xC000011BL) +#endif + +#ifndef STATUS_RXACT_INVALID_STATE +# define STATUS_RXACT_INVALID_STATE ((NTSTATUS) 0xC000011CL) +#endif + +#ifndef STATUS_RXACT_COMMIT_FAILURE +# define STATUS_RXACT_COMMIT_FAILURE ((NTSTATUS) 0xC000011DL) +#endif + +#ifndef STATUS_MAPPED_FILE_SIZE_ZERO +# define STATUS_MAPPED_FILE_SIZE_ZERO ((NTSTATUS) 0xC000011EL) +#endif + +#ifndef STATUS_TOO_MANY_OPENED_FILES +# define STATUS_TOO_MANY_OPENED_FILES ((NTSTATUS) 0xC000011FL) +#endif + +#ifndef STATUS_CANCELLED +# define STATUS_CANCELLED ((NTSTATUS) 0xC0000120L) +#endif + +#ifndef STATUS_CANNOT_DELETE +# define STATUS_CANNOT_DELETE ((NTSTATUS) 0xC0000121L) +#endif + +#ifndef STATUS_INVALID_COMPUTER_NAME +# define STATUS_INVALID_COMPUTER_NAME ((NTSTATUS) 0xC0000122L) +#endif + +#ifndef STATUS_FILE_DELETED +# define STATUS_FILE_DELETED ((NTSTATUS) 0xC0000123L) +#endif + +#ifndef STATUS_SPECIAL_ACCOUNT +# define STATUS_SPECIAL_ACCOUNT ((NTSTATUS) 0xC0000124L) +#endif + +#ifndef STATUS_SPECIAL_GROUP +# define STATUS_SPECIAL_GROUP ((NTSTATUS) 0xC0000125L) +#endif + +#ifndef STATUS_SPECIAL_USER +# define STATUS_SPECIAL_USER ((NTSTATUS) 0xC0000126L) +#endif + +#ifndef STATUS_MEMBERS_PRIMARY_GROUP +# define STATUS_MEMBERS_PRIMARY_GROUP ((NTSTATUS) 0xC0000127L) +#endif + +#ifndef STATUS_FILE_CLOSED +# define STATUS_FILE_CLOSED ((NTSTATUS) 0xC0000128L) +#endif + +#ifndef STATUS_TOO_MANY_THREADS +# define STATUS_TOO_MANY_THREADS ((NTSTATUS) 0xC0000129L) +#endif + +#ifndef STATUS_THREAD_NOT_IN_PROCESS +# define STATUS_THREAD_NOT_IN_PROCESS ((NTSTATUS) 0xC000012AL) +#endif + +#ifndef STATUS_TOKEN_ALREADY_IN_USE +# define STATUS_TOKEN_ALREADY_IN_USE ((NTSTATUS) 0xC000012BL) +#endif + +#ifndef STATUS_PAGEFILE_QUOTA_EXCEEDED +# define STATUS_PAGEFILE_QUOTA_EXCEEDED ((NTSTATUS) 0xC000012CL) +#endif + +#ifndef STATUS_COMMITMENT_LIMIT +# define STATUS_COMMITMENT_LIMIT ((NTSTATUS) 0xC000012DL) +#endif + +#ifndef STATUS_INVALID_IMAGE_LE_FORMAT +# define STATUS_INVALID_IMAGE_LE_FORMAT ((NTSTATUS) 0xC000012EL) +#endif + +#ifndef STATUS_INVALID_IMAGE_NOT_MZ +# define STATUS_INVALID_IMAGE_NOT_MZ ((NTSTATUS) 0xC000012FL) +#endif + +#ifndef STATUS_INVALID_IMAGE_PROTECT +# define STATUS_INVALID_IMAGE_PROTECT ((NTSTATUS) 0xC0000130L) +#endif + +#ifndef STATUS_INVALID_IMAGE_WIN_16 +# define STATUS_INVALID_IMAGE_WIN_16 ((NTSTATUS) 0xC0000131L) +#endif + +#ifndef STATUS_LOGON_SERVER_CONFLICT +# define STATUS_LOGON_SERVER_CONFLICT ((NTSTATUS) 0xC0000132L) +#endif + +#ifndef STATUS_TIME_DIFFERENCE_AT_DC +# define STATUS_TIME_DIFFERENCE_AT_DC ((NTSTATUS) 0xC0000133L) +#endif + +#ifndef STATUS_SYNCHRONIZATION_REQUIRED +# define STATUS_SYNCHRONIZATION_REQUIRED ((NTSTATUS) 0xC0000134L) +#endif + +#ifndef STATUS_DLL_NOT_FOUND +# define STATUS_DLL_NOT_FOUND ((NTSTATUS) 0xC0000135L) +#endif + +#ifndef STATUS_OPEN_FAILED +# define STATUS_OPEN_FAILED ((NTSTATUS) 0xC0000136L) +#endif + +#ifndef STATUS_IO_PRIVILEGE_FAILED +# define STATUS_IO_PRIVILEGE_FAILED ((NTSTATUS) 0xC0000137L) +#endif + +#ifndef STATUS_ORDINAL_NOT_FOUND +# define STATUS_ORDINAL_NOT_FOUND ((NTSTATUS) 0xC0000138L) +#endif + +#ifndef STATUS_ENTRYPOINT_NOT_FOUND +# define STATUS_ENTRYPOINT_NOT_FOUND ((NTSTATUS) 0xC0000139L) +#endif + +#ifndef STATUS_CONTROL_C_EXIT +# define STATUS_CONTROL_C_EXIT ((NTSTATUS) 0xC000013AL) +#endif + +#ifndef STATUS_LOCAL_DISCONNECT +# define STATUS_LOCAL_DISCONNECT ((NTSTATUS) 0xC000013BL) +#endif + +#ifndef STATUS_REMOTE_DISCONNECT +# define STATUS_REMOTE_DISCONNECT ((NTSTATUS) 0xC000013CL) +#endif + +#ifndef STATUS_REMOTE_RESOURCES +# define STATUS_REMOTE_RESOURCES ((NTSTATUS) 0xC000013DL) +#endif + +#ifndef STATUS_LINK_FAILED +# define STATUS_LINK_FAILED ((NTSTATUS) 0xC000013EL) +#endif + +#ifndef STATUS_LINK_TIMEOUT +# define STATUS_LINK_TIMEOUT ((NTSTATUS) 0xC000013FL) +#endif + +#ifndef STATUS_INVALID_CONNECTION +# define STATUS_INVALID_CONNECTION ((NTSTATUS) 0xC0000140L) +#endif + +#ifndef STATUS_INVALID_ADDRESS +# define STATUS_INVALID_ADDRESS ((NTSTATUS) 0xC0000141L) +#endif + +#ifndef STATUS_DLL_INIT_FAILED +# define STATUS_DLL_INIT_FAILED ((NTSTATUS) 0xC0000142L) +#endif + +#ifndef STATUS_MISSING_SYSTEMFILE +# define STATUS_MISSING_SYSTEMFILE ((NTSTATUS) 0xC0000143L) +#endif + +#ifndef STATUS_UNHANDLED_EXCEPTION +# define STATUS_UNHANDLED_EXCEPTION ((NTSTATUS) 0xC0000144L) +#endif + +#ifndef STATUS_APP_INIT_FAILURE +# define STATUS_APP_INIT_FAILURE ((NTSTATUS) 0xC0000145L) +#endif + +#ifndef STATUS_PAGEFILE_CREATE_FAILED +# define STATUS_PAGEFILE_CREATE_FAILED ((NTSTATUS) 0xC0000146L) +#endif + +#ifndef STATUS_NO_PAGEFILE +# define STATUS_NO_PAGEFILE ((NTSTATUS) 0xC0000147L) +#endif + +#ifndef STATUS_INVALID_LEVEL +# define STATUS_INVALID_LEVEL ((NTSTATUS) 0xC0000148L) +#endif + +#ifndef STATUS_WRONG_PASSWORD_CORE +# define STATUS_WRONG_PASSWORD_CORE ((NTSTATUS) 0xC0000149L) +#endif + +#ifndef STATUS_ILLEGAL_FLOAT_CONTEXT +# define STATUS_ILLEGAL_FLOAT_CONTEXT ((NTSTATUS) 0xC000014AL) +#endif + +#ifndef STATUS_PIPE_BROKEN +# define STATUS_PIPE_BROKEN ((NTSTATUS) 0xC000014BL) +#endif + +#ifndef STATUS_REGISTRY_CORRUPT +# define STATUS_REGISTRY_CORRUPT ((NTSTATUS) 0xC000014CL) +#endif + +#ifndef STATUS_REGISTRY_IO_FAILED +# define STATUS_REGISTRY_IO_FAILED ((NTSTATUS) 0xC000014DL) +#endif + +#ifndef STATUS_NO_EVENT_PAIR +# define STATUS_NO_EVENT_PAIR ((NTSTATUS) 0xC000014EL) +#endif + +#ifndef STATUS_UNRECOGNIZED_VOLUME +# define STATUS_UNRECOGNIZED_VOLUME ((NTSTATUS) 0xC000014FL) +#endif + +#ifndef STATUS_SERIAL_NO_DEVICE_INITED +# define STATUS_SERIAL_NO_DEVICE_INITED ((NTSTATUS) 0xC0000150L) +#endif + +#ifndef STATUS_NO_SUCH_ALIAS +# define STATUS_NO_SUCH_ALIAS ((NTSTATUS) 0xC0000151L) +#endif + +#ifndef STATUS_MEMBER_NOT_IN_ALIAS +# define STATUS_MEMBER_NOT_IN_ALIAS ((NTSTATUS) 0xC0000152L) +#endif + +#ifndef STATUS_MEMBER_IN_ALIAS +# define STATUS_MEMBER_IN_ALIAS ((NTSTATUS) 0xC0000153L) +#endif + +#ifndef STATUS_ALIAS_EXISTS +# define STATUS_ALIAS_EXISTS ((NTSTATUS) 0xC0000154L) +#endif + +#ifndef STATUS_LOGON_NOT_GRANTED +# define STATUS_LOGON_NOT_GRANTED ((NTSTATUS) 0xC0000155L) +#endif + +#ifndef STATUS_TOO_MANY_SECRETS +# define STATUS_TOO_MANY_SECRETS ((NTSTATUS) 0xC0000156L) +#endif + +#ifndef STATUS_SECRET_TOO_LONG +# define STATUS_SECRET_TOO_LONG ((NTSTATUS) 0xC0000157L) +#endif + +#ifndef STATUS_INTERNAL_DB_ERROR +# define STATUS_INTERNAL_DB_ERROR ((NTSTATUS) 0xC0000158L) +#endif + +#ifndef STATUS_FULLSCREEN_MODE +# define STATUS_FULLSCREEN_MODE ((NTSTATUS) 0xC0000159L) +#endif + +#ifndef STATUS_TOO_MANY_CONTEXT_IDS +# define STATUS_TOO_MANY_CONTEXT_IDS ((NTSTATUS) 0xC000015AL) +#endif + +#ifndef STATUS_LOGON_TYPE_NOT_GRANTED +# define STATUS_LOGON_TYPE_NOT_GRANTED ((NTSTATUS) 0xC000015BL) +#endif + +#ifndef STATUS_NOT_REGISTRY_FILE +# define STATUS_NOT_REGISTRY_FILE ((NTSTATUS) 0xC000015CL) +#endif + +#ifndef STATUS_NT_CROSS_ENCRYPTION_REQUIRED +# define STATUS_NT_CROSS_ENCRYPTION_REQUIRED ((NTSTATUS) 0xC000015DL) +#endif + +#ifndef STATUS_DOMAIN_CTRLR_CONFIG_ERROR +# define STATUS_DOMAIN_CTRLR_CONFIG_ERROR ((NTSTATUS) 0xC000015EL) +#endif + +#ifndef STATUS_FT_MISSING_MEMBER +# define STATUS_FT_MISSING_MEMBER ((NTSTATUS) 0xC000015FL) +#endif + +#ifndef STATUS_ILL_FORMED_SERVICE_ENTRY +# define STATUS_ILL_FORMED_SERVICE_ENTRY ((NTSTATUS) 0xC0000160L) +#endif + +#ifndef STATUS_ILLEGAL_CHARACTER +# define STATUS_ILLEGAL_CHARACTER ((NTSTATUS) 0xC0000161L) +#endif + +#ifndef STATUS_UNMAPPABLE_CHARACTER +# define STATUS_UNMAPPABLE_CHARACTER ((NTSTATUS) 0xC0000162L) +#endif + +#ifndef STATUS_UNDEFINED_CHARACTER +# define STATUS_UNDEFINED_CHARACTER ((NTSTATUS) 0xC0000163L) +#endif + +#ifndef STATUS_FLOPPY_VOLUME +# define STATUS_FLOPPY_VOLUME ((NTSTATUS) 0xC0000164L) +#endif + +#ifndef STATUS_FLOPPY_ID_MARK_NOT_FOUND +# define STATUS_FLOPPY_ID_MARK_NOT_FOUND ((NTSTATUS) 0xC0000165L) +#endif + +#ifndef STATUS_FLOPPY_WRONG_CYLINDER +# define STATUS_FLOPPY_WRONG_CYLINDER ((NTSTATUS) 0xC0000166L) +#endif + +#ifndef STATUS_FLOPPY_UNKNOWN_ERROR +# define STATUS_FLOPPY_UNKNOWN_ERROR ((NTSTATUS) 0xC0000167L) +#endif + +#ifndef STATUS_FLOPPY_BAD_REGISTERS +# define STATUS_FLOPPY_BAD_REGISTERS ((NTSTATUS) 0xC0000168L) +#endif + +#ifndef STATUS_DISK_RECALIBRATE_FAILED +# define STATUS_DISK_RECALIBRATE_FAILED ((NTSTATUS) 0xC0000169L) +#endif + +#ifndef STATUS_DISK_OPERATION_FAILED +# define STATUS_DISK_OPERATION_FAILED ((NTSTATUS) 0xC000016AL) +#endif + +#ifndef STATUS_DISK_RESET_FAILED +# define STATUS_DISK_RESET_FAILED ((NTSTATUS) 0xC000016BL) +#endif + +#ifndef STATUS_SHARED_IRQ_BUSY +# define STATUS_SHARED_IRQ_BUSY ((NTSTATUS) 0xC000016CL) +#endif + +#ifndef STATUS_FT_ORPHANING +# define STATUS_FT_ORPHANING ((NTSTATUS) 0xC000016DL) +#endif + +#ifndef STATUS_BIOS_FAILED_TO_CONNECT_INTERRUPT +# define STATUS_BIOS_FAILED_TO_CONNECT_INTERRUPT ((NTSTATUS) 0xC000016EL) +#endif + +#ifndef STATUS_PARTITION_FAILURE +# define STATUS_PARTITION_FAILURE ((NTSTATUS) 0xC0000172L) +#endif + +#ifndef STATUS_INVALID_BLOCK_LENGTH +# define STATUS_INVALID_BLOCK_LENGTH ((NTSTATUS) 0xC0000173L) +#endif + +#ifndef STATUS_DEVICE_NOT_PARTITIONED +# define STATUS_DEVICE_NOT_PARTITIONED ((NTSTATUS) 0xC0000174L) +#endif + +#ifndef STATUS_UNABLE_TO_LOCK_MEDIA +# define STATUS_UNABLE_TO_LOCK_MEDIA ((NTSTATUS) 0xC0000175L) +#endif + +#ifndef STATUS_UNABLE_TO_UNLOAD_MEDIA +# define STATUS_UNABLE_TO_UNLOAD_MEDIA ((NTSTATUS) 0xC0000176L) +#endif + +#ifndef STATUS_EOM_OVERFLOW +# define STATUS_EOM_OVERFLOW ((NTSTATUS) 0xC0000177L) +#endif + +#ifndef STATUS_NO_MEDIA +# define STATUS_NO_MEDIA ((NTSTATUS) 0xC0000178L) +#endif + +#ifndef STATUS_NO_SUCH_MEMBER +# define STATUS_NO_SUCH_MEMBER ((NTSTATUS) 0xC000017AL) +#endif + +#ifndef STATUS_INVALID_MEMBER +# define STATUS_INVALID_MEMBER ((NTSTATUS) 0xC000017BL) +#endif + +#ifndef STATUS_KEY_DELETED +# define STATUS_KEY_DELETED ((NTSTATUS) 0xC000017CL) +#endif + +#ifndef STATUS_NO_LOG_SPACE +# define STATUS_NO_LOG_SPACE ((NTSTATUS) 0xC000017DL) +#endif + +#ifndef STATUS_TOO_MANY_SIDS +# define STATUS_TOO_MANY_SIDS ((NTSTATUS) 0xC000017EL) +#endif + +#ifndef STATUS_LM_CROSS_ENCRYPTION_REQUIRED +# define STATUS_LM_CROSS_ENCRYPTION_REQUIRED ((NTSTATUS) 0xC000017FL) +#endif + +#ifndef STATUS_KEY_HAS_CHILDREN +# define STATUS_KEY_HAS_CHILDREN ((NTSTATUS) 0xC0000180L) +#endif + +#ifndef STATUS_CHILD_MUST_BE_VOLATILE +# define STATUS_CHILD_MUST_BE_VOLATILE ((NTSTATUS) 0xC0000181L) +#endif + +#ifndef STATUS_DEVICE_CONFIGURATION_ERROR +# define STATUS_DEVICE_CONFIGURATION_ERROR ((NTSTATUS) 0xC0000182L) +#endif + +#ifndef STATUS_DRIVER_INTERNAL_ERROR +# define STATUS_DRIVER_INTERNAL_ERROR ((NTSTATUS) 0xC0000183L) +#endif + +#ifndef STATUS_INVALID_DEVICE_STATE +# define STATUS_INVALID_DEVICE_STATE ((NTSTATUS) 0xC0000184L) +#endif + +#ifndef STATUS_IO_DEVICE_ERROR +# define STATUS_IO_DEVICE_ERROR ((NTSTATUS) 0xC0000185L) +#endif + +#ifndef STATUS_DEVICE_PROTOCOL_ERROR +# define STATUS_DEVICE_PROTOCOL_ERROR ((NTSTATUS) 0xC0000186L) +#endif + +#ifndef STATUS_BACKUP_CONTROLLER +# define STATUS_BACKUP_CONTROLLER ((NTSTATUS) 0xC0000187L) +#endif + +#ifndef STATUS_LOG_FILE_FULL +# define STATUS_LOG_FILE_FULL ((NTSTATUS) 0xC0000188L) +#endif + +#ifndef STATUS_TOO_LATE +# define STATUS_TOO_LATE ((NTSTATUS) 0xC0000189L) +#endif + +#ifndef STATUS_NO_TRUST_LSA_SECRET +# define STATUS_NO_TRUST_LSA_SECRET ((NTSTATUS) 0xC000018AL) +#endif + +#ifndef STATUS_NO_TRUST_SAM_ACCOUNT +# define STATUS_NO_TRUST_SAM_ACCOUNT ((NTSTATUS) 0xC000018BL) +#endif + +#ifndef STATUS_TRUSTED_DOMAIN_FAILURE +# define STATUS_TRUSTED_DOMAIN_FAILURE ((NTSTATUS) 0xC000018CL) +#endif + +#ifndef STATUS_TRUSTED_RELATIONSHIP_FAILURE +# define STATUS_TRUSTED_RELATIONSHIP_FAILURE ((NTSTATUS) 0xC000018DL) +#endif + +#ifndef STATUS_EVENTLOG_FILE_CORRUPT +# define STATUS_EVENTLOG_FILE_CORRUPT ((NTSTATUS) 0xC000018EL) +#endif + +#ifndef STATUS_EVENTLOG_CANT_START +# define STATUS_EVENTLOG_CANT_START ((NTSTATUS) 0xC000018FL) +#endif + +#ifndef STATUS_TRUST_FAILURE +# define STATUS_TRUST_FAILURE ((NTSTATUS) 0xC0000190L) +#endif + +#ifndef STATUS_MUTANT_LIMIT_EXCEEDED +# define STATUS_MUTANT_LIMIT_EXCEEDED ((NTSTATUS) 0xC0000191L) +#endif + +#ifndef STATUS_NETLOGON_NOT_STARTED +# define STATUS_NETLOGON_NOT_STARTED ((NTSTATUS) 0xC0000192L) +#endif + +#ifndef STATUS_ACCOUNT_EXPIRED +# define STATUS_ACCOUNT_EXPIRED ((NTSTATUS) 0xC0000193L) +#endif + +#ifndef STATUS_POSSIBLE_DEADLOCK +# define STATUS_POSSIBLE_DEADLOCK ((NTSTATUS) 0xC0000194L) +#endif + +#ifndef STATUS_NETWORK_CREDENTIAL_CONFLICT +# define STATUS_NETWORK_CREDENTIAL_CONFLICT ((NTSTATUS) 0xC0000195L) +#endif + +#ifndef STATUS_REMOTE_SESSION_LIMIT +# define STATUS_REMOTE_SESSION_LIMIT ((NTSTATUS) 0xC0000196L) +#endif + +#ifndef STATUS_EVENTLOG_FILE_CHANGED +# define STATUS_EVENTLOG_FILE_CHANGED ((NTSTATUS) 0xC0000197L) +#endif + +#ifndef STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT +# define STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT ((NTSTATUS) 0xC0000198L) +#endif + +#ifndef STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT +# define STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT ((NTSTATUS) 0xC0000199L) +#endif + +#ifndef STATUS_NOLOGON_SERVER_TRUST_ACCOUNT +# define STATUS_NOLOGON_SERVER_TRUST_ACCOUNT ((NTSTATUS) 0xC000019AL) +#endif + +#ifndef STATUS_DOMAIN_TRUST_INCONSISTENT +# define STATUS_DOMAIN_TRUST_INCONSISTENT ((NTSTATUS) 0xC000019BL) +#endif + +#ifndef STATUS_FS_DRIVER_REQUIRED +# define STATUS_FS_DRIVER_REQUIRED ((NTSTATUS) 0xC000019CL) +#endif + +#ifndef STATUS_IMAGE_ALREADY_LOADED_AS_DLL +# define STATUS_IMAGE_ALREADY_LOADED_AS_DLL ((NTSTATUS) 0xC000019DL) +#endif + +#ifndef STATUS_INCOMPATIBLE_WITH_GLOBAL_SHORT_NAME_REGISTRY_SETTING +# define STATUS_INCOMPATIBLE_WITH_GLOBAL_SHORT_NAME_REGISTRY_SETTING ((NTSTATUS) 0xC000019EL) +#endif + +#ifndef STATUS_SHORT_NAMES_NOT_ENABLED_ON_VOLUME +# define STATUS_SHORT_NAMES_NOT_ENABLED_ON_VOLUME ((NTSTATUS) 0xC000019FL) +#endif + +#ifndef STATUS_SECURITY_STREAM_IS_INCONSISTENT +# define STATUS_SECURITY_STREAM_IS_INCONSISTENT ((NTSTATUS) 0xC00001A0L) +#endif + +#ifndef STATUS_INVALID_LOCK_RANGE +# define STATUS_INVALID_LOCK_RANGE ((NTSTATUS) 0xC00001A1L) +#endif + +#ifndef STATUS_INVALID_ACE_CONDITION +# define STATUS_INVALID_ACE_CONDITION ((NTSTATUS) 0xC00001A2L) +#endif + +#ifndef STATUS_IMAGE_SUBSYSTEM_NOT_PRESENT +# define STATUS_IMAGE_SUBSYSTEM_NOT_PRESENT ((NTSTATUS) 0xC00001A3L) +#endif + +#ifndef STATUS_NOTIFICATION_GUID_ALREADY_DEFINED +# define STATUS_NOTIFICATION_GUID_ALREADY_DEFINED ((NTSTATUS) 0xC00001A4L) +#endif + +#ifndef STATUS_NETWORK_OPEN_RESTRICTION +# define STATUS_NETWORK_OPEN_RESTRICTION ((NTSTATUS) 0xC0000201L) +#endif + +#ifndef STATUS_NO_USER_SESSION_KEY +# define STATUS_NO_USER_SESSION_KEY ((NTSTATUS) 0xC0000202L) +#endif + +#ifndef STATUS_USER_SESSION_DELETED +# define STATUS_USER_SESSION_DELETED ((NTSTATUS) 0xC0000203L) +#endif + +#ifndef STATUS_RESOURCE_LANG_NOT_FOUND +# define STATUS_RESOURCE_LANG_NOT_FOUND ((NTSTATUS) 0xC0000204L) +#endif + +#ifndef STATUS_INSUFF_SERVER_RESOURCES +# define STATUS_INSUFF_SERVER_RESOURCES ((NTSTATUS) 0xC0000205L) +#endif + +#ifndef STATUS_INVALID_BUFFER_SIZE +# define STATUS_INVALID_BUFFER_SIZE ((NTSTATUS) 0xC0000206L) +#endif + +#ifndef STATUS_INVALID_ADDRESS_COMPONENT +# define STATUS_INVALID_ADDRESS_COMPONENT ((NTSTATUS) 0xC0000207L) +#endif + +#ifndef STATUS_INVALID_ADDRESS_WILDCARD +# define STATUS_INVALID_ADDRESS_WILDCARD ((NTSTATUS) 0xC0000208L) +#endif + +#ifndef STATUS_TOO_MANY_ADDRESSES +# define STATUS_TOO_MANY_ADDRESSES ((NTSTATUS) 0xC0000209L) +#endif + +#ifndef STATUS_ADDRESS_ALREADY_EXISTS +# define STATUS_ADDRESS_ALREADY_EXISTS ((NTSTATUS) 0xC000020AL) +#endif + +#ifndef STATUS_ADDRESS_CLOSED +# define STATUS_ADDRESS_CLOSED ((NTSTATUS) 0xC000020BL) +#endif + +#ifndef STATUS_CONNECTION_DISCONNECTED +# define STATUS_CONNECTION_DISCONNECTED ((NTSTATUS) 0xC000020CL) +#endif + +#ifndef STATUS_CONNECTION_RESET +# define STATUS_CONNECTION_RESET ((NTSTATUS) 0xC000020DL) +#endif + +#ifndef STATUS_TOO_MANY_NODES +# define STATUS_TOO_MANY_NODES ((NTSTATUS) 0xC000020EL) +#endif + +#ifndef STATUS_TRANSACTION_ABORTED +# define STATUS_TRANSACTION_ABORTED ((NTSTATUS) 0xC000020FL) +#endif + +#ifndef STATUS_TRANSACTION_TIMED_OUT +# define STATUS_TRANSACTION_TIMED_OUT ((NTSTATUS) 0xC0000210L) +#endif + +#ifndef STATUS_TRANSACTION_NO_RELEASE +# define STATUS_TRANSACTION_NO_RELEASE ((NTSTATUS) 0xC0000211L) +#endif + +#ifndef STATUS_TRANSACTION_NO_MATCH +# define STATUS_TRANSACTION_NO_MATCH ((NTSTATUS) 0xC0000212L) +#endif + +#ifndef STATUS_TRANSACTION_RESPONDED +# define STATUS_TRANSACTION_RESPONDED ((NTSTATUS) 0xC0000213L) +#endif + +#ifndef STATUS_TRANSACTION_INVALID_ID +# define STATUS_TRANSACTION_INVALID_ID ((NTSTATUS) 0xC0000214L) +#endif + +#ifndef STATUS_TRANSACTION_INVALID_TYPE +# define STATUS_TRANSACTION_INVALID_TYPE ((NTSTATUS) 0xC0000215L) +#endif + +#ifndef STATUS_NOT_SERVER_SESSION +# define STATUS_NOT_SERVER_SESSION ((NTSTATUS) 0xC0000216L) +#endif + +#ifndef STATUS_NOT_CLIENT_SESSION +# define STATUS_NOT_CLIENT_SESSION ((NTSTATUS) 0xC0000217L) +#endif + +#ifndef STATUS_CANNOT_LOAD_REGISTRY_FILE +# define STATUS_CANNOT_LOAD_REGISTRY_FILE ((NTSTATUS) 0xC0000218L) +#endif + +#ifndef STATUS_DEBUG_ATTACH_FAILED +# define STATUS_DEBUG_ATTACH_FAILED ((NTSTATUS) 0xC0000219L) +#endif + +#ifndef STATUS_SYSTEM_PROCESS_TERMINATED +# define STATUS_SYSTEM_PROCESS_TERMINATED ((NTSTATUS) 0xC000021AL) +#endif + +#ifndef STATUS_DATA_NOT_ACCEPTED +# define STATUS_DATA_NOT_ACCEPTED ((NTSTATUS) 0xC000021BL) +#endif + +#ifndef STATUS_NO_BROWSER_SERVERS_FOUND +# define STATUS_NO_BROWSER_SERVERS_FOUND ((NTSTATUS) 0xC000021CL) +#endif + +#ifndef STATUS_VDM_HARD_ERROR +# define STATUS_VDM_HARD_ERROR ((NTSTATUS) 0xC000021DL) +#endif + +#ifndef STATUS_DRIVER_CANCEL_TIMEOUT +# define STATUS_DRIVER_CANCEL_TIMEOUT ((NTSTATUS) 0xC000021EL) +#endif + +#ifndef STATUS_REPLY_MESSAGE_MISMATCH +# define STATUS_REPLY_MESSAGE_MISMATCH ((NTSTATUS) 0xC000021FL) +#endif + +#ifndef STATUS_MAPPED_ALIGNMENT +# define STATUS_MAPPED_ALIGNMENT ((NTSTATUS) 0xC0000220L) +#endif + +#ifndef STATUS_IMAGE_CHECKSUM_MISMATCH +# define STATUS_IMAGE_CHECKSUM_MISMATCH ((NTSTATUS) 0xC0000221L) +#endif + +#ifndef STATUS_LOST_WRITEBEHIND_DATA +# define STATUS_LOST_WRITEBEHIND_DATA ((NTSTATUS) 0xC0000222L) +#endif + +#ifndef STATUS_CLIENT_SERVER_PARAMETERS_INVALID +# define STATUS_CLIENT_SERVER_PARAMETERS_INVALID ((NTSTATUS) 0xC0000223L) +#endif + +#ifndef STATUS_PASSWORD_MUST_CHANGE +# define STATUS_PASSWORD_MUST_CHANGE ((NTSTATUS) 0xC0000224L) +#endif + +#ifndef STATUS_NOT_FOUND +# define STATUS_NOT_FOUND ((NTSTATUS) 0xC0000225L) +#endif + +#ifndef STATUS_NOT_TINY_STREAM +# define STATUS_NOT_TINY_STREAM ((NTSTATUS) 0xC0000226L) +#endif + +#ifndef STATUS_RECOVERY_FAILURE +# define STATUS_RECOVERY_FAILURE ((NTSTATUS) 0xC0000227L) +#endif + +#ifndef STATUS_STACK_OVERFLOW_READ +# define STATUS_STACK_OVERFLOW_READ ((NTSTATUS) 0xC0000228L) +#endif + +#ifndef STATUS_FAIL_CHECK +# define STATUS_FAIL_CHECK ((NTSTATUS) 0xC0000229L) +#endif + +#ifndef STATUS_DUPLICATE_OBJECTID +# define STATUS_DUPLICATE_OBJECTID ((NTSTATUS) 0xC000022AL) +#endif + +#ifndef STATUS_OBJECTID_EXISTS +# define STATUS_OBJECTID_EXISTS ((NTSTATUS) 0xC000022BL) +#endif + +#ifndef STATUS_CONVERT_TO_LARGE +# define STATUS_CONVERT_TO_LARGE ((NTSTATUS) 0xC000022CL) +#endif + +#ifndef STATUS_RETRY +# define STATUS_RETRY ((NTSTATUS) 0xC000022DL) +#endif + +#ifndef STATUS_FOUND_OUT_OF_SCOPE +# define STATUS_FOUND_OUT_OF_SCOPE ((NTSTATUS) 0xC000022EL) +#endif + +#ifndef STATUS_ALLOCATE_BUCKET +# define STATUS_ALLOCATE_BUCKET ((NTSTATUS) 0xC000022FL) +#endif + +#ifndef STATUS_PROPSET_NOT_FOUND +# define STATUS_PROPSET_NOT_FOUND ((NTSTATUS) 0xC0000230L) +#endif + +#ifndef STATUS_MARSHALL_OVERFLOW +# define STATUS_MARSHALL_OVERFLOW ((NTSTATUS) 0xC0000231L) +#endif + +#ifndef STATUS_INVALID_VARIANT +# define STATUS_INVALID_VARIANT ((NTSTATUS) 0xC0000232L) +#endif + +#ifndef STATUS_DOMAIN_CONTROLLER_NOT_FOUND +# define STATUS_DOMAIN_CONTROLLER_NOT_FOUND ((NTSTATUS) 0xC0000233L) +#endif + +#ifndef STATUS_ACCOUNT_LOCKED_OUT +# define STATUS_ACCOUNT_LOCKED_OUT ((NTSTATUS) 0xC0000234L) +#endif + +#ifndef STATUS_HANDLE_NOT_CLOSABLE +# define STATUS_HANDLE_NOT_CLOSABLE ((NTSTATUS) 0xC0000235L) +#endif + +#ifndef STATUS_CONNECTION_REFUSED +# define STATUS_CONNECTION_REFUSED ((NTSTATUS) 0xC0000236L) +#endif + +#ifndef STATUS_GRACEFUL_DISCONNECT +# define STATUS_GRACEFUL_DISCONNECT ((NTSTATUS) 0xC0000237L) +#endif + +#ifndef STATUS_ADDRESS_ALREADY_ASSOCIATED +# define STATUS_ADDRESS_ALREADY_ASSOCIATED ((NTSTATUS) 0xC0000238L) +#endif + +#ifndef STATUS_ADDRESS_NOT_ASSOCIATED +# define STATUS_ADDRESS_NOT_ASSOCIATED ((NTSTATUS) 0xC0000239L) +#endif + +#ifndef STATUS_CONNECTION_INVALID +# define STATUS_CONNECTION_INVALID ((NTSTATUS) 0xC000023AL) +#endif + +#ifndef STATUS_CONNECTION_ACTIVE +# define STATUS_CONNECTION_ACTIVE ((NTSTATUS) 0xC000023BL) +#endif + +#ifndef STATUS_NETWORK_UNREACHABLE +# define STATUS_NETWORK_UNREACHABLE ((NTSTATUS) 0xC000023CL) +#endif + +#ifndef STATUS_HOST_UNREACHABLE +# define STATUS_HOST_UNREACHABLE ((NTSTATUS) 0xC000023DL) +#endif + +#ifndef STATUS_PROTOCOL_UNREACHABLE +# define STATUS_PROTOCOL_UNREACHABLE ((NTSTATUS) 0xC000023EL) +#endif + +#ifndef STATUS_PORT_UNREACHABLE +# define STATUS_PORT_UNREACHABLE ((NTSTATUS) 0xC000023FL) +#endif + +#ifndef STATUS_REQUEST_ABORTED +# define STATUS_REQUEST_ABORTED ((NTSTATUS) 0xC0000240L) +#endif + +#ifndef STATUS_CONNECTION_ABORTED +# define STATUS_CONNECTION_ABORTED ((NTSTATUS) 0xC0000241L) +#endif + +#ifndef STATUS_BAD_COMPRESSION_BUFFER +# define STATUS_BAD_COMPRESSION_BUFFER ((NTSTATUS) 0xC0000242L) +#endif + +#ifndef STATUS_USER_MAPPED_FILE +# define STATUS_USER_MAPPED_FILE ((NTSTATUS) 0xC0000243L) +#endif + +#ifndef STATUS_AUDIT_FAILED +# define STATUS_AUDIT_FAILED ((NTSTATUS) 0xC0000244L) +#endif + +#ifndef STATUS_TIMER_RESOLUTION_NOT_SET +# define STATUS_TIMER_RESOLUTION_NOT_SET ((NTSTATUS) 0xC0000245L) +#endif + +#ifndef STATUS_CONNECTION_COUNT_LIMIT +# define STATUS_CONNECTION_COUNT_LIMIT ((NTSTATUS) 0xC0000246L) +#endif + +#ifndef STATUS_LOGIN_TIME_RESTRICTION +# define STATUS_LOGIN_TIME_RESTRICTION ((NTSTATUS) 0xC0000247L) +#endif + +#ifndef STATUS_LOGIN_WKSTA_RESTRICTION +# define STATUS_LOGIN_WKSTA_RESTRICTION ((NTSTATUS) 0xC0000248L) +#endif + +#ifndef STATUS_IMAGE_MP_UP_MISMATCH +# define STATUS_IMAGE_MP_UP_MISMATCH ((NTSTATUS) 0xC0000249L) +#endif + +#ifndef STATUS_INSUFFICIENT_LOGON_INFO +# define STATUS_INSUFFICIENT_LOGON_INFO ((NTSTATUS) 0xC0000250L) +#endif + +#ifndef STATUS_BAD_DLL_ENTRYPOINT +# define STATUS_BAD_DLL_ENTRYPOINT ((NTSTATUS) 0xC0000251L) +#endif + +#ifndef STATUS_BAD_SERVICE_ENTRYPOINT +# define STATUS_BAD_SERVICE_ENTRYPOINT ((NTSTATUS) 0xC0000252L) +#endif + +#ifndef STATUS_LPC_REPLY_LOST +# define STATUS_LPC_REPLY_LOST ((NTSTATUS) 0xC0000253L) +#endif + +#ifndef STATUS_IP_ADDRESS_CONFLICT1 +# define STATUS_IP_ADDRESS_CONFLICT1 ((NTSTATUS) 0xC0000254L) +#endif + +#ifndef STATUS_IP_ADDRESS_CONFLICT2 +# define STATUS_IP_ADDRESS_CONFLICT2 ((NTSTATUS) 0xC0000255L) +#endif + +#ifndef STATUS_REGISTRY_QUOTA_LIMIT +# define STATUS_REGISTRY_QUOTA_LIMIT ((NTSTATUS) 0xC0000256L) +#endif + +#ifndef STATUS_PATH_NOT_COVERED +# define STATUS_PATH_NOT_COVERED ((NTSTATUS) 0xC0000257L) +#endif + +#ifndef STATUS_NO_CALLBACK_ACTIVE +# define STATUS_NO_CALLBACK_ACTIVE ((NTSTATUS) 0xC0000258L) +#endif + +#ifndef STATUS_LICENSE_QUOTA_EXCEEDED +# define STATUS_LICENSE_QUOTA_EXCEEDED ((NTSTATUS) 0xC0000259L) +#endif + +#ifndef STATUS_PWD_TOO_SHORT +# define STATUS_PWD_TOO_SHORT ((NTSTATUS) 0xC000025AL) +#endif + +#ifndef STATUS_PWD_TOO_RECENT +# define STATUS_PWD_TOO_RECENT ((NTSTATUS) 0xC000025BL) +#endif + +#ifndef STATUS_PWD_HISTORY_CONFLICT +# define STATUS_PWD_HISTORY_CONFLICT ((NTSTATUS) 0xC000025CL) +#endif + +#ifndef STATUS_PLUGPLAY_NO_DEVICE +# define STATUS_PLUGPLAY_NO_DEVICE ((NTSTATUS) 0xC000025EL) +#endif + +#ifndef STATUS_UNSUPPORTED_COMPRESSION +# define STATUS_UNSUPPORTED_COMPRESSION ((NTSTATUS) 0xC000025FL) +#endif + +#ifndef STATUS_INVALID_HW_PROFILE +# define STATUS_INVALID_HW_PROFILE ((NTSTATUS) 0xC0000260L) +#endif + +#ifndef STATUS_INVALID_PLUGPLAY_DEVICE_PATH +# define STATUS_INVALID_PLUGPLAY_DEVICE_PATH ((NTSTATUS) 0xC0000261L) +#endif + +#ifndef STATUS_DRIVER_ORDINAL_NOT_FOUND +# define STATUS_DRIVER_ORDINAL_NOT_FOUND ((NTSTATUS) 0xC0000262L) +#endif + +#ifndef STATUS_DRIVER_ENTRYPOINT_NOT_FOUND +# define STATUS_DRIVER_ENTRYPOINT_NOT_FOUND ((NTSTATUS) 0xC0000263L) +#endif + +#ifndef STATUS_RESOURCE_NOT_OWNED +# define STATUS_RESOURCE_NOT_OWNED ((NTSTATUS) 0xC0000264L) +#endif + +#ifndef STATUS_TOO_MANY_LINKS +# define STATUS_TOO_MANY_LINKS ((NTSTATUS) 0xC0000265L) +#endif + +#ifndef STATUS_QUOTA_LIST_INCONSISTENT +# define STATUS_QUOTA_LIST_INCONSISTENT ((NTSTATUS) 0xC0000266L) +#endif + +#ifndef STATUS_FILE_IS_OFFLINE +# define STATUS_FILE_IS_OFFLINE ((NTSTATUS) 0xC0000267L) +#endif + +#ifndef STATUS_EVALUATION_EXPIRATION +# define STATUS_EVALUATION_EXPIRATION ((NTSTATUS) 0xC0000268L) +#endif + +#ifndef STATUS_ILLEGAL_DLL_RELOCATION +# define STATUS_ILLEGAL_DLL_RELOCATION ((NTSTATUS) 0xC0000269L) +#endif + +#ifndef STATUS_LICENSE_VIOLATION +# define STATUS_LICENSE_VIOLATION ((NTSTATUS) 0xC000026AL) +#endif + +#ifndef STATUS_DLL_INIT_FAILED_LOGOFF +# define STATUS_DLL_INIT_FAILED_LOGOFF ((NTSTATUS) 0xC000026BL) +#endif + +#ifndef STATUS_DRIVER_UNABLE_TO_LOAD +# define STATUS_DRIVER_UNABLE_TO_LOAD ((NTSTATUS) 0xC000026CL) +#endif + +#ifndef STATUS_DFS_UNAVAILABLE +# define STATUS_DFS_UNAVAILABLE ((NTSTATUS) 0xC000026DL) +#endif + +#ifndef STATUS_VOLUME_DISMOUNTED +# define STATUS_VOLUME_DISMOUNTED ((NTSTATUS) 0xC000026EL) +#endif + +#ifndef STATUS_WX86_INTERNAL_ERROR +# define STATUS_WX86_INTERNAL_ERROR ((NTSTATUS) 0xC000026FL) +#endif + +#ifndef STATUS_WX86_FLOAT_STACK_CHECK +# define STATUS_WX86_FLOAT_STACK_CHECK ((NTSTATUS) 0xC0000270L) +#endif + +#ifndef STATUS_VALIDATE_CONTINUE +# define STATUS_VALIDATE_CONTINUE ((NTSTATUS) 0xC0000271L) +#endif + +#ifndef STATUS_NO_MATCH +# define STATUS_NO_MATCH ((NTSTATUS) 0xC0000272L) +#endif + +#ifndef STATUS_NO_MORE_MATCHES +# define STATUS_NO_MORE_MATCHES ((NTSTATUS) 0xC0000273L) +#endif + +#ifndef STATUS_NOT_A_REPARSE_POINT +# define STATUS_NOT_A_REPARSE_POINT ((NTSTATUS) 0xC0000275L) +#endif + +#ifndef STATUS_IO_REPARSE_TAG_INVALID +# define STATUS_IO_REPARSE_TAG_INVALID ((NTSTATUS) 0xC0000276L) +#endif + +#ifndef STATUS_IO_REPARSE_TAG_MISMATCH +# define STATUS_IO_REPARSE_TAG_MISMATCH ((NTSTATUS) 0xC0000277L) +#endif + +#ifndef STATUS_IO_REPARSE_DATA_INVALID +# define STATUS_IO_REPARSE_DATA_INVALID ((NTSTATUS) 0xC0000278L) +#endif + +#ifndef STATUS_IO_REPARSE_TAG_NOT_HANDLED +# define STATUS_IO_REPARSE_TAG_NOT_HANDLED ((NTSTATUS) 0xC0000279L) +#endif + +#ifndef STATUS_REPARSE_POINT_NOT_RESOLVED +# define STATUS_REPARSE_POINT_NOT_RESOLVED ((NTSTATUS) 0xC0000280L) +#endif + +#ifndef STATUS_DIRECTORY_IS_A_REPARSE_POINT +# define STATUS_DIRECTORY_IS_A_REPARSE_POINT ((NTSTATUS) 0xC0000281L) +#endif + +#ifndef STATUS_RANGE_LIST_CONFLICT +# define STATUS_RANGE_LIST_CONFLICT ((NTSTATUS) 0xC0000282L) +#endif + +#ifndef STATUS_SOURCE_ELEMENT_EMPTY +# define STATUS_SOURCE_ELEMENT_EMPTY ((NTSTATUS) 0xC0000283L) +#endif + +#ifndef STATUS_DESTINATION_ELEMENT_FULL +# define STATUS_DESTINATION_ELEMENT_FULL ((NTSTATUS) 0xC0000284L) +#endif + +#ifndef STATUS_ILLEGAL_ELEMENT_ADDRESS +# define STATUS_ILLEGAL_ELEMENT_ADDRESS ((NTSTATUS) 0xC0000285L) +#endif + +#ifndef STATUS_MAGAZINE_NOT_PRESENT +# define STATUS_MAGAZINE_NOT_PRESENT ((NTSTATUS) 0xC0000286L) +#endif + +#ifndef STATUS_REINITIALIZATION_NEEDED +# define STATUS_REINITIALIZATION_NEEDED ((NTSTATUS) 0xC0000287L) +#endif + +#ifndef STATUS_DEVICE_REQUIRES_CLEANING +# define STATUS_DEVICE_REQUIRES_CLEANING ((NTSTATUS) 0x80000288L) +#endif + +#ifndef STATUS_DEVICE_DOOR_OPEN +# define STATUS_DEVICE_DOOR_OPEN ((NTSTATUS) 0x80000289L) +#endif + +#ifndef STATUS_ENCRYPTION_FAILED +# define STATUS_ENCRYPTION_FAILED ((NTSTATUS) 0xC000028AL) +#endif + +#ifndef STATUS_DECRYPTION_FAILED +# define STATUS_DECRYPTION_FAILED ((NTSTATUS) 0xC000028BL) +#endif + +#ifndef STATUS_RANGE_NOT_FOUND +# define STATUS_RANGE_NOT_FOUND ((NTSTATUS) 0xC000028CL) +#endif + +#ifndef STATUS_NO_RECOVERY_POLICY +# define STATUS_NO_RECOVERY_POLICY ((NTSTATUS) 0xC000028DL) +#endif + +#ifndef STATUS_NO_EFS +# define STATUS_NO_EFS ((NTSTATUS) 0xC000028EL) +#endif + +#ifndef STATUS_WRONG_EFS +# define STATUS_WRONG_EFS ((NTSTATUS) 0xC000028FL) +#endif + +#ifndef STATUS_NO_USER_KEYS +# define STATUS_NO_USER_KEYS ((NTSTATUS) 0xC0000290L) +#endif + +#ifndef STATUS_FILE_NOT_ENCRYPTED +# define STATUS_FILE_NOT_ENCRYPTED ((NTSTATUS) 0xC0000291L) +#endif + +#ifndef STATUS_NOT_EXPORT_FORMAT +# define STATUS_NOT_EXPORT_FORMAT ((NTSTATUS) 0xC0000292L) +#endif + +#ifndef STATUS_FILE_ENCRYPTED +# define STATUS_FILE_ENCRYPTED ((NTSTATUS) 0xC0000293L) +#endif + +#ifndef STATUS_WAKE_SYSTEM +# define STATUS_WAKE_SYSTEM ((NTSTATUS) 0x40000294L) +#endif + +#ifndef STATUS_WMI_GUID_NOT_FOUND +# define STATUS_WMI_GUID_NOT_FOUND ((NTSTATUS) 0xC0000295L) +#endif + +#ifndef STATUS_WMI_INSTANCE_NOT_FOUND +# define STATUS_WMI_INSTANCE_NOT_FOUND ((NTSTATUS) 0xC0000296L) +#endif + +#ifndef STATUS_WMI_ITEMID_NOT_FOUND +# define STATUS_WMI_ITEMID_NOT_FOUND ((NTSTATUS) 0xC0000297L) +#endif + +#ifndef STATUS_WMI_TRY_AGAIN +# define STATUS_WMI_TRY_AGAIN ((NTSTATUS) 0xC0000298L) +#endif + +#ifndef STATUS_SHARED_POLICY +# define STATUS_SHARED_POLICY ((NTSTATUS) 0xC0000299L) +#endif + +#ifndef STATUS_POLICY_OBJECT_NOT_FOUND +# define STATUS_POLICY_OBJECT_NOT_FOUND ((NTSTATUS) 0xC000029AL) +#endif + +#ifndef STATUS_POLICY_ONLY_IN_DS +# define STATUS_POLICY_ONLY_IN_DS ((NTSTATUS) 0xC000029BL) +#endif + +#ifndef STATUS_VOLUME_NOT_UPGRADED +# define STATUS_VOLUME_NOT_UPGRADED ((NTSTATUS) 0xC000029CL) +#endif + +#ifndef STATUS_REMOTE_STORAGE_NOT_ACTIVE +# define STATUS_REMOTE_STORAGE_NOT_ACTIVE ((NTSTATUS) 0xC000029DL) +#endif + +#ifndef STATUS_REMOTE_STORAGE_MEDIA_ERROR +# define STATUS_REMOTE_STORAGE_MEDIA_ERROR ((NTSTATUS) 0xC000029EL) +#endif + +#ifndef STATUS_NO_TRACKING_SERVICE +# define STATUS_NO_TRACKING_SERVICE ((NTSTATUS) 0xC000029FL) +#endif + +#ifndef STATUS_SERVER_SID_MISMATCH +# define STATUS_SERVER_SID_MISMATCH ((NTSTATUS) 0xC00002A0L) +#endif + +#ifndef STATUS_DS_NO_ATTRIBUTE_OR_VALUE +# define STATUS_DS_NO_ATTRIBUTE_OR_VALUE ((NTSTATUS) 0xC00002A1L) +#endif + +#ifndef STATUS_DS_INVALID_ATTRIBUTE_SYNTAX +# define STATUS_DS_INVALID_ATTRIBUTE_SYNTAX ((NTSTATUS) 0xC00002A2L) +#endif + +#ifndef STATUS_DS_ATTRIBUTE_TYPE_UNDEFINED +# define STATUS_DS_ATTRIBUTE_TYPE_UNDEFINED ((NTSTATUS) 0xC00002A3L) +#endif + +#ifndef STATUS_DS_ATTRIBUTE_OR_VALUE_EXISTS +# define STATUS_DS_ATTRIBUTE_OR_VALUE_EXISTS ((NTSTATUS) 0xC00002A4L) +#endif + +#ifndef STATUS_DS_BUSY +# define STATUS_DS_BUSY ((NTSTATUS) 0xC00002A5L) +#endif + +#ifndef STATUS_DS_UNAVAILABLE +# define STATUS_DS_UNAVAILABLE ((NTSTATUS) 0xC00002A6L) +#endif + +#ifndef STATUS_DS_NO_RIDS_ALLOCATED +# define STATUS_DS_NO_RIDS_ALLOCATED ((NTSTATUS) 0xC00002A7L) +#endif + +#ifndef STATUS_DS_NO_MORE_RIDS +# define STATUS_DS_NO_MORE_RIDS ((NTSTATUS) 0xC00002A8L) +#endif + +#ifndef STATUS_DS_INCORRECT_ROLE_OWNER +# define STATUS_DS_INCORRECT_ROLE_OWNER ((NTSTATUS) 0xC00002A9L) +#endif + +#ifndef STATUS_DS_RIDMGR_INIT_ERROR +# define STATUS_DS_RIDMGR_INIT_ERROR ((NTSTATUS) 0xC00002AAL) +#endif + +#ifndef STATUS_DS_OBJ_CLASS_VIOLATION +# define STATUS_DS_OBJ_CLASS_VIOLATION ((NTSTATUS) 0xC00002ABL) +#endif + +#ifndef STATUS_DS_CANT_ON_NON_LEAF +# define STATUS_DS_CANT_ON_NON_LEAF ((NTSTATUS) 0xC00002ACL) +#endif + +#ifndef STATUS_DS_CANT_ON_RDN +# define STATUS_DS_CANT_ON_RDN ((NTSTATUS) 0xC00002ADL) +#endif + +#ifndef STATUS_DS_CANT_MOD_OBJ_CLASS +# define STATUS_DS_CANT_MOD_OBJ_CLASS ((NTSTATUS) 0xC00002AEL) +#endif + +#ifndef STATUS_DS_CROSS_DOM_MOVE_FAILED +# define STATUS_DS_CROSS_DOM_MOVE_FAILED ((NTSTATUS) 0xC00002AFL) +#endif + +#ifndef STATUS_DS_GC_NOT_AVAILABLE +# define STATUS_DS_GC_NOT_AVAILABLE ((NTSTATUS) 0xC00002B0L) +#endif + +#ifndef STATUS_DIRECTORY_SERVICE_REQUIRED +# define STATUS_DIRECTORY_SERVICE_REQUIRED ((NTSTATUS) 0xC00002B1L) +#endif + +#ifndef STATUS_REPARSE_ATTRIBUTE_CONFLICT +# define STATUS_REPARSE_ATTRIBUTE_CONFLICT ((NTSTATUS) 0xC00002B2L) +#endif + +#ifndef STATUS_CANT_ENABLE_DENY_ONLY +# define STATUS_CANT_ENABLE_DENY_ONLY ((NTSTATUS) 0xC00002B3L) +#endif + +#ifndef STATUS_FLOAT_MULTIPLE_FAULTS +# define STATUS_FLOAT_MULTIPLE_FAULTS ((NTSTATUS) 0xC00002B4L) +#endif + +#ifndef STATUS_FLOAT_MULTIPLE_TRAPS +# define STATUS_FLOAT_MULTIPLE_TRAPS ((NTSTATUS) 0xC00002B5L) +#endif + +#ifndef STATUS_DEVICE_REMOVED +# define STATUS_DEVICE_REMOVED ((NTSTATUS) 0xC00002B6L) +#endif + +#ifndef STATUS_JOURNAL_DELETE_IN_PROGRESS +# define STATUS_JOURNAL_DELETE_IN_PROGRESS ((NTSTATUS) 0xC00002B7L) +#endif + +#ifndef STATUS_JOURNAL_NOT_ACTIVE +# define STATUS_JOURNAL_NOT_ACTIVE ((NTSTATUS) 0xC00002B8L) +#endif + +#ifndef STATUS_NOINTERFACE +# define STATUS_NOINTERFACE ((NTSTATUS) 0xC00002B9L) +#endif + +#ifndef STATUS_DS_ADMIN_LIMIT_EXCEEDED +# define STATUS_DS_ADMIN_LIMIT_EXCEEDED ((NTSTATUS) 0xC00002C1L) +#endif + +#ifndef STATUS_DRIVER_FAILED_SLEEP +# define STATUS_DRIVER_FAILED_SLEEP ((NTSTATUS) 0xC00002C2L) +#endif + +#ifndef STATUS_MUTUAL_AUTHENTICATION_FAILED +# define STATUS_MUTUAL_AUTHENTICATION_FAILED ((NTSTATUS) 0xC00002C3L) +#endif + +#ifndef STATUS_CORRUPT_SYSTEM_FILE +# define STATUS_CORRUPT_SYSTEM_FILE ((NTSTATUS) 0xC00002C4L) +#endif + +#ifndef STATUS_DATATYPE_MISALIGNMENT_ERROR +# define STATUS_DATATYPE_MISALIGNMENT_ERROR ((NTSTATUS) 0xC00002C5L) +#endif + +#ifndef STATUS_WMI_READ_ONLY +# define STATUS_WMI_READ_ONLY ((NTSTATUS) 0xC00002C6L) +#endif + +#ifndef STATUS_WMI_SET_FAILURE +# define STATUS_WMI_SET_FAILURE ((NTSTATUS) 0xC00002C7L) +#endif + +#ifndef STATUS_COMMITMENT_MINIMUM +# define STATUS_COMMITMENT_MINIMUM ((NTSTATUS) 0xC00002C8L) +#endif + +#ifndef STATUS_REG_NAT_CONSUMPTION +# define STATUS_REG_NAT_CONSUMPTION ((NTSTATUS) 0xC00002C9L) +#endif + +#ifndef STATUS_TRANSPORT_FULL +# define STATUS_TRANSPORT_FULL ((NTSTATUS) 0xC00002CAL) +#endif + +#ifndef STATUS_DS_SAM_INIT_FAILURE +# define STATUS_DS_SAM_INIT_FAILURE ((NTSTATUS) 0xC00002CBL) +#endif + +#ifndef STATUS_ONLY_IF_CONNECTED +# define STATUS_ONLY_IF_CONNECTED ((NTSTATUS) 0xC00002CCL) +#endif + +#ifndef STATUS_DS_SENSITIVE_GROUP_VIOLATION +# define STATUS_DS_SENSITIVE_GROUP_VIOLATION ((NTSTATUS) 0xC00002CDL) +#endif + +#ifndef STATUS_PNP_RESTART_ENUMERATION +# define STATUS_PNP_RESTART_ENUMERATION ((NTSTATUS) 0xC00002CEL) +#endif + +#ifndef STATUS_JOURNAL_ENTRY_DELETED +# define STATUS_JOURNAL_ENTRY_DELETED ((NTSTATUS) 0xC00002CFL) +#endif + +#ifndef STATUS_DS_CANT_MOD_PRIMARYGROUPID +# define STATUS_DS_CANT_MOD_PRIMARYGROUPID ((NTSTATUS) 0xC00002D0L) +#endif + +#ifndef STATUS_SYSTEM_IMAGE_BAD_SIGNATURE +# define STATUS_SYSTEM_IMAGE_BAD_SIGNATURE ((NTSTATUS) 0xC00002D1L) +#endif + +#ifndef STATUS_PNP_REBOOT_REQUIRED +# define STATUS_PNP_REBOOT_REQUIRED ((NTSTATUS) 0xC00002D2L) +#endif + +#ifndef STATUS_POWER_STATE_INVALID +# define STATUS_POWER_STATE_INVALID ((NTSTATUS) 0xC00002D3L) +#endif + +#ifndef STATUS_DS_INVALID_GROUP_TYPE +# define STATUS_DS_INVALID_GROUP_TYPE ((NTSTATUS) 0xC00002D4L) +#endif + +#ifndef STATUS_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN +# define STATUS_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN ((NTSTATUS) 0xC00002D5L) +#endif + +#ifndef STATUS_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN +# define STATUS_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN ((NTSTATUS) 0xC00002D6L) +#endif + +#ifndef STATUS_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER +# define STATUS_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER ((NTSTATUS) 0xC00002D7L) +#endif + +#ifndef STATUS_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER +# define STATUS_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER ((NTSTATUS) 0xC00002D8L) +#endif + +#ifndef STATUS_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER +# define STATUS_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER ((NTSTATUS) 0xC00002D9L) +#endif + +#ifndef STATUS_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER +# define STATUS_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER ((NTSTATUS) 0xC00002DAL) +#endif + +#ifndef STATUS_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER +# define STATUS_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER ((NTSTATUS) 0xC00002DBL) +#endif + +#ifndef STATUS_DS_HAVE_PRIMARY_MEMBERS +# define STATUS_DS_HAVE_PRIMARY_MEMBERS ((NTSTATUS) 0xC00002DCL) +#endif + +#ifndef STATUS_WMI_NOT_SUPPORTED +# define STATUS_WMI_NOT_SUPPORTED ((NTSTATUS) 0xC00002DDL) +#endif + +#ifndef STATUS_INSUFFICIENT_POWER +# define STATUS_INSUFFICIENT_POWER ((NTSTATUS) 0xC00002DEL) +#endif + +#ifndef STATUS_SAM_NEED_BOOTKEY_PASSWORD +# define STATUS_SAM_NEED_BOOTKEY_PASSWORD ((NTSTATUS) 0xC00002DFL) +#endif + +#ifndef STATUS_SAM_NEED_BOOTKEY_FLOPPY +# define STATUS_SAM_NEED_BOOTKEY_FLOPPY ((NTSTATUS) 0xC00002E0L) +#endif + +#ifndef STATUS_DS_CANT_START +# define STATUS_DS_CANT_START ((NTSTATUS) 0xC00002E1L) +#endif + +#ifndef STATUS_DS_INIT_FAILURE +# define STATUS_DS_INIT_FAILURE ((NTSTATUS) 0xC00002E2L) +#endif + +#ifndef STATUS_SAM_INIT_FAILURE +# define STATUS_SAM_INIT_FAILURE ((NTSTATUS) 0xC00002E3L) +#endif + +#ifndef STATUS_DS_GC_REQUIRED +# define STATUS_DS_GC_REQUIRED ((NTSTATUS) 0xC00002E4L) +#endif + +#ifndef STATUS_DS_LOCAL_MEMBER_OF_LOCAL_ONLY +# define STATUS_DS_LOCAL_MEMBER_OF_LOCAL_ONLY ((NTSTATUS) 0xC00002E5L) +#endif + +#ifndef STATUS_DS_NO_FPO_IN_UNIVERSAL_GROUPS +# define STATUS_DS_NO_FPO_IN_UNIVERSAL_GROUPS ((NTSTATUS) 0xC00002E6L) +#endif + +#ifndef STATUS_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED +# define STATUS_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED ((NTSTATUS) 0xC00002E7L) +#endif + +#ifndef STATUS_MULTIPLE_FAULT_VIOLATION +# define STATUS_MULTIPLE_FAULT_VIOLATION ((NTSTATUS) 0xC00002E8L) +#endif + +#ifndef STATUS_CURRENT_DOMAIN_NOT_ALLOWED +# define STATUS_CURRENT_DOMAIN_NOT_ALLOWED ((NTSTATUS) 0xC00002E9L) +#endif + +#ifndef STATUS_CANNOT_MAKE +# define STATUS_CANNOT_MAKE ((NTSTATUS) 0xC00002EAL) +#endif + +#ifndef STATUS_SYSTEM_SHUTDOWN +# define STATUS_SYSTEM_SHUTDOWN ((NTSTATUS) 0xC00002EBL) +#endif + +#ifndef STATUS_DS_INIT_FAILURE_CONSOLE +# define STATUS_DS_INIT_FAILURE_CONSOLE ((NTSTATUS) 0xC00002ECL) +#endif + +#ifndef STATUS_DS_SAM_INIT_FAILURE_CONSOLE +# define STATUS_DS_SAM_INIT_FAILURE_CONSOLE ((NTSTATUS) 0xC00002EDL) +#endif + +#ifndef STATUS_UNFINISHED_CONTEXT_DELETED +# define STATUS_UNFINISHED_CONTEXT_DELETED ((NTSTATUS) 0xC00002EEL) +#endif + +#ifndef STATUS_NO_TGT_REPLY +# define STATUS_NO_TGT_REPLY ((NTSTATUS) 0xC00002EFL) +#endif + +#ifndef STATUS_OBJECTID_NOT_FOUND +# define STATUS_OBJECTID_NOT_FOUND ((NTSTATUS) 0xC00002F0L) +#endif + +#ifndef STATUS_NO_IP_ADDRESSES +# define STATUS_NO_IP_ADDRESSES ((NTSTATUS) 0xC00002F1L) +#endif + +#ifndef STATUS_WRONG_CREDENTIAL_HANDLE +# define STATUS_WRONG_CREDENTIAL_HANDLE ((NTSTATUS) 0xC00002F2L) +#endif + +#ifndef STATUS_CRYPTO_SYSTEM_INVALID +# define STATUS_CRYPTO_SYSTEM_INVALID ((NTSTATUS) 0xC00002F3L) +#endif + +#ifndef STATUS_MAX_REFERRALS_EXCEEDED +# define STATUS_MAX_REFERRALS_EXCEEDED ((NTSTATUS) 0xC00002F4L) +#endif + +#ifndef STATUS_MUST_BE_KDC +# define STATUS_MUST_BE_KDC ((NTSTATUS) 0xC00002F5L) +#endif + +#ifndef STATUS_STRONG_CRYPTO_NOT_SUPPORTED +# define STATUS_STRONG_CRYPTO_NOT_SUPPORTED ((NTSTATUS) 0xC00002F6L) +#endif + +#ifndef STATUS_TOO_MANY_PRINCIPALS +# define STATUS_TOO_MANY_PRINCIPALS ((NTSTATUS) 0xC00002F7L) +#endif + +#ifndef STATUS_NO_PA_DATA +# define STATUS_NO_PA_DATA ((NTSTATUS) 0xC00002F8L) +#endif + +#ifndef STATUS_PKINIT_NAME_MISMATCH +# define STATUS_PKINIT_NAME_MISMATCH ((NTSTATUS) 0xC00002F9L) +#endif + +#ifndef STATUS_SMARTCARD_LOGON_REQUIRED +# define STATUS_SMARTCARD_LOGON_REQUIRED ((NTSTATUS) 0xC00002FAL) +#endif + +#ifndef STATUS_KDC_INVALID_REQUEST +# define STATUS_KDC_INVALID_REQUEST ((NTSTATUS) 0xC00002FBL) +#endif + +#ifndef STATUS_KDC_UNABLE_TO_REFER +# define STATUS_KDC_UNABLE_TO_REFER ((NTSTATUS) 0xC00002FCL) +#endif + +#ifndef STATUS_KDC_UNKNOWN_ETYPE +# define STATUS_KDC_UNKNOWN_ETYPE ((NTSTATUS) 0xC00002FDL) +#endif + +#ifndef STATUS_SHUTDOWN_IN_PROGRESS +# define STATUS_SHUTDOWN_IN_PROGRESS ((NTSTATUS) 0xC00002FEL) +#endif + +#ifndef STATUS_SERVER_SHUTDOWN_IN_PROGRESS +# define STATUS_SERVER_SHUTDOWN_IN_PROGRESS ((NTSTATUS) 0xC00002FFL) +#endif + +#ifndef STATUS_NOT_SUPPORTED_ON_SBS +# define STATUS_NOT_SUPPORTED_ON_SBS ((NTSTATUS) 0xC0000300L) +#endif + +#ifndef STATUS_WMI_GUID_DISCONNECTED +# define STATUS_WMI_GUID_DISCONNECTED ((NTSTATUS) 0xC0000301L) +#endif + +#ifndef STATUS_WMI_ALREADY_DISABLED +# define STATUS_WMI_ALREADY_DISABLED ((NTSTATUS) 0xC0000302L) +#endif + +#ifndef STATUS_WMI_ALREADY_ENABLED +# define STATUS_WMI_ALREADY_ENABLED ((NTSTATUS) 0xC0000303L) +#endif + +#ifndef STATUS_MFT_TOO_FRAGMENTED +# define STATUS_MFT_TOO_FRAGMENTED ((NTSTATUS) 0xC0000304L) +#endif + +#ifndef STATUS_COPY_PROTECTION_FAILURE +# define STATUS_COPY_PROTECTION_FAILURE ((NTSTATUS) 0xC0000305L) +#endif + +#ifndef STATUS_CSS_AUTHENTICATION_FAILURE +# define STATUS_CSS_AUTHENTICATION_FAILURE ((NTSTATUS) 0xC0000306L) +#endif + +#ifndef STATUS_CSS_KEY_NOT_PRESENT +# define STATUS_CSS_KEY_NOT_PRESENT ((NTSTATUS) 0xC0000307L) +#endif + +#ifndef STATUS_CSS_KEY_NOT_ESTABLISHED +# define STATUS_CSS_KEY_NOT_ESTABLISHED ((NTSTATUS) 0xC0000308L) +#endif + +#ifndef STATUS_CSS_SCRAMBLED_SECTOR +# define STATUS_CSS_SCRAMBLED_SECTOR ((NTSTATUS) 0xC0000309L) +#endif + +#ifndef STATUS_CSS_REGION_MISMATCH +# define STATUS_CSS_REGION_MISMATCH ((NTSTATUS) 0xC000030AL) +#endif + +#ifndef STATUS_CSS_RESETS_EXHAUSTED +# define STATUS_CSS_RESETS_EXHAUSTED ((NTSTATUS) 0xC000030BL) +#endif + +#ifndef STATUS_PKINIT_FAILURE +# define STATUS_PKINIT_FAILURE ((NTSTATUS) 0xC0000320L) +#endif + +#ifndef STATUS_SMARTCARD_SUBSYSTEM_FAILURE +# define STATUS_SMARTCARD_SUBSYSTEM_FAILURE ((NTSTATUS) 0xC0000321L) +#endif + +#ifndef STATUS_NO_KERB_KEY +# define STATUS_NO_KERB_KEY ((NTSTATUS) 0xC0000322L) +#endif + +#ifndef STATUS_HOST_DOWN +# define STATUS_HOST_DOWN ((NTSTATUS) 0xC0000350L) +#endif + +#ifndef STATUS_UNSUPPORTED_PREAUTH +# define STATUS_UNSUPPORTED_PREAUTH ((NTSTATUS) 0xC0000351L) +#endif + +#ifndef STATUS_EFS_ALG_BLOB_TOO_BIG +# define STATUS_EFS_ALG_BLOB_TOO_BIG ((NTSTATUS) 0xC0000352L) +#endif + +#ifndef STATUS_PORT_NOT_SET +# define STATUS_PORT_NOT_SET ((NTSTATUS) 0xC0000353L) +#endif + +#ifndef STATUS_DEBUGGER_INACTIVE +# define STATUS_DEBUGGER_INACTIVE ((NTSTATUS) 0xC0000354L) +#endif + +#ifndef STATUS_DS_VERSION_CHECK_FAILURE +# define STATUS_DS_VERSION_CHECK_FAILURE ((NTSTATUS) 0xC0000355L) +#endif + +#ifndef STATUS_AUDITING_DISABLED +# define STATUS_AUDITING_DISABLED ((NTSTATUS) 0xC0000356L) +#endif + +#ifndef STATUS_PRENT4_MACHINE_ACCOUNT +# define STATUS_PRENT4_MACHINE_ACCOUNT ((NTSTATUS) 0xC0000357L) +#endif + +#ifndef STATUS_DS_AG_CANT_HAVE_UNIVERSAL_MEMBER +# define STATUS_DS_AG_CANT_HAVE_UNIVERSAL_MEMBER ((NTSTATUS) 0xC0000358L) +#endif + +#ifndef STATUS_INVALID_IMAGE_WIN_32 +# define STATUS_INVALID_IMAGE_WIN_32 ((NTSTATUS) 0xC0000359L) +#endif + +#ifndef STATUS_INVALID_IMAGE_WIN_64 +# define STATUS_INVALID_IMAGE_WIN_64 ((NTSTATUS) 0xC000035AL) +#endif + +#ifndef STATUS_BAD_BINDINGS +# define STATUS_BAD_BINDINGS ((NTSTATUS) 0xC000035BL) +#endif + +#ifndef STATUS_NETWORK_SESSION_EXPIRED +# define STATUS_NETWORK_SESSION_EXPIRED ((NTSTATUS) 0xC000035CL) +#endif + +#ifndef STATUS_APPHELP_BLOCK +# define STATUS_APPHELP_BLOCK ((NTSTATUS) 0xC000035DL) +#endif + +#ifndef STATUS_ALL_SIDS_FILTERED +# define STATUS_ALL_SIDS_FILTERED ((NTSTATUS) 0xC000035EL) +#endif + +#ifndef STATUS_NOT_SAFE_MODE_DRIVER +# define STATUS_NOT_SAFE_MODE_DRIVER ((NTSTATUS) 0xC000035FL) +#endif + +#ifndef STATUS_ACCESS_DISABLED_BY_POLICY_DEFAULT +# define STATUS_ACCESS_DISABLED_BY_POLICY_DEFAULT ((NTSTATUS) 0xC0000361L) +#endif + +#ifndef STATUS_ACCESS_DISABLED_BY_POLICY_PATH +# define STATUS_ACCESS_DISABLED_BY_POLICY_PATH ((NTSTATUS) 0xC0000362L) +#endif + +#ifndef STATUS_ACCESS_DISABLED_BY_POLICY_PUBLISHER +# define STATUS_ACCESS_DISABLED_BY_POLICY_PUBLISHER ((NTSTATUS) 0xC0000363L) +#endif + +#ifndef STATUS_ACCESS_DISABLED_BY_POLICY_OTHER +# define STATUS_ACCESS_DISABLED_BY_POLICY_OTHER ((NTSTATUS) 0xC0000364L) +#endif + +#ifndef STATUS_FAILED_DRIVER_ENTRY +# define STATUS_FAILED_DRIVER_ENTRY ((NTSTATUS) 0xC0000365L) +#endif + +#ifndef STATUS_DEVICE_ENUMERATION_ERROR +# define STATUS_DEVICE_ENUMERATION_ERROR ((NTSTATUS) 0xC0000366L) +#endif + +#ifndef STATUS_MOUNT_POINT_NOT_RESOLVED +# define STATUS_MOUNT_POINT_NOT_RESOLVED ((NTSTATUS) 0xC0000368L) +#endif + +#ifndef STATUS_INVALID_DEVICE_OBJECT_PARAMETER +# define STATUS_INVALID_DEVICE_OBJECT_PARAMETER ((NTSTATUS) 0xC0000369L) +#endif + +#ifndef STATUS_MCA_OCCURED +# define STATUS_MCA_OCCURED ((NTSTATUS) 0xC000036AL) +#endif + +#ifndef STATUS_DRIVER_BLOCKED_CRITICAL +# define STATUS_DRIVER_BLOCKED_CRITICAL ((NTSTATUS) 0xC000036BL) +#endif + +#ifndef STATUS_DRIVER_BLOCKED +# define STATUS_DRIVER_BLOCKED ((NTSTATUS) 0xC000036CL) +#endif + +#ifndef STATUS_DRIVER_DATABASE_ERROR +# define STATUS_DRIVER_DATABASE_ERROR ((NTSTATUS) 0xC000036DL) +#endif + +#ifndef STATUS_SYSTEM_HIVE_TOO_LARGE +# define STATUS_SYSTEM_HIVE_TOO_LARGE ((NTSTATUS) 0xC000036EL) +#endif + +#ifndef STATUS_INVALID_IMPORT_OF_NON_DLL +# define STATUS_INVALID_IMPORT_OF_NON_DLL ((NTSTATUS) 0xC000036FL) +#endif + +#ifndef STATUS_DS_SHUTTING_DOWN +# define STATUS_DS_SHUTTING_DOWN ((NTSTATUS) 0x40000370L) +#endif + +#ifndef STATUS_NO_SECRETS +# define STATUS_NO_SECRETS ((NTSTATUS) 0xC0000371L) +#endif + +#ifndef STATUS_ACCESS_DISABLED_NO_SAFER_UI_BY_POLICY +# define STATUS_ACCESS_DISABLED_NO_SAFER_UI_BY_POLICY ((NTSTATUS) 0xC0000372L) +#endif + +#ifndef STATUS_FAILED_STACK_SWITCH +# define STATUS_FAILED_STACK_SWITCH ((NTSTATUS) 0xC0000373L) +#endif + +#ifndef STATUS_HEAP_CORRUPTION +# define STATUS_HEAP_CORRUPTION ((NTSTATUS) 0xC0000374L) +#endif + +#ifndef STATUS_SMARTCARD_WRONG_PIN +# define STATUS_SMARTCARD_WRONG_PIN ((NTSTATUS) 0xC0000380L) +#endif + +#ifndef STATUS_SMARTCARD_CARD_BLOCKED +# define STATUS_SMARTCARD_CARD_BLOCKED ((NTSTATUS) 0xC0000381L) +#endif + +#ifndef STATUS_SMARTCARD_CARD_NOT_AUTHENTICATED +# define STATUS_SMARTCARD_CARD_NOT_AUTHENTICATED ((NTSTATUS) 0xC0000382L) +#endif + +#ifndef STATUS_SMARTCARD_NO_CARD +# define STATUS_SMARTCARD_NO_CARD ((NTSTATUS) 0xC0000383L) +#endif + +#ifndef STATUS_SMARTCARD_NO_KEY_CONTAINER +# define STATUS_SMARTCARD_NO_KEY_CONTAINER ((NTSTATUS) 0xC0000384L) +#endif + +#ifndef STATUS_SMARTCARD_NO_CERTIFICATE +# define STATUS_SMARTCARD_NO_CERTIFICATE ((NTSTATUS) 0xC0000385L) +#endif + +#ifndef STATUS_SMARTCARD_NO_KEYSET +# define STATUS_SMARTCARD_NO_KEYSET ((NTSTATUS) 0xC0000386L) +#endif + +#ifndef STATUS_SMARTCARD_IO_ERROR +# define STATUS_SMARTCARD_IO_ERROR ((NTSTATUS) 0xC0000387L) +#endif + +#ifndef STATUS_DOWNGRADE_DETECTED +# define STATUS_DOWNGRADE_DETECTED ((NTSTATUS) 0xC0000388L) +#endif + +#ifndef STATUS_SMARTCARD_CERT_REVOKED +# define STATUS_SMARTCARD_CERT_REVOKED ((NTSTATUS) 0xC0000389L) +#endif + +#ifndef STATUS_ISSUING_CA_UNTRUSTED +# define STATUS_ISSUING_CA_UNTRUSTED ((NTSTATUS) 0xC000038AL) +#endif + +#ifndef STATUS_REVOCATION_OFFLINE_C +# define STATUS_REVOCATION_OFFLINE_C ((NTSTATUS) 0xC000038BL) +#endif + +#ifndef STATUS_PKINIT_CLIENT_FAILURE +# define STATUS_PKINIT_CLIENT_FAILURE ((NTSTATUS) 0xC000038CL) +#endif + +#ifndef STATUS_SMARTCARD_CERT_EXPIRED +# define STATUS_SMARTCARD_CERT_EXPIRED ((NTSTATUS) 0xC000038DL) +#endif + +#ifndef STATUS_DRIVER_FAILED_PRIOR_UNLOAD +# define STATUS_DRIVER_FAILED_PRIOR_UNLOAD ((NTSTATUS) 0xC000038EL) +#endif + +#ifndef STATUS_SMARTCARD_SILENT_CONTEXT +# define STATUS_SMARTCARD_SILENT_CONTEXT ((NTSTATUS) 0xC000038FL) +#endif + +#ifndef STATUS_PER_USER_TRUST_QUOTA_EXCEEDED +# define STATUS_PER_USER_TRUST_QUOTA_EXCEEDED ((NTSTATUS) 0xC0000401L) +#endif + +#ifndef STATUS_ALL_USER_TRUST_QUOTA_EXCEEDED +# define STATUS_ALL_USER_TRUST_QUOTA_EXCEEDED ((NTSTATUS) 0xC0000402L) +#endif + +#ifndef STATUS_USER_DELETE_TRUST_QUOTA_EXCEEDED +# define STATUS_USER_DELETE_TRUST_QUOTA_EXCEEDED ((NTSTATUS) 0xC0000403L) +#endif + +#ifndef STATUS_DS_NAME_NOT_UNIQUE +# define STATUS_DS_NAME_NOT_UNIQUE ((NTSTATUS) 0xC0000404L) +#endif + +#ifndef STATUS_DS_DUPLICATE_ID_FOUND +# define STATUS_DS_DUPLICATE_ID_FOUND ((NTSTATUS) 0xC0000405L) +#endif + +#ifndef STATUS_DS_GROUP_CONVERSION_ERROR +# define STATUS_DS_GROUP_CONVERSION_ERROR ((NTSTATUS) 0xC0000406L) +#endif + +#ifndef STATUS_VOLSNAP_PREPARE_HIBERNATE +# define STATUS_VOLSNAP_PREPARE_HIBERNATE ((NTSTATUS) 0xC0000407L) +#endif + +#ifndef STATUS_USER2USER_REQUIRED +# define STATUS_USER2USER_REQUIRED ((NTSTATUS) 0xC0000408L) +#endif + +#ifndef STATUS_STACK_BUFFER_OVERRUN +# define STATUS_STACK_BUFFER_OVERRUN ((NTSTATUS) 0xC0000409L) +#endif + +#ifndef STATUS_NO_S4U_PROT_SUPPORT +# define STATUS_NO_S4U_PROT_SUPPORT ((NTSTATUS) 0xC000040AL) +#endif + +#ifndef STATUS_CROSSREALM_DELEGATION_FAILURE +# define STATUS_CROSSREALM_DELEGATION_FAILURE ((NTSTATUS) 0xC000040BL) +#endif + +#ifndef STATUS_REVOCATION_OFFLINE_KDC +# define STATUS_REVOCATION_OFFLINE_KDC ((NTSTATUS) 0xC000040CL) +#endif + +#ifndef STATUS_ISSUING_CA_UNTRUSTED_KDC +# define STATUS_ISSUING_CA_UNTRUSTED_KDC ((NTSTATUS) 0xC000040DL) +#endif + +#ifndef STATUS_KDC_CERT_EXPIRED +# define STATUS_KDC_CERT_EXPIRED ((NTSTATUS) 0xC000040EL) +#endif + +#ifndef STATUS_KDC_CERT_REVOKED +# define STATUS_KDC_CERT_REVOKED ((NTSTATUS) 0xC000040FL) +#endif + +#ifndef STATUS_PARAMETER_QUOTA_EXCEEDED +# define STATUS_PARAMETER_QUOTA_EXCEEDED ((NTSTATUS) 0xC0000410L) +#endif + +#ifndef STATUS_HIBERNATION_FAILURE +# define STATUS_HIBERNATION_FAILURE ((NTSTATUS) 0xC0000411L) +#endif + +#ifndef STATUS_DELAY_LOAD_FAILED +# define STATUS_DELAY_LOAD_FAILED ((NTSTATUS) 0xC0000412L) +#endif + +#ifndef STATUS_AUTHENTICATION_FIREWALL_FAILED +# define STATUS_AUTHENTICATION_FIREWALL_FAILED ((NTSTATUS) 0xC0000413L) +#endif + +#ifndef STATUS_VDM_DISALLOWED +# define STATUS_VDM_DISALLOWED ((NTSTATUS) 0xC0000414L) +#endif + +#ifndef STATUS_HUNG_DISPLAY_DRIVER_THREAD +# define STATUS_HUNG_DISPLAY_DRIVER_THREAD ((NTSTATUS) 0xC0000415L) +#endif + +#ifndef STATUS_INSUFFICIENT_RESOURCE_FOR_SPECIFIED_SHARED_SECTION_SIZE +# define STATUS_INSUFFICIENT_RESOURCE_FOR_SPECIFIED_SHARED_SECTION_SIZE ((NTSTATUS) 0xC0000416L) +#endif + +#ifndef STATUS_INVALID_CRUNTIME_PARAMETER +# define STATUS_INVALID_CRUNTIME_PARAMETER ((NTSTATUS) 0xC0000417L) +#endif + +#ifndef STATUS_NTLM_BLOCKED +# define STATUS_NTLM_BLOCKED ((NTSTATUS) 0xC0000418L) +#endif + +#ifndef STATUS_DS_SRC_SID_EXISTS_IN_FOREST +# define STATUS_DS_SRC_SID_EXISTS_IN_FOREST ((NTSTATUS) 0xC0000419L) +#endif + +#ifndef STATUS_DS_DOMAIN_NAME_EXISTS_IN_FOREST +# define STATUS_DS_DOMAIN_NAME_EXISTS_IN_FOREST ((NTSTATUS) 0xC000041AL) +#endif + +#ifndef STATUS_DS_FLAT_NAME_EXISTS_IN_FOREST +# define STATUS_DS_FLAT_NAME_EXISTS_IN_FOREST ((NTSTATUS) 0xC000041BL) +#endif + +#ifndef STATUS_INVALID_USER_PRINCIPAL_NAME +# define STATUS_INVALID_USER_PRINCIPAL_NAME ((NTSTATUS) 0xC000041CL) +#endif + +#ifndef STATUS_FATAL_USER_CALLBACK_EXCEPTION +# define STATUS_FATAL_USER_CALLBACK_EXCEPTION ((NTSTATUS) 0xC000041DL) +#endif + +#ifndef STATUS_ASSERTION_FAILURE +# define STATUS_ASSERTION_FAILURE ((NTSTATUS) 0xC0000420L) +#endif + +#ifndef STATUS_VERIFIER_STOP +# define STATUS_VERIFIER_STOP ((NTSTATUS) 0xC0000421L) +#endif + +#ifndef STATUS_CALLBACK_POP_STACK +# define STATUS_CALLBACK_POP_STACK ((NTSTATUS) 0xC0000423L) +#endif + +#ifndef STATUS_INCOMPATIBLE_DRIVER_BLOCKED +# define STATUS_INCOMPATIBLE_DRIVER_BLOCKED ((NTSTATUS) 0xC0000424L) +#endif + +#ifndef STATUS_HIVE_UNLOADED +# define STATUS_HIVE_UNLOADED ((NTSTATUS) 0xC0000425L) +#endif + +#ifndef STATUS_COMPRESSION_DISABLED +# define STATUS_COMPRESSION_DISABLED ((NTSTATUS) 0xC0000426L) +#endif + +#ifndef STATUS_FILE_SYSTEM_LIMITATION +# define STATUS_FILE_SYSTEM_LIMITATION ((NTSTATUS) 0xC0000427L) +#endif + +#ifndef STATUS_INVALID_IMAGE_HASH +# define STATUS_INVALID_IMAGE_HASH ((NTSTATUS) 0xC0000428L) +#endif + +#ifndef STATUS_NOT_CAPABLE +# define STATUS_NOT_CAPABLE ((NTSTATUS) 0xC0000429L) +#endif + +#ifndef STATUS_REQUEST_OUT_OF_SEQUENCE +# define STATUS_REQUEST_OUT_OF_SEQUENCE ((NTSTATUS) 0xC000042AL) +#endif + +#ifndef STATUS_IMPLEMENTATION_LIMIT +# define STATUS_IMPLEMENTATION_LIMIT ((NTSTATUS) 0xC000042BL) +#endif + +#ifndef STATUS_ELEVATION_REQUIRED +# define STATUS_ELEVATION_REQUIRED ((NTSTATUS) 0xC000042CL) +#endif + +#ifndef STATUS_NO_SECURITY_CONTEXT +# define STATUS_NO_SECURITY_CONTEXT ((NTSTATUS) 0xC000042DL) +#endif + +#ifndef STATUS_PKU2U_CERT_FAILURE +# define STATUS_PKU2U_CERT_FAILURE ((NTSTATUS) 0xC000042FL) +#endif + +#ifndef STATUS_BEYOND_VDL +# define STATUS_BEYOND_VDL ((NTSTATUS) 0xC0000432L) +#endif + +#ifndef STATUS_ENCOUNTERED_WRITE_IN_PROGRESS +# define STATUS_ENCOUNTERED_WRITE_IN_PROGRESS ((NTSTATUS) 0xC0000433L) +#endif + +#ifndef STATUS_PTE_CHANGED +# define STATUS_PTE_CHANGED ((NTSTATUS) 0xC0000434L) +#endif + +#ifndef STATUS_PURGE_FAILED +# define STATUS_PURGE_FAILED ((NTSTATUS) 0xC0000435L) +#endif + +#ifndef STATUS_CRED_REQUIRES_CONFIRMATION +# define STATUS_CRED_REQUIRES_CONFIRMATION ((NTSTATUS) 0xC0000440L) +#endif + +#ifndef STATUS_CS_ENCRYPTION_INVALID_SERVER_RESPONSE +# define STATUS_CS_ENCRYPTION_INVALID_SERVER_RESPONSE ((NTSTATUS) 0xC0000441L) +#endif + +#ifndef STATUS_CS_ENCRYPTION_UNSUPPORTED_SERVER +# define STATUS_CS_ENCRYPTION_UNSUPPORTED_SERVER ((NTSTATUS) 0xC0000442L) +#endif + +#ifndef STATUS_CS_ENCRYPTION_EXISTING_ENCRYPTED_FILE +# define STATUS_CS_ENCRYPTION_EXISTING_ENCRYPTED_FILE ((NTSTATUS) 0xC0000443L) +#endif + +#ifndef STATUS_CS_ENCRYPTION_NEW_ENCRYPTED_FILE +# define STATUS_CS_ENCRYPTION_NEW_ENCRYPTED_FILE ((NTSTATUS) 0xC0000444L) +#endif + +#ifndef STATUS_CS_ENCRYPTION_FILE_NOT_CSE +# define STATUS_CS_ENCRYPTION_FILE_NOT_CSE ((NTSTATUS) 0xC0000445L) +#endif + +#ifndef STATUS_INVALID_LABEL +# define STATUS_INVALID_LABEL ((NTSTATUS) 0xC0000446L) +#endif + +#ifndef STATUS_DRIVER_PROCESS_TERMINATED +# define STATUS_DRIVER_PROCESS_TERMINATED ((NTSTATUS) 0xC0000450L) +#endif + +#ifndef STATUS_AMBIGUOUS_SYSTEM_DEVICE +# define STATUS_AMBIGUOUS_SYSTEM_DEVICE ((NTSTATUS) 0xC0000451L) +#endif + +#ifndef STATUS_SYSTEM_DEVICE_NOT_FOUND +# define STATUS_SYSTEM_DEVICE_NOT_FOUND ((NTSTATUS) 0xC0000452L) +#endif + +#ifndef STATUS_RESTART_BOOT_APPLICATION +# define STATUS_RESTART_BOOT_APPLICATION ((NTSTATUS) 0xC0000453L) +#endif + +#ifndef STATUS_INSUFFICIENT_NVRAM_RESOURCES +# define STATUS_INSUFFICIENT_NVRAM_RESOURCES ((NTSTATUS) 0xC0000454L) +#endif + +#ifndef STATUS_INVALID_TASK_NAME +# define STATUS_INVALID_TASK_NAME ((NTSTATUS) 0xC0000500L) +#endif + +#ifndef STATUS_INVALID_TASK_INDEX +# define STATUS_INVALID_TASK_INDEX ((NTSTATUS) 0xC0000501L) +#endif + +#ifndef STATUS_THREAD_ALREADY_IN_TASK +# define STATUS_THREAD_ALREADY_IN_TASK ((NTSTATUS) 0xC0000502L) +#endif + +#ifndef STATUS_CALLBACK_BYPASS +# define STATUS_CALLBACK_BYPASS ((NTSTATUS) 0xC0000503L) +#endif + +#ifndef STATUS_FAIL_FAST_EXCEPTION +# define STATUS_FAIL_FAST_EXCEPTION ((NTSTATUS) 0xC0000602L) +#endif + +#ifndef STATUS_IMAGE_CERT_REVOKED +# define STATUS_IMAGE_CERT_REVOKED ((NTSTATUS) 0xC0000603L) +#endif + +#ifndef STATUS_PORT_CLOSED +# define STATUS_PORT_CLOSED ((NTSTATUS) 0xC0000700L) +#endif + +#ifndef STATUS_MESSAGE_LOST +# define STATUS_MESSAGE_LOST ((NTSTATUS) 0xC0000701L) +#endif + +#ifndef STATUS_INVALID_MESSAGE +# define STATUS_INVALID_MESSAGE ((NTSTATUS) 0xC0000702L) +#endif + +#ifndef STATUS_REQUEST_CANCELED +# define STATUS_REQUEST_CANCELED ((NTSTATUS) 0xC0000703L) +#endif + +#ifndef STATUS_RECURSIVE_DISPATCH +# define STATUS_RECURSIVE_DISPATCH ((NTSTATUS) 0xC0000704L) +#endif + +#ifndef STATUS_LPC_RECEIVE_BUFFER_EXPECTED +# define STATUS_LPC_RECEIVE_BUFFER_EXPECTED ((NTSTATUS) 0xC0000705L) +#endif + +#ifndef STATUS_LPC_INVALID_CONNECTION_USAGE +# define STATUS_LPC_INVALID_CONNECTION_USAGE ((NTSTATUS) 0xC0000706L) +#endif + +#ifndef STATUS_LPC_REQUESTS_NOT_ALLOWED +# define STATUS_LPC_REQUESTS_NOT_ALLOWED ((NTSTATUS) 0xC0000707L) +#endif + +#ifndef STATUS_RESOURCE_IN_USE +# define STATUS_RESOURCE_IN_USE ((NTSTATUS) 0xC0000708L) +#endif + +#ifndef STATUS_HARDWARE_MEMORY_ERROR +# define STATUS_HARDWARE_MEMORY_ERROR ((NTSTATUS) 0xC0000709L) +#endif + +#ifndef STATUS_THREADPOOL_HANDLE_EXCEPTION +# define STATUS_THREADPOOL_HANDLE_EXCEPTION ((NTSTATUS) 0xC000070AL) +#endif + +#ifndef STATUS_THREADPOOL_SET_EVENT_ON_COMPLETION_FAILED +# define STATUS_THREADPOOL_SET_EVENT_ON_COMPLETION_FAILED ((NTSTATUS) 0xC000070BL) +#endif + +#ifndef STATUS_THREADPOOL_RELEASE_SEMAPHORE_ON_COMPLETION_FAILED +# define STATUS_THREADPOOL_RELEASE_SEMAPHORE_ON_COMPLETION_FAILED ((NTSTATUS) 0xC000070CL) +#endif + +#ifndef STATUS_THREADPOOL_RELEASE_MUTEX_ON_COMPLETION_FAILED +# define STATUS_THREADPOOL_RELEASE_MUTEX_ON_COMPLETION_FAILED ((NTSTATUS) 0xC000070DL) +#endif + +#ifndef STATUS_THREADPOOL_FREE_LIBRARY_ON_COMPLETION_FAILED +# define STATUS_THREADPOOL_FREE_LIBRARY_ON_COMPLETION_FAILED ((NTSTATUS) 0xC000070EL) +#endif + +#ifndef STATUS_THREADPOOL_RELEASED_DURING_OPERATION +# define STATUS_THREADPOOL_RELEASED_DURING_OPERATION ((NTSTATUS) 0xC000070FL) +#endif + +#ifndef STATUS_CALLBACK_RETURNED_WHILE_IMPERSONATING +# define STATUS_CALLBACK_RETURNED_WHILE_IMPERSONATING ((NTSTATUS) 0xC0000710L) +#endif + +#ifndef STATUS_APC_RETURNED_WHILE_IMPERSONATING +# define STATUS_APC_RETURNED_WHILE_IMPERSONATING ((NTSTATUS) 0xC0000711L) +#endif + +#ifndef STATUS_PROCESS_IS_PROTECTED +# define STATUS_PROCESS_IS_PROTECTED ((NTSTATUS) 0xC0000712L) +#endif + +#ifndef STATUS_MCA_EXCEPTION +# define STATUS_MCA_EXCEPTION ((NTSTATUS) 0xC0000713L) +#endif + +#ifndef STATUS_CERTIFICATE_MAPPING_NOT_UNIQUE +# define STATUS_CERTIFICATE_MAPPING_NOT_UNIQUE ((NTSTATUS) 0xC0000714L) +#endif + +#ifndef STATUS_SYMLINK_CLASS_DISABLED +# define STATUS_SYMLINK_CLASS_DISABLED ((NTSTATUS) 0xC0000715L) +#endif + +#ifndef STATUS_INVALID_IDN_NORMALIZATION +# define STATUS_INVALID_IDN_NORMALIZATION ((NTSTATUS) 0xC0000716L) +#endif + +#ifndef STATUS_NO_UNICODE_TRANSLATION +# define STATUS_NO_UNICODE_TRANSLATION ((NTSTATUS) 0xC0000717L) +#endif + +#ifndef STATUS_ALREADY_REGISTERED +# define STATUS_ALREADY_REGISTERED ((NTSTATUS) 0xC0000718L) +#endif + +#ifndef STATUS_CONTEXT_MISMATCH +# define STATUS_CONTEXT_MISMATCH ((NTSTATUS) 0xC0000719L) +#endif + +#ifndef STATUS_PORT_ALREADY_HAS_COMPLETION_LIST +# define STATUS_PORT_ALREADY_HAS_COMPLETION_LIST ((NTSTATUS) 0xC000071AL) +#endif + +#ifndef STATUS_CALLBACK_RETURNED_THREAD_PRIORITY +# define STATUS_CALLBACK_RETURNED_THREAD_PRIORITY ((NTSTATUS) 0xC000071BL) +#endif + +#ifndef STATUS_INVALID_THREAD +# define STATUS_INVALID_THREAD ((NTSTATUS) 0xC000071CL) +#endif + +#ifndef STATUS_CALLBACK_RETURNED_TRANSACTION +# define STATUS_CALLBACK_RETURNED_TRANSACTION ((NTSTATUS) 0xC000071DL) +#endif + +#ifndef STATUS_CALLBACK_RETURNED_LDR_LOCK +# define STATUS_CALLBACK_RETURNED_LDR_LOCK ((NTSTATUS) 0xC000071EL) +#endif + +#ifndef STATUS_CALLBACK_RETURNED_LANG +# define STATUS_CALLBACK_RETURNED_LANG ((NTSTATUS) 0xC000071FL) +#endif + +#ifndef STATUS_CALLBACK_RETURNED_PRI_BACK +# define STATUS_CALLBACK_RETURNED_PRI_BACK ((NTSTATUS) 0xC0000720L) +#endif + +#ifndef STATUS_CALLBACK_RETURNED_THREAD_AFFINITY +# define STATUS_CALLBACK_RETURNED_THREAD_AFFINITY ((NTSTATUS) 0xC0000721L) +#endif + +#ifndef STATUS_DISK_REPAIR_DISABLED +# define STATUS_DISK_REPAIR_DISABLED ((NTSTATUS) 0xC0000800L) +#endif + +#ifndef STATUS_DS_DOMAIN_RENAME_IN_PROGRESS +# define STATUS_DS_DOMAIN_RENAME_IN_PROGRESS ((NTSTATUS) 0xC0000801L) +#endif + +#ifndef STATUS_DISK_QUOTA_EXCEEDED +# define STATUS_DISK_QUOTA_EXCEEDED ((NTSTATUS) 0xC0000802L) +#endif + +#ifndef STATUS_DATA_LOST_REPAIR +# define STATUS_DATA_LOST_REPAIR ((NTSTATUS) 0x80000803L) +#endif + +#ifndef STATUS_CONTENT_BLOCKED +# define STATUS_CONTENT_BLOCKED ((NTSTATUS) 0xC0000804L) +#endif + +#ifndef STATUS_BAD_CLUSTERS +# define STATUS_BAD_CLUSTERS ((NTSTATUS) 0xC0000805L) +#endif + +#ifndef STATUS_VOLUME_DIRTY +# define STATUS_VOLUME_DIRTY ((NTSTATUS) 0xC0000806L) +#endif + +#ifndef STATUS_FILE_CHECKED_OUT +# define STATUS_FILE_CHECKED_OUT ((NTSTATUS) 0xC0000901L) +#endif + +#ifndef STATUS_CHECKOUT_REQUIRED +# define STATUS_CHECKOUT_REQUIRED ((NTSTATUS) 0xC0000902L) +#endif + +#ifndef STATUS_BAD_FILE_TYPE +# define STATUS_BAD_FILE_TYPE ((NTSTATUS) 0xC0000903L) +#endif + +#ifndef STATUS_FILE_TOO_LARGE +# define STATUS_FILE_TOO_LARGE ((NTSTATUS) 0xC0000904L) +#endif + +#ifndef STATUS_FORMS_AUTH_REQUIRED +# define STATUS_FORMS_AUTH_REQUIRED ((NTSTATUS) 0xC0000905L) +#endif + +#ifndef STATUS_VIRUS_INFECTED +# define STATUS_VIRUS_INFECTED ((NTSTATUS) 0xC0000906L) +#endif + +#ifndef STATUS_VIRUS_DELETED +# define STATUS_VIRUS_DELETED ((NTSTATUS) 0xC0000907L) +#endif + +#ifndef STATUS_BAD_MCFG_TABLE +# define STATUS_BAD_MCFG_TABLE ((NTSTATUS) 0xC0000908L) +#endif + +#ifndef STATUS_CANNOT_BREAK_OPLOCK +# define STATUS_CANNOT_BREAK_OPLOCK ((NTSTATUS) 0xC0000909L) +#endif + +#ifndef STATUS_WOW_ASSERTION +# define STATUS_WOW_ASSERTION ((NTSTATUS) 0xC0009898L) +#endif + +#ifndef STATUS_INVALID_SIGNATURE +# define STATUS_INVALID_SIGNATURE ((NTSTATUS) 0xC000A000L) +#endif + +#ifndef STATUS_HMAC_NOT_SUPPORTED +# define STATUS_HMAC_NOT_SUPPORTED ((NTSTATUS) 0xC000A001L) +#endif + +#ifndef STATUS_AUTH_TAG_MISMATCH +# define STATUS_AUTH_TAG_MISMATCH ((NTSTATUS) 0xC000A002L) +#endif + +#ifndef STATUS_IPSEC_QUEUE_OVERFLOW +# define STATUS_IPSEC_QUEUE_OVERFLOW ((NTSTATUS) 0xC000A010L) +#endif + +#ifndef STATUS_ND_QUEUE_OVERFLOW +# define STATUS_ND_QUEUE_OVERFLOW ((NTSTATUS) 0xC000A011L) +#endif + +#ifndef STATUS_HOPLIMIT_EXCEEDED +# define STATUS_HOPLIMIT_EXCEEDED ((NTSTATUS) 0xC000A012L) +#endif + +#ifndef STATUS_PROTOCOL_NOT_SUPPORTED +# define STATUS_PROTOCOL_NOT_SUPPORTED ((NTSTATUS) 0xC000A013L) +#endif + +#ifndef STATUS_FASTPATH_REJECTED +# define STATUS_FASTPATH_REJECTED ((NTSTATUS) 0xC000A014L) +#endif + +#ifndef STATUS_LOST_WRITEBEHIND_DATA_NETWORK_DISCONNECTED +# define STATUS_LOST_WRITEBEHIND_DATA_NETWORK_DISCONNECTED ((NTSTATUS) 0xC000A080L) +#endif + +#ifndef STATUS_LOST_WRITEBEHIND_DATA_NETWORK_SERVER_ERROR +# define STATUS_LOST_WRITEBEHIND_DATA_NETWORK_SERVER_ERROR ((NTSTATUS) 0xC000A081L) +#endif + +#ifndef STATUS_LOST_WRITEBEHIND_DATA_LOCAL_DISK_ERROR +# define STATUS_LOST_WRITEBEHIND_DATA_LOCAL_DISK_ERROR ((NTSTATUS) 0xC000A082L) +#endif + +#ifndef STATUS_XML_PARSE_ERROR +# define STATUS_XML_PARSE_ERROR ((NTSTATUS) 0xC000A083L) +#endif + +#ifndef STATUS_XMLDSIG_ERROR +# define STATUS_XMLDSIG_ERROR ((NTSTATUS) 0xC000A084L) +#endif + +#ifndef STATUS_WRONG_COMPARTMENT +# define STATUS_WRONG_COMPARTMENT ((NTSTATUS) 0xC000A085L) +#endif + +#ifndef STATUS_AUTHIP_FAILURE +# define STATUS_AUTHIP_FAILURE ((NTSTATUS) 0xC000A086L) +#endif + +#ifndef STATUS_DS_OID_MAPPED_GROUP_CANT_HAVE_MEMBERS +# define STATUS_DS_OID_MAPPED_GROUP_CANT_HAVE_MEMBERS ((NTSTATUS) 0xC000A087L) +#endif + +#ifndef STATUS_DS_OID_NOT_FOUND +# define STATUS_DS_OID_NOT_FOUND ((NTSTATUS) 0xC000A088L) +#endif + +#ifndef STATUS_HASH_NOT_SUPPORTED +# define STATUS_HASH_NOT_SUPPORTED ((NTSTATUS) 0xC000A100L) +#endif + +#ifndef STATUS_HASH_NOT_PRESENT +# define STATUS_HASH_NOT_PRESENT ((NTSTATUS) 0xC000A101L) +#endif + - /* This is not the NTSTATUS_FROM_WIN32 that the DDK provides, because the */ - /* DDK got it wrong! */ ++/* This is not the NTSTATUS_FROM_WIN32 that the DDK provides, because the DDK ++ * got it wrong! */ +#ifdef NTSTATUS_FROM_WIN32 +# undef NTSTATUS_FROM_WIN32 +#endif +#define NTSTATUS_FROM_WIN32(error) ((NTSTATUS) (error) <= 0 ? \ + ((NTSTATUS) (error)) : ((NTSTATUS) (((error) & 0x0000FFFF) | \ + (FACILITY_NTWIN32 << 16) | ERROR_SEVERITY_WARNING))) + +#ifndef JOB_OBJECT_LIMIT_PROCESS_MEMORY +# define JOB_OBJECT_LIMIT_PROCESS_MEMORY 0x00000100 +#endif +#ifndef JOB_OBJECT_LIMIT_JOB_MEMORY +# define JOB_OBJECT_LIMIT_JOB_MEMORY 0x00000200 +#endif +#ifndef JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION +# define JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION 0x00000400 +#endif +#ifndef JOB_OBJECT_LIMIT_BREAKAWAY_OK +# define JOB_OBJECT_LIMIT_BREAKAWAY_OK 0x00000800 +#endif +#ifndef JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK +# define JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK 0x00001000 +#endif +#ifndef JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE +# define JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE 0x00002000 +#endif + +#ifndef SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE +# define SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE 0x00000002 +#endif + +/* from winternl.h */ ++#if !defined(__UNICODE_STRING_DEFINED) && defined(__MINGW32_) ++#define __UNICODE_STRING_DEFINED ++#endif +typedef struct _UNICODE_STRING { + USHORT Length; + USHORT MaximumLength; + PWSTR Buffer; +} UNICODE_STRING, *PUNICODE_STRING; + +typedef const UNICODE_STRING *PCUNICODE_STRING; + +/* from ntifs.h */ +#ifndef DEVICE_TYPE +# define DEVICE_TYPE DWORD +#endif + +#ifndef VOLUME_NAME_DOS +# define VOLUME_NAME_DOS 0x0 +#endif + +#ifndef MAPVK_VK_TO_VSC +# define MAPVK_VK_TO_VSC (0) +#endif + +/* MinGW already has a definition for REPARSE_DATA_BUFFER, but mingw-w64 does + * not. + */ +#if defined(_MSC_VER) || defined(__MINGW64_VERSION_MAJOR) + typedef struct _REPARSE_DATA_BUFFER { + ULONG ReparseTag; + USHORT ReparseDataLength; + USHORT Reserved; + union { + struct { + USHORT SubstituteNameOffset; + USHORT SubstituteNameLength; + USHORT PrintNameOffset; + USHORT PrintNameLength; + ULONG Flags; + WCHAR PathBuffer[1]; + } SymbolicLinkReparseBuffer; + struct { + USHORT SubstituteNameOffset; + USHORT SubstituteNameLength; + USHORT PrintNameOffset; + USHORT PrintNameLength; + WCHAR PathBuffer[1]; + } MountPointReparseBuffer; + struct { + UCHAR DataBuffer[1]; + } GenericReparseBuffer; + }; + } REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER; +#endif + +typedef struct _IO_STATUS_BLOCK { + union { + NTSTATUS Status; + PVOID Pointer; + }; + ULONG_PTR Information; +} IO_STATUS_BLOCK, *PIO_STATUS_BLOCK; + +typedef enum _FILE_INFORMATION_CLASS { + FileDirectoryInformation = 1, + FileFullDirectoryInformation, + FileBothDirectoryInformation, + FileBasicInformation, + FileStandardInformation, + FileInternalInformation, + FileEaInformation, + FileAccessInformation, + FileNameInformation, + FileRenameInformation, + FileLinkInformation, + FileNamesInformation, + FileDispositionInformation, + FilePositionInformation, + FileFullEaInformation, + FileModeInformation, + FileAlignmentInformation, + FileAllInformation, + FileAllocationInformation, + FileEndOfFileInformation, + FileAlternateNameInformation, + FileStreamInformation, + FilePipeInformation, + FilePipeLocalInformation, + FilePipeRemoteInformation, + FileMailslotQueryInformation, + FileMailslotSetInformation, + FileCompressionInformation, + FileObjectIdInformation, + FileCompletionInformation, + FileMoveClusterInformation, + FileQuotaInformation, + FileReparsePointInformation, + FileNetworkOpenInformation, + FileAttributeTagInformation, + FileTrackingInformation, + FileIdBothDirectoryInformation, + FileIdFullDirectoryInformation, + FileValidDataLengthInformation, + FileShortNameInformation, + FileIoCompletionNotificationInformation, + FileIoStatusBlockRangeInformation, + FileIoPriorityHintInformation, + FileSfioReserveInformation, + FileSfioVolumeInformation, + FileHardLinkInformation, + FileProcessIdsUsingFileInformation, + FileNormalizedNameInformation, + FileNetworkPhysicalNameInformation, + FileIdGlobalTxDirectoryInformation, + FileIsRemoteDeviceInformation, + FileAttributeCacheInformation, + FileNumaNodeInformation, + FileStandardLinkInformation, + FileRemoteProtocolInformation, + FileMaximumInformation +} FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS; + +typedef struct _FILE_DIRECTORY_INFORMATION { + ULONG NextEntryOffset; + ULONG FileIndex; + LARGE_INTEGER CreationTime; + LARGE_INTEGER LastAccessTime; + LARGE_INTEGER LastWriteTime; + LARGE_INTEGER ChangeTime; + LARGE_INTEGER EndOfFile; + LARGE_INTEGER AllocationSize; + ULONG FileAttributes; + ULONG FileNameLength; + WCHAR FileName[1]; +} FILE_DIRECTORY_INFORMATION, *PFILE_DIRECTORY_INFORMATION; + +typedef struct _FILE_BOTH_DIR_INFORMATION { + ULONG NextEntryOffset; + ULONG FileIndex; + LARGE_INTEGER CreationTime; + LARGE_INTEGER LastAccessTime; + LARGE_INTEGER LastWriteTime; + LARGE_INTEGER ChangeTime; + LARGE_INTEGER EndOfFile; + LARGE_INTEGER AllocationSize; + ULONG FileAttributes; + ULONG FileNameLength; + ULONG EaSize; + CCHAR ShortNameLength; + WCHAR ShortName[12]; + WCHAR FileName[1]; +} FILE_BOTH_DIR_INFORMATION, *PFILE_BOTH_DIR_INFORMATION; + +typedef struct _FILE_BASIC_INFORMATION { + LARGE_INTEGER CreationTime; + LARGE_INTEGER LastAccessTime; + LARGE_INTEGER LastWriteTime; + LARGE_INTEGER ChangeTime; + DWORD FileAttributes; +} FILE_BASIC_INFORMATION, *PFILE_BASIC_INFORMATION; + +typedef struct _FILE_STANDARD_INFORMATION { + LARGE_INTEGER AllocationSize; + LARGE_INTEGER EndOfFile; + ULONG NumberOfLinks; + BOOLEAN DeletePending; + BOOLEAN Directory; +} FILE_STANDARD_INFORMATION, *PFILE_STANDARD_INFORMATION; + +typedef struct _FILE_INTERNAL_INFORMATION { + LARGE_INTEGER IndexNumber; +} FILE_INTERNAL_INFORMATION, *PFILE_INTERNAL_INFORMATION; + +typedef struct _FILE_EA_INFORMATION { + ULONG EaSize; +} FILE_EA_INFORMATION, *PFILE_EA_INFORMATION; + +typedef struct _FILE_ACCESS_INFORMATION { + ACCESS_MASK AccessFlags; +} FILE_ACCESS_INFORMATION, *PFILE_ACCESS_INFORMATION; + +typedef struct _FILE_POSITION_INFORMATION { + LARGE_INTEGER CurrentByteOffset; +} FILE_POSITION_INFORMATION, *PFILE_POSITION_INFORMATION; + +typedef struct _FILE_MODE_INFORMATION { + ULONG Mode; +} FILE_MODE_INFORMATION, *PFILE_MODE_INFORMATION; + +typedef struct _FILE_ALIGNMENT_INFORMATION { + ULONG AlignmentRequirement; +} FILE_ALIGNMENT_INFORMATION, *PFILE_ALIGNMENT_INFORMATION; + +typedef struct _FILE_NAME_INFORMATION { + ULONG FileNameLength; + WCHAR FileName[1]; +} FILE_NAME_INFORMATION, *PFILE_NAME_INFORMATION; + +typedef struct _FILE_END_OF_FILE_INFORMATION { + LARGE_INTEGER EndOfFile; +} FILE_END_OF_FILE_INFORMATION, *PFILE_END_OF_FILE_INFORMATION; + +typedef struct _FILE_ALL_INFORMATION { + FILE_BASIC_INFORMATION BasicInformation; + FILE_STANDARD_INFORMATION StandardInformation; + FILE_INTERNAL_INFORMATION InternalInformation; + FILE_EA_INFORMATION EaInformation; + FILE_ACCESS_INFORMATION AccessInformation; + FILE_POSITION_INFORMATION PositionInformation; + FILE_MODE_INFORMATION ModeInformation; + FILE_ALIGNMENT_INFORMATION AlignmentInformation; + FILE_NAME_INFORMATION NameInformation; +} FILE_ALL_INFORMATION, *PFILE_ALL_INFORMATION; + +typedef struct _FILE_DISPOSITION_INFORMATION { + BOOLEAN DeleteFile; +} FILE_DISPOSITION_INFORMATION, *PFILE_DISPOSITION_INFORMATION; + +typedef struct _FILE_PIPE_LOCAL_INFORMATION { + ULONG NamedPipeType; + ULONG NamedPipeConfiguration; + ULONG MaximumInstances; + ULONG CurrentInstances; + ULONG InboundQuota; + ULONG ReadDataAvailable; + ULONG OutboundQuota; + ULONG WriteQuotaAvailable; + ULONG NamedPipeState; + ULONG NamedPipeEnd; +} FILE_PIPE_LOCAL_INFORMATION, *PFILE_PIPE_LOCAL_INFORMATION; + +#define FILE_SYNCHRONOUS_IO_ALERT 0x00000010 +#define FILE_SYNCHRONOUS_IO_NONALERT 0x00000020 + +typedef enum _FS_INFORMATION_CLASS { + FileFsVolumeInformation = 1, + FileFsLabelInformation = 2, + FileFsSizeInformation = 3, + FileFsDeviceInformation = 4, + FileFsAttributeInformation = 5, + FileFsControlInformation = 6, + FileFsFullSizeInformation = 7, + FileFsObjectIdInformation = 8, + FileFsDriverPathInformation = 9, + FileFsVolumeFlagsInformation = 10, + FileFsSectorSizeInformation = 11 +} FS_INFORMATION_CLASS, *PFS_INFORMATION_CLASS; + +typedef struct _FILE_FS_VOLUME_INFORMATION { + LARGE_INTEGER VolumeCreationTime; + ULONG VolumeSerialNumber; + ULONG VolumeLabelLength; + BOOLEAN SupportsObjects; + WCHAR VolumeLabel[1]; +} FILE_FS_VOLUME_INFORMATION, *PFILE_FS_VOLUME_INFORMATION; + +typedef struct _FILE_FS_LABEL_INFORMATION { + ULONG VolumeLabelLength; + WCHAR VolumeLabel[1]; +} FILE_FS_LABEL_INFORMATION, *PFILE_FS_LABEL_INFORMATION; + +typedef struct _FILE_FS_SIZE_INFORMATION { + LARGE_INTEGER TotalAllocationUnits; + LARGE_INTEGER AvailableAllocationUnits; + ULONG SectorsPerAllocationUnit; + ULONG BytesPerSector; +} FILE_FS_SIZE_INFORMATION, *PFILE_FS_SIZE_INFORMATION; + +typedef struct _FILE_FS_DEVICE_INFORMATION { + DEVICE_TYPE DeviceType; + ULONG Characteristics; +} FILE_FS_DEVICE_INFORMATION, *PFILE_FS_DEVICE_INFORMATION; + +typedef struct _FILE_FS_ATTRIBUTE_INFORMATION { + ULONG FileSystemAttributes; + LONG MaximumComponentNameLength; + ULONG FileSystemNameLength; + WCHAR FileSystemName[1]; +} FILE_FS_ATTRIBUTE_INFORMATION, *PFILE_FS_ATTRIBUTE_INFORMATION; + +typedef struct _FILE_FS_CONTROL_INFORMATION { + LARGE_INTEGER FreeSpaceStartFiltering; + LARGE_INTEGER FreeSpaceThreshold; + LARGE_INTEGER FreeSpaceStopFiltering; + LARGE_INTEGER DefaultQuotaThreshold; + LARGE_INTEGER DefaultQuotaLimit; + ULONG FileSystemControlFlags; +} FILE_FS_CONTROL_INFORMATION, *PFILE_FS_CONTROL_INFORMATION; + +typedef struct _FILE_FS_FULL_SIZE_INFORMATION { + LARGE_INTEGER TotalAllocationUnits; + LARGE_INTEGER CallerAvailableAllocationUnits; + LARGE_INTEGER ActualAvailableAllocationUnits; + ULONG SectorsPerAllocationUnit; + ULONG BytesPerSector; +} FILE_FS_FULL_SIZE_INFORMATION, *PFILE_FS_FULL_SIZE_INFORMATION; + +typedef struct _FILE_FS_OBJECTID_INFORMATION { + UCHAR ObjectId[16]; + UCHAR ExtendedInfo[48]; +} FILE_FS_OBJECTID_INFORMATION, *PFILE_FS_OBJECTID_INFORMATION; + +typedef struct _FILE_FS_DRIVER_PATH_INFORMATION { + BOOLEAN DriverInPath; + ULONG DriverNameLength; + WCHAR DriverName[1]; +} FILE_FS_DRIVER_PATH_INFORMATION, *PFILE_FS_DRIVER_PATH_INFORMATION; + +typedef struct _FILE_FS_VOLUME_FLAGS_INFORMATION { + ULONG Flags; +} FILE_FS_VOLUME_FLAGS_INFORMATION, *PFILE_FS_VOLUME_FLAGS_INFORMATION; + +typedef struct _FILE_FS_SECTOR_SIZE_INFORMATION { + ULONG LogicalBytesPerSector; + ULONG PhysicalBytesPerSectorForAtomicity; + ULONG PhysicalBytesPerSectorForPerformance; + ULONG FileSystemEffectivePhysicalBytesPerSectorForAtomicity; + ULONG Flags; + ULONG ByteOffsetForSectorAlignment; + ULONG ByteOffsetForPartitionAlignment; +} FILE_FS_SECTOR_SIZE_INFORMATION, *PFILE_FS_SECTOR_SIZE_INFORMATION; + +typedef struct _SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION { + LARGE_INTEGER IdleTime; + LARGE_INTEGER KernelTime; + LARGE_INTEGER UserTime; + LARGE_INTEGER DpcTime; + LARGE_INTEGER InterruptTime; + ULONG InterruptCount; +} SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION, *PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION; + +#ifndef SystemProcessorPerformanceInformation +# define SystemProcessorPerformanceInformation 8 +#endif + +#ifndef FILE_DEVICE_FILE_SYSTEM +# define FILE_DEVICE_FILE_SYSTEM 0x00000009 +#endif + +#ifndef FILE_DEVICE_NETWORK +# define FILE_DEVICE_NETWORK 0x00000012 +#endif + +#ifndef METHOD_BUFFERED +# define METHOD_BUFFERED 0 +#endif + +#ifndef METHOD_IN_DIRECT +# define METHOD_IN_DIRECT 1 +#endif + +#ifndef METHOD_OUT_DIRECT +# define METHOD_OUT_DIRECT 2 +#endif + +#ifndef METHOD_NEITHER +#define METHOD_NEITHER 3 +#endif + +#ifndef METHOD_DIRECT_TO_HARDWARE +# define METHOD_DIRECT_TO_HARDWARE METHOD_IN_DIRECT +#endif + +#ifndef METHOD_DIRECT_FROM_HARDWARE +# define METHOD_DIRECT_FROM_HARDWARE METHOD_OUT_DIRECT +#endif + +#ifndef FILE_ANY_ACCESS +# define FILE_ANY_ACCESS 0 +#endif + +#ifndef FILE_SPECIAL_ACCESS +# define FILE_SPECIAL_ACCESS (FILE_ANY_ACCESS) +#endif + +#ifndef FILE_READ_ACCESS +# define FILE_READ_ACCESS 0x0001 +#endif + +#ifndef FILE_WRITE_ACCESS +# define FILE_WRITE_ACCESS 0x0002 +#endif + +#ifndef CTL_CODE +# define CTL_CODE(device_type, function, method, access) \ + (((device_type) << 16) | ((access) << 14) | ((function) << 2) | (method)) +#endif + +#ifndef FSCTL_SET_REPARSE_POINT +# define FSCTL_SET_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, \ + 41, \ + METHOD_BUFFERED, \ + FILE_SPECIAL_ACCESS) +#endif + +#ifndef FSCTL_GET_REPARSE_POINT +# define FSCTL_GET_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, \ + 42, \ + METHOD_BUFFERED, \ + FILE_ANY_ACCESS) +#endif + +#ifndef FSCTL_DELETE_REPARSE_POINT +# define FSCTL_DELETE_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, \ + 43, \ + METHOD_BUFFERED, \ + FILE_SPECIAL_ACCESS) +#endif + +#ifndef IO_REPARSE_TAG_SYMLINK +# define IO_REPARSE_TAG_SYMLINK (0xA000000CL) +#endif + +typedef VOID (NTAPI *PIO_APC_ROUTINE) + (PVOID ApcContext, + PIO_STATUS_BLOCK IoStatusBlock, + ULONG Reserved); + ++typedef NTSTATUS (NTAPI *sRtlGetVersion) ++ (PRTL_OSVERSIONINFOW lpVersionInformation); ++ +typedef ULONG (NTAPI *sRtlNtStatusToDosError) + (NTSTATUS Status); + +typedef NTSTATUS (NTAPI *sNtDeviceIoControlFile) + (HANDLE FileHandle, + HANDLE Event, + PIO_APC_ROUTINE ApcRoutine, + PVOID ApcContext, + PIO_STATUS_BLOCK IoStatusBlock, + ULONG IoControlCode, + PVOID InputBuffer, + ULONG InputBufferLength, + PVOID OutputBuffer, + ULONG OutputBufferLength); + +typedef NTSTATUS (NTAPI *sNtQueryInformationFile) + (HANDLE FileHandle, + PIO_STATUS_BLOCK IoStatusBlock, + PVOID FileInformation, + ULONG Length, + FILE_INFORMATION_CLASS FileInformationClass); + +typedef NTSTATUS (NTAPI *sNtSetInformationFile) + (HANDLE FileHandle, + PIO_STATUS_BLOCK IoStatusBlock, + PVOID FileInformation, + ULONG Length, + FILE_INFORMATION_CLASS FileInformationClass); + +typedef NTSTATUS (NTAPI *sNtQueryVolumeInformationFile) + (HANDLE FileHandle, + PIO_STATUS_BLOCK IoStatusBlock, + PVOID FsInformation, + ULONG Length, + FS_INFORMATION_CLASS FsInformationClass); + +typedef NTSTATUS (NTAPI *sNtQuerySystemInformation) + (UINT SystemInformationClass, + PVOID SystemInformation, + ULONG SystemInformationLength, + PULONG ReturnLength); + +typedef NTSTATUS (NTAPI *sNtQueryDirectoryFile) + (HANDLE FileHandle, + HANDLE Event, + PIO_APC_ROUTINE ApcRoutine, + PVOID ApcContext, + PIO_STATUS_BLOCK IoStatusBlock, + PVOID FileInformation, + ULONG Length, + FILE_INFORMATION_CLASS FileInformationClass, + BOOLEAN ReturnSingleEntry, + PUNICODE_STRING FileName, + BOOLEAN RestartScan + ); + +/* + * Kernel32 headers + */ +#ifndef FILE_SKIP_COMPLETION_PORT_ON_SUCCESS +# define FILE_SKIP_COMPLETION_PORT_ON_SUCCESS 0x1 +#endif + +#ifndef FILE_SKIP_SET_EVENT_ON_HANDLE +# define FILE_SKIP_SET_EVENT_ON_HANDLE 0x2 +#endif + +#ifndef SYMBOLIC_LINK_FLAG_DIRECTORY +# define SYMBOLIC_LINK_FLAG_DIRECTORY 0x1 +#endif + +#if (defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)) \ + || (defined(_MSC_VER) && _MSC_VER < 1500) + typedef struct _OVERLAPPED_ENTRY { + ULONG_PTR lpCompletionKey; + LPOVERLAPPED lpOverlapped; + ULONG_PTR Internal; + DWORD dwNumberOfBytesTransferred; + } OVERLAPPED_ENTRY, *LPOVERLAPPED_ENTRY; +#endif + +/* from wincon.h */ +#ifndef ENABLE_INSERT_MODE +# define ENABLE_INSERT_MODE 0x20 +#endif + +#ifndef ENABLE_QUICK_EDIT_MODE +# define ENABLE_QUICK_EDIT_MODE 0x40 +#endif + +#ifndef ENABLE_EXTENDED_FLAGS +# define ENABLE_EXTENDED_FLAGS 0x80 +#endif + +/* from winerror.h */ +#ifndef ERROR_ELEVATION_REQUIRED +# define ERROR_ELEVATION_REQUIRED 740 +#endif + +#ifndef ERROR_SYMLINK_NOT_SUPPORTED +# define ERROR_SYMLINK_NOT_SUPPORTED 1464 +#endif + +#ifndef ERROR_MUI_FILE_NOT_FOUND +# define ERROR_MUI_FILE_NOT_FOUND 15100 +#endif + +#ifndef ERROR_MUI_INVALID_FILE +# define ERROR_MUI_INVALID_FILE 15101 +#endif + +#ifndef ERROR_MUI_INVALID_RC_CONFIG +# define ERROR_MUI_INVALID_RC_CONFIG 15102 +#endif + +#ifndef ERROR_MUI_INVALID_LOCALE_NAME +# define ERROR_MUI_INVALID_LOCALE_NAME 15103 +#endif + +#ifndef ERROR_MUI_INVALID_ULTIMATEFALLBACK_NAME +# define ERROR_MUI_INVALID_ULTIMATEFALLBACK_NAME 15104 +#endif + +#ifndef ERROR_MUI_FILE_NOT_LOADED +# define ERROR_MUI_FILE_NOT_LOADED 15105 +#endif + +typedef BOOL (WINAPI *sGetQueuedCompletionStatusEx) + (HANDLE CompletionPort, + LPOVERLAPPED_ENTRY lpCompletionPortEntries, + ULONG ulCount, + PULONG ulNumEntriesRemoved, + DWORD dwMilliseconds, + BOOL fAlertable); + - typedef BOOL (WINAPI* sSetFileCompletionNotificationModes) - (HANDLE FileHandle, - UCHAR Flags); - - typedef BOOLEAN (WINAPI* sCreateSymbolicLinkW) - (LPCWSTR lpSymlinkFileName, - LPCWSTR lpTargetFileName, - DWORD dwFlags); - - typedef BOOL (WINAPI* sCancelIoEx) - (HANDLE hFile, - LPOVERLAPPED lpOverlapped); - - typedef VOID (WINAPI* sInitializeConditionVariable) - (PCONDITION_VARIABLE ConditionVariable); - - typedef BOOL (WINAPI* sSleepConditionVariableCS) - (PCONDITION_VARIABLE ConditionVariable, - PCRITICAL_SECTION CriticalSection, - DWORD dwMilliseconds); - - typedef BOOL (WINAPI* sSleepConditionVariableSRW) - (PCONDITION_VARIABLE ConditionVariable, - PSRWLOCK SRWLock, - DWORD dwMilliseconds, - ULONG Flags); - - typedef VOID (WINAPI* sWakeAllConditionVariable) - (PCONDITION_VARIABLE ConditionVariable); - - typedef VOID (WINAPI* sWakeConditionVariable) - (PCONDITION_VARIABLE ConditionVariable); - - typedef BOOL (WINAPI* sCancelSynchronousIo) - (HANDLE hThread); - - typedef DWORD (WINAPI* sGetFinalPathNameByHandleW) - (HANDLE hFile, - LPWSTR lpszFilePath, - DWORD cchFilePath, - DWORD dwFlags); - +/* from powerbase.h */ +#ifndef DEVICE_NOTIFY_CALLBACK +# define DEVICE_NOTIFY_CALLBACK 2 +#endif + +#ifndef PBT_APMRESUMEAUTOMATIC +# define PBT_APMRESUMEAUTOMATIC 18 +#endif + +#ifndef PBT_APMRESUMESUSPEND +# define PBT_APMRESUMESUSPEND 7 +#endif + +typedef ULONG CALLBACK _DEVICE_NOTIFY_CALLBACK_ROUTINE( + PVOID Context, + ULONG Type, + PVOID Setting +); +typedef _DEVICE_NOTIFY_CALLBACK_ROUTINE* _PDEVICE_NOTIFY_CALLBACK_ROUTINE; + +typedef struct _DEVICE_NOTIFY_SUBSCRIBE_PARAMETERS { + _PDEVICE_NOTIFY_CALLBACK_ROUTINE Callback; + PVOID Context; +} _DEVICE_NOTIFY_SUBSCRIBE_PARAMETERS, *_PDEVICE_NOTIFY_SUBSCRIBE_PARAMETERS; + +typedef PVOID _HPOWERNOTIFY; +typedef _HPOWERNOTIFY *_PHPOWERNOTIFY; + +typedef DWORD (WINAPI *sPowerRegisterSuspendResumeNotification) + (DWORD Flags, + HANDLE Recipient, + _PHPOWERNOTIFY RegistrationHandle); + +/* from Winuser.h */ +typedef VOID (CALLBACK* WINEVENTPROC) + (HWINEVENTHOOK hWinEventHook, + DWORD event, + HWND hwnd, + LONG idObject, + LONG idChild, + DWORD idEventThread, + DWORD dwmsEventTime); + +typedef HWINEVENTHOOK (WINAPI *sSetWinEventHook) + (UINT eventMin, + UINT eventMax, + HMODULE hmodWinEventProc, + WINEVENTPROC lpfnWinEventProc, + DWORD idProcess, + DWORD idThread, + UINT dwflags); + + +/* Ntdll function pointers */ ++extern sRtlGetVersion pRtlGetVersion; +extern sRtlNtStatusToDosError pRtlNtStatusToDosError; +extern sNtDeviceIoControlFile pNtDeviceIoControlFile; +extern sNtQueryInformationFile pNtQueryInformationFile; +extern sNtSetInformationFile pNtSetInformationFile; +extern sNtQueryVolumeInformationFile pNtQueryVolumeInformationFile; +extern sNtQueryDirectoryFile pNtQueryDirectoryFile; +extern sNtQuerySystemInformation pNtQuerySystemInformation; + - +/* Kernel32 function pointers */ +extern sGetQueuedCompletionStatusEx pGetQueuedCompletionStatusEx; - extern sSetFileCompletionNotificationModes pSetFileCompletionNotificationModes; - extern sCreateSymbolicLinkW pCreateSymbolicLinkW; - extern sCancelIoEx pCancelIoEx; - extern sInitializeConditionVariable pInitializeConditionVariable; - extern sSleepConditionVariableCS pSleepConditionVariableCS; - extern sSleepConditionVariableSRW pSleepConditionVariableSRW; - extern sWakeAllConditionVariable pWakeAllConditionVariable; - extern sWakeConditionVariable pWakeConditionVariable; - extern sCancelSynchronousIo pCancelSynchronousIo; - extern sGetFinalPathNameByHandleW pGetFinalPathNameByHandleW; - + +/* Powrprof.dll function pointer */ +extern sPowerRegisterSuspendResumeNotification pPowerRegisterSuspendResumeNotification; + +/* User32.dll function pointer */ +extern sSetWinEventHook pSetWinEventHook; + - /* iphlpapi.dll function pointer */ - union _NET_LUID_LH; - typedef DWORD (WINAPI *sConvertInterfaceIndexToLuid)( - ULONG InterfaceIndex, - union _NET_LUID_LH *InterfaceLuid); - - typedef DWORD (WINAPI *sConvertInterfaceLuidToNameW)( - const union _NET_LUID_LH *InterfaceLuid, - PWSTR InterfaceName, - size_t Length); - - extern sConvertInterfaceIndexToLuid pConvertInterfaceIndexToLuid; - extern sConvertInterfaceLuidToNameW pConvertInterfaceLuidToNameW; - - +#endif /* UV_WIN_WINAPI_H_ */ https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4fcb0d0213112bb2fdb04bb27e82543b93cfe41d commit 4fcb0d0213112bb2fdb04bb27e82543b93cfe41d Author: libuv upstream AuthorDate: Tue Jan 15 10:42:13 2019 -0500 Commit: Brad King CommitDate: Wed Jan 16 14:48:27 2019 -0500 libuv 2019-01-15 (f84c5e69) Code extracted from: https://github.com/libuv/libuv.git at commit f84c5e693b80cb0c62bcefba147e7a66e2b839c9 (v1.x). diff --git a/include/pthread-barrier.h b/include/pthread-barrier.h deleted file mode 100644 index 07db9b8a..0000000 --- a/include/pthread-barrier.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -Copyright (c) 2016, Kari Tristan Helgason - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#ifndef _UV_PTHREAD_BARRIER_ -#define _UV_PTHREAD_BARRIER_ -#include -#include -#if !defined(__MVS__) -#include /* sem_t */ -#endif - -#define PTHREAD_BARRIER_SERIAL_THREAD 0x12345 -#define UV__PTHREAD_BARRIER_FALLBACK 1 - -/* - * To maintain ABI compatibility with - * libuv v1.x struct is padded according - * to target platform - */ -#if defined(__ANDROID__) -# define UV_BARRIER_STRUCT_PADDING \ - sizeof(pthread_mutex_t) + \ - sizeof(pthread_cond_t) + \ - sizeof(unsigned int) - \ - sizeof(void *) -#elif defined(__APPLE__) -# define UV_BARRIER_STRUCT_PADDING \ - sizeof(pthread_mutex_t) + \ - 2 * sizeof(sem_t) + \ - 2 * sizeof(unsigned int) - \ - sizeof(void *) -#else -# define UV_BARRIER_STRUCT_PADDING 0 -#endif - -typedef struct { - pthread_mutex_t mutex; - pthread_cond_t cond; - unsigned threshold; - unsigned in; - unsigned out; -} _uv_barrier; - -typedef struct { - _uv_barrier* b; - char _pad[UV_BARRIER_STRUCT_PADDING]; -} pthread_barrier_t; - -int pthread_barrier_init(pthread_barrier_t* barrier, - const void* barrier_attr, - unsigned count); - -int pthread_barrier_wait(pthread_barrier_t* barrier); -int pthread_barrier_destroy(pthread_barrier_t *barrier); - -#endif /* _UV_PTHREAD_BARRIER_ */ diff --git a/include/uv.h b/include/uv.h index 41fad45..a46b229 100644 --- a/include/uv.h +++ b/include/uv.h @@ -45,21 +45,21 @@ extern "C" { # define UV_EXTERN /* nothing */ #endif -#include "uv-errno.h" -#include "uv-version.h" +#include "uv/errno.h" +#include "uv/version.h" #include #include #if defined(_MSC_VER) && _MSC_VER < 1600 -# include "stdint-msvc2008.h" +# include "uv/stdint-msvc2008.h" #else # include #endif #if defined(_WIN32) -# include "uv-win.h" +# include "uv/win.h" #else -# include "uv-unix.h" +# include "uv/unix.h" #endif /* Expand this list if necessary. */ @@ -142,6 +142,7 @@ extern "C" { XX(EHOSTDOWN, "host is down") \ XX(EREMOTEIO, "remote I/O error") \ XX(ENOTTY, "inappropriate ioctl for device") \ + XX(EFTYPE, "inappropriate file type or format") \ #define UV_HANDLE_TYPE_MAP(XX) \ XX(ASYNC, async) \ @@ -233,6 +234,7 @@ typedef struct uv_cpu_info_s uv_cpu_info_t; typedef struct uv_interface_address_s uv_interface_address_t; typedef struct uv_dirent_s uv_dirent_t; typedef struct uv_passwd_s uv_passwd_t; +typedef struct uv_utsname_s uv_utsname_t; typedef enum { UV_LOOP_BLOCK_SIGNAL @@ -369,7 +371,10 @@ typedef enum { UV_EXTERN int uv_translate_sys_error(int sys_errno); UV_EXTERN const char* uv_strerror(int err); +UV_EXTERN char* uv_strerror_r(int err, char* buf, size_t buflen); + UV_EXTERN const char* uv_err_name(int err); +UV_EXTERN char* uv_err_name_r(int err, char* buf, size_t buflen); #define UV_REQ_FIELDS \ @@ -503,7 +508,7 @@ UV_EXTERN int uv_try_write(uv_stream_t* handle, struct uv_write_s { UV_REQ_FIELDS uv_write_cb cb; - uv_stream_t* send_handle; + uv_stream_t* send_handle; /* TODO: make private and unix-only in v2.x. */ uv_stream_t* handle; UV_WRITE_PRIVATE_FIELDS }; @@ -865,7 +870,13 @@ typedef enum { * flags may be specified to create a duplex data stream. */ UV_READABLE_PIPE = 0x10, - UV_WRITABLE_PIPE = 0x20 + UV_WRITABLE_PIPE = 0x20, + + /* + * Open the child pipe handle in overlapped mode on Windows. + * On Unix it is silently ignored. + */ + UV_OVERLAPPED_PIPE = 0x40 } uv_stdio_flags; typedef struct uv_stdio_container_s { @@ -953,11 +964,22 @@ enum uv_process_flags { */ UV_PROCESS_DETACHED = (1 << 3), /* + * Hide the subprocess window that would normally be created. This option is + * only meaningful on Windows systems. On Unix it is silently ignored. + */ + UV_PROCESS_WINDOWS_HIDE = (1 << 4), + /* * Hide the subprocess console window that would normally be created. This * option is only meaningful on Windows systems. On Unix it is silently * ignored. */ - UV_PROCESS_WINDOWS_HIDE = (1 << 4) + UV_PROCESS_WINDOWS_HIDE_CONSOLE = (1 << 5), + /* + * Hide the subprocess GUI window that would normally be created. This + * option is only meaningful on Windows systems. On Unix it is silently + * ignored. + */ + UV_PROCESS_WINDOWS_HIDE_GUI = (1 << 6) }; /* @@ -997,16 +1019,18 @@ UV_EXTERN int uv_queue_work(uv_loop_t* loop, UV_EXTERN int uv_cancel(uv_req_t* req); +struct uv_cpu_times_s { + uint64_t user; + uint64_t nice; + uint64_t sys; + uint64_t idle; + uint64_t irq; +}; + struct uv_cpu_info_s { char* model; int speed; - struct uv_cpu_times_s { - uint64_t user; - uint64_t nice; - uint64_t sys; - uint64_t idle; - uint64_t irq; - } cpu_times; + struct uv_cpu_times_s cpu_times; }; struct uv_interface_address_s { @@ -1031,6 +1055,16 @@ struct uv_passwd_s { char* homedir; }; +struct uv_utsname_s { + char sysname[256]; + char release[256]; + char version[256]; + char machine[256]; + /* This struct does not contain the nodename and domainname fields present in + the utsname type. domainname is a GNU extension. Both fields are referred + to as meaningless in the docs. */ +}; + typedef enum { UV_DIRENT_UNKNOWN, UV_DIRENT_FILE, @@ -1053,6 +1087,7 @@ UV_EXTERN int uv_set_process_title(const char* title); UV_EXTERN int uv_resident_set_memory(size_t* rss); UV_EXTERN int uv_uptime(double* uptime); UV_EXTERN uv_os_fd_t uv_get_osfhandle(int fd); +UV_EXTERN int uv_open_osfhandle(uv_os_fd_t os_fd); typedef struct { long tv_sec; @@ -1087,6 +1122,16 @@ UV_EXTERN void uv_os_free_passwd(uv_passwd_t* pwd); UV_EXTERN uv_pid_t uv_os_getpid(void); UV_EXTERN uv_pid_t uv_os_getppid(void); +#define UV_PRIORITY_LOW 19 +#define UV_PRIORITY_BELOW_NORMAL 10 +#define UV_PRIORITY_NORMAL 0 +#define UV_PRIORITY_ABOVE_NORMAL -7 +#define UV_PRIORITY_HIGH -14 +#define UV_PRIORITY_HIGHEST -20 + +UV_EXTERN int uv_os_getpriority(uv_pid_t pid, int* priority); +UV_EXTERN int uv_os_setpriority(uv_pid_t pid, int priority); + UV_EXTERN int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count); UV_EXTERN void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count); @@ -1101,6 +1146,8 @@ UV_EXTERN int uv_os_unsetenv(const char* name); UV_EXTERN int uv_os_gethostname(char* buffer, size_t* size); +UV_EXTERN int uv_os_uname(uv_utsname_t* buffer); + typedef enum { UV_FS_UNKNOWN = -1, @@ -1133,7 +1180,8 @@ typedef enum { UV_FS_CHOWN, UV_FS_FCHOWN, UV_FS_REALPATH, - UV_FS_COPYFILE + UV_FS_COPYFILE, + UV_FS_LCHOWN } uv_fs_type; /* uv_fs_t is a subclass of uv_req_t. */ @@ -1336,6 +1384,12 @@ UV_EXTERN int uv_fs_fchown(uv_loop_t* loop, uv_uid_t uid, uv_gid_t gid, uv_fs_cb cb); +UV_EXTERN int uv_fs_lchown(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + uv_uid_t uid, + uv_gid_t gid, + uv_fs_cb cb); enum uv_fs_event { diff --git a/include/uv-aix.h b/include/uv/aix.h similarity index 100% rename from include/uv-aix.h rename to include/uv/aix.h diff --git a/include/android-ifaddrs.h b/include/uv/android-ifaddrs.h similarity index 100% rename from include/android-ifaddrs.h rename to include/uv/android-ifaddrs.h diff --git a/include/uv-bsd.h b/include/uv/bsd.h similarity index 100% rename from include/uv-bsd.h rename to include/uv/bsd.h diff --git a/include/uv-darwin.h b/include/uv/darwin.h similarity index 100% rename from include/uv-darwin.h rename to include/uv/darwin.h diff --git a/include/uv-errno.h b/include/uv/errno.h similarity index 98% rename from include/uv-errno.h rename to include/uv/errno.h index aa4d450..8eeb95d 100644 --- a/include/uv-errno.h +++ b/include/uv/errno.h @@ -433,5 +433,11 @@ # define UV__ENOTTY (-4029) #endif +#if defined(EFTYPE) && !defined(_WIN32) +# define UV__EFTYPE UV__ERR(EFTYPE) +#else +# define UV__EFTYPE (-4028) +#endif + #endif /* UV_ERRNO_H_ */ diff --git a/include/uv-linux.h b/include/uv/linux.h similarity index 100% rename from include/uv-linux.h rename to include/uv/linux.h diff --git a/include/uv-os390.h b/include/uv/os390.h similarity index 100% rename from include/uv-os390.h rename to include/uv/os390.h diff --git a/include/uv-posix.h b/include/uv/posix.h similarity index 100% rename from include/uv-posix.h rename to include/uv/posix.h diff --git a/include/stdint-msvc2008.h b/include/uv/stdint-msvc2008.h similarity index 100% rename from include/stdint-msvc2008.h rename to include/uv/stdint-msvc2008.h diff --git a/include/uv-sunos.h b/include/uv/sunos.h similarity index 100% rename from include/uv-sunos.h rename to include/uv/sunos.h diff --git a/include/uv-threadpool.h b/include/uv/threadpool.h similarity index 100% rename from include/uv-threadpool.h rename to include/uv/threadpool.h diff --git a/include/tree.h b/include/uv/tree.h similarity index 100% rename from include/tree.h rename to include/uv/tree.h diff --git a/include/uv-unix.h b/include/uv/unix.h similarity index 95% rename from include/uv-unix.h rename to include/uv/unix.h index 480a069..9de9efe 100644 --- a/include/uv-unix.h +++ b/include/uv/unix.h @@ -42,32 +42,30 @@ #include #include -#include "uv-threadpool.h" +#include "uv/threadpool.h" #if defined(__linux__) -# include "uv-linux.h" +# include "uv/linux.h" #elif defined (__MVS__) -# include "uv-os390.h" +# include "uv/os390.h" #elif defined(__PASE__) -# include "uv-posix.h" +# include "uv/posix.h" #elif defined(_AIX) -# include "uv-aix.h" +# include "uv/aix.h" #elif defined(__sun) -# include "uv-sunos.h" +# include "uv/sunos.h" #elif defined(__APPLE__) -# include "uv-darwin.h" +# include "uv/darwin.h" #elif defined(__DragonFly__) || \ defined(__FreeBSD__) || \ defined(__FreeBSD_kernel__) || \ defined(__OpenBSD__) || \ defined(__NetBSD__) -# include "uv-bsd.h" +# include "uv/bsd.h" #elif defined(__CYGWIN__) || defined(__MSYS__) -# include "uv-posix.h" -#endif - -#ifndef PTHREAD_BARRIER_SERIAL_THREAD -# include "pthread-barrier.h" +# include "uv/posix.h" +#elif defined(__GNU__) +# include "uv/posix.h" #endif #ifndef NI_MAXHOST @@ -136,8 +134,28 @@ typedef pthread_rwlock_t uv_rwlock_t; typedef UV_PLATFORM_SEM_T uv_sem_t; typedef pthread_cond_t uv_cond_t; typedef pthread_key_t uv_key_t; -typedef pthread_barrier_t uv_barrier_t; +/* Note: guard clauses should match uv_barrier_init's in src/unix/thread.c. */ +#if defined(_AIX) || !defined(PTHREAD_BARRIER_SERIAL_THREAD) +/* TODO(bnoordhuis) Merge into uv_barrier_t in v2. */ +struct _uv_barrier { + uv_mutex_t mutex; + uv_cond_t cond; + unsigned threshold; + unsigned in; + unsigned out; +}; + +typedef struct { + struct _uv_barrier* b; +# if defined(PTHREAD_BARRIER_SERIAL_THREAD) + /* TODO(bnoordhuis) Remove padding in v2. */ + char pad[sizeof(pthread_barrier_t) - sizeof(struct _uv_barrier*)]; +# endif +} uv_barrier_t; +#else +typedef pthread_barrier_t uv_barrier_t; +#endif /* Platform-specific definitions for uv_spawn support. */ typedef gid_t uv_gid_t; diff --git a/include/uv-version.h b/include/uv/version.h similarity index 97% rename from include/uv-version.h rename to include/uv/version.h index 06c6711..abc140a 100644 --- a/include/uv-version.h +++ b/include/uv/version.h @@ -31,8 +31,8 @@ */ #define UV_VERSION_MAJOR 1 -#define UV_VERSION_MINOR 20 -#define UV_VERSION_PATCH 3 +#define UV_VERSION_MINOR 24 +#define UV_VERSION_PATCH 2 #define UV_VERSION_IS_RELEASE 0 #define UV_VERSION_SUFFIX "dev" diff --git a/include/uv-win.h b/include/uv/win.h similarity index 95% rename from include/uv-win.h rename to include/uv/win.h index 4c6c50a..edd2cc6 100644 --- a/include/uv-win.h +++ b/include/uv/win.h @@ -25,6 +25,7 @@ #if !defined(_SSIZE_T_) && !defined(_SSIZE_T_DEFINED) typedef intptr_t ssize_t; +# define SSIZE_MAX INTPTR_MAX # define _SSIZE_T_ # define _SSIZE_T_DEFINED #endif @@ -53,13 +54,13 @@ typedef struct pollfd { #include #if defined(_MSC_VER) && _MSC_VER < 1600 -# include "stdint-msvc2008.h" +# include "uv/stdint-msvc2008.h" #else # include #endif -#include "tree.h" -#include "uv-threadpool.h" +#include "uv/tree.h" +#include "uv/threadpool.h" #define MAX_PIPENAME_LEN 256 @@ -86,8 +87,16 @@ typedef struct pollfd { #define SIGKILL 9 #define SIGWINCH 28 -/* The CRT defines SIGABRT_COMPAT as 6, which equals SIGABRT on many */ -/* unix-like platforms. However MinGW doesn't define it, so we do. */ +/* Redefine NSIG to take SIGWINCH into consideration */ +#if defined(NSIG) && NSIG <= SIGWINCH +# undef NSIG +#endif +#ifndef NSIG +# define NSIG SIGWINCH + 1 +#endif + +/* The CRT defines SIGABRT_COMPAT as 6, which equals SIGABRT on many unix-like + * platforms. However MinGW doesn't define it, so we do. */ #ifndef SIGABRT_COMPAT # define SIGABRT_COMPAT 6 #endif @@ -244,7 +253,7 @@ typedef union { CRITICAL_SECTION waiters_count_lock; HANDLE signal_event; HANDLE broadcast_event; - } fallback; + } unused_; /* TODO: retained for ABI compatibility; remove me in v2.x. */ } uv_cond_t; typedef union { @@ -308,8 +317,6 @@ typedef struct { char* errmsg; } uv_lib_t; -RB_HEAD(uv_timer_tree_s, uv_timer_s); - #define UV_LOOP_PRIVATE_FIELDS \ /* The loop's I/O completion port */ \ HANDLE iocp; \ @@ -321,8 +328,8 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s); uv_req_t* pending_reqs_tail; \ /* Head of a single-linked list of closed handles */ \ uv_handle_t* endgame_handles; \ - /* The head of the timers tree */ \ - struct uv_timer_tree_s timers; \ + /* TODO(bnoordhuis) Stop heap-allocating |timer_heap| in libuv v2.x. */ \ + void* timer_heap; \ /* Lists of active loop (prepare / check / idle) watchers */ \ uv_prepare_t* prepare_handles; \ uv_check_t* check_handles; \ @@ -368,10 +375,10 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s); } u; \ struct uv_req_s* next_req; -#define UV_WRITE_PRIVATE_FIELDS \ - int ipc_header; \ - uv_buf_t write_buffer; \ - HANDLE event_handle; \ +#define UV_WRITE_PRIVATE_FIELDS \ + int coalesced; \ + uv_buf_t write_buffer; \ + HANDLE event_handle; \ HANDLE wait_handle; #define UV_CONNECT_PRIVATE_FIELDS \ @@ -459,16 +466,17 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s); #define uv_pipe_connection_fields \ uv_timer_t* eof_timer; \ - uv_write_t ipc_header_write_req; \ - int ipc_pid; \ - uint64_t remaining_ipc_rawdata_bytes; \ - struct { \ - void* queue[2]; \ - int queue_len; \ - } pending_ipc_info; \ + uv_write_t dummy; /* TODO: retained for ABI compat; remove this in v2.x. */ \ + DWORD ipc_remote_pid; \ + union { \ + uint32_t payload_remaining; \ + uint64_t dummy; /* TODO: retained for ABI compat; remove this in v2.x. */ \ + } ipc_data_frame; \ + void* ipc_xfer_queue[2]; \ + int ipc_xfer_queue_length; \ uv_write_t* non_overlapped_writes_tail; \ - uv_mutex_t readfile_mutex; \ - volatile HANDLE readfile_thread; + CRITICAL_SECTION readfile_thread_lock; \ + volatile HANDLE readfile_thread_handle; #define UV_PIPE_PRIVATE_FIELDS \ HANDLE handle; \ @@ -478,8 +486,8 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s); struct { uv_pipe_connection_fields } conn; \ } pipe; -/* TODO: put the parser states in an union - TTY handles are always */ -/* half-duplex so read-state can safely overlap write-state. */ +/* TODO: put the parser states in an union - TTY handles are always half-duplex + * so read-state can safely overlap write-state. */ #define UV_TTY_PRIVATE_FIELDS \ HANDLE handle; \ union { \ @@ -528,8 +536,9 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s); unsigned char events; #define UV_TIMER_PRIVATE_FIELDS \ - RB_ENTRY(uv_timer_s) tree_entry; \ - uint64_t due; \ + void* heap_node[3]; \ + int unused; \ + uint64_t timeout; \ uint64_t repeat; \ uint64_t start_id; \ uv_timer_cb timer_cb; diff --git a/src/fs-poll.c b/src/fs-poll.c index ee73d5a..6c82dfc 100644 --- a/src/fs-poll.c +++ b/src/fs-poll.c @@ -83,7 +83,7 @@ int uv_fs_poll_start(uv_fs_poll_t* handle, if (err < 0) goto error; - ctx->timer_handle.flags |= UV__HANDLE_INTERNAL; + ctx->timer_handle.flags |= UV_HANDLE_INTERNAL; uv__handle_unref(&ctx->timer_handle); err = uv_fs_stat(loop, &ctx->fs_req, ctx->path, poll_cb); @@ -248,7 +248,7 @@ static int statbuf_eq(const uv_stat_t* a, const uv_stat_t* b) { #include "win/handle-inl.h" void uv__fs_poll_endgame(uv_loop_t* loop, uv_fs_poll_t* handle) { - assert(handle->flags & UV__HANDLE_CLOSING); + assert(handle->flags & UV_HANDLE_CLOSING); assert(!(handle->flags & UV_HANDLE_CLOSED)); uv__handle_close(handle); } diff --git a/src/idna.c b/src/idna.c new file mode 100644 index 0000000..13ffac6 --- /dev/null +++ b/src/idna.c @@ -0,0 +1,291 @@ +/* Copyright (c) 2011, 2018 Ben Noordhuis + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* Derived from https://github.com/bnoordhuis/punycode + * but updated to support IDNA 2008. + */ + +#include "uv.h" +#include "idna.h" +#include + +static unsigned uv__utf8_decode1_slow(const char** p, + const char* pe, + unsigned a) { + unsigned b; + unsigned c; + unsigned d; + unsigned min; + + if (a > 0xF7) + return -1; + + switch (*p - pe) { + default: + if (a > 0xEF) { + min = 0x10000; + a = a & 7; + b = (unsigned char) *(*p)++; + c = (unsigned char) *(*p)++; + d = (unsigned char) *(*p)++; + break; + } + /* Fall through. */ + case 2: + if (a > 0xDF) { + min = 0x800; + b = 0x80 | (a & 15); + c = (unsigned char) *(*p)++; + d = (unsigned char) *(*p)++; + a = 0; + break; + } + /* Fall through. */ + case 1: + if (a > 0xBF) { + min = 0x80; + b = 0x80; + c = 0x80 | (a & 31); + d = (unsigned char) *(*p)++; + a = 0; + break; + } + return -1; /* Invalid continuation byte. */ + } + + if (0x80 != (0xC0 & (b ^ c ^ d))) + return -1; /* Invalid sequence. */ + + b &= 63; + c &= 63; + d &= 63; + a = (a << 18) | (b << 12) | (c << 6) | d; + + if (a < min) + return -1; /* Overlong sequence. */ + + if (a > 0x10FFFF) + return -1; /* Four-byte sequence > U+10FFFF. */ + + if (a >= 0xD800 && a <= 0xDFFF) + return -1; /* Surrogate pair. */ + + return a; +} + +unsigned uv__utf8_decode1(const char** p, const char* pe) { + unsigned a; + + a = (unsigned char) *(*p)++; + + if (a < 128) + return a; /* ASCII, common case. */ + + return uv__utf8_decode1_slow(p, pe, a); +} + +#define foreach_codepoint(c, p, pe) \ + for (; (void) (*p <= pe && (c = uv__utf8_decode1(p, pe))), *p <= pe;) + +static int uv__idna_toascii_label(const char* s, const char* se, + char** d, char* de) { + static const char alphabet[] = "abcdefghijklmnopqrstuvwxyz0123456789"; + const char* ss; + unsigned c; + unsigned h; + unsigned k; + unsigned n; + unsigned m; + unsigned q; + unsigned t; + unsigned x; + unsigned y; + unsigned bias; + unsigned delta; + unsigned todo; + int first; + + h = 0; + ss = s; + todo = 0; + + foreach_codepoint(c, &s, se) { + if (c < 128) + h++; + else if (c == (unsigned) -1) + return UV_EINVAL; + else + todo++; + } + + if (todo > 0) { + if (*d < de) *(*d)++ = 'x'; + if (*d < de) *(*d)++ = 'n'; + if (*d < de) *(*d)++ = '-'; + if (*d < de) *(*d)++ = '-'; + } + + x = 0; + s = ss; + foreach_codepoint(c, &s, se) { + if (c > 127) + continue; + + if (*d < de) + *(*d)++ = c; + + if (++x == h) + break; /* Visited all ASCII characters. */ + } + + if (todo == 0) + return h; + + /* Only write separator when we've written ASCII characters first. */ + if (h > 0) + if (*d < de) + *(*d)++ = '-'; + + n = 128; + bias = 72; + delta = 0; + first = 1; + + while (todo > 0) { + m = -1; + s = ss; + foreach_codepoint(c, &s, se) + if (c >= n) + if (c < m) + m = c; + + x = m - n; + y = h + 1; + + if (x > ~delta / y) + return UV_E2BIG; /* Overflow. */ + + delta += x * y; + n = m; + + s = ss; + foreach_codepoint(c, &s, se) { + if (c < n) + if (++delta == 0) + return UV_E2BIG; /* Overflow. */ + + if (c != n) + continue; + + for (k = 36, q = delta; /* empty */; k += 36) { + t = 1; + + if (k > bias) + t = k - bias; + + if (t > 26) + t = 26; + + if (q < t) + break; + + /* TODO(bnoordhuis) Since 1 <= t <= 26 and therefore + * 10 <= y <= 35, we can optimize the long division + * into a table-based reciprocal multiplication. + */ + x = q - t; + y = 36 - t; /* 10 <= y <= 35 since 1 <= t <= 26. */ + q = x / y; + t = t + x % y; /* 1 <= t <= 35 because of y. */ + + if (*d < de) + *(*d)++ = alphabet[t]; + } + + if (*d < de) + *(*d)++ = alphabet[q]; + + delta /= 2; + + if (first) { + delta /= 350; + first = 0; + } + + /* No overflow check is needed because |delta| was just + * divided by 2 and |delta+delta >= delta + delta/h|. + */ + h++; + delta += delta / h; + + for (bias = 0; delta > 35 * 26 / 2; bias += 36) + delta /= 35; + + bias += 36 * delta / (delta + 38); + delta = 0; + todo--; + } + + delta++; + n++; + } + + return 0; +} + +#undef foreach_codepoint + +long uv__idna_toascii(const char* s, const char* se, char* d, char* de) { + const char* si; + const char* st; + unsigned c; + char* ds; + int rc; + + ds = d; + + for (si = s; si < se; /* empty */) { + st = si; + c = uv__utf8_decode1(&si, se); + + if (c != '.') + if (c != 0x3002) /* ? */ + if (c != 0xFF0E) /* ? */ + if (c != 0xFF61) /* ? */ + continue; + + rc = uv__idna_toascii_label(s, st, &d, de); + + if (rc < 0) + return rc; + + if (d < de) + *d++ = '.'; + + s = si; + } + + if (s < se) { + rc = uv__idna_toascii_label(s, se, &d, de); + + if (rc < 0) + return rc; + } + + if (d < de) + *d++ = '\0'; + + return d - ds; /* Number of bytes written. */ +} diff --git a/src/idna.h b/src/idna.h new file mode 100644 index 0000000..8e0c592 --- /dev/null +++ b/src/idna.h @@ -0,0 +1,31 @@ +/* Copyright (c) 2011, 2018 Ben Noordhuis + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef UV_SRC_IDNA_H_ +#define UV_SRC_IDNA_H_ + +/* Decode a single codepoint. Returns the codepoint or UINT32_MAX on error. + * |p| is updated on success _and_ error, i.e., bad multi-byte sequences are + * skipped in their entirety, not just the first bad byte. + */ +unsigned uv__utf8_decode1(const char** p, const char* pe); + +/* Convert a UTF-8 domain name to IDNA 2008 / Punycode. A return value >= 0 + * is the number of bytes written to |d|, including the trailing nul byte. + * A return value < 0 is a libuv error code. |s| and |d| can not overlap. + */ +long uv__idna_toascii(const char* s, const char* se, char* d, char* de); + +#endif /* UV_SRC_IDNA_H_ */ diff --git a/src/inet.c b/src/inet.c index da63a68..698ab23 100644 --- a/src/inet.c +++ b/src/inet.c @@ -19,7 +19,7 @@ #include #if defined(_MSC_VER) && _MSC_VER < 1600 -# include "stdint-msvc2008.h" +# include "uv/stdint-msvc2008.h" #else # include #endif @@ -59,8 +59,7 @@ static int inet_ntop4(const unsigned char *src, char *dst, size_t size) { if (l <= 0 || (size_t) l >= size) { return UV_ENOSPC; } - strncpy(dst, tmp, size); - dst[size - 1] = '\0'; + uv__strscpy(dst, tmp, size); return 0; } @@ -142,14 +141,8 @@ static int inet_ntop6(const unsigned char *src, char *dst, size_t size) { if (best.base != -1 && (best.base + best.len) == ARRAY_SIZE(words)) *tp++ = ':'; *tp++ = '\0'; - - /* - * Check for overflow, copy, and we're done. - */ - if ((size_t)(tp - tmp) > size) { + if (UV_E2BIG == uv__strscpy(dst, tmp, size)) return UV_ENOSPC; - } - strcpy(dst, tmp); return 0; } diff --git a/src/strscpy.c b/src/strscpy.c new file mode 100644 index 0000000..2a2bdce --- /dev/null +++ b/src/strscpy.c @@ -0,0 +1,17 @@ +#include "strscpy.h" +#include /* SSIZE_MAX */ + +ssize_t uv__strscpy(char* d, const char* s, size_t n) { + size_t i; + + for (i = 0; i < n; i++) + if ('\0' == (d[i] = s[i])) + return i > SSIZE_MAX ? UV_E2BIG : (ssize_t) i; + + if (i == 0) + return 0; + + d[--i] = '\0'; + + return UV_E2BIG; +} diff --git a/src/strscpy.h b/src/strscpy.h new file mode 100644 index 0000000..fbe0a39 --- /dev/null +++ b/src/strscpy.h @@ -0,0 +1,18 @@ +#ifndef UV_STRSCPY_H_ +#define UV_STRSCPY_H_ + +/* Include uv.h for its definitions of size_t and ssize_t. + * size_t can be obtained directly from but ssize_t requires + * some hoop jumping on Windows that I didn't want to duplicate here. + */ +#include "uv.h" + +/* Copies up to |n-1| bytes from |d| to |s| and always zero-terminates + * the result, except when |n==0|. Returns the number of bytes copied + * or UV_E2BIG if |d| is too small. + * + * See https://www.kernel.org/doc/htmldocs/kernel-api/API-strscpy.html + */ +ssize_t uv__strscpy(char* d, const char* s, size_t n); + +#endif /* UV_STRSCPY_H_ */ diff --git a/src/threadpool.c b/src/threadpool.c index 413d1c2..4258933 100644 --- a/src/threadpool.c +++ b/src/threadpool.c @@ -33,12 +33,18 @@ static uv_once_t once = UV_ONCE_INIT; static uv_cond_t cond; static uv_mutex_t mutex; static unsigned int idle_threads; +static unsigned int slow_io_work_running; static unsigned int nthreads; static uv_thread_t* threads; static uv_thread_t default_threads[4]; static QUEUE exit_message; static QUEUE wq; +static QUEUE run_slow_work_message; +static QUEUE slow_io_pending_wq; +static unsigned int slow_work_thread_threshold(void) { + return (nthreads + 1) / 2; +} static void uv__cancelled(struct uv__work* w) { abort(); @@ -51,34 +57,67 @@ static void uv__cancelled(struct uv__work* w) { static void worker(void* arg) { struct uv__work* w; QUEUE* q; + int is_slow_work; uv_sem_post((uv_sem_t*) arg); arg = NULL; + uv_mutex_lock(&mutex); for (;;) { - uv_mutex_lock(&mutex); - - while (QUEUE_EMPTY(&wq)) { + /* `mutex` should always be locked at this point. */ + + /* Keep waiting while either no work is present or only slow I/O + and we're at the threshold for that. */ + while (QUEUE_EMPTY(&wq) || + (QUEUE_HEAD(&wq) == &run_slow_work_message && + QUEUE_NEXT(&run_slow_work_message) == &wq && + slow_io_work_running >= slow_work_thread_threshold())) { idle_threads += 1; uv_cond_wait(&cond, &mutex); idle_threads -= 1; } q = QUEUE_HEAD(&wq); - - if (q == &exit_message) + if (q == &exit_message) { uv_cond_signal(&cond); - else { + uv_mutex_unlock(&mutex); + break; + } + + QUEUE_REMOVE(q); + QUEUE_INIT(q); /* Signal uv_cancel() that the work req is executing. */ + + is_slow_work = 0; + if (q == &run_slow_work_message) { + /* If we're at the slow I/O threshold, re-schedule until after all + other work in the queue is done. */ + if (slow_io_work_running >= slow_work_thread_threshold()) { + QUEUE_INSERT_TAIL(&wq, q); + continue; + } + + /* If we encountered a request to run slow I/O work but there is none + to run, that means it's cancelled => Start over. */ + if (QUEUE_EMPTY(&slow_io_pending_wq)) + continue; + + is_slow_work = 1; + slow_io_work_running++; + + q = QUEUE_HEAD(&slow_io_pending_wq); QUEUE_REMOVE(q); - QUEUE_INIT(q); /* Signal uv_cancel() that the work req is - executing. */ + QUEUE_INIT(q); + + /* If there is more slow I/O work, schedule it to be run as well. */ + if (!QUEUE_EMPTY(&slow_io_pending_wq)) { + QUEUE_INSERT_TAIL(&wq, &run_slow_work_message); + if (idle_threads > 0) + uv_cond_signal(&cond); + } } uv_mutex_unlock(&mutex); - if (q == &exit_message) - break; - w = QUEUE_DATA(q, struct uv__work, wq); w->work(w); @@ -88,12 +127,32 @@ static void worker(void* arg) { QUEUE_INSERT_TAIL(&w->loop->wq, &w->wq); uv_async_send(&w->loop->wq_async); uv_mutex_unlock(&w->loop->wq_mutex); + + /* Lock `mutex` since that is expected at the start of the next + * iteration. */ + uv_mutex_lock(&mutex); + if (is_slow_work) { + /* `slow_io_work_running` is protected by `mutex`. */ + slow_io_work_running--; + } } } -static void post(QUEUE* q) { +static void post(QUEUE* q, enum uv__work_kind kind) { uv_mutex_lock(&mutex); + if (kind == UV__WORK_SLOW_IO) { + /* Insert into a separate queue. */ + QUEUE_INSERT_TAIL(&slow_io_pending_wq, q); + if (!QUEUE_EMPTY(&run_slow_work_message)) { + /* Running slow I/O tasks is already scheduled => Nothing to do here. + The worker that runs said other task will schedule this one as well. */ + uv_mutex_unlock(&mutex); + return; + } + q = &run_slow_work_message; + } + QUEUE_INSERT_TAIL(&wq, q); if (idle_threads > 0) uv_cond_signal(&cond); @@ -108,7 +167,7 @@ UV_DESTRUCTOR(static void cleanup(void)) { if (nthreads == 0) return; - post(&exit_message); + post(&exit_message, UV__WORK_CPU); for (i = 0; i < nthreads; i++) if (uv_thread_join(threads + i)) @@ -156,6 +215,8 @@ static void init_threads(void) { abort(); QUEUE_INIT(&wq); + QUEUE_INIT(&slow_io_pending_wq); + QUEUE_INIT(&run_slow_work_message); if (uv_sem_init(&sem, 0)) abort(); @@ -194,13 +255,14 @@ static void init_once(void) { void uv__work_submit(uv_loop_t* loop, struct uv__work* w, + enum uv__work_kind kind, void (*work)(struct uv__work* w), void (*done)(struct uv__work* w, int status)) { uv_once(&once, init_once); w->loop = loop; w->work = work; w->done = done; - post(&w->wq); + post(&w->wq, kind); } @@ -284,7 +346,11 @@ int uv_queue_work(uv_loop_t* loop, req->loop = loop; req->work_cb = work_cb; req->after_work_cb = after_work_cb; - uv__work_submit(loop, &req->work_req, uv__queue_work, uv__queue_done); + uv__work_submit(loop, + &req->work_req, + UV__WORK_CPU, + uv__queue_work, + uv__queue_done); return 0; } diff --git a/src/unix/timer.c b/src/timer.c similarity index 91% rename from src/unix/timer.c rename to src/timer.c index 54dabfe..dd78bcb 100644 --- a/src/unix/timer.c +++ b/src/timer.c @@ -19,13 +19,22 @@ */ #include "uv.h" -#include "internal.h" +#include "uv-common.h" #include "heap-inl.h" #include #include +static struct heap *timer_heap(const uv_loop_t* loop) { +#ifdef _WIN32 + return (struct heap*) loop->timer_heap; +#else + return (struct heap*) &loop->timer_heap; +#endif +} + + static int timer_less_than(const struct heap_node* ha, const struct heap_node* hb) { const uv_timer_t* a; @@ -81,7 +90,7 @@ int uv_timer_start(uv_timer_t* handle, /* start_id is the second index to be compared in uv__timer_cmp() */ handle->start_id = handle->loop->timer_counter++; - heap_insert((struct heap*) &handle->loop->timer_heap, + heap_insert(timer_heap(handle->loop), (struct heap_node*) &handle->heap_node, timer_less_than); uv__handle_start(handle); @@ -94,7 +103,7 @@ int uv_timer_stop(uv_timer_t* handle) { if (!uv__is_active(handle)) return 0; - heap_remove((struct heap*) &handle->loop->timer_heap, + heap_remove(timer_heap(handle->loop), (struct heap_node*) &handle->heap_node, timer_less_than); uv__handle_stop(handle); @@ -131,7 +140,7 @@ int uv__next_timeout(const uv_loop_t* loop) { const uv_timer_t* handle; uint64_t diff; - heap_node = heap_min((const struct heap*) &loop->timer_heap); + heap_node = heap_min(timer_heap(loop)); if (heap_node == NULL) return -1; /* block indefinitely */ @@ -143,7 +152,7 @@ int uv__next_timeout(const uv_loop_t* loop) { if (diff > INT_MAX) diff = INT_MAX; - return diff; + return (int) diff; } @@ -152,7 +161,7 @@ void uv__run_timers(uv_loop_t* loop) { uv_timer_t* handle; for (;;) { - heap_node = heap_min((struct heap*) &loop->timer_heap); + heap_node = heap_min(timer_heap(loop)); if (heap_node == NULL) break; diff --git a/src/unix/aix-common.c b/src/unix/aix-common.c index 9c11c5d..e9697e9 100644 --- a/src/unix/aix-common.c +++ b/src/unix/aix-common.c @@ -166,8 +166,7 @@ void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count) { } -int uv_interface_addresses(uv_interface_address_t** addresses, - int* count) { +int uv_interface_addresses(uv_interface_address_t** addresses, int* count) { uv_interface_address_t* address; int sockfd, inet6, size = 1; struct ifconf ifc; @@ -175,6 +174,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses, struct sockaddr_dl* sa_addr; *count = 0; + *addresses = NULL; if (0 > (sockfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP))) { return UV__ERR(errno); @@ -217,6 +217,11 @@ int uv_interface_addresses(uv_interface_address_t** addresses, (*count)++; } + if (*count == 0) { + uv__close(sockfd); + return 0; + } + /* Alloc the return interface structs */ *addresses = uv__malloc(*count * sizeof(uv_interface_address_t)); if (!(*addresses)) { @@ -290,3 +295,4 @@ void uv_free_interface_addresses(uv_interface_address_t* addresses, uv__free(addresses); } + diff --git a/src/unix/aix.c b/src/unix/aix.c index 92de814..337e58e 100644 --- a/src/unix/aix.c +++ b/src/unix/aix.c @@ -358,19 +358,15 @@ void uv_loadavg(double avg[3]) { #ifdef HAVE_SYS_AHAFS_EVPRODS_H -static char *uv__rawname(char *cp) { - static char rawbuf[FILENAME_MAX+1]; - char *dp = rindex(cp, '/'); +static char* uv__rawname(const char* cp, char (*dst)[FILENAME_MAX+1]) { + char* dp; + dp = rindex(cp, '/'); if (dp == 0) return 0; - *dp = 0; - strcpy(rawbuf, cp); - *dp = '/'; - strcat(rawbuf, "/r"); - strcat(rawbuf, dp+1); - return rawbuf; + snprintf(*dst, sizeof(*dst), "%.*s/r%s", (int) (dp - cp), cp, dp + 1); + return *dst; } @@ -399,6 +395,7 @@ static int uv__path_is_a_directory(char* filename) { * Returns 0 if AHAFS is mounted, or an error code < 0 on failure */ static int uv__is_ahafs_mounted(void){ + char rawbuf[FILENAME_MAX+1]; int rv, i = 2; struct vmount *p; int size_multiplier = 10; @@ -432,7 +429,7 @@ static int uv__is_ahafs_mounted(void){ obj = vmt2dataptr(vmt, VMT_OBJECT); /* device */ stub = vmt2dataptr(vmt, VMT_STUB); /* mount point */ - if (EQ(obj, dev) || EQ(uv__rawname(obj), dev) || EQ(stub, dev)) { + if (EQ(obj, dev) || EQ(uv__rawname(obj, &rawbuf), dev) || EQ(stub, dev)) { uv__free(p); /* Found a match */ return 0; } @@ -453,7 +450,8 @@ static int uv__makedir_p(const char *dir) { size_t len; int err; - snprintf(tmp, sizeof(tmp),"%s",dir); + /* TODO(bnoordhuis) Check uv__strscpy() return value. */ + uv__strscpy(tmp, dir, sizeof(tmp)); len = strlen(tmp); if (tmp[len - 1] == '/') tmp[len - 1] = 0; @@ -557,7 +555,7 @@ static int uv__setup_ahafs(const char* filename, int *fd) { sprintf(mon_file_write_string, "CHANGED=YES;WAIT_TYPE=WAIT_IN_SELECT;INFO_LVL=1"); rc = write(*fd, mon_file_write_string, strlen(mon_file_write_string)+1); - if (rc < 0) + if (rc < 0 && errno != EBUSY) return UV__ERR(errno); return 0; @@ -702,9 +700,9 @@ static void uv__ahafs_event(uv_loop_t* loop, uv__io_t* event_watch, unsigned int else p++; } - strncpy(fname, p, sizeof(fname) - 1); - /* Just in case */ - fname[sizeof(fname) - 1] = '\0'; + + /* TODO(bnoordhuis) Check uv__strscpy() return value. */ + uv__strscpy(fname, p, sizeof(fname)); handle->cb(handle, fname, events, 0); } @@ -730,12 +728,19 @@ int uv_fs_event_start(uv_fs_event_t* handle, char cwd[PATH_MAX]; char absolute_path[PATH_MAX]; char readlink_cwd[PATH_MAX]; + struct timeval zt; + fd_set pollfd; /* Figure out whether filename is absolute or not */ - if (filename[0] == '/') { + if (filename[0] == '\0') { + /* Missing a pathname */ + return UV_ENOENT; + } + else if (filename[0] == '/') { /* We have absolute pathname */ - snprintf(absolute_path, sizeof(absolute_path), "%s", filename); + /* TODO(bnoordhuis) Check uv__strscpy() return value. */ + uv__strscpy(absolute_path, filename, sizeof(absolute_path)); } else { /* We have a relative pathname, compose the absolute pathname */ snprintf(cwd, sizeof(cwd), "/proc/%lu/cwd", (unsigned long) getpid()); @@ -769,6 +774,15 @@ int uv_fs_event_start(uv_fs_event_t* handle, uv__io_start(handle->loop, &handle->event_watcher, POLLIN); + /* AHAFS wants someone to poll for it to start mointoring. + * so kick-start it so that we don't miss an event in the + * eventuality of an event that occurs in the current loop. */ + do { + memset(&zt, 0, sizeof(zt)); + FD_ZERO(&pollfd); + FD_SET(fd, &pollfd); + rc = select(fd + 1, &pollfd, NULL, NULL, &zt); + } while (rc == -1 && errno == EINTR); return 0; #else return UV_ENOSYS; @@ -886,16 +900,20 @@ int uv_set_process_title(const char* title) { int uv_get_process_title(char* buffer, size_t size) { size_t len; - len = strlen(process_argv[0]); if (buffer == NULL || size == 0) return UV_EINVAL; - else if (size <= len) - return UV_ENOBUFS; uv_once(&process_title_mutex_once, init_process_title_mutex_once); uv_mutex_lock(&process_title_mutex); - memcpy(buffer, process_argv[0], len + 1); + len = strlen(process_argv[0]); + if (size <= len) { + uv_mutex_unlock(&process_title_mutex); + return UV_ENOBUFS; + } + + memcpy(buffer, process_argv[0], len); + buffer[len] = '\0'; uv_mutex_unlock(&process_title_mutex); @@ -982,7 +1000,8 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) { return UV_ENOMEM; } - strcpy(cpu_id.name, FIRST_CPU); + /* TODO(bnoordhuis) Check uv__strscpy() return value. */ + uv__strscpy(cpu_id.name, FIRST_CPU, sizeof(cpu_id.name)); result = perfstat_cpu(&cpu_id, ps_cpus, sizeof(perfstat_cpu_t), ncpus); if (result == -1) { uv__free(ps_cpus); diff --git a/src/unix/android-ifaddrs.c b/src/unix/android-ifaddrs.c index bf30b14..99fb25a 100644 --- a/src/unix/android-ifaddrs.c +++ b/src/unix/android-ifaddrs.c @@ -23,7 +23,7 @@ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "android-ifaddrs.h" +#include "uv/android-ifaddrs.h" #include "uv-common.h" #include diff --git a/src/unix/bsd-ifaddrs.c b/src/unix/bsd-ifaddrs.c index 0d02154..3c2253f 100644 --- a/src/unix/bsd-ifaddrs.c +++ b/src/unix/bsd-ifaddrs.c @@ -52,13 +52,10 @@ static int uv__ifaddr_exclude(struct ifaddrs *ent, int exclude_type) { */ if (ent->ifa_addr->sa_family == AF_LINK) return 1; -#elif defined(__NetBSD__) +#elif defined(__NetBSD__) || defined(__OpenBSD__) if (ent->ifa_addr->sa_family != PF_INET && ent->ifa_addr->sa_family != PF_INET6) return 1; -#elif defined(__OpenBSD__) - if (ent->ifa_addr->sa_family != PF_INET) - return 1; #endif return 0; } @@ -69,11 +66,12 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) { uv_interface_address_t* address; int i; + *count = 0; + *addresses = NULL; + if (getifaddrs(&addrs) != 0) return UV__ERR(errno); - *count = 0; - /* Count the number of interfaces */ for (ent = addrs; ent != NULL; ent = ent->ifa_next) { if (uv__ifaddr_exclude(ent, UV__EXCLUDE_IFADDR)) @@ -81,6 +79,11 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) { (*count)++; } + if (*count == 0) { + freeifaddrs(addrs); + return 0; + } + *addresses = uv__malloc(*count * sizeof(**addresses)); if (*addresses == NULL) { @@ -121,15 +124,17 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) { address = *addresses; for (i = 0; i < *count; i++) { - if (strcmp(address->name, ent->ifa_name) == 0) { #if defined(__CYGWIN__) || defined(__MSYS__) - memset(address->phys_addr, 0, sizeof(address->phys_addr)); + memset(address->phys_addr, 0, sizeof(address->phys_addr)); #else + if (strcmp(address->name, ent->ifa_name) == 0) { struct sockaddr_dl* sa_addr; sa_addr = (struct sockaddr_dl*)(ent->ifa_addr); memcpy(address->phys_addr, LLADDR(sa_addr), sizeof(address->phys_addr)); -#endif + } else { + memset(address->phys_addr, 0, sizeof(address->phys_addr)); } +#endif address++; } } diff --git a/src/unix/proctitle.c b/src/unix/bsd-proctitle.c similarity index 50% copy from src/unix/proctitle.c copy to src/unix/bsd-proctitle.c index 1a8c7a7..0ce47c8 100644 --- a/src/unix/proctitle.c +++ b/src/unix/bsd-proctitle.c @@ -1,4 +1,5 @@ -/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. +/* Copyright libuv project contributors. All rights reserved. + * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the @@ -21,81 +22,40 @@ #include "uv.h" #include "internal.h" -#include -#include +#include +#include -extern void uv__set_process_title(const char* title); static uv_mutex_t process_title_mutex; static uv_once_t process_title_mutex_once = UV_ONCE_INIT; -static void* args_mem; - -static struct { - char* str; - size_t len; -} process_title; +static char* process_title; static void init_process_title_mutex_once(void) { - uv_mutex_init(&process_title_mutex); + if (uv_mutex_init(&process_title_mutex)) + abort(); } char** uv_setup_args(int argc, char** argv) { - char** new_argv; - size_t size; - char* s; - int i; - - if (argc <= 0) - return argv; - - /* Calculate how much memory we need for the argv strings. */ - size = 0; - for (i = 0; i < argc; i++) - size += strlen(argv[i]) + 1; - -#if defined(__MVS__) - /* argv is not adjacent. So just use argv[0] */ - process_title.str = argv[0]; - process_title.len = strlen(argv[0]); -#else - process_title.str = argv[0]; - process_title.len = argv[argc - 1] + strlen(argv[argc - 1]) - argv[0]; - assert(process_title.len + 1 == size); /* argv memory should be adjacent. */ -#endif - - /* Add space for the argv pointers. */ - size += (argc + 1) * sizeof(char*); - - new_argv = uv__malloc(size); - if (new_argv == NULL) - return argv; - args_mem = new_argv; - - /* Copy over the strings and set up the pointer table. */ - s = (char*) &new_argv[argc + 1]; - for (i = 0; i < argc; i++) { - size = strlen(argv[i]) + 1; - memcpy(s, argv[i], size); - new_argv[i] = s; - s += size; - } - new_argv[i] = NULL; - - return new_argv; + process_title = argc > 0 ? uv__strdup(argv[0]) : NULL; + return argv; } int uv_set_process_title(const char* title) { + char* new_title; + + new_title = uv__strdup(title); + if (new_title == NULL) + return UV_ENOMEM; + uv_once(&process_title_mutex_once, init_process_title_mutex_once); uv_mutex_lock(&process_title_mutex); - if (process_title.len != 0) { - /* No need to terminate, byte after is always '\0'. */ - strncpy(process_title.str, title, process_title.len); - uv__set_process_title(title); - } + uv__free(process_title); + process_title = new_title; + setproctitle("%s", title); uv_mutex_unlock(&process_title_mutex); @@ -104,29 +64,30 @@ int uv_set_process_title(const char* title) { int uv_get_process_title(char* buffer, size_t size) { + size_t len; + if (buffer == NULL || size == 0) return UV_EINVAL; uv_once(&process_title_mutex_once, init_process_title_mutex_once); uv_mutex_lock(&process_title_mutex); - if (size <= process_title.len) { - uv_mutex_unlock(&process_title_mutex); - return UV_ENOBUFS; - } + if (process_title != NULL) { + len = strlen(process_title) + 1; - if (process_title.len != 0) - memcpy(buffer, process_title.str, process_title.len + 1); + if (size < len) { + uv_mutex_unlock(&process_title_mutex); + return UV_ENOBUFS; + } - buffer[process_title.len] = '\0'; + memcpy(buffer, process_title, len); + } else { + len = 0; + } uv_mutex_unlock(&process_title_mutex); - return 0; -} + buffer[len] = '\0'; - -UV_DESTRUCTOR(static void free_args_mem(void)) { - uv__free(args_mem); /* Keep valgrind happy. */ - args_mem = NULL; + return 0; } diff --git a/src/unix/core.c b/src/unix/core.c index 18c8fcd..cd57ce2 100644 --- a/src/unix/core.c +++ b/src/unix/core.c @@ -40,6 +40,7 @@ #include /* writev */ #include /* getrusage */ #include +#include #ifdef __sun # include /* MAXHOSTNAMELEN on Solaris */ @@ -116,7 +117,7 @@ uint64_t uv_hrtime(void) { void uv_close(uv_handle_t* handle, uv_close_cb close_cb) { assert(!uv__is_closing(handle)); - handle->flags |= UV_CLOSING; + handle->flags |= UV_HANDLE_CLOSING; handle->close_cb = close_cb; switch (handle->type) { @@ -174,8 +175,8 @@ void uv_close(uv_handle_t* handle, uv_close_cb close_cb) { case UV_SIGNAL: uv__signal_close((uv_signal_t*) handle); - /* Signal handles may not be closed immediately. The signal code will */ - /* itself close uv__make_close_pending whenever appropriate. */ + /* Signal handles may not be closed immediately. The signal code will + * itself close uv__make_close_pending whenever appropriate. */ return; default: @@ -214,8 +215,8 @@ int uv__socket_sockopt(uv_handle_t* handle, int optname, int* value) { } void uv__make_close_pending(uv_handle_t* handle) { - assert(handle->flags & UV_CLOSING); - assert(!(handle->flags & UV_CLOSED)); + assert(handle->flags & UV_HANDLE_CLOSING); + assert(!(handle->flags & UV_HANDLE_CLOSED)); handle->next_closing = handle->loop->closing_handles; handle->loop->closing_handles = handle; } @@ -241,15 +242,17 @@ int uv__getiovmax(void) { static void uv__finish_close(uv_handle_t* handle) { - /* Note: while the handle is in the UV_CLOSING state now, it's still possible - * for it to be active in the sense that uv__is_active() returns true. + /* Note: while the handle is in the UV_HANDLE_CLOSING state now, it's still + * possible for it to be active in the sense that uv__is_active() returns + * true. + * * A good example is when the user calls uv_shutdown(), immediately followed * by uv_close(). The handle is considered active at this point because the * completion of the shutdown req is still pending. */ - assert(handle->flags & UV_CLOSING); - assert(!(handle->flags & UV_CLOSED)); - handle->flags |= UV_CLOSED; + assert(handle->flags & UV_HANDLE_CLOSING); + assert(!(handle->flags & UV_HANDLE_CLOSED)); + handle->flags |= UV_HANDLE_CLOSED; switch (handle->type) { case UV_PREPARE: @@ -634,27 +637,6 @@ int uv__cloexec_fcntl(int fd, int set) { } -/* This function is not execve-safe, there is a race window - * between the call to dup() and fcntl(FD_CLOEXEC). - */ -int uv__dup(int fd) { - int err; - - fd = dup(fd); - - if (fd == -1) - return UV__ERR(errno); - - err = uv__cloexec(fd, 1); - if (err) { - uv__close(fd); - return err; - } - - return fd; -} - - ssize_t uv__recvmsg(int fd, struct msghdr* msg, int flags) { struct cmsghdr* cmsg; ssize_t rc; @@ -927,6 +909,11 @@ int uv__io_active(const uv__io_t* w, unsigned int events) { } +int uv__fd_exists(uv_loop_t* loop, int fd) { + return (unsigned) fd < loop->nwatchers && loop->watchers[fd] != NULL; +} + + int uv_getrusage(uv_rusage_t* rusage) { struct rusage usage; @@ -1331,6 +1318,9 @@ uv_os_fd_t uv_get_osfhandle(int fd) { return fd; } +int uv_open_osfhandle(uv_os_fd_t os_fd) { + return os_fd; +} uv_pid_t uv_os_getpid(void) { return getpid(); @@ -1340,3 +1330,87 @@ uv_pid_t uv_os_getpid(void) { uv_pid_t uv_os_getppid(void) { return getppid(); } + + +int uv_os_getpriority(uv_pid_t pid, int* priority) { + int r; + + if (priority == NULL) + return UV_EINVAL; + + errno = 0; + r = getpriority(PRIO_PROCESS, (int) pid); + + if (r == -1 && errno != 0) + return UV__ERR(errno); + + *priority = r; + return 0; +} + + +int uv_os_setpriority(uv_pid_t pid, int priority) { + if (priority < UV_PRIORITY_HIGHEST || priority > UV_PRIORITY_LOW) + return UV_EINVAL; + + if (setpriority(PRIO_PROCESS, (int) pid, priority) != 0) + return UV__ERR(errno); + + return 0; +} + + +int uv_os_uname(uv_utsname_t* buffer) { + struct utsname buf; + int r; + + if (buffer == NULL) + return UV_EINVAL; + + if (uname(&buf) == -1) { + r = UV__ERR(errno); + goto error; + } + + r = uv__strscpy(buffer->sysname, buf.sysname, sizeof(buffer->sysname)); + if (r == UV_E2BIG) + goto error; + +#ifdef _AIX + r = snprintf(buffer->release, + sizeof(buffer->release), + "%s.%s", + buf.version, + buf.release); + if (r >= sizeof(buffer->release)) { + r = UV_E2BIG; + goto error; + } +#else + r = uv__strscpy(buffer->release, buf.release, sizeof(buffer->release)); + if (r == UV_E2BIG) + goto error; +#endif + + r = uv__strscpy(buffer->version, buf.version, sizeof(buffer->version)); + if (r == UV_E2BIG) + goto error; + +#if defined(_AIX) || defined(__PASE__) + r = uv__strscpy(buffer->machine, "ppc64", sizeof(buffer->machine)); +#else + r = uv__strscpy(buffer->machine, buf.machine, sizeof(buffer->machine)); +#endif + + if (r == UV_E2BIG) + goto error; + + return 0; + +error: + buffer->sysname[0] = '\0'; + buffer->release[0] = '\0'; + buffer->version[0] = '\0'; + buffer->machine[0] = '\0'; + return r; +} diff --git a/src/unix/cygwin.c b/src/unix/cygwin.c index 9fe4093..9da20e2 100644 --- a/src/unix/cygwin.c +++ b/src/unix/cygwin.c @@ -38,7 +38,7 @@ int uv_uptime(double* uptime) { int uv_resident_set_memory(size_t* rss) { /* FIXME: read /proc/meminfo? */ *rss = 0; - return UV_ENOSYS; + return 0; } int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) { diff --git a/src/unix/darwin-proctitle.c b/src/unix/darwin-proctitle.c index dabde22..e505bdd 100644 --- a/src/unix/darwin-proctitle.c +++ b/src/unix/darwin-proctitle.c @@ -33,61 +33,56 @@ # include #endif +#define S(s) pCFStringCreateWithCString(NULL, (s), kCFStringEncodingUTF8) -static int uv__pthread_setname_np(const char* name) { - int (*dynamic_pthread_setname_np)(const char* name); - char namebuf[64]; /* MAXTHREADNAMESIZE */ - int err; - - /* pthread_setname_np() first appeared in OS X 10.6 and iOS 3.2. */ - *(void **)(&dynamic_pthread_setname_np) = - dlsym(RTLD_DEFAULT, "pthread_setname_np"); - - if (dynamic_pthread_setname_np == NULL) - return UV_ENOSYS; - - strncpy(namebuf, name, sizeof(namebuf) - 1); - namebuf[sizeof(namebuf) - 1] = '\0'; - err = dynamic_pthread_setname_np(namebuf); - if (err) - return UV__ERR(err); +static int (*dynamic_pthread_setname_np)(const char* name); +#if !TARGET_OS_IPHONE +static CFStringRef (*pCFStringCreateWithCString)(CFAllocatorRef, + const char*, + CFStringEncoding); +static CFBundleRef (*pCFBundleGetBundleWithIdentifier)(CFStringRef); +static void *(*pCFBundleGetDataPointerForName)(CFBundleRef, CFStringRef); +static void *(*pCFBundleGetFunctionPointerForName)(CFBundleRef, CFStringRef); +static CFTypeRef (*pLSGetCurrentApplicationASN)(void); +static OSStatus (*pLSSetApplicationInformationItem)(int, + CFTypeRef, + CFStringRef, + CFStringRef, + CFDictionaryRef*); +static void* application_services_handle; +static void* core_foundation_handle; +static CFBundleRef launch_services_bundle; +static CFStringRef* display_name_key; +static CFDictionaryRef (*pCFBundleGetInfoDictionary)(CFBundleRef); +static CFBundleRef (*pCFBundleGetMainBundle)(void); +static CFBundleRef hi_services_bundle; +static OSStatus (*pSetApplicationIsDaemon)(int); +static CFDictionaryRef (*pLSApplicationCheckIn)(int, CFDictionaryRef); +static void (*pLSSetApplicationLaunchServicesServerConnectionStatus)(uint64_t, + void*); + + +UV_DESTRUCTOR(static void uv__set_process_title_platform_fini(void)) { + if (core_foundation_handle != NULL) { + dlclose(core_foundation_handle); + core_foundation_handle = NULL; + } - return 0; + if (application_services_handle != NULL) { + dlclose(application_services_handle); + application_services_handle = NULL; + } } +#endif /* !TARGET_OS_IPHONE */ -int uv__set_process_title(const char* title) { -#if TARGET_OS_IPHONE - return uv__pthread_setname_np(title); -#else - CFStringRef (*pCFStringCreateWithCString)(CFAllocatorRef, - const char*, - CFStringEncoding); - CFBundleRef (*pCFBundleGetBundleWithIdentifier)(CFStringRef); - void *(*pCFBundleGetDataPointerForName)(CFBundleRef, CFStringRef); - void *(*pCFBundleGetFunctionPointerForName)(CFBundleRef, CFStringRef); - CFTypeRef (*pLSGetCurrentApplicationASN)(void); - OSStatus (*pLSSetApplicationInformationItem)(int, - CFTypeRef, - CFStringRef, - CFStringRef, - CFDictionaryRef*); - void* application_services_handle; - void* core_foundation_handle; - CFBundleRef launch_services_bundle; - CFStringRef* display_name_key; - CFDictionaryRef (*pCFBundleGetInfoDictionary)(CFBundleRef); - CFBundleRef (*pCFBundleGetMainBundle)(void); - CFBundleRef hi_services_bundle; - OSStatus (*pSetApplicationIsDaemon)(int); - CFDictionaryRef (*pLSApplicationCheckIn)(int, CFDictionaryRef); - void (*pLSSetApplicationLaunchServicesServerConnectionStatus)(uint64_t, - void*); - CFTypeRef asn; - int err; - - err = UV_ENOENT; +void uv__set_process_title_platform_init(void) { + /* pthread_setname_np() first appeared in OS X 10.6 and iOS 3.2. */ + *(void **)(&dynamic_pthread_setname_np) = + dlsym(RTLD_DEFAULT, "pthread_setname_np"); + +#if !TARGET_OS_IPHONE application_services_handle = dlopen("/System/Library/Frameworks/" "ApplicationServices.framework/" "Versions/A/ApplicationServices", @@ -116,8 +111,6 @@ int uv__set_process_title(const char* title) { goto out; } -#define S(s) pCFStringCreateWithCString(NULL, (s), kCFStringEncodingUTF8) - launch_services_bundle = pCFBundleGetBundleWithIdentifier(S("com.apple.LaunchServices")); @@ -148,13 +141,14 @@ int uv__set_process_title(const char* title) { "CFBundleGetInfoDictionary"); *(void **)(&pCFBundleGetMainBundle) = dlsym(core_foundation_handle, "CFBundleGetMainBundle"); + if (pCFBundleGetInfoDictionary == NULL || pCFBundleGetMainBundle == NULL) goto out; /* Black 10.9 magic, to remove (Not responding) mark in Activity Monitor */ hi_services_bundle = pCFBundleGetBundleWithIdentifier(S("com.apple.HIServices")); - err = UV_ENOENT; + if (hi_services_bundle == NULL) goto out; @@ -168,42 +162,37 @@ int uv__set_process_title(const char* title) { pCFBundleGetFunctionPointerForName( launch_services_bundle, S("_LSSetApplicationLaunchServicesServerConnectionStatus")); + if (pSetApplicationIsDaemon == NULL || pLSApplicationCheckIn == NULL || pLSSetApplicationLaunchServicesServerConnectionStatus == NULL) { goto out; } - if (pSetApplicationIsDaemon(1) != noErr) - goto out; - - pLSSetApplicationLaunchServicesServerConnectionStatus(0, NULL); - - /* Check into process manager?! */ - pLSApplicationCheckIn(-2, - pCFBundleGetInfoDictionary(pCFBundleGetMainBundle())); - - asn = pLSGetCurrentApplicationASN(); - - err = UV_EINVAL; - if (pLSSetApplicationInformationItem(-2, /* Magic value. */ - asn, - *display_name_key, - S(title), - NULL) != noErr) { - goto out; - } - - uv__pthread_setname_np(title); /* Don't care if it fails. */ - err = 0; + return; out: - if (core_foundation_handle != NULL) - dlclose(core_foundation_handle); + uv__set_process_title_platform_fini(); +#endif /* !TARGET_OS_IPHONE */ +} - if (application_services_handle != NULL) - dlclose(application_services_handle); - return err; +void uv__set_process_title(const char* title) { +#if !TARGET_OS_IPHONE + if (core_foundation_handle != NULL && pSetApplicationIsDaemon(1) != noErr) { + CFTypeRef asn; + pLSSetApplicationLaunchServicesServerConnectionStatus(0, NULL); + pLSApplicationCheckIn(/* Magic value */ -2, + pCFBundleGetInfoDictionary(pCFBundleGetMainBundle())); + asn = pLSGetCurrentApplicationASN(); + pLSSetApplicationInformationItem(/* Magic value */ -2, asn, + *display_name_key, S(title), NULL); + } #endif /* !TARGET_OS_IPHONE */ + + if (dynamic_pthread_setname_np != NULL) { + char namebuf[64]; /* MAXTHREADNAMESIZE */ + uv__strscpy(namebuf, title, sizeof(namebuf)); + dynamic_pthread_setname_np(namebuf); + } } diff --git a/src/unix/freebsd.c b/src/unix/freebsd.c index 70ccb13..0f729cf 100644 --- a/src/unix/freebsd.c +++ b/src/unix/freebsd.c @@ -47,15 +47,6 @@ # define CP_INTR 4 #endif -static uv_mutex_t process_title_mutex; -static uv_once_t process_title_mutex_once = UV_ONCE_INIT; -static char *process_title; - - -static void init_process_title_mutex_once(void) { - uv_mutex_init(&process_title_mutex); -} - int uv__platform_loop_init(uv_loop_t* loop) { return uv__kqueue_init(loop); @@ -159,76 +150,6 @@ void uv_loadavg(double avg[3]) { } -char** uv_setup_args(int argc, char** argv) { - process_title = argc ? uv__strdup(argv[0]) : NULL; - return argv; -} - - -int uv_set_process_title(const char* title) { - int oid[4]; - char* new_title; - - new_title = uv__strdup(title); - - uv_once(&process_title_mutex_once, init_process_title_mutex_once); - uv_mutex_lock(&process_title_mutex); - - if (process_title == NULL) { - uv_mutex_unlock(&process_title_mutex); - return UV_ENOMEM; - } - - uv__free(process_title); - process_title = new_title; - - oid[0] = CTL_KERN; - oid[1] = KERN_PROC; - oid[2] = KERN_PROC_ARGS; - oid[3] = getpid(); - - sysctl(oid, - ARRAY_SIZE(oid), - NULL, - NULL, - process_title, - strlen(process_title) + 1); - - uv_mutex_unlock(&process_title_mutex); - - return 0; -} - - -int uv_get_process_title(char* buffer, size_t size) { - size_t len; - - if (buffer == NULL || size == 0) - return UV_EINVAL; - - uv_once(&process_title_mutex_once, init_process_title_mutex_once); - uv_mutex_lock(&process_title_mutex); - - if (process_title) { - len = strlen(process_title) + 1; - - if (size < len) { - uv_mutex_unlock(&process_title_mutex); - return UV_ENOBUFS; - } - - memcpy(buffer, process_title, len); - } else { - len = 0; - } - - uv_mutex_unlock(&process_title_mutex); - - buffer[len] = '\0'; - - return 0; -} - int uv_resident_set_memory(size_t* rss) { struct kinfo_proc kinfo; size_t page_size; diff --git a/src/unix/fs.c b/src/unix/fs.c index de67873..a0bd70d 100644 --- a/src/unix/fs.c +++ b/src/unix/fs.c @@ -43,7 +43,6 @@ #include #include #include -#include #include #if defined(__DragonFly__) || \ @@ -62,11 +61,20 @@ #if defined(__APPLE__) # include +# include #elif defined(__linux__) && !defined(FICLONE) # include # define FICLONE _IOW(0x94, 9, int) #endif +#if defined(_AIX) && !defined(_AIX71) +# include +#endif + +#if defined(_AIX) && _XOPEN_SOURCE <= 600 +extern char *mkdtemp(char *template); /* See issue #740 on AIX < 7 */ +#endif + #define INIT(subtype) \ do { \ if (req == NULL) \ @@ -120,7 +128,11 @@ do { \ if (cb != NULL) { \ uv__req_register(loop, req); \ - uv__work_submit(loop, &req->work_req, uv__fs_work, uv__fs_done); \ + uv__work_submit(loop, \ + &req->work_req, \ + UV__WORK_FAST_IO, \ + uv__fs_work, \ + uv__fs_done); \ return 0; \ } \ else { \ @@ -143,7 +155,7 @@ static ssize_t uv__fs_fsync(uv_fs_t* req) { int r; r = fcntl(req->file, F_FULLFSYNC); - if (r != 0 && errno == ENOTTY) + if (r != 0) r = fsync(req->file); return r; #else @@ -165,59 +177,17 @@ static ssize_t uv__fs_fdatasync(uv_fs_t* req) { static ssize_t uv__fs_futime(uv_fs_t* req) { -#if defined(__linux__) +#if defined(__linux__) \ + || defined(_AIX71) /* utimesat() has nanosecond resolution but we stick to microseconds * for the sake of consistency with other platforms. */ - static int no_utimesat; struct timespec ts[2]; - struct timeval tv[2]; - char path[sizeof("/proc/self/fd/") + 3 * sizeof(int)]; - int r; - - if (no_utimesat) - goto skip; - ts[0].tv_sec = req->atime; ts[0].tv_nsec = (uint64_t)(req->atime * 1000000) % 1000000 * 1000; ts[1].tv_sec = req->mtime; ts[1].tv_nsec = (uint64_t)(req->mtime * 1000000) % 1000000 * 1000; - - r = uv__utimesat(req->file, NULL, ts, 0); - if (r == 0) - return r; - - if (errno != ENOSYS) - return r; - - no_utimesat = 1; - -skip: - - tv[0].tv_sec = req->atime; - tv[0].tv_usec = (uint64_t)(req->atime * 1000000) % 1000000; - tv[1].tv_sec = req->mtime; - tv[1].tv_usec = (uint64_t)(req->mtime * 1000000) % 1000000; - snprintf(path, sizeof(path), "/proc/self/fd/%d", (int) req->file); - - r = utimes(path, tv); - if (r == 0) - return r; - - switch (errno) { - case ENOENT: - if (fcntl(req->file, F_GETFL) == -1 && errno == EBADF) - break; - /* Fall through. */ - - case EACCES: - case ENOTDIR: - errno = ENOSYS; - break; - } - - return r; - + return futimens(req->file, ts); #elif defined(__APPLE__) \ || defined(__DragonFly__) \ || defined(__FreeBSD__) \ @@ -235,13 +205,6 @@ skip: # else return futimes(req->file, tv); # endif -#elif defined(_AIX71) - struct timespec ts[2]; - ts[0].tv_sec = req->atime; - ts[0].tv_nsec = (uint64_t)(req->atime * 1000000) % 1000000 * 1000; - ts[1].tv_sec = req->mtime; - ts[1].tv_nsec = (uint64_t)(req->mtime * 1000000) % 1000000 * 1000; - return futimens(req->file, ts); #elif defined(__MVS__) attrib_t atr; memset(&atr, 0, sizeof(atr)); @@ -304,17 +267,13 @@ static ssize_t uv__fs_read(uv_fs_t* req) { #if defined(__linux__) static int no_preadv; #endif + unsigned int iovmax; ssize_t result; -#if defined(_AIX) - struct stat buf; - if(fstat(req->file, &buf)) - return -1; - if(S_ISDIR(buf.st_mode)) { - errno = EISDIR; - return -1; - } -#endif /* defined(_AIX) */ + iovmax = uv__getiovmax(); + if (req->nbufs > iovmax) + req->nbufs = iovmax; + if (req->off < 0) { if (req->nbufs == 1) result = read(req->file, req->bufs[0].base, req->bufs[0].len); @@ -333,25 +292,7 @@ static ssize_t uv__fs_read(uv_fs_t* req) { if (no_preadv) retry: # endif { - off_t nread; - size_t index; - - nread = 0; - index = 0; - result = 1; - do { - if (req->bufs[index].len > 0) { - result = pread(req->file, - req->bufs[index].base, - req->bufs[index].len, - req->off + nread); - if (result > 0) - nread += result; - } - index++; - } while (index < req->nbufs && result > 0); - if (nread > 0) - result = nread; + result = pread(req->file, req->bufs[0].base, req->bufs[0].len, req->off); } # if defined(__linux__) else { @@ -369,6 +310,13 @@ static ssize_t uv__fs_read(uv_fs_t* req) { } done: + /* Early cleanup of bufs allocation, since we're done with it. */ + if (req->bufs != req->bufsml) + uv__free(req->bufs); + + req->bufs = NULL; + req->nbufs = 0; + return result; } @@ -415,29 +363,55 @@ static ssize_t uv__fs_scandir(uv_fs_t* req) { return n; } +#if defined(_POSIX_PATH_MAX) +# define UV__FS_PATH_MAX _POSIX_PATH_MAX +#elif defined(PATH_MAX) +# define UV__FS_PATH_MAX PATH_MAX +#else +# define UV__FS_PATH_MAX_FALLBACK 8192 +# define UV__FS_PATH_MAX UV__FS_PATH_MAX_FALLBACK +#endif static ssize_t uv__fs_pathmax_size(const char* path) { ssize_t pathmax; pathmax = pathconf(path, _PC_PATH_MAX); - if (pathmax == -1) { -#if defined(PATH_MAX) - return PATH_MAX; -#else -#error "PATH_MAX undefined in the current platform" -#endif - } + if (pathmax == -1) + pathmax = UV__FS_PATH_MAX; return pathmax; } static ssize_t uv__fs_readlink(uv_fs_t* req) { + ssize_t maxlen; ssize_t len; char* buf; + char* newbuf; - len = uv__fs_pathmax_size(req->path); - buf = uv__malloc(len + 1); +#if defined(UV__FS_PATH_MAX_FALLBACK) + /* We may not have a real PATH_MAX. Read size of link. */ + struct stat st; + int ret; + ret = lstat(req->path, &st); + if (ret != 0) + return -1; + if (!S_ISLNK(st.st_mode)) { + errno = EINVAL; + return -1; + } + + maxlen = st.st_size; + + /* According to readlink(2) lstat can report st_size == 0 + for some symlinks, such as those in /proc or /sys. */ + if (maxlen == 0) + maxlen = uv__fs_pathmax_size(req->path); +#else + maxlen = uv__fs_pathmax_size(req->path); +#endif + + buf = uv__malloc(maxlen); if (buf == NULL) { errno = ENOMEM; @@ -445,17 +419,28 @@ static ssize_t uv__fs_readlink(uv_fs_t* req) { } #if defined(__MVS__) - len = os390_readlink(req->path, buf, len); + len = os390_readlink(req->path, buf, maxlen); #else - len = readlink(req->path, buf, len); + len = readlink(req->path, buf, maxlen); #endif - if (len == -1) { uv__free(buf); return -1; } + /* Uncommon case: resize to make room for the trailing nul byte. */ + if (len == maxlen) { + newbuf = uv__realloc(buf, len + 1); + + if (newbuf == NULL) { + uv__free(buf); + return -1; + } + + buf = newbuf; + } + buf[len] = '\0'; req->ptr = buf; @@ -463,9 +448,15 @@ static ssize_t uv__fs_readlink(uv_fs_t* req) { } static ssize_t uv__fs_realpath(uv_fs_t* req) { - ssize_t len; char* buf; +#if defined(_POSIX_VERSION) && _POSIX_VERSION >= 200809L + buf = realpath(req->path, NULL); + if (buf == NULL) + return -1; +#else + ssize_t len; + len = uv__fs_pathmax_size(req->path); buf = uv__malloc(len + 1); @@ -478,6 +469,7 @@ static ssize_t uv__fs_realpath(uv_fs_t* req) { uv__free(buf); return -1; } +#endif req->ptr = buf; @@ -698,10 +690,48 @@ static ssize_t uv__fs_sendfile(uv_fs_t* req) { static ssize_t uv__fs_utime(uv_fs_t* req) { +#if defined(__linux__) \ + || defined(_AIX71) \ + || defined(__sun) + /* utimesat() has nanosecond resolution but we stick to microseconds + * for the sake of consistency with other platforms. + */ + struct timespec ts[2]; + ts[0].tv_sec = req->atime; + ts[0].tv_nsec = (uint64_t)(req->atime * 1000000) % 1000000 * 1000; + ts[1].tv_sec = req->mtime; + ts[1].tv_nsec = (uint64_t)(req->mtime * 1000000) % 1000000 * 1000; + return utimensat(AT_FDCWD, req->path, ts, 0); +#elif defined(__APPLE__) \ + || defined(__DragonFly__) \ + || defined(__FreeBSD__) \ + || defined(__FreeBSD_kernel__) \ + || defined(__NetBSD__) \ + || defined(__OpenBSD__) + struct timeval tv[2]; + tv[0].tv_sec = req->atime; + tv[0].tv_usec = (uint64_t)(req->atime * 1000000) % 1000000; + tv[1].tv_sec = req->mtime; + tv[1].tv_usec = (uint64_t)(req->mtime * 1000000) % 1000000; + return utimes(req->path, tv); +#elif defined(_AIX) \ + && !defined(_AIX71) struct utimbuf buf; buf.actime = req->atime; buf.modtime = req->mtime; - return utime(req->path, &buf); /* TODO use utimes() where available */ + return utime(req->path, &buf); +#elif defined(__MVS__) + attrib_t atr; + memset(&atr, 0, sizeof(atr)); + atr.att_mtimechg = 1; + atr.att_atimechg = 1; + atr.att_mtime = req->mtime; + atr.att_atime = req->atime; + return __lchattr((char*) req->path, &atr, sizeof(atr)); +#else + errno = ENOSYS; + return -1; +#endif } @@ -739,25 +769,7 @@ static ssize_t uv__fs_write(uv_fs_t* req) { if (no_pwritev) retry: # endif { - off_t written; - size_t index; - - written = 0; - index = 0; - r = 0; - do { - if (req->bufs[index].len > 0) { - r = pwrite(req->file, - req->bufs[index].base, - req->bufs[index].len, - req->off + written); - if (r > 0) - written += r; - } - index++; - } while (index < req->nbufs && r >= 0); - if (written > 0) - r = written; + r = pwrite(req->file, req->bufs[0].base, req->bufs[0].len, req->off); } # if defined(__linux__) else { @@ -786,26 +798,41 @@ done: static ssize_t uv__fs_copyfile(uv_fs_t* req) { #if defined(__APPLE__) && !TARGET_OS_IPHONE /* On macOS, use the native copyfile(3). */ + static int can_clone; copyfile_flags_t flags; + char buf[64]; + size_t len; + int major; flags = COPYFILE_ALL; if (req->flags & UV_FS_COPYFILE_EXCL) flags |= COPYFILE_EXCL; -#ifdef COPYFILE_CLONE - if (req->flags & UV_FS_COPYFILE_FICLONE) - flags |= COPYFILE_CLONE; -#endif - + /* Check OS version. Cloning is only supported on macOS >= 10.12. */ if (req->flags & UV_FS_COPYFILE_FICLONE_FORCE) { -#ifdef COPYFILE_CLONE_FORCE - flags |= COPYFILE_CLONE_FORCE; -#else - return UV_ENOSYS; -#endif + if (can_clone == 0) { + len = sizeof(buf); + if (sysctlbyname("kern.osrelease", buf, &len, NULL, 0)) + return UV__ERR(errno); + + if (1 != sscanf(buf, "%d", &major)) + abort(); + + can_clone = -1 + 2 * (major >= 16); /* macOS >= 10.12 */ + } + + if (can_clone < 0) + return UV_ENOSYS; } + /* copyfile() simply ignores COPYFILE_CLONE if it's not supported. */ + if (req->flags & UV_FS_COPYFILE_FICLONE) + flags |= 1 << 24; /* COPYFILE_CLONE */ + + if (req->flags & UV_FS_COPYFILE_FICLONE_FORCE) + flags |= 1 << 25; /* COPYFILE_CLONE_FORCE */ + return copyfile(req->path, req->new_path, NULL, flags); #else uv_fs_t fs_req; @@ -865,9 +892,11 @@ static ssize_t uv__fs_copyfile(uv_fs_t* req) { /* If an error occurred that the sendfile fallback also won't handle, or this is a force clone then exit. Otherwise, fall through to try using sendfile(). */ - if ((errno != ENOTTY && errno != EOPNOTSUPP && errno != EXDEV) || - req->flags & UV_FS_COPYFILE_FICLONE_FORCE) { - err = -errno; + if (errno != ENOTTY && errno != EOPNOTSUPP && errno != EXDEV) { + err = UV__ERR(errno); + goto out; + } else if (req->flags & UV_FS_COPYFILE_FICLONE_FORCE) { + err = UV_ENOTSUP; goto out; } } else { @@ -927,7 +956,11 @@ out: } } - return result; + if (result == 0) + return 0; + + errno = UV__ERR(result); + return -1; #endif } @@ -1043,9 +1076,21 @@ static int uv__fs_fstat(int fd, uv_stat_t *buf) { return ret; } +static size_t uv__fs_buf_offset(uv_buf_t* bufs, size_t size) { + size_t offset; + /* Figure out which bufs are done */ + for (offset = 0; size > 0 && bufs[offset].len <= size; ++offset) + size -= bufs[offset].len; -typedef ssize_t (*uv__fs_buf_iter_processor)(uv_fs_t* req); -static ssize_t uv__fs_buf_iter(uv_fs_t* req, uv__fs_buf_iter_processor process) { + /* Fix a partial read/write */ + if (size > 0) { + bufs[offset].base += size; + bufs[offset].len -= size; + } + return offset; +} + +static ssize_t uv__fs_write_all(uv_fs_t* req) { unsigned int iovmax; unsigned int nbufs; uv_buf_t* bufs; @@ -1062,7 +1107,10 @@ static ssize_t uv__fs_buf_iter(uv_fs_t* req, uv__fs_buf_iter_processor process) if (req->nbufs > iovmax) req->nbufs = iovmax; - result = process(req); + do + result = uv__fs_write(req); + while (result < 0 && errno == EINTR); + if (result <= 0) { if (total == 0) total = result; @@ -1072,14 +1120,12 @@ static ssize_t uv__fs_buf_iter(uv_fs_t* req, uv__fs_buf_iter_processor process) if (req->off >= 0) req->off += result; + req->nbufs = uv__fs_buf_offset(req->bufs, result); req->bufs += req->nbufs; nbufs -= req->nbufs; total += result; } - if (errno == EINTR && total == -1) - return total; - if (bufs != req->bufsml) uv__free(bufs); @@ -1096,7 +1142,8 @@ static void uv__fs_work(struct uv__work* w) { ssize_t r; req = container_of(w, uv_fs_t, work_req); - retry_on_eintr = !(req->fs_type == UV_FS_CLOSE); + retry_on_eintr = !(req->fs_type == UV_FS_CLOSE || + req->fs_type == UV_FS_READ); do { errno = 0; @@ -1114,6 +1161,7 @@ static void uv__fs_work(struct uv__work* w) { X(COPYFILE, uv__fs_copyfile(req)); X(FCHMOD, fchmod(req->file, req->mode)); X(FCHOWN, fchown(req->file, req->uid, req->gid)); + X(LCHOWN, lchown(req->path, req->uid, req->gid)); X(FDATASYNC, uv__fs_fdatasync(req)); X(FSTAT, uv__fs_fstat(req->file, &req->statbuf)); X(FSYNC, uv__fs_fsync(req)); @@ -1124,7 +1172,7 @@ static void uv__fs_work(struct uv__work* w) { X(MKDIR, mkdir(req->path, req->mode)); X(MKDTEMP, uv__fs_mkdtemp(req)); X(OPEN, uv__fs_open(req)); - X(READ, uv__fs_buf_iter(req, uv__fs_read)); + X(READ, uv__fs_read(req)); X(SCANDIR, uv__fs_scandir(req)); X(READLINK, uv__fs_readlink(req)); X(REALPATH, uv__fs_realpath(req)); @@ -1135,7 +1183,7 @@ static void uv__fs_work(struct uv__work* w) { X(SYMLINK, symlink(req->path, req->new_path)); X(UNLINK, unlink(req->path)); X(UTIME, uv__fs_utime(req)); - X(WRITE, uv__fs_buf_iter(req, uv__fs_write)); + X(WRITE, uv__fs_write_all(req)); default: abort(); } #undef X @@ -1240,6 +1288,20 @@ int uv_fs_fchown(uv_loop_t* loop, } +int uv_fs_lchown(uv_loop_t* loop, + uv_fs_t* req, + const char* path, + uv_uid_t uid, + uv_gid_t gid, + uv_fs_cb cb) { + INIT(LCHOWN); + PATH; + req->uid = uid; + req->gid = gid; + POST; +} + + int uv_fs_fdatasync(uv_loop_t* loop, uv_fs_t* req, uv_file file, uv_fs_cb cb) { INIT(FDATASYNC); req->file = file; diff --git a/src/unix/fsevents.c b/src/unix/fsevents.c index 47d8024..c430562 100644 --- a/src/unix/fsevents.c +++ b/src/unix/fsevents.c @@ -255,42 +255,55 @@ static void uv__fsevents_event_cb(ConstFSEventStreamRef streamRef, path = paths[i]; len = strlen(path); + if (handle->realpath_len == 0) + continue; /* This should be unreachable */ + /* Filter out paths that are outside handle's request */ - if (strncmp(path, handle->realpath, handle->realpath_len) != 0) + if (len < handle->realpath_len) + continue; + + if (handle->realpath_len != len && + path[handle->realpath_len] != '/') + /* Make sure that realpath actually named a directory, + * or that we matched the whole string */ continue; - if (handle->realpath_len > 1 || *handle->realpath != '/') { + if (memcmp(path, handle->realpath, handle->realpath_len) != 0) + continue; + + if (!(handle->realpath_len == 1 && handle->realpath[0] == '/')) { + /* Remove common prefix, unless the watched folder is "/" */ path += handle->realpath_len; len -= handle->realpath_len; - /* Skip forward slash */ - if (*path != '\0') { + /* Ignore events with path equal to directory itself */ + if (len <= 1 && (flags & kFSEventStreamEventFlagItemIsDir)) + continue; + + if (len == 0) { + /* Since we're using fsevents to watch the file itself, + * realpath == path, and we now need to get the basename of the file back + * (for commonality with other codepaths and platforms). */ + while (len < handle->realpath_len && path[-1] != '/') { + path--; + len++; + } + /* Created and Removed seem to be always set, but don't make sense */ + flags &= ~kFSEventsRenamed; + } else { + /* Skip forward slash */ path++; len--; } } -#ifdef MAC_OS_X_VERSION_10_7 - /* Ignore events with path equal to directory itself */ - if (len == 0) - continue; -#else - if (len == 0 && (flags & kFSEventStreamEventFlagItemIsDir)) - continue; -#endif /* MAC_OS_X_VERSION_10_7 */ - /* Do not emit events from subdirectories (without option set) */ - if ((handle->cf_flags & UV_FS_EVENT_RECURSIVE) == 0 && *path != 0) { + if ((handle->cf_flags & UV_FS_EVENT_RECURSIVE) == 0 && *path != '\0') { pos = strchr(path + 1, '/'); if (pos != NULL) continue; } -#ifndef MAC_OS_X_VERSION_10_7 - path = ""; - len = 0; -#endif /* MAC_OS_X_VERSION_10_7 */ - event = uv__malloc(sizeof(*event) + len); if (event == NULL) break; @@ -299,22 +312,11 @@ static void uv__fsevents_event_cb(ConstFSEventStreamRef streamRef, memcpy(event->path, path, len + 1); event->events = UV_RENAME; -#ifdef MAC_OS_X_VERSION_10_7 - if (0 != (flags & kFSEventsModified) && - 0 == (flags & kFSEventsRenamed)) { - event->events = UV_CHANGE; - } -#else - if (0 != (flags & kFSEventsModified) && - 0 != (flags & kFSEventStreamEventFlagItemIsDir) && - 0 == (flags & kFSEventStreamEventFlagItemRenamed)) { - event->events = UV_CHANGE; - } - if (0 == (flags & kFSEventStreamEventFlagItemIsDir) && - 0 == (flags & kFSEventStreamEventFlagItemRenamed)) { - event->events = UV_CHANGE; + if (0 == (flags & kFSEventsRenamed)) { + if (0 != (flags & kFSEventsModified) || + 0 == (flags & kFSEventStreamEventFlagItemIsDir)) + event->events = UV_CHANGE; } -#endif /* MAC_OS_X_VERSION_10_7 */ QUEUE_INSERT_TAIL(&head, &event->member); } @@ -836,7 +838,7 @@ int uv__fsevents_init(uv_fs_event_t* handle) { handle->cf_cb->data = handle; uv_async_init(handle->loop, handle->cf_cb, uv__fsevents_cb); - handle->cf_cb->flags |= UV__HANDLE_INTERNAL; + handle->cf_cb->flags |= UV_HANDLE_INTERNAL; uv_unref((uv_handle_t*) handle->cf_cb); err = uv_mutex_init(&handle->cf_mutex); diff --git a/src/unix/getaddrinfo.c b/src/unix/getaddrinfo.c index 10e8afd..6d23fbe 100644 --- a/src/unix/getaddrinfo.c +++ b/src/unix/getaddrinfo.c @@ -27,6 +27,7 @@ #include "uv.h" #include "internal.h" +#include "idna.h" #include #include /* NULL */ @@ -141,15 +142,34 @@ int uv_getaddrinfo(uv_loop_t* loop, const char* hostname, const char* service, const struct addrinfo* hints) { + char hostname_ascii[256]; size_t hostname_len; size_t service_len; size_t hints_len; size_t len; char* buf; + long rc; if (req == NULL || (hostname == NULL && service == NULL)) return UV_EINVAL; + /* FIXME(bnoordhuis) IDNA does not seem to work z/OS, + * probably because it uses EBCDIC rather than ASCII. + */ +#ifdef __MVS__ + (void) &hostname_ascii; +#else + if (hostname != NULL) { + rc = uv__idna_toascii(hostname, + hostname + strlen(hostname), + hostname_ascii, + hostname_ascii + sizeof(hostname_ascii)); + if (rc < 0) + return rc; + hostname = hostname_ascii; + } +#endif + hostname_len = hostname ? strlen(hostname) + 1 : 0; service_len = service ? strlen(service) + 1 : 0; hints_len = hints ? sizeof(*hints) : 0; @@ -186,6 +206,7 @@ int uv_getaddrinfo(uv_loop_t* loop, if (cb) { uv__work_submit(loop, &req->work_req, + UV__WORK_SLOW_IO, uv__getaddrinfo_work, uv__getaddrinfo_done); return 0; diff --git a/src/unix/getnameinfo.c b/src/unix/getnameinfo.c index 9a43672..991002a 100644 --- a/src/unix/getnameinfo.c +++ b/src/unix/getnameinfo.c @@ -109,6 +109,7 @@ int uv_getnameinfo(uv_loop_t* loop, if (getnameinfo_cb) { uv__work_submit(loop, &req->work_req, + UV__WORK_SLOW_IO, uv__getnameinfo_work, uv__getnameinfo_done); return 0; diff --git a/src/unix/ibmi.c b/src/unix/ibmi.c index 02e90fb..13fed6c 100644 --- a/src/unix/ibmi.c +++ b/src/unix/ibmi.c @@ -72,7 +72,8 @@ void uv_loadavg(double avg[3]) { int uv_resident_set_memory(size_t* rss) { - return UV_ENOSYS; + *rss = 0; + return 0; } diff --git a/src/unix/internal.h b/src/unix/internal.h index 63e478f..c059893 100644 --- a/src/unix/internal.h +++ b/src/unix/internal.h @@ -127,26 +127,6 @@ int uv__pthread_sigmask(int how, const sigset_t* set, sigset_t* oset); typedef struct uv__stream_queued_fds_s uv__stream_queued_fds_t; -/* handle flags */ -enum { - UV_CLOSING = 0x01, /* uv_close() called but not finished. */ - UV_CLOSED = 0x02, /* close(2) finished. */ - UV_STREAM_READING = 0x04, /* uv_read_start() called. */ - UV_STREAM_SHUTTING = 0x08, /* uv_shutdown() called but not complete. */ - UV_STREAM_SHUT = 0x10, /* Write side closed. */ - UV_STREAM_READABLE = 0x20, /* The stream is readable */ - UV_STREAM_WRITABLE = 0x40, /* The stream is writable */ - UV_STREAM_BLOCKING = 0x80, /* Synchronous writes. */ - UV_STREAM_READ_PARTIAL = 0x100, /* read(2) read less than requested. */ - UV_STREAM_READ_EOF = 0x200, /* read(2) read EOF. */ - UV_TCP_NODELAY = 0x400, /* Disable Nagle. */ - UV_TCP_KEEPALIVE = 0x800, /* Turn on keep-alive. */ - UV_TCP_SINGLE_ACCEPT = 0x1000, /* Only accept() when idle. */ - UV_HANDLE_IPV6 = 0x10000, /* Handle is bound to a IPv6 socket. */ - UV_UDP_PROCESSING = 0x20000, /* Handle is running the send callback queue. */ - UV_HANDLE_BOUND = 0x40000 /* Handle is bound to an address and port */ -}; - /* loop flags */ enum { UV_LOOP_BLOCK_SIGPROF = 1 @@ -205,7 +185,6 @@ int uv__nonblock_fcntl(int fd, int set); int uv__close(int fd); /* preserves errno */ int uv__close_nocheckstdio(int fd); int uv__socket(int domain, int type, int protocol); -int uv__dup(int fd); ssize_t uv__recvmsg(int fd, struct msghdr *msg, int flags); void uv__make_close_pending(uv_handle_t* handle); int uv__getiovmax(void); @@ -219,6 +198,7 @@ int uv__io_active(const uv__io_t* w, unsigned int events); int uv__io_check_fd(uv_loop_t* loop, int fd); void uv__io_poll(uv_loop_t* loop, int timeout); /* in milliseconds or -1 */ int uv__io_fork(uv_loop_t* loop); +int uv__fd_exists(uv_loop_t* loop, int fd); /* async */ void uv__async_stop(uv_loop_t* loop); @@ -251,10 +231,6 @@ int uv__tcp_keepalive(int fd, int on, unsigned int delay); /* pipe */ int uv_pipe_listen(uv_pipe_t* handle, int backlog, uv_connection_cb cb); -/* timer */ -void uv__run_timers(uv_loop_t* loop); -int uv__next_timeout(const uv_loop_t* loop); - /* signal */ void uv__signal_close(uv_signal_t* handle); void uv__signal_global_once_init(void); @@ -279,7 +255,6 @@ void uv__prepare_close(uv_prepare_t* handle); void uv__process_close(uv_process_t* handle); void uv__stream_close(uv_stream_t* handle); void uv__tcp_close(uv_tcp_t* handle); -void uv__timer_close(uv_timer_t* handle); void uv__udp_close(uv_udp_t* handle); void uv__udp_finish_close(uv_udp_t* handle); uv_handle_type uv__handle_type(int fd); @@ -309,24 +284,6 @@ int uv__fsevents_init(uv_fs_event_t* handle); int uv__fsevents_close(uv_fs_event_t* handle); void uv__fsevents_loop_delete(uv_loop_t* loop); -/* OSX < 10.7 has no file events, polyfill them */ -#ifndef MAC_OS_X_VERSION_10_7 - -static const int kFSEventStreamCreateFlagFileEvents = 0x00000010; -static const int kFSEventStreamEventFlagItemCreated = 0x00000100; -static const int kFSEventStreamEventFlagItemRemoved = 0x00000200; -static const int kFSEventStreamEventFlagItemInodeMetaMod = 0x00000400; -static const int kFSEventStreamEventFlagItemRenamed = 0x00000800; -static const int kFSEventStreamEventFlagItemModified = 0x00001000; -static const int kFSEventStreamEventFlagItemFinderInfoMod = 0x00002000; -static const int kFSEventStreamEventFlagItemChangeOwner = 0x00004000; -static const int kFSEventStreamEventFlagItemXattrMod = 0x00008000; -static const int kFSEventStreamEventFlagItemIsFile = 0x00010000; -static const int kFSEventStreamEventFlagItemIsDir = 0x00020000; -static const int kFSEventStreamEventFlagItemIsSymlink = 0x00040000; - -#endif /* __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1070 */ - #endif /* defined(__APPLE__) */ UV_UNUSED(static void uv__update_time(uv_loop_t* loop)) { diff --git a/src/unix/kqueue.c b/src/unix/kqueue.c index a30fd73..c24f96e 100644 --- a/src/unix/kqueue.c +++ b/src/unix/kqueue.c @@ -261,8 +261,8 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { w = loop->watchers[fd]; if (w == NULL) { - /* File descriptor that we've stopped watching, disarm it. */ - /* TODO batch up */ + /* File descriptor that we've stopped watching, disarm it. + * TODO: batch up. */ struct kevent events[1]; EV_SET(events + 0, fd, ev->filter, EV_DELETE, 0, 0, 0); @@ -452,49 +452,48 @@ int uv_fs_event_start(uv_fs_event_t* handle, uv_fs_event_cb cb, const char* path, unsigned int flags) { -#if defined(__APPLE__) - struct stat statbuf; -#endif /* defined(__APPLE__) */ int fd; if (uv__is_active(handle)) return UV_EINVAL; - /* TODO open asynchronously - but how do we report back errors? */ - fd = open(path, O_RDONLY); - if (fd == -1) - return UV__ERR(errno); - - uv__handle_start(handle); - uv__io_init(&handle->event_watcher, uv__fs_event, fd); - handle->path = uv__strdup(path); - handle->cb = cb; - #if defined(__APPLE__) - if (uv__has_forked_with_cfrunloop) - goto fallback; - /* Nullify field to perform checks later */ handle->cf_cb = NULL; handle->realpath = NULL; handle->realpath_len = 0; handle->cf_flags = flags; - if (fstat(fd, &statbuf)) - goto fallback; - /* FSEvents works only with directories */ - if (!(statbuf.st_mode & S_IFDIR)) - goto fallback; - - /* The fallback fd is no longer needed */ - uv__close(fd); - handle->event_watcher.fd = -1; - - return uv__fsevents_init(handle); - -fallback: + if (!uv__has_forked_with_cfrunloop) { + int r; + /* The fallback fd is not used */ + handle->event_watcher.fd = -1; + handle->path = uv__strdup(path); + if (handle->path == NULL) + return UV_ENOMEM; + handle->cb = cb; + r = uv__fsevents_init(handle); + if (r == 0) { + uv__handle_start(handle); + } else { + uv__free(handle->path); + handle->path = NULL; + } + return r; + } #endif /* defined(__APPLE__) */ + /* TODO open asynchronously - but how do we report back errors? */ + fd = open(path, O_RDONLY); + if (fd == -1) + return UV__ERR(errno); + + handle->path = uv__strdup(path); + if (handle->path == NULL) + return UV_ENOMEM; + handle->cb = cb; + uv__handle_start(handle); + uv__io_init(&handle->event_watcher, uv__fs_event, fd); uv__io_start(handle->loop, &handle->event_watcher, POLLIN); return 0; @@ -502,29 +501,29 @@ fallback: int uv_fs_event_stop(uv_fs_event_t* handle) { + int r; + r = 0; + if (!uv__is_active(handle)) return 0; uv__handle_stop(handle); #if defined(__APPLE__) - if (uv__has_forked_with_cfrunloop || uv__fsevents_close(handle)) -#endif /* defined(__APPLE__) */ - { - uv__io_close(handle->loop, &handle->event_watcher); - } - - uv__free(handle->path); - handle->path = NULL; + if (!uv__has_forked_with_cfrunloop) + r = uv__fsevents_close(handle); +#endif if (handle->event_watcher.fd != -1) { - /* When FSEvents is used, we don't use the event_watcher's fd under certain - * confitions. (see uv_fs_event_start) */ + uv__io_close(handle->loop, &handle->event_watcher); uv__close(handle->event_watcher.fd); handle->event_watcher.fd = -1; } - return 0; + uv__free(handle->path); + handle->path = NULL; + + return r; } diff --git a/src/unix/linux-core.c b/src/unix/linux-core.c index b63c25f..3341b94 100644 --- a/src/unix/linux-core.c +++ b/src/unix/linux-core.c @@ -20,7 +20,7 @@ /* We lean on the fact that POLL{IN,OUT,ERR,HUP} correspond with their * EPOLL* counterparts. We use the POLL* variants in this file because that - * is what libuv uses elsewhere and it avoids a dependency on . + * is what libuv uses elsewhere. */ #include "uv.h" @@ -34,6 +34,7 @@ #include #include +#include #include #include #include @@ -51,7 +52,7 @@ #ifdef HAVE_IFADDRS_H # if defined(__ANDROID__) -# include "android-ifaddrs.h" +# include "uv/android-ifaddrs.h" # else # include # endif @@ -84,13 +85,13 @@ static unsigned long read_cpufreq(unsigned int cpunum); int uv__platform_loop_init(uv_loop_t* loop) { int fd; - fd = uv__epoll_create1(UV__EPOLL_CLOEXEC); + fd = epoll_create1(EPOLL_CLOEXEC); /* epoll_create1() can fail either because it's not implemented (old kernel) * or because it doesn't understand the EPOLL_CLOEXEC flag. */ if (fd == -1 && (errno == ENOSYS || errno == EINVAL)) { - fd = uv__epoll_create(256); + fd = epoll_create(256); if (fd != -1) uv__cloexec(fd, 1); @@ -134,20 +135,20 @@ void uv__platform_loop_delete(uv_loop_t* loop) { void uv__platform_invalidate_fd(uv_loop_t* loop, int fd) { - struct uv__epoll_event* events; - struct uv__epoll_event dummy; + struct epoll_event* events; + struct epoll_event dummy; uintptr_t i; uintptr_t nfds; assert(loop->watchers != NULL); - events = (struct uv__epoll_event*) loop->watchers[loop->nwatchers]; + events = (struct epoll_event*) loop->watchers[loop->nwatchers]; nfds = (uintptr_t) loop->watchers[loop->nwatchers + 1]; if (events != NULL) /* Invalidate events with same file descriptor */ for (i = 0; i < nfds; i++) - if ((int) events[i].data == fd) - events[i].data = -1; + if (events[i].data.fd == fd) + events[i].data.fd = -1; /* Remove the file descriptor from the epoll. * This avoids a problem where the same file description remains open @@ -160,25 +161,26 @@ void uv__platform_invalidate_fd(uv_loop_t* loop, int fd) { * has the EPOLLWAKEUP flag set generates spurious audit syslog warnings. */ memset(&dummy, 0, sizeof(dummy)); - uv__epoll_ctl(loop->backend_fd, UV__EPOLL_CTL_DEL, fd, &dummy); + epoll_ctl(loop->backend_fd, EPOLL_CTL_DEL, fd, &dummy); } } int uv__io_check_fd(uv_loop_t* loop, int fd) { - struct uv__epoll_event e; + struct epoll_event e; int rc; + memset(&e, 0, sizeof(e)); e.events = POLLIN; - e.data = -1; + e.data.fd = -1; rc = 0; - if (uv__epoll_ctl(loop->backend_fd, UV__EPOLL_CTL_ADD, fd, &e)) + if (epoll_ctl(loop->backend_fd, EPOLL_CTL_ADD, fd, &e)) if (errno != EEXIST) rc = UV__ERR(errno); if (rc == 0) - if (uv__epoll_ctl(loop->backend_fd, UV__EPOLL_CTL_DEL, fd, &e)) + if (epoll_ctl(loop->backend_fd, EPOLL_CTL_DEL, fd, &e)) abort(); return rc; @@ -195,16 +197,14 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { * that being the largest value I have seen in the wild (and only once.) */ static const int max_safe_timeout = 1789569; - static int no_epoll_pwait; - static int no_epoll_wait; - struct uv__epoll_event events[1024]; - struct uv__epoll_event* pe; - struct uv__epoll_event e; + struct epoll_event events[1024]; + struct epoll_event* pe; + struct epoll_event e; int real_timeout; QUEUE* q; uv__io_t* w; sigset_t sigset; - uint64_t sigmask; + sigset_t* psigset; uint64_t base; int have_signals; int nevents; @@ -219,6 +219,8 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { return; } + memset(&e, 0, sizeof(e)); + while (!QUEUE_EMPTY(&loop->watcher_queue)) { q = QUEUE_HEAD(&loop->watcher_queue); QUEUE_REMOVE(q); @@ -230,35 +232,35 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { assert(w->fd < (int) loop->nwatchers); e.events = w->pevents; - e.data = w->fd; + e.data.fd = w->fd; if (w->events == 0) - op = UV__EPOLL_CTL_ADD; + op = EPOLL_CTL_ADD; else - op = UV__EPOLL_CTL_MOD; + op = EPOLL_CTL_MOD; /* XXX Future optimization: do EPOLL_CTL_MOD lazily if we stop watching * events, skip the syscall and squelch the events after epoll_wait(). */ - if (uv__epoll_ctl(loop->backend_fd, op, w->fd, &e)) { + if (epoll_ctl(loop->backend_fd, op, w->fd, &e)) { if (errno != EEXIST) abort(); - assert(op == UV__EPOLL_CTL_ADD); + assert(op == EPOLL_CTL_ADD); /* We've reactivated a file descriptor that's been watched before. */ - if (uv__epoll_ctl(loop->backend_fd, UV__EPOLL_CTL_MOD, w->fd, &e)) + if (epoll_ctl(loop->backend_fd, EPOLL_CTL_MOD, w->fd, &e)) abort(); } w->events = w->pevents; } - sigmask = 0; + psigset = NULL; if (loop->flags & UV_LOOP_BLOCK_SIGPROF) { sigemptyset(&sigset); sigaddset(&sigset, SIGPROF); - sigmask |= 1 << (SIGPROF - 1); + psigset = &sigset; } assert(timeout >= -1); @@ -273,30 +275,11 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { if (sizeof(int32_t) == sizeof(long) && timeout >= max_safe_timeout) timeout = max_safe_timeout; - if (sigmask != 0 && no_epoll_pwait != 0) - if (pthread_sigmask(SIG_BLOCK, &sigset, NULL)) - abort(); - - if (no_epoll_wait != 0 || (sigmask != 0 && no_epoll_pwait == 0)) { - nfds = uv__epoll_pwait(loop->backend_fd, - events, - ARRAY_SIZE(events), - timeout, - sigmask); - if (nfds == -1 && errno == ENOSYS) - no_epoll_pwait = 1; - } else { - nfds = uv__epoll_wait(loop->backend_fd, - events, - ARRAY_SIZE(events), - timeout); - if (nfds == -1 && errno == ENOSYS) - no_epoll_wait = 1; - } - - if (sigmask != 0 && no_epoll_pwait != 0) - if (pthread_sigmask(SIG_UNBLOCK, &sigset, NULL)) - abort(); + nfds = epoll_pwait(loop->backend_fd, + events, + ARRAY_SIZE(events), + timeout, + psigset); /* Update loop->time unconditionally. It's tempting to skip the update when * timeout == 0 (i.e. non-blocking poll) but there is no guarantee that the @@ -317,12 +300,6 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { } if (nfds == -1) { - if (errno == ENOSYS) { - /* epoll_wait() or epoll_pwait() failed, try the other system call. */ - assert(no_epoll_wait == 0 || no_epoll_pwait == 0); - continue; - } - if (errno != EINTR) abort(); @@ -344,7 +321,7 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { loop->watchers[loop->nwatchers + 1] = (void*) (uintptr_t) nfds; for (i = 0; i < nfds; i++) { pe = events + i; - fd = pe->data; + fd = pe->data.fd; /* Skip invalidated events, see uv__platform_invalidate_fd */ if (fd == -1) @@ -361,7 +338,7 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { * Ignore all errors because we may be racing with another thread * when the file descriptor is closed. */ - uv__epoll_ctl(loop->backend_fd, UV__EPOLL_CTL_DEL, fd, pe); + epoll_ctl(loop->backend_fd, EPOLL_CTL_DEL, fd, pe); continue; } @@ -388,7 +365,8 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { * free when we switch over to edge-triggered I/O. */ if (pe->events == POLLERR || pe->events == POLLHUP) - pe->events |= w->pevents & (POLLIN | POLLOUT | UV__POLLPRI); + pe->events |= + w->pevents & (POLLIN | POLLOUT | UV__POLLRDHUP | UV__POLLPRI); if (pe->events != 0) { /* Run signal watchers last. This also affects child process watchers @@ -851,9 +829,10 @@ static int uv__ifaddr_exclude(struct ifaddrs *ent, int exclude_type) { return !exclude_type; } -int uv_interface_addresses(uv_interface_address_t** addresses, - int* count) { +int uv_interface_addresses(uv_interface_address_t** addresses, int* count) { #ifndef HAVE_IFADDRS_H + *count = 0; + *addresses = NULL; return UV_ENOSYS; #else struct ifaddrs *addrs, *ent; @@ -861,12 +840,12 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int i; struct sockaddr_ll *sll; - if (getifaddrs(&addrs)) - return UV__ERR(errno); - *count = 0; *addresses = NULL; + if (getifaddrs(&addrs)) + return UV__ERR(errno); + /* Count the number of interfaces */ for (ent = addrs; ent != NULL; ent = ent->ifa_next) { if (uv__ifaddr_exclude(ent, UV__EXCLUDE_IFADDR)) @@ -875,8 +854,10 @@ int uv_interface_addresses(uv_interface_address_t** addresses, (*count)++; } - if (*count == 0) + if (*count == 0) { + freeifaddrs(addrs); return 0; + } *addresses = uv__malloc(*count * sizeof(**addresses)); if (!(*addresses)) { @@ -920,6 +901,8 @@ int uv_interface_addresses(uv_interface_address_t** addresses, if (strcmp(address->name, ent->ifa_name) == 0) { sll = (struct sockaddr_ll*)ent->ifa_addr; memcpy(address->phys_addr, sll->sll_addr, sizeof(address->phys_addr)); + } else { + memset(address->phys_addr, 0, sizeof(address->phys_addr)); } address++; } diff --git a/src/unix/linux-inotify.c b/src/unix/linux-inotify.c index bcad630..9b26202 100644 --- a/src/unix/linux-inotify.c +++ b/src/unix/linux-inotify.c @@ -19,7 +19,7 @@ */ #include "uv.h" -#include "tree.h" +#include "uv/tree.h" #include "internal.h" #include @@ -278,6 +278,7 @@ int uv_fs_event_start(uv_fs_event_t* handle, const char* path, unsigned int flags) { struct watcher_list* w; + size_t len; int events; int err; int wd; @@ -306,12 +307,13 @@ int uv_fs_event_start(uv_fs_event_t* handle, if (w) goto no_insert; - w = uv__malloc(sizeof(*w) + strlen(path) + 1); + len = strlen(path) + 1; + w = uv__malloc(sizeof(*w) + len); if (w == NULL) return UV_ENOMEM; w->wd = wd; - w->path = strcpy((char*)(w + 1), path); + w->path = memcpy(w + 1, path, len); QUEUE_INIT(&w->watchers); w->iterating = 0; RB_INSERT(watcher_root, CAST(&handle->loop->inotify_watchers), w); diff --git a/src/unix/linux-syscalls.c b/src/unix/linux-syscalls.c index 89998de..bfd7544 100644 --- a/src/unix/linux-syscalls.c +++ b/src/unix/linux-syscalls.c @@ -77,56 +77,6 @@ # endif #endif /* __NR_eventfd2 */ -#ifndef __NR_epoll_create -# if defined(__x86_64__) -# define __NR_epoll_create 213 -# elif defined(__i386__) -# define __NR_epoll_create 254 -# elif defined(__arm__) -# define __NR_epoll_create (UV_SYSCALL_BASE + 250) -# endif -#endif /* __NR_epoll_create */ - -#ifndef __NR_epoll_create1 -# if defined(__x86_64__) -# define __NR_epoll_create1 291 -# elif defined(__i386__) -# define __NR_epoll_create1 329 -# elif defined(__arm__) -# define __NR_epoll_create1 (UV_SYSCALL_BASE + 357) -# endif -#endif /* __NR_epoll_create1 */ - -#ifndef __NR_epoll_ctl -# if defined(__x86_64__) -# define __NR_epoll_ctl 233 /* used to be 214 */ -# elif defined(__i386__) -# define __NR_epoll_ctl 255 -# elif defined(__arm__) -# define __NR_epoll_ctl (UV_SYSCALL_BASE + 251) -# endif -#endif /* __NR_epoll_ctl */ - -#ifndef __NR_epoll_wait -# if defined(__x86_64__) -# define __NR_epoll_wait 232 /* used to be 215 */ -# elif defined(__i386__) -# define __NR_epoll_wait 256 -# elif defined(__arm__) -# define __NR_epoll_wait (UV_SYSCALL_BASE + 252) -# endif -#endif /* __NR_epoll_wait */ - -#ifndef __NR_epoll_pwait -# if defined(__x86_64__) -# define __NR_epoll_pwait 281 -# elif defined(__i386__) -# define __NR_epoll_pwait 319 -# elif defined(__arm__) -# define __NR_epoll_pwait (UV_SYSCALL_BASE + 346) -# endif -#endif /* __NR_epoll_pwait */ - #ifndef __NR_inotify_init # if defined(__x86_64__) # define __NR_inotify_init 253 @@ -285,76 +235,6 @@ int uv__eventfd2(unsigned int count, int flags) { } -int uv__epoll_create(int size) { -#if defined(__NR_epoll_create) - return syscall(__NR_epoll_create, size); -#else - return errno = ENOSYS, -1; -#endif -} - - -int uv__epoll_create1(int flags) { -#if defined(__NR_epoll_create1) - return syscall(__NR_epoll_create1, flags); -#else - return errno = ENOSYS, -1; -#endif -} - - -int uv__epoll_ctl(int epfd, int op, int fd, struct uv__epoll_event* events) { -#if defined(__NR_epoll_ctl) - return syscall(__NR_epoll_ctl, epfd, op, fd, events); -#else - return errno = ENOSYS, -1; -#endif -} - - -int uv__epoll_wait(int epfd, - struct uv__epoll_event* events, - int nevents, - int timeout) { -#if defined(__NR_epoll_wait) - int result; - result = syscall(__NR_epoll_wait, epfd, events, nevents, timeout); -#if MSAN_ACTIVE - if (result > 0) - __msan_unpoison(events, sizeof(events[0]) * result); -#endif - return result; -#else - return errno = ENOSYS, -1; -#endif -} - - -int uv__epoll_pwait(int epfd, - struct uv__epoll_event* events, - int nevents, - int timeout, - uint64_t sigmask) { -#if defined(__NR_epoll_pwait) - int result; - result = syscall(__NR_epoll_pwait, - epfd, - events, - nevents, - timeout, - &sigmask, - sizeof(sigmask)); -#if MSAN_ACTIVE - if (result > 0) - __msan_unpoison(events, sizeof(events[0]) * result); -#endif - return result; -#else - return errno = ENOSYS, -1; -#endif -} - - int uv__inotify_init(void) { #if defined(__NR_inotify_init) return syscall(__NR_inotify_init); @@ -431,19 +311,6 @@ int uv__recvmmsg(int fd, } -int uv__utimesat(int dirfd, - const char* path, - const struct timespec times[2], - int flags) -{ -#if defined(__NR_utimensat) - return syscall(__NR_utimensat, dirfd, path, times, flags); -#else - return errno = ENOSYS, -1; -#endif -} - - ssize_t uv__preadv(int fd, const struct iovec *iov, int iovcnt, int64_t offset) { #if defined(__NR_preadv) return syscall(__NR_preadv, fd, iov, iovcnt, (long)offset, (long)(offset >> 32)); diff --git a/src/unix/linux-syscalls.h b/src/unix/linux-syscalls.h index 4c095e9..3dfd329 100644 --- a/src/unix/linux-syscalls.h +++ b/src/unix/linux-syscalls.h @@ -66,12 +66,6 @@ # define UV__SOCK_NONBLOCK UV__O_NONBLOCK #endif -/* epoll flags */ -#define UV__EPOLL_CLOEXEC UV__O_CLOEXEC -#define UV__EPOLL_CTL_ADD 1 -#define UV__EPOLL_CTL_DEL 2 -#define UV__EPOLL_CTL_MOD 3 - /* inotify flags */ #define UV__IN_ACCESS 0x001 #define UV__IN_MODIFY 0x002 @@ -86,18 +80,6 @@ #define UV__IN_DELETE_SELF 0x400 #define UV__IN_MOVE_SELF 0x800 -#if defined(__x86_64__) -struct uv__epoll_event { - uint32_t events; - uint64_t data; -} __attribute__((packed)); -#else -struct uv__epoll_event { - uint32_t events; - uint64_t data; -}; -#endif - struct uv__inotify_event { int32_t wd; uint32_t mask; @@ -113,18 +95,6 @@ struct uv__mmsghdr { int uv__accept4(int fd, struct sockaddr* addr, socklen_t* addrlen, int flags); int uv__eventfd(unsigned int count); -int uv__epoll_create(int size); -int uv__epoll_create1(int flags); -int uv__epoll_ctl(int epfd, int op, int fd, struct uv__epoll_event *ev); -int uv__epoll_wait(int epfd, - struct uv__epoll_event* events, - int nevents, - int timeout); -int uv__epoll_pwait(int epfd, - struct uv__epoll_event* events, - int nevents, - int timeout, - uint64_t sigmask); int uv__eventfd2(unsigned int count, int flags); int uv__inotify_init(void); int uv__inotify_init1(int flags); @@ -140,10 +110,6 @@ int uv__sendmmsg(int fd, struct uv__mmsghdr* mmsg, unsigned int vlen, unsigned int flags); -int uv__utimesat(int dirfd, - const char* path, - const struct timespec times[2], - int flags); ssize_t uv__preadv(int fd, const struct iovec *iov, int iovcnt, int64_t offset); ssize_t uv__pwritev(int fd, const struct iovec *iov, int iovcnt, int64_t offset); int uv__dup3(int oldfd, int newfd, int flags); diff --git a/src/unix/loop.c b/src/unix/loop.c index 99ead6c..c2a03d7 100644 --- a/src/unix/loop.c +++ b/src/unix/loop.c @@ -20,7 +20,7 @@ */ #include "uv.h" -#include "tree.h" +#include "uv/tree.h" #include "internal.h" #include "heap-inl.h" #include @@ -74,7 +74,7 @@ int uv_loop_init(uv_loop_t* loop) { goto fail_signal_init; uv__handle_unref(&loop->child_watcher); - loop->child_watcher.flags |= UV__HANDLE_INTERNAL; + loop->child_watcher.flags |= UV_HANDLE_INTERNAL; QUEUE_INIT(&loop->process_handles); err = uv_rwlock_init(&loop->cloexec_lock); @@ -90,7 +90,7 @@ int uv_loop_init(uv_loop_t* loop) { goto fail_async_init; uv__handle_unref(&loop->wq_async); - loop->wq_async.flags |= UV__HANDLE_INTERNAL; + loop->wq_async.flags |= UV_HANDLE_INTERNAL; return 0; diff --git a/src/unix/netbsd.c b/src/unix/netbsd.c index 2605c11..a2a4e52 100644 --- a/src/unix/netbsd.c +++ b/src/unix/netbsd.c @@ -40,15 +40,6 @@ #include #include -static uv_mutex_t process_title_mutex; -static uv_once_t process_title_mutex_once = UV_ONCE_INIT; -static char *process_title; - - -static void init_process_title_mutex_once(void) { - uv_mutex_init(&process_title_mutex); -} - int uv__platform_loop_init(uv_loop_t* loop) { return uv__kqueue_init(loop); @@ -96,7 +87,8 @@ int uv_exepath(char* buffer, size_t* size) { /* Copy string from the intermediate buffer to outer one with appropriate * length. */ - strlcpy(buffer, int_buf, *size); + /* TODO(bnoordhuis) Check uv__strscpy() return value. */ + uv__strscpy(buffer, int_buf, *size); /* Set new size. */ *size = strlen(buffer); @@ -134,65 +126,6 @@ uint64_t uv_get_total_memory(void) { } -char** uv_setup_args(int argc, char** argv) { - process_title = argc ? uv__strdup(argv[0]) : NULL; - return argv; -} - - -int uv_set_process_title(const char* title) { - char* new_title; - - new_title = uv__strdup(title); - - uv_once(&process_title_mutex_once, init_process_title_mutex_once); - uv_mutex_lock(&process_title_mutex); - - if (process_title == NULL) { - uv_mutex_unlock(&process_title_mutex); - return UV_ENOMEM; - } - - uv__free(process_title); - process_title = new_title; - setproctitle("%s", title); - - uv_mutex_unlock(&process_title_mutex); - - return 0; -} - - -int uv_get_process_title(char* buffer, size_t size) { - size_t len; - - if (buffer == NULL || size == 0) - return UV_EINVAL; - - uv_once(&process_title_mutex_once, init_process_title_mutex_once); - uv_mutex_lock(&process_title_mutex); - - if (process_title) { - len = strlen(process_title) + 1; - - if (size < len) { - uv_mutex_unlock(&process_title_mutex); - return UV_ENOBUFS; - } - - memcpy(buffer, process_title, len); - } else { - len = 0; - } - - uv_mutex_unlock(&process_title_mutex); - - buffer[len] = '\0'; - - return 0; -} - - int uv_resident_set_memory(size_t* rss) { kvm_t *kd = NULL; struct kinfo_proc2 *kinfo = NULL; diff --git a/src/unix/openbsd.c b/src/unix/openbsd.c index ce937cd..bffb58b 100644 --- a/src/unix/openbsd.c +++ b/src/unix/openbsd.c @@ -36,16 +36,6 @@ #include -static uv_mutex_t process_title_mutex; -static uv_once_t process_title_mutex_once = UV_ONCE_INIT; -static char *process_title; - - -static void init_process_title_mutex_once(void) { - uv_mutex_init(&process_title_mutex); -} - - int uv__platform_loop_init(uv_loop_t* loop) { return uv__kqueue_init(loop); } @@ -146,65 +136,6 @@ uint64_t uv_get_total_memory(void) { } -char** uv_setup_args(int argc, char** argv) { - process_title = argc ? uv__strdup(argv[0]) : NULL; - return argv; -} - - -int uv_set_process_title(const char* title) { - char* new_title; - - new_title = uv__strdup(title); - - uv_once(&process_title_mutex_once, init_process_title_mutex_once); - uv_mutex_lock(&process_title_mutex); - - if (process_title == NULL) { - uv_mutex_unlock(&process_title_mutex); - return UV_ENOMEM; - } - - uv__free(process_title); - process_title = new_title; - setproctitle("%s", title); - - uv_mutex_unlock(&process_title_mutex); - - return 0; -} - - -int uv_get_process_title(char* buffer, size_t size) { - size_t len; - - if (buffer == NULL || size == 0) - return UV_EINVAL; - - uv_once(&process_title_mutex_once, init_process_title_mutex_once); - uv_mutex_lock(&process_title_mutex); - - if (process_title) { - len = strlen(process_title) + 1; - - if (size < len) { - uv_mutex_unlock(&process_title_mutex); - return UV_ENOBUFS; - } - - memcpy(buffer, process_title, len); - } else { - len = 0; - } - - uv_mutex_unlock(&process_title_mutex); - - buffer[len] = '\0'; - - return 0; -} - - int uv_resident_set_memory(size_t* rss) { struct kinfo_proc kinfo; size_t page_size = getpagesize(); diff --git a/src/unix/os390-syscalls.c b/src/unix/os390-syscalls.c index a5dd344..1040d66 100644 --- a/src/unix/os390-syscalls.c +++ b/src/unix/os390-syscalls.c @@ -141,7 +141,7 @@ static void init_message_queue(uv__os390_epoll* lst) { } msg; /* initialize message queue */ - lst->msg_queue = msgget(IPC_PRIVATE, 0622 | IPC_CREAT); + lst->msg_queue = msgget(IPC_PRIVATE, 0600 | IPC_CREAT); if (lst->msg_queue == -1) abort(); @@ -255,12 +255,13 @@ int epoll_ctl(uv__os390_epoll* lst, lst->items[fd].events = event->events; lst->items[fd].revents = 0; } else if (op == EPOLL_CTL_MOD) { - if (fd >= lst->size || lst->items[fd].fd == -1) { + if (fd >= lst->size - 1 || lst->items[fd].fd == -1) { uv_mutex_unlock(&global_epoll_lock); errno = ENOENT; return -1; } lst->items[fd].events = event->events; + lst->items[fd].revents = 0; } else abort(); @@ -275,8 +276,9 @@ int epoll_wait(uv__os390_epoll* lst, struct epoll_event* events, struct pollfd* pfds; int pollret; int reventcount; + int nevents; - size = _SET_FDS_MSGS(size, 1, lst->size - 1); + _SET_FDS_MSGS(size, 1, lst->size - 1); pfds = lst->items; pollret = poll(pfds, size, timeout); if (pollret <= 0) @@ -285,19 +287,28 @@ int epoll_wait(uv__os390_epoll* lst, struct epoll_event* events, pollret = _NFDS(pollret) + _NMSGS(pollret); reventcount = 0; + nevents = 0; for (int i = 0; i < lst->size && i < maxevents && reventcount < pollret; ++i) { struct epoll_event ev; + struct pollfd* pfd; - if (pfds[i].fd == -1 || pfds[i].revents == 0) + pfd = &pfds[i]; + if (pfd->fd == -1 || pfd->revents == 0) continue; - ev.fd = pfds[i].fd; - ev.events = pfds[i].revents; - events[reventcount++] = ev; + ev.fd = pfd->fd; + ev.events = pfd->revents; + if (pfd->revents & POLLIN && pfd->revents & POLLOUT) + reventcount += 2; + else if (pfd->revents & (POLLIN | POLLOUT)) + ++reventcount; + + pfd->revents = 0; + events[nevents++] = ev; } - return reventcount; + return nevents; } @@ -493,7 +504,7 @@ ssize_t os390_readlink(const char* path, char* buf, size_t len) { size_t strnlen(const char* str, size_t maxlen) { - void* p = memchr(str, 0, maxlen); + char* p = memchr(str, 0, maxlen); if (p == NULL) return maxlen; else diff --git a/src/unix/os390-syscalls.h b/src/unix/os390-syscalls.h index 6e34a88..ea59910 100644 --- a/src/unix/os390-syscalls.h +++ b/src/unix/os390-syscalls.h @@ -36,10 +36,6 @@ #define MAX_ITEMS_PER_EPOLL 1024 #define UV__O_CLOEXEC 0x80000 -#define UV__EPOLL_CLOEXEC UV__O_CLOEXEC -#define UV__EPOLL_CTL_ADD EPOLL_CTL_ADD -#define UV__EPOLL_CTL_DEL EPOLL_CTL_DEL -#define UV__EPOLL_CTL_MOD EPOLL_CTL_MOD struct epoll_event { int events; diff --git a/src/unix/os390.c b/src/unix/os390.c index f766b39..dc146e3 100644 --- a/src/unix/os390.c +++ b/src/unix/os390.c @@ -229,15 +229,15 @@ static int getexe(const int pid, char* buf, size_t len) { assert(((Output_buf.Output_data.offsetPath >>24) & 0xFF) == 'A'); /* Get the offset from the lowest 3 bytes */ - Output_path = (char*)(&Output_buf) + - (Output_buf.Output_data.offsetPath & 0x00FFFFFF); + Output_path = (struct Output_path_type*) ((char*) (&Output_buf) + + (Output_buf.Output_data.offsetPath & 0x00FFFFFF)); if (Output_path->len >= len) { errno = ENOBUFS; return -1; } - strncpy(buf, Output_path->path, len); + uv__strscpy(buf, Output_path->path, len); return 0; } @@ -357,13 +357,11 @@ uint64_t uv_get_total_memory(void) { int uv_resident_set_memory(size_t* rss) { - char* psa; char* ascb; char* rax; size_t nframes; - psa = PSA_PTR; - ascb = *(char* __ptr32 *)(psa + PSAAOLD); + ascb = *(char* __ptr32 *)(PSA_PTR + PSAAOLD); rax = *(char* __ptr32 *)(ascb + ASCBRSME); nframes = *(unsigned int*)(rax + RAXFMCT); @@ -512,7 +510,7 @@ static int uv__interface_addresses_v6(uv_interface_address_t** addresses, /* TODO: Retrieve netmask using SIOCGIFNETMASK ioctl */ address->is_internal = flg.__nif6e_flags & _NIF6E_FLAGS_LOOPBACK ? 1 : 0; - + memset(address->phys_addr, 0, sizeof(address->phys_addr)); address++; } @@ -531,12 +529,14 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) { struct ifreq* p; int count_v6; + *count = 0; + *addresses = NULL; + /* get the ipv6 addresses first */ uv_interface_address_t* addresses_v6; uv__interface_addresses_v6(&addresses_v6, &count_v6); /* now get the ipv4 addresses */ - *count = 0; /* Assume maximum buffer size allowable */ maxsize = 16384; @@ -578,6 +578,11 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) { (*count)++; } + if (*count == 0) { + uv__close(sockfd); + return 0; + } + /* Alloc the return interface structs */ *addresses = uv__malloc((*count + count_v6) * sizeof(uv_interface_address_t)); @@ -624,6 +629,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) { } address->is_internal = flg.ifr_flags & IFF_LOOPBACK ? 1 : 0; + memset(address->phys_addr, 0, sizeof(address->phys_addr)); address++; } @@ -662,7 +668,7 @@ void uv__platform_invalidate_fd(uv_loop_t* loop, int fd) { /* Remove the file descriptor from the epoll. */ if (loop->ep != NULL) - epoll_ctl(loop->ep, UV__EPOLL_CTL_DEL, fd, &dummy); + epoll_ctl(loop->ep, EPOLL_CTL_DEL, fd, &dummy); } @@ -751,7 +757,7 @@ int uv_fs_event_stop(uv_fs_event_t* handle) { memcpy(reg_struct.__rfis_rftok, handle->rfis_rftok, sizeof(handle->rfis_rftok)); - /* + /* * This call will take "/" as the path argument in case we * don't care to supply the correct path. The system will simply * ignore it. @@ -838,9 +844,9 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { e.fd = w->fd; if (w->events == 0) - op = UV__EPOLL_CTL_ADD; + op = EPOLL_CTL_ADD; else - op = UV__EPOLL_CTL_MOD; + op = EPOLL_CTL_MOD; /* XXX Future optimization: do EPOLL_CTL_MOD lazily if we stop watching * events, skip the syscall and squelch the events after epoll_wait(). @@ -849,10 +855,10 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { if (errno != EEXIST) abort(); - assert(op == UV__EPOLL_CTL_ADD); + assert(op == EPOLL_CTL_ADD); /* We've reactivated a file descriptor that's been watched before. */ - if (epoll_ctl(loop->ep, UV__EPOLL_CTL_MOD, w->fd, &e)) + if (epoll_ctl(loop->ep, EPOLL_CTL_MOD, w->fd, &e)) abort(); } @@ -934,7 +940,7 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { * Ignore all errors because we may be racing with another thread * when the file descriptor is closed. */ - epoll_ctl(loop->ep, UV__EPOLL_CTL_DEL, fd, pe); + epoll_ctl(loop->ep, EPOLL_CTL_DEL, fd, pe); continue; } @@ -987,7 +993,7 @@ void uv__set_process_title(const char* title) { } int uv__io_fork(uv_loop_t* loop) { - /* + /* Nullify the msg queue but don't close it because it is still being used by the parent. */ diff --git a/src/unix/pipe.c b/src/unix/pipe.c index 2c578dc..d3b554c 100644 --- a/src/unix/pipe.c +++ b/src/unix/pipe.c @@ -66,8 +66,7 @@ int uv_pipe_bind(uv_pipe_t* handle, const char* name) { sockfd = err; memset(&saddr, 0, sizeof saddr); - strncpy(saddr.sun_path, pipe_fname, sizeof(saddr.sun_path) - 1); - saddr.sun_path[sizeof(saddr.sun_path) - 1] = '\0'; + uv__strscpy(saddr.sun_path, pipe_fname, sizeof(saddr.sun_path)); saddr.sun_family = AF_UNIX; if (bind(sockfd, (struct sockaddr*)&saddr, sizeof saddr)) { @@ -132,7 +131,20 @@ void uv__pipe_close(uv_pipe_t* handle) { int uv_pipe_open(uv_pipe_t* handle, uv_file fd) { + int flags; + int mode; int err; + flags = 0; + + if (uv__fd_exists(handle->loop, fd)) + return UV_EEXIST; + + do + mode = fcntl(fd, F_GETFL); + while (mode == -1 && errno == EINTR); + + if (mode == -1) + return UV__ERR(errno); /* according to docs, must be EBADF */ err = uv__nonblock(fd, 1); if (err) @@ -144,9 +156,13 @@ int uv_pipe_open(uv_pipe_t* handle, uv_file fd) { return err; #endif /* defined(__APPLE__) */ - return uv__stream_open((uv_stream_t*)handle, - fd, - UV_STREAM_READABLE | UV_STREAM_WRITABLE); + mode &= O_ACCMODE; + if (mode != O_WRONLY) + flags |= UV_HANDLE_READABLE; + if (mode != O_RDONLY) + flags |= UV_HANDLE_WRITABLE; + + return uv__stream_open((uv_stream_t*)handle, fd, flags); } @@ -169,8 +185,7 @@ void uv_pipe_connect(uv_connect_t* req, } memset(&saddr, 0, sizeof saddr); - strncpy(saddr.sun_path, name, sizeof(saddr.sun_path) - 1); - saddr.sun_path[sizeof(saddr.sun_path) - 1] = '\0'; + uv__strscpy(saddr.sun_path, name, sizeof(saddr.sun_path)); saddr.sun_family = AF_UNIX; do { @@ -196,7 +211,7 @@ void uv_pipe_connect(uv_connect_t* req, if (new_sock) { err = uv__stream_open((uv_stream_t*)handle, uv__stream_fd(handle), - UV_STREAM_READABLE | UV_STREAM_WRITABLE); + UV_HANDLE_READABLE | UV_HANDLE_WRITABLE); } if (err == 0) diff --git a/src/unix/poll.c b/src/unix/poll.c index f3b0bf4..3d5022b 100644 --- a/src/unix/poll.c +++ b/src/unix/poll.c @@ -68,6 +68,9 @@ static void uv__poll_io(uv_loop_t* loop, uv__io_t* w, unsigned int events) { int uv_poll_init(uv_loop_t* loop, uv_poll_t* handle, int fd) { int err; + if (uv__fd_exists(loop, fd)) + return UV_EEXIST; + err = uv__io_check_fd(loop, fd); if (err) return err; diff --git a/src/unix/process.c b/src/unix/process.c index 3a3cfd6..101c9c5 100644 --- a/src/unix/process.c +++ b/src/unix/process.c @@ -239,9 +239,9 @@ static int uv__process_open_stream(uv_stdio_container_t* container, flags = 0; if (container->flags & UV_WRITABLE_PIPE) - flags |= UV_STREAM_READABLE; + flags |= UV_HANDLE_READABLE; if (container->flags & UV_READABLE_PIPE) - flags |= UV_STREAM_WRITABLE; + flags |= UV_HANDLE_WRITABLE; return uv__stream_open(container->data.stream, pipefds[0], flags); } diff --git a/src/unix/proctitle.c b/src/unix/proctitle.c index 1a8c7a7..a5ce203 100644 --- a/src/unix/proctitle.c +++ b/src/unix/proctitle.c @@ -24,6 +24,7 @@ #include #include +extern void uv__set_process_title_platform_init(void); extern void uv__set_process_title(const char* title); static uv_mutex_t process_title_mutex; @@ -38,6 +39,9 @@ static struct { static void init_process_title_mutex_once(void) { uv_mutex_init(&process_title_mutex); +#ifdef __APPLE__ + uv__set_process_title_platform_init(); +#endif } diff --git a/src/unix/signal.c b/src/unix/signal.c index b9d0a56..01aa55f 100644 --- a/src/unix/signal.c +++ b/src/unix/signal.c @@ -54,8 +54,7 @@ static void uv__signal_unregister_handler(int signum); static uv_once_t uv__signal_global_init_guard = UV_ONCE_INIT; static struct uv__signal_tree_s uv__signal_tree = RB_INITIALIZER(uv__signal_tree); -static int uv__signal_lock_pipefd[2]; - +static int uv__signal_lock_pipefd[2] = { -1, -1 }; RB_GENERATE_STATIC(uv__signal_tree_s, uv_signal_s, tree_entry, @@ -64,7 +63,7 @@ RB_GENERATE_STATIC(uv__signal_tree_s, static void uv__signal_global_reinit(void); static void uv__signal_global_init(void) { - if (!uv__signal_lock_pipefd[0]) + if (uv__signal_lock_pipefd[0] == -1) /* pthread_atfork can register before and after handlers, one * for each child. This only registers one for the child. That * state is both persistent and cumulative, so if we keep doing @@ -74,15 +73,11 @@ static void uv__signal_global_init(void) { if (pthread_atfork(NULL, NULL, &uv__signal_global_reinit)) abort(); - if (uv__make_pipe(uv__signal_lock_pipefd, 0)) - abort(); - - if (uv__signal_unlock()) - abort(); + uv__signal_global_reinit(); } -static void uv__signal_global_reinit(void) { +UV_DESTRUCTOR(static void uv__signal_global_fini(void)) { /* We can only use signal-safe functions here. * That includes read/write and close, fortunately. * We do all of this directly here instead of resetting @@ -90,11 +85,26 @@ static void uv__signal_global_reinit(void) { * uv__signal_global_once_init is only called from uv_loop_init * and this needs to function in existing loops. */ - uv__close(uv__signal_lock_pipefd[0]); - uv__signal_lock_pipefd[0] = -1; - uv__close(uv__signal_lock_pipefd[1]); - uv__signal_lock_pipefd[1] = -1; - uv__signal_global_init(); + if (uv__signal_lock_pipefd[0] != -1) { + uv__close(uv__signal_lock_pipefd[0]); + uv__signal_lock_pipefd[0] = -1; + } + + if (uv__signal_lock_pipefd[1] != -1) { + uv__close(uv__signal_lock_pipefd[1]); + uv__signal_lock_pipefd[1] = -1; + } +} + + +static void uv__signal_global_reinit(void) { + uv__signal_global_fini(); + + if (uv__make_pipe(uv__signal_lock_pipefd, 0)) + abort(); + + if (uv__signal_unlock()) + abort(); } @@ -103,7 +113,6 @@ void uv__signal_global_once_init(void) { } - static int uv__signal_lock(void) { int r; char data; @@ -387,7 +396,7 @@ static int uv__signal_start(uv_signal_t* handle, */ first_handle = uv__signal_first_handle(signum); if (first_handle == NULL || - (!oneshot && (first_handle->flags & UV__SIGNAL_ONE_SHOT))) { + (!oneshot && (first_handle->flags & UV_SIGNAL_ONE_SHOT))) { err = uv__signal_register_handler(signum, oneshot); if (err) { /* Registering the signal handler failed. Must be an invalid signal. */ @@ -398,7 +407,7 @@ static int uv__signal_start(uv_signal_t* handle, handle->signum = signum; if (oneshot) - handle->flags |= UV__SIGNAL_ONE_SHOT; + handle->flags |= UV_SIGNAL_ONE_SHOT; RB_INSERT(uv__signal_tree_s, &uv__signal_tree, handle); @@ -455,20 +464,20 @@ static void uv__signal_event(uv_loop_t* loop, handle = msg->handle; if (msg->signum == handle->signum) { - assert(!(handle->flags & UV_CLOSING)); + assert(!(handle->flags & UV_HANDLE_CLOSING)); handle->signal_cb(handle, handle->signum); } handle->dispatched_signals++; - if (handle->flags & UV__SIGNAL_ONE_SHOT) + if (handle->flags & UV_SIGNAL_ONE_SHOT) uv__signal_stop(handle); /* If uv_close was called while there were caught signals that were not * yet dispatched, the uv__finish_close was deferred. Make close pending * now if this has happened. */ - if ((handle->flags & UV_CLOSING) && + if ((handle->flags & UV_HANDLE_CLOSING) && (handle->caught_signals == handle->dispatched_signals)) { uv__make_close_pending((uv_handle_t*) handle); } @@ -496,11 +505,11 @@ static int uv__signal_compare(uv_signal_t* w1, uv_signal_t* w2) { if (w1->signum < w2->signum) return -1; if (w1->signum > w2->signum) return 1; - /* Handlers without UV__SIGNAL_ONE_SHOT set will come first, so if the first + /* Handlers without UV_SIGNAL_ONE_SHOT set will come first, so if the first * handler returned is a one-shot handler, the rest will be too. */ - f1 = w1->flags & UV__SIGNAL_ONE_SHOT; - f2 = w2->flags & UV__SIGNAL_ONE_SHOT; + f1 = w1->flags & UV_SIGNAL_ONE_SHOT; + f2 = w2->flags & UV_SIGNAL_ONE_SHOT; if (f1 < f2) return -1; if (f1 > f2) return 1; @@ -549,8 +558,8 @@ static void uv__signal_stop(uv_signal_t* handle) { if (first_handle == NULL) { uv__signal_unregister_handler(handle->signum); } else { - rem_oneshot = handle->flags & UV__SIGNAL_ONE_SHOT; - first_oneshot = first_handle->flags & UV__SIGNAL_ONE_SHOT; + rem_oneshot = handle->flags & UV_SIGNAL_ONE_SHOT; + first_oneshot = first_handle->flags & UV_SIGNAL_ONE_SHOT; if (first_oneshot && !rem_oneshot) { ret = uv__signal_register_handler(handle->signum, 1); assert(ret == 0); diff --git a/src/unix/stream.c b/src/unix/stream.c index 5ec6bf4..a75ba15 100644 --- a/src/unix/stream.c +++ b/src/unix/stream.c @@ -58,11 +58,19 @@ struct uv__stream_select_s { fd_set* swrite; size_t swrite_sz; }; -# define WRITE_RETRY_ON_ERROR(send_handle) \ + +/* Due to a possible kernel bug at least in OS X 10.10 "Yosemite", + * EPROTOTYPE can be returned while trying to write to a socket that is + * shutting down. If we retry the write, we should get the expected EPIPE + * instead. + */ +# define RETRY_ON_WRITE_ERROR(errno) (errno == EINTR || errno == EPROTOTYPE) +# define IS_TRANSIENT_WRITE_ERROR(errno, send_handle) \ (errno == EAGAIN || errno == EWOULDBLOCK || errno == ENOBUFS || \ - (errno == EMSGSIZE && send_handle)) + (errno == EMSGSIZE && send_handle != NULL)) #else -# define WRITE_RETRY_ON_ERROR(send_handle) \ +# define RETRY_ON_WRITE_ERROR(errno) (errno == EINTR) +# define IS_TRANSIENT_WRITE_ERROR(errno, send_handle) \ (errno == EAGAIN || errno == EWOULDBLOCK || errno == ENOBUFS) #endif /* defined(__APPLE__) */ @@ -220,7 +228,7 @@ static void uv__stream_osx_select(void* arg) { uv_sem_wait(&s->async_sem); /* Should be processed at this stage */ - assert((s->events == 0) || (stream->flags & UV_CLOSING)); + assert((s->events == 0) || (stream->flags & UV_HANDLE_CLOSING)); } } } @@ -248,7 +256,7 @@ static void uv__stream_osx_select_cb(uv_async_t* handle) { if ((events & POLLOUT) && uv__io_active(&stream->io_watcher, POLLOUT)) uv__stream_io(stream->loop, &stream->io_watcher, POLLOUT); - if (stream->flags & UV_CLOSING) + if (stream->flags & UV_HANDLE_CLOSING) return; /* NOTE: It is important to do it here, otherwise `select()` might be called @@ -342,7 +350,7 @@ int uv__stream_try_select(uv_stream_t* stream, int* fd) { if (err) goto failed_async_init; - s->async.flags |= UV__HANDLE_INTERNAL; + s->async.flags |= UV_HANDLE_INTERNAL; uv__handle_unref(&s->async); err = uv_sem_init(&s->close_sem, 0); @@ -407,12 +415,14 @@ int uv__stream_open(uv_stream_t* stream, int fd, int flags) { stream->flags |= flags; if (stream->type == UV_TCP) { - if ((stream->flags & UV_TCP_NODELAY) && uv__tcp_nodelay(fd, 1)) + if ((stream->flags & UV_HANDLE_TCP_NODELAY) && uv__tcp_nodelay(fd, 1)) return UV__ERR(errno); /* TODO Use delay the user passed in. */ - if ((stream->flags & UV_TCP_KEEPALIVE) && uv__tcp_keepalive(fd, 1, 60)) + if ((stream->flags & UV_HANDLE_TCP_KEEPALIVE) && + uv__tcp_keepalive(fd, 1, 60)) { return UV__ERR(errno); + } } #if defined(__APPLE__) @@ -447,7 +457,7 @@ void uv__stream_flush_write_queue(uv_stream_t* stream, int error) { void uv__stream_destroy(uv_stream_t* stream) { assert(!uv__io_active(&stream->io_watcher, POLLIN | POLLOUT)); - assert(stream->flags & UV_CLOSED); + assert(stream->flags & UV_HANDLE_CLOSED); if (stream->connect_req) { uv__req_unregister(stream->loop, stream->connect_req); @@ -522,7 +532,7 @@ void uv__server_io(uv_loop_t* loop, uv__io_t* w, unsigned int events) { stream = container_of(w, uv_stream_t, io_watcher); assert(events & POLLIN); assert(stream->accepted_fd == -1); - assert(!(stream->flags & UV_CLOSING)); + assert(!(stream->flags & UV_HANDLE_CLOSING)); uv__io_start(stream->loop, &stream->io_watcher, POLLIN); @@ -565,7 +575,8 @@ void uv__server_io(uv_loop_t* loop, uv__io_t* w, unsigned int events) { return; } - if (stream->type == UV_TCP && (stream->flags & UV_TCP_SINGLE_ACCEPT)) { + if (stream->type == UV_TCP && + (stream->flags & UV_HANDLE_TCP_SINGLE_ACCEPT)) { /* Give other processes a chance to accept connections. */ struct timespec timeout = { 0, 1 }; nanosleep(&timeout, NULL); @@ -590,7 +601,7 @@ int uv_accept(uv_stream_t* server, uv_stream_t* client) { case UV_TCP: err = uv__stream_open(client, server->accepted_fd, - UV_STREAM_READABLE | UV_STREAM_WRITABLE); + UV_HANDLE_READABLE | UV_HANDLE_WRITABLE); if (err) { /* TODO handle error */ uv__close(server->accepted_fd); @@ -674,14 +685,14 @@ static void uv__drain(uv_stream_t* stream) { uv__stream_osx_interrupt_select(stream); /* Shutdown? */ - if ((stream->flags & UV_STREAM_SHUTTING) && - !(stream->flags & UV_CLOSING) && - !(stream->flags & UV_STREAM_SHUT)) { + if ((stream->flags & UV_HANDLE_SHUTTING) && + !(stream->flags & UV_HANDLE_CLOSING) && + !(stream->flags & UV_HANDLE_SHUT)) { assert(stream->shutdown_req); req = stream->shutdown_req; stream->shutdown_req = NULL; - stream->flags &= ~UV_STREAM_SHUTTING; + stream->flags &= ~UV_HANDLE_SHUTTING; uv__req_unregister(stream->loop, req); err = 0; @@ -689,7 +700,7 @@ static void uv__drain(uv_stream_t* stream) { err = UV__ERR(errno); if (err == 0) - stream->flags |= UV_STREAM_SHUT; + stream->flags |= UV_HANDLE_SHUT; if (req->cb != NULL) req->cb(req, err); @@ -697,6 +708,14 @@ static void uv__drain(uv_stream_t* stream) { } +static ssize_t uv__writev(int fd, struct iovec* vec, size_t n) { + if (n == 1) + return write(fd, vec->iov_base, vec->iov_len); + else + return writev(fd, vec, n); +} + + static size_t uv__write_req_size(uv_write_t* req) { size_t size; @@ -709,6 +728,37 @@ static size_t uv__write_req_size(uv_write_t* req) { } +/* Returns 1 if all write request data has been written, or 0 if there is still + * more data to write. + * + * Note: the return value only says something about the *current* request. + * There may still be other write requests sitting in the queue. + */ +static int uv__write_req_update(uv_stream_t* stream, + uv_write_t* req, + size_t n) { + uv_buf_t* buf; + size_t len; + + assert(n <= stream->write_queue_size); + stream->write_queue_size -= n; + + buf = req->bufs + req->write_index; + + while (n > 0) { + len = n < buf->len ? n : buf->len; + buf->base += len; + buf->len -= len; + buf += (buf->len == 0); /* Advance to next buffer if this one is empty. */ + n -= len; + } + + req->write_index = buf - req->bufs; + + return req->write_index == req->nbufs; +} + + static void uv__write_req_finish(uv_write_t* req) { uv_stream_t* stream = req->handle; @@ -829,102 +879,32 @@ start: *pi = fd_to_send; } - do { + do n = sendmsg(uv__stream_fd(stream), &msg, 0); - } -#if defined(__APPLE__) - /* - * Due to a possible kernel bug at least in OS X 10.10 "Yosemite", - * EPROTOTYPE can be returned while trying to write to a socket that is - * shutting down. If we retry the write, we should get the expected EPIPE - * instead. - */ - while (n == -1 && (errno == EINTR || errno == EPROTOTYPE)); -#else - while (n == -1 && errno == EINTR); -#endif - } else { - do { - if (iovcnt == 1) { - n = write(uv__stream_fd(stream), iov[0].iov_base, iov[0].iov_len); - } else { - n = writev(uv__stream_fd(stream), iov, iovcnt); - } - } -#if defined(__APPLE__) - /* - * Due to a possible kernel bug at least in OS X 10.10 "Yosemite", - * EPROTOTYPE can be returned while trying to write to a socket that is - * shutting down. If we retry the write, we should get the expected EPIPE - * instead. - */ - while (n == -1 && (errno == EINTR || errno == EPROTOTYPE)); -#else - while (n == -1 && errno == EINTR); -#endif - } + while (n == -1 && RETRY_ON_WRITE_ERROR(errno)); - if (n < 0) { - if (!WRITE_RETRY_ON_ERROR(req->send_handle)) { - err = UV__ERR(errno); - goto error; - } else if (stream->flags & UV_STREAM_BLOCKING) { - /* If this is a blocking stream, try again. */ - goto start; - } + /* Ensure the handle isn't sent again in case this is a partial write. */ + if (n >= 0) + req->send_handle = NULL; } else { - /* Successful write */ - - while (n >= 0) { - uv_buf_t* buf = &(req->bufs[req->write_index]); - size_t len = buf->len; - - assert(req->write_index < req->nbufs); - - if ((size_t)n < len) { - buf->base += n; - buf->len -= n; - stream->write_queue_size -= n; - n = 0; - - /* There is more to write. */ - if (stream->flags & UV_STREAM_BLOCKING) { - /* - * If we're blocking then we should not be enabling the write - * watcher - instead we need to try again. - */ - goto start; - } else { - /* Break loop and ensure the watcher is pending. */ - break; - } - - } else { - /* Finished writing the buf at index req->write_index. */ - req->write_index++; - - assert((size_t)n >= len); - n -= len; - - assert(stream->write_queue_size >= len); - stream->write_queue_size -= len; + do + n = uv__writev(uv__stream_fd(stream), iov, iovcnt); + while (n == -1 && RETRY_ON_WRITE_ERROR(errno)); + } - if (req->write_index == req->nbufs) { - /* Then we're done! */ - assert(n == 0); - uv__write_req_finish(req); - /* TODO: start trying to write the next request. */ - return; - } - } - } + if (n == -1 && !IS_TRANSIENT_WRITE_ERROR(errno, req->send_handle)) { + err = UV__ERR(errno); + goto error; } - /* Either we've counted n down to zero or we've got EAGAIN. */ - assert(n == 0 || n == -1); + if (n > 0 && uv__write_req_update(stream, req, n)) { + uv__write_req_finish(req); + return; /* TODO(bnoordhuis) Start trying to write the next request. */ + } - /* Only non-blocking streams should use the write_watcher. */ - assert(!(stream->flags & UV_STREAM_BLOCKING)); + /* If this is a blocking stream, try again. */ + if (stream->flags & UV_HANDLE_BLOCKING_WRITES) + goto start; /* We're not done. */ uv__io_start(stream->loop, &stream->io_watcher, POLLOUT); @@ -947,10 +927,16 @@ error: static void uv__write_callbacks(uv_stream_t* stream) { uv_write_t* req; QUEUE* q; + QUEUE pq; + + if (QUEUE_EMPTY(&stream->write_completed_queue)) + return; + + QUEUE_MOVE(&stream->write_completed_queue, &pq); - while (!QUEUE_EMPTY(&stream->write_completed_queue)) { + while (!QUEUE_EMPTY(&pq)) { /* Pop a req off write_completed_queue. */ - q = QUEUE_HEAD(&stream->write_completed_queue); + q = QUEUE_HEAD(&pq); req = QUEUE_DATA(q, uv_write_t, queue); QUEUE_REMOVE(q); uv__req_unregister(stream->loop, req); @@ -966,8 +952,6 @@ static void uv__write_callbacks(uv_stream_t* stream) { if (req->cb) req->cb(req, req->error); } - - assert(QUEUE_EMPTY(&stream->write_completed_queue)); } @@ -1015,13 +999,13 @@ uv_handle_type uv__handle_type(int fd) { static void uv__stream_eof(uv_stream_t* stream, const uv_buf_t* buf) { - stream->flags |= UV_STREAM_READ_EOF; + stream->flags |= UV_HANDLE_READ_EOF; uv__io_stop(stream->loop, &stream->io_watcher, POLLIN); if (!uv__io_active(&stream->io_watcher, POLLOUT)) uv__handle_stop(stream); uv__stream_osx_interrupt_select(stream); stream->read_cb(stream, UV_EOF, buf); - stream->flags &= ~UV_STREAM_READING; + stream->flags &= ~UV_HANDLE_READING; } @@ -1121,6 +1105,7 @@ static int uv__stream_recv_cmsg(uv_stream_t* stream, struct msghdr* msg) { #ifdef __clang__ # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wgnu-folding-constant" +# pragma clang diagnostic ignored "-Wvla-extension" #endif static void uv__read(uv_stream_t* stream) { @@ -1132,7 +1117,7 @@ static void uv__read(uv_stream_t* stream) { int err; int is_ipc; - stream->flags &= ~UV_STREAM_READ_PARTIAL; + stream->flags &= ~UV_HANDLE_READ_PARTIAL; /* Prevent loop starvation when the data comes in as fast as (or faster than) * we can read it. XXX Need to rearm fd if we switch to edge-triggered I/O. @@ -1141,11 +1126,11 @@ static void uv__read(uv_stream_t* stream) { is_ipc = stream->type == UV_NAMED_PIPE && ((uv_pipe_t*) stream)->ipc; - /* XXX: Maybe instead of having UV_STREAM_READING we just test if + /* XXX: Maybe instead of having UV_HANDLE_READING we just test if * tcp->read_cb is NULL or not? */ while (stream->read_cb - && (stream->flags & UV_STREAM_READING) + && (stream->flags & UV_HANDLE_READING) && (count-- > 0)) { assert(stream->alloc_cb != NULL); @@ -1186,7 +1171,7 @@ static void uv__read(uv_stream_t* stream) { /* Error */ if (errno == EAGAIN || errno == EWOULDBLOCK) { /* Wait for the next one. */ - if (stream->flags & UV_STREAM_READING) { + if (stream->flags & UV_HANDLE_READING) { uv__io_start(stream->loop, &stream->io_watcher, POLLIN); uv__stream_osx_interrupt_select(stream); } @@ -1199,8 +1184,8 @@ static void uv__read(uv_stream_t* stream) { } else { /* Error. User should call uv_close(). */ stream->read_cb(stream, UV__ERR(errno), &buf); - if (stream->flags & UV_STREAM_READING) { - stream->flags &= ~UV_STREAM_READING; + if (stream->flags & UV_HANDLE_READING) { + stream->flags &= ~UV_HANDLE_READING; uv__io_stop(stream->loop, &stream->io_watcher, POLLIN); if (!uv__io_active(&stream->io_watcher, POLLOUT)) uv__handle_stop(stream); @@ -1250,7 +1235,7 @@ static void uv__read(uv_stream_t* stream) { /* Return if we didn't fill the buffer, there is no more data to read. */ if (nread < buflen) { - stream->flags |= UV_STREAM_READ_PARTIAL; + stream->flags |= UV_HANDLE_READ_PARTIAL; return; } } @@ -1271,9 +1256,9 @@ int uv_shutdown(uv_shutdown_t* req, uv_stream_t* stream, uv_shutdown_cb cb) { stream->type == UV_TTY || stream->type == UV_NAMED_PIPE); - if (!(stream->flags & UV_STREAM_WRITABLE) || - stream->flags & UV_STREAM_SHUT || - stream->flags & UV_STREAM_SHUTTING || + if (!(stream->flags & UV_HANDLE_WRITABLE) || + stream->flags & UV_HANDLE_SHUT || + stream->flags & UV_HANDLE_SHUTTING || uv__is_closing(stream)) { return UV_ENOTCONN; } @@ -1285,7 +1270,7 @@ int uv_shutdown(uv_shutdown_t* req, uv_stream_t* stream, uv_shutdown_cb cb) { req->handle = stream; req->cb = cb; stream->shutdown_req = req; - stream->flags |= UV_STREAM_SHUTTING; + stream->flags |= UV_HANDLE_SHUTTING; uv__io_start(stream->loop, &stream->io_watcher, POLLOUT); uv__stream_osx_interrupt_select(stream); @@ -1302,7 +1287,7 @@ static void uv__stream_io(uv_loop_t* loop, uv__io_t* w, unsigned int events) { assert(stream->type == UV_TCP || stream->type == UV_NAMED_PIPE || stream->type == UV_TTY); - assert(!(stream->flags & UV_CLOSING)); + assert(!(stream->flags & UV_HANDLE_CLOSING)); if (stream->connect_req) { uv__stream_connect(stream); @@ -1311,7 +1296,7 @@ static void uv__stream_io(uv_loop_t* loop, uv__io_t* w, unsigned int events) { assert(uv__stream_fd(stream) >= 0); - /* Ignore POLLHUP here. Even it it's set, there may still be data to read. */ + /* Ignore POLLHUP here. Even if it's set, there may still be data to read. */ if (events & (POLLIN | POLLERR | POLLHUP)) uv__read(stream); @@ -1325,9 +1310,9 @@ static void uv__stream_io(uv_loop_t* loop, uv__io_t* w, unsigned int events) { * report the EOF yet because there is still data to read. */ if ((events & POLLHUP) && - (stream->flags & UV_STREAM_READING) && - (stream->flags & UV_STREAM_READ_PARTIAL) && - !(stream->flags & UV_STREAM_READ_EOF)) { + (stream->flags & UV_HANDLE_READING) && + (stream->flags & UV_HANDLE_READ_PARTIAL) && + !(stream->flags & UV_HANDLE_READ_EOF)) { uv_buf_t buf = { NULL, 0 }; uv__stream_eof(stream, &buf); } @@ -1417,7 +1402,7 @@ int uv_write2(uv_write_t* req, if (uv__stream_fd(stream) < 0) return UV_EBADF; - if (!(stream->flags & UV_STREAM_WRITABLE)) + if (!(stream->flags & UV_HANDLE_WRITABLE)) return -EPIPE; if (send_handle) { @@ -1487,7 +1472,7 @@ int uv_write2(uv_write_t* req, * if this assert fires then somehow the blocking stream isn't being * sufficiently flushed in uv__write. */ - assert(!(stream->flags & UV_STREAM_BLOCKING)); + assert(!(stream->flags & UV_HANDLE_BLOCKING_WRITES)); uv__io_start(stream->loop, &stream->io_watcher, POLLOUT); uv__stream_osx_interrupt_select(stream); } @@ -1568,16 +1553,16 @@ int uv_read_start(uv_stream_t* stream, assert(stream->type == UV_TCP || stream->type == UV_NAMED_PIPE || stream->type == UV_TTY); - if (stream->flags & UV_CLOSING) + if (stream->flags & UV_HANDLE_CLOSING) return UV_EINVAL; - if (!(stream->flags & UV_STREAM_READABLE)) + if (!(stream->flags & UV_HANDLE_READABLE)) return -ENOTCONN; - /* The UV_STREAM_READING flag is irrelevant of the state of the tcp - it just + /* The UV_HANDLE_READING flag is irrelevant of the state of the tcp - it just * expresses the desired state of the user. */ - stream->flags |= UV_STREAM_READING; + stream->flags |= UV_HANDLE_READING; /* TODO: try to do the read inline? */ /* TODO: keep track of tcp state. If we've gotten a EOF then we should @@ -1598,10 +1583,10 @@ int uv_read_start(uv_stream_t* stream, int uv_read_stop(uv_stream_t* stream) { - if (!(stream->flags & UV_STREAM_READING)) + if (!(stream->flags & UV_HANDLE_READING)) return 0; - stream->flags &= ~UV_STREAM_READING; + stream->flags &= ~UV_HANDLE_READING; uv__io_stop(stream->loop, &stream->io_watcher, POLLIN); if (!uv__io_active(&stream->io_watcher, POLLOUT)) uv__handle_stop(stream); @@ -1614,12 +1599,12 @@ int uv_read_stop(uv_stream_t* stream) { int uv_is_readable(const uv_stream_t* stream) { - return !!(stream->flags & UV_STREAM_READABLE); + return !!(stream->flags & UV_HANDLE_READABLE); } int uv_is_writable(const uv_stream_t* stream) { - return !!(stream->flags & UV_STREAM_WRITABLE); + return !!(stream->flags & UV_HANDLE_WRITABLE); } @@ -1668,6 +1653,7 @@ void uv__stream_close(uv_stream_t* handle) { uv__io_close(handle->loop, &handle->io_watcher); uv_read_stop(handle); uv__handle_stop(handle); + handle->flags &= ~(UV_HANDLE_READABLE | UV_HANDLE_WRITABLE); if (handle->io_watcher.fd != -1) { /* Don't close stdio file descriptors. Nothing good comes from it. */ diff --git a/src/unix/sunos.c b/src/unix/sunos.c index b6b3dfe..2552a01 100644 --- a/src/unix/sunos.c +++ b/src/unix/sunos.c @@ -692,6 +692,8 @@ void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count) { #ifdef SUNOS_NO_IFADDRS int uv_interface_addresses(uv_interface_address_t** addresses, int* count) { + *count = 0; + *addresses = NULL; return UV_ENOSYS; } #else /* SUNOS_NO_IFADDRS */ @@ -705,13 +707,14 @@ static int uv__set_phys_addr(uv_interface_address_t* address, struct sockaddr_dl* sa_addr; int sockfd; - int i; + size_t i; struct arpreq arpreq; /* This appears to only work as root */ sa_addr = (struct sockaddr_dl*)(ent->ifa_addr); memcpy(address->phys_addr, LLADDR(sa_addr), sizeof(address->phys_addr)); for (i = 0; i < sizeof(address->phys_addr); i++) { + /* Check that all bytes of phys_addr are zero. */ if (address->phys_addr[i] != 0) return 0; } @@ -758,11 +761,12 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) { struct ifaddrs* addrs; struct ifaddrs* ent; + *count = 0; + *addresses = NULL; + if (getifaddrs(&addrs)) return UV__ERR(errno); - *count = 0; - /* Count the number of interfaces */ for (ent = addrs; ent != NULL; ent = ent->ifa_next) { if (uv__ifaddr_exclude(ent)) @@ -770,6 +774,11 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) { (*count)++; } + if (*count == 0) { + freeifaddrs(addrs); + return 0; + } + *addresses = uv__malloc(*count * sizeof(**addresses)); if (!(*addresses)) { freeifaddrs(addrs); diff --git a/src/unix/tcp.c b/src/unix/tcp.c index 9a46793..2982851 100644 --- a/src/unix/tcp.c +++ b/src/unix/tcp.c @@ -216,7 +216,7 @@ int uv__tcp_connect(uv_connect_t* req, err = maybe_new_socket(handle, addr->sa_family, - UV_STREAM_READABLE | UV_STREAM_WRITABLE); + UV_HANDLE_READABLE | UV_HANDLE_WRITABLE); if (err) return err; @@ -263,13 +263,16 @@ int uv__tcp_connect(uv_connect_t* req, int uv_tcp_open(uv_tcp_t* handle, uv_os_sock_t sock) { int err; + if (uv__fd_exists(handle->loop, sock)) + return UV_EEXIST; + err = uv__nonblock(sock, 1); if (err) return err; return uv__stream_open((uv_stream_t*)handle, sock, - UV_STREAM_READABLE | UV_STREAM_WRITABLE); + UV_HANDLE_READABLE | UV_HANDLE_WRITABLE); } @@ -331,7 +334,7 @@ int uv_tcp_listen(uv_tcp_t* tcp, int backlog, uv_connection_cb cb) { } if (single_accept) - tcp->flags |= UV_TCP_SINGLE_ACCEPT; + tcp->flags |= UV_HANDLE_TCP_SINGLE_ACCEPT; flags = 0; #if defined(__MVS__) @@ -398,9 +401,9 @@ int uv_tcp_nodelay(uv_tcp_t* handle, int on) { } if (on) - handle->flags |= UV_TCP_NODELAY; + handle->flags |= UV_HANDLE_TCP_NODELAY; else - handle->flags &= ~UV_TCP_NODELAY; + handle->flags &= ~UV_HANDLE_TCP_NODELAY; return 0; } @@ -416,9 +419,9 @@ int uv_tcp_keepalive(uv_tcp_t* handle, int on, unsigned int delay) { } if (on) - handle->flags |= UV_TCP_KEEPALIVE; + handle->flags |= UV_HANDLE_TCP_KEEPALIVE; else - handle->flags &= ~UV_TCP_KEEPALIVE; + handle->flags &= ~UV_HANDLE_TCP_KEEPALIVE; /* TODO Store delay if uv__stream_fd(handle) == -1 but don't want to enlarge * uv_tcp_t with an int that's almost never used... @@ -430,9 +433,9 @@ int uv_tcp_keepalive(uv_tcp_t* handle, int on, unsigned int delay) { int uv_tcp_simultaneous_accepts(uv_tcp_t* handle, int enable) { if (enable) - handle->flags &= ~UV_TCP_SINGLE_ACCEPT; + handle->flags &= ~UV_HANDLE_TCP_SINGLE_ACCEPT; else - handle->flags |= UV_TCP_SINGLE_ACCEPT; + handle->flags |= UV_HANDLE_TCP_SINGLE_ACCEPT; return 0; } diff --git a/src/unix/thread.c b/src/unix/thread.c index 303bc6e..2900470 100644 --- a/src/unix/thread.c +++ b/src/unix/thread.c @@ -44,108 +44,119 @@ #undef NANOSEC #define NANOSEC ((uint64_t) 1e9) +#if defined(PTHREAD_BARRIER_SERIAL_THREAD) +STATIC_ASSERT(sizeof(uv_barrier_t) == sizeof(pthread_barrier_t)); +#endif -#if defined(UV__PTHREAD_BARRIER_FALLBACK) -/* TODO: support barrier_attr */ -int pthread_barrier_init(pthread_barrier_t* barrier, - const void* barrier_attr, - unsigned count) { +/* Note: guard clauses should match uv_barrier_t's in include/uv/uv-unix.h. */ +#if defined(_AIX) || !defined(PTHREAD_BARRIER_SERIAL_THREAD) +int uv_barrier_init(uv_barrier_t* barrier, unsigned int count) { + struct _uv_barrier* b; int rc; - _uv_barrier* b; if (barrier == NULL || count == 0) - return EINVAL; - - if (barrier_attr != NULL) - return ENOTSUP; + return UV_EINVAL; b = uv__malloc(sizeof(*b)); if (b == NULL) - return ENOMEM; + return UV_ENOMEM; b->in = 0; b->out = 0; b->threshold = count; - if ((rc = pthread_mutex_init(&b->mutex, NULL)) != 0) + rc = uv_mutex_init(&b->mutex); + if (rc != 0) goto error2; - if ((rc = pthread_cond_init(&b->cond, NULL)) != 0) + + rc = uv_cond_init(&b->cond); + if (rc != 0) goto error; barrier->b = b; return 0; error: - pthread_mutex_destroy(&b->mutex); + uv_mutex_destroy(&b->mutex); error2: uv__free(b); return rc; } -int pthread_barrier_wait(pthread_barrier_t* barrier) { - int rc; - _uv_barrier* b; + +int uv_barrier_wait(uv_barrier_t* barrier) { + struct _uv_barrier* b; + int last; if (barrier == NULL || barrier->b == NULL) - return EINVAL; + return UV_EINVAL; b = barrier->b; - /* Lock the mutex*/ - if ((rc = pthread_mutex_lock(&b->mutex)) != 0) - return rc; + uv_mutex_lock(&b->mutex); - /* Increment the count. If this is the first thread to reach the threshold, - wake up waiters, unlock the mutex, then return - PTHREAD_BARRIER_SERIAL_THREAD. */ if (++b->in == b->threshold) { b->in = 0; - b->out = b->threshold - 1; - rc = pthread_cond_signal(&b->cond); - assert(rc == 0); - - pthread_mutex_unlock(&b->mutex); - return PTHREAD_BARRIER_SERIAL_THREAD; + b->out = b->threshold; + uv_cond_signal(&b->cond); + } else { + do + uv_cond_wait(&b->cond, &b->mutex); + while (b->in != 0); } - /* Otherwise, wait for other threads until in is set to 0, - then return 0 to indicate this is not the first thread. */ - do { - if ((rc = pthread_cond_wait(&b->cond, &b->mutex)) != 0) - break; - } while (b->in != 0); - - /* mark thread exit */ - b->out--; - pthread_cond_signal(&b->cond); - pthread_mutex_unlock(&b->mutex); - return rc; + + last = (--b->out == 0); + if (!last) + uv_cond_signal(&b->cond); /* Not needed for last thread. */ + + uv_mutex_unlock(&b->mutex); + return last; } -int pthread_barrier_destroy(pthread_barrier_t* barrier) { - int rc; - _uv_barrier* b; - if (barrier == NULL || barrier->b == NULL) - return EINVAL; +void uv_barrier_destroy(uv_barrier_t* barrier) { + struct _uv_barrier* b; b = barrier->b; + uv_mutex_lock(&b->mutex); - if ((rc = pthread_mutex_lock(&b->mutex)) != 0) - return rc; + assert(b->in == 0); + assert(b->out == 0); - if (b->in > 0 || b->out > 0) - rc = EBUSY; - - pthread_mutex_unlock(&b->mutex); + if (b->in != 0 || b->out != 0) + abort(); - if (rc) - return rc; + uv_mutex_unlock(&b->mutex); + uv_mutex_destroy(&b->mutex); + uv_cond_destroy(&b->cond); - pthread_cond_destroy(&b->cond); - pthread_mutex_destroy(&b->mutex); uv__free(barrier->b); barrier->b = NULL; - return 0; } + +#else + +int uv_barrier_init(uv_barrier_t* barrier, unsigned int count) { + return UV__ERR(pthread_barrier_init(barrier, NULL, count)); +} + + +int uv_barrier_wait(uv_barrier_t* barrier) { + int rc; + + rc = pthread_barrier_wait(barrier); + if (rc != 0) + if (rc != PTHREAD_BARRIER_SERIAL_THREAD) + abort(); + + return rc == PTHREAD_BARRIER_SERIAL_THREAD; +} + + +void uv_barrier_destroy(uv_barrier_t* barrier) { + if (pthread_barrier_destroy(barrier)) + abort(); +} + #endif @@ -771,25 +782,6 @@ int uv_cond_timedwait(uv_cond_t* cond, uv_mutex_t* mutex, uint64_t timeout) { } -int uv_barrier_init(uv_barrier_t* barrier, unsigned int count) { - return UV__ERR(pthread_barrier_init(barrier, NULL, count)); -} - - -void uv_barrier_destroy(uv_barrier_t* barrier) { - if (pthread_barrier_destroy(barrier)) - abort(); -} - - -int uv_barrier_wait(uv_barrier_t* barrier) { - int r = pthread_barrier_wait(barrier); - if (r && r != PTHREAD_BARRIER_SERIAL_THREAD) - abort(); - return r == PTHREAD_BARRIER_SERIAL_THREAD; -} - - int uv_key_create(uv_key_t* key) { return UV__ERR(pthread_key_create(key, NULL)); } diff --git a/src/unix/tty.c b/src/unix/tty.c index f22b3b8..74d3d75 100644 --- a/src/unix/tty.c +++ b/src/unix/tty.c @@ -92,13 +92,15 @@ static int uv__tty_is_slave(const int fd) { return result; } -int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, int fd, int readable) { +int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, int fd, int unused) { uv_handle_type type; int flags; int newfd; int r; int saved_flags; + int mode; char path[256]; + (void)unused; /* deprecated parameter is no longer needed */ /* File descriptors that refer to files cannot be monitored with epoll. * That restriction also applies to character devices like /dev/random @@ -111,6 +113,15 @@ int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, int fd, int readable) { flags = 0; newfd = -1; + /* Save the fd flags in case we need to restore them due to an error. */ + do + saved_flags = fcntl(fd, F_GETFL); + while (saved_flags == -1 && errno == EINTR); + + if (saved_flags == -1) + return UV__ERR(errno); + mode = saved_flags & O_ACCMODE; + /* Reopen the file descriptor when it refers to a tty. This lets us put the * tty in non-blocking mode without affecting other processes that share it * with us. @@ -128,14 +139,14 @@ int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, int fd, int readable) { * slave device. */ if (uv__tty_is_slave(fd) && ttyname_r(fd, path, sizeof(path)) == 0) - r = uv__open_cloexec(path, O_RDWR); + r = uv__open_cloexec(path, mode); else r = -1; if (r < 0) { /* fallback to using blocking writes */ - if (!readable) - flags |= UV_STREAM_BLOCKING; + if (mode != O_RDONLY) + flags |= UV_HANDLE_BLOCKING_WRITES; goto skip; } @@ -154,22 +165,6 @@ int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, int fd, int readable) { fd = newfd; } -#if defined(__APPLE__) - /* Save the fd flags in case we need to restore them due to an error. */ - do - saved_flags = fcntl(fd, F_GETFL); - while (saved_flags == -1 && errno == EINTR); - - if (saved_flags == -1) { - if (newfd != -1) - uv__close(newfd); - return UV__ERR(errno); - } -#endif - - /* Pacify the compiler. */ - (void) &saved_flags; - skip: uv__stream_init(loop, (uv_stream_t*) tty, UV_TTY); @@ -177,7 +172,7 @@ skip: * the handle queue, since it was added by uv__handle_init in uv_stream_init. */ - if (!(flags & UV_STREAM_BLOCKING)) + if (!(flags & UV_HANDLE_BLOCKING_WRITES)) uv__nonblock(fd, 1); #if defined(__APPLE__) @@ -194,10 +189,10 @@ skip: } #endif - if (readable) - flags |= UV_STREAM_READABLE; - else - flags |= UV_STREAM_WRITABLE; + if (mode != O_WRONLY) + flags |= UV_HANDLE_READABLE; + if (mode != O_RDONLY) + flags |= UV_HANDLE_WRITABLE; uv__stream_open((uv_stream_t*) tty, fd, flags); tty->mode = UV_TTY_MODE_NORMAL; diff --git a/src/unix/udp.c b/src/unix/udp.c index 74d613b..ec337ec 100644 --- a/src/unix/udp.c +++ b/src/unix/udp.c @@ -92,8 +92,8 @@ static void uv__udp_run_completed(uv_udp_t* handle) { uv_udp_send_t* req; QUEUE* q; - assert(!(handle->flags & UV_UDP_PROCESSING)); - handle->flags |= UV_UDP_PROCESSING; + assert(!(handle->flags & UV_HANDLE_UDP_PROCESSING)); + handle->flags |= UV_HANDLE_UDP_PROCESSING; while (!QUEUE_EMPTY(&handle->write_completed_queue)) { q = QUEUE_HEAD(&handle->write_completed_queue); @@ -128,7 +128,7 @@ static void uv__udp_run_completed(uv_udp_t* handle) { uv__handle_stop(handle); } - handle->flags &= ~UV_UDP_PROCESSING; + handle->flags &= ~UV_HANDLE_UDP_PROCESSING; } @@ -427,7 +427,7 @@ int uv__udp_send(uv_udp_send_t* req, QUEUE_INSERT_TAIL(&handle->write_queue, &req->queue); uv__handle_start(handle); - if (empty_queue && !(handle->flags & UV_UDP_PROCESSING)) { + if (empty_queue && !(handle->flags & UV_HANDLE_UDP_PROCESSING)) { uv__udp_sendmsg(handle); /* `uv__udp_sendmsg` may not be able to do non-blocking write straight @@ -624,6 +624,9 @@ int uv_udp_open(uv_udp_t* handle, uv_os_sock_t sock) { if (handle->io_watcher.fd != -1) return UV_EBUSY; + if (uv__fd_exists(handle->loop, sock)) + return UV_EEXIST; + err = uv__nonblock(sock, 1); if (err) return err; @@ -757,14 +760,16 @@ int uv_udp_set_multicast_ttl(uv_udp_t* handle, int ttl) { * IP_MULTICAST_TTL, so hardcode the size of the option in the IPv6 case, * and use the general uv__setsockopt_maybe_char call otherwise. */ -#if defined(__sun) || defined(_AIX) || defined(__MVS__) +#if defined(__sun) || defined(_AIX) || defined(__OpenBSD__) || \ + defined(__MVS__) if (handle->flags & UV_HANDLE_IPV6) return uv__setsockopt(handle, IP_MULTICAST_TTL, IPV6_MULTICAST_HOPS, &ttl, sizeof(ttl)); -#endif /* defined(__sun) || defined(_AIX) || defined(__MVS__) */ +#endif /* defined(__sun) || defined(_AIX) || defined(__OpenBSD__) || \ + defined(__MVS__) */ return uv__setsockopt_maybe_char(handle, IP_MULTICAST_TTL, @@ -780,14 +785,16 @@ int uv_udp_set_multicast_loop(uv_udp_t* handle, int on) { * IP_MULTICAST_LOOP, so hardcode the size of the option in the IPv6 case, * and use the general uv__setsockopt_maybe_char call otherwise. */ -#if defined(__sun) || defined(_AIX) || defined(__MVS__) +#if defined(__sun) || defined(_AIX) || defined(__OpenBSD__) || \ + defined(__MVS__) if (handle->flags & UV_HANDLE_IPV6) return uv__setsockopt(handle, IP_MULTICAST_LOOP, IPV6_MULTICAST_LOOP, &on, sizeof(on)); -#endif /* defined(__sun) || defined(_AIX) || defined(__MVS__) */ +#endif /* defined(__sun) || defined(_AIX) ||defined(__OpenBSD__) || + defined(__MVS__) */ return uv__setsockopt_maybe_char(handle, IP_MULTICAST_LOOP, diff --git a/src/uv-common.c b/src/uv-common.c index 7134589..952bde0 100644 --- a/src/uv-common.c +++ b/src/uv-common.c @@ -72,7 +72,9 @@ char* uv__strndup(const char* s, size_t n) { } void* uv__malloc(size_t size) { - return uv__allocator.local_malloc(size); + if (size > 0) + return uv__allocator.local_malloc(size); + return NULL; } void uv__free(void* ptr) { @@ -91,7 +93,10 @@ void* uv__calloc(size_t count, size_t size) { } void* uv__realloc(void* ptr, size_t size) { - return uv__allocator.local_realloc(ptr, size); + if (size > 0) + return uv__allocator.local_realloc(ptr, size); + uv__free(ptr); + return NULL; } int uv_replace_allocator(uv_malloc_func malloc_func, @@ -155,6 +160,18 @@ static const char* uv__unknown_err_code(int err) { return copy != NULL ? copy : "Unknown system error"; } +#define UV_ERR_NAME_GEN_R(name, _) \ +case UV_## name: \ + uv__strscpy(buf, #name, buflen); break; +char* uv_err_name_r(int err, char* buf, size_t buflen) { + switch (err) { + UV_ERRNO_MAP(UV_ERR_NAME_GEN_R) + default: snprintf(buf, buflen, "Unknown system error %d", err); + } + return buf; +} +#undef UV_ERR_NAME_GEN_R + #define UV_ERR_NAME_GEN(name, _) case UV_ ## name: return #name; const char* uv_err_name(int err) { @@ -166,6 +183,19 @@ const char* uv_err_name(int err) { #undef UV_ERR_NAME_GEN +#define UV_STRERROR_GEN_R(name, msg) \ +case UV_ ## name: \ + snprintf(buf, buflen, "%s", msg); break; +char* uv_strerror_r(int err, char* buf, size_t buflen) { + switch (err) { + UV_ERRNO_MAP(UV_STRERROR_GEN_R) + default: snprintf(buf, buflen, "Unknown system error %d", err); + } + return buf; +} +#undef UV_STRERROR_GEN_R + + #define UV_STRERROR_GEN(name, msg) case UV_ ## name: return msg; const char* uv_strerror(int err) { switch (err) { @@ -357,7 +387,7 @@ void uv_walk(uv_loop_t* loop, uv_walk_cb walk_cb, void* arg) { QUEUE_REMOVE(q); QUEUE_INSERT_TAIL(&loop->handle_queue, q); - if (h->flags & UV__HANDLE_INTERNAL) continue; + if (h->flags & UV_HANDLE_INTERNAL) continue; walk_cb(h, arg); } } @@ -386,9 +416,9 @@ static void uv__print_handles(uv_loop_t* loop, int only_active, FILE* stream) { fprintf(stream, "[%c%c%c] %-8s %p\n", - "R-"[!(h->flags & UV__HANDLE_REF)], - "A-"[!(h->flags & UV__HANDLE_ACTIVE)], - "I-"[!(h->flags & UV__HANDLE_INTERNAL)], + "R-"[!(h->flags & UV_HANDLE_REF)], + "A-"[!(h->flags & UV_HANDLE_ACTIVE)], + "I-"[!(h->flags & UV_HANDLE_INTERNAL)], type, (void*)h); } @@ -632,7 +662,7 @@ int uv_loop_close(uv_loop_t* loop) { QUEUE_FOREACH(q, &loop->handle_queue) { h = QUEUE_DATA(q, uv_handle_t, handle_queue); - if (!(h->flags & UV__HANDLE_INTERNAL)) + if (!(h->flags & UV_HANDLE_INTERNAL)) return UV_EBUSY; } diff --git a/src/uv-common.h b/src/uv-common.h index c497d01..15ac4d0 100644 --- a/src/uv-common.h +++ b/src/uv-common.h @@ -32,14 +32,15 @@ #include #if defined(_MSC_VER) && _MSC_VER < 1600 -# include "stdint-msvc2008.h" +# include "uv/stdint-msvc2008.h" #else # include #endif #include "uv.h" -#include "tree.h" +#include "uv/tree.h" #include "queue.h" +#include "strscpy.h" #if EDOM > 0 # define UV__ERR(x) (-(x)) @@ -59,22 +60,67 @@ extern int snprintf(char*, size_t, const char*, ...); #define STATIC_ASSERT(expr) \ void uv__static_assert(int static_assert_failed[1 - 2 * !(expr)]) -#ifndef _WIN32 +/* Handle flags. Some flags are specific to Windows or UNIX. */ enum { - UV__SIGNAL_ONE_SHOT = 0x80000, /* On signal reception remove sighandler */ - UV__HANDLE_INTERNAL = 0x8000, - UV__HANDLE_ACTIVE = 0x4000, - UV__HANDLE_REF = 0x2000, - UV__HANDLE_CLOSING = 0 /* no-op on unix */ + /* Used by all handles. */ + UV_HANDLE_CLOSING = 0x00000001, + UV_HANDLE_CLOSED = 0x00000002, + UV_HANDLE_ACTIVE = 0x00000004, + UV_HANDLE_REF = 0x00000008, + UV_HANDLE_INTERNAL = 0x00000010, + UV_HANDLE_ENDGAME_QUEUED = 0x00000020, + + /* Used by streams. */ + UV_HANDLE_LISTENING = 0x00000040, + UV_HANDLE_CONNECTION = 0x00000080, + UV_HANDLE_SHUTTING = 0x00000100, + UV_HANDLE_SHUT = 0x00000200, + UV_HANDLE_READ_PARTIAL = 0x00000400, + UV_HANDLE_READ_EOF = 0x00000800, + + /* Used by streams and UDP handles. */ + UV_HANDLE_READING = 0x00001000, + UV_HANDLE_BOUND = 0x00002000, + UV_HANDLE_READABLE = 0x00004000, + UV_HANDLE_WRITABLE = 0x00008000, + UV_HANDLE_READ_PENDING = 0x00010000, + UV_HANDLE_SYNC_BYPASS_IOCP = 0x00020000, + UV_HANDLE_ZERO_READ = 0x00040000, + UV_HANDLE_EMULATE_IOCP = 0x00080000, + UV_HANDLE_BLOCKING_WRITES = 0x00100000, + UV_HANDLE_CANCELLATION_PENDING = 0x00200000, + + /* Used by uv_tcp_t and uv_udp_t handles */ + UV_HANDLE_IPV6 = 0x00400000, + + /* Only used by uv_tcp_t handles. */ + UV_HANDLE_TCP_NODELAY = 0x01000000, + UV_HANDLE_TCP_KEEPALIVE = 0x02000000, + UV_HANDLE_TCP_SINGLE_ACCEPT = 0x04000000, + UV_HANDLE_TCP_ACCEPT_STATE_CHANGING = 0x08000000, + UV_HANDLE_TCP_SOCKET_CLOSED = 0x10000000, + UV_HANDLE_SHARED_TCP_SOCKET = 0x20000000, + + /* Only used by uv_udp_t handles. */ + UV_HANDLE_UDP_PROCESSING = 0x01000000, + + /* Only used by uv_pipe_t handles. */ + UV_HANDLE_NON_OVERLAPPED_PIPE = 0x01000000, + UV_HANDLE_PIPESERVER = 0x02000000, + + /* Only used by uv_tty_t handles. */ + UV_HANDLE_TTY_READABLE = 0x01000000, + UV_HANDLE_TTY_RAW = 0x02000000, + UV_HANDLE_TTY_SAVED_POSITION = 0x04000000, + UV_HANDLE_TTY_SAVED_ATTRIBUTES = 0x08000000, + + /* Only used by uv_signal_t handles. */ + UV_SIGNAL_ONE_SHOT_DISPATCHED = 0x01000000, + UV_SIGNAL_ONE_SHOT = 0x02000000, + + /* Only used by uv_poll_t handles. */ + UV_HANDLE_POLL_SLOW = 0x01000000 }; -#else -# define UV__SIGNAL_ONE_SHOT_DISPATCHED 0x200 -# define UV__SIGNAL_ONE_SHOT 0x100 -# define UV__HANDLE_INTERNAL 0x80 -# define UV__HANDLE_ACTIVE 0x40 -# define UV__HANDLE_REF 0x20 -# define UV__HANDLE_CLOSING 0x01 -#endif int uv__loop_configure(uv_loop_t* loop, uv_loop_option option, va_list ap); @@ -119,8 +165,15 @@ void uv__fs_poll_close(uv_fs_poll_t* handle); int uv__getaddrinfo_translate_error(int sys_err); /* EAI_* error. */ +enum uv__work_kind { + UV__WORK_CPU, + UV__WORK_FAST_IO, + UV__WORK_SLOW_IO +}; + void uv__work_submit(uv_loop_t* loop, struct uv__work *w, + enum uv__work_kind kind, void (*work)(struct uv__work *w), void (*done)(struct uv__work *w, int status)); @@ -132,6 +185,10 @@ int uv__socket_sockopt(uv_handle_t* handle, int optname, int* value); void uv__fs_scandir_cleanup(uv_fs_t* req); +int uv__next_timeout(const uv_loop_t* loop); +void uv__run_timers(uv_loop_t* loop); +void uv__timer_close(uv_timer_t* handle); + #define uv__has_active_reqs(loop) \ ((loop)->active_reqs.count > 0) @@ -164,49 +221,47 @@ void uv__fs_scandir_cleanup(uv_fs_t* req); while (0) #define uv__is_active(h) \ - (((h)->flags & UV__HANDLE_ACTIVE) != 0) + (((h)->flags & UV_HANDLE_ACTIVE) != 0) #define uv__is_closing(h) \ - (((h)->flags & (UV_CLOSING | UV_CLOSED)) != 0) + (((h)->flags & (UV_HANDLE_CLOSING | UV_HANDLE_CLOSED)) != 0) #define uv__handle_start(h) \ do { \ - assert(((h)->flags & UV__HANDLE_CLOSING) == 0); \ - if (((h)->flags & UV__HANDLE_ACTIVE) != 0) break; \ - (h)->flags |= UV__HANDLE_ACTIVE; \ - if (((h)->flags & UV__HANDLE_REF) != 0) uv__active_handle_add(h); \ + if (((h)->flags & UV_HANDLE_ACTIVE) != 0) break; \ + (h)->flags |= UV_HANDLE_ACTIVE; \ + if (((h)->flags & UV_HANDLE_REF) != 0) uv__active_handle_add(h); \ } \ while (0) #define uv__handle_stop(h) \ do { \ - assert(((h)->flags & UV__HANDLE_CLOSING) == 0); \ - if (((h)->flags & UV__HANDLE_ACTIVE) == 0) break; \ - (h)->flags &= ~UV__HANDLE_ACTIVE; \ - if (((h)->flags & UV__HANDLE_REF) != 0) uv__active_handle_rm(h); \ + if (((h)->flags & UV_HANDLE_ACTIVE) == 0) break; \ + (h)->flags &= ~UV_HANDLE_ACTIVE; \ + if (((h)->flags & UV_HANDLE_REF) != 0) uv__active_handle_rm(h); \ } \ while (0) #define uv__handle_ref(h) \ do { \ - if (((h)->flags & UV__HANDLE_REF) != 0) break; \ - (h)->flags |= UV__HANDLE_REF; \ - if (((h)->flags & UV__HANDLE_CLOSING) != 0) break; \ - if (((h)->flags & UV__HANDLE_ACTIVE) != 0) uv__active_handle_add(h); \ + if (((h)->flags & UV_HANDLE_REF) != 0) break; \ + (h)->flags |= UV_HANDLE_REF; \ + if (((h)->flags & UV_HANDLE_CLOSING) != 0) break; \ + if (((h)->flags & UV_HANDLE_ACTIVE) != 0) uv__active_handle_add(h); \ } \ while (0) #define uv__handle_unref(h) \ do { \ - if (((h)->flags & UV__HANDLE_REF) == 0) break; \ - (h)->flags &= ~UV__HANDLE_REF; \ - if (((h)->flags & UV__HANDLE_CLOSING) != 0) break; \ - if (((h)->flags & UV__HANDLE_ACTIVE) != 0) uv__active_handle_rm(h); \ + if (((h)->flags & UV_HANDLE_REF) == 0) break; \ + (h)->flags &= ~UV_HANDLE_REF; \ + if (((h)->flags & UV_HANDLE_CLOSING) != 0) break; \ + if (((h)->flags & UV_HANDLE_ACTIVE) != 0) uv__active_handle_rm(h); \ } \ while (0) #define uv__has_ref(h) \ - (((h)->flags & UV__HANDLE_REF) != 0) + (((h)->flags & UV_HANDLE_REF) != 0) #if defined(_WIN32) # define uv__handle_platform_init(h) ((h)->u.fd = -1) @@ -218,7 +273,7 @@ void uv__fs_scandir_cleanup(uv_fs_t* req); do { \ (h)->loop = (loop_); \ (h)->type = (type_); \ - (h)->flags = UV__HANDLE_REF; /* Ref the loop when active. */ \ + (h)->flags = UV_HANDLE_REF; /* Ref the loop when active. */ \ QUEUE_INSERT_TAIL(&(loop_)->handle_queue, &(h)->handle_queue); \ uv__handle_platform_init(h); \ } \ diff --git a/src/uv-data-getter-setters.c b/src/uv-data-getter-setters.c index 533e4a2..b7fcd4a 100644 --- a/src/uv-data-getter-setters.c +++ b/src/uv-data-getter-setters.c @@ -3,11 +3,11 @@ const char* uv_handle_type_name(uv_handle_type type) { switch (type) { #define XX(uc,lc) case UV_##uc: return #lc; - UV_HANDLE_TYPE_MAP(XX) + UV_HANDLE_TYPE_MAP(XX) #undef XX - case UV_FILE: return "file"; - case UV_HANDLE_TYPE_MAX: - case UV_UNKNOWN_HANDLE: return NULL; + case UV_FILE: return "file"; + case UV_HANDLE_TYPE_MAX: + case UV_UNKNOWN_HANDLE: return NULL; } return NULL; } @@ -31,10 +31,12 @@ void uv_handle_set_data(uv_handle_t* handle, void* data) { const char* uv_req_type_name(uv_req_type type) { switch (type) { #define XX(uc,lc) case UV_##uc: return #lc; - UV_REQ_TYPE_MAP(XX) + UV_REQ_TYPE_MAP(XX) #undef XX - case UV_REQ_TYPE_MAX: - case UV_UNKNOWN_REQ: return NULL; + case UV_REQ_TYPE_MAX: + case UV_UNKNOWN_REQ: + default: /* UV_REQ_TYPE_PRIVATE */ + return NULL; } return NULL; } diff --git a/src/win/async.c b/src/win/async.c index 0b636ed..d787f66 100644 --- a/src/win/async.c +++ b/src/win/async.c @@ -29,7 +29,7 @@ void uv_async_endgame(uv_loop_t* loop, uv_async_t* handle) { - if (handle->flags & UV__HANDLE_CLOSING && + if (handle->flags & UV_HANDLE_CLOSING && !handle->async_sent) { assert(!(handle->flags & UV_HANDLE_CLOSED)); uv__handle_close(handle); @@ -71,9 +71,9 @@ int uv_async_send(uv_async_t* handle) { return -1; } - /* The user should make sure never to call uv_async_send to a closing */ - /* or closed handle. */ - assert(!(handle->flags & UV__HANDLE_CLOSING)); + /* The user should make sure never to call uv_async_send to a closing or + * closed handle. */ + assert(!(handle->flags & UV_HANDLE_CLOSING)); if (!uv__atomic_exchange_set(&handle->async_sent)) { POST_COMPLETION_FOR_REQ(loop, &handle->async_req); @@ -90,7 +90,7 @@ void uv_process_async_wakeup_req(uv_loop_t* loop, uv_async_t* handle, handle->async_sent = 0; - if (handle->flags & UV__HANDLE_CLOSING) { + if (handle->flags & UV_HANDLE_CLOSING) { uv_want_endgame(loop, (uv_handle_t*)handle); } else if (handle->async_cb != NULL) { handle->async_cb(handle); diff --git a/src/win/atomicops-inl.h b/src/win/atomicops-inl.h index 6d8126f..52713cf 100644 --- a/src/win/atomicops-inl.h +++ b/src/win/atomicops-inl.h @@ -29,10 +29,10 @@ /* Atomic set operation on char */ #ifdef _MSC_VER /* MSVC */ -/* _InterlockedOr8 is supported by MSVC on x32 and x64. It is slightly less */ -/* efficient than InterlockedExchange, but InterlockedExchange8 does not */ -/* exist, and interlocked operations on larger targets might require the */ -/* target to be aligned. */ +/* _InterlockedOr8 is supported by MSVC on x32 and x64. It is slightly less + * efficient than InterlockedExchange, but InterlockedExchange8 does not exist, + * and interlocked operations on larger targets might require the target to be + * aligned. */ #pragma intrinsic(_InterlockedOr8) static char INLINE uv__atomic_exchange_set(char volatile* target) { diff --git a/src/win/core.c b/src/win/core.c index 5fa9b66..bf80d77 100644 --- a/src/win/core.c +++ b/src/win/core.c @@ -33,6 +33,7 @@ #include "internal.h" #include "queue.h" #include "handle-inl.h" +#include "heap-inl.h" #include "req-inl.h" /* uv_once initialization guards */ @@ -221,6 +222,7 @@ static void uv_init(void) { int uv_loop_init(uv_loop_t* loop) { + struct heap* timer_heap; int err; /* Initialize libuv itself first */ @@ -246,7 +248,13 @@ int uv_loop_init(uv_loop_t* loop) { loop->endgame_handles = NULL; - RB_INIT(&loop->timers); + loop->timer_heap = timer_heap = uv__malloc(sizeof(*timer_heap)); + if (timer_heap == NULL) { + err = UV_ENOMEM; + goto fail_timers_alloc; + } + + heap_init(timer_heap); loop->check_handles = NULL; loop->prepare_handles = NULL; @@ -273,7 +281,7 @@ int uv_loop_init(uv_loop_t* loop) { goto fail_async_init; uv__handle_unref(&loop->wq_async); - loop->wq_async.flags |= UV__HANDLE_INTERNAL; + loop->wq_async.flags |= UV_HANDLE_INTERNAL; err = uv__loops_add(loop); if (err) @@ -285,6 +293,10 @@ fail_async_init: uv_mutex_destroy(&loop->wq_mutex); fail_mutex_init: + uv__free(timer_heap); + loop->timer_heap = NULL; + +fail_timers_alloc: CloseHandle(loop->iocp); loop->iocp = INVALID_HANDLE_VALUE; @@ -292,6 +304,13 @@ fail_mutex_init: } +void uv_update_time(uv_loop_t* loop) { + uint64_t new_time = uv__hrtime(1000); + assert(new_time >= loop->time); + loop->time = new_time; +} + + void uv__once_init(void) { uv_once(&uv_init_guard_, uv_init); } @@ -320,6 +339,9 @@ void uv__loop_close(uv_loop_t* loop) { uv_mutex_unlock(&loop->wq_mutex); uv_mutex_destroy(&loop->wq_mutex); + uv__free(loop->timer_heap); + loop->timer_heap = NULL; + CloseHandle(loop->iocp); } @@ -359,7 +381,7 @@ int uv_backend_timeout(const uv_loop_t* loop) { } -static void uv_poll(uv_loop_t* loop, DWORD timeout) { +static void uv__poll_wine(uv_loop_t* loop, DWORD timeout) { DWORD bytes; ULONG_PTR key; OVERLAPPED* overlapped; @@ -410,7 +432,7 @@ static void uv_poll(uv_loop_t* loop, DWORD timeout) { } -static void uv_poll_ex(uv_loop_t* loop, DWORD timeout) { +static void uv__poll(uv_loop_t* loop, DWORD timeout) { BOOL success; uv_req_t* req; OVERLAPPED_ENTRY overlappeds[128]; @@ -422,12 +444,12 @@ static void uv_poll_ex(uv_loop_t* loop, DWORD timeout) { timeout_time = loop->time + timeout; for (repeat = 0; ; repeat++) { - success = pGetQueuedCompletionStatusEx(loop->iocp, - overlappeds, - ARRAY_SIZE(overlappeds), - &count, - timeout, - FALSE); + success = GetQueuedCompletionStatusEx(loop->iocp, + overlappeds, + ARRAY_SIZE(overlappeds), + &count, + timeout, + FALSE); if (success) { for (i = 0; i < count; i++) { @@ -485,12 +507,6 @@ int uv_run(uv_loop_t *loop, uv_run_mode mode) { DWORD timeout; int r; int ran_pending; - void (*poll)(uv_loop_t* loop, DWORD timeout); - - if (pGetQueuedCompletionStatusEx) - poll = &uv_poll_ex; - else - poll = &uv_poll; r = uv__loop_alive(loop); if (!r) @@ -498,7 +514,7 @@ int uv_run(uv_loop_t *loop, uv_run_mode mode) { while (r != 0 && loop->stop_flag == 0) { uv_update_time(loop); - uv_process_timers(loop); + uv__run_timers(loop); ran_pending = uv_process_reqs(loop); uv_idle_invoke(loop); @@ -508,7 +524,11 @@ int uv_run(uv_loop_t *loop, uv_run_mode mode) { if ((mode == UV_RUN_ONCE && !ran_pending) || mode == UV_RUN_DEFAULT) timeout = uv_backend_timeout(loop); - (*poll)(loop, timeout); + if (pGetQueuedCompletionStatusEx) + uv__poll(loop, timeout); + else + uv__poll_wine(loop, timeout); + uv_check_invoke(loop); uv_process_endgames(loop); @@ -522,7 +542,7 @@ int uv_run(uv_loop_t *loop, uv_run_mode mode) { * UV_RUN_NOWAIT makes no guarantees about progress so it's omitted from * the check. */ - uv_process_timers(loop); + uv__run_timers(loop); } r = uv__loop_alive(loop); diff --git a/src/win/dl.c b/src/win/dl.c index 97ac1c1..676be4d 100644 --- a/src/win/dl.c +++ b/src/win/dl.c @@ -64,7 +64,8 @@ void uv_dlclose(uv_lib_t* lib) { int uv_dlsym(uv_lib_t* lib, const char* name, void** ptr) { - *ptr = (void*) GetProcAddress(lib->handle, name); + /* Cast though integer to suppress pedantic warning about forbidden cast. */ + *ptr = (void*)(uintptr_t) GetProcAddress(lib->handle, name); return uv__dlerror(lib, "", *ptr ? 0 : GetLastError()); } @@ -75,8 +76,9 @@ const char* uv_dlerror(const uv_lib_t* lib) { static void uv__format_fallback_error(uv_lib_t* lib, int errorno){ - DWORD_PTR args[1] = { (DWORD_PTR) errorno }; - LPSTR fallback_error = "error: %1!d!"; + static const CHAR fallback_error[] = "error: %1!d!"; + DWORD_PTR args[1]; + args[0] = (DWORD_PTR) errorno; FormatMessageA(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY | @@ -107,7 +109,8 @@ static int uv__dlerror(uv_lib_t* lib, const char* filename, DWORD errorno) { MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), (LPSTR) &lib->errmsg, 0, NULL); - if (!res && GetLastError() == ERROR_MUI_FILE_NOT_FOUND) { + if (!res && (GetLastError() == ERROR_MUI_FILE_NOT_FOUND || + GetLastError() == ERROR_RESOURCE_TYPE_NOT_FOUND)) { res = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, errorno, diff --git a/src/win/error.c b/src/win/error.c index 9b03bfe..24924ba 100644 --- a/src/win/error.c +++ b/src/win/error.c @@ -46,8 +46,8 @@ void uv_fatal_error(const int errorno, const char* syscall) { errmsg = "Unknown error"; } - /* FormatMessage messages include a newline character already, */ - /* so don't add another. */ + /* FormatMessage messages include a newline character already, so don't add + * another. */ if (syscall) { fprintf(stderr, "%s: (%d) %s", syscall, errorno, errmsg); } else { diff --git a/src/win/fs-event.c b/src/win/fs-event.c index 14c9af9..acf8e11 100644 --- a/src/win/fs-event.c +++ b/src/win/fs-event.c @@ -83,7 +83,7 @@ static void uv_relative_path(const WCHAR* filename, static int uv_split_path(const WCHAR* filename, WCHAR** dir, WCHAR** file) { size_t len, i; - + if (filename == NULL) { if (dir != NULL) *dir = NULL; @@ -215,11 +215,11 @@ int uv_fs_event_start(uv_fs_event_t* handle, uv__free(long_path); long_path = NULL; } - } - if (long_path) { - uv__free(pathw); - pathw = long_path; + if (long_path) { + uv__free(pathw); + pathw = long_path; + } } dir_to_watch = pathw; @@ -230,8 +230,11 @@ int uv_fs_event_start(uv_fs_event_t* handle, */ /* Convert to short path. */ - short_path = short_path_buffer; - if (!GetShortPathNameW(pathw, short_path, ARRAY_SIZE(short_path))) { + if (GetShortPathNameW(pathw, + short_path_buffer, + ARRAY_SIZE(short_path_buffer))) { + short_path = short_path_buffer; + } else { short_path = NULL; } @@ -419,7 +422,7 @@ void uv_process_fs_event_req(uv_loop_t* loop, uv_req_t* req, * - We are not active, just ignore the callback */ if (!uv__is_active(handle)) { - if (handle->flags & UV__HANDLE_CLOSING) { + if (handle->flags & UV_HANDLE_CLOSING) { uv_want_endgame(loop, (uv_handle_t*) handle); } return; @@ -543,7 +546,7 @@ void uv_process_fs_event_req(uv_loop_t* loop, uv_req_t* req, } offset = file_info->NextEntryOffset; - } while (offset && !(handle->flags & UV__HANDLE_CLOSING)); + } while (offset && !(handle->flags & UV_HANDLE_CLOSING)); } else { handle->cb(handle, NULL, UV_CHANGE, 0); } @@ -552,7 +555,7 @@ void uv_process_fs_event_req(uv_loop_t* loop, uv_req_t* req, handle->cb(handle, NULL, 0, uv_translate_sys_error(err)); } - if (!(handle->flags & UV__HANDLE_CLOSING)) { + if (!(handle->flags & UV_HANDLE_CLOSING)) { uv_fs_event_queue_readdirchanges(loop, handle); } else { uv_want_endgame(loop, (uv_handle_t*)handle); @@ -573,7 +576,7 @@ void uv_fs_event_close(uv_loop_t* loop, uv_fs_event_t* handle) { void uv_fs_event_endgame(uv_loop_t* loop, uv_fs_event_t* handle) { - if ((handle->flags & UV__HANDLE_CLOSING) && !handle->req_pending) { + if ((handle->flags & UV_HANDLE_CLOSING) && !handle->req_pending) { assert(!(handle->flags & UV_HANDLE_CLOSED)); if (handle->buffer) { diff --git a/src/win/fs.c b/src/win/fs.c index 30b87ac..65d936b 100644 --- a/src/win/fs.c +++ b/src/win/fs.c @@ -55,7 +55,11 @@ do { \ if (cb != NULL) { \ uv__req_register(loop, req); \ - uv__work_submit(loop, &req->work_req, uv__fs_work, uv__fs_done); \ + uv__work_submit(loop, \ + &req->work_req, \ + UV__WORK_FAST_IO, \ + uv__fs_work, \ + uv__fs_done); \ return 0; \ } else { \ uv__fs_work(&req->work_req); \ @@ -92,14 +96,17 @@ return; \ } +#define MILLIONu (1000U * 1000U) +#define BILLIONu (1000U * 1000U * 1000U) + #define FILETIME_TO_UINT(filetime) \ - (*((uint64_t*) &(filetime)) - 116444736000000000ULL) + (*((uint64_t*) &(filetime)) - (uint64_t) 116444736 * BILLIONu) #define FILETIME_TO_TIME_T(filetime) \ - (FILETIME_TO_UINT(filetime) / 10000000ULL) + (FILETIME_TO_UINT(filetime) / (10u * MILLIONu)) #define FILETIME_TO_TIME_NS(filetime, secs) \ - ((FILETIME_TO_UINT(filetime) - (secs * 10000000ULL)) * 100) + ((FILETIME_TO_UINT(filetime) - (secs * (uint64_t) 10 * MILLIONu)) * 100U) #define FILETIME_TO_TIMESPEC(ts, filetime) \ do { \ @@ -109,8 +116,8 @@ #define TIME_T_TO_FILETIME(time, filetime_ptr) \ do { \ - uint64_t bigtime = ((uint64_t) ((time) * 10000000ULL)) + \ - 116444736000000000ULL; \ + uint64_t bigtime = ((uint64_t) ((time) * (uint64_t) 10 * MILLIONu)) + \ + (uint64_t) 116444736 * BILLIONu; \ (filetime_ptr)->dwLowDateTime = bigtime & 0xFFFFFFFF; \ (filetime_ptr)->dwHighDateTime = bigtime >> 32; \ } while(0) @@ -326,12 +333,11 @@ INLINE static int fs__readlink_handle(HANDLE handle, char** target_ptr, reparse_data->SymbolicLinkReparseBuffer.SubstituteNameLength / sizeof(WCHAR); - /* Real symlinks can contain pretty much everything, but the only thing */ - /* we really care about is undoing the implicit conversion to an NT */ - /* namespaced path that CreateSymbolicLink will perform on absolute */ - /* paths. If the path is win32-namespaced then the user must have */ - /* explicitly made it so, and we better just return the unmodified */ - /* reparse data. */ + /* Real symlinks can contain pretty much everything, but the only thing we + * really care about is undoing the implicit conversion to an NT namespaced + * path that CreateSymbolicLink will perform on absolute paths. If the path + * is win32-namespaced then the user must have explicitly made it so, and + * we better just return the unmodified reparse data. */ if (w_target_len >= 4 && w_target[0] == L'\\' && w_target[1] == L'?' && @@ -352,8 +358,8 @@ INLINE static int fs__readlink_handle(HANDLE handle, char** target_ptr, (w_target[5] == L'N' || w_target[5] == L'n') && (w_target[6] == L'C' || w_target[6] == L'c') && w_target[7] == L'\\') { - /* \??\UNC\\\ - make sure the final path looks like */ - /* \\\\ */ + /* \??\UNC\\\ - make sure the final path looks like + * \\\\ */ w_target += 6; w_target[0] = L'\\'; w_target_len -= 6; @@ -368,11 +374,11 @@ INLINE static int fs__readlink_handle(HANDLE handle, char** target_ptr, w_target_len = reparse_data->MountPointReparseBuffer.SubstituteNameLength / sizeof(WCHAR); - /* Only treat junctions that look like \??\:\ as symlink. */ - /* Junctions can also be used as mount points, like \??\Volume{}, */ - /* but that's confusing for programs since they wouldn't be able to */ - /* actually understand such a path when returned by uv_readlink(). */ - /* UNC paths are never valid for junctions so we don't care about them. */ + /* Only treat junctions that look like \??\:\ as symlink. Junctions + * can also be used as mount points, like \??\Volume{}, but that's + * confusing for programs since they wouldn't be able to actually + * understand such a path when returned by uv_readlink(). UNC paths are + * never valid for junctions so we don't care about them. */ if (!(w_target_len >= 6 && w_target[0] == L'\\' && w_target[1] == L'?' && @@ -409,8 +415,8 @@ void fs__open(uv_fs_t* req) { int fd, current_umask; int flags = req->fs.info.file_flags; - /* Obtain the active umask. umask() never fails and returns the previous */ - /* umask. */ + /* Obtain the active umask. umask() never fails and returns the previous + * umask. */ current_umask = umask(0); umask(current_umask); @@ -502,6 +508,33 @@ void fs__open(uv_fs_t* req) { } if (flags & UV_FS_O_DIRECT) { + /* + * FILE_APPEND_DATA and FILE_FLAG_NO_BUFFERING are mutually exclusive. + * Windows returns 87, ERROR_INVALID_PARAMETER if these are combined. + * + * FILE_APPEND_DATA is included in FILE_GENERIC_WRITE: + * + * FILE_GENERIC_WRITE = STANDARD_RIGHTS_WRITE | + * FILE_WRITE_DATA | + * FILE_WRITE_ATTRIBUTES | + * FILE_WRITE_EA | + * FILE_APPEND_DATA | + * SYNCHRONIZE + * + * Note: Appends are also permitted by FILE_WRITE_DATA. + * + * In order for direct writes and direct appends to succeed, we therefore + * exclude FILE_APPEND_DATA if FILE_WRITE_DATA is specified, and otherwise + * fail if the user's sole permission is a direct append, since this + * particular combination is invalid. + */ + if (access & FILE_APPEND_DATA) { + if (access & FILE_WRITE_DATA) { + access &= ~FILE_APPEND_DATA; + } else { + goto einval; + } + } attributes |= FILE_FLAG_NO_BUFFERING; } @@ -530,8 +563,8 @@ void fs__open(uv_fs_t* req) { DWORD error = GetLastError(); if (error == ERROR_FILE_EXISTS && (flags & UV_FS_O_CREAT) && !(flags & UV_FS_O_EXCL)) { - /* Special case: when ERROR_FILE_EXISTS happens and UV_FS_O_CREAT was */ - /* specified, it means the path referred to a directory. */ + /* Special case: when ERROR_FILE_EXISTS happens and UV_FS_O_CREAT was + * specified, it means the path referred to a directory. */ SET_REQ_UV_ERROR(req, UV_EISDIR, error); } else { SET_REQ_WIN32_ERROR(req, GetLastError()); @@ -756,9 +789,9 @@ void fs__unlink(uv_fs_t* req) { } if (info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { - /* Do not allow deletion of directories, unless it is a symlink. When */ - /* the path refers to a non-symlink directory, report EPERM as mandated */ - /* by POSIX.1. */ + /* Do not allow deletion of directories, unless it is a symlink. When the + * path refers to a non-symlink directory, report EPERM as mandated by + * POSIX.1. */ /* Check if it is a reparse point. If it's not, it's a normal directory. */ if (!(info.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)) { @@ -767,8 +800,8 @@ void fs__unlink(uv_fs_t* req) { return; } - /* Read the reparse point and check if it is a valid symlink. */ - /* If not, don't unlink. */ + /* Read the reparse point and check if it is a valid symlink. If not, don't + * unlink. */ if (fs__readlink_handle(handle, NULL, NULL) < 0) { DWORD error = GetLastError(); if (error == ERROR_SYMLINK_NOT_SUPPORTED) @@ -783,9 +816,8 @@ void fs__unlink(uv_fs_t* req) { /* Remove read-only attribute */ FILE_BASIC_INFORMATION basic = { 0 }; - basic.FileAttributes = info.dwFileAttributes - & ~(FILE_ATTRIBUTE_READONLY) - | FILE_ATTRIBUTE_ARCHIVE; + basic.FileAttributes = (info.dwFileAttributes & ~FILE_ATTRIBUTE_READONLY) | + FILE_ATTRIBUTE_ARCHIVE; status = pNtSetInformationFile(handle, &iosb, @@ -1196,7 +1228,7 @@ INLINE static int fs__stat_handle(HANDLE handle, uv_stat_t* statbuf, /* st_blocks contains the on-disk allocation size in 512-byte units. */ statbuf->st_blocks = - file_info.StandardInformation.AllocationSize.QuadPart >> 9ULL; + (uint64_t) file_info.StandardInformation.AllocationSize.QuadPart >> 9; statbuf->st_nlink = file_info.StandardInformation.NumberOfLinks; @@ -1490,6 +1522,7 @@ static void fs__chmod(uv_fs_t* req) { static void fs__fchmod(uv_fs_t* req) { int fd = req->file.fd; + int clear_archive_flag; HANDLE handle; NTSTATUS nt_status; IO_STATUS_BLOCK io_status; @@ -1497,7 +1530,11 @@ static void fs__fchmod(uv_fs_t* req) { VERIFY_FD(fd, req); - handle = uv__get_osfhandle(fd); + handle = ReOpenFile(uv__get_osfhandle(fd), FILE_WRITE_ATTRIBUTES, 0, 0); + if (handle == INVALID_HANDLE_VALUE) { + SET_REQ_WIN32_ERROR(req, GetLastError()); + return; + } nt_status = pNtQueryInformationFile(handle, &io_status, @@ -1507,7 +1544,27 @@ static void fs__fchmod(uv_fs_t* req) { if (!NT_SUCCESS(nt_status)) { SET_REQ_WIN32_ERROR(req, pRtlNtStatusToDosError(nt_status)); - return; + goto fchmod_cleanup; + } + + /* Test if the Archive attribute is cleared */ + if ((file_info.FileAttributes & FILE_ATTRIBUTE_ARCHIVE) == 0) { + /* Set Archive flag, otherwise setting or clearing the read-only + flag will not work */ + file_info.FileAttributes |= FILE_ATTRIBUTE_ARCHIVE; + nt_status = pNtSetInformationFile(handle, + &io_status, + &file_info, + sizeof file_info, + FileBasicInformation); + if (!NT_SUCCESS(nt_status)) { + SET_REQ_WIN32_ERROR(req, pRtlNtStatusToDosError(nt_status)); + goto fchmod_cleanup; + } + /* Remeber to clear the flag later on */ + clear_archive_flag = 1; + } else { + clear_archive_flag = 0; } if (req->fs.info.mode & _S_IWRITE) { @@ -1524,10 +1581,28 @@ static void fs__fchmod(uv_fs_t* req) { if (!NT_SUCCESS(nt_status)) { SET_REQ_WIN32_ERROR(req, pRtlNtStatusToDosError(nt_status)); - return; + goto fchmod_cleanup; + } + + if (clear_archive_flag) { + file_info.FileAttributes &= ~FILE_ATTRIBUTE_ARCHIVE; + if (file_info.FileAttributes == 0) { + file_info.FileAttributes = FILE_ATTRIBUTE_NORMAL; + } + nt_status = pNtSetInformationFile(handle, + &io_status, + &file_info, + sizeof file_info, + FileBasicInformation); + if (!NT_SUCCESS(nt_status)) { + SET_REQ_WIN32_ERROR(req, pRtlNtStatusToDosError(nt_status)); + goto fchmod_cleanup; + } } SET_REQ_SUCCESS(req); +fchmod_cleanup: + CloseHandle(handle); } @@ -1787,17 +1862,13 @@ static void fs__symlink(uv_fs_t* req) { fs__create_junction(req, pathw, new_pathw); return; } - if (!pCreateSymbolicLinkW) { - SET_REQ_UV_ERROR(req, UV_ENOSYS, ERROR_NOT_SUPPORTED); - return; - } if (req->fs.info.file_flags & UV_FS_SYMLINK_DIR) flags = SYMBOLIC_LINK_FLAG_DIRECTORY | uv__file_symlink_usermode_flag; else flags = uv__file_symlink_usermode_flag; - if (pCreateSymbolicLinkW(new_pathw, pathw, flags)) { + if (CreateSymbolicLinkW(new_pathw, pathw, flags)) { SET_REQ_RESULT(req, 0); return; } @@ -1848,13 +1919,13 @@ static void fs__readlink(uv_fs_t* req) { } -static size_t fs__realpath_handle(HANDLE handle, char** realpath_ptr) { +static ssize_t fs__realpath_handle(HANDLE handle, char** realpath_ptr) { int r; DWORD w_realpath_len; WCHAR* w_realpath_ptr = NULL; WCHAR* w_realpath_buf; - w_realpath_len = pGetFinalPathNameByHandleW(handle, NULL, 0, VOLUME_NAME_DOS); + w_realpath_len = GetFinalPathNameByHandleW(handle, NULL, 0, VOLUME_NAME_DOS); if (w_realpath_len == 0) { return -1; } @@ -1866,10 +1937,8 @@ static size_t fs__realpath_handle(HANDLE handle, char** realpath_ptr) { } w_realpath_ptr = w_realpath_buf; - if (pGetFinalPathNameByHandleW(handle, - w_realpath_ptr, - w_realpath_len, - VOLUME_NAME_DOS) == 0) { + if (GetFinalPathNameByHandleW( + handle, w_realpath_ptr, w_realpath_len, VOLUME_NAME_DOS) == 0) { uv__free(w_realpath_buf); SetLastError(ERROR_INVALID_HANDLE); return -1; @@ -1901,11 +1970,6 @@ static size_t fs__realpath_handle(HANDLE handle, char** realpath_ptr) { static void fs__realpath(uv_fs_t* req) { HANDLE handle; - if (!pGetFinalPathNameByHandleW) { - SET_REQ_UV_ERROR(req, UV_ENOSYS, ERROR_NOT_SUPPORTED); - return; - } - handle = CreateFileW(req->file.pathw, 0, 0, @@ -1940,6 +2004,10 @@ static void fs__fchown(uv_fs_t* req) { } +static void fs__lchown(uv_fs_t* req) { + req->result = 0; +} + static void uv__fs_work(struct uv__work* w) { uv_fs_t* req; @@ -1977,6 +2045,7 @@ static void uv__fs_work(struct uv__work* w) { XX(REALPATH, realpath) XX(CHOWN, chown) XX(FCHOWN, fchown); + XX(LCHOWN, lchown); default: assert(!"bad uv_fs_type"); } @@ -2262,6 +2331,19 @@ int uv_fs_fchown(uv_loop_t* loop, uv_fs_t* req, uv_file fd, uv_uid_t uid, } +int uv_fs_lchown(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_uid_t uid, + uv_gid_t gid, uv_fs_cb cb) { + int err; + + INIT(UV_FS_LCHOWN); + err = fs__capture_path(req, path, NULL, cb != NULL); + if (err) { + return uv_translate_sys_error(err); + } + POST; +} + + int uv_fs_stat(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) { int err; diff --git a/src/win/getaddrinfo.c b/src/win/getaddrinfo.c index 5adc766..dfab860 100644 --- a/src/win/getaddrinfo.c +++ b/src/win/getaddrinfo.c @@ -24,6 +24,7 @@ #include "uv.h" #include "internal.h" #include "req-inl.h" +#include "idna.h" /* EAI_* constants. */ #include @@ -71,8 +72,8 @@ int uv__getaddrinfo_translate_error(int sys_err) { #endif -/* adjust size value to be multiple of 4. Use to keep pointer aligned */ -/* Do we need different versions of this for different architectures? */ +/* Adjust size value to be multiple of 4. Use to keep pointer aligned. + * Do we need different versions of this for different architectures? */ #define ALIGNED_SIZE(X) ((((X) + 3) >> 2) << 2) #ifndef NDIS_IF_MAX_STRING_SIZE @@ -124,8 +125,7 @@ static void uv__getaddrinfo_done(struct uv__work* w, int status) { } if (req->retcode == 0) { - /* convert addrinfoW to addrinfo */ - /* first calculate required length */ + /* Convert addrinfoW to addrinfo. First calculate required length. */ addrinfow_ptr = req->addrinfow; while (addrinfow_ptr != NULL) { addrinfo_len += addrinfo_struct_len + @@ -260,11 +260,13 @@ int uv_getaddrinfo(uv_loop_t* loop, const char* node, const char* service, const struct addrinfo* hints) { + char hostname_ascii[256]; int nodesize = 0; int servicesize = 0; int hintssize = 0; char* alloc_ptr = NULL; int err; + long rc; if (req == NULL || (node == NULL && service == NULL)) { return UV_EINVAL; @@ -278,12 +280,19 @@ int uv_getaddrinfo(uv_loop_t* loop, /* calculate required memory size for all input values */ if (node != NULL) { - nodesize = ALIGNED_SIZE(MultiByteToWideChar(CP_UTF8, 0, node, -1, NULL, 0) * - sizeof(WCHAR)); + rc = uv__idna_toascii(node, + node + strlen(node), + hostname_ascii, + hostname_ascii + sizeof(hostname_ascii)); + if (rc < 0) + return rc; + nodesize = ALIGNED_SIZE(MultiByteToWideChar(CP_UTF8, 0, hostname_ascii, + -1, NULL, 0) * sizeof(WCHAR)); if (nodesize == 0) { err = GetLastError(); goto error; } + node = hostname_ascii; } if (service != NULL) { @@ -313,8 +322,8 @@ int uv_getaddrinfo(uv_loop_t* loop, /* save alloc_ptr now so we can free if error */ req->alloc = (void*)alloc_ptr; - /* convert node string to UTF16 into allocated memory and save pointer in */ - /* the request. */ + /* Convert node string to UTF16 into allocated memory and save pointer in the + * request. */ if (node != NULL) { req->node = (WCHAR*)alloc_ptr; if (MultiByteToWideChar(CP_UTF8, @@ -331,8 +340,8 @@ int uv_getaddrinfo(uv_loop_t* loop, req->node = NULL; } - /* convert service string to UTF16 into allocated memory and save pointer */ - /* in the req. */ + /* Convert service string to UTF16 into allocated memory and save pointer in + * the req. */ if (service != NULL) { req->service = (WCHAR*)alloc_ptr; if (MultiByteToWideChar(CP_UTF8, @@ -369,6 +378,7 @@ int uv_getaddrinfo(uv_loop_t* loop, if (getaddrinfo_cb) { uv__work_submit(loop, &req->work_req, + UV__WORK_SLOW_IO, uv__getaddrinfo_work, uv__getaddrinfo_done); return 0; @@ -392,21 +402,15 @@ int uv_if_indextoname(unsigned int ifindex, char* buffer, size_t* size) { DWORD bufsize; int r; - uv__once_init(); - if (buffer == NULL || size == NULL || *size == 0) return UV_EINVAL; - if (pConvertInterfaceIndexToLuid == NULL) - return UV_ENOSYS; - r = pConvertInterfaceIndexToLuid(ifindex, &luid); + r = ConvertInterfaceIndexToLuid(ifindex, &luid); if (r != 0) return uv_translate_sys_error(r); - if (pConvertInterfaceLuidToNameW == NULL) - return UV_ENOSYS; - r = pConvertInterfaceLuidToNameW(&luid, wname, ARRAY_SIZE(wname)); + r = ConvertInterfaceLuidToNameW(&luid, wname, ARRAY_SIZE(wname)); if (r != 0) return uv_translate_sys_error(r); diff --git a/src/win/getnameinfo.c b/src/win/getnameinfo.c index 9f10cd2..b377338 100644 --- a/src/win/getnameinfo.c +++ b/src/win/getnameinfo.c @@ -42,7 +42,7 @@ static void uv__getnameinfo_work(struct uv__work* w) { uv_getnameinfo_t* req; WCHAR host[NI_MAXHOST]; WCHAR service[NI_MAXSERV]; - int ret = 0; + int ret; req = container_of(w, uv_getnameinfo_t, work_req); if (GetNameInfoW((struct sockaddr*)&req->storage, @@ -53,27 +53,34 @@ static void uv__getnameinfo_work(struct uv__work* w) { ARRAY_SIZE(service), req->flags)) { ret = WSAGetLastError(); + req->retcode = uv__getaddrinfo_translate_error(ret); + return; + } + + ret = WideCharToMultiByte(CP_UTF8, + 0, + host, + -1, + req->host, + sizeof(req->host), + NULL, + NULL); + if (ret == 0) { + req->retcode = uv_translate_sys_error(GetLastError()); + return; + } + + ret = WideCharToMultiByte(CP_UTF8, + 0, + service, + -1, + req->service, + sizeof(req->service), + NULL, + NULL); + if (ret == 0) { + req->retcode = uv_translate_sys_error(GetLastError()); } - req->retcode = uv__getaddrinfo_translate_error(ret); - - /* convert results to UTF-8 */ - WideCharToMultiByte(CP_UTF8, - 0, - host, - -1, - req->host, - sizeof(req->host), - NULL, - NULL); - - WideCharToMultiByte(CP_UTF8, - 0, - service, - -1, - req->service, - sizeof(req->service), - NULL, - NULL); } @@ -138,6 +145,7 @@ int uv_getnameinfo(uv_loop_t* loop, if (getnameinfo_cb) { uv__work_submit(loop, &req->work_req, + UV__WORK_SLOW_IO, uv__getnameinfo_work, uv__getnameinfo_done); return 0; diff --git a/src/win/handle-inl.h b/src/win/handle-inl.h index 8d0334c..82c657d 100644 --- a/src/win/handle-inl.h +++ b/src/win/handle-inl.h @@ -32,7 +32,7 @@ #define DECREASE_ACTIVE_COUNT(loop, handle) \ do { \ if (--(handle)->activecnt == 0 && \ - !((handle)->flags & UV__HANDLE_CLOSING)) { \ + !((handle)->flags & UV_HANDLE_CLOSING)) { \ uv__handle_stop((handle)); \ } \ assert((handle)->activecnt >= 0); \ @@ -53,7 +53,7 @@ assert(handle->reqs_pending > 0); \ handle->reqs_pending--; \ \ - if (handle->flags & UV__HANDLE_CLOSING && \ + if (handle->flags & UV_HANDLE_CLOSING && \ handle->reqs_pending == 0) { \ uv_want_endgame(loop, (uv_handle_t*)handle); \ } \ @@ -62,14 +62,14 @@ #define uv__handle_closing(handle) \ do { \ - assert(!((handle)->flags & UV__HANDLE_CLOSING)); \ + assert(!((handle)->flags & UV_HANDLE_CLOSING)); \ \ - if (!(((handle)->flags & UV__HANDLE_ACTIVE) && \ - ((handle)->flags & UV__HANDLE_REF))) \ + if (!(((handle)->flags & UV_HANDLE_ACTIVE) && \ + ((handle)->flags & UV_HANDLE_REF))) \ uv__active_handle_add((uv_handle_t*) (handle)); \ \ - (handle)->flags |= UV__HANDLE_CLOSING; \ - (handle)->flags &= ~UV__HANDLE_ACTIVE; \ + (handle)->flags |= UV_HANDLE_CLOSING; \ + (handle)->flags &= ~UV_HANDLE_ACTIVE; \ } while (0) @@ -126,7 +126,8 @@ INLINE static void uv_process_endgames(uv_loop_t* loop) { break; case UV_TIMER: - uv_timer_endgame(loop, (uv_timer_t*) handle); + uv__timer_close((uv_timer_t*) handle); + uv__handle_close(handle); break; case UV_PREPARE: @@ -164,10 +165,10 @@ INLINE static void uv_process_endgames(uv_loop_t* loop) { INLINE static HANDLE uv__get_osfhandle(int fd) { - /* _get_osfhandle() raises an assert in debug builds if the FD is invalid. */ - /* But it also correctly checks the FD and returns INVALID_HANDLE_VALUE */ - /* for invalid FDs in release builds (or if you let the assert continue). */ - /* So this wrapper function disables asserts when calling _get_osfhandle. */ + /* _get_osfhandle() raises an assert in debug builds if the FD is invalid. + * But it also correctly checks the FD and returns INVALID_HANDLE_VALUE for + * invalid FDs in release builds (or if you let the assert continue). So this + * wrapper function disables asserts when calling _get_osfhandle. */ HANDLE handle; UV_BEGIN_DISABLE_CRT_ASSERT(); diff --git a/src/win/handle.c b/src/win/handle.c index 3915070..9d76c3f 100644 --- a/src/win/handle.c +++ b/src/win/handle.c @@ -59,15 +59,15 @@ uv_handle_type uv_guess_handle(uv_file file) { int uv_is_active(const uv_handle_t* handle) { - return (handle->flags & UV__HANDLE_ACTIVE) && - !(handle->flags & UV__HANDLE_CLOSING); + return (handle->flags & UV_HANDLE_ACTIVE) && + !(handle->flags & UV_HANDLE_CLOSING); } void uv_close(uv_handle_t* handle, uv_close_cb cb) { uv_loop_t* loop = handle->loop; - if (handle->flags & UV__HANDLE_CLOSING) { + if (handle->flags & UV_HANDLE_CLOSING) { assert(0); return; } @@ -150,10 +150,14 @@ void uv_close(uv_handle_t* handle, uv_close_cb cb) { int uv_is_closing(const uv_handle_t* handle) { - return !!(handle->flags & (UV__HANDLE_CLOSING | UV_HANDLE_CLOSED)); + return !!(handle->flags & (UV_HANDLE_CLOSING | UV_HANDLE_CLOSED)); } uv_os_fd_t uv_get_osfhandle(int fd) { return uv__get_osfhandle(fd); } + +int uv_open_osfhandle(uv_os_fd_t os_fd) { + return _open_osfhandle((intptr_t) os_fd, 0); +} diff --git a/src/win/internal.h b/src/win/internal.h index cce4e20..634b9f7 100644 --- a/src/win/internal.h +++ b/src/win/internal.h @@ -25,7 +25,7 @@ #include "uv.h" #include "../uv-common.h" -#include "tree.h" +#include "uv/tree.h" #include "winapi.h" #include "winsock.h" @@ -58,77 +58,19 @@ extern UV_THREAD_LOCAL int uv__crt_assert_enabled; #endif /* - * Handles - * (also see handle-inl.h) - */ - -/* Used by all handles. */ -#define UV_HANDLE_CLOSED 0x00000002 -#define UV_HANDLE_ENDGAME_QUEUED 0x00000008 - -/* uv-common.h: #define UV__HANDLE_CLOSING 0x00000001 */ -/* uv-common.h: #define UV__HANDLE_ACTIVE 0x00000040 */ -/* uv-common.h: #define UV__HANDLE_REF 0x00000020 */ -/* uv-common.h: #define UV_HANDLE_INTERNAL 0x00000080 */ - -/* Used by streams and UDP handles. */ -#define UV_HANDLE_READING 0x00000100 -#define UV_HANDLE_BOUND 0x00000200 -#define UV_HANDLE_LISTENING 0x00000800 -#define UV_HANDLE_CONNECTION 0x00001000 -#define UV_HANDLE_READABLE 0x00008000 -#define UV_HANDLE_WRITABLE 0x00010000 -#define UV_HANDLE_READ_PENDING 0x00020000 -#define UV_HANDLE_SYNC_BYPASS_IOCP 0x00040000 -#define UV_HANDLE_ZERO_READ 0x00080000 -#define UV_HANDLE_EMULATE_IOCP 0x00100000 -#define UV_HANDLE_BLOCKING_WRITES 0x00200000 -#define UV_HANDLE_CANCELLATION_PENDING 0x00400000 - -/* Used by uv_tcp_t and uv_udp_t handles */ -#define UV_HANDLE_IPV6 0x01000000 - -/* Only used by uv_tcp_t handles. */ -#define UV_HANDLE_TCP_NODELAY 0x02000000 -#define UV_HANDLE_TCP_KEEPALIVE 0x04000000 -#define UV_HANDLE_TCP_SINGLE_ACCEPT 0x08000000 -#define UV_HANDLE_TCP_ACCEPT_STATE_CHANGING 0x10000000 -#define UV_HANDLE_TCP_SOCKET_CLOSED 0x20000000 -#define UV_HANDLE_SHARED_TCP_SOCKET 0x40000000 - -/* Only used by uv_pipe_t handles. */ -#define UV_HANDLE_NON_OVERLAPPED_PIPE 0x01000000 -#define UV_HANDLE_PIPESERVER 0x02000000 -#define UV_HANDLE_PIPE_READ_CANCELABLE 0x04000000 - -/* Only used by uv_tty_t handles. */ -#define UV_HANDLE_TTY_READABLE 0x01000000 -#define UV_HANDLE_TTY_RAW 0x02000000 -#define UV_HANDLE_TTY_SAVED_POSITION 0x04000000 -#define UV_HANDLE_TTY_SAVED_ATTRIBUTES 0x08000000 - -/* Only used by uv_poll_t handles. */ -#define UV_HANDLE_POLL_SLOW 0x02000000 - - -/* - * Requests: see req-inl.h - */ - - -/* - * Streams: see stream-inl.h - */ - - -/* * TCP */ +typedef enum { + UV__IPC_SOCKET_XFER_NONE = 0, + UV__IPC_SOCKET_XFER_TCP_CONNECTION, + UV__IPC_SOCKET_XFER_TCP_SERVER +} uv__ipc_socket_xfer_type_t; + typedef struct { WSAPROTOCOL_INFOW socket_info; - int delayed_error; -} uv__ipc_socket_info_ex; + uint32_t delayed_error; +} uv__ipc_socket_xfer_info_t; int uv_tcp_listen(uv_tcp_t* handle, int backlog, uv_connection_cb cb); int uv_tcp_accept(uv_tcp_t* server, uv_tcp_t* client); @@ -150,11 +92,13 @@ void uv_process_tcp_connect_req(uv_loop_t* loop, uv_tcp_t* handle, void uv_tcp_close(uv_loop_t* loop, uv_tcp_t* tcp); void uv_tcp_endgame(uv_loop_t* loop, uv_tcp_t* handle); -int uv_tcp_import(uv_tcp_t* tcp, uv__ipc_socket_info_ex* socket_info_ex, - int tcp_connection); - -int uv_tcp_duplicate_socket(uv_tcp_t* handle, int pid, - LPWSAPROTOCOL_INFOW protocol_info); +int uv__tcp_xfer_export(uv_tcp_t* handle, + int pid, + uv__ipc_socket_xfer_type_t* xfer_type, + uv__ipc_socket_xfer_info_t* xfer_info); +int uv__tcp_xfer_import(uv_tcp_t* tcp, + uv__ipc_socket_xfer_type_t xfer_type, + uv__ipc_socket_xfer_info_t* xfer_info); /* @@ -178,14 +122,14 @@ int uv_pipe_listen(uv_pipe_t* handle, int backlog, uv_connection_cb cb); int uv_pipe_accept(uv_pipe_t* server, uv_stream_t* client); int uv_pipe_read_start(uv_pipe_t* handle, uv_alloc_cb alloc_cb, uv_read_cb read_cb); -int uv_pipe_write(uv_loop_t* loop, uv_write_t* req, uv_pipe_t* handle, - const uv_buf_t bufs[], unsigned int nbufs, uv_write_cb cb); -int uv_pipe_write2(uv_loop_t* loop, uv_write_t* req, uv_pipe_t* handle, - const uv_buf_t bufs[], unsigned int nbufs, uv_stream_t* send_handle, - uv_write_cb cb); -void uv__pipe_pause_read(uv_pipe_t* handle); -void uv__pipe_unpause_read(uv_pipe_t* handle); -void uv__pipe_stop_read(uv_pipe_t* handle); +void uv__pipe_read_stop(uv_pipe_t* handle); +int uv__pipe_write(uv_loop_t* loop, + uv_write_t* req, + uv_pipe_t* handle, + const uv_buf_t bufs[], + size_t nbufs, + uv_stream_t* send_handle, + uv_write_cb cb); void uv_process_pipe_read_req(uv_loop_t* loop, uv_pipe_t* handle, uv_req_t* req); @@ -248,15 +192,6 @@ void uv_poll_endgame(uv_loop_t* loop, uv_poll_t* handle); /* - * Timers - */ -void uv_timer_endgame(uv_loop_t* loop, uv_timer_t* handle); - -DWORD uv__next_timeout(const uv_loop_t* loop); -void uv_process_timers(uv_loop_t* loop); - - -/* * Loop watchers */ void uv_loop_watcher_endgame(uv_loop_t* loop, uv_handle_t* handle); @@ -332,7 +267,6 @@ void uv__fs_poll_endgame(uv_loop_t* loop, uv_fs_poll_t* handle); void uv__util_init(void); uint64_t uv__hrtime(double scale); -int uv_current_pid(void); __declspec(noreturn) void uv_fatal_error(const int errorno, const char* syscall); int uv__getpwuid_r(uv_passwd_t* pwd); int uv__convert_utf16_to_utf8(const WCHAR* utf16, int utf16len, char** utf8); diff --git a/src/win/loop-watcher.c b/src/win/loop-watcher.c index 20e4509..ad7fbea 100644 --- a/src/win/loop-watcher.c +++ b/src/win/loop-watcher.c @@ -27,7 +27,7 @@ void uv_loop_watcher_endgame(uv_loop_t* loop, uv_handle_t* handle) { - if (handle->flags & UV__HANDLE_CLOSING) { + if (handle->flags & UV_HANDLE_CLOSING) { assert(!(handle->flags & UV_HANDLE_CLOSED)); handle->flags |= UV_HANDLE_CLOSED; uv__handle_close(handle); diff --git a/src/win/pipe.c b/src/win/pipe.c index 83ee4f9..277f649 100644 --- a/src/win/pipe.c +++ b/src/win/pipe.c @@ -21,39 +21,28 @@ #include #include -#include #include #include +#include -#include "uv.h" -#include "internal.h" #include "handle-inl.h" -#include "stream-inl.h" +#include "internal.h" #include "req-inl.h" +#include "stream-inl.h" +#include "uv-common.h" +#include "uv.h" #include #include -typedef struct uv__ipc_queue_item_s uv__ipc_queue_item_t; - -struct uv__ipc_queue_item_s { - /* - * NOTE: It is important for socket_info_ex to be the first field, - * because we will we assigning it to the pending_ipc_info.socket_info - */ - uv__ipc_socket_info_ex socket_info_ex; - QUEUE member; - int tcp_connection; -}; - /* A zero-size buffer for use by uv_pipe_read */ static char uv_zero_[] = ""; /* Null uv_buf_t */ static const uv_buf_t uv_null_buf_ = { 0, NULL }; -/* The timeout that the pipe will wait for the remote end to write data */ -/* when the local ends wants to shut it down. */ +/* The timeout that the pipe will wait for the remote end to write data when + * the local ends wants to shut it down. */ static const int64_t eof_timeout = 50; /* ms */ static const int default_pending_pipe_instances = 4; @@ -62,22 +51,44 @@ static const int default_pending_pipe_instances = 4; static char pipe_prefix[] = "\\\\?\\pipe"; static const int pipe_prefix_len = sizeof(pipe_prefix) - 1; -/* IPC protocol flags. */ -#define UV_IPC_RAW_DATA 0x0001 -#define UV_IPC_TCP_SERVER 0x0002 -#define UV_IPC_TCP_CONNECTION 0x0004 +/* IPC incoming xfer queue item. */ +typedef struct { + uv__ipc_socket_xfer_type_t xfer_type; + uv__ipc_socket_xfer_info_t xfer_info; + QUEUE member; +} uv__ipc_xfer_queue_item_t; + +/* IPC frame header flags. */ +/* clang-format off */ +enum { + UV__IPC_FRAME_HAS_DATA = 0x01, + UV__IPC_FRAME_HAS_SOCKET_XFER = 0x02, + UV__IPC_FRAME_XFER_IS_TCP_CONNECTION = 0x04, + /* These are combinations of the flags above. */ + UV__IPC_FRAME_XFER_FLAGS = 0x06, + UV__IPC_FRAME_VALID_FLAGS = 0x07 +}; +/* clang-format on */ /* IPC frame header. */ typedef struct { - int flags; - uint64_t raw_data_length; -} uv_ipc_frame_header_t; - -/* IPC frame, which contains an imported TCP socket stream. */ + uint32_t flags; + uint32_t reserved1; /* Ignored. */ + uint32_t data_length; /* Must be zero if there is no data. */ + uint32_t reserved2; /* Must be zero. */ +} uv__ipc_frame_header_t; + +/* To implement the IPC protocol correctly, these structures must have exactly + * the right size. */ +STATIC_ASSERT(sizeof(uv__ipc_frame_header_t) == 16); +STATIC_ASSERT(sizeof(uv__ipc_socket_xfer_info_t) == 632); + +/* Coalesced write request. */ typedef struct { - uv_ipc_frame_header_t header; - uv__ipc_socket_info_ex socket_info_ex; -} uv_ipc_frame_uv_stream; + uv_write_t req; /* Internal heap-allocated write request. */ + uv_write_t* user_req; /* Pointer to user-specified uv_write_t. */ +} uv__coalesced_write_t; + static void eof_timer_init(uv_pipe_t* pipe); static void eof_timer_start(uv_pipe_t* pipe); @@ -98,15 +109,12 @@ int uv_pipe_init(uv_loop_t* loop, uv_pipe_t* handle, int ipc) { handle->reqs_pending = 0; handle->handle = INVALID_HANDLE_VALUE; handle->name = NULL; - handle->pipe.conn.ipc_pid = 0; - handle->pipe.conn.remaining_ipc_rawdata_bytes = 0; - QUEUE_INIT(&handle->pipe.conn.pending_ipc_info.queue); - handle->pipe.conn.pending_ipc_info.queue_len = 0; + handle->pipe.conn.ipc_remote_pid = 0; + handle->pipe.conn.ipc_data_frame.payload_remaining = 0; + QUEUE_INIT(&handle->pipe.conn.ipc_xfer_queue); + handle->pipe.conn.ipc_xfer_queue_length = 0; handle->ipc = ipc; handle->pipe.conn.non_overlapped_writes_tail = NULL; - handle->pipe.conn.readfile_thread = NULL; - - UV_REQ_INIT(&handle->pipe.conn.ipc_header_write_req, UV_UNKNOWN_REQ); return 0; } @@ -117,10 +125,9 @@ static void uv_pipe_connection_init(uv_pipe_t* handle) { handle->read_req.data = handle; handle->pipe.conn.eof_timer = NULL; assert(!(handle->flags & UV_HANDLE_PIPESERVER)); - if (pCancelSynchronousIo && - handle->flags & UV_HANDLE_NON_OVERLAPPED_PIPE) { - uv_mutex_init(&handle->pipe.conn.readfile_mutex); - handle->flags |= UV_HANDLE_PIPE_READ_CANCELABLE; + if (handle->flags & UV_HANDLE_NON_OVERLAPPED_PIPE) { + handle->pipe.conn.readfile_thread_handle = NULL; + InitializeCriticalSection(&handle->pipe.conn.readfile_thread_lock); } } @@ -347,12 +354,7 @@ void uv_pipe_endgame(uv_loop_t* loop, uv_pipe_t* handle) { NTSTATUS nt_status; IO_STATUS_BLOCK io_status; FILE_PIPE_LOCAL_INFORMATION pipe_info; - uv__ipc_queue_item_t* item; - - if (handle->flags & UV_HANDLE_PIPE_READ_CANCELABLE) { - handle->flags &= ~UV_HANDLE_PIPE_READ_CANCELABLE; - uv_mutex_destroy(&handle->pipe.conn.readfile_mutex); - } + uv__ipc_xfer_queue_item_t* xfer_queue_item; if ((handle->flags & UV_HANDLE_CONNECTION) && handle->stream.conn.shutdown_req != NULL && @@ -362,7 +364,7 @@ void uv_pipe_endgame(uv_loop_t* loop, uv_pipe_t* handle) { /* Clear the shutdown_req field so we don't go here again. */ handle->stream.conn.shutdown_req = NULL; - if (handle->flags & UV__HANDLE_CLOSING) { + if (handle->flags & UV_HANDLE_CLOSING) { UNREGISTER_HANDLE_REQ(loop, handle, req); /* Already closing. Cancel the shutdown. */ @@ -423,33 +425,33 @@ void uv_pipe_endgame(uv_loop_t* loop, uv_pipe_t* handle) { } } - if (handle->flags & UV__HANDLE_CLOSING && + if (handle->flags & UV_HANDLE_CLOSING && handle->reqs_pending == 0) { assert(!(handle->flags & UV_HANDLE_CLOSED)); if (handle->flags & UV_HANDLE_CONNECTION) { /* Free pending sockets */ - while (!QUEUE_EMPTY(&handle->pipe.conn.pending_ipc_info.queue)) { + while (!QUEUE_EMPTY(&handle->pipe.conn.ipc_xfer_queue)) { QUEUE* q; SOCKET socket; - q = QUEUE_HEAD(&handle->pipe.conn.pending_ipc_info.queue); + q = QUEUE_HEAD(&handle->pipe.conn.ipc_xfer_queue); QUEUE_REMOVE(q); - item = QUEUE_DATA(q, uv__ipc_queue_item_t, member); + xfer_queue_item = QUEUE_DATA(q, uv__ipc_xfer_queue_item_t, member); /* Materialize socket and close it */ socket = WSASocketW(FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO, - &item->socket_info_ex.socket_info, + &xfer_queue_item->xfer_info.socket_info, 0, WSA_FLAG_OVERLAPPED); - uv__free(item); + uv__free(xfer_queue_item); if (socket != INVALID_SOCKET) closesocket(socket); } - handle->pipe.conn.pending_ipc_info.queue_len = 0; + handle->pipe.conn.ipc_xfer_queue_length = 0; if (handle->flags & UV_HANDLE_EMULATE_IOCP) { if (handle->read_req.wait_handle != INVALID_HANDLE_VALUE) { @@ -461,6 +463,9 @@ void uv_pipe_endgame(uv_loop_t* loop, uv_pipe_t* handle) { handle->read_req.event_handle = NULL; } } + + if (handle->flags & UV_HANDLE_NON_OVERLAPPED_PIPE) + DeleteCriticalSection(&handle->pipe.conn.readfile_thread_lock); } if (handle->flags & UV_HANDLE_PIPESERVER) { @@ -595,8 +600,8 @@ static DWORD WINAPI pipe_connect_thread_proc(void* parameter) { loop = handle->loop; assert(loop); - /* We're here because CreateFile on a pipe returned ERROR_PIPE_BUSY. */ - /* We wait for the pipe to become available with WaitNamedPipe. */ + /* We're here because CreateFile on a pipe returned ERROR_PIPE_BUSY. We wait + * for the pipe to become available with WaitNamedPipe. */ while (WaitNamedPipeW(handle->name, 30000)) { /* The pipe is now available, try to connect. */ pipeHandle = open_named_pipe(handle->name, &duplex_flags); @@ -706,55 +711,68 @@ error: } -void uv__pipe_pause_read(uv_pipe_t* handle) { - if (handle->flags & UV_HANDLE_PIPE_READ_CANCELABLE) { - /* Pause the ReadFile task briefly, to work - around the Windows kernel bug that causes - any access to a NamedPipe to deadlock if - any process has called ReadFile */ - HANDLE h; - uv_mutex_lock(&handle->pipe.conn.readfile_mutex); - h = handle->pipe.conn.readfile_thread; - while (h) { - /* spinlock: we expect this to finish quickly, - or we are probably about to deadlock anyways - (in the kernel), so it doesn't matter */ - pCancelSynchronousIo(h); - SwitchToThread(); /* yield thread control briefly */ - h = handle->pipe.conn.readfile_thread; - } - } -} +void uv__pipe_interrupt_read(uv_pipe_t* handle) { + BOOL r; + + if (!(handle->flags & UV_HANDLE_READ_PENDING)) + return; /* No pending reads. */ + if (handle->flags & UV_HANDLE_CANCELLATION_PENDING) + return; /* Already cancelled. */ + if (handle->handle == INVALID_HANDLE_VALUE) + return; /* Pipe handle closed. */ + if (!(handle->flags & UV_HANDLE_NON_OVERLAPPED_PIPE)) { + /* Cancel asynchronous read. */ + r = CancelIoEx(handle->handle, &handle->read_req.u.io.overlapped); + assert(r || GetLastError() == ERROR_NOT_FOUND); -void uv__pipe_unpause_read(uv_pipe_t* handle) { - if (handle->flags & UV_HANDLE_PIPE_READ_CANCELABLE) { - uv_mutex_unlock(&handle->pipe.conn.readfile_mutex); + } else { + /* Cancel synchronous read (which is happening in the thread pool). */ + HANDLE thread; + volatile HANDLE* thread_ptr = &handle->pipe.conn.readfile_thread_handle; + + EnterCriticalSection(&handle->pipe.conn.readfile_thread_lock); + + thread = *thread_ptr; + if (thread == NULL) { + /* The thread pool thread has not yet reached the point of blocking, we + * can pre-empt it by setting thread_handle to INVALID_HANDLE_VALUE. */ + *thread_ptr = INVALID_HANDLE_VALUE; + + } else { + /* Spin until the thread has acknowledged (by setting the thread to + * INVALID_HANDLE_VALUE) that it is past the point of blocking. */ + while (thread != INVALID_HANDLE_VALUE) { + r = CancelSynchronousIo(thread); + assert(r || GetLastError() == ERROR_NOT_FOUND); + SwitchToThread(); /* Yield thread. */ + thread = *thread_ptr; + } + } + + LeaveCriticalSection(&handle->pipe.conn.readfile_thread_lock); } + + /* Set flag to indicate that read has been cancelled. */ + handle->flags |= UV_HANDLE_CANCELLATION_PENDING; } -void uv__pipe_stop_read(uv_pipe_t* handle) { - if (pCancelIoEx && - !(handle->flags & UV_HANDLE_NON_OVERLAPPED_PIPE) && - !(handle->flags & UV_HANDLE_EMULATE_IOCP) && - handle->flags & UV_HANDLE_READING && - handle->read_req.type == UV_READ) { - pCancelIoEx(handle->handle, &handle->read_req.u.io.overlapped); - } +void uv__pipe_read_stop(uv_pipe_t* handle) { handle->flags &= ~UV_HANDLE_READING; - uv__pipe_pause_read((uv_pipe_t*)handle); - uv__pipe_unpause_read((uv_pipe_t*)handle); + DECREASE_ACTIVE_COUNT(handle->loop, handle); + + uv__pipe_interrupt_read(handle); } -/* Cleans up uv_pipe_t (server or connection) and all resources associated */ -/* with it. */ +/* Cleans up uv_pipe_t (server or connection) and all resources associated with + * it. */ void uv_pipe_cleanup(uv_loop_t* loop, uv_pipe_t* handle) { int i; HANDLE pipeHandle; - uv__pipe_stop_read(handle); + uv__pipe_interrupt_read(handle); if (handle->name) { uv__free(handle->name); @@ -864,23 +882,22 @@ int uv_pipe_accept(uv_pipe_t* server, uv_stream_t* client) { uv_pipe_t* pipe_client; uv_pipe_accept_t* req; QUEUE* q; - uv__ipc_queue_item_t* item; + uv__ipc_xfer_queue_item_t* item; int err; if (server->ipc) { - if (QUEUE_EMPTY(&server->pipe.conn.pending_ipc_info.queue)) { + if (QUEUE_EMPTY(&server->pipe.conn.ipc_xfer_queue)) { /* No valid pending sockets. */ return WSAEWOULDBLOCK; } - q = QUEUE_HEAD(&server->pipe.conn.pending_ipc_info.queue); + q = QUEUE_HEAD(&server->pipe.conn.ipc_xfer_queue); QUEUE_REMOVE(q); - server->pipe.conn.pending_ipc_info.queue_len--; - item = QUEUE_DATA(q, uv__ipc_queue_item_t, member); + server->pipe.conn.ipc_xfer_queue_length--; + item = QUEUE_DATA(q, uv__ipc_xfer_queue_item_t, member); - err = uv_tcp_import((uv_tcp_t*)client, - &item->socket_info_ex, - item->tcp_connection); + err = uv__tcp_xfer_import( + (uv_tcp_t*) client, item->xfer_type, &item->xfer_info); if (err != 0) return err; @@ -889,8 +906,8 @@ int uv_pipe_accept(uv_pipe_t* server, uv_stream_t* client) { } else { pipe_client = (uv_pipe_t*)client; - /* Find a connection instance that has been connected, but not yet */ - /* accepted. */ + /* Find a connection instance that has been connected, but not yet + * accepted. */ req = server->pipe.serv.pending_accepts; if (!req) { @@ -908,7 +925,7 @@ int uv_pipe_accept(uv_pipe_t* server, uv_stream_t* client) { req->next_pending = NULL; req->pipeHandle = INVALID_HANDLE_VALUE; - if (!(server->flags & UV__HANDLE_CLOSING)) { + if (!(server->flags & UV_HANDLE_CLOSING)) { uv_pipe_queue_accept(loop, server, req, FALSE); } } @@ -953,74 +970,75 @@ int uv_pipe_listen(uv_pipe_t* handle, int backlog, uv_connection_cb cb) { } -static DWORD WINAPI uv_pipe_zero_readfile_thread_proc(void* parameter) { - int result; - DWORD bytes; - uv_read_t* req = (uv_read_t*) parameter; +static DWORD WINAPI uv_pipe_zero_readfile_thread_proc(void* arg) { + uv_read_t* req = (uv_read_t*) arg; uv_pipe_t* handle = (uv_pipe_t*) req->data; uv_loop_t* loop = handle->loop; - HANDLE hThread = NULL; + volatile HANDLE* thread_ptr = &handle->pipe.conn.readfile_thread_handle; + CRITICAL_SECTION* lock = &handle->pipe.conn.readfile_thread_lock; + HANDLE thread; + DWORD bytes; DWORD err; - uv_mutex_t *m = &handle->pipe.conn.readfile_mutex; - assert(req != NULL); assert(req->type == UV_READ); assert(handle->type == UV_NAMED_PIPE); - if (handle->flags & UV_HANDLE_PIPE_READ_CANCELABLE) { - uv_mutex_lock(m); /* mutex controls *setting* of readfile_thread */ - if (DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), - GetCurrentProcess(), &hThread, - 0, FALSE, DUPLICATE_SAME_ACCESS)) { - handle->pipe.conn.readfile_thread = hThread; - } else { - hThread = NULL; - } - uv_mutex_unlock(m); + err = 0; + + /* Create a handle to the current thread. */ + if (!DuplicateHandle(GetCurrentProcess(), + GetCurrentThread(), + GetCurrentProcess(), + &thread, + 0, + FALSE, + DUPLICATE_SAME_ACCESS)) { + err = GetLastError(); + goto out1; } -restart_readfile: - if (handle->flags & UV_HANDLE_READING) { - result = ReadFile(handle->handle, - &uv_zero_, - 0, - &bytes, - NULL); - if (!result) { - err = GetLastError(); - if (err == ERROR_OPERATION_ABORTED && - handle->flags & UV_HANDLE_PIPE_READ_CANCELABLE) { - if (handle->flags & UV_HANDLE_READING) { - /* just a brief break to do something else */ - handle->pipe.conn.readfile_thread = NULL; - /* resume after it is finished */ - uv_mutex_lock(m); - handle->pipe.conn.readfile_thread = hThread; - uv_mutex_unlock(m); - goto restart_readfile; - } else { - result = 1; /* successfully stopped reading */ - } - } - } + + /* The lock needs to be held when thread handle is modified. */ + EnterCriticalSection(lock); + if (*thread_ptr == INVALID_HANDLE_VALUE) { + /* uv__pipe_interrupt_read() cancelled reading before we got here. */ + err = ERROR_OPERATION_ABORTED; } else { - result = 1; /* successfully aborted read before it even started */ - } - if (hThread) { - assert(hThread == handle->pipe.conn.readfile_thread); - /* mutex does not control clearing readfile_thread */ - handle->pipe.conn.readfile_thread = NULL; - uv_mutex_lock(m); - /* only when we hold the mutex lock is it safe to - open or close the handle */ - CloseHandle(hThread); - uv_mutex_unlock(m); + /* Let main thread know which worker thread is doing the blocking read. */ + assert(*thread_ptr == NULL); + *thread_ptr = thread; } + LeaveCriticalSection(lock); - if (!result) { - SET_REQ_ERROR(req, err); - } + if (err) + goto out2; + + /* Block the thread until data is available on the pipe, or the read is + * cancelled. */ + if (!ReadFile(handle->handle, &uv_zero_, 0, &bytes, NULL)) + err = GetLastError(); + + /* Let the main thread know the worker is past the point of blocking. */ + assert(thread == *thread_ptr); + *thread_ptr = INVALID_HANDLE_VALUE; + + /* Briefly acquire the mutex. Since the main thread holds the lock while it + * is spinning trying to cancel this thread's I/O, we will block here until + * it stops doing that. */ + EnterCriticalSection(lock); + LeaveCriticalSection(lock); +out2: + /* Close the handle to the current thread. */ + CloseHandle(thread); + +out1: + /* Set request status and post a completion record to the IOCP. */ + if (err) + SET_REQ_ERROR(req, err); + else + SET_REQ_SUCCESS(req); POST_COMPLETION_FOR_REQ(loop, req); + return 0; } @@ -1102,6 +1120,7 @@ static void uv_pipe_queue_read(uv_loop_t* loop, uv_pipe_t* handle) { req = &handle->read_req; if (handle->flags & UV_HANDLE_NON_OVERLAPPED_PIPE) { + handle->pipe.conn.readfile_thread_handle = NULL; /* Reset cancellation. */ if (!QueueUserWorkItem(&uv_pipe_zero_readfile_thread_proc, req, WT_EXECUTELONGFUNCTION)) { @@ -1169,8 +1188,8 @@ int uv_pipe_read_start(uv_pipe_t* handle, handle->read_cb = read_cb; handle->alloc_cb = alloc_cb; - /* If reading was stopped and then started again, there could still be a */ - /* read request pending. */ + /* If reading was stopped and then started again, there could still be a read + * request pending. */ if (!(handle->flags & UV_HANDLE_READ_PENDING)) uv_pipe_queue_read(loop, handle); @@ -1226,154 +1245,110 @@ static void uv_queue_non_overlapped_write(uv_pipe_t* handle) { } -static int uv_pipe_write_impl(uv_loop_t* loop, - uv_write_t* req, - uv_pipe_t* handle, - const uv_buf_t bufs[], - unsigned int nbufs, - uv_stream_t* send_handle, - uv_write_cb cb) { - int err; - int result; - uv_tcp_t* tcp_send_handle; - uv_write_t* ipc_header_req = NULL; - uv_ipc_frame_uv_stream ipc_frame; +static int uv__build_coalesced_write_req(uv_write_t* user_req, + const uv_buf_t bufs[], + size_t nbufs, + uv_write_t** req_out, + uv_buf_t* write_buf_out) { + /* Pack into a single heap-allocated buffer: + * (a) a uv_write_t structure where libuv stores the actual state. + * (b) a pointer to the original uv_write_t. + * (c) data from all `bufs` entries. + */ + char* heap_buffer; + size_t heap_buffer_length, heap_buffer_offset; + uv__coalesced_write_t* coalesced_write_req; /* (a) + (b) */ + char* data_start; /* (c) */ + size_t data_length; + unsigned int i; + + /* Compute combined size of all combined buffers from `bufs`. */ + data_length = 0; + for (i = 0; i < nbufs; i++) + data_length += bufs[i].len; + + /* The total combined size of data buffers should not exceed UINT32_MAX, + * because WriteFile() won't accept buffers larger than that. */ + if (data_length > UINT32_MAX) + return WSAENOBUFS; /* Maps to UV_ENOBUFS. */ + + /* Compute heap buffer size. */ + heap_buffer_length = sizeof *coalesced_write_req + /* (a) + (b) */ + data_length; /* (c) */ + + /* Allocate buffer. */ + heap_buffer = uv__malloc(heap_buffer_length); + if (heap_buffer == NULL) + return ERROR_NOT_ENOUGH_MEMORY; /* Maps to UV_ENOMEM. */ + + /* Copy uv_write_t information to the buffer. */ + coalesced_write_req = (uv__coalesced_write_t*) heap_buffer; + coalesced_write_req->req = *user_req; /* copy (a) */ + coalesced_write_req->req.coalesced = 1; + coalesced_write_req->user_req = user_req; /* copy (b) */ + heap_buffer_offset = sizeof *coalesced_write_req; /* offset (a) + (b) */ + + /* Copy data buffers to the heap buffer. */ + data_start = &heap_buffer[heap_buffer_offset]; + for (i = 0; i < nbufs; i++) { + memcpy(&heap_buffer[heap_buffer_offset], + bufs[i].base, + bufs[i].len); /* copy (c) */ + heap_buffer_offset += bufs[i].len; /* offset (c) */ + } + assert(heap_buffer_offset == heap_buffer_length); + + /* Set out arguments and return. */ + *req_out = &coalesced_write_req->req; + *write_buf_out = uv_buf_init(data_start, (unsigned int) data_length); + return 0; +} - if (nbufs != 1 && (nbufs != 0 || !send_handle)) { - return ERROR_NOT_SUPPORTED; - } - /* Only TCP handles are supported for sharing. */ - if (send_handle && ((send_handle->type != UV_TCP) || - (!(send_handle->flags & UV_HANDLE_BOUND) && - !(send_handle->flags & UV_HANDLE_CONNECTION)))) { - return ERROR_NOT_SUPPORTED; - } +static int uv__pipe_write_data(uv_loop_t* loop, + uv_write_t* req, + uv_pipe_t* handle, + const uv_buf_t bufs[], + size_t nbufs, + uv_write_cb cb, + int copy_always) { + int err; + int result; + uv_buf_t write_buf; assert(handle->handle != INVALID_HANDLE_VALUE); UV_REQ_INIT(req, UV_WRITE); req->handle = (uv_stream_t*) handle; + req->send_handle = NULL; req->cb = cb; - req->ipc_header = 0; + /* Private fields. */ + req->coalesced = 0; req->event_handle = NULL; req->wait_handle = INVALID_HANDLE_VALUE; memset(&req->u.io.overlapped, 0, sizeof(req->u.io.overlapped)); - - if (handle->ipc) { - assert(!(handle->flags & UV_HANDLE_NON_OVERLAPPED_PIPE)); - ipc_frame.header.flags = 0; - - /* Use the IPC framing protocol. */ - if (send_handle) { - tcp_send_handle = (uv_tcp_t*)send_handle; - - if (handle->pipe.conn.ipc_pid == 0) { - handle->pipe.conn.ipc_pid = uv_current_pid(); - } - - err = uv_tcp_duplicate_socket(tcp_send_handle, handle->pipe.conn.ipc_pid, - &ipc_frame.socket_info_ex.socket_info); - if (err) { - return err; - } - - ipc_frame.socket_info_ex.delayed_error = tcp_send_handle->delayed_error; - - ipc_frame.header.flags |= UV_IPC_TCP_SERVER; - - if (tcp_send_handle->flags & UV_HANDLE_CONNECTION) { - ipc_frame.header.flags |= UV_IPC_TCP_CONNECTION; - } - } - - if (nbufs == 1) { - ipc_frame.header.flags |= UV_IPC_RAW_DATA; - ipc_frame.header.raw_data_length = bufs[0].len; - } - - /* - * Use the provided req if we're only doing a single write. - * If we're doing multiple writes, use ipc_header_write_req to do - * the first write, and then use the provided req for the second write. - */ - if (!(ipc_frame.header.flags & UV_IPC_RAW_DATA)) { - ipc_header_req = req; - } else { - /* - * Try to use the preallocated write req if it's available. - * Otherwise allocate a new one. - */ - if (handle->pipe.conn.ipc_header_write_req.type != UV_WRITE) { - ipc_header_req = (uv_write_t*)&handle->pipe.conn.ipc_header_write_req; - } else { - ipc_header_req = (uv_write_t*)uv__malloc(sizeof(uv_write_t)); - if (!ipc_header_req) { - uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc"); - } - } - - UV_REQ_INIT(ipc_header_req, UV_WRITE); - ipc_header_req->handle = (uv_stream_t*) handle; - ipc_header_req->cb = NULL; - ipc_header_req->ipc_header = 1; - } - - /* Write the header or the whole frame. */ - memset(&ipc_header_req->u.io.overlapped, 0, - sizeof(ipc_header_req->u.io.overlapped)); - - /* Using overlapped IO, but wait for completion before returning. - This write is blocking because ipc_frame is on stack. */ - ipc_header_req->u.io.overlapped.hEvent = CreateEvent(NULL, 1, 0, NULL); - if (!ipc_header_req->u.io.overlapped.hEvent) { - uv_fatal_error(GetLastError(), "CreateEvent"); - } - - result = WriteFile(handle->handle, - &ipc_frame, - ipc_frame.header.flags & UV_IPC_TCP_SERVER ? - sizeof(ipc_frame) : sizeof(ipc_frame.header), - NULL, - &ipc_header_req->u.io.overlapped); - if (!result && GetLastError() != ERROR_IO_PENDING) { - err = GetLastError(); - CloseHandle(ipc_header_req->u.io.overlapped.hEvent); + req->write_buffer = uv_null_buf_; + + if (nbufs == 0) { + /* Write empty buffer. */ + write_buf = uv_null_buf_; + } else if (nbufs == 1 && !copy_always) { + /* Write directly from bufs[0]. */ + write_buf = bufs[0]; + } else { + /* Coalesce all `bufs` into one big buffer. This also creates a new + * write-request structure that replaces the old one. */ + err = uv__build_coalesced_write_req(req, bufs, nbufs, &req, &write_buf); + if (err != 0) return err; - } - - if (!result) { - /* Request not completed immediately. Wait for it.*/ - if (WaitForSingleObject(ipc_header_req->u.io.overlapped.hEvent, INFINITE) != - WAIT_OBJECT_0) { - err = GetLastError(); - CloseHandle(ipc_header_req->u.io.overlapped.hEvent); - return err; - } - } - ipc_header_req->u.io.queued_bytes = 0; - CloseHandle(ipc_header_req->u.io.overlapped.hEvent); - ipc_header_req->u.io.overlapped.hEvent = NULL; - - REGISTER_HANDLE_REQ(loop, handle, ipc_header_req); - handle->reqs_pending++; - handle->stream.conn.write_reqs_pending++; - - /* If we don't have any raw data to write - we're done. */ - if (!(ipc_frame.header.flags & UV_IPC_RAW_DATA)) { - return 0; - } } if ((handle->flags & (UV_HANDLE_BLOCKING_WRITES | UV_HANDLE_NON_OVERLAPPED_PIPE)) == (UV_HANDLE_BLOCKING_WRITES | UV_HANDLE_NON_OVERLAPPED_PIPE)) { DWORD bytes; - result = WriteFile(handle->handle, - bufs[0].base, - bufs[0].len, - &bytes, - NULL); + result = + WriteFile(handle->handle, write_buf.base, write_buf.len, &bytes, NULL); if (!result) { err = GetLastError(); @@ -1389,14 +1364,14 @@ static int uv_pipe_write_impl(uv_loop_t* loop, POST_COMPLETION_FOR_REQ(loop, req); return 0; } else if (handle->flags & UV_HANDLE_NON_OVERLAPPED_PIPE) { - req->write_buffer = bufs[0]; + req->write_buffer = write_buf; uv_insert_non_overlapped_write_req(handle, req); if (handle->stream.conn.write_reqs_pending == 0) { uv_queue_non_overlapped_write(handle); } /* Request queued by the kernel. */ - req->u.io.queued_bytes = bufs[0].len; + req->u.io.queued_bytes = write_buf.len; handle->write_queue_size += req->u.io.queued_bytes; } else if (handle->flags & UV_HANDLE_BLOCKING_WRITES) { /* Using overlapped IO, but wait for completion before returning */ @@ -1406,8 +1381,8 @@ static int uv_pipe_write_impl(uv_loop_t* loop, } result = WriteFile(handle->handle, - bufs[0].base, - bufs[0].len, + write_buf.base, + write_buf.len, NULL, &req->u.io.overlapped); @@ -1422,13 +1397,13 @@ static int uv_pipe_write_impl(uv_loop_t* loop, req->u.io.queued_bytes = 0; } else { /* Request queued by the kernel. */ - req->u.io.queued_bytes = bufs[0].len; + req->u.io.queued_bytes = write_buf.len; handle->write_queue_size += req->u.io.queued_bytes; if (WaitForSingleObject(req->u.io.overlapped.hEvent, INFINITE) != WAIT_OBJECT_0) { err = GetLastError(); CloseHandle(req->u.io.overlapped.hEvent); - return uv_translate_sys_error(err); + return err; } } CloseHandle(req->u.io.overlapped.hEvent); @@ -1439,8 +1414,8 @@ static int uv_pipe_write_impl(uv_loop_t* loop, return 0; } else { result = WriteFile(handle->handle, - bufs[0].base, - bufs[0].len, + write_buf.base, + write_buf.len, NULL, &req->u.io.overlapped); @@ -1453,7 +1428,7 @@ static int uv_pipe_write_impl(uv_loop_t* loop, req->u.io.queued_bytes = 0; } else { /* Request queued by the kernel. */ - req->u.io.queued_bytes = bufs[0].len; + req->u.io.queued_bytes = write_buf.len; handle->write_queue_size += req->u.io.queued_bytes; } @@ -1478,35 +1453,143 @@ static int uv_pipe_write_impl(uv_loop_t* loop, } -int uv_pipe_write(uv_loop_t* loop, - uv_write_t* req, - uv_pipe_t* handle, - const uv_buf_t bufs[], - unsigned int nbufs, - uv_write_cb cb) { - return uv_pipe_write_impl(loop, req, handle, bufs, nbufs, NULL, cb); +static DWORD uv__pipe_get_ipc_remote_pid(uv_pipe_t* handle) { + DWORD* pid = &handle->pipe.conn.ipc_remote_pid; + + /* If the both ends of the IPC pipe are owned by the same process, + * the remote end pid may not yet be set. If so, do it here. + * TODO: this is weird; it'd probably better to use a handshake. */ + if (*pid == 0) + *pid = GetCurrentProcessId(); + + return *pid; +} + + +int uv__pipe_write_ipc(uv_loop_t* loop, + uv_write_t* req, + uv_pipe_t* handle, + const uv_buf_t data_bufs[], + size_t data_buf_count, + uv_stream_t* send_handle, + uv_write_cb cb) { + uv_buf_t stack_bufs[6]; + uv_buf_t* bufs; + size_t buf_count, buf_index; + uv__ipc_frame_header_t frame_header; + uv__ipc_socket_xfer_type_t xfer_type = UV__IPC_SOCKET_XFER_NONE; + uv__ipc_socket_xfer_info_t xfer_info; + uint64_t data_length; + size_t i; + int err; + + /* Compute the combined size of data buffers. */ + data_length = 0; + for (i = 0; i < data_buf_count; i++) + data_length += data_bufs[i].len; + if (data_length > UINT32_MAX) + return WSAENOBUFS; /* Maps to UV_ENOBUFS. */ + + /* Prepare the frame's socket xfer payload. */ + if (send_handle != NULL) { + uv_tcp_t* send_tcp_handle = (uv_tcp_t*) send_handle; + + /* Verify that `send_handle` it is indeed a tcp handle. */ + if (send_tcp_handle->type != UV_TCP) + return ERROR_NOT_SUPPORTED; + + /* Export the tcp handle. */ + err = uv__tcp_xfer_export(send_tcp_handle, + uv__pipe_get_ipc_remote_pid(handle), + &xfer_type, + &xfer_info); + if (err != 0) + return err; + } + + /* Compute the number of uv_buf_t's required. */ + buf_count = 1 + data_buf_count; /* Frame header and data buffers. */ + if (send_handle != NULL) + buf_count += 1; /* One extra for the socket xfer information. */ + + /* Use the on-stack buffer array if it is big enough; otherwise allocate + * space for it on the heap. */ + if (buf_count < ARRAY_SIZE(stack_bufs)) { + /* Use on-stack buffer array. */ + bufs = stack_bufs; + } else { + /* Use heap-allocated buffer array. */ + bufs = uv__calloc(buf_count, sizeof(uv_buf_t)); + if (bufs == NULL) + return ERROR_NOT_ENOUGH_MEMORY; /* Maps to UV_ENOMEM. */ + } + buf_index = 0; + + /* Initialize frame header and add it to the buffers list. */ + memset(&frame_header, 0, sizeof frame_header); + bufs[buf_index++] = uv_buf_init((char*) &frame_header, sizeof frame_header); + + if (send_handle != NULL) { + /* Add frame header flags. */ + switch (xfer_type) { + case UV__IPC_SOCKET_XFER_TCP_CONNECTION: + frame_header.flags |= UV__IPC_FRAME_HAS_SOCKET_XFER | + UV__IPC_FRAME_XFER_IS_TCP_CONNECTION; + break; + case UV__IPC_SOCKET_XFER_TCP_SERVER: + frame_header.flags |= UV__IPC_FRAME_HAS_SOCKET_XFER; + break; + default: + assert(0); /* Unreachable. */ + } + /* Add xfer info buffer. */ + bufs[buf_index++] = uv_buf_init((char*) &xfer_info, sizeof xfer_info); + } + + if (data_length > 0) { + /* Update frame header. */ + frame_header.flags |= UV__IPC_FRAME_HAS_DATA; + frame_header.data_length = (uint32_t) data_length; + /* Add data buffers to buffers list. */ + for (i = 0; i < data_buf_count; i++) + bufs[buf_index++] = data_bufs[i]; + } + + /* Write buffers. We set the `always_copy` flag, so it is not a problem that + * some of the written data lives on the stack. */ + err = uv__pipe_write_data(loop, req, handle, bufs, buf_count, cb, 1); + + /* If we had to heap-allocate the bufs array, free it now. */ + if (bufs != stack_bufs) { + uv__free(bufs); + } + + return err; } -int uv_pipe_write2(uv_loop_t* loop, +int uv__pipe_write(uv_loop_t* loop, uv_write_t* req, uv_pipe_t* handle, const uv_buf_t bufs[], - unsigned int nbufs, + size_t nbufs, uv_stream_t* send_handle, uv_write_cb cb) { - if (!handle->ipc) { - return WSAEINVAL; + if (handle->ipc) { + /* IPC pipe write: use framing protocol. */ + return uv__pipe_write_ipc(loop, req, handle, bufs, nbufs, send_handle, cb); + } else { + /* Non-IPC pipe write: put data on the wire directly. */ + assert(send_handle == NULL); + return uv__pipe_write_data(loop, req, handle, bufs, nbufs, cb, 0); } - - return uv_pipe_write_impl(loop, req, handle, bufs, nbufs, send_handle, cb); } static void uv_pipe_read_eof(uv_loop_t* loop, uv_pipe_t* handle, uv_buf_t buf) { - /* If there is an eof timer running, we don't need it any more, */ - /* so discard it. */ + /* If there is an eof timer running, we don't need it any more, so discard + * it. */ eof_timer_destroy(handle); handle->flags &= ~UV_HANDLE_READABLE; @@ -1518,8 +1601,8 @@ static void uv_pipe_read_eof(uv_loop_t* loop, uv_pipe_t* handle, static void uv_pipe_read_error(uv_loop_t* loop, uv_pipe_t* handle, int error, uv_buf_t buf) { - /* If there is an eof timer running, we don't need it any more, */ - /* so discard it. */ + /* If there is an eof timer running, we don't need it any more, so discard + * it. */ eof_timer_destroy(handle); uv_read_stop((uv_stream_t*) handle); @@ -1530,10 +1613,7 @@ static void uv_pipe_read_error(uv_loop_t* loop, uv_pipe_t* handle, int error, static void uv_pipe_read_error_or_eof(uv_loop_t* loop, uv_pipe_t* handle, int error, uv_buf_t buf) { - if (error == ERROR_OPERATION_ABORTED) { - /* do nothing (equivalent to EINTR) */ - } - else if (error == ERROR_BROKEN_PIPE) { + if (error == ERROR_BROKEN_PIPE) { uv_pipe_read_eof(loop, handle, buf); } else { uv_pipe_read_error(loop, handle, error, buf); @@ -1541,152 +1621,228 @@ static void uv_pipe_read_error_or_eof(uv_loop_t* loop, uv_pipe_t* handle, } -void uv__pipe_insert_pending_socket(uv_pipe_t* handle, - uv__ipc_socket_info_ex* info, - int tcp_connection) { - uv__ipc_queue_item_t* item; +static void uv__pipe_queue_ipc_xfer_info( + uv_pipe_t* handle, + uv__ipc_socket_xfer_type_t xfer_type, + uv__ipc_socket_xfer_info_t* xfer_info) { + uv__ipc_xfer_queue_item_t* item; - item = (uv__ipc_queue_item_t*) uv__malloc(sizeof(*item)); + item = (uv__ipc_xfer_queue_item_t*) uv__malloc(sizeof(*item)); if (item == NULL) uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc"); - memcpy(&item->socket_info_ex, info, sizeof(item->socket_info_ex)); - item->tcp_connection = tcp_connection; - QUEUE_INSERT_TAIL(&handle->pipe.conn.pending_ipc_info.queue, &item->member); - handle->pipe.conn.pending_ipc_info.queue_len++; + item->xfer_type = xfer_type; + item->xfer_info = *xfer_info; + + QUEUE_INSERT_TAIL(&handle->pipe.conn.ipc_xfer_queue, &item->member); + handle->pipe.conn.ipc_xfer_queue_length++; +} + + +/* Read an exact number of bytes from a pipe. If an error or end-of-file is + * encountered before the requested number of bytes are read, an error is + * returned. */ +static int uv__pipe_read_exactly(HANDLE h, void* buffer, DWORD count) { + DWORD bytes_read, bytes_read_now; + + bytes_read = 0; + while (bytes_read < count) { + if (!ReadFile(h, + (char*) buffer + bytes_read, + count - bytes_read, + &bytes_read_now, + NULL)) { + return GetLastError(); + } + + bytes_read += bytes_read_now; + } + + assert(bytes_read == count); + return 0; } -void uv_process_pipe_read_req(uv_loop_t* loop, uv_pipe_t* handle, - uv_req_t* req) { - DWORD bytes, avail; +static DWORD uv__pipe_read_data(uv_loop_t* loop, + uv_pipe_t* handle, + DWORD suggested_bytes, + DWORD max_bytes) { + DWORD bytes_read; uv_buf_t buf; - uv_ipc_frame_uv_stream ipc_frame; + /* Ask the user for a buffer to read data into. */ + buf = uv_buf_init(NULL, 0); + handle->alloc_cb((uv_handle_t*) handle, suggested_bytes, &buf); + if (buf.base == NULL || buf.len == 0) { + handle->read_cb((uv_stream_t*) handle, UV_ENOBUFS, &buf); + return 0; /* Break out of read loop. */ + } + + /* Ensure we read at most the smaller of: + * (a) the length of the user-allocated buffer. + * (b) the maximum data length as specified by the `max_bytes` argument. + */ + if (max_bytes > buf.len) + max_bytes = buf.len; + + /* Read into the user buffer. */ + if (!ReadFile(handle->handle, buf.base, max_bytes, &bytes_read, NULL)) { + uv_pipe_read_error_or_eof(loop, handle, GetLastError(), buf); + return 0; /* Break out of read loop. */ + } + + /* Call the read callback. */ + handle->read_cb((uv_stream_t*) handle, bytes_read, &buf); + + return bytes_read; +} + + +static DWORD uv__pipe_read_ipc(uv_loop_t* loop, uv_pipe_t* handle) { + uint32_t* data_remaining = &handle->pipe.conn.ipc_data_frame.payload_remaining; + int err; + + if (*data_remaining > 0) { + /* Read frame data payload. */ + DWORD bytes_read = + uv__pipe_read_data(loop, handle, *data_remaining, *data_remaining); + *data_remaining -= bytes_read; + return bytes_read; + + } else { + /* Start of a new IPC frame. */ + uv__ipc_frame_header_t frame_header; + uint32_t xfer_flags; + uv__ipc_socket_xfer_type_t xfer_type; + uv__ipc_socket_xfer_info_t xfer_info; + + /* Read the IPC frame header. */ + err = uv__pipe_read_exactly( + handle->handle, &frame_header, sizeof frame_header); + if (err) + goto error; + + /* Validate that flags are valid. */ + if ((frame_header.flags & ~UV__IPC_FRAME_VALID_FLAGS) != 0) + goto invalid; + /* Validate that reserved2 is zero. */ + if (frame_header.reserved2 != 0) + goto invalid; + + /* Parse xfer flags. */ + xfer_flags = frame_header.flags & UV__IPC_FRAME_XFER_FLAGS; + if (xfer_flags & UV__IPC_FRAME_HAS_SOCKET_XFER) { + /* Socket coming -- determine the type. */ + xfer_type = xfer_flags & UV__IPC_FRAME_XFER_IS_TCP_CONNECTION + ? UV__IPC_SOCKET_XFER_TCP_CONNECTION + : UV__IPC_SOCKET_XFER_TCP_SERVER; + } else if (xfer_flags == 0) { + /* No socket. */ + xfer_type = UV__IPC_SOCKET_XFER_NONE; + } else { + /* Invalid flags. */ + goto invalid; + } + + /* Parse data frame information. */ + if (frame_header.flags & UV__IPC_FRAME_HAS_DATA) { + *data_remaining = frame_header.data_length; + } else if (frame_header.data_length != 0) { + /* Data length greater than zero but data flag not set -- invalid. */ + goto invalid; + } + + /* If no socket xfer info follows, return here. Data will be read in a + * subsequent invocation of uv__pipe_read_ipc(). */ + if (xfer_type == UV__IPC_SOCKET_XFER_NONE) + return sizeof frame_header; /* Number of bytes read. */ + + /* Read transferred socket information. */ + err = uv__pipe_read_exactly(handle->handle, &xfer_info, sizeof xfer_info); + if (err) + goto error; + + /* Store the pending socket info. */ + uv__pipe_queue_ipc_xfer_info(handle, xfer_type, &xfer_info); + + /* Return number of bytes read. */ + return sizeof frame_header + sizeof xfer_info; + } + +invalid: + /* Invalid frame. */ + err = WSAECONNABORTED; /* Maps to UV_ECONNABORTED. */ + +error: + uv_pipe_read_error_or_eof(loop, handle, err, uv_null_buf_); + return 0; /* Break out of read loop. */ +} + + +void uv_process_pipe_read_req(uv_loop_t* loop, + uv_pipe_t* handle, + uv_req_t* req) { assert(handle->type == UV_NAMED_PIPE); - handle->flags &= ~UV_HANDLE_READ_PENDING; + handle->flags &= ~(UV_HANDLE_READ_PENDING | UV_HANDLE_CANCELLATION_PENDING); + DECREASE_PENDING_REQ_COUNT(handle); eof_timer_stop(handle); - if (!REQ_SUCCESS(req)) { - /* An error occurred doing the 0-read. */ - if (handle->flags & UV_HANDLE_READING) { - uv_pipe_read_error_or_eof(loop, - handle, - GET_REQ_ERROR(req), - uv_null_buf_); - } - } else { - /* Do non-blocking reads until the buffer is empty */ - while (handle->flags & UV_HANDLE_READING) { - if (!PeekNamedPipe(handle->handle, - NULL, - 0, - NULL, - &avail, - NULL)) { - uv_pipe_read_error_or_eof(loop, handle, GetLastError(), uv_null_buf_); - break; - } + /* At this point, we're done with bookkeeping. If the user has stopped + * reading the pipe in the meantime, there is nothing left to do, since there + * is no callback that we can call. */ + if (!(handle->flags & UV_HANDLE_READING)) + return; - if (avail == 0) { - /* There is nothing to read after all. */ - break; - } + if (!REQ_SUCCESS(req)) { + /* An error occurred doing the zero-read. */ + DWORD err = GET_REQ_ERROR(req); - if (handle->ipc) { - /* Use the IPC framing protocol to read the incoming data. */ - if (handle->pipe.conn.remaining_ipc_rawdata_bytes == 0) { - /* We're reading a new frame. First, read the header. */ - assert(avail >= sizeof(ipc_frame.header)); - - if (!ReadFile(handle->handle, - &ipc_frame.header, - sizeof(ipc_frame.header), - &bytes, - NULL)) { - uv_pipe_read_error_or_eof(loop, handle, GetLastError(), - uv_null_buf_); - break; - } - - assert(bytes == sizeof(ipc_frame.header)); - assert(ipc_frame.header.flags <= (UV_IPC_TCP_SERVER | UV_IPC_RAW_DATA | - UV_IPC_TCP_CONNECTION)); - - if (ipc_frame.header.flags & UV_IPC_TCP_SERVER) { - assert(avail - sizeof(ipc_frame.header) >= - sizeof(ipc_frame.socket_info_ex)); - - /* Read the TCP socket info. */ - if (!ReadFile(handle->handle, - &ipc_frame.socket_info_ex, - sizeof(ipc_frame) - sizeof(ipc_frame.header), - &bytes, - NULL)) { - uv_pipe_read_error_or_eof(loop, handle, GetLastError(), - uv_null_buf_); - break; - } - - assert(bytes == sizeof(ipc_frame) - sizeof(ipc_frame.header)); - - /* Store the pending socket info. */ - uv__pipe_insert_pending_socket( - handle, - &ipc_frame.socket_info_ex, - ipc_frame.header.flags & UV_IPC_TCP_CONNECTION); - } - - if (ipc_frame.header.flags & UV_IPC_RAW_DATA) { - handle->pipe.conn.remaining_ipc_rawdata_bytes = - ipc_frame.header.raw_data_length; - continue; - } - } else { - avail = min(avail, (DWORD)handle->pipe.conn.remaining_ipc_rawdata_bytes); - } - } + /* If the read was cancelled by uv__pipe_interrupt_read(), the request may + * indicate an ERROR_OPERATION_ABORTED error. This error isn't relevant to + * the user; we'll start a new zero-read at the end of this function. */ + if (err != ERROR_OPERATION_ABORTED) + uv_pipe_read_error_or_eof(loop, handle, err, uv_null_buf_); - buf = uv_buf_init(NULL, 0); - handle->alloc_cb((uv_handle_t*) handle, avail, &buf); - if (buf.base == NULL || buf.len == 0) { - handle->read_cb((uv_stream_t*) handle, UV_ENOBUFS, &buf); + } else { + /* The zero-read completed without error, indicating there is data + * available in the kernel buffer. */ + DWORD avail; + + /* Get the number of bytes available. */ + avail = 0; + if (!PeekNamedPipe(handle->handle, NULL, 0, NULL, &avail, NULL)) + uv_pipe_read_error_or_eof(loop, handle, GetLastError(), uv_null_buf_); + + /* Read until we've either read all the bytes available, or the 'reading' + * flag is cleared. */ + while (avail > 0 && handle->flags & UV_HANDLE_READING) { + /* Depending on the type of pipe, read either IPC frames or raw data. */ + DWORD bytes_read = + handle->ipc ? uv__pipe_read_ipc(loop, handle) + : uv__pipe_read_data(loop, handle, avail, (DWORD) -1); + + /* If no bytes were read, treat this as an indication that an error + * occurred, and break out of the read loop. */ + if (bytes_read == 0) break; - } - assert(buf.base != NULL); - - if (ReadFile(handle->handle, - buf.base, - min(buf.len, avail), - &bytes, - NULL)) { - /* Successful read */ - if (handle->ipc) { - assert(handle->pipe.conn.remaining_ipc_rawdata_bytes >= bytes); - handle->pipe.conn.remaining_ipc_rawdata_bytes = - handle->pipe.conn.remaining_ipc_rawdata_bytes - bytes; - } - handle->read_cb((uv_stream_t*)handle, bytes, &buf); - /* Read again only if bytes == buf.len */ - if (bytes <= buf.len) { - break; - } - } else { - uv_pipe_read_error_or_eof(loop, handle, GetLastError(), buf); + /* It is possible that more bytes were read than we thought were + * available. To prevent `avail` from underflowing, break out of the loop + * if this is the case. */ + if (bytes_read > avail) break; - } - } - /* Post another 0-read if still reading and not closing. */ - if ((handle->flags & UV_HANDLE_READING) && - !(handle->flags & UV_HANDLE_READ_PENDING)) { - uv_pipe_queue_read(loop, handle); + /* Recompute the number of bytes available. */ + avail -= bytes_read; } } - DECREASE_PENDING_REQ_COUNT(handle); + /* Start another zero-read request if necessary. */ + if ((handle->flags & UV_HANDLE_READING) && + !(handle->flags & UV_HANDLE_READ_PENDING)) { + uv_pipe_queue_read(loop, handle); + } } @@ -1712,17 +1868,19 @@ void uv_process_pipe_write_req(uv_loop_t* loop, uv_pipe_t* handle, } } - if (req->ipc_header) { - if (req == &handle->pipe.conn.ipc_header_write_req) { - req->type = UV_UNKNOWN_REQ; - } else { - uv__free(req); - } - } else { - if (req->cb) { - err = GET_REQ_ERROR(req); - req->cb(req, uv_translate_sys_error(err)); - } + err = GET_REQ_ERROR(req); + + /* If this was a coalesced write, extract pointer to the user_provided + * uv_write_t structure so we can pass the expected pointer to the callback, + * then free the heap-allocated write req. */ + if (req->coalesced) { + uv__coalesced_write_t* coalesced_write = + container_of(req, uv__coalesced_write_t, req); + req = coalesced_write->user_req; + uv__free(coalesced_write); + } + if (req->cb) { + req->cb(req, uv_translate_sys_error(err)); } handle->stream.conn.write_reqs_pending--; @@ -1748,7 +1906,7 @@ void uv_process_pipe_accept_req(uv_loop_t* loop, uv_pipe_t* handle, assert(handle->type == UV_NAMED_PIPE); - if (handle->flags & UV__HANDLE_CLOSING) { + if (handle->flags & UV_HANDLE_CLOSING) { /* The req->pipeHandle should be freed already in uv_pipe_cleanup(). */ assert(req->pipeHandle == INVALID_HANDLE_VALUE); DECREASE_PENDING_REQ_COUNT(handle); @@ -1768,7 +1926,7 @@ void uv_process_pipe_accept_req(uv_loop_t* loop, uv_pipe_t* handle, CloseHandle(req->pipeHandle); req->pipeHandle = INVALID_HANDLE_VALUE; } - if (!(handle->flags & UV__HANDLE_CLOSING)) { + if (!(handle->flags & UV_HANDLE_CLOSING)) { uv_pipe_queue_accept(loop, handle, req, FALSE); } } @@ -1806,19 +1964,19 @@ void uv_process_pipe_shutdown_req(uv_loop_t* loop, uv_pipe_t* handle, UNREGISTER_HANDLE_REQ(loop, handle, req); if (handle->flags & UV_HANDLE_READABLE) { - /* Initialize and optionally start the eof timer. Only do this if the */ - /* pipe is readable and we haven't seen EOF come in ourselves. */ + /* Initialize and optionally start the eof timer. Only do this if the pipe + * is readable and we haven't seen EOF come in ourselves. */ eof_timer_init(handle); - /* If reading start the timer right now. */ - /* Otherwise uv_pipe_queue_read will start it. */ + /* If reading start the timer right now. Otherwise uv_pipe_queue_read will + * start it. */ if (handle->flags & UV_HANDLE_READ_PENDING) { eof_timer_start(handle); } } else { - /* This pipe is not readable. We can just close it to let the other end */ - /* know that we're done writing. */ + /* This pipe is not readable. We can just close it to let the other end + * know that we're done writing. */ close_pipe(handle); } @@ -1869,17 +2027,16 @@ static void eof_timer_cb(uv_timer_t* timer) { assert(pipe->type == UV_NAMED_PIPE); - /* This should always be true, since we start the timer only */ - /* in uv_pipe_queue_read after successfully calling ReadFile, */ - /* or in uv_process_pipe_shutdown_req if a read is pending, */ - /* and we always immediately stop the timer in */ - /* uv_process_pipe_read_req. */ + /* This should always be true, since we start the timer only in + * uv_pipe_queue_read after successfully calling ReadFile, or in + * uv_process_pipe_shutdown_req if a read is pending, and we always + * immediately stop the timer in uv_process_pipe_read_req. */ assert(pipe->flags & UV_HANDLE_READ_PENDING); - /* If there are many packets coming off the iocp then the timer callback */ - /* may be called before the read request is coming off the queue. */ - /* Therefore we check here if the read request has completed but will */ - /* be processed later. */ + /* If there are many packets coming off the iocp then the timer callback may + * be called before the read request is coming off the queue. Therefore we + * check here if the read request has completed but will be processed later. + */ if ((pipe->flags & UV_HANDLE_READ_PENDING) && HasOverlappedIoCompleted(&pipe->read_req.u.io.overlapped)) { return; @@ -1888,12 +2045,12 @@ static void eof_timer_cb(uv_timer_t* timer) { /* Force both ends off the pipe. */ close_pipe(pipe); - /* Stop reading, so the pending read that is going to fail will */ - /* not be reported to the user. */ + /* Stop reading, so the pending read that is going to fail will not be + * reported to the user. */ uv_read_stop((uv_stream_t*) pipe); - /* Report the eof and update flags. This will get reported even if the */ - /* user stopped reading in the meantime. TODO: is that okay? */ + /* Report the eof and update flags. This will get reported even if the user + * stopped reading in the meantime. TODO: is that okay? */ uv_pipe_read_eof(loop, pipe, uv_null_buf_); } @@ -1980,8 +2137,8 @@ int uv_pipe_open(uv_pipe_t* pipe, uv_file file) { if (pipe->ipc) { assert(!(pipe->flags & UV_HANDLE_NON_OVERLAPPED_PIPE)); - pipe->pipe.conn.ipc_pid = uv_os_getppid(); - assert(pipe->pipe.conn.ipc_pid != -1); + pipe->pipe.conn.ipc_remote_pid = uv_os_getppid(); + assert(pipe->pipe.conn.ipc_remote_pid != (DWORD) -1); } return 0; } @@ -2006,7 +2163,15 @@ static int uv__pipe_getname(const uv_pipe_t* handle, char* buffer, size_t* size) return UV_EINVAL; } - uv__pipe_pause_read((uv_pipe_t*)handle); /* cast away const warning */ + /* NtQueryInformationFile will block if another thread is performing a + * blocking operation on the queried handle. If the pipe handle is + * synchronous, there may be a worker thread currently calling ReadFile() on + * the pipe handle, which could cause a deadlock. To avoid this, interrupt + * the read. */ + if (handle->flags & UV_HANDLE_CONNECTION && + handle->flags & UV_HANDLE_NON_OVERLAPPED_PIPE) { + uv__pipe_interrupt_read((uv_pipe_t*) handle); /* cast away const warning */ + } nt_status = pNtQueryInformationFile(handle->handle, &io_status, @@ -2097,7 +2262,6 @@ error: uv__free(name_info); cleanup: - uv__pipe_unpause_read((uv_pipe_t*)handle); /* cast away const warning */ return err; } @@ -2105,7 +2269,7 @@ cleanup: int uv_pipe_pending_count(uv_pipe_t* handle) { if (!handle->ipc) return 0; - return handle->pipe.conn.pending_ipc_info.queue_len; + return handle->pipe.conn.ipc_xfer_queue_length; } @@ -2138,14 +2302,14 @@ int uv_pipe_getpeername(const uv_pipe_t* handle, char* buffer, size_t* size) { uv_handle_type uv_pipe_pending_type(uv_pipe_t* handle) { if (!handle->ipc) return UV_UNKNOWN_HANDLE; - if (handle->pipe.conn.pending_ipc_info.queue_len == 0) + if (handle->pipe.conn.ipc_xfer_queue_length == 0) return UV_UNKNOWN_HANDLE; else return UV_TCP; } int uv_pipe_chmod(uv_pipe_t* handle, int mode) { - SID_IDENTIFIER_AUTHORITY sid_world = SECURITY_WORLD_SID_AUTHORITY; + SID_IDENTIFIER_AUTHORITY sid_world = { SECURITY_WORLD_SID_AUTHORITY }; PACL old_dacl, new_dacl; PSECURITY_DESCRIPTOR sd; EXPLICIT_ACCESS ea; @@ -2180,7 +2344,7 @@ int uv_pipe_chmod(uv_pipe_t* handle, int mode) { error = GetLastError(); goto clean_sid; } - + memset(&ea, 0, sizeof(EXPLICIT_ACCESS)); if (mode & UV_READABLE) ea.grfAccessPermissions |= GENERIC_READ | FILE_WRITE_ATTRIBUTES; diff --git a/src/win/poll.c b/src/win/poll.c index a648ba7..3c66786 100644 --- a/src/win/poll.c +++ b/src/win/poll.c @@ -75,7 +75,7 @@ static AFD_POLL_INFO* uv__get_afd_poll_info_dummy(void) { static void uv__fast_poll_submit_poll_req(uv_loop_t* loop, uv_poll_t* handle) { uv_req_t* req; AFD_POLL_INFO* afd_poll_info; - DWORD result; + int result; /* Find a yet unsubmitted req to submit. */ if (handle->submitted_events_1 == 0) { @@ -91,16 +91,16 @@ static void uv__fast_poll_submit_poll_req(uv_loop_t* loop, uv_poll_t* handle) { handle->mask_events_1 = handle->events; handle->mask_events_2 = 0; } else { - /* Just wait until there's an unsubmitted req. */ - /* This will happen almost immediately as one of the 2 outstanding */ - /* requests is about to return. When this happens, */ - /* uv__fast_poll_process_poll_req will be called, and the pending */ - /* events, if needed, will be processed in a subsequent request. */ + /* Just wait until there's an unsubmitted req. This will happen almost + * immediately as one of the 2 outstanding requests is about to return. + * When this happens, uv__fast_poll_process_poll_req will be called, and + * the pending events, if needed, will be processed in a subsequent + * request. */ return; } - /* Setting Exclusive to TRUE makes the other poll request return if there */ - /* is any. */ + /* Setting Exclusive to TRUE makes the other poll request return if there is + * any. */ afd_poll_info->Exclusive = TRUE; afd_poll_info->NumberOfHandles = 1; afd_poll_info->Timeout.QuadPart = INT64_MAX; @@ -136,7 +136,7 @@ static void uv__fast_poll_submit_poll_req(uv_loop_t* loop, uv_poll_t* handle) { static int uv__fast_poll_cancel_poll_req(uv_loop_t* loop, uv_poll_t* handle) { AFD_POLL_INFO afd_poll_info; - DWORD result; + int result; afd_poll_info.Exclusive = TRUE; afd_poll_info.NumberOfHandles = 1; @@ -218,7 +218,7 @@ static void uv__fast_poll_process_poll_req(uv_loop_t* loop, uv_poll_t* handle, if ((handle->events & ~(handle->submitted_events_1 | handle->submitted_events_2)) != 0) { uv__fast_poll_submit_poll_req(loop, handle); - } else if ((handle->flags & UV__HANDLE_CLOSING) && + } else if ((handle->flags & UV_HANDLE_CLOSING) && handle->submitted_events_1 == 0 && handle->submitted_events_2 == 0) { uv_want_endgame(loop, (uv_handle_t*) handle); @@ -228,7 +228,7 @@ static void uv__fast_poll_process_poll_req(uv_loop_t* loop, uv_poll_t* handle, static int uv__fast_poll_set(uv_loop_t* loop, uv_poll_t* handle, int events) { assert(handle->type == UV_POLL); - assert(!(handle->flags & UV__HANDLE_CLOSING)); + assert(!(handle->flags & UV_HANDLE_CLOSING)); assert((events & ~(UV_READABLE | UV_WRITABLE | UV_DISCONNECT)) == 0); handle->events = events; @@ -257,8 +257,8 @@ static int uv__fast_poll_close(uv_loop_t* loop, uv_poll_t* handle) { uv_want_endgame(loop, (uv_handle_t*) handle); return 0; } else { - /* Cancel outstanding poll requests by executing another, unique poll */ - /* request that forces the outstanding ones to return. */ + /* Cancel outstanding poll requests by executing another, unique poll + * request that forces the outstanding ones to return. */ return uv__fast_poll_cancel_poll_req(loop, handle); } } @@ -316,9 +316,8 @@ static SOCKET uv__fast_poll_get_peer_socket(uv_loop_t* loop, return INVALID_SOCKET; } - /* If we didn't (try) to create a peer socket yet, try to make one. Don't */ - /* try again if the peer socket creation failed earlier for the same */ - /* protocol. */ + /* If we didn't (try) to create a peer socket yet, try to make one. Don't try + * again if the peer socket creation failed earlier for the same protocol. */ peer_socket = loop->poll_peer_sockets[index]; if (peer_socket == 0) { peer_socket = uv__fast_poll_create_peer_socket(loop->iocp, protocol_info); @@ -357,8 +356,8 @@ static DWORD WINAPI uv__slow_poll_thread_proc(void* arg) { efds.fd_count = 0; } - /* Make the select() time out after 3 minutes. If select() hangs because */ - /* the user closed the socket, we will at least not hang indefinitely. */ + /* Make the select() time out after 3 minutes. If select() hangs because the + * user closed the socket, we will at least not hang indefinitely. */ timeout.tv_sec = 3 * 60; timeout.tv_usec = 0; @@ -462,7 +461,7 @@ static void uv__slow_poll_process_poll_req(uv_loop_t* loop, uv_poll_t* handle, if ((handle->events & ~(handle->submitted_events_1 | handle->submitted_events_2)) != 0) { uv__slow_poll_submit_poll_req(loop, handle); - } else if ((handle->flags & UV__HANDLE_CLOSING) && + } else if ((handle->flags & UV_HANDLE_CLOSING) && handle->submitted_events_1 == 0 && handle->submitted_events_2 == 0) { uv_want_endgame(loop, (uv_handle_t*) handle); @@ -472,7 +471,7 @@ static void uv__slow_poll_process_poll_req(uv_loop_t* loop, uv_poll_t* handle, static int uv__slow_poll_set(uv_loop_t* loop, uv_poll_t* handle, int events) { assert(handle->type == UV_POLL); - assert(!(handle->flags & UV__HANDLE_CLOSING)); + assert(!(handle->flags & UV_HANDLE_CLOSING)); assert((events & ~(UV_READABLE | UV_WRITABLE)) == 0); handle->events = events; @@ -522,10 +521,10 @@ int uv_poll_init_socket(uv_loop_t* loop, uv_poll_t* handle, if (ioctlsocket(socket, FIONBIO, &yes) == SOCKET_ERROR) return uv_translate_sys_error(WSAGetLastError()); - /* Try to obtain a base handle for the socket. This increases this chances */ - /* that we find an AFD handle and are able to use the fast poll mechanism. */ - /* This will always fail on windows XP/2k3, since they don't support the */ - /* SIO_BASE_HANDLE ioctl. */ +/* Try to obtain a base handle for the socket. This increases this chances that + * we find an AFD handle and are able to use the fast poll mechanism. This will + * always fail on windows XP/2k3, since they don't support the. SIO_BASE_HANDLE + * ioctl. */ #ifndef NDEBUG base_socket = INVALID_SOCKET; #endif @@ -557,9 +556,9 @@ int uv_poll_init_socket(uv_loop_t* loop, uv_poll_t* handle, return uv_translate_sys_error(WSAGetLastError()); } - /* Get the peer socket that is needed to enable fast poll. If the returned */ - /* value is NULL, the protocol is not implemented by MSAFD and we'll have */ - /* to use slow mode. */ + /* Get the peer socket that is needed to enable fast poll. If the returned + * value is NULL, the protocol is not implemented by MSAFD and we'll have to + * use slow mode. */ peer_socket = uv__fast_poll_get_peer_socket(loop, &protocol_info); if (peer_socket != INVALID_SOCKET) { @@ -634,7 +633,7 @@ int uv_poll_close(uv_loop_t* loop, uv_poll_t* handle) { void uv_poll_endgame(uv_loop_t* loop, uv_poll_t* handle) { - assert(handle->flags & UV__HANDLE_CLOSING); + assert(handle->flags & UV_HANDLE_CLOSING); assert(!(handle->flags & UV_HANDLE_CLOSED)); assert(handle->submitted_events_1 == 0); diff --git a/src/win/process-stdio.c b/src/win/process-stdio.c index 032e309..355d618 100644 --- a/src/win/process-stdio.c +++ b/src/win/process-stdio.c @@ -103,12 +103,12 @@ static int uv__create_stdio_pipe_pair(uv_loop_t* loop, DWORD client_access = 0; HANDLE child_pipe = INVALID_HANDLE_VALUE; int err; + int overlap; if (flags & UV_READABLE_PIPE) { - /* The server needs inbound access too, otherwise CreateNamedPipe() */ - /* won't give us the FILE_READ_ATTRIBUTES permission. We need that to */ - /* probe the state of the write buffer when we're trying to shutdown */ - /* the pipe. */ + /* The server needs inbound access too, otherwise CreateNamedPipe() won't + * give us the FILE_READ_ATTRIBUTES permission. We need that to probe the + * state of the write buffer when we're trying to shutdown the pipe. */ server_access |= PIPE_ACCESS_OUTBOUND | PIPE_ACCESS_INBOUND; client_access |= GENERIC_READ | FILE_WRITE_ATTRIBUTES; } @@ -131,12 +131,13 @@ static int uv__create_stdio_pipe_pair(uv_loop_t* loop, sa.lpSecurityDescriptor = NULL; sa.bInheritHandle = TRUE; + overlap = server_pipe->ipc || (flags & UV_OVERLAPPED_PIPE); child_pipe = CreateFileA(pipe_name, client_access, 0, &sa, OPEN_EXISTING, - server_pipe->ipc ? FILE_FLAG_OVERLAPPED : 0, + overlap ? FILE_FLAG_OVERLAPPED : 0, NULL); if (child_pipe == INVALID_HANDLE_VALUE) { err = GetLastError(); @@ -159,8 +160,8 @@ static int uv__create_stdio_pipe_pair(uv_loop_t* loop, } #endif - /* Do a blocking ConnectNamedPipe. This should not block because we have */ - /* both ends of the pipe created. */ + /* Do a blocking ConnectNamedPipe. This should not block because we have both + * ends of the pipe created. */ if (!ConnectNamedPipe(server_pipe->handle, NULL)) { if (GetLastError() != ERROR_PIPE_CONNECTED) { err = GetLastError(); @@ -194,11 +195,11 @@ static int uv__duplicate_handle(uv_loop_t* loop, HANDLE handle, HANDLE* dup) { HANDLE current_process; - /* _get_osfhandle will sometimes return -2 in case of an error. This seems */ - /* to happen when fd <= 2 and the process' corresponding stdio handle is */ - /* set to NULL. Unfortunately DuplicateHandle will happily duplicate */ - /* (HANDLE) -2, so this situation goes unnoticed until someone tries to */ - /* use the duplicate. Therefore we filter out known-invalid handles here. */ + /* _get_osfhandle will sometimes return -2 in case of an error. This seems to + * happen when fd <= 2 and the process' corresponding stdio handle is set to + * NULL. Unfortunately DuplicateHandle will happily duplicate (HANDLE) -2, so + * this situation goes unnoticed until someone tries to use the duplicate. + * Therefore we filter out known-invalid handles here. */ if (handle == INVALID_HANDLE_VALUE || handle == NULL || handle == (HANDLE) -2) { @@ -284,8 +285,8 @@ int uv__stdio_create(uv_loop_t* loop, return ERROR_OUTOFMEMORY; } - /* Prepopulate the buffer with INVALID_HANDLE_VALUE handles so we can */ - /* clean up on failure. */ + /* Prepopulate the buffer with INVALID_HANDLE_VALUE handles so we can clean + * up on failure. */ CHILD_STDIO_COUNT(buffer) = count; for (i = 0; i < count; i++) { CHILD_STDIO_CRT_FLAGS(buffer, i) = 0; @@ -303,12 +304,12 @@ int uv__stdio_create(uv_loop_t* loop, switch (fdopt.flags & (UV_IGNORE | UV_CREATE_PIPE | UV_INHERIT_FD | UV_INHERIT_STREAM)) { case UV_IGNORE: - /* Starting a process with no stdin/stout/stderr can confuse it. */ - /* So no matter what the user specified, we make sure the first */ - /* three FDs are always open in their typical modes, e.g. stdin */ - /* be readable and stdout/err should be writable. For FDs > 2, don't */ - /* do anything - all handles in the stdio buffer are initialized with */ - /* INVALID_HANDLE_VALUE, which should be okay. */ + /* Starting a process with no stdin/stout/stderr can confuse it. So no + * matter what the user specified, we make sure the first three FDs are + * always open in their typical modes, e. g. stdin be readable and + * stdout/err should be writable. For FDs > 2, don't do anything - all + * handles in the stdio buffer are initialized with. + * INVALID_HANDLE_VALUE, which should be okay. */ if (i <= 2) { DWORD access = (i == 0) ? FILE_GENERIC_READ : FILE_GENERIC_WRITE | FILE_READ_ATTRIBUTES; @@ -323,14 +324,14 @@ int uv__stdio_create(uv_loop_t* loop, break; case UV_CREATE_PIPE: { - /* Create a pair of two connected pipe ends; one end is turned into */ - /* an uv_pipe_t for use by the parent. The other one is given to */ - /* the child. */ + /* Create a pair of two connected pipe ends; one end is turned into an + * uv_pipe_t for use by the parent. The other one is given to the + * child. */ uv_pipe_t* parent_pipe = (uv_pipe_t*) fdopt.data.stream; HANDLE child_pipe = INVALID_HANDLE_VALUE; - /* Create a new, connected pipe pair. stdio[i].stream should point */ - /* to an uninitialized, but not connected pipe handle. */ + /* Create a new, connected pipe pair. stdio[i]. stream should point to + * an uninitialized, but not connected pipe handle. */ assert(fdopt.data.stream->type == UV_NAMED_PIPE); assert(!(fdopt.data.stream->flags & UV_HANDLE_CONNECTION)); assert(!(fdopt.data.stream->flags & UV_HANDLE_PIPESERVER)); @@ -354,8 +355,8 @@ int uv__stdio_create(uv_loop_t* loop, /* Make an inheritable duplicate of the handle. */ err = uv__duplicate_fd(loop, fdopt.data.fd, &child_handle); if (err) { - /* If fdopt.data.fd is not valid and fd fd <= 2, then ignore the */ - /* error. */ + /* If fdopt. data. fd is not valid and fd <= 2, then ignore the + * error. */ if (fdopt.data.fd <= 2 && err == ERROR_INVALID_HANDLE) { CHILD_STDIO_CRT_FLAGS(buffer, i) = 0; CHILD_STDIO_HANDLE(buffer, i) = INVALID_HANDLE_VALUE; @@ -418,8 +419,8 @@ int uv__stdio_create(uv_loop_t* loop, if (stream_handle == NULL || stream_handle == INVALID_HANDLE_VALUE) { - /* The handle is already closed, or not yet created, or the */ - /* stream type is not supported. */ + /* The handle is already closed, or not yet created, or the stream + * type is not supported. */ err = ERROR_NOT_SUPPORTED; goto error; } diff --git a/src/win/process.c b/src/win/process.c index 7523522..f9c53de 100644 --- a/src/win/process.c +++ b/src/win/process.c @@ -360,8 +360,8 @@ static WCHAR* search_path(const WCHAR *file, return NULL; } - /* Find the start of the filename so we can split the directory from the */ - /* name. */ + /* Find the start of the filename so we can split the directory from the + * name. */ for (file_name_start = (WCHAR*)file + file_len; file_name_start > file && file_name_start[-1] != L'\\' @@ -556,8 +556,8 @@ int make_program_args(char** args, int verbatim_arguments, WCHAR** dst_ptr) { arg_count++; } - /* Adjust for potential quotes. Also assume the worst-case scenario */ - /* that every character needs escaping, so we need twice as much space. */ + /* Adjust for potential quotes. Also assume the worst-case scenario that + * every character needs escaping, so we need twice as much space. */ dst_len = dst_len * 2 + arg_count * 2; /* Allocate buffer for the final command line. */ @@ -739,7 +739,7 @@ int make_program_env(char* env_block[], WCHAR** dst_ptr) { } } *ptr_copy = NULL; - assert(env_len == ptr - dst_copy); + assert(env_len == (size_t) (ptr - dst_copy)); /* sort our (UTF-16) copy */ qsort(env_copy, env_block_count-1, sizeof(wchar_t*), qsort_wcscmp); @@ -799,7 +799,7 @@ int make_program_env(char* env_block[], WCHAR** dst_ptr) { var_size = GetEnvironmentVariableW(required_vars[i].wide, ptr, (int) (env_len - (ptr - dst))); - if (var_size != len-1) { /* race condition? */ + if (var_size != (DWORD) (len - 1)) { /* TODO: handle race condition? */ uv_fatal_error(GetLastError(), "GetEnvironmentVariableW"); } } @@ -815,7 +815,7 @@ int make_program_env(char* env_block[], WCHAR** dst_ptr) { } /* Terminate with an extra NULL. */ - assert(env_len == (ptr - dst)); + assert(env_len == (size_t) (ptr - dst)); *ptr = L'\0'; uv__free(dst_copy); @@ -831,8 +831,13 @@ int make_program_env(char* env_block[], WCHAR** dst_ptr) { */ static WCHAR* find_path(WCHAR *env) { for (; env != NULL && *env != 0; env += wcslen(env) + 1) { - if (wcsncmp(env, L"PATH=", 5) == 0) + if ((env[0] == L'P' || env[0] == L'p') && + (env[1] == L'A' || env[1] == L'a') && + (env[2] == L'T' || env[2] == L't') && + (env[3] == L'H' || env[3] == L'h') && + (env[4] == L'=')) { return &env[5]; + } } return NULL; @@ -865,9 +870,9 @@ void uv_process_proc_exit(uv_loop_t* loop, uv_process_t* handle) { assert(handle->exit_cb_pending); handle->exit_cb_pending = 0; - /* If we're closing, don't call the exit callback. Just schedule a close */ - /* callback now. */ - if (handle->flags & UV__HANDLE_CLOSING) { + /* If we're closing, don't call the exit callback. Just schedule a close + * callback now. */ + if (handle->flags & UV_HANDLE_CLOSING) { uv_want_endgame(loop, (uv_handle_t*) handle); return; } @@ -878,14 +883,14 @@ void uv_process_proc_exit(uv_loop_t* loop, uv_process_t* handle) { handle->wait_handle = INVALID_HANDLE_VALUE; } - /* Set the handle to inactive: no callbacks will be made after the exit */ - /* callback.*/ + /* Set the handle to inactive: no callbacks will be made after the exit + * callback. */ uv__handle_stop(handle); if (GetExitCodeProcess(handle->process_handle, &status)) { exit_code = status; } else { - /* Unable to to obtain the exit code. This should never happen. */ + /* Unable to obtain the exit code. This should never happen. */ exit_code = uv_translate_sys_error(GetLastError()); } @@ -900,8 +905,8 @@ void uv_process_close(uv_loop_t* loop, uv_process_t* handle) { uv__handle_closing(handle); if (handle->wait_handle != INVALID_HANDLE_VALUE) { - /* This blocks until either the wait was cancelled, or the callback has */ - /* completed. */ + /* This blocks until either the wait was cancelled, or the callback has + * completed. */ BOOL r = UnregisterWaitEx(handle->wait_handle, INVALID_HANDLE_VALUE); if (!r) { /* This should never happen, and if it happens, we can't recover... */ @@ -919,7 +924,7 @@ void uv_process_close(uv_loop_t* loop, uv_process_t* handle) { void uv_process_endgame(uv_loop_t* loop, uv_process_t* handle) { assert(!handle->exit_cb_pending); - assert(handle->flags & UV__HANDLE_CLOSING); + assert(handle->flags & UV_HANDLE_CLOSING); assert(!(handle->flags & UV_HANDLE_CLOSED)); /* Clean-up the process handle. */ @@ -959,6 +964,8 @@ int uv_spawn(uv_loop_t* loop, UV_PROCESS_SETGID | UV_PROCESS_SETUID | UV_PROCESS_WINDOWS_HIDE | + UV_PROCESS_WINDOWS_HIDE_CONSOLE | + UV_PROCESS_WINDOWS_HIDE_GUI | UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS))); err = uv_utf8_to_utf16_alloc(options->file, &application); @@ -1060,7 +1067,8 @@ int uv_spawn(uv_loop_t* loop, process_flags = CREATE_UNICODE_ENVIRONMENT; - if (options->flags & UV_PROCESS_WINDOWS_HIDE) { + if ((options->flags & UV_PROCESS_WINDOWS_HIDE_CONSOLE) || + (options->flags & UV_PROCESS_WINDOWS_HIDE)) { /* Avoid creating console window if stdio is not inherited. */ for (i = 0; i < options->stdio_count; i++) { if (options->stdio[i].flags & UV_INHERIT_FD) @@ -1068,7 +1076,9 @@ int uv_spawn(uv_loop_t* loop, if (i == options->stdio_count - 1) process_flags |= CREATE_NO_WINDOW; } - + } + if ((options->flags & UV_PROCESS_WINDOWS_HIDE_GUI) || + (options->flags & UV_PROCESS_WINDOWS_HIDE)) { /* Use SW_HIDE to avoid any potential process window. */ startup.wShowWindow = SW_HIDE; } else { @@ -1104,14 +1114,13 @@ int uv_spawn(uv_loop_t* loop, goto done; } - /* Spawn succeeded */ - /* Beyond this point, failure is reported asynchronously. */ + /* Spawn succeeded. Beyond this point, failure is reported asynchronously. */ process->process_handle = info.hProcess; process->pid = info.dwProcessId; - /* If the process isn't spawned as detached, assign to the global job */ - /* object so windows will kill it when the parent process dies. */ + /* If the process isn't spawned as detached, assign to the global job object + * so windows will kill it when the parent process dies. */ if (!(options->flags & UV_PROCESS_DETACHED)) { uv_once(&uv_global_job_handle_init_guard_, uv__init_global_job_handle); @@ -1138,7 +1147,8 @@ int uv_spawn(uv_loop_t* loop, if (fdopt->flags & UV_CREATE_PIPE && fdopt->data.stream->type == UV_NAMED_PIPE && ((uv_pipe_t*) fdopt->data.stream)->ipc) { - ((uv_pipe_t*) fdopt->data.stream)->pipe.conn.ipc_pid = info.dwProcessId; + ((uv_pipe_t*) fdopt->data.stream)->pipe.conn.ipc_remote_pid = + info.dwProcessId; } } @@ -1154,8 +1164,8 @@ int uv_spawn(uv_loop_t* loop, assert(!err); - /* Make the handle active. It will remain active until the exit callback */ - /* is made or the handle is closed, whichever happens first. */ + /* Make the handle active. It will remain active until the exit callback is + * made or the handle is closed, whichever happens first. */ uv__handle_start(process); /* Cleanup, whether we succeeded or failed. */ @@ -1186,16 +1196,16 @@ static int uv__kill(HANDLE process_handle, int signum) { case SIGTERM: case SIGKILL: case SIGINT: { - /* Unconditionally terminate the process. On Windows, killed processes */ - /* normally return 1. */ + /* Unconditionally terminate the process. On Windows, killed processes + * normally return 1. */ DWORD status; int err; if (TerminateProcess(process_handle, 1)) return 0; - /* If the process already exited before TerminateProcess was called, */ - /* TerminateProcess will fail with ERROR_ACCESS_DENIED. */ + /* If the process already exited before TerminateProcess was called,. + * TerminateProcess will fail with ERROR_ACCESS_DENIED. */ err = GetLastError(); if (err == ERROR_ACCESS_DENIED && GetExitCodeProcess(process_handle, &status) && diff --git a/src/win/req.c b/src/win/req.c deleted file mode 100644 index 111cc5e..0000000 --- a/src/win/req.c +++ /dev/null @@ -1,25 +0,0 @@ -/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -#include - -#include "uv.h" -#include "internal.h" diff --git a/src/win/signal.c b/src/win/signal.c index a174da1..276dc60 100644 --- a/src/win/signal.c +++ b/src/win/signal.c @@ -47,13 +47,13 @@ void uv_signals_init(void) { static int uv__signal_compare(uv_signal_t* w1, uv_signal_t* w2) { - /* Compare signums first so all watchers with the same signnum end up */ - /* adjacent. */ + /* Compare signums first so all watchers with the same signnum end up + * adjacent. */ if (w1->signum < w2->signum) return -1; if (w1->signum > w2->signum) return 1; - /* Sort by loop pointer, so we can easily look up the first item after */ - /* { .signum = x, .loop = NULL } */ + /* Sort by loop pointer, so we can easily look up the first item after + * { .signum = x, .loop = NULL }. */ if ((uintptr_t) w1->loop < (uintptr_t) w2->loop) return -1; if ((uintptr_t) w1->loop > (uintptr_t) w2->loop) return 1; @@ -90,7 +90,7 @@ int uv__signal_dispatch(int signum) { unsigned long previous = InterlockedExchange( (volatile LONG*) &handle->pending_signum, signum); - if (handle->flags & UV__SIGNAL_ONE_SHOT_DISPATCHED) + if (handle->flags & UV_SIGNAL_ONE_SHOT_DISPATCHED) continue; if (!previous) { @@ -98,8 +98,8 @@ int uv__signal_dispatch(int signum) { } dispatched = 1; - if (handle->flags & UV__SIGNAL_ONE_SHOT) - handle->flags |= UV__SIGNAL_ONE_SHOT_DISPATCHED; + if (handle->flags & UV_SIGNAL_ONE_SHOT) + handle->flags |= UV_SIGNAL_ONE_SHOT_DISPATCHED; } LeaveCriticalSection(&uv__signal_lock); @@ -118,10 +118,10 @@ static BOOL WINAPI uv__signal_control_handler(DWORD type) { case CTRL_CLOSE_EVENT: if (uv__signal_dispatch(SIGHUP)) { - /* Windows will terminate the process after the control handler */ - /* returns. After that it will just terminate our process. Therefore */ - /* block the signal handler so the main loop has some time to pick */ - /* up the signal and do something for a few seconds. */ + /* Windows will terminate the process after the control handler + * returns. After that it will just terminate our process. Therefore + * block the signal handler so the main loop has some time to pick up + * the signal and do something for a few seconds. */ Sleep(INFINITE); return TRUE; } @@ -129,8 +129,8 @@ static BOOL WINAPI uv__signal_control_handler(DWORD type) { case CTRL_LOGOFF_EVENT: case CTRL_SHUTDOWN_EVENT: - /* These signals are only sent to services. Services have their own */ - /* notification mechanism, so there's no point in handling these. */ + /* These signals are only sent to services. Services have their own + * notification mechanism, so there's no point in handling these. */ default: /* We don't handle these. */ @@ -190,13 +190,13 @@ int uv__signal_start(uv_signal_t* handle, int signum, int oneshot) { /* Test for invalid signal values. */ - if (signum != SIGWINCH && (signum <= 0 || signum >= NSIG)) + if (signum <= 0 || signum >= NSIG) return UV_EINVAL; - /* Short circuit: if the signal watcher is already watching {signum} don't */ - /* go through the process of deregistering and registering the handler. */ - /* Additionally, this avoids pending signals getting lost in the (small) */ - /* time frame that handle->signum == 0. */ + /* Short circuit: if the signal watcher is already watching {signum} don't go + * through the process of deregistering and registering the handler. + * Additionally, this avoids pending signals getting lost in the (small) time + * frame that handle->signum == 0. */ if (signum == handle->signum) { handle->signal_cb = signal_cb; return 0; @@ -213,7 +213,7 @@ int uv__signal_start(uv_signal_t* handle, handle->signum = signum; if (oneshot) - handle->flags |= UV__SIGNAL_ONE_SHOT; + handle->flags |= UV_SIGNAL_ONE_SHOT; RB_INSERT(uv_signal_tree_s, &uv__signal_tree, handle); @@ -237,16 +237,16 @@ void uv_process_signal_req(uv_loop_t* loop, uv_signal_t* handle, (volatile LONG*) &handle->pending_signum, 0); assert(dispatched_signum != 0); - /* Check if the pending signal equals the signum that we are watching for. */ - /* These can get out of sync when the handler is stopped and restarted */ - /* while the signal_req is pending. */ + /* Check if the pending signal equals the signum that we are watching for. + * These can get out of sync when the handler is stopped and restarted while + * the signal_req is pending. */ if (dispatched_signum == handle->signum) handle->signal_cb(handle, dispatched_signum); - if (handle->flags & UV__SIGNAL_ONE_SHOT) + if (handle->flags & UV_SIGNAL_ONE_SHOT) uv_signal_stop(handle); - if (handle->flags & UV__HANDLE_CLOSING) { + if (handle->flags & UV_HANDLE_CLOSING) { /* When it is closing, it must be stopped at this point. */ assert(handle->signum == 0); uv_want_endgame(loop, (uv_handle_t*) handle); @@ -265,7 +265,7 @@ void uv_signal_close(uv_loop_t* loop, uv_signal_t* handle) { void uv_signal_endgame(uv_loop_t* loop, uv_signal_t* handle) { - assert(handle->flags & UV__HANDLE_CLOSING); + assert(handle->flags & UV_HANDLE_CLOSING); assert(!(handle->flags & UV_HANDLE_CLOSED)); assert(handle->signum == 0); diff --git a/src/win/stream.c b/src/win/stream.c index 13cbfdc..7656627 100644 --- a/src/win/stream.c +++ b/src/win/stream.c @@ -105,12 +105,10 @@ int uv_read_stop(uv_stream_t* handle) { err = 0; if (handle->type == UV_TTY) { err = uv_tty_read_stop((uv_tty_t*) handle); + } else if (handle->type == UV_NAMED_PIPE) { + uv__pipe_read_stop((uv_pipe_t*) handle); } else { - if (handle->type == UV_NAMED_PIPE) { - uv__pipe_stop_read((uv_pipe_t*) handle); - } else { - handle->flags &= ~UV_HANDLE_READING; - } + handle->flags &= ~UV_HANDLE_READING; DECREASE_ACTIVE_COUNT(handle->loop, handle); } @@ -136,7 +134,8 @@ int uv_write(uv_write_t* req, err = uv_tcp_write(loop, req, (uv_tcp_t*) handle, bufs, nbufs, cb); break; case UV_NAMED_PIPE: - err = uv_pipe_write(loop, req, (uv_pipe_t*) handle, bufs, nbufs, cb); + err = uv__pipe_write( + loop, req, (uv_pipe_t*) handle, bufs, nbufs, NULL, cb); break; case UV_TTY: err = uv_tty_write(loop, req, (uv_tty_t*) handle, bufs, nbufs, cb); @@ -158,25 +157,18 @@ int uv_write2(uv_write_t* req, uv_loop_t* loop = handle->loop; int err; - if (!(handle->flags & UV_HANDLE_WRITABLE)) { - return UV_EPIPE; + if (send_handle == NULL) { + return uv_write(req, handle, bufs, nbufs, cb); } - err = ERROR_INVALID_PARAMETER; - switch (handle->type) { - case UV_NAMED_PIPE: - err = uv_pipe_write2(loop, - req, - (uv_pipe_t*) handle, - bufs, - nbufs, - send_handle, - cb); - break; - default: - assert(0); + if (handle->type != UV_NAMED_PIPE || !((uv_pipe_t*) handle)->ipc) { + return UV_EINVAL; + } else if (!(handle->flags & UV_HANDLE_WRITABLE)) { + return UV_EPIPE; } + err = uv__pipe_write( + loop, req, (uv_pipe_t*) handle, bufs, nbufs, send_handle, cb); return uv_translate_sys_error(err); } @@ -184,7 +176,7 @@ int uv_write2(uv_write_t* req, int uv_try_write(uv_stream_t* stream, const uv_buf_t bufs[], unsigned int nbufs) { - if (stream->flags & UV__HANDLE_CLOSING) + if (stream->flags & UV_HANDLE_CLOSING) return UV_EBADF; if (!(stream->flags & UV_HANDLE_WRITABLE)) return UV_EPIPE; diff --git a/src/win/tcp.c b/src/win/tcp.c index 39c1ff0..3ce5548 100644 --- a/src/win/tcp.c +++ b/src/win/tcp.c @@ -99,8 +99,8 @@ static int uv_tcp_set_socket(uv_loop_t* loop, if (!SetHandleInformation((HANDLE) socket, HANDLE_FLAG_INHERIT, 0)) return GetLastError(); - /* Associate it with the I/O completion port. */ - /* Use uv_handle_t pointer as completion key. */ + /* Associate it with the I/O completion port. Use uv_handle_t pointer as + * completion key. */ if (CreateIoCompletionPort((HANDLE)socket, loop->iocp, (ULONG_PTR)socket, @@ -118,15 +118,12 @@ static int uv_tcp_set_socket(uv_loop_t* loop, non_ifs_lsp = uv_tcp_non_ifs_lsp_ipv4; } - if (pSetFileCompletionNotificationModes && - !(handle->flags & UV_HANDLE_EMULATE_IOCP) && !non_ifs_lsp) { - if (pSetFileCompletionNotificationModes((HANDLE) socket, - FILE_SKIP_SET_EVENT_ON_HANDLE | - FILE_SKIP_COMPLETION_PORT_ON_SUCCESS)) { - handle->flags |= UV_HANDLE_SYNC_BYPASS_IOCP; - } else if (GetLastError() != ERROR_INVALID_FUNCTION) { + if (!(handle->flags & UV_HANDLE_EMULATE_IOCP) && !non_ifs_lsp) { + UCHAR sfcnm_flags = + FILE_SKIP_SET_EVENT_ON_HANDLE | FILE_SKIP_COMPLETION_PORT_ON_SUCCESS; + if (!SetFileCompletionNotificationModes((HANDLE) socket, sfcnm_flags)) return GetLastError(); - } + handle->flags |= UV_HANDLE_SYNC_BYPASS_IOCP; } if (handle->flags & UV_HANDLE_TCP_NODELAY) { @@ -220,7 +217,7 @@ void uv_tcp_endgame(uv_loop_t* loop, uv_tcp_t* handle) { UNREGISTER_HANDLE_REQ(loop, handle, handle->stream.conn.shutdown_req); err = 0; - if (handle->flags & UV__HANDLE_CLOSING) { + if (handle->flags & UV_HANDLE_CLOSING) { err = ERROR_OPERATION_ABORTED; } else if (shutdown(handle->socket, SD_SEND) == SOCKET_ERROR) { err = WSAGetLastError(); @@ -236,7 +233,7 @@ void uv_tcp_endgame(uv_loop_t* loop, uv_tcp_t* handle) { return; } - if (handle->flags & UV__HANDLE_CLOSING && + if (handle->flags & UV_HANDLE_CLOSING && handle->reqs_pending == 0) { assert(!(handle->flags & UV_HANDLE_CLOSED)); @@ -326,9 +323,9 @@ static int uv_tcp_try_bind(uv_tcp_t* handle, on = (flags & UV_TCP_IPV6ONLY) != 0; - /* TODO: how to handle errors? This may fail if there is no ipv4 stack */ - /* available, or when run on XP/2003 which have no support for dualstack */ - /* sockets. For now we're silently ignoring the error. */ + /* TODO: how to handle errors? This may fail if there is no ipv4 stack + * available, or when run on XP/2003 which have no support for dualstack + * sockets. For now we're silently ignoring the error. */ setsockopt(handle->socket, IPPROTO_IPV6, IPV6_V6ONLY, @@ -626,9 +623,9 @@ int uv_tcp_listen(uv_tcp_t* handle, int backlog, uv_connection_cb cb) { uv_tcp_queue_accept(handle, req); } - /* Initialize other unused requests too, because uv_tcp_endgame */ - /* doesn't know how how many requests were initialized, so it will */ - /* try to clean up {uv_simultaneous_server_accepts} requests. */ + /* Initialize other unused requests too, because uv_tcp_endgame doesn't + * know how many requests were initialized, so it will try to clean up + * {uv_simultaneous_server_accepts} requests. */ for (i = simultaneous_accepts; i < uv_simultaneous_server_accepts; i++) { req = &handle->tcp.serv.accept_reqs[i]; UV_REQ_INIT(req, UV_ACCEPT); @@ -683,7 +680,7 @@ int uv_tcp_accept(uv_tcp_t* server, uv_tcp_t* client) { req->next_pending = NULL; req->accept_socket = INVALID_SOCKET; - if (!(server->flags & UV__HANDLE_CLOSING)) { + if (!(server->flags & UV_HANDLE_CLOSING)) { /* Check if we're in a middle of changing the number of pending accepts. */ if (!(server->flags & UV_HANDLE_TCP_ACCEPT_STATE_CHANGING)) { uv_tcp_queue_accept(server, req); @@ -721,8 +718,8 @@ int uv_tcp_read_start(uv_tcp_t* handle, uv_alloc_cb alloc_cb, handle->alloc_cb = alloc_cb; INCREASE_ACTIVE_COUNT(loop, handle); - /* If reading was stopped and then started again, there could still be a */ - /* read request pending. */ + /* If reading was stopped and then started again, there could still be a read + * request pending. */ if (!(handle->flags & UV_HANDLE_READ_PENDING)) { if (handle->flags & UV_HANDLE_EMULATE_IOCP && !handle->read_req.event_handle) { @@ -948,6 +945,7 @@ void uv_process_tcp_read_req(uv_loop_t* loop, uv_tcp_t* handle, uv_req_t* req) { DWORD bytes, flags, err; uv_buf_t buf; + int count; assert(handle->type == UV_TCP); @@ -965,8 +963,7 @@ void uv_process_tcp_read_req(uv_loop_t* loop, uv_tcp_t* handle, err = GET_REQ_SOCK_ERROR(req); if (err == WSAECONNABORTED) { - /* - * Turn WSAECONNABORTED into UV_ECONNRESET to be consistent with Unix. + /* Turn WSAECONNABORTED into UV_ECONNRESET to be consistent with Unix. */ err = WSAECONNRESET; } @@ -1003,7 +1000,8 @@ void uv_process_tcp_read_req(uv_loop_t* loop, uv_tcp_t* handle, } /* Do nonblocking reads until the buffer is empty */ - while (handle->flags & UV_HANDLE_READING) { + count = 32; + while ((handle->flags & UV_HANDLE_READING) && (count-- > 0)) { buf = uv_buf_init(NULL, 0); handle->alloc_cb((uv_handle_t*) handle, 65536, &buf); if (buf.base == NULL || buf.len == 0) { @@ -1046,8 +1044,8 @@ void uv_process_tcp_read_req(uv_loop_t* loop, uv_tcp_t* handle, DECREASE_ACTIVE_COUNT(loop, handle); if (err == WSAECONNABORTED) { - /* Turn WSAECONNABORTED into UV_ECONNRESET to be consistent with */ - /* Unix. */ + /* Turn WSAECONNABORTED into UV_ECONNRESET to be consistent with + * Unix. */ err = WSAECONNRESET; } @@ -1119,10 +1117,9 @@ void uv_process_tcp_accept_req(uv_loop_t* loop, uv_tcp_t* handle, assert(handle->type == UV_TCP); - /* If handle->accepted_socket is not a valid socket, then */ - /* uv_queue_accept must have failed. This is a serious error. We stop */ - /* accepting connections and report this error to the connection */ - /* callback. */ + /* If handle->accepted_socket is not a valid socket, then uv_queue_accept + * must have failed. This is a serious error. We stop accepting connections + * and report this error to the connection callback. */ if (req->accept_socket == INVALID_SOCKET) { if (handle->flags & UV_HANDLE_LISTENING) { handle->flags &= ~UV_HANDLE_LISTENING; @@ -1147,9 +1144,9 @@ void uv_process_tcp_accept_req(uv_loop_t* loop, uv_tcp_t* handle, handle->stream.serv.connection_cb((uv_stream_t*)handle, 0); } } else { - /* Error related to accepted socket is ignored because the server */ - /* socket may still be healthy. If the server socket is broken */ - /* uv_queue_accept will detect it. */ + /* Error related to accepted socket is ignored because the server socket + * may still be healthy. If the server socket is broken uv_queue_accept + * will detect it. */ closesocket(req->accept_socket); req->accept_socket = INVALID_SOCKET; if (handle->flags & UV_HANDLE_LISTENING) { @@ -1171,7 +1168,7 @@ void uv_process_tcp_connect_req(uv_loop_t* loop, uv_tcp_t* handle, err = 0; if (REQ_SUCCESS(req)) { - if (handle->flags & UV__HANDLE_CLOSING) { + if (handle->flags & UV_HANDLE_CLOSING) { /* use UV_ECANCELED for consistency with Unix */ err = ERROR_OPERATION_ABORTED; } else if (setsockopt(handle->socket, @@ -1194,40 +1191,76 @@ void uv_process_tcp_connect_req(uv_loop_t* loop, uv_tcp_t* handle, } -int uv_tcp_import(uv_tcp_t* tcp, uv__ipc_socket_info_ex* socket_info_ex, - int tcp_connection) { +int uv__tcp_xfer_export(uv_tcp_t* handle, + int target_pid, + uv__ipc_socket_xfer_type_t* xfer_type, + uv__ipc_socket_xfer_info_t* xfer_info) { + if (handle->flags & UV_HANDLE_CONNECTION) { + *xfer_type = UV__IPC_SOCKET_XFER_TCP_CONNECTION; + } else { + *xfer_type = UV__IPC_SOCKET_XFER_TCP_SERVER; + /* We're about to share the socket with another process. Because this is a + * listening socket, we assume that the other process will be accepting + * connections on it. Thus, before sharing the socket with another process, + * we call listen here in the parent process. */ + if (!(handle->flags & UV_HANDLE_LISTENING)) { + if (!(handle->flags & UV_HANDLE_BOUND)) { + return ERROR_NOT_SUPPORTED; + } + if (handle->delayed_error == 0 && + listen(handle->socket, SOMAXCONN) == SOCKET_ERROR) { + handle->delayed_error = WSAGetLastError(); + } + } + } + + if (WSADuplicateSocketW(handle->socket, target_pid, &xfer_info->socket_info)) + return WSAGetLastError(); + xfer_info->delayed_error = handle->delayed_error; + + /* Mark the local copy of the handle as 'shared' so we behave in a way that's + * friendly to the process(es) that we share the socket with. */ + handle->flags |= UV_HANDLE_SHARED_TCP_SOCKET; + + return 0; +} + + +int uv__tcp_xfer_import(uv_tcp_t* tcp, + uv__ipc_socket_xfer_type_t xfer_type, + uv__ipc_socket_xfer_info_t* xfer_info) { int err; - SOCKET socket = WSASocketW(FROM_PROTOCOL_INFO, - FROM_PROTOCOL_INFO, - FROM_PROTOCOL_INFO, - &socket_info_ex->socket_info, - 0, - WSA_FLAG_OVERLAPPED); + SOCKET socket; + + assert(xfer_type == UV__IPC_SOCKET_XFER_TCP_SERVER || + xfer_type == UV__IPC_SOCKET_XFER_TCP_CONNECTION); + + socket = WSASocketW(FROM_PROTOCOL_INFO, + FROM_PROTOCOL_INFO, + FROM_PROTOCOL_INFO, + &xfer_info->socket_info, + 0, + WSA_FLAG_OVERLAPPED); if (socket == INVALID_SOCKET) { return WSAGetLastError(); } - err = uv_tcp_set_socket(tcp->loop, - tcp, - socket, - socket_info_ex->socket_info.iAddressFamily, - 1); + err = uv_tcp_set_socket( + tcp->loop, tcp, socket, xfer_info->socket_info.iAddressFamily, 1); if (err) { closesocket(socket); return err; } - if (tcp_connection) { + tcp->delayed_error = xfer_info->delayed_error; + tcp->flags |= UV_HANDLE_BOUND | UV_HANDLE_SHARED_TCP_SOCKET; + + if (xfer_type == UV__IPC_SOCKET_XFER_TCP_CONNECTION) { uv_connection_init((uv_stream_t*)tcp); tcp->flags |= UV_HANDLE_READABLE | UV_HANDLE_WRITABLE; } - tcp->flags |= UV_HANDLE_BOUND; - tcp->flags |= UV_HANDLE_SHARED_TCP_SOCKET; - - tcp->delayed_error = socket_info_ex->delayed_error; - tcp->loop->active_tcp_streams++; return 0; } @@ -1273,39 +1306,6 @@ int uv_tcp_keepalive(uv_tcp_t* handle, int enable, unsigned int delay) { } -int uv_tcp_duplicate_socket(uv_tcp_t* handle, int pid, - LPWSAPROTOCOL_INFOW protocol_info) { - if (!(handle->flags & UV_HANDLE_CONNECTION)) { - /* - * We're about to share the socket with another process. Because - * this is a listening socket, we assume that the other process will - * be accepting connections on it. So, before sharing the socket - * with another process, we call listen here in the parent process. - */ - - if (!(handle->flags & UV_HANDLE_LISTENING)) { - if (!(handle->flags & UV_HANDLE_BOUND)) { - return ERROR_INVALID_PARAMETER; - } - - if (!(handle->delayed_error)) { - if (listen(handle->socket, SOMAXCONN) == SOCKET_ERROR) { - handle->delayed_error = WSAGetLastError(); - } - } - } - } - - if (WSADuplicateSocketW(handle->socket, pid, protocol_info)) { - return WSAGetLastError(); - } - - handle->flags |= UV_HANDLE_SHARED_TCP_SOCKET; - - return 0; -} - - int uv_tcp_simultaneous_accepts(uv_tcp_t* handle, int enable) { if (handle->flags & UV_HANDLE_CONNECTION) { return UV_EINVAL; @@ -1346,8 +1346,8 @@ static int uv_tcp_try_cancel_io(uv_tcp_t* tcp) { non_ifs_lsp = (tcp->flags & UV_HANDLE_IPV6) ? uv_tcp_non_ifs_lsp_ipv6 : uv_tcp_non_ifs_lsp_ipv4; - /* If there are non-ifs LSPs then try to obtain a base handle for the */ - /* socket. This will always fail on Windows XP/3k. */ + /* If there are non-ifs LSPs then try to obtain a base handle for the socket. + * This will always fail on Windows XP/3k. */ if (non_ifs_lsp) { DWORD bytes; if (WSAIoctl(socket, @@ -1379,38 +1379,37 @@ void uv_tcp_close(uv_loop_t* loop, uv_tcp_t* tcp) { int close_socket = 1; if (tcp->flags & UV_HANDLE_READ_PENDING) { - /* In order for winsock to do a graceful close there must not be any */ - /* any pending reads, or the socket must be shut down for writing */ + /* In order for winsock to do a graceful close there must not be any any + * pending reads, or the socket must be shut down for writing */ if (!(tcp->flags & UV_HANDLE_SHARED_TCP_SOCKET)) { /* Just do shutdown on non-shared sockets, which ensures graceful close. */ shutdown(tcp->socket, SD_SEND); } else if (uv_tcp_try_cancel_io(tcp) == 0) { - /* In case of a shared socket, we try to cancel all outstanding I/O, */ - /* If that works, don't close the socket yet - wait for the read req to */ - /* return and close the socket in uv_tcp_endgame. */ + /* In case of a shared socket, we try to cancel all outstanding I/O,. If + * that works, don't close the socket yet - wait for the read req to + * return and close the socket in uv_tcp_endgame. */ close_socket = 0; } else { - /* When cancelling isn't possible - which could happen when an LSP is */ - /* present on an old Windows version, we will have to close the socket */ - /* with a read pending. That is not nice because trailing sent bytes */ - /* may not make it to the other side. */ + /* When cancelling isn't possible - which could happen when an LSP is + * present on an old Windows version, we will have to close the socket + * with a read pending. That is not nice because trailing sent bytes may + * not make it to the other side. */ } } else if ((tcp->flags & UV_HANDLE_SHARED_TCP_SOCKET) && tcp->tcp.serv.accept_reqs != NULL) { - /* Under normal circumstances closesocket() will ensure that all pending */ - /* accept reqs are canceled. However, when the socket is shared the */ - /* presence of another reference to the socket in another process will */ - /* keep the accept reqs going, so we have to ensure that these are */ - /* canceled. */ + /* Under normal circumstances closesocket() will ensure that all pending + * accept reqs are canceled. However, when the socket is shared the + * presence of another reference to the socket in another process will keep + * the accept reqs going, so we have to ensure that these are canceled. */ if (uv_tcp_try_cancel_io(tcp) != 0) { - /* When cancellation is not possible, there is another option: we can */ - /* close the incoming sockets, which will also cancel the accept */ - /* operations. However this is not cool because we might inadvertently */ - /* close a socket that just accepted a new connection, which will */ - /* cause the connection to be aborted. */ + /* When cancellation is not possible, there is another option: we can + * close the incoming sockets, which will also cancel the accept + * operations. However this is not cool because we might inadvertently + * close a socket that just accepted a new connection, which will cause + * the connection to be aborted. */ unsigned int i; for (i = 0; i < uv_simultaneous_server_accepts; i++) { uv_tcp_accept_t* req = &tcp->tcp.serv.accept_reqs[i]; diff --git a/src/win/thread.c b/src/win/thread.c index 9eaad77..fd4b7c9 100644 --- a/src/win/thread.c +++ b/src/win/thread.c @@ -23,29 +23,15 @@ #include #include +#if defined(__MINGW64_VERSION_MAJOR) +/* MemoryBarrier expands to __mm_mfence in some cases (x86+sse2), which may + * require this header in some versions of mingw64. */ +#include +#endif + #include "uv.h" #include "internal.h" - -#define HAVE_CONDVAR_API() (pInitializeConditionVariable != NULL) - -static int uv_cond_fallback_init(uv_cond_t* cond); -static void uv_cond_fallback_destroy(uv_cond_t* cond); -static void uv_cond_fallback_signal(uv_cond_t* cond); -static void uv_cond_fallback_broadcast(uv_cond_t* cond); -static void uv_cond_fallback_wait(uv_cond_t* cond, uv_mutex_t* mutex); -static int uv_cond_fallback_timedwait(uv_cond_t* cond, - uv_mutex_t* mutex, uint64_t timeout); - -static int uv_cond_condvar_init(uv_cond_t* cond); -static void uv_cond_condvar_destroy(uv_cond_t* cond); -static void uv_cond_condvar_signal(uv_cond_t* cond); -static void uv_cond_condvar_broadcast(uv_cond_t* cond); -static void uv_cond_condvar_wait(uv_cond_t* cond, uv_mutex_t* mutex); -static int uv_cond_condvar_timedwait(uv_cond_t* cond, - uv_mutex_t* mutex, uint64_t timeout); - - static void uv__once_inner(uv_once_t* guard, void (*callback)(void)) { DWORD result; HANDLE existing_event, created_event; @@ -69,8 +55,8 @@ static void uv__once_inner(uv_once_t* guard, void (*callback)(void)) { guard->ran = 1; } else { - /* We lost the race. Destroy the event we created and wait for the */ - /* existing one to become signaled. */ + /* We lost the race. Destroy the event we created and wait for the existing + * one to become signaled. */ CloseHandle(created_event); result = WaitForSingleObject(existing_event, INFINITE); assert(result == WAIT_OBJECT_0); @@ -138,7 +124,7 @@ int uv_thread_create(uv_thread_t *tid, void (*entry)(void *arg), void *arg) { ctx->arg = arg; /* Create the thread in suspended state so we have a chance to pass - * its own creation handle to it */ + * its own creation handle to it */ thread = (HANDLE) _beginthreadex(NULL, 0, uv__thread_start, @@ -377,220 +363,35 @@ int uv_sem_trywait(uv_sem_t* sem) { } -/* This condition variable implementation is based on the SetEvent solution - * (section 3.2) at http://www.cs.wustl.edu/~schmidt/win32-cv-1.html - * We could not use the SignalObjectAndWait solution (section 3.4) because - * it want the 2nd argument (type uv_mutex_t) of uv_cond_wait() and - * uv_cond_timedwait() to be HANDLEs, but we use CRITICAL_SECTIONs. - */ - -static int uv_cond_fallback_init(uv_cond_t* cond) { - int err; - - /* Initialize the count to 0. */ - cond->fallback.waiters_count = 0; - - InitializeCriticalSection(&cond->fallback.waiters_count_lock); - - /* Create an auto-reset event. */ - cond->fallback.signal_event = CreateEvent(NULL, /* no security */ - FALSE, /* auto-reset event */ - FALSE, /* non-signaled initially */ - NULL); /* unnamed */ - if (!cond->fallback.signal_event) { - err = GetLastError(); - goto error2; - } - - /* Create a manual-reset event. */ - cond->fallback.broadcast_event = CreateEvent(NULL, /* no security */ - TRUE, /* manual-reset */ - FALSE, /* non-signaled */ - NULL); /* unnamed */ - if (!cond->fallback.broadcast_event) { - err = GetLastError(); - goto error; - } - - return 0; - -error: - CloseHandle(cond->fallback.signal_event); -error2: - DeleteCriticalSection(&cond->fallback.waiters_count_lock); - return uv_translate_sys_error(err); -} - - -static int uv_cond_condvar_init(uv_cond_t* cond) { - pInitializeConditionVariable(&cond->cond_var); - return 0; -} - - int uv_cond_init(uv_cond_t* cond) { - uv__once_init(); - - if (HAVE_CONDVAR_API()) - return uv_cond_condvar_init(cond); - else - return uv_cond_fallback_init(cond); -} - - -static void uv_cond_fallback_destroy(uv_cond_t* cond) { - if (!CloseHandle(cond->fallback.broadcast_event)) - abort(); - if (!CloseHandle(cond->fallback.signal_event)) - abort(); - DeleteCriticalSection(&cond->fallback.waiters_count_lock); -} - - -static void uv_cond_condvar_destroy(uv_cond_t* cond) { - /* nothing to do */ + InitializeConditionVariable(&cond->cond_var); + return 0; } void uv_cond_destroy(uv_cond_t* cond) { - if (HAVE_CONDVAR_API()) - uv_cond_condvar_destroy(cond); - else - uv_cond_fallback_destroy(cond); -} - - -static void uv_cond_fallback_signal(uv_cond_t* cond) { - int have_waiters; - - /* Avoid race conditions. */ - EnterCriticalSection(&cond->fallback.waiters_count_lock); - have_waiters = cond->fallback.waiters_count > 0; - LeaveCriticalSection(&cond->fallback.waiters_count_lock); - - if (have_waiters) - SetEvent(cond->fallback.signal_event); -} - - -static void uv_cond_condvar_signal(uv_cond_t* cond) { - pWakeConditionVariable(&cond->cond_var); + /* nothing to do */ + (void) &cond; } void uv_cond_signal(uv_cond_t* cond) { - if (HAVE_CONDVAR_API()) - uv_cond_condvar_signal(cond); - else - uv_cond_fallback_signal(cond); -} - - -static void uv_cond_fallback_broadcast(uv_cond_t* cond) { - int have_waiters; - - /* Avoid race conditions. */ - EnterCriticalSection(&cond->fallback.waiters_count_lock); - have_waiters = cond->fallback.waiters_count > 0; - LeaveCriticalSection(&cond->fallback.waiters_count_lock); - - if (have_waiters) - SetEvent(cond->fallback.broadcast_event); -} - - -static void uv_cond_condvar_broadcast(uv_cond_t* cond) { - pWakeAllConditionVariable(&cond->cond_var); + WakeConditionVariable(&cond->cond_var); } void uv_cond_broadcast(uv_cond_t* cond) { - if (HAVE_CONDVAR_API()) - uv_cond_condvar_broadcast(cond); - else - uv_cond_fallback_broadcast(cond); -} - - -static int uv_cond_wait_helper(uv_cond_t* cond, uv_mutex_t* mutex, - DWORD dwMilliseconds) { - DWORD result; - int last_waiter; - HANDLE handles[2] = { - cond->fallback.signal_event, - cond->fallback.broadcast_event - }; - - /* Avoid race conditions. */ - EnterCriticalSection(&cond->fallback.waiters_count_lock); - cond->fallback.waiters_count++; - LeaveCriticalSection(&cond->fallback.waiters_count_lock); - - /* It's ok to release the here since Win32 manual-reset events */ - /* maintain state when used with . This avoids the "lost wakeup" */ - /* bug. */ - uv_mutex_unlock(mutex); - - /* Wait for either event to become signaled due to being */ - /* called or being called. */ - result = WaitForMultipleObjects(2, handles, FALSE, dwMilliseconds); - - EnterCriticalSection(&cond->fallback.waiters_count_lock); - cond->fallback.waiters_count--; - last_waiter = result == WAIT_OBJECT_0 + 1 - && cond->fallback.waiters_count == 0; - LeaveCriticalSection(&cond->fallback.waiters_count_lock); - - /* Some thread called . */ - if (last_waiter) { - /* We're the last waiter to be notified or to stop waiting, so reset the */ - /* the manual-reset event. */ - ResetEvent(cond->fallback.broadcast_event); - } - - /* Reacquire the . */ - uv_mutex_lock(mutex); - - if (result == WAIT_OBJECT_0 || result == WAIT_OBJECT_0 + 1) - return 0; - - if (result == WAIT_TIMEOUT) - return UV_ETIMEDOUT; - - abort(); - return -1; /* Satisfy the compiler. */ -} - - -static void uv_cond_fallback_wait(uv_cond_t* cond, uv_mutex_t* mutex) { - if (uv_cond_wait_helper(cond, mutex, INFINITE)) - abort(); -} - - -static void uv_cond_condvar_wait(uv_cond_t* cond, uv_mutex_t* mutex) { - if (!pSleepConditionVariableCS(&cond->cond_var, mutex, INFINITE)) - abort(); + WakeAllConditionVariable(&cond->cond_var); } void uv_cond_wait(uv_cond_t* cond, uv_mutex_t* mutex) { - if (HAVE_CONDVAR_API()) - uv_cond_condvar_wait(cond, mutex); - else - uv_cond_fallback_wait(cond, mutex); -} - - -static int uv_cond_fallback_timedwait(uv_cond_t* cond, - uv_mutex_t* mutex, uint64_t timeout) { - return uv_cond_wait_helper(cond, mutex, (DWORD)(timeout / 1e6)); + if (!SleepConditionVariableCS(&cond->cond_var, mutex, INFINITE)) + abort(); } - -static int uv_cond_condvar_timedwait(uv_cond_t* cond, - uv_mutex_t* mutex, uint64_t timeout) { - if (pSleepConditionVariableCS(&cond->cond_var, mutex, (DWORD)(timeout / 1e6))) +int uv_cond_timedwait(uv_cond_t* cond, uv_mutex_t* mutex, uint64_t timeout) { + if (SleepConditionVariableCS(&cond->cond_var, mutex, (DWORD)(timeout / 1e6))) return 0; if (GetLastError() != ERROR_TIMEOUT) abort(); @@ -598,15 +399,6 @@ static int uv_cond_condvar_timedwait(uv_cond_t* cond, } -int uv_cond_timedwait(uv_cond_t* cond, uv_mutex_t* mutex, - uint64_t timeout) { - if (HAVE_CONDVAR_API()) - return uv_cond_condvar_timedwait(cond, mutex, timeout); - else - return uv_cond_fallback_timedwait(cond, mutex, timeout); -} - - int uv_barrier_init(uv_barrier_t* barrier, unsigned int count) { int err; diff --git a/src/win/timer.c b/src/win/timer.c deleted file mode 100644 index 7e006fe..0000000 --- a/src/win/timer.c +++ /dev/null @@ -1,195 +0,0 @@ -/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -#include -#include - -#include "uv.h" -#include "internal.h" -#include "tree.h" -#include "handle-inl.h" - - -/* The number of milliseconds in one second. */ -#define UV__MILLISEC 1000 - - -void uv_update_time(uv_loop_t* loop) { - uint64_t new_time = uv__hrtime(UV__MILLISEC); - assert(new_time >= loop->time); - loop->time = new_time; -} - - -static int uv_timer_compare(uv_timer_t* a, uv_timer_t* b) { - if (a->due < b->due) - return -1; - if (a->due > b->due) - return 1; - /* - * compare start_id when both has the same due. start_id is - * allocated with loop->timer_counter in uv_timer_start(). - */ - if (a->start_id < b->start_id) - return -1; - if (a->start_id > b->start_id) - return 1; - return 0; -} - - -RB_GENERATE_STATIC(uv_timer_tree_s, uv_timer_s, tree_entry, uv_timer_compare) - - -int uv_timer_init(uv_loop_t* loop, uv_timer_t* handle) { - uv__handle_init(loop, (uv_handle_t*) handle, UV_TIMER); - handle->timer_cb = NULL; - handle->repeat = 0; - - return 0; -} - - -void uv_timer_endgame(uv_loop_t* loop, uv_timer_t* handle) { - if (handle->flags & UV__HANDLE_CLOSING) { - assert(!(handle->flags & UV_HANDLE_CLOSED)); - uv__handle_close(handle); - } -} - - -static uint64_t get_clamped_due_time(uint64_t loop_time, uint64_t timeout) { - uint64_t clamped_timeout; - - clamped_timeout = loop_time + timeout; - if (clamped_timeout < timeout) - clamped_timeout = (uint64_t) -1; - - return clamped_timeout; -} - - -int uv_timer_start(uv_timer_t* handle, uv_timer_cb timer_cb, uint64_t timeout, - uint64_t repeat) { - uv_loop_t* loop = handle->loop; - uv_timer_t* old; - - if (timer_cb == NULL) - return UV_EINVAL; - - if (uv__is_active(handle)) - uv_timer_stop(handle); - - handle->timer_cb = timer_cb; - handle->due = get_clamped_due_time(loop->time, timeout); - handle->repeat = repeat; - uv__handle_start(handle); - - /* start_id is the second index to be compared in uv__timer_cmp() */ - handle->start_id = handle->loop->timer_counter++; - - old = RB_INSERT(uv_timer_tree_s, &loop->timers, handle); - assert(old == NULL); - - return 0; -} - - -int uv_timer_stop(uv_timer_t* handle) { - uv_loop_t* loop = handle->loop; - - if (!uv__is_active(handle)) - return 0; - - RB_REMOVE(uv_timer_tree_s, &loop->timers, handle); - uv__handle_stop(handle); - - return 0; -} - - -int uv_timer_again(uv_timer_t* handle) { - /* If timer_cb is NULL that means that the timer was never started. */ - if (!handle->timer_cb) { - return UV_EINVAL; - } - - if (handle->repeat) { - uv_timer_stop(handle); - uv_timer_start(handle, handle->timer_cb, handle->repeat, handle->repeat); - } - - return 0; -} - - -void uv_timer_set_repeat(uv_timer_t* handle, uint64_t repeat) { - assert(handle->type == UV_TIMER); - handle->repeat = repeat; -} - - -uint64_t uv_timer_get_repeat(const uv_timer_t* handle) { - assert(handle->type == UV_TIMER); - return handle->repeat; -} - - -DWORD uv__next_timeout(const uv_loop_t* loop) { - uv_timer_t* timer; - int64_t delta; - - /* Check if there are any running timers - * Need to cast away const first, since RB_MIN doesn't know what we are - * going to do with this return value, it can't be marked const - */ - timer = RB_MIN(uv_timer_tree_s, &((uv_loop_t*)loop)->timers); - if (timer) { - delta = timer->due - loop->time; - if (delta >= UINT_MAX - 1) { - /* A timeout value of UINT_MAX means infinite, so that's no good. */ - return UINT_MAX - 1; - } else if (delta < 0) { - /* Negative timeout values are not allowed */ - return 0; - } else { - return (DWORD)delta; - } - } else { - /* No timers */ - return INFINITE; - } -} - - -void uv_process_timers(uv_loop_t* loop) { - uv_timer_t* timer; - - /* Call timer callbacks */ - for (timer = RB_MIN(uv_timer_tree_s, &loop->timers); - timer != NULL && timer->due <= loop->time; - timer = RB_MIN(uv_timer_tree_s, &loop->timers)) { - - uv_timer_stop(timer); - uv_timer_again(timer); - timer->timer_cb((uv_timer_t*) timer); - } -} diff --git a/src/win/tty.c b/src/win/tty.c index ecf7bc9..f38e9a8 100644 --- a/src/win/tty.c +++ b/src/win/tty.c @@ -25,7 +25,7 @@ #include #if defined(_MSC_VER) && _MSC_VER < 1600 -# include "stdint-msvc2008.h" +# include "uv/stdint-msvc2008.h" #else # include #endif @@ -164,7 +164,7 @@ void uv_console_init(void) { OPEN_EXISTING, 0, 0); - if (uv__tty_console_handle != NULL) { + if (uv__tty_console_handle != INVALID_HANDLE_VALUE) { QueueUserWorkItem(uv__tty_console_resize_message_loop_thread, NULL, WT_EXECUTELONGFUNCTION); @@ -172,9 +172,12 @@ void uv_console_init(void) { } -int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, uv_file fd, int readable) { +int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, uv_file fd, int unused) { + BOOL readable; + DWORD NumberOfEvents; HANDLE handle; CONSOLE_SCREEN_BUFFER_INFO screen_buffer_info; + (void)unused; uv__once_init(); handle = (HANDLE) uv__get_osfhandle(fd); @@ -199,14 +202,15 @@ int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, uv_file fd, int readable) { fd = -1; } + readable = GetNumberOfConsoleInputEvents(handle, &NumberOfEvents); if (!readable) { /* Obtain the screen buffer info with the output handle. */ if (!GetConsoleScreenBufferInfo(handle, &screen_buffer_info)) { return uv_translate_sys_error(GetLastError()); } - /* Obtain the the tty_output_lock because the virtual window state is */ - /* shared between all uv_tty_t handles. */ + /* Obtain the tty_output_lock because the virtual window state is shared + * between all uv_tty_t handles. */ uv_sem_wait(&uv_tty_output_lock); if (uv__vterm_state == UV_UNCHECKED) @@ -356,6 +360,8 @@ int uv_tty_set_mode(uv_tty_t* tty, uv_tty_mode_t mode) { } } else { was_reading = 0; + alloc_cb = NULL; + read_cb = NULL; } uv_sem_wait(&uv_tty_output_lock); @@ -382,12 +388,6 @@ int uv_tty_set_mode(uv_tty_t* tty, uv_tty_mode_t mode) { } -int uv_is_tty(uv_file file) { - DWORD result; - return GetConsoleMode((HANDLE) _get_osfhandle(file), &result) != 0; -} - - int uv_tty_get_winsize(uv_tty_t* tty, int* width, int* height) { CONSOLE_SCREEN_BUFFER_INFO info; @@ -484,8 +484,8 @@ static DWORD CALLBACK uv_tty_line_read_thread(void* data) { bytes = MAX_INPUT_BUFFER_LENGTH; } - /* At last, unicode! */ - /* One utf-16 codeunit never takes more than 3 utf-8 codeunits to encode */ + /* At last, unicode! One utf-16 codeunit never takes more than 3 utf-8 + * codeunits to encode. */ chars = bytes / 3; status = InterlockedExchange(&uv__read_console_status, IN_PROGRESS); @@ -620,10 +620,10 @@ static const char* get_vt100_fn_key(DWORD code, char shift, char ctrl, } switch (code) { - /* These mappings are the same as Cygwin's. Unmodified and alt-modified */ - /* keypad keys comply with linux console, modifiers comply with xterm */ - /* modifier usage. F1..f12 and shift-f1..f10 comply with linux console, */ - /* f6..f12 with and without modifiers comply with rxvt. */ + /* These mappings are the same as Cygwin's. Unmodified and alt-modified + * keypad keys comply with linux console, modifiers comply with xterm + * modifier usage. F1. f12 and shift-f1. f10 comply with linux console, f6. + * f12 with and without modifiers comply with rxvt. */ VK_CASE(VK_INSERT, "[2~", "[2;2~", "[2;5~", "[2;6~") VK_CASE(VK_END, "[4~", "[4;2~", "[4;5~", "[4;6~") VK_CASE(VK_DOWN, "[B", "[1;2B", "[1;5B", "[1;6B") @@ -706,8 +706,8 @@ void uv_process_tty_read_raw_req(uv_loop_t* loop, uv_tty_t* handle, goto out; } - /* Windows sends a lot of events that we're not interested in, so buf */ - /* will be allocated on demand, when there's actually something to emit. */ + /* Windows sends a lot of events that we're not interested in, so buf will be + * allocated on demand, when there's actually something to emit. */ buf = uv_null_buf_; buf_used = 0; @@ -733,16 +733,17 @@ void uv_process_tty_read_raw_req(uv_loop_t* loop, uv_tty_t* handle, continue; } - /* Ignore keyup events, unless the left alt key was held and a valid */ - /* unicode character was emitted. */ - if (!KEV.bKeyDown && !(((KEV.dwControlKeyState & LEFT_ALT_PRESSED) || - KEV.wVirtualKeyCode==VK_MENU) && KEV.uChar.UnicodeChar != 0)) { + /* Ignore keyup events, unless the left alt key was held and a valid + * unicode character was emitted. */ + if (!KEV.bKeyDown && + KEV.wVirtualKeyCode != VK_MENU && + KEV.uChar.UnicodeChar != 0) { continue; } - /* Ignore keypresses to numpad number keys if the left alt is held */ - /* because the user is composing a character, or windows simulating */ - /* this. */ + /* Ignore keypresses to numpad number keys if the left alt is held + * because the user is composing a character, or windows simulating this. + */ if ((KEV.dwControlKeyState & LEFT_ALT_PRESSED) && !(KEV.dwControlKeyState & ENHANCED_KEY) && (KEV.wVirtualKeyCode == VK_INSERT || @@ -779,8 +780,8 @@ void uv_process_tty_read_raw_req(uv_loop_t* loop, uv_tty_t* handle, continue; } - /* Prefix with \u033 if alt was held, but alt was not used as part */ - /* a compose sequence. */ + /* Prefix with \u033 if alt was held, but alt was not used as part a + * compose sequence. */ if ((KEV.dwControlKeyState & (LEFT_ALT_PRESSED | RIGHT_ALT_PRESSED)) && !(KEV.dwControlKeyState & (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED)) && KEV.bKeyDown) { @@ -793,8 +794,9 @@ void uv_process_tty_read_raw_req(uv_loop_t* loop, uv_tty_t* handle, if (KEV.uChar.UnicodeChar >= 0xDC00 && KEV.uChar.UnicodeChar < 0xE000) { /* UTF-16 surrogate pair */ - WCHAR utf16_buffer[2] = { handle->tty.rd.last_utf16_high_surrogate, - KEV.uChar.UnicodeChar}; + WCHAR utf16_buffer[2]; + utf16_buffer[0] = handle->tty.rd.last_utf16_high_surrogate; + utf16_buffer[1] = KEV.uChar.UnicodeChar; char_len = WideCharToMultiByte(CP_UTF8, 0, utf16_buffer, @@ -818,8 +820,8 @@ void uv_process_tty_read_raw_req(uv_loop_t* loop, uv_tty_t* handle, /* Whatever happened, the last character wasn't a high surrogate. */ handle->tty.rd.last_utf16_high_surrogate = 0; - /* If the utf16 character(s) couldn't be converted something must */ - /* be wrong. */ + /* If the utf16 character(s) couldn't be converted something must be + * wrong. */ if (!char_len) { handle->flags &= ~UV_HANDLE_READING; DECREASE_ACTIVE_COUNT(loop, handle); @@ -943,21 +945,15 @@ void uv_process_tty_read_line_req(uv_loop_t* loop, uv_tty_t* handle, handle->read_cb((uv_stream_t*) handle, uv_translate_sys_error(GET_REQ_ERROR(req)), &buf); - } else { - /* The read was cancelled, or whatever we don't care */ - handle->read_cb((uv_stream_t*) handle, 0, &buf); } - } else { - if (!(handle->flags & UV_HANDLE_CANCELLATION_PENDING)) { - /* Read successful */ - /* TODO: read unicode, convert to utf-8 */ + if (!(handle->flags & UV_HANDLE_CANCELLATION_PENDING) && + req->u.io.overlapped.InternalHigh != 0) { + /* Read successful. TODO: read unicode, convert to utf-8 */ DWORD bytes = req->u.io.overlapped.InternalHigh; handle->read_cb((uv_stream_t*) handle, bytes, &buf); - } else { - handle->flags &= ~UV_HANDLE_CANCELLATION_PENDING; - handle->read_cb((uv_stream_t*) handle, 0, &buf); } + handle->flags &= ~UV_HANDLE_CANCELLATION_PENDING; } /* Wait for more input events. */ @@ -975,9 +971,9 @@ void uv_process_tty_read_req(uv_loop_t* loop, uv_tty_t* handle, assert(handle->type == UV_TTY); assert(handle->flags & UV_HANDLE_TTY_READABLE); - /* If the read_line_buffer member is zero, it must have been an raw read. */ - /* Otherwise it was a line-buffered read. */ - /* FIXME: This is quite obscure. Use a flag or something. */ + /* If the read_line_buffer member is zero, it must have been an raw read. + * Otherwise it was a line-buffered read. FIXME: This is quite obscure. Use a + * flag or something. */ if (handle->tty.rd.read_line_buffer.len == 0) { uv_process_tty_read_raw_req(loop, handle, req); } else { @@ -999,14 +995,14 @@ int uv_tty_read_start(uv_tty_t* handle, uv_alloc_cb alloc_cb, handle->read_cb = read_cb; handle->alloc_cb = alloc_cb; - /* If reading was stopped and then started again, there could still be a */ - /* read request pending. */ + /* If reading was stopped and then started again, there could still be a read + * request pending. */ if (handle->flags & UV_HANDLE_READ_PENDING) { return 0; } - /* Maybe the user stopped reading half-way while processing key events. */ - /* Short-circuit if this could be the case. */ + /* Maybe the user stopped reading half-way while processing key events. + * Short-circuit if this could be the case. */ if (handle->tty.rd.last_key_len > 0) { SET_REQ_SUCCESS(&handle->read_req); uv_insert_pending_req(handle->loop, (uv_req_t*) &handle->read_req); @@ -1033,9 +1029,10 @@ int uv_tty_read_stop(uv_tty_t* handle) { return 0; if (handle->flags & UV_HANDLE_TTY_RAW) { - /* Cancel raw read */ - /* Write some bullshit event to force the console wait to return. */ + /* Cancel raw read. Write some bullshit event to force the console wait to + * return. */ memset(&record, 0, sizeof record); + record.EventType = FOCUS_EVENT; if (!WriteConsoleInputW(handle->handle, &record, 1, &written)) { return GetLastError(); } @@ -1116,8 +1113,8 @@ static void uv_tty_update_virtual_window(CONSOLE_SCREEN_BUFFER_INFO* info) { uv_tty_virtual_offset = info->dwCursorPosition.Y; } else if (uv_tty_virtual_offset < info->dwCursorPosition.Y - uv_tty_virtual_height + 1) { - /* If suddenly find the cursor outside of the virtual window, it must */ - /* have somehow scrolled. Update the virtual window offset. */ + /* If suddenly find the cursor outside of the virtual window, it must have + * somehow scrolled. Update the virtual window offset. */ uv_tty_virtual_offset = info->dwCursorPosition.Y - uv_tty_virtual_height + 1; } @@ -1304,8 +1301,8 @@ static int uv_tty_clear(uv_tty_t* handle, int dir, char entire_screen, x2 = 0; x2r = 1; } else { - /* Clear to end of row. We pretend the console is 65536 characters wide, */ - /* uv_tty_make_real_coord will clip it to the actual console width. */ + /* Clear to end of row. We pretend the console is 65536 characters wide, + * uv_tty_make_real_coord will clip it to the actual console width. */ x2 = 0xffff; x2r = 0; } @@ -1613,8 +1610,8 @@ static int uv_tty_write_bufs(uv_tty_t* handle, const uv_buf_t bufs[], unsigned int nbufs, DWORD* error) { - /* We can only write 8k characters at a time. Windows can't handle */ - /* much more characters in a single console write anyway. */ + /* We can only write 8k characters at a time. Windows can't handle much more + * characters in a single console write anyway. */ WCHAR utf16_buf[MAX_CONSOLE_CHAR]; WCHAR* utf16_buffer; DWORD utf16_buf_used = 0; @@ -1650,9 +1647,8 @@ static int uv_tty_write_bufs(uv_tty_t* handle, unsigned char previous_eol = handle->tty.wr.previous_eol; unsigned char ansi_parser_state = handle->tty.wr.ansi_parser_state; - /* Store the error here. If we encounter an error, stop trying to do i/o */ - /* but keep parsing the buffer so we leave the parser in a consistent */ - /* state. */ + /* Store the error here. If we encounter an error, stop trying to do i/o but + * keep parsing the buffer so we leave the parser in a consistent state. */ *error = ERROR_SUCCESS; utf16_buffer = utf16_buf; @@ -1700,9 +1696,9 @@ static int uv_tty_write_bufs(uv_tty_t* handle, for (j = 0; j < buf.len; j++) { unsigned char c = buf.base[j]; - /* Run the character through the utf8 decoder We happily accept non */ - /* shortest form encodings and invalid code points - there's no real */ - /* harm that can be done. */ + /* Run the character through the utf8 decoder We happily accept non + * shortest form encodings and invalid code points - there's no real harm + * that can be done. */ if (utf8_bytes_left == 0) { /* Read utf-8 start byte */ DWORD first_zero_bit; @@ -1742,8 +1738,8 @@ static int uv_tty_write_bufs(uv_tty_t* handle, /* Start byte where continuation was expected. */ utf8_bytes_left = 0; utf8_codepoint = UNICODE_REPLACEMENT_CHARACTER; - /* Patch buf offset so this character will be parsed again as a */ - /* start byte. */ + /* Patch buf offset so this character will be parsed again as a start + * byte. */ j--; } @@ -1776,8 +1772,8 @@ static int uv_tty_write_bufs(uv_tty_t* handle, case '_': case 'P': case ']': - /* Not supported, but we'll have to parse until we see a stop */ - /* code, e.g. ESC \ or BEL. */ + /* Not supported, but we'll have to parse until we see a stop code, + * e. g. ESC \ or BEL. */ ansi_parser_state = ANSI_ST_CONTROL; continue; @@ -1859,8 +1855,9 @@ static int uv_tty_write_bufs(uv_tty_t* handle, continue; } else { - /* If ANSI_IN_ARG is not set, add another argument and */ - /* default it to 0. */ + /* If ANSI_IN_ARG is not set, add another argument and default it + * to 0. */ + /* Check for too many arguments */ if (handle->tty.wr.ansi_csi_argc >= ARRAY_SIZE(handle->tty.wr.ansi_csi_argv)) { ansi_parser_state |= ANSI_IGNORE; @@ -1874,9 +1871,9 @@ static int uv_tty_write_bufs(uv_tty_t* handle, } else if (utf8_codepoint == '?' && !(ansi_parser_state & ANSI_IN_ARG) && handle->tty.wr.ansi_csi_argc == 0) { - /* Ignores '?' if it is the first character after CSI[ */ - /* This is an extension character from the VT100 codeset */ - /* that is supported and used by most ANSI terminals today. */ + /* Ignores '?' if it is the first character after CSI[. This is an + * extension character from the VT100 codeset that is supported and + * used by most ANSI terminals today. */ continue; } else if (utf8_codepoint >= '@' && utf8_codepoint <= '~' && @@ -2006,8 +2003,8 @@ static int uv_tty_write_bufs(uv_tty_t* handle, continue; } else { - /* We don't support commands that use private mode characters or */ - /* intermediaries. Ignore the rest of the sequence. */ + /* We don't support commands that use private mode characters or + * intermediaries. Ignore the rest of the sequence. */ ansi_parser_state |= ANSI_IGNORE; continue; } @@ -2020,8 +2017,8 @@ static int uv_tty_write_bufs(uv_tty_t* handle, } } else if (ansi_parser_state & ANSI_ST_CONTROL) { - /* Unsupported control code */ - /* Ignore everything until we see BEL or ESC \ */ + /* Unsupported control code. + * Ignore everything until we see `BEL` or `ESC \`. */ if (ansi_parser_state & ANSI_IN_STRING) { if (!(ansi_parser_state & ANSI_BACKSLASH_SEEN)) { if (utf8_codepoint == '"') { @@ -2055,9 +2052,9 @@ static int uv_tty_write_bufs(uv_tty_t* handle, abort(); } - /* We wouldn't mind emitting utf-16 surrogate pairs. Too bad, the */ - /* windows console doesn't really support UTF-16, so just emit the */ - /* replacement character. */ + /* We wouldn't mind emitting utf-16 surrogate pairs. Too bad, the windows + * console doesn't really support UTF-16, so just emit the replacement + * character. */ if (utf8_codepoint > 0xffff) { utf8_codepoint = UNICODE_REPLACEMENT_CHARACTER; } @@ -2071,10 +2068,10 @@ static int uv_tty_write_bufs(uv_tty_t* handle, utf16_buf[utf16_buf_used++] = L'\r'; utf16_buf[utf16_buf_used++] = L'\n'; } else if (utf8_codepoint == 0x0d && previous_eol == 0x0a) { - /* \n was followed by \r; do not print the \r, since */ - /* the source was either \r\n\r (so the second \r is */ - /* redundant) or was \n\r (so the \n was processed */ - /* by the last case and an \r automatically inserted). */ + /* \n was followed by \r; do not print the \r, since the source was + * either \r\n\r (so the second \r is redundant) or was \n\r (so the + * \n was processed by the last case and an \r automatically + * inserted). */ } else { /* \r without \n; print \r as-is. */ ENSURE_BUFFER_SPACE(1); @@ -2182,14 +2179,14 @@ void uv_process_tty_write_req(uv_loop_t* loop, uv_tty_t* handle, void uv_tty_close(uv_tty_t* handle) { assert(handle->u.fd == -1 || handle->u.fd > 2); + if (handle->flags & UV_HANDLE_READING) + uv_tty_read_stop(handle); + if (handle->u.fd == -1) CloseHandle(handle->handle); else close(handle->u.fd); - if (handle->flags & UV_HANDLE_READING) - uv_tty_read_stop(handle); - handle->u.fd = -1; handle->handle = INVALID_HANDLE_VALUE; handle->flags &= ~(UV_HANDLE_READABLE | UV_HANDLE_WRITABLE); @@ -2209,7 +2206,7 @@ void uv_tty_endgame(uv_loop_t* loop, uv_tty_t* handle) { /* TTY shutdown is really just a no-op */ if (handle->stream.conn.shutdown_req->cb) { - if (handle->flags & UV__HANDLE_CLOSING) { + if (handle->flags & UV_HANDLE_CLOSING) { handle->stream.conn.shutdown_req->cb(handle->stream.conn.shutdown_req, UV_ECANCELED); } else { handle->stream.conn.shutdown_req->cb(handle->stream.conn.shutdown_req, 0); @@ -2222,10 +2219,10 @@ void uv_tty_endgame(uv_loop_t* loop, uv_tty_t* handle) { return; } - if (handle->flags & UV__HANDLE_CLOSING && + if (handle->flags & UV_HANDLE_CLOSING && handle->reqs_pending == 0) { - /* The wait handle used for raw reading should be unregistered when the */ - /* wait callback runs. */ + /* The wait handle used for raw reading should be unregistered when the + * wait callback runs. */ assert(!(handle->flags & UV_HANDLE_TTY_READABLE) || handle->tty.rd.read_raw_wait == NULL); diff --git a/src/win/udp.c b/src/win/udp.c index cd1d0e0..37df849 100644 --- a/src/win/udp.c +++ b/src/win/udp.c @@ -74,8 +74,8 @@ static int uv_udp_set_socket(uv_loop_t* loop, uv_udp_t* handle, SOCKET socket, return GetLastError(); } - /* Associate it with the I/O completion port. */ - /* Use uv_handle_t pointer as completion key. */ + /* Associate it with the I/O completion port. Use uv_handle_t pointer as + * completion key. */ if (CreateIoCompletionPort((HANDLE)socket, loop->iocp, (ULONG_PTR)socket, @@ -83,31 +83,28 @@ static int uv_udp_set_socket(uv_loop_t* loop, uv_udp_t* handle, SOCKET socket, return GetLastError(); } - if (pSetFileCompletionNotificationModes) { - /* All known Windows that support SetFileCompletionNotificationModes */ - /* have a bug that makes it impossible to use this function in */ - /* conjunction with datagram sockets. We can work around that but only */ - /* if the user is using the default UDP driver (AFD) and has no other */ - /* LSPs stacked on top. Here we check whether that is the case. */ - opt_len = (int) sizeof info; - if (getsockopt(socket, - SOL_SOCKET, - SO_PROTOCOL_INFOW, - (char*) &info, - &opt_len) == SOCKET_ERROR) { - return GetLastError(); - } + /* All known Windows that support SetFileCompletionNotificationModes have a + * bug that makes it impossible to use this function in conjunction with + * datagram sockets. We can work around that but only if the user is using + * the default UDP driver (AFD) and has no other. LSPs stacked on top. Here + * we check whether that is the case. */ + opt_len = (int) sizeof info; + if (getsockopt( + socket, SOL_SOCKET, SO_PROTOCOL_INFOW, (char*) &info, &opt_len) == + SOCKET_ERROR) { + return GetLastError(); + } - if (info.ProtocolChain.ChainLen == 1) { - if (pSetFileCompletionNotificationModes((HANDLE)socket, - FILE_SKIP_SET_EVENT_ON_HANDLE | - FILE_SKIP_COMPLETION_PORT_ON_SUCCESS)) { - handle->flags |= UV_HANDLE_SYNC_BYPASS_IOCP; - handle->func_wsarecv = uv_wsarecv_workaround; - handle->func_wsarecvfrom = uv_wsarecvfrom_workaround; - } else if (GetLastError() != ERROR_INVALID_FUNCTION) { - return GetLastError(); - } + if (info.ProtocolChain.ChainLen == 1) { + if (SetFileCompletionNotificationModes( + (HANDLE) socket, + FILE_SKIP_SET_EVENT_ON_HANDLE | + FILE_SKIP_COMPLETION_PORT_ON_SUCCESS)) { + handle->flags |= UV_HANDLE_SYNC_BYPASS_IOCP; + handle->func_wsarecv = uv_wsarecv_workaround; + handle->func_wsarecvfrom = uv_wsarecvfrom_workaround; + } else if (GetLastError() != ERROR_INVALID_FUNCTION) { + return GetLastError(); } } @@ -191,7 +188,7 @@ void uv_udp_close(uv_loop_t* loop, uv_udp_t* handle) { void uv_udp_endgame(uv_loop_t* loop, uv_udp_t* handle) { - if (handle->flags & UV__HANDLE_CLOSING && + if (handle->flags & UV_HANDLE_CLOSING && handle->reqs_pending == 0) { assert(!(handle->flags & UV_HANDLE_CLOSED)); uv__handle_close(handle); @@ -245,12 +242,12 @@ static int uv_udp_maybe_bind(uv_udp_t* handle, handle->flags |= UV_HANDLE_IPV6; if (addr->sa_family == AF_INET6 && !(flags & UV_UDP_IPV6ONLY)) { - /* On windows IPV6ONLY is on by default. */ - /* If the user doesn't specify it libuv turns it off. */ + /* On windows IPV6ONLY is on by default. If the user doesn't specify it + * libuv turns it off. */ - /* TODO: how to handle errors? This may fail if there is no ipv4 stack */ - /* available, or when run on XP/2003 which have no support for dualstack */ - /* sockets. For now we're silently ignoring the error. */ + /* TODO: how to handle errors? This may fail if there is no ipv4 stack + * available, or when run on XP/2003 which have no support for dualstack + * sockets. For now we're silently ignoring the error. */ setsockopt(handle->socket, IPPROTO_IPV6, IPV6_V6ONLY, @@ -369,7 +366,7 @@ int uv__udp_recv_start(uv_udp_t* handle, uv_alloc_cb alloc_cb, int err; if (handle->flags & UV_HANDLE_READING) { - return WSAEALREADY; + return UV_EALREADY; } err = uv_udp_maybe_bind(handle, @@ -377,7 +374,7 @@ int uv__udp_recv_start(uv_udp_t* handle, uv_alloc_cb alloc_cb, sizeof(uv_addr_ip4_any_), 0); if (err) - return err; + return uv_translate_sys_error(err); handle->flags |= UV_HANDLE_READING; INCREASE_ACTIVE_COUNT(loop, handle); @@ -386,8 +383,8 @@ int uv__udp_recv_start(uv_udp_t* handle, uv_alloc_cb alloc_cb, handle->recv_cb = recv_cb; handle->alloc_cb = alloc_cb; - /* If reading was stopped and then started again, there could still be a */ - /* recv request pending. */ + /* If reading was stopped and then started again, there could still be a recv + * request pending. */ if (!(handle->flags & UV_HANDLE_READ_PENDING)) uv_udp_queue_recv(loop, handle); @@ -467,19 +464,19 @@ void uv_process_udp_recv_req(uv_loop_t* loop, uv_udp_t* handle, if (!REQ_SUCCESS(req)) { DWORD err = GET_REQ_SOCK_ERROR(req); if (err == WSAEMSGSIZE) { - /* Not a real error, it just indicates that the received packet */ - /* was bigger than the receive buffer. */ + /* Not a real error, it just indicates that the received packet was + * bigger than the receive buffer. */ } else if (err == WSAECONNRESET || err == WSAENETRESET) { - /* A previous sendto operation failed; ignore this error. If */ - /* zero-reading we need to call WSARecv/WSARecvFrom _without_ the */ - /* MSG_PEEK flag to clear out the error queue. For nonzero reads, */ - /* immediately queue a new receive. */ + /* A previous sendto operation failed; ignore this error. If zero-reading + * we need to call WSARecv/WSARecvFrom _without_ the. MSG_PEEK flag to + * clear out the error queue. For nonzero reads, immediately queue a new + * receive. */ if (!(handle->flags & UV_HANDLE_ZERO_READ)) { goto done; } } else { - /* A real error occurred. Report the error to the user only if we're */ - /* currently reading. */ + /* A real error occurred. Report the error to the user only if we're + * currently reading. */ if (handle->flags & UV_HANDLE_READING) { uv_udp_recv_stop(handle); buf = (handle->flags & UV_HANDLE_ZERO_READ) ? @@ -503,8 +500,8 @@ void uv_process_udp_recv_req(uv_loop_t* loop, uv_udp_t* handle, struct sockaddr_storage from; int from_len; - /* Do a nonblocking receive */ - /* TODO: try to read multiple datagrams at once. FIONREAD maybe? */ + /* Do a nonblocking receive. + * TODO: try to read multiple datagrams at once. FIONREAD maybe? */ buf = uv_buf_init(NULL, 0); handle->alloc_cb((uv_handle_t*) handle, 65536, &buf); if (buf.base == NULL || buf.len == 0) { @@ -741,7 +738,7 @@ int uv_udp_set_multicast_interface(uv_udp_t* handle, const char* interface_addr) return UV_EINVAL; } - if (!(handle->flags & UV_HANDLE_BOUND)) + if (handle->socket == INVALID_SOCKET) return UV_EBADF; if (addr_st.ss_family == AF_INET) { @@ -772,7 +769,7 @@ int uv_udp_set_multicast_interface(uv_udp_t* handle, const char* interface_addr) int uv_udp_set_broadcast(uv_udp_t* handle, int value) { BOOL optval = (BOOL) value; - if (!(handle->flags & UV_HANDLE_BOUND)) + if (handle->socket == INVALID_SOCKET) return UV_EBADF; if (setsockopt(handle->socket, @@ -818,7 +815,7 @@ int uv_udp_open(uv_udp_t* handle, uv_os_sock_t sock) { return UV_EINVAL; \ } \ \ - if (!(handle->flags & UV_HANDLE_BOUND)) \ + if (handle->socket == INVALID_SOCKET) \ return UV_EBADF; \ \ if (!(handle->flags & UV_HANDLE_IPV6)) { \ diff --git a/src/win/util.c b/src/win/util.c index 49b5bc7..9237891 100644 --- a/src/win/util.c +++ b/src/win/util.c @@ -74,10 +74,6 @@ static char *process_title; static CRITICAL_SECTION process_title_lock; -/* Cached copy of the process id, written once. */ -static DWORD current_pid = 0; - - /* Interval (in seconds) of the high-resolution clock. */ static double hrtime_interval_ = 0; @@ -149,8 +145,8 @@ int uv_exepath(char* buffer, size_t* size_ptr) { uv__free(utf16_buffer); - /* utf8_len *does* include the terminating null at this point, but the */ - /* returned size shouldn't. */ + /* utf8_len *does* include the terminating null at this point, but the + * returned size shouldn't. */ *size_ptr = utf8_len - 1; return 0; @@ -173,16 +169,16 @@ int uv_cwd(char* buffer, size_t* size) { if (utf16_len == 0) { return uv_translate_sys_error(GetLastError()); } else if (utf16_len > MAX_PATH) { - /* This should be impossible; however the CRT has a code path to deal */ - /* with this scenario, so I added a check anyway. */ + /* This should be impossible; however the CRT has a code path to deal with + * this scenario, so I added a check anyway. */ return UV_EIO; } /* utf16_len contains the length, *not* including the terminating null. */ utf16_buffer[utf16_len] = L'\0'; - /* The returned directory should not have a trailing slash, unless it */ - /* points at a drive root, like c:\. Remove it if needed.*/ + /* The returned directory should not have a trailing slash, unless it points + * at a drive root, like c:\. Remove it if needed. */ if (utf16_buffer[utf16_len - 1] == L'\\' && !(utf16_len == 3 && utf16_buffer[1] == L':')) { utf16_len--; @@ -239,9 +235,9 @@ int uv_chdir(const char* dir) { utf16_buffer, MAX_PATH) == 0) { DWORD error = GetLastError(); - /* The maximum length of the current working directory is 260 chars, */ - /* including terminating null. If it doesn't fit, the path name must be */ - /* too long. */ + /* The maximum length of the current working directory is 260 chars, + * including terminating null. If it doesn't fit, the path name must be too + * long. */ if (error == ERROR_INSUFFICIENT_BUFFER) { return UV_ENAMETOOLONG; } else { @@ -253,9 +249,9 @@ int uv_chdir(const char* dir) { return uv_translate_sys_error(GetLastError()); } - /* Windows stores the drive-local path in an "hidden" environment variable, */ - /* which has the form "=C:=C:\Windows". SetCurrentDirectory does not */ - /* update this, so we'll have to do it. */ + /* Windows stores the drive-local path in an "hidden" environment variable, + * which has the form "=C:=C:\Windows". SetCurrentDirectory does not update + * this, so we'll have to do it. */ utf16_len = GetCurrentDirectoryW(MAX_PATH, utf16_buffer); if (utf16_len == 0) { return uv_translate_sys_error(GetLastError()); @@ -263,8 +259,8 @@ int uv_chdir(const char* dir) { return UV_EIO; } - /* The returned directory should not have a trailing slash, unless it */ - /* points at a drive root, like c:\. Remove it if needed. */ + /* The returned directory should not have a trailing slash, unless it points + * at a drive root, like c:\. Remove it if needed. */ if (utf16_buffer[utf16_len - 1] == L'\\' && !(utf16_len == 3 && utf16_buffer[1] == L':')) { utf16_len--; @@ -272,8 +268,8 @@ int uv_chdir(const char* dir) { } if (utf16_len < 2 || utf16_buffer[1] != L':') { - /* Doesn't look like a drive letter could be there - probably an UNC */ - /* path. TODO: Need to handle win32 namespaces like \\?\C:\ ? */ + /* Doesn't look like a drive letter could be there - probably an UNC path. + * TODO: Need to handle win32 namespaces like \\?\C:\ ? */ drive_letter = 0; } else if (utf16_buffer[0] >= L'A' && utf16_buffer[0] <= L'Z') { drive_letter = utf16_buffer[0]; @@ -359,14 +355,6 @@ uv_pid_t uv_os_getppid(void) { } -int uv_current_pid(void) { - if (current_pid == 0) { - current_pid = GetCurrentProcessId(); - } - return current_pid; -} - - char** uv_setup_args(int argc, char** argv) { return argv; } @@ -828,6 +816,9 @@ int uv_interface_addresses(uv_interface_address_t** addresses_ptr, int is_vista_or_greater; ULONG flags; + *addresses_ptr = NULL; + *count_ptr = 0; + is_vista_or_greater = is_windows_version_or_greater(6, 0, 0, 0); if (is_vista_or_greater) { flags = GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST | @@ -842,17 +833,17 @@ int uv_interface_addresses(uv_interface_address_t** addresses_ptr, } - /* Fetch the size of the adapters reported by windows, and then get the */ - /* list itself. */ + /* Fetch the size of the adapters reported by windows, and then get the list + * itself. */ win_address_buf_size = 0; win_address_buf = NULL; for (;;) { ULONG r; - /* If win_address_buf is 0, then GetAdaptersAddresses will fail with */ - /* ERROR_BUFFER_OVERFLOW, and the required buffer size will be stored in */ - /* win_address_buf_size. */ + /* If win_address_buf is 0, then GetAdaptersAddresses will fail with. + * ERROR_BUFFER_OVERFLOW, and the required buffer size will be stored in + * win_address_buf_size. */ r = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, @@ -866,8 +857,8 @@ int uv_interface_addresses(uv_interface_address_t** addresses_ptr, switch (r) { case ERROR_BUFFER_OVERFLOW: - /* This happens when win_address_buf is NULL or too small to hold */ - /* all adapters. */ + /* This happens when win_address_buf is NULL or too small to hold all + * adapters. */ win_address_buf = uv__malloc(win_address_buf_size); if (win_address_buf == NULL) return UV_ENOMEM; @@ -901,15 +892,15 @@ int uv_interface_addresses(uv_interface_address_t** addresses_ptr, return UV_ENOBUFS; default: - /* Other (unspecified) errors can happen, but we don't have any */ - /* special meaning for them. */ + /* Other (unspecified) errors can happen, but we don't have any special + * meaning for them. */ assert(r != ERROR_SUCCESS); return uv_translate_sys_error(r); } } - /* Count the number of enabled interfaces and compute how much space is */ - /* needed to store their info. */ + /* Count the number of enabled interfaces and compute how much space is + * needed to store their info. */ count = 0; uv_address_buf_size = 0; @@ -919,9 +910,9 @@ int uv_interface_addresses(uv_interface_address_t** addresses_ptr, IP_ADAPTER_UNICAST_ADDRESS* unicast_address; int name_size; - /* Interfaces that are not 'up' should not be reported. Also skip */ - /* interfaces that have no associated unicast address, as to avoid */ - /* allocating space for the name for this interface. */ + /* Interfaces that are not 'up' should not be reported. Also skip + * interfaces that have no associated unicast address, as to avoid + * allocating space for the name for this interface. */ if (adapter->OperStatus != IfOperStatusUp || adapter->FirstUnicastAddress == NULL) continue; @@ -941,8 +932,8 @@ int uv_interface_addresses(uv_interface_address_t** addresses_ptr, } uv_address_buf_size += name_size; - /* Count the number of addresses associated with this interface, and */ - /* compute the size. */ + /* Count the number of addresses associated with this interface, and + * compute the size. */ for (unicast_address = (IP_ADAPTER_UNICAST_ADDRESS*) adapter->FirstUnicastAddress; unicast_address != NULL; @@ -959,8 +950,8 @@ int uv_interface_addresses(uv_interface_address_t** addresses_ptr, return UV_ENOMEM; } - /* Compute the start of the uv_interface_address_t array, and the place in */ - /* the buffer where the interface names will be stored. */ + /* Compute the start of the uv_interface_address_t array, and the place in + * the buffer where the interface names will be stored. */ uv_address = uv_address_buf; name_buf = (char*) (uv_address_buf + count); @@ -1199,8 +1190,8 @@ int uv_os_tmpdir(char* buffer, size_t* size) { return UV_EIO; } - /* The returned directory should not have a trailing slash, unless it */ - /* points at a drive root, like c:\. Remove it if needed.*/ + /* The returned directory should not have a trailing slash, unless it points + * at a drive root, like c:\. Remove it if needed. */ if (path[len - 1] == L'\\' && !(len == 3 && path[1] == L':')) { len--; @@ -1542,3 +1533,214 @@ int uv_os_gethostname(char* buffer, size_t* size) { *size = len; return 0; } + + +static int uv__get_handle(uv_pid_t pid, int access, HANDLE* handle) { + int r; + + if (pid == 0) + *handle = GetCurrentProcess(); + else + *handle = OpenProcess(access, FALSE, pid); + + if (*handle == NULL) { + r = GetLastError(); + + if (r == ERROR_INVALID_PARAMETER) + return UV_ESRCH; + else + return uv_translate_sys_error(r); + } + + return 0; +} + + +int uv_os_getpriority(uv_pid_t pid, int* priority) { + HANDLE handle; + int r; + + if (priority == NULL) + return UV_EINVAL; + + r = uv__get_handle(pid, PROCESS_QUERY_LIMITED_INFORMATION, &handle); + + if (r != 0) + return r; + + r = GetPriorityClass(handle); + + if (r == 0) { + r = uv_translate_sys_error(GetLastError()); + } else { + /* Map Windows priority classes to Unix nice values. */ + if (r == REALTIME_PRIORITY_CLASS) + *priority = UV_PRIORITY_HIGHEST; + else if (r == HIGH_PRIORITY_CLASS) + *priority = UV_PRIORITY_HIGH; + else if (r == ABOVE_NORMAL_PRIORITY_CLASS) + *priority = UV_PRIORITY_ABOVE_NORMAL; + else if (r == NORMAL_PRIORITY_CLASS) + *priority = UV_PRIORITY_NORMAL; + else if (r == BELOW_NORMAL_PRIORITY_CLASS) + *priority = UV_PRIORITY_BELOW_NORMAL; + else /* IDLE_PRIORITY_CLASS */ + *priority = UV_PRIORITY_LOW; + + r = 0; + } + + CloseHandle(handle); + return r; +} + + +int uv_os_setpriority(uv_pid_t pid, int priority) { + HANDLE handle; + int priority_class; + int r; + + /* Map Unix nice values to Windows priority classes. */ + if (priority < UV_PRIORITY_HIGHEST || priority > UV_PRIORITY_LOW) + return UV_EINVAL; + else if (priority < UV_PRIORITY_HIGH) + priority_class = REALTIME_PRIORITY_CLASS; + else if (priority < UV_PRIORITY_ABOVE_NORMAL) + priority_class = HIGH_PRIORITY_CLASS; + else if (priority < UV_PRIORITY_NORMAL) + priority_class = ABOVE_NORMAL_PRIORITY_CLASS; + else if (priority < UV_PRIORITY_BELOW_NORMAL) + priority_class = NORMAL_PRIORITY_CLASS; + else if (priority < UV_PRIORITY_LOW) + priority_class = BELOW_NORMAL_PRIORITY_CLASS; + else + priority_class = IDLE_PRIORITY_CLASS; + + r = uv__get_handle(pid, PROCESS_SET_INFORMATION, &handle); + + if (r != 0) + return r; + + if (SetPriorityClass(handle, priority_class) == 0) + r = uv_translate_sys_error(GetLastError()); + + CloseHandle(handle); + return r; +} + + +int uv_os_uname(uv_utsname_t* buffer) { + /* Implementation loosely based on + https://github.com/gagern/gnulib/blob/master/lib/uname.c */ + OSVERSIONINFOW os_info; + SYSTEM_INFO system_info; + int processor_level; + int r; + + if (buffer == NULL) + return UV_EINVAL; + + uv__once_init(); + os_info.dwOSVersionInfoSize = sizeof(os_info); + os_info.szCSDVersion[0] = L'\0'; + + /* Try calling RtlGetVersion(), and fall back to the deprecated GetVersionEx() + if RtlGetVersion() is not available. */ + if (pRtlGetVersion) { + pRtlGetVersion(&os_info); + } else { + /* Silence GetVersionEx() deprecation warning. */ + #pragma warning(suppress : 4996) + if (GetVersionExW(&os_info) == 0) { + r = uv_translate_sys_error(GetLastError()); + goto error; + } + } + + /* Populate the version field. */ + if (WideCharToMultiByte(CP_UTF8, + 0, + os_info.szCSDVersion, + -1, + buffer->version, + sizeof(buffer->version), + NULL, + NULL) == 0) { + r = uv_translate_sys_error(GetLastError()); + goto error; + } + + /* Populate the sysname field. */ +#ifdef __MINGW32__ + r = snprintf(buffer->sysname, + sizeof(buffer->sysname), + "MINGW32_NT-%u.%u", + (unsigned int) os_info.dwMajorVersion, + (unsigned int) os_info.dwMinorVersion); + assert(r < sizeof(buffer->sysname)); +#else + uv__strscpy(buffer->sysname, "Windows_NT", sizeof(buffer->sysname)); +#endif + + /* Populate the release field. */ + r = snprintf(buffer->release, + sizeof(buffer->release), + "%d.%d.%d", + (unsigned int) os_info.dwMajorVersion, + (unsigned int) os_info.dwMinorVersion, + (unsigned int) os_info.dwBuildNumber); + assert(r < sizeof(buffer->release)); + + /* Populate the machine field. */ + GetSystemInfo(&system_info); + + switch (system_info.wProcessorArchitecture) { + case PROCESSOR_ARCHITECTURE_AMD64: + uv__strscpy(buffer->machine, "x86_64", sizeof(buffer->machine)); + break; + case PROCESSOR_ARCHITECTURE_IA64: + uv__strscpy(buffer->machine, "ia64", sizeof(buffer->machine)); + break; + case PROCESSOR_ARCHITECTURE_INTEL: + uv__strscpy(buffer->machine, "i386", sizeof(buffer->machine)); + + if (system_info.wProcessorLevel > 3) { + processor_level = system_info.wProcessorLevel < 6 ? + system_info.wProcessorLevel : 6; + buffer->machine[1] = '0' + processor_level; + } + + break; + case PROCESSOR_ARCHITECTURE_IA32_ON_WIN64: + uv__strscpy(buffer->machine, "i686", sizeof(buffer->machine)); + break; + case PROCESSOR_ARCHITECTURE_MIPS: + uv__strscpy(buffer->machine, "mips", sizeof(buffer->machine)); + break; + case PROCESSOR_ARCHITECTURE_ALPHA: + case PROCESSOR_ARCHITECTURE_ALPHA64: + uv__strscpy(buffer->machine, "alpha", sizeof(buffer->machine)); + break; + case PROCESSOR_ARCHITECTURE_PPC: + uv__strscpy(buffer->machine, "powerpc", sizeof(buffer->machine)); + break; + case PROCESSOR_ARCHITECTURE_SHX: + uv__strscpy(buffer->machine, "sh", sizeof(buffer->machine)); + break; + case PROCESSOR_ARCHITECTURE_ARM: + uv__strscpy(buffer->machine, "arm", sizeof(buffer->machine)); + break; + default: + uv__strscpy(buffer->machine, "unknown", sizeof(buffer->machine)); + break; + } + + return 0; + +error: + buffer->sysname[0] = '\0'; + buffer->release[0] = '\0'; + buffer->version[0] = '\0'; + buffer->machine[0] = '\0'; + return r; +} diff --git a/src/win/winapi.c b/src/win/winapi.c index c330786..fbbbcee 100644 --- a/src/win/winapi.c +++ b/src/win/winapi.c @@ -26,6 +26,7 @@ /* Ntdll function pointers */ +sRtlGetVersion pRtlGetVersion; sRtlNtStatusToDosError pRtlNtStatusToDosError; sNtDeviceIoControlFile pNtDeviceIoControlFile; sNtQueryInformationFile pNtQueryInformationFile; @@ -34,20 +35,8 @@ sNtQueryVolumeInformationFile pNtQueryVolumeInformationFile; sNtQueryDirectoryFile pNtQueryDirectoryFile; sNtQuerySystemInformation pNtQuerySystemInformation; - /* Kernel32 function pointers */ sGetQueuedCompletionStatusEx pGetQueuedCompletionStatusEx; -sSetFileCompletionNotificationModes pSetFileCompletionNotificationModes; -sCreateSymbolicLinkW pCreateSymbolicLinkW; -sCancelIoEx pCancelIoEx; -sInitializeConditionVariable pInitializeConditionVariable; -sSleepConditionVariableCS pSleepConditionVariableCS; -sSleepConditionVariableSRW pSleepConditionVariableSRW; -sWakeAllConditionVariable pWakeAllConditionVariable; -sWakeConditionVariable pWakeConditionVariable; -sCancelSynchronousIo pCancelSynchronousIo; -sGetFinalPathNameByHandleW pGetFinalPathNameByHandleW; - /* Powrprof.dll function pointer */ sPowerRegisterSuspendResumeNotification pPowerRegisterSuspendResumeNotification; @@ -55,22 +44,21 @@ sPowerRegisterSuspendResumeNotification pPowerRegisterSuspendResumeNotification; /* User32.dll function pointer */ sSetWinEventHook pSetWinEventHook; -/* iphlpapi.dll function pointer */ -sConvertInterfaceIndexToLuid pConvertInterfaceIndexToLuid = NULL; -sConvertInterfaceLuidToNameW pConvertInterfaceLuidToNameW = NULL; void uv_winapi_init(void) { HMODULE ntdll_module; - HMODULE kernel32_module; HMODULE powrprof_module; HMODULE user32_module; - HMODULE iphlpapi_module; + HMODULE kernel32_module; ntdll_module = GetModuleHandleA("ntdll.dll"); if (ntdll_module == NULL) { uv_fatal_error(GetLastError(), "GetModuleHandleA"); } + pRtlGetVersion = (sRtlGetVersion) GetProcAddress(ntdll_module, + "RtlGetVersion"); + pRtlNtStatusToDosError = (sRtlNtStatusToDosError) GetProcAddress( ntdll_module, "RtlNtStatusToDosError"); @@ -127,37 +115,6 @@ void uv_winapi_init(void) { kernel32_module, "GetQueuedCompletionStatusEx"); - pSetFileCompletionNotificationModes = (sSetFileCompletionNotificationModes) - GetProcAddress(kernel32_module, "SetFileCompletionNotificationModes"); - - pCreateSymbolicLinkW = (sCreateSymbolicLinkW) - GetProcAddress(kernel32_module, "CreateSymbolicLinkW"); - - pCancelIoEx = (sCancelIoEx) - GetProcAddress(kernel32_module, "CancelIoEx"); - - pInitializeConditionVariable = (sInitializeConditionVariable) - GetProcAddress(kernel32_module, "InitializeConditionVariable"); - - pSleepConditionVariableCS = (sSleepConditionVariableCS) - GetProcAddress(kernel32_module, "SleepConditionVariableCS"); - - pSleepConditionVariableSRW = (sSleepConditionVariableSRW) - GetProcAddress(kernel32_module, "SleepConditionVariableSRW"); - - pWakeAllConditionVariable = (sWakeAllConditionVariable) - GetProcAddress(kernel32_module, "WakeAllConditionVariable"); - - pWakeConditionVariable = (sWakeConditionVariable) - GetProcAddress(kernel32_module, "WakeConditionVariable"); - - pCancelSynchronousIo = (sCancelSynchronousIo) - GetProcAddress(kernel32_module, "CancelSynchronousIo"); - - pGetFinalPathNameByHandleW = (sGetFinalPathNameByHandleW) - GetProcAddress(kernel32_module, "GetFinalPathNameByHandleW"); - - powrprof_module = LoadLibraryA("powrprof.dll"); if (powrprof_module != NULL) { pPowerRegisterSuspendResumeNotification = (sPowerRegisterSuspendResumeNotification) @@ -170,11 +127,4 @@ void uv_winapi_init(void) { GetProcAddress(user32_module, "SetWinEventHook"); } - iphlpapi_module = LoadLibraryA("iphlpapi.dll"); - if (iphlpapi_module != NULL) { - pConvertInterfaceIndexToLuid = (sConvertInterfaceIndexToLuid) - GetProcAddress(iphlpapi_module, "ConvertInterfaceIndexToLuid"); - pConvertInterfaceLuidToNameW = (sConvertInterfaceLuidToNameW) - GetProcAddress(iphlpapi_module, "ConvertInterfaceLuidToNameW"); - } } diff --git a/src/win/winapi.h b/src/win/winapi.h index 38570c2..82c5ed4 100644 --- a/src/win/winapi.h +++ b/src/win/winapi.h @@ -4076,8 +4076,8 @@ # define STATUS_HASH_NOT_PRESENT ((NTSTATUS) 0xC000A101L) #endif -/* This is not the NTSTATUS_FROM_WIN32 that the DDK provides, because the */ -/* DDK got it wrong! */ +/* This is not the NTSTATUS_FROM_WIN32 that the DDK provides, because the DDK + * got it wrong! */ #ifdef NTSTATUS_FROM_WIN32 # undef NTSTATUS_FROM_WIN32 #endif @@ -4109,6 +4109,9 @@ #endif /* from winternl.h */ +#if !defined(__UNICODE_STRING_DEFINED) && defined(__MINGW32_) +#define __UNICODE_STRING_DEFINED +#endif typedef struct _UNICODE_STRING { USHORT Length; USHORT MaximumLength; @@ -4516,6 +4519,9 @@ typedef VOID (NTAPI *PIO_APC_ROUTINE) PIO_STATUS_BLOCK IoStatusBlock, ULONG Reserved); +typedef NTSTATUS (NTAPI *sRtlGetVersion) + (PRTL_OSVERSIONINFOW lpVersionInformation); + typedef ULONG (NTAPI *sRtlNtStatusToDosError) (NTSTATUS Status); @@ -4650,48 +4656,6 @@ typedef BOOL (WINAPI *sGetQueuedCompletionStatusEx) DWORD dwMilliseconds, BOOL fAlertable); -typedef BOOL (WINAPI* sSetFileCompletionNotificationModes) - (HANDLE FileHandle, - UCHAR Flags); - -typedef BOOLEAN (WINAPI* sCreateSymbolicLinkW) - (LPCWSTR lpSymlinkFileName, - LPCWSTR lpTargetFileName, - DWORD dwFlags); - -typedef BOOL (WINAPI* sCancelIoEx) - (HANDLE hFile, - LPOVERLAPPED lpOverlapped); - -typedef VOID (WINAPI* sInitializeConditionVariable) - (PCONDITION_VARIABLE ConditionVariable); - -typedef BOOL (WINAPI* sSleepConditionVariableCS) - (PCONDITION_VARIABLE ConditionVariable, - PCRITICAL_SECTION CriticalSection, - DWORD dwMilliseconds); - -typedef BOOL (WINAPI* sSleepConditionVariableSRW) - (PCONDITION_VARIABLE ConditionVariable, - PSRWLOCK SRWLock, - DWORD dwMilliseconds, - ULONG Flags); - -typedef VOID (WINAPI* sWakeAllConditionVariable) - (PCONDITION_VARIABLE ConditionVariable); - -typedef VOID (WINAPI* sWakeConditionVariable) - (PCONDITION_VARIABLE ConditionVariable); - -typedef BOOL (WINAPI* sCancelSynchronousIo) - (HANDLE hThread); - -typedef DWORD (WINAPI* sGetFinalPathNameByHandleW) - (HANDLE hFile, - LPWSTR lpszFilePath, - DWORD cchFilePath, - DWORD dwFlags); - /* from powerbase.h */ #ifndef DEVICE_NOTIFY_CALLBACK # define DEVICE_NOTIFY_CALLBACK 2 @@ -4746,6 +4710,7 @@ typedef HWINEVENTHOOK (WINAPI *sSetWinEventHook) /* Ntdll function pointers */ +extern sRtlGetVersion pRtlGetVersion; extern sRtlNtStatusToDosError pRtlNtStatusToDosError; extern sNtDeviceIoControlFile pNtDeviceIoControlFile; extern sNtQueryInformationFile pNtQueryInformationFile; @@ -4754,20 +4719,8 @@ extern sNtQueryVolumeInformationFile pNtQueryVolumeInformationFile; extern sNtQueryDirectoryFile pNtQueryDirectoryFile; extern sNtQuerySystemInformation pNtQuerySystemInformation; - /* Kernel32 function pointers */ extern sGetQueuedCompletionStatusEx pGetQueuedCompletionStatusEx; -extern sSetFileCompletionNotificationModes pSetFileCompletionNotificationModes; -extern sCreateSymbolicLinkW pCreateSymbolicLinkW; -extern sCancelIoEx pCancelIoEx; -extern sInitializeConditionVariable pInitializeConditionVariable; -extern sSleepConditionVariableCS pSleepConditionVariableCS; -extern sSleepConditionVariableSRW pSleepConditionVariableSRW; -extern sWakeAllConditionVariable pWakeAllConditionVariable; -extern sWakeConditionVariable pWakeConditionVariable; -extern sCancelSynchronousIo pCancelSynchronousIo; -extern sGetFinalPathNameByHandleW pGetFinalPathNameByHandleW; - /* Powrprof.dll function pointer */ extern sPowerRegisterSuspendResumeNotification pPowerRegisterSuspendResumeNotification; @@ -4775,19 +4728,4 @@ extern sPowerRegisterSuspendResumeNotification pPowerRegisterSuspendResumeNotifi /* User32.dll function pointer */ extern sSetWinEventHook pSetWinEventHook; -/* iphlpapi.dll function pointer */ -union _NET_LUID_LH; -typedef DWORD (WINAPI *sConvertInterfaceIndexToLuid)( - ULONG InterfaceIndex, - union _NET_LUID_LH *InterfaceLuid); - -typedef DWORD (WINAPI *sConvertInterfaceLuidToNameW)( - const union _NET_LUID_LH *InterfaceLuid, - PWSTR InterfaceName, - size_t Length); - -extern sConvertInterfaceIndexToLuid pConvertInterfaceIndexToLuid; -extern sConvertInterfaceLuidToNameW pConvertInterfaceLuidToNameW; - - #endif /* UV_WIN_WINAPI_H_ */ diff --git a/src/win/winsock.c b/src/win/winsock.c index 8418895..5e7da2a 100644 --- a/src/win/winsock.c +++ b/src/win/winsock.c @@ -256,8 +256,8 @@ int uv_ntstatus_to_winsock_error(NTSTATUS status) { default: if ((status & (FACILITY_NTWIN32 << 16)) == (FACILITY_NTWIN32 << 16) && (status & (ERROR_SEVERITY_ERROR | ERROR_SEVERITY_WARNING))) { - /* It's a windows error that has been previously mapped to an */ - /* ntstatus code. */ + /* It's a windows error that has been previously mapped to an ntstatus + * code. */ return (DWORD) (status & 0xffff); } else { /* The default fallback for unmappable ntstatus codes. */ @@ -519,8 +519,8 @@ int WSAAPI uv_msafd_poll(SOCKET socket, AFD_POLL_INFO* info_in, sizeof *info_out); if (overlapped == NULL) { - /* If this is a blocking operation, wait for the event to become */ - /* signaled, and then grab the real status from the io status block. */ + /* If this is a blocking operation, wait for the event to become signaled, + * and then grab the real status from the io status block. */ if (status == STATUS_PENDING) { DWORD r = WaitForSingleObject(event, INFINITE); ----------------------------------------------------------------------- Summary of changes: Auxiliary/vim/syntax/cmake.vim | 2 + Help/manual/cmake-generator-expressions.7.rst | 13 + .../ExternalProject-non-cmake-source-subdir.rst | 7 + Help/release/dev/fortran-compiler-id.rst | 5 + Modules/ExternalProject.cmake | 10 +- Source/CPack/cmCPackExternalGenerator.cxx | 2 +- Source/CPack/cmCPackGenerator.cxx | 6 +- Source/CPack/cpack.cxx | 6 +- Source/CTest/cmCTestBuildAndTestHandler.cxx | 2 +- Source/CTest/cmCTestLaunch.cxx | 2 +- Source/CTest/cmCTestScriptHandler.cxx | 4 +- Source/CTest/cmCTestTestHandler.cxx | 4 +- Source/cmCTest.cxx | 15 +- Source/cmGeneratorExpressionNode.cxx | 46 + Source/cmGeneratorTarget.cxx | 20 +- Source/cmGeneratorTarget.h | 4 +- Source/cmGlobalGenerator.cxx | 24 +- Source/cmIncludeCommand.cxx | 3 +- Source/cmLocalUnixMakefileGenerator3.cxx | 3 +- Source/cmMakefile.cxx | 5 +- Source/cmMakefile.h | 7 +- Source/cmQtAutoGenInitializer.cxx | 7 +- Source/cmQtAutoGenInitializer.h | 3 +- Source/cmQtAutoGeneratorMocUic.cxx | 2 +- Source/cmQtAutoGeneratorRcc.cxx | 2 +- Source/cmTarget.cxx | 12 +- Source/cmTarget.h | 2 +- Source/cmake.cxx | 4 +- Tests/CMakeLists.txt | 15 + Tests/CompileOptions/CMakeLists.txt | 17 + Tests/CompileOptions/main.cpp | 15 +- .../CMakeLists.txt | 20 + .../Example/subdir/Makefile | 2 + .../BuildAndTest/CMakeLists.txt | 10 + .../CMakeRoleGlobalProperty/CMakeLists.txt.in | 4 +- .../CMakeRoleGlobalProperty/RunCMakeTest.cmake | 7 + .../NonValidTarget-Fortran_COMPILER_ID-result.txt} | 0 .../NonValidTarget-Fortran_COMPILER_ID-stderr.txt | 9 + .../NonValidTarget-Fortran_COMPILER_ID.cmake | 4 + ...alidTarget-Fortran_COMPILER_VERSION-result.txt} | 0 ...ValidTarget-Fortran_COMPILER_VERSION-stderr.txt | 9 + .../NonValidTarget-Fortran_COMPILER_VERSION.cmake | 4 + .../GeneratorExpression/RunCMakeTest.cmake | 2 + Utilities/IWYU/mapping.imp | 4 +- Utilities/cmlibuv/CMakeLists.txt | 41 +- Utilities/cmlibuv/include/pthread-barrier.h | 69 -- Utilities/cmlibuv/include/uv.h | 86 +- Utilities/cmlibuv/include/{uv-aix.h => uv/aix.h} | 0 .../cmlibuv/include/{ => uv}/android-ifaddrs.h | 0 Utilities/cmlibuv/include/{uv-bsd.h => uv/bsd.h} | 0 .../cmlibuv/include/{uv-darwin.h => uv/darwin.h} | 0 .../cmlibuv/include/{uv-errno.h => uv/errno.h} | 6 + .../cmlibuv/include/{uv-linux.h => uv/linux.h} | 0 .../cmlibuv/include/{uv-os390.h => uv/os390.h} | 0 .../cmlibuv/include/{uv-posix.h => uv/posix.h} | 0 .../cmlibuv/include/{ => uv}/stdint-msvc2008.h | 0 .../cmlibuv/include/{uv-sunos.h => uv/sunos.h} | 0 .../include/{uv-threadpool.h => uv/threadpool.h} | 0 Utilities/cmlibuv/include/{ => uv}/tree.h | 0 Utilities/cmlibuv/include/{uv-unix.h => uv/unix.h} | 47 +- .../cmlibuv/include/{uv-version.h => uv/version.h} | 4 +- Utilities/cmlibuv/include/{uv-win.h => uv/win.h} | 59 +- Utilities/cmlibuv/src/fs-poll.c | 4 +- Utilities/cmlibuv/src/idna.c | 291 +++++ Utilities/cmlibuv/src/idna.h | 31 + Utilities/cmlibuv/src/inet.c | 13 +- Utilities/cmlibuv/src/strscpy.c | 17 + Utilities/cmlibuv/src/strscpy.h | 18 + Utilities/cmlibuv/src/threadpool.c | 96 +- Utilities/cmlibuv/src/{unix => }/timer.c | 21 +- Utilities/cmlibuv/src/unix/aix-common.c | 10 +- Utilities/cmlibuv/src/unix/aix.c | 63 +- Utilities/cmlibuv/src/unix/android-ifaddrs.c | 2 +- Utilities/cmlibuv/src/unix/bsd-ifaddrs.c | 23 +- .../src/unix/{proctitle.c => bsd-proctitle.c} | 103 +- Utilities/cmlibuv/src/unix/cmake-bootstrap.c | 1 + Utilities/cmlibuv/src/unix/core.c | 136 ++- Utilities/cmlibuv/src/unix/cygwin.c | 2 +- Utilities/cmlibuv/src/unix/darwin-proctitle.c | 147 ++- Utilities/cmlibuv/src/unix/freebsd.c | 79 -- Utilities/cmlibuv/src/unix/fs.c | 299 +++--- Utilities/cmlibuv/src/unix/fsevents.c | 72 +- Utilities/cmlibuv/src/unix/getaddrinfo.c | 21 + Utilities/cmlibuv/src/unix/getnameinfo.c | 1 + Utilities/cmlibuv/src/unix/ibmi.c | 3 +- Utilities/cmlibuv/src/unix/internal.h | 45 +- Utilities/cmlibuv/src/unix/kqueue.c | 83 +- Utilities/cmlibuv/src/unix/linux-core.c | 117 +- Utilities/cmlibuv/src/unix/linux-inotify.c | 8 +- Utilities/cmlibuv/src/unix/linux-syscalls.c | 133 --- Utilities/cmlibuv/src/unix/linux-syscalls.h | 34 - Utilities/cmlibuv/src/unix/loop.c | 6 +- Utilities/cmlibuv/src/unix/netbsd.c | 71 +- Utilities/cmlibuv/src/unix/openbsd.c | 69 -- Utilities/cmlibuv/src/unix/os390-syscalls.c | 29 +- Utilities/cmlibuv/src/unix/os390-syscalls.h | 4 - Utilities/cmlibuv/src/unix/os390.c | 38 +- Utilities/cmlibuv/src/unix/pipe.c | 31 +- Utilities/cmlibuv/src/unix/poll.c | 3 + Utilities/cmlibuv/src/unix/process.c | 4 +- Utilities/cmlibuv/src/unix/proctitle.c | 4 + Utilities/cmlibuv/src/unix/signal.c | 59 +- Utilities/cmlibuv/src/unix/stream.c | 262 +++-- Utilities/cmlibuv/src/unix/sunos.c | 15 +- Utilities/cmlibuv/src/unix/tcp.c | 21 +- Utilities/cmlibuv/src/unix/thread.c | 146 ++- Utilities/cmlibuv/src/unix/tty.c | 45 +- Utilities/cmlibuv/src/unix/udp.c | 23 +- Utilities/cmlibuv/src/uv-common.c | 44 +- Utilities/cmlibuv/src/uv-common.h | 127 ++- Utilities/cmlibuv/src/uv-data-getter-setters.c | 16 +- Utilities/cmlibuv/src/win/async.c | 10 +- Utilities/cmlibuv/src/win/atomicops-inl.h | 8 +- Utilities/cmlibuv/src/win/core.c | 58 +- Utilities/cmlibuv/src/win/dl.c | 11 +- Utilities/cmlibuv/src/win/error.c | 4 +- Utilities/cmlibuv/src/win/fs-event.c | 25 +- Utilities/cmlibuv/src/win/fs.c | 184 +++- Utilities/cmlibuv/src/win/getaddrinfo.c | 40 +- Utilities/cmlibuv/src/win/getnameinfo.c | 50 +- Utilities/cmlibuv/src/win/handle-inl.h | 25 +- Utilities/cmlibuv/src/win/handle.c | 12 +- Utilities/cmlibuv/src/win/internal.h | 114 +- Utilities/cmlibuv/src/win/loop-watcher.c | 2 +- Utilities/cmlibuv/src/win/pipe.c | 1130 +++++++++++--------- Utilities/cmlibuv/src/win/poll.c | 55 +- Utilities/cmlibuv/src/win/process-stdio.c | 59 +- Utilities/cmlibuv/src/win/process.c | 70 +- Utilities/cmlibuv/src/win/req.c | 25 - Utilities/cmlibuv/src/win/signal.c | 50 +- Utilities/cmlibuv/src/win/stream.c | 36 +- Utilities/cmlibuv/src/win/tcp.c | 213 ++-- Utilities/cmlibuv/src/win/thread.c | 246 +---- Utilities/cmlibuv/src/win/timer.c | 195 ---- Utilities/cmlibuv/src/win/tty.c | 177 ++- Utilities/cmlibuv/src/win/udp.c | 95 +- Utilities/cmlibuv/src/win/util.c | 298 +++++- Utilities/cmlibuv/src/win/winapi.c | 60 +- Utilities/cmlibuv/src/win/winapi.h | 80 +- Utilities/cmlibuv/src/win/winsock.c | 8 +- bootstrap | 8 +- 141 files changed, 3603 insertions(+), 3291 deletions(-) create mode 100644 Help/release/dev/ExternalProject-non-cmake-source-subdir.rst create mode 100644 Help/release/dev/fortran-compiler-id.rst create mode 100644 Tests/ExternalProjectSourceSubdirNotCMake/CMakeLists.txt create mode 100644 Tests/ExternalProjectSourceSubdirNotCMake/Example/subdir/Makefile create mode 100644 Tests/RunCMake/CMakeRoleGlobalProperty/BuildAndTest/CMakeLists.txt copy Tests/RunCMake/{while/MissingArgument-result.txt => GeneratorExpression/NonValidTarget-Fortran_COMPILER_ID-result.txt} (100%) create mode 100644 Tests/RunCMake/GeneratorExpression/NonValidTarget-Fortran_COMPILER_ID-stderr.txt create mode 100644 Tests/RunCMake/GeneratorExpression/NonValidTarget-Fortran_COMPILER_ID.cmake copy Tests/RunCMake/{while/MissingArgument-result.txt => GeneratorExpression/NonValidTarget-Fortran_COMPILER_VERSION-result.txt} (100%) create mode 100644 Tests/RunCMake/GeneratorExpression/NonValidTarget-Fortran_COMPILER_VERSION-stderr.txt create mode 100644 Tests/RunCMake/GeneratorExpression/NonValidTarget-Fortran_COMPILER_VERSION.cmake delete mode 100644 Utilities/cmlibuv/include/pthread-barrier.h rename Utilities/cmlibuv/include/{uv-aix.h => uv/aix.h} (100%) rename Utilities/cmlibuv/include/{ => uv}/android-ifaddrs.h (100%) rename Utilities/cmlibuv/include/{uv-bsd.h => uv/bsd.h} (100%) rename Utilities/cmlibuv/include/{uv-darwin.h => uv/darwin.h} (100%) rename Utilities/cmlibuv/include/{uv-errno.h => uv/errno.h} (98%) rename Utilities/cmlibuv/include/{uv-linux.h => uv/linux.h} (100%) rename Utilities/cmlibuv/include/{uv-os390.h => uv/os390.h} (100%) rename Utilities/cmlibuv/include/{uv-posix.h => uv/posix.h} (100%) rename Utilities/cmlibuv/include/{ => uv}/stdint-msvc2008.h (100%) rename Utilities/cmlibuv/include/{uv-sunos.h => uv/sunos.h} (100%) rename Utilities/cmlibuv/include/{uv-threadpool.h => uv/threadpool.h} (100%) rename Utilities/cmlibuv/include/{ => uv}/tree.h (100%) rename Utilities/cmlibuv/include/{uv-unix.h => uv/unix.h} (95%) rename Utilities/cmlibuv/include/{uv-version.h => uv/version.h} (97%) rename Utilities/cmlibuv/include/{uv-win.h => uv/win.h} (95%) create mode 100644 Utilities/cmlibuv/src/idna.c create mode 100644 Utilities/cmlibuv/src/idna.h create mode 100644 Utilities/cmlibuv/src/strscpy.c create mode 100644 Utilities/cmlibuv/src/strscpy.h rename Utilities/cmlibuv/src/{unix => }/timer.c (91%) copy Utilities/cmlibuv/src/unix/{proctitle.c => bsd-proctitle.c} (50%) delete mode 100644 Utilities/cmlibuv/src/win/req.c delete mode 100644 Utilities/cmlibuv/src/win/timer.c hooks/post-receive -- CMake From kwrobot at kitware.com Tue Jan 22 00:03:04 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 22 Jan 2019 00:03:04 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-1032-g05e4fa4 Message-ID: <20190122050304.902B5125908@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 05e4fa47738bf44e8ee6501b415df2899b10f6da (commit) from 02f7e997e939dbd0c753514edcd580083cebd37c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=05e4fa47738bf44e8ee6501b415df2899b10f6da commit 05e4fa47738bf44e8ee6501b415df2899b10f6da Author: Kitware Robot AuthorDate: Tue Jan 22 00:01:06 2019 -0500 Commit: Kitware Robot CommitDate: Tue Jan 22 00:01:06 2019 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 62f5f70..497feed 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 13) -set(CMake_VERSION_PATCH 20190121) +set(CMake_VERSION_PATCH 20190122) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Tue Jan 22 09:33:06 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 22 Jan 2019 09:33:06 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-1043-gcb7fbf1 Message-ID: <20190122143306.7FF321184A9@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via cb7fbf1dbbcc88fc7701250db5c3ccdf0ab7396e (commit) via acaf9801d004dc77d8abbb09b2ce3a88fd182322 (commit) via 17e12a9fa99c0a3008da2a611d91e810fad9f102 (commit) via 67bced8a26348e1cc05d8c04ed90633c642bf3a3 (commit) via 3132ea801c2466773309edda82387025f903fc12 (commit) via 2c50a725763eb2201f356852eab98dfdf9c27591 (commit) via 48ec0bc1401b99e5a2d07392fb98f96d5fec9e50 (commit) via 8bba458ea5d6b792e165560d79efd8d8356f4329 (commit) via 818df52c488a94628169811bddffe05f36c68b42 (commit) via 8144b00e32cf1e24daf41353cbcd1806311ceac9 (commit) via b70c0aed5c616edce5cbc803c7de92580f835f90 (commit) from 05e4fa47738bf44e8ee6501b415df2899b10f6da (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cb7fbf1dbbcc88fc7701250db5c3ccdf0ab7396e commit cb7fbf1dbbcc88fc7701250db5c3ccdf0ab7396e Merge: acaf980 3132ea8 Author: Brad King AuthorDate: Tue Jan 22 14:32:47 2019 +0000 Commit: Kitware Robot CommitDate: Tue Jan 22 09:32:58 2019 -0500 Merge topic 'stdout-string' 3132ea801c cmSystemTools: Stdout(),Stderr() accept std::string argument Acked-by: Kitware Robot Merge-request: !2829 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=acaf9801d004dc77d8abbb09b2ce3a88fd182322 commit acaf9801d004dc77d8abbb09b2ce3a88fd182322 Merge: 17e12a9 2c50a72 Author: Brad King AuthorDate: Tue Jan 22 14:32:00 2019 +0000 Commit: Kitware Robot CommitDate: Tue Jan 22 09:32:06 2019 -0500 Merge topic 'depends-string' 2c50a72576 cmDepends: all members accept std::string arguments Acked-by: Kitware Robot Merge-request: !2827 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=17e12a9fa99c0a3008da2a611d91e810fad9f102 commit 17e12a9fa99c0a3008da2a611d91e810fad9f102 Merge: 05e4fa4 67bced8 Author: Brad King AuthorDate: Tue Jan 22 14:28:12 2019 +0000 Commit: Kitware Robot CommitDate: Tue Jan 22 09:28:18 2019 -0500 Merge topic 'cmake-gui-generator-platform' 67bced8a26 cmake-gui: Improve label for default platform 48ec0bc140 cmake-gui: Add field for generator platform selection 8bba458ea5 Add global generator factory method to get default platform name 818df52c48 Add global generator factory method to get list of known platforms 8144b00e32 Split global generator factory list with and without platforms b70c0aed5c VS: Factor out helper function to compute host platform name Acked-by: Kitware Robot Merge-request: !2832 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=67bced8a26348e1cc05d8c04ed90633c642bf3a3 commit 67bced8a26348e1cc05d8c04ed90633c642bf3a3 Author: Julien Jomier AuthorDate: Mon Jan 21 13:18:26 2019 +0100 Commit: Julien Jomier CommitDate: Mon Jan 21 13:18:26 2019 +0100 cmake-gui: Improve label for default platform Specify the default platform to be used when the platform field is empty diff --git a/Source/QtDialog/FirstConfigure.cxx b/Source/QtDialog/FirstConfigure.cxx index 66707d6..ae5179c 100644 --- a/Source/QtDialog/FirstConfigure.cxx +++ b/Source/QtDialog/FirstConfigure.cxx @@ -75,8 +75,7 @@ QFrame* StartCompilerSetup::CreatePlatformWidgets() QVBoxLayout* l = new QVBoxLayout(frame); l->setContentsMargins(0, 0, 0, 0); - this->PlatformLabel = - new QLabel(tr("Specify the platform for this generator")); + this->PlatformLabel = new QLabel(tr("Optional platform for generator")); l->addWidget(this->PlatformLabel); this->PlatformOptions = new QComboBox(frame); @@ -106,6 +105,10 @@ void StartCompilerSetup::setGenerators( this->GeneratorsSupportingPlatform.append( QString::fromLocal8Bit(it->name.c_str())); + this + ->GeneratorDefaultPlatform[QString::fromLocal8Bit(it->name.c_str())] = + QString::fromLocal8Bit(it->defaultPlatform.c_str()); + std::vector::const_iterator platformIt = it->supportedPlatforms.cbegin(); while (platformIt != it->supportedPlatforms.cend()) { @@ -182,6 +185,13 @@ void StartCompilerSetup::onGeneratorChanged(QString const& name) // Display the generator platform for the generators supporting it if (GeneratorsSupportingPlatform.contains(name)) { + // Change the label title to include the default platform + std::string label = "Optional platform for generator"; + label += "(if empty, generator uses: "; + label += this->GeneratorDefaultPlatform[name].toStdString(); + label += ")"; + this->PlatformLabel->setText(tr(label.c_str())); + // Regenerate the list of supported platform this->PlatformOptions->clear(); QStringList platform_list; diff --git a/Source/QtDialog/FirstConfigure.h b/Source/QtDialog/FirstConfigure.h index 133f422..d1db5bf 100644 --- a/Source/QtDialog/FirstConfigure.h +++ b/Source/QtDialog/FirstConfigure.h @@ -63,6 +63,7 @@ protected: QStringList GeneratorsSupportingToolset; QStringList GeneratorsSupportingPlatform; QMultiMap GeneratorSupportedPlatforms; + QMap GeneratorDefaultPlatform; private: QFrame* CreateToolsetWidgets(); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3132ea801c2466773309edda82387025f903fc12 commit 3132ea801c2466773309edda82387025f903fc12 Author: Vitaly Stakhovsky AuthorDate: Sun Jan 20 00:03:35 2019 -0500 Commit: Vitaly Stakhovsky CommitDate: Sun Jan 20 00:03:35 2019 -0500 cmSystemTools: Stdout(),Stderr() accept std::string argument diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 1c0d9f6..5ba3370 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -2781,13 +2781,13 @@ bool cmCTest::RunCommand(std::vector const& args, if ((res == cmsysProcess_Pipe_STDOUT || res == cmsysProcess_Pipe_STDERR) && this->ExtraVerbose) { processOutput.DecodeText(data, length, strdata); - cmSystemTools::Stdout(strdata.c_str(), strdata.size()); + cmSystemTools::Stdout(strdata); } } if (this->ExtraVerbose) { processOutput.DecodeText(std::string(), strdata); if (!strdata.empty()) { - cmSystemTools::Stdout(strdata.c_str(), strdata.size()); + cmSystemTools::Stdout(strdata); } } diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx index 2acb015..e4eb5e5 100644 --- a/Source/cmDepends.cxx +++ b/Source/cmDepends.cxx @@ -87,7 +87,7 @@ void cmDepends::Clear(const char* file) if (this->Verbose) { std::ostringstream msg; msg << "Clearing dependencies in \"" << file << "\"." << std::endl; - cmSystemTools::Stdout(msg.str().c_str()); + cmSystemTools::Stdout(msg.str()); } // Write an empty dependency file. @@ -170,7 +170,7 @@ bool cmDepends::CheckDependencies( std::ostringstream msg; msg << "Dependee \"" << dependee << "\" does not exist for depender \"" << depender << "\"." << std::endl; - cmSystemTools::Stdout(msg.str().c_str()); + cmSystemTools::Stdout(msg.str()); } } else { if (dependerExists) { @@ -187,7 +187,7 @@ bool cmDepends::CheckDependencies( std::ostringstream msg; msg << "Dependee \"" << dependee << "\" is newer than depender \"" << depender << "\"." << std::endl; - cmSystemTools::Stdout(msg.str().c_str()); + cmSystemTools::Stdout(msg.str()); } } } else { @@ -206,7 +206,7 @@ bool cmDepends::CheckDependencies( msg << "Dependee \"" << dependee << "\" is newer than depends file \"" << internalDependsFileName << "\"." << std::endl; - cmSystemTools::Stdout(msg.str().c_str()); + cmSystemTools::Stdout(msg.str()); } } } diff --git a/Source/cmExecProgramCommand.cxx b/Source/cmExecProgramCommand.cxx index ea4cd40..49d9841 100644 --- a/Source/cmExecProgramCommand.cxx +++ b/Source/cmExecProgramCommand.cxx @@ -221,7 +221,7 @@ bool cmExecProgramCommand::RunCommand(const char* command, std::string& output, if (p == cmsysProcess_Pipe_STDOUT || p == cmsysProcess_Pipe_STDERR) { if (verbose) { processOutput.DecodeText(data, length, strdata); - cmSystemTools::Stdout(strdata.c_str(), strdata.size()); + cmSystemTools::Stdout(strdata); } output.append(data, length); } @@ -230,7 +230,7 @@ bool cmExecProgramCommand::RunCommand(const char* command, std::string& output, if (verbose) { processOutput.DecodeText(std::string(), strdata); if (!strdata.empty()) { - cmSystemTools::Stdout(strdata.c_str(), strdata.size()); + cmSystemTools::Stdout(strdata); } } @@ -270,7 +270,7 @@ bool cmExecProgramCommand::RunCommand(const char* command, std::string& output, } msg += "\n"; if (verbose) { - cmSystemTools::Stdout(msg.c_str()); + cmSystemTools::Stdout(msg); } output += msg; #else diff --git a/Source/cmExecuteProcessCommand.cxx b/Source/cmExecuteProcessCommand.cxx index 679a648..08a8be7 100644 --- a/Source/cmExecuteProcessCommand.cxx +++ b/Source/cmExecuteProcessCommand.cxx @@ -249,14 +249,14 @@ bool cmExecuteProcessCommand::InitialPass(std::vector const& args, if (p == cmsysProcess_Pipe_STDOUT && !output_quiet) { if (output_variable.empty()) { processOutput.DecodeText(data, length, strdata, 1); - cmSystemTools::Stdout(strdata.c_str(), strdata.size()); + cmSystemTools::Stdout(strdata); } else { cmExecuteProcessCommandAppend(tempOutput, data, length); } } else if (p == cmsysProcess_Pipe_STDERR && !error_quiet) { if (error_variable.empty()) { processOutput.DecodeText(data, length, strdata, 2); - cmSystemTools::Stderr(strdata.c_str(), strdata.size()); + cmSystemTools::Stderr(strdata); } else { cmExecuteProcessCommandAppend(tempError, data, length); } @@ -265,13 +265,13 @@ bool cmExecuteProcessCommand::InitialPass(std::vector const& args, if (!output_quiet && output_variable.empty()) { processOutput.DecodeText(std::string(), strdata, 1); if (!strdata.empty()) { - cmSystemTools::Stdout(strdata.c_str(), strdata.size()); + cmSystemTools::Stdout(strdata); } } if (!error_quiet && error_variable.empty()) { processOutput.DecodeText(std::string(), strdata, 2); if (!strdata.empty()) { - cmSystemTools::Stderr(strdata.c_str(), strdata.size()); + cmSystemTools::Stderr(strdata); } } diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 707a1b5..eca6bea 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1286,7 +1286,7 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies(const char* tgtInfo, std::ostringstream msg; msg << "Dependee \"" << tgtInfo << "\" is newer than depender \"" << internalDependFile << "\"." << std::endl; - cmSystemTools::Stdout(msg.str().c_str()); + cmSystemTools::Stdout(msg.str()); } needRescanDependInfo = true; } @@ -1307,7 +1307,7 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies(const char* tgtInfo, std::ostringstream msg; msg << "Dependee \"" << dirInfoFile << "\" is newer than depender \"" << internalDependFile << "\"." << std::endl; - cmSystemTools::Stdout(msg.str().c_str()); + cmSystemTools::Stdout(msg.str()); } needRescanDirInfo = true; } @@ -1489,7 +1489,7 @@ void cmLocalUnixMakefileGenerator3::CheckMultipleOutputs(bool verbose) msg << "Deleting primary custom command output \"" << dependee << "\" because another output \"" << depender << "\" does not exist." << std::endl; - cmSystemTools::Stdout(msg.str().c_str()); + cmSystemTools::Stdout(msg.str()); } cmSystemTools::RemoveFile(dependee); } diff --git a/Source/cmQtAutoGenerator.cxx b/Source/cmQtAutoGenerator.cxx index c5d5d7c..e2d7deb 100644 --- a/Source/cmQtAutoGenerator.cxx +++ b/Source/cmQtAutoGenerator.cxx @@ -54,7 +54,7 @@ void cmQtAutoGenerator::Logger::Info(GeneratorT genType, } { std::lock_guard lock(Mutex_); - cmSystemTools::Stdout(msg.c_str(), msg.size()); + cmSystemTools::Stdout(msg); } } @@ -78,7 +78,7 @@ void cmQtAutoGenerator::Logger::Warning(GeneratorT genType, msg.push_back('\n'); { std::lock_guard lock(Mutex_); - cmSystemTools::Stdout(msg.c_str(), msg.size()); + cmSystemTools::Stdout(msg); } } @@ -107,7 +107,7 @@ void cmQtAutoGenerator::Logger::Error(GeneratorT genType, msg.push_back('\n'); { std::lock_guard lock(Mutex_); - cmSystemTools::Stderr(msg.c_str(), msg.size()); + cmSystemTools::Stderr(msg); } } @@ -149,7 +149,7 @@ void cmQtAutoGenerator::Logger::ErrorCommand( msg.push_back('\n'); { std::lock_guard lock(Mutex_); - cmSystemTools::Stderr(msg.c_str(), msg.size()); + cmSystemTools::Stderr(msg); } } diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index be65853..cb97cba 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -302,33 +302,21 @@ void cmSystemTools::SetStderrCallback(OutputCallback f, void* clientData) s_StderrCallbackClientData = clientData; } -void cmSystemTools::Stdout(const char* s) -{ - cmSystemTools::Stdout(s, strlen(s)); -} - -void cmSystemTools::Stderr(const char* s) -{ - cmSystemTools::Stderr(s, strlen(s)); -} - -void cmSystemTools::Stderr(const char* s, size_t length) +void cmSystemTools::Stderr(const std::string& s) { if (s_StderrCallback) { - (*s_StderrCallback)(s, length, s_StderrCallbackClientData); + (*s_StderrCallback)(s.c_str(), s.length(), s_StderrCallbackClientData); } else { - std::cerr.write(s, length); - std::cerr.flush(); + std::cerr << s << std::flush; } } -void cmSystemTools::Stdout(const char* s, size_t length) +void cmSystemTools::Stdout(const std::string& s) { if (s_StdoutCallback) { - (*s_StdoutCallback)(s, length, s_StdoutCallbackClientData); + (*s_StdoutCallback)(s.c_str(), s.length(), s_StdoutCallbackClientData); } else { - std::cout.write(s, length); - std::cout.flush(); + std::cout << s << std::flush; } } @@ -792,7 +780,7 @@ bool cmSystemTools::RunSingleCommand(std::vector const& command, if (pipe == cmsysProcess_Pipe_STDOUT) { if (outputflag != OUTPUT_NONE) { processOutput.DecodeText(data, length, strdata, 1); - cmSystemTools::Stdout(strdata.c_str(), strdata.size()); + cmSystemTools::Stdout(strdata); } if (captureStdOut) { tempStdOut.insert(tempStdOut.end(), data, data + length); @@ -800,7 +788,7 @@ bool cmSystemTools::RunSingleCommand(std::vector const& command, } else if (pipe == cmsysProcess_Pipe_STDERR) { if (outputflag != OUTPUT_NONE) { processOutput.DecodeText(data, length, strdata, 2); - cmSystemTools::Stderr(strdata.c_str(), strdata.size()); + cmSystemTools::Stderr(strdata); } if (captureStdErr) { tempStdErr.insert(tempStdErr.end(), data, data + length); @@ -811,11 +799,11 @@ bool cmSystemTools::RunSingleCommand(std::vector const& command, if (outputflag != OUTPUT_NONE) { processOutput.DecodeText(std::string(), strdata, 1); if (!strdata.empty()) { - cmSystemTools::Stdout(strdata.c_str(), strdata.size()); + cmSystemTools::Stdout(strdata); } processOutput.DecodeText(std::string(), strdata, 2); if (!strdata.empty()) { - cmSystemTools::Stderr(strdata.c_str(), strdata.size()); + cmSystemTools::Stderr(strdata); } } } @@ -1899,13 +1887,13 @@ bool extract_tar(const char* outFileName, bool verbose, bool extract) if (verbose) { if (extract) { cmSystemTools::Stdout("x "); - cmSystemTools::Stdout(cm_archive_entry_pathname(entry).c_str()); + cmSystemTools::Stdout(cm_archive_entry_pathname(entry)); } else { list_item_verbose(stdout, entry); } cmSystemTools::Stdout("\n"); } else if (!extract) { - cmSystemTools::Stdout(cm_archive_entry_pathname(entry).c_str()); + cmSystemTools::Stdout(cm_archive_entry_pathname(entry)); cmSystemTools::Stdout("\n"); } if (extract) { diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index c0999e7..365be36 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -79,13 +79,11 @@ public: typedef void (*OutputCallback)(const char*, size_t length, void*); ///! Send a string to stdout - static void Stdout(const char* s); - static void Stdout(const char* s, size_t length); + static void Stdout(const std::string& s); static void SetStdoutCallback(OutputCallback, void* clientData = nullptr); ///! Send a string to stderr - static void Stderr(const char* s); - static void Stderr(const char* s, size_t length); + static void Stderr(const std::string& s); static void SetStderrCallback(OutputCallback, void* clientData = nullptr); typedef bool (*InterruptCallback)(void*); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 9fcfbde..c8e54aa 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2006,7 +2006,7 @@ int cmake::CheckBuildSystem() if (verbose) { std::ostringstream msg; msg << "Re-run cmake no build system arguments\n"; - cmSystemTools::Stdout(msg.str().c_str()); + cmSystemTools::Stdout(msg.str()); } return 1; } @@ -2017,7 +2017,7 @@ int cmake::CheckBuildSystem() std::ostringstream msg; msg << "Re-run cmake missing file: " << this->CheckBuildSystemArgument << "\n"; - cmSystemTools::Stdout(msg.str().c_str()); + cmSystemTools::Stdout(msg.str()); } return 1; } @@ -2037,7 +2037,7 @@ int cmake::CheckBuildSystem() std::ostringstream msg; msg << "Re-run cmake error reading : " << this->CheckBuildSystemArgument << "\n"; - cmSystemTools::Stdout(msg.str().c_str()); + cmSystemTools::Stdout(msg.str()); } // There was an error reading the file. Just rerun. return 1; @@ -2071,7 +2071,7 @@ int cmake::CheckBuildSystem() if (verbose) { std::ostringstream msg; msg << "Re-run cmake, missing byproduct: " << p << "\n"; - cmSystemTools::Stdout(msg.str().c_str()); + cmSystemTools::Stdout(msg.str()); } return 1; } @@ -2092,7 +2092,7 @@ int cmake::CheckBuildSystem() std::ostringstream msg; msg << "Re-run cmake no CMAKE_MAKEFILE_DEPENDS " "or CMAKE_MAKEFILE_OUTPUTS :\n"; - cmSystemTools::Stdout(msg.str().c_str()); + cmSystemTools::Stdout(msg.str()); } return 1; } @@ -2111,7 +2111,7 @@ int cmake::CheckBuildSystem() if (verbose) { std::ostringstream msg; msg << "Re-run cmake: build system dependency is missing\n"; - cmSystemTools::Stdout(msg.str().c_str()); + cmSystemTools::Stdout(msg.str()); } return 1; } @@ -2131,7 +2131,7 @@ int cmake::CheckBuildSystem() if (verbose) { std::ostringstream msg; msg << "Re-run cmake: build system output is missing\n"; - cmSystemTools::Stdout(msg.str().c_str()); + cmSystemTools::Stdout(msg.str()); } return 1; } @@ -2147,7 +2147,7 @@ int cmake::CheckBuildSystem() std::ostringstream msg; msg << "Re-run cmake file: " << out_oldest << " older than: " << dep_newest << "\n"; - cmSystemTools::Stdout(msg.str().c_str()); + cmSystemTools::Stdout(msg.str()); } return 1; } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2c50a725763eb2201f356852eab98dfdf9c27591 commit 2c50a725763eb2201f356852eab98dfdf9c27591 Author: Vitaly Stakhovsky AuthorDate: Fri Jan 18 20:20:00 2019 -0500 Commit: Vitaly Stakhovsky CommitDate: Fri Jan 18 20:30:13 2019 -0500 cmDepends: all members accept std::string arguments Most `const char*` arguments converted to `const std::string&` in `cmDepends` and derived classes. In addition performed minor code cleanup. diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx index 2acb015..fae3d9b 100644 --- a/Source/cmDepends.cxx +++ b/Source/cmDepends.cxx @@ -13,7 +13,7 @@ #include #include -cmDepends::cmDepends(cmLocalGenerator* lg, const char* targetDir) +cmDepends::cmDepends(cmLocalGenerator* lg, const std::string& targetDir) : LocalGenerator(lg) , TargetDirectory(targetDir) , Dependee(new char[MaxPath]) @@ -65,12 +65,13 @@ bool cmDepends::Finalize(std::ostream& /*unused*/, std::ostream& /*unused*/) return true; } -bool cmDepends::Check(const char* makeFile, const char* internalFile, +bool cmDepends::Check(const std::string& makeFile, + const std::string& internalFile, std::map& validDeps) { // Check whether dependencies must be regenerated. bool okay = true; - cmsys::ifstream fin(internalFile); + cmsys::ifstream fin(internalFile.c_str()); if (!(fin && this->CheckDependencies(fin, internalFile, validDeps))) { // Clear all dependencies so they will be regenerated. this->Clear(makeFile); @@ -81,7 +82,7 @@ bool cmDepends::Check(const char* makeFile, const char* internalFile, return okay; } -void cmDepends::Clear(const char* file) +void cmDepends::Clear(const std::string& file) { // Print verbose output. if (this->Verbose) { @@ -107,7 +108,7 @@ bool cmDepends::WriteDependencies(const std::set& /*unused*/, } bool cmDepends::CheckDependencies( - std::istream& internalDepends, const char* internalDependsFileName, + std::istream& internalDepends, const std::string& internalDependsFileName, std::map& validDeps) { // Parse dependencies from the stream. If any dependee is missing @@ -194,8 +195,8 @@ bool cmDepends::CheckDependencies( // The dependee exists, but the depender doesn't. Regenerate if the // internalDepends file is older than the dependee. int result = 0; - if ((!this->FileComparison->FileTimeCompare(internalDependsFileName, - dependee, &result) || + if ((!this->FileComparison->FileTimeCompare( + internalDependsFileName.c_str(), dependee, &result) || result < 0)) { // The depends-file is older than the dependee. regenerate = true; diff --git a/Source/cmDepends.h b/Source/cmDepends.h index 705d215..b0b5bb5 100644 --- a/Source/cmDepends.h +++ b/Source/cmDepends.h @@ -29,7 +29,7 @@ class cmDepends public: /** Instances need to know the build directory name and the relative path from the build directory to the target file. */ - cmDepends(cmLocalGenerator* lg = nullptr, const char* targetDir = ""); + cmDepends(cmLocalGenerator* lg = nullptr, const std::string& targetDir = ""); /** Set the local generator for the directory in which we are scanning dependencies. This is not a full local generator; it @@ -41,7 +41,10 @@ public: void SetLanguage(const std::string& lang) { this->Language = lang; } /** Set the target build directory. */ - void SetTargetDirectory(const char* dir) { this->TargetDirectory = dir; } + void SetTargetDirectory(const std::string& dir) + { + this->TargetDirectory = dir; + } /** should this be verbose in its output */ void SetVerbose(bool verb) { this->Verbose = verb; } @@ -61,11 +64,11 @@ public: they must be generated Clear has already been called to wipe out the old dependencies. Dependencies which are still valid will be stored in validDeps. */ - bool Check(const char* makeFile, const char* internalFile, + bool Check(const std::string& makeFile, const std::string& internalFile, std::map& validDeps); /** Clear dependencies for the target file so they will be regenerated. */ - void Clear(const char* file); + void Clear(const std::string& file); /** Set the file comparison object */ void SetFileComparison(cmFileTimeComparison* fc) @@ -85,7 +88,7 @@ protected: // Return false if dependencies must be regenerated and true // otherwise. virtual bool CheckDependencies( - std::istream& internalDepends, const char* internalDependsFileName, + std::istream& internalDepends, const std::string& internalDependsFileName, std::map& validDeps); // Finalize the dependency information for the target. diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index 072d116..f6ac4f2 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -24,7 +24,7 @@ cmDependsC::cmDependsC() } cmDependsC::cmDependsC( - cmLocalGenerator* lg, const char* targetDir, const std::string& lang, + cmLocalGenerator* lg, const std::string& targetDir, const std::string& lang, const std::map* validDeps) : cmDepends(lg, targetDir) , ValidDeps(validDeps) @@ -53,8 +53,8 @@ cmDependsC::cmDependsC( } this->IncludeRegexLine.compile(INCLUDE_REGEX_LINE); - this->IncludeRegexScan.compile(scanRegex.c_str()); - this->IncludeRegexComplain.compile(complainRegex.c_str()); + this->IncludeRegexScan.compile(scanRegex); + this->IncludeRegexComplain.compile(complainRegex); this->IncludeRegexLineString = INCLUDE_REGEX_LINE_MARKER INCLUDE_REGEX_LINE; this->IncludeRegexScanString = INCLUDE_REGEX_SCAN_MARKER; this->IncludeRegexScanString += scanRegex; @@ -212,7 +212,7 @@ bool cmDependsC::WriteDependencies(const std::set& sources, // Scan this file for new dependencies. Pass the directory // containing the file to handle double-quote includes. std::string dir = cmSystemTools::GetFilenamePath(fullName); - this->Scan(fin, dir.c_str(), fullName); + this->Scan(fin, dir, fullName); } else { // Skip file with encoding we do not implement. } @@ -342,7 +342,7 @@ void cmDependsC::WriteCacheFile() const } } -void cmDependsC::Scan(std::istream& is, const char* directory, +void cmDependsC::Scan(std::istream& is, const std::string& directory, const std::string& fullName) { cmIncludeLines* newCacheEntry = new cmIncludeLines; @@ -418,7 +418,7 @@ void cmDependsC::SetupTransforms() sep = "|"; } xform += ")[ \t]*\\(([^),]*)\\)"; - this->IncludeRegexTransform.compile(xform.c_str()); + this->IncludeRegexTransform.compile(xform); // Build a string that encodes all transformation rules and will // change when rules are changed. @@ -460,11 +460,11 @@ void cmDependsC::TransformLine(std::string& line) // Construct the transformed line. std::string newline = this->IncludeRegexTransform.match(1); std::string arg = this->IncludeRegexTransform.match(4); - for (const char* c = tri->second.c_str(); *c; ++c) { - if (*c == '%') { + for (char c : tri->second) { + if (c == '%') { newline += arg; } else { - newline += *c; + newline += c; } } diff --git a/Source/cmDependsC.h b/Source/cmDependsC.h index f833888..af2b06e 100644 --- a/Source/cmDependsC.h +++ b/Source/cmDependsC.h @@ -28,7 +28,7 @@ public: /** Checking instances need to know the build directory name and the relative path from the build directory to the target file. */ cmDependsC(); - cmDependsC(cmLocalGenerator* lg, const char* targetDir, + cmDependsC(cmLocalGenerator* lg, const std::string& targetDir, const std::string& lang, const std::map* validDeps); @@ -42,7 +42,7 @@ protected: std::ostream& internalDepends) override; // Method to scan a single file. - void Scan(std::istream& is, const char* directory, + void Scan(std::istream& is, const std::string& directory, const std::string& fullName); // Regular expression to identify C preprocessor include directives. diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index e51f81e..6c5f647 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -7,7 +7,6 @@ #include #include #include -#include #include #include "cmAlgorithms.h" @@ -54,7 +53,8 @@ public: typedef std::map ObjectInfoMap; ObjectInfoMap ObjectInfo; - cmFortranSourceInfo& CreateObjectInfo(const char* obj, const char* src) + cmFortranSourceInfo& CreateObjectInfo(const std::string& obj, + const std::string& src) { std::map::iterator i = this->ObjectInfo.find(obj); @@ -121,8 +121,7 @@ bool cmDependsFortran::WriteDependencies(const std::set& sources, bool okay = true; for (std::string const& src : sources) { // Get the information object for this source. - cmFortranSourceInfo& info = - this->Internal->CreateObjectInfo(obj.c_str(), src.c_str()); + cmFortranSourceInfo& info = this->Internal->CreateObjectInfo(obj, src); // Create the parser object. The constructor takes info by reference, // so we may look into the resulting objects later. @@ -153,7 +152,7 @@ bool cmDependsFortran::Finalize(std::ostream& makeDepends, this->LocateModules(); // Get the directory in which stamp files will be stored. - const char* stamp_dir = this->TargetDirectory.c_str(); + const std::string& stamp_dir = this->TargetDirectory; // Get the directory in which module files will be created. cmMakefile* mf = this->LocalGenerator->GetMakefile(); @@ -167,9 +166,8 @@ bool cmDependsFortran::Finalize(std::ostream& makeDepends, typedef cmDependsFortranInternals::ObjectInfoMap ObjectInfoMap; ObjectInfoMap const& objInfo = this->Internal->ObjectInfo; for (auto const& i : objInfo) { - if (!this->WriteDependenciesReal(i.first.c_str(), i.second, mod_dir, - stamp_dir, makeDepends, - internalDepends)) { + if (!this->WriteDependenciesReal(i.first, i.second, mod_dir, stamp_dir, + makeDepends, internalDepends)) { return false; } } @@ -256,22 +254,22 @@ void cmDependsFortran::LocateModules() std::string fname = targetDir + "/fortran.internal"; cmsys::ifstream fin(fname.c_str()); if (fin) { - this->MatchRemoteModules(fin, targetDir.c_str()); + this->MatchRemoteModules(fin, targetDir); } } } void cmDependsFortran::MatchLocalModules() { - const char* stampDir = this->TargetDirectory.c_str(); + std::string const& stampDir = this->TargetDirectory; std::set const& provides = this->Internal->TargetProvides; for (std::string const& i : provides) { - this->ConsiderModule(i.c_str(), stampDir); + this->ConsiderModule(i, stampDir); } } void cmDependsFortran::MatchRemoteModules(std::istream& fin, - const char* stampDir) + const std::string& stampDir) { std::string line; bool doing_provides = false; @@ -300,7 +298,8 @@ void cmDependsFortran::MatchRemoteModules(std::istream& fin, } } -void cmDependsFortran::ConsiderModule(const char* name, const char* stampDir) +void cmDependsFortran::ConsiderModule(const std::string& name, + const std::string& stampDir) { // Locate each required module. typedef cmDependsFortranInternals::TargetRequiresMap TargetRequiresMap; @@ -317,17 +316,17 @@ void cmDependsFortran::ConsiderModule(const char* name, const char* stampDir) } } -bool cmDependsFortran::WriteDependenciesReal(const char* obj, +bool cmDependsFortran::WriteDependenciesReal(std::string const& obj, cmFortranSourceInfo const& info, std::string const& mod_dir, - const char* stamp_dir, + std::string const& stamp_dir, std::ostream& makeDepends, std::ostream& internalDepends) { typedef cmDependsFortranInternals::TargetRequiresMap TargetRequiresMap; // Get the source file for this object. - const char* src = info.Source.c_str(); + std::string const& src = info.Source; // Write the include dependencies to the output stream. std::string binDir = this->LocalGenerator->GetBinaryDirectory(); @@ -502,8 +501,7 @@ bool cmDependsFortran::CopyModule(const std::vector& args) cmFortranModuleAppendUpperLower(cmSystemTools::GetFilenameName(mod), mod_upper, mod_lower); if (cmSystemTools::FileExists(mod_upper, true)) { - if (cmDependsFortran::ModulesDiffer(mod_upper.c_str(), stamp.c_str(), - compilerId.c_str())) { + if (cmDependsFortran::ModulesDiffer(mod_upper, stamp, compilerId)) { if (!cmSystemTools::CopyFileAlways(mod_upper, stamp)) { std::cerr << "Error copying Fortran module from \"" << mod_upper << "\" to \"" << stamp << "\".\n"; @@ -513,8 +511,7 @@ bool cmDependsFortran::CopyModule(const std::vector& args) return true; } if (cmSystemTools::FileExists(mod_lower, true)) { - if (cmDependsFortran::ModulesDiffer(mod_lower.c_str(), stamp.c_str(), - compilerId.c_str())) { + if (cmDependsFortran::ModulesDiffer(mod_lower, stamp, compilerId)) { if (!cmSystemTools::CopyFileAlways(mod_lower, stamp)) { std::cerr << "Error copying Fortran module from \"" << mod_lower << "\" to \"" << stamp << "\".\n"; @@ -581,9 +578,9 @@ static bool cmFortranStreamsDiffer(std::istream& ifs1, std::istream& ifs2) return true; } -bool cmDependsFortran::ModulesDiffer(const char* modFile, - const char* stampFile, - const char* compilerId) +bool cmDependsFortran::ModulesDiffer(const std::string& modFile, + const std::string& stampFile, + const std::string& compilerId) { /* gnu >= 4.9: @@ -617,16 +614,17 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile, * source is compiled twice * -SunPro */ - if (strcmp(compilerId, "SunPro") == 0) { + if (compilerId == "SunPro") { return cmSystemTools::FilesDiffer(modFile, stampFile); } #if defined(_WIN32) || defined(__CYGWIN__) - cmsys::ifstream finModFile(modFile, std::ios::in | std::ios::binary); - cmsys::ifstream finStampFile(stampFile, std::ios::in | std::ios::binary); + cmsys::ifstream finModFile(modFile.c_str(), std::ios::in | std::ios::binary); + cmsys::ifstream finStampFile(stampFile.c_str(), + std::ios::in | std::ios::binary); #else - cmsys::ifstream finModFile(modFile); - cmsys::ifstream finStampFile(stampFile); + cmsys::ifstream finModFile(modFile.c_str()); + cmsys::ifstream finStampFile(stampFile.c_str()); #endif if (!finModFile || !finStampFile) { // At least one of the files does not exist. The modules differ. @@ -641,7 +639,7 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile, * Eat the stream content until all recompile only related changes * are left behind. */ - if (strcmp(compilerId, "GNU") == 0) { + if (compilerId == "GNU") { // GNU Fortran 4.9 and later compress .mod files with gzip // but also do not include a date so we can fall through to // compare them without skipping any prefix. @@ -664,7 +662,7 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile, return true; } } - } else if (strcmp(compilerId, "Intel") == 0) { + } else if (compilerId == "Intel") { const char seq[2] = { '\n', '\0' }; const int seqlen = 2; diff --git a/Source/cmDependsFortran.h b/Source/cmDependsFortran.h index 5d96dd4..f5f5be2 100644 --- a/Source/cmDependsFortran.h +++ b/Source/cmDependsFortran.h @@ -44,8 +44,9 @@ public: /** Determine if a mod file and the corresponding mod.stamp file are representing different module information. */ - static bool ModulesDiffer(const char* modFile, const char* stampFile, - const char* compilerId); + static bool ModulesDiffer(const std::string& modFile, + const std::string& stampFile, + const std::string& compilerId); protected: // Finalize the dependency information for the target. @@ -55,8 +56,8 @@ protected: // Find all the modules required by the target. void LocateModules(); void MatchLocalModules(); - void MatchRemoteModules(std::istream& fin, const char* stampDir); - void ConsiderModule(const char* name, const char* stampDir); + void MatchRemoteModules(std::istream& fin, const std::string& stampDir); + void ConsiderModule(const std::string& name, const std::string& stampDir); bool FindModule(std::string const& name, std::string& module); // Implement writing/checking methods required by superclass. @@ -65,8 +66,10 @@ protected: std::ostream& internalDepends) override; // Actually write the dependencies to the streams. - bool WriteDependenciesReal(const char* obj, cmFortranSourceInfo const& info, - std::string const& mod_dir, const char* stamp_dir, + bool WriteDependenciesReal(std::string const& obj, + cmFortranSourceInfo const& info, + std::string const& mod_dir, + std::string const& stamp_dir, std::ostream& makeDepends, std::ostream& internalDepends); diff --git a/Source/cmDependsJava.cxx b/Source/cmDependsJava.cxx index 29938ba..b44b3a2 100644 --- a/Source/cmDependsJava.cxx +++ b/Source/cmDependsJava.cxx @@ -27,7 +27,8 @@ bool cmDependsJava::WriteDependencies(const std::set& sources, } bool cmDependsJava::CheckDependencies( - std::istream& /*internalDepends*/, const char* /*internalDependsFileName*/, + std::istream& /*internalDepends*/, + const std::string& /*internalDependsFileName*/, std::map& /*validDeps*/) { return true; diff --git a/Source/cmDependsJava.h b/Source/cmDependsJava.h index d070840..1928c51 100644 --- a/Source/cmDependsJava.h +++ b/Source/cmDependsJava.h @@ -33,7 +33,7 @@ protected: const std::string& file, std::ostream& makeDepends, std::ostream& internalDepends) override; bool CheckDependencies( - std::istream& internalDepends, const char* internalDependsFileName, + std::istream& internalDepends, const std::string& internalDependsFileName, std::map& validDeps) override; }; diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 707a1b5..b31855d 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1333,8 +1333,8 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies(const char* tgtInfo, // dependency vector. This means that in the normal case, when only // few or one file have been edited, then also only this one file is // actually scanned again, instead of all files for this target. - needRescanDependencies = !checker.Check( - dependFile.c_str(), internalDependFile.c_str(), validDependencies); + needRescanDependencies = + !checker.Check(dependFile, internalDependFile, validDependencies); } if (needRescanDependInfo || needRescanDirInfo || needRescanDependencies) { @@ -1347,7 +1347,7 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies(const char* tgtInfo, cmsysTerminal_Color_ForegroundBold, message.c_str(), true, color); - return this->ScanDependencies(dir.c_str(), validDependencies); + return this->ScanDependencies(dir, validDependencies); } // The dependencies are already up-to-date. @@ -1355,7 +1355,7 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies(const char* tgtInfo, } bool cmLocalUnixMakefileGenerator3::ScanDependencies( - const char* targetDir, + const std::string& targetDir, std::map& validDeps) { // Read the directory information file. @@ -1393,12 +1393,9 @@ bool cmLocalUnixMakefileGenerator3::ScanDependencies( cmSystemTools::Error("Directory Information file not found"); } - // create the file stream for the depends file - std::string dir = targetDir; - // Open the make depends file. This should be copy-if-different // because the make tool may try to reload it needlessly otherwise. - std::string ruleFileNameFull = dir; + std::string ruleFileNameFull = targetDir; ruleFileNameFull += "/depend.make"; cmGeneratedFileStream ruleFileStream( ruleFileNameFull, false, this->GlobalGenerator->GetMakefileEncoding()); @@ -1410,7 +1407,7 @@ bool cmLocalUnixMakefileGenerator3::ScanDependencies( // Open the cmake dependency tracking file. This should not be // copy-if-different because dependencies are re-scanned when it is // older than the DependInfo.cmake. - std::string internalRuleFileNameFull = dir; + std::string internalRuleFileNameFull = targetDir; internalRuleFileNameFull += "/depend.internal"; cmGeneratedFileStream internalRuleFileStream( internalRuleFileNameFull, false, @@ -1451,7 +1448,7 @@ bool cmLocalUnixMakefileGenerator3::ScanDependencies( scanner->SetFileComparison( this->GlobalGenerator->GetCMakeInstance()->GetFileComparison()); scanner->SetLanguage(lang); - scanner->SetTargetDirectory(dir.c_str()); + scanner->SetTargetDirectory(targetDir); scanner->Write(ruleFileStream, internalRuleFileStream); // free the scanner for this language @@ -1720,7 +1717,7 @@ void cmLocalUnixMakefileGenerator3::ClearDependencies(cmMakefile* mf, // Clear the implicit dependency makefile. std::string dependFile = dir + "/depend.make"; - clearer.Clear(dependFile.c_str()); + clearer.Clear(dependFile); // Remove the internal dependency check file to force // regeneration. diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index ee6b37b..c0d0e13 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -245,7 +245,7 @@ protected: // Helper methods for dependency updates. bool ScanDependencies( - const char* targetDir, + const std::string& targetDir, std::map& validDeps); void CheckMultipleOutputs(bool verbose); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=48ec0bc1401b99e5a2d07392fb98f96d5fec9e50 commit 48ec0bc1401b99e5a2d07392fb98f96d5fec9e50 Author: Julien Jomier AuthorDate: Fri Jan 4 12:41:01 2019 +0100 Commit: Brad King CommitDate: Fri Jan 18 12:41:35 2019 -0500 cmake-gui: Add field for generator platform selection Extend the "first configure" dialog with a field for the user to select a value for `CMAKE_GENERATOR_PLATFORM`. Fixes: #17343 diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index 444a980..72cce9f 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -751,6 +751,7 @@ bool CMakeSetupDialog::setupFirstConfigure() if (dialog.exec() == QDialog::Accepted) { dialog.saveToSettings(); this->CMakeThread->cmakeInstance()->setGenerator(dialog.getGenerator()); + this->CMakeThread->cmakeInstance()->setPlatform(dialog.getPlatform()); this->CMakeThread->cmakeInstance()->setToolset(dialog.getToolset()); QCMakeCacheModel* m = this->CacheValues->cacheModel(); diff --git a/Source/QtDialog/FirstConfigure.cxx b/Source/QtDialog/FirstConfigure.cxx index 88ce7cb..66707d6 100644 --- a/Source/QtDialog/FirstConfigure.cxx +++ b/Source/QtDialog/FirstConfigure.cxx @@ -16,8 +16,12 @@ StartCompilerSetup::StartCompilerSetup(QWidget* p) this->GeneratorOptions = new QComboBox(this); l->addWidget(this->GeneratorOptions); + // Add the generator platform + this->PlatformFrame = CreatePlatformWidgets(); + l->addWidget(PlatformFrame); + // Add the ability to specify toolset (-T parameter) - ToolsetFrame = CreateToolsetWidgets(); + this->ToolsetFrame = CreateToolsetWidgets(); l->addWidget(ToolsetFrame); l->addSpacing(6); @@ -45,7 +49,7 @@ StartCompilerSetup::StartCompilerSetup(QWidget* p) SLOT(onSelectionChanged(bool))); QObject::connect(this->CompilerSetupOptions[3], SIGNAL(toggled(bool)), this, SLOT(onSelectionChanged(bool))); - QObject::connect(GeneratorOptions, + QObject::connect(this->GeneratorOptions, SIGNAL(currentIndexChanged(QString const&)), this, SLOT(onGeneratorChanged(QString const&))); } @@ -65,6 +69,24 @@ QFrame* StartCompilerSetup::CreateToolsetWidgets() return frame; } +QFrame* StartCompilerSetup::CreatePlatformWidgets() +{ + QFrame* frame = new QFrame(this); + QVBoxLayout* l = new QVBoxLayout(frame); + l->setContentsMargins(0, 0, 0, 0); + + this->PlatformLabel = + new QLabel(tr("Specify the platform for this generator")); + l->addWidget(this->PlatformLabel); + + this->PlatformOptions = new QComboBox(frame); + this->PlatformOptions->setEditable(true); + + l->addWidget(this->PlatformOptions); + + return frame; +} + StartCompilerSetup::~StartCompilerSetup() { } @@ -80,6 +102,22 @@ void StartCompilerSetup::setGenerators( for (it = gens.begin(); it != gens.end(); ++it) { generator_list.append(QString::fromLocal8Bit(it->name.c_str())); + if (it->supportsPlatform) { + this->GeneratorsSupportingPlatform.append( + QString::fromLocal8Bit(it->name.c_str())); + + std::vector::const_iterator platformIt = + it->supportedPlatforms.cbegin(); + while (platformIt != it->supportedPlatforms.cend()) { + + this->GeneratorSupportedPlatforms.insert( + QString::fromLocal8Bit(it->name.c_str()), + QString::fromLocal8Bit((*platformIt).c_str())); + + platformIt++; + } + } + if (it->supportsToolset) { this->GeneratorsSupportingToolset.append( QString::fromLocal8Bit(it->name.c_str())); @@ -102,6 +140,11 @@ QString StartCompilerSetup::getGenerator() const return this->GeneratorOptions->currentText(); }; +QString StartCompilerSetup::getPlatform() const +{ + return this->PlatformOptions->currentText(); +}; + QString StartCompilerSetup::getToolset() const { return this->Toolset->text(); @@ -136,6 +179,24 @@ void StartCompilerSetup::onSelectionChanged(bool on) void StartCompilerSetup::onGeneratorChanged(QString const& name) { + // Display the generator platform for the generators supporting it + if (GeneratorsSupportingPlatform.contains(name)) { + + // Regenerate the list of supported platform + this->PlatformOptions->clear(); + QStringList platform_list; + platform_list.append(""); + + QList platforms = this->GeneratorSupportedPlatforms.values(name); + platform_list.append(platforms); + + this->PlatformOptions->addItems(platform_list); + PlatformFrame->show(); + } else { + PlatformFrame->hide(); + } + + // Display the toolset box for the generators supporting it if (GeneratorsSupportingToolset.contains(name)) { ToolsetFrame->show(); } else { @@ -390,6 +451,11 @@ QString FirstConfigure::getGenerator() const return this->mStartCompilerSetupPage->getGenerator(); } +QString FirstConfigure::getPlatform() const +{ + return this->mStartCompilerSetupPage->getPlatform(); +} + QString FirstConfigure::getToolset() const { return this->mStartCompilerSetupPage->getToolset(); diff --git a/Source/QtDialog/FirstConfigure.h b/Source/QtDialog/FirstConfigure.h index abfa03f..133f422 100644 --- a/Source/QtDialog/FirstConfigure.h +++ b/Source/QtDialog/FirstConfigure.h @@ -35,6 +35,7 @@ public: void setCurrentGenerator(const QString& gen); QString getGenerator() const; QString getToolset() const; + QString getPlatform() const; bool defaultSetup() const; bool compilerSetup() const; @@ -56,10 +57,16 @@ protected: QFrame* ToolsetFrame; QLineEdit* Toolset; QLabel* ToolsetLabel; + QFrame* PlatformFrame; + QComboBox* PlatformOptions; + QLabel* PlatformLabel; QStringList GeneratorsSupportingToolset; + QStringList GeneratorsSupportingPlatform; + QMultiMap GeneratorSupportedPlatforms; private: QFrame* CreateToolsetWidgets(); + QFrame* CreatePlatformWidgets(); }; //! the page that gives basic options for native compilers @@ -159,6 +166,7 @@ public: void setGenerators(std::vector const& gens); QString getGenerator() const; + QString getPlatform() const; QString getToolset() const; bool defaultSetup() const; diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index 9a6784e..2eecce6 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -35,7 +35,8 @@ QCMake::QCMake(QObject* p) cmSystemTools::SetInterruptCallback(QCMake::interruptCallback, this); std::vector generators; - this->CMakeInstance->GetRegisteredGenerators(generators); + this->CMakeInstance->GetRegisteredGenerators( + generators, /*includeNamesWithPlatform=*/false); std::vector::const_iterator it; for (it = generators.begin(); it != generators.end(); ++it) { @@ -74,6 +75,7 @@ void QCMake::setBinaryDirectory(const QString& _dir) cmState* state = this->CMakeInstance->GetState(); this->setGenerator(QString()); this->setToolset(QString()); + this->setPlatform(QString()); if (!this->CMakeInstance->LoadCache( this->BinaryDirectory.toLocal8Bit().data())) { QDir testDir(this->BinaryDirectory); @@ -102,6 +104,12 @@ void QCMake::setBinaryDirectory(const QString& _dir) this->setGenerator(QString::fromLocal8Bit(curGen.c_str())); } + const char* platform = + state->GetCacheEntryValue("CMAKE_GENERATOR_PLATFORM"); + if (platform) { + this->setPlatform(QString::fromLocal8Bit(platform)); + } + const char* toolset = state->GetCacheEntryValue("CMAKE_GENERATOR_TOOLSET"); if (toolset) { this->setToolset(QString::fromLocal8Bit(toolset)); @@ -119,6 +127,14 @@ void QCMake::setGenerator(const QString& gen) } } +void QCMake::setPlatform(const QString& platform) +{ + if (this->Platform != platform) { + this->Platform = platform; + emit this->platformChanged(this->Platform); + } +} + void QCMake::setToolset(const QString& toolset) { if (this->Toolset != toolset) { @@ -140,7 +156,8 @@ void QCMake::configure() this->CMakeInstance->SetGlobalGenerator( this->CMakeInstance->CreateGlobalGenerator( this->Generator.toLocal8Bit().data())); - this->CMakeInstance->SetGeneratorPlatform(""); + this->CMakeInstance->SetGeneratorPlatform( + this->Platform.toLocal8Bit().data()); this->CMakeInstance->SetGeneratorToolset(this->Toolset.toLocal8Bit().data()); this->CMakeInstance->LoadCache(); this->CMakeInstance->SetWarnUninitialized(this->WarnUninitializedMode); diff --git a/Source/QtDialog/QCMake.h b/Source/QtDialog/QCMake.h index 4b3920a..c84da58 100644 --- a/Source/QtDialog/QCMake.h +++ b/Source/QtDialog/QCMake.h @@ -75,6 +75,8 @@ public slots: /// set the desired generator to use void setGenerator(const QString& generator); /// set the desired generator to use + void setPlatform(const QString& platform); + /// set the desired generator to use void setToolset(const QString& toolset); /// do the configure step void configure(); @@ -155,6 +157,8 @@ signals: void debugOutputChanged(bool); /// signal when the toolset changes void toolsetChanged(const QString& toolset); + /// signal when the platform changes + void platformChanged(const QString& platform); /// signal when open is done void openDone(bool successful); /// signal when open is done @@ -175,6 +179,7 @@ protected: QString SourceDirectory; QString BinaryDirectory; QString Generator; + QString Platform; QString Toolset; std::vector AvailableGenerators; QString CMakeExecutable; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8bba458ea5d6b792e165560d79efd8d8356f4329 commit 8bba458ea5d6b792e165560d79efd8d8356f4329 Author: Brad King AuthorDate: Fri Jan 18 11:45:33 2019 -0500 Commit: Brad King CommitDate: Fri Jan 18 12:30:19 2019 -0500 Add global generator factory method to get default platform name diff --git a/Source/cmGlobalGeneratorFactory.h b/Source/cmGlobalGeneratorFactory.h index 26c9545..d4f772b 100644 --- a/Source/cmGlobalGeneratorFactory.h +++ b/Source/cmGlobalGeneratorFactory.h @@ -41,6 +41,9 @@ public: /** Get the list of supported platforms name for this generator */ virtual std::vector GetKnownPlatforms() const = 0; + + /** If the generator suports platforms, get its default. */ + virtual std::string GetDefaultPlatformName() const = 0; }; template @@ -87,6 +90,8 @@ public: // default is no platform supported return std::vector(); } + + std::string GetDefaultPlatformName() const override { return std::string(); } }; #endif diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index c439f68..dbe582b 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -100,6 +100,8 @@ public: platforms.emplace_back("Itanium"); return platforms; } + + std::string GetDefaultPlatformName() const override { return "Win32"; } }; cmGlobalGeneratorFactory* cmGlobalVisualStudio10Generator::NewFactory() diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index 0aaf2bb..4eb78ba 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -109,6 +109,8 @@ public: return platforms; } + + std::string GetDefaultPlatformName() const override { return "Win32"; } }; cmGlobalGeneratorFactory* cmGlobalVisualStudio11Generator::NewFactory() diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx index 1c202a8..8b50684 100644 --- a/Source/cmGlobalVisualStudio12Generator.cxx +++ b/Source/cmGlobalVisualStudio12Generator.cxx @@ -84,6 +84,8 @@ public: platforms.emplace_back("ARM"); return platforms; } + + std::string GetDefaultPlatformName() const override { return "Win32"; } }; cmGlobalGeneratorFactory* cmGlobalVisualStudio12Generator::NewFactory() diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx index c87433e..a0a9558 100644 --- a/Source/cmGlobalVisualStudio14Generator.cxx +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -84,6 +84,8 @@ public: platforms.emplace_back("ARM"); return platforms; } + + std::string GetDefaultPlatformName() const override { return "Win32"; } }; cmGlobalGeneratorFactory* cmGlobalVisualStudio14Generator::NewFactory() diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx index 15a83af..6e61d268 100644 --- a/Source/cmGlobalVisualStudio9Generator.cxx +++ b/Source/cmGlobalVisualStudio9Generator.cxx @@ -99,6 +99,8 @@ public: } return platforms; } + + std::string GetDefaultPlatformName() const override { return "Win32"; } }; cmGlobalGeneratorFactory* cmGlobalVisualStudio9Generator::NewFactory() diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx index 4b08b11..31f585c 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx +++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx @@ -159,6 +159,8 @@ public: platforms.emplace_back("ARM64"); return platforms; } + + std::string GetDefaultPlatformName() const override { return "Win32"; } }; cmGlobalGeneratorFactory* @@ -234,6 +236,11 @@ public: platforms.emplace_back("ARM64"); return platforms; } + + std::string GetDefaultPlatformName() const override + { + return VSHostPlatformName(); + } }; cmGlobalGeneratorFactory* diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index ca5dafe..4dd1a87 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -152,6 +152,8 @@ public: { return std::vector(); } + + std::string GetDefaultPlatformName() const override { return std::string(); } }; cmGlobalXCodeGenerator::cmGlobalXCodeGenerator( diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 927d39b..2ac1b00 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -977,6 +977,7 @@ void cmake::GetRegisteredGenerators(std::vector& generators, info.supportsToolset = gen->SupportsToolset(); info.supportsPlatform = gen->SupportsPlatform(); info.supportedPlatforms = gen->GetKnownPlatforms(); + info.defaultPlatform = gen->GetDefaultPlatformName(); info.name = name; info.baseName = name; info.isAlias = false; diff --git a/Source/cmake.h b/Source/cmake.h index d67f835..38d0c62 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -105,6 +105,7 @@ public: bool supportsToolset; bool supportsPlatform; std::vector supportedPlatforms; + std::string defaultPlatform; bool isAlias; }; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=818df52c488a94628169811bddffe05f36c68b42 commit 818df52c488a94628169811bddffe05f36c68b42 Author: Brad King AuthorDate: Fri Jan 18 10:13:55 2019 -0500 Commit: Brad King CommitDate: Fri Jan 18 12:29:53 2019 -0500 Add global generator factory method to get list of known platforms Add a `cmGlobalGeneratorFactory::GetKnownPlatforms` method to return a list of known possible values for `CMAKE_GENERATOR_PLATFORM`. Implement the method for each generator by referencing the list of possible values documented in `Help/generator/*.rst` for it. Co-Author: Julien Jomier diff --git a/Source/cmGlobalGeneratorFactory.h b/Source/cmGlobalGeneratorFactory.h index 906ec9a..26c9545 100644 --- a/Source/cmGlobalGeneratorFactory.h +++ b/Source/cmGlobalGeneratorFactory.h @@ -38,6 +38,9 @@ public: /** Determine whether or not this generator supports platforms */ virtual bool SupportsPlatform() const = 0; + + /** Get the list of supported platforms name for this generator */ + virtual std::vector GetKnownPlatforms() const = 0; }; template @@ -77,6 +80,13 @@ public: /** Determine whether or not this generator supports platforms */ bool SupportsPlatform() const override { return T::SupportsPlatform(); } + + /** Get the list of supported platforms name for this generator */ + std::vector GetKnownPlatforms() const override + { + // default is no platform supported + return std::vector(); + } }; #endif diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index bf856ea..c439f68 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -91,6 +91,15 @@ public: bool SupportsToolset() const override { return true; } bool SupportsPlatform() const override { return true; } + + std::vector GetKnownPlatforms() const override + { + std::vector platforms; + platforms.emplace_back("x64"); + platforms.emplace_back("Win32"); + platforms.emplace_back("Itanium"); + return platforms; + } }; cmGlobalGeneratorFactory* cmGlobalVisualStudio10Generator::NewFactory() diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index a44058b..0aaf2bb 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -93,6 +93,22 @@ public: bool SupportsToolset() const override { return true; } bool SupportsPlatform() const override { return true; } + + std::vector GetKnownPlatforms() const override + { + std::vector platforms; + platforms.emplace_back("x64"); + platforms.emplace_back("Win32"); + platforms.emplace_back("ARM"); + + std::set installedSDKs = + cmGlobalVisualStudio11Generator::GetInstalledWindowsCESDKs(); + for (std::string const& i : installedSDKs) { + platforms.emplace_back(i); + } + + return platforms; + } }; cmGlobalGeneratorFactory* cmGlobalVisualStudio11Generator::NewFactory() diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx index cbd5085..1c202a8 100644 --- a/Source/cmGlobalVisualStudio12Generator.cxx +++ b/Source/cmGlobalVisualStudio12Generator.cxx @@ -75,6 +75,15 @@ public: bool SupportsToolset() const override { return true; } bool SupportsPlatform() const override { return true; } + + std::vector GetKnownPlatforms() const override + { + std::vector platforms; + platforms.emplace_back("x64"); + platforms.emplace_back("Win32"); + platforms.emplace_back("ARM"); + return platforms; + } }; cmGlobalGeneratorFactory* cmGlobalVisualStudio12Generator::NewFactory() diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx index 47768a8..c87433e 100644 --- a/Source/cmGlobalVisualStudio14Generator.cxx +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -75,6 +75,15 @@ public: bool SupportsToolset() const override { return true; } bool SupportsPlatform() const override { return true; } + + std::vector GetKnownPlatforms() const override + { + std::vector platforms; + platforms.emplace_back("x64"); + platforms.emplace_back("Win32"); + platforms.emplace_back("ARM"); + return platforms; + } }; cmGlobalGeneratorFactory* cmGlobalVisualStudio14Generator::NewFactory() diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx index d72b25b..15a83af 100644 --- a/Source/cmGlobalVisualStudio9Generator.cxx +++ b/Source/cmGlobalVisualStudio9Generator.cxx @@ -83,6 +83,22 @@ public: bool SupportsToolset() const override { return false; } bool SupportsPlatform() const override { return true; } + + std::vector GetKnownPlatforms() const override + { + std::vector platforms; + platforms.emplace_back("x64"); + platforms.emplace_back("Win32"); + platforms.emplace_back("Itanium"); + cmVisualStudioWCEPlatformParser parser; + parser.ParseVersion("9.0"); + const std::vector& availablePlatforms = + parser.GetAvailablePlatforms(); + for (std::string const& i : availablePlatforms) { + platforms.emplace_back(i); + } + return platforms; + } }; cmGlobalGeneratorFactory* cmGlobalVisualStudio9Generator::NewFactory() diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx index 0860294..4b08b11 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx +++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx @@ -149,6 +149,16 @@ public: bool SupportsToolset() const override { return true; } bool SupportsPlatform() const override { return true; } + + std::vector GetKnownPlatforms() const override + { + std::vector platforms; + platforms.emplace_back("x64"); + platforms.emplace_back("Win32"); + platforms.emplace_back("ARM"); + platforms.emplace_back("ARM64"); + return platforms; + } }; cmGlobalGeneratorFactory* @@ -214,6 +224,16 @@ public: bool SupportsToolset() const override { return true; } bool SupportsPlatform() const override { return true; } + + std::vector GetKnownPlatforms() const override + { + std::vector platforms; + platforms.emplace_back("x64"); + platforms.emplace_back("Win32"); + platforms.emplace_back("ARM"); + platforms.emplace_back("ARM64"); + return platforms; + } }; cmGlobalGeneratorFactory* diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index e5ab0e1..ca5dafe 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -147,6 +147,11 @@ public: bool SupportsToolset() const override { return true; } bool SupportsPlatform() const override { return false; } + + std::vector GetKnownPlatforms() const override + { + return std::vector(); + } }; cmGlobalXCodeGenerator::cmGlobalXCodeGenerator( diff --git a/Source/cmake.cxx b/Source/cmake.cxx index f320aff..927d39b 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -976,6 +976,7 @@ void cmake::GetRegisteredGenerators(std::vector& generators, GeneratorInfo info; info.supportsToolset = gen->SupportsToolset(); info.supportsPlatform = gen->SupportsPlatform(); + info.supportedPlatforms = gen->GetKnownPlatforms(); info.name = name; info.baseName = name; info.isAlias = false; diff --git a/Source/cmake.h b/Source/cmake.h index b37cccd..d67f835 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -104,6 +104,7 @@ public: std::string extraName; bool supportsToolset; bool supportsPlatform; + std::vector supportedPlatforms; bool isAlias; }; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8144b00e32cf1e24daf41353cbcd1806311ceac9 commit 8144b00e32cf1e24daf41353cbcd1806311ceac9 Author: Brad King AuthorDate: Fri Jan 18 11:08:45 2019 -0500 Commit: Brad King CommitDate: Fri Jan 18 12:29:53 2019 -0500 Split global generator factory list with and without platforms Replace `cmGlobalGeneratorFactory::GetGenerators` with a pair of methods to split the list of generator names into those that have platforms in the name and those that do not. diff --git a/Source/cmGlobalGeneratorFactory.h b/Source/cmGlobalGeneratorFactory.h index 4e3e770..906ec9a 100644 --- a/Source/cmGlobalGeneratorFactory.h +++ b/Source/cmGlobalGeneratorFactory.h @@ -30,7 +30,8 @@ public: virtual void GetDocumentation(cmDocumentationEntry& entry) const = 0; /** Get the names of the current registered generators */ - virtual void GetGenerators(std::vector& names) const = 0; + virtual std::vector GetGeneratorNames() const = 0; + virtual std::vector GetGeneratorNamesWithPlatform() const = 0; /** Determine whether or not this generator supports toolsets */ virtual bool SupportsToolset() const = 0; @@ -60,9 +61,15 @@ public: } /** Get the names of the current registered generators */ - void GetGenerators(std::vector& names) const override + std::vector GetGeneratorNames() const override { + std::vector names; names.push_back(T::GetActualName()); + return names; + } + std::vector GetGeneratorNamesWithPlatform() const override + { + return std::vector(); } /** Determine whether or not this generator supports toolsets */ diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 79757a8..bf856ea 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -74,11 +74,19 @@ public: "Optional [arch] can be \"Win64\" or \"IA64\"."; } - void GetGenerators(std::vector& names) const override + std::vector GetGeneratorNames() const override { + std::vector names; names.push_back(vs10generatorName); + return names; + } + + std::vector GetGeneratorNamesWithPlatform() const override + { + std::vector names; names.push_back(vs10generatorName + std::string(" IA64")); names.push_back(vs10generatorName + std::string(" Win64")); + return names; } bool SupportsToolset() const override { return true; } diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index 36eb492..a44058b 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -69,9 +69,16 @@ public: "Optional [arch] can be \"Win64\" or \"ARM\"."; } - void GetGenerators(std::vector& names) const override + std::vector GetGeneratorNames() const override { + std::vector names; names.push_back(vs11generatorName); + return names; + } + + std::vector GetGeneratorNamesWithPlatform() const override + { + std::vector names; names.push_back(vs11generatorName + std::string(" ARM")); names.push_back(vs11generatorName + std::string(" Win64")); @@ -80,6 +87,8 @@ public: for (std::string const& i : installedSDKs) { names.push_back(std::string(vs11generatorName) + " " + i); } + + return names; } bool SupportsToolset() const override { return true; } diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx index 61034a7..cbd5085 100644 --- a/Source/cmGlobalVisualStudio12Generator.cxx +++ b/Source/cmGlobalVisualStudio12Generator.cxx @@ -58,11 +58,19 @@ public: "Optional [arch] can be \"Win64\" or \"ARM\"."; } - void GetGenerators(std::vector& names) const override + std::vector GetGeneratorNames() const override { + std::vector names; names.push_back(vs12generatorName); + return names; + } + + std::vector GetGeneratorNamesWithPlatform() const override + { + std::vector names; names.push_back(vs12generatorName + std::string(" ARM")); names.push_back(vs12generatorName + std::string(" Win64")); + return names; } bool SupportsToolset() const override { return true; } diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx index 5ea5e67..47768a8 100644 --- a/Source/cmGlobalVisualStudio14Generator.cxx +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -58,11 +58,19 @@ public: "Optional [arch] can be \"Win64\" or \"ARM\"."; } - void GetGenerators(std::vector& names) const override + std::vector GetGeneratorNames() const override { + std::vector names; names.push_back(vs14generatorName); + return names; + } + + std::vector GetGeneratorNamesWithPlatform() const override + { + std::vector names; names.push_back(vs14generatorName + std::string(" ARM")); names.push_back(vs14generatorName + std::string(" Win64")); + return names; } bool SupportsToolset() const override { return true; } diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx index 445b40c..d72b25b 100644 --- a/Source/cmGlobalVisualStudio9Generator.cxx +++ b/Source/cmGlobalVisualStudio9Generator.cxx @@ -59,9 +59,16 @@ public: "Optional [arch] can be \"Win64\" or \"IA64\"."; } - void GetGenerators(std::vector& names) const override + std::vector GetGeneratorNames() const override { + std::vector names; names.push_back(vs9generatorName); + return names; + } + + std::vector GetGeneratorNamesWithPlatform() const override + { + std::vector names; names.push_back(vs9generatorName + std::string(" Win64")); names.push_back(vs9generatorName + std::string(" IA64")); cmVisualStudioWCEPlatformParser parser; @@ -71,6 +78,7 @@ public: for (std::string const& i : availablePlatforms) { names.push_back("Visual Studio 9 2008 " + i); } + return names; } bool SupportsToolset() const override { return false; } diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx index 15e52fe..0860294 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx +++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx @@ -132,11 +132,19 @@ public: "Optional [arch] can be \"Win64\" or \"ARM\"."; } - void GetGenerators(std::vector& names) const override + std::vector GetGeneratorNames() const override { + std::vector names; names.push_back(vs15generatorName); + return names; + } + + std::vector GetGeneratorNamesWithPlatform() const override + { + std::vector names; names.push_back(vs15generatorName + std::string(" ARM")); names.push_back(vs15generatorName + std::string(" Win64")); + return names; } bool SupportsToolset() const override { return true; } @@ -192,9 +200,16 @@ public: "Use -A option to specify architecture."; } - virtual void GetGenerators(std::vector& names) const + std::vector GetGeneratorNames() const override { + std::vector names; names.push_back(vs16generatorName); + return names; + } + + std::vector GetGeneratorNamesWithPlatform() const override + { + return std::vector(); } bool SupportsToolset() const override { return true; } diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 6618351..e5ab0e1 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -133,9 +133,16 @@ public: cmGlobalXCodeGenerator::GetDocumentation(entry); } - void GetGenerators(std::vector& names) const override + std::vector GetGeneratorNames() const override { + std::vector names; names.push_back(cmGlobalXCodeGenerator::GetActualName()); + return names; + } + + std::vector GetGeneratorNamesWithPlatform() const override + { + return std::vector(); } bool SupportsToolset() const override { return true; } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 9fcfbde..f320aff 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -959,12 +959,18 @@ void cmake::AddDefaultExtraGenerators() #endif } -void cmake::GetRegisteredGenerators( - std::vector& generators) const +void cmake::GetRegisteredGenerators(std::vector& generators, + bool includeNamesWithPlatform) const { for (cmGlobalGeneratorFactory* gen : this->Generators) { - std::vector names; - gen->GetGenerators(names); + std::vector names = gen->GetGeneratorNames(); + + if (includeNamesWithPlatform) { + std::vector namesWithPlatform = + gen->GetGeneratorNamesWithPlatform(); + names.insert(names.end(), namesWithPlatform.begin(), + namesWithPlatform.end()); + } for (std::string const& name : names) { GeneratorInfo info; diff --git a/Source/cmake.h b/Source/cmake.h index cd8c622..b37cccd 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -196,7 +196,8 @@ public: void SetGlobalGenerator(cmGlobalGenerator*); ///! Get the names of the current registered generators - void GetRegisteredGenerators(std::vector& generators) const; + void GetRegisteredGenerators(std::vector& generators, + bool includeNamesWithPlatform = true) const; ///! Set the name of the selected generator-specific instance. void SetGeneratorInstance(std::string const& instance) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b70c0aed5c616edce5cbc803c7de92580f835f90 commit b70c0aed5c616edce5cbc803c7de92580f835f90 Author: Brad King AuthorDate: Fri Jan 18 11:41:31 2019 -0500 Commit: Brad King CommitDate: Fri Jan 18 12:29:53 2019 -0500 VS: Factor out helper function to compute host platform name diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx index 99f9503..15e52fe 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx +++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx @@ -19,6 +19,20 @@ # include "cmsys/SystemInformation.hxx" #endif +static std::string VSHostPlatformName() +{ +#ifdef HOST_PLATFORM_NAME + return HOST_PLATFORM_NAME; +#else + cmsys::SystemInformation info; + if (info.Is64Bits()) { + return "x64"; + } else { + return "Win32"; + } +#endif +} + static unsigned int VSVersionToMajor( cmGlobalVisualStudioGenerator::VSVersion v) { @@ -206,16 +220,7 @@ cmGlobalVisualStudioVersionedGenerator::cmGlobalVisualStudioVersionedGenerator( this->DefaultCSharpFlagTableName = VSVersionToToolset(this->Version); this->DefaultLinkFlagTableName = VSVersionToToolset(this->Version); if (this->Version >= cmGlobalVisualStudioGenerator::VS16) { -#ifdef HOST_PLATFORM_NAME - this->DefaultPlatformName = HOST_PLATFORM_NAME; -#else - cmsys::SystemInformation info; - if (info.Is64Bits()) { - this->DefaultPlatformName = "x64"; - } else { - this->DefaultPlatformName = "Win32"; - } -#endif + this->DefaultPlatformName = VSHostPlatformName(); } } ----------------------------------------------------------------------- Summary of changes: Source/QtDialog/CMakeSetupDialog.cxx | 1 + Source/QtDialog/FirstConfigure.cxx | 80 ++++++++++++++++++++++- Source/QtDialog/FirstConfigure.h | 9 +++ Source/QtDialog/QCMake.cxx | 21 +++++- Source/QtDialog/QCMake.h | 5 ++ Source/cmCTest.cxx | 4 +- Source/cmDepends.cxx | 23 +++---- Source/cmDepends.h | 13 ++-- Source/cmDependsC.cxx | 18 ++--- Source/cmDependsC.h | 4 +- Source/cmDependsFortran.cxx | 58 ++++++++-------- Source/cmDependsFortran.h | 15 +++-- Source/cmDependsJava.cxx | 3 +- Source/cmDependsJava.h | 2 +- Source/cmExecProgramCommand.cxx | 6 +- Source/cmExecuteProcessCommand.cxx | 8 +-- Source/cmGlobalGeneratorFactory.h | 26 +++++++- Source/cmGlobalVisualStudio10Generator.cxx | 21 +++++- Source/cmGlobalVisualStudio11Generator.cxx | 29 +++++++- Source/cmGlobalVisualStudio12Generator.cxx | 21 +++++- Source/cmGlobalVisualStudio14Generator.cxx | 21 +++++- Source/cmGlobalVisualStudio9Generator.cxx | 28 +++++++- Source/cmGlobalVisualStudioVersionedGenerator.cxx | 71 ++++++++++++++++---- Source/cmGlobalXCodeGenerator.cxx | 16 ++++- Source/cmLocalUnixMakefileGenerator3.cxx | 25 ++++--- Source/cmLocalUnixMakefileGenerator3.h | 2 +- Source/cmQtAutoGenerator.cxx | 8 +-- Source/cmSystemTools.cxx | 36 ++++------ Source/cmSystemTools.h | 6 +- Source/cmake.cxx | 32 +++++---- Source/cmake.h | 5 +- 31 files changed, 459 insertions(+), 158 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Tue Jan 22 09:43:04 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 22 Jan 2019 09:43:04 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-1049-gbcc9ea2 Message-ID: <20190122144304.B6E8D1135D2@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via bcc9ea2b3d9cd3b882dbb2a23502b0392cb21d1b (commit) via ad2ed96a85ff2548222093723b923305732a79cb (commit) via 4b017d579d00f1d4d032eda7e179f57bdd1da080 (commit) via 97700e9f5b17b1631f6bfef4fec62dad88dc9319 (commit) via ab3b549ee0dcd79607f8347a9b69c9b029590fbd (commit) via 5ff7fb592e5b9c5a6a0f05055a2bde5623e8cc54 (commit) from cb7fbf1dbbcc88fc7701250db5c3ccdf0ab7396e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bcc9ea2b3d9cd3b882dbb2a23502b0392cb21d1b commit bcc9ea2b3d9cd3b882dbb2a23502b0392cb21d1b Merge: ad2ed96 ab3b549 Author: Brad King AuthorDate: Tue Jan 22 14:41:09 2019 +0000 Commit: Kitware Robot CommitDate: Tue Jan 22 09:41:23 2019 -0500 Merge topic 'crosscompiling_emulator-fix' ab3b549ee0 CROSSCOMPILING_EMULATOR: Fix test generation for empty value Acked-by: Kitware Robot Merge-request: !2834 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ad2ed96a85ff2548222093723b923305732a79cb commit ad2ed96a85ff2548222093723b923305732a79cb Merge: 4b017d5 97700e9 Author: Brad King AuthorDate: Tue Jan 22 14:40:33 2019 +0000 Commit: Kitware Robot CommitDate: Tue Jan 22 09:40:39 2019 -0500 Merge topic 'findgit-imported-target' 97700e9f5b FindGit: Add imported target Acked-by: Kitware Robot Merge-request: !2790 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4b017d579d00f1d4d032eda7e179f57bdd1da080 commit 4b017d579d00f1d4d032eda7e179f57bdd1da080 Merge: cb7fbf1 5ff7fb5 Author: Brad King AuthorDate: Tue Jan 22 14:38:24 2019 +0000 Commit: Kitware Robot CommitDate: Tue Jan 22 09:38:30 2019 -0500 Merge topic 'Wcomma' 5ff7fb592e Fixed all but one clang -Wcomma warning Acked-by: Kitware Robot Merge-request: !2828 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=97700e9f5b17b1631f6bfef4fec62dad88dc9319 commit 97700e9f5b17b1631f6bfef4fec62dad88dc9319 Author: Kyle Edwards AuthorDate: Fri Jan 11 12:01:10 2019 -0500 Commit: Kyle Edwards CommitDate: Mon Jan 21 10:01:56 2019 -0500 FindGit: Add imported target diff --git a/Help/release/dev/findgit-imported-target.rst b/Help/release/dev/findgit-imported-target.rst new file mode 100644 index 0000000..cabbae5 --- /dev/null +++ b/Help/release/dev/findgit-imported-target.rst @@ -0,0 +1,5 @@ +findgit-imported-target +----------------------- + +* The :module:`FindGit` module now provides an ``IMPORTED`` target for the Git + executable. diff --git a/Modules/FindGit.cmake b/Modules/FindGit.cmake index c447a1a..900e4f5 100644 --- a/Modules/FindGit.cmake +++ b/Modules/FindGit.cmake @@ -5,6 +5,11 @@ FindGit ------- +The module defines the following ``IMPORTED`` targets: + +``Git::Git`` + Executable of the Git command-line client. + The module defines the following variables: ``GIT_EXECUTABLE`` @@ -78,6 +83,12 @@ if(GIT_EXECUTABLE) string(REPLACE "git version " "" GIT_VERSION_STRING "${git_version}") endif() unset(git_version) + + get_property(_findgit_role GLOBAL PROPERTY CMAKE_ROLE) + if(_findgit_role STREQUAL "PROJECT" AND NOT TARGET Git::Git) + add_executable(Git::Git IMPORTED) + set_property(TARGET Git::Git PROPERTY IMPORTED_LOCATION "${GIT_EXECUTABLE}") + endif() endif() include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 86f4c56..c1703cc 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1437,6 +1437,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release add_subdirectory(FindGIF) endif() + if(CMake_TEST_FindGit) + add_subdirectory(FindGit) + endif() + if(CMake_TEST_FindGSL) add_subdirectory(FindGSL) endif() diff --git a/Tests/FindGit/CMakeLists.txt b/Tests/FindGit/CMakeLists.txt new file mode 100644 index 0000000..5d061f4 --- /dev/null +++ b/Tests/FindGit/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindGit.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGit/Test" + "${CMake_BINARY_DIR}/Tests/FindGit/Test" + ${build_generator_args} + --build-project TestFindGit + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) diff --git a/Tests/FindGit/Test/CMakeLists.txt b/Tests/FindGit/Test/CMakeLists.txt new file mode 100644 index 0000000..26fb372 --- /dev/null +++ b/Tests/FindGit/Test/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.12) +project(TestFindGit NONE) +include(CTest) + +find_package(Git REQUIRED) + +add_test(NAME test_git + COMMAND ${CMAKE_COMMAND} + "-DGIT_EXECUTABLE=${GIT_EXECUTABLE}" + "-DGIT_EXECUTABLE_TARGET=$" + "-DGIT_VERSION_STRING=${GIT_VERSION_STRING}" + -P "${CMAKE_CURRENT_LIST_DIR}/RunGit.cmake" + ) diff --git a/Tests/FindGit/Test/RunGit.cmake b/Tests/FindGit/Test/RunGit.cmake new file mode 100644 index 0000000..f798cd3 --- /dev/null +++ b/Tests/FindGit/Test/RunGit.cmake @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 3.12) + +function(run_git exe exe_display) + execute_process(COMMAND ${exe} --version + OUTPUT_VARIABLE output + OUTPUT_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE result + ) + + if(NOT result EQUAL 0) + message(SEND_ERROR "Result of ${exe_display} --version is ${result}, should be 0") + endif() + + if(NOT output STREQUAL "git version ${GIT_VERSION_STRING}") + message(SEND_ERROR "Output of ${exe_display} --version is \"${output}\", should be \"git version ${GIT_VERSION_STRING}\"") + endif() +endfunction() + +run_git("${GIT_EXECUTABLE}" "\${GIT_EXECUTABLE}") +run_git("${GIT_EXECUTABLE_TARGET}" "Git::Git") https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ab3b549ee0dcd79607f8347a9b69c9b029590fbd commit ab3b549ee0dcd79607f8347a9b69c9b029590fbd Author: Kyle Edwards AuthorDate: Mon Jan 21 09:57:25 2019 -0500 Commit: Kyle Edwards CommitDate: Mon Jan 21 09:57:25 2019 -0500 CROSSCOMPILING_EMULATOR: Fix test generation for empty value If CROSSCOMPILING_EMULATOR was set to an empty string, and a test was generated with the executable as the command, CMake would segfault upon trying to generate the test file. Fix this. Fixes: #18819 diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx index 1e2ddc7..6032701 100644 --- a/Source/cmTestGenerator.cxx +++ b/Source/cmTestGenerator.cxx @@ -90,7 +90,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os, // Prepend with the emulator when cross compiling if required. const char* emulator = target->GetProperty("CROSSCOMPILING_EMULATOR"); - if (emulator != nullptr) { + if (emulator != nullptr && *emulator) { std::vector emulatorWithArgs; cmSystemTools::ExpandListArgument(emulator, emulatorWithArgs); std::string emulatorExe(emulatorWithArgs[0]); diff --git a/Tests/RunCMake/CrosscompilingEmulator/CrosscompilingEmulatorProperty.cmake b/Tests/RunCMake/CrosscompilingEmulator/CrosscompilingEmulatorProperty.cmake index 1aeb510..2fdefc4 100644 --- a/Tests/RunCMake/CrosscompilingEmulator/CrosscompilingEmulatorProperty.cmake +++ b/Tests/RunCMake/CrosscompilingEmulator/CrosscompilingEmulatorProperty.cmake @@ -26,3 +26,9 @@ get_property(emulator TARGET target_without_emulator if(NOT "${emulator}" STREQUAL "") message(SEND_ERROR "Default CROSSCOMPILING_EMULATOR property not set to null") endif() + +add_executable(target_with_empty_emulator simple_src_exiterror.cxx) +set_property(TARGET target_with_empty_emulator PROPERTY CROSSCOMPILING_EMULATOR "") + +enable_testing() +add_test(NAME test_target_with_empty_emulator COMMAND target_with_empty_emulator) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5ff7fb592e5b9c5a6a0f05055a2bde5623e8cc54 commit 5ff7fb592e5b9c5a6a0f05055a2bde5623e8cc54 Author: Sean McBride AuthorDate: Fri Jan 11 20:48:19 2019 -0500 Commit: Sean McBride CommitDate: Fri Jan 11 20:48:19 2019 -0500 Fixed all but one clang -Wcomma warning diff --git a/Source/CTest/cmCTestCVS.cxx b/Source/CTest/cmCTestCVS.cxx index 4fb3273..6e1ada1 100644 --- a/Source/CTest/cmCTestCVS.cxx +++ b/Source/CTest/cmCTestCVS.cxx @@ -111,8 +111,8 @@ public: , Revisions(revs) , Section(SectionHeader) { - this->SetLog(&cvs->Log, prefix), - this->RegexRevision.compile("^revision +([^ ]*) *$"); + this->SetLog(&cvs->Log, prefix); + this->RegexRevision.compile("^revision +([^ ]*) *$"); this->RegexBranches.compile("^branches: .*$"); this->RegexPerson.compile("^date: +([^;]+); +author: +([^;]+);"); } diff --git a/Source/cmExecProgramCommand.cxx b/Source/cmExecProgramCommand.cxx index ea4cd40..e7f8a01 100644 --- a/Source/cmExecProgramCommand.cxx +++ b/Source/cmExecProgramCommand.cxx @@ -217,7 +217,7 @@ bool cmExecProgramCommand::RunCommand(const char* command, std::string& output, int p; cmProcessOutput processOutput(encoding); std::string strdata; - while ((p = cmsysProcess_WaitForData(cp, &data, &length, nullptr), p)) { + while ((p = cmsysProcess_WaitForData(cp, &data, &length, nullptr))) { if (p == cmsysProcess_Pipe_STDOUT || p == cmsysProcess_Pipe_STDERR) { if (verbose) { processOutput.DecodeText(data, length, strdata); diff --git a/Source/cmExecuteProcessCommand.cxx b/Source/cmExecuteProcessCommand.cxx index 679a648..b549776 100644 --- a/Source/cmExecuteProcessCommand.cxx +++ b/Source/cmExecuteProcessCommand.cxx @@ -244,7 +244,7 @@ bool cmExecuteProcessCommand::InitialPass(std::vector const& args, int p; cmProcessOutput processOutput(encoding); std::string strdata; - while ((p = cmsysProcess_WaitForData(cp, &data, &length, nullptr), p)) { + while ((p = cmsysProcess_WaitForData(cp, &data, &length, nullptr))) { // Put the output in the right place. if (p == cmsysProcess_Pipe_STDOUT && !output_quiet) { if (output_variable.empty()) { diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index d6ab769..068cf5e 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -176,12 +176,14 @@ cmGlobalGenerator* cmGlobalXCodeGenerator::Factory::CreateGlobalGenerator( std::string versionFile; { std::string out; - std::string::size_type pos = 0; - if (cmSystemTools::RunSingleCommand("xcode-select --print-path", &out, - nullptr, nullptr, nullptr, - cmSystemTools::OUTPUT_NONE) && - (pos = out.find(".app/"), pos != std::string::npos)) { - versionFile = out.substr(0, pos + 5) + "Contents/version.plist"; + bool commandResult = cmSystemTools::RunSingleCommand( + "xcode-select --print-path", &out, nullptr, nullptr, nullptr, + cmSystemTools::OUTPUT_NONE); + if (commandResult) { + std::string::size_type pos = out.find(".app/"); + if (pos != std::string::npos) { + versionFile = out.substr(0, pos + 5) + "Contents/version.plist"; + } } } if (!versionFile.empty() && cmSystemTools::FileExists(versionFile.c_str())) { diff --git a/Source/cmProcessTools.cxx b/Source/cmProcessTools.cxx index facde5d..a2bc16f 100644 --- a/Source/cmProcessTools.cxx +++ b/Source/cmProcessTools.cxx @@ -16,7 +16,7 @@ void cmProcessTools::RunProcess(struct cmsysProcess_s* cp, OutputParser* out, cmProcessOutput processOutput(encoding); std::string strdata; while ((out || err) && - (p = cmsysProcess_WaitForData(cp, &data, &length, nullptr), p)) { + (p = cmsysProcess_WaitForData(cp, &data, &length, nullptr))) { if (out && p == cmsysProcess_Pipe_STDOUT) { processOutput.DecodeText(data, length, strdata, 1); if (!out->Process(strdata.c_str(), int(strdata.size()))) { ----------------------------------------------------------------------- Summary of changes: Help/release/dev/findgit-imported-target.rst | 5 +++++ Modules/FindGit.cmake | 11 +++++++++++ Source/CTest/cmCTestCVS.cxx | 4 ++-- Source/cmExecProgramCommand.cxx | 2 +- Source/cmExecuteProcessCommand.cxx | 2 +- Source/cmGlobalXCodeGenerator.cxx | 14 ++++++++------ Source/cmProcessTools.cxx | 2 +- Source/cmTestGenerator.cxx | 2 +- Tests/CMakeLists.txt | 4 ++++ Tests/{FindICU => FindGit}/CMakeLists.txt | 8 ++++---- Tests/FindGit/Test/CMakeLists.txt | 13 +++++++++++++ Tests/FindGit/Test/RunGit.cmake | 20 ++++++++++++++++++++ .../CrosscompilingEmulatorProperty.cmake | 6 ++++++ 13 files changed, 77 insertions(+), 16 deletions(-) create mode 100644 Help/release/dev/findgit-imported-target.rst copy Tests/{FindICU => FindGit}/CMakeLists.txt (55%) create mode 100644 Tests/FindGit/Test/CMakeLists.txt create mode 100644 Tests/FindGit/Test/RunGit.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Tue Jan 22 11:43:04 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 22 Jan 2019 11:43:04 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-1059-gfa5bf87 Message-ID: <20190122164304.DBAF011D924@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via fa5bf870df1ce5d9cbcf61be736beb0b1e87b85b (commit) via a1f65014a30c7e9da15c87e3cca1d86b480c5339 (commit) via 5990ecb74133e1a9c885fc0ea62896b501d37fef (commit) via d751d2d2ed277c1bfb2882fd90b377983ab4700f (commit) via c765ae495aa25714023d2cf2bcf6a9873da06184 (commit) via 8c5221fb1fad10518c8ef7901a686a9a816baf0e (commit) via 15ad8300621eaf9fe23cda30368f90b420505d43 (commit) via dfd5ae7da71ed9330eca7e352b8f9b42babdf3dd (commit) via 6023fe7ff22848bc29ee67395eeb10f066758c06 (commit) via 7408cd39298dfce442d7aa539a90a227433865d5 (commit) from bcc9ea2b3d9cd3b882dbb2a23502b0392cb21d1b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fa5bf870df1ce5d9cbcf61be736beb0b1e87b85b commit fa5bf870df1ce5d9cbcf61be736beb0b1e87b85b Merge: a1f6501 5990ecb Author: Brad King AuthorDate: Tue Jan 22 16:37:12 2019 +0000 Commit: Kitware Robot CommitDate: Tue Jan 22 11:37:49 2019 -0500 Merge topic 'implicit-includes' 5990ecb741 Compute implicit include directories from compiler output d751d2d2ed CMakeDetermineCompilerABI: set locale to C for try_compile() c765ae495a CMakeDetermineCompilerABI: pass verbose flag during compilation 8c5221fb1f try_compile: Preserve special characters in COMPILE_DEFINITIONS 15ad830062 Refactor exclusion of -I/usr/include to avoid per-language values Acked-by: Kitware Robot Merge-request: !2716 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a1f65014a30c7e9da15c87e3cca1d86b480c5339 commit a1f65014a30c7e9da15c87e3cca1d86b480c5339 Merge: bcc9ea2 dfd5ae7 Author: Brad King AuthorDate: Tue Jan 22 16:36:51 2019 +0000 Commit: Kitware Robot CommitDate: Tue Jan 22 11:37:01 2019 -0500 Merge topic 'help-mark-default-generator' dfd5ae7da7 Help: Mark default CMake generator with asterisk 6023fe7ff2 ccmake: Append rather than replace Generators section of docs 7408cd3929 cmake: Return generator docs directly Acked-by: Kitware Robot Merge-request: !2682 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5990ecb74133e1a9c885fc0ea62896b501d37fef commit 5990ecb74133e1a9c885fc0ea62896b501d37fef Author: Chuck Cranor AuthorDate: Fri Dec 7 07:48:17 2018 -0700 Commit: Brad King CommitDate: Mon Jan 21 11:14:08 2019 -0500 Compute implicit include directories from compiler output - CMakeParseImplicitIncludeInfo.cmake: new parser that extracts the compiler's include path from verbose output. If the parser cannot parse the output, we fall back to the old behavior. On osx we skip over framework directories (handled elsewhere). - CMakeDetermineCompilerABI.cmake: - use verbose flag in try_compile for ${src} - use new cmake_parse_implicit_include_info() to attempt extract implicit include directory path and if successful set CMAKE_${LANG}_IMPLICIT_INCLUDE_DIRECTORIES - CMakeCCompiler.cmake.in and CMakeCXXCompiler.cmake.in - preserve CMAKE_${LANG}_IMPLICIT_INCLUDE_DIRECTORIES value between runs in the same way CMAKE_${LANG}_IMPLICIT_LINK_DIRECTORIES is preserved - Tests/RunCMake/ParseImplicitIncludeInfo: tests for parse based on the older Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in. The test runs a set of verbose compiler outputs collected from various machines through the parser and checks the results. New compiler files can be added by dropping input/output files in the ParseImplicitIncludeInfo/data subdirectory and then adding the new set of files to the ${targets} list in ParseImplicitIncludeInfo.cmake. There is a helper CMakeLists.txt in ParseImplicitIncludeInfo/data that can help with the generation of test input files. NOTE: the standard cmake pre-commit hook rejects verbose compiler output with trailing spaces... you have to manually edit them out. This shouldn't impact the test. Note that both the parser and the test code can use CMAKE_${LANG}_COMPILER_* variables such as ${CMAKE_CXX_COMPILER_ID} to decide how to parse verbose compiler output. For the test code, this requires us to save the variables values in the test input files. Fixes: #16291 diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in index e75c74e..f473b0d 100644 --- a/Modules/CMakeCCompiler.cmake.in +++ b/Modules/CMakeCCompiler.cmake.in @@ -69,6 +69,7 @@ endif() @CMAKE_C_SYSROOT_FLAG_CODE@ @CMAKE_C_OSX_DEPLOYMENT_TARGET_FLAG_CODE@ +set(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES "@CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES@") 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@") diff --git a/Modules/CMakeCUDACompiler.cmake.in b/Modules/CMakeCUDACompiler.cmake.in index feb3e79..711129a 100644 --- a/Modules/CMakeCUDACompiler.cmake.in +++ b/Modules/CMakeCUDACompiler.cmake.in @@ -23,6 +23,7 @@ set(CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES "@CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBR set(CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES "@CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES@") set(CMAKE_CUDA_HOST_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_CUDA_HOST_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES@") +set(CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES "@CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES@") set(CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES "@CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES@") set(CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES "@CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES@") set(CMAKE_CUDA_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_CUDA_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES@") diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in index 5f52fd8..a1be02b 100644 --- a/Modules/CMakeCXXCompiler.cmake.in +++ b/Modules/CMakeCXXCompiler.cmake.in @@ -72,6 +72,7 @@ endif() @CMAKE_CXX_SYSROOT_FLAG_CODE@ @CMAKE_CXX_OSX_DEPLOYMENT_TARGET_FLAG_CODE@ +set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES "@CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES@") 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@") diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake index 1dbd44f..e55b83f 100644 --- a/Modules/CMakeDetermineCompilerABI.cmake +++ b/Modules/CMakeDetermineCompilerABI.cmake @@ -6,6 +6,7 @@ # This is used internally by CMake and should not be included by user # code. +include(${CMAKE_ROOT}/Modules/CMakeParseImplicitIncludeInfo.cmake) include(${CMAKE_ROOT}/Modules/CMakeParseImplicitLinkInfo.cmake) include(CMakeTestCompilerCommon) @@ -87,6 +88,18 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src) set(CMAKE_${lang}_COMPILER_ABI "${ABI_NAME}" PARENT_SCOPE) endif() + # Parse implicit include directory for this language, if available. + set (implicit_incdirs "") + if(CMAKE_${lang}_VERBOSE_FLAG) + cmake_parse_implicit_include_info("${OUTPUT}" "${lang}" + implicit_incdirs log rv) + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Parsed ${lang} implicit include dir info from above output: rv=${rv}\n${log}\n\n") + if("${rv}" STREQUAL "done") # update parent if parse completed ok + set(CMAKE_${lang}_IMPLICIT_INCLUDE_DIRECTORIES "${implicit_incdirs}" PARENT_SCOPE) + endif() + endif() + # Parse implicit linker information for this language, if available. set(implicit_dirs "") set(implicit_libs "") diff --git a/Modules/CMakeParseImplicitIncludeInfo.cmake b/Modules/CMakeParseImplicitIncludeInfo.cmake new file mode 100644 index 0000000..9901fea --- /dev/null +++ b/Modules/CMakeParseImplicitIncludeInfo.cmake @@ -0,0 +1,95 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# This is used internally by CMake and should not be included by user code. + +# helper function that parses implicit include dirs from a single line +# for compilers that report them that way. on success we return the +# list of dirs in id_var and set state_var to the 'done' state. +function(cmake_parse_implicit_include_line line lang id_var log_var state_var) + # clear variables we append to (avoids possible polution from parent scopes) + unset(rv) + set(log "") + + # ccfe: cray compiler front end (PrgEnv-cray) + if("${CMAKE_${lang}_COMPILER_ID}" STREQUAL "Cray" AND + "${line}" MATCHES "-isystem") + string(REGEX MATCHALL " (-I ?|-isystem )([^ ]*)" incs "${line}") + foreach(inc IN LISTS incs) + string(REGEX REPLACE " (-I ?|-isystem )([^ ]*)" "\\2" idir "${inc}") + list(APPEND rv "${idir}") + endforeach() + if(rv) + string(APPEND log " got implicit includes via cray ccfe parser!\n") + else() + string(APPEND log " warning: cray ccfe parse failed!\n") + endif() + endif() + + if(log) + set(${log_var} "${log}" PARENT_SCOPE) + endif() + if(rv) + set(${id_var} "${rv}" PARENT_SCOPE) + set(${state_var} "done" PARENT_SCOPE) + endif() +endfunction() + +# top-level function to parse implicit include directory information +# from verbose compiler output. sets state_var in parent to 'done' on success. +function(cmake_parse_implicit_include_info text lang dir_var log_var state_var) + set(state start) # values: start, loading, done + + # clear variables we append to (avoids possible polution from parent scopes) + set(implicit_dirs_tmp) + set(log "") + + # go through each line of output... + string(REGEX REPLACE "\r?\n" ";" output_lines "${text}") + foreach(line IN LISTS output_lines) + if(state STREQUAL start) + string(FIND "${line}" "#include <...> search starts here:" rv) + if(rv GREATER -1) + set(state loading) + string(APPEND log " found start of implicit include info\n") + else() + cmake_parse_implicit_include_line("${line}" "${lang}" implicit_dirs_tmp + linelog state) + if(linelog) + string(APPEND log ${linelog}) + endif() + if(state STREQUAL done) + break() + endif() + endif() + elseif(state STREQUAL loading) + string(FIND "${line}" "End of search list." rv) + if(rv GREATER -1) + set(state done) + string(APPEND log " end of search list found\n") + break() + else() + string(STRIP "${line}" path) # remove leading/trailing spaces + if ("${path}" MATCHES " \\(framework directory\\)$") + continue() # frameworks are handled elsewhere, ignore them here + endif() + string(REPLACE "\\" "/" path "${path}") + list(APPEND implicit_dirs_tmp "${path}") + string(APPEND log " add: [${path}]\n") + endif() + endif() + endforeach() + + # Log results. + if(state STREQUAL done) + string(APPEND log " implicit include dirs: [${implicit_dirs_tmp}]\n") + else() + string(APPEND log " warn: unable to parse implicit include dirs!\n") + endif() + + # Return results. + set(${dir_var} "${implicit_dirs_tmp}" PARENT_SCOPE) + set(${log_var} "${log}" PARENT_SCOPE) + set(${state_var} "${state}" PARENT_SCOPE) + +endfunction() diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index c8653b4..bf18efe 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -186,6 +186,7 @@ add_RunCMake_test(TargetPropertyGeneratorExpressions) add_RunCMake_test(Languages) add_RunCMake_test(LinkStatic) add_RunCMake_test(ObjectLibrary) +add_RunCMake_test(ParseImplicitIncludeInfo) if(UNIX AND CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG AND CMAKE_EXECUTABLE_FORMAT STREQUAL "ELF") add_RunCMake_test(RuntimePath) endif() diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/CMakeLists.txt b/Tests/RunCMake/ParseImplicitIncludeInfo/CMakeLists.txt new file mode 100644 index 0000000..2897109 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.0) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake b/Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake new file mode 100644 index 0000000..21d4df2 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake @@ -0,0 +1,95 @@ +cmake_minimum_required(VERSION 3.0) +project(Minimal NONE) + +# +# list of targets to test. to add a target: put its files in the data +# subdirectory and add it to this list... we run each target's +# data/*.input file through the parser and check to see if it matches +# the corresponding data/*.output file. note that the empty-* case +# has special handling (it should not parse). +# +set(targets + craype-C-Cray-8.7 craype-CXX-Cray-8.7 + craype-C-GNU-7.3.0 craype-CXX-GNU-7.3.0 + craype-C-Intel-18.0.2.20180210 craype-CXX-Intel-18.0.2.20180210 + darwin-C-AppleClang-8.0.0.8000042 darwin-CXX-AppleClang-8.0.0.8000042 + empty-C empty-CXX + freebsd-C-Clang-3.3.0 freebsd-CXX-Clang-3.3.0 + linux-C-GNU-7.3.0 linux-CXX-GNU-7.3.0 + linux-C-Intel-18.0.0.20170811 linux-CXX-Intel-18.0.0.20170811 + linux-CUDA-NVIDIA-9.2.148 + mingw.org-C-GNU-4.9.3 mingw.org-CXX-GNU-4.9.3 + netbsd-C-GNU-4.8.5 netbsd-CXX-GNU-4.8.5 + openbsd-C-Clang-5.0.1 openbsd-CXX-Clang-5.0.1 + #FIXME: The parser does not handle SunPro yet. + #sunos-C-SunPro-5.13.0 sunos-CXX-SunPro-5.13.0 + ) + +include(${CMAKE_ROOT}/Modules/CMakeParseImplicitIncludeInfo.cmake) + +# +# load_compiler_info: read infile, parsing out cmake compiler info +# variables as we go. returns language, a list of variables we set +# (so we can clear them later), and the remaining verbose output +# from the compiler. +# +function(load_compiler_info infile lang_var outcmvars_var outstr_var) + unset(lang) + unset(outcmvars) + unset(outstr) + file(READ "${infile}" in) + string(REGEX REPLACE "\r?\n" ";" in_lines "${in}") + foreach(line IN LISTS in_lines) + # check for special CMAKE variable lines and parse them if found + if("${line}" MATCHES "^CMAKE_([_A-Za-z0-9]+)=(.*)$") + if("${CMAKE_MATCH_1}" STREQUAL "LANG") # handle CMAKE_LANG here + set(lang "${CMAKE_MATCH_2}") + else() + set(CMAKE_${CMAKE_MATCH_1} "${CMAKE_MATCH_2}" PARENT_SCOPE) + list(APPEND outcmvars "CMAKE_${CMAKE_MATCH_1}") + endif() + else() + string(APPEND outstr "${line}\n") + endif() + endforeach() + if(NOT lang) + message("load_compiler_info: ${infile} no LANG info; default to C") + set(lang C) + endif() + set(${lang_var} "${lang}" PARENT_SCOPE) + set(${outcmvars_var} "${outcmvars}" PARENT_SCOPE) + set(${outstr_var} "${outstr}" PARENT_SCOPE) +endfunction() + +# +# unload_compiler_info: clear out any CMAKE_* vars load previously set +# +function(unload_compiler_info cmvars) + foreach(var IN LISTS cmvars) + unset("${var}" PARENT_SCOPE) + endforeach() +endfunction() + +# +# main test loop +# +foreach(t ${targets}) + set(infile "${CMAKE_SOURCE_DIR}/data/${t}.input") + set(outfile "${CMAKE_SOURCE_DIR}/data/${t}.output") + if (NOT EXISTS ${infile} OR NOT EXISTS ${outfile}) + message("missing files for target ${t} in ${CMAKE_SOURCE_DIR}/data") + continue() + endif() + load_compiler_info(${infile} lang cmvars input) + file(READ ${outfile} output) + string(STRIP "${output}" output) + cmake_parse_implicit_include_info("${input}" "${lang}" idirs log state) + if(t MATCHES "^empty-") # empty isn't supposed to parse + if("${state}" STREQUAL "done") + message("empty parse failed: ${idirs}, log=${log}") + endif() + elseif(NOT "${state}" STREQUAL "done" OR NOT "${output}" STREQUAL "${idirs}") + message("parse failed: state=${state}, ${output} != ${idirs}, log=${log}") + endif() + unload_compiler_info("${cmvars}") +endforeach(t) diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/RunCMakeTest.cmake b/Tests/RunCMake/ParseImplicitIncludeInfo/RunCMakeTest.cmake new file mode 100644 index 0000000..6266b50 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/RunCMakeTest.cmake @@ -0,0 +1,3 @@ +include(RunCMake) + +run_cmake(ParseImplicitIncludeInfo) diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/CMakeLists.txt b/Tests/RunCMake/ParseImplicitIncludeInfo/data/CMakeLists.txt new file mode 100644 index 0000000..fb4e57b --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/CMakeLists.txt @@ -0,0 +1,85 @@ +# +# helper CMakeLists.txt file that can be used to generate input files +# for the Tests/RunCMake/ParseImplicitIncludeInfo test. +# +# usage: +# [create a temporary build directory and chdir to it] +# cmake [-D options] $CMAKE_SRC/Tests/RunCMake/ParseImplicitIncludeInfo/data +# +# where useful -D options include: +# -DLANGUAGES="C;CXX" -- list of languages to generate inputs for +# -DUNAME="Darwin" -- operating system name (def: CMAKE_SYSTEM_NAME) +# + +cmake_minimum_required(VERSION 3.3) + +set(lngs C CXX) +set(LANGUAGES "${lngs}" CACHE STRING "List of languages to generate inputs for") + +project(gen_implicit_include_data ${LANGUAGES}) + +set(UNAME "${CMAKE_SYSTEM_NAME}" CACHE STRING "System uname") +string(TOLOWER "${UNAME}" UNAME) +message("Generate input for system type: ${UNAME}") + +# CMAKE__COMPILER_* variables we save in the resultfile +set(compvars ABI AR ARCHITECTURE_ID EXTERNAL_TOOLCHAIN ID LAUNCHER LOADED + RANLIB TARGET VERSION VERSION_INTERAL) + +foreach(lang IN ITEMS ${LANGUAGES}) + + if("${lang}" STREQUAL "C") + set(file ${CMAKE_ROOT}/Modules/CMakeCCompilerABI.c) + elseif("${lang}" STREQUAL "CXX") + set(file ${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp) + elseif("${lang}" STREQUAL "CUDA") + set(file ${CMAKE_ROOT}/Modules/CMakeCUDACompilerABI.cu) + else() + message(FATAL_ERROR "unknown language ${lang}") + endif() + + set(resultfile "${CMAKE_BINARY_DIR}/") + string(APPEND resultfile ${UNAME}-${lang}-${CMAKE_${lang}_COMPILER_ID}) + string(APPEND resultfile -${CMAKE_${lang}_COMPILER_VERSION}) + string(APPEND resultfile .input) + message("Generate input for language ${lang}") + message("Input file: ${file}") + message("Result file: ${resultfile}") + + # replicate logic from CMakeDetermineCompilerABI + set(outfile "${CMAKE_PLATFORM_INFO_DIR}/test${lang}.out") + set(CMAKE_FLAGS ) + set(COMPILE_DEFINITIONS ) + if(DEFINED CMAKE_${lang}_VERBOSE_FLAG) + set(CMAKE_FLAGS "-DEXE_LINKER_FLAGS=${CMAKE_${lang}_VERBOSE_FLAG}") + set(COMPILE_DEFINITIONS "${CMAKE_${lang}_VERBOSE_FLAG}") + endif() + if(DEFINED CMAKE_${lang}_VERBOSE_COMPILE_FLAG) + set(COMPILE_DEFINITIONS "${CMAKE_${lang}_VERBOSE_COMPILE_FLAG}") + endif() + if(NOT "x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xMSVC") + # Avoid adding our own platform standard libraries for compilers + # from which we might detect implicit link libraries. + list(APPEND CMAKE_FLAGS "-DCMAKE_${lang}_STANDARD_LIBRARIES=") + endif() + + try_compile(rv ${CMAKE_BINARY_DIR} ${file} + CMAKE_FLAGS ${CMAKE_FLAGS} + COMPILE_DEFINITIONS ${COMPILE_DEFINITIONS} + CMAKE_FLAGS ${CMAKE_FLAGS} + OUTPUT_VARIABLE output + COPY_FILE "${outfile}" + COPY_FILE_ERROR copy_error) + + if(NOT rv) + message(FATAL_ERROR "${lang} compile failed!!") + endif() + + set(result "CMAKE_LANG=${lang}\n") + foreach(var IN ITEMS ${compvars}) + list(APPEND result + "CMAKE_${lang}_COMPILER_${var}=${CMAKE_${lang}_COMPILER_${var}}\n") + endforeach() + + file(WRITE ${resultfile} ${result} ${output}) +endforeach() diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/README b/Tests/RunCMake/ParseImplicitIncludeInfo/data/README new file mode 100644 index 0000000..489c787 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/README @@ -0,0 +1,12 @@ +This directory contains sample input files for the implicit include +directories parser for testing. For each configuration there is one +".input" file and one ".output" file. + +To generate ".input" files for a system, create a temporary build +directory and chdir to it. Then run cmake pointing to this directory. +The CMakeLists.txt file here will generate ".input" files in your +build directory. + +The ".output" files should be generated by hand from the input files. +The test will compare the parser output to the manually generated +".output" file. The two should match. diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-C-Cray-8.7.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-C-Cray-8.7.input new file mode 100644 index 0000000..b3218a2 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-C-Cray-8.7.input @@ -0,0 +1,53 @@ +CMAKE_LANG=C +CMAKE_C_COMPILER_ABI=ELF +CMAKE_C_COMPILER_AR= +CMAKE_C_COMPILER_ARCHITECTURE_ID= +CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_C_COMPILER_ID=Cray +CMAKE_C_COMPILER_LAUNCHER= +CMAKE_C_COMPILER_LOADED=1 +CMAKE_C_COMPILER_RANLIB= +CMAKE_C_COMPILER_TARGET= +CMAKE_C_COMPILER_VERSION=8.7 +CMAKE_C_COMPILER_VERSION_INTERAL= +Change Dir: /tmp/ii/CMakeFiles/CMakeTmp + +Run Build Command:"/usr/bin/gmake" "cmTC_cb7b8/fast" +/usr/bin/gmake -f CMakeFiles/cmTC_cb7b8.dir/build.make CMakeFiles/cmTC_cb7b8.dir/build +gmake[1]: Entering directory '/tmp/ii/CMakeFiles/CMakeTmp' +Building C object CMakeFiles/cmTC_cb7b8.dir/CMakeCCompilerABI.c.o +/opt/cray/pe/craype/2.5.15/bin/cc -v -o CMakeFiles/cmTC_cb7b8.dir/CMakeCCompilerABI.c.o -c /usr/share/cmake/Modules/CMakeCCompilerABI.c +rm /tmp/pe_15430/CMakeCCompilerABI_1.s + +/opt/cray/pe/cce/8.7.4/cce/x86_64/bin/ccfe -hc -hcpu=haswell -D __CRAYXC -D __CRAY_HASWELL -D __CRAYXT_COMPUTE_LINUX_TARGET -hnetwork=aries -nostdinc -isystem /opt/cray/pe/cce/8.7.4/cce/x86_64/include/craylibs -isystem /opt/cray/pe/cce/8.7.4/cce/x86_64/include/basic -isystem /opt/gcc/6.1.0/snos/lib/gcc/x86_64-suse-linux/6.1.0/include -isystem /opt/gcc/6.1.0/snos/lib/gcc/x86_64-suse-linux/6.1.0/include-fixed -isystem /opt/gcc/6.1.0/snos/include -isystem /usr/include -I /opt/cray/pe/libsci/18.07.1/CRAY/8.6/x86_64/include -I /opt/cray/pe/mpt/7.7.3/gni/mpich-cray/8.6/include -I /opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include -I /opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include -I /opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include -I /opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include -I /opt/cray/dmapp/7.1.1-6.0.5.0_49.8__g1125556.ari/include -I /opt/cray/pe/pmi/5.0.14/include -I /opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include -I /opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include -I /opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include -I /opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include -I /opt/cray-hss-devel/8.0.0/include -D__PEDRVR_GCC_BASE_ACTIVE__ -hpl=/tmp/pe_15430//pldir -rx8503 -ru87000 -CZ /tmp/pe_15430/CMakeCCompilerABI.T -Cx -CX /tmp/pe_15430/CMakeCCompilerABI.xml -hdecompile=/tmp/ii/CMakeFiles/CMakeTmp/CMakeFiles/cmTC_cb7b8.dir/CMakeCCompilerABI. -S /tmp/pe_15430/CMakeCCompilerABI_1.s -hipa3 -ufile_id=1 /usr/share/cmake/Modules/CMakeCCompilerABI.c + +/opt/cray/pe/cce/8.7.4/cce/x86_64/bin/optcg /tmp/pe_15430//pldir 1 + +/opt/cray/pe/cce/8.7.4/binutils/x86_64/x86_64-pc-linux-gnu/bin/as -o CMakeFiles/cmTC_cb7b8.dir/CMakeCCompilerABI.c.o --64 /tmp/pe_15430/CMakeCCompilerABI_1.s +rm /tmp/pe_15430/CMakeCCompilerABI_1.s +rm /tmp/pe_15430//CMakeCCompilerABI_1.cif.Ttmp +rm /tmp/pe_15430//CMakeCCompilerABI.Tfe +rm /tmp/pe_15430//CMakeCCompilerABI.T +rm /tmp/pe_15430//CMakeCCompilerABI_1.xml.Ttmp +rm /tmp/pe_15430//pldir/PL_path +rm /tmp/pe_15430//pldir/iline_1 +rm /tmp/pe_15430//pldir/PL_module_list +rm /tmp/pe_15430//pldir/CMakeCCompilerABI_1.inl +rm /tmp/pe_15430//pldir/gline_1 +rm /tmp/pe_15430//pldir/PL_global_data +rmdir /tmp/pe_15430//pldir +rm /tmp/pe_15430//CMakeCCompilerABI.xml +rmdir /tmp/pe_15430/ +Linking C executable cmTC_cb7b8 +/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_cb7b8.dir/link.txt --verbose=1 +/opt/cray/pe/craype/2.5.15/bin/cc -v CMakeFiles/cmTC_cb7b8.dir/CMakeCCompilerABI.c.o -o cmTC_cb7b8 + +/opt/cray/pe/cce/8.7.4/binutils/x86_64/x86_64-pc-linux-gnu/bin/ld /usr/lib64//crt1.o /usr/lib64//crti.o /opt/gcc/6.1.0/snos/lib/gcc/x86_64-suse-linux/6.1.0//crtbeginT.o /opt/gcc/6.1.0/snos/lib/gcc/x86_64-suse-linux/6.1.0//crtfastmath.o /opt/cray/pe/cce/8.7.4/cce/x86_64/lib/no_mmap.o CMakeFiles/cmTC_cb7b8.dir/CMakeCCompilerABI.c.o -Bstatic -rpath=/opt/cray/pe/cce/8.7.4/cce/x86_64/lib -L /opt/gcc/6.1.0/snos/lib64 -rpath=/opt/cray/pe/gcc-libs -L /opt/cray/pe/libsci/18.07.1/CRAY/8.6/x86_64/lib -L /opt/cray/dmapp/default/lib64 -L /opt/cray/pe/mpt/7.7.3/gni/mpich-cray/8.6/lib -L /opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/lib64 -L /opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/lib64 -L /opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/lib64 -L /opt/cray/dmapp/7.1.1-6.0.5.0_49.8__g1125556.ari/lib64 -L /opt/cray/pe/pmi/5.0.14/lib64 -L /opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/lib64 -L /opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/lib64 -L /opt/cray/pe/atp/2.1.3/libApp -L /opt/cray/pe/cce/8.7.4/cce/x86_64/lib/pkgconfig/../ -L /opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/lib64 --no-as-needed -lAtpSigHandler -lAtpSigHCommData --undefined=_ATP_Data_Globals --undefined=__atpHandlerInstall -L /usr/lib64 -L /lib64 -rpath=/usr/lib64 -rpath=/lib64 -lpthread -lsci_cray_mpi_mp -lm -lf -lsci_cray_mp -lcraymp -lm -lpthread -lf -lhugetlbfs -lmpich_cray -lrt -lpthread -lugni -lpmi -lpgas-dmapp -lfi -lu -lrt --undefined=dmapp_get_flag_nbi -ldmapp -lugni -ludreg -lpthread -lm -lcray-c++-rts -lstdc++ -lxpmem -ldmapp -lpthread -lpmi -lpthread -lalpslli -lpthread -lwlm_detect -lugni -lpthread -lalpsutil -lpthread -lrca -ludreg -lquadmath -lm -lomp -lrt -lcraymp -lpthread -lrt -ldl -lcray-c++-rts -lstdc++ -lm -lmodules -lm -lrt -lfi -lm -lquadmath -lrt -lcraymath -lm -lgfortran -lquadmath -lrt -lf -lm -lpthread -lrt -lu -lrt -ldl -lcray-c++-rts -lstdc++ -lm -lcsup -lrt --as-needed -latomic --no-as-needed -lstdc++ -lpthread --start-group -lc -lcsup -lgcc_eh -lm -lgcc --end-group -T/opt/cray/pe/cce/8.7.4/cce/x86_64/lib/2.23.1.cce.ld -L /opt/gcc/6.1.0/snos/lib/gcc/x86_64-suse-linux/6.1.0 -L /opt/cray/pe/cce/8.7.4/binutils/x86_64/x86_64-pc-linux-gnu/..//x86_64-unknown-linux-gnu/lib -EL -o cmTC_cb7b8 --undefined=__pthread_initialize_minimal /opt/gcc/6.1.0/snos/lib/gcc/x86_64-suse-linux/6.1.0//crtend.o /usr/lib64//crtn.o + +/opt/cray/pe/cce/8.7.4/binutils/x86_64/bin/objcopy --remove-section=.note.ftn_module_data cmTC_cb7b8 +rm /tmp/pe_15450//pldir/PL_path +rm /tmp/pe_15450//pldir/PL_module_list +rm /tmp/pe_15450//pldir/PL_global_data +rmdir /tmp/pe_15450//pldir +rmdir /tmp/pe_15450/ +gmake[1]: Leaving directory '/tmp/ii/CMakeFiles/CMakeTmp' diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-C-Cray-8.7.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-C-Cray-8.7.output new file mode 100644 index 0000000..cbd2132 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-C-Cray-8.7.output @@ -0,0 +1 @@ +/opt/cray/pe/cce/8.7.4/cce/x86_64/include/craylibs;/opt/cray/pe/cce/8.7.4/cce/x86_64/include/basic;/opt/gcc/6.1.0/snos/lib/gcc/x86_64-suse-linux/6.1.0/include;/opt/gcc/6.1.0/snos/lib/gcc/x86_64-suse-linux/6.1.0/include-fixed;/opt/gcc/6.1.0/snos/include;/usr/include;/opt/cray/pe/libsci/18.07.1/CRAY/8.6/x86_64/include;/opt/cray/pe/mpt/7.7.3/gni/mpich-cray/8.6/include;/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include;/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include;/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include;/opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include;/opt/cray/dmapp/7.1.1-6.0.5.0_49.8__g1125556.ari/include;/opt/cray/pe/pmi/5.0.14/include;/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include;/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include;/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include;/opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include;/opt/cray-hss-devel/8.0.0/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-C-GNU-7.3.0.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-C-GNU-7.3.0.input new file mode 100644 index 0000000..2dc60af --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-C-GNU-7.3.0.input @@ -0,0 +1,79 @@ +CMAKE_LANG=C +CMAKE_C_COMPILER_ABI=ELF +CMAKE_C_COMPILER_AR= +CMAKE_C_COMPILER_ARCHITECTURE_ID= +CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_C_COMPILER_ID=GNU +CMAKE_C_COMPILER_LAUNCHER= +CMAKE_C_COMPILER_LOADED=1 +CMAKE_C_COMPILER_RANLIB= +CMAKE_C_COMPILER_TARGET= +CMAKE_C_COMPILER_VERSION=7.3.0 +CMAKE_C_COMPILER_VERSION_INTERAL= +Change Dir: /tmp/ii/CMakeFiles/CMakeTmp + +Run Build Command:"/usr/bin/gmake" "cmTC_61245/fast" +/usr/bin/gmake -f CMakeFiles/cmTC_61245.dir/build.make CMakeFiles/cmTC_61245.dir/build +gmake[1]: Entering directory '/tmp/ii/CMakeFiles/CMakeTmp' +Building C object CMakeFiles/cmTC_61245.dir/CMakeCCompilerABI.c.o +/opt/cray/pe/craype/2.5.15/bin/cc -v -o CMakeFiles/cmTC_61245.dir/CMakeCCompilerABI.c.o -c /usr/share/cmake/Modules/CMakeCCompilerABI.c +Using built-in specs. +COLLECT_GCC=/opt/gcc/7.3.0/bin/../snos/bin/gcc +Target: x86_64-suse-linux +Configured with: ../cray-gcc-7.3.0-201801270210.d61239fc6000b/configure --prefix=/opt/gcc/7.3.0/snos --disable-nls --libdir=/opt/gcc/7.3.0/snos/lib --enable-languages=c,c++,fortran --with-gxx-include-dir=/opt/gcc/7.3.0/snos/include/g++ --with-slibdir=/opt/gcc/7.3.0/snos/lib --with-system-zlib --enable-shared --enable-__cxa_atexit --build=x86_64-suse-linux --with-ppl --with-cloog --disable-multilib +Thread model: posix +gcc version 7.3.0 20180125 (Cray Inc.) (GCC) +COLLECT_GCC_OPTIONS='-march=core-avx2' '-static' '-D' '__CRAYXC' '-D' '__CRAY_HASWELL' '-D' '__CRAYXT_COMPUTE_LINUX_TARGET' '-u' 'pthread_mutex_destroy' '-D' '__TARGET_LINUX__' '-v' '-o' 'CMakeFiles/cmTC_61245.dir/CMakeCCompilerABI.c.o' '-c' '-I' '/opt/cray/pe/libsci/18.07.1/GNU/7.1/x86_64/include' '-I' '/opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/include' '-I' '/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include' '-I' '/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include' '-I' '/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include' '-I' '/opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include' '-I' '/opt/cray/pe/pmi/5.0.14/include' '-I' '/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include' '-I' '/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include' '-I' '/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include' '-I' '/opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include' '-I' '/opt/cray-hss-devel/8.0.0/include' + /opt/gcc/7.3.0/snos/libexec/gcc/x86_64-suse-linux/7.3.0/cc1 -quiet -v -I /opt/cray/pe/libsci/18.07.1/GNU/7.1/x86_64/include -I /opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/include -I /opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include -I /opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include -I /opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include -I /opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include -I /opt/cray/pe/pmi/5.0.14/include -I /opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include -I /opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include -I /opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include -I /opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include -I /opt/cray-hss-devel/8.0.0/include -D __CRAYXC -D __CRAY_HASWELL -D __CRAYXT_COMPUTE_LINUX_TARGET -D __TARGET_LINUX__ /usr/share/cmake/Modules/CMakeCCompilerABI.c -quiet -dumpbase CMakeCCompilerABI.c -march=core-avx2 -auxbase-strip CMakeFiles/cmTC_61245.dir/CMakeCCompilerABI.c.o -version -o /tmp/ccNvdQ8R.s +GNU C11 (GCC) version 7.3.0 20180125 (Cray Inc.) (x86_64-suse-linux) + compiled by GNU C version 7.3.0 20180125 (Cray Inc.), GMP version 6.0.0, MPFR version 3.1.3, MPC version 1.0.3, isl version isl-0.15-GMP + +GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 +ignoring nonexistent directory "/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/../../../../x86_64-suse-linux/include" +#include "..." search starts here: +#include <...> search starts here: + /opt/cray/pe/libsci/18.07.1/GNU/7.1/x86_64/include + /opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/include + /opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include + /opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include + /opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include + /opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include + /opt/cray/pe/pmi/5.0.14/include + /opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include + /opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include + /opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include + /opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include + /opt/cray-hss-devel/8.0.0/include + /opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/include + /usr/local/include + /opt/gcc/7.3.0/snos/include + /opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/include-fixed + /usr/include +End of search list. +GNU C11 (GCC) version 7.3.0 20180125 (Cray Inc.) (x86_64-suse-linux) + compiled by GNU C version 7.3.0 20180125 (Cray Inc.), GMP version 6.0.0, MPFR version 3.1.3, MPC version 1.0.3, isl version isl-0.15-GMP + +GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 +Compiler executable checksum: 4ecdcb30ed2f7ac4fb078d81fd42f086 +COLLECT_GCC_OPTIONS='-march=core-avx2' '-static' '-D' '__CRAYXC' '-D' '__CRAY_HASWELL' '-D' '__CRAYXT_COMPUTE_LINUX_TARGET' '-u' 'pthread_mutex_destroy' '-D' '__TARGET_LINUX__' '-v' '-o' 'CMakeFiles/cmTC_61245.dir/CMakeCCompilerABI.c.o' '-c' '-I' '/opt/cray/pe/libsci/18.07.1/GNU/7.1/x86_64/include' '-I' '/opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/include' '-I' '/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include' '-I' '/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include' '-I' '/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include' '-I' '/opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include' '-I' '/opt/cray/pe/pmi/5.0.14/include' '-I' '/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include' '-I' '/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include' '-I' '/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include' '-I' '/opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include' '-I' '/opt/cray-hss-devel/8.0.0/include' + as -v -I /opt/cray/pe/libsci/18.07.1/GNU/7.1/x86_64/include -I /opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/include -I /opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include -I /opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include -I /opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include -I /opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include -I /opt/cray/pe/pmi/5.0.14/include -I /opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include -I /opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include -I /opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include -I /opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include -I /opt/cray-hss-devel/8.0.0/include --64 -o CMakeFiles/cmTC_61245.dir/CMakeCCompilerABI.c.o /tmp/ccNvdQ8R.s +GNU assembler version 2.31.1 (x86_64-suse-linux) using BFD version (GNU Binutils SUSE Linux Enterprise 12) 2.31.1.20180828-9.26 +COMPILER_PATH=/opt/gcc/7.3.0/snos/libexec/gcc/x86_64-suse-linux/7.3.0/:/opt/gcc/7.3.0/snos/libexec/gcc/x86_64-suse-linux/7.3.0/:/opt/gcc/7.3.0/snos/libexec/gcc/x86_64-suse-linux/:/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/:/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/ +LIBRARY_PATH=/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/:/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/../../../:/lib/:/usr/lib/ +COLLECT_GCC_OPTIONS='-march=core-avx2' '-static' '-D' '__CRAYXC' '-D' '__CRAY_HASWELL' '-D' '__CRAYXT_COMPUTE_LINUX_TARGET' '-u' 'pthread_mutex_destroy' '-D' '__TARGET_LINUX__' '-v' '-o' 'CMakeFiles/cmTC_61245.dir/CMakeCCompilerABI.c.o' '-c' '-I' '/opt/cray/pe/libsci/18.07.1/GNU/7.1/x86_64/include' '-I' '/opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/include' '-I' '/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include' '-I' '/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include' '-I' '/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include' '-I' '/opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include' '-I' '/opt/cray/pe/pmi/5.0.14/include' '-I' '/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include' '-I' '/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include' '-I' '/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include' '-I' '/opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include' '-I' '/opt/cray-hss-devel/8.0.0/include' +Linking C executable cmTC_61245 +/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_61245.dir/link.txt --verbose=1 +/opt/cray/pe/craype/2.5.15/bin/cc -v CMakeFiles/cmTC_61245.dir/CMakeCCompilerABI.c.o -o cmTC_61245 +Using built-in specs. +COLLECT_GCC=/opt/gcc/7.3.0/bin/../snos/bin/gcc +COLLECT_LTO_WRAPPER=/opt/gcc/7.3.0/snos/libexec/gcc/x86_64-suse-linux/7.3.0/lto-wrapper +Target: x86_64-suse-linux +Configured with: ../cray-gcc-7.3.0-201801270210.d61239fc6000b/configure --prefix=/opt/gcc/7.3.0/snos --disable-nls --libdir=/opt/gcc/7.3.0/snos/lib --enable-languages=c,c++,fortran --with-gxx-include-dir=/opt/gcc/7.3.0/snos/include/g++ --with-slibdir=/opt/gcc/7.3.0/snos/lib --with-system-zlib --enable-shared --enable-__cxa_atexit --build=x86_64-suse-linux --with-ppl --with-cloog --disable-multilib +Thread model: posix +gcc version 7.3.0 20180125 (Cray Inc.) (GCC) +COMPILER_PATH=/opt/gcc/7.3.0/snos/libexec/gcc/x86_64-suse-linux/7.3.0/:/opt/gcc/7.3.0/snos/libexec/gcc/x86_64-suse-linux/7.3.0/:/opt/gcc/7.3.0/snos/libexec/gcc/x86_64-suse-linux/:/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/:/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/ +LIBRARY_PATH=/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/:/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/../../../:/lib/:/usr/lib/ +COLLECT_GCC_OPTIONS='-march=core-avx2' '-static' '-D' '__CRAYXC' '-D' '__CRAY_HASWELL' '-D' '__CRAYXT_COMPUTE_LINUX_TARGET' '-u' 'pthread_mutex_destroy' '-D' '__TARGET_LINUX__' '-v' '-o' 'cmTC_61245' '-I' '/opt/cray/pe/libsci/18.07.1/GNU/7.1/x86_64/include' '-I' '/opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/include' '-I' '/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include' '-I' '/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include' '-I' '/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include' '-I' '/opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include' '-I' '/opt/cray/pe/pmi/5.0.14/include' '-I' '/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include' '-I' '/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include' '-I' '/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include' '-I' '/opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include' '-I' '/opt/cray-hss-devel/8.0.0/include' '-L/opt/cray/pe/libsci/18.07.1/GNU/7.1/x86_64/lib' '-L/opt/cray/dmapp/default/lib64' '-L/opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/lib' '-L/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/lib64' '-L/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/lib64' '-L/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/lib64' '-L/opt/cray/pe/pmi/5.0.14/lib64' '-L/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/lib64' '-L/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/lib64' '-L/opt/cray/pe/atp/2.1.3/libApp' '-L/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/lib64' + /opt/gcc/7.3.0/snos/libexec/gcc/x86_64-suse-linux/7.3.0/collect2 -plugin /opt/gcc/7.3.0/snos/libexec/gcc/x86_64-suse-linux/7.3.0/liblto_plugin.so -plugin-opt=/opt/gcc/7.3.0/snos/libexec/gcc/x86_64-suse-linux/7.3.0/lto-wrapper -plugin-opt=-fresolution=/tmp/ccG3uxpY.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_eh -plugin-opt=-pass-through=-lc -m elf_x86_64 -static -o cmTC_61245 -u pthread_mutex_destroy /usr/lib/../lib64/crt1.o /usr/lib/../lib64/crti.o /opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/crtbeginT.o -L/opt/cray/pe/libsci/18.07.1/GNU/7.1/x86_64/lib -L/opt/cray/dmapp/default/lib64 -L/opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/lib -L/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/lib64 -L/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/lib64 -L/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/lib64 -L/opt/cray/pe/pmi/5.0.14/lib64 -L/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/lib64 -L/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/lib64 -L/opt/cray/pe/atp/2.1.3/libApp -L/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/lib64 -L/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0 -L/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/../../.. CMakeFiles/cmTC_61245.dir/CMakeCCompilerABI.c.o -rpath=/opt/cray/pe/gcc-libs --no-as-needed -lAtpSigHandler -lAtpSigHCommData --undefined=_ATP_Data_Globals --undefined=__atpHandlerInstall -lpthread -lsci_gnu_71_mpi -lsci_gnu_71 -lpthread -lhugetlbfs -lmpich_gnu_71 -lrt -lugni -lpthread -lpmi -lpthread -lalpslli -lpthread -lwlm_detect -lalpsutil -lpthread -lrca -lxpmem -lugni -lpthread -ludreg --as-needed -lgfortran -lquadmath --no-as-needed --as-needed -lmvec --no-as-needed --as-needed -lm --no-as-needed --as-needed -lpthread --no-as-needed --start-group -lgcc -lgcc_eh -lc --end-group /opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/crtend.o /usr/lib/../lib64/crtn.o +COLLECT_GCC_OPTIONS='-march=core-avx2' '-static' '-D' '__CRAYXC' '-D' '__CRAY_HASWELL' '-D' '__CRAYXT_COMPUTE_LINUX_TARGET' '-u' 'pthread_mutex_destroy' '-D' '__TARGET_LINUX__' '-v' '-o' 'cmTC_61245' '-I' '/opt/cray/pe/libsci/18.07.1/GNU/7.1/x86_64/include' '-I' '/opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/include' '-I' '/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include' '-I' '/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include' '-I' '/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include' '-I' '/opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include' '-I' '/opt/cray/pe/pmi/5.0.14/include' '-I' '/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include' '-I' '/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include' '-I' '/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include' '-I' '/opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include' '-I' '/opt/cray-hss-devel/8.0.0/include' '-L/opt/cray/pe/libsci/18.07.1/GNU/7.1/x86_64/lib' '-L/opt/cray/dmapp/default/lib64' '-L/opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/lib' '-L/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/lib64' '-L/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/lib64' '-L/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/lib64' '-L/opt/cray/pe/pmi/5.0.14/lib64' '-L/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/lib64' '-L/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/lib64' '-L/opt/cray/pe/atp/2.1.3/libApp' '-L/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/lib64' +gmake[1]: Leaving directory '/tmp/ii/CMakeFiles/CMakeTmp' diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-C-GNU-7.3.0.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-C-GNU-7.3.0.output new file mode 100644 index 0000000..64f127e --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-C-GNU-7.3.0.output @@ -0,0 +1 @@ +/opt/cray/pe/libsci/18.07.1/GNU/7.1/x86_64/include;/opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/include;/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include;/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include;/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include;/opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include;/opt/cray/pe/pmi/5.0.14/include;/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include;/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include;/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include;/opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include;/opt/cray-hss-devel/8.0.0/include;/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/include;/usr/local/include;/opt/gcc/7.3.0/snos/include;/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/include-fixed;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-C-Intel-18.0.2.20180210.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-C-Intel-18.0.2.20180210.input new file mode 100644 index 0000000..8c68e5b --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-C-Intel-18.0.2.20180210.input @@ -0,0 +1,40 @@ +CMAKE_LANG=C +CMAKE_C_COMPILER_ABI=ELF +CMAKE_C_COMPILER_AR= +CMAKE_C_COMPILER_ARCHITECTURE_ID= +CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_C_COMPILER_ID=Intel +CMAKE_C_COMPILER_LAUNCHER= +CMAKE_C_COMPILER_LOADED=1 +CMAKE_C_COMPILER_RANLIB= +CMAKE_C_COMPILER_TARGET= +CMAKE_C_COMPILER_VERSION=18.0.2.20180210 +CMAKE_C_COMPILER_VERSION_INTERAL= +Change Dir: /tmp/ii/CMakeFiles/CMakeTmp + +Run Build Command:"/usr/bin/gmake" "cmTC_96fde/fast" +/usr/bin/gmake -f CMakeFiles/cmTC_96fde.dir/build.make CMakeFiles/cmTC_96fde.dir/build +gmake[1]: Entering directory '/tmp/ii/CMakeFiles/CMakeTmp' +Building C object CMakeFiles/cmTC_96fde.dir/CMakeCCompilerABI.c.o +/opt/intel/2018.2.199/compilers_and_libraries_2018/linux/bin/intel64/icc -v -o CMakeFiles/cmTC_96fde.dir/CMakeCCompilerABI.c.o -c /usr/share/cmake/Modules/CMakeCCompilerABI.c +icc version 18.0.2 (gcc version 6.3.0 compatibility) +/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/bin/intel64/mcpcom --target_efi2 --lang=c -_g -mP3OPT_inline_alloca -D__ICC=1800 -D__INTEL_COMPILER=1800 -D__INTEL_COMPILER_UPDATE=2 -D__PTRDIFF_TYPE__=long "-D__SIZE_TYPE__=unsigned long" -D__WCHAR_TYPE__=int "-D__WINT_TYPE__=unsigned int" "-D__INTMAX_TYPE__=long int" "-D__UINTMAX_TYPE__=long unsigned int" -D__LONG_MAX__=9223372036854775807L -D__QMSPP_ -D__OPTIMIZE__ -D__NO_MATH_INLINES -D__NO_STRING_INLINES -D__GNUC_GNU_INLINE__ -D__GNUC__=6 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=0 -D__LP64__ -D_LP64 -D__GXX_ABI_VERSION=1010 "-D__USER_LABEL_PREFIX__= " -D__REGISTER_PREFIX__= -D__INTEL_RTTI__ -D__unix__ -D__unix -D__linux__ -D__linux -D__gnu_linux__ -B -Dunix -Dlinux "-_Asystem(unix)" -D__ELF__ -D__x86_64 -D__x86_64__ -D__amd64 -D__amd64__ "-_Acpu(x86_64)" "-_Amachine(x86_64)" -D__INTEL_COMPILER_BUILD_DATE=20180210 -D__INTEL_OFFLOAD -D__i686 -D__i686__ -D__pentiumpro -D__pentiumpro__ -D__pentium4 -D__pentium4__ -D__tune_pentium4__ -D__SSE2__ -D__SSE2_MATH__ -D__SSE__ -D__SSE_MATH__ -D__MMX__ -_k -_8 -_l --has_new_stdarg_support -_a -_b --gnu_version=60300 -_W5 --gcc-extern-inline --multibyte_chars -mGLOB_diag_suppress_sys --system_preinclude /usr/include/stdc-predef.h --array_section --simd --simd_func --offload_mode=1 --offload_target_names=gfx,GFX,mic,MIC --offload_unique_string=icc1641499230JViDRp -mGLOB_em64t=TRUE -mP1OPT_version=18.0-intel64 -mGLOB_diag_file=CMakeFiles/cmTC_96fde.dir/CMakeCCompilerABI.c.diag -mGLOB_long_size_64 -mGLOB_routine_pointer_size_64 -mP1OPT_print_version=FALSE -mCG_use_gas_got_workaround=F -mP2OPT_align_option_used=TRUE -mGLOB_gcc_version=630 "-mGLOB_options_string=-v -o CMakeFiles/cmTC_96fde.dir/CMakeCCompilerABI.c.o -c" -mGLOB_cxx_limited_range=FALSE -mCG_extend_parms=FALSE -mGLOB_compiler_bin_directory=/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/bin/intel64 -mGLOB_as_output_backup_file_name=/tmp/icc6TGEr2as_.s -mIPOPT_activate -mIPOPT_lite -mGLOB_instruction_tuning=0x0 -mGLOB_uarch_tuning=0x0 -mGLOB_product_id_code=0x22006d92 -mCG_bnl_movbe=T -mGLOB_extended_instructions=0x8 -mP3OPT_use_mspp_call_convention -mP2OPT_subs_out_of_bound=FALSE -mP2OPT_disam_type_based_disam=2 -mP2OPT_disam_assume_ansi_c -mP2OPT_checked_disam_ansi_alias=TRUE -mGLOB_ansi_alias -mPGOPTI_value_profile_use=T -mP2OPT_il0_array_sections=TRUE -mGLOB_offload_mode=1 -mP2OPT_offload_unique_var_string=icc1641499230JViDRp -mP2OPT_hlo_level=2 -mP2OPT_hlo -mP2OPT_hpo_rtt_control=0 -mIPOPT_args_in_regs=0 -mP2OPT_disam_assume_nonstd_intent_in=FALSE -mGLOB_imf_mapping_library=/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/bin/intel64/libiml_attr.so -mPGOPTI_gen_threadsafe_level=0 -mIPOPT_lto_object_enabled -mIPOPT_lto_object_value=1 -mIPOPT_obj_output_file_name=CMakeFiles/cmTC_96fde.dir/CMakeCCompilerABI.c.o -mIPOPT_whole_archive_fixup_file_name=/tmp/iccwarchM4gS0h -mGLOB_linker_version=2.31.1.20180828 -mGLOB_driver_tempfile_name=/tmp/icctempfileMGADNU -mP3OPT_asm_target=P3OPT_ASM_TARGET_GAS -mGLOB_async_unwind_tables=TRUE -mGLOB_obj_output_file=CMakeFiles/cmTC_96fde.dir/CMakeCCompilerABI.c.o -mGLOB_source_dialect=GLOB_SOURCE_DIALECT_C -mP1OPT_source_file_name=/usr/share/cmake/Modules/CMakeCCompilerABI.c -mP1OPT_full_source_file_name=/usr/share/cmake/Modules/CMakeCCompilerABI.c /usr/share/cmake/Modules/CMakeCCompilerABI.c +#include "..." search starts here: +#include <...> search starts here: + /opt/intel/2018.2.199/compilers_and_libraries_2018/linux/mkl/include + /opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/include/intel64 + /opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/include/icc + /opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/include + /usr/local/include + /opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/include + /opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/include-fixed + /opt/gcc/6.3.0/snos/include/ + /usr/include +End of search list. +Linking C executable cmTC_96fde +/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_96fde.dir/link.txt --verbose=1 +/opt/intel/2018.2.199/compilers_and_libraries_2018/linux/bin/intel64/icc -v CMakeFiles/cmTC_96fde.dir/CMakeCCompilerABI.c.o -o cmTC_96fde -rdynamic +icc version 18.0.2 (gcc version 6.3.0 compatibility) +/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/bin/intel64/mcpcom -mGLOB_em64t=TRUE -mP1OPT_version=18.0-intel64 -mGLOB_diag_file=CMakeFiles/cmTC_96fde.dir/CMakeCCompilerABI.c.diag -mGLOB_long_size_64 -mGLOB_routine_pointer_size_64 -mP1OPT_print_version=FALSE -mCG_use_gas_got_workaround=F -mP2OPT_align_option_used=TRUE -mGLOB_gcc_version=630 "-mGLOB_options_string=-v -o cmTC_96fde -rdynamic" -mGLOB_cxx_limited_range=FALSE -mCG_extend_parms=FALSE -mGLOB_compiler_bin_directory=/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/bin/intel64 -mGLOB_as_output_backup_file_name=/tmp/iccRJ58KYas_.s -mGLOB_dashboard_use_source_name -mIPOPT_activate -mGLOB_product_id_code=0x22006d92 -mP3OPT_use_mspp_call_convention -mP2OPT_subs_out_of_bound=FALSE -mP2OPT_disam_type_based_disam=2 -mP2OPT_disam_assume_ansi_c -mP2OPT_checked_disam_ansi_alias=TRUE -mGLOB_ansi_alias -mPGOPTI_value_profile_use=T -mGLOB_opt_report_use_source_name -mP2OPT_il0_array_sections=TRUE -mGLOB_offload_mode=1 -mP2OPT_offload_unique_var_string=icc0762718770pMrhfB -mP2OPT_hlo -mP2OPT_hpo_rtt_control=0 -mIPOPT_args_in_regs=0 -mP2OPT_disam_assume_nonstd_intent_in=FALSE -mGLOB_imf_mapping_library=/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/bin/intel64/libiml_attr.so -mPGOPTI_gen_threadsafe_level=0 -mIPOPT_link -mIPOPT_ipo_activate -mIPOPT_mo_activate -mIPOPT_source_files_list=/tmp/iccslisYmrmw5 -mIPOPT_mo_global_data -mIPOPT_link_script_file=/tmp/iccscript8Dy5AI "-mIPOPT_cmdline_link="/usr/lib/../lib64/crt1.o" "/usr/lib/../lib64/crti.o" "/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/crtbegin.o" "-export-dynamic" "--eh-frame-hdr" "--build-id" "-dynamic-linker" "/lib64/ld-linux-x86-64.so.2" "-m" "elf_x86_64" "-o" "cmTC_96fde" "-L/opt/intel/2018.2.199/compilers_and_libraries_2018/linux/mkl/lib/intel64" "-L/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/lib/intel64_lin" "-L/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/" "-L/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/../../../../lib64" "-L/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/../../../../lib64/" "-L/lib/../lib64" "-L/lib/../lib64/" "-L/usr/lib/../lib64" "-L/usr/lib/../lib64/" "-L/opt/intel/2018.2.199/compilers_and_libraries_2018/linux/mkl/lib/intel64/" "-L/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/../../../" "-L/lib64" "-L/lib/" "-L/usr/lib64" "-L/usr/lib" "CMakeFiles/cmTC_96fde.dir/CMakeCCompilerABI.c.o" "-Bdynamic" "-Bstatic" "-limf" "-lsvml" "-lirng" "-Bdynamic" "-lm" "-Bstatic" "-lipgo" "-ldecimal" "--as-needed" "-Bdynamic" "-lcilkrts" "-lstdc++" "--no-as-needed" "-lgcc" "-lgcc_s" "-Bstatic" "-lirc" "-lsvml" "-Bdynamic" "-lc" "-lgcc" "-lgcc_s" "-Bstatic" "-lirc_s" "-Bdynamic" "-ldl" "-lc" "/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/crtend.o" "/usr/lib/../lib64/crtn.o"" -mIPOPT_il_in_obj -mIPOPT_ipo_activate_warn=FALSE -mIPOPT_obj_output_file_name=/tmp/ipo_icclnz13i.o -mIPOPT_whole_archive_fixup_file_name=/tmp/iccwarch0d1B2R -mGLOB_linker_version=2.31.1.20180828 -mGLOB_driver_tempfile_name=/tmp/icctempfilelBn98u -mP3OPT_asm_target=P3OPT_ASM_TARGET_GAS -mGLOB_async_unwind_tables=TRUE -mGLOB_obj_output_file=/tmp/ipo_icclnz13i.o -mGLOB_source_dialect=GLOB_SOURCE_DIALECT_NONE -mP1OPT_source_file_name=ipo_out.c CMakeFiles/cmTC_96fde.dir/CMakeCCompilerABI.c.o -mIPOPT_object_files=T -mIPOPT_assembly_files=/tmp/iccalisA2xsdz -mIPOPT_generated_tempfiles=/tmp/iccelisbUgbic -mIPOPT_embedded_object_base_name=/tmp/icceobjEt9TmP -mIPOPT_cmdline_link_new_name=/tmp/iccllisYEcDrs +ld /usr/lib/../lib64/crt1.o /usr/lib/../lib64/crti.o /opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/crtbegin.o -export-dynamic --eh-frame-hdr --build-id -dynamic-linker /lib64/ld-linux-x86-64.so.2 -m elf_x86_64 -o cmTC_96fde -L/opt/intel/2018.2.199/compilers_and_libraries_2018/linux/mkl/lib/intel64 -L/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/lib/intel64_lin -L/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/ -L/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/../../../../lib64 -L/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/../../../../lib64/ -L/lib/../lib64 -L/lib/../lib64/ -L/usr/lib/../lib64 -L/usr/lib/../lib64/ -L/opt/intel/2018.2.199/compilers_and_libraries_2018/linux/mkl/lib/intel64/ -L/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/../../../ -L/lib64 -L/lib/ -L/usr/lib64 -L/usr/lib CMakeFiles/cmTC_96fde.dir/CMakeCCompilerABI.c.o -Bdynamic -Bstatic -limf -lsvml -lirng -Bdynamic -lm -Bstatic -lipgo -ldecimal --as-needed -Bdynamic -lcilkrts -lstdc++ --no-as-needed -lgcc -lgcc_s -Bstatic -lirc -lsvml -Bdynamic -lc -lgcc -lgcc_s -Bstatic -lirc_s -Bdynamic -ldl -lc /opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/crtend.o /usr/lib/../lib64/crtn.o +gmake[1]: Leaving directory '/tmp/ii/CMakeFiles/CMakeTmp' diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-C-Intel-18.0.2.20180210.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-C-Intel-18.0.2.20180210.output new file mode 100644 index 0000000..f0989ca --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-C-Intel-18.0.2.20180210.output @@ -0,0 +1 @@ +/opt/intel/2018.2.199/compilers_and_libraries_2018/linux/mkl/include;/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/include/intel64;/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/include/icc;/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/include;/usr/local/include;/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/include;/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/include-fixed;/opt/gcc/6.3.0/snos/include/;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-Cray-8.7.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-Cray-8.7.input new file mode 100644 index 0000000..73c9c8a --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-Cray-8.7.input @@ -0,0 +1,53 @@ +CMAKE_LANG=CXX +CMAKE_CXX_COMPILER_ABI=ELF +CMAKE_CXX_COMPILER_AR= +CMAKE_CXX_COMPILER_ARCHITECTURE_ID= +CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_CXX_COMPILER_ID=Cray +CMAKE_CXX_COMPILER_LAUNCHER= +CMAKE_CXX_COMPILER_LOADED=1 +CMAKE_CXX_COMPILER_RANLIB= +CMAKE_CXX_COMPILER_TARGET= +CMAKE_CXX_COMPILER_VERSION=8.7 +CMAKE_CXX_COMPILER_VERSION_INTERAL= +Change Dir: /tmp/ii/CMakeFiles/CMakeTmp + +Run Build Command:"/usr/bin/gmake" "cmTC_f3b1f/fast" +/usr/bin/gmake -f CMakeFiles/cmTC_f3b1f.dir/build.make CMakeFiles/cmTC_f3b1f.dir/build +gmake[1]: Entering directory '/tmp/ii/CMakeFiles/CMakeTmp' +Building CXX object CMakeFiles/cmTC_f3b1f.dir/CMakeCXXCompilerABI.cpp.o +/opt/cray/pe/craype/2.5.15/bin/CC -v -o CMakeFiles/cmTC_f3b1f.dir/CMakeCXXCompilerABI.cpp.o -c /usr/share/cmake/Modules/CMakeCXXCompilerABI.cpp +rm /tmp/pe_15530/CMakeCXXCompilerABI_1.s + +/opt/cray/pe/cce/8.7.4/cce/x86_64/bin/ccfe -hcpu=haswell -D __CRAYXC -D __CRAY_HASWELL -D __CRAYXT_COMPUTE_LINUX_TARGET -hnetwork=aries -nostdinc -isystem /opt/cray/pe/cce/8.7.4/cce/x86_64/include/craylibs -isystem /opt/gcc/6.1.0/snos/include/g++ -isystem /opt/gcc/6.1.0/snos/include/g++/x86_64-suse-linux -isystem /opt/gcc/6.1.0/snos/include/g++/backward -isystem /opt/gcc/6.1.0/snos/lib/gcc/x86_64-suse-linux/6.1.0/include -isystem /opt/gcc/6.1.0/snos/lib/gcc/x86_64-suse-linux/6.1.0/include-fixed -isystem /opt/cray/pe/cce/8.7.4/cce/x86_64/include/c++ -isystem /opt/cray/pe/cce/8.7.4/cce/x86_64/include/basic -isystem /opt/gcc/6.1.0/snos/include -isystem /usr/include -I /opt/cray/pe/libsci/18.07.1/CRAY/8.6/x86_64/include -I /opt/cray/pe/mpt/7.7.3/gni/mpich-cray/8.6/include -I /opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include -I /opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include -I /opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include -I /opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include -I /opt/cray/dmapp/7.1.1-6.0.5.0_49.8__g1125556.ari/include -I /opt/cray/pe/pmi/5.0.14/include -I /opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include -I /opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include -I /opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include -I /opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include -I /opt/cray-hss-devel/8.0.0/include -D__PEDRVR_GCC_BASE_ACTIVE__ -hpl=/tmp/pe_15530//pldir -rx8503 -ru87000 -hipafrom=/opt/cray/pe/cce/8.7.4/cce/x86_64/lib/libcray-c++-rts.a -CZ /tmp/pe_15530/CMakeCXXCompilerABI.T -Cx -CX /tmp/pe_15530/CMakeCXXCompilerABI.xml -hdecompile=/tmp/ii/CMakeFiles/CMakeTmp/CMakeFiles/cmTC_f3b1f.dir/CMakeCXXCompilerABI. -S /tmp/pe_15530/CMakeCXXCompilerABI_1.s -hipa4 -ufile_id=1 /usr/share/cmake/Modules/CMakeCXXCompilerABI.cpp + +/opt/cray/pe/cce/8.7.4/cce/x86_64/bin/optcg /tmp/pe_15530//pldir 1 + +/opt/cray/pe/cce/8.7.4/binutils/x86_64/x86_64-pc-linux-gnu/bin/as -o CMakeFiles/cmTC_f3b1f.dir/CMakeCXXCompilerABI.cpp.o --64 /tmp/pe_15530/CMakeCXXCompilerABI_1.s +rm /tmp/pe_15530/CMakeCXXCompilerABI_1.s +rm /tmp/pe_15530//CMakeCXXCompilerABI.xml +rm /tmp/pe_15530//CMakeCXXCompilerABI_1.cif.Ttmp +rm /tmp/pe_15530//CMakeCXXCompilerABI.T +rm /tmp/pe_15530//pldir/PL_path +rm /tmp/pe_15530//pldir/CMakeCXXCompilerABI_1.inl +rm /tmp/pe_15530//pldir/iline_1 +rm /tmp/pe_15530//pldir/PL_module_list +rm /tmp/pe_15530//pldir/gline_1 +rm /tmp/pe_15530//pldir/PL_global_data +rmdir /tmp/pe_15530//pldir +rm /tmp/pe_15530//CMakeCXXCompilerABI.Tfe +rm /tmp/pe_15530//CMakeCXXCompilerABI_1.xml.Ttmp +rmdir /tmp/pe_15530/ +Linking CXX executable cmTC_f3b1f +/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_f3b1f.dir/link.txt --verbose=1 +/opt/cray/pe/craype/2.5.15/bin/CC -v CMakeFiles/cmTC_f3b1f.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_f3b1f + +/opt/cray/pe/cce/8.7.4/binutils/x86_64/x86_64-pc-linux-gnu/bin/ld /usr/lib64//crt1.o /usr/lib64//crti.o /opt/gcc/6.1.0/snos/lib/gcc/x86_64-suse-linux/6.1.0//crtbeginT.o /opt/gcc/6.1.0/snos/lib/gcc/x86_64-suse-linux/6.1.0//crtfastmath.o /opt/cray/pe/cce/8.7.4/cce/x86_64/lib/no_mmap.o CMakeFiles/cmTC_f3b1f.dir/CMakeCXXCompilerABI.cpp.o -Bstatic -rpath=/opt/cray/pe/cce/8.7.4/cce/x86_64/lib -L /opt/gcc/6.1.0/snos/lib64 -rpath=/opt/cray/pe/gcc-libs -L /opt/cray/pe/libsci/18.07.1/CRAY/8.6/x86_64/lib -L /opt/cray/dmapp/default/lib64 -L /opt/cray/pe/mpt/7.7.3/gni/mpich-cray/8.6/lib -L /opt/cray/dmapp/default/lib64 -L /opt/cray/pe/mpt/7.7.3/gni/mpich-cray/8.6/lib -L /opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/lib64 -L /opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/lib64 -L /opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/lib64 -L /opt/cray/dmapp/7.1.1-6.0.5.0_49.8__g1125556.ari/lib64 -L /opt/cray/pe/pmi/5.0.14/lib64 -L /opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/lib64 -L /opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/lib64 -L /opt/cray/pe/atp/2.1.3/libApp -L /opt/cray/pe/cce/8.7.4/cce/x86_64/lib/pkgconfig/../ -L /opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/lib64 --no-as-needed -lAtpSigHandler -lAtpSigHCommData --undefined=_ATP_Data_Globals --undefined=__atpHandlerInstall -L /usr/lib64 -L /lib64 -rpath=/usr/lib64 -rpath=/lib64 -lpthread -lsci_cray_mpi_mp -lm -lf -lsci_cray_mp -lcraymp -lm -lpthread -lf -lhugetlbfs -lmpichcxx_cray -lrt -lpthread -lugni -lpmi -lmpich_cray -lrt -lpthread -lugni -lpmi -lpgas-dmapp -lfi -lu -lrt --undefined=dmapp_get_flag_nbi -ldmapp -lugni -ludreg -lpthread -lm -lcray-c++-rts -lstdc++ -lxpmem -ldmapp -lpthread -lpmi -lpthread -lalpslli -lpthread -lwlm_detect -lugni -lpthread -lalpsutil -lpthread -lrca -ludreg -lquadmath -lm -lomp -lrt -lcraymp -lpthread -lrt -ldl -lcray-c++-rts -lstdc++ -lm -lmodules -lm -lrt -lfi -lm -lquadmath -lrt -lcraymath -lm -lgfortran -lquadmath -lrt -lf -lm -lpthread -lrt -lu -lrt -ldl -lcray-c++-rts -lstdc++ -lm -lcsup -lrt --as-needed -latomic --no-as-needed -lcray-c++-rts -lstdc++ -lsupc++ -lstdc++ -lpthread --start-group -lc -lcsup -lgcc_eh -lm -lgcc --end-group -T/opt/cray/pe/cce/8.7.4/cce/x86_64/lib/2.23.1.cce.ld -L /opt/gcc/6.1.0/snos/lib/gcc/x86_64-suse-linux/6.1.0 -L /opt/cray/pe/cce/8.7.4/binutils/x86_64/x86_64-pc-linux-gnu/..//x86_64-unknown-linux-gnu/lib -EL -o cmTC_f3b1f --undefined=__pthread_initialize_minimal /opt/gcc/6.1.0/snos/lib/gcc/x86_64-suse-linux/6.1.0//crtend.o /usr/lib64//crtn.o + +/opt/cray/pe/cce/8.7.4/binutils/x86_64/bin/objcopy --remove-section=.note.ftn_module_data cmTC_f3b1f +rm /tmp/pe_15566//pldir/PL_path +rm /tmp/pe_15566//pldir/PL_module_list +rm /tmp/pe_15566//pldir/PL_global_data +rmdir /tmp/pe_15566//pldir +rmdir /tmp/pe_15566/ +gmake[1]: Leaving directory '/tmp/ii/CMakeFiles/CMakeTmp' diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-Cray-8.7.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-Cray-8.7.output new file mode 100644 index 0000000..259c42a --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-Cray-8.7.output @@ -0,0 +1 @@ +/opt/cray/pe/cce/8.7.4/cce/x86_64/include/craylibs;/opt/gcc/6.1.0/snos/include/g++;/opt/gcc/6.1.0/snos/include/g++/x86_64-suse-linux;/opt/gcc/6.1.0/snos/include/g++/backward;/opt/gcc/6.1.0/snos/lib/gcc/x86_64-suse-linux/6.1.0/include;/opt/gcc/6.1.0/snos/lib/gcc/x86_64-suse-linux/6.1.0/include-fixed;/opt/cray/pe/cce/8.7.4/cce/x86_64/include/c++;/opt/cray/pe/cce/8.7.4/cce/x86_64/include/basic;/opt/gcc/6.1.0/snos/include;/usr/include;/opt/cray/pe/libsci/18.07.1/CRAY/8.6/x86_64/include;/opt/cray/pe/mpt/7.7.3/gni/mpich-cray/8.6/include;/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include;/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include;/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include;/opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include;/opt/cray/dmapp/7.1.1-6.0.5.0_49.8__g1125556.ari/include;/opt/cray/pe/pmi/5.0.14/include;/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include;/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include;/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include;/opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include;/opt/cray-hss-devel/8.0.0/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-GNU-7.3.0.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-GNU-7.3.0.input new file mode 100644 index 0000000..50f2859 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-GNU-7.3.0.input @@ -0,0 +1,82 @@ +CMAKE_LANG=CXX +CMAKE_CXX_COMPILER_ABI=ELF +CMAKE_CXX_COMPILER_AR= +CMAKE_CXX_COMPILER_ARCHITECTURE_ID= +CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_CXX_COMPILER_ID=GNU +CMAKE_CXX_COMPILER_LAUNCHER= +CMAKE_CXX_COMPILER_LOADED=1 +CMAKE_CXX_COMPILER_RANLIB= +CMAKE_CXX_COMPILER_TARGET= +CMAKE_CXX_COMPILER_VERSION=7.3.0 +CMAKE_CXX_COMPILER_VERSION_INTERAL= +Change Dir: /tmp/ii/CMakeFiles/CMakeTmp + +Run Build Command:"/usr/bin/gmake" "cmTC_66e70/fast" +/usr/bin/gmake -f CMakeFiles/cmTC_66e70.dir/build.make CMakeFiles/cmTC_66e70.dir/build +gmake[1]: Entering directory '/tmp/ii/CMakeFiles/CMakeTmp' +Building CXX object CMakeFiles/cmTC_66e70.dir/CMakeCXXCompilerABI.cpp.o +/opt/cray/pe/craype/2.5.15/bin/CC -v -o CMakeFiles/cmTC_66e70.dir/CMakeCXXCompilerABI.cpp.o -c /usr/share/cmake/Modules/CMakeCXXCompilerABI.cpp +Using built-in specs. +COLLECT_GCC=/opt/gcc/7.3.0/bin/../snos/bin/g++ +Target: x86_64-suse-linux +Configured with: ../cray-gcc-7.3.0-201801270210.d61239fc6000b/configure --prefix=/opt/gcc/7.3.0/snos --disable-nls --libdir=/opt/gcc/7.3.0/snos/lib --enable-languages=c,c++,fortran --with-gxx-include-dir=/opt/gcc/7.3.0/snos/include/g++ --with-slibdir=/opt/gcc/7.3.0/snos/lib --with-system-zlib --enable-shared --enable-__cxa_atexit --build=x86_64-suse-linux --with-ppl --with-cloog --disable-multilib +Thread model: posix +gcc version 7.3.0 20180125 (Cray Inc.) (GCC) +COLLECT_GCC_OPTIONS='-march=core-avx2' '-static' '-D' '__CRAYXC' '-D' '__CRAY_HASWELL' '-D' '__CRAYXT_COMPUTE_LINUX_TARGET' '-u' 'pthread_mutex_destroy' '-D' '__TARGET_LINUX__' '-v' '-o' 'CMakeFiles/cmTC_66e70.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-I' '/opt/cray/pe/libsci/18.07.1/GNU/7.1/x86_64/include' '-I' '/opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/include' '-I' '/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include' '-I' '/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include' '-I' '/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include' '-I' '/opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include' '-I' '/opt/cray/pe/pmi/5.0.14/include' '-I' '/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include' '-I' '/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include' '-I' '/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include' '-I' '/opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include' '-I' '/opt/cray-hss-devel/8.0.0/include' + /opt/gcc/7.3.0/snos/libexec/gcc/x86_64-suse-linux/7.3.0/cc1plus -quiet -v -I /opt/cray/pe/libsci/18.07.1/GNU/7.1/x86_64/include -I /opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/include -I /opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include -I /opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include -I /opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include -I /opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include -I /opt/cray/pe/pmi/5.0.14/include -I /opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include -I /opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include -I /opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include -I /opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include -I /opt/cray-hss-devel/8.0.0/include -D_GNU_SOURCE -D __CRAYXC -D __CRAY_HASWELL -D __CRAYXT_COMPUTE_LINUX_TARGET -D __TARGET_LINUX__ /usr/share/cmake/Modules/CMakeCXXCompilerABI.cpp -quiet -dumpbase CMakeCXXCompilerABI.cpp -march=core-avx2 -auxbase-strip CMakeFiles/cmTC_66e70.dir/CMakeCXXCompilerABI.cpp.o -version -o /tmp/ccH9m9Qh.s +GNU C++14 (GCC) version 7.3.0 20180125 (Cray Inc.) (x86_64-suse-linux) + compiled by GNU C version 7.3.0 20180125 (Cray Inc.), GMP version 6.0.0, MPFR version 3.1.3, MPC version 1.0.3, isl version isl-0.15-GMP + +GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 +ignoring nonexistent directory "/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/../../../../x86_64-suse-linux/include" +#include "..." search starts here: +#include <...> search starts here: + /opt/cray/pe/libsci/18.07.1/GNU/7.1/x86_64/include + /opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/include + /opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include + /opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include + /opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include + /opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include + /opt/cray/pe/pmi/5.0.14/include + /opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include + /opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include + /opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include + /opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include + /opt/cray-hss-devel/8.0.0/include + /opt/gcc/7.3.0/snos/include/g++ + /opt/gcc/7.3.0/snos/include/g++/x86_64-suse-linux + /opt/gcc/7.3.0/snos/include/g++/backward + /opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/include + /usr/local/include + /opt/gcc/7.3.0/snos/include + /opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/include-fixed + /usr/include +End of search list. +GNU C++14 (GCC) version 7.3.0 20180125 (Cray Inc.) (x86_64-suse-linux) + compiled by GNU C version 7.3.0 20180125 (Cray Inc.), GMP version 6.0.0, MPFR version 3.1.3, MPC version 1.0.3, isl version isl-0.15-GMP + +GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 +Compiler executable checksum: f544672a0be6a74646c0fce634253d7e +COLLECT_GCC_OPTIONS='-march=core-avx2' '-static' '-D' '__CRAYXC' '-D' '__CRAY_HASWELL' '-D' '__CRAYXT_COMPUTE_LINUX_TARGET' '-u' 'pthread_mutex_destroy' '-D' '__TARGET_LINUX__' '-v' '-o' 'CMakeFiles/cmTC_66e70.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-I' '/opt/cray/pe/libsci/18.07.1/GNU/7.1/x86_64/include' '-I' '/opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/include' '-I' '/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include' '-I' '/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include' '-I' '/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include' '-I' '/opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include' '-I' '/opt/cray/pe/pmi/5.0.14/include' '-I' '/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include' '-I' '/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include' '-I' '/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include' '-I' '/opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include' '-I' '/opt/cray-hss-devel/8.0.0/include' + as -v -I /opt/cray/pe/libsci/18.07.1/GNU/7.1/x86_64/include -I /opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/include -I /opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include -I /opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include -I /opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include -I /opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include -I /opt/cray/pe/pmi/5.0.14/include -I /opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include -I /opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include -I /opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include -I /opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include -I /opt/cray-hss-devel/8.0.0/include --64 -o CMakeFiles/cmTC_66e70.dir/CMakeCXXCompilerABI.cpp.o /tmp/ccH9m9Qh.s +GNU assembler version 2.31.1 (x86_64-suse-linux) using BFD version (GNU Binutils SUSE Linux Enterprise 12) 2.31.1.20180828-9.26 +COMPILER_PATH=/opt/gcc/7.3.0/snos/libexec/gcc/x86_64-suse-linux/7.3.0/:/opt/gcc/7.3.0/snos/libexec/gcc/x86_64-suse-linux/7.3.0/:/opt/gcc/7.3.0/snos/libexec/gcc/x86_64-suse-linux/:/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/:/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/ +LIBRARY_PATH=/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/:/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/../../../:/lib/:/usr/lib/ +COLLECT_GCC_OPTIONS='-march=core-avx2' '-static' '-D' '__CRAYXC' '-D' '__CRAY_HASWELL' '-D' '__CRAYXT_COMPUTE_LINUX_TARGET' '-u' 'pthread_mutex_destroy' '-D' '__TARGET_LINUX__' '-v' '-o' 'CMakeFiles/cmTC_66e70.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-I' '/opt/cray/pe/libsci/18.07.1/GNU/7.1/x86_64/include' '-I' '/opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/include' '-I' '/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include' '-I' '/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include' '-I' '/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include' '-I' '/opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include' '-I' '/opt/cray/pe/pmi/5.0.14/include' '-I' '/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include' '-I' '/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include' '-I' '/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include' '-I' '/opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include' '-I' '/opt/cray-hss-devel/8.0.0/include' +Linking CXX executable cmTC_66e70 +/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_66e70.dir/link.txt --verbose=1 +/opt/cray/pe/craype/2.5.15/bin/CC -v CMakeFiles/cmTC_66e70.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_66e70 +Using built-in specs. +COLLECT_GCC=/opt/gcc/7.3.0/bin/../snos/bin/g++ +COLLECT_LTO_WRAPPER=/opt/gcc/7.3.0/snos/libexec/gcc/x86_64-suse-linux/7.3.0/lto-wrapper +Target: x86_64-suse-linux +Configured with: ../cray-gcc-7.3.0-201801270210.d61239fc6000b/configure --prefix=/opt/gcc/7.3.0/snos --disable-nls --libdir=/opt/gcc/7.3.0/snos/lib --enable-languages=c,c++,fortran --with-gxx-include-dir=/opt/gcc/7.3.0/snos/include/g++ --with-slibdir=/opt/gcc/7.3.0/snos/lib --with-system-zlib --enable-shared --enable-__cxa_atexit --build=x86_64-suse-linux --with-ppl --with-cloog --disable-multilib +Thread model: posix +gcc version 7.3.0 20180125 (Cray Inc.) (GCC) +COMPILER_PATH=/opt/gcc/7.3.0/snos/libexec/gcc/x86_64-suse-linux/7.3.0/:/opt/gcc/7.3.0/snos/libexec/gcc/x86_64-suse-linux/7.3.0/:/opt/gcc/7.3.0/snos/libexec/gcc/x86_64-suse-linux/:/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/:/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/ +LIBRARY_PATH=/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/:/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/../../../:/lib/:/usr/lib/ +COLLECT_GCC_OPTIONS='-march=core-avx2' '-static' '-D' '__CRAYXC' '-D' '__CRAY_HASWELL' '-D' '__CRAYXT_COMPUTE_LINUX_TARGET' '-u' 'pthread_mutex_destroy' '-D' '__TARGET_LINUX__' '-v' '-o' 'cmTC_66e70' '-I' '/opt/cray/pe/libsci/18.07.1/GNU/7.1/x86_64/include' '-I' '/opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/include' '-I' '/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include' '-I' '/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include' '-I' '/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include' '-I' '/opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include' '-I' '/opt/cray/pe/pmi/5.0.14/include' '-I' '/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include' '-I' '/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include' '-I' '/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include' '-I' '/opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include' '-I' '/opt/cray-hss-devel/8.0.0/include' '-L/opt/cray/pe/libsci/18.07.1/GNU/7.1/x86_64/lib' '-L/opt/cray/dmapp/default/lib64' '-L/opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/lib' '-L/opt/cray/dmapp/default/lib64' '-L/opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/lib' '-L/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/lib64' '-L/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/lib64' '-L/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/lib64' '-L/opt/cray/pe/pmi/5.0.14/lib64' '-L/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/lib64' '-L/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/lib64' '-L/opt/cray/pe/atp/2.1.3/libApp' '-L/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/lib64' + /opt/gcc/7.3.0/snos/libexec/gcc/x86_64-suse-linux/7.3.0/collect2 -plugin /opt/gcc/7.3.0/snos/libexec/gcc/x86_64-suse-linux/7.3.0/liblto_plugin.so -plugin-opt=/opt/gcc/7.3.0/snos/libexec/gcc/x86_64-suse-linux/7.3.0/lto-wrapper -plugin-opt=-fresolution=/tmp/ccPBC8Um.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_eh -plugin-opt=-pass-through=-lc -m elf_x86_64 -static -o cmTC_66e70 -u pthread_mutex_destroy /usr/lib/../lib64/crt1.o /usr/lib/../lib64/crti.o /opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/crtbeginT.o -L/opt/cray/pe/libsci/18.07.1/GNU/7.1/x86_64/lib -L/opt/cray/dmapp/default/lib64 -L/opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/lib -L/opt/cray/dmapp/default/lib64 -L/opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/lib -L/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/lib64 -L/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/lib64 -L/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/lib64 -L/opt/cray/pe/pmi/5.0.14/lib64 -L/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/lib64 -L/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/lib64 -L/opt/cray/pe/atp/2.1.3/libApp -L/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/lib64 -L/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0 -L/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/../../.. CMakeFiles/cmTC_66e70.dir/CMakeCXXCompilerABI.cpp.o -rpath=/opt/cray/pe/gcc-libs --no-as-needed -lAtpSigHandler -lAtpSigHCommData --undefined=_ATP_Data_Globals --undefined=__atpHandlerInstall -lpthread -lsci_gnu_71_mpi -lsci_gnu_71 -lpthread -lhugetlbfs -lmpichcxx_gnu_71 -lrt -lugni -lpthread -lpmi -lmpich_gnu_71 -lrt -lugni -lpthread -lpmi -lpthread -lalpslli -lpthread -lwlm_detect -lalpsutil -lpthread -lrca -lugni -lpthread -lxpmem -ludreg --as-needed -lgfortran -lquadmath --no-as-needed --as-needed -lmvec --no-as-needed --as-needed -lm --no-as-needed --as-needed -lpthread --no-as-needed -lstdc++ -lm --start-group -lgcc -lgcc_eh -lc --end-group /opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/crtend.o /usr/lib/../lib64/crtn.o +COLLECT_GCC_OPTIONS='-march=core-avx2' '-static' '-D' '__CRAYXC' '-D' '__CRAY_HASWELL' '-D' '__CRAYXT_COMPUTE_LINUX_TARGET' '-u' 'pthread_mutex_destroy' '-D' '__TARGET_LINUX__' '-v' '-o' 'cmTC_66e70' '-I' '/opt/cray/pe/libsci/18.07.1/GNU/7.1/x86_64/include' '-I' '/opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/include' '-I' '/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include' '-I' '/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include' '-I' '/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include' '-I' '/opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include' '-I' '/opt/cray/pe/pmi/5.0.14/include' '-I' '/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include' '-I' '/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include' '-I' '/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include' '-I' '/opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include' '-I' '/opt/cray-hss-devel/8.0.0/include' '-L/opt/cray/pe/libsci/18.07.1/GNU/7.1/x86_64/lib' '-L/opt/cray/dmapp/default/lib64' '-L/opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/lib' '-L/opt/cray/dmapp/default/lib64' '-L/opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/lib' '-L/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/lib64' '-L/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/lib64' '-L/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/lib64' '-L/opt/cray/pe/pmi/5.0.14/lib64' '-L/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/lib64' '-L/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/lib64' '-L/opt/cray/pe/atp/2.1.3/libApp' '-L/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/lib64' +gmake[1]: Leaving directory '/tmp/ii/CMakeFiles/CMakeTmp' diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-GNU-7.3.0.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-GNU-7.3.0.output new file mode 100644 index 0000000..d9095f7 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-GNU-7.3.0.output @@ -0,0 +1 @@ +/opt/cray/pe/libsci/18.07.1/GNU/7.1/x86_64/include;/opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/include;/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include;/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include;/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include;/opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include;/opt/cray/pe/pmi/5.0.14/include;/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include;/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include;/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include;/opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include;/opt/cray-hss-devel/8.0.0/include;/opt/gcc/7.3.0/snos/include/g++;/opt/gcc/7.3.0/snos/include/g++/x86_64-suse-linux;/opt/gcc/7.3.0/snos/include/g++/backward;/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/include;/usr/local/include;/opt/gcc/7.3.0/snos/include;/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/include-fixed;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-Intel-18.0.2.20180210.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-Intel-18.0.2.20180210.input new file mode 100644 index 0000000..e25f7cf --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-Intel-18.0.2.20180210.input @@ -0,0 +1,43 @@ +CMAKE_LANG=CXX +CMAKE_CXX_COMPILER_ABI=ELF +CMAKE_CXX_COMPILER_AR= +CMAKE_CXX_COMPILER_ARCHITECTURE_ID= +CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_CXX_COMPILER_ID=Intel +CMAKE_CXX_COMPILER_LAUNCHER= +CMAKE_CXX_COMPILER_LOADED=1 +CMAKE_CXX_COMPILER_RANLIB= +CMAKE_CXX_COMPILER_TARGET= +CMAKE_CXX_COMPILER_VERSION=18.0.2.20180210 +CMAKE_CXX_COMPILER_VERSION_INTERAL= +Change Dir: /tmp/ii/CMakeFiles/CMakeTmp + +Run Build Command:"/usr/bin/gmake" "cmTC_7f9a2/fast" +/usr/bin/gmake -f CMakeFiles/cmTC_7f9a2.dir/build.make CMakeFiles/cmTC_7f9a2.dir/build +gmake[1]: Entering directory '/tmp/ii/CMakeFiles/CMakeTmp' +Building CXX object CMakeFiles/cmTC_7f9a2.dir/CMakeCXXCompilerABI.cpp.o +/opt/intel/2018.2.199/compilers_and_libraries_2018/linux/bin/intel64/icpc -v -o CMakeFiles/cmTC_7f9a2.dir/CMakeCXXCompilerABI.cpp.o -c /usr/share/cmake/Modules/CMakeCXXCompilerABI.cpp +icpc version 18.0.2 (gcc version 6.3.0 compatibility) +/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/bin/intel64/mcpcom --target_efi2 --lang=c++ -_g -mP3OPT_inline_alloca -D__ICC=1800 -D__INTEL_COMPILER=1800 -D__INTEL_COMPILER_UPDATE=2 -D__PTRDIFF_TYPE__=long "-D__SIZE_TYPE__=unsigned long" -D__WCHAR_TYPE__=int "-D__WINT_TYPE__=unsigned int" "-D__INTMAX_TYPE__=long int" "-D__UINTMAX_TYPE__=long unsigned int" -D__GLIBCXX_TYPE_INT_N_0=__int128 -D__GLIBCXX_BITSIZE_INT_N_0=128 -D__LONG_MAX__=9223372036854775807L -D__QMSPP_ -D__OPTIMIZE__ -D__NO_MATH_INLINES -D__NO_STRING_INLINES -D__GNUC_GNU_INLINE__ -D__GNUG__=6 -D__GNUC__=6 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=0 -D__LP64__ -D_LP64 -D_GNU_SOURCE=1 -D__DEPRECATED=1 -D__GXX_WEAK__=1 -D__GXX_ABI_VERSION=1010 "-D__USER_LABEL_PREFIX__= " -D__REGISTER_PREFIX__= -D__INTEL_RTTI__ -D__EXCEPTIONS=1 -D__unix__ -D__unix -D__linux__ -D__linux -D__gnu_linux__ -B -Dunix -Dlinux "-_Asystem(unix)" -D__ELF__ -D__x86_64 -D__x86_64__ -D__amd64 -D__amd64__ "-_Acpu(x86_64)" "-_Amachine(x86_64)" -D__INTEL_COMPILER_BUILD_DATE=20180210 -D__INTEL_OFFLOAD -D__i686 -D__i686__ -D__pentiumpro -D__pentiumpro__ -D__pentium4 -D__pentium4__ -D__tune_pentium4__ -D__SSE2__ -D__SSE2_MATH__ -D__SSE__ -D__SSE_MATH__ -D__MMX__ -_k -_8 -_l --has_new_stdarg_support -_a -_b --gnu_version=60300 -_W5 --gcc-extern-inline -p --bool -tused -x --multibyte_chars -mGLOB_diag_suppress_sys --system_preinclude /usr/include/stdc-predef.h --array_section --simd --simd_func --offload_mode=1 --offload_target_names=gfx,GFX,mic,MIC --offload_unique_string=icpc0677339003u7vp5M --bool -mGLOB_em64t=TRUE -mP1OPT_version=18.0-intel64 -mGLOB_diag_file=CMakeFiles/cmTC_7f9a2.dir/CMakeCXXCompilerABI.cpp.diag -mGLOB_long_size_64 -mGLOB_routine_pointer_size_64 -mP1OPT_print_version=FALSE -mCG_use_gas_got_workaround=F -mP2OPT_align_option_used=TRUE -mGLOB_gcc_version=630 "-mGLOB_options_string=-v -o CMakeFiles/cmTC_7f9a2.dir/CMakeCXXCompilerABI.cpp.o -c" -mGLOB_cxx_limited_range=FALSE -mCG_extend_parms=FALSE -mGLOB_compiler_bin_directory=/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/bin/intel64 -mGLOB_as_output_backup_file_name=/tmp/icpc9QgBnwas_.s -mIPOPT_activate -mIPOPT_lite -mGLOB_instruction_tuning=0x0 -mGLOB_uarch_tuning=0x0 -mGLOB_product_id_code=0x22006d8f -mCG_bnl_movbe=T -mGLOB_extended_instructions=0x8 -mP3OPT_use_mspp_call_convention -mP2OPT_subs_out_of_bound=FALSE -mP2OPT_disam_type_based_disam=2 -mP2OPT_disam_assume_ansi_c -mP2OPT_checked_disam_ansi_alias=TRUE -mGLOB_ansi_alias -mPGOPTI_value_profile_use=T -mP2OPT_il0_array_sections=TRUE -mGLOB_offload_mode=1 -mP2OPT_offload_unique_var_string=icpc0677339003u7vp5M -mP2OPT_hlo_level=2 -mP2OPT_hlo -mP2OPT_hpo_rtt_control=0 -mIPOPT_args_in_regs=0 -mP2OPT_disam_assume_nonstd_intent_in=FALSE -mGLOB_imf_mapping_library=/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/bin/intel64/libiml_attr.so -mPGOPTI_gen_threadsafe_level=0 -mIPOPT_lto_object_enabled -mIPOPT_lto_object_value=1 -mIPOPT_obj_output_file_name=CMakeFiles/cmTC_7f9a2.dir/CMakeCXXCompilerABI.cpp.o -mIPOPT_whole_archive_fixup_file_name=/tmp/icpcwarchdKZxrN -mGLOB_linker_version=2.31.1.20180828 -mGLOB_driver_tempfile_name=/tmp/icpctempfilejCzFYq -mP3OPT_asm_target=P3OPT_ASM_TARGET_GAS -mGLOB_async_unwind_tables=TRUE -mGLOB_obj_output_file=CMakeFiles/cmTC_7f9a2.dir/CMakeCXXCompilerABI.cpp.o -mGLOB_source_dialect=GLOB_SOURCE_DIALECT_C_PLUS_PLUS -mP1OPT_source_file_name=/usr/share/cmake/Modules/CMakeCXXCompilerABI.cpp -mP1OPT_full_source_file_name=/usr/share/cmake/Modules/CMakeCXXCompilerABI.cpp -mGLOB_eh_linux /usr/share/cmake/Modules/CMakeCXXCompilerABI.cpp +#include "..." search starts here: +#include <...> search starts here: + /opt/intel/2018.2.199/compilers_and_libraries_2018/linux/mkl/include + /opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/include/intel64 + /opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/include/icc + /opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/include + /opt/gcc/6.3.0/snos/include/g++ + /opt/gcc/6.3.0/snos/include/g++/x86_64-suse-linux + /opt/gcc/6.3.0/snos/include/g++/backward + /usr/local/include + /opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/include + /opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/include-fixed + /opt/gcc/6.3.0/snos/include/ + /usr/include +End of search list. +Linking CXX executable cmTC_7f9a2 +/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_7f9a2.dir/link.txt --verbose=1 +/opt/intel/2018.2.199/compilers_and_libraries_2018/linux/bin/intel64/icpc -v CMakeFiles/cmTC_7f9a2.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_7f9a2 -rdynamic +icpc version 18.0.2 (gcc version 6.3.0 compatibility) +/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/bin/intel64/mcpcom -mGLOB_em64t=TRUE -mP1OPT_version=18.0-intel64 -mGLOB_diag_file=CMakeFiles/cmTC_7f9a2.dir/CMakeCXXCompilerABI.cpp.diag -mGLOB_long_size_64 -mGLOB_routine_pointer_size_64 -mP1OPT_print_version=FALSE -mCG_use_gas_got_workaround=F -mP2OPT_align_option_used=TRUE -mGLOB_gcc_version=630 "-mGLOB_options_string=-v -o cmTC_7f9a2 -rdynamic" -mGLOB_cxx_limited_range=FALSE -mCG_extend_parms=FALSE -mGLOB_compiler_bin_directory=/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/bin/intel64 -mGLOB_as_output_backup_file_name=/tmp/icpczXhKsFas_.s -mGLOB_dashboard_use_source_name -mIPOPT_activate -mGLOB_product_id_code=0x22006d8f -mP3OPT_use_mspp_call_convention -mP2OPT_subs_out_of_bound=FALSE -mP2OPT_disam_type_based_disam=2 -mP2OPT_disam_assume_ansi_c -mP2OPT_checked_disam_ansi_alias=TRUE -mGLOB_ansi_alias -mPGOPTI_value_profile_use=T -mGLOB_opt_report_use_source_name -mP2OPT_il0_array_sections=TRUE -mGLOB_offload_mode=1 -mP2OPT_offload_unique_var_string=icpc0782944392Xjn3gY -mP2OPT_hlo -mP2OPT_hpo_rtt_control=0 -mIPOPT_args_in_regs=0 -mP2OPT_disam_assume_nonstd_intent_in=FALSE -mGLOB_imf_mapping_library=/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/bin/intel64/libiml_attr.so -mPGOPTI_gen_threadsafe_level=0 -mIPOPT_link -mIPOPT_ipo_activate -mIPOPT_mo_activate -mIPOPT_source_files_list=/tmp/icpcslis0WLMWJ -mIPOPT_mo_global_data -mIPOPT_link_script_file=/tmp/icpcscriptx5xyMn "-mIPOPT_cmdline_link="/usr/lib/../lib64/crt1.o" "/usr/lib/../lib64/crti.o" "/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/crtbegin.o" "-export-dynamic" "--eh-frame-hdr" "--build-id" "-dynamic-linker" "/lib64/ld-linux-x86-64.so.2" "-m" "elf_x86_64" "-o" "cmTC_7f9a2" "-L/opt/intel/2018.2.199/compilers_and_libraries_2018/linux/mkl/lib/intel64" "-L/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/lib/intel64_lin" "-L/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/" "-L/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/../../../../lib64" "-L/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/../../../../lib64/" "-L/lib/../lib64" "-L/lib/../lib64/" "-L/usr/lib/../lib64" "-L/usr/lib/../lib64/" "-L/opt/intel/2018.2.199/compilers_and_libraries_2018/linux/mkl/lib/intel64/" "-L/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/../../../" "-L/lib64" "-L/lib/" "-L/usr/lib64" "-L/usr/lib" "CMakeFiles/cmTC_7f9a2.dir/CMakeCXXCompilerABI.cpp.o" "-Bdynamic" "-Bstatic" "-limf" "-lsvml" "-lirng" "-Bdynamic" "-lstdc++" "-lm" "-Bstatic" "-lipgo" "-ldecimal" "--as-needed" "-Bdynamic" "-lcilkrts" "--no-as-needed" "-lstdc++" "-lgcc" "-lgcc_s" "-Bstatic" "-lirc" "-lsvml" "-Bdynamic" "-lc" "-lgcc" "-lgcc_s" "-Bstatic" "-lirc_s" "-Bdynamic" "-ldl" "-lc" "/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/crtend.o" "/usr/lib/../lib64/crtn.o"" -mIPOPT_il_in_obj -mIPOPT_ipo_activate_warn=FALSE -mIPOPT_obj_output_file_name=/tmp/ipo_icpcP4kcWS.o -mIPOPT_whole_archive_fixup_file_name=/tmp/icpcwarchR2OJ1A -mGLOB_linker_version=2.31.1.20180828 -mGLOB_driver_tempfile_name=/tmp/icpctempfileWiVxTe -mP3OPT_asm_target=P3OPT_ASM_TARGET_GAS -mGLOB_async_unwind_tables=TRUE -mGLOB_obj_output_file=/tmp/ipo_icpcP4kcWS.o -mGLOB_source_dialect=GLOB_SOURCE_DIALECT_NONE -mP1OPT_source_file_name=ipo_out.c CMakeFiles/cmTC_7f9a2.dir/CMakeCXXCompilerABI.cpp.o -mIPOPT_object_files=T -mIPOPT_assembly_files=/tmp/icpcalis76IIBa -mIPOPT_generated_tempfiles=/tmp/icpcelisj58trO -mIPOPT_embedded_object_base_name=/tmp/icpceobjgmHfhs -mIPOPT_cmdline_link_new_name=/tmp/icpcllis3p9065 +ld /usr/lib/../lib64/crt1.o /usr/lib/../lib64/crti.o /opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/crtbegin.o -export-dynamic --eh-frame-hdr --build-id -dynamic-linker /lib64/ld-linux-x86-64.so.2 -m elf_x86_64 -o cmTC_7f9a2 -L/opt/intel/2018.2.199/compilers_and_libraries_2018/linux/mkl/lib/intel64 -L/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/lib/intel64_lin -L/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/ -L/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/../../../../lib64 -L/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/../../../../lib64/ -L/lib/../lib64 -L/lib/../lib64/ -L/usr/lib/../lib64 -L/usr/lib/../lib64/ -L/opt/intel/2018.2.199/compilers_and_libraries_2018/linux/mkl/lib/intel64/ -L/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/../../../ -L/lib64 -L/lib/ -L/usr/lib64 -L/usr/lib CMakeFiles/cmTC_7f9a2.dir/CMakeCXXCompilerABI.cpp.o -Bdynamic -Bstatic -limf -lsvml -lirng -Bdynamic -lstdc++ -lm -Bstatic -lipgo -ldecimal --as-needed -Bdynamic -lcilkrts --no-as-needed -lstdc++ -lgcc -lgcc_s -Bstatic -lirc -lsvml -Bdynamic -lc -lgcc -lgcc_s -Bstatic -lirc_s -Bdynamic -ldl -lc /opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/crtend.o /usr/lib/../lib64/crtn.o +gmake[1]: Leaving directory '/tmp/ii/CMakeFiles/CMakeTmp' diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-Intel-18.0.2.20180210.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-Intel-18.0.2.20180210.output new file mode 100644 index 0000000..73d779b --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-Intel-18.0.2.20180210.output @@ -0,0 +1 @@ +/opt/intel/2018.2.199/compilers_and_libraries_2018/linux/mkl/include;/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/include/intel64;/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/include/icc;/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/include;/opt/gcc/6.3.0/snos/include/g++;/opt/gcc/6.3.0/snos/include/g++/x86_64-suse-linux;/opt/gcc/6.3.0/snos/include/g++/backward;/usr/local/include;/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/include;/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/include-fixed;/opt/gcc/6.3.0/snos/include/;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/darwin-C-AppleClang-8.0.0.8000042.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/darwin-C-AppleClang-8.0.0.8000042.input new file mode 100644 index 0000000..4bc26bc --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/darwin-C-AppleClang-8.0.0.8000042.input @@ -0,0 +1,50 @@ +CMAKE_LANG=C +CMAKE_C_COMPILER_ABI= +CMAKE_C_COMPILER_AR= +CMAKE_C_COMPILER_ARCHITECTURE_ID= +CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_C_COMPILER_ID=AppleClang +CMAKE_C_COMPILER_LAUNCHER= +CMAKE_C_COMPILER_LOADED=1 +CMAKE_C_COMPILER_RANLIB= +CMAKE_C_COMPILER_TARGET= +CMAKE_C_COMPILER_VERSION=8.0.0.8000042 +CMAKE_C_COMPILER_VERSION_INTERAL= +Change Dir: /tmp/ii/CMakeFiles/CMakeTmp + +Run Build Command:"/usr/bin/make" "cmTC_0c33e/fast" +/Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_0c33e.dir/build.make CMakeFiles/cmTC_0c33e.dir/build +Building C object CMakeFiles/cmTC_0c33e.dir/CMakeCCompilerABI.c.o +/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -v -Wl,-v -o CMakeFiles/cmTC_0c33e.dir/CMakeCCompilerABI.c.o -c /usr/local/pkg.1804/share/cmake-3.10/Modules/CMakeCCompilerABI.c +Apple LLVM version 8.0.0 (clang-800.0.42.1) +Target: x86_64-apple-darwin15.6.0 +Thread model: posix +InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin +clang: warning: -Wl,-v: 'linker' input unused + "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.11.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name CMakeCCompilerABI.c -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 274.2 -v -dwarf-column-info -debugger-tuning=lldb -coverage-file /private/tmp/ii/CMakeFiles/CMakeTmp/CMakeFiles/cmTC_0c33e.dir/CMakeCCompilerABI.c.o -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0 -fdebug-compilation-dir /private/tmp/ii/CMakeFiles/CMakeTmp -ferror-limit 19 -fmessage-length 0 -stack-protector 1 -fblocks -fobjc-runtime=macosx-10.11.0 -fencode-extended-block-signature -fmax-type-align=16 -fdiagnostics-show-option -o CMakeFiles/cmTC_0c33e.dir/CMakeCCompilerABI.c.o -x c /usr/local/pkg.1804/share/cmake-3.10/Modules/CMakeCCompilerABI.c +clang -cc1 version 8.0.0 (clang-800.0.42.1) default target x86_64-apple-darwin15.6.0 +ignoring nonexistent directory "/usr/local/include" +#include "..." search starts here: +#include <...> search starts here: + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0/include + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include + /usr/include + /System/Library/Frameworks (framework directory) + /Library/Frameworks (framework directory) +End of search list. +Linking C executable cmTC_0c33e +/usr/local/pkg.1804/bin/cmake -E cmake_link_script CMakeFiles/cmTC_0c33e.dir/link.txt --verbose=1 +/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -Wl,-search_paths_first -Wl,-headerpad_max_install_names -v -Wl,-v CMakeFiles/cmTC_0c33e.dir/CMakeCCompilerABI.c.o -o cmTC_0c33e +Apple LLVM version 8.0.0 (clang-800.0.42.1) +Target: x86_64-apple-darwin15.6.0 +Thread model: posix +InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin + "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.11.0 -o cmTC_0c33e -search_paths_first -headerpad_max_install_names -v CMakeFiles/cmTC_0c33e.dir/CMakeCCompilerABI.c.o -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0/lib/darwin/libclang_rt.osx.a +@(#)PROGRAM:ld PROJECT:ld64-274.2 +configured to support archs: armv6 armv7 armv7s arm64 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em (tvOS) +Library search paths: + /usr/lib + /usr/local/lib +Framework search paths: + /Library/Frameworks/ + /System/Library/Frameworks/ diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/darwin-C-AppleClang-8.0.0.8000042.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/darwin-C-AppleClang-8.0.0.8000042.output new file mode 100644 index 0000000..c857928 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/darwin-C-AppleClang-8.0.0.8000042.output @@ -0,0 +1 @@ +/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0/include;/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/darwin-CXX-AppleClang-8.0.0.8000042.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/darwin-CXX-AppleClang-8.0.0.8000042.input new file mode 100644 index 0000000..907a92e --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/darwin-CXX-AppleClang-8.0.0.8000042.input @@ -0,0 +1,52 @@ +CMAKE_LANG=CXX +CMAKE_CXX_COMPILER_ABI= +CMAKE_CXX_COMPILER_AR= +CMAKE_CXX_COMPILER_ARCHITECTURE_ID= +CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_CXX_COMPILER_ID=AppleClang +CMAKE_CXX_COMPILER_LAUNCHER= +CMAKE_CXX_COMPILER_LOADED=1 +CMAKE_CXX_COMPILER_RANLIB= +CMAKE_CXX_COMPILER_TARGET= +CMAKE_CXX_COMPILER_VERSION=8.0.0.8000042 +CMAKE_CXX_COMPILER_VERSION_INTERAL= +Change Dir: /tmp/ii/CMakeFiles/CMakeTmp + +Run Build Command:"/usr/bin/make" "cmTC_b7e96/fast" +/Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_b7e96.dir/build.make CMakeFiles/cmTC_b7e96.dir/build +Building CXX object CMakeFiles/cmTC_b7e96.dir/CMakeCXXCompilerABI.cpp.o +/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -v -Wl,-v -o CMakeFiles/cmTC_b7e96.dir/CMakeCXXCompilerABI.cpp.o -c /usr/local/pkg.1804/share/cmake-3.10/Modules/CMakeCXXCompilerABI.cpp +Apple LLVM version 8.0.0 (clang-800.0.42.1) +Target: x86_64-apple-darwin15.6.0 +Thread model: posix +InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin +clang: warning: -Wl,-v: 'linker' input unused + "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.11.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name CMakeCXXCompilerABI.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 274.2 -v -dwarf-column-info -debugger-tuning=lldb -coverage-file /private/tmp/ii/CMakeFiles/CMakeTmp/CMakeFiles/cmTC_b7e96.dir/CMakeCXXCompilerABI.cpp.o -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0 -stdlib=libc++ -fdeprecated-macro -fdebug-compilation-dir /private/tmp/ii/CMakeFiles/CMakeTmp -ferror-limit 19 -fmessage-length 0 -stack-protector 1 -fblocks -fobjc-runtime=macosx-10.11.0 -fencode-extended-block-signature -fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option -o CMakeFiles/cmTC_b7e96.dir/CMakeCXXCompilerABI.cpp.o -x c++ /usr/local/pkg.1804/share/cmake-3.10/Modules/CMakeCXXCompilerABI.cpp +clang -cc1 version 8.0.0 (clang-800.0.42.1) default target x86_64-apple-darwin15.6.0 +ignoring nonexistent directory "/usr/include/c++/v1" +ignoring nonexistent directory "/usr/local/include" +#include "..." search starts here: +#include <...> search starts here: + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1 + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0/include + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include + /usr/include + /System/Library/Frameworks (framework directory) + /Library/Frameworks (framework directory) +End of search list. +Linking CXX executable cmTC_b7e96 +/usr/local/pkg.1804/bin/cmake -E cmake_link_script CMakeFiles/cmTC_b7e96.dir/link.txt --verbose=1 +/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -Wl,-search_paths_first -Wl,-headerpad_max_install_names -v -Wl,-v CMakeFiles/cmTC_b7e96.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_b7e96 +Apple LLVM version 8.0.0 (clang-800.0.42.1) +Target: x86_64-apple-darwin15.6.0 +Thread model: posix +InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin + "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.11.0 -o cmTC_b7e96 -search_paths_first -headerpad_max_install_names -v CMakeFiles/cmTC_b7e96.dir/CMakeCXXCompilerABI.cpp.o -lc++ -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0/lib/darwin/libclang_rt.osx.a +@(#)PROGRAM:ld PROJECT:ld64-274.2 +configured to support archs: armv6 armv7 armv7s arm64 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em (tvOS) +Library search paths: + /usr/lib + /usr/local/lib +Framework search paths: + /Library/Frameworks/ + /System/Library/Frameworks/ diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/darwin-CXX-AppleClang-8.0.0.8000042.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/darwin-CXX-AppleClang-8.0.0.8000042.output new file mode 100644 index 0000000..6df208c --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/darwin-CXX-AppleClang-8.0.0.8000042.output @@ -0,0 +1 @@ +/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1;/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0/include;/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/empty-C.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/empty-C.input new file mode 100644 index 0000000..b27eb02 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/empty-C.input @@ -0,0 +1,14 @@ +CMAKE_LANG=C +CMAKE_C_COMPILER_ABI=ELF +CMAKE_C_COMPILER_AR=/usr/bin/gcc-ar-7 +CMAKE_C_COMPILER_ARCHITECTURE_ID= +CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_C_COMPILER_ID=GNU +CMAKE_C_COMPILER_LAUNCHER= +CMAKE_C_COMPILER_LOADED=1 +CMAKE_C_COMPILER_RANLIB=/usr/bin/gcc-ranlib-7 +CMAKE_C_COMPILER_TARGET= +CMAKE_C_COMPILER_VERSION=7.3.0 +CMAKE_C_COMPILER_VERSION_INTERAL= + +This is a test and there is nothing here to parse. diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/empty-C.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/empty-C.output new file mode 100644 index 0000000..e69de29 diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/empty-CXX.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/empty-CXX.input new file mode 100644 index 0000000..b983d6b --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/empty-CXX.input @@ -0,0 +1,14 @@ +CMAKE_LANG=CXX +CMAKE_CXX_COMPILER_ABI=ELF +CMAKE_CXX_COMPILER_AR=/usr/bin/gcc-ar-7 +CMAKE_CXX_COMPILER_ARCHITECTURE_ID= +CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_CXX_COMPILER_ID=GNU +CMAKE_CXX_COMPILER_LAUNCHER= +CMAKE_CXX_COMPILER_LOADED=1 +CMAKE_CXX_COMPILER_RANLIB=/usr/bin/gcc-ranlib-7 +CMAKE_CXX_COMPILER_TARGET= +CMAKE_CXX_COMPILER_VERSION=7.3.0 +CMAKE_CXX_COMPILER_VERSION_INTERAL= + +This is a test and there is nothing here to parse. diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/empty-CXX.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/empty-CXX.output new file mode 100644 index 0000000..e69de29 diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/freebsd-C-Clang-3.3.0.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/freebsd-C-Clang-3.3.0.input new file mode 100644 index 0000000..81626f9 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/freebsd-C-Clang-3.3.0.input @@ -0,0 +1,38 @@ +CMAKE_LANG=C +CMAKE_C_COMPILER_ABI=ELF +CMAKE_C_COMPILER_AR= +CMAKE_C_COMPILER_ARCHITECTURE_ID= +CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_C_COMPILER_ID=Clang +CMAKE_C_COMPILER_LAUNCHER= +CMAKE_C_COMPILER_LOADED=1 +CMAKE_C_COMPILER_RANLIB= +CMAKE_C_COMPILER_TARGET= +CMAKE_C_COMPILER_VERSION=3.3.0 +CMAKE_C_COMPILER_VERSION_INTERAL= +Change Dir: /tmp/ii/CMakeFiles/CMakeTmp + +Run Build Command:"/usr/local/bin/gmake" "cmTC_0c44b/fast" +/usr/local/bin/gmake -f CMakeFiles/cmTC_0c44b.dir/build.make CMakeFiles/cmTC_0c44b.dir/build +gmake[1]: Entering directory `/tmp/ii/CMakeFiles/CMakeTmp' +Building C object CMakeFiles/cmTC_0c44b.dir/CMakeCCompilerABI.c.o +/usr/bin/cc -v -o CMakeFiles/cmTC_0c44b.dir/CMakeCCompilerABI.c.o -c /usr/local/share/cmake-3.7/Modules/CMakeCCompilerABI.c +FreeBSD clang version 3.3 (tags/RELEASE_33/final 183502) 20130610 +Target: x86_64-unknown-freebsd10.0 +Thread model: posix + "/usr/bin/cc" -cc1 -triple x86_64-unknown-freebsd10.0 -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name CMakeCCompilerABI.c -mrelocation-model static -mdisable-fp-elim -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -v -coverage-file /tmp/ii/CMakeFiles/cmTC_0c44b.dir/CMakeCCompilerABI.c.o -resource-dir /usr/bin/../lib/clang/3.3 -fdebug-compilation-dir /tmp/ii/CMakeFiles/CMakeTmp -ferror-limit 19 -fmessage-length 0 -mstackrealign -fobjc-runtime=gnustep -fobjc-default-synthesize-properties -fdiagnostics-show-option -backend-option -vectorize-loops -o CMakeFiles/cmTC_0c44b.dir/CMakeCCompilerABI.c.o -x c /usr/local/share/cmake-3.7/Modules/CMakeCCompilerABI.c +clang -cc1 version 3.3 based upon LLVM 3.3 default target x86_64-unknown-freebsd10.0 +ignoring nonexistent directory "/usr/bin/../lib/clang/3.3/include" +#include "..." search starts here: +#include <...> search starts here: + /usr/include/clang/3.3 + /usr/include +End of search list. +Linking C executable cmTC_0c44b +/usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTC_0c44b.dir/link.txt --verbose=1 +/usr/bin/cc -v CMakeFiles/cmTC_0c44b.dir/CMakeCCompilerABI.c.o -o cmTC_0c44b +FreeBSD clang version 3.3 (tags/RELEASE_33/final 183502) 20130610 +Target: x86_64-unknown-freebsd10.0 +Thread model: posix + "/usr/bin/ld" --eh-frame-hdr -dynamic-linker /libexec/ld-elf.so.1 --hash-style=both --enable-new-dtags -o cmTC_0c44b /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o -L/usr/lib CMakeFiles/cmTC_0c44b.dir/CMakeCCompilerABI.c.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/crtend.o /usr/lib/crtn.o +gmake[1]: Leaving directory `/tmp/ii/CMakeFiles/CMakeTmp' diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/freebsd-C-Clang-3.3.0.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/freebsd-C-Clang-3.3.0.output new file mode 100644 index 0000000..893ec49 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/freebsd-C-Clang-3.3.0.output @@ -0,0 +1 @@ +/usr/include/clang/3.3;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/freebsd-CXX-Clang-3.3.0.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/freebsd-CXX-Clang-3.3.0.input new file mode 100644 index 0000000..1f7758b --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/freebsd-CXX-Clang-3.3.0.input @@ -0,0 +1,45 @@ +CMAKE_LANG=CXX +CMAKE_CXX_COMPILER_ABI=ELF +CMAKE_CXX_COMPILER_AR= +CMAKE_CXX_COMPILER_ARCHITECTURE_ID= +CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_CXX_COMPILER_ID=Clang +CMAKE_CXX_COMPILER_LAUNCHER= +CMAKE_CXX_COMPILER_LOADED=1 +CMAKE_CXX_COMPILER_RANLIB= +CMAKE_CXX_COMPILER_TARGET= +CMAKE_CXX_COMPILER_VERSION=3.3.0 +CMAKE_CXX_COMPILER_VERSION_INTERAL= +Change Dir: /tmp/ii/CMakeFiles/CMakeTmp + +Run Build Command:"/usr/local/bin/gmake" "cmTC_c3442/fast" +/usr/local/bin/gmake -f CMakeFiles/cmTC_c3442.dir/build.make CMakeFiles/cmTC_c3442.dir/build +gmake[1]: Entering directory `/tmp/ii/CMakeFiles/CMakeTmp' +Building CXX object CMakeFiles/cmTC_c3442.dir/CMakeCXXCompilerABI.cpp.o +/usr/bin/CC -v -o CMakeFiles/cmTC_c3442.dir/CMakeCXXCompilerABI.cpp.o -c /usr/local/share/cmake-3.7/Modules/CMakeCXXCompilerABI.cpp +FreeBSD clang version 3.3 (tags/RELEASE_33/final 183502) 20130610 +Target: x86_64-unknown-freebsd10.0 +Thread model: posix + "/usr/bin/CC" -cc1 -triple x86_64-unknown-freebsd10.0 -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name CMakeCXXCompilerABI.cpp -mrelocation-model static -mdisable-fp-elim -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -v -coverage-file /tmp/ii/CMakeFiles/cmTC_c3442.dir/CMakeCXXCompilerABI.cpp.o -resource-dir /usr/bin/../lib/clang/3.3 -internal-isystem /usr/include/c++/v1 -fdeprecated-macro -fdebug-compilation-dir /tmp/ii/CMakeFiles/CMakeTmp -ferror-limit 19 -fmessage-length 0 -mstackrealign -fobjc-runtime=gnustep -fobjc-default-synthesize-properties -fcxx-exceptions -fexceptions -fdiagnostics-show-option -backend-option -vectorize-loops -o CMakeFiles/cmTC_c3442.dir/CMakeCXXCompilerABI.cpp.o -x c++ /usr/local/share/cmake-3.7/Modules/CMakeCXXCompilerABI.cpp +clang -cc1 version 3.3 based upon LLVM 3.3 default target x86_64-unknown-freebsd10.0 +ignoring nonexistent directory "/usr/include/c++/4.2/backward/backward" +ignoring nonexistent directory "/usr/bin/../lib/clang/3.3/include" +ignoring duplicate directory "/usr/include/c++/4.2" +ignoring duplicate directory "/usr/include/c++/4.2/backward" +ignoring duplicate directory "/usr/include/c++/4.2/backward" +#include "..." search starts here: +#include <...> search starts here: + /usr/include/c++/v1 + /usr/include/c++/4.2 + /usr/include/c++/4.2/backward + /usr/include/clang/3.3 + /usr/include +End of search list. +Linking CXX executable cmTC_c3442 +/usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTC_c3442.dir/link.txt --verbose=1 +/usr/bin/CC -v CMakeFiles/cmTC_c3442.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_c3442 +FreeBSD clang version 3.3 (tags/RELEASE_33/final 183502) 20130610 +Target: x86_64-unknown-freebsd10.0 +Thread model: posix + "/usr/bin/ld" --eh-frame-hdr -dynamic-linker /libexec/ld-elf.so.1 --hash-style=both --enable-new-dtags -o cmTC_c3442 /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o -L/usr/lib CMakeFiles/cmTC_c3442.dir/CMakeCXXCompilerABI.cpp.o -lc++ -lm -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/crtend.o /usr/lib/crtn.o +gmake[1]: Leaving directory `/tmp/ii/CMakeFiles/CMakeTmp' diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/freebsd-CXX-Clang-3.3.0.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/freebsd-CXX-Clang-3.3.0.output new file mode 100644 index 0000000..cd64264 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/freebsd-CXX-Clang-3.3.0.output @@ -0,0 +1 @@ +/usr/include/c++/v1;/usr/include/c++/4.2;/usr/include/c++/4.2/backward;/usr/include/clang/3.3;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-C-GNU-7.3.0.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-C-GNU-7.3.0.input new file mode 100644 index 0000000..ee296a7 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-C-GNU-7.3.0.input @@ -0,0 +1,72 @@ +CMAKE_LANG=C +CMAKE_C_COMPILER_ABI=ELF +CMAKE_C_COMPILER_AR=/usr/bin/gcc-ar-7 +CMAKE_C_COMPILER_ARCHITECTURE_ID= +CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_C_COMPILER_ID=GNU +CMAKE_C_COMPILER_LAUNCHER= +CMAKE_C_COMPILER_LOADED=1 +CMAKE_C_COMPILER_RANLIB=/usr/bin/gcc-ranlib-7 +CMAKE_C_COMPILER_TARGET= +CMAKE_C_COMPILER_VERSION=7.3.0 +CMAKE_C_COMPILER_VERSION_INTERAL= +Change Dir: /tmp/ii/CMakeFiles/CMakeTmp + +Run Build Command:"/usr/bin/make" "cmTC_1f304/fast" +/usr/bin/make -f CMakeFiles/cmTC_1f304.dir/build.make CMakeFiles/cmTC_1f304.dir/build +make[1]: Entering directory '/tmp/ii/CMakeFiles/CMakeTmp' +Building C object CMakeFiles/cmTC_1f304.dir/CMakeCCompilerABI.c.o +/usr/bin/cc -v -o CMakeFiles/cmTC_1f304.dir/CMakeCCompilerABI.c.o -c /usr/share/cmake-3.10/Modules/CMakeCCompilerABI.c +Using built-in specs. +COLLECT_GCC=/usr/bin/cc +OFFLOAD_TARGET_NAMES=nvptx-none +OFFLOAD_TARGET_DEFAULT=1 +Target: x86_64-linux-gnu +Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.3.0-27ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu +Thread model: posix +gcc version 7.3.0 (Ubuntu 7.3.0-27ubuntu1~18.04) +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_1f304.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' + /usr/lib/gcc/x86_64-linux-gnu/7/cc1 -quiet -v -imultiarch x86_64-linux-gnu /usr/share/cmake-3.10/Modules/CMakeCCompilerABI.c -quiet -dumpbase CMakeCCompilerABI.c -mtune=generic -march=x86-64 -auxbase-strip CMakeFiles/cmTC_1f304.dir/CMakeCCompilerABI.c.o -version -fstack-protector-strong -Wformat -Wformat-security -o /tmp/cc3JNm0a.s +GNU C11 (Ubuntu 7.3.0-27ubuntu1~18.04) version 7.3.0 (x86_64-linux-gnu) + compiled by GNU C version 7.3.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version isl-0.19-GMP + +GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 +ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu" +ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/7/../../../../x86_64-linux-gnu/include" +#include "..." search starts here: +#include <...> search starts here: + /usr/lib/gcc/x86_64-linux-gnu/7/include + /usr/local/include + /usr/lib/gcc/x86_64-linux-gnu/7/include-fixed + /usr/include/x86_64-linux-gnu + /usr/include +End of search list. +GNU C11 (Ubuntu 7.3.0-27ubuntu1~18.04) version 7.3.0 (x86_64-linux-gnu) + compiled by GNU C version 7.3.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version isl-0.19-GMP + +GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 +Compiler executable checksum: c8081a99abb72bbfd9129549110a350c +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_1f304.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' + as -v --64 -o CMakeFiles/cmTC_1f304.dir/CMakeCCompilerABI.c.o /tmp/cc3JNm0a.s +GNU assembler version 2.30 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.30 +COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/ +LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/7/../../../:/lib/:/usr/lib/ +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_1f304.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' +Linking C executable cmTC_1f304 +/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_1f304.dir/link.txt --verbose=1 +/usr/bin/cc -v -rdynamic CMakeFiles/cmTC_1f304.dir/CMakeCCompilerABI.c.o -o cmTC_1f304 +Using built-in specs. +COLLECT_GCC=/usr/bin/cc +COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper +OFFLOAD_TARGET_NAMES=nvptx-none +OFFLOAD_TARGET_DEFAULT=1 +Target: x86_64-linux-gnu +Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.3.0-27ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu +Thread model: posix +gcc version 7.3.0 (Ubuntu 7.3.0-27ubuntu1~18.04) +COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/ +LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/7/../../../:/lib/:/usr/lib/ +COLLECT_GCC_OPTIONS='-v' '-rdynamic' '-o' 'cmTC_1f304' '-mtune=generic' '-march=x86-64' + /usr/lib/gcc/x86_64-linux-gnu/7/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/7/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper -plugin-opt=-fresolution=/tmp/ccg3L1R6.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --sysroot=/ --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o cmTC_1f304 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/7/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/7 -L/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/7/../../.. CMakeFiles/cmTC_1f304.dir/CMakeCCompilerABI.c.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-linux-gnu/7/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crtn.o +COLLECT_GCC_OPTIONS='-v' '-rdynamic' '-o' 'cmTC_1f304' '-mtune=generic' '-march=x86-64' +make[1]: Leaving directory '/tmp/ii/CMakeFiles/CMakeTmp' diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-C-GNU-7.3.0.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-C-GNU-7.3.0.output new file mode 100644 index 0000000..dcd6565 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-C-GNU-7.3.0.output @@ -0,0 +1 @@ +/usr/lib/gcc/x86_64-linux-gnu/7/include;/usr/local/include;/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed;/usr/include/x86_64-linux-gnu;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-C-Intel-18.0.0.20170811.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-C-Intel-18.0.0.20170811.input new file mode 100644 index 0000000..1e6544b --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-C-Intel-18.0.0.20170811.input @@ -0,0 +1,43 @@ +CMAKE_LANG=C +CMAKE_C_COMPILER_ABI=ELF +CMAKE_C_COMPILER_AR= +CMAKE_C_COMPILER_ARCHITECTURE_ID= +CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_C_COMPILER_ID=Intel +CMAKE_C_COMPILER_LAUNCHER= +CMAKE_C_COMPILER_LOADED=1 +CMAKE_C_COMPILER_RANLIB= +CMAKE_C_COMPILER_TARGET= +CMAKE_C_COMPILER_VERSION=18.0.0.20170811 +CMAKE_C_COMPILER_VERSION_INTERAL= +Change Dir: /tmp/ii/CMakeFiles/CMakeTmp + +Run Build Command:"/usr/bin/gmake" "cmTC_a5f0a/fast" +/usr/bin/gmake -f CMakeFiles/cmTC_a5f0a.dir/build.make CMakeFiles/cmTC_a5f0a.dir/build +gmake[1]: Entering directory `/tmp/ii/CMakeFiles/CMakeTmp' +Building C object CMakeFiles/cmTC_a5f0a.dir/CMakeCCompilerABI.c.o +/opt/intel/compilers_and_libraries_2018.0.128/linux/bin/intel64/icc -v -o CMakeFiles/cmTC_a5f0a.dir/CMakeCCompilerABI.c.o -c /tmp/CMake/Modules/CMakeCCompilerABI.c +icc version 18.0.0 (gcc version 4.8.5 compatibility) +/opt/intel/compilers_and_libraries_2018.0.128/linux/bin/intel64/mcpcom --target_efi2 --lang=c -_g -mP3OPT_inline_alloca -D__ICC=1800 -D__INTEL_COMPILER=1800 -D__INTEL_COMPILER_UPDATE=0 -D__PTRDIFF_TYPE__=long "-D__SIZE_TYPE__=unsigned long" -D__WCHAR_TYPE__=int "-D__WINT_TYPE__=unsigned int" "-D__INTMAX_TYPE__=long int" "-D__UINTMAX_TYPE__=long unsigned int" -D__LONG_MAX__=9223372036854775807L -D__QMSPP_ -D__OPTIMIZE__ -D__NO_MATH_INLINES -D__NO_STRING_INLINES -D__GNUC_GNU_INLINE__ -D__GNUC__=4 -D__GNUC_MINOR__=8 -D__GNUC_PATCHLEVEL__=5 -D__LP64__ -D_LP64 -D__GXX_ABI_VERSION=1002 "-D__USER_LABEL_PREFIX__= " -D__REGISTER_PREFIX__= -D__INTEL_RTTI__ -D__unix__ -D__unix -D__linux__ -D__linux -D__gnu_linux__ -B -Dunix -Dlinux "-_Asystem(unix)" -D__ELF__ -D__x86_64 -D__x86_64__ -D__amd64 -D__amd64__ "-_Acpu(x86_64)" "-_Amachine(x86_64)" -D__INTEL_COMPILER_BUILD_DATE=20170811 -D__INTEL_OFFLOAD -D__i686 -D__i686__ -D__pentiumpro -D__pentiumpro__ -D__pentium4 -D__pentium4__ -D__tune_pentium4__ -D__SSE2__ -D__SSE2_MATH__ -D__SSE__ -D__SSE_MATH__ -D__MMX__ -_k -_8 -_l --has_new_stdarg_support -_a -_b --gnu_version=40805 -_W5 --gcc-extern-inline --multibyte_chars -mGLOB_diag_suppress_sys --system_preinclude /usr/include/stdc-predef.h --array_section --simd --simd_func --offload_mode=1 --offload_target_names=gfx,GFX,mic,MIC --offload_unique_string=icc1018727407m03RCD -mGLOB_em64t=TRUE -mP1OPT_version=18.0-intel64 -mGLOB_diag_file=CMakeFiles/cmTC_a5f0a.dir/CMakeCCompilerABI.c.diag -mGLOB_long_size_64 -mGLOB_routine_pointer_size_64 -mP1OPT_print_version=FALSE -mCG_use_gas_got_workaround=F -mP2OPT_align_option_used=TRUE -mGLOB_gcc_version=485 "-mGLOB_options_string=-v -o CMakeFiles/cmTC_a5f0a.dir/CMakeCCompilerABI.c.o -c" -mGLOB_cxx_limited_range=FALSE -mCG_extend_parms=FALSE -mGLOB_compiler_bin_directory=/opt/intel/compilers_and_libraries_2018.0.128/linux/bin/intel64 -mGLOB_as_output_backup_file_name=/tmp/iccMjPSufas_.s -mIPOPT_activate -mIPOPT_lite -mGLOB_instruction_tuning=0x0 -mGLOB_uarch_tuning=0x0 -mGLOB_product_id_code=0x22006d92 -mCG_bnl_movbe=T -mGLOB_extended_instructions=0x8 -mP3OPT_use_mspp_call_convention -mP2OPT_subs_out_of_bound=FALSE -mP2OPT_disam_type_based_disam=2 -mP2OPT_disam_assume_ansi_c -mP2OPT_checked_disam_ansi_alias=TRUE -mGLOB_ansi_alias -mPGOPTI_value_profile_use=T -mP2OPT_il0_array_sections=TRUE -mGLOB_offload_mode=1 -mP2OPT_offload_unique_var_string=icc1018727407m03RCD -mP2OPT_hlo_level=2 -mP2OPT_hlo -mP2OPT_hpo_rtt_control=0 -mIPOPT_args_in_regs=0 -mP2OPT_disam_assume_nonstd_intent_in=FALSE -mGLOB_imf_mapping_library=/opt/intel/compilers_and_libraries_2018.0.128/linux/bin/intel64/libiml_attr.so -mPGOPTI_gen_threadsafe_level=0 -mIPOPT_lto_object_enabled -mIPOPT_lto_object_value=1 -mIPOPT_obj_output_file_name=CMakeFiles/cmTC_a5f0a.dir/CMakeCCompilerABI.c.o -mIPOPT_whole_archive_fixup_file_name=/tmp/iccwarchDkkYqW -mGLOB_linker_version=2.27 -mGLOB_driver_tempfile_name=/tmp/icctempfileg2vfUM -mP3OPT_asm_target=P3OPT_ASM_TARGET_GAS -mGLOB_async_unwind_tables=TRUE -mGLOB_obj_output_file=CMakeFiles/cmTC_a5f0a.dir/CMakeCCompilerABI.c.o -mGLOB_source_dialect=GLOB_SOURCE_DIALECT_C -mP1OPT_source_file_name=/tmp/CMake/Modules/CMakeCCompilerABI.c -mP1OPT_full_source_file_name=/tmp/CMake/Modules/CMakeCCompilerABI.c /tmp/CMake/Modules/CMakeCCompilerABI.c +#include "..." search starts here: +#include <...> search starts here: + /opt/intel/compilers_and_libraries_2018.0.128/linux/ipp/include + /opt/intel/compilers_and_libraries_2018.0.128/linux/mkl/include + /opt/intel/compilers_and_libraries_2018.0.128/linux/pstl/include + /opt/intel/compilers_and_libraries_2018.0.128/linux/tbb/include + /opt/intel/compilers_and_libraries_2018.0.128/linux/tbb/include + /opt/intel/compilers_and_libraries_2018.0.128/linux/compiler/include/intel64 + /opt/intel/compilers_and_libraries_2018.0.128/linux/compiler/include/icc + /opt/intel/compilers_and_libraries_2018.0.128/linux/compiler/include + /usr/local/include + /usr/lib/gcc/x86_64-redhat-linux/4.8.5/include + /usr/include/ + /usr/include +End of search list. +Linking C executable cmTC_a5f0a +/tmp/CMake/bin/cmake -E cmake_link_script CMakeFiles/cmTC_a5f0a.dir/link.txt --verbose=1 +/opt/intel/compilers_and_libraries_2018.0.128/linux/bin/intel64/icc -v -rdynamic CMakeFiles/cmTC_a5f0a.dir/CMakeCCompilerABI.c.o -o cmTC_a5f0a +icc version 18.0.0 (gcc version 4.8.5 compatibility) +/opt/intel/compilers_and_libraries_2018.0.128/linux/bin/intel64/mcpcom -mGLOB_em64t=TRUE -mP1OPT_version=18.0-intel64 -mGLOB_diag_file=CMakeFiles/cmTC_a5f0a.dir/CMakeCCompilerABI.c.diag -mGLOB_long_size_64 -mGLOB_routine_pointer_size_64 -mP1OPT_print_version=FALSE -mCG_use_gas_got_workaround=F -mP2OPT_align_option_used=TRUE -mGLOB_gcc_version=485 "-mGLOB_options_string=-v -rdynamic -o cmTC_a5f0a" -mGLOB_cxx_limited_range=FALSE -mCG_extend_parms=FALSE -mGLOB_compiler_bin_directory=/opt/intel/compilers_and_libraries_2018.0.128/linux/bin/intel64 -mGLOB_as_output_backup_file_name=/tmp/iccSNrbyQas_.s -mGLOB_dashboard_use_source_name -mIPOPT_activate -mGLOB_product_id_code=0x22006d92 -mP3OPT_use_mspp_call_convention -mP2OPT_subs_out_of_bound=FALSE -mP2OPT_disam_type_based_disam=2 -mP2OPT_disam_assume_ansi_c -mP2OPT_checked_disam_ansi_alias=TRUE -mGLOB_ansi_alias -mPGOPTI_value_profile_use=T -mGLOB_opt_report_use_source_name -mP2OPT_il0_array_sections=TRUE -mGLOB_offload_mode=1 -mP2OPT_offload_unique_var_string=icc0131594309ugIRtJ -mP2OPT_hlo -mP2OPT_hpo_rtt_control=0 -mIPOPT_args_in_regs=0 -mP2OPT_disam_assume_nonstd_intent_in=FALSE -mGLOB_imf_mapping_library=/opt/intel/compilers_and_libraries_2018.0.128/linux/bin/intel64/libiml_attr.so -mPGOPTI_gen_threadsafe_level=0 -mIPOPT_link -mIPOPT_ipo_activate -mIPOPT_mo_activate -mIPOPT_source_files_list=/tmp/iccslis4FFYii -mIPOPT_mo_global_data -mIPOPT_link_script_file=/tmp/iccscriptV37728 "-mIPOPT_cmdline_link="/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crt1.o" "/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crti.o" "/usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbegin.o" "-export-dynamic" "--eh-frame-hdr" "--build-id" "-dynamic-linker" "/lib64/ld-linux-x86-64.so.2" "-m" "elf_x86_64" "-o" "cmTC_a5f0a" "-L/opt/intel/compilers_and_libraries_2018.0.128/linux/ipp/lib/intel64" "-L/opt/intel/compilers_and_libraries_2018.0.128/linux/compiler/lib/intel64_lin" "-L/opt/intel/compilers_and_libraries_2018.0.128/linux/mkl/lib/intel64_lin" "-L/opt/intel/compilers_and_libraries_2018.0.128/linux/tbb/lib/intel64/gcc4.7" "-L/opt/intel/compilers_and_libraries_2018.0.128/linux/tbb/lib/intel64/gcc4.7" "-L/opt/intel/compilers_and_libraries_2018.0.128/linux/compiler/lib/intel64_lin" "-L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/" "-L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64" "-L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/" "-L/lib/../lib64" "-L/lib/../lib64/" "-L/usr/lib/../lib64" "-L/usr/lib/../lib64/" "-L/opt/intel/compilers_and_libraries_2018.0.128/linux/ipp/lib/intel64/" "-L/opt/intel/compilers_and_libraries_2018.0.128/linux/compiler/lib/intel64_lin/" "-L/opt/intel/compilers_and_libraries_2018.0.128/linux/mkl/lib/intel64_lin/" "-L/opt/intel/compilers_and_libraries_2018.0.128/linux/tbb/lib/intel64/gcc4.7/" "-L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../" "-L/lib64" "-L/lib/" "-L/usr/lib64" "-L/usr/lib" "CMakeFiles/cmTC_a5f0a.dir/CMakeCCompilerABI.c.o" "-Bdynamic" "-Bstatic" "-limf" "-lsvml" "-lirng" "-Bdynamic" "-lm" "-Bstatic" "-lipgo" "-ldecimal" "--as-needed" "-Bdynamic" "-lcilkrts" "-lstdc++" "--no-as-needed" "-lgcc" "-lgcc_s" "-Bstatic" "-lirc" "-lsvml" "-Bdynamic" "-lc" "-lgcc" "-lgcc_s" "-Bstatic" "-lirc_s" "-Bdynamic" "-ldl" "-lc" "/usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtend.o" "/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crtn.o"" -mIPOPT_il_in_obj -mIPOPT_ipo_activate_warn=FALSE -mIPOPT_obj_output_file_name=/tmp/ipo_iccYpsdQb.o -mIPOPT_whole_archive_fixup_file_name=/tmp/iccwarchgEXmQo -mGLOB_linker_version=2.27 -mGLOB_driver_tempfile_name=/tmp/icctempfilemNLlCf -mP3OPT_asm_target=P3OPT_ASM_TARGET_GAS -mGLOB_async_unwind_tables=TRUE -mGLOB_obj_output_file=/tmp/ipo_iccYpsdQb.o -mGLOB_source_dialect=GLOB_SOURCE_DIALECT_NONE -mP1OPT_source_file_name=ipo_out.c CMakeFiles/cmTC_a5f0a.dir/CMakeCCompilerABI.c.o -mIPOPT_object_files=T -mIPOPT_assembly_files=/tmp/iccalisRmwrkT -mIPOPT_generated_tempfiles=/tmp/iccelisUgbz4J -mIPOPT_embedded_object_base_name=/tmp/icceobj0agHOA -mIPOPT_cmdline_link_new_name=/tmp/iccllis0qIPyr +ld /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbegin.o -export-dynamic --eh-frame-hdr --build-id -dynamic-linker /lib64/ld-linux-x86-64.so.2 -m elf_x86_64 -o cmTC_a5f0a -L/opt/intel/compilers_and_libraries_2018.0.128/linux/ipp/lib/intel64 -L/opt/intel/compilers_and_libraries_2018.0.128/linux/compiler/lib/intel64_lin -L/opt/intel/compilers_and_libraries_2018.0.128/linux/mkl/lib/intel64_lin -L/opt/intel/compilers_and_libraries_2018.0.128/linux/tbb/lib/intel64/gcc4.7 -L/opt/intel/compilers_and_libraries_2018.0.128/linux/tbb/lib/intel64/gcc4.7 -L/opt/intel/compilers_and_libraries_2018.0.128/linux/compiler/lib/intel64_lin -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/ -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/ -L/lib/../lib64 -L/lib/../lib64/ -L/usr/lib/../lib64 -L/usr/lib/../lib64/ -L/opt/intel/compilers_and_libraries_2018.0.128/linux/ipp/lib/intel64/ -L/opt/intel/compilers_and_libraries_2018.0.128/linux/compiler/lib/intel64_lin/ -L/opt/intel/compilers_and_libraries_2018.0.128/linux/mkl/lib/intel64_lin/ -L/opt/intel/compilers_and_libraries_2018.0.128/linux/tbb/lib/intel64/gcc4.7/ -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../ -L/lib64 -L/lib/ -L/usr/lib64 -L/usr/lib CMakeFiles/cmTC_a5f0a.dir/CMakeCCompilerABI.c.o -Bdynamic -Bstatic -limf -lsvml -lirng -Bdynamic -lm -Bstatic -lipgo -ldecimal --as-needed -Bdynamic -lcilkrts -lstdc++ --no-as-needed -lgcc -lgcc_s -Bstatic -lirc -lsvml -Bdynamic -lc -lgcc -lgcc_s -Bstatic -lirc_s -Bdynamic -ldl -lc /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtend.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crtn.o +gmake[1]: Leaving directory `/tmp/ii/CMakeFiles/CMakeTmp' diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-C-Intel-18.0.0.20170811.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-C-Intel-18.0.0.20170811.output new file mode 100644 index 0000000..ba0269b --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-C-Intel-18.0.0.20170811.output @@ -0,0 +1 @@ +/opt/intel/compilers_and_libraries_2018.0.128/linux/ipp/include;/opt/intel/compilers_and_libraries_2018.0.128/linux/mkl/include;/opt/intel/compilers_and_libraries_2018.0.128/linux/pstl/include;/opt/intel/compilers_and_libraries_2018.0.128/linux/tbb/include;/opt/intel/compilers_and_libraries_2018.0.128/linux/tbb/include;/opt/intel/compilers_and_libraries_2018.0.128/linux/compiler/include/intel64;/opt/intel/compilers_and_libraries_2018.0.128/linux/compiler/include/icc;/opt/intel/compilers_and_libraries_2018.0.128/linux/compiler/include;/usr/local/include;/usr/lib/gcc/x86_64-redhat-linux/4.8.5/include;/usr/include/;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CUDA-NVIDIA-9.2.148.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CUDA-NVIDIA-9.2.148.input new file mode 100644 index 0000000..5dd3650 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CUDA-NVIDIA-9.2.148.input @@ -0,0 +1,124 @@ +CMAKE_LANG=CUDA +CMAKE_CUDA_COMPILER_ABI=ELF +CMAKE_CUDA_COMPILER_AR= +CMAKE_CUDA_COMPILER_ARCHITECTURE_ID= +CMAKE_CUDA_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_CUDA_COMPILER_ID=NVIDIA +CMAKE_CUDA_COMPILER_LAUNCHER= +CMAKE_CUDA_COMPILER_LOADED=1 +CMAKE_CUDA_COMPILER_RANLIB= +CMAKE_CUDA_COMPILER_TARGET= +CMAKE_CUDA_COMPILER_VERSION=9.2.148 +CMAKE_CUDA_COMPILER_VERSION_INTERAL= +Change Dir: /tmp/ii/CMakeFiles/CMakeTmp + +Run Build Command:"/usr/bin/make" "cmTC_5996d/fast" +/usr/bin/make -f CMakeFiles/cmTC_5996d.dir/build.make CMakeFiles/cmTC_5996d.dir/build +make[1]: Entering directory '/tmp/ii/CMakeFiles/CMakeTmp' +Building CUDA object CMakeFiles/cmTC_5996d.dir/CMakeCUDACompilerABI.cu.o +/usr/bin/nvcc -Xcompiler=-v -x cu -c "/tmp/CMake/Modules/CMakeCUDACompilerABI.cu" -o CMakeFiles/cmTC_5996d.dir/CMakeCUDACompilerABI.cu.o +Using built-in specs. +COLLECT_GCC=gcc-5 +Target: x86_64-linux-gnu +Configured with: ../src/configure -v --with-pkgversion='Debian 5.5.0-12' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --enable-objc-gc --enable-multiarch --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu +Thread model: posix +gcc version 5.5.0 20171010 (Debian 5.5.0-12) +COLLECT_GCC_OPTIONS='-std=c++14' '-D' '__CUDA_ARCH__=300' '-E' '-D' 'CUDA_DOUBLE_MATH_FUNCTIONS' '-D' '__CUDACC__' '-D' '__NVCC__' '-v' '-D' '__CUDACC_VER_BUILD__=148' '-D' '__CUDACC_VER_MINOR__=2' '-D' '__CUDACC_VER_MAJOR__=9' '-include' 'cuda_runtime.h' '-m64' '-mtune=generic' '-march=x86-64' + /usr/lib/gcc/x86_64-linux-gnu/5/cc1plus -E -quiet -v -imultiarch x86_64-linux-gnu -D_GNU_SOURCE -D __CUDA_ARCH__=300 -D CUDA_DOUBLE_MATH_FUNCTIONS -D __CUDACC__ -D __NVCC__ -D __CUDACC_VER_BUILD__=148 -D __CUDACC_VER_MINOR__=2 -D __CUDACC_VER_MAJOR__=9 -include cuda_runtime.h /tmp/CMake/Modules/CMakeCUDACompilerABI.cu -m64 -mtune=generic -march=x86-64 -std=c++14 +ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/5" +ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu" +ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/5/../../../../x86_64-linux-gnu/include" +#include "..." search starts here: +#include <...> search starts here: + /usr/include/c++/5 + /usr/include/x86_64-linux-gnu/c++/5 + /usr/include/c++/5/backward + /usr/lib/gcc/x86_64-linux-gnu/5/include + /usr/local/include + /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed + /usr/include/x86_64-linux-gnu + /usr/include +End of search list. +COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/ +LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../:/lib/:/usr/lib/ +COLLECT_GCC_OPTIONS='-std=c++14' '-D' '__CUDA_ARCH__=300' '-E' '-D' 'CUDA_DOUBLE_MATH_FUNCTIONS' '-D' '__CUDACC__' '-D' '__NVCC__' '-v' '-D' '__CUDACC_VER_BUILD__=148' '-D' '__CUDACC_VER_MINOR__=2' '-D' '__CUDACC_VER_MAJOR__=9' '-include' 'cuda_runtime.h' '-m64' '-mtune=generic' '-march=x86-64' +Using built-in specs. +COLLECT_GCC=gcc-5 +Target: x86_64-linux-gnu +Configured with: ../src/configure -v --with-pkgversion='Debian 5.5.0-12' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --enable-objc-gc --enable-multiarch --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu +Thread model: posix +gcc version 5.5.0 20171010 (Debian 5.5.0-12) +COLLECT_GCC_OPTIONS='-std=c++14' '-E' '-D' '__CUDACC__' '-D' '__NVCC__' '-v' '-D' '__CUDACC_VER_BUILD__=148' '-D' '__CUDACC_VER_MINOR__=2' '-D' '__CUDACC_VER_MAJOR__=9' '-include' 'cuda_runtime.h' '-m64' '-mtune=generic' '-march=x86-64' + /usr/lib/gcc/x86_64-linux-gnu/5/cc1plus -E -quiet -v -imultiarch x86_64-linux-gnu -D_GNU_SOURCE -D __CUDACC__ -D __NVCC__ -D __CUDACC_VER_BUILD__=148 -D __CUDACC_VER_MINOR__=2 -D __CUDACC_VER_MAJOR__=9 -include cuda_runtime.h /tmp/CMake/Modules/CMakeCUDACompilerABI.cu -m64 -mtune=generic -march=x86-64 -std=c++14 +ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/5" +ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu" +ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/5/../../../../x86_64-linux-gnu/include" +#include "..." search starts here: +#include <...> search starts here: + /usr/include/c++/5 + /usr/include/x86_64-linux-gnu/c++/5 + /usr/include/c++/5/backward + /usr/lib/gcc/x86_64-linux-gnu/5/include + /usr/local/include + /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed + /usr/include/x86_64-linux-gnu + /usr/include +End of search list. +COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/ +LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../:/lib/:/usr/lib/ +COLLECT_GCC_OPTIONS='-std=c++14' '-E' '-D' '__CUDACC__' '-D' '__NVCC__' '-v' '-D' '__CUDACC_VER_BUILD__=148' '-D' '__CUDACC_VER_MINOR__=2' '-D' '__CUDACC_VER_MAJOR__=9' '-include' 'cuda_runtime.h' '-m64' '-mtune=generic' '-march=x86-64' +Using built-in specs. +COLLECT_GCC=gcc-5 +Target: x86_64-linux-gnu +Configured with: ../src/configure -v --with-pkgversion='Debian 5.5.0-12' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --enable-objc-gc --enable-multiarch --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu +Thread model: posix +gcc version 5.5.0 20171010 (Debian 5.5.0-12) +COLLECT_GCC_OPTIONS='-std=c++14' '-D' '__CUDA_ARCH__=300' '-c' '-D' 'CUDA_DOUBLE_MATH_FUNCTIONS' '-v' '-m64' '-o' 'CMakeFiles/cmTC_5996d.dir/CMakeCUDACompilerABI.cu.o' '-mtune=generic' '-march=x86-64' + /usr/lib/gcc/x86_64-linux-gnu/5/cc1plus -quiet -v -imultiarch x86_64-linux-gnu -D_GNU_SOURCE -D __CUDA_ARCH__=300 -D CUDA_DOUBLE_MATH_FUNCTIONS /tmp/tmpxft_00002df4_00000000-5_CMakeCUDACompilerABI.cudafe1.cpp -quiet -dumpbase tmpxft_00002df4_00000000-5_CMakeCUDACompilerABI.cudafe1.cpp -m64 -mtune=generic -march=x86-64 -auxbase-strip CMakeFiles/cmTC_5996d.dir/CMakeCUDACompilerABI.cu.o -std=c++14 -version -o /tmp/ccSDI00n.s +GNU C++14 (Debian 5.5.0-12) version 5.5.0 20171010 (x86_64-linux-gnu) + compiled by GNU C version 5.5.0 20171010, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0 +warning: MPFR header version 4.0.1 differs from library version 4.0.2-rc1. +GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 +ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/5" +ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu" +ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/5/../../../../x86_64-linux-gnu/include" +#include "..." search starts here: +#include <...> search starts here: + /usr/include/c++/5 + /usr/include/x86_64-linux-gnu/c++/5 + /usr/include/c++/5/backward + /usr/lib/gcc/x86_64-linux-gnu/5/include + /usr/local/include + /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed + /usr/include/x86_64-linux-gnu + /usr/include +End of search list. +GNU C++14 (Debian 5.5.0-12) version 5.5.0 20171010 (x86_64-linux-gnu) + compiled by GNU C version 5.5.0 20171010, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0 +warning: MPFR header version 4.0.1 differs from library version 4.0.2-rc1. +GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 +Compiler executable checksum: 3caa6244fa07ed8a2b405a77ac6cb692 +COLLECT_GCC_OPTIONS='-std=c++14' '-D' '__CUDA_ARCH__=300' '-c' '-D' 'CUDA_DOUBLE_MATH_FUNCTIONS' '-v' '-m64' '-o' 'CMakeFiles/cmTC_5996d.dir/CMakeCUDACompilerABI.cu.o' '-mtune=generic' '-march=x86-64' + as -v --64 -o CMakeFiles/cmTC_5996d.dir/CMakeCUDACompilerABI.cu.o /tmp/ccSDI00n.s +GNU assembler version 2.31.1 (x86_64-linux-gnu) using BFD version (GNU Binutils for Debian) 2.31.1 +COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/ +LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../:/lib/:/usr/lib/ +COLLECT_GCC_OPTIONS='-std=c++14' '-D' '__CUDA_ARCH__=300' '-c' '-D' 'CUDA_DOUBLE_MATH_FUNCTIONS' '-v' '-m64' '-o' 'CMakeFiles/cmTC_5996d.dir/CMakeCUDACompilerABI.cu.o' '-mtune=generic' '-march=x86-64' +Linking CUDA device code CMakeFiles/cmTC_5996d.dir/cmake_device_link.o +"/tmp/CMake/bin/cmake" -E cmake_link_script CMakeFiles/cmTC_5996d.dir/dlink.txt --verbose=1 +/usr/bin/nvcc -Xcompiler=-fPIC -Wno-deprecated-gpu-targets -shared -dlink CMakeFiles/cmTC_5996d.dir/CMakeCUDACompilerABI.cu.o -o CMakeFiles/cmTC_5996d.dir/cmake_device_link.o -L"/usr/lib/x86_64-linux-gnu" +Linking CUDA executable cmTC_5996d +"/tmp/CMake/bin/cmake" -E cmake_link_script CMakeFiles/cmTC_5996d.dir/link.txt --verbose=1 +/usr/lib/nvidia-cuda-toolkit/bin/g++ -v CMakeFiles/cmTC_5996d.dir/CMakeCUDACompilerABI.cu.o CMakeFiles/cmTC_5996d.dir/cmake_device_link.o -o cmTC_5996d -L"/usr/lib/x86_64-linux-gnu/stubs" -lcudadevrt -lcudart_static -lrt -lpthread -ldl +Using built-in specs. +COLLECT_GCC=g++-5 +COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper +Target: x86_64-linux-gnu +Configured with: ../src/configure -v --with-pkgversion='Debian 5.5.0-12' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --enable-objc-gc --enable-multiarch --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu +Thread model: posix +gcc version 5.5.0 20171010 (Debian 5.5.0-12) +COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/ +LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../:/lib/:/usr/lib/ +COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_5996d' '-L/usr/lib/x86_64-linux-gnu/stubs' '-shared-libgcc' '-mtune=generic' '-march=x86-64' + /usr/lib/gcc/x86_64-linux-gnu/5/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/5/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper -plugin-opt=-fresolution=/tmp/cc85GscA.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --sysroot=/ --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o cmTC_5996d /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/5/crtbegin.o -L/usr/lib/x86_64-linux-gnu/stubs -L/usr/lib/gcc/x86_64-linux-gnu/5 -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/5/../../.. CMakeFiles/cmTC_5996d.dir/CMakeCUDACompilerABI.cu.o CMakeFiles/cmTC_5996d.dir/cmake_device_link.o -lcudadevrt -lcudart_static -lrt -lpthread -ldl -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/5/crtend.o /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crtn.o +make[1]: Leaving directory '/tmp/ii/CMakeFiles/CMakeTmp' diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CUDA-NVIDIA-9.2.148.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CUDA-NVIDIA-9.2.148.output new file mode 100644 index 0000000..4f49cd1 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CUDA-NVIDIA-9.2.148.output @@ -0,0 +1 @@ +/usr/include/c++/5;/usr/include/x86_64-linux-gnu/c++/5;/usr/include/c++/5/backward;/usr/lib/gcc/x86_64-linux-gnu/5/include;/usr/local/include;/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed;/usr/include/x86_64-linux-gnu;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-GNU-7.3.0.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-GNU-7.3.0.input new file mode 100644 index 0000000..633a0ef --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-GNU-7.3.0.input @@ -0,0 +1,76 @@ +CMAKE_LANG=CXX +CMAKE_CXX_COMPILER_ABI=ELF +CMAKE_CXX_COMPILER_AR=/usr/bin/gcc-ar-7 +CMAKE_CXX_COMPILER_ARCHITECTURE_ID= +CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_CXX_COMPILER_ID=GNU +CMAKE_CXX_COMPILER_LAUNCHER= +CMAKE_CXX_COMPILER_LOADED=1 +CMAKE_CXX_COMPILER_RANLIB=/usr/bin/gcc-ranlib-7 +CMAKE_CXX_COMPILER_TARGET= +CMAKE_CXX_COMPILER_VERSION=7.3.0 +CMAKE_CXX_COMPILER_VERSION_INTERAL= +Change Dir: /tmp/ii/CMakeFiles/CMakeTmp + +Run Build Command:"/usr/bin/make" "cmTC_63146/fast" +/usr/bin/make -f CMakeFiles/cmTC_63146.dir/build.make CMakeFiles/cmTC_63146.dir/build +make[1]: Entering directory '/tmp/ii/CMakeFiles/CMakeTmp' +Building CXX object CMakeFiles/cmTC_63146.dir/CMakeCXXCompilerABI.cpp.o +/usr/bin/c++ -v -o CMakeFiles/cmTC_63146.dir/CMakeCXXCompilerABI.cpp.o -c /usr/share/cmake-3.10/Modules/CMakeCXXCompilerABI.cpp +Using built-in specs. +COLLECT_GCC=/usr/bin/c++ +OFFLOAD_TARGET_NAMES=nvptx-none +OFFLOAD_TARGET_DEFAULT=1 +Target: x86_64-linux-gnu +Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.3.0-27ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu +Thread model: posix +gcc version 7.3.0 (Ubuntu 7.3.0-27ubuntu1~18.04) +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_63146.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' + /usr/lib/gcc/x86_64-linux-gnu/7/cc1plus -quiet -v -imultiarch x86_64-linux-gnu -D_GNU_SOURCE /usr/share/cmake-3.10/Modules/CMakeCXXCompilerABI.cpp -quiet -dumpbase CMakeCXXCompilerABI.cpp -mtune=generic -march=x86-64 -auxbase-strip CMakeFiles/cmTC_63146.dir/CMakeCXXCompilerABI.cpp.o -version -fstack-protector-strong -Wformat -Wformat-security -o /tmp/ccXqnn3f.s +GNU C++14 (Ubuntu 7.3.0-27ubuntu1~18.04) version 7.3.0 (x86_64-linux-gnu) + compiled by GNU C version 7.3.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version isl-0.19-GMP + +GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 +ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/7" +ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu" +ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/7/../../../../x86_64-linux-gnu/include" +#include "..." search starts here: +#include <...> search starts here: + /usr/include/c++/7 + /usr/include/x86_64-linux-gnu/c++/7 + /usr/include/c++/7/backward + /usr/lib/gcc/x86_64-linux-gnu/7/include + /usr/local/include + /usr/lib/gcc/x86_64-linux-gnu/7/include-fixed + /usr/include/x86_64-linux-gnu + /usr/include +End of search list. +GNU C++14 (Ubuntu 7.3.0-27ubuntu1~18.04) version 7.3.0 (x86_64-linux-gnu) + compiled by GNU C version 7.3.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version isl-0.19-GMP + +GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 +Compiler executable checksum: 1bfae38ae5df64de6196cbd8c3b07d86 +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_63146.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' + as -v --64 -o CMakeFiles/cmTC_63146.dir/CMakeCXXCompilerABI.cpp.o /tmp/ccXqnn3f.s +GNU assembler version 2.30 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.30 +COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/ +LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/7/../../../:/lib/:/usr/lib/ +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_63146.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' +Linking CXX executable cmTC_63146 +/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_63146.dir/link.txt --verbose=1 +/usr/bin/c++ -v -rdynamic CMakeFiles/cmTC_63146.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_63146 +Using built-in specs. +COLLECT_GCC=/usr/bin/c++ +COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper +OFFLOAD_TARGET_NAMES=nvptx-none +OFFLOAD_TARGET_DEFAULT=1 +Target: x86_64-linux-gnu +Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.3.0-27ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu +Thread model: posix +gcc version 7.3.0 (Ubuntu 7.3.0-27ubuntu1~18.04) +COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/ +LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/7/../../../:/lib/:/usr/lib/ +COLLECT_GCC_OPTIONS='-v' '-rdynamic' '-o' 'cmTC_63146' '-shared-libgcc' '-mtune=generic' '-march=x86-64' + /usr/lib/gcc/x86_64-linux-gnu/7/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/7/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper -plugin-opt=-fresolution=/tmp/cca3NVun.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --sysroot=/ --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o cmTC_63146 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/7/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/7 -L/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/7/../../.. CMakeFiles/cmTC_63146.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/7/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crtn.o +COLLECT_GCC_OPTIONS='-v' '-rdynamic' '-o' 'cmTC_63146' '-shared-libgcc' '-mtune=generic' '-march=x86-64' +make[1]: Leaving directory '/tmp/ii/CMakeFiles/CMakeTmp' diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-GNU-7.3.0.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-GNU-7.3.0.output new file mode 100644 index 0000000..6f5d071 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-GNU-7.3.0.output @@ -0,0 +1 @@ +/usr/include/c++/7;/usr/include/x86_64-linux-gnu/c++/7;/usr/include/c++/7/backward;/usr/lib/gcc/x86_64-linux-gnu/7/include;/usr/local/include;/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed;/usr/include/x86_64-linux-gnu;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-Intel-18.0.0.20170811.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-Intel-18.0.0.20170811.input new file mode 100644 index 0000000..22d8715 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-Intel-18.0.0.20170811.input @@ -0,0 +1,46 @@ +CMAKE_LANG=CXX +CMAKE_CXX_COMPILER_ABI=ELF +CMAKE_CXX_COMPILER_AR= +CMAKE_CXX_COMPILER_ARCHITECTURE_ID= +CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_CXX_COMPILER_ID=Intel +CMAKE_CXX_COMPILER_LAUNCHER= +CMAKE_CXX_COMPILER_LOADED=1 +CMAKE_CXX_COMPILER_RANLIB= +CMAKE_CXX_COMPILER_TARGET= +CMAKE_CXX_COMPILER_VERSION=18.0.0.20170811 +CMAKE_CXX_COMPILER_VERSION_INTERAL= +Change Dir: /tmp/ii/CMakeFiles/CMakeTmp + +Run Build Command:"/usr/bin/gmake" "cmTC_d768a/fast" +/usr/bin/gmake -f CMakeFiles/cmTC_d768a.dir/build.make CMakeFiles/cmTC_d768a.dir/build +gmake[1]: Entering directory `/tmp/ii/CMakeFiles/CMakeTmp' +Building CXX object CMakeFiles/cmTC_d768a.dir/CMakeCXXCompilerABI.cpp.o +/opt/intel/compilers_and_libraries_2018.0.128/linux/bin/intel64/icpc -v -o CMakeFiles/cmTC_d768a.dir/CMakeCXXCompilerABI.cpp.o -c /tmp/CMake/Modules/CMakeCXXCompilerABI.cpp +icpc version 18.0.0 (gcc version 4.8.5 compatibility) +/opt/intel/compilers_and_libraries_2018.0.128/linux/bin/intel64/mcpcom --target_efi2 --lang=c++ -_g -mP3OPT_inline_alloca -D__ICC=1800 -D__INTEL_COMPILER=1800 -D__INTEL_COMPILER_UPDATE=0 -D__PTRDIFF_TYPE__=long "-D__SIZE_TYPE__=unsigned long" -D__WCHAR_TYPE__=int "-D__WINT_TYPE__=unsigned int" "-D__INTMAX_TYPE__=long int" "-D__UINTMAX_TYPE__=long unsigned int" -D__LONG_MAX__=9223372036854775807L -D__QMSPP_ -D__OPTIMIZE__ -D__NO_MATH_INLINES -D__NO_STRING_INLINES -D__GNUC_GNU_INLINE__ -D__GNUG__=4 -D__GNUC__=4 -D__GNUC_MINOR__=8 -D__GNUC_PATCHLEVEL__=5 -D__LP64__ -D_LP64 -D_GNU_SOURCE=1 -D__DEPRECATED=1 -D__GXX_WEAK__=1 -D__GXX_ABI_VERSION=1002 "-D__USER_LABEL_PREFIX__= " -D__REGISTER_PREFIX__= -D__INTEL_RTTI__ -D__EXCEPTIONS=1 -D__unix__ -D__unix -D__linux__ -D__linux -D__gnu_linux__ -B -Dunix -Dlinux "-_Asystem(unix)" -D__ELF__ -D__x86_64 -D__x86_64__ -D__amd64 -D__amd64__ "-_Acpu(x86_64)" "-_Amachine(x86_64)" -D__INTEL_COMPILER_BUILD_DATE=20170811 -D__INTEL_OFFLOAD -D__i686 -D__i686__ -D__pentiumpro -D__pentiumpro__ -D__pentium4 -D__pentium4__ -D__tune_pentium4__ -D__SSE2__ -D__SSE2_MATH__ -D__SSE__ -D__SSE_MATH__ -D__MMX__ -_k -_8 -_l --has_new_stdarg_support -_a -_b --gnu_version=40805 -_W5 --gcc-extern-inline -p --bool -tused -x --multibyte_chars -mGLOB_diag_suppress_sys --system_preinclude /usr/include/stdc-predef.h --array_section --simd --simd_func --offload_mode=1 --offload_target_names=gfx,GFX,mic,MIC --offload_unique_string=icpc1792177319iuY4UR --bool -mGLOB_em64t=TRUE -mP1OPT_version=18.0-intel64 -mGLOB_diag_file=CMakeFiles/cmTC_d768a.dir/CMakeCXXCompilerABI.cpp.diag -mGLOB_long_size_64 -mGLOB_routine_pointer_size_64 -mP1OPT_print_version=FALSE -mCG_use_gas_got_workaround=F -mP2OPT_align_option_used=TRUE -mGLOB_gcc_version=485 "-mGLOB_options_string=-v -o CMakeFiles/cmTC_d768a.dir/CMakeCXXCompilerABI.cpp.o -c" -mGLOB_cxx_limited_range=FALSE -mCG_extend_parms=FALSE -mGLOB_compiler_bin_directory=/opt/intel/compilers_and_libraries_2018.0.128/linux/bin/intel64 -mGLOB_as_output_backup_file_name=/tmp/icpcv8rR8Aas_.s -mIPOPT_activate -mIPOPT_lite -mGLOB_instruction_tuning=0x0 -mGLOB_uarch_tuning=0x0 -mGLOB_product_id_code=0x22006d8f -mCG_bnl_movbe=T -mGLOB_extended_instructions=0x8 -mP3OPT_use_mspp_call_convention -mP2OPT_subs_out_of_bound=FALSE -mP2OPT_disam_type_based_disam=2 -mP2OPT_disam_assume_ansi_c -mP2OPT_checked_disam_ansi_alias=TRUE -mGLOB_ansi_alias -mPGOPTI_value_profile_use=T -mP2OPT_il0_array_sections=TRUE -mGLOB_offload_mode=1 -mP2OPT_offload_unique_var_string=icpc1792177319iuY4UR -mP2OPT_hlo_level=2 -mP2OPT_hlo -mP2OPT_hpo_rtt_control=0 -mIPOPT_args_in_regs=0 -mP2OPT_disam_assume_nonstd_intent_in=FALSE -mGLOB_imf_mapping_library=/opt/intel/compilers_and_libraries_2018.0.128/linux/bin/intel64/libiml_attr.so -mPGOPTI_gen_threadsafe_level=0 -mIPOPT_lto_object_enabled -mIPOPT_lto_object_value=1 -mIPOPT_obj_output_file_name=CMakeFiles/cmTC_d768a.dir/CMakeCXXCompilerABI.cpp.o -mIPOPT_whole_archive_fixup_file_name=/tmp/icpcwarchqQRwIj -mGLOB_linker_version=2.27 -mGLOB_driver_tempfile_name=/tmp/icpctempfilekXiB0a -mP3OPT_asm_target=P3OPT_ASM_TARGET_GAS -mGLOB_async_unwind_tables=TRUE -mGLOB_obj_output_file=CMakeFiles/cmTC_d768a.dir/CMakeCXXCompilerABI.cpp.o -mGLOB_source_dialect=GLOB_SOURCE_DIALECT_C_PLUS_PLUS -mP1OPT_source_file_name=/tmp/CMake/Modules/CMakeCXXCompilerABI.cpp -mP1OPT_full_source_file_name=/tmp/CMake/Modules/CMakeCXXCompilerABI.cpp -mGLOB_eh_linux /tmp/CMake/Modules/CMakeCXXCompilerABI.cpp +#include "..." search starts here: +#include <...> search starts here: + /opt/intel/compilers_and_libraries_2018.0.128/linux/ipp/include + /opt/intel/compilers_and_libraries_2018.0.128/linux/mkl/include + /opt/intel/compilers_and_libraries_2018.0.128/linux/pstl/include + /opt/intel/compilers_and_libraries_2018.0.128/linux/tbb/include + /opt/intel/compilers_and_libraries_2018.0.128/linux/tbb/include + /opt/intel/compilers_and_libraries_2018.0.128/linux/compiler/include/intel64 + /opt/intel/compilers_and_libraries_2018.0.128/linux/compiler/include/icc + /opt/intel/compilers_and_libraries_2018.0.128/linux/compiler/include + /usr/include/c++/4.8.5 + /usr/include/c++/4.8.5/x86_64-redhat-linux + /usr/include/c++/4.8.5/backward + /usr/local/include + /usr/lib/gcc/x86_64-redhat-linux/4.8.5/include + /usr/include/ + /usr/include +End of search list. +Linking CXX executable cmTC_d768a +/tmp/CMake/bin/cmake -E cmake_link_script CMakeFiles/cmTC_d768a.dir/link.txt --verbose=1 +/opt/intel/compilers_and_libraries_2018.0.128/linux/bin/intel64/icpc -v -rdynamic CMakeFiles/cmTC_d768a.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_d768a +icpc version 18.0.0 (gcc version 4.8.5 compatibility) +/opt/intel/compilers_and_libraries_2018.0.128/linux/bin/intel64/mcpcom -mGLOB_em64t=TRUE -mP1OPT_version=18.0-intel64 -mGLOB_diag_file=CMakeFiles/cmTC_d768a.dir/CMakeCXXCompilerABI.cpp.diag -mGLOB_long_size_64 -mGLOB_routine_pointer_size_64 -mP1OPT_print_version=FALSE -mCG_use_gas_got_workaround=F -mP2OPT_align_option_used=TRUE -mGLOB_gcc_version=485 "-mGLOB_options_string=-v -rdynamic -o cmTC_d768a" -mGLOB_cxx_limited_range=FALSE -mCG_extend_parms=FALSE -mGLOB_compiler_bin_directory=/opt/intel/compilers_and_libraries_2018.0.128/linux/bin/intel64 -mGLOB_as_output_backup_file_name=/tmp/icpczjpPCuas_.s -mGLOB_dashboard_use_source_name -mIPOPT_activate -mGLOB_product_id_code=0x22006d8f -mP3OPT_use_mspp_call_convention -mP2OPT_subs_out_of_bound=FALSE -mP2OPT_disam_type_based_disam=2 -mP2OPT_disam_assume_ansi_c -mP2OPT_checked_disam_ansi_alias=TRUE -mGLOB_ansi_alias -mPGOPTI_value_profile_use=T -mGLOB_opt_report_use_source_name -mP2OPT_il0_array_sections=TRUE -mGLOB_offload_mode=1 -mP2OPT_offload_unique_var_string=icpc1401760296yQqGc2 -mP2OPT_hlo -mP2OPT_hpo_rtt_control=0 -mIPOPT_args_in_regs=0 -mP2OPT_disam_assume_nonstd_intent_in=FALSE -mGLOB_imf_mapping_library=/opt/intel/compilers_and_libraries_2018.0.128/linux/bin/intel64/libiml_attr.so -mPGOPTI_gen_threadsafe_level=0 -mIPOPT_link -mIPOPT_ipo_activate -mIPOPT_mo_activate -mIPOPT_source_files_list=/tmp/icpcslis4PdBUT -mIPOPT_mo_global_data -mIPOPT_link_script_file=/tmp/icpcscript0uzJtL "-mIPOPT_cmdline_link="/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crt1.o" "/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crti.o" "/usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbegin.o" "-export-dynamic" "--eh-frame-hdr" "--build-id" "-dynamic-linker" "/lib64/ld-linux-x86-64.so.2" "-m" "elf_x86_64" "-o" "cmTC_d768a" "-L/opt/intel/compilers_and_libraries_2018.0.128/linux/ipp/lib/intel64" "-L/opt/intel/compilers_and_libraries_2018.0.128/linux/compiler/lib/intel64_lin" "-L/opt/intel/compilers_and_libraries_2018.0.128/linux/mkl/lib/intel64_lin" "-L/opt/intel/compilers_and_libraries_2018.0.128/linux/tbb/lib/intel64/gcc4.7" "-L/opt/intel/compilers_and_libraries_2018.0.128/linux/tbb/lib/intel64/gcc4.7" "-L/opt/intel/compilers_and_libraries_2018.0.128/linux/compiler/lib/intel64_lin" "-L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/" "-L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64" "-L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/" "-L/lib/../lib64" "-L/lib/../lib64/" "-L/usr/lib/../lib64" "-L/usr/lib/../lib64/" "-L/opt/intel/compilers_and_libraries_2018.0.128/linux/ipp/lib/intel64/" "-L/opt/intel/compilers_and_libraries_2018.0.128/linux/compiler/lib/intel64_lin/" "-L/opt/intel/compilers_and_libraries_2018.0.128/linux/mkl/lib/intel64_lin/" "-L/opt/intel/compilers_and_libraries_2018.0.128/linux/tbb/lib/intel64/gcc4.7/" "-L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../" "-L/lib64" "-L/lib/" "-L/usr/lib64" "-L/usr/lib" "CMakeFiles/cmTC_d768a.dir/CMakeCXXCompilerABI.cpp.o" "-Bdynamic" "-Bstatic" "-limf" "-lsvml" "-lirng" "-Bdynamic" "-lstdc++" "-lm" "-Bstatic" "-lipgo" "-ldecimal" "--as-needed" "-Bdynamic" "-lcilkrts" "--no-as-needed" "-lstdc++" "-lgcc" "-lgcc_s" "-Bstatic" "-lirc" "-lsvml" "-Bdynamic" "-lc" "-lgcc" "-lgcc_s" "-Bstatic" "-lirc_s" "-Bdynamic" "-ldl" "-lc" "/usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtend.o" "/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crtn.o"" -mIPOPT_il_in_obj -mIPOPT_ipo_activate_warn=FALSE -mIPOPT_obj_output_file_name=/tmp/ipo_icpcGEmWvI.o -mIPOPT_whole_archive_fixup_file_name=/tmp/icpcwarchvs7jo5 -mGLOB_linker_version=2.27 -mGLOB_driver_tempfile_name=/tmp/icpctempfileQPMrZW -mP3OPT_asm_target=P3OPT_ASM_TARGET_GAS -mGLOB_async_unwind_tables=TRUE -mGLOB_obj_output_file=/tmp/ipo_icpcGEmWvI.o -mGLOB_source_dialect=GLOB_SOURCE_DIALECT_NONE -mP1OPT_source_file_name=ipo_out.c CMakeFiles/cmTC_d768a.dir/CMakeCXXCompilerABI.cpp.o -mIPOPT_object_files=T -mIPOPT_assembly_files=/tmp/icpcalisfym8Dr -mIPOPT_generated_tempfiles=/tmp/icpcelisfz0edj -mIPOPT_embedded_object_base_name=/tmp/icpceobjS73lMa -mIPOPT_cmdline_link_new_name=/tmp/icpcllisTgrtl2 +ld /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbegin.o -export-dynamic --eh-frame-hdr --build-id -dynamic-linker /lib64/ld-linux-x86-64.so.2 -m elf_x86_64 -o cmTC_d768a -L/opt/intel/compilers_and_libraries_2018.0.128/linux/ipp/lib/intel64 -L/opt/intel/compilers_and_libraries_2018.0.128/linux/compiler/lib/intel64_lin -L/opt/intel/compilers_and_libraries_2018.0.128/linux/mkl/lib/intel64_lin -L/opt/intel/compilers_and_libraries_2018.0.128/linux/tbb/lib/intel64/gcc4.7 -L/opt/intel/compilers_and_libraries_2018.0.128/linux/tbb/lib/intel64/gcc4.7 -L/opt/intel/compilers_and_libraries_2018.0.128/linux/compiler/lib/intel64_lin -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/ -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/ -L/lib/../lib64 -L/lib/../lib64/ -L/usr/lib/../lib64 -L/usr/lib/../lib64/ -L/opt/intel/compilers_and_libraries_2018.0.128/linux/ipp/lib/intel64/ -L/opt/intel/compilers_and_libraries_2018.0.128/linux/compiler/lib/intel64_lin/ -L/opt/intel/compilers_and_libraries_2018.0.128/linux/mkl/lib/intel64_lin/ -L/opt/intel/compilers_and_libraries_2018.0.128/linux/tbb/lib/intel64/gcc4.7/ -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../ -L/lib64 -L/lib/ -L/usr/lib64 -L/usr/lib CMakeFiles/cmTC_d768a.dir/CMakeCXXCompilerABI.cpp.o -Bdynamic -Bstatic -limf -lsvml -lirng -Bdynamic -lstdc++ -lm -Bstatic -lipgo -ldecimal --as-needed -Bdynamic -lcilkrts --no-as-needed -lstdc++ -lgcc -lgcc_s -Bstatic -lirc -lsvml -Bdynamic -lc -lgcc -lgcc_s -Bstatic -lirc_s -Bdynamic -ldl -lc /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtend.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crtn.o +gmake[1]: Leaving directory `/tmp/ii/CMakeFiles/CMakeTmp' diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-Intel-18.0.0.20170811.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-Intel-18.0.0.20170811.output new file mode 100644 index 0000000..56d2b9f --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-Intel-18.0.0.20170811.output @@ -0,0 +1 @@ +/opt/intel/compilers_and_libraries_2018.0.128/linux/ipp/include;/opt/intel/compilers_and_libraries_2018.0.128/linux/mkl/include;/opt/intel/compilers_and_libraries_2018.0.128/linux/pstl/include;/opt/intel/compilers_and_libraries_2018.0.128/linux/tbb/include;/opt/intel/compilers_and_libraries_2018.0.128/linux/tbb/include;/opt/intel/compilers_and_libraries_2018.0.128/linux/compiler/include/intel64;/opt/intel/compilers_and_libraries_2018.0.128/linux/compiler/include/icc;/opt/intel/compilers_and_libraries_2018.0.128/linux/compiler/include;/usr/include/c++/4.8.5;/usr/include/c++/4.8.5/x86_64-redhat-linux;/usr/include/c++/4.8.5/backward;/usr/local/include;/usr/lib/gcc/x86_64-redhat-linux/4.8.5/include;/usr/include/;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/mingw.org-C-GNU-4.9.3.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/mingw.org-C-GNU-4.9.3.input new file mode 100644 index 0000000..df96c59 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/mingw.org-C-GNU-4.9.3.input @@ -0,0 +1,70 @@ +CMAKE_LANG=C +CMAKE_C_COMPILER_ABI= +CMAKE_C_COMPILER_AR=C:/MinGW/bin/gcc-ar.exe +CMAKE_C_COMPILER_ARCHITECTURE_ID= +CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_C_COMPILER_ID=GNU +CMAKE_C_COMPILER_LAUNCHER= +CMAKE_C_COMPILER_LOADED=1 +CMAKE_C_COMPILER_RANLIB=C:/MinGW/bin/gcc-ranlib.exe +CMAKE_C_COMPILER_TARGET= +CMAKE_C_COMPILER_VERSION=4.9.3 +CMAKE_C_COMPILER_VERSION_INTERAL= +Change Dir: C:/tmp/ii/CMakeFiles/CMakeTmp + +Run Build Command:"C:/MinGW/bin/mingw32-make.exe" "cmTC_ab097/fast" +C:/MinGW/bin/mingw32-make.exe -f CMakeFiles\cmTC_ab097.dir\build.make CMakeFiles/cmTC_ab097.dir/build +mingw32-make.exe[1]: Entering directory 'C:/tmp/ii/CMakeFiles/CMakeTmp' +Building C object CMakeFiles/cmTC_ab097.dir/CMakeCCompilerABI.c.obj +C:\MinGW\bin\gcc.exe -v -o CMakeFiles\cmTC_ab097.dir\CMakeCCompilerABI.c.obj -c "C:\CMake\Modules\CMakeCCompilerABI.c" +Using built-in specs. +COLLECT_GCC=C:\MinGW\bin\gcc.exe +Target: mingw32 +Configured with: ../src/gcc-4.9.3/configure --build=x86_64-pc-linux-gnu --host=mingw32 --prefix=/mingw --disable-win32-registry --target=mingw32 --with-arch=i586 --enable-languages=c,c++,objc,obj-c++,fortran,ada --enable-static --enable-shared --enable-threads --with-dwarf2 --disable-sjlj-exceptions --enable-version-specific-runtime-libs --enable-libstdcxx-debug --with-tune=generic --enable-nls +Thread model: win32 +gcc version 4.9.3 (GCC) +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles\cmTC_ab097.dir\CMakeCCompilerABI.c.obj' '-c' '-mtune=generic' '-march=i586' + c:/mingw/bin/../libexec/gcc/mingw32/4.9.3/cc1.exe -quiet -v -iprefix c:\mingw\bin\../lib/gcc/mingw32/4.9.3/ C:\CMake\Modules\CMakeCCompilerABI.c -quiet -dumpbase CMakeCCompilerABI.c -mtune=generic -march=i586 -auxbase-strip CMakeFiles\cmTC_ab097.dir\CMakeCCompilerABI.c.obj -version -o C:\Users\DASHBO~1\AppData\Local\Temp\ccKRBU4I.s +GNU C (GCC) version 4.9.3 (mingw32) + compiled by GNU C version 4.9.3, GMP version 5.1.2, MPFR version 3.1.2, MPC version 1.0.2 +GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 +ignoring nonexistent directory "c:\mingw\bin\../lib/gcc/mingw32/4.9.3/../../../../mingw32/include" +ignoring duplicate directory "c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.9.3/include" +ignoring duplicate directory "/mingw/lib/gcc/mingw32/4.9.3/../../../../include" +ignoring duplicate directory "c:/mingw/lib/gcc/../../include" +ignoring duplicate directory "c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.9.3/include-fixed" +ignoring nonexistent directory "c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.9.3/../../../../mingw32/include" +ignoring duplicate directory "/mingw/include" +#include "..." search starts here: +#include <...> search starts here: + c:\mingw\bin\../lib/gcc/mingw32/4.9.3/include + c:\mingw\bin\../lib/gcc/mingw32/4.9.3/../../../../include + c:\mingw\bin\../lib/gcc/mingw32/4.9.3/include-fixed +End of search list. +GNU C (GCC) version 4.9.3 (mingw32) + compiled by GNU C version 4.9.3, GMP version 5.1.2, MPFR version 3.1.2, MPC version 1.0.2 +GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 +Compiler executable checksum: 32bccaa1a45d39107471fe656e1c3cd5 +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles\cmTC_ab097.dir\CMakeCCompilerABI.c.obj' '-c' '-mtune=generic' '-march=i586' + c:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../../../mingw32/bin/as.exe -v -o CMakeFiles\cmTC_ab097.dir\CMakeCCompilerABI.c.obj C:\Users\DASHBO~1\AppData\Local\Temp\ccKRBU4I.s +GNU assembler version 2.25.1 (mingw32) using BFD version (GNU Binutils) 2.25.1 +COMPILER_PATH=c:/mingw/bin/../libexec/gcc/mingw32/4.9.3/;c:/mingw/bin/../libexec/gcc/;c:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../../../mingw32/bin/ +LIBRARY_PATH=c:/mingw/bin/../lib/gcc/mingw32/4.9.3/;c:/mingw/bin/../lib/gcc/;c:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../../../mingw32/lib/;c:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../../ +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles\cmTC_ab097.dir\CMakeCCompilerABI.c.obj' '-c' '-mtune=generic' '-march=i586' +Linking C executable cmTC_ab097.exe +"C:\CMake\bin\cmake.exe" -E cmake_link_script CMakeFiles\cmTC_ab097.dir\link.txt --verbose=1 +"C:\CMake\bin\cmake.exe" -E remove -f CMakeFiles\cmTC_ab097.dir/objects.a +C:\MinGW\bin\ar.exe cr CMakeFiles\cmTC_ab097.dir/objects.a @CMakeFiles\cmTC_ab097.dir\objects1.rsp +C:\MinGW\bin\gcc.exe -v -Wl,--whole-archive CMakeFiles\cmTC_ab097.dir/objects.a -Wl,--no-whole-archive -o cmTC_ab097.exe -Wl,--out-implib,libcmTC_ab097.dll.a -Wl,--major-image-version,0,--minor-image-version,0 +Using built-in specs. +COLLECT_GCC=C:\MinGW\bin\gcc.exe +COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/4.9.3/lto-wrapper.exe +Target: mingw32 +Configured with: ../src/gcc-4.9.3/configure --build=x86_64-pc-linux-gnu --host=mingw32 --prefix=/mingw --disable-win32-registry --target=mingw32 --with-arch=i586 --enable-languages=c,c++,objc,obj-c++,fortran,ada --enable-static --enable-shared --enable-threads --with-dwarf2 --disable-sjlj-exceptions --enable-version-specific-runtime-libs --enable-libstdcxx-debug --with-tune=generic --enable-nls +Thread model: win32 +gcc version 4.9.3 (GCC) +COMPILER_PATH=c:/mingw/bin/../libexec/gcc/mingw32/4.9.3/;c:/mingw/bin/../libexec/gcc/;c:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../../../mingw32/bin/ +LIBRARY_PATH=c:/mingw/bin/../lib/gcc/mingw32/4.9.3/;c:/mingw/bin/../lib/gcc/;c:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../../../mingw32/lib/;c:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../../ +COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_ab097.exe' '-mtune=generic' '-march=i586' + c:/mingw/bin/../libexec/gcc/mingw32/4.9.3/collect2.exe -plugin c:/mingw/bin/../libexec/gcc/mingw32/4.9.3/liblto_plugin-0.dll -plugin-opt=c:/mingw/bin/../libexec/gcc/mingw32/4.9.3/lto-wrapper.exe -plugin-opt=-fresolution=C:\Users\DASHBO~1\AppData\Local\Temp\ccEGcsW8.res -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_eh -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -plugin-opt=-pass-through=-ladvapi32 -plugin-opt=-pass-through=-lshell32 -plugin-opt=-pass-through=-luser32 -plugin-opt=-pass-through=-lkernel32 -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_eh -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -Bdynamic -o cmTC_ab097.exe c:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../../crt2.o c:/mingw/bin/../lib/gcc/mingw32/4.9.3/crtbegin.o -Lc:/mingw/bin/../lib/gcc/mingw32/4.9.3 -Lc:/mingw/bin/../lib/gcc -Lc:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../../../mingw32/lib -Lc:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../.. --whole-archive CMakeFiles\cmTC_ab097.dir/objects.a --no-whole-archive --out-implib libcmTC_ab097.dll.a --major-image-version 0 --minor-image-version 0 -lmingw32 -lgcc -lgcc_eh -lmoldname -lmingwex -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc -lgcc_eh -lmoldname -lmingwex -lmsvcrt c:/mingw/bin/../lib/gcc/mingw32/4.9.3/crtend.o +mingw32-make.exe[1]: Leaving directory 'C:/tmp/ii/CMakeFiles/CMakeTmp' diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/mingw.org-C-GNU-4.9.3.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/mingw.org-C-GNU-4.9.3.output new file mode 100644 index 0000000..cdfb8b2 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/mingw.org-C-GNU-4.9.3.output @@ -0,0 +1 @@ +c:/mingw/bin/../lib/gcc/mingw32/4.9.3/include;c:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../../../include;c:/mingw/bin/../lib/gcc/mingw32/4.9.3/include-fixed diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/mingw.org-CXX-GNU-4.9.3.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/mingw.org-CXX-GNU-4.9.3.input new file mode 100644 index 0000000..ba44889 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/mingw.org-CXX-GNU-4.9.3.input @@ -0,0 +1,76 @@ +CMAKE_LANG=CXX +CMAKE_CXX_COMPILER_ABI=ELF +CMAKE_CXX_COMPILER_AR=C:/MinGW/bin/gcc-ar.exe +CMAKE_CXX_COMPILER_ARCHITECTURE_ID= +CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_CXX_COMPILER_ID=GNU +CMAKE_CXX_COMPILER_LAUNCHER= +CMAKE_CXX_COMPILER_LOADED=1 +CMAKE_CXX_COMPILER_RANLIB=C:/MinGW/bin/gcc-ranlib.exe +CMAKE_CXX_COMPILER_TARGET= +CMAKE_CXX_COMPILER_VERSION=4.9.3 +CMAKE_CXX_COMPILER_VERSION_INTERAL= +Change Dir: C:/tmp/ii/CMakeFiles/CMakeTmp + +Run Build Command:"C:/MinGW/bin/mingw32-make.exe" "cmTC_2b790/fast" +C:/MinGW/bin/mingw32-make.exe -f CMakeFiles\cmTC_2b790.dir\build.make CMakeFiles/cmTC_2b790.dir/build +mingw32-make.exe[1]: Entering directory 'C:/tmp/ii/CMakeFiles/CMakeTmp' +Building CXX object CMakeFiles/cmTC_2b790.dir/CMakeCXXCompilerABI.cpp.obj +C:\MinGW\bin\g++.exe -v -o CMakeFiles\cmTC_2b790.dir\CMakeCXXCompilerABI.cpp.obj -c "C:\CMake\Modules\CMakeCXXCompilerABI.cpp" +Using built-in specs. +COLLECT_GCC=C:\MinGW\bin\g++.exe +Target: mingw32 +Configured with: ../src/gcc-4.9.3/configure --build=x86_64-pc-linux-gnu --host=mingw32 --prefix=/mingw --disable-win32-registry --target=mingw32 --with-arch=i586 --enable-languages=c,c++,objc,obj-c++,fortran,ada --enable-static --enable-shared --enable-threads --with-dwarf2 --disable-sjlj-exceptions --enable-version-specific-runtime-libs --enable-libstdcxx-debug --with-tune=generic --enable-nls +Thread model: win32 +gcc version 4.9.3 (GCC) +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles\cmTC_2b790.dir\CMakeCXXCompilerABI.cpp.obj' '-c' '-shared-libgcc' '-mtune=generic' '-march=i586' + c:/mingw/bin/../libexec/gcc/mingw32/4.9.3/cc1plus.exe -quiet -v -iprefix c:\mingw\bin\../lib/gcc/mingw32/4.9.3/ C:\CMake\Modules\CMakeCXXCompilerABI.cpp -quiet -dumpbase CMakeCXXCompilerABI.cpp -mtune=generic -march=i586 -auxbase-strip CMakeFiles\cmTC_2b790.dir\CMakeCXXCompilerABI.cpp.obj -version -o C:\Users\DASHBO~1\AppData\Local\Temp\cceEHFvQ.s +GNU C++ (GCC) version 4.9.3 (mingw32) + compiled by GNU C version 4.9.3, GMP version 5.1.2, MPFR version 3.1.2, MPC version 1.0.2 +GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 +ignoring nonexistent directory "c:\mingw\bin\../lib/gcc/mingw32/4.9.3/../../../../mingw32/include" +ignoring duplicate directory "c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.9.3/include/c++" +ignoring duplicate directory "c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.9.3/include/c++/mingw32" +ignoring duplicate directory "c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.9.3/include/c++/backward" +ignoring duplicate directory "c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.9.3/include" +ignoring duplicate directory "/mingw/lib/gcc/mingw32/4.9.3/../../../../include" +ignoring duplicate directory "c:/mingw/lib/gcc/../../include" +ignoring duplicate directory "c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.9.3/include-fixed" +ignoring nonexistent directory "c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.9.3/../../../../mingw32/include" +ignoring duplicate directory "/mingw/include" +#include "..." search starts here: +#include <...> search starts here: + c:\mingw\bin\../lib/gcc/mingw32/4.9.3/include/c++ + c:\mingw\bin\../lib/gcc/mingw32/4.9.3/include/c++/mingw32 + c:\mingw\bin\../lib/gcc/mingw32/4.9.3/include/c++/backward + c:\mingw\bin\../lib/gcc/mingw32/4.9.3/include + c:\mingw\bin\../lib/gcc/mingw32/4.9.3/../../../../include + c:\mingw\bin\../lib/gcc/mingw32/4.9.3/include-fixed +End of search list. +GNU C++ (GCC) version 4.9.3 (mingw32) + compiled by GNU C version 4.9.3, GMP version 5.1.2, MPFR version 3.1.2, MPC version 1.0.2 +GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 +Compiler executable checksum: 5086496b116ea21cdc0e479568243b88 +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles\cmTC_2b790.dir\CMakeCXXCompilerABI.cpp.obj' '-c' '-shared-libgcc' '-mtune=generic' '-march=i586' + c:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../../../mingw32/bin/as.exe -v -o CMakeFiles\cmTC_2b790.dir\CMakeCXXCompilerABI.cpp.obj C:\Users\DASHBO~1\AppData\Local\Temp\cceEHFvQ.s +GNU assembler version 2.25.1 (mingw32) using BFD version (GNU Binutils) 2.25.1 +COMPILER_PATH=c:/mingw/bin/../libexec/gcc/mingw32/4.9.3/;c:/mingw/bin/../libexec/gcc/;c:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../../../mingw32/bin/ +LIBRARY_PATH=c:/mingw/bin/../lib/gcc/mingw32/4.9.3/;c:/mingw/bin/../lib/gcc/;c:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../../../mingw32/lib/;c:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../../ +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles\cmTC_2b790.dir\CMakeCXXCompilerABI.cpp.obj' '-c' '-shared-libgcc' '-mtune=generic' '-march=i586' +Linking CXX executable cmTC_2b790.exe +"C:\CMake\bin\cmake.exe" -E cmake_link_script CMakeFiles\cmTC_2b790.dir\link.txt --verbose=1 +"C:\CMake\bin\cmake.exe" -E remove -f CMakeFiles\cmTC_2b790.dir/objects.a +C:\MinGW\bin\ar.exe cr CMakeFiles\cmTC_2b790.dir/objects.a @CMakeFiles\cmTC_2b790.dir\objects1.rsp +C:\MinGW\bin\g++.exe -v -Wl,--whole-archive CMakeFiles\cmTC_2b790.dir/objects.a -Wl,--no-whole-archive -o cmTC_2b790.exe -Wl,--out-implib,libcmTC_2b790.dll.a -Wl,--major-image-version,0,--minor-image-version,0 +Using built-in specs. +COLLECT_GCC=C:\MinGW\bin\g++.exe +COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/4.9.3/lto-wrapper.exe +Target: mingw32 +Configured with: ../src/gcc-4.9.3/configure --build=x86_64-pc-linux-gnu --host=mingw32 --prefix=/mingw --disable-win32-registry --target=mingw32 --with-arch=i586 --enable-languages=c,c++,objc,obj-c++,fortran,ada --enable-static --enable-shared --enable-threads --with-dwarf2 --disable-sjlj-exceptions --enable-version-specific-runtime-libs --enable-libstdcxx-debug --with-tune=generic --enable-nls +Thread model: win32 +gcc version 4.9.3 (GCC) +COMPILER_PATH=c:/mingw/bin/../libexec/gcc/mingw32/4.9.3/;c:/mingw/bin/../libexec/gcc/;c:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../../../mingw32/bin/ +LIBRARY_PATH=c:/mingw/bin/../lib/gcc/mingw32/4.9.3/;c:/mingw/bin/../lib/gcc/;c:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../../../mingw32/lib/;c:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../../ +COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_2b790.exe' '-shared-libgcc' '-mtune=generic' '-march=i586' + c:/mingw/bin/../libexec/gcc/mingw32/4.9.3/collect2.exe -plugin c:/mingw/bin/../libexec/gcc/mingw32/4.9.3/liblto_plugin-0.dll -plugin-opt=c:/mingw/bin/../libexec/gcc/mingw32/4.9.3/lto-wrapper.exe -plugin-opt=-fresolution=C:\Users\DASHBO~1\AppData\Local\Temp\ccYpt7zh.res -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -plugin-opt=-pass-through=-ladvapi32 -plugin-opt=-pass-through=-lshell32 -plugin-opt=-pass-through=-luser32 -plugin-opt=-pass-through=-lkernel32 -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -Bdynamic -u ___register_frame_info -u ___deregister_frame_info -o cmTC_2b790.exe c:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../../crt2.o c:/mingw/bin/../lib/gcc/mingw32/4.9.3/crtbegin.o -Lc:/mingw/bin/../lib/gcc/mingw32/4.9.3 -Lc:/mingw/bin/../lib/gcc -Lc:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../../../mingw32/lib -Lc:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../.. --whole-archive CMakeFiles\cmTC_2b790.dir/objects.a --no-whole-archive --out-implib libcmTC_2b790.dll.a --major-image-version 0 --minor-image-version 0 -lstdc++ -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt c:/mingw/bin/../lib/gcc/mingw32/4.9.3/crtend.o +mingw32-make.exe[1]: Leaving directory 'C:/tmp/ii/CMakeFiles/CMakeTmp' diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/mingw.org-CXX-GNU-4.9.3.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/mingw.org-CXX-GNU-4.9.3.output new file mode 100644 index 0000000..881a1a1 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/mingw.org-CXX-GNU-4.9.3.output @@ -0,0 +1 @@ +c:/mingw/bin/../lib/gcc/mingw32/4.9.3/include/c++;c:/mingw/bin/../lib/gcc/mingw32/4.9.3/include/c++/mingw32;c:/mingw/bin/../lib/gcc/mingw32/4.9.3/include/c++/backward;c:/mingw/bin/../lib/gcc/mingw32/4.9.3/include;c:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../../../include;c:/mingw/bin/../lib/gcc/mingw32/4.9.3/include-fixed diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/netbsd-C-GNU-4.8.5.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/netbsd-C-GNU-4.8.5.input new file mode 100644 index 0000000..b468484 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/netbsd-C-GNU-4.8.5.input @@ -0,0 +1,60 @@ +CMAKE_LANG=C +CMAKE_C_COMPILER_ABI=ELF +CMAKE_C_COMPILER_AR=CMAKE_C_COMPILER_AR-NOTFOUND +CMAKE_C_COMPILER_ARCHITECTURE_ID= +CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_C_COMPILER_ID=GNU +CMAKE_C_COMPILER_LAUNCHER= +CMAKE_C_COMPILER_LOADED=1 +CMAKE_C_COMPILER_RANLIB=CMAKE_C_COMPILER_RANLIB-NOTFOUND +CMAKE_C_COMPILER_TARGET= +CMAKE_C_COMPILER_VERSION=4.8.5 +CMAKE_C_COMPILER_VERSION_INTERAL= +Change Dir: /tmp/ii/CMakeFiles/CMakeTmp + +Run Build Command:"/usr/pkg/bin/gmake" "cmTC_9a517/fast" +/usr/pkg/bin/gmake -f CMakeFiles/cmTC_9a517.dir/build.make CMakeFiles/cmTC_9a517.dir/build +gmake[1]: Entering directory '/tmp/ii/CMakeFiles/CMakeTmp' +Building C object CMakeFiles/cmTC_9a517.dir/CMakeCCompilerABI.c.o +/usr/bin/cc -v -o CMakeFiles/cmTC_9a517.dir/CMakeCCompilerABI.c.o -c /usr/pkg/share/cmake-3.9/Modules/CMakeCCompilerABI.c +Using built-in specs. +COLLECT_GCC=/usr/bin/cc +Target: i486--netbsdelf +Configured with: /usr/7/src/tools/gcc/../../external/gpl3/gcc/dist/configure --target=i486--netbsdelf --enable-long-long --enable-threads --with-bugurl=http://www.NetBSD.org/Misc/send-pr.html --with-pkgversion='NetBSD nb2 20150115' --with-system-zlib --enable-__cxa_atexit --enable-libstdcxx-threads --with-arch=i486 --with-tune=nocona --enable-libstdcxx-time=rt --enable-lto --with-mpc-lib=/var/obj/mknative/i386/usr/7/src/external/lgpl3/mpc/lib/libmpc --with-mpfr-lib=/var/obj/mknative/i386/usr/7/src/external/lgpl3/mpfr/lib/libmpfr --with-gmp-lib=/var/obj/mknative/i386/usr/7/src/external/lgpl3/gmp/lib/libgmp --with-mpc-include=/usr/7/src/external/lgpl3/mpc/dist/src --with-mpfr-include=/usr/7/src/external/lgpl3/mpfr/dist/src --with-gmp-include=/usr/7/src/external/lgpl3/gmp/lib/libgmp/arch/i386 --enable-tls --disable-multilib --disable-symvers --disable-libstdcxx-pch --build=x86_64-unknown-netbsd6.0. --host=i486--netbsdelf --with-sysroot=/var/obj/mknative/i386/usr/7/src/destdir.i386 +Thread model: posix +gcc version 4.8.5 (nb2 20150115) +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_9a517.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=nocona' '-march=i486' + /usr/libexec/cc1 -quiet -v /usr/pkg/share/cmake-3.9/Modules/CMakeCCompilerABI.c -quiet -dumpbase CMakeCCompilerABI.c -mtune=nocona -march=i486 -auxbase-strip CMakeFiles/cmTC_9a517.dir/CMakeCCompilerABI.c.o -version -o /var/tmp//ccXQW9Zo.s +GNU C (nb2 20150115) version 4.8.5 (i486--netbsdelf) + compiled by GNU C version 4.8.5, GMP version 5.1.3, MPFR version 3.1.2, MPC version 1.0.1 +GGC heuristics: --param ggc-min-expand=73 --param ggc-min-heapsize=81803 +#include "..." search starts here: +#include <...> search starts here: + /usr/include/gcc-4.8 + /usr/include +End of search list. +GNU C (nb2 20150115) version 4.8.5 (i486--netbsdelf) + compiled by GNU C version 4.8.5, GMP version 5.1.3, MPFR version 3.1.2, MPC version 1.0.1 +GGC heuristics: --param ggc-min-expand=73 --param ggc-min-heapsize=81803 +Compiler executable checksum: 468b91b49af5cfeb6bb696ad20c66c1c +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_9a517.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=nocona' '-march=i486' + as -v -o CMakeFiles/cmTC_9a517.dir/CMakeCCompilerABI.c.o /var/tmp//ccXQW9Zo.s +GNU assembler version 2.23.2 (i486--netbsdelf) using BFD version (NetBSD Binutils nb1) 2.23.2 +COMPILER_PATH=/usr/libexec/ +LIBRARY_PATH=/usr/lib/ +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_9a517.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=nocona' '-march=i486' +Linking C executable cmTC_9a517 +/usr/pkg/bin/cmake -E cmake_link_script CMakeFiles/cmTC_9a517.dir/link.txt --verbose=1 +/usr/bin/cc -v CMakeFiles/cmTC_9a517.dir/CMakeCCompilerABI.c.o -o cmTC_9a517 +Using built-in specs. +COLLECT_GCC=/usr/bin/cc +COLLECT_LTO_WRAPPER=/usr/libexec/lto-wrapper +Target: i486--netbsdelf +Configured with: /usr/7/src/tools/gcc/../../external/gpl3/gcc/dist/configure --target=i486--netbsdelf --enable-long-long --enable-threads --with-bugurl=http://www.NetBSD.org/Misc/send-pr.html --with-pkgversion='NetBSD nb2 20150115' --with-system-zlib --enable-__cxa_atexit --enable-libstdcxx-threads --with-arch=i486 --with-tune=nocona --enable-libstdcxx-time=rt --enable-lto --with-mpc-lib=/var/obj/mknative/i386/usr/7/src/external/lgpl3/mpc/lib/libmpc --with-mpfr-lib=/var/obj/mknative/i386/usr/7/src/external/lgpl3/mpfr/lib/libmpfr --with-gmp-lib=/var/obj/mknative/i386/usr/7/src/external/lgpl3/gmp/lib/libgmp --with-mpc-include=/usr/7/src/external/lgpl3/mpc/dist/src --with-mpfr-include=/usr/7/src/external/lgpl3/mpfr/dist/src --with-gmp-include=/usr/7/src/external/lgpl3/gmp/lib/libgmp/arch/i386 --enable-tls --disable-multilib --disable-symvers --disable-libstdcxx-pch --build=x86_64-unknown-netbsd6.0. --host=i486--netbsdelf --with-sysroot=/var/obj/mknative/i386/usr/7/src/destdir.i386 +Thread model: posix +gcc version 4.8.5 (nb2 20150115) +COMPILER_PATH=/usr/libexec/ +LIBRARY_PATH=/usr/lib/ +COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_9a517' '-mtune=nocona' '-march=i486' + ld --eh-frame-hdr -dc -dp -e __start -dynamic-linker /usr/libexec/ld.elf_so -o cmTC_9a517 /usr/lib/crt0.o /usr/lib/crti.o /usr/lib/crtbegin.o CMakeFiles/cmTC_9a517.dir/CMakeCCompilerABI.c.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/crtend.o /usr/lib/crtn.o +gmake[1]: Leaving directory '/tmp/ii/CMakeFiles/CMakeTmp' diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/netbsd-C-GNU-4.8.5.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/netbsd-C-GNU-4.8.5.output new file mode 100644 index 0000000..6b69b2d --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/netbsd-C-GNU-4.8.5.output @@ -0,0 +1 @@ +/usr/include/gcc-4.8;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/netbsd-CXX-GNU-4.8.5.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/netbsd-CXX-GNU-4.8.5.input new file mode 100644 index 0000000..e3c5f72 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/netbsd-CXX-GNU-4.8.5.input @@ -0,0 +1,62 @@ +CMAKE_LANG=CXX +CMAKE_CXX_COMPILER_ABI=ELF +CMAKE_CXX_COMPILER_AR=CMAKE_CXX_COMPILER_AR-NOTFOUND +CMAKE_CXX_COMPILER_ARCHITECTURE_ID= +CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_CXX_COMPILER_ID=GNU +CMAKE_CXX_COMPILER_LAUNCHER= +CMAKE_CXX_COMPILER_LOADED=1 +CMAKE_CXX_COMPILER_RANLIB=CMAKE_CXX_COMPILER_RANLIB-NOTFOUND +CMAKE_CXX_COMPILER_TARGET= +CMAKE_CXX_COMPILER_VERSION=4.8.5 +CMAKE_CXX_COMPILER_VERSION_INTERAL= +Change Dir: /tmp/ii/CMakeFiles/CMakeTmp + +Run Build Command:"/usr/pkg/bin/gmake" "cmTC_cca06/fast" +/usr/pkg/bin/gmake -f CMakeFiles/cmTC_cca06.dir/build.make CMakeFiles/cmTC_cca06.dir/build +gmake[1]: Entering directory '/tmp/ii/CMakeFiles/CMakeTmp' +Building CXX object CMakeFiles/cmTC_cca06.dir/CMakeCXXCompilerABI.cpp.o +/usr/bin/c++ -v -o CMakeFiles/cmTC_cca06.dir/CMakeCXXCompilerABI.cpp.o -c /usr/pkg/share/cmake-3.9/Modules/CMakeCXXCompilerABI.cpp +Using built-in specs. +COLLECT_GCC=/usr/bin/c++ +Target: i486--netbsdelf +Configured with: /usr/7/src/tools/gcc/../../external/gpl3/gcc/dist/configure --target=i486--netbsdelf --enable-long-long --enable-threads --with-bugurl=http://www.NetBSD.org/Misc/send-pr.html --with-pkgversion='NetBSD nb2 20150115' --with-system-zlib --enable-__cxa_atexit --enable-libstdcxx-threads --with-arch=i486 --with-tune=nocona --enable-libstdcxx-time=rt --enable-lto --with-mpc-lib=/var/obj/mknative/i386/usr/7/src/external/lgpl3/mpc/lib/libmpc --with-mpfr-lib=/var/obj/mknative/i386/usr/7/src/external/lgpl3/mpfr/lib/libmpfr --with-gmp-lib=/var/obj/mknative/i386/usr/7/src/external/lgpl3/gmp/lib/libgmp --with-mpc-include=/usr/7/src/external/lgpl3/mpc/dist/src --with-mpfr-include=/usr/7/src/external/lgpl3/mpfr/dist/src --with-gmp-include=/usr/7/src/external/lgpl3/gmp/lib/libgmp/arch/i386 --enable-tls --disable-multilib --disable-symvers --disable-libstdcxx-pch --build=x86_64-unknown-netbsd6.0. --host=i486--netbsdelf --with-sysroot=/var/obj/mknative/i386/usr/7/src/destdir.i386 +Thread model: posix +gcc version 4.8.5 (nb2 20150115) +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_cca06.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=nocona' '-march=i486' + /usr/libexec/cc1plus -quiet -v /usr/pkg/share/cmake-3.9/Modules/CMakeCXXCompilerABI.cpp -quiet -dumpbase CMakeCXXCompilerABI.cpp -mtune=nocona -march=i486 -auxbase-strip CMakeFiles/cmTC_cca06.dir/CMakeCXXCompilerABI.cpp.o -version -o /var/tmp//ccqeRxzZ.s +GNU C++ (nb2 20150115) version 4.8.5 (i486--netbsdelf) + compiled by GNU C version 4.8.5, GMP version 5.1.3, MPFR version 3.1.2, MPC version 1.0.1 +GGC heuristics: --param ggc-min-expand=73 --param ggc-min-heapsize=81803 +#include "..." search starts here: +#include <...> search starts here: + /usr/include/g++ + /usr/include/g++/backward + /usr/include/gcc-4.8 + /usr/include +End of search list. +GNU C++ (nb2 20150115) version 4.8.5 (i486--netbsdelf) + compiled by GNU C version 4.8.5, GMP version 5.1.3, MPFR version 3.1.2, MPC version 1.0.1 +GGC heuristics: --param ggc-min-expand=73 --param ggc-min-heapsize=81803 +Compiler executable checksum: 961550adc452c84b614bf799df00d02b +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_cca06.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=nocona' '-march=i486' + as -v -o CMakeFiles/cmTC_cca06.dir/CMakeCXXCompilerABI.cpp.o /var/tmp//ccqeRxzZ.s +GNU assembler version 2.23.2 (i486--netbsdelf) using BFD version (NetBSD Binutils nb1) 2.23.2 +COMPILER_PATH=/usr/libexec/ +LIBRARY_PATH=/usr/lib/ +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_cca06.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=nocona' '-march=i486' +Linking CXX executable cmTC_cca06 +/usr/pkg/bin/cmake -E cmake_link_script CMakeFiles/cmTC_cca06.dir/link.txt --verbose=1 +/usr/bin/c++ -v CMakeFiles/cmTC_cca06.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_cca06 +Using built-in specs. +COLLECT_GCC=/usr/bin/c++ +COLLECT_LTO_WRAPPER=/usr/libexec/lto-wrapper +Target: i486--netbsdelf +Configured with: /usr/7/src/tools/gcc/../../external/gpl3/gcc/dist/configure --target=i486--netbsdelf --enable-long-long --enable-threads --with-bugurl=http://www.NetBSD.org/Misc/send-pr.html --with-pkgversion='NetBSD nb2 20150115' --with-system-zlib --enable-__cxa_atexit --enable-libstdcxx-threads --with-arch=i486 --with-tune=nocona --enable-libstdcxx-time=rt --enable-lto --with-mpc-lib=/var/obj/mknative/i386/usr/7/src/external/lgpl3/mpc/lib/libmpc --with-mpfr-lib=/var/obj/mknative/i386/usr/7/src/external/lgpl3/mpfr/lib/libmpfr --with-gmp-lib=/var/obj/mknative/i386/usr/7/src/external/lgpl3/gmp/lib/libgmp --with-mpc-include=/usr/7/src/external/lgpl3/mpc/dist/src --with-mpfr-include=/usr/7/src/external/lgpl3/mpfr/dist/src --with-gmp-include=/usr/7/src/external/lgpl3/gmp/lib/libgmp/arch/i386 --enable-tls --disable-multilib --disable-symvers --disable-libstdcxx-pch --build=x86_64-unknown-netbsd6.0. --host=i486--netbsdelf --with-sysroot=/var/obj/mknative/i386/usr/7/src/destdir.i386 +Thread model: posix +gcc version 4.8.5 (nb2 20150115) +COMPILER_PATH=/usr/libexec/ +LIBRARY_PATH=/usr/lib/ +COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_cca06' '-shared-libgcc' '-mtune=nocona' '-march=i486' + ld --eh-frame-hdr -dc -dp -e __start -dynamic-linker /usr/libexec/ld.elf_so -o cmTC_cca06 /usr/lib/crt0.o /usr/lib/crti.o /usr/lib/crtbegin.o CMakeFiles/cmTC_cca06.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm --as-needed -lgcc_s --no-as-needed -lgcc -lc --as-needed -lgcc_s --no-as-needed -lgcc /usr/lib/crtend.o /usr/lib/crtn.o +gmake[1]: Leaving directory '/tmp/ii/CMakeFiles/CMakeTmp' diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/netbsd-CXX-GNU-4.8.5.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/netbsd-CXX-GNU-4.8.5.output new file mode 100644 index 0000000..7b1e11e --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/netbsd-CXX-GNU-4.8.5.output @@ -0,0 +1 @@ +/usr/include/g++;/usr/include/g++/backward;/usr/include/gcc-4.8;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/openbsd-C-Clang-5.0.1.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/openbsd-C-Clang-5.0.1.input new file mode 100644 index 0000000..9f34f3d --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/openbsd-C-Clang-5.0.1.input @@ -0,0 +1,37 @@ +CMAKE_LANG=C +CMAKE_C_COMPILER_ABI=ELF +CMAKE_C_COMPILER_AR=CMAKE_C_COMPILER_AR-NOTFOUND +CMAKE_C_COMPILER_ARCHITECTURE_ID= +CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_C_COMPILER_ID=Clang +CMAKE_C_COMPILER_LAUNCHER= +CMAKE_C_COMPILER_LOADED=1 +CMAKE_C_COMPILER_RANLIB=CMAKE_C_COMPILER_RANLIB-NOTFOUND +CMAKE_C_COMPILER_TARGET= +CMAKE_C_COMPILER_VERSION=5.0.1 +CMAKE_C_COMPILER_VERSION_INTERAL= +Change Dir: /tmp/ii/CMakeFiles/CMakeTmp + +Run Build Command:"/usr/bin/make" "cmTC_f5360/fast" +/usr/bin/make -f CMakeFiles/cmTC_f5360.dir/build.make CMakeFiles/cmTC_f5360.dir/build +Building C object CMakeFiles/cmTC_f5360.dir/CMakeCCompilerABI.c.o +/usr/bin/cc -v -o CMakeFiles/cmTC_f5360.dir/CMakeCCompilerABI.c.o -c /usr/local/share/cmake/Modules/CMakeCCompilerABI.c +OpenBSD clang version 5.0.1 (tags/RELEASE_501/final) (based on LLVM 5.0.1) +Target: amd64-unknown-openbsd6.3 +Thread model: posix +InstalledDir: /usr/bin + "/usr/bin/cc" -cc1 -triple amd64-unknown-openbsd6.3 -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name CMakeCCompilerABI.c -mrelocation-model pic -pic-level 1 -pic-is-pie -mthread-model posix -mdisable-fp-elim -relaxed-aliasing -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -v -dwarf-column-info -debugger-tuning=gdb -coverage-notes-file /tmp/ii/CMakeFiles/CMakeTmp/CMakeFiles/cmTC_f5360.dir/CMakeCCompilerABI.c.gcno -resource-dir /usr/lib/clang/5.0.1 -fdebug-compilation-dir /tmp/ii/CMakeFiles/CMakeTmp -ferror-limit 19 -fmessage-length 0 -femulated-tls -fwrapv -stack-protector 2 -fobjc-runtime=gnustep -fdiagnostics-show-option -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-valloc -fno-builtin-free -fno-builtin-strdup -fno-builtin-strndup -o CMakeFiles/cmTC_f5360.dir/CMakeCCompilerABI.c.o -x c /usr/local/share/cmake/Modules/CMakeCCompilerABI.c +clang -cc1 version 5.0.1 based upon LLVM 5.0.1 default target amd64-unknown-openbsd6.3 +#include "..." search starts here: +#include <...> search starts here: + /usr/lib/clang/5.0.1/include + /usr/include +End of search list. +Linking C executable cmTC_f5360 +/usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTC_f5360.dir/link.txt --verbose=1 +/usr/bin/cc -v CMakeFiles/cmTC_f5360.dir/CMakeCCompilerABI.c.o -o cmTC_f5360 -Wl,-rpath-link,/usr/X11R6/lib:/usr/local/lib +OpenBSD clang version 5.0.1 (tags/RELEASE_501/final) (based on LLVM 5.0.1) +Target: amd64-unknown-openbsd6.3 +Thread model: posix +InstalledDir: /usr/bin + "/usr/bin/ld" -e __start --eh-frame-hdr -Bdynamic -dynamic-linker /usr/libexec/ld.so -o cmTC_f5360 /usr/bin/../lib/crt0.o /usr/bin/../lib/crtbegin.o -L/usr/bin/../lib -L/usr/lib CMakeFiles/cmTC_f5360.dir/CMakeCCompilerABI.c.o -rpath-link /usr/X11R6/lib:/usr/local/lib -lcompiler_rt -lc -lcompiler_rt /usr/bin/../lib/crtend.o diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/openbsd-C-Clang-5.0.1.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/openbsd-C-Clang-5.0.1.output new file mode 100644 index 0000000..60dbe24 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/openbsd-C-Clang-5.0.1.output @@ -0,0 +1 @@ +/usr/lib/clang/5.0.1/include;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/openbsd-CXX-Clang-5.0.1.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/openbsd-CXX-Clang-5.0.1.input new file mode 100644 index 0000000..93f1a95 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/openbsd-CXX-Clang-5.0.1.input @@ -0,0 +1,38 @@ +CMAKE_LANG=CXX +CMAKE_CXX_COMPILER_ABI=ELF +CMAKE_CXX_COMPILER_AR=CMAKE_CXX_COMPILER_AR-NOTFOUND +CMAKE_CXX_COMPILER_ARCHITECTURE_ID= +CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_CXX_COMPILER_ID=Clang +CMAKE_CXX_COMPILER_LAUNCHER= +CMAKE_CXX_COMPILER_LOADED=1 +CMAKE_CXX_COMPILER_RANLIB=CMAKE_CXX_COMPILER_RANLIB-NOTFOUND +CMAKE_CXX_COMPILER_TARGET= +CMAKE_CXX_COMPILER_VERSION=5.0.1 +CMAKE_CXX_COMPILER_VERSION_INTERAL= +Change Dir: /tmp/ii/CMakeFiles/CMakeTmp + +Run Build Command:"/usr/bin/make" "cmTC_a2bf8/fast" +/usr/bin/make -f CMakeFiles/cmTC_a2bf8.dir/build.make CMakeFiles/cmTC_a2bf8.dir/build +Building CXX object CMakeFiles/cmTC_a2bf8.dir/CMakeCXXCompilerABI.cpp.o +/usr/bin/c++ -v -o CMakeFiles/cmTC_a2bf8.dir/CMakeCXXCompilerABI.cpp.o -c /usr/local/share/cmake/Modules/CMakeCXXCompilerABI.cpp +OpenBSD clang version 5.0.1 (tags/RELEASE_501/final) (based on LLVM 5.0.1) +Target: amd64-unknown-openbsd6.3 +Thread model: posix +InstalledDir: /usr/bin + "/usr/bin/c++" -cc1 -triple amd64-unknown-openbsd6.3 -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name CMakeCXXCompilerABI.cpp -mrelocation-model pic -pic-level 1 -pic-is-pie -mthread-model posix -mdisable-fp-elim -relaxed-aliasing -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -v -dwarf-column-info -debugger-tuning=gdb -coverage-notes-file /tmp/ii/CMakeFiles/CMakeTmp/CMakeFiles/cmTC_a2bf8.dir/CMakeCXXCompilerABI.cpp.gcno -resource-dir /usr/lib/clang/5.0.1 -internal-isystem /usr/include/c++/v1 -fdeprecated-macro -fdebug-compilation-dir /tmp/ii/CMakeFiles/CMakeTmp -ferror-limit 19 -fmessage-length 0 -femulated-tls -fwrapv -stack-protector 2 -fobjc-runtime=gnustep -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-valloc -fno-builtin-free -fno-builtin-strdup -fno-builtin-strndup -o CMakeFiles/cmTC_a2bf8.dir/CMakeCXXCompilerABI.cpp.o -x c++ /usr/local/share/cmake/Modules/CMakeCXXCompilerABI.cpp +clang -cc1 version 5.0.1 based upon LLVM 5.0.1 default target amd64-unknown-openbsd6.3 +#include "..." search starts here: +#include <...> search starts here: + /usr/include/c++/v1 + /usr/lib/clang/5.0.1/include + /usr/include +End of search list. +Linking CXX executable cmTC_a2bf8 +/usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTC_a2bf8.dir/link.txt --verbose=1 +/usr/bin/c++ -v CMakeFiles/cmTC_a2bf8.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_a2bf8 -Wl,-rpath-link,/usr/X11R6/lib:/usr/local/lib +OpenBSD clang version 5.0.1 (tags/RELEASE_501/final) (based on LLVM 5.0.1) +Target: amd64-unknown-openbsd6.3 +Thread model: posix +InstalledDir: /usr/bin + "/usr/bin/ld" -e __start --eh-frame-hdr -Bdynamic -dynamic-linker /usr/libexec/ld.so -o cmTC_a2bf8 /usr/bin/../lib/crt0.o /usr/bin/../lib/crtbegin.o -L/usr/bin/../lib -L/usr/lib CMakeFiles/cmTC_a2bf8.dir/CMakeCXXCompilerABI.cpp.o -rpath-link /usr/X11R6/lib:/usr/local/lib -lc++ -lc++abi -lpthread -lm -lcompiler_rt -lc -lcompiler_rt /usr/bin/../lib/crtend.o diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/openbsd-CXX-Clang-5.0.1.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/openbsd-CXX-Clang-5.0.1.output new file mode 100644 index 0000000..6da1398 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/openbsd-CXX-Clang-5.0.1.output @@ -0,0 +1 @@ +/usr/include/c++/v1;/usr/lib/clang/5.0.1/include;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/sunos-C-SunPro-5.13.0.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/sunos-C-SunPro-5.13.0.input new file mode 100644 index 0000000..b0b504a --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/sunos-C-SunPro-5.13.0.input @@ -0,0 +1,35 @@ +CMAKE_LANG=C +CMAKE_C_COMPILER_ABI= +CMAKE_C_COMPILER_AR= +CMAKE_C_COMPILER_ARCHITECTURE_ID= +CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_C_COMPILER_ID=SunPro +CMAKE_C_COMPILER_LAUNCHER= +CMAKE_C_COMPILER_LOADED=1 +CMAKE_C_COMPILER_RANLIB= +CMAKE_C_COMPILER_TARGET= +CMAKE_C_COMPILER_VERSION=5.13.0 +CMAKE_C_COMPILER_VERSION_INTERAL= +Change Dir: /tmp/ii/CMakeFiles/CMakeTmp + +Run Build Command:"/opt/csw/bin/gmake" "cmTC_55079/fast" +/opt/csw/bin/gmake -f CMakeFiles/cmTC_55079.dir/build.make CMakeFiles/cmTC_55079.dir/build +gmake[1]: Entering directory '/tmp/ii/CMakeFiles/CMakeTmp' +Building C object CMakeFiles/cmTC_55079.dir/CMakeCCompilerABI.c.o +/opt/solarisstudio12.4/bin/cc -# -o CMakeFiles/cmTC_55079.dir/CMakeCCompilerABI.c.o -c /tmp/CMake/Modules/CMakeCCompilerABI.c +### cc: Note: NLSPATH = /opt/solarisstudio12.4/bin/../lib/locale/%L/LC_MESSAGES/%N.cat:/opt/solarisstudio12.4/bin/../../lib/locale/%L/LC_MESSAGES/%N.cat +### command line files and options (expanded): +### -# -oCMakeFiles/cmTC_55079.dir/CMakeCCompilerABI.c.o -c /tmp/CMake/Modules/CMakeCCompilerABI.c +/opt/solarisstudio12.4/lib/compilers/acomp -Qy -std=c11 -i /tmp/CMake/Modules/CMakeCCompilerABI.c -D__SunOS_5_10 -D__SUNPRO_C=0x5130 -D__unix -D__SVR4 -D__sun -D__SunOS -D__sparcv8 -D__sparc -D__BUILTIN_VA_ARG_INCR -D__C11FEATURES__ -D__C99FEATURES__ -D__PRAGMA_REDEFINE_EXTNAME -Dunix -Dsun -Dsparc -D__RESTRICT -D__FLT_EVAL_METHOD__=0 -D__SUN_PREFETCH -D__NOVECTORSIZE__ -I-xbuiltin -I/opt/solarisstudio12.4/lib/compilers/include/cc -xbuiltin=%none -fsimple=0 -m32 -fparam_ir -fparam_ir -xdebuginfo=%none -xF=%none -xdbggen=dwarf+usedonly+incl -xldscope=global -xivdep=loop "-g/opt/solarisstudio12.4/bin/cc -c " -destination_ir=yabe -y-fbe -y/opt/solarisstudio12.4/bin/fbe -y-xmemalign=8i -y-verbose -y-comdat -y-xdebuginfo=%none -y-xarch=generic -y-m32 -y-comdat -y-xthreadvar=no%dynamic -y-xannotate=yes -y-o -yCMakeFiles/cmTC_55079.dir/CMakeCCompilerABI.c.o +Linking C executable cmTC_55079 +/tmp/CMake/bin/cmake -E cmake_link_script CMakeFiles/cmTC_55079.dir/link.txt --verbose=1 +/opt/solarisstudio12.4/bin/cc -# CMakeFiles/cmTC_55079.dir/CMakeCCompilerABI.c.o -o cmTC_55079 +### cc: Note: NLSPATH = /opt/solarisstudio12.4/bin/../lib/locale/%L/LC_MESSAGES/%N.cat:/opt/solarisstudio12.4/bin/../../lib/locale/%L/LC_MESSAGES/%N.cat +### command line files and options (expanded): +### -# CMakeFiles/cmTC_55079.dir/CMakeCCompilerABI.c.o -ocmTC_55079 +### cc: Note: LD_LIBRARY_PATH = (null) +### cc: Note: LD_RUN_PATH = (null) +### cc: Note: LD_OPTIONS = (null) +ln -s /opt/solarisstudio12.4/lib/compilers /tmp/lib_link.1547820951.9061.01 +/usr/ccs/bin/ld -zld32=-S/tmp/lib_link.1547820951.9061.01/libldstab_ws.so -zld64=-S/tmp/lib_link.1547820951.9061.01/sparcv9/libldstab_ws.so -zld32=-S/tmp/lib_link.1547820951.9061.01/libld_annotate.so -zld64=-S/tmp/lib_link.1547820951.9061.01/sparcv9/libld_annotate.so /opt/solarisstudio12.4/lib/compilers/crti.o /opt/solarisstudio12.4/lib/compilers/crt1.o /opt/solarisstudio12.4/lib/compilers/misalign.o /opt/solarisstudio12.4/lib/compilers/values-xa.o CMakeFiles/cmTC_55079.dir/CMakeCCompilerABI.c.o -o cmTC_55079 -Y "P,/opt/solarisstudio12.4/lib/compilers/staticlib:/opt/solarisstudio12.4/lib/compilers/sparc:/opt/solarisstudio12.4/lib/compilers:/usr/ccs/lib:/lib:/usr/lib" -Qy -lc /opt/solarisstudio12.4/lib/compilers/crtn.o +gmake[1]: Leaving directory '/tmp/ii/CMakeFiles/CMakeTmp' diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/sunos-C-SunPro-5.13.0.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/sunos-C-SunPro-5.13.0.output new file mode 100644 index 0000000..e69de29 diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/sunos-CXX-SunPro-5.13.0.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/sunos-CXX-SunPro-5.13.0.input new file mode 100644 index 0000000..9abd06a --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/sunos-CXX-SunPro-5.13.0.input @@ -0,0 +1,38 @@ +CMAKE_LANG=CXX +CMAKE_CXX_COMPILER_ABI= +CMAKE_CXX_COMPILER_AR= +CMAKE_CXX_COMPILER_ARCHITECTURE_ID= +CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_CXX_COMPILER_ID=SunPro +CMAKE_CXX_COMPILER_LAUNCHER= +CMAKE_CXX_COMPILER_LOADED=1 +CMAKE_CXX_COMPILER_RANLIB= +CMAKE_CXX_COMPILER_TARGET= +CMAKE_CXX_COMPILER_VERSION=5.13.0 +CMAKE_CXX_COMPILER_VERSION_INTERAL= +Change Dir: /tmp/ii/CMakeFiles/CMakeTmp + +Run Build Command:"/opt/csw/bin/gmake" "cmTC_cc4b2/fast" +/opt/csw/bin/gmake -f CMakeFiles/cmTC_cc4b2.dir/build.make CMakeFiles/cmTC_cc4b2.dir/build +gmake[1]: Entering directory '/tmp/ii/CMakeFiles/CMakeTmp' +Building CXX object CMakeFiles/cmTC_cc4b2.dir/CMakeCXXCompilerABI.cpp.o +/opt/solarisstudio12.4/bin/CC -v -o CMakeFiles/cmTC_cc4b2.dir/CMakeCXXCompilerABI.cpp.o -c /tmp/CMake/Modules/CMakeCXXCompilerABI.cpp +### CC: Note: NLSPATH = /opt/solarisstudio12.4/bin/../lib/locale/%L/LC_MESSAGES/%N.cat:/opt/solarisstudio12.4/bin/../../lib/locale/%L/LC_MESSAGES/%N.cat +### command line files and options (expanded): +### -v -oCMakeFiles/cmTC_cc4b2.dir/CMakeCXXCompilerABI.cpp.o -c /tmp/CMake/Modules/CMakeCXXCompilerABI.cpp +/opt/solarisstudio12.4/lib/compilers/ccfe -D__SunOS_5_10 -D__SUNPRO_CC=0x5130 -D__unix -D__SVR4 -D__sun -D__SunOS -D__sparcv8 -D__sparc -D__BUILTIN_VA_ARG_INCR -Dunix -Dsun -Dsparc -D__SUN_PREFETCH -D__SUNPRO_CC_COMPAT=5 -D__NOVECTORSIZE__ -I-xbuiltin -I/opt/solarisstudio12.4/lib/compilers/include/CC/Cstd -I/opt/solarisstudio12.4/lib/compilers/include/CC -I/opt/solarisstudio12.4/lib/compilers/include/cc -ptf /tmp/ccfe.1547820952.9069.02.%1.%2 -ptx /opt/solarisstudio12.4/bin/CC -ptk "-v -c " -compat=5 -xdebuginfo=%none -instlib=/opt/solarisstudio12.4/lib/compilers/libCstd.a -xdbggen=dwarf+usedonly+incl -xF=%none -xbuiltin=%none -xldscope=global -xivdep=loop -O0 -xarrayloc /tmp/CMake/Modules/CMakeCXXCompilerABI.cpp -ptb CMakeFiles/cmTC_cc4b2.dir/CMakeCXXCompilerABI.cpp.o -y-fbe -y/opt/solarisstudio12.4/bin/fbe -y-xmemalign=8i -y-verbose -y-comdat -y-xdebuginfo=%none -y-xarch=generic -y-m32 -y-comdat -y-xthreadvar=no%dynamic -y-xannotate=yes -y-o -yCMakeFiles/cmTC_cc4b2.dir/CMakeCXXCompilerABI.cpp.o 2> /tmp/ccfe.1547820952.9069.01.err +rm /tmp/ccfe.1547820952.9069.01.err +Linking CXX executable cmTC_cc4b2 +/tmp/CMake/bin/cmake -E cmake_link_script CMakeFiles/cmTC_cc4b2.dir/link.txt --verbose=1 +/opt/solarisstudio12.4/bin/CC -v CMakeFiles/cmTC_cc4b2.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_cc4b2 +### CC: Note: NLSPATH = /opt/solarisstudio12.4/bin/../lib/locale/%L/LC_MESSAGES/%N.cat:/opt/solarisstudio12.4/bin/../../lib/locale/%L/LC_MESSAGES/%N.cat +### command line files and options (expanded): +### -v CMakeFiles/cmTC_cc4b2.dir/CMakeCXXCompilerABI.cpp.o -ocmTC_cc4b2 +### CC: Note: LD_LIBRARY_PATH = (null) +### CC: Note: LD_RUN_PATH = (null) +### CC: Note: LD_OPTIONS = (null) +ln -s /opt/solarisstudio12.4/lib/compilers /tmp/lib_link.1547820952.9076.01 +/usr/ccs/bin/ld -zld32=-S/tmp/lib_link.1547820952.9076.01/libldstab_ws.so -zld64=-S/tmp/lib_link.1547820952.9076.01/sparcv9/libldstab_ws.so -zld32=-S/tmp/lib_link.1547820952.9076.01/libld_annotate.so -zld64=-S/tmp/lib_link.1547820952.9076.01/sparcv9/libld_annotate.so -zld32=-S/tmp/lib_link.1547820952.9076.01/libCCexcept.so.1 -zld64=-S/tmp/lib_link.1547820952.9076.01/sparcv9/libCCexcept.so.1 /opt/solarisstudio12.4/lib/compilers/crti.o -u __1cH__CimplKcplus_init6F_v_ /opt/solarisstudio12.4/lib/compilers/CCrti.o /opt/solarisstudio12.4/lib/compilers/crt1.o /opt/solarisstudio12.4/lib/compilers/misalign.o /opt/solarisstudio12.4/lib/compilers/values-xa.o CMakeFiles/cmTC_cc4b2.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_cc4b2 -Y "P,/opt/solarisstudio12.4/lib/compilers/sparc:/opt/solarisstudio12.4/lib/compilers:/opt/solarisstudio12.4/lib/sparc:/opt/solarisstudio12.4/lib:/usr/ccs/lib:/lib:/usr/lib" -Qy "-R/opt/solarisstudio12.4/lib/sparc:/opt/solarisstudio12.4/lib" -lCstd -lCrun -lm -lc /opt/solarisstudio12.4/lib/compilers/CCrtn.o /opt/solarisstudio12.4/lib/compilers/crtn.o 2> /tmp/ld.1547820952.9076.02.err +rm /tmp/lib_link.1547820952.9076.01 +rm /tmp/ld.1547820952.9076.02.err +gmake[1]: Leaving directory '/tmp/ii/CMakeFiles/CMakeTmp' diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/sunos-CXX-SunPro-5.13.0.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/sunos-CXX-SunPro-5.13.0.output new file mode 100644 index 0000000..e69de29 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d751d2d2ed277c1bfb2882fd90b377983ab4700f commit d751d2d2ed277c1bfb2882fd90b377983ab4700f Author: Chuck Cranor AuthorDate: Mon Jan 14 12:42:22 2019 -0700 Commit: Brad King CommitDate: Mon Jan 21 11:14:08 2019 -0500 CMakeDetermineCompilerABI: set locale to C for try_compile() Have CMakeDetermineCompilerABI set the locale to C before calling try_compile(). This is for the implicit include path parser to keep all the verbose compiler messages in English so we can parse it. See #18784 for discussion. diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake index 14f4da0..1dbd44f 100644 --- a/Modules/CMakeDetermineCompilerABI.cmake +++ b/Modules/CMakeDetermineCompilerABI.cmake @@ -30,6 +30,17 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src) list(APPEND CMAKE_FLAGS "-DCMAKE_${lang}_STANDARD_LIBRARIES=") endif() __TestCompiler_setTryCompileTargetType() + + # Save the current LC_ALL, LC_MESSAGES, and LANG environment variables + # and set them to "C" that way GCC's "search starts here" text is in + # English and we can grok it. + set(_orig_lc_all $ENV{LC_ALL}) + set(_orig_lc_messages $ENV{LC_MESSAGES}) + set(_orig_lang $ENV{LANG}) + set(ENV{LC_ALL} C) + set(ENV{LC_MESSAGES} C) + set(ENV{LANG} C) + try_compile(CMAKE_${lang}_ABI_COMPILED ${CMAKE_BINARY_DIR} ${src} CMAKE_FLAGS ${CMAKE_FLAGS} @@ -40,6 +51,12 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src) COPY_FILE "${BIN}" COPY_FILE_ERROR _copy_error ) + + # Restore original LC_ALL, LC_MESSAGES, and LANG + set(ENV{LC_ALL} ${_orig_lc_all}) + set(ENV{LC_MESSAGES} ${_orig_lc_messages}) + set(ENV{LANG} ${_orig_lang}) + # Move result from cache to normal variable. set(CMAKE_${lang}_ABI_COMPILED ${CMAKE_${lang}_ABI_COMPILED}) unset(CMAKE_${lang}_ABI_COMPILED CACHE) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c765ae495aa25714023d2cf2bcf6a9873da06184 commit c765ae495aa25714023d2cf2bcf6a9873da06184 Author: Brad King AuthorDate: Mon Jan 21 10:23:03 2019 -0500 Commit: Brad King CommitDate: Mon Jan 21 11:14:08 2019 -0500 CMakeDetermineCompilerABI: pass verbose flag during compilation Default to the same flag that is used for verbose link information, but provide another internal platform information variable to use a compilation-specific variant. Populate it for CUDA where we use a different compiler for compilation and linking and therefore need different flags. Co-Author: Chuck Cranor diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake index d88f2ed..14f4da0 100644 --- a/Modules/CMakeDetermineCompilerABI.cmake +++ b/Modules/CMakeDetermineCompilerABI.cmake @@ -16,8 +16,13 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src) # Compile the ABI identification source. set(BIN "${CMAKE_PLATFORM_INFO_DIR}/CMakeDetermineCompilerABI_${lang}.bin") set(CMAKE_FLAGS ) + set(COMPILE_DEFINITIONS ) if(DEFINED CMAKE_${lang}_VERBOSE_FLAG) set(CMAKE_FLAGS "-DEXE_LINKER_FLAGS=${CMAKE_${lang}_VERBOSE_FLAG}") + set(COMPILE_DEFINITIONS "${CMAKE_${lang}_VERBOSE_FLAG}") + endif() + if(DEFINED CMAKE_${lang}_VERBOSE_COMPILE_FLAG) + set(COMPILE_DEFINITIONS "${CMAKE_${lang}_VERBOSE_COMPILE_FLAG}") endif() if(NOT "x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xMSVC") # Avoid adding our own platform standard libraries for compilers @@ -30,6 +35,7 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src) CMAKE_FLAGS ${CMAKE_FLAGS} # Ignore unused flags when we are just determining the ABI. "--no-warn-unused-cli" + COMPILE_DEFINITIONS ${COMPILE_DEFINITIONS} OUTPUT_VARIABLE OUTPUT COPY_FILE "${BIN}" COPY_FILE_ERROR _copy_error diff --git a/Modules/Compiler/NVIDIA-CUDA.cmake b/Modules/Compiler/NVIDIA-CUDA.cmake index 05db548..de9dd99 100644 --- a/Modules/Compiler/NVIDIA-CUDA.cmake +++ b/Modules/Compiler/NVIDIA-CUDA.cmake @@ -1,4 +1,5 @@ set(CMAKE_CUDA_VERBOSE_FLAG "-v") +set(CMAKE_CUDA_VERBOSE_COMPILE_FLAG "-Xcompiler=-v") if(NOT "x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC") set(CMAKE_CUDA_COMPILE_OPTIONS_PIE -Xcompiler=-fPIE) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8c5221fb1fad10518c8ef7901a686a9a816baf0e commit 8c5221fb1fad10518c8ef7901a686a9a816baf0e Author: Brad King AuthorDate: Mon Jan 21 10:07:20 2019 -0500 Commit: Brad King CommitDate: Mon Jan 21 11:14:08 2019 -0500 try_compile: Preserve special characters in COMPILE_DEFINITIONS When generating the `CMakeLists.txt` file, we pass the values given to our `COMPILE_DEFINITIONS` option in an `add_definitions` call. Pass them as bracket arguments to preserve special characters like `#`. diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 137b25f..ef250d7 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -599,7 +599,9 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv, fprintf(fout, "link_directories(${LINK_DIRECTORIES})\n"); // handle any compile flags we need to pass on if (!compileDefs.empty()) { - fprintf(fout, "add_definitions(%s)\n", cmJoin(compileDefs, " ").c_str()); + // Pass using bracket arguments to preserve content. + fprintf(fout, "add_definitions([==[%s]==])\n", + cmJoin(compileDefs, "]==] [==[").c_str()); } /* Use a random file name to avoid rapid creation and deletion https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=15ad8300621eaf9fe23cda30368f90b420505d43 commit 15ad8300621eaf9fe23cda30368f90b420505d43 Author: Brad King AuthorDate: Mon Jan 21 11:09:32 2019 -0500 Commit: Brad King CommitDate: Mon Jan 21 11:14:07 2019 -0500 Refactor exclusion of -I/usr/include to avoid per-language values Add a `CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES` to contain the hard-coded list of paths to be excluded from `-I` arguments so that the values remain excluded even if the per-language `CMAKE__IMPLICIT_INCLUDE_DIRECTORIES` variants change. This is needed to preserve our historical exclusion of `-I/usr/include` even when it is not a real implicit include directory. A policy may be needed to remove it later. diff --git a/Modules/Platform/UnixPaths.cmake b/Modules/Platform/UnixPaths.cmake index 328d3c6..fc22fce 100644 --- a/Modules/Platform/UnixPaths.cmake +++ b/Modules/Platform/UnixPaths.cmake @@ -63,6 +63,13 @@ list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES /lib /lib32 /lib64 /usr/lib /usr/lib32 /usr/lib64 ) +# Platform-wide directories to avoid adding via -I. +list(APPEND CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES + /usr/include + ) + +# Default per-language values. These may be later replaced after +# parsing the implicit link directories from compiler output. list(APPEND CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES /usr/include ) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 797add9..54f1c7f 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -947,21 +947,29 @@ std::vector> cmLocalGenerator::GetIncludeDirectories( rootPath = this->Makefile->GetSafeDefinition("CMAKE_SYSROOT"); } + std::vector impDirVec; + + // Get platform-wide implicit directories. + if (const char* implicitIncludes = (this->Makefile->GetDefinition( + "CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES"))) { + cmSystemTools::ExpandListArgument(implicitIncludes, impDirVec); + } + // Load implicit include directories for this language. std::string key = "CMAKE_"; key += lang; key += "_IMPLICIT_INCLUDE_DIRECTORIES"; if (const char* value = this->Makefile->GetDefinition(key)) { - std::vector impDirVec; cmSystemTools::ExpandListArgument(value, impDirVec); - for (std::string const& i : impDirVec) { - { - std::string d = rootPath + i; - cmSystemTools::ConvertToUnixSlashes(d); - emitted.insert(std::move(d)); - } - implicitDirs.push_back(i); + } + + for (std::string const& i : impDirVec) { + { + std::string d = rootPath + i; + cmSystemTools::ConvertToUnixSlashes(d); + emitted.insert(std::move(d)); } + implicitDirs.push_back(i); } } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dfd5ae7da71ed9330eca7e352b8f9b42babdf3dd commit dfd5ae7da71ed9330eca7e352b8f9b42babdf3dd Author: Artur Ryt AuthorDate: Fri Nov 30 19:43:22 2018 +0100 Commit: Brad King CommitDate: Fri Jan 18 12:57:34 2019 -0500 Help: Mark default CMake generator with asterisk Required extracting default generator evaluation to explicit function, as Visual Studio generators get validated during their construction. Fixes: #18544 diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index 6a817b4..d4628fa 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -43,11 +43,18 @@ static const char* cmDocumentationStandardOptions[][2] = { { nullptr, nullptr } }; -static const char* cmDocumentationGeneratorsHeader[][2] = { +static const char* cmDocumentationCPackGeneratorsHeader[][2] = { { nullptr, "The following generators are available on this platform:" }, { nullptr, nullptr } }; +static const char* cmDocumentationCMakeGeneratorsHeader[][2] = { + { nullptr, + "The following generators are available on this platform (* marks " + "default):" }, + { nullptr, nullptr } +}; + cmDocumentation::cmDocumentation() { this->addCommonStandardDocSections(); @@ -178,7 +185,7 @@ void cmDocumentation::addCommonStandardDocSections() void cmDocumentation::addCMakeStandardDocSections() { cmDocumentationSection sec{ "Generators" }; - sec.Append(cmDocumentationGeneratorsHeader); + sec.Append(cmDocumentationCMakeGeneratorsHeader); this->AllSections.emplace("Generators", std::move(sec)); } @@ -191,7 +198,9 @@ void cmDocumentation::addCTestStandardDocSections() void cmDocumentation::addCPackStandardDocSections() { - addCMakeStandardDocSections(); + cmDocumentationSection sec{ "Generators" }; + sec.Append(cmDocumentationCPackGeneratorsHeader); + this->AllSections.emplace("Generators", std::move(sec)); } bool cmDocumentation::CheckOptions(int argc, const char* const* argv, diff --git a/Source/cmDocumentationEntry.h b/Source/cmDocumentationEntry.h index ea43b88..ca323cc 100644 --- a/Source/cmDocumentationEntry.h +++ b/Source/cmDocumentationEntry.h @@ -12,6 +12,7 @@ struct cmDocumentationEntry { std::string Name; std::string Brief; + char CustomNamePrefix = ' '; cmDocumentationEntry() {} cmDocumentationEntry(const char* doc[2]) { diff --git a/Source/cmDocumentationFormatter.cxx b/Source/cmDocumentationFormatter.cxx index 678e408..e573c04 100644 --- a/Source/cmDocumentationFormatter.cxx +++ b/Source/cmDocumentationFormatter.cxx @@ -5,6 +5,7 @@ #include "cmDocumentationEntry.h" #include "cmDocumentationSection.h" +#include #include #include #include @@ -168,7 +169,7 @@ void cmDocumentationFormatter::PrintSection( const std::vector& entries = section.GetEntries(); for (cmDocumentationEntry const& entry : entries) { if (!entry.Name.empty()) { - os << " " << entry.Name; + os << std::setw(2) << std::left << entry.CustomNamePrefix << entry.Name; this->TextIndent = " "; int align = static_cast(strlen(this->TextIndent)) - 4; for (int i = static_cast(entry.Name.size()); i < align; ++i) { diff --git a/Source/cmake.cxx b/Source/cmake.cxx index c53b597..619fd3e 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1519,7 +1519,7 @@ int cmake::ActualConfigure() return 0; } -void cmake::CreateDefaultGlobalGenerator() +std::unique_ptr cmake::EvaluateDefaultGlobalGenerator() { #if defined(_WIN32) && !defined(__CYGWIN__) && !defined(CMAKE_BOOT_MINGW) std::string found; @@ -1572,11 +1572,20 @@ void cmake::CreateDefaultGlobalGenerator() if (!gen) { gen = new cmGlobalNMakeMakefileGenerator(this); } - this->SetGlobalGenerator(gen); - std::cout << "-- Building for: " << gen->GetName() << "\n"; + return std::unique_ptr(gen); #else - this->SetGlobalGenerator(new cmGlobalUnixMakefileGenerator3(this)); + return cm::make_unique(this); +#endif +} + +void cmake::CreateDefaultGlobalGenerator() +{ + auto gen = this->EvaluateDefaultGlobalGenerator(); +#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(CMAKE_BOOT_MINGW) + // This print could be unified for all platforms + std::cout << "-- Building for: " << gen->GetName() << "\n"; #endif + this->SetGlobalGenerator(gen.release()); } void cmake::PreLoadCMakeFiles() @@ -1927,9 +1936,18 @@ void cmake::SetIsInTryCompile(bool b) void cmake::AppendGlobalGeneratorsDocumentation( std::vector& v) { + const auto defaultGenerator = this->EvaluateDefaultGlobalGenerator(); + const std::string defaultName = defaultGenerator->GetName(); + bool foundDefaultOne = false; + for (cmGlobalGeneratorFactory* g : this->Generators) { cmDocumentationEntry e; g->GetDocumentation(e); + if (!foundDefaultOne && + cmSystemTools::StringStartsWith(e.Name, defaultName.c_str())) { + e.CustomNamePrefix = '*'; + foundDefaultOne = true; + } v.push_back(std::move(e)); } } diff --git a/Source/cmake.h b/Source/cmake.h index 1586845..31cd97d 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -531,6 +531,7 @@ private: // Print a list of valid generators to stderr. void PrintGeneratorList(); + std::unique_ptr EvaluateDefaultGlobalGenerator(); void CreateDefaultGlobalGenerator(); void AppendGlobalGeneratorsDocumentation(std::vector&); diff --git a/Tests/Server/cmakelib.py b/Tests/Server/cmakelib.py index edb5af6..546ae4c 100644 --- a/Tests/Server/cmakelib.py +++ b/Tests/Server/cmakelib.py @@ -276,6 +276,10 @@ def validateGlobalSettings(cmakeCommand, cmakeCommandPath, data): index = cmakeoutput.index('\nGenerators\n\n') cmakeGenerators = [] for line in cmakeoutput[index + 12:].splitlines(): + if not line: + continue + if line[0] == '*': # default generator marker + line = ' ' + line[1:] if not line.startswith(' '): continue if line.startswith(' '): https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6023fe7ff22848bc29ee67395eeb10f066758c06 commit 6023fe7ff22848bc29ee67395eeb10f066758c06 Author: Craig Scott AuthorDate: Sun Dec 2 14:50:55 2018 +1100 Commit: Brad King CommitDate: Fri Jan 18 12:57:34 2019 -0500 ccmake: Append rather than replace Generators section of docs Using SetSection() discards the heading line populated by addCMakeStandardDocSections(), whereas AppendSection() preserves it. This also makes the code used for ccmake consistent with that used for cmake and cmake-gui. diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx index 44789b0..ec3cd9f 100644 --- a/Source/CursesDialog/ccmake.cxx +++ b/Source/CursesDialog/ccmake.cxx @@ -95,7 +95,7 @@ int main(int argc, char const* const* argv) if (argc == 1) { doc.AppendSection("Usage", cmDocumentationUsageNote); } - doc.SetSection("Generators", generators); + doc.AppendSection("Generators", generators); doc.PrependSection("Options", cmDocumentationOptions); return doc.PrintRequestedDocumentation(std::cout) ? 0 : 1; } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7408cd39298dfce442d7aa539a90a227433865d5 commit 7408cd39298dfce442d7aa539a90a227433865d5 Author: Artur Ryt AuthorDate: Fri Nov 30 19:00:57 2018 +0100 Commit: Brad King CommitDate: Fri Jan 18 12:57:32 2019 -0500 cmake: Return generator docs directly The GetGeneratorDocumentation() function was not accurately named and required the vector to populate to be passed as a function argument. This commit makes the slightly renamed function return by value, making it a true getter as implied by its name. Some minor refactoring of the implementation also makes the steps of populating the vector clearer. diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx index 6dc692e..44789b0 100644 --- a/Source/CursesDialog/ccmake.cxx +++ b/Source/CursesDialog/ccmake.cxx @@ -5,7 +5,7 @@ #include "cmCursesMainForm.h" #include "cmCursesStandardIncludes.h" #include "cmDocumentation.h" -#include "cmDocumentationEntry.h" +#include "cmDocumentationEntry.h" // IWYU pragma: keep #include "cmState.h" #include "cmSystemTools.h" #include "cmake.h" @@ -88,8 +88,7 @@ int main(int argc, char const* const* argv) hcm.SetHomeDirectory(""); hcm.SetHomeOutputDirectory(""); hcm.AddCMakePaths(); - std::vector generators; - hcm.GetGeneratorDocumentation(generators); + auto generators = hcm.GetGeneratorsDocumentation(); doc.SetName("ccmake"); doc.SetSection("Name", cmDocumentationName); doc.SetSection("Usage", cmDocumentationUsage); diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx index b4307bb..9f4e48e 100644 --- a/Source/QtDialog/CMakeSetup.cxx +++ b/Source/QtDialog/CMakeSetup.cxx @@ -69,8 +69,7 @@ int main(int argc, char** argv) hcm.SetHomeOutputDirectory(""); hcm.AddCMakePaths(); - std::vector generators; - hcm.GetGeneratorDocumentation(generators); + auto generators = hcm.GetGeneratorsDocumentation(); doc.SetName("cmake"); doc.SetSection("Name", cmDocumentationName); doc.SetSection("Usage", cmDocumentationUsage); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 9fcfbde..c53b597 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1924,13 +1924,19 @@ void cmake::SetIsInTryCompile(bool b) this->State->SetIsInTryCompile(b); } -void cmake::GetGeneratorDocumentation(std::vector& v) +void cmake::AppendGlobalGeneratorsDocumentation( + std::vector& v) { for (cmGlobalGeneratorFactory* g : this->Generators) { cmDocumentationEntry e; g->GetDocumentation(e); v.push_back(std::move(e)); } +} + +void cmake::AppendExtraGeneratorsDocumentation( + std::vector& v) +{ for (cmExternalMakefileProjectGeneratorFactory* eg : this->ExtraGenerators) { const std::string doc = eg->GetDocumentation(); const std::string name = eg->GetName(); @@ -1956,12 +1962,19 @@ void cmake::GetGeneratorDocumentation(std::vector& v) } } +std::vector cmake::GetGeneratorsDocumentation() +{ + std::vector v; + this->AppendGlobalGeneratorsDocumentation(v); + this->AppendExtraGeneratorsDocumentation(v); + return v; +} + void cmake::PrintGeneratorList() { #ifdef CMAKE_BUILD_WITH_CMAKE cmDocumentation doc; - std::vector generators; - this->GetGeneratorDocumentation(generators); + auto generators = this->GetGeneratorsDocumentation(); doc.AppendSection("Generators", generators); std::cerr << "\n"; doc.PrintDocumentation(cmDocumentation::ListGenerators, std::cerr); diff --git a/Source/cmake.h b/Source/cmake.h index cd8c622..1586845 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -292,7 +292,7 @@ public: cmVariableWatch* GetVariableWatch() { return this->VariableWatch; } #endif - void GetGeneratorDocumentation(std::vector&); + std::vector GetGeneratorsDocumentation(); ///! Set/Get a property of this target file void SetProperty(const std::string& prop, const char* value); @@ -533,6 +533,9 @@ private: void CreateDefaultGlobalGenerator(); + void AppendGlobalGeneratorsDocumentation(std::vector&); + void AppendExtraGeneratorsDocumentation(std::vector&); + /** * Convert a message type between a warning and an error, based on the state * of the error output CMake variables, in the cache. diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 84d1414..c1c9537 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -2,7 +2,7 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmAlgorithms.h" -#include "cmDocumentationEntry.h" +#include "cmDocumentationEntry.h" // IWYU pragma: keep #include "cmGlobalGenerator.h" #include "cmMakefile.h" #include "cmState.h" @@ -227,9 +227,7 @@ int do_cmake(int ac, char const* const* av) std::vector args(av, av + ac); hcm.SetCacheArgs(args); - std::vector generators; - - hcm.GetGeneratorDocumentation(generators); + auto generators = hcm.GetGeneratorsDocumentation(); doc.SetName("cmake"); doc.SetSection("Name", cmDocumentationName); ----------------------------------------------------------------------- Summary of changes: Modules/CMakeCCompiler.cmake.in | 1 + Modules/CMakeCUDACompiler.cmake.in | 1 + Modules/CMakeCXXCompiler.cmake.in | 1 + Modules/CMakeDetermineCompilerABI.cmake | 36 ++++++ Modules/CMakeParseImplicitIncludeInfo.cmake | 95 ++++++++++++++++ Modules/Compiler/NVIDIA-CUDA.cmake | 1 + Modules/Platform/UnixPaths.cmake | 7 ++ Source/CursesDialog/ccmake.cxx | 7 +- Source/QtDialog/CMakeSetup.cxx | 3 +- Source/cmCoreTryCompile.cxx | 4 +- Source/cmDocumentation.cxx | 15 ++- Source/cmDocumentationEntry.h | 1 + Source/cmDocumentationFormatter.cxx | 3 +- Source/cmLocalGenerator.cxx | 24 ++-- Source/cmake.cxx | 45 ++++++-- Source/cmake.h | 6 +- Source/cmakemain.cxx | 6 +- Tests/RunCMake/CMakeLists.txt | 1 + .../CMakeLists.txt | 0 .../ParseImplicitIncludeInfo.cmake | 95 ++++++++++++++++ .../ParseImplicitIncludeInfo/RunCMakeTest.cmake | 3 + .../ParseImplicitIncludeInfo/data/CMakeLists.txt | 85 ++++++++++++++ .../RunCMake/ParseImplicitIncludeInfo/data/README | 12 ++ .../data/craype-C-Cray-8.7.input | 53 +++++++++ .../data/craype-C-Cray-8.7.output | 1 + .../data/craype-C-GNU-7.3.0.input | 79 +++++++++++++ .../data/craype-C-GNU-7.3.0.output | 1 + .../data/craype-C-Intel-18.0.2.20180210.input | 40 +++++++ .../data/craype-C-Intel-18.0.2.20180210.output | 1 + .../data/craype-CXX-Cray-8.7.input | 53 +++++++++ .../data/craype-CXX-Cray-8.7.output | 1 + .../data/craype-CXX-GNU-7.3.0.input | 82 ++++++++++++++ .../data/craype-CXX-GNU-7.3.0.output | 1 + .../data/craype-CXX-Intel-18.0.2.20180210.input | 43 +++++++ .../data/craype-CXX-Intel-18.0.2.20180210.output | 1 + .../data/darwin-C-AppleClang-8.0.0.8000042.input | 50 +++++++++ .../data/darwin-C-AppleClang-8.0.0.8000042.output | 1 + .../data/darwin-CXX-AppleClang-8.0.0.8000042.input | 52 +++++++++ .../darwin-CXX-AppleClang-8.0.0.8000042.output | 1 + .../ParseImplicitIncludeInfo/data/empty-C.input | 14 +++ .../ParseImplicitIncludeInfo/data/empty-C.output} | 0 .../ParseImplicitIncludeInfo/data/empty-CXX.input | 14 +++ .../data/empty-CXX.output} | 0 .../data/freebsd-C-Clang-3.3.0.input | 38 +++++++ .../data/freebsd-C-Clang-3.3.0.output | 1 + .../data/freebsd-CXX-Clang-3.3.0.input | 45 ++++++++ .../data/freebsd-CXX-Clang-3.3.0.output | 1 + .../data/linux-C-GNU-7.3.0.input | 72 ++++++++++++ .../data/linux-C-GNU-7.3.0.output | 1 + .../data/linux-C-Intel-18.0.0.20170811.input | 43 +++++++ .../data/linux-C-Intel-18.0.0.20170811.output | 1 + .../data/linux-CUDA-NVIDIA-9.2.148.input | 124 +++++++++++++++++++++ .../data/linux-CUDA-NVIDIA-9.2.148.output | 1 + .../data/linux-CXX-GNU-7.3.0.input | 76 +++++++++++++ .../data/linux-CXX-GNU-7.3.0.output | 1 + .../data/linux-CXX-Intel-18.0.0.20170811.input | 46 ++++++++ .../data/linux-CXX-Intel-18.0.0.20170811.output | 1 + .../data/mingw.org-C-GNU-4.9.3.input | 70 ++++++++++++ .../data/mingw.org-C-GNU-4.9.3.output | 1 + .../data/mingw.org-CXX-GNU-4.9.3.input | 76 +++++++++++++ .../data/mingw.org-CXX-GNU-4.9.3.output | 1 + .../data/netbsd-C-GNU-4.8.5.input | 60 ++++++++++ .../data/netbsd-C-GNU-4.8.5.output | 1 + .../data/netbsd-CXX-GNU-4.8.5.input | 62 +++++++++++ .../data/netbsd-CXX-GNU-4.8.5.output | 1 + .../data/openbsd-C-Clang-5.0.1.input | 37 ++++++ .../data/openbsd-C-Clang-5.0.1.output | 1 + .../data/openbsd-CXX-Clang-5.0.1.input | 38 +++++++ .../data/openbsd-CXX-Clang-5.0.1.output | 1 + .../data/sunos-C-SunPro-5.13.0.input | 35 ++++++ .../data/sunos-C-SunPro-5.13.0.output} | 0 .../data/sunos-CXX-SunPro-5.13.0.input | 38 +++++++ .../data/sunos-CXX-SunPro-5.13.0.output} | 0 Tests/Server/cmakelib.py | 4 + 74 files changed, 1786 insertions(+), 31 deletions(-) create mode 100644 Modules/CMakeParseImplicitIncludeInfo.cmake copy Tests/RunCMake/{target_compile_features => ParseImplicitIncludeInfo}/CMakeLists.txt (100%) create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/CMakeLists.txt create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/README create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-C-Cray-8.7.input create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-C-Cray-8.7.output create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-C-GNU-7.3.0.input create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-C-GNU-7.3.0.output create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-C-Intel-18.0.2.20180210.input create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-C-Intel-18.0.2.20180210.output create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-Cray-8.7.input create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-Cray-8.7.output create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-GNU-7.3.0.input create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-GNU-7.3.0.output create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-Intel-18.0.2.20180210.input create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-CXX-Intel-18.0.2.20180210.output create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/darwin-C-AppleClang-8.0.0.8000042.input create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/darwin-C-AppleClang-8.0.0.8000042.output create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/darwin-CXX-AppleClang-8.0.0.8000042.input create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/darwin-CXX-AppleClang-8.0.0.8000042.output create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/empty-C.input copy Tests/{Wrapping/vtkIncluded.cxx => RunCMake/ParseImplicitIncludeInfo/data/empty-C.output} (100%) create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/empty-CXX.input copy Tests/{Wrapping/vtkIncluded.cxx => RunCMake/ParseImplicitIncludeInfo/data/empty-CXX.output} (100%) create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/freebsd-C-Clang-3.3.0.input create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/freebsd-C-Clang-3.3.0.output create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/freebsd-CXX-Clang-3.3.0.input create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/freebsd-CXX-Clang-3.3.0.output create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-C-GNU-7.3.0.input create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-C-GNU-7.3.0.output create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-C-Intel-18.0.0.20170811.input create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-C-Intel-18.0.0.20170811.output create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CUDA-NVIDIA-9.2.148.input create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CUDA-NVIDIA-9.2.148.output create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-GNU-7.3.0.input create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-GNU-7.3.0.output create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-Intel-18.0.0.20170811.input create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-Intel-18.0.0.20170811.output create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/mingw.org-C-GNU-4.9.3.input create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/mingw.org-C-GNU-4.9.3.output create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/mingw.org-CXX-GNU-4.9.3.input create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/mingw.org-CXX-GNU-4.9.3.output create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/netbsd-C-GNU-4.8.5.input create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/netbsd-C-GNU-4.8.5.output create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/netbsd-CXX-GNU-4.8.5.input create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/netbsd-CXX-GNU-4.8.5.output create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/openbsd-C-Clang-5.0.1.input create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/openbsd-C-Clang-5.0.1.output create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/openbsd-CXX-Clang-5.0.1.input create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/openbsd-CXX-Clang-5.0.1.output create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/sunos-C-SunPro-5.13.0.input copy Tests/{Wrapping/vtkIncluded.cxx => RunCMake/ParseImplicitIncludeInfo/data/sunos-C-SunPro-5.13.0.output} (100%) create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/sunos-CXX-SunPro-5.13.0.input copy Tests/{Wrapping/vtkIncluded.cxx => RunCMake/ParseImplicitIncludeInfo/data/sunos-CXX-SunPro-5.13.0.output} (100%) hooks/post-receive -- CMake From kwrobot at kitware.com Wed Jan 23 00:03:05 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 23 Jan 2019 00:03:05 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-1060-gfd54b85 Message-ID: <20190123050305.1B8221281EB@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via fd54b85937b9cbfbc04b05b9a0b9d143ea2be6e5 (commit) from fa5bf870df1ce5d9cbcf61be736beb0b1e87b85b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fd54b85937b9cbfbc04b05b9a0b9d143ea2be6e5 commit fd54b85937b9cbfbc04b05b9a0b9d143ea2be6e5 Author: Kitware Robot AuthorDate: Wed Jan 23 00:01:05 2019 -0500 Commit: Kitware Robot CommitDate: Wed Jan 23 00:01:05 2019 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 497feed..b06c382 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 13) -set(CMake_VERSION_PATCH 20190122) +set(CMake_VERSION_PATCH 20190123) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Wed Jan 23 08:23:06 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 23 Jan 2019 08:23:06 -0500 (EST) Subject: [Cmake-commits] CMake branch, release, updated. v3.13.3-3-g845a46f Message-ID: <20190123132306.AEDCA1137E8@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, release has been updated via 845a46fb743cc036edd45e941be41ca55a3910b2 (commit) via 6b85eea3656e30aca7249ca4b903884d3bc73020 (commit) via 2395b1b244743aaf28426a72f37d1aac96e3db9e (commit) from 8887ebc69b86606b388272d5c89ce11753bb4804 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Help/release/3.13.rst | 26 ++++++++++++++++++++++++++ Source/cmake.cxx | 7 +++++-- Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 12 +++++++++++- Tests/RunCMake/CommandLine/no-S-B-result.txt | 1 - Tests/RunCMake/CommandLine/no-S-B-stderr.txt | 5 ++++- 5 files changed, 46 insertions(+), 5 deletions(-) delete mode 100644 Tests/RunCMake/CommandLine/no-S-B-result.txt hooks/post-receive -- CMake From kwrobot at kitware.com Wed Jan 23 08:23:06 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 23 Jan 2019 08:23:06 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-1077-ga7f5cd4 Message-ID: <20190123132306.96A7311375D@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via a7f5cd45e135dd51d67176fc40e2d769ac5f7db8 (commit) via 22893baed1556420b93c4f3a62b4c450ac354040 (commit) via e898f48bbc944c5525f7f292b55cca8ae2fa4cae (commit) via c1247d861a42fa79e7ca4cc9a793b1fa1f012dce (commit) via 877eed30c7f3fa873b36ec3654c00c50a3977425 (commit) via d8788faa6634e4a837e9d62423bcf4969d90e560 (commit) via 845a46fb743cc036edd45e941be41ca55a3910b2 (commit) via 20861d758b5c8ee1791ac1f76088ba29431a4e16 (commit) via 68b51fb19af65610f6f36f3a3da2aa34ab0a9c59 (commit) via 6b85eea3656e30aca7249ca4b903884d3bc73020 (commit) via 5a0784ddea62ee653a3a1199d4ff2140868d2c1d (commit) via 405d9cb4b5cf9d849facda5dfa6ec02e57f33be7 (commit) via 3068a0d0dc87a57408c53b23e125b6c6de0c181a (commit) via f2fca92686fb360c433d06452700d90dcf62c9fa (commit) via e463133cd2a189d5d2ad3bf95caa4058a2c0d764 (commit) via 2395b1b244743aaf28426a72f37d1aac96e3db9e (commit) via 2993fc347af5db802721f1bbe0a0e05d19a28e89 (commit) from fd54b85937b9cbfbc04b05b9a0b9d143ea2be6e5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a7f5cd45e135dd51d67176fc40e2d769ac5f7db8 commit a7f5cd45e135dd51d67176fc40e2d769ac5f7db8 Merge: 22893ba 5a0784d Author: Brad King AuthorDate: Wed Jan 23 13:16:55 2019 +0000 Commit: Kitware Robot CommitDate: Wed Jan 23 08:17:49 2019 -0500 Merge topic 'tidy-pass-by-value' 5a0784ddea clang-tidy: Pass by value Acked-by: Kitware Robot Merge-request: !2836 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=22893baed1556420b93c4f3a62b4c450ac354040 commit 22893baed1556420b93c4f3a62b4c450ac354040 Merge: e898f48 405d9cb Author: Brad King AuthorDate: Wed Jan 23 13:16:11 2019 +0000 Commit: Kitware Robot CommitDate: Wed Jan 23 08:17:04 2019 -0500 Merge topic 'update-kwsys' 405d9cb4b5 Merge branch 'upstream-KWSys' into update-kwsys 3068a0d0dc KWSys 2019-01-22 (4fecfe6f) Acked-by: Kitware Robot Merge-request: !2833 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e898f48bbc944c5525f7f292b55cca8ae2fa4cae commit e898f48bbc944c5525f7f292b55cca8ae2fa4cae Merge: c1247d8 2993fc3 Author: Brad King AuthorDate: Wed Jan 23 13:15:53 2019 +0000 Commit: Kitware Robot CommitDate: Wed Jan 23 08:16:15 2019 -0500 Merge topic 'getmodulesfile-string' 2993fc347a cmMakefile: GetModulesFile() accepts std::string param Acked-by: Kitware Robot Merge-request: !2838 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c1247d861a42fa79e7ca4cc9a793b1fa1f012dce commit c1247d861a42fa79e7ca4cc9a793b1fa1f012dce Merge: 877eed3 f2fca92 Author: Brad King AuthorDate: Wed Jan 23 13:15:29 2019 +0000 Commit: Kitware Robot CommitDate: Wed Jan 23 08:15:36 2019 -0500 Merge topic 'cmake_build_jobs_supports_no_space' f2fca92686 cmake: --build supports '-jN' e463133cd2 Tests: Remove unused files from RunCMake.CommandLine test Acked-by: Kitware Robot Merge-request: !2819 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=877eed30c7f3fa873b36ec3654c00c50a3977425 commit 877eed30c7f3fa873b36ec3654c00c50a3977425 Merge: d8788fa 845a46f Author: Brad King AuthorDate: Wed Jan 23 08:13:29 2019 -0500 Commit: Brad King CommitDate: Wed Jan 23 08:13:29 2019 -0500 Merge branch 'release-3.13' https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d8788faa6634e4a837e9d62423bcf4969d90e560 commit d8788faa6634e4a837e9d62423bcf4969d90e560 Merge: fd54b85 20861d7 Author: Brad King AuthorDate: Wed Jan 23 13:12:55 2019 +0000 Commit: Kitware Robot CommitDate: Wed Jan 23 08:13:02 2019 -0500 Merge topic 'cmake-warn-no-src-build-dir' 20861d758b Merge branch 'backport-cmake-warn-no-src-build-dir' 68b51fb19a cmake: Convert no source/build dir error to warning 6b85eea365 Help: Add 3.13.4 release note for no source/build dir error/warning 2395b1b244 cmake: Convert no source/build dir error to warning Acked-by: Kitware Robot Merge-request: !2839 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=20861d758b5c8ee1791ac1f76088ba29431a4e16 commit 20861d758b5c8ee1791ac1f76088ba29431a4e16 Merge: 68b51fb 6b85eea Author: Brad King AuthorDate: Tue Jan 22 14:46:56 2019 -0500 Commit: Brad King CommitDate: Tue Jan 22 14:46:56 2019 -0500 Merge branch 'backport-cmake-warn-no-src-build-dir' https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=68b51fb19af65610f6f36f3a3da2aa34ab0a9c59 commit 68b51fb19af65610f6f36f3a3da2aa34ab0a9c59 Author: Craig Scott AuthorDate: Tue Jan 22 21:33:54 2019 +1100 Commit: Brad King CommitDate: Tue Jan 22 14:46:03 2019 -0500 cmake: Convert no source/build dir error to warning Temporarily restore previous behavior that allowed specifying no source or build directory to work, even though it was neither documented nor supported. This commit is expected to eventually be reverted to restore the fatal error for such cases. Relates: #18817 diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 065f6df..914c3b0 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -810,8 +810,11 @@ void cmake::SetArgs(const std::vector& args) if (this->CurrentWorkingMode == cmake::NORMAL_MODE && !haveSourceDir && !haveBinaryDir) { - cmSystemTools::Error("No source or binary directory provided"); - return; + this->IssueMessage( + MessageType::WARNING, + "No source or binary directory provided. Both will be assumed to be " + "the same as the current working directory, but note that this " + "warning will become a fatal error in future CMake releases."); } if (!haveSourceDir) { diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 0e04ad1..70fcdba 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -56,12 +56,22 @@ run_cmake_command(cache-empty-entry ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}/cache-empty-entry/) function(run_ExplicitDirs) + set(source_dir ${RunCMake_BINARY_DIR}/ExplicitDirsMissing) + + file(REMOVE_RECURSE "${source_dir}") + file(MAKE_DIRECTORY "${source_dir}") + file(WRITE ${source_dir}/CMakeLists.txt [=[ +cmake_minimum_required(VERSION 3.13) +project(ExplicitDirsMissing LANGUAGES NONE) +]=]) + run_cmake_command(no-S-B ${CMAKE_COMMAND} -E chdir ${source_dir} + ${CMAKE_COMMAND} -DFOO=BAR) + set(source_dir ${RunCMake_SOURCE_DIR}/ExplicitDirs) set(binary_dir ${RunCMake_BINARY_DIR}/ExplicitDirs-build) file(REMOVE_RECURSE "${binary_dir}") file(MAKE_DIRECTORY "${binary_dir}") - run_cmake_command(no-S-B ${CMAKE_COMMAND} -DFOO=BAR) run_cmake_command(S-arg ${CMAKE_COMMAND} -S ${source_dir} ${binary_dir}) run_cmake_command(S-arg-reverse-order ${CMAKE_COMMAND} ${binary_dir} -S${source_dir} ) run_cmake_command(S-no-arg ${CMAKE_COMMAND} -S ) diff --git a/Tests/RunCMake/CommandLine/no-S-B-result.txt b/Tests/RunCMake/CommandLine/no-S-B-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/CommandLine/no-S-B-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/CommandLine/no-S-B-stderr.txt b/Tests/RunCMake/CommandLine/no-S-B-stderr.txt index 7a94307..c166dcf 100644 --- a/Tests/RunCMake/CommandLine/no-S-B-stderr.txt +++ b/Tests/RunCMake/CommandLine/no-S-B-stderr.txt @@ -1 +1,4 @@ -CMake Error: No source or binary directory provided +CMake Warning: + No source or binary directory provided. Both will be assumed to be the + same as the current working directory, but note that this warning will + become a fatal error in future CMake releases. https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5a0784ddea62ee653a3a1199d4ff2140868d2c1d commit 5a0784ddea62ee653a3a1199d4ff2140868d2c1d Author: Regina Pfeifer AuthorDate: Mon Jan 21 17:15:21 2019 +0100 Commit: Brad King CommitDate: Tue Jan 22 13:03:04 2019 -0500 clang-tidy: Pass by value diff --git a/.clang-tidy b/.clang-tidy index aef99dc..626c754 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -11,7 +11,6 @@ misc-*,\ -misc-static-assert,\ modernize-*,\ -modernize-deprecated-headers,\ --modernize-pass-by-value,\ -modernize-raw-string-literal,\ -modernize-return-braced-init-list,\ -modernize-use-auto,\ diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index 29968af..46a428f 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -23,17 +23,15 @@ namespace { class DebGenerator { public: - DebGenerator(cmCPackLog* logger, std::string const& outputName, - std::string const& workDir, std::string const& topLevelDir, - std::string const& temporaryDir, + DebGenerator(cmCPackLog* logger, std::string outputName, std::string workDir, + std::string topLevelDir, std::string temporaryDir, const char* debianCompressionType, const char* debianArchiveType, - std::map const& controlValues, - bool genShLibs, std::string const& shLibsFilename, - bool genPostInst, std::string const& postInst, bool genPostRm, - std::string const& postRm, const char* controlExtra, - bool permissionStrctPolicy, - std::vector const& packageFiles); + std::map controlValues, + bool genShLibs, std::string shLibsFilename, bool genPostInst, + std::string postInst, bool genPostRm, std::string postRm, + const char* controlExtra, bool permissionStrctPolicy, + std::vector packageFiles); bool generate() const; @@ -66,31 +64,29 @@ private: }; DebGenerator::DebGenerator( - cmCPackLog* logger, std::string const& outputName, - std::string const& workDir, std::string const& topLevelDir, - std::string const& temporaryDir, const char* debianCompressionType, - const char* debianArchiveType, - std::map const& controlValues, bool genShLibs, - std::string const& shLibsFilename, bool genPostInst, - std::string const& postInst, bool genPostRm, std::string const& postRm, - const char* controlExtra, bool permissionStrictPolicy, - std::vector const& packageFiles) + cmCPackLog* logger, std::string outputName, std::string workDir, + std::string topLevelDir, std::string temporaryDir, + const char* debianCompressionType, const char* debianArchiveType, + std::map controlValues, bool genShLibs, + std::string shLibsFilename, bool genPostInst, std::string postInst, + bool genPostRm, std::string postRm, const char* controlExtra, + bool permissionStrictPolicy, std::vector packageFiles) : Logger(logger) - , OutputName(outputName) - , WorkDir(workDir) - , TopLevelDir(topLevelDir) - , TemporaryDir(temporaryDir) + , OutputName(std::move(outputName)) + , WorkDir(std::move(workDir)) + , TopLevelDir(std::move(topLevelDir)) + , TemporaryDir(std::move(temporaryDir)) , DebianArchiveType(debianArchiveType ? debianArchiveType : "gnutar") - , ControlValues(controlValues) + , ControlValues(std::move(controlValues)) , GenShLibs(genShLibs) - , ShLibsFilename(shLibsFilename) + , ShLibsFilename(std::move(shLibsFilename)) , GenPostInst(genPostInst) - , PostInst(postInst) + , PostInst(std::move(postInst)) , GenPostRm(genPostRm) - , PostRm(postRm) + , PostRm(std::move(postRm)) , ControlExtra(controlExtra) , PermissionStrictPolicy(permissionStrictPolicy) - , PackageFiles(packageFiles) + , PackageFiles(std::move(packageFiles)) { if (!debianCompressionType) { debianCompressionType = "gzip"; diff --git a/Source/CPack/cmCPackFreeBSDGenerator.cxx b/Source/CPack/cmCPackFreeBSDGenerator.cxx index 1e6b118..0ff0054 100644 --- a/Source/CPack/cmCPackFreeBSDGenerator.cxx +++ b/Source/CPack/cmCPackFreeBSDGenerator.cxx @@ -17,6 +17,7 @@ #include #include +#include cmCPackFreeBSDGenerator::cmCPackFreeBSDGenerator() : cmCPackArchiveGenerator(cmArchiveWrite::CompressXZ, "paxr") @@ -97,8 +98,8 @@ class ManifestKey public: std::string key; - ManifestKey(const std::string& k) - : key(k) + ManifestKey(std::string k) + : key(std::move(k)) { } @@ -115,9 +116,9 @@ class ManifestKeyValue : public ManifestKey public: std::string value; - ManifestKeyValue(const std::string& k, const std::string& v) + ManifestKeyValue(const std::string& k, std::string v) : ManifestKey(k) - , value(v) + , value(std::move(v)) { } diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index 55ef375..188ad69 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -20,15 +20,16 @@ #include #include #include +#include inline int ctrl(int z) { return (z & 037); } -cmCursesMainForm::cmCursesMainForm(std::vector const& args, +cmCursesMainForm::cmCursesMainForm(std::vector args, int initWidth) - : Args(args) + : Args(std::move(args)) , InitialWidth(initWidth) { this->NumberOfPages = 0; diff --git a/Source/CursesDialog/cmCursesMainForm.h b/Source/CursesDialog/cmCursesMainForm.h index 2c006cf..824025b 100644 --- a/Source/CursesDialog/cmCursesMainForm.h +++ b/Source/CursesDialog/cmCursesMainForm.h @@ -26,7 +26,7 @@ class cmCursesMainForm : public cmCursesForm CM_DISABLE_COPY(cmCursesMainForm) public: - cmCursesMainForm(std::vector const& args, int initwidth); + cmCursesMainForm(std::vector args, int initwidth); ~cmCursesMainForm() override; /** diff --git a/Source/QtDialog/QCMakeWidgets.cxx b/Source/QtDialog/QCMakeWidgets.cxx index b544b86..eab418f 100644 --- a/Source/QtDialog/QCMakeWidgets.cxx +++ b/Source/QtDialog/QCMakeWidgets.cxx @@ -7,10 +7,11 @@ #include #include #include +#include -QCMakeFileEditor::QCMakeFileEditor(QWidget* p, const QString& var) +QCMakeFileEditor::QCMakeFileEditor(QWidget* p, QString var) : QLineEdit(p) - , Variable(var) + , Variable(std::move(var)) { this->ToolButton = new QToolButton(this); this->ToolButton->setText("..."); diff --git a/Source/QtDialog/QCMakeWidgets.h b/Source/QtDialog/QCMakeWidgets.h index e63c197..5d2368e 100644 --- a/Source/QtDialog/QCMakeWidgets.h +++ b/Source/QtDialog/QCMakeWidgets.h @@ -18,7 +18,7 @@ class QCMakeFileEditor : public QLineEdit { Q_OBJECT public: - QCMakeFileEditor(QWidget* p, const QString& var); + QCMakeFileEditor(QWidget* p, QString var); protected slots: virtual void chooseFile() = 0; signals: diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index 2f8e675..9e3efd3 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -61,8 +61,8 @@ struct cmStrCmp : m_test(test) { } - cmStrCmp(const std::string& test) - : m_test(test) + cmStrCmp(std::string test) + : m_test(std::move(test)) { } diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index db7eb96..61fcf03 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -9,6 +9,7 @@ #include #include #include +#include #include class cmGeneratorTarget; @@ -31,9 +32,8 @@ public: struct Item { Item() {} - Item(std::string const& v, bool p, - cmGeneratorTarget const* target = nullptr) - : Value(v) + Item(std::string v, bool p, cmGeneratorTarget const* target = nullptr) + : Value(std::move(v)) , IsPath(p) , Target(target) { diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx index 33b9cf1..94ea529 100644 --- a/Source/cmConditionEvaluator.cxx +++ b/Source/cmConditionEvaluator.cxx @@ -8,6 +8,7 @@ #include #include #include +#include #include "cmAlgorithms.h" #include "cmMakefile.h" @@ -53,11 +54,11 @@ static std::string const keyVERSION_LESS = "VERSION_LESS"; static std::string const keyVERSION_LESS_EQUAL = "VERSION_LESS_EQUAL"; cmConditionEvaluator::cmConditionEvaluator(cmMakefile& makefile, - const cmListFileContext& context, - const cmListFileBacktrace& bt) + cmListFileContext context, + cmListFileBacktrace bt) : Makefile(makefile) - , ExecutionContext(context) - , Backtrace(bt) + , ExecutionContext(std::move(context)) + , Backtrace(std::move(bt)) , Policy12Status(makefile.GetPolicyStatus(cmPolicies::CMP0012)) , Policy54Status(makefile.GetPolicyStatus(cmPolicies::CMP0054)) , Policy57Status(makefile.GetPolicyStatus(cmPolicies::CMP0057)) diff --git a/Source/cmConditionEvaluator.h b/Source/cmConditionEvaluator.h index fc87a2d..59e1396 100644 --- a/Source/cmConditionEvaluator.h +++ b/Source/cmConditionEvaluator.h @@ -21,8 +21,8 @@ class cmConditionEvaluator public: typedef std::list cmArgumentList; - cmConditionEvaluator(cmMakefile& makefile, cmListFileContext const& context, - cmListFileBacktrace const& bt); + cmConditionEvaluator(cmMakefile& makefile, cmListFileContext context, + cmListFileBacktrace 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 diff --git a/Source/cmCustomCommand.cxx b/Source/cmCustomCommand.cxx index 9dcec2f..242ceaa 100644 --- a/Source/cmCustomCommand.cxx +++ b/Source/cmCustomCommand.cxx @@ -4,17 +4,19 @@ #include "cmMakefile.h" +#include + cmCustomCommand::cmCustomCommand(cmMakefile const* mf, - const std::vector& outputs, - const std::vector& byproducts, - const std::vector& depends, - const cmCustomCommandLines& commandLines, + std::vector outputs, + std::vector byproducts, + std::vector depends, + cmCustomCommandLines commandLines, const char* comment, const char* workingDirectory) - : Outputs(outputs) - , Byproducts(byproducts) - , Depends(depends) - , CommandLines(commandLines) + : Outputs(std::move(outputs)) + , Byproducts(std::move(byproducts)) + , Depends(std::move(depends)) + , CommandLines(std::move(commandLines)) , Comment(comment ? comment : "") , WorkingDirectory(workingDirectory ? workingDirectory : "") , HaveComment(comment != nullptr) diff --git a/Source/cmCustomCommand.h b/Source/cmCustomCommand.h index d82160b..50f15a4 100644 --- a/Source/cmCustomCommand.h +++ b/Source/cmCustomCommand.h @@ -23,12 +23,11 @@ class cmCustomCommand { public: /** Main constructor specifies all information for the command. */ - cmCustomCommand(cmMakefile const* mf, - const std::vector& outputs, - const std::vector& byproducts, - const std::vector& depends, - const cmCustomCommandLines& commandLines, - const char* comment, const char* workingDirectory); + cmCustomCommand(cmMakefile const* mf, std::vector outputs, + std::vector byproducts, + std::vector depends, + cmCustomCommandLines commandLines, const char* comment, + const char* workingDirectory); /** Get the output file produced by the command. */ const std::vector& GetOutputs() const; diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index d1c1736..6bf9946 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -16,10 +16,10 @@ #include cmCustomCommandGenerator::cmCustomCommandGenerator(cmCustomCommand const& cc, - const std::string& config, + std::string config, cmLocalGenerator* lg) : CC(cc) - , Config(config) + , Config(std::move(config)) , LG(lg) , OldStyle(cc.GetEscapeOldStyle()) , MakeVars(cc.GetEscapeAllowMakeVars()) diff --git a/Source/cmCustomCommandGenerator.h b/Source/cmCustomCommandGenerator.h index b7e2a39..9684cff 100644 --- a/Source/cmCustomCommandGenerator.h +++ b/Source/cmCustomCommandGenerator.h @@ -29,8 +29,8 @@ class cmCustomCommandGenerator const char* GetArgv0Location(unsigned int c) const; public: - cmCustomCommandGenerator(cmCustomCommand const& cc, - const std::string& config, cmLocalGenerator* lg); + cmCustomCommandGenerator(cmCustomCommand const& cc, std::string config, + cmLocalGenerator* lg); ~cmCustomCommandGenerator(); cmCustomCommand const& GetCC() const { return this->CC; } unsigned int GetNumberOfCommands() const; diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx index 3b3783a..976ba57 100644 --- a/Source/cmDepends.cxx +++ b/Source/cmDepends.cxx @@ -13,9 +13,9 @@ #include #include -cmDepends::cmDepends(cmLocalGenerator* lg, const std::string& targetDir) +cmDepends::cmDepends(cmLocalGenerator* lg, std::string targetDir) : LocalGenerator(lg) - , TargetDirectory(targetDir) + , TargetDirectory(std::move(targetDir)) , Dependee(new char[MaxPath]) , Depender(new char[MaxPath]) { diff --git a/Source/cmDepends.h b/Source/cmDepends.h index b0b5bb5..c5e1d5b 100644 --- a/Source/cmDepends.h +++ b/Source/cmDepends.h @@ -29,7 +29,7 @@ class cmDepends public: /** Instances need to know the build directory name and the relative path from the build directory to the target file. */ - cmDepends(cmLocalGenerator* lg = nullptr, const std::string& targetDir = ""); + cmDepends(cmLocalGenerator* lg = nullptr, std::string targetDir = ""); /** Set the local generator for the directory in which we are scanning dependencies. This is not a full local generator; it diff --git a/Source/cmExpandedCommandArgument.cxx b/Source/cmExpandedCommandArgument.cxx index 650a5ad..00848a6 100644 --- a/Source/cmExpandedCommandArgument.cxx +++ b/Source/cmExpandedCommandArgument.cxx @@ -2,13 +2,15 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmExpandedCommandArgument.h" +#include + cmExpandedCommandArgument::cmExpandedCommandArgument() { } -cmExpandedCommandArgument::cmExpandedCommandArgument(std::string const& value, +cmExpandedCommandArgument::cmExpandedCommandArgument(std::string value, bool quoted) - : Value(value) + : Value(std::move(value)) , Quoted(quoted) { } diff --git a/Source/cmExpandedCommandArgument.h b/Source/cmExpandedCommandArgument.h index d71fc92..69d35de 100644 --- a/Source/cmExpandedCommandArgument.h +++ b/Source/cmExpandedCommandArgument.h @@ -18,7 +18,7 @@ class cmExpandedCommandArgument { public: cmExpandedCommandArgument(); - cmExpandedCommandArgument(std::string const& value, bool quoted); + cmExpandedCommandArgument(std::string value, bool quoted); std::string const& GetValue() const; diff --git a/Source/cmExportSet.h b/Source/cmExportSet.h index 58ad617..0ef306f 100644 --- a/Source/cmExportSet.h +++ b/Source/cmExportSet.h @@ -6,6 +6,7 @@ #include "cmConfigure.h" // IWYU pragma: keep #include +#include #include class cmInstallExportGenerator; @@ -17,8 +18,8 @@ class cmExportSet { public: /// Construct an empty export set named \a name - cmExportSet(const std::string& name) - : Name(name) + cmExportSet(std::string name) + : Name(std::move(name)) { } /// Destructor diff --git a/Source/cmExternalMakefileProjectGenerator.cxx b/Source/cmExternalMakefileProjectGenerator.cxx index fecd821..150995f 100644 --- a/Source/cmExternalMakefileProjectGenerator.cxx +++ b/Source/cmExternalMakefileProjectGenerator.cxx @@ -2,6 +2,8 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmExternalMakefileProjectGenerator.h" +#include + class cmMakefile; void cmExternalMakefileProjectGenerator::EnableLanguage( @@ -32,10 +34,9 @@ bool cmExternalMakefileProjectGenerator::Open( } cmExternalMakefileProjectGeneratorFactory:: - cmExternalMakefileProjectGeneratorFactory(const std::string& n, - const std::string& doc) - : Name(n) - , Documentation(doc) + cmExternalMakefileProjectGeneratorFactory(std::string n, std::string doc) + : Name(std::move(n)) + , Documentation(std::move(doc)) { } diff --git a/Source/cmExternalMakefileProjectGenerator.h b/Source/cmExternalMakefileProjectGenerator.h index d48abca..492987d 100644 --- a/Source/cmExternalMakefileProjectGenerator.h +++ b/Source/cmExternalMakefileProjectGenerator.h @@ -70,8 +70,7 @@ protected: class cmExternalMakefileProjectGeneratorFactory { public: - cmExternalMakefileProjectGeneratorFactory(const std::string& n, - const std::string& doc); + cmExternalMakefileProjectGeneratorFactory(std::string n, std::string doc); virtual ~cmExternalMakefileProjectGeneratorFactory(); std::string GetName() const; diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx index 078d1d5..3363c9b 100644 --- a/Source/cmFileAPICodemodel.cxx +++ b/Source/cmFileAPICodemodel.cxx @@ -166,13 +166,13 @@ class BacktraceData } public: - BacktraceData(std::string const& topSource); + BacktraceData(std::string topSource); bool Add(cmListFileBacktrace const& bt, Json::ArrayIndex& index); Json::Value Dump(); }; -BacktraceData::BacktraceData(std::string const& topSource) - : TopSource(topSource) +BacktraceData::BacktraceData(std::string topSource) + : TopSource(std::move(topSource)) { } diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 9ae1cb9..2fc190c 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -1760,8 +1760,8 @@ bool cmFileListGeneratorBase::Consider(std::string const& fullPath, class cmFileListGeneratorFixed : public cmFileListGeneratorBase { public: - cmFileListGeneratorFixed(std::string const& str) - : String(str) + cmFileListGeneratorFixed(std::string str) + : String(std::move(str)) { } cmFileListGeneratorFixed(cmFileListGeneratorFixed const& r) @@ -1940,8 +1940,8 @@ private: class cmFileListGeneratorCaseInsensitive : public cmFileListGeneratorBase { public: - cmFileListGeneratorCaseInsensitive(std::string const& str) - : String(str) + cmFileListGeneratorCaseInsensitive(std::string str) + : String(std::move(str)) { } cmFileListGeneratorCaseInsensitive( @@ -1982,8 +1982,8 @@ private: class cmFileListGeneratorGlob : public cmFileListGeneratorBase { public: - cmFileListGeneratorGlob(std::string const& str) - : Pattern(str) + cmFileListGeneratorGlob(std::string str) + : Pattern(std::move(str)) { } cmFileListGeneratorGlob(cmFileListGeneratorGlob const& r) diff --git a/Source/cmFortranParser.h b/Source/cmFortranParser.h index 132b3e6..8d4c90b 100644 --- a/Source/cmFortranParser.h +++ b/Source/cmFortranParser.h @@ -8,6 +8,7 @@ # include # include +# include # include #endif @@ -114,10 +115,10 @@ int cmFortran_yyparse(yyscan_t); // Define parser object internal structure. struct cmFortranFile { - cmFortranFile(FILE* file, YY_BUFFER_STATE buffer, const std::string& dir) + cmFortranFile(FILE* file, YY_BUFFER_STATE buffer, std::string dir) : File(file) , Buffer(buffer) - , Directory(dir) + , Directory(std::move(dir)) , LastCharWasNewline(false) { } @@ -129,9 +130,8 @@ struct cmFortranFile struct cmFortranParser_s { - cmFortranParser_s(std::vector const& includes, - std::set const& defines, - cmFortranSourceInfo& info); + cmFortranParser_s(std::vector includes, + std::set defines, cmFortranSourceInfo& info); ~cmFortranParser_s(); bool FindIncludeFile(const char* dir, const char* includeName, diff --git a/Source/cmFortranParserImpl.cxx b/Source/cmFortranParserImpl.cxx index 01cbb78..45481a4 100644 --- a/Source/cmFortranParserImpl.cxx +++ b/Source/cmFortranParserImpl.cxx @@ -8,6 +8,7 @@ #include #include #include +#include #include bool cmFortranParser_s::FindIncludeFile(const char* dir, @@ -42,11 +43,11 @@ bool cmFortranParser_s::FindIncludeFile(const char* dir, return false; } -cmFortranParser_s::cmFortranParser_s(std::vector const& includes, - std::set const& defines, +cmFortranParser_s::cmFortranParser_s(std::vector includes, + std::set defines, cmFortranSourceInfo& info) - : IncludePath(includes) - , PPDefinitions(defines) + : IncludePath(std::move(includes)) + , PPDefinitions(std::move(defines)) , Info(info) { this->InInterface = false; diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index 96d4ad6..f3f9771 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -15,9 +15,8 @@ #include "cmGeneratorExpressionParser.h" #include "cmSystemTools.h" -cmGeneratorExpression::cmGeneratorExpression( - const cmListFileBacktrace& backtrace) - : Backtrace(backtrace) +cmGeneratorExpression::cmGeneratorExpression(cmListFileBacktrace backtrace) + : Backtrace(std::move(backtrace)) { } @@ -96,9 +95,9 @@ const std::string& cmCompiledGeneratorExpression::EvaluateWithContext( } cmCompiledGeneratorExpression::cmCompiledGeneratorExpression( - cmListFileBacktrace const& backtrace, const std::string& input) - : Backtrace(backtrace) - , Input(input) + cmListFileBacktrace backtrace, std::string input) + : Backtrace(std::move(backtrace)) + , Input(std::move(input)) , HadContextSensitiveCondition(false) , HadHeadSensitiveCondition(false) , EvaluateForBuildsystem(false) diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index 9c05f60..e5463a7 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -11,6 +11,7 @@ #include // IWYU pragma: keep #include #include +#include #include class cmCompiledGeneratorExpression; @@ -35,8 +36,7 @@ class cmGeneratorExpression public: /** Construct. */ - cmGeneratorExpression( - cmListFileBacktrace const& backtrace = cmListFileBacktrace()); + cmGeneratorExpression(cmListFileBacktrace backtrace = cmListFileBacktrace()); ~cmGeneratorExpression(); std::unique_ptr Parse( @@ -140,8 +140,8 @@ private: cmGeneratorExpressionContext& context, cmGeneratorExpressionDAGChecker* dagChecker) const; - cmCompiledGeneratorExpression(cmListFileBacktrace const& backtrace, - const std::string& input); + cmCompiledGeneratorExpression(cmListFileBacktrace backtrace, + std::string input); friend class cmGeneratorExpression; @@ -169,13 +169,13 @@ class cmGeneratorExpressionInterpreter public: cmGeneratorExpressionInterpreter(cmLocalGenerator* localGenerator, - std::string const& config, + std::string config, cmGeneratorTarget const* headTarget, - std::string const& lang = std::string()) + std::string lang = std::string()) : LocalGenerator(localGenerator) - , Config(config) + , Config(std::move(config)) , HeadTarget(headTarget) - , Language(lang) + , Language(std::move(lang)) { } diff --git a/Source/cmGeneratorExpressionContext.cxx b/Source/cmGeneratorExpressionContext.cxx index a6dde5d..6d97331 100644 --- a/Source/cmGeneratorExpressionContext.cxx +++ b/Source/cmGeneratorExpressionContext.cxx @@ -2,15 +2,17 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmGeneratorExpressionContext.h" +#include + cmGeneratorExpressionContext::cmGeneratorExpressionContext( - cmLocalGenerator* lg, std::string const& config, bool quiet, + cmLocalGenerator* lg, std::string config, bool quiet, cmGeneratorTarget const* headTarget, const cmGeneratorTarget* currentTarget, - bool evaluateForBuildsystem, cmListFileBacktrace const& backtrace, - std::string const& language) - : Backtrace(backtrace) + bool evaluateForBuildsystem, cmListFileBacktrace backtrace, + std::string language) + : Backtrace(std::move(backtrace)) , LG(lg) - , Config(config) - , Language(language) + , Config(std::move(config)) + , Language(std::move(language)) , HeadTarget(headTarget) , CurrentTarget(currentTarget) , Quiet(quiet) diff --git a/Source/cmGeneratorExpressionContext.h b/Source/cmGeneratorExpressionContext.h index 5b0123e..6e076bf 100644 --- a/Source/cmGeneratorExpressionContext.h +++ b/Source/cmGeneratorExpressionContext.h @@ -14,12 +14,12 @@ class cmLocalGenerator; struct cmGeneratorExpressionContext { - cmGeneratorExpressionContext(cmLocalGenerator* lg, std::string const& config, + cmGeneratorExpressionContext(cmLocalGenerator* lg, std::string config, bool quiet, const cmGeneratorTarget* headTarget, cmGeneratorTarget const* currentTarget, bool evaluateForBuildsystem, - cmListFileBacktrace const& backtrace, - std::string const& language); + cmListFileBacktrace backtrace, + std::string language); cmListFileBacktrace Backtrace; std::set DependTargets; diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx index 61b798b..0f26e70 100644 --- a/Source/cmGeneratorExpressionDAGChecker.cxx +++ b/Source/cmGeneratorExpressionDAGChecker.cxx @@ -15,26 +15,26 @@ #include cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker( - const cmListFileBacktrace& backtrace, cmGeneratorTarget const* target, - const std::string& property, const GeneratorExpressionContent* content, + cmListFileBacktrace backtrace, cmGeneratorTarget const* target, + std::string property, const GeneratorExpressionContent* content, cmGeneratorExpressionDAGChecker* parent) : Parent(parent) , Target(target) - , Property(property) + , Property(std::move(property)) , Content(content) - , Backtrace(backtrace) + , Backtrace(std::move(backtrace)) , TransitivePropertiesOnly(false) { Initialize(); } cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker( - cmGeneratorTarget const* target, const std::string& property, + cmGeneratorTarget const* target, std::string property, const GeneratorExpressionContent* content, cmGeneratorExpressionDAGChecker* parent) : Parent(parent) , Target(target) - , Property(property) + , Property(std::move(property)) , Content(content) , Backtrace() , TransitivePropertiesOnly(false) diff --git a/Source/cmGeneratorExpressionDAGChecker.h b/Source/cmGeneratorExpressionDAGChecker.h index 1525c39..e1fba5e 100644 --- a/Source/cmGeneratorExpressionDAGChecker.h +++ b/Source/cmGeneratorExpressionDAGChecker.h @@ -42,13 +42,13 @@ class cmGeneratorTarget; struct cmGeneratorExpressionDAGChecker { - cmGeneratorExpressionDAGChecker(const cmListFileBacktrace& backtrace, + cmGeneratorExpressionDAGChecker(cmListFileBacktrace backtrace, cmGeneratorTarget const* target, - const std::string& property, + std::string property, const GeneratorExpressionContent* content, cmGeneratorExpressionDAGChecker* parent); cmGeneratorExpressionDAGChecker(cmGeneratorTarget const* target, - const std::string& property, + std::string property, const GeneratorExpressionContent* content, cmGeneratorExpressionDAGChecker* parent); diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx index 1c33a6e..326cb0e 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.cxx +++ b/Source/cmGeneratorExpressionEvaluationFile.cxx @@ -18,11 +18,11 @@ #include "cmSystemTools.h" cmGeneratorExpressionEvaluationFile::cmGeneratorExpressionEvaluationFile( - const std::string& input, + std::string input, std::unique_ptr outputFileExpr, std::unique_ptr condition, bool inputIsContent, cmPolicies::PolicyStatus policyStatusCMP0070) - : Input(input) + : Input(std::move(input)) , OutputFileExpr(std::move(outputFileExpr)) , Condition(std::move(condition)) , InputIsContent(inputIsContent) diff --git a/Source/cmGeneratorExpressionEvaluationFile.h b/Source/cmGeneratorExpressionEvaluationFile.h index 2a79069..89a2390 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.h +++ b/Source/cmGeneratorExpressionEvaluationFile.h @@ -20,7 +20,7 @@ class cmGeneratorExpressionEvaluationFile { public: cmGeneratorExpressionEvaluationFile( - const std::string& input, + std::string input, std::unique_ptr outputFileExpr, std::unique_ptr condition, bool inputIsContent, cmPolicies::PolicyStatus policyStatusCMP0070); diff --git a/Source/cmGeneratorExpressionParser.cxx b/Source/cmGeneratorExpressionParser.cxx index 489970c..949a86d 100644 --- a/Source/cmGeneratorExpressionParser.cxx +++ b/Source/cmGeneratorExpressionParser.cxx @@ -9,8 +9,8 @@ #include cmGeneratorExpressionParser::cmGeneratorExpressionParser( - const std::vector& tokens) - : Tokens(tokens) + std::vector tokens) + : Tokens(std::move(tokens)) , NestingLevel(0) { } diff --git a/Source/cmGeneratorExpressionParser.h b/Source/cmGeneratorExpressionParser.h index 633381c..e663496 100644 --- a/Source/cmGeneratorExpressionParser.h +++ b/Source/cmGeneratorExpressionParser.h @@ -13,8 +13,7 @@ struct cmGeneratorExpressionEvaluator; struct cmGeneratorExpressionParser { - cmGeneratorExpressionParser( - const std::vector& tokens); + cmGeneratorExpressionParser(std::vector tokens); void Parse(std::vector& result); diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index eb3d4af..0e3ace3 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -14,6 +14,7 @@ #include #include #include +#include #include "cmAlgorithms.h" #include "cmComputeLinkInformation.h" @@ -1805,10 +1806,10 @@ class cmTargetCollectLinkLanguages { public: cmTargetCollectLinkLanguages(cmGeneratorTarget const* target, - const std::string& config, + std::string config, std::unordered_set& languages, cmGeneratorTarget const* head) - : Config(config) + : Config(std::move(config)) , Languages(languages) , HeadTarget(head) , Target(target) diff --git a/Source/cmGlobVerificationManager.h b/Source/cmGlobVerificationManager.h index cdbd275..c293a76 100644 --- a/Source/cmGlobVerificationManager.h +++ b/Source/cmGlobVerificationManager.h @@ -55,13 +55,13 @@ private: const bool FollowSymlinks; const std::string Relative; const std::string Expression; - CacheEntryKey(const bool rec, const bool l, const bool s, - const std::string& rel, const std::string& e) + CacheEntryKey(const bool rec, const bool l, const bool s, std::string rel, + std::string e) : Recurse(rec) , ListDirectories(l) , FollowSymlinks(s) - , Relative(rel) - , Expression(e) + , Relative(std::move(rel)) + , Expression(std::move(e)) { } bool operator<(const CacheEntryKey& r) const; diff --git a/Source/cmGraphAdjacencyList.h b/Source/cmGraphAdjacencyList.h index fb2eee2..5ca9269 100644 --- a/Source/cmGraphAdjacencyList.h +++ b/Source/cmGraphAdjacencyList.h @@ -7,6 +7,7 @@ #include "cmListFileCache.h" +#include #include /** @@ -17,10 +18,10 @@ class cmGraphEdge { public: - cmGraphEdge(int n, bool s, cmListFileBacktrace const& bt) + cmGraphEdge(int n, bool s, cmListFileBacktrace bt) : Dest(n) , Strong(s) - , Backtrace(bt) + , Backtrace(std::move(bt)) { } operator int() const { return this->Dest; } diff --git a/Source/cmInstallCommandArguments.cxx b/Source/cmInstallCommandArguments.cxx index 538aa9f..4f872f4 100644 --- a/Source/cmInstallCommandArguments.cxx +++ b/Source/cmInstallCommandArguments.cxx @@ -16,7 +16,7 @@ const char* cmInstallCommandArguments::PermissionsTable[] = { const std::string cmInstallCommandArguments::EmptyString; cmInstallCommandArguments::cmInstallCommandArguments( - const std::string& defaultComponent) + std::string defaultComponent) : Destination(&Parser, "DESTINATION", &ArgumentGroup) , Component(&Parser, "COMPONENT", &ArgumentGroup) , NamelinkComponent(&Parser, "NAMELINK_COMPONENT", &ArgumentGroup) @@ -29,7 +29,7 @@ cmInstallCommandArguments::cmInstallCommandArguments( , NamelinkSkip(&Parser, "NAMELINK_SKIP", &ArgumentGroup) , Type(&Parser, "TYPE", &ArgumentGroup) , GenericArguments(nullptr) - , DefaultComponentName(defaultComponent) + , DefaultComponentName(std::move(defaultComponent)) { } diff --git a/Source/cmInstallCommandArguments.h b/Source/cmInstallCommandArguments.h index 425e58a..8e974af 100644 --- a/Source/cmInstallCommandArguments.h +++ b/Source/cmInstallCommandArguments.h @@ -13,7 +13,7 @@ class cmInstallCommandArguments { public: - cmInstallCommandArguments(const std::string& defaultComponent); + cmInstallCommandArguments(std::string defaultComponent); void SetGenericArguments(cmInstallCommandArguments* args) { this->GenericArguments = args; diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 86c6a58..08f46aa 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -22,18 +22,18 @@ #include "cmake.h" cmInstallTargetGenerator::cmInstallTargetGenerator( - const std::string& targetName, const char* dest, bool implib, + std::string targetName, const char* dest, bool implib, const char* file_permissions, std::vector const& configurations, const char* component, MessageLevel message, bool exclude_from_all, - bool optional, cmListFileBacktrace const& backtrace) + bool optional, cmListFileBacktrace backtrace) : cmInstallGenerator(dest, configurations, component, message, exclude_from_all) - , TargetName(targetName) + , TargetName(std::move(targetName)) , Target(nullptr) , FilePermissions(file_permissions) , ImportLibrary(implib) , Optional(optional) - , Backtrace(backtrace) + , Backtrace(std::move(backtrace)) { this->ActionsPerConfig = true; this->NamelinkMode = NamelinkModeNone; diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h index bf625d1..715b4ae 100644 --- a/Source/cmInstallTargetGenerator.h +++ b/Source/cmInstallTargetGenerator.h @@ -23,11 +23,11 @@ class cmInstallTargetGenerator : public cmInstallGenerator { public: cmInstallTargetGenerator( - std::string const& targetName, const char* dest, bool implib, + std::string targetName, const char* dest, bool implib, const char* file_permissions, std::vector const& configurations, const char* component, MessageLevel message, bool exclude_from_all, bool optional, - cmListFileBacktrace const& backtrace = cmListFileBacktrace()); + cmListFileBacktrace backtrace = cmListFileBacktrace()); ~cmInstallTargetGenerator() override; /** Select the policy for installing shared library linkable name diff --git a/Source/cmLinkItem.cxx b/Source/cmLinkItem.cxx index 12a07f6..b035c8c 100644 --- a/Source/cmLinkItem.cxx +++ b/Source/cmLinkItem.cxx @@ -10,16 +10,15 @@ cmLinkItem::cmLinkItem() { } -cmLinkItem::cmLinkItem(std::string const& n, cmListFileBacktrace const& bt) - : String(n) - , Backtrace(bt) +cmLinkItem::cmLinkItem(std::string n, cmListFileBacktrace bt) + : String(std::move(n)) + , Backtrace(std::move(bt)) { } -cmLinkItem::cmLinkItem(cmGeneratorTarget const* t, - cmListFileBacktrace const& bt) +cmLinkItem::cmLinkItem(cmGeneratorTarget const* t, cmListFileBacktrace bt) : Target(t) - , Backtrace(bt) + , Backtrace(std::move(bt)) { } diff --git a/Source/cmLinkItem.h b/Source/cmLinkItem.h index b841509..d2459db 100644 --- a/Source/cmLinkItem.h +++ b/Source/cmLinkItem.h @@ -24,8 +24,8 @@ class cmLinkItem public: cmLinkItem(); - cmLinkItem(std::string const& s, cmListFileBacktrace const& bt); - cmLinkItem(cmGeneratorTarget const* t, cmListFileBacktrace const& bt); + cmLinkItem(std::string s, cmListFileBacktrace bt); + cmLinkItem(cmGeneratorTarget const* t, cmListFileBacktrace bt); std::string const& AsStr() const; cmGeneratorTarget const* Target = nullptr; cmListFileBacktrace Backtrace; diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index b826795..05b22cf 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -659,15 +659,14 @@ bool cmListCommand::HandleTransformCommand( // Transform: lambda function implementing the action struct ActionDescriptor { - ActionDescriptor(const std::string& name) - : Name(name) + ActionDescriptor(std::string name) + : Name(std::move(name)) { } - ActionDescriptor(const std::string& name, int arity, - const transform_type& transform) - : Name(name) + ActionDescriptor(std::string name, int arity, transform_type transform) + : Name(std::move(name)) , Arity(arity) - , Transform(transform) + , Transform(std::move(transform)) { } diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index 9aa1f32..ff793f6 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -24,7 +24,7 @@ cmCommandContext::cmCommandName& cmCommandContext::cmCommandName::operator=( struct cmListFileParser { - cmListFileParser(cmListFile* lf, cmListFileBacktrace const& lfbt, + cmListFileParser(cmListFile* lf, cmListFileBacktrace lfbt, cmMessenger* messenger, const char* filename); ~cmListFileParser(); void IssueFileOpenError(std::string const& text) const; @@ -47,12 +47,11 @@ struct cmListFileParser } Separation; }; -cmListFileParser::cmListFileParser(cmListFile* lf, - cmListFileBacktrace const& lfbt, +cmListFileParser::cmListFileParser(cmListFile* lf, cmListFileBacktrace lfbt, cmMessenger* messenger, const char* filename) : ListFile(lf) - , Backtrace(lfbt) + , Backtrace(std::move(lfbt)) , Messenger(messenger) , FileName(filename) , Lexer(cmListFileLexer_New()) diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h index 4a247ba..529c389 100644 --- a/Source/cmListFileCache.h +++ b/Source/cmListFileCache.h @@ -51,8 +51,8 @@ struct cmListFileArgument Bracket }; cmListFileArgument() {} - cmListFileArgument(const std::string& v, Delimiter d, long line) - : Value(v) + cmListFileArgument(std::string v, Delimiter d, long line) + : Value(std::move(v)) , Delim(d) , Line(line) { diff --git a/Source/cmLocalCommonGenerator.cxx b/Source/cmLocalCommonGenerator.cxx index 7ce2c82..c6d2c58 100644 --- a/Source/cmLocalCommonGenerator.cxx +++ b/Source/cmLocalCommonGenerator.cxx @@ -12,10 +12,9 @@ class cmGlobalGenerator; cmLocalCommonGenerator::cmLocalCommonGenerator(cmGlobalGenerator* gg, - cmMakefile* mf, - std::string const& wd) + cmMakefile* mf, std::string wd) : cmLocalGenerator(gg, mf) - , WorkingDirectory(wd) + , WorkingDirectory(std::move(wd)) { // Store the configuration name that will be generated. if (const char* config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE")) { diff --git a/Source/cmLocalCommonGenerator.h b/Source/cmLocalCommonGenerator.h index 7b8e6fe..abebbc2 100644 --- a/Source/cmLocalCommonGenerator.h +++ b/Source/cmLocalCommonGenerator.h @@ -22,7 +22,7 @@ class cmLocalCommonGenerator : public cmLocalGenerator { public: cmLocalCommonGenerator(cmGlobalGenerator* gg, cmMakefile* mf, - std::string const& wd); + std::string wd); ~cmLocalCommonGenerator() override; std::string const& GetConfigName() { return this->ConfigName; } diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 5b9d108..c50dcb7 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1733,9 +1733,9 @@ class NotInProjectDir { public: // Constructor with the source and binary directory's path - NotInProjectDir(const std::string& sourceDir, const std::string& binaryDir) - : SourceDir(sourceDir) - , BinaryDir(binaryDir) + NotInProjectDir(std::string sourceDir, std::string binaryDir) + : SourceDir(std::move(sourceDir)) + , BinaryDir(std::move(binaryDir)) { } diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index c0d0e13..5268e6b 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -12,6 +12,7 @@ #include #include #include +#include #include class cmCustomCommand; @@ -267,9 +268,9 @@ private: cmGeneratorTarget* Target = nullptr; std::string Language; LocalObjectEntry() {} - LocalObjectEntry(cmGeneratorTarget* t, const std::string& lang) + LocalObjectEntry(cmGeneratorTarget* t, std::string lang) : Target(t) - , Language(lang) + , Language(std::move(lang)) { } }; diff --git a/Source/cmOSXBundleGenerator.cxx b/Source/cmOSXBundleGenerator.cxx index 2b96785..6857d5a 100644 --- a/Source/cmOSXBundleGenerator.cxx +++ b/Source/cmOSXBundleGenerator.cxx @@ -10,15 +10,16 @@ #include "cmTarget.h" #include +#include class cmSourceFile; cmOSXBundleGenerator::cmOSXBundleGenerator(cmGeneratorTarget* target, - const std::string& configName) + std::string configName) : GT(target) , Makefile(target->Target->GetMakefile()) , LocalGenerator(target->GetLocalGenerator()) - , ConfigName(configName) + , ConfigName(std::move(configName)) , MacContentFolders(nullptr) { if (this->MustSkip()) { diff --git a/Source/cmOSXBundleGenerator.h b/Source/cmOSXBundleGenerator.h index be7e932..ba5bee0 100644 --- a/Source/cmOSXBundleGenerator.h +++ b/Source/cmOSXBundleGenerator.h @@ -17,8 +17,7 @@ class cmSourceFile; class cmOSXBundleGenerator { public: - cmOSXBundleGenerator(cmGeneratorTarget* target, - const std::string& configName); + cmOSXBundleGenerator(cmGeneratorTarget* target, std::string configName); // create an app bundle at a given root, and return // the directory within the bundle that contains the executable diff --git a/Source/cmPathLabel.cxx b/Source/cmPathLabel.cxx index 4793206..fb81351 100644 --- a/Source/cmPathLabel.cxx +++ b/Source/cmPathLabel.cxx @@ -2,8 +2,10 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmPathLabel.h" -cmPathLabel::cmPathLabel(const std::string& label) - : Label(label) +#include + +cmPathLabel::cmPathLabel(std::string label) + : Label(std::move(label)) , Hash(0) { // Use a Jenkins one-at-a-time hash with under/over-flow protection diff --git a/Source/cmPathLabel.h b/Source/cmPathLabel.h index 97551fb..55dffab 100644 --- a/Source/cmPathLabel.h +++ b/Source/cmPathLabel.h @@ -17,7 +17,7 @@ class cmPathLabel { public: - cmPathLabel(const std::string& label); + cmPathLabel(std::string label); // The comparison operators are only for quick sorting and searching and // in no way imply any lexicographical order of the label diff --git a/Source/cmPipeConnection.cxx b/Source/cmPipeConnection.cxx index 999d6f3..1eede13 100644 --- a/Source/cmPipeConnection.cxx +++ b/Source/cmPipeConnection.cxx @@ -6,10 +6,10 @@ #include "cmServer.h" -cmPipeConnection::cmPipeConnection(const std::string& name, +cmPipeConnection::cmPipeConnection(std::string name, cmConnectionBufferStrategy* bufferStrategy) : cmEventBasedConnection(bufferStrategy) - , PipeName(name) + , PipeName(std::move(name)) { } diff --git a/Source/cmPipeConnection.h b/Source/cmPipeConnection.h index 49f9fdf..e67f15c 100644 --- a/Source/cmPipeConnection.h +++ b/Source/cmPipeConnection.h @@ -13,7 +13,7 @@ class cmPipeConnection : public cmEventBasedConnection { public: - cmPipeConnection(const std::string& name, + cmPipeConnection(std::string name, cmConnectionBufferStrategy* bufferStrategy = nullptr); bool OnServeStart(std::string* pString) override; diff --git a/Source/cmQtAutoGeneratorMocUic.h b/Source/cmQtAutoGeneratorMocUic.h index 9ec1def..0df2cff 100644 --- a/Source/cmQtAutoGeneratorMocUic.h +++ b/Source/cmQtAutoGeneratorMocUic.h @@ -49,8 +49,8 @@ public: { } - KeyExpT(std::string const& key, std::string const& exp) - : Key(key) + KeyExpT(std::string key, std::string const& exp) + : Key(std::move(key)) , Exp(exp) { } @@ -240,10 +240,10 @@ public: class JobMocT : public JobT { public: - JobMocT(std::string&& sourceFile, std::string const& includerFile, + JobMocT(std::string&& sourceFile, std::string includerFile, std::string&& includeString) : SourceFile(std::move(sourceFile)) - , IncluderFile(includerFile) + , IncluderFile(std::move(includerFile)) , IncludeString(std::move(includeString)) { } @@ -269,10 +269,10 @@ public: class JobUicT : public JobT { public: - JobUicT(std::string&& sourceFile, std::string const& includerFile, + JobUicT(std::string&& sourceFile, std::string includerFile, std::string&& includeString) : SourceFile(std::move(sourceFile)) - , IncluderFile(includerFile) + , IncluderFile(std::move(includerFile)) , IncludeString(std::move(includeString)) { } diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx index 2866a39..55204d7 100644 --- a/Source/cmRST.cxx +++ b/Source/cmRST.cxx @@ -13,9 +13,9 @@ #include #include -cmRST::cmRST(std::ostream& os, std::string const& docroot) +cmRST::cmRST(std::ostream& os, std::string docroot) : OS(os) - , DocRoot(docroot) + , DocRoot(std::move(docroot)) , IncludeDepth(0) , OutputLinePending(false) , LastLineEndedInColonColon(false) diff --git a/Source/cmRST.h b/Source/cmRST.h index ee47867..d8d2a0b 100644 --- a/Source/cmRST.h +++ b/Source/cmRST.h @@ -25,7 +25,7 @@ class cmRST { public: - cmRST(std::ostream& os, std::string const& docroot); + cmRST(std::ostream& os, std::string docroot); bool ProcessFile(std::string const& fname, bool isModule = false); private: diff --git a/Source/cmRulePlaceholderExpander.cxx b/Source/cmRulePlaceholderExpander.cxx index c3e8ff5..e347a2c 100644 --- a/Source/cmRulePlaceholderExpander.cxx +++ b/Source/cmRulePlaceholderExpander.cxx @@ -10,13 +10,13 @@ #include "cmSystemTools.h" cmRulePlaceholderExpander::cmRulePlaceholderExpander( - std::map const& compilers, - std::map const& variableMappings, - std::string const& compilerSysroot, std::string const& linkerSysroot) - : Compilers(compilers) - , VariableMappings(variableMappings) - , CompilerSysroot(compilerSysroot) - , LinkerSysroot(linkerSysroot) + std::map compilers, + std::map variableMappings, + std::string compilerSysroot, std::string linkerSysroot) + : Compilers(std::move(compilers)) + , VariableMappings(std::move(variableMappings)) + , CompilerSysroot(std::move(compilerSysroot)) + , LinkerSysroot(std::move(linkerSysroot)) { } diff --git a/Source/cmRulePlaceholderExpander.h b/Source/cmRulePlaceholderExpander.h index 7aa63db..5c03637 100644 --- a/Source/cmRulePlaceholderExpander.h +++ b/Source/cmRulePlaceholderExpander.h @@ -15,9 +15,9 @@ class cmRulePlaceholderExpander { public: cmRulePlaceholderExpander( - std::map const& compilers, - std::map const& variableMappings, - std::string const& compilerSysroot, std::string const& linkerSysroot); + std::map compilers, + std::map variableMappings, + std::string compilerSysroot, std::string linkerSysroot); void SetTargetImpLib(std::string const& targetImpLib) { diff --git a/Source/cmScriptGenerator.cxx b/Source/cmScriptGenerator.cxx index 2cae714..ae0a158 100644 --- a/Source/cmScriptGenerator.cxx +++ b/Source/cmScriptGenerator.cxx @@ -4,11 +4,12 @@ #include "cmSystemTools.h" -cmScriptGenerator::cmScriptGenerator( - const std::string& config_var, - std::vector const& configurations) - : RuntimeConfigVariable(config_var) - , Configurations(configurations) +#include + +cmScriptGenerator::cmScriptGenerator(std::string config_var, + std::vector configurations) + : RuntimeConfigVariable(std::move(config_var)) + , Configurations(std::move(configurations)) , ConfigurationName("") , ConfigurationTypes(nullptr) , ActionsPerConfig(false) diff --git a/Source/cmScriptGenerator.h b/Source/cmScriptGenerator.h index 0bb388e..725cbc6 100644 --- a/Source/cmScriptGenerator.h +++ b/Source/cmScriptGenerator.h @@ -47,8 +47,8 @@ class cmScriptGenerator CM_DISABLE_COPY(cmScriptGenerator) public: - cmScriptGenerator(const std::string& config_var, - std::vector const& configurations); + cmScriptGenerator(std::string config_var, + std::vector configurations); virtual ~cmScriptGenerator(); void Generate(std::ostream& os, const std::string& config, diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx index 11a3f46..c3c8156 100644 --- a/Source/cmServerProtocol.cxx +++ b/Source/cmServerProtocol.cxx @@ -20,6 +20,7 @@ #include #include #include +#include #include // Get rid of some windows macros: @@ -39,11 +40,10 @@ std::vector toStringList(const Json::Value& in) } // namespace cmServerRequest::cmServerRequest(cmServer* server, cmConnection* connection, - const std::string& t, const std::string& c, - const Json::Value& d) - : Type(t) - , Cookie(c) - , Data(d) + std::string t, std::string c, Json::Value d) + : Type(std::move(t)) + , Cookie(std::move(c)) + , Data(std::move(d)) , Connection(connection) , m_Server(server) { @@ -707,15 +707,15 @@ cmServerResponse cmServerProtocol1::ProcessCTests( } cmServerProtocol1::GeneratorInformation::GeneratorInformation( - const std::string& generatorName, const std::string& extraGeneratorName, - const std::string& toolset, const std::string& platform, - const std::string& sourceDirectory, const std::string& buildDirectory) - : GeneratorName(generatorName) - , ExtraGeneratorName(extraGeneratorName) - , Toolset(toolset) - , Platform(platform) - , SourceDirectory(sourceDirectory) - , BuildDirectory(buildDirectory) + std::string generatorName, std::string extraGeneratorName, + std::string toolset, std::string platform, std::string sourceDirectory, + std::string buildDirectory) + : GeneratorName(std::move(generatorName)) + , ExtraGeneratorName(std::move(extraGeneratorName)) + , Toolset(std::move(toolset)) + , Platform(std::move(platform)) + , SourceDirectory(std::move(sourceDirectory)) + , BuildDirectory(std::move(buildDirectory)) { } diff --git a/Source/cmServerProtocol.h b/Source/cmServerProtocol.h index df71cff..2d1507b 100644 --- a/Source/cmServerProtocol.h +++ b/Source/cmServerProtocol.h @@ -56,9 +56,8 @@ public: cmConnection* Connection; private: - cmServerRequest(cmServer* server, cmConnection* connection, - const std::string& t, const std::string& c, - const Json::Value& d); + cmServerRequest(cmServer* server, cmConnection* connection, std::string t, + std::string c, Json::Value d); void ReportProgress(int min, int current, int max, const std::string& message) const; @@ -140,12 +139,10 @@ private: { public: GeneratorInformation() = default; - GeneratorInformation(const std::string& generatorName, - const std::string& extraGeneratorName, - const std::string& toolset, - const std::string& platform, - const std::string& sourceDirectory, - const std::string& buildDirectory); + GeneratorInformation(std::string generatorName, + std::string extraGeneratorName, std::string toolset, + std::string platform, std::string sourceDirectory, + std::string buildDirectory); void SetupGenerator(cmake* cm, std::string* errorMessage); diff --git a/Source/cmSourceGroup.cxx b/Source/cmSourceGroup.cxx index 12ef62b..7e1e836 100644 --- a/Source/cmSourceGroup.cxx +++ b/Source/cmSourceGroup.cxx @@ -2,15 +2,17 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmSourceGroup.h" +#include + class cmSourceGroupInternals { public: std::vector GroupChildren; }; -cmSourceGroup::cmSourceGroup(const std::string& name, const char* regex, +cmSourceGroup::cmSourceGroup(std::string name, const char* regex, const char* parentName) - : Name(name) + : Name(std::move(name)) { this->Internal = new cmSourceGroupInternals; this->SetGroupRegex(regex); diff --git a/Source/cmSourceGroup.h b/Source/cmSourceGroup.h index b39f8dd..7c65494 100644 --- a/Source/cmSourceGroup.h +++ b/Source/cmSourceGroup.h @@ -26,7 +26,7 @@ class cmSourceGroupInternals; class cmSourceGroup { public: - cmSourceGroup(const std::string& name, const char* regex, + cmSourceGroup(std::string name, const char* regex, const char* parentName = nullptr); cmSourceGroup(cmSourceGroup const& r); ~cmSourceGroup(); diff --git a/Source/cmStringReplaceHelper.cxx b/Source/cmStringReplaceHelper.cxx index f50cf58..4a62987 100644 --- a/Source/cmStringReplaceHelper.cxx +++ b/Source/cmStringReplaceHelper.cxx @@ -5,13 +5,14 @@ #include "cmMakefile.h" #include +#include cmStringReplaceHelper::cmStringReplaceHelper(const std::string& regex, - const std::string& replace_expr, + std::string replace_expr, cmMakefile* makefile) : RegExString(regex) , RegularExpression(regex) - , ReplaceExpression(replace_expr) + , ReplaceExpression(std::move(replace_expr)) , Makefile(makefile) { this->ParseReplaceExpression(); diff --git a/Source/cmStringReplaceHelper.h b/Source/cmStringReplaceHelper.h index 3e76d86..5cebde7 100644 --- a/Source/cmStringReplaceHelper.h +++ b/Source/cmStringReplaceHelper.h @@ -6,6 +6,7 @@ #include "cmsys/RegularExpression.hxx" #include +#include #include class cmMakefile; @@ -13,8 +14,7 @@ class cmMakefile; class cmStringReplaceHelper { public: - cmStringReplaceHelper(const std::string& regex, - const std::string& replace_expr, + cmStringReplaceHelper(const std::string& regex, std::string replace_expr, cmMakefile* makefile = nullptr); bool IsRegularExpressionValid() const @@ -39,9 +39,9 @@ private: , Value(s) { } - RegexReplacement(const std::string& s) + RegexReplacement(std::string s) : Number(-1) - , Value(s) + , Value(std::move(s)) { } RegexReplacement(int n) diff --git a/Source/cmUnexpectedCommand.h b/Source/cmUnexpectedCommand.h index 7154881..33d6bdc 100644 --- a/Source/cmUnexpectedCommand.h +++ b/Source/cmUnexpectedCommand.h @@ -6,6 +6,7 @@ #include "cmConfigure.h" // IWYU pragma: keep #include +#include #include #include "cmCommand.h" @@ -15,8 +16,8 @@ class cmExecutionStatus; class cmUnexpectedCommand : public cmCommand { public: - cmUnexpectedCommand(std::string const& name, const char* error) - : Name(name) + cmUnexpectedCommand(std::string name, const char* error) + : Name(std::move(name)) , Error(error) { } diff --git a/Source/cmXCodeScheme.cxx b/Source/cmXCodeScheme.cxx index d301ad0..1b16198 100644 --- a/Source/cmXCodeScheme.cxx +++ b/Source/cmXCodeScheme.cxx @@ -5,16 +5,17 @@ #include #include #include +#include #include "cmGeneratedFileStream.h" #include "cmGeneratorTarget.h" #include "cmXMLSafe.h" -cmXCodeScheme::cmXCodeScheme(cmXCodeObject* xcObj, const TestObjects& tests, +cmXCodeScheme::cmXCodeScheme(cmXCodeObject* xcObj, TestObjects tests, const std::vector& configList, unsigned int xcVersion) : Target(xcObj) - , Tests(tests) + , Tests(std::move(tests)) , TargetName(xcObj->GetTarget()->GetName()) , ConfigList(configList) , XcodeVersion(xcVersion) diff --git a/Source/cmXCodeScheme.h b/Source/cmXCodeScheme.h index 96c76e6..8c47123 100644 --- a/Source/cmXCodeScheme.h +++ b/Source/cmXCodeScheme.h @@ -20,7 +20,7 @@ class cmXCodeScheme public: typedef std::vector TestObjects; - cmXCodeScheme(cmXCodeObject* xcObj, const TestObjects& tests, + cmXCodeScheme(cmXCodeObject* xcObj, TestObjects tests, const std::vector& configList, unsigned int xcVersion); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=405d9cb4b5cf9d849facda5dfa6ec02e57f33be7 commit 405d9cb4b5cf9d849facda5dfa6ec02e57f33be7 Merge: bcc9ea2 3068a0d Author: Brad King AuthorDate: Tue Jan 22 11:29:56 2019 -0500 Commit: Brad King CommitDate: Tue Jan 22 11:29:56 2019 -0500 Merge branch 'upstream-KWSys' into update-kwsys * upstream-KWSys: KWSys 2019-01-22 (4fecfe6f) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3068a0d0dc87a57408c53b23e125b6c6de0c181a commit 3068a0d0dc87a57408c53b23e125b6c6de0c181a Author: KWSys Upstream AuthorDate: Tue Jan 22 11:29:02 2019 -0500 Commit: Brad King CommitDate: Tue Jan 22 11:29:56 2019 -0500 KWSys 2019-01-22 (4fecfe6f) Code extracted from: https://gitlab.kitware.com/utils/kwsys.git at commit 4fecfe6f29be07ec165bcc87a20666425d928aa6 (master). Upstream Shortlog ----------------- Brad King (1): 7a5e5af8 SystemTools: Revert "Fix FileIsSymlink with Windows data deduplication" Tobias Kloss (1): ef373416 SystemTools: Fix FileIsSymlink with Windows data deduplication Wouter Klouwen (1): 8e9970fb SystemInformation: support BSD platforms for GetProcessId diff --git a/SystemInformation.cxx b/SystemInformation.cxx index d368fa2..6c12355 100644 --- a/SystemInformation.cxx +++ b/SystemInformation.cxx @@ -3871,7 +3871,8 @@ SystemInformation::LongLong SystemInformationImplementation::GetProcessId() { #if defined(_WIN32) return GetCurrentProcessId(); -#elif defined(__linux) || defined(__APPLE__) +#elif defined(__linux) || defined(__APPLE__) || defined(__OpenBSD__) || \ + defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) return getpid(); #else return -1; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f2fca92686fb360c433d06452700d90dcf62c9fa commit f2fca92686fb360c433d06452700d90dcf62c9fa Author: Robert Maynard AuthorDate: Thu Jan 17 09:15:09 2019 -0600 Commit: Brad King CommitDate: Tue Jan 22 08:27:04 2019 -0500 cmake: --build supports '-jN' diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 5a04eab..b5a42ff 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -360,6 +360,31 @@ int do_cmake(int ac, char const* const* av) return 0; } +namespace { +int extract_job_number(int& index, char const* current, char const* next, + int len_of_flag) +{ + std::string command(current); + std::string jobString = command.substr(len_of_flag); + if (jobString.empty() && next && isdigit(next[0])) { + ++index; // skip parsing the job number + jobString = std::string(next); + } + + int jobs = -1; + unsigned long numJobs = 0; + if (jobString.empty()) { + jobs = cmake::DEFAULT_BUILD_PARALLEL_LEVEL; + } else if (cmSystemTools::StringToULong(jobString.c_str(), &numJobs)) { + jobs = int(numJobs); + } else { + std::cerr << "'" << command.substr(0, len_of_flag) << "' invalid number '" + << jobString << "' given.\n\n"; + } + return jobs; +} +} + static int do_build(int ac, char const* const* av) { #ifndef CMAKE_BUILD_WITH_CMAKE @@ -377,7 +402,6 @@ static int do_build(int ac, char const* const* av) enum Doing { DoingNone, - DoingJobs, DoingDir, DoingTarget, DoingConfig, @@ -387,12 +411,17 @@ static int do_build(int ac, char const* const* av) for (int i = 2; i < ac; ++i) { if (doing == DoingNative) { nativeOptions.emplace_back(av[i]); - } else if ((strcmp(av[i], "-j") == 0) || - (strcmp(av[i], "--parallel") == 0)) { - jobs = cmake::DEFAULT_BUILD_PARALLEL_LEVEL; - /* does the next argument start with a number? */ - if ((i + 1 < ac) && (isdigit(*av[i + 1]))) { - doing = DoingJobs; + } else if (cmHasLiteralPrefix(av[i], "-j")) { + const char* nextArg = ((i + 1 < ac) ? av[i + 1] : nullptr); + jobs = extract_job_number(i, av[i], nextArg, sizeof("-j") - 1); + if (jobs < 0) { + dir.clear(); + } + } else if (cmHasLiteralPrefix(av[i], "--parallel")) { + const char* nextArg = ((i + 1 < ac) ? av[i + 1] : nullptr); + jobs = extract_job_number(i, av[i], nextArg, sizeof("--parallel") - 1); + if (jobs < 0) { + dir.clear(); } } else if (strcmp(av[i], "--target") == 0) { if (!hasTarget) { @@ -414,18 +443,6 @@ static int do_build(int ac, char const* const* av) doing = DoingNative; } else { switch (doing) { - case DoingJobs: { - unsigned long numJobs = 0; - if (cmSystemTools::StringToULong(av[i], &numJobs)) { - jobs = int(numJobs); - doing = DoingNone; - } else { - std::cerr << "'" << av[i - 1] << "' invalid number '" << av[i] - << "' given.\n\n"; - dir.clear(); - break; - } - } break; case DoingDir: dir = cmSystemTools::CollapseFullPath(av[i]); doing = DoingNone; diff --git a/Tests/RunCMake/CommandLine/BuildDir--build--parallel-no-space-bad-number-result.txt b/Tests/RunCMake/CommandLine/BuildDir--build--parallel-no-space-bad-number-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/BuildDir--build--parallel-no-space-bad-number-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/BuildDir--build--parallel-no-space-bad-number-stderr.txt b/Tests/RunCMake/CommandLine/BuildDir--build--parallel-no-space-bad-number-stderr.txt new file mode 100644 index 0000000..e73d760 --- /dev/null +++ b/Tests/RunCMake/CommandLine/BuildDir--build--parallel-no-space-bad-number-stderr.txt @@ -0,0 +1,3 @@ +^'--parallel' invalid number '12ab' given\. ++ +Usage: cmake --build \[options\] \[-- \[native-options\]\] diff --git a/Tests/RunCMake/CommandLine/BuildDir--build--parallel-no-space-good-number-stderr.txt b/Tests/RunCMake/CommandLine/BuildDir--build--parallel-no-space-good-number-stderr.txt new file mode 100644 index 0000000..3c2c808 --- /dev/null +++ b/Tests/RunCMake/CommandLine/BuildDir--build--parallel-no-space-good-number-stderr.txt @@ -0,0 +1 @@ +(^$|^Warning: .* does not support parallel builds\. Ignoring parallel build command line option\.) diff --git a/Tests/RunCMake/CommandLine/BuildDir--build--parallel-no-space-good-number-trailing--target-stderr.txt b/Tests/RunCMake/CommandLine/BuildDir--build--parallel-no-space-good-number-trailing--target-stderr.txt new file mode 100644 index 0000000..3c2c808 --- /dev/null +++ b/Tests/RunCMake/CommandLine/BuildDir--build--parallel-no-space-good-number-trailing--target-stderr.txt @@ -0,0 +1 @@ +(^$|^Warning: .* does not support parallel builds\. Ignoring parallel build command line option\.) diff --git a/Tests/RunCMake/CommandLine/BuildDir--build-jobs-no-space-bad-number-result.txt b/Tests/RunCMake/CommandLine/BuildDir--build-jobs-no-space-bad-number-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/BuildDir--build-jobs-no-space-bad-number-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/BuildDir--build-jobs-no-space-bad-number-stderr.txt b/Tests/RunCMake/CommandLine/BuildDir--build-jobs-no-space-bad-number-stderr.txt new file mode 100644 index 0000000..c810087 --- /dev/null +++ b/Tests/RunCMake/CommandLine/BuildDir--build-jobs-no-space-bad-number-stderr.txt @@ -0,0 +1,3 @@ +^'-j' invalid number '12ab' given\. ++ +Usage: cmake --build \[options\] \[-- \[native-options\]\] diff --git a/Tests/RunCMake/CommandLine/BuildDir--build-jobs-no-space-good-number-stderr.txt b/Tests/RunCMake/CommandLine/BuildDir--build-jobs-no-space-good-number-stderr.txt new file mode 100644 index 0000000..3c2c808 --- /dev/null +++ b/Tests/RunCMake/CommandLine/BuildDir--build-jobs-no-space-good-number-stderr.txt @@ -0,0 +1 @@ +(^$|^Warning: .* does not support parallel builds\. Ignoring parallel build command line option\.) diff --git a/Tests/RunCMake/CommandLine/BuildDir--build-jobs-no-space-good-number-trailing--target-stderr.txt b/Tests/RunCMake/CommandLine/BuildDir--build-jobs-no-space-good-number-trailing--target-stderr.txt new file mode 100644 index 0000000..3c2c808 --- /dev/null +++ b/Tests/RunCMake/CommandLine/BuildDir--build-jobs-no-space-good-number-trailing--target-stderr.txt @@ -0,0 +1 @@ +(^$|^Warning: .* does not support parallel builds\. Ignoring parallel build command line option\.) diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 0e04ad1..ff9fcac 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -105,6 +105,19 @@ function(run_BuildDir) ${CMAKE_COMMAND} --build BuildDir-build --parallel 2) run_cmake_command(BuildDir--build--parallel-good-number-trailing--target ${CMAKE_COMMAND} -E chdir .. ${CMAKE_COMMAND} --build BuildDir-build --parallel 2 --target CustomTarget) + run_cmake_command(BuildDir--build-jobs-no-space-bad-number ${CMAKE_COMMAND} -E chdir .. + ${CMAKE_COMMAND} --build BuildDir-build -j12ab) + run_cmake_command(BuildDir--build-jobs-no-space-good-number ${CMAKE_COMMAND} -E chdir .. + ${CMAKE_COMMAND} --build BuildDir-build -j2) + run_cmake_command(BuildDir--build-jobs-no-space-good-number-trailing--target ${CMAKE_COMMAND} -E chdir .. + ${CMAKE_COMMAND} --build BuildDir-build -j2 --target CustomTarget) + run_cmake_command(BuildDir--build--parallel-no-space-bad-number ${CMAKE_COMMAND} -E chdir .. + ${CMAKE_COMMAND} --build BuildDir-build --parallel12ab) + run_cmake_command(BuildDir--build--parallel-no-space-good-number ${CMAKE_COMMAND} -E chdir .. + ${CMAKE_COMMAND} --build BuildDir-build --parallel2) + run_cmake_command(BuildDir--build--parallel-no-space-good-number-trailing--target ${CMAKE_COMMAND} -E chdir .. + ${CMAKE_COMMAND} --build BuildDir-build --parallel2 --target CustomTarget) + # No default jobs for Xcode and FreeBSD build command if(NOT RunCMake_GENERATOR MATCHES "Xcode" AND NOT CMAKE_SYSTEM_NAME MATCHES "FreeBSD") run_cmake_command(BuildDir--build-jobs-no-number ${CMAKE_COMMAND} -E chdir .. https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e463133cd2a189d5d2ad3bf95caa4058a2c0d764 commit e463133cd2a189d5d2ad3bf95caa4058a2c0d764 Author: Brad King AuthorDate: Tue Jan 22 08:24:23 2019 -0500 Commit: Brad King CommitDate: Tue Jan 22 08:24:23 2019 -0500 Tests: Remove unused files from RunCMake.CommandLine test Drop `-stderr.txt` files for cases that do not exist. diff --git a/Tests/RunCMake/CommandLine/BuildDir--build--parallel-good-number-trailing-stderr.txt b/Tests/RunCMake/CommandLine/BuildDir--build--parallel-good-number-trailing-stderr.txt deleted file mode 100644 index 3c2c808..0000000 --- a/Tests/RunCMake/CommandLine/BuildDir--build--parallel-good-number-trailing-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -(^$|^Warning: .* does not support parallel builds\. Ignoring parallel build command line option\.) diff --git a/Tests/RunCMake/CommandLine/BuildDir--build--parallel-no-number-trailing-stderr.txt b/Tests/RunCMake/CommandLine/BuildDir--build--parallel-no-number-trailing-stderr.txt deleted file mode 100644 index 3c2c808..0000000 --- a/Tests/RunCMake/CommandLine/BuildDir--build--parallel-no-number-trailing-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -(^$|^Warning: .* does not support parallel builds\. Ignoring parallel build command line option\.) diff --git a/Tests/RunCMake/CommandLine/BuildDir--build-jobs-good-number-trailing-stderr.txt b/Tests/RunCMake/CommandLine/BuildDir--build-jobs-good-number-trailing-stderr.txt deleted file mode 100644 index 3c2c808..0000000 --- a/Tests/RunCMake/CommandLine/BuildDir--build-jobs-good-number-trailing-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -(^$|^Warning: .* does not support parallel builds\. Ignoring parallel build command line option\.) diff --git a/Tests/RunCMake/CommandLine/BuildDir--build-jobs-no-number-trailing-stderr.txt b/Tests/RunCMake/CommandLine/BuildDir--build-jobs-no-number-trailing-stderr.txt deleted file mode 100644 index 3c2c808..0000000 --- a/Tests/RunCMake/CommandLine/BuildDir--build-jobs-no-number-trailing-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -(^$|^Warning: .* does not support parallel builds\. Ignoring parallel build command line option\.) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2993fc347af5db802721f1bbe0a0e05d19a28e89 commit 2993fc347af5db802721f1bbe0a0e05d19a28e89 Author: Vitaly Stakhovsky AuthorDate: Mon Jan 21 12:56:51 2019 -0500 Commit: Vitaly Stakhovsky CommitDate: Mon Jan 21 12:56:51 2019 -0500 cmMakefile: GetModulesFile() accepts std::string param diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 9ae1cb9..97ef481 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -663,7 +663,7 @@ bool cmFindPackageCommand::FindModule(bool& found) module += this->Name; module += ".cmake"; bool system = false; - std::string mfile = this->Makefile->GetModulesFile(module.c_str(), system); + std::string mfile = this->Makefile->GetModulesFile(module, system); if (!mfile.empty()) { if (system) { auto it = this->DeprecatedFindModules.find(this->Name); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 2d36315..b2b0e38 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -353,8 +353,7 @@ bool cmGlobalGenerator::FindMakeProgram(cmMakefile* mf) } if (!mf->GetDefinition("CMAKE_MAKE_PROGRAM") || cmSystemTools::IsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM"))) { - std::string setMakeProgram = - mf->GetModulesFile(this->FindMakeProgramFile.c_str()); + std::string setMakeProgram = mf->GetModulesFile(this->FindMakeProgramFile); if (!setMakeProgram.empty()) { mf->ReadListFile(setMakeProgram); } @@ -464,11 +463,10 @@ void cmGlobalGenerator::EnableLanguage( if (this->TryCompileOuterMakefile) { // In a try-compile we can only enable languages provided by caller. - for (std::string const& li : languages) { - if (li == "NONE") { + for (std::string const& lang : languages) { + if (lang == "NONE") { this->SetLanguageEnabled("NONE", mf); } else { - const char* lang = li.c_str(); if (this->LanguagesReady.find(lang) == this->LanguagesReady.end()) { std::ostringstream e; e << "The test project needs language " << lang @@ -616,10 +614,9 @@ void cmGlobalGenerator::EnableLanguage( // load the CMakeDetermine(LANG)Compiler.cmake file to find // the compiler - for (std::string const& l : languages) { - const char* lang = l.c_str(); + for (std::string const& lang : languages) { needSetLanguageEnabledMaps[lang] = false; - if (l == "NONE") { + if (lang == "NONE") { this->SetLanguageEnabled("NONE", mf); continue; } @@ -661,8 +658,7 @@ void cmGlobalGenerator::EnableLanguage( std::string determineCompiler = "CMakeDetermine"; determineCompiler += lang; determineCompiler += "Compiler.cmake"; - std::string determineFile = - mf->GetModulesFile(determineCompiler.c_str()); + std::string determineFile = mf->GetModulesFile(determineCompiler); if (!mf->ReadListFile(determineFile)) { cmSystemTools::Error("Could not find cmake module file: ", determineCompiler.c_str()); @@ -721,9 +717,8 @@ void cmGlobalGenerator::EnableLanguage( } // loop over languages again loading CMake(LANG)Information.cmake // - for (std::string const& l : languages) { - const char* lang = l.c_str(); - if (l == "NONE") { + for (std::string const& lang : languages) { + if (lang == "NONE") { this->SetLanguageEnabled("NONE", mf); continue; } @@ -744,7 +739,7 @@ void cmGlobalGenerator::EnableLanguage( "No " << compilerName << " could be found.\n" ; /* clang-format on */ - } else if (strcmp(lang, "RC") != 0 && strcmp(lang, "ASM_MASM") != 0) { + } else if ((lang != "RC") && (lang != "ASM_MASM")) { if (!cmSystemTools::FileIsFullPath(compilerFile)) { /* clang-format off */ noCompiler << @@ -790,7 +785,7 @@ void cmGlobalGenerator::EnableLanguage( fpath = "CMake"; fpath += lang; fpath += "Information.cmake"; - std::string informationFile = mf->GetModulesFile(fpath.c_str()); + std::string informationFile = mf->GetModulesFile(fpath); if (informationFile.empty()) { cmSystemTools::Error("Could not find cmake module file: ", fpath.c_str()); @@ -814,7 +809,7 @@ void cmGlobalGenerator::EnableLanguage( std::string testLang = "CMakeTest"; testLang += lang; testLang += "Compiler.cmake"; - std::string ifpath = mf->GetModulesFile(testLang.c_str()); + std::string ifpath = mf->GetModulesFile(testLang); if (!mf->ReadListFile(ifpath)) { cmSystemTools::Error("Could not find cmake module file: ", testLang.c_str()); @@ -2861,7 +2856,7 @@ void cmGlobalGenerator::CheckRuleHashes(std::string const& pfile, if (strncmp(line.c_str(), rhi->second.Data, 32) != 0) { // The rule has changed. Delete the output so it will be // built again. - fname = cmSystemTools::CollapseFullPath(fname, home.c_str()); + fname = cmSystemTools::CollapseFullPath(fname, home); cmSystemTools::RemoveFile(fname); } } else { @@ -2871,7 +2866,7 @@ void cmGlobalGenerator::CheckRuleHashes(std::string const& pfile, // Instead, we keep the rule hash as long as the file exists so // that if the feature is turned back on and the rule has // changed the file is still rebuilt. - std::string fpath = cmSystemTools::CollapseFullPath(fname, home.c_str()); + std::string fpath = cmSystemTools::CollapseFullPath(fname, home); if (cmSystemTools::FileExists(fpath)) { RuleHash hash; memcpy(hash.Data, line.c_str(), 32); diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx index a67d09e..0d608bb 100644 --- a/Source/cmIncludeCommand.cxx +++ b/Source/cmIncludeCommand.cxx @@ -67,7 +67,7 @@ bool cmIncludeCommand::InitialPass(std::vector const& args, // Not a path. Maybe module. std::string module = fname; module += ".cmake"; - std::string mfile = this->Makefile->GetModulesFile(module.c_str()); + std::string mfile = this->Makefile->GetModulesFile(module); if (!mfile.empty()) { fname = mfile; } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 97e684b..09537bb 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2783,7 +2783,7 @@ void cmLocalGenerator::GenerateAppleInfoPList(cmGeneratorTarget* target, const char* in = target->GetProperty("MACOSX_BUNDLE_INFO_PLIST"); std::string inFile = (in && *in) ? in : "MacOSXBundleInfo.plist.in"; if (!cmSystemTools::FileIsFullPath(inFile)) { - std::string inMod = this->Makefile->GetModulesFile(inFile.c_str()); + std::string inMod = this->Makefile->GetModulesFile(inFile); if (!inMod.empty()) { inFile = inMod; } @@ -2821,7 +2821,7 @@ void cmLocalGenerator::GenerateFrameworkInfoPList( const char* in = target->GetProperty("MACOSX_FRAMEWORK_INFO_PLIST"); std::string inFile = (in && *in) ? in : "MacOSXFrameworkInfo.plist.in"; if (!cmSystemTools::FileIsFullPath(inFile)) { - std::string inMod = this->Makefile->GetModulesFile(inFile.c_str()); + std::string inMod = this->Makefile->GetModulesFile(inFile); if (!inMod.empty()) { inFile = inMod; } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 9589b7f..500776e 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3516,7 +3516,7 @@ void cmMakefile::DisplayStatus(const char* message, float s) const cm->UpdateProgress(message, s); } -std::string cmMakefile::GetModulesFile(const char* filename, +std::string cmMakefile::GetModulesFile(const std::string& filename, bool& system) const { std::string result; diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index abe2cd1..e88bb0b 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -689,13 +689,13 @@ public: /** * Return a location of a file in cmake or custom modules directory */ - std::string GetModulesFile(const char* name) const + std::string GetModulesFile(const std::string& name) const { bool system; return this->GetModulesFile(name, system); } - std::string GetModulesFile(const char* name, bool& system) const; + std::string GetModulesFile(const std::string& name, bool& system) const; ///! Set/Get a property of this directory void SetProperty(const std::string& prop, const char* value); ----------------------------------------------------------------------- Summary of changes: .clang-tidy | 1 - Help/release/3.13.rst | 26 ++++++++++ Source/CPack/cmCPackDebGenerator.cxx | 50 +++++++++----------- Source/CPack/cmCPackFreeBSDGenerator.cxx | 9 ++-- Source/CursesDialog/cmCursesMainForm.cxx | 5 +- Source/CursesDialog/cmCursesMainForm.h | 2 +- Source/QtDialog/QCMakeWidgets.cxx | 5 +- Source/QtDialog/QCMakeWidgets.h | 2 +- Source/cmAlgorithms.h | 4 +- Source/cmComputeLinkInformation.h | 6 +-- Source/cmConditionEvaluator.cxx | 9 ++-- Source/cmConditionEvaluator.h | 4 +- Source/cmCustomCommand.cxx | 18 +++---- Source/cmCustomCommand.h | 11 ++--- Source/cmCustomCommandGenerator.cxx | 4 +- Source/cmCustomCommandGenerator.h | 4 +- Source/cmDepends.cxx | 4 +- Source/cmDepends.h | 2 +- Source/cmExpandedCommandArgument.cxx | 6 ++- Source/cmExpandedCommandArgument.h | 2 +- Source/cmExportSet.h | 5 +- Source/cmExternalMakefileProjectGenerator.cxx | 9 ++-- Source/cmExternalMakefileProjectGenerator.h | 3 +- Source/cmFileAPICodemodel.cxx | 6 +-- Source/cmFindPackageCommand.cxx | 14 +++--- Source/cmFortranParser.h | 10 ++-- Source/cmFortranParserImpl.cxx | 9 ++-- Source/cmGeneratorExpression.cxx | 11 ++--- Source/cmGeneratorExpression.h | 16 +++---- Source/cmGeneratorExpressionContext.cxx | 14 +++--- Source/cmGeneratorExpressionContext.h | 6 +-- Source/cmGeneratorExpressionDAGChecker.cxx | 12 ++--- Source/cmGeneratorExpressionDAGChecker.h | 6 +-- Source/cmGeneratorExpressionEvaluationFile.cxx | 4 +- Source/cmGeneratorExpressionEvaluationFile.h | 2 +- Source/cmGeneratorExpressionParser.cxx | 4 +- Source/cmGeneratorExpressionParser.h | 3 +- Source/cmGeneratorTarget.cxx | 5 +- Source/cmGlobVerificationManager.h | 8 ++-- Source/cmGlobalGenerator.cxx | 31 +++++------- Source/cmGraphAdjacencyList.h | 5 +- Source/cmIncludeCommand.cxx | 2 +- Source/cmInstallCommandArguments.cxx | 4 +- Source/cmInstallCommandArguments.h | 2 +- Source/cmInstallTargetGenerator.cxx | 8 ++-- Source/cmInstallTargetGenerator.h | 4 +- Source/cmLinkItem.cxx | 11 ++--- Source/cmLinkItem.h | 4 +- Source/cmListCommand.cxx | 11 ++--- Source/cmListFileCache.cxx | 7 ++- Source/cmListFileCache.h | 4 +- Source/cmLocalCommonGenerator.cxx | 5 +- Source/cmLocalCommonGenerator.h | 2 +- Source/cmLocalGenerator.cxx | 4 +- Source/cmLocalUnixMakefileGenerator3.cxx | 6 +-- Source/cmLocalUnixMakefileGenerator3.h | 5 +- Source/cmMakefile.cxx | 2 +- Source/cmMakefile.h | 4 +- Source/cmOSXBundleGenerator.cxx | 5 +- Source/cmOSXBundleGenerator.h | 3 +- Source/cmPathLabel.cxx | 6 ++- Source/cmPathLabel.h | 2 +- Source/cmPipeConnection.cxx | 4 +- Source/cmPipeConnection.h | 2 +- Source/cmQtAutoGeneratorMocUic.h | 12 ++--- Source/cmRST.cxx | 4 +- Source/cmRST.h | 2 +- Source/cmRulePlaceholderExpander.cxx | 14 +++--- Source/cmRulePlaceholderExpander.h | 6 +-- Source/cmScriptGenerator.cxx | 11 +++-- Source/cmScriptGenerator.h | 4 +- Source/cmServerProtocol.cxx | 28 +++++------ Source/cmServerProtocol.h | 15 +++--- Source/cmSourceGroup.cxx | 6 ++- Source/cmSourceGroup.h | 2 +- Source/cmStringReplaceHelper.cxx | 5 +- Source/cmStringReplaceHelper.h | 8 ++-- Source/cmUnexpectedCommand.h | 5 +- Source/cmXCodeScheme.cxx | 5 +- Source/cmXCodeScheme.h | 2 +- Source/cmake.cxx | 7 ++- Source/cmakemain.cxx | 55 ++++++++++++++-------- Source/kwsys/SystemInformation.cxx | 3 +- ...build--parallel-no-space-bad-number-result.txt} | 0 ...build--parallel-no-space-bad-number-stderr.txt} | 0 ...uild--parallel-no-space-good-number-stderr.txt} | 0 ...-space-good-number-trailing--target-stderr.txt} | 0 ...Dir--build-jobs-no-space-bad-number-result.txt} | 0 ...Dir--build-jobs-no-space-bad-number-stderr.txt} | 0 ...ir--build-jobs-no-space-good-number-stderr.txt} | 0 ...-space-good-number-trailing--target-stderr.txt} | 0 Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 25 +++++++++- Tests/RunCMake/CommandLine/no-S-B-result.txt | 1 - Tests/RunCMake/CommandLine/no-S-B-stderr.txt | 5 +- 94 files changed, 382 insertions(+), 307 deletions(-) copy Tests/RunCMake/{while/MissingArgument-result.txt => CommandLine/BuildDir--build--parallel-no-space-bad-number-result.txt} (100%) copy Tests/RunCMake/CommandLine/{BuildDir--build--parallel-bad-number-stderr.txt => BuildDir--build--parallel-no-space-bad-number-stderr.txt} (100%) rename Tests/RunCMake/CommandLine/{BuildDir--build-jobs-no-number-trailing-stderr.txt => BuildDir--build--parallel-no-space-good-number-stderr.txt} (100%) rename Tests/RunCMake/CommandLine/{BuildDir--build-jobs-good-number-trailing-stderr.txt => BuildDir--build--parallel-no-space-good-number-trailing--target-stderr.txt} (100%) copy Tests/RunCMake/{while/MissingArgument-result.txt => CommandLine/BuildDir--build-jobs-no-space-bad-number-result.txt} (100%) copy Tests/RunCMake/CommandLine/{BuildDir--build-jobs-bad-number-stderr.txt => BuildDir--build-jobs-no-space-bad-number-stderr.txt} (100%) rename Tests/RunCMake/CommandLine/{BuildDir--build--parallel-no-number-trailing-stderr.txt => BuildDir--build-jobs-no-space-good-number-stderr.txt} (100%) rename Tests/RunCMake/CommandLine/{BuildDir--build--parallel-good-number-trailing-stderr.txt => BuildDir--build-jobs-no-space-good-number-trailing--target-stderr.txt} (100%) delete mode 100644 Tests/RunCMake/CommandLine/no-S-B-result.txt hooks/post-receive -- CMake From kwrobot at kitware.com Thu Jan 24 00:03:05 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 24 Jan 2019 00:03:05 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-1078-ga578922 Message-ID: <20190124050305.38B55125443@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via a5789224674999ed206464fa7cea62ae31e3dc67 (commit) from a7f5cd45e135dd51d67176fc40e2d769ac5f7db8 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a5789224674999ed206464fa7cea62ae31e3dc67 commit a5789224674999ed206464fa7cea62ae31e3dc67 Author: Kitware Robot AuthorDate: Thu Jan 24 00:01:08 2019 -0500 Commit: Kitware Robot CommitDate: Thu Jan 24 00:01:08 2019 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index b06c382..d67aba1 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 13) -set(CMake_VERSION_PATCH 20190123) +set(CMake_VERSION_PATCH 20190124) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Jan 24 05:43:07 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 24 Jan 2019 05:43:07 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-1083-g1d02491 Message-ID: <20190124104307.BE207127A03@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 1d02491950b0aa05d2053e7fa32b39dca31e537b (commit) via 02f5caf4879018fca79fe01fbd196e65e6227870 (commit) via e4541b0e3dde49183742eda8100f608d03d0d027 (commit) via f2d7ed1cda590688e4ff4e37119007d0ee7cf893 (commit) via 8ef1916c8226ebf781c4ad0de158d15754d411f5 (commit) from a5789224674999ed206464fa7cea62ae31e3dc67 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1d02491950b0aa05d2053e7fa32b39dca31e537b commit 1d02491950b0aa05d2053e7fa32b39dca31e537b Merge: 02f5caf f2d7ed1 Author: Marc Chevrier AuthorDate: Thu Jan 24 10:38:02 2019 +0000 Commit: Kitware Robot CommitDate: Thu Jan 24 05:38:08 2019 -0500 Merge topic 'findgit-note' f2d7ed1cda Help: Add note about CMAKE_ROLE to FindGit documentation Acked-by: Kitware Robot Merge-request: !2847 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=02f5caf4879018fca79fe01fbd196e65e6227870 commit 02f5caf4879018fca79fe01fbd196e65e6227870 Merge: a578922 e4541b0 Author: Marc Chevrier AuthorDate: Thu Jan 24 10:34:18 2019 +0000 Commit: Kitware Robot CommitDate: Thu Jan 24 05:34:27 2019 -0500 Merge topic 'findpython-script' e4541b0e3d FindPython: Support script mode 8ef1916c82 FindPython: Test existence of imported targets Acked-by: Kitware Robot Merge-request: !2844 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e4541b0e3dde49183742eda8100f608d03d0d027 commit e4541b0e3dde49183742eda8100f608d03d0d027 Author: Kyle Edwards AuthorDate: Wed Jan 23 10:08:27 2019 -0500 Commit: Kyle Edwards CommitDate: Wed Jan 23 13:51:09 2019 -0500 FindPython: Support script mode Fixes: #18827 diff --git a/Help/release/dev/findpython-script.rst b/Help/release/dev/findpython-script.rst new file mode 100644 index 0000000..5de1ebf --- /dev/null +++ b/Help/release/dev/findpython-script.rst @@ -0,0 +1,6 @@ +findpython-script +----------------- + +* The :module:`FindPython2`, :module:`FindPython3`, and :module:`FindPython` + modules now support running in script mode by skipping the creation of + imported targets and helper functions. diff --git a/Modules/FindPython.cmake b/Modules/FindPython.cmake index 8645a0d..f5fb0ab 100644 --- a/Modules/FindPython.cmake +++ b/Modules/FindPython.cmake @@ -30,7 +30,8 @@ To manage concurrent versions 3 and 2 of Python, use :module:`FindPython3` and Imported Targets ^^^^^^^^^^^^^^^^ -This module defines the following :ref:`Imported Targets `: +This module defines the following :ref:`Imported Targets ` +(when :prop_gbl:`CMAKE_ROLE` is ``PROJECT``): ``Python::Interpreter`` Python interpreter. Target defined if component ``Interpreter`` is found. @@ -144,9 +145,10 @@ Hints Commands ^^^^^^^^ -This module defines the command ``Python_add_library`` which have the same -semantic as :command:`add_library` but take care of Python module naming rules -(only applied if library is of type ``MODULE``) and add dependency to target +This module defines the command ``Python_add_library`` (when +:prop_gbl:`CMAKE_ROLE` is ``PROJECT``), which has the same semantics as +:command:`add_library`, but takes care of Python module naming rules +(only applied if library is of type ``MODULE``), and adds a dependency to target ``Python::Python``:: Python_add_library (my_module MODULE src1.cpp) diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake index e0ebb90..fd429e2 100644 --- a/Modules/FindPython/Support.cmake +++ b/Modules/FindPython/Support.cmake @@ -24,6 +24,8 @@ else() message (FATAL_ERROR "FindPython: INTERNAL ERROR") endif() +get_property(_${_PYTHON_PREFIX}_CMAKE_ROLE GLOBAL PROPERTY CMAKE_ROLE) + # # helper commands @@ -1133,118 +1135,120 @@ find_package_handle_standard_args (${_PYTHON_PREFIX} HANDLE_COMPONENTS) # Create imported targets and helper functions -if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS - AND ${_PYTHON_PREFIX}_Interpreter_FOUND - AND NOT TARGET ${_PYTHON_PREFIX}::Interpreter) - add_executable (${_PYTHON_PREFIX}::Interpreter IMPORTED) - set_property (TARGET ${_PYTHON_PREFIX}::Interpreter - PROPERTY IMPORTED_LOCATION "${${_PYTHON_PREFIX}_EXECUTABLE}") -endif() - -if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS - AND ${_PYTHON_PREFIX}_Compiler_FOUND - AND NOT TARGET ${_PYTHON_PREFIX}::Compiler) - add_executable (${_PYTHON_PREFIX}::Compiler IMPORTED) - set_property (TARGET ${_PYTHON_PREFIX}::Compiler - PROPERTY IMPORTED_LOCATION "${${_PYTHON_PREFIX}_COMPILER}") -endif() - -if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS - AND ${_PYTHON_PREFIX}_Development_FOUND AND NOT TARGET ${_PYTHON_PREFIX}::Python) +if(_${_PYTHON_PREFIX}_CMAKE_ROLE STREQUAL "PROJECT") + if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS + AND ${_PYTHON_PREFIX}_Interpreter_FOUND + AND NOT TARGET ${_PYTHON_PREFIX}::Interpreter) + add_executable (${_PYTHON_PREFIX}::Interpreter IMPORTED) + set_property (TARGET ${_PYTHON_PREFIX}::Interpreter + PROPERTY IMPORTED_LOCATION "${${_PYTHON_PREFIX}_EXECUTABLE}") + endif() - if (${_PYTHON_PREFIX}_LIBRARY_RELEASE MATCHES "${CMAKE_SHARED_LIBRARY_SUFFIX}$" - OR ${_PYTHON_PREFIX}_LIBRARY_DEBUG MATCHES "${CMAKE_SHARED_LIBRARY_SUFFIX}$" - OR ${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE OR ${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG) - set (_${_PYTHON_PREFIX}_LIBRARY_TYPE SHARED) - else() - set (_${_PYTHON_PREFIX}_LIBRARY_TYPE STATIC) + if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS + AND ${_PYTHON_PREFIX}_Compiler_FOUND + AND NOT TARGET ${_PYTHON_PREFIX}::Compiler) + add_executable (${_PYTHON_PREFIX}::Compiler IMPORTED) + set_property (TARGET ${_PYTHON_PREFIX}::Compiler + PROPERTY IMPORTED_LOCATION "${${_PYTHON_PREFIX}_COMPILER}") endif() - add_library (${_PYTHON_PREFIX}::Python ${_${_PYTHON_PREFIX}_LIBRARY_TYPE} IMPORTED) - - set_property (TARGET ${_PYTHON_PREFIX}::Python - PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${${_PYTHON_PREFIX}_INCLUDE_DIR}") - - if ((${_PYTHON_PREFIX}_LIBRARY_RELEASE AND ${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE) - OR (${_PYTHON_PREFIX}_LIBRARY_DEBUG AND ${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG)) - # System manage shared libraries in two parts: import and runtime - if (${_PYTHON_PREFIX}_LIBRARY_RELEASE AND ${_PYTHON_PREFIX}_LIBRARY_DEBUG) - set_property (TARGET ${_PYTHON_PREFIX}::Python PROPERTY IMPORTED_CONFIGURATIONS RELEASE DEBUG) - set_target_properties (${_PYTHON_PREFIX}::Python - PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C" - IMPORTED_IMPLIB_RELEASE "${${_PYTHON_PREFIX}_LIBRARY_RELEASE}" - IMPORTED_LOCATION_RELEASE "${${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE}") - set_target_properties (${_PYTHON_PREFIX}::Python - PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C" - IMPORTED_IMPLIB_DEBUG "${${_PYTHON_PREFIX}_LIBRARY_DEBUG}" - IMPORTED_LOCATION_DEBUG "${${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG}") + if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS + AND ${_PYTHON_PREFIX}_Development_FOUND AND NOT TARGET ${_PYTHON_PREFIX}::Python) + + if (${_PYTHON_PREFIX}_LIBRARY_RELEASE MATCHES "${CMAKE_SHARED_LIBRARY_SUFFIX}$" + OR ${_PYTHON_PREFIX}_LIBRARY_DEBUG MATCHES "${CMAKE_SHARED_LIBRARY_SUFFIX}$" + OR ${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE OR ${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG) + set (_${_PYTHON_PREFIX}_LIBRARY_TYPE SHARED) else() - set_target_properties (${_PYTHON_PREFIX}::Python - PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "C" - IMPORTED_IMPLIB "${${_PYTHON_PREFIX}_LIBRARY}" - IMPORTED_LOCATION "${${_PYTHON_PREFIX}_RUNTIME_LIBRARY}") + set (_${_PYTHON_PREFIX}_LIBRARY_TYPE STATIC) endif() - else() - if (${_PYTHON_PREFIX}_LIBRARY_RELEASE AND ${_PYTHON_PREFIX}_LIBRARY_DEBUG) - set_property (TARGET ${_PYTHON_PREFIX}::Python PROPERTY IMPORTED_CONFIGURATIONS RELEASE DEBUG) - set_target_properties (${_PYTHON_PREFIX}::Python - PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C" - IMPORTED_LOCATION_RELEASE "${${_PYTHON_PREFIX}_LIBRARY_RELEASE}") - set_target_properties (${_PYTHON_PREFIX}::Python - PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C" - IMPORTED_LOCATION_DEBUG "${${_PYTHON_PREFIX}_LIBRARY_DEBUG}") + + add_library (${_PYTHON_PREFIX}::Python ${_${_PYTHON_PREFIX}_LIBRARY_TYPE} IMPORTED) + + set_property (TARGET ${_PYTHON_PREFIX}::Python + PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${${_PYTHON_PREFIX}_INCLUDE_DIR}") + + if ((${_PYTHON_PREFIX}_LIBRARY_RELEASE AND ${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE) + OR (${_PYTHON_PREFIX}_LIBRARY_DEBUG AND ${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG)) + # System manage shared libraries in two parts: import and runtime + if (${_PYTHON_PREFIX}_LIBRARY_RELEASE AND ${_PYTHON_PREFIX}_LIBRARY_DEBUG) + set_property (TARGET ${_PYTHON_PREFIX}::Python PROPERTY IMPORTED_CONFIGURATIONS RELEASE DEBUG) + set_target_properties (${_PYTHON_PREFIX}::Python + PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C" + IMPORTED_IMPLIB_RELEASE "${${_PYTHON_PREFIX}_LIBRARY_RELEASE}" + IMPORTED_LOCATION_RELEASE "${${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE}") + set_target_properties (${_PYTHON_PREFIX}::Python + PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C" + IMPORTED_IMPLIB_DEBUG "${${_PYTHON_PREFIX}_LIBRARY_DEBUG}" + IMPORTED_LOCATION_DEBUG "${${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG}") + else() + set_target_properties (${_PYTHON_PREFIX}::Python + PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_IMPLIB "${${_PYTHON_PREFIX}_LIBRARY}" + IMPORTED_LOCATION "${${_PYTHON_PREFIX}_RUNTIME_LIBRARY}") + endif() else() - set_target_properties (${_PYTHON_PREFIX}::Python - PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "C" - IMPORTED_LOCATION "${${_PYTHON_PREFIX}_LIBRARY}") + if (${_PYTHON_PREFIX}_LIBRARY_RELEASE AND ${_PYTHON_PREFIX}_LIBRARY_DEBUG) + set_property (TARGET ${_PYTHON_PREFIX}::Python PROPERTY IMPORTED_CONFIGURATIONS RELEASE DEBUG) + set_target_properties (${_PYTHON_PREFIX}::Python + PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C" + IMPORTED_LOCATION_RELEASE "${${_PYTHON_PREFIX}_LIBRARY_RELEASE}") + set_target_properties (${_PYTHON_PREFIX}::Python + PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C" + IMPORTED_LOCATION_DEBUG "${${_PYTHON_PREFIX}_LIBRARY_DEBUG}") + else() + set_target_properties (${_PYTHON_PREFIX}::Python + PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${${_PYTHON_PREFIX}_LIBRARY}") + endif() endif() - endif() - if (_${_PYTHON_PREFIX}_CONFIG AND _${_PYTHON_PREFIX}_LIBRARY_TYPE STREQUAL "STATIC") - # extend link information with dependent libraries - execute_process (COMMAND "${_${_PYTHON_PREFIX}_CONFIG}" --ldflags - RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT - OUTPUT_VARIABLE _${_PYTHON_PREFIX}_FLAGS - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) - if (NOT _${_PYTHON_PREFIX}_RESULT) - string (REGEX MATCHALL "-[Ll][^ ]+" _${_PYTHON_PREFIX}_LINK_LIBRARIES "${_${_PYTHON_PREFIX}_FLAGS}") - # remove elements relative to python library itself - list (FILTER _${_PYTHON_PREFIX}_LINK_LIBRARIES EXCLUDE REGEX "-lpython") - foreach (_${_PYTHON_PREFIX}_DIR IN LISTS ${_PYTHON_PREFIX}_LIBRARY_DIRS) - list (FILTER _${_PYTHON_PREFIX}_LINK_LIBRARIES EXCLUDE REGEX "-L${${_PYTHON_PREFIX}_DIR}") - endforeach() - set_property (TARGET ${_PYTHON_PREFIX}::Python - PROPERTY INTERFACE_LINK_LIBRARIES ${_${_PYTHON_PREFIX}_LINK_LIBRARIES}) + if (_${_PYTHON_PREFIX}_CONFIG AND _${_PYTHON_PREFIX}_LIBRARY_TYPE STREQUAL "STATIC") + # extend link information with dependent libraries + execute_process (COMMAND "${_${_PYTHON_PREFIX}_CONFIG}" --ldflags + RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT + OUTPUT_VARIABLE _${_PYTHON_PREFIX}_FLAGS + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + if (NOT _${_PYTHON_PREFIX}_RESULT) + string (REGEX MATCHALL "-[Ll][^ ]+" _${_PYTHON_PREFIX}_LINK_LIBRARIES "${_${_PYTHON_PREFIX}_FLAGS}") + # remove elements relative to python library itself + list (FILTER _${_PYTHON_PREFIX}_LINK_LIBRARIES EXCLUDE REGEX "-lpython") + foreach (_${_PYTHON_PREFIX}_DIR IN LISTS ${_PYTHON_PREFIX}_LIBRARY_DIRS) + list (FILTER _${_PYTHON_PREFIX}_LINK_LIBRARIES EXCLUDE REGEX "-L${${_PYTHON_PREFIX}_DIR}") + endforeach() + set_property (TARGET ${_PYTHON_PREFIX}::Python + PROPERTY INTERFACE_LINK_LIBRARIES ${_${_PYTHON_PREFIX}_LINK_LIBRARIES}) + endif() endif() - endif() - # - # PYTHON_ADD_LIBRARY ( [STATIC|SHARED|MODULE] src1 src2 ... srcN) - # It is used to build modules for python. - # - function (__${_PYTHON_PREFIX}_ADD_LIBRARY prefix name) - cmake_parse_arguments (PARSE_ARGV 2 PYTHON_ADD_LIBRARY - "STATIC;SHARED;MODULE" "" "") - - unset (type) - if (NOT (PYTHON_ADD_LIBRARY_STATIC - OR PYTHON_ADD_LIBRARY_SHARED - OR PYTHON_ADD_LIBRARY_MODULE)) - set (type MODULE) - endif() - add_library (${name} ${type} ${ARGN}) - target_link_libraries (${name} PRIVATE ${prefix}::Python) - - # customize library name to follow module name rules - get_property (type TARGET ${name} PROPERTY TYPE) - if (type STREQUAL "MODULE_LIBRARY") - set_property (TARGET ${name} PROPERTY PREFIX "") - if(CMAKE_SYSTEM_NAME STREQUAL "Windows") - set_property (TARGET ${name} PROPERTY SUFFIX ".pyd") + # + # PYTHON_ADD_LIBRARY ( [STATIC|SHARED|MODULE] src1 src2 ... srcN) + # It is used to build modules for python. + # + function (__${_PYTHON_PREFIX}_ADD_LIBRARY prefix name) + cmake_parse_arguments (PARSE_ARGV 2 PYTHON_ADD_LIBRARY + "STATIC;SHARED;MODULE" "" "") + + unset (type) + if (NOT (PYTHON_ADD_LIBRARY_STATIC + OR PYTHON_ADD_LIBRARY_SHARED + OR PYTHON_ADD_LIBRARY_MODULE)) + set (type MODULE) endif() - endif() - endfunction() + add_library (${name} ${type} ${ARGN}) + target_link_libraries (${name} PRIVATE ${prefix}::Python) + + # customize library name to follow module name rules + get_property (type TARGET ${name} PROPERTY TYPE) + if (type STREQUAL "MODULE_LIBRARY") + set_property (TARGET ${name} PROPERTY PREFIX "") + if(CMAKE_SYSTEM_NAME STREQUAL "Windows") + set_property (TARGET ${name} PROPERTY SUFFIX ".pyd") + endif() + endif() + endfunction() + endif() endif() # final clean-up diff --git a/Modules/FindPython2.cmake b/Modules/FindPython2.cmake index 998e992..b770708 100644 --- a/Modules/FindPython2.cmake +++ b/Modules/FindPython2.cmake @@ -31,7 +31,8 @@ for you. Imported Targets ^^^^^^^^^^^^^^^^ -This module defines the following :ref:`Imported Targets `: +This module defines the following :ref:`Imported Targets ` +(when :prop_gbl:`CMAKE_ROLE` is ``PROJECT``): ``Python2::Interpreter`` Python 2 interpreter. Target defined if component ``Interpreter`` is found. @@ -145,9 +146,10 @@ Hints Commands ^^^^^^^^ -This module defines the command ``Python2_add_library`` which have the same -semantic as :command:`add_library` but take care of Python module naming rules -(only applied if library is of type ``MODULE``) and add dependency to target +This module defines the command ``Python2_add_library`` (when +:prop_gbl:`CMAKE_ROLE` is ``PROJECT``), which has the same semantics as +:command:`add_library`, but takes care of Python module naming rules +(only applied if library is of type ``MODULE``), and adds a dependency to target ``Python2::Python``:: Python2_add_library (my_module MODULE src1.cpp) diff --git a/Modules/FindPython3.cmake b/Modules/FindPython3.cmake index 2176f3f..17f1e56 100644 --- a/Modules/FindPython3.cmake +++ b/Modules/FindPython3.cmake @@ -31,7 +31,8 @@ for you. Imported Targets ^^^^^^^^^^^^^^^^ -This module defines the following :ref:`Imported Targets `: +This module defines the following :ref:`Imported Targets ` +(when :prop_gbl:`CMAKE_ROLE` is ``PROJECT``): ``Python3::Interpreter`` Python 3 interpreter. Target defined if component ``Interpreter`` is found. @@ -145,9 +146,10 @@ Hints Commands ^^^^^^^^ -This module defines the command ``Python3_add_library`` which have the same -semantic as :command:`add_library` but take care of Python module naming rules -(only applied if library is of type ``MODULE``) and add dependency to target +This module defines the command ``Python3_add_library`` (when +:prop_gbl:`CMAKE_ROLE` is ``PROJECT``), which has the same semantics as +:command:`add_library`, but takes care of Python module naming rules +(only applied if library is of type ``MODULE``), and adds a dependency to target ``Python3::Python``:: Python3_add_library (my_module MODULE src1.cpp) diff --git a/Tests/FindPython/FindPythonScript.cmake b/Tests/FindPython/FindPythonScript.cmake new file mode 100644 index 0000000..9450092 --- /dev/null +++ b/Tests/FindPython/FindPythonScript.cmake @@ -0,0 +1 @@ +find_package(${PYTHON_PACKAGE_NAME} REQUIRED QUIET) diff --git a/Tests/FindPython/Python/CMakeLists.txt b/Tests/FindPython/Python/CMakeLists.txt index 4919062..f7fc243 100644 --- a/Tests/FindPython/Python/CMakeLists.txt +++ b/Tests/FindPython/Python/CMakeLists.txt @@ -23,3 +23,7 @@ target_compile_definitions (spam3 PRIVATE PYTHON3) add_test (NAME python_spam3 COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$" "${Python_EXECUTABLE}" -c "import spam3; spam3.system(\"cd\")") + +add_test(NAME findpython_script + COMMAND "${CMAKE_COMMAND}" -DPYTHON_PACKAGE_NAME=Python + -P "${CMAKE_CURRENT_LIST_DIR}/../FindPythonScript.cmake") diff --git a/Tests/FindPython/Python2/CMakeLists.txt b/Tests/FindPython/Python2/CMakeLists.txt index c5da3b1..a0753f6 100644 --- a/Tests/FindPython/Python2/CMakeLists.txt +++ b/Tests/FindPython/Python2/CMakeLists.txt @@ -28,3 +28,7 @@ target_compile_definitions (spam2 PRIVATE PYTHON2) add_test (NAME python2_spam2 COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$" "${Python2_EXECUTABLE}" -c "import spam2; spam2.system(\"cd\")") + +add_test(NAME findpython2_script + COMMAND "${CMAKE_COMMAND}" -DPYTHON_PACKAGE_NAME=Python2 + -P "${CMAKE_CURRENT_LIST_DIR}/../FindPythonScript.cmake") diff --git a/Tests/FindPython/Python3/CMakeLists.txt b/Tests/FindPython/Python3/CMakeLists.txt index eb3ad79..65eea4c 100644 --- a/Tests/FindPython/Python3/CMakeLists.txt +++ b/Tests/FindPython/Python3/CMakeLists.txt @@ -28,3 +28,7 @@ target_compile_definitions (spam3 PRIVATE PYTHON3) add_test (NAME python3_spam3 COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$" "${Python3_EXECUTABLE}" -c "import spam3; spam3.system(\"cd\")") + +add_test(NAME findpython3_script + COMMAND "${CMAKE_COMMAND}" -DPYTHON_PACKAGE_NAME=Python3 + -P "${CMAKE_CURRENT_LIST_DIR}/../FindPythonScript.cmake") https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f2d7ed1cda590688e4ff4e37119007d0ee7cf893 commit f2d7ed1cda590688e4ff4e37119007d0ee7cf893 Author: Kyle Edwards AuthorDate: Wed Jan 23 13:22:55 2019 -0500 Commit: Kyle Edwards CommitDate: Wed Jan 23 13:45:12 2019 -0500 Help: Add note about CMAKE_ROLE to FindGit documentation diff --git a/Modules/FindGit.cmake b/Modules/FindGit.cmake index 900e4f5..3491cdc 100644 --- a/Modules/FindGit.cmake +++ b/Modules/FindGit.cmake @@ -5,7 +5,8 @@ FindGit ------- -The module defines the following ``IMPORTED`` targets: +The module defines the following ``IMPORTED`` targets (when +:prop_gbl:`CMAKE_ROLE` is ``PROJECT``): ``Git::Git`` Executable of the Git command-line client. https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8ef1916c8226ebf781c4ad0de158d15754d411f5 commit 8ef1916c8226ebf781c4ad0de158d15754d411f5 Author: Kyle Edwards AuthorDate: Wed Jan 23 11:53:21 2019 -0500 Commit: Kyle Edwards CommitDate: Wed Jan 23 11:53:54 2019 -0500 FindPython: Test existence of imported targets diff --git a/Tests/FindPython/Python/CMakeLists.txt b/Tests/FindPython/Python/CMakeLists.txt index bebd23f..4919062 100644 --- a/Tests/FindPython/Python/CMakeLists.txt +++ b/Tests/FindPython/Python/CMakeLists.txt @@ -9,6 +9,14 @@ if (NOT Python_FOUND) message (FATAL_ERROR "Fail to found Python 3") endif() +if(NOT TARGET Python::Interpreter) + message(SEND_ERROR "Python::Interpreter not found") +endif() + +if(NOT TARGET Python::Python) + message(SEND_ERROR "Python::Python not found") +endif() + Python_add_library (spam3 MODULE ../spam.c) target_compile_definitions (spam3 PRIVATE PYTHON3) diff --git a/Tests/FindPython/Python2/CMakeLists.txt b/Tests/FindPython/Python2/CMakeLists.txt index 9622b6f..c5da3b1 100644 --- a/Tests/FindPython/Python2/CMakeLists.txt +++ b/Tests/FindPython/Python2/CMakeLists.txt @@ -14,6 +14,14 @@ if (NOT Python2_FOUND) message (FATAL_ERROR "Fail to found Python 2") endif() +if(NOT TARGET Python2::Interpreter) + message(SEND_ERROR "Python2::Interpreter not found") +endif() + +if(NOT TARGET Python2::Python) + message(SEND_ERROR "Python2::Python not found") +endif() + Python2_add_library (spam2 MODULE ../spam.c) target_compile_definitions (spam2 PRIVATE PYTHON2) diff --git a/Tests/FindPython/Python3/CMakeLists.txt b/Tests/FindPython/Python3/CMakeLists.txt index cb86eae..eb3ad79 100644 --- a/Tests/FindPython/Python3/CMakeLists.txt +++ b/Tests/FindPython/Python3/CMakeLists.txt @@ -14,6 +14,14 @@ if (NOT Python3_FOUND) message (FATAL_ERROR "Fail to found Python 3") endif() +if(NOT TARGET Python3::Interpreter) + message(SEND_ERROR "Python2::Interpreter not found") +endif() + +if(NOT TARGET Python3::Python) + message(SEND_ERROR "Python2::Python not found") +endif() + Python3_add_library (spam3 MODULE ../spam.c) target_compile_definitions (spam3 PRIVATE PYTHON3) ----------------------------------------------------------------------- Summary of changes: Help/release/dev/findpython-script.rst | 6 + Modules/FindGit.cmake | 3 +- Modules/FindPython.cmake | 10 +- Modules/FindPython/Support.cmake | 206 ++++++++++++++++---------------- Modules/FindPython2.cmake | 10 +- Modules/FindPython3.cmake | 10 +- Tests/FindPython/FindPythonScript.cmake | 1 + Tests/FindPython/Python/CMakeLists.txt | 12 ++ Tests/FindPython/Python2/CMakeLists.txt | 12 ++ Tests/FindPython/Python3/CMakeLists.txt | 12 ++ 10 files changed, 168 insertions(+), 114 deletions(-) create mode 100644 Help/release/dev/findpython-script.rst create mode 100644 Tests/FindPython/FindPythonScript.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Thu Jan 24 10:43:04 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 24 Jan 2019 10:43:04 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-1085-g378473f Message-ID: <20190124154304.F0E93127C1C@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 378473f9f184000cb768c1b99e6242e054787f34 (commit) via 3d63d3ce2fd6064433e2cff9469260aec9deb116 (commit) from 1d02491950b0aa05d2053e7fa32b39dca31e537b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=378473f9f184000cb768c1b99e6242e054787f34 commit 378473f9f184000cb768c1b99e6242e054787f34 Merge: 1d02491 3d63d3c Author: Brad King AuthorDate: Thu Jan 24 15:36:33 2019 +0000 Commit: Kitware Robot CommitDate: Thu Jan 24 10:36:40 2019 -0500 Merge topic 'fortran-docs' 3d63d3ce2f Help: Add examples to CheckFortranSource{Runs,Compiles} Acked-by: Kitware Robot Merge-request: !2843 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3d63d3ce2fd6064433e2cff9469260aec9deb116 commit 3d63d3ce2fd6064433e2cff9469260aec9deb116 Author: Michael Hirsch, Ph.D AuthorDate: Tue Jan 22 22:24:03 2019 -0500 Commit: Brad King CommitDate: Wed Jan 23 08:28:13 2019 -0500 Help: Add examples to CheckFortranSource{Runs,Compiles} diff --git a/Modules/CheckFortranSourceCompiles.cmake b/Modules/CheckFortranSourceCompiles.cmake index 1820407..f94b254 100644 --- a/Modules/CheckFortranSourceCompiles.cmake +++ b/Modules/CheckFortranSourceCompiles.cmake @@ -17,8 +17,20 @@ Check if given Fortran source compiles and links into an executable. ) Checks that the source supplied in ```` can be compiled as a Fortran - source file and linked as an executable (so it must contain at least a - ``PROGRAM`` entry point). The result will be stored in the internal cache + source file and linked as an executable. The ```` must be a Fortran program + containing at least an ``end`` statement--for example: + + .. code-block:: cmake + + check_fortran_source_compiles("character :: b; error stop b; end" F2018ESTOPOK SRC_EXT F90) + + This command can help avoid costly build processes when a compiler lacks support + for a necessary feature, or a particular vendor library is not compatible with + the Fortran compiler version being used. This generate-time check may advise the + user of such before the main build process. See also the + :command:`check_fortran_source_runs` command to actually run the compiled code. + + The result will be stored in the internal cache variable ````, with a boolean true value for success and boolean false for failure. diff --git a/Modules/CheckFortranSourceRuns.cmake b/Modules/CheckFortranSourceRuns.cmake index 58d90d7..13fdb0b 100644 --- a/Modules/CheckFortranSourceRuns.cmake +++ b/Modules/CheckFortranSourceRuns.cmake @@ -16,8 +16,20 @@ subsequently be run. [SRC_EXT ]) Check that the source supplied in ```` can be compiled as a Fortran source - file, linked as an executable and then run. The ```` must contain at - least ``program; end program`` statements. If the ```` could be built and run + file, linked as an executable and then run. The ```` must be a Fortran program + containing at least an ``end`` statement--for example: + + .. code-block:: cmake + + check_fortran_source_runs("real :: x[*]; call co_sum(x); end" F2018coarrayOK) + + This command can help avoid costly build processes when a compiler lacks support + for a necessary feature, or a particular vendor library is not compatible with + the Fortran compiler version being used. Some of these failures only occur at runtime + instead of linktime, and a trivial runtime example can catch the issue before the + main build process. + + If the ```` could be built and run successfully, the internal cache variable specified by ```` will be set to 1, otherwise it will be set to an value that evaluates to boolean false (e.g. an empty string or an error message). ----------------------------------------------------------------------- Summary of changes: Modules/CheckFortranSourceCompiles.cmake | 16 ++++++++++++++-- Modules/CheckFortranSourceRuns.cmake | 16 ++++++++++++++-- 2 files changed, 28 insertions(+), 4 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Fri Jan 25 00:03:05 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 25 Jan 2019 00:03:05 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-1086-gd47aa71 Message-ID: <20190125050305.3322011361C@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via d47aa71b395b9d2d641d928ae90f10a135f22b49 (commit) from 378473f9f184000cb768c1b99e6242e054787f34 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d47aa71b395b9d2d641d928ae90f10a135f22b49 commit d47aa71b395b9d2d641d928ae90f10a135f22b49 Author: Kitware Robot AuthorDate: Fri Jan 25 00:01:06 2019 -0500 Commit: Kitware Robot CommitDate: Fri Jan 25 00:01:06 2019 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index d67aba1..e3a5e52 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 13) -set(CMake_VERSION_PATCH 20190124) +set(CMake_VERSION_PATCH 20190125) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Fri Jan 25 04:23:10 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 25 Jan 2019 04:23:10 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-1088-g0d8d7a6 Message-ID: <20190125092311.146E71138B8@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 0d8d7a6896c5065c4baa1c4f5489e2424535ce6a (commit) via 513e77550daaac083cb13b3df53be955a7d0b429 (commit) from d47aa71b395b9d2d641d928ae90f10a135f22b49 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0d8d7a6896c5065c4baa1c4f5489e2424535ce6a commit 0d8d7a6896c5065c4baa1c4f5489e2424535ce6a Merge: d47aa71 513e775 Author: Marc Chevrier AuthorDate: Fri Jan 25 09:17:58 2019 +0000 Commit: Kitware Robot CommitDate: Fri Jan 25 04:18:11 2019 -0500 Merge topic 'FindPython-numpy' 513e77550d FindPython: Introduce NumPy component Acked-by: Kitware Robot Merge-request: !2734 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=513e77550daaac083cb13b3df53be955a7d0b429 commit 513e77550daaac083cb13b3df53be955a7d0b429 Author: Hiroshi Miura AuthorDate: Wed Dec 12 13:16:08 2018 +0900 Commit: Hiroshi Miura CommitDate: Fri Jan 25 01:26:48 2019 +0900 FindPython: Introduce NumPy component Fixes: #18678 Signed-off-by: Hiroshi Miura diff --git a/Help/release/dev/FindPython-NumPy-component.rst b/Help/release/dev/FindPython-NumPy-component.rst new file mode 100644 index 0000000..5ea6cfb --- /dev/null +++ b/Help/release/dev/FindPython-NumPy-component.rst @@ -0,0 +1,5 @@ +FindPython-NumPy-component +-------------------------- + +* The :module:`FindPython`, :module:`FindPython2`, and :module:`FindPython3` + modules gained support for ``NumPy`` component. diff --git a/Modules/FindPython.cmake b/Modules/FindPython.cmake index f5fb0ab..f014916 100644 --- a/Modules/FindPython.cmake +++ b/Modules/FindPython.cmake @@ -14,11 +14,12 @@ Three components are supported: * ``Compiler``: search for Python compiler. Only offered by IronPython. * ``Development``: search for development artifacts (include directories and libraries). +* ``NumPy``: search for NumPy include directories. If no ``COMPONENTS`` is specified, ``Interpreter`` is assumed. -To ensure consistent versions between components ``Interpreter``, ``Compiler`` -and ``Development``, specify all components at the same time:: +To ensure consistent versions between components ``Interpreter``, ``Compiler``, +``Development`` and ``NumPy``, specify all components at the same time:: find_package (Python COMPONENTS Interpreter Development) @@ -39,6 +40,8 @@ This module defines the following :ref:`Imported Targets ` Python compiler. Target defined if component ``Compiler`` is found. ``Python::Python`` Python library. Target defined if component ``Development`` is found. +``Python::NumPy`` + NumPy Python library. Target defined if component ``NumPy`` is found. Result Variables ^^^^^^^^^^^^^^^^ @@ -104,6 +107,12 @@ This module will set the following variables in your project Python minor version. ``Python_VERSION_PATCH`` Python patch version. +``Python_NumPy_FOUND`` + System has the NumPy. +``Python_NumPy_INCLUDE_DIRS`` + The NumPy include directries. +``Python_NumPy_VERSION`` + The NumPy version. Hints ^^^^^ diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake index fd429e2..0138b04 100644 --- a/Modules/FindPython/Support.cmake +++ b/Modules/FindPython/Support.cmake @@ -209,6 +209,10 @@ if (NOT ${_PYTHON_PREFIX}_FIND_COMPONENTS) set (${_PYTHON_PREFIX}_FIND_COMPONENTS Interpreter) set (${_PYTHON_PREFIX}_FIND_REQUIRED_Interpreter TRUE) endif() +if ("NumPy" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS) + list (APPEND ${_PYTHON_PREFIX}_FIND_COMPONENTS "Interpreter" "Development") + list (REMOVE_DUPLICATES ${_PYTHON_PREFIX}_FIND_COMPONENTS) +endif() foreach (_${_PYTHON_PREFIX}_COMPONENT IN LISTS ${_PYTHON_PREFIX}_FIND_COMPONENTS) set (${_PYTHON_PREFIX}_${_${_PYTHON_PREFIX}_COMPONENT}_FOUND FALSE) endforeach() @@ -1122,6 +1126,41 @@ if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS endif() endif() +if ("NumPy" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS AND ${_PYTHON_PREFIX}_Interpreter_FOUND) + if (${_PYTHON_PREFIX}_FIND_REQUIRED_NumPy) + list (APPEND _${_PYTHON_PREFIX}_REQUIRED_VARS ${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR) + list (APPEND _${_PYTHON_PREFIX}_CACHED_VARS ${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR) + endif() + execute_process( + COMMAND "${${_PYTHON_PREFIX}_EXECUTABLE}" -c + "from __future__ import print_function\ntry: import numpy; print(numpy.get_include(), end='')\nexcept:pass\n" + RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT + OUTPUT_VARIABLE _${_PYTHON_PREFIX}_NumPy_PATH + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + if (NOT _${_PYTHON_PREFIX}_RESULT) + find_path(${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR + NAMES arrayobject.h numpyconfig.h + HINTS "${_${_PYTHON_PREFIX}_NumPy_PATH}" + PATH_SUFFIXES numpy + NO_DEFAULT_PATH) + endif() + if(${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR) + set(${_PYTHON_PREFIX}_NumPy_INCLUDE_DIRS "${${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR}") + set(${_PYTHON_PREFIX}_NumPy_FOUND TRUE) + endif() + if(${_PYTHON_PREFIX}_NumPy_FOUND) + execute_process( + COMMAND "${${_PYTHON_PREFIX}_EXECUTABLE}" -c + "from __future__ import print_function\ntry: import numpy; print(numpy.__version__, end='')\nexcept:pass\n" + RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT + OUTPUT_VARIABLE _${_PYTHON_PREFIX}_NumPy_VERSION) + if (NOT _${_PYTHON_PREFIX}_RESULT) + set(${_PYTHON_PREFIX}_NumPy_VERSION "${_${_PYTHON_PREFIX}_NumPy_VERSION}") + endif() + endif() +endif() + # final validation if (${_PYTHON_PREFIX}_VERSION_MAJOR AND NOT ${_PYTHON_PREFIX}_VERSION_MAJOR VERSION_EQUAL _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR) @@ -1249,6 +1288,14 @@ if(_${_PYTHON_PREFIX}_CMAKE_ROLE STREQUAL "PROJECT") endif() endfunction() endif() + + if ("NumPy" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS AND ${_PYTHON_PREFIX}_NumPy_FOUND + AND NOT TARGET ${_PYTHON_PREFIX}::NumPy AND TARGET ${_PYTHON_PREFIX}::Python) + add_library (${_PYTHON_PREFIX}::NumPy INTERFACE IMPORTED) + set_property (TARGET ${_PYTHON_PREFIX}::NumPy + PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR}") + target_link_libraries (${_PYTHON_PREFIX}::NumPy INTERFACE ${_PYTHON_PREFIX}::Python) + endif() endif() # final clean-up diff --git a/Modules/FindPython2.cmake b/Modules/FindPython2.cmake index b770708..0bb7b28 100644 --- a/Modules/FindPython2.cmake +++ b/Modules/FindPython2.cmake @@ -14,11 +14,12 @@ Three components are supported: * ``Compiler``: search for Python 2 compiler. Only offered by IronPython. * ``Development``: search for development artifacts (include directories and libraries) +* ``NumPy``: search for NumPy include directories. If no ``COMPONENTS`` is specified, ``Interpreter`` is assumed. -To ensure consistent versions between components ``Interpreter``, ``Compiler`` -and ``Development``, specify all components at the same time:: +To ensure consistent versions between components ``Interpreter``, ``Compiler``, +``Development`` and ``NumPy``, specify all components at the same time:: find_package (Python2 COMPONENTS Interpreter Development) @@ -40,6 +41,8 @@ This module defines the following :ref:`Imported Targets ` Python 2 compiler. Target defined if component ``Compiler`` is found. ``Python2::Python`` Python 2 library. Target defined if component ``Development`` is found. +``Python2::NumPy`` + NumPy library for Python 2. Target defined if component ``NumPy`` is found. Result Variables ^^^^^^^^^^^^^^^^ @@ -105,6 +108,12 @@ This module will set the following variables in your project Python 2 minor version. ``Python2_VERSION_PATCH`` Python 2 patch version. +``Python2_NumPy_FOUND`` + System has the NumPy. +``Python2_NumPy_INCLUDE_DIRS`` + The NumPy include directries. +``Python2_NumPy_VERSION`` + The NumPy version. Hints ^^^^^ diff --git a/Modules/FindPython3.cmake b/Modules/FindPython3.cmake index 17f1e56..b3dfff3 100644 --- a/Modules/FindPython3.cmake +++ b/Modules/FindPython3.cmake @@ -14,11 +14,12 @@ Three components are supported: * ``Compiler``: search for Python 3 compiler. Only offered by IronPython. * ``Development``: search for development artifacts (include directories and libraries) +* ``NumPy``: search for NumPy include directories. If no ``COMPONENTS`` is specified, ``Interpreter`` is assumed. -To ensure consistent versions between components ``Interpreter``, ``Compiler`` -and ``Development``, specify all components at the same time:: +To ensure consistent versions between components ``Interpreter``, ``Compiler``, +``Development`` and ``NumPy``, specify all components at the same time:: find_package (Python3 COMPONENTS Interpreter Development) @@ -40,6 +41,8 @@ This module defines the following :ref:`Imported Targets ` Python 3 compiler. Target defined if component ``Compiler`` is found. ``Python3::Python`` Python 3 library. Target defined if component ``Development`` is found. +``Python3::NumPy`` + NumPy library for Python 3. Target defined if component ``NumPy`` is found. Result Variables ^^^^^^^^^^^^^^^^ @@ -105,6 +108,12 @@ This module will set the following variables in your project Python 3 minor version. ``Python3_VERSION_PATCH`` Python 3 patch version. +``Python3_NumPy_FOUND`` + System has the NumPy. +``Python3_NumPy_INCLUDE_DIRS`` + The NumPy include directries. +``Python3_NumPy_VERSION`` + The NumPy version. Hints ^^^^^ diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index c1703cc..0c6eabc 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1558,7 +1558,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release add_subdirectory(FindXercesC) endif() - if(CMake_TEST_FindPython) + if(CMake_TEST_FindPython OR CMake_TEST_FindPython_NumPy) add_subdirectory(FindPython) endif() diff --git a/Tests/FindPython/CMakeLists.txt b/Tests/FindPython/CMakeLists.txt index 639d29c..38211a4 100644 --- a/Tests/FindPython/CMakeLists.txt +++ b/Tests/FindPython/CMakeLists.txt @@ -1,69 +1,94 @@ -add_test(NAME FindPython.Python2 COMMAND - ${CMAKE_CTEST_COMMAND} -C $ - --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindPython/Python2" - "${CMake_BINARY_DIR}/Tests/FindPython/Python2" - ${build_generator_args} - --build-project TestPython2 - --build-options ${build_options} - --test-command ${CMAKE_CTEST_COMMAND} -V -C $ - ) +if(CMake_TEST_FindPython) + add_test(NAME FindPython.Python2 COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/Python2" + "${CMake_BINARY_DIR}/Tests/FindPython/Python2" + ${build_generator_args} + --build-project TestPython2 + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) -add_test(NAME FindPython.Python2Fail COMMAND - ${CMAKE_CTEST_COMMAND} -C $ - --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindPython/Python2Fail" - "${CMake_BINARY_DIR}/Tests/FindPython/Python2Fail" - ${build_generator_args} - --build-project TestPython2Fail - --build-options ${build_options} - --test-command ${CMAKE_CTEST_COMMAND} -V -C $ - ) -set_tests_properties(FindPython.Python2Fail PROPERTIES - PASS_REGULAR_EXPRESSION "Could NOT find Python2 \\(missing: foobar\\)") + add_test(NAME FindPython.Python2Fail COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/Python2Fail" + "${CMake_BINARY_DIR}/Tests/FindPython/Python2Fail" + ${build_generator_args} + --build-project TestPython2Fail + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) + set_tests_properties(FindPython.Python2Fail PROPERTIES + PASS_REGULAR_EXPRESSION "Could NOT find Python2 \\(missing: foobar\\)") -add_test(NAME FindPython.Python3 COMMAND - ${CMAKE_CTEST_COMMAND} -C $ - --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindPython/Python3" - "${CMake_BINARY_DIR}/Tests/FindPython/Python3" - ${build_generator_args} - --build-project TestPython3 - --build-options ${build_options} - --test-command ${CMAKE_CTEST_COMMAND} -V -C $ - ) + add_test(NAME FindPython.Python3 COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/Python3" + "${CMake_BINARY_DIR}/Tests/FindPython/Python3" + ${build_generator_args} + --build-project TestPython3 + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) -add_test(NAME FindPython.Python3Fail COMMAND - ${CMAKE_CTEST_COMMAND} -C $ - --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindPython/Python3Fail" - "${CMake_BINARY_DIR}/Tests/FindPython/Python3Fail" - ${build_generator_args} - --build-project TestPython3Fail - --build-options ${build_options} - --test-command ${CMAKE_CTEST_COMMAND} -V -C $ - ) -set_tests_properties(FindPython.Python3Fail PROPERTIES - PASS_REGULAR_EXPRESSION "Could NOT find Python3 \\(missing: foobar\\)") + add_test(NAME FindPython.Python3Fail COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/Python3Fail" + "${CMake_BINARY_DIR}/Tests/FindPython/Python3Fail" + ${build_generator_args} + --build-project TestPython3Fail + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) + set_tests_properties(FindPython.Python3Fail PROPERTIES + PASS_REGULAR_EXPRESSION "Could NOT find Python3 \\(missing: foobar\\)") -add_test(NAME FindPython.Python COMMAND - ${CMAKE_CTEST_COMMAND} -C $ - --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindPython/Python" - "${CMake_BINARY_DIR}/Tests/FindPython/Python" - ${build_generator_args} - --build-project TestPython - --build-options ${build_options} - --test-command ${CMAKE_CTEST_COMMAND} -V -C $ - ) + add_test(NAME FindPython.Python COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/Python" + "${CMake_BINARY_DIR}/Tests/FindPython/Python" + ${build_generator_args} + --build-project TestPython + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) + + add_test(NAME FindPython.MultiplePackages COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/MultiplePackages" + "${CMake_BINARY_DIR}/Tests/FindPython/MultiplePackages" + ${build_generator_args} + --build-project TestMultiplePackages + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) +endif() -add_test(NAME FindPython.MultiplePackages COMMAND - ${CMAKE_CTEST_COMMAND} -C $ - --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindPython/MultiplePackages" - "${CMake_BINARY_DIR}/Tests/FindPython/MultiplePackages" - ${build_generator_args} - --build-project TestMultiplePackages - --build-options ${build_options} - --test-command ${CMAKE_CTEST_COMMAND} -V -C $ +if(CMake_TEST_FindPython_NumPy) + add_test(NAME FindPython.NumPy COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/NumPy" + "${CMake_BINARY_DIR}/Tests/FindPython/NumPy" + ${build_generator_args} + --build-project TestNumPy + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) + add_test(NAME FindPython.NumPyOnly COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/NumPyOnly" + "${CMake_BINARY_DIR}/Tests/FindPython/NumPyOnly" + ${build_generator_args} + --build-project TestNumPyOnly + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ ) + endif() diff --git a/Tests/FindPython/NumPy/CMakeLists.txt b/Tests/FindPython/NumPy/CMakeLists.txt new file mode 100644 index 0000000..f557026 --- /dev/null +++ b/Tests/FindPython/NumPy/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 3.1) + +project(TestNumPy C) + +find_package (Python2 REQUIRED COMPONENTS Interpreter Development NumPy) +find_package (Python3 REQUIRED COMPONENTS Interpreter Development NumPy) + +Python2_add_library (arraytest2 MODULE arraytest.c) +target_compile_definitions (arraytest2 PRIVATE PYTHON2) +target_link_libraries (arraytest2 PRIVATE Python2::NumPy) + +Python3_add_library (arraytest3 MODULE arraytest.c) +target_compile_definitions (arraytest3 PRIVATE PYTHON3) +target_link_libraries (arraytest3 PRIVATE Python3::NumPy) + +add_test (NAME python2_arraytest + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$" + "${Python2_EXECUTABLE}" -c "import numpy; import arraytest2; arraytest2.vecsq(numpy.array([1, 2, 3]));") + +add_test (NAME python3_arraytest + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$" + "${Python3_EXECUTABLE}" -c "import numpy; import arraytest3; arraytest3.vecsq(numpy.array([1, 2, 3]));") diff --git a/Tests/FindPython/NumPy/arraytest.c b/Tests/FindPython/NumPy/arraytest.c new file mode 100644 index 0000000..135877d --- /dev/null +++ b/Tests/FindPython/NumPy/arraytest.c @@ -0,0 +1,58 @@ +#include "Python.h" + +#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION +#include "arrayobject.h" + +#include + +static PyObject* vecsq(PyObject* self, PyObject* args); + +static PyMethodDef arraytestMethods[] = { { "vecsq", vecsq, METH_VARARGS }, + { NULL, NULL } }; + +static PyObject* vecsq(PyObject* self, PyObject* args) +{ + PyArrayObject *vecin, *vecout; + npy_intp dims[2]; + double *cin, *cout; + int i, j, n, m; + + if (!PyArg_ParseTuple(args, "O!", &PyArray_Type, &vecin)) + return NULL; + + n = dims[0] = PyArray_NDIM(vecin); + vecout = (PyArrayObject*)PyArray_SimpleNew(1, dims, NPY_DOUBLE); + + cin = (double*)PyArray_DATA(vecin); + cout = (double*)PyArray_DATA(vecout); + + for (i = 0; i < n; i++) { + cout[i] = cin[i] * cin[i]; + } + return PyArray_Return(vecout); +} + +#if defined(PYTHON2) +PyMODINIT_FUNC init_C_arraytest(void) +{ + (void)Py_InitModule("arraytest2", arraytestMethods); + import_array(); +} +#endif + +#if defined(PYTHON3) +static struct PyModuleDef arraytestmodule = { + PyModuleDef_HEAD_INIT, "arraytest3", /* name of module */ + NULL, /* module documentation, may be NULL */ + -1, /* size of per-interpreter state of the module, + or -1 if the module keeps state in global variables. */ + arraytestMethods +}; + +PyMODINIT_FUNC PyInit_C_arraytest(void) +{ + PyObject* po = PyModule_Create(&arraytestmodule); + import_array(); + return po; +} +#endif diff --git a/Tests/FindPython/NumPyOnly/CMakeLists.txt b/Tests/FindPython/NumPyOnly/CMakeLists.txt new file mode 100644 index 0000000..a5db603 --- /dev/null +++ b/Tests/FindPython/NumPyOnly/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.1) + +project(TestNumPyOnly C) + +find_package(Python2 REQUIRED COMPONENTS NumPy) +find_package(Python3 REQUIRED COMPONENTS NumPy) + +Python2_add_library (arraytest2 MODULE ../NumPy/arraytest.c) +target_compile_definitions (arraytest2 PRIVATE PYTHON2) +target_link_libraries (arraytest2 PRIVATE Python2::NumPy) + +Python3_add_library (arraytest3 MODULE ../NumPy/arraytest.c) +target_compile_definitions (arraytest3 PRIVATE PYTHON3) +target_link_libraries (arraytest3 PRIVATE Python3::NumPy) ----------------------------------------------------------------------- Summary of changes: Help/release/dev/FindPython-NumPy-component.rst | 5 + Modules/FindPython.cmake | 13 +- Modules/FindPython/Support.cmake | 47 ++++++++ Modules/FindPython2.cmake | 13 +- Modules/FindPython3.cmake | 13 +- Tests/CMakeLists.txt | 2 +- Tests/FindPython/CMakeLists.txt | 151 ++++++++++++++---------- Tests/FindPython/NumPy/CMakeLists.txt | 22 ++++ Tests/FindPython/NumPy/arraytest.c | 58 +++++++++ Tests/FindPython/NumPyOnly/CMakeLists.txt | 14 +++ 10 files changed, 268 insertions(+), 70 deletions(-) create mode 100644 Help/release/dev/FindPython-NumPy-component.rst create mode 100644 Tests/FindPython/NumPy/CMakeLists.txt create mode 100644 Tests/FindPython/NumPy/arraytest.c create mode 100644 Tests/FindPython/NumPyOnly/CMakeLists.txt hooks/post-receive -- CMake From kwrobot at kitware.com Fri Jan 25 07:53:07 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 25 Jan 2019 07:53:07 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-1092-ga5f7652 Message-ID: <20190125125307.63B94A2C37@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via a5f7652fb9325c285d2e8a76404120b83fab79ea (commit) via 29fbd3c9a0ab2a27e9deadccd160d15e5e80e70e (commit) via 646eedcfcb73548b723603626ac276f739ba5d1d (commit) via 8f56f22b84b52238dca066cc431c6e82f5380fe4 (commit) from 0d8d7a6896c5065c4baa1c4f5489e2424535ce6a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a5f7652fb9325c285d2e8a76404120b83fab79ea commit a5f7652fb9325c285d2e8a76404120b83fab79ea Merge: 29fbd3c 646eedc Author: Brad King AuthorDate: Fri Jan 25 12:50:31 2019 +0000 Commit: Kitware Robot CommitDate: Fri Jan 25 07:51:25 2019 -0500 Merge topic 'revert-file-alt-httpauth' 646eedcfcb Revert "file: Allow DOWNLOAD/UPLOAD using alternate authentication methods" Acked-by: Kitware Robot Merge-request: !2858 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=29fbd3c9a0ab2a27e9deadccd160d15e5e80e70e commit 29fbd3c9a0ab2a27e9deadccd160d15e5e80e70e Merge: 0d8d7a6 8f56f22 Author: Brad King AuthorDate: Fri Jan 25 12:50:16 2019 +0000 Commit: Kitware Robot CommitDate: Fri Jan 25 07:50:23 2019 -0500 Merge topic 'aarch64-no-std-move-function' 8f56f22b84 cmListCommand: Avoid std::function move constructor on aarch64 Acked-by: Kitware Robot Merge-request: !2857 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=646eedcfcb73548b723603626ac276f739ba5d1d commit 646eedcfcb73548b723603626ac276f739ba5d1d Author: Brad King AuthorDate: Thu Jan 24 14:13:33 2019 -0500 Commit: Brad King CommitDate: Thu Jan 24 14:14:40 2019 -0500 Revert "file: Allow DOWNLOAD/UPLOAD using alternate authentication methods" Revert commit 31301b46a7 (file: Allow DOWNLOAD/UPLOAD using alternate authentication methods, 2018-08-28, v3.13.0-rc1~155^2). It regressed support for password-protected redirects. Fixes: #18691 diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 1f76703..5d34b71 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -2906,10 +2906,6 @@ bool cmFileCommand::HandleDownloadCommand(std::vector const& args) ::CURLcode res = ::curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); check_curl_result(res, "DOWNLOAD cannot set url: "); - // enable auth - res = ::curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY); - check_curl_result(res, "DOWNLOAD cannot set httpauth: "); - // enable HTTP ERROR parsing res = ::curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1); check_curl_result(res, "DOWNLOAD cannot set http failure option: "); @@ -3209,10 +3205,6 @@ bool cmFileCommand::HandleUploadCommand(std::vector const& args) res = ::curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); check_curl_result(res, "UPLOAD cannot set url: "); - // enable auth - res = ::curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY); - check_curl_result(res, "UPLOAD cannot set httpauth: "); - res = ::curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, cmWriteToMemoryCallback); check_curl_result(res, "UPLOAD cannot set write function: "); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8f56f22b84b52238dca066cc431c6e82f5380fe4 commit 8f56f22b84b52238dca066cc431c6e82f5380fe4 Author: Brad King AuthorDate: Thu Jan 24 14:01:17 2019 -0500 Commit: Brad King CommitDate: Thu Jan 24 14:07:05 2019 -0500 cmListCommand: Avoid std::function move constructor on aarch64 Since commit 5a0784ddea (clang-tidy: Pass by value, 2019-01-21), some of the `RunCMake.{list,PositionIndependentCode}` cases have crashed on an aarch64 build with GCC 6. Avoiding use of the `std::function` move constructor avoids the crash. Use a strict preprocessor condition to use this workaround only where needed. diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index 05b22cf..b24c5ba 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -666,7 +666,12 @@ bool cmListCommand::HandleTransformCommand( ActionDescriptor(std::string name, int arity, transform_type transform) : Name(std::move(name)) , Arity(arity) +#if defined(__GNUC__) && __GNUC__ == 6 && defined(__aarch64__) + // std::function move constructor miscompiles on this architecture + , Transform(transform) +#else , Transform(std::move(transform)) +#endif { } ----------------------------------------------------------------------- Summary of changes: Source/cmFileCommand.cxx | 8 -------- Source/cmListCommand.cxx | 5 +++++ 2 files changed, 5 insertions(+), 8 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Fri Jan 25 08:03:05 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 25 Jan 2019 08:03:05 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-1105-gb4ccb6c Message-ID: <20190125130305.E831A14C3D@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via b4ccb6cd32029efa802dfdfa889c75bc16f65cf1 (commit) via 40745ad35ac57b437dcd6d74e846e9cd9743808f (commit) via c18fc30d1a0c67780fdea4ccd0a84a601ad7e8ef (commit) via 9f84cbd8c323a5a59b666a8bc8199e52a181bb35 (commit) via 5a6e683a32c8ba9f7610e4ca0c6c3d9e7888d934 (commit) via 73a6605e069dbe05b8303007620544f9c73f0273 (commit) via 329cf7f3e3ef4d64b4bdd274ad2b6cc376a6cb0e (commit) via d67ce0a61e6a4c8b639cb19f575b4f0a5b2d033f (commit) via bee32e96b392ff4e0f2baf8fdc831a9e5240c7d9 (commit) via 99337d345ba9d3379135c90854be23403fa8e274 (commit) via 9e5c13738bdc45b00b529b492bad92800890fb9c (commit) via 614876c638f7a428ff2f47104e2427bdbb64958d (commit) via 3e867ed4003e33ace2de6027f9bedb9aa7718b0c (commit) from a5f7652fb9325c285d2e8a76404120b83fab79ea (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b4ccb6cd32029efa802dfdfa889c75bc16f65cf1 commit b4ccb6cd32029efa802dfdfa889c75bc16f65cf1 Merge: 40745ad d67ce0a Author: Brad King AuthorDate: Fri Jan 25 13:00:14 2019 +0000 Commit: Kitware Robot CommitDate: Fri Jan 25 08:02:21 2019 -0500 Merge topic 'update-kwsys' d67ce0a61e Merge branch 'upstream-KWSys' into update-kwsys bee32e96b3 KWSys 2019-01-24 (b9dd1636) Acked-by: Kitware Robot Merge-request: !2851 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=40745ad35ac57b437dcd6d74e846e9cd9743808f commit 40745ad35ac57b437dcd6d74e846e9cd9743808f Merge: c18fc30 3e867ed Author: Brad King AuthorDate: Fri Jan 25 12:59:37 2019 +0000 Commit: Kitware Robot CommitDate: Fri Jan 25 08:01:26 2019 -0500 Merge topic 'cmake-files-directory' 3e867ed400 cmake: inlined files dir constant and removed it from cmake.h Acked-by: Kitware Robot Rejected-by: vvs31415 Merge-request: !2655 diff --cc Source/cmGlobalUnixMakefileGenerator3.cxx index b481979,45cb19f..f504846 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@@ -572,12 -572,12 +572,12 @@@ void cmGlobalUnixMakefileGenerator3::Wr // Write the rule. commands.clear(); - std::string tmp = cmake::GetCMakeFilesDirectoryPostSlash(); + std::string tmp = "CMakeFiles/"; tmp += "Makefile2"; - commands.push_back(lg->GetRecursiveMakeCall(tmp.c_str(), name)); + commands.push_back(lg->GetRecursiveMakeCall(tmp, name)); depends.clear(); if (regenerate) { - depends.push_back("cmake_check_build_system"); + depends.emplace_back("cmake_check_build_system"); } lg->WriteMakeRule(ruleFileStream, "Build rule for target.", name, depends, commands, true); @@@ -726,9 -726,9 +726,9 @@@ void cmGlobalUnixMakefileGenerator3::Wr progCmd << " " << this->CountProgressMarksInTarget(gtarget, emitted); commands.push_back(progCmd.str()); } - std::string tmp = cmake::GetCMakeFilesDirectoryPostSlash(); + std::string tmp = "CMakeFiles/"; tmp += "Makefile2"; - commands.push_back(lg->GetRecursiveMakeCall(tmp.c_str(), localName)); + commands.push_back(lg->GetRecursiveMakeCall(tmp, localName)); { std::ostringstream progCmd; progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # 0 diff --cc Source/cmInstallTargetGenerator.cxx index 08f46aa,89b3e73..d1d4316 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@@ -19,16 -19,15 +19,15 @@@ #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmTarget.h" - #include "cmake.h" cmInstallTargetGenerator::cmInstallTargetGenerator( - const std::string& targetName, const char* dest, bool implib, + std::string targetName, const char* dest, bool implib, const char* file_permissions, std::vector const& configurations, const char* component, MessageLevel message, bool exclude_from_all, - bool optional, cmListFileBacktrace const& backtrace) + bool optional, cmListFileBacktrace backtrace) : cmInstallGenerator(dest, configurations, component, message, exclude_from_all) - , TargetName(targetName) + , TargetName(std::move(targetName)) , Target(nullptr) , FilePermissions(file_permissions) , ImportLibrary(implib) diff --cc Source/cmLocalUnixMakefileGenerator3.cxx index 324ea47,e246bc7..7cb98b9 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@@ -371,9 -371,10 +371,9 @@@ void cmLocalUnixMakefileGenerator3::Wri depends.clear(); // Build the target for this pass. - std::string makefile2 = cmake::GetCMakeFilesDirectoryPostSlash(); + std::string makefile2 = "CMakeFiles/"; makefile2 += "Makefile2"; - commands.push_back( - this->GetRecursiveMakeCall(makefile2.c_str(), localName)); + commands.push_back(this->GetRecursiveMakeCall(makefile2, localName)); this->CreateCDCommand(commands, this->GetBinaryDirectory(), this->GetCurrentBinaryDirectory()); this->WriteMakeRule(ruleFileStream, "Convenience name for target.", @@@ -1361,9 -1362,10 +1361,9 @@@ bool cmLocalUnixMakefileGenerator3::Sca cmMakefile* mf = this->Makefile; bool haveDirectoryInfo = false; std::string dirInfoFile = this->GetCurrentBinaryDirectory(); - dirInfoFile += cmake::GetCMakeFilesDirectory(); + dirInfoFile += "/CMakeFiles"; dirInfoFile += "/CMakeDirectoryInformation.cmake"; - if (mf->ReadListFile(dirInfoFile.c_str()) && - !cmSystemTools::GetErrorOccuredFlag()) { + if (mf->ReadListFile(dirInfoFile) && !cmSystemTools::GetErrorOccuredFlag()) { haveDirectoryInfo = true; } @@@ -1608,9 -1613,10 +1608,9 @@@ void cmLocalUnixMakefileGenerator3::Wri cmOutputConverter::SHELL); commands.push_back(progCmd.str()); } - std::string mf2Dir = cmake::GetCMakeFilesDirectoryPostSlash(); + std::string mf2Dir = "CMakeFiles/"; mf2Dir += "Makefile2"; - commands.push_back( - this->GetRecursiveMakeCall(mf2Dir.c_str(), recursiveTarget)); + commands.push_back(this->GetRecursiveMakeCall(mf2Dir, recursiveTarget)); this->CreateCDCommand(commands, this->GetBinaryDirectory(), this->GetCurrentBinaryDirectory()); { https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c18fc30d1a0c67780fdea4ccd0a84a601ad7e8ef commit c18fc30d1a0c67780fdea4ccd0a84a601ad7e8ef Merge: 9f84cbd 9e5c137 Author: Brad King AuthorDate: Fri Jan 25 12:58:11 2019 +0000 Commit: Kitware Robot CommitDate: Fri Jan 25 08:00:14 2019 -0500 Merge topic 'renamefile-string' 9e5c13738b cmSystemTools::RenameFile: Accepts std::string args Acked-by: Kitware Robot Merge-request: !2842 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9f84cbd8c323a5a59b666a8bc8199e52a181bb35 commit 9f84cbd8c323a5a59b666a8bc8199e52a181bb35 Merge: 5a6e683 99337d3 Author: Brad King AuthorDate: Fri Jan 25 12:58:15 2019 +0000 Commit: Kitware Robot CommitDate: Fri Jan 25 07:59:11 2019 -0500 Merge topic 'error-overloads' 99337d345b cmSystemTools::Error(): new overload accepting std::string Acked-by: Kitware Robot Merge-request: !2845 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5a6e683a32c8ba9f7610e4ca0c6c3d9e7888d934 commit 5a6e683a32c8ba9f7610e4ca0c6c3d9e7888d934 Merge: 73a6605 614876c Author: Brad King AuthorDate: Fri Jan 25 12:58:06 2019 +0000 Commit: Kitware Robot CommitDate: Fri Jan 25 07:58:12 2019 -0500 Merge topic 'unixmfg3-string' 614876c638 cmLocalUnixMakefileGenerator3: more methods accept std::string Acked-by: Kitware Robot Merge-request: !2840 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=73a6605e069dbe05b8303007620544f9c73f0273 commit 73a6605e069dbe05b8303007620544f9c73f0273 Merge: a5f7652 329cf7f Author: Brad King AuthorDate: Fri Jan 25 07:55:29 2019 -0500 Commit: Brad King CommitDate: Fri Jan 25 07:55:29 2019 -0500 Merge branch 'release-3.13' https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d67ce0a61e6a4c8b639cb19f575b4f0a5b2d033f commit d67ce0a61e6a4c8b639cb19f575b4f0a5b2d033f Merge: 1d02491 bee32e9 Author: Brad King AuthorDate: Thu Jan 24 09:52:25 2019 -0500 Commit: Brad King CommitDate: Thu Jan 24 09:52:25 2019 -0500 Merge branch 'upstream-KWSys' into update-kwsys * upstream-KWSys: KWSys 2019-01-24 (b9dd1636) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bee32e96b392ff4e0f2baf8fdc831a9e5240c7d9 commit bee32e96b392ff4e0f2baf8fdc831a9e5240c7d9 Author: KWSys Upstream AuthorDate: Thu Jan 24 09:49:15 2019 -0500 Commit: Brad King CommitDate: Thu Jan 24 09:52:22 2019 -0500 KWSys 2019-01-24 (b9dd1636) Code extracted from: https://gitlab.kitware.com/utils/kwsys.git at commit b9dd1636e50ea43cd33bed8c6ffbbe7161618b54 (master). Upstream Shortlog ----------------- Ben Boeckel (1): 28db6989 cmake: add an option for building with PIC Taylor Braun-Jones (1): 3f35954d SystemTools: Add TextFilesDiffer method Tobias Kloss (1): aa1f7f7c SystemTools: Fix FileIsSymlink with Windows data deduplication diff --git a/CMakeLists.txt b/CMakeLists.txt index a2fcc16..b33aa80 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -454,6 +454,10 @@ ELSE() SET(KWSYS_LIBRARY_TYPE STATIC) ENDIF() +if(NOT DEFINED KWSYS_BUILD_PIC) + set(KWSYS_BUILD_PIC 0) +endif() + #----------------------------------------------------------------------------- # Configure some implementation details. @@ -870,7 +874,7 @@ IF(KWSYS_C_SRCS OR KWSYS_CXX_SRCS) SET(KWSYS_LINK_DEPENDENCY INTERFACE) ADD_LIBRARY(${KWSYS_TARGET_OBJECT} OBJECT ${KWSYS_C_SRCS} ${KWSYS_CXX_SRCS}) - IF(KWSYS_BUILD_SHARED) + IF(KWSYS_BUILD_SHARED OR KWSYS_BUILD_PIC) SET_PROPERTY(TARGET ${KWSYS_TARGET_OBJECT} PROPERTY POSITION_INDEPENDENT_CODE TRUE) ENDIF() @@ -965,7 +969,7 @@ IF(KWSYS_ENABLE_C AND KWSYS_C_SRCS) ${KWSYS_TARGET_C_INTERFACE} ${KWSYS_TARGET_C_LINK}) SET(KWSYS_LINK_DEPENDENCY INTERFACE) ADD_LIBRARY(${KWSYS_TARGET_C_OBJECT} OBJECT ${KWSYS_C_SRCS}) - IF(KWSYS_BUILD_SHARED) + IF(KWSYS_BUILD_SHARED OR KWSYS_BUILD_PIC) SET_PROPERTY(TARGET ${KWSYS_TARGET_C_OBJECT} PROPERTY POSITION_INDEPENDENT_CODE TRUE) ENDIF() diff --git a/SystemTools.cxx b/SystemTools.cxx index c5160a9..cbdfe11 100644 --- a/SystemTools.cxx +++ b/SystemTools.cxx @@ -2161,6 +2161,32 @@ bool SystemTools::FilesDiffer(const std::string& source, return false; } +bool SystemTools::TextFilesDiffer(const std::string& path1, + const std::string& path2) +{ + kwsys::ifstream if1(path1.c_str()); + kwsys::ifstream if2(path2.c_str()); + if (!if1 || !if2) { + return true; + } + + for (;;) { + std::string line1, line2; + bool hasData1 = GetLineFromStream(if1, line1); + bool hasData2 = GetLineFromStream(if2, line2); + if (hasData1 != hasData2) { + return true; + } + if (!hasData1) { + break; + } + if (line1 != line2) { + return true; + } + } + return false; +} + /** * Blockwise copy source to destination file */ @@ -2979,10 +3005,36 @@ bool SystemTools::FileIsDirectory(const std::string& inName) bool SystemTools::FileIsSymlink(const std::string& name) { #if defined(_WIN32) - DWORD attr = - GetFileAttributesW(Encoding::ToWindowsExtendedPath(name).c_str()); + std::wstring path = Encoding::ToWindowsExtendedPath(name); + DWORD attr = GetFileAttributesW(path.c_str()); if (attr != INVALID_FILE_ATTRIBUTES) { - return (attr & FILE_ATTRIBUTE_REPARSE_POINT) != 0; + if ((attr & FILE_ATTRIBUTE_REPARSE_POINT) != 0) { + // FILE_ATTRIBUTE_REPARSE_POINT means: + // * a file or directory that has an associated reparse point, or + // * a file that is a symbolic link. + HANDLE hFile = CreateFileW( + path.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, + FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS, NULL); + if (hFile == INVALID_HANDLE_VALUE) { + return false; + } + byte buffer[MAXIMUM_REPARSE_DATA_BUFFER_SIZE]; + DWORD bytesReturned = 0; + if (!DeviceIoControl(hFile, FSCTL_GET_REPARSE_POINT, NULL, 0, buffer, + MAXIMUM_REPARSE_DATA_BUFFER_SIZE, &bytesReturned, + NULL)) { + CloseHandle(hFile); + // Since FILE_ATTRIBUTE_REPARSE_POINT is set this file must be + // a symbolic link if it is not a reparse point. + return GetLastError() == ERROR_NOT_A_REPARSE_POINT; + } + CloseHandle(hFile); + ULONG reparseTag = + reinterpret_cast(&buffer[0])->ReparseTag; + return (reparseTag == IO_REPARSE_TAG_SYMLINK) || + (reparseTag == IO_REPARSE_TAG_MOUNT_POINT); + } + return false; } else { return false; } diff --git a/SystemTools.hxx.in b/SystemTools.hxx.in index 8d1f78c..1967860 100644 --- a/SystemTools.hxx.in +++ b/SystemTools.hxx.in @@ -579,6 +579,13 @@ public: const std::string& destination); /** + * Compare the contents of two files, ignoring line ending differences. + * Return true if different + */ + static bool TextFilesDiffer(const std::string& path1, + const std::string& path2); + + /** * Return true if the two files are the same file */ static bool SameFile(const std::string& file1, const std::string& file2); diff --git a/testSystemTools.cxx b/testSystemTools.cxx index 0477d59..9a40b53 100644 --- a/testSystemTools.cxx +++ b/testSystemTools.cxx @@ -984,6 +984,50 @@ static bool CheckGetLineFromStreamLongLine() return true; } +static bool writeFile(const char* fileName, const char* data) +{ + kwsys::ofstream out(fileName, std::ios::binary); + out << data; + if (!out) { + std::cerr << "Failed to write file: " << fileName << std::endl; + return false; + } + return true; +} + +static bool CheckTextFilesDiffer() +{ + struct + { + const char* a; + const char* b; + bool differ; + } test_cases[] = { { "one", "one", false }, + { "one", "two", true }, + { "", "", false }, + { "\n", "\r\n", false }, + { "one\n", "one\n", false }, + { "one\r\n", "one\n", false }, + { "one\n", "one", false }, + { "one\ntwo", "one\ntwo", false }, + { "one\ntwo", "one\r\ntwo", false } }; + const int num_test_cases = sizeof(test_cases) / sizeof(test_cases[0]); + for (int i = 0; i < num_test_cases; ++i) { + if (!writeFile("file_a", test_cases[i].a) || + !writeFile("file_b", test_cases[i].b)) { + return false; + } + if (kwsys::SystemTools::TextFilesDiffer("file_a", "file_b") != + test_cases[i].differ) { + std::cerr << "Incorrect TextFilesDiffer result for test case " << i + 1 + << "." << std::endl; + return false; + } + } + + return true; +} + int testSystemTools(int, char* []) { bool res = true; @@ -1027,5 +1071,7 @@ int testSystemTools(int, char* []) res &= CheckGetFilenameName(); + res &= CheckTextFilesDiffer(); + return res ? 0 : 1; } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=99337d345ba9d3379135c90854be23403fa8e274 commit 99337d345ba9d3379135c90854be23403fa8e274 Author: Vitaly Stakhovsky AuthorDate: Wed Jan 23 10:12:17 2019 -0500 Commit: Vitaly Stakhovsky CommitDate: Wed Jan 23 10:19:30 2019 -0500 cmSystemTools::Error(): new overload accepting std::string diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index 8ed43f9..811af56 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -720,7 +720,7 @@ void CCONV cmSourceFileSetName(void* arg, const char* name, const char* dir, ext != headerExts.end(); ++ext) { e << " ." << *ext; } - cmSystemTools::Error(e.str().c_str()); + cmSystemTools::Error(e.str()); } void CCONV cmSourceFileSetName2(void* arg, const char* name, const char* dir, diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 4e2f275..989c7ee 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -2173,7 +2173,7 @@ int cmCTest::Run(std::vector& args, std::string* output) // handle the simple commandline arguments std::string errormsg; if (!this->HandleCommandLineArguments(i, args, errormsg)) { - cmSystemTools::Error(errormsg.c_str()); + cmSystemTools::Error(errormsg); return 1; } diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index e1d312b..a133914 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -123,7 +123,7 @@ bool cmCacheManager::LoadCache(const std::string& path, bool internal, std::ostringstream error; error << "Parse error in cache file " << cacheFile; error << " on line " << lineno << ". Offending entry: " << realbuffer; - cmSystemTools::Error(error.str().c_str()); + cmSystemTools::Error(error.str()); } } this->CacheMajorVersion = 0; @@ -171,7 +171,7 @@ bool cmCacheManager::LoadCache(const std::string& path, bool internal, << " where CMakeCache.txt was created. This may result " "in binaries being created in the wrong place. If you " "are not sure, reedit the CMakeCache.txt"; - cmSystemTools::Error(message.str().c_str()); + cmSystemTools::Error(message.str()); } } return true; diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 87bc150..c68bb21 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -1237,7 +1237,7 @@ void cmComputeLinkInformation::AddFrameworkItem(std::string const& item) std::ostringstream e; e << "Could not parse framework path \"" << item << "\" " << "linked by target " << this->Target->GetName() << "."; - cmSystemTools::Error(e.str().c_str()); + cmSystemTools::Error(e.str()); return; } diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index fde9750..1d20cff 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -495,7 +495,7 @@ void cmComputeTargetDepends::ComplainAboutBadComponent( e << "At least one of these targets is not a STATIC_LIBRARY. " << "Cyclic dependencies are allowed only among static libraries."; } - cmSystemTools::Error(e.str().c_str()); + cmSystemTools::Error(e.str()); } bool cmComputeTargetDepends::IntraComponent(std::vector const& cmap, diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index c6b66a3..c8f743a 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -83,7 +83,7 @@ bool cmExportFileGenerator::GenerateImportFile() std::string se = cmSystemTools::GetLastSystemError(); std::ostringstream e; e << "cannot write to file \"" << this->MainImportFile << "\": " << se; - cmSystemTools::Error(e.str().c_str()); + cmSystemTools::Error(e.str()); return false; } std::ostream& os = *foutPtr; diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index 3821144..f8bc0ab 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -54,7 +54,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) << "\" ...) " << "includes target \"" << te->Target->GetName() << "\" more than once in the export set."; - cmSystemTools::Error(e.str().c_str()); + cmSystemTools::Error(e.str()); return false; } } @@ -112,7 +112,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) std::string errorMessage; if (!this->PopulateExportProperties(gt, properties, errorMessage)) { - cmSystemTools::Error(errorMessage.c_str()); + cmSystemTools::Error(errorMessage); return false; } @@ -294,7 +294,7 @@ bool cmExportInstallFileGenerator::GenerateImportFileConfig( std::string se = cmSystemTools::GetLastSystemError(); std::ostringstream e; e << "cannot write to file \"" << fileName << "\": " << se; - cmSystemTools::Error(e.str().c_str()); + cmSystemTools::Error(e.str()); return false; } std::ostream& os = exportFileStream; @@ -518,7 +518,7 @@ void cmExportInstallFileGenerator::ComplainAboutMissingTarget( e << "that is not in this export set, but " << occurrences << " times in others."; } - cmSystemTools::Error(e.str().c_str()); + cmSystemTools::Error(e.str()); } std::string cmExportInstallFileGenerator::InstallNameDir( diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 0e3ace3..e028d8d 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -203,7 +203,7 @@ std::string cmGeneratorTarget::GetExportName() const std::ostringstream e; e << "EXPORT_NAME property \"" << exportName << "\" for \"" << this->GetName() << "\": is not valid."; - cmSystemTools::Error(e.str().c_str()); + cmSystemTools::Error(e.str()); return ""; } return exportName; @@ -4587,7 +4587,7 @@ PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt, << " property requirement\nof " "dependency \"" << theTarget->GetName() << "\".\n"; - cmSystemTools::Error(e.str().c_str()); + cmSystemTools::Error(e.str()); break; } propContent = consistent.second; @@ -4612,7 +4612,7 @@ PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt, "already. The INTERFACE_" << p << " property on\ndependency \"" << theTarget->GetName() << "\" is in conflict.\n"; - cmSystemTools::Error(e.str().c_str()); + cmSystemTools::Error(e.str()); break; } propContent = consistent.second; @@ -4632,7 +4632,7 @@ PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt, e << "The INTERFACE_" << p << " property of \"" << theTarget->GetName() << "\" does\nnot agree with the value of " << p << " already determined\nfor \"" << tgt->GetName() << "\".\n"; - cmSystemTools::Error(e.str().c_str()); + cmSystemTools::Error(e.str()); break; } propContent = consistent.second; diff --git a/Source/cmGlobVerificationManager.cxx b/Source/cmGlobVerificationManager.cxx index e8959f2..478f725 100644 --- a/Source/cmGlobVerificationManager.cxx +++ b/Source/cmGlobVerificationManager.cxx @@ -165,7 +165,7 @@ void cmGlobVerificationManager::AddCacheEntry( message << "\n " << std::get<0>(bt); std::get<1>(bt).PrintTitle(message); } - cmSystemTools::Error(message.str().c_str()); + cmSystemTools::Error(message.str()); } else { value.Backtraces.emplace_back(variable, backtrace); } diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index b2b0e38..ca96ebc 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -364,7 +364,7 @@ bool cmGlobalGenerator::FindMakeProgram(cmMakefile* mf) err << "CMake was unable to find a build program corresponding to \"" << this->GetName() << "\". CMAKE_MAKE_PROGRAM is not set. You " << "probably need to select a different build tool."; - cmSystemTools::Error(err.str().c_str()); + cmSystemTools::Error(err.str()); cmSystemTools::SetFatalErrorOccured(); return false; } @@ -1282,7 +1282,7 @@ bool cmGlobalGenerator::CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const << "duplicate custom targets. " << "Consider using a Makefiles generator or fix the project to not " << "use duplicate target names."; - cmSystemTools::Error(e.str().c_str()); + cmSystemTools::Error(e.str()); return false; } diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 557efec..7963c8a 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -93,7 +93,7 @@ bool cmGlobalGhsMultiGenerator::SetGeneratorToolset(std::string const& ts, message += prevTool; message += "\nEither remove the CMakeCache.txt file and CMakeFiles " "directory or choose a different binary directory."; - cmSystemTools::Error(message.c_str()); + cmSystemTools::Error(message); return false; } else { /* store the toolset that is being used for this build */ @@ -178,7 +178,7 @@ void cmGlobalGhsMultiGenerator::GetToolset(cmMakefile* mf, std::string& tsd, if (output.empty()) { std::string msg = "No GHS toolsets found in GHS_TOOLSET_ROOT \"" + tsd + "\"."; - cmSystemTools::Error(msg.c_str()); + cmSystemTools::Error(msg); tsd = ""; } else { tsd += output.back(); @@ -189,7 +189,7 @@ void cmGlobalGhsMultiGenerator::GetToolset(cmMakefile* mf, std::string& tsd, tryPath = cmSystemTools::CollapseCombinedPath(tsd, ts); if (!cmSystemTools::FileExists(tryPath)) { std::string msg = "GHS toolset \"" + tryPath + "\" not found."; - cmSystemTools::Error(msg.c_str()); + cmSystemTools::Error(msg); tsd = ""; } else { tsd = tryPath; diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index 16796cf..8e67fad 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -149,7 +149,7 @@ void cmGlobalVisualStudio71Generator::WriteProjectDepends( m += target->GetName(); m += " depends on unknown target: "; m += name; - cmSystemTools::Error(m.c_str()); + cmSystemTools::Error(m); } fout << "\t\t{" << guid << "} = {" << guid << "}\n"; } diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx index 4cc081c..98a895e 100644 --- a/Source/cmInstallExportGenerator.cxx +++ b/Source/cmInstallExportGenerator.cxx @@ -127,7 +127,7 @@ void cmInstallExportGenerator::GenerateScript(std::ostream& os) std::ostringstream e; e << "INSTALL(EXPORT) given unknown export \"" << ExportSet->GetName() << "\""; - cmSystemTools::Error(e.str().c_str()); + cmSystemTools::Error(e.str()); return; } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 3771737..62aff99 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1794,7 +1794,7 @@ static void AddVisibilityCompileOption(std::string& flags, std::ostringstream e; e << "Target " << target->GetName() << " uses unsupported value \"" << prop << "\" for " << flagDefine << "."; - cmSystemTools::Error(e.str().c_str()); + cmSystemTools::Error(e.str()); return; } std::string option = std::string(opt) + prop; @@ -2800,7 +2800,7 @@ void cmLocalGenerator::GenerateAppleInfoPList(cmGeneratorTarget* target, std::ostringstream e; e << "Target " << target->GetName() << " Info.plist template \"" << inFile << "\" could not be found."; - cmSystemTools::Error(e.str().c_str()); + cmSystemTools::Error(e.str()); return; } @@ -2838,7 +2838,7 @@ void cmLocalGenerator::GenerateFrameworkInfoPList( std::ostringstream e; e << "Target " << target->GetName() << " Info.plist template \"" << inFile << "\" could not be found."; - cmSystemTools::Error(e.str().c_str()); + cmSystemTools::Error(e.str()); return; } diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx index ab1e699..ff1e027 100644 --- a/Source/cmOutputRequiredFilesCommand.cxx +++ b/Source/cmOutputRequiredFilesCommand.cxx @@ -194,7 +194,7 @@ protected: message += includeFile; message += " for file "; message += info->FullPath; - cmSystemTools::Error(message.c_str(), nullptr); + cmSystemTools::Error(message); } continue; } diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index 47f7d73..d37e5f5 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -111,7 +111,7 @@ static bool AddToSourceGroup(cmMakefile* makefile, std::string const& fileName, ost << ": " << property; ost << ": Could not find or create the source group "; ost << cmQtAutoGen::Quoted(groupName); - cmSystemTools::Error(ost.str().c_str()); + cmSystemTools::Error(ost.str()); return false; } } @@ -941,7 +941,7 @@ bool cmQtAutoGenInitializer::InitScanFiles() if (!qrc.Generated) { std::string error; if (!RccListInputs(qrc.QrcFile, qrc.Resources, error)) { - cmSystemTools::Error(error.c_str()); + cmSystemTools::Error(error); return false; } } @@ -1219,7 +1219,7 @@ bool cmQtAutoGenInitializer::SetupCustomTargets() if (!cmSystemTools::MakeDirectory(this->Dir.Info)) { std::string emsg = ("AutoGen: Could not create directory: "); emsg += Quoted(this->Dir.Info); - cmSystemTools::Error(emsg.c_str()); + cmSystemTools::Error(emsg); return false; } @@ -1307,7 +1307,7 @@ bool cmQtAutoGenInitializer::SetupWriteAutogenInfo() } else { std::string err = "AutoGen: Could not write file "; err += this->AutogenTarget.InfoFile; - cmSystemTools::Error(err.c_str()); + cmSystemTools::Error(err); return false; } @@ -1347,7 +1347,7 @@ bool cmQtAutoGenInitializer::SetupWriteRccInfo() } else { std::string err = "AutoRcc: Could not write file "; err += qrc.InfoFile; - cmSystemTools::Error(err.c_str()); + cmSystemTools::Error(err); return false; } } @@ -1512,7 +1512,7 @@ std::pair GetQtExecutable( msg += target->GetName(); msg += "): "; msg += err; - cmSystemTools::Error(msg.c_str()); + cmSystemTools::Error(msg); return std::make_pair(false, ""); } diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 9abc5f3..2d98a7d 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -270,6 +270,13 @@ void cmSystemTools::Error(const char* m1, const char* m2, const char* m3, cmSystemTools::Message(message.c_str(), "Error"); } +void cmSystemTools::Error(const std::string& m) +{ + std::string message = "CMake Error: " + m; + cmSystemTools::s_ErrorOccured = true; + cmSystemTools::Message(message.c_str(), "Error"); +} + void cmSystemTools::SetInterruptCallback(InterruptCallback f, void* clientData) { s_InterruptCallback = f; @@ -338,7 +345,7 @@ void cmSystemTools::ReportLastSystemError(const char* msg) std::string m = msg; m += ": System Error: "; m += Superclass::GetLastSystemError(); - cmSystemTools::Error(m.c_str()); + cmSystemTools::Error(m); } bool cmSystemTools::IsInternallyOn(const char* val) @@ -549,7 +556,7 @@ std::vector cmSystemTools::HandleResponseFile( error += cmSystemTools::GetLastSystemError(); error += "):\n "; error += arg.substr(1); - cmSystemTools::Error(error.c_str()); + cmSystemTools::Error(error); } else { std::string line; cmSystemTools::GetLineFromStream(responseFile, line); @@ -1651,7 +1658,7 @@ bool cmSystemTools::CreateTar(const char* outFileName, e += outFileName; e += "\": "; e += cmSystemTools::GetLastSystemError(); - cmSystemTools::Error(e.c_str()); + cmSystemTools::Error(e); return false; } cmArchiveWrite::Compress compress = cmArchiveWrite::CompressNone; @@ -1684,7 +1691,7 @@ bool cmSystemTools::CreateTar(const char* outFileName, } } if (!a) { - cmSystemTools::Error(a.GetError().c_str()); + cmSystemTools::Error(a.GetError()); return false; } return true; @@ -3120,7 +3127,7 @@ bool cmSystemTools::CreateSymlink(const std::string& origName, if (errorMessage) { *errorMessage = std::move(e); } else { - cmSystemTools::Error(e.c_str()); + cmSystemTools::Error(e); } return false; } @@ -3141,7 +3148,7 @@ bool cmSystemTools::CreateLink(const std::string& origName, if (errorMessage) { *errorMessage = std::move(e); } else { - cmSystemTools::Error(e.c_str()); + cmSystemTools::Error(e); } return false; } diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 7a209c6..9d872d1 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -70,6 +70,7 @@ public: */ static void Error(const char* m, const char* m2 = nullptr, const char* m3 = nullptr, const char* m4 = nullptr); + static void Error(const std::string& m); /** * Display a message. diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx index 10a6d9a..0a657f7 100644 --- a/Source/cmTryRunCommand.cxx +++ b/Source/cmTryRunCommand.cxx @@ -121,7 +121,7 @@ bool cmTryRunCommand::InitialPass(std::vector const& argv, // now try running the command if it compiled if (!res) { if (this->OutputFile.empty()) { - cmSystemTools::Error(this->FindErrorMessage.c_str()); + cmSystemTools::Error(this->FindErrorMessage); } else { // "run" it and capture the output std::string runOutputContents; @@ -354,7 +354,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs, errorMessage += " " + internalRunOutputName + " (advanced)\n"; } errorMessage += detailsString; - cmSystemTools::Error(errorMessage.c_str()); + cmSystemTools::Error(errorMessage); return; } diff --git a/Source/cmVariableRequiresCommand.cxx b/Source/cmVariableRequiresCommand.cxx index 06ca53c..c02157a 100644 --- a/Source/cmVariableRequiresCommand.cxx +++ b/Source/cmVariableRequiresCommand.cxx @@ -57,7 +57,7 @@ bool cmVariableRequiresCommand::InitialPass( "One or more of the required variables is advanced." " To set the variable, you must turn on advanced mode in cmake."; } - cmSystemTools::Error(message.c_str()); + cmSystemTools::Error(message); } return true; diff --git a/Source/cmVariableWatchCommand.cxx b/Source/cmVariableWatchCommand.cxx index 03e0059..975d6e4 100644 --- a/Source/cmVariableWatchCommand.cxx +++ b/Source/cmVariableWatchCommand.cxx @@ -60,7 +60,7 @@ static void cmVariableWatchCommandVariableAccessed(const std::string& variable, error << "Error in cmake code at\nUnknown:0:\n" << "A command failed during the invocation of callback \"" << data->Command << "\"."; - cmSystemTools::Error(error.str().c_str()); + cmSystemTools::Error(error.str()); data->InCallback = false; return; } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 914c3b0..1261fff 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1172,7 +1172,7 @@ int cmake::DoPreConfigureChecks() } err << "Specify --help for usage, or press the help button on the CMake " "GUI."; - cmSystemTools::Error(err.str().c_str()); + cmSystemTools::Error(err.str()); return -2; } @@ -1190,7 +1190,7 @@ int cmake::DoPreConfigureChecks() message += cacheStart; message += "\" used to generate cache. "; message += "Re-run cmake with a different source directory."; - cmSystemTools::Error(message.c_str()); + cmSystemTools::Error(message); return -2; } } else { @@ -1400,7 +1400,7 @@ int cmake::ActualConfigure() message += *genName; message += "\nEither remove the CMakeCache.txt file and CMakeFiles " "directory or choose a different binary directory."; - cmSystemTools::Error(message.c_str()); + cmSystemTools::Error(message); return -2; } } @@ -1424,7 +1424,7 @@ int cmake::ActualConfigure() message += *instance; message += "\nEither remove the CMakeCache.txt file and CMakeFiles " "directory or choose a different binary directory."; - cmSystemTools::Error(message.c_str()); + cmSystemTools::Error(message); return -2; } } else { @@ -1443,7 +1443,7 @@ int cmake::ActualConfigure() message += *platformName; message += "\nEither remove the CMakeCache.txt file and CMakeFiles " "directory or choose a different binary directory."; - cmSystemTools::Error(message.c_str()); + cmSystemTools::Error(message); return -2; } } else { @@ -1461,7 +1461,7 @@ int cmake::ActualConfigure() message += *tsName; message += "\nEither remove the CMakeCache.txt file and CMakeFiles " "directory or choose a different binary directory."; - cmSystemTools::Error(message.c_str()); + cmSystemTools::Error(message); return -2; } } else { diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 26f7509..e9cdb71 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -123,7 +123,7 @@ void CMakeCommandUsage(const char* program) ; /* clang-format on */ - cmSystemTools::Error(errorStream.str().c_str()); + cmSystemTools::Error(errorStream.str()); } static bool cmTarFilesFrom(std::string const& file, @@ -132,14 +132,14 @@ static bool cmTarFilesFrom(std::string const& file, if (cmSystemTools::FileIsDirectory(file)) { std::ostringstream e; e << "-E tar --files-from= file '" << file << "' is a directory"; - cmSystemTools::Error(e.str().c_str()); + cmSystemTools::Error(e.str()); return false; } cmsys::ifstream fin(file.c_str()); if (!fin) { std::ostringstream e; e << "-E tar --files-from= file '" << file << "' not found"; - cmSystemTools::Error(e.str().c_str()); + cmSystemTools::Error(e.str()); return false; } std::string line; @@ -153,7 +153,7 @@ static bool cmTarFilesFrom(std::string const& file, std::ostringstream e; e << "-E tar --files-from='" << file << "' file invalid line:\n" << line << "\n"; - cmSystemTools::Error(e.str().c_str()); + cmSystemTools::Error(e.str()); return false; } else { files.push_back(line); @@ -1173,7 +1173,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) if (server.Serve(&errorMessage)) { return 0; } - cmSystemTools::Error(errorMessage.c_str()); + cmSystemTools::Error(errorMessage); #else static_cast(supportExperimental); static_cast(isDebug); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9e5c13738bdc45b00b529b492bad92800890fb9c commit 9e5c13738bdc45b00b529b492bad92800890fb9c Author: Vitaly Stakhovsky AuthorDate: Tue Jan 22 20:37:59 2019 -0500 Commit: Vitaly Stakhovsky CommitDate: Tue Jan 22 20:37:59 2019 -0500 cmSystemTools::RenameFile: Accepts std::string args diff --git a/Source/CPack/IFW/cmCPackIFWRepository.cxx b/Source/CPack/IFW/cmCPackIFWRepository.cxx index 987cad8..8042167 100644 --- a/Source/CPack/IFW/cmCPackIFWRepository.cxx +++ b/Source/CPack/IFW/cmCPackIFWRepository.cxx @@ -200,7 +200,7 @@ bool cmCPackIFWRepository::PatchUpdatesXml() fout.Close(); - return cmSystemTools::RenameFile(updatesPatchXml.data(), updatesXml.data()); + return cmSystemTools::RenameFile(updatesPatchXml, updatesXml); } void cmCPackIFWRepository::WriteRepositoryConfig(cmXMLWriter& xout) diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index 320647a..d3aa2b4 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -538,7 +538,7 @@ void cmCTestMultiProcessHandler::UpdateCostData() fout << f << "\n"; } fout.close(); - cmSystemTools::RenameFile(tmpout.c_str(), fname.c_str()); + cmSystemTools::RenameFile(tmpout, fname); } void cmCTestMultiProcessHandler::ReadCostData() diff --git a/Source/cmFileAPI.cxx b/Source/cmFileAPI.cxx index 89bd258..34b6b33 100644 --- a/Source/cmFileAPI.cxx +++ b/Source/cmFileAPI.cxx @@ -169,7 +169,7 @@ std::string cmFileAPI::WriteJsonFile( // If the final name already exists then assume it has proper content. // Otherwise, atomically place the reply file at its final name if (cmSystemTools::FileExists(file, true) || - !cmSystemTools::RenameFile(tmpFile.c_str(), file.c_str())) { + !cmSystemTools::RenameFile(tmpFile, file)) { cmSystemTools::RemoveFile(tmpFile); } diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 999af54..c9ae38c 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -2461,7 +2461,7 @@ bool cmFileCommand::HandleRename(std::vector const& args) newname += "/" + args[2]; } - if (!cmSystemTools::RenameFile(oldname.c_str(), newname.c_str())) { + if (!cmSystemTools::RenameFile(oldname, newname)) { std::string err = cmSystemTools::GetLastSystemError(); std::ostringstream e; /* clang-format off */ diff --git a/Source/cmGeneratedFileStream.cxx b/Source/cmGeneratedFileStream.cxx index bf53dbf..eef5dc0 100644 --- a/Source/cmGeneratedFileStream.cxx +++ b/Source/cmGeneratedFileStream.cxx @@ -210,7 +210,7 @@ int cmGeneratedFileStreamBase::CompressFile(std::string const&, int cmGeneratedFileStreamBase::RenameFile(std::string const& oldname, std::string const& newname) { - return cmSystemTools::RenameFile(oldname.c_str(), newname.c_str()); + return cmSystemTools::RenameFile(oldname, newname); } void cmGeneratedFileStream::SetName(const std::string& fname) diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 9abc5f3..7126944 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -1028,7 +1028,8 @@ void cmSystemTools::InitializeLibUV() #endif } -bool cmSystemTools::RenameFile(const char* oldname, const char* newname) +bool cmSystemTools::RenameFile(const std::string& oldname, + const std::string& newname) { #ifdef _WIN32 # ifndef INVALID_FILE_ATTRIBUTES @@ -1066,7 +1067,7 @@ bool cmSystemTools::RenameFile(const char* oldname, const char* newname) return retry.Count > 0; #else /* On UNIX we have an OS-provided call to do this atomically. */ - return rename(oldname, newname) == 0; + return rename(oldname.c_str(), newname.c_str()) == 0; #endif } diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 7a209c6..4ae83d6 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -179,7 +179,8 @@ public: /** Rename a file or directory within a single disk volume (atomic if possible). */ - static bool RenameFile(const char* oldname, const char* newname); + static bool RenameFile(const std::string& oldname, + const std::string& newname); ///! Compute the hash of a file static std::string ComputeFileHash(const std::string& source, diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 065f6df..e792771 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -115,8 +115,10 @@ typedef std::unordered_map JsonValueMapType; } // namespace -static bool cmakeCheckStampFile(const char* stampName, bool verbose = true); -static bool cmakeCheckStampList(const char* stampList, bool verbose = true); +static bool cmakeCheckStampFile(const std::string& stampName, + bool verbose = true); +static bool cmakeCheckStampList(const std::string& stampList, + bool verbose = true); void cmWarnUnusedCliWarning(const std::string& variable, int /*unused*/, void* ctx, const char* /*unused*/, @@ -1626,13 +1628,13 @@ int cmake::Run(const std::vector& args, bool noconfigure) // If we are given a stamp list file check if it is really out of date. if (!this->CheckStampList.empty() && - cmakeCheckStampList(this->CheckStampList.c_str())) { + cmakeCheckStampList(this->CheckStampList)) { return 0; } // If we are given a stamp file check if it is really out of date. if (!this->CheckStampFile.empty() && - cmakeCheckStampFile(this->CheckStampFile.c_str())) { + cmakeCheckStampFile(this->CheckStampFile)) { return 0; } @@ -2413,7 +2415,7 @@ int cmake::GetSystemInformation(std::vector& args) return 0; } -static bool cmakeCheckStampFile(const char* stampName, bool verbose) +static bool cmakeCheckStampFile(const std::string& stampName, bool verbose) { // The stamp file does not exist. Use the stamp dependencies to // determine whether it is really out of date. This works in @@ -2458,12 +2460,11 @@ static bool cmakeCheckStampFile(const char* stampName, bool verbose) // by the VS IDE due to a "rebuild" request. Restore it atomically. std::ostringstream stampTempStream; stampTempStream << stampName << ".tmp" << cmSystemTools::RandomSeed(); - std::string stampTempString = stampTempStream.str(); - const char* stampTemp = stampTempString.c_str(); + std::string stampTemp = stampTempStream.str(); { // TODO: Teach cmGeneratedFileStream to use a random temp file (with // multiple tries in unlikely case of conflict) and use that here. - cmsys::ofstream stamp(stampTemp); + cmsys::ofstream stamp(stampTemp.c_str()); stamp << "# CMake generation timestamp file for this directory.\n"; } if (cmSystemTools::RenameFile(stampTemp, stampName)) { @@ -2477,11 +2478,11 @@ static bool cmakeCheckStampFile(const char* stampName, bool verbose) return true; } cmSystemTools::RemoveFile(stampTemp); - cmSystemTools::Error("Cannot restore timestamp ", stampName); + cmSystemTools::Error("Cannot restore timestamp ", stampName.c_str()); return false; } -static bool cmakeCheckStampList(const char* stampList, bool verbose) +static bool cmakeCheckStampList(const std::string& stampList, bool verbose) { // If the stamp list does not exist CMake must rerun to generate it. if (!cmSystemTools::FileExists(stampList)) { @@ -2489,7 +2490,7 @@ static bool cmakeCheckStampList(const char* stampList, bool verbose) << "is missing.\n"; return false; } - cmsys::ifstream fin(stampList); + cmsys::ifstream fin(stampList.c_str()); if (!fin) { std::cout << "CMake is re-running because generate.stamp.list " << "could not be read.\n"; @@ -2499,7 +2500,7 @@ static bool cmakeCheckStampList(const char* stampList, bool verbose) // Check each stamp. std::string stampName; while (cmSystemTools::GetLineFromStream(fin, stampName)) { - if (!cmakeCheckStampFile(stampName.c_str(), verbose)) { + if (!cmakeCheckStampFile(stampName, verbose)) { return false; } } @@ -2620,7 +2621,7 @@ int cmake::Build(int jobs, const std::string& dir, const std::string& target, } } - if (!cmakeCheckStampList(stampList.c_str(), false)) { + if (!cmakeCheckStampList(stampList, false)) { // Correctly initialize the home (=source) and home output (=binary) // directories, which is required for running the generation step. std::string homeOrig = this->GetHomeDirectory(); diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 26f7509..6a514f5 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -530,7 +530,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) // Rename a file or directory if (args[1] == "rename" && args.size() == 4) { - if (!cmSystemTools::RenameFile(args[2].c_str(), args[3].c_str())) { + if (!cmSystemTools::RenameFile(args[2], args[3])) { std::string e = cmSystemTools::GetLastSystemError(); std::cerr << "Error renaming from \"" << args[2] << "\" to \"" << args[3] << "\": " << e << "\n"; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=614876c638f7a428ff2f47104e2427bdbb64958d commit 614876c638f7a428ff2f47104e2427bdbb64958d Author: Vitaly Stakhovsky AuthorDate: Tue Jan 22 10:39:08 2019 -0500 Commit: Vitaly Stakhovsky CommitDate: Tue Jan 22 11:11:13 2019 -0500 cmLocalUnixMakefileGenerator3: more methods accept std::string diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 52bb046..b481979 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -574,7 +574,7 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules( commands.clear(); std::string tmp = cmake::GetCMakeFilesDirectoryPostSlash(); tmp += "Makefile2"; - commands.push_back(lg->GetRecursiveMakeCall(tmp.c_str(), name)); + commands.push_back(lg->GetRecursiveMakeCall(tmp, name)); depends.clear(); if (regenerate) { depends.emplace_back("cmake_check_build_system"); @@ -594,7 +594,7 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules( localName = name; localName += "/fast"; commands.push_back( - lg->GetRecursiveMakeCall(makefileName.c_str(), makeTargetName)); + lg->GetRecursiveMakeCall(makefileName, makeTargetName)); lg->WriteMakeRule(ruleFileStream, "fast build rule for target.", localName, depends, commands, true); @@ -608,7 +608,7 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules( depends.clear(); commands.clear(); commands.push_back( - lg->GetRecursiveMakeCall(makefileName.c_str(), makeTargetName)); + lg->GetRecursiveMakeCall(makefileName, makeTargetName)); lg->WriteMakeRule(ruleFileStream, "Manual pre-install relink rule for target.", localName, depends, commands, true); @@ -659,12 +659,12 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2( makeTargetName = localName; makeTargetName += "/depend"; commands.push_back( - lg->GetRecursiveMakeCall(makefileName.c_str(), makeTargetName)); + lg->GetRecursiveMakeCall(makefileName, makeTargetName)); makeTargetName = localName; makeTargetName += "/build"; commands.push_back( - lg->GetRecursiveMakeCall(makefileName.c_str(), makeTargetName)); + lg->GetRecursiveMakeCall(makefileName, makeTargetName)); // Write the rule. localName += "/all"; @@ -728,7 +728,7 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2( } std::string tmp = cmake::GetCMakeFilesDirectoryPostSlash(); tmp += "Makefile2"; - commands.push_back(lg->GetRecursiveMakeCall(tmp.c_str(), localName)); + commands.push_back(lg->GetRecursiveMakeCall(tmp, localName)); { std::ostringstream progCmd; progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # 0 @@ -761,8 +761,7 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2( localName += "/preinstall"; depends.clear(); commands.clear(); - commands.push_back( - lg->GetRecursiveMakeCall(makefileName.c_str(), localName)); + commands.push_back(lg->GetRecursiveMakeCall(makefileName, localName)); lg->WriteMakeRule(ruleFileStream, "Pre-install relink rule for target.", localName, depends, commands, true); @@ -783,7 +782,7 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2( depends.clear(); commands.clear(); commands.push_back( - lg->GetRecursiveMakeCall(makefileName.c_str(), makeTargetName)); + lg->GetRecursiveMakeCall(makefileName, makeTargetName)); lg->WriteMakeRule(ruleFileStream, "clean rule for target.", makeTargetName, depends, commands, true); commands.clear(); diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index dc54314..ebc613b 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -233,8 +233,8 @@ public: virtual void ClearDependencies(cmMakefile* /* mf */, bool /* verbose */) {} /** Called from command-line hook to update dependencies. */ - virtual bool UpdateDependencies(const char* /* tgtInfo */, bool /*verbose*/, - bool /*color*/) + virtual bool UpdateDependencies(const std::string& /* tgtInfo */, + bool /*verbose*/, bool /*color*/) { return true; } diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 5b9d108..60c00b5 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -248,8 +248,8 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile() for (auto& localObjectFile : localObjectFiles) { // Add a convenience rule for building the object file. this->WriteObjectConvenienceRule( - ruleFileStream, "target to build an object file", - localObjectFile.first.c_str(), localObjectFile.second); + ruleFileStream, "target to build an object file", localObjectFile.first, + localObjectFile.second); // Check whether preprocessing and assembly rules make sense. // They make sense only for C and C++ sources. @@ -271,9 +271,9 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile() if (lang_has_preprocessor && do_preprocess_rules) { std::string::size_type dot_pos = localObjectFile.first.rfind("."); std::string base = localObjectFile.first.substr(0, dot_pos); - this->WriteObjectConvenienceRule( - ruleFileStream, "target to preprocess a source file", - (base + ".i").c_str(), localObjectFile.second); + this->WriteObjectConvenienceRule(ruleFileStream, + "target to preprocess a source file", + (base + ".i"), localObjectFile.second); localObjectFile.second.HasPreprocessRule = true; } @@ -282,7 +282,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile() std::string base = localObjectFile.first.substr(0, dot_pos); this->WriteObjectConvenienceRule( ruleFileStream, "target to generate assembly for a file", - (base + ".s").c_str(), localObjectFile.second); + (base + ".s"), localObjectFile.second); localObjectFile.second.HasAssembleRule = true; } } @@ -298,7 +298,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile() } void cmLocalUnixMakefileGenerator3::WriteObjectConvenienceRule( - std::ostream& ruleFileStream, const char* comment, const char* output, + std::ostream& ruleFileStream, const char* comment, const std::string& output, LocalObjectInfo const& info) { // If the rule includes the source file extension then create a @@ -334,7 +334,7 @@ void cmLocalUnixMakefileGenerator3::WriteObjectConvenienceRule( targetName += "/"; targetName += output; commands.push_back( - this->GetRecursiveMakeCall(tgtMakefileName.c_str(), targetName)); + this->GetRecursiveMakeCall(tgtMakefileName, targetName)); } this->CreateCDCommand(commands, this->GetBinaryDirectory(), this->GetCurrentBinaryDirectory()); @@ -373,8 +373,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefileTargets( // Build the target for this pass. std::string makefile2 = cmake::GetCMakeFilesDirectoryPostSlash(); makefile2 += "Makefile2"; - commands.push_back( - this->GetRecursiveMakeCall(makefile2.c_str(), localName)); + commands.push_back(this->GetRecursiveMakeCall(makefile2, localName)); this->CreateCDCommand(commands, this->GetBinaryDirectory(), this->GetCurrentBinaryDirectory()); this->WriteMakeRule(ruleFileStream, "Convenience name for target.", @@ -399,7 +398,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefileTargets( depends.clear(); commands.clear(); commands.push_back( - this->GetRecursiveMakeCall(makefileName.c_str(), makeTargetName)); + this->GetRecursiveMakeCall(makefileName, makeTargetName)); this->CreateCDCommand(commands, this->GetBinaryDirectory(), this->GetCurrentBinaryDirectory()); this->WriteMakeRule(ruleFileStream, "fast build rule for target.", @@ -415,7 +414,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefileTargets( depends.clear(); commands.clear(); commands.push_back( - this->GetRecursiveMakeCall(makefile2.c_str(), makeTargetName)); + this->GetRecursiveMakeCall(makefile2, makeTargetName)); this->CreateCDCommand(commands, this->GetBinaryDirectory(), this->GetCurrentBinaryDirectory()); this->WriteMakeRule(ruleFileStream, @@ -1254,9 +1253,8 @@ std::string cmLocalUnixMakefileGenerator3::CreateMakeVariable( return ret; } -bool cmLocalUnixMakefileGenerator3::UpdateDependencies(const char* tgtInfo, - bool verbose, - bool color) +bool cmLocalUnixMakefileGenerator3::UpdateDependencies( + const std::string& tgtInfo, bool verbose, bool color) { // read in the target info file if (!this->Makefile->ReadListFile(tgtInfo) || @@ -1280,7 +1278,8 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies(const char* tgtInfo, this->GlobalGenerator->GetCMakeInstance()->GetFileComparison(); { int result; - if (!ftc->FileTimeCompare(internalDependFile.c_str(), tgtInfo, &result) || + if (!ftc->FileTimeCompare(internalDependFile.c_str(), tgtInfo.c_str(), + &result) || result < 0) { if (verbose) { std::ostringstream msg; @@ -1611,8 +1610,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules( } std::string mf2Dir = cmake::GetCMakeFilesDirectoryPostSlash(); mf2Dir += "Makefile2"; - commands.push_back( - this->GetRecursiveMakeCall(mf2Dir.c_str(), recursiveTarget)); + commands.push_back(this->GetRecursiveMakeCall(mf2Dir, recursiveTarget)); this->CreateCDCommand(commands, this->GetBinaryDirectory(), this->GetCurrentBinaryDirectory()); { @@ -1631,8 +1629,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules( recursiveTarget += "/clean"; commands.clear(); depends.clear(); - commands.push_back( - this->GetRecursiveMakeCall(mf2Dir.c_str(), recursiveTarget)); + commands.push_back(this->GetRecursiveMakeCall(mf2Dir, recursiveTarget)); this->CreateCDCommand(commands, this->GetBinaryDirectory(), this->GetCurrentBinaryDirectory()); this->WriteMakeRule(ruleFileStream, "The main clean target", "clean", @@ -1657,8 +1654,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules( // At least make sure the build system is up to date. depends.emplace_back("cmake_check_build_system"); } - commands.push_back( - this->GetRecursiveMakeCall(mf2Dir.c_str(), recursiveTarget)); + commands.push_back(this->GetRecursiveMakeCall(mf2Dir, recursiveTarget)); this->CreateCDCommand(commands, this->GetBinaryDirectory(), this->GetCurrentBinaryDirectory()); this->WriteMakeRule(ruleFileStream, "Prepare targets for installation.", @@ -1886,7 +1882,7 @@ void cmLocalUnixMakefileGenerator3::WriteDisclaimer(std::ostream& os) } std::string cmLocalUnixMakefileGenerator3::GetRecursiveMakeCall( - const char* makefile, const std::string& tgt) + const std::string& makefile, const std::string& tgt) { // Call make on the given file. std::string cmd; @@ -1956,7 +1952,7 @@ void cmLocalUnixMakefileGenerator3::WriteCMakeArgument(std::ostream& os, } std::string cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath( - const char* p, bool useWatcomQuote) + const std::string& p, bool useWatcomQuote) { // Split the path into its components. std::vector components; @@ -2040,8 +2036,8 @@ cmLocalUnixMakefileGenerator3::GetImplicitDepends(const cmGeneratorTarget* tgt) } void cmLocalUnixMakefileGenerator3::AddImplicitDepends( - const cmGeneratorTarget* tgt, const std::string& lang, const char* obj, - const char* src) + const cmGeneratorTarget* tgt, const std::string& lang, + const std::string& obj, const std::string& src) { this->ImplicitDepends[tgt->GetName()][lang][obj].push_back(src); } diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index c0d0e13..5cd7da8 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -83,7 +83,7 @@ public: void WriteDivider(std::ostream& os); /** used to create a recursive make call */ - std::string GetRecursiveMakeCall(const char* makefile, + std::string GetRecursiveMakeCall(const std::string& makefile, const std::string& tgt); // append flags to a string @@ -120,7 +120,7 @@ public: std::string const& targetDir, std::string const& relDir); - static std::string ConvertToQuotedOutputPath(const char* p, + static std::string ConvertToQuotedOutputPath(const std::string& p, bool useWatcomQuote); std::string CreateMakeVariable(const std::string& sin, @@ -128,7 +128,7 @@ public: /** Called from command-line hook to bring dependencies up to date for a target. */ - bool UpdateDependencies(const char* tgtInfo, bool verbose, + bool UpdateDependencies(const std::string& tgtInfo, bool verbose, bool color) override; /** Called from command-line hook to clear dependencies. */ @@ -158,8 +158,8 @@ public: cmGeneratorTarget const* tgt); void AddImplicitDepends(cmGeneratorTarget const* tgt, - const std::string& lang, const char* obj, - const char* src); + const std::string& lang, const std::string& obj, + const std::string& src); // write the target rules for the local Makefile into the stream void WriteLocalAllRules(std::ostream& ruleFileStream); @@ -200,9 +200,6 @@ protected: void WriteDependLanguageInfo(std::ostream& cmakefileStream, cmGeneratorTarget* tgt); - // write the local help rule - void WriteHelpRule(std::ostream& ruleFileStream); - // this converts a file name that is relative to the StartOuputDirectory // into a full path std::string ConvertToFullPath(const std::string& localPath); @@ -211,15 +208,6 @@ protected: const std::string& realTarget, const std::string& helpTarget); - void WriteTargetDependRule(std::ostream& ruleFileStream, - cmGeneratorTarget* target); - void WriteTargetCleanRule(std::ostream& ruleFileStream, - cmGeneratorTarget* target, - const std::vector& files); - void WriteTargetRequiresRule(std::ostream& ruleFileStream, - cmGeneratorTarget* target, - const std::vector& objects); - void AppendRuleDepend(std::vector& depends, const char* ruleFileName); void AppendRuleDepends(std::vector& depends, @@ -284,7 +272,8 @@ private: std::map& localObjectFiles); void WriteObjectConvenienceRule(std::ostream& ruleFileStream, - const char* comment, const char* output, + const char* comment, + const std::string& output, LocalObjectInfo const& info); std::vector LocalHelp; diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 1207646..6709b5b 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -435,8 +435,8 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles( objFullPath = cmSystemTools::CollapseFullPath(objFullPath); std::string srcFullPath = cmSystemTools::CollapseFullPath(source.GetFullPath()); - this->LocalGenerator->AddImplicitDepends( - this->GeneratorTarget, lang, objFullPath.c_str(), srcFullPath.c_str()); + this->LocalGenerator->AddImplicitDepends(this->GeneratorTarget, lang, + objFullPath, srcFullPath); } void cmMakefileTargetGenerator::WriteObjectBuildFile( @@ -1213,8 +1213,7 @@ void cmMakefileTargetGenerator::GenerateCustomRuleFile( std::string objFullPath = cmSystemTools::CollapseFullPath(outputs[0]); std::string srcFullPath = cmSystemTools::CollapseFullPath(idi.second); this->LocalGenerator->AddImplicitDepends(this->GeneratorTarget, idi.first, - objFullPath.c_str(), - srcFullPath.c_str()); + objFullPath, srcFullPath); } } @@ -1249,7 +1248,7 @@ void cmMakefileTargetGenerator::WriteObjectsVariable( *this->BuildFileStream << " " << lineContinue << "\n"; *this->BuildFileStream << cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath( - obj.c_str(), useWatcomQuote); + obj, useWatcomQuote); } *this->BuildFileStream << "\n"; @@ -1272,7 +1271,7 @@ void cmMakefileTargetGenerator::WriteObjectsVariable( *this->BuildFileStream << " " << lineContinue << "\n"; *this->BuildFileStream << cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath( - obj.c_str(), useWatcomQuote); + obj, useWatcomQuote); } *this->BuildFileStream << "\n" << "\n"; diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 26f7509..cb59034 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -964,8 +964,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) std::unique_ptr lgd(ggd->CreateLocalGenerator(&mf)); // Actually scan dependencies. - return lgd->UpdateDependencies(depInfo.c_str(), verbose, color) ? 0 - : 2; + return lgd->UpdateDependencies(depInfo, verbose, color) ? 0 : 2; } return 1; } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3e867ed4003e33ace2de6027f9bedb9aa7718b0c commit 3e867ed4003e33ace2de6027f9bedb9aa7718b0c Author: Bruno Manganelli AuthorDate: Thu Nov 22 21:05:05 2018 +0000 Commit: Bruno Manganelli CommitDate: Mon Jan 21 15:34:16 2019 +0000 cmake: inlined files dir constant and removed it from cmake.h diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index fbd1038..d594db3 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -15,7 +15,6 @@ #include "cmSystemTools.h" #include "cmWorkingDirectory.h" #include "cmXMLWriter.h" -#include "cmake.h" #include "cmsys/FStream.hxx" #include "cmsys/Glob.hxx" @@ -2227,7 +2226,7 @@ int cmCTestCoverageHandler::GetLabelId(std::string const& label) void cmCTestCoverageHandler::LoadLabels() { std::string fileList = this->CTest->GetBinaryDir(); - fileList += cmake::GetCMakeFilesDirectory(); + fileList += "/CMakeFiles"; fileList += "/TargetDirectories.txt"; cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " target directory list [" << fileList << "]\n", diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx index 6cd1c09..60a86ee 100644 --- a/Source/CTest/cmCTestLaunch.cxx +++ b/Source/CTest/cmCTestLaunch.cxx @@ -282,7 +282,7 @@ void cmCTestLaunch::LoadLabels() // Labels are listed in per-target files. std::string fname = this->OptionBuildDir; - fname += cmake::GetCMakeFilesDirectory(); + fname += "/CMakeFiles"; fname += "/"; fname += this->OptionTargetName; fname += ".dir/Labels.txt"; diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index e1d312b..c59ffa0 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -16,7 +16,6 @@ #include "cmState.h" #include "cmSystemTools.h" #include "cmVersion.h" -#include "cmake.h" cmCacheManager::cmCacheManager() { @@ -27,7 +26,7 @@ cmCacheManager::cmCacheManager() void cmCacheManager::CleanCMakeFiles(const std::string& path) { std::string glob = path; - glob += cmake::GetCMakeFilesDirectory(); + glob += "/CMakeFiles"; glob += "/*.cmake"; cmsys::Glob globIt; globIt.FindFiles(glob); @@ -360,7 +359,7 @@ bool cmCacheManager::SaveCache(const std::string& path, cmMessenger* messenger) fout << "\n"; fout.Close(); std::string checkCacheFile = path; - checkCacheFile += cmake::GetCMakeFilesDirectory(); + checkCacheFile += "/CMakeFiles"; cmSystemTools::MakeDirectory(checkCacheFile); checkCacheFile += "/cmake.check_cache"; cmsys::ofstream checkCache(checkCacheFile.c_str()); @@ -384,7 +383,7 @@ bool cmCacheManager::DeleteCache(const std::string& path) cmSystemTools::RemoveFile(cacheFile); // now remove the files in the CMakeFiles directory // this cleans up language cache files - cmakeFiles += cmake::GetCMakeFilesDirectory(); + cmakeFiles += "/CMakeFiles"; if (cmSystemTools::FileIsDirectory(cmakeFiles)) { cmSystemTools::RemoveADirectory(cmakeFiles); } diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index a483fd1..248cdac 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -394,7 +394,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv, // compute the binary dir when TRY_COMPILE is called with a src file // signature if (this->SrcFileSignature) { - this->BinaryDirectory += cmake::GetCMakeFilesDirectory(); + this->BinaryDirectory += "/CMakeFiles"; this->BinaryDirectory += "/CMakeTmp"; } else { // only valid for srcfile signatures diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index db2fde8..0e6a53c 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -558,7 +558,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector const& args) if (hex_conversion_enabled) { // TODO: should work without temp file, but just on a memory buffer std::string binaryFileName = this->Makefile->GetCurrentBinaryDirectory(); - binaryFileName += cmake::GetCMakeFilesDirectory(); + binaryFileName += "/CMakeFiles"; binaryFileName += "/FileCommandStringsBinaryFile"; if (cmHexFileConverter::TryConvert(fileName.c_str(), binaryFileName.c_str())) { diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 6515dfa..406fdd9 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -6140,7 +6140,7 @@ bool cmGeneratorTarget::HasImportLibrary(std::string const& config) const std::string cmGeneratorTarget::GetSupportDirectory() const { std::string dir = this->LocalGenerator->GetCurrentBinaryDirectory(); - dir += cmake::GetCMakeFilesDirectory(); + dir += "/CMakeFiles"; dir += "/"; dir += this->GetName(); #if defined(__VMS) diff --git a/Source/cmGlobVerificationManager.cxx b/Source/cmGlobVerificationManager.cxx index e8959f2..82d8d04 100644 --- a/Source/cmGlobVerificationManager.cxx +++ b/Source/cmGlobVerificationManager.cxx @@ -9,7 +9,6 @@ #include "cmListFileCache.h" #include "cmSystemTools.h" #include "cmVersion.h" -#include "cmake.h" bool cmGlobVerificationManager::SaveVerificationScript(const std::string& path) { @@ -18,7 +17,7 @@ bool cmGlobVerificationManager::SaveVerificationScript(const std::string& path) } std::string scriptFile = path; - scriptFile += cmake::GetCMakeFilesDirectory(); + scriptFile += "/CMakeFiles"; std::string stampFile = scriptFile; cmSystemTools::MakeDirectory(scriptFile); scriptFile += "/VerifyGlobs.cmake"; diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 85c2345..44889fa 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -485,7 +485,7 @@ void cmGlobalGenerator::EnableLanguage( mf->AddDefinition("RUN_CONFIGURE", true); std::string rootBin = this->CMakeInstance->GetHomeOutputDirectory(); - rootBin += cmake::GetCMakeFilesDirectory(); + rootBin += "/CMakeFiles"; // If the configuration files path has been set, // then we are in a try compile and need to copy the enable language @@ -1214,7 +1214,7 @@ void cmGlobalGenerator::Configure() const char* logs[] = { "CMakeOutput.log", "CMakeError.log", nullptr }; for (const char** log = logs; *log; ++log) { std::string f = this->CMakeInstance->GetHomeOutputDirectory(); - f += cmake::GetCMakeFilesDirectory(); + f += "/CMakeFiles"; f += "/"; f += *log; if (cmSystemTools::FileExists(f)) { @@ -2000,7 +2000,7 @@ void cmGlobalGenerator::SetConfiguredFilesPath(cmGlobalGenerator* gen) this->ConfiguredFilesPath = gen->ConfiguredFilesPath; } else { this->ConfiguredFilesPath = gen->CMakeInstance->GetHomeOutputDirectory(); - this->ConfiguredFilesPath += cmake::GetCMakeFilesDirectory(); + this->ConfiguredFilesPath += "/CMakeFiles"; } } @@ -2618,8 +2618,7 @@ std::string cmGlobalGenerator::GenerateRuleFile( ruleFile += ".rule"; const char* dir = this->GetCMakeCFGIntDir(); if (dir && dir[0] == '$') { - cmSystemTools::ReplaceString(ruleFile, dir, - cmake::GetCMakeFilesDirectory()); + cmSystemTools::ReplaceString(ruleFile, dir, "/CMakeFiles"); } return ruleFile; } @@ -2820,7 +2819,7 @@ void cmGlobalGenerator::CheckRuleHashes() #if defined(CMAKE_BUILD_WITH_CMAKE) std::string home = this->GetCMakeInstance()->GetHomeOutputDirectory(); std::string pfile = home; - pfile += cmake::GetCMakeFilesDirectory(); + pfile += "/CMakeFiles"; pfile += "/CMakeRuleHashes.txt"; this->CheckRuleHashes(pfile, home); this->WriteRuleHashes(pfile); @@ -2899,7 +2898,7 @@ void cmGlobalGenerator::WriteSummary() { // Record all target directories in a central location. std::string fname = this->CMakeInstance->GetHomeOutputDirectory(); - fname += cmake::GetCMakeFilesDirectory(); + fname += "/CMakeFiles"; fname += "/TargetDirectories.txt"; cmGeneratedFileStream fout(fname); diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index ceee500..45cb19f 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -146,7 +146,7 @@ void cmGlobalUnixMakefileGenerator3::Generate() for (cmLocalGenerator* lg : this->LocalGenerators) { std::string markFileName = lg->GetCurrentBinaryDirectory(); markFileName += "/"; - markFileName += cmake::GetCMakeFilesDirectory(); + markFileName += "/CMakeFiles"; markFileName += "/progress.marks"; cmGeneratedFileStream markFile(markFileName); markFile << this->CountProgressMarksInAll(lg) << "\n"; @@ -196,7 +196,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainMakefile2() // see if the build system must be regenerated. std::string makefileName = this->GetCMakeInstance()->GetHomeOutputDirectory(); - makefileName += cmake::GetCMakeFilesDirectory(); + makefileName += "/CMakeFiles"; makefileName += "/Makefile2"; cmGeneratedFileStream makefileStream(makefileName, false, this->GetMakefileEncoding()); @@ -268,7 +268,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() // see if the build system must be regenerated. std::string cmakefileName = this->GetCMakeInstance()->GetHomeOutputDirectory(); - cmakefileName += cmake::GetCMakeFilesDirectory(); + cmakefileName += "/CMakeFiles"; cmakefileName += "/Makefile.cmake"; cmGeneratedFileStream cmakefileStream(cmakefileName); if (!cmakefileStream) { @@ -332,7 +332,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() // Build the path to the cache check file. std::string check = this->GetCMakeInstance()->GetHomeOutputDirectory(); - check += cmake::GetCMakeFilesDirectory(); + check += "/CMakeFiles"; check += "/cmake.check_cache"; // Set the corresponding makefile in the cmake file. @@ -363,7 +363,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() for (cmLocalGenerator* localGen : this->LocalGenerators) { lg = static_cast(localGen); tmpStr = lg->GetCurrentBinaryDirectory(); - tmpStr += cmake::GetCMakeFilesDirectory(); + tmpStr += "/CMakeFiles"; tmpStr += "/CMakeDirectoryInformation.cmake"; cmakefileStream << " \"" << lg->ConvertToRelativePath(binDir, tmpStr) << "\"\n"; @@ -572,7 +572,7 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules( // Write the rule. commands.clear(); - std::string tmp = cmake::GetCMakeFilesDirectoryPostSlash(); + std::string tmp = "CMakeFiles/"; tmp += "Makefile2"; commands.push_back(lg->GetRecursiveMakeCall(tmp.c_str(), name)); depends.clear(); @@ -672,7 +672,7 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2( cmLocalUnixMakefileGenerator3::EchoProgress progress; progress.Dir = lg->GetBinaryDirectory(); - progress.Dir += cmake::GetCMakeFilesDirectory(); + progress.Dir += "/CMakeFiles"; { std::ostringstream progressArg; const char* sep = ""; @@ -726,7 +726,7 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2( progCmd << " " << this->CountProgressMarksInTarget(gtarget, emitted); commands.push_back(progCmd.str()); } - std::string tmp = cmake::GetCMakeFilesDirectoryPostSlash(); + std::string tmp = "CMakeFiles/"; tmp += "Makefile2"; commands.push_back(lg->GetRecursiveMakeCall(tmp.c_str(), localName)); { diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 79757a8..338f258 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -687,7 +687,7 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf) wd = this->ConfiguredFilesPath; } else { wd = this->GetCMakeInstance()->GetHomeOutputDirectory(); - wd += cmake::GetCMakeFilesDirectory(); + wd += "/CMakeFiles"; } wd += "/"; wd += cmVersion::GetCMakeVersion(); @@ -986,7 +986,7 @@ std::string cmGlobalVisualStudio10Generator::GenerateRuleFile( // The VS 10 generator needs to create the .rule files on disk. // Hide them away under the CMakeFiles directory. std::string ruleDir = this->GetCMakeInstance()->GetHomeOutputDirectory(); - ruleDir += cmake::GetCMakeFilesDirectory(); + ruleDir += "/CMakeFiles"; ruleDir += "/"; ruleDir += cmSystemTools::ComputeStringMD5( cmSystemTools::GetFilenamePath(output).c_str()); diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 4d165c2..f6db018 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -117,7 +117,7 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget() // Create a list of all stamp files for this project. std::vector stamps; - std::string stampList = cmake::GetCMakeFilesDirectoryPostSlash(); + std::string stampList = "CMakeFiles/"; stampList += cmGlobalVisualStudio8Generator::GetGenerateStampList(); { std::string stampListFile = @@ -129,7 +129,7 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget() for (cmLocalGenerator const* gi : generators) { stampFile = gi->GetMakefile()->GetCurrentBinaryDirectory(); stampFile += "/"; - stampFile += cmake::GetCMakeFilesDirectoryPostSlash(); + stampFile += "CMakeFiles/"; stampFile += "generate.stamp"; fout << stampFile << "\n"; stamps.push_back(stampFile); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 6618351..ce5665a 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -607,7 +607,7 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile( std::string checkCache = root->GetBinaryDirectory(); checkCache += "/"; - checkCache += cmake::GetCMakeFilesDirectoryPostSlash(); + checkCache += "CMakeFiles/"; checkCache += "cmake.check_cache"; if (cm->DoWriteGlobVerifyTarget()) { @@ -1397,7 +1397,7 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmGeneratorTarget* gtgt) // language. cmMakefile* mf = gtgt->Target->GetMakefile(); std::string fname = gtgt->GetLocalGenerator()->GetCurrentBinaryDirectory(); - fname += cmake::GetCMakeFilesDirectory(); + fname += "/CMakeFiles"; fname += "/"; fname += gtgt->GetName(); fname += "-CMakeForceLinker"; @@ -3705,7 +3705,7 @@ std::string cmGlobalXCodeGenerator::ComputeInfoPListLocation( cmGeneratorTarget* target) { std::string plist = target->GetLocalGenerator()->GetCurrentBinaryDirectory(); - plist += cmake::GetCMakeFilesDirectory(); + plist += "/CMakeFiles"; plist += "/"; plist += target->GetName(); plist += ".dir/Info.plist"; diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx index 4cc081c..13e4dd3 100644 --- a/Source/cmInstallExportGenerator.cxx +++ b/Source/cmInstallExportGenerator.cxx @@ -15,7 +15,6 @@ #include "cmInstallType.h" #include "cmLocalGenerator.h" #include "cmSystemTools.h" -#include "cmake.h" cmInstallExportGenerator::cmInstallExportGenerator( cmExportSet* exportSet, const char* destination, @@ -57,7 +56,7 @@ void cmInstallExportGenerator::ComputeTempDir() // Choose a temporary directory in which to generate the import // files to be installed. this->TempDir = this->LocalGenerator->GetCurrentBinaryDirectory(); - this->TempDir += cmake::GetCMakeFilesDirectory(); + this->TempDir += "/CMakeFiles"; this->TempDir += "/Export"; if (this->Destination.empty()) { return; diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 86c6a58..89b3e73 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -19,7 +19,6 @@ #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmTarget.h" -#include "cmake.h" cmInstallTargetGenerator::cmInstallTargetGenerator( const std::string& targetName, const char* dest, bool implib, @@ -102,7 +101,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig( if (this->Target->NeedRelinkBeforeInstall(config)) { fromDirConfig = this->Target->GetLocalGenerator()->GetCurrentBinaryDirectory(); - fromDirConfig += cmake::GetCMakeFilesDirectory(); + fromDirConfig += "/CMakeFiles"; fromDirConfig += "/CMakeRelink.dir/"; } else { cmStateEnums::ArtifactType artifact = this->ImportLibrary diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index a8647b1..eb32895 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -106,7 +106,7 @@ void cmLocalNinjaGenerator::Generate() std::string cmLocalNinjaGenerator::GetTargetDirectory( cmGeneratorTarget const* target) const { - std::string dir = cmake::GetCMakeFilesDirectoryPostSlash(); + std::string dir = "CMakeFiles/"; dir += target->GetName(); #if defined(__VMS) dir += "_dir"; @@ -305,7 +305,7 @@ std::string cmLocalNinjaGenerator::WriteCommandScript( scriptPath = target->GetSupportDirectory(); } else { scriptPath = this->GetCurrentBinaryDirectory(); - scriptPath += cmake::GetCMakeFilesDirectory(); + scriptPath += "/CMakeFiles"; } cmSystemTools::MakeDirectory(scriptPath); scriptPath += '/'; diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 707a1b5..e246bc7 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -371,7 +371,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefileTargets( depends.clear(); // Build the target for this pass. - std::string makefile2 = cmake::GetCMakeFilesDirectoryPostSlash(); + std::string makefile2 = "CMakeFiles/"; makefile2 += "Makefile2"; commands.push_back( this->GetRecursiveMakeCall(makefile2.c_str(), localName)); @@ -429,7 +429,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefileTargets( void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile() { std::string infoFileName = this->GetCurrentBinaryDirectory(); - infoFileName += cmake::GetCMakeFilesDirectory(); + infoFileName += "/CMakeFiles"; infoFileName += "/CMakeDirectoryInformation.cmake"; // Open the output file. @@ -771,7 +771,7 @@ void cmLocalUnixMakefileGenerator3::WriteSpecialTargetsBottom( cmOutputConverter::SHELL); commands.push_back(rescanRule); } - std::string cmakefileName = cmake::GetCMakeFilesDirectoryPostSlash(); + std::string cmakefileName = "CMakeFiles/"; cmakefileName += "Makefile.cmake"; std::string runRule = "$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)"; @@ -1296,7 +1296,7 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies(const char* tgtInfo, // may have changed. In this case discard all old dependencies. bool needRescanDirInfo = false; std::string dirInfoFile = this->GetCurrentBinaryDirectory(); - dirInfoFile += cmake::GetCMakeFilesDirectory(); + dirInfoFile += "/CMakeFiles"; dirInfoFile += "/CMakeDirectoryInformation.cmake"; { int result; @@ -1362,7 +1362,7 @@ bool cmLocalUnixMakefileGenerator3::ScanDependencies( cmMakefile* mf = this->Makefile; bool haveDirectoryInfo = false; std::string dirInfoFile = this->GetCurrentBinaryDirectory(); - dirInfoFile += cmake::GetCMakeFilesDirectory(); + dirInfoFile += "/CMakeFiles"; dirInfoFile += "/CMakeDirectoryInformation.cmake"; if (mf->ReadListFile(dirInfoFile.c_str()) && !cmSystemTools::GetErrorOccuredFlag()) { @@ -1597,14 +1597,14 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules( } std::string progressDir = this->GetBinaryDirectory(); - progressDir += cmake::GetCMakeFilesDirectory(); + progressDir += "/CMakeFiles"; { std::ostringstream progCmd; progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; progCmd << this->ConvertToOutputFormat( cmSystemTools::CollapseFullPath(progressDir), cmOutputConverter::SHELL); - std::string progressFile = cmake::GetCMakeFilesDirectory(); + std::string progressFile = "/CMakeFiles"; progressFile += "/progress.marks"; std::string progressFileNameFull = this->ConvertToFullPath(progressFile); progCmd << " " @@ -1613,7 +1613,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules( cmOutputConverter::SHELL); commands.push_back(progCmd.str()); } - std::string mf2Dir = cmake::GetCMakeFilesDirectoryPostSlash(); + std::string mf2Dir = "CMakeFiles/"; mf2Dir += "Makefile2"; commands.push_back( this->GetRecursiveMakeCall(mf2Dir.c_str(), recursiveTarget)); @@ -1682,7 +1682,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules( cmOutputConverter::SHELL); commands.push_back(rescanRule); } - std::string cmakefileName = cmake::GetCMakeFilesDirectoryPostSlash(); + std::string cmakefileName = "CMakeFiles/"; cmakefileName += "Makefile.cmake"; { std::string runRule = @@ -2027,7 +2027,7 @@ std::string cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath( std::string cmLocalUnixMakefileGenerator3::GetTargetDirectory( cmGeneratorTarget const* target) const { - std::string dir = cmake::GetCMakeFilesDirectoryPostSlash(); + std::string dir = "CMakeFiles/"; dir += target->GetName(); #if defined(__VMS) dir += "_dir"; diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 677d033..9ea8c2e 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -97,7 +97,7 @@ void cmLocalVisualStudio7Generator::FixGlobalTargets() force_commands.push_back(force_command); std::string no_main_dependency; std::string force = this->GetCurrentBinaryDirectory(); - force += cmake::GetCMakeFilesDirectory(); + force += "/CMakeFiles"; force += "/"; force += l->GetName(); force += "_force"; @@ -144,7 +144,7 @@ void cmLocalVisualStudio7Generator::WriteStampFiles() // Touch a timestamp file used to determine when the project file is // out of date. std::string stampName = this->GetCurrentBinaryDirectory(); - stampName += cmake::GetCMakeFilesDirectory(); + stampName += "/CMakeFiles"; cmSystemTools::MakeDirectory(stampName.c_str()); stampName += "/"; stampName += "generate.stamp"; @@ -254,7 +254,7 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule() std::string stampName = this->GetCurrentBinaryDirectory(); stampName += "/"; - stampName += cmake::GetCMakeFilesDirectoryPostSlash(); + stampName += "CMakeFiles/"; stampName += "generate.stamp"; cmCustomCommandLine commandLine; commandLine.push_back(cmSystemTools::GetCMakeCommand()); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 274c631..4a6f921 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1138,7 +1138,7 @@ cmTarget* cmMakefile::AddUtilityCommand( // Store the custom command in the target. if (!commandLines.empty() || !depends.empty()) { std::string force = this->GetCurrentBinaryDirectory(); - force += cmake::GetCMakeFilesDirectory(); + force += "/CMakeFiles"; force += "/"; force += utilityName; std::vector forced; @@ -1492,7 +1492,7 @@ void cmMakefile::Configure() // make sure the CMakeFiles dir is there std::string filesDir = this->StateSnapshot.GetDirectory().GetCurrentBinary(); - filesDir += cmake::GetCMakeFilesDirectory(); + filesDir += "/CMakeFiles"; cmSystemTools::MakeDirectory(filesDir); assert(cmSystemTools::FileExists(currentStart, true)); @@ -2720,8 +2720,7 @@ bool cmMakefile::IsProjectFile(const char* filename) const { return cmSystemTools::IsSubDirectory(filename, this->GetHomeDirectory()) || (cmSystemTools::IsSubDirectory(filename, this->GetHomeOutputDirectory()) && - !cmSystemTools::IsSubDirectory(filename, - cmake::GetCMakeFilesDirectory())); + !cmSystemTools::IsSubDirectory(filename, "/CMakeFiles")); } MessageType cmMakefile::ExpandVariablesInStringNew( diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index 92eeb2e..e576b5f 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -25,7 +25,6 @@ #include "cmStateSnapshot.h" #include "cmStateTypes.h" #include "cmSystemTools.h" -#include "cmake.h" cmMakefileExecutableTargetGenerator::cmMakefileExecutableTargetGenerator( cmGeneratorTarget* target) @@ -317,7 +316,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) std::string outpathImp; if (relink) { outpath = this->Makefile->GetCurrentBinaryDirectory(); - outpath += cmake::GetCMakeFilesDirectory(); + outpath += "/CMakeFiles"; outpath += "/CMakeRelink.dir"; cmSystemTools::MakeDirectory(outpath); outpath += "/"; diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 0c2d7b3..72181ab 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -25,7 +25,6 @@ #include "cmStateSnapshot.h" #include "cmStateTypes.h" #include "cmSystemTools.h" -#include "cmake.h" cmMakefileLibraryTargetGenerator::cmMakefileLibraryTargetGenerator( cmGeneratorTarget* target) @@ -499,7 +498,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( outpath += "/"; } else if (relink) { outpath = this->Makefile->GetCurrentBinaryDirectory(); - outpath += cmake::GetCMakeFilesDirectory(); + outpath += "/CMakeFiles"; outpath += "/CMakeRelink.dir"; cmSystemTools::MakeDirectory(outpath); outpath += "/"; diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index d1dcd81..a7920a2 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1222,7 +1222,7 @@ void cmMakefileTargetGenerator::MakeEchoProgress( cmLocalUnixMakefileGenerator3::EchoProgress& progress) const { progress.Dir = this->LocalGenerator->GetBinaryDirectory(); - progress.Dir += cmake::GetCMakeFilesDirectory(); + progress.Dir += "/CMakeFiles"; std::ostringstream progressArg; progressArg << "$(CMAKE_PROGRESS_" << this->NumberOfProgressActions << ")"; progress.Arg = progressArg.str(); diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index b62da66..8b125e3 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -31,7 +31,6 @@ #include "cmStateSnapshot.h" #include "cmStateTypes.h" #include "cmSystemTools.h" -#include "cmake.h" class cmCustomCommand; @@ -718,8 +717,7 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkStatement() globalGen.GetRuleCmdLength(this->LanguageLinkerDeviceRule()); const std::string rspfile = this->ConvertToNinjaPath( - std::string(cmake::GetCMakeFilesDirectoryPostSlash()) + - genTarget.GetName() + ".rsp"); + std::string("CMakeFiles/") + genTarget.GetName() + ".rsp"); // Gather order-only dependencies. cmNinjaDeps orderOnlyDeps; @@ -1004,8 +1002,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() } const std::string rspfile = this->ConvertToNinjaPath( - std::string(cmake::GetCMakeFilesDirectoryPostSlash()) + gt.GetName() + - ".rsp"); + std::string("CMakeFiles/") + gt.GetName() + ".rsp"); // Gather order-only dependencies. cmNinjaDeps orderOnlyDeps; diff --git a/Source/cmNinjaUtilityTargetGenerator.cxx b/Source/cmNinjaUtilityTargetGenerator.cxx index cc6d4b9..5057dc4 100644 --- a/Source/cmNinjaUtilityTargetGenerator.cxx +++ b/Source/cmNinjaUtilityTargetGenerator.cxx @@ -14,7 +14,6 @@ #include "cmSourceFile.h" #include "cmStateTypes.h" #include "cmSystemTools.h" -#include "cmake.h" #include #include @@ -35,7 +34,7 @@ void cmNinjaUtilityTargetGenerator::Generate() { std::string utilCommandName = this->GetLocalGenerator()->GetCurrentBinaryDirectory(); - utilCommandName += cmake::GetCMakeFilesDirectory(); + utilCommandName += "/CMakeFiles"; utilCommandName += "/"; utilCommandName += this->GetTargetName() + ".util"; utilCommandName = this->ConvertToNinjaPath(utilCommandName); diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index 9fa8a89..e90e102 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -26,7 +26,6 @@ #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmTarget.h" -#include "cmake.h" #include "cmsys/FStream.hxx" #include "cmsys/SystemInformation.hxx" @@ -352,7 +351,7 @@ bool cmQtAutoGenInitializer::InitCustomTargets() // Info directory this->Dir.Info = cbd; - this->Dir.Info += cmake::GetCMakeFilesDirectory(); + this->Dir.Info += "/CMakeFiles"; this->Dir.Info += '/'; this->Dir.Info += this->Target->GetName(); this->Dir.Info += "_autogen"; diff --git a/Source/cmStateSnapshot.cxx b/Source/cmStateSnapshot.cxx index a4305e6..63bec71 100644 --- a/Source/cmStateSnapshot.cxx +++ b/Source/cmStateSnapshot.cxx @@ -16,7 +16,6 @@ #include "cmStateDirectory.h" #include "cmStatePrivate.h" #include "cmVersion.h" -#include "cmake.h" #if !defined(_WIN32) # include @@ -348,8 +347,7 @@ void cmStateSnapshot::SetDefaultDefinitions() std::to_string(cmVersion::GetTweakVersion())); this->SetDefinition("CMAKE_VERSION", cmVersion::GetCMakeVersion()); - this->SetDefinition("CMAKE_FILES_DIRECTORY", - cmake::GetCMakeFilesDirectory()); + this->SetDefinition("CMAKE_FILES_DIRECTORY", "/CMakeFiles"); // Setup the default include file regular expression (match everything). this->Position->BuildSystemDirectory->Properties.SetProperty( diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx index e224a27..42fcc3c 100644 --- a/Source/cmTryRunCommand.cxx +++ b/Source/cmTryRunCommand.cxx @@ -217,7 +217,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs, // removed at the end of TRY_RUN and the user can run it manually // on the target platform. std::string copyDest = this->Makefile->GetHomeOutputDirectory(); - copyDest += cmake::GetCMakeFilesDirectory(); + copyDest += "/CMakeFiles"; copyDest += "/"; copyDest += cmSystemTools::GetFilenameWithoutExtension(this->OutputFile); copyDest += "-"; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index c65bd2e..46f1a17 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2560,8 +2560,7 @@ int cmake::Build(int jobs, const std::string& dir, const std::string& target, // actually starting the build. If not done separately from the build // itself, there is the risk of building an out-of-date solution file due // to limitations of the underlying build system. - std::string const stampList = cachePath + "/" + - GetCMakeFilesDirectoryPostSlash() + + std::string const stampList = cachePath + "/" + "CMakeFiles/" + cmGlobalVisualStudio9Generator::GetGenerateStampList(); // Note that the stampList file only exists for VS generators. @@ -2571,8 +2570,8 @@ int cmake::Build(int jobs, const std::string& dir, const std::string& target, // the glob verification script before starting the build this->AddScriptingCommands(); if (this->GlobalGenerator->MatchesGeneratorName("Visual Studio 9 2008")) { - std::string const globVerifyScript = cachePath + "/" + - GetCMakeFilesDirectoryPostSlash() + "VerifyGlobs.cmake"; + std::string const globVerifyScript = + cachePath + "/" + "CMakeFiles/" + "VerifyGlobs.cmake"; if (cmSystemTools::FileExists(globVerifyScript)) { std::vector args; this->ReadListFile(args, globVerifyScript.c_str()); diff --git a/Source/cmake.h b/Source/cmake.h index 9891857..148fc83 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -123,12 +123,6 @@ public: #endif std::string ReportCapabilities(bool haveServerMode) const; - static const char* GetCMakeFilesDirectory() { return "/CMakeFiles"; } - static const char* GetCMakeFilesDirectoryPostSlash() - { - return "CMakeFiles/"; - } - //@{ /** * Set/Get the home directory (or output directory) in the project. The ----------------------------------------------------------------------- Summary of changes: Source/CPack/IFW/cmCPackIFWRepository.cxx | 2 +- Source/CTest/cmCTestCoverageHandler.cxx | 3 +- Source/CTest/cmCTestLaunch.cxx | 2 +- Source/CTest/cmCTestMultiProcessHandler.cxx | 2 +- Source/cmCPluginAPI.cxx | 2 +- Source/cmCTest.cxx | 2 +- Source/cmCacheManager.cxx | 11 ++--- Source/cmComputeLinkInformation.cxx | 2 +- Source/cmComputeTargetDepends.cxx | 2 +- Source/cmCoreTryCompile.cxx | 2 +- Source/cmExportFileGenerator.cxx | 2 +- Source/cmExportInstallFileGenerator.cxx | 8 +-- Source/cmFileAPI.cxx | 2 +- Source/cmFileCommand.cxx | 4 +- Source/cmGeneratedFileStream.cxx | 2 +- Source/cmGeneratorTarget.cxx | 10 ++-- Source/cmGlobVerificationManager.cxx | 5 +- Source/cmGlobalGenerator.cxx | 17 +++---- Source/cmGlobalGhsMultiGenerator.cxx | 6 +-- Source/cmGlobalUnixMakefileGenerator3.cxx | 33 ++++++------- Source/cmGlobalVisualStudio10Generator.cxx | 4 +- Source/cmGlobalVisualStudio71Generator.cxx | 2 +- Source/cmGlobalVisualStudio8Generator.cxx | 4 +- Source/cmGlobalXCodeGenerator.cxx | 6 +-- Source/cmInstallExportGenerator.cxx | 5 +- Source/cmInstallTargetGenerator.cxx | 3 +- Source/cmLocalGenerator.cxx | 6 +-- Source/cmLocalGenerator.h | 4 +- Source/cmLocalNinjaGenerator.cxx | 4 +- Source/cmLocalUnixMakefileGenerator3.cxx | 68 ++++++++++++-------------- Source/cmLocalUnixMakefileGenerator3.h | 25 +++------- Source/cmLocalVisualStudio7Generator.cxx | 6 +-- Source/cmMakefile.cxx | 7 ++- Source/cmMakefileExecutableTargetGenerator.cxx | 3 +- Source/cmMakefileLibraryTargetGenerator.cxx | 3 +- Source/cmMakefileTargetGenerator.cxx | 13 +++-- Source/cmNinjaNormalTargetGenerator.cxx | 7 +-- Source/cmNinjaUtilityTargetGenerator.cxx | 3 +- Source/cmOutputRequiredFilesCommand.cxx | 2 +- Source/cmQtAutoGenInitializer.cxx | 15 +++--- Source/cmStateSnapshot.cxx | 4 +- Source/cmSystemTools.cxx | 24 ++++++--- Source/cmSystemTools.h | 4 +- Source/cmTryRunCommand.cxx | 6 +-- Source/cmVariableRequiresCommand.cxx | 2 +- Source/cmVariableWatchCommand.cxx | 2 +- Source/cmake.cxx | 46 ++++++++--------- Source/cmake.h | 6 --- Source/cmcmd.cxx | 15 +++--- Source/kwsys/CMakeLists.txt | 8 ++- Source/kwsys/SystemTools.cxx | 58 ++++++++++++++++++++-- Source/kwsys/SystemTools.hxx.in | 7 +++ Source/kwsys/testSystemTools.cxx | 46 +++++++++++++++++ 53 files changed, 308 insertions(+), 229 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Fri Jan 25 08:03:06 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 25 Jan 2019 08:03:06 -0500 (EST) Subject: [Cmake-commits] CMake branch, release, updated. v3.13.3-5-g329cf7f Message-ID: <20190125130306.0335F14DE2@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, release has been updated via 329cf7f3e3ef4d64b4bdd274ad2b6cc376a6cb0e (commit) via 646eedcfcb73548b723603626ac276f739ba5d1d (commit) from 845a46fb743cc036edd45e941be41ca55a3910b2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Source/cmFileCommand.cxx | 8 -------- 1 file changed, 8 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Fri Jan 25 08:13:03 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 25 Jan 2019 08:13:03 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-1116-g40628b2 Message-ID: <20190125131303.AEB57127A7F@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 40628b2519ae1553a33f701cf46ee8fbbd013b85 (commit) via 24b6e4830d9027e63db7dfafa500aaeb652d3a4c (commit) via 15bc4a25e50d18ba081f31ffd8fc4724b83460b5 (commit) via 9a2bddb7042485a35329cf8644f8da1cbfd2398f (commit) via a8f51555235a1a747e540a0859ab146f927dfd0b (commit) via 26b7a8e77ecafea417a0430276533ec5e58fa33a (commit) via de13c55d74e0e95aa3799ba132db668212721776 (commit) via c3203bf31637a960d1bf579fb7092a1ae850cdb5 (commit) via 68eabb357616f7ef469b20dd8d9cb8ce588e113d (commit) via a6982cff0d3910723ad4fd40b9c63cf77c872d30 (commit) via dc6888573da15cd7ddb9f91b70ef3e6c4e7cae15 (commit) from b4ccb6cd32029efa802dfdfa889c75bc16f65cf1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=40628b2519ae1553a33f701cf46ee8fbbd013b85 commit 40628b2519ae1553a33f701cf46ee8fbbd013b85 Merge: 24b6e48 a6982cf Author: Brad King AuthorDate: Fri Jan 25 13:09:28 2019 +0000 Commit: Kitware Robot CommitDate: Fri Jan 25 08:09:37 2019 -0500 Merge topic 'max-recursion-depth' a6982cff0d cmMakefile: Impose maximum recursion limit Acked-by: Kitware Robot Acked-by: Juraj Or?uli? Merge-request: !2746 diff --cc Source/cmMakefile.cxx index 7eed837,ca5047a..b59a733 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@@ -2721,9 -2747,20 +2747,19 @@@ bool cmMakefile::IsProjectFile(const ch { return cmSystemTools::IsSubDirectory(filename, this->GetHomeDirectory()) || (cmSystemTools::IsSubDirectory(filename, this->GetHomeOutputDirectory()) && - !cmSystemTools::IsSubDirectory(filename, - cmake::GetCMakeFilesDirectory())); + !cmSystemTools::IsSubDirectory(filename, "/CMakeFiles")); } + int cmMakefile::GetRecursionDepth() const + { + return this->RecursionDepth; + } + + void cmMakefile::SetRecursionDepth(int recursionDepth) + { + this->RecursionDepth = recursionDepth; + } + MessageType cmMakefile::ExpandVariablesInStringNew( std::string& errorstr, std::string& source, bool escapeQuotes, bool noEscapes, bool atOnly, const char* filename, long line, https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=24b6e4830d9027e63db7dfafa500aaeb652d3a4c commit 24b6e4830d9027e63db7dfafa500aaeb652d3a4c Merge: 15bc4a2 dc68885 Author: Brad King AuthorDate: Fri Jan 25 13:05:45 2019 +0000 Commit: Kitware Robot CommitDate: Fri Jan 25 08:06:54 2019 -0500 Merge topic 'exclude_from_all' dc6888573d Pass EXCLUDE_FROM_ALL from directory to targets Acked-by: Kitware Robot Merge-request: !2816 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=15bc4a25e50d18ba081f31ffd8fc4724b83460b5 commit 15bc4a25e50d18ba081f31ffd8fc4724b83460b5 Merge: 9a2bddb de13c55 Author: Brad King AuthorDate: Fri Jan 25 13:04:58 2019 +0000 Commit: Kitware Robot CommitDate: Fri Jan 25 08:06:01 2019 -0500 Merge topic 'swift' de13c55d74 Ninja: support `SWIFT_MODULE_NAME` property Acked-by: Kitware Robot Merge-request: !2850 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9a2bddb7042485a35329cf8644f8da1cbfd2398f commit 9a2bddb7042485a35329cf8644f8da1cbfd2398f Merge: a8f5155 26b7a8e Author: Brad King AuthorDate: Fri Jan 25 13:04:36 2019 +0000 Commit: Kitware Robot CommitDate: Fri Jan 25 08:05:06 2019 -0500 Merge topic 'FindICU-win64' 26b7a8e77e FindICU: Find 64-bit Windows builds under CMP0074 NEW behavior Acked-by: Kitware Robot Merge-request: !2859 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a8f51555235a1a747e540a0859ab146f927dfd0b commit a8f51555235a1a747e540a0859ab146f927dfd0b Merge: b4ccb6c c3203bf Author: Brad King AuthorDate: Fri Jan 25 13:04:13 2019 +0000 Commit: Kitware Robot CommitDate: Fri Jan 25 08:04:19 2019 -0500 Merge topic 'clang-warnings' c3203bf316 Silence -Wcomma warning 68eabb3576 Avoid -Wstring-plus-int warning Acked-by: Kitware Robot Merge-request: !2846 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=26b7a8e77ecafea417a0430276533ec5e58fa33a commit 26b7a8e77ecafea417a0430276533ec5e58fa33a Author: Johannes Reiff AuthorDate: Thu Jan 24 14:44:18 2019 -0500 Commit: Brad King CommitDate: Thu Jan 24 14:55:35 2019 -0500 FindICU: Find 64-bit Windows builds under CMP0074 NEW behavior CMP0074 causes FindICU.cmake to always prefer the 32-bit version of ICU programs/libraries on Windows. NO_PACKAGE_ROOT_PATH reverts this behavior. Fixes: #18742 diff --git a/Modules/FindICU.cmake b/Modules/FindICU.cmake index 70e10f5..e4b4909 100644 --- a/Modules/FindICU.cmake +++ b/Modules/FindICU.cmake @@ -165,7 +165,9 @@ function(_ICU_FIND) find_program("${cache_var}" "${program}" HINTS ${icu_roots} PATH_SUFFIXES ${icu_binary_suffixes} - DOC "ICU ${program} executable") + DOC "ICU ${program} executable" + NO_PACKAGE_ROOT_PATH + ) mark_as_advanced(cache_var) set("${program_var}" "${${cache_var}}" PARENT_SCOPE) endforeach() @@ -229,11 +231,15 @@ function(_ICU_FIND) find_library("${component_cache_release}" ${component_libnames} HINTS ${icu_roots} PATH_SUFFIXES ${icu_library_suffixes} - DOC "ICU ${component} library (release)") + DOC "ICU ${component} library (release)" + NO_PACKAGE_ROOT_PATH + ) find_library("${component_cache_debug}" ${component_debug_libnames} HINTS ${icu_roots} PATH_SUFFIXES ${icu_library_suffixes} - DOC "ICU ${component} library (debug)") + DOC "ICU ${component} library (debug)" + NO_PACKAGE_ROOT_PATH + ) include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) select_library_configurations(ICU_${component_upcase}) mark_as_advanced("${component_cache_release}" "${component_cache_debug}") https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=de13c55d74e0e95aa3799ba132db668212721776 commit de13c55d74e0e95aa3799ba132db668212721776 Author: Saleem Abdulrasool AuthorDate: Wed Jan 16 11:42:10 2019 -0800 Commit: Saleem Abdulrasool CommitDate: Wed Jan 23 21:21:07 2019 -0800 Ninja: support `SWIFT_MODULE_NAME` property Add a new `SWIFT_MODULE_NAME` property that defaults to the target name. This can be adjusted via `set_target_properties`. This is needed as otherwise, the first source file determines the module name. Issue: #18800 diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index c959a04..edb0ef3 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -919,7 +919,12 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement( } vars["SWIFT_AUXILIARY_SOURCES"] = aux_sources; - vars["SWIFT_MODULE_NAME"] = this->GeneratorTarget->GetName(); + if (const char* name = + this->GeneratorTarget->GetProperty("SWIFT_MODULE_NAME")) { + vars["SWIFT_MODULE_NAME"] = name; + } else { + vars["SWIFT_MODULE_NAME"] = this->GeneratorTarget->GetName(); + } } if (!this->NeedDepTypeMSVC(language)) { https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c3203bf31637a960d1bf579fb7092a1ae850cdb5 commit c3203bf31637a960d1bf579fb7092a1ae850cdb5 Author: Brad King AuthorDate: Wed Jan 23 13:20:14 2019 -0500 Commit: Brad King CommitDate: Wed Jan 23 13:20:14 2019 -0500 Silence -Wcomma warning We use a comma-in-paren expression to evaluate multiple statements in a condition. Clang warns that this may be incorrect. Follow its suggestion to cast all but the last expression to `void` to silence the warning. diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index ff793f6..cc2c09f 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -193,8 +193,9 @@ bool cmListFileParser::ParseFunction(const char* name, long line) unsigned long lastLine; unsigned long parenDepth = 0; this->Separation = SeparationOkay; - while ((lastLine = cmListFileLexer_GetCurrentLine(this->Lexer), - token = cmListFileLexer_Scan(this->Lexer))) { + while ( + (static_cast(lastLine = cmListFileLexer_GetCurrentLine(this->Lexer)), + token = cmListFileLexer_Scan(this->Lexer))) { if (token->type == cmListFileLexer_Token_Space || token->type == cmListFileLexer_Token_Newline) { this->Separation = SeparationOkay; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=68eabb357616f7ef469b20dd8d9cb8ce588e113d commit 68eabb357616f7ef469b20dd8d9cb8ce588e113d Author: Brad King AuthorDate: Wed Jan 23 13:17:22 2019 -0500 Commit: Brad King CommitDate: Wed Jan 23 13:17:22 2019 -0500 Avoid -Wstring-plus-int warning In `cmState::GetGlobalProperty` we use a macro to produce a string of the form ";a;b;c" and want to return "a;b;c" by skipping the leading ";". Switch from pointer arithmetic to indexing+addressing to silence the "warning: adding 'int' to a string does not append to the string" diagnostic from Clang. diff --git a/Source/cmState.cxx b/Source/cmState.cxx index d4d3df5..fdd7b3d 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -545,10 +545,10 @@ const char* cmState::GetGlobalProperty(const std::string& prop) } #define STRING_LIST_ELEMENT(F) ";" #F if (prop == "CMAKE_C_KNOWN_FEATURES") { - return FOR_EACH_C_FEATURE(STRING_LIST_ELEMENT) + 1; + return &FOR_EACH_C_FEATURE(STRING_LIST_ELEMENT)[1]; } if (prop == "CMAKE_CXX_KNOWN_FEATURES") { - return FOR_EACH_CXX_FEATURE(STRING_LIST_ELEMENT) + 1; + return &FOR_EACH_CXX_FEATURE(STRING_LIST_ELEMENT)[1]; } #undef STRING_LIST_ELEMENT return this->GlobalProperties.GetPropertyValue(prop); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a6982cff0d3910723ad4fd40b9c63cf77c872d30 commit a6982cff0d3910723ad4fd40b9c63cf77c872d30 Author: Kyle Edwards AuthorDate: Fri Dec 14 17:24:52 2018 -0500 Commit: Kyle Edwards CommitDate: Wed Jan 23 09:52:29 2019 -0500 cmMakefile: Impose maximum recursion limit In order to keep infinitely-recursive scripts from causing a stack overflow in the CMake executable, CMake now imposes a maximum recursion limit before issuing an error message. The limit can be adjusted at runtime with CMAKE_MAXIMUM_RECURSION_DEPTH. Fixes: #18694 diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index bd6a58f..de4ce3d 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -190,6 +190,7 @@ Variables that Change Behavior /variable/CMAKE_LIBRARY_PATH /variable/CMAKE_LINK_DIRECTORIES_BEFORE /variable/CMAKE_MFC_FLAG + /variable/CMAKE_MAXIMUM_RECURSION_DEPTH /variable/CMAKE_MODULE_PATH /variable/CMAKE_NOT_USING_CONFIG_FLAGS /variable/CMAKE_POLICY_DEFAULT_CMPNNNN diff --git a/Help/release/dev/max-recursion-depth.rst b/Help/release/dev/max-recursion-depth.rst new file mode 100644 index 0000000..3d9c781 --- /dev/null +++ b/Help/release/dev/max-recursion-depth.rst @@ -0,0 +1,6 @@ +max-recursion-depth +------------------- + +* CMake now imposes a maximum recursion limit to prevent a stack overflow on + scripts that recurse infinitely. The limit can be adjusted at runtime with + :variable:`CMAKE_MAXIMUM_RECURSION_DEPTH`. diff --git a/Help/variable/CMAKE_MAXIMUM_RECURSION_DEPTH.rst b/Help/variable/CMAKE_MAXIMUM_RECURSION_DEPTH.rst new file mode 100644 index 0000000..7110b16 --- /dev/null +++ b/Help/variable/CMAKE_MAXIMUM_RECURSION_DEPTH.rst @@ -0,0 +1,33 @@ +CMAKE_MAXIMUM_RECURSION_DEPTH +----------------------------- + +Maximum recursion depth for CMake scripts. It is intended to be set on the +command line with ``-DCMAKE_MAXIMUM_RECURSION_DEPTH=``, or within +``CMakeLists.txt`` by projects that require a large recursion depth. Projects +that set this variable should provide the user with a way to override it. For +example: + +.. code-block:: cmake + + # About to perform deeply recursive actions + if(NOT CMAKE_MAXIMUM_RECURSION_DEPTH) + set(CMAKE_MAXIMUM_RECURSION_DEPTH 2000) + endif() + +If it is not set, or is set to a non-integer value, a sensible default limit is +used. If the recursion limit is reached, the script terminates immediately with +a fatal error. + +Calling any of the following commands increases the recursion depth: + +* :command:`include` +* :command:`find_package` +* :command:`add_subdirectory` +* :command:`try_compile` +* :command:`ctest_read_custom_files` +* :command:`ctest_run_script` (unless ``NEW_PROCESS`` is specified) +* User-defined :command:`function`'s and :command:`macro`'s (note that + :command:`function` and :command:`macro` themselves don't increase recursion + depth) +* Reading or writing variables that are being watched by a + :command:`variable_watch` diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 9e753e6..c73c6df 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -31,6 +31,16 @@ else() set(CMAKE_USE_ELF_PARSER) endif() +if(NOT CMake_DEFAULT_RECURSION_LIMIT) + if(DEFINED ENV{DASHBOARD_TEST_FROM_CTEST}) + set(CMake_DEFAULT_RECURSION_LIMIT 100) + elseif(MINGW) + set(CMake_DEFAULT_RECURSION_LIMIT 400) + else() + set(CMake_DEFAULT_RECURSION_LIMIT 1000) + endif() +endif() + if(APPLE) set(CMAKE_USE_MACH_PARSER 1) endif() diff --git a/Source/CTest/cmCTestRunScriptCommand.cxx b/Source/CTest/cmCTestRunScriptCommand.cxx index 238284a..a7e47d3 100644 --- a/Source/CTest/cmCTestRunScriptCommand.cxx +++ b/Source/CTest/cmCTestRunScriptCommand.cxx @@ -39,7 +39,8 @@ bool cmCTestRunScriptCommand::InitialPass(std::vector const& args, ++i; } else { int ret; - cmCTestScriptHandler::RunScript(this->CTest, args[i].c_str(), !np, &ret); + cmCTestScriptHandler::RunScript(this->CTest, this->Makefile, + args[i].c_str(), !np, &ret); std::ostringstream str; str << ret; this->Makefile->AddDefinition(returnVariable, str.str().c_str()); diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index f417f53..b949023 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -78,6 +78,7 @@ cmCTestScriptHandler::cmCTestScriptHandler() this->EmptyBinDir = false; this->EmptyBinDirOnce = false; this->Makefile = nullptr; + this->ParentMakefile = nullptr; this->CMake = nullptr; this->GlobalGenerator = nullptr; @@ -117,6 +118,7 @@ void cmCTestScriptHandler::Initialize() delete this->Makefile; this->Makefile = nullptr; + this->ParentMakefile = nullptr; delete this->GlobalGenerator; this->GlobalGenerator = nullptr; @@ -292,6 +294,10 @@ void cmCTestScriptHandler::CreateCMake() snapshot.GetDirectory().SetCurrentSource(cwd); snapshot.GetDirectory().SetCurrentBinary(cwd); this->Makefile = new cmMakefile(this->GlobalGenerator, snapshot); + if (this->ParentMakefile) { + this->Makefile->SetRecursionDepth( + this->ParentMakefile->GetRecursionDepth()); + } this->CMake->SetProgressCallback(ctestScriptProgressCallback, this->CTest); @@ -891,11 +897,13 @@ void cmCTestScriptHandler::RestoreBackupDirectories() } } -bool cmCTestScriptHandler::RunScript(cmCTest* ctest, const char* sname, - bool InProcess, int* returnValue) +bool cmCTestScriptHandler::RunScript(cmCTest* ctest, cmMakefile* mf, + const char* sname, bool InProcess, + int* returnValue) { cmCTestScriptHandler* sh = new cmCTestScriptHandler(); sh->SetCTestInstance(ctest); + sh->ParentMakefile = mf; sh->AddConfigurationScript(sname, InProcess); int res = sh->ProcessHandler(); if (returnValue) { diff --git a/Source/CTest/cmCTestScriptHandler.h b/Source/CTest/cmCTestScriptHandler.h index cf0762e..d93b5f8 100644 --- a/Source/CTest/cmCTestScriptHandler.h +++ b/Source/CTest/cmCTestScriptHandler.h @@ -72,8 +72,8 @@ public: /* * Run a script */ - static bool RunScript(cmCTest* ctest, const char* script, bool InProcess, - int* returnValue); + static bool RunScript(cmCTest* ctest, cmMakefile* mf, const char* script, + bool InProcess, int* returnValue); int RunCurrentScript(); /* @@ -166,6 +166,7 @@ private: std::chrono::steady_clock::time_point ScriptStartTime; cmMakefile* Makefile; + cmMakefile* ParentMakefile; cmGlobalGenerator* GlobalGenerator; cmake* CMake; }; diff --git a/Source/cmConfigure.cmake.h.in b/Source/cmConfigure.cmake.h.in index c80439b..9d00c21 100644 --- a/Source/cmConfigure.cmake.h.in +++ b/Source/cmConfigure.cmake.h.in @@ -20,6 +20,7 @@ #cmakedefine CMAKE_USE_ELF_PARSER #cmakedefine CMAKE_USE_MACH_PARSER #cmakedefine CMake_HAVE_CXX_MAKE_UNIQUE +#define CMake_DEFAULT_RECURSION_LIMIT @CMake_DEFAULT_RECURSION_LIMIT@ #define CMAKE_BIN_DIR "/@CMAKE_BIN_DIR@" #define CMAKE_DATA_DIR "/@CMAKE_DATA_DIR@" diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index b2b0e38..acd666f 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -98,6 +98,8 @@ cmGlobalGenerator::cmGlobalGenerator(cmake* cm) this->ConfigureDoneCMP0026AndCMP0024 = false; this->FirstTimeProgress = 0.0f; + this->RecursionDepth = 0; + cm->GetState()->SetIsGeneratorMultiConfig(false); cm->GetState()->SetMinGWMake(false); cm->GetState()->SetMSYSShell(false); @@ -1166,6 +1168,7 @@ void cmGlobalGenerator::Configure() this->CMakeInstance->GetHomeOutputDirectory()); cmMakefile* dirMf = new cmMakefile(this, snapshot); + dirMf->SetRecursionDepth(this->RecursionDepth); this->Makefiles.push_back(dirMf); this->IndexMakefile(dirMf); diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 36d3d10..fa16180 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -432,6 +432,8 @@ public: std::string MakeSilentFlag; + int RecursionDepth; + protected: typedef std::vector GeneratorVector; // for a project collect all its targets by following depend diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 500776e..ca5047a 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -45,6 +45,8 @@ #include "cm_sys_stat.h" #include "cmake.h" +#include "cmConfigure.h" // IWYU pragma: keep + #ifdef CMAKE_BUILD_WITH_CMAKE # include "cmVariableWatch.h" #endif @@ -83,6 +85,7 @@ cmMakefile::cmMakefile(cmGlobalGenerator* globalGenerator, this->StateSnapshot = this->StateSnapshot.GetState()->CreatePolicyScopeSnapshot( this->StateSnapshot); + this->RecursionDepth = 0; // Enter a policy level for this directory. this->PushPolicy(); @@ -333,12 +336,14 @@ public: cmListFileContext const& lfc = cmListFileContext::FromCommandContext( cc, this->Makefile->StateSnapshot.GetExecutionListFile()); this->Makefile->Backtrace = this->Makefile->Backtrace.Push(lfc); + ++this->Makefile->RecursionDepth; this->Makefile->ExecutionStatusStack.push_back(&status); } ~cmMakefileCall() { this->Makefile->ExecutionStatusStack.pop_back(); + --this->Makefile->RecursionDepth; this->Makefile->Backtrace = this->Makefile->Backtrace.Pop(); } @@ -361,6 +366,24 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff, cmMakefileCall stack_manager(this, lff, status); static_cast(stack_manager); + // Check for maximum recursion depth. + int depth = CMake_DEFAULT_RECURSION_LIMIT; + const char* depthStr = this->GetDefinition("CMAKE_MAXIMUM_RECURSION_DEPTH"); + if (depthStr) { + std::istringstream s(depthStr); + int d; + if (s >> d) { + depth = d; + } + } + if (this->RecursionDepth > depth) { + std::ostringstream e; + e << "Maximum recursion depth of " << depth << " exceeded"; + this->IssueMessage(MessageType::FATAL_ERROR, e.str()); + cmSystemTools::SetFatalErrorOccured(); + return false; + } + // Lookup the command prototype. if (cmCommand* proto = this->GetState()->GetCommandByExactName(lff.Name.Lower)) { @@ -1369,6 +1392,9 @@ void cmMakefile::InitializeFromParent(cmMakefile* parent) // Imported targets. this->ImportedTargets = parent->ImportedTargets; + + // Recursion depth. + this->RecursionDepth = parent->RecursionDepth; } void cmMakefile::PushFunctionScope(std::string const& fileName, @@ -2725,6 +2751,16 @@ bool cmMakefile::IsProjectFile(const char* filename) const cmake::GetCMakeFilesDirectory())); } +int cmMakefile::GetRecursionDepth() const +{ + return this->RecursionDepth; +} + +void cmMakefile::SetRecursionDepth(int recursionDepth) +{ + this->RecursionDepth = recursionDepth; +} + MessageType cmMakefile::ExpandVariablesInStringNew( std::string& errorstr, std::string& source, bool escapeQuotes, bool noEscapes, bool atOnly, const char* filename, long line, @@ -3388,6 +3424,7 @@ int cmMakefile::TryCompile(const std::string& srcdir, this->IsSourceFileTryCompile = false; return 1; } + gg->RecursionDepth = this->RecursionDepth; cm.SetGlobalGenerator(gg); // do a configure @@ -3407,6 +3444,12 @@ int cmMakefile::TryCompile(const std::string& srcdir, cmStateEnums::STRING); } } + const char* recursionDepth = + this->GetDefinition("CMAKE_MAXIMUM_RECURSION_DEPTH"); + if (recursionDepth) { + cm.AddCacheEntry("CMAKE_MAXIMUM_RECURSION_DEPTH", recursionDepth, + "Maximum recursion depth", cmStateEnums::STRING); + } // if cmake args were provided then pass them in if (cmakeArgs) { // FIXME: Workaround to ignore unused CLI variables in try-compile. diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index e88bb0b..2bd44e2 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -870,6 +870,9 @@ public: const char* sourceFilename) const; bool IsProjectFile(const char* filename) const; + int GetRecursionDepth() const; + void SetRecursionDepth(int recursionDepth); + protected: // add link libraries and directories to the target void AddGlobalLinkInformation(cmTarget& target); @@ -930,6 +933,7 @@ protected: private: cmStateSnapshot StateSnapshot; cmListFileBacktrace Backtrace; + int RecursionDepth; void ReadListFile(cmListFile const& listFile, const std::string& filenametoread); diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index bf18efe..e6c90b4 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -215,6 +215,7 @@ endif() add_RunCMake_test(CompatibleInterface) add_RunCMake_test(Syntax) add_RunCMake_test(WorkingDirectory) +add_RunCMake_test(MaxRecursionDepth) add_RunCMake_test(add_custom_command) add_RunCMake_test(add_custom_target) diff --git a/Tests/RunCMake/MaxRecursionDepth/CMakeLists.txt b/Tests/RunCMake/MaxRecursionDepth/CMakeLists.txt new file mode 100644 index 0000000..d2cd86d --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 3.13) +if(DEFINED CMAKE_GENERATOR) + project(${RunCMake_TEST} NONE) +endif() +include("${CMAKE_CURRENT_LIST_DIR}/${TEST_NAME}.cmake") diff --git a/Tests/RunCMake/MaxRecursionDepth/CMakeLists.txt.in b/Tests/RunCMake/MaxRecursionDepth/CMakeLists.txt.in new file mode 100644 index 0000000..fee3eda --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/CMakeLists.txt.in @@ -0,0 +1,2 @@ +cmake_minimum_required(VERSION 3.12) +project(MaxRecursionDepth NONE) diff --git a/Tests/RunCMake/MaxRecursionDepth/CTestCustom.cmake b/Tests/RunCMake/MaxRecursionDepth/CTestCustom.cmake new file mode 100644 index 0000000..354bc7a --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/CTestCustom.cmake @@ -0,0 +1,3 @@ +message("${x}") +math(EXPR x "${x} + 1") +ctest_read_custom_files("${CMAKE_CURRENT_LIST_DIR}") diff --git a/Tests/RunCMake/MaxRecursionDepth/FindRecursivePackage.cmake b/Tests/RunCMake/MaxRecursionDepth/FindRecursivePackage.cmake new file mode 100644 index 0000000..3cbb99e --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/FindRecursivePackage.cmake @@ -0,0 +1,3 @@ +message("${x}") +math(EXPR x "${x} + 1") +find_package(RecursivePackage) diff --git a/Tests/RunCMake/MaxRecursionDepth/RunCMakeTest.cmake b/Tests/RunCMake/MaxRecursionDepth/RunCMakeTest.cmake new file mode 100644 index 0000000..c5a859d --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/RunCMakeTest.cmake @@ -0,0 +1,49 @@ +include(RunCMake) +include(RunCTest) + +function(run_cmake_recursive name) + set(RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" -DTEST_NAME=${name}) + run_cmake(${name}-default) + unset(RunCMake_TEST_OPTIONS) + set(RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" -DTEST_NAME=${name} -DCMAKE_MAXIMUM_RECURSION_DEPTH=10) + run_cmake(${name}-var) + unset(RunCMake_TEST_OPTIONS) + set(RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" -DTEST_NAME=${name} -DCMAKE_MAXIMUM_RECURSION_DEPTH=a) + run_cmake(${name}-invalid-var) + unset(RunCMake_TEST_OPTIONS) + + run_cmake_command(${name}-default-script ${CMAKE_COMMAND} "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" -DTEST_NAME=${name} -P "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt") + run_cmake_command(${name}-var-script ${CMAKE_COMMAND} "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" -DTEST_NAME=${name} -DCMAKE_MAXIMUM_RECURSION_DEPTH=10 -P "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt") + run_cmake_command(${name}-invalid-var-script ${CMAKE_COMMAND} "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" -DTEST_NAME=${name} -DCMAKE_MAXIMUM_RECURSION_DEPTH=a -P "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt") +endfunction() + +function(run_ctest_recursive name) + run_ctest(${name}-default "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" -DTEST_NAME=${name}) + run_ctest(${name}-var "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" -DTEST_NAME=${name} -DCMAKE_MAXIMUM_RECURSION_DEPTH=10) + run_ctest(${name}-invalid-var "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" -DTEST_NAME=${name} -DCMAKE_MAXIMUM_RECURSION_DEPTH=a) +endfunction() + +run_cmake_recursive(function) +run_cmake_recursive(macro) +run_cmake_recursive(include) +run_cmake_recursive(find_package) +run_cmake_recursive(variable_watch) + +# We run these tests separately and only with a small limit because they are +# taxing and slow. The "implicit" and "invalid" cases are already thoroughly +# covered by the other tests above. +set(RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" -DTEST_NAME=add_subdirectory -DCMAKE_MAXIMUM_RECURSION_DEPTH=10) +run_cmake(add_subdirectory-var) +unset(RunCMake_TEST_OPTIONS) +set(RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" -DTEST_NAME=try_compile -DCMAKE_MAXIMUM_RECURSION_DEPTH=10) +run_cmake(try_compile-var) +unset(RunCMake_TEST_OPTIONS) + +run_ctest_recursive(ctest_read_custom_files) + +# We run the ctest_run_script() test separately and only with an explicit limit +# because ctest_run_script() is taxing and slow, and because the implicit +# recursion limit is hit by CTestScriptMode.cmake before we can test it +# properly. The "implicit" and "invalid" cases are already thoroughly covered +# by the other tests above. +run_ctest(ctest_run_script-var "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" -DTEST_NAME=ctest_run_script -DCMAKE_MAXIMUM_RECURSION_DEPTH=10) diff --git a/Tests/RunCMake/MaxRecursionDepth/add_subdirectory-var-result.txt b/Tests/RunCMake/MaxRecursionDepth/add_subdirectory-var-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/add_subdirectory-var-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/add_subdirectory-var-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/add_subdirectory-var-stderr.txt new file mode 100644 index 0000000..23fb5c6 --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/add_subdirectory-var-stderr.txt @@ -0,0 +1,10 @@ +^3 +4 +5 +6 +7 +8 +9 +10 +CMake Error at add_subdirectory/CMakeLists\.txt:1 \(message\): + Maximum recursion depth of 10 exceeded$ diff --git a/Tests/RunCMake/MaxRecursionDepth/add_subdirectory.cmake b/Tests/RunCMake/MaxRecursionDepth/add_subdirectory.cmake new file mode 100644 index 0000000..36c21f3 --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/add_subdirectory.cmake @@ -0,0 +1,2 @@ +set(x 3) +add_subdirectory(add_subdirectory) diff --git a/Tests/RunCMake/MaxRecursionDepth/add_subdirectory/CMakeLists.txt b/Tests/RunCMake/MaxRecursionDepth/add_subdirectory/CMakeLists.txt new file mode 100644 index 0000000..a8244af --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/add_subdirectory/CMakeLists.txt @@ -0,0 +1,3 @@ +message("${x}") +math(EXPR x "${x} + 1") +add_subdirectory(. dir) diff --git a/Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-default-result.txt b/Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-default-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-default-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-default-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-default-stderr.txt new file mode 100644 index 0000000..7dbbb3e --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-default-stderr.txt @@ -0,0 +1,5 @@ +[0-9]+ +CMake Error at .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake:1 \(message\): + Maximum recursion depth of [0-9]+ exceeded +Call Stack \(most recent call first\): + .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake:3 \(ctest_read_custom_files\) diff --git a/Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-invalid-var-result.txt b/Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-invalid-var-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-invalid-var-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-invalid-var-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-invalid-var-stderr.txt new file mode 100644 index 0000000..7dbbb3e --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-invalid-var-stderr.txt @@ -0,0 +1,5 @@ +[0-9]+ +CMake Error at .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake:1 \(message\): + Maximum recursion depth of [0-9]+ exceeded +Call Stack \(most recent call first\): + .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake:3 \(ctest_read_custom_files\) diff --git a/Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-var-result.txt b/Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-var-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-var-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-var-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-var-stderr.txt new file mode 100644 index 0000000..bc89703 --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-var-stderr.txt @@ -0,0 +1,34 @@ +^2 +3 +4 +5 +6 +7 +8 +9 +10 +CMake Error at .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake:1 \(message\): + Maximum recursion depth of 10 exceeded +Call Stack \(most recent call first\): + .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake:3 \(ctest_read_custom_files\) + .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake:3 \(ctest_read_custom_files\) + .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake:3 \(ctest_read_custom_files\) + .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake:3 \(ctest_read_custom_files\) + .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake:3 \(ctest_read_custom_files\) + .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake:3 \(ctest_read_custom_files\) + .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake:3 \(ctest_read_custom_files\) + .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake:3 \(ctest_read_custom_files\) + .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake:3 \(ctest_read_custom_files\) + .*/Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-var/test\.cmake:10 \(ctest_read_custom_files\) + + +Problem reading custom configuration: .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake +Problem reading custom configuration: .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake +Problem reading custom configuration: .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake +Problem reading custom configuration: .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake +Problem reading custom configuration: .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake +Problem reading custom configuration: .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake +Problem reading custom configuration: .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake +Problem reading custom configuration: .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake +Problem reading custom configuration: .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake +Problem reading custom configuration: .*/Tests/RunCMake/MaxRecursionDepth/CTestCustom\.cmake$ diff --git a/Tests/RunCMake/MaxRecursionDepth/ctest_run_script-var-result.txt b/Tests/RunCMake/MaxRecursionDepth/ctest_run_script-var-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/ctest_run_script-var-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/MaxRecursionDepth/ctest_run_script-var-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/ctest_run_script-var-stderr.txt new file mode 100644 index 0000000..b10b26d --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/ctest_run_script-var-stderr.txt @@ -0,0 +1,51 @@ +^2 +3 +4 +5 +6 +7 +8 +9 +10 +CMake Error at .*/Tests/RunCMake/MaxRecursionDepth/ctest_run_script_11\.cmake:1 \(cmake_minimum_required\): + Maximum recursion depth of 10 exceeded + + +CMake Error at .*/Tests/RunCMake/MaxRecursionDepth/ctest_run_script_10\.cmake:13 \(message\): + Nested script failed + + +CMake Error at .*/Tests/RunCMake/MaxRecursionDepth/ctest_run_script_9\.cmake:13 \(message\): + Nested script failed + + +CMake Error at .*/Tests/RunCMake/MaxRecursionDepth/ctest_run_script_8\.cmake:13 \(message\): + Nested script failed + + +CMake Error at .*/Tests/RunCMake/MaxRecursionDepth/ctest_run_script_7\.cmake:13 \(message\): + Nested script failed + + +CMake Error at .*/Tests/RunCMake/MaxRecursionDepth/ctest_run_script_6\.cmake:13 \(message\): + Nested script failed + + +CMake Error at .*/Tests/RunCMake/MaxRecursionDepth/ctest_run_script_5\.cmake:13 \(message\): + Nested script failed + + +CMake Error at .*/Tests/RunCMake/MaxRecursionDepth/ctest_run_script_4\.cmake:13 \(message\): + Nested script failed + + +CMake Error at .*/Tests/RunCMake/MaxRecursionDepth/ctest_run_script_3\.cmake:13 \(message\): + Nested script failed + + +CMake Error at .*/Tests/RunCMake/MaxRecursionDepth/ctest_run_script_2\.cmake:13 \(message\): + Nested script failed + + +CMake Error at .*/Tests/RunCMake/MaxRecursionDepth/ctest_run_script-var/test\.cmake:19 \(message\): + Nested script failed$ diff --git a/Tests/RunCMake/MaxRecursionDepth/ctest_run_script.cmake.in b/Tests/RunCMake/MaxRecursionDepth/ctest_run_script.cmake.in new file mode 100644 index 0000000..d4f28c4 --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/ctest_run_script.cmake.in @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.12) +set(CTEST_RUN_CURRENT_SCRIPT 0) + +message("@LEVEL_CURRENT@") + +set(CTEST_SOURCE_DIRECTORY "@CTEST_SOURCE_DIRECTORY@") +set(CTEST_BINARY_DIRECTORY "@CTEST_BINARY_DIRECTORY@") +set(CTEST_COMMAND "@CTEST_COMMAND@") + +ctest_run_script("${CMAKE_CURRENT_LIST_DIR}/ctest_run_script_ at LEVEL_NEXT@.cmake" RETURN_VALUE val) + +if(NOT val EQUAL 0) + message(FATAL_ERROR "Nested script failed") +endif() diff --git a/Tests/RunCMake/MaxRecursionDepth/find_package-default-result.txt b/Tests/RunCMake/MaxRecursionDepth/find_package-default-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/find_package-default-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/find_package-default-script-result.txt b/Tests/RunCMake/MaxRecursionDepth/find_package-default-script-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/find_package-default-script-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/find_package-default-script-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/find_package-default-script-stderr.txt new file mode 100644 index 0000000..b8557ab --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/find_package-default-script-stderr.txt @@ -0,0 +1,5 @@ +[0-9]+ +CMake Error at .*/FindRecursivePackage\.cmake:1 \(message\): + Maximum recursion depth of [0-9]+ exceeded +Call Stack \(most recent call first\): + .*/FindRecursivePackage\.cmake:3 \(find_package\) diff --git a/Tests/RunCMake/MaxRecursionDepth/find_package-default-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/find_package-default-stderr.txt new file mode 100644 index 0000000..5d31e29 --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/find_package-default-stderr.txt @@ -0,0 +1,5 @@ +[0-9]+ +CMake Error at FindRecursivePackage\.cmake:1 \(message\): + Maximum recursion depth of [0-9]+ exceeded +Call Stack \(most recent call first\): + FindRecursivePackage\.cmake:3 \(find_package\) diff --git a/Tests/RunCMake/MaxRecursionDepth/find_package-invalid-var-result.txt b/Tests/RunCMake/MaxRecursionDepth/find_package-invalid-var-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/find_package-invalid-var-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/find_package-invalid-var-script-result.txt b/Tests/RunCMake/MaxRecursionDepth/find_package-invalid-var-script-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/find_package-invalid-var-script-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/find_package-invalid-var-script-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/find_package-invalid-var-script-stderr.txt new file mode 100644 index 0000000..b8557ab --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/find_package-invalid-var-script-stderr.txt @@ -0,0 +1,5 @@ +[0-9]+ +CMake Error at .*/FindRecursivePackage\.cmake:1 \(message\): + Maximum recursion depth of [0-9]+ exceeded +Call Stack \(most recent call first\): + .*/FindRecursivePackage\.cmake:3 \(find_package\) diff --git a/Tests/RunCMake/MaxRecursionDepth/find_package-invalid-var-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/find_package-invalid-var-stderr.txt new file mode 100644 index 0000000..5d31e29 --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/find_package-invalid-var-stderr.txt @@ -0,0 +1,5 @@ +[0-9]+ +CMake Error at FindRecursivePackage\.cmake:1 \(message\): + Maximum recursion depth of [0-9]+ exceeded +Call Stack \(most recent call first\): + FindRecursivePackage\.cmake:3 \(find_package\) diff --git a/Tests/RunCMake/MaxRecursionDepth/find_package-var-result.txt b/Tests/RunCMake/MaxRecursionDepth/find_package-var-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/find_package-var-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/find_package-var-script-result.txt b/Tests/RunCMake/MaxRecursionDepth/find_package-var-script-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/find_package-var-script-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/find_package-var-script-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/find_package-var-script-stderr.txt new file mode 100644 index 0000000..5314551 --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/find_package-var-script-stderr.txt @@ -0,0 +1,21 @@ +^3 +4 +5 +6 +7 +8 +9 +10 +CMake Error at .*/FindRecursivePackage\.cmake:1 \(message\): + Maximum recursion depth of 10 exceeded +Call Stack \(most recent call first\): + .*/FindRecursivePackage\.cmake:3 \(find_package\) + .*/FindRecursivePackage\.cmake:3 \(find_package\) + .*/FindRecursivePackage\.cmake:3 \(find_package\) + .*/FindRecursivePackage\.cmake:3 \(find_package\) + .*/FindRecursivePackage\.cmake:3 \(find_package\) + .*/FindRecursivePackage\.cmake:3 \(find_package\) + .*/FindRecursivePackage\.cmake:3 \(find_package\) + .*/FindRecursivePackage\.cmake:3 \(find_package\) + .*/find_package\.cmake:2 \(find_package\) + .*/CMakeLists\.txt:5 \(include\)$ diff --git a/Tests/RunCMake/MaxRecursionDepth/find_package-var-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/find_package-var-stderr.txt new file mode 100644 index 0000000..b47a13a --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/find_package-var-stderr.txt @@ -0,0 +1,21 @@ +^3 +4 +5 +6 +7 +8 +9 +10 +CMake Error at FindRecursivePackage\.cmake:1 \(message\): + Maximum recursion depth of 10 exceeded +Call Stack \(most recent call first\): + FindRecursivePackage\.cmake:3 \(find_package\) + FindRecursivePackage\.cmake:3 \(find_package\) + FindRecursivePackage\.cmake:3 \(find_package\) + FindRecursivePackage\.cmake:3 \(find_package\) + FindRecursivePackage\.cmake:3 \(find_package\) + FindRecursivePackage\.cmake:3 \(find_package\) + FindRecursivePackage\.cmake:3 \(find_package\) + FindRecursivePackage\.cmake:3 \(find_package\) + find_package\.cmake:2 \(find_package\) + CMakeLists\.txt:5 \(include\)$ diff --git a/Tests/RunCMake/MaxRecursionDepth/find_package.cmake b/Tests/RunCMake/MaxRecursionDepth/find_package.cmake new file mode 100644 index 0000000..a235f7d --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/find_package.cmake @@ -0,0 +1,2 @@ +set(x 3) +find_package(RecursivePackage) diff --git a/Tests/RunCMake/MaxRecursionDepth/function-default-result.txt b/Tests/RunCMake/MaxRecursionDepth/function-default-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/function-default-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/function-default-script-result.txt b/Tests/RunCMake/MaxRecursionDepth/function-default-script-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/function-default-script-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/function-default-script-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/function-default-script-stderr.txt new file mode 100644 index 0000000..92de1fb --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/function-default-script-stderr.txt @@ -0,0 +1,5 @@ +[0-9]+ +CMake Error at .*/function\.cmake:2 \(message\): + Maximum recursion depth of [0-9]+ exceeded +Call Stack \(most recent call first\): + .*/function\.cmake:4 \(recursive\) diff --git a/Tests/RunCMake/MaxRecursionDepth/function-default-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/function-default-stderr.txt new file mode 100644 index 0000000..5c25c4b --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/function-default-stderr.txt @@ -0,0 +1,5 @@ +[0-9]+ +CMake Error at function\.cmake:2 \(message\): + Maximum recursion depth of [0-9]+ exceeded +Call Stack \(most recent call first\): + function\.cmake:4 \(recursive\) diff --git a/Tests/RunCMake/MaxRecursionDepth/function-invalid-var-result.txt b/Tests/RunCMake/MaxRecursionDepth/function-invalid-var-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/function-invalid-var-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/function-invalid-var-script-result.txt b/Tests/RunCMake/MaxRecursionDepth/function-invalid-var-script-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/function-invalid-var-script-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/function-invalid-var-script-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/function-invalid-var-script-stderr.txt new file mode 100644 index 0000000..92de1fb --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/function-invalid-var-script-stderr.txt @@ -0,0 +1,5 @@ +[0-9]+ +CMake Error at .*/function\.cmake:2 \(message\): + Maximum recursion depth of [0-9]+ exceeded +Call Stack \(most recent call first\): + .*/function\.cmake:4 \(recursive\) diff --git a/Tests/RunCMake/MaxRecursionDepth/function-invalid-var-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/function-invalid-var-stderr.txt new file mode 100644 index 0000000..5c25c4b --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/function-invalid-var-stderr.txt @@ -0,0 +1,5 @@ +[0-9]+ +CMake Error at function\.cmake:2 \(message\): + Maximum recursion depth of [0-9]+ exceeded +Call Stack \(most recent call first\): + function\.cmake:4 \(recursive\) diff --git a/Tests/RunCMake/MaxRecursionDepth/function-var-result.txt b/Tests/RunCMake/MaxRecursionDepth/function-var-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/function-var-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/function-var-script-result.txt b/Tests/RunCMake/MaxRecursionDepth/function-var-script-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/function-var-script-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/function-var-script-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/function-var-script-stderr.txt new file mode 100644 index 0000000..61304b1 --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/function-var-script-stderr.txt @@ -0,0 +1,21 @@ +^3 +4 +5 +6 +7 +8 +9 +10 +CMake Error at .*/function\.cmake:2 \(message\): + Maximum recursion depth of 10 exceeded +Call Stack \(most recent call first\): + .*/function\.cmake:4 \(recursive\) + .*/function\.cmake:4 \(recursive\) + .*/function\.cmake:4 \(recursive\) + .*/function\.cmake:4 \(recursive\) + .*/function\.cmake:4 \(recursive\) + .*/function\.cmake:4 \(recursive\) + .*/function\.cmake:4 \(recursive\) + .*/function\.cmake:4 \(recursive\) + .*/function\.cmake:7 \(recursive\) + .*/CMakeLists\.txt:5 \(include\)$ diff --git a/Tests/RunCMake/MaxRecursionDepth/function-var-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/function-var-stderr.txt new file mode 100644 index 0000000..54e72af --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/function-var-stderr.txt @@ -0,0 +1,21 @@ +^3 +4 +5 +6 +7 +8 +9 +10 +CMake Error at function\.cmake:2 \(message\): + Maximum recursion depth of 10 exceeded +Call Stack \(most recent call first\): + function\.cmake:4 \(recursive\) + function\.cmake:4 \(recursive\) + function\.cmake:4 \(recursive\) + function\.cmake:4 \(recursive\) + function\.cmake:4 \(recursive\) + function\.cmake:4 \(recursive\) + function\.cmake:4 \(recursive\) + function\.cmake:4 \(recursive\) + function\.cmake:7 \(recursive\) + CMakeLists\.txt:5 \(include\)$ diff --git a/Tests/RunCMake/MaxRecursionDepth/function.cmake b/Tests/RunCMake/MaxRecursionDepth/function.cmake new file mode 100644 index 0000000..581cb89 --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/function.cmake @@ -0,0 +1,7 @@ +function(recursive x) + message("${x}") + math(EXPR y "${x} + 1") + recursive(${y}) +endfunction() + +recursive(3) diff --git a/Tests/RunCMake/MaxRecursionDepth/include-default-result.txt b/Tests/RunCMake/MaxRecursionDepth/include-default-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/include-default-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/include-default-script-result.txt b/Tests/RunCMake/MaxRecursionDepth/include-default-script-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/include-default-script-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/include-default-script-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/include-default-script-stderr.txt new file mode 100644 index 0000000..0510e7c --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/include-default-script-stderr.txt @@ -0,0 +1,5 @@ +[0-9]+ +CMake Error at .*/include_recursive\.cmake:1 \(message\): + Maximum recursion depth of [0-9]+ exceeded +Call Stack \(most recent call first\): + .*/include_recursive\.cmake:3 \(include\) diff --git a/Tests/RunCMake/MaxRecursionDepth/include-default-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/include-default-stderr.txt new file mode 100644 index 0000000..b1494a8 --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/include-default-stderr.txt @@ -0,0 +1,5 @@ +[0-9]+ +CMake Error at include_recursive\.cmake:1 \(message\): + Maximum recursion depth of [0-9]+ exceeded +Call Stack \(most recent call first\): + include_recursive\.cmake:3 \(include\) diff --git a/Tests/RunCMake/MaxRecursionDepth/include-invalid-var-result.txt b/Tests/RunCMake/MaxRecursionDepth/include-invalid-var-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/include-invalid-var-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/include-invalid-var-script-result.txt b/Tests/RunCMake/MaxRecursionDepth/include-invalid-var-script-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/include-invalid-var-script-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/include-invalid-var-script-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/include-invalid-var-script-stderr.txt new file mode 100644 index 0000000..0510e7c --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/include-invalid-var-script-stderr.txt @@ -0,0 +1,5 @@ +[0-9]+ +CMake Error at .*/include_recursive\.cmake:1 \(message\): + Maximum recursion depth of [0-9]+ exceeded +Call Stack \(most recent call first\): + .*/include_recursive\.cmake:3 \(include\) diff --git a/Tests/RunCMake/MaxRecursionDepth/include-invalid-var-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/include-invalid-var-stderr.txt new file mode 100644 index 0000000..b1494a8 --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/include-invalid-var-stderr.txt @@ -0,0 +1,5 @@ +[0-9]+ +CMake Error at include_recursive\.cmake:1 \(message\): + Maximum recursion depth of [0-9]+ exceeded +Call Stack \(most recent call first\): + include_recursive\.cmake:3 \(include\) diff --git a/Tests/RunCMake/MaxRecursionDepth/include-var-result.txt b/Tests/RunCMake/MaxRecursionDepth/include-var-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/include-var-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/include-var-script-result.txt b/Tests/RunCMake/MaxRecursionDepth/include-var-script-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/include-var-script-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/include-var-script-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/include-var-script-stderr.txt new file mode 100644 index 0000000..f55f505 --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/include-var-script-stderr.txt @@ -0,0 +1,21 @@ +^3 +4 +5 +6 +7 +8 +9 +10 +CMake Error at .*/include_recursive\.cmake:1 \(message\): + Maximum recursion depth of 10 exceeded +Call Stack \(most recent call first\): + .*/include_recursive\.cmake:3 \(include\) + .*/include_recursive\.cmake:3 \(include\) + .*/include_recursive\.cmake:3 \(include\) + .*/include_recursive\.cmake:3 \(include\) + .*/include_recursive\.cmake:3 \(include\) + .*/include_recursive\.cmake:3 \(include\) + .*/include_recursive\.cmake:3 \(include\) + .*/include_recursive\.cmake:3 \(include\) + .*/include\.cmake:2 \(include\) + .*/CMakeLists\.txt:5 \(include\)$ diff --git a/Tests/RunCMake/MaxRecursionDepth/include-var-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/include-var-stderr.txt new file mode 100644 index 0000000..ff33985 --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/include-var-stderr.txt @@ -0,0 +1,21 @@ +^3 +4 +5 +6 +7 +8 +9 +10 +CMake Error at include_recursive\.cmake:1 \(message\): + Maximum recursion depth of 10 exceeded +Call Stack \(most recent call first\): + include_recursive\.cmake:3 \(include\) + include_recursive\.cmake:3 \(include\) + include_recursive\.cmake:3 \(include\) + include_recursive\.cmake:3 \(include\) + include_recursive\.cmake:3 \(include\) + include_recursive\.cmake:3 \(include\) + include_recursive\.cmake:3 \(include\) + include_recursive\.cmake:3 \(include\) + include\.cmake:2 \(include\) + CMakeLists\.txt:5 \(include\)$ diff --git a/Tests/RunCMake/MaxRecursionDepth/include.cmake b/Tests/RunCMake/MaxRecursionDepth/include.cmake new file mode 100644 index 0000000..5e86a40 --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/include.cmake @@ -0,0 +1,2 @@ +set(x 3) +include("${CMAKE_CURRENT_LIST_DIR}/include_recursive.cmake") diff --git a/Tests/RunCMake/MaxRecursionDepth/include_recursive.cmake b/Tests/RunCMake/MaxRecursionDepth/include_recursive.cmake new file mode 100644 index 0000000..b3f744e --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/include_recursive.cmake @@ -0,0 +1,3 @@ +message("${x}") +math(EXPR x "${x} + 1") +include("${CMAKE_CURRENT_LIST_FILE}") diff --git a/Tests/RunCMake/MaxRecursionDepth/macro-default-result.txt b/Tests/RunCMake/MaxRecursionDepth/macro-default-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/macro-default-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/macro-default-script-result.txt b/Tests/RunCMake/MaxRecursionDepth/macro-default-script-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/macro-default-script-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/macro-default-script-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/macro-default-script-stderr.txt new file mode 100644 index 0000000..c67be57 --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/macro-default-script-stderr.txt @@ -0,0 +1,5 @@ +[0-9]+ +CMake Error at .*/macro\.cmake:2 \(message\): + Maximum recursion depth of [0-9]+ exceeded +Call Stack \(most recent call first\): + .*/macro\.cmake:4 \(recursive\) diff --git a/Tests/RunCMake/MaxRecursionDepth/macro-default-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/macro-default-stderr.txt new file mode 100644 index 0000000..0b27162 --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/macro-default-stderr.txt @@ -0,0 +1,5 @@ +[0-9]+ +CMake Error at macro\.cmake:2 \(message\): + Maximum recursion depth of [0-9]+ exceeded +Call Stack \(most recent call first\): + macro\.cmake:4 \(recursive\) diff --git a/Tests/RunCMake/MaxRecursionDepth/macro-invalid-var-result.txt b/Tests/RunCMake/MaxRecursionDepth/macro-invalid-var-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/macro-invalid-var-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/macro-invalid-var-script-result.txt b/Tests/RunCMake/MaxRecursionDepth/macro-invalid-var-script-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/macro-invalid-var-script-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/macro-invalid-var-script-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/macro-invalid-var-script-stderr.txt new file mode 100644 index 0000000..c67be57 --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/macro-invalid-var-script-stderr.txt @@ -0,0 +1,5 @@ +[0-9]+ +CMake Error at .*/macro\.cmake:2 \(message\): + Maximum recursion depth of [0-9]+ exceeded +Call Stack \(most recent call first\): + .*/macro\.cmake:4 \(recursive\) diff --git a/Tests/RunCMake/MaxRecursionDepth/macro-invalid-var-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/macro-invalid-var-stderr.txt new file mode 100644 index 0000000..0b27162 --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/macro-invalid-var-stderr.txt @@ -0,0 +1,5 @@ +[0-9]+ +CMake Error at macro\.cmake:2 \(message\): + Maximum recursion depth of [0-9]+ exceeded +Call Stack \(most recent call first\): + macro\.cmake:4 \(recursive\) diff --git a/Tests/RunCMake/MaxRecursionDepth/macro-var-result.txt b/Tests/RunCMake/MaxRecursionDepth/macro-var-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/macro-var-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/macro-var-script-result.txt b/Tests/RunCMake/MaxRecursionDepth/macro-var-script-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/macro-var-script-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/macro-var-script-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/macro-var-script-stderr.txt new file mode 100644 index 0000000..142e068 --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/macro-var-script-stderr.txt @@ -0,0 +1,21 @@ +^3 +4 +5 +6 +7 +8 +9 +10 +CMake Error at .*/macro\.cmake:2 \(message\): + Maximum recursion depth of 10 exceeded +Call Stack \(most recent call first\): + .*/macro\.cmake:4 \(recursive\) + .*/macro\.cmake:4 \(recursive\) + .*/macro\.cmake:4 \(recursive\) + .*/macro\.cmake:4 \(recursive\) + .*/macro\.cmake:4 \(recursive\) + .*/macro\.cmake:4 \(recursive\) + .*/macro\.cmake:4 \(recursive\) + .*/macro\.cmake:4 \(recursive\) + .*/macro\.cmake:7 \(recursive\) + .*/CMakeLists\.txt:5 \(include\)$ diff --git a/Tests/RunCMake/MaxRecursionDepth/macro-var-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/macro-var-stderr.txt new file mode 100644 index 0000000..71de553 --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/macro-var-stderr.txt @@ -0,0 +1,21 @@ +^3 +4 +5 +6 +7 +8 +9 +10 +CMake Error at macro\.cmake:2 \(message\): + Maximum recursion depth of 10 exceeded +Call Stack \(most recent call first\): + macro\.cmake:4 \(recursive\) + macro\.cmake:4 \(recursive\) + macro\.cmake:4 \(recursive\) + macro\.cmake:4 \(recursive\) + macro\.cmake:4 \(recursive\) + macro\.cmake:4 \(recursive\) + macro\.cmake:4 \(recursive\) + macro\.cmake:4 \(recursive\) + macro\.cmake:7 \(recursive\) + CMakeLists\.txt:5 \(include\)$ diff --git a/Tests/RunCMake/MaxRecursionDepth/macro.cmake b/Tests/RunCMake/MaxRecursionDepth/macro.cmake new file mode 100644 index 0000000..a7cbfc2 --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/macro.cmake @@ -0,0 +1,7 @@ +macro(recursive x) + message("${x}") + math(EXPR y "${x} + 1") + recursive(${y}) +endmacro() + +recursive(3) diff --git a/Tests/RunCMake/MaxRecursionDepth/test.cmake.in b/Tests/RunCMake/MaxRecursionDepth/test.cmake.in new file mode 100644 index 0000000..fd1fc10 --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/test.cmake.in @@ -0,0 +1,21 @@ +cmake_minimum_required(VERSION 3.12) +set(CTEST_RUN_CURRENT_SCRIPT 0) + +set(CTEST_SOURCE_DIRECTORY "@RunCMake_SOURCE_DIR@") +set(CTEST_BINARY_DIRECTORY "@RunCMake_BINARY_DIR@") +set(CTEST_COMMAND "${CMAKE_CTEST_COMMAND}") + +if(TEST_NAME STREQUAL "ctest_read_custom_files") + set(x 2) + ctest_read_custom_files("@RunCMake_SOURCE_DIR@") +elseif(TEST_NAME STREQUAL "ctest_run_script") + foreach(LEVEL_CURRENT RANGE 2 15) + math(EXPR LEVEL_NEXT "${LEVEL_CURRENT} + 1") + configure_file("@RunCMake_SOURCE_DIR@/ctest_run_script.cmake.in" "@RunCMake_BINARY_DIR@/ctest_run_script_${LEVEL_CURRENT}.cmake" @ONLY) + endforeach() + + ctest_run_script("@RunCMake_BINARY_DIR@/ctest_run_script_2.cmake" RETURN_VALUE val) + if(NOT val EQUAL 0) + message(FATAL_ERROR "Nested script failed") + endif() +endif() diff --git a/Tests/RunCMake/MaxRecursionDepth/try_compile-var-result.txt b/Tests/RunCMake/MaxRecursionDepth/try_compile-var-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/try_compile-var-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/try_compile-var-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/try_compile-var-stderr.txt new file mode 100644 index 0000000..130db34 --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/try_compile-var-stderr.txt @@ -0,0 +1,48 @@ +^3 +4 +5 +6 +7 +8 +9 +10 +CMake Error at .*/Tests/RunCMake/MaxRecursionDepth/try_compile/CMakeLists\.txt:1 \(cmake_minimum_required\): + Maximum recursion depth of 10 exceeded + + +CMake Error at .*/Tests/RunCMake/MaxRecursionDepth/try_compile/CMakeLists\.txt:5 \(try_compile\): + Failed to configure test project build system\. + + +CMake Error at .*/Tests/RunCMake/MaxRecursionDepth/try_compile/CMakeLists\.txt:5 \(try_compile\): + Failed to configure test project build system\. + + +CMake Error at .*/Tests/RunCMake/MaxRecursionDepth/try_compile/CMakeLists\.txt:5 \(try_compile\): + Failed to configure test project build system\. + + +CMake Error at .*/Tests/RunCMake/MaxRecursionDepth/try_compile/CMakeLists\.txt:5 \(try_compile\): + Failed to configure test project build system\. + + +CMake Error at .*/Tests/RunCMake/MaxRecursionDepth/try_compile/CMakeLists\.txt:5 \(try_compile\): + Failed to configure test project build system\. + + +CMake Error at .*/Tests/RunCMake/MaxRecursionDepth/try_compile/CMakeLists\.txt:5 \(try_compile\): + Failed to configure test project build system\. + + +CMake Error at .*/Tests/RunCMake/MaxRecursionDepth/try_compile/CMakeLists\.txt:5 \(try_compile\): + Failed to configure test project build system\. + + +CMake Error at .*/Tests/RunCMake/MaxRecursionDepth/try_compile/CMakeLists\.txt:5 \(try_compile\): + Failed to configure test project build system\. + + +CMake Error at try_compile\.cmake:1 \(try_compile\): + Failed to configure test project build system\. +Call Stack \(most recent call first\): + CMakeLists\.txt:5 \(include\)$ diff --git a/Tests/RunCMake/MaxRecursionDepth/try_compile.cmake b/Tests/RunCMake/MaxRecursionDepth/try_compile.cmake new file mode 100644 index 0000000..c40fb06 --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/try_compile.cmake @@ -0,0 +1,6 @@ +try_compile(result + "${CMAKE_CURRENT_BINARY_DIR}/try_compile" + "${CMAKE_CURRENT_SOURCE_DIR}/try_compile" + try_compile + CMAKE_FLAGS -Dx:STRING=3 + ) diff --git a/Tests/RunCMake/MaxRecursionDepth/try_compile/CMakeLists.txt b/Tests/RunCMake/MaxRecursionDepth/try_compile/CMakeLists.txt new file mode 100644 index 0000000..2271090 --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/try_compile/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.12) + +message("${x}") +math(EXPR x "${x} + 1") +try_compile(result + "${CMAKE_CURRENT_BINARY_DIR}/try_compile" + "${CMAKE_CURRENT_SOURCE_DIR}" + try_compile + CMAKE_FLAGS -Dx:STRING=${x} + ) + +# We put this last to avoid prematurely triggering the recursion limit +project(try_compile NONE) diff --git a/Tests/RunCMake/MaxRecursionDepth/variable_watch-default-result.txt b/Tests/RunCMake/MaxRecursionDepth/variable_watch-default-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/variable_watch-default-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/variable_watch-default-script-result.txt b/Tests/RunCMake/MaxRecursionDepth/variable_watch-default-script-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/variable_watch-default-script-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/variable_watch-default-script-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/variable_watch-default-script-stderr.txt new file mode 100644 index 0000000..4dddc96 --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/variable_watch-default-script-stderr.txt @@ -0,0 +1,6 @@ +[0-9]+ +CMake Error at .*/variable_watch\.cmake:9999 \(update_x\): + Maximum recursion depth of [0-9]+ exceeded +Call Stack \(most recent call first\): + .*/variable_watch\.cmake:5 \(set\) + .*/variable_watch\.cmake:9999 \(update_x\) diff --git a/Tests/RunCMake/MaxRecursionDepth/variable_watch-default-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/variable_watch-default-stderr.txt new file mode 100644 index 0000000..a8b4756 --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/variable_watch-default-stderr.txt @@ -0,0 +1,6 @@ +[0-9]+ +CMake Error at variable_watch\.cmake:9999 \(update_x\): + Maximum recursion depth of [0-9]+ exceeded +Call Stack \(most recent call first\): + variable_watch\.cmake:5 \(set\) + variable_watch\.cmake:9999 \(update_x\) diff --git a/Tests/RunCMake/MaxRecursionDepth/variable_watch-invalid-var-result.txt b/Tests/RunCMake/MaxRecursionDepth/variable_watch-invalid-var-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/variable_watch-invalid-var-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/variable_watch-invalid-var-script-result.txt b/Tests/RunCMake/MaxRecursionDepth/variable_watch-invalid-var-script-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/variable_watch-invalid-var-script-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/variable_watch-invalid-var-script-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/variable_watch-invalid-var-script-stderr.txt new file mode 100644 index 0000000..4dddc96 --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/variable_watch-invalid-var-script-stderr.txt @@ -0,0 +1,6 @@ +[0-9]+ +CMake Error at .*/variable_watch\.cmake:9999 \(update_x\): + Maximum recursion depth of [0-9]+ exceeded +Call Stack \(most recent call first\): + .*/variable_watch\.cmake:5 \(set\) + .*/variable_watch\.cmake:9999 \(update_x\) diff --git a/Tests/RunCMake/MaxRecursionDepth/variable_watch-invalid-var-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/variable_watch-invalid-var-stderr.txt new file mode 100644 index 0000000..a8b4756 --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/variable_watch-invalid-var-stderr.txt @@ -0,0 +1,6 @@ +[0-9]+ +CMake Error at variable_watch\.cmake:9999 \(update_x\): + Maximum recursion depth of [0-9]+ exceeded +Call Stack \(most recent call first\): + variable_watch\.cmake:5 \(set\) + variable_watch\.cmake:9999 \(update_x\) diff --git a/Tests/RunCMake/MaxRecursionDepth/variable_watch-var-result.txt b/Tests/RunCMake/MaxRecursionDepth/variable_watch-var-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/variable_watch-var-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/variable_watch-var-script-result.txt b/Tests/RunCMake/MaxRecursionDepth/variable_watch-var-script-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/variable_watch-var-script-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/MaxRecursionDepth/variable_watch-var-script-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/variable_watch-var-script-stderr.txt new file mode 100644 index 0000000..00b2b3c --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/variable_watch-var-script-stderr.txt @@ -0,0 +1,22 @@ +^4 +6 +8 +10 +CMake Error at .*/variable_watch\.cmake:9999 \(update_x\): + Maximum recursion depth of 10 exceeded +Call Stack \(most recent call first\): + .*/variable_watch\.cmake:5 \(set\) + .*/variable_watch\.cmake:9999 \(update_x\) + .*/variable_watch\.cmake:5 \(set\) + .*/variable_watch\.cmake:9999 \(update_x\) + .*/variable_watch\.cmake:5 \(set\) + .*/variable_watch\.cmake:9999 \(update_x\) + .*/variable_watch\.cmake:5 \(set\) + .*/variable_watch\.cmake:9999 \(update_x\) + .*/variable_watch\.cmake:9 \(set\) + .*/CMakeLists\.txt:5 \(include\) + + +CMake Error: Error in cmake code at +Unknown:0: +A command failed during the invocation of callback "update_x"\.$ diff --git a/Tests/RunCMake/MaxRecursionDepth/variable_watch-var-stderr.txt b/Tests/RunCMake/MaxRecursionDepth/variable_watch-var-stderr.txt new file mode 100644 index 0000000..8f27bf1 --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/variable_watch-var-stderr.txt @@ -0,0 +1,22 @@ +^4 +6 +8 +10 +CMake Error at variable_watch\.cmake:9999 \(update_x\): + Maximum recursion depth of 10 exceeded +Call Stack \(most recent call first\): + variable_watch\.cmake:5 \(set\) + variable_watch\.cmake:9999 \(update_x\) + variable_watch\.cmake:5 \(set\) + variable_watch\.cmake:9999 \(update_x\) + variable_watch\.cmake:5 \(set\) + variable_watch\.cmake:9999 \(update_x\) + variable_watch\.cmake:5 \(set\) + variable_watch\.cmake:9999 \(update_x\) + variable_watch\.cmake:9 \(set\) + CMakeLists\.txt:5 \(include\) + + +CMake Error: Error in cmake code at +Unknown:0: +A command failed during the invocation of callback "update_x"\.$ diff --git a/Tests/RunCMake/MaxRecursionDepth/variable_watch.cmake b/Tests/RunCMake/MaxRecursionDepth/variable_watch.cmake new file mode 100644 index 0000000..b3c7b8d --- /dev/null +++ b/Tests/RunCMake/MaxRecursionDepth/variable_watch.cmake @@ -0,0 +1,9 @@ +function(update_x) + message("${x}") + math(EXPR y "${x} + 2") + variable_watch(x update_x) + set(x "${y}") +endfunction() + +variable_watch(x update_x) +set(x 4) diff --git a/bootstrap b/bootstrap index 901bc10..f185ea8 100755 --- a/bootstrap +++ b/bootstrap @@ -1312,6 +1312,7 @@ cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_PATCH ${cmake_versi cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION \"${cmake_version}\"" cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP_SOURCE_DIR \"${CMAKE_BOOTSTRAP_SOURCE_DIR}\"" cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP_BINARY_DIR \"${CMAKE_BOOTSTRAP_BINARY_DIR}\"" +cmake_report cmConfigure.h${_tmp} "#define CMake_DEFAULT_RECURSION_LIMIT 400" cmake_report cmConfigure.h${_tmp} "#define CMAKE_BIN_DIR \"/bootstrap-not-insalled\"" cmake_report cmConfigure.h${_tmp} "#define CMAKE_DATA_DIR \"/bootstrap-not-insalled\"" cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP" https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dc6888573da15cd7ddb9f91b70ef3e6c4e7cae15 commit dc6888573da15cd7ddb9f91b70ef3e6c4e7cae15 Author: Zack Galbreath AuthorDate: Tue Jan 15 17:26:02 2019 -0600 Commit: Zack Galbreath CommitDate: Mon Jan 21 11:38:24 2019 -0500 Pass EXCLUDE_FROM_ALL from directory to targets When a target is created it now inherits the EXCLUDE_FROM_ALL property from its directory. This change makes it possible to include a target in "all", even if its directory has been marked as EXCLUDE_FROM_ALL. diff --git a/Help/prop_dir/EXCLUDE_FROM_ALL.rst b/Help/prop_dir/EXCLUDE_FROM_ALL.rst index 1aa24e4..9d3192c 100644 --- a/Help/prop_dir/EXCLUDE_FROM_ALL.rst +++ b/Help/prop_dir/EXCLUDE_FROM_ALL.rst @@ -7,3 +7,9 @@ A property on a directory that indicates if its targets are excluded from the default build target. If it is not, then with a Makefile for example typing make will cause the targets to be built. The same concept applies to the default build of other generators. + +Targets inherit the :prop_tgt:`EXCLUDE_FROM_ALL` property from the directory +that they are created in. When a directory is excluded, all of its targets will +have :prop_tgt:`EXCLUDE_FROM_ALL` set to ``TRUE``. After creating such a target +you can change its :prop_tgt:`EXCLUDE_FROM_ALL` property to ``FALSE``. This +will cause the target to be included in the default build target. diff --git a/Help/prop_tgt/EXCLUDE_FROM_ALL.rst b/Help/prop_tgt/EXCLUDE_FROM_ALL.rst index caa5741..e7457e1 100644 --- a/Help/prop_tgt/EXCLUDE_FROM_ALL.rst +++ b/Help/prop_tgt/EXCLUDE_FROM_ALL.rst @@ -8,3 +8,6 @@ the default build target. If it is not, then with a Makefile for example typing make will cause this target to be built. The same concept applies to the default build of other generators. Installing a target with EXCLUDE_FROM_ALL set to true has undefined behavior. + +This property is enabled by default for targets that are created in +directories that have :prop_dir:`EXCLUDE_FROM_ALL` set to ``TRUE``. diff --git a/Help/release/dev/EXCLUDE_FROM_ALL.rst b/Help/release/dev/EXCLUDE_FROM_ALL.rst new file mode 100644 index 0000000..519ac42 --- /dev/null +++ b/Help/release/dev/EXCLUDE_FROM_ALL.rst @@ -0,0 +1,7 @@ +EXCLUDE_FROM_ALL +---------------- + +* A target's :prop_tgt:`EXCLUDE_FROM_ALL` property can now override the + setting of its directory. A target will now be built as part of "all" + if its :prop_tgt:`EXCLUDE_FROM_ALL` property is set to ``OFF``, even if its + containing directory is marked as :prop_dir:`EXCLUDE_FROM_ALL`. diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 85c2345..1973282 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2034,17 +2034,10 @@ bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root, return this->IsExcluded(rootSnp, snp); } -bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root, - cmGeneratorTarget* target) const +bool cmGlobalGenerator::IsExcluded(cmGeneratorTarget* target) const { - if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY || - target->GetPropertyAsBool("EXCLUDE_FROM_ALL")) { - // This target is excluded from its directory. - return true; - } - // This target is included in its directory. Check whether the - // directory is excluded. - return this->IsExcluded(root, target->GetLocalGenerator()); + return target->GetType() == cmStateEnums::INTERFACE_LIBRARY || + target->GetPropertyAsBool("EXCLUDE_FROM_ALL"); } void cmGlobalGenerator::GetEnabledLanguages( diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 36d3d10..c251800 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -468,7 +468,7 @@ protected: bool IsExcluded(cmStateSnapshot const& root, cmStateSnapshot const& snp) const; bool IsExcluded(cmLocalGenerator* root, cmLocalGenerator* gen) const; - bool IsExcluded(cmLocalGenerator* root, cmGeneratorTarget* target) const; + bool IsExcluded(cmGeneratorTarget* target) const; virtual void InitializeProgressMarks() {} struct GlobalTargetInfo diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 00fa348..f1ab852 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -331,9 +331,9 @@ public: return LocalGenerators; } - bool IsExcluded(cmLocalGenerator* root, cmGeneratorTarget* target) + bool IsExcluded(cmGeneratorTarget* target) { - return cmGlobalGenerator::IsExcluded(root, target); + return cmGlobalGenerator::IsExcluded(target); } int GetRuleCmdLength(const std::string& name) { return RuleCmdLength[name]; } diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index ceee500..5e45ae1 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -702,7 +702,7 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2( localName, depends, commands, true); // add the all/all dependency - if (!this->IsExcluded(this->LocalGenerators[0], gtarget)) { + if (!this->IsExcluded(gtarget)) { depends.clear(); depends.push_back(localName); commands.clear(); @@ -767,7 +767,7 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2( "Pre-install relink rule for target.", localName, depends, commands, true); - if (!this->IsExcluded(this->LocalGenerators[0], gtarget)) { + if (!this->IsExcluded(gtarget)) { depends.clear(); depends.push_back(localName); commands.clear(); diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 41d961c..cbea3dd 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -201,7 +201,7 @@ void cmGlobalVisualStudioGenerator::AddExtraIDETargets() tgt->IsImported()) { continue; } - if (!this->IsExcluded(gen[0], tgt)) { + if (!this->IsExcluded(tgt)) { allBuild->AddUtility(tgt->GetName()); } } diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 6618351..2cc3d41 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -522,10 +522,6 @@ void cmGlobalXCodeGenerator::AddExtraTargets( // now make the allbuild depend on all the non-utility targets // in the project for (auto& gen : gens) { - if (this->IsExcluded(root, gen)) { - continue; - } - for (auto target : gen->GetGeneratorTargets()) { if (target->GetType() == cmStateEnums::GLOBAL_TARGET) { continue; @@ -558,8 +554,7 @@ void cmGlobalXCodeGenerator::AddExtraTargets( false, "", false, cmMakefile::AcceptObjectLibraryCommands); } - if (target->GetType() != cmStateEnums::INTERFACE_LIBRARY && - !target->GetPropertyAsBool("EXCLUDE_FROM_ALL")) { + if (!this->IsExcluded(target)) { allbuild->AddUtility(target->GetName()); } } diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index a8647b1..66a770c 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -90,9 +90,7 @@ void cmLocalNinjaGenerator::Generate() if (tg) { tg->Generate(); // Add the target to "all" if required. - if (!this->GetGlobalNinjaGenerator()->IsExcluded( - this->GetGlobalNinjaGenerator()->GetLocalGenerators()[0], - target)) { + if (!this->GetGlobalNinjaGenerator()->IsExcluded(target)) { this->GetGlobalNinjaGenerator()->AddDependencyToAll(target); } delete tg; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 274c631..a3762ce 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1127,7 +1127,7 @@ cmTarget* cmMakefile::AddUtilityCommand( // Create a target instance for this utility. cmTarget* target = this->AddNewTarget(cmStateEnums::UTILITY, utilityName); target->SetIsGeneratorProvided(origin == TargetOrigin::Generator); - if (excludeFromAll) { + if (excludeFromAll || this->GetPropertyAsBool("EXCLUDE_FROM_ALL")) { target->SetProperty("EXCLUDE_FROM_ALL", "TRUE"); } if (!comment) { @@ -1662,7 +1662,7 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath, cmMakefile* subMf = new cmMakefile(this->GlobalGenerator, newSnapshot); this->GetGlobalGenerator()->AddMakefile(subMf); - if (excludeFromAll) { + if (excludeFromAll || this->GetPropertyAsBool("EXCLUDE_FROM_ALL")) { subMf->SetProperty("EXCLUDE_FROM_ALL", "TRUE"); } @@ -1958,7 +1958,7 @@ cmTarget* cmMakefile::AddLibrary(const std::string& lname, // over changes in CMakeLists.txt, making the information stale and // hence useless. target->ClearDependencyInformation(*this); - if (excludeFromAll) { + if (excludeFromAll || this->GetPropertyAsBool("EXCLUDE_FROM_ALL")) { target->SetProperty("EXCLUDE_FROM_ALL", "TRUE"); } target->AddSources(srcs); @@ -1971,7 +1971,7 @@ cmTarget* cmMakefile::AddExecutable(const std::string& exeName, bool excludeFromAll) { cmTarget* target = this->AddNewTarget(cmStateEnums::EXECUTABLE, exeName); - if (excludeFromAll) { + if (excludeFromAll || this->GetPropertyAsBool("EXCLUDE_FROM_ALL")) { target->SetProperty("EXCLUDE_FROM_ALL", "TRUE"); } target->AddSources(srcs); diff --git a/Tests/RunCMake/add_subdirectory/ExcludeFromAll/CMakeLists.txt b/Tests/RunCMake/add_subdirectory/ExcludeFromAll/CMakeLists.txt index b1df6b0..9e6462b 100644 --- a/Tests/RunCMake/add_subdirectory/ExcludeFromAll/CMakeLists.txt +++ b/Tests/RunCMake/add_subdirectory/ExcludeFromAll/CMakeLists.txt @@ -1,4 +1,20 @@ add_library(bar STATIC bar.cpp) add_library(foo STATIC foo.cpp) + +add_library(baz STATIC foo.cpp) +set_target_properties(baz PROPERTIES EXCLUDE_FROM_ALL OFF) + +file(GENERATE + OUTPUT "${CMAKE_BINARY_DIR}/main.txt" + CONTENT "$") + +file(GENERATE + OUTPUT "${CMAKE_BINARY_DIR}/bar.txt" + CONTENT "$") + +file(GENERATE + OUTPUT "${CMAKE_BINARY_DIR}/baz.txt" + CONTENT "$") + target_include_directories(foo PUBLIC .) diff --git a/Tests/RunCMake/add_subdirectory/ExcludeFromAll/check.cmake b/Tests/RunCMake/add_subdirectory/ExcludeFromAll/check.cmake new file mode 100644 index 0000000..14ec482 --- /dev/null +++ b/Tests/RunCMake/add_subdirectory/ExcludeFromAll/check.cmake @@ -0,0 +1,44 @@ +# Use globbing to check if exes / libs were built because determining +# exactly where these files will live inside a CMake -P script is +# pretty challenging. + +file(READ "${RunCMake_TEST_BINARY_DIR}/main.txt" main_exe) +file(READ "${RunCMake_TEST_BINARY_DIR}/bar.txt" bar_lib) +file(READ "${RunCMake_TEST_BINARY_DIR}/baz.txt" baz_lib) + +set(found_main FALSE) +file(GLOB_RECURSE files + LIST_DIRECTORIES FALSE + RELATIVE "${RunCMake_TEST_BINARY_DIR}" + "${RunCMake_TEST_BINARY_DIR}/*") +foreach (file IN LISTS files) + if (file MATCHES "${main_exe}") + set(found_main TRUE) + endif() +endforeach() +if (NOT found_main) + set(RunCMake_TEST_FAILED "'main' missing from ${RunCMake_TEST_BINARY_DIR}") +endif() + +set(found_bar FALSE) +set(found_baz FALSE) +file(GLOB_RECURSE files + LIST_DIRECTORIES FALSE + RELATIVE "${RunCMake_TEST_BINARY_DIR}/ExcludeFromAll" + "${RunCMake_TEST_BINARY_DIR}/ExcludeFromAll/*") +foreach (file IN LISTS files) + if (file MATCHES "${bar_lib}") + set(found_bar TRUE) + endif() + if (file MATCHES "${baz_lib}") + set(found_baz TRUE) + endif() +endforeach() +if (found_bar) + set(RunCMake_TEST_FAILED + "'bar' was not excluded from ${RunCMake_TEST_BINARY_DIR}/ExcludeFromAll") +endif() +if (NOT found_baz) + set(RunCMake_TEST_FAILED + "'baz' missing from ${RunCMake_TEST_BINARY_DIR}/ExcludeFromAll") +endif() diff --git a/Tests/RunCMake/add_subdirectory/RunCMakeTest.cmake b/Tests/RunCMake/add_subdirectory/RunCMakeTest.cmake index 343e65b..781e483 100644 --- a/Tests/RunCMake/add_subdirectory/RunCMakeTest.cmake +++ b/Tests/RunCMake/add_subdirectory/RunCMakeTest.cmake @@ -33,6 +33,7 @@ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") run_cmake(ExcludeFromAll) +set(RunCMake-check-file ExcludeFromAll/check.cmake) run_cmake_command(ExcludeFromAll-build ${CMAKE_COMMAND} --build .) unset(RunCMake_TEST_BINARY_DIR) ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-variables.7.rst | 1 + Help/prop_dir/EXCLUDE_FROM_ALL.rst | 6 +++ Help/prop_tgt/EXCLUDE_FROM_ALL.rst | 3 ++ Help/release/dev/EXCLUDE_FROM_ALL.rst | 7 +++ Help/release/dev/max-recursion-depth.rst | 6 +++ Help/variable/CMAKE_MAXIMUM_RECURSION_DEPTH.rst | 33 ++++++++++++++ Modules/FindICU.cmake | 12 +++-- Source/CMakeLists.txt | 10 +++++ Source/CTest/cmCTestRunScriptCommand.cxx | 3 +- Source/CTest/cmCTestScriptHandler.cxx | 12 ++++- Source/CTest/cmCTestScriptHandler.h | 5 ++- Source/cmConfigure.cmake.h.in | 1 + Source/cmGlobalGenerator.cxx | 16 +++---- Source/cmGlobalGenerator.h | 4 +- Source/cmGlobalNinjaGenerator.h | 4 +- Source/cmGlobalUnixMakefileGenerator3.cxx | 4 +- Source/cmGlobalVisualStudioGenerator.cxx | 2 +- Source/cmGlobalXCodeGenerator.cxx | 7 +-- Source/cmListFileCache.cxx | 5 ++- Source/cmLocalNinjaGenerator.cxx | 4 +- Source/cmMakefile.cxx | 51 ++++++++++++++++++++-- Source/cmMakefile.h | 4 ++ Source/cmNinjaTargetGenerator.cxx | 7 ++- Source/cmState.cxx | 4 +- Tests/RunCMake/CMakeLists.txt | 1 + Tests/RunCMake/MaxRecursionDepth/CMakeLists.txt | 5 +++ Tests/RunCMake/MaxRecursionDepth/CMakeLists.txt.in | 2 + Tests/RunCMake/MaxRecursionDepth/CTestCustom.cmake | 3 ++ .../MaxRecursionDepth/FindRecursivePackage.cmake | 3 ++ .../RunCMake/MaxRecursionDepth/RunCMakeTest.cmake | 49 +++++++++++++++++++++ .../add_subdirectory-var-result.txt} | 0 .../add_subdirectory-var-stderr.txt | 10 +++++ .../MaxRecursionDepth/add_subdirectory.cmake | 2 + .../add_subdirectory/CMakeLists.txt | 3 ++ .../ctest_read_custom_files-default-result.txt} | 0 .../ctest_read_custom_files-default-stderr.txt | 5 +++ ...ctest_read_custom_files-invalid-var-result.txt} | 0 .../ctest_read_custom_files-invalid-var-stderr.txt | 5 +++ .../ctest_read_custom_files-var-result.txt} | 0 .../ctest_read_custom_files-var-stderr.txt | 34 +++++++++++++++ .../ctest_run_script-var-result.txt} | 0 .../ctest_run_script-var-stderr.txt | 51 ++++++++++++++++++++++ .../MaxRecursionDepth/ctest_run_script.cmake.in | 14 ++++++ .../find_package-default-result.txt} | 0 .../find_package-default-script-result.txt} | 0 .../find_package-default-script-stderr.txt | 5 +++ .../find_package-default-stderr.txt | 5 +++ .../find_package-invalid-var-result.txt} | 0 .../find_package-invalid-var-script-result.txt} | 0 .../find_package-invalid-var-script-stderr.txt | 5 +++ .../find_package-invalid-var-stderr.txt | 5 +++ .../find_package-var-result.txt} | 0 .../find_package-var-script-result.txt} | 0 .../find_package-var-script-stderr.txt | 21 +++++++++ .../MaxRecursionDepth/find_package-var-stderr.txt | 21 +++++++++ .../RunCMake/MaxRecursionDepth/find_package.cmake | 2 + .../function-default-result.txt} | 0 .../function-default-script-result.txt} | 0 .../function-default-script-stderr.txt | 5 +++ .../MaxRecursionDepth/function-default-stderr.txt | 5 +++ .../function-invalid-var-result.txt} | 0 .../function-invalid-var-script-result.txt} | 0 .../function-invalid-var-script-stderr.txt | 5 +++ .../function-invalid-var-stderr.txt | 5 +++ .../function-var-result.txt} | 0 .../function-var-script-result.txt} | 0 .../function-var-script-stderr.txt | 21 +++++++++ .../MaxRecursionDepth/function-var-stderr.txt | 21 +++++++++ Tests/RunCMake/MaxRecursionDepth/function.cmake | 7 +++ .../include-default-result.txt} | 0 .../include-default-script-result.txt} | 0 .../include-default-script-stderr.txt | 5 +++ .../MaxRecursionDepth/include-default-stderr.txt | 5 +++ .../include-invalid-var-result.txt} | 0 .../include-invalid-var-script-result.txt} | 0 .../include-invalid-var-script-stderr.txt | 5 +++ .../include-invalid-var-stderr.txt | 5 +++ .../include-var-result.txt} | 0 .../include-var-script-result.txt} | 0 .../include-var-script-stderr.txt | 21 +++++++++ .../MaxRecursionDepth/include-var-stderr.txt | 21 +++++++++ Tests/RunCMake/MaxRecursionDepth/include.cmake | 2 + .../MaxRecursionDepth/include_recursive.cmake | 3 ++ .../macro-default-result.txt} | 0 .../macro-default-script-result.txt} | 0 .../macro-default-script-stderr.txt | 5 +++ .../MaxRecursionDepth/macro-default-stderr.txt | 5 +++ .../macro-invalid-var-result.txt} | 0 .../macro-invalid-var-script-result.txt} | 0 .../macro-invalid-var-script-stderr.txt | 5 +++ .../MaxRecursionDepth/macro-invalid-var-stderr.txt | 5 +++ .../macro-var-result.txt} | 0 .../macro-var-script-result.txt} | 0 .../MaxRecursionDepth/macro-var-script-stderr.txt | 21 +++++++++ .../MaxRecursionDepth/macro-var-stderr.txt | 21 +++++++++ Tests/RunCMake/MaxRecursionDepth/macro.cmake | 7 +++ Tests/RunCMake/MaxRecursionDepth/test.cmake.in | 21 +++++++++ .../try_compile-var-result.txt} | 0 .../MaxRecursionDepth/try_compile-var-stderr.txt | 48 ++++++++++++++++++++ Tests/RunCMake/MaxRecursionDepth/try_compile.cmake | 6 +++ .../MaxRecursionDepth/try_compile/CMakeLists.txt | 13 ++++++ .../variable_watch-default-result.txt} | 0 .../variable_watch-default-script-result.txt} | 0 .../variable_watch-default-script-stderr.txt | 6 +++ .../variable_watch-default-stderr.txt | 6 +++ .../variable_watch-invalid-var-result.txt} | 0 .../variable_watch-invalid-var-script-result.txt} | 0 .../variable_watch-invalid-var-script-stderr.txt | 6 +++ .../variable_watch-invalid-var-stderr.txt | 6 +++ .../variable_watch-var-result.txt} | 0 .../variable_watch-var-script-result.txt} | 0 .../variable_watch-var-script-stderr.txt | 22 ++++++++++ .../variable_watch-var-stderr.txt | 22 ++++++++++ .../MaxRecursionDepth/variable_watch.cmake | 9 ++++ .../add_subdirectory/ExcludeFromAll/CMakeLists.txt | 16 +++++++ .../add_subdirectory/ExcludeFromAll/check.cmake | 44 +++++++++++++++++++ Tests/RunCMake/add_subdirectory/RunCMakeTest.cmake | 1 + bootstrap | 1 + 118 files changed, 852 insertions(+), 42 deletions(-) create mode 100644 Help/release/dev/EXCLUDE_FROM_ALL.rst create mode 100644 Help/release/dev/max-recursion-depth.rst create mode 100644 Help/variable/CMAKE_MAXIMUM_RECURSION_DEPTH.rst create mode 100644 Tests/RunCMake/MaxRecursionDepth/CMakeLists.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/CMakeLists.txt.in create mode 100644 Tests/RunCMake/MaxRecursionDepth/CTestCustom.cmake create mode 100644 Tests/RunCMake/MaxRecursionDepth/FindRecursivePackage.cmake create mode 100644 Tests/RunCMake/MaxRecursionDepth/RunCMakeTest.cmake copy Tests/RunCMake/{while/MissingArgument-result.txt => MaxRecursionDepth/add_subdirectory-var-result.txt} (100%) create mode 100644 Tests/RunCMake/MaxRecursionDepth/add_subdirectory-var-stderr.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/add_subdirectory.cmake create mode 100644 Tests/RunCMake/MaxRecursionDepth/add_subdirectory/CMakeLists.txt copy Tests/RunCMake/{ctest_submit/RepeatRETURN_VALUE-result.txt => MaxRecursionDepth/ctest_read_custom_files-default-result.txt} (100%) create mode 100644 Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-default-stderr.txt copy Tests/RunCMake/{ctest_submit/RepeatRETURN_VALUE-result.txt => MaxRecursionDepth/ctest_read_custom_files-invalid-var-result.txt} (100%) create mode 100644 Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-invalid-var-stderr.txt copy Tests/RunCMake/{ctest_submit/RepeatRETURN_VALUE-result.txt => MaxRecursionDepth/ctest_read_custom_files-var-result.txt} (100%) create mode 100644 Tests/RunCMake/MaxRecursionDepth/ctest_read_custom_files-var-stderr.txt copy Tests/RunCMake/{ctest_submit/RepeatRETURN_VALUE-result.txt => MaxRecursionDepth/ctest_run_script-var-result.txt} (100%) create mode 100644 Tests/RunCMake/MaxRecursionDepth/ctest_run_script-var-stderr.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/ctest_run_script.cmake.in copy Tests/RunCMake/{while/MissingArgument-result.txt => MaxRecursionDepth/find_package-default-result.txt} (100%) copy Tests/RunCMake/{while/MissingArgument-result.txt => MaxRecursionDepth/find_package-default-script-result.txt} (100%) create mode 100644 Tests/RunCMake/MaxRecursionDepth/find_package-default-script-stderr.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/find_package-default-stderr.txt copy Tests/RunCMake/{while/MissingArgument-result.txt => MaxRecursionDepth/find_package-invalid-var-result.txt} (100%) copy Tests/RunCMake/{while/MissingArgument-result.txt => MaxRecursionDepth/find_package-invalid-var-script-result.txt} (100%) create mode 100644 Tests/RunCMake/MaxRecursionDepth/find_package-invalid-var-script-stderr.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/find_package-invalid-var-stderr.txt copy Tests/RunCMake/{while/MissingArgument-result.txt => MaxRecursionDepth/find_package-var-result.txt} (100%) copy Tests/RunCMake/{while/MissingArgument-result.txt => MaxRecursionDepth/find_package-var-script-result.txt} (100%) create mode 100644 Tests/RunCMake/MaxRecursionDepth/find_package-var-script-stderr.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/find_package-var-stderr.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/find_package.cmake copy Tests/RunCMake/{while/MissingArgument-result.txt => MaxRecursionDepth/function-default-result.txt} (100%) copy Tests/RunCMake/{while/MissingArgument-result.txt => MaxRecursionDepth/function-default-script-result.txt} (100%) create mode 100644 Tests/RunCMake/MaxRecursionDepth/function-default-script-stderr.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/function-default-stderr.txt copy Tests/RunCMake/{while/MissingArgument-result.txt => MaxRecursionDepth/function-invalid-var-result.txt} (100%) copy Tests/RunCMake/{while/MissingArgument-result.txt => MaxRecursionDepth/function-invalid-var-script-result.txt} (100%) create mode 100644 Tests/RunCMake/MaxRecursionDepth/function-invalid-var-script-stderr.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/function-invalid-var-stderr.txt copy Tests/RunCMake/{while/MissingArgument-result.txt => MaxRecursionDepth/function-var-result.txt} (100%) copy Tests/RunCMake/{while/MissingArgument-result.txt => MaxRecursionDepth/function-var-script-result.txt} (100%) create mode 100644 Tests/RunCMake/MaxRecursionDepth/function-var-script-stderr.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/function-var-stderr.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/function.cmake copy Tests/RunCMake/{while/MissingArgument-result.txt => MaxRecursionDepth/include-default-result.txt} (100%) copy Tests/RunCMake/{while/MissingArgument-result.txt => MaxRecursionDepth/include-default-script-result.txt} (100%) create mode 100644 Tests/RunCMake/MaxRecursionDepth/include-default-script-stderr.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/include-default-stderr.txt copy Tests/RunCMake/{while/MissingArgument-result.txt => MaxRecursionDepth/include-invalid-var-result.txt} (100%) copy Tests/RunCMake/{while/MissingArgument-result.txt => MaxRecursionDepth/include-invalid-var-script-result.txt} (100%) create mode 100644 Tests/RunCMake/MaxRecursionDepth/include-invalid-var-script-stderr.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/include-invalid-var-stderr.txt copy Tests/RunCMake/{while/MissingArgument-result.txt => MaxRecursionDepth/include-var-result.txt} (100%) copy Tests/RunCMake/{while/MissingArgument-result.txt => MaxRecursionDepth/include-var-script-result.txt} (100%) create mode 100644 Tests/RunCMake/MaxRecursionDepth/include-var-script-stderr.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/include-var-stderr.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/include.cmake create mode 100644 Tests/RunCMake/MaxRecursionDepth/include_recursive.cmake copy Tests/RunCMake/{while/MissingArgument-result.txt => MaxRecursionDepth/macro-default-result.txt} (100%) copy Tests/RunCMake/{while/MissingArgument-result.txt => MaxRecursionDepth/macro-default-script-result.txt} (100%) create mode 100644 Tests/RunCMake/MaxRecursionDepth/macro-default-script-stderr.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/macro-default-stderr.txt copy Tests/RunCMake/{while/MissingArgument-result.txt => MaxRecursionDepth/macro-invalid-var-result.txt} (100%) copy Tests/RunCMake/{while/MissingArgument-result.txt => MaxRecursionDepth/macro-invalid-var-script-result.txt} (100%) create mode 100644 Tests/RunCMake/MaxRecursionDepth/macro-invalid-var-script-stderr.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/macro-invalid-var-stderr.txt copy Tests/RunCMake/{while/MissingArgument-result.txt => MaxRecursionDepth/macro-var-result.txt} (100%) copy Tests/RunCMake/{while/MissingArgument-result.txt => MaxRecursionDepth/macro-var-script-result.txt} (100%) create mode 100644 Tests/RunCMake/MaxRecursionDepth/macro-var-script-stderr.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/macro-var-stderr.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/macro.cmake create mode 100644 Tests/RunCMake/MaxRecursionDepth/test.cmake.in copy Tests/RunCMake/{while/MissingArgument-result.txt => MaxRecursionDepth/try_compile-var-result.txt} (100%) create mode 100644 Tests/RunCMake/MaxRecursionDepth/try_compile-var-stderr.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/try_compile.cmake create mode 100644 Tests/RunCMake/MaxRecursionDepth/try_compile/CMakeLists.txt copy Tests/RunCMake/{while/MissingArgument-result.txt => MaxRecursionDepth/variable_watch-default-result.txt} (100%) copy Tests/RunCMake/{while/MissingArgument-result.txt => MaxRecursionDepth/variable_watch-default-script-result.txt} (100%) create mode 100644 Tests/RunCMake/MaxRecursionDepth/variable_watch-default-script-stderr.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/variable_watch-default-stderr.txt copy Tests/RunCMake/{while/MissingArgument-result.txt => MaxRecursionDepth/variable_watch-invalid-var-result.txt} (100%) copy Tests/RunCMake/{while/MissingArgument-result.txt => MaxRecursionDepth/variable_watch-invalid-var-script-result.txt} (100%) create mode 100644 Tests/RunCMake/MaxRecursionDepth/variable_watch-invalid-var-script-stderr.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/variable_watch-invalid-var-stderr.txt copy Tests/RunCMake/{while/MissingArgument-result.txt => MaxRecursionDepth/variable_watch-var-result.txt} (100%) copy Tests/RunCMake/{while/MissingArgument-result.txt => MaxRecursionDepth/variable_watch-var-script-result.txt} (100%) create mode 100644 Tests/RunCMake/MaxRecursionDepth/variable_watch-var-script-stderr.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/variable_watch-var-stderr.txt create mode 100644 Tests/RunCMake/MaxRecursionDepth/variable_watch.cmake create mode 100644 Tests/RunCMake/add_subdirectory/ExcludeFromAll/check.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Sat Jan 26 00:03:04 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Sat, 26 Jan 2019 00:03:04 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-1117-gbe2cc30 Message-ID: <20190126050304.8BBF211DE0E@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via be2cc309f1f653609d3c9983203541de2b1f9a08 (commit) from 40628b2519ae1553a33f701cf46ee8fbbd013b85 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=be2cc309f1f653609d3c9983203541de2b1f9a08 commit be2cc309f1f653609d3c9983203541de2b1f9a08 Author: Kitware Robot AuthorDate: Sat Jan 26 00:01:07 2019 -0500 Commit: Kitware Robot CommitDate: Sat Jan 26 00:01:07 2019 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index e3a5e52..eadd63d 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 13) -set(CMake_VERSION_PATCH 20190125) +set(CMake_VERSION_PATCH 20190126) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Sun Jan 27 00:03:03 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Sun, 27 Jan 2019 00:03:03 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-1118-gf725750 Message-ID: <20190127050303.A1841127B03@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via f725750f040c3649d51af1543c03cf6c45307c12 (commit) from be2cc309f1f653609d3c9983203541de2b1f9a08 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f725750f040c3649d51af1543c03cf6c45307c12 commit f725750f040c3649d51af1543c03cf6c45307c12 Author: Kitware Robot AuthorDate: Sun Jan 27 00:01:05 2019 -0500 Commit: Kitware Robot CommitDate: Sun Jan 27 00:01:05 2019 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index eadd63d..6dcb2fb 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 13) -set(CMake_VERSION_PATCH 20190126) +set(CMake_VERSION_PATCH 20190127) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jan 28 00:03:03 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 28 Jan 2019 00:03:03 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-1119-gf832f15 Message-ID: <20190128050303.E5B6812818D@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via f832f15509ae269d236c0c7a5e06808b78fdaba2 (commit) from f725750f040c3649d51af1543c03cf6c45307c12 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f832f15509ae269d236c0c7a5e06808b78fdaba2 commit f832f15509ae269d236c0c7a5e06808b78fdaba2 Author: Kitware Robot AuthorDate: Mon Jan 28 00:01:05 2019 -0500 Commit: Kitware Robot CommitDate: Mon Jan 28 00:01:05 2019 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 6dcb2fb..69c2ed0 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 13) -set(CMake_VERSION_PATCH 20190127) +set(CMake_VERSION_PATCH 20190128) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jan 28 08:03:04 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 28 Jan 2019 08:03:04 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-1123-g6d57201 Message-ID: <20190128130304.2B43411DBB9@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 6d572018687cc2b398f59519e87f17c68836b267 (commit) via f411e936be6c5d0070c67aeb3baea150a01024a1 (commit) via fc40bca5902e6c29197696438211265e22efa84f (commit) via 08dee696b5831a8cba0a70df5e6b072f91d0c6f8 (commit) from f832f15509ae269d236c0c7a5e06808b78fdaba2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6d572018687cc2b398f59519e87f17c68836b267 commit 6d572018687cc2b398f59519e87f17c68836b267 Merge: f411e93 fc40bca Author: Brad King AuthorDate: Mon Jan 28 12:59:11 2019 +0000 Commit: Kitware Robot CommitDate: Mon Jan 28 07:59:30 2019 -0500 Merge topic 'intel-compile-features' fc40bca590 Intel: Record support for relaxed constexpr by version 18.0.5 Acked-by: Kitware Robot Merge-request: !2862 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f411e936be6c5d0070c67aeb3baea150a01024a1 commit f411e936be6c5d0070c67aeb3baea150a01024a1 Merge: f832f15 08dee69 Author: Brad King AuthorDate: Mon Jan 28 12:58:36 2019 +0000 Commit: Kitware Robot CommitDate: Mon Jan 28 07:58:45 2019 -0500 Merge topic 'FindPythonInterp-version-fix' 08dee696b5 FindPythonInterp: Do not assume any version if test script fails Acked-by: Kitware Robot Merge-request: !2835 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fc40bca5902e6c29197696438211265e22efa84f commit fc40bca5902e6c29197696438211265e22efa84f Author: Brad King AuthorDate: Fri Jan 25 07:37:20 2019 -0500 Commit: Brad King CommitDate: Fri Jan 25 07:56:37 2019 -0500 Intel: Record support for relaxed constexpr by version 18.0.5 Update the special case added by commit f719a13c28 (Features: Add special case to disable relaxed constexpr for Intel 18, 2018-06-04, v3.12.0-rc1~11^2) to record that 18.0.5 fixed the regression. diff --git a/Modules/Compiler/Intel-CXX-FeatureTests.cmake b/Modules/Compiler/Intel-CXX-FeatureTests.cmake index 0df6c0f..aa35b97 100644 --- a/Modules/Compiler/Intel-CXX-FeatureTests.cmake +++ b/Modules/Compiler/Intel-CXX-FeatureTests.cmake @@ -24,7 +24,7 @@ set(DETECT_CXX14 "((__cplusplus >= 201300L) || ((__cplusplus == 201103L) && !def unset(DETECT_BUGGY_ICC15) set(Intel17_CXX14 "__INTEL_COMPILER >= 1700 && ${DETECT_CXX14}") -set(_cmake_feature_test_cxx_relaxed_constexpr "__cpp_constexpr >= 201304 || (${Intel17_CXX14} && __INTEL_COMPILER != 1800 && !defined(_MSC_VER))") +set(_cmake_feature_test_cxx_relaxed_constexpr "__cpp_constexpr >= 201304 || (${Intel17_CXX14} && !(__INTEL_COMPILER == 1800 && __INTEL_COMPILER_UPDATE < 5) && !defined(_MSC_VER))") set(Intel16_CXX14 "__INTEL_COMPILER >= 1600 && ${DETECT_CXX14}") set(_cmake_feature_test_cxx_aggregate_default_initializers "${Intel16_CXX14}") https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=08dee696b5831a8cba0a70df5e6b072f91d0c6f8 commit 08dee696b5831a8cba0a70df5e6b072f91d0c6f8 Author: Marc Chevrier AuthorDate: Mon Jan 21 16:41:59 2019 +0100 Commit: Brad King CommitDate: Tue Jan 22 10:43:08 2019 -0500 FindPythonInterp: Do not assume any version if test script fails The Python version is retrieved by executing a small python script. If, for any reason, script fails to execute, leave the `PYTHON_VERSION_*` variables undefined instead of assuming version 1.4. Fixes: #18799 diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake index d1f7b31..da33301 100644 --- a/Modules/FindPythonInterp.cmake +++ b/Modules/FindPythonInterp.cmake @@ -130,7 +130,9 @@ if(PYTHON_EXECUTABLE) endif() else() # sys.version predates sys.version_info, so use that - execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c "import sys; sys.stdout.write(sys.version)" + # sys.version was first documented for Python 1.5, so assume version 1.4 + # if retrieving sys.version fails. + execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c "try: import sys; sys.stdout.write(sys.version)\nexcept: sys.stdout.write(\"1.4.0\")" OUTPUT_VARIABLE _VERSION RESULT_VARIABLE _PYTHON_VERSION_RESULT ERROR_QUIET) @@ -144,12 +146,10 @@ if(PYTHON_EXECUTABLE) set(PYTHON_VERSION_PATCH "0") endif() else() - # sys.version was first documented for Python 1.5, so assume - # this is older. - set(PYTHON_VERSION_STRING "1.4") - set(PYTHON_VERSION_MAJOR "1") - set(PYTHON_VERSION_MINOR "4") - set(PYTHON_VERSION_PATCH "0") + unset(PYTHON_VERSION_STRING) + unset(PYTHON_VERSION_MAJOR) + unset(PYTHON_VERSION_MINOR) + unset(PYTHON_VERSION_PATCH) endif() endif() unset(_PYTHON_VERSION_RESULT) ----------------------------------------------------------------------- Summary of changes: Modules/Compiler/Intel-CXX-FeatureTests.cmake | 2 +- Modules/FindPythonInterp.cmake | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jan 28 08:13:03 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 28 Jan 2019 08:13:03 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-1144-gdc752c9 Message-ID: <20190128131303.7F0C611DE0E@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via dc752c9d2d4bc2c0ad047689bd01bb75aa8f8fb9 (commit) via ce57bc8e04e1b30dd2645df111783a8961296070 (commit) via 70fabb8f25b41b2cf332335bb14f3627c786626f (commit) via f3f9ca1d7c3fd95b5f361c3e8bb7b815bfd0f86d (commit) via 2e91627dea507ec6f4406d561b073bdc14860cb1 (commit) via 568343767e5852f0e5751341a3aa44ab6feffb8a (commit) via b9e6d04558bdafab67aa392052d7136cdc4a7be2 (commit) via 880e38059939f3259b42f4ed3cd9c6142d73437f (commit) via 27eb8cc6ba96ae856c3ad12cfe0503e3d822482e (commit) via 626c51f47be79c5438cc349f51ba1b4973194bfc (commit) via fd45cbf40ee809d6b900f22247fef06e3d349c78 (commit) via db35e3cfd606a156cbb518af19603da7f22c26d8 (commit) via 533f95c8479c6c04ec23263244671bd81a98ea39 (commit) via d2fcc6748aa2a7888fc1d0d8366f19141c2cf2c0 (commit) via a7973ccb5310b24acdc9176555b458bad6000a43 (commit) via 049410c0b61aa1894cab8b3885c78d59fdcbcd9e (commit) via 43aa632f57bb31514719b7f0d629a9285147f7f8 (commit) via 460a146e2b8da5355e4638706002715aed85acbc (commit) via 0df37903715d900fa5cfa3c51176649ed69d7d50 (commit) via fb2e418c64d915b4d75f55f815e67923216def62 (commit) via 20922d673375e6b819eba32e84471922b008b8a9 (commit) from 6d572018687cc2b398f59519e87f17c68836b267 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dc752c9d2d4bc2c0ad047689bd01bb75aa8f8fb9 commit dc752c9d2d4bc2c0ad047689bd01bb75aa8f8fb9 Merge: ce57bc8 2e91627 Author: Brad King AuthorDate: Mon Jan 28 13:08:30 2019 +0000 Commit: Kitware Robot CommitDate: Mon Jan 28 08:08:36 2019 -0500 Merge topic 'implicit-incs-upd' 2e91627dea ParseImplicitIncludeInfo: add Fortran implicit include handling 568343767e ParseImplicitIncludeInfo: handle/add SunPro, XL, and -nostdinc test cases Acked-by: Kitware Robot Merge-request: !2855 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ce57bc8e04e1b30dd2645df111783a8961296070 commit ce57bc8e04e1b30dd2645df111783a8961296070 Merge: 70fabb8 626c51f Author: Brad King AuthorDate: Mon Jan 28 13:07:23 2019 +0000 Commit: Kitware Robot CommitDate: Mon Jan 28 08:07:28 2019 -0500 Merge topic 'vs2019' 626c51f47b VS: Update for Visual Studio 2019 Preview 2 fd45cbf40e VS: Fix `/MANIFESTUAC:` link flag mapping for v142 db35e3cfd6 VS: Fix support for '/guard:cf' linker flag for v142 533f95c847 VS: Map the link `/debug` flag for v142 d2fcc6748a VS: Fix `/MANIFESTUAC:NO` link flag mapping for v142 a7973ccb53 VS: Populate `/permissive` flag table entry for v142 049410c0b6 VS: Populate `/JMC-` flag table entry for v142 43aa632f57 VS: Populate `-Qspectre-` flag table entry for v142 ... Acked-by: Kitware Robot Merge-request: !2856 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=70fabb8f25b41b2cf332335bb14f3627c786626f commit 70fabb8f25b41b2cf332335bb14f3627c786626f Merge: f3f9ca1 b9e6d04 Author: Brad King AuthorDate: Mon Jan 28 13:04:44 2019 +0000 Commit: Kitware Robot CommitDate: Mon Jan 28 08:04:51 2019 -0500 Merge topic 'png-optimize' b9e6d04558 Reduce size of PNG images 880e380599 CPack: Replace corrupted background png with original Acked-by: Kitware Robot Merge-request: !2852 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f3f9ca1d7c3fd95b5f361c3e8bb7b815bfd0f86d commit f3f9ca1d7c3fd95b5f361c3e8bb7b815bfd0f86d Merge: 6d57201 27eb8cc Author: Brad King AuthorDate: Mon Jan 28 08:03:52 2019 -0500 Commit: Brad King CommitDate: Mon Jan 28 08:03:52 2019 -0500 Merge branch 'release-3.13' https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2e91627dea507ec6f4406d561b073bdc14860cb1 commit 2e91627dea507ec6f4406d561b073bdc14860cb1 Author: Chuck Cranor AuthorDate: Fri Jan 25 10:57:42 2019 -0700 Commit: Chuck Cranor CommitDate: Fri Jan 25 10:57:42 2019 -0700 ParseImplicitIncludeInfo: add Fortran implicit include handling Currently cmake is only setting CMAKE_Fortran_IMPLICIT_INCLUDE_DIRECTORIES the first time it runs (the implicit includes parser is only run when the cache variables are initially populated). It is left unset during additional runs. This behavior is both confusing and inconsistent. Modify CMakeFortranCompiler.cmake.in to preserve the value of CMAKE_Fortran_IMPLICIT_INCLUDE_DIRECTORIES so that cmake's Fortran behavior matches C and CXX (i.e. CMAKE_Fortran_IMPLICIT_INCLUDE_DIRECTORIES retains its value across runs). The implicit includes variable may not be as useful for Fortran as it is for C and CXX, but we do want cmake to be consistent in how it is handled. Adjust CMakeParseImplicitIncludeInfo to parse verbose Fortran output for Cray and XL compiler IDs (GNU and clang were already ok since they use the same verbose output format as they do with C/CXX). Allow Tests/RunCMake/ParseImplicitIncludeInfo/data/CMakeLists.txt to generate test inputs for Fortran too, and add some sample Fortran input files for the Tests/RunCMake/ParseImplicitIncludeInfo test. diff --git a/Modules/CMakeFortranCompiler.cmake.in b/Modules/CMakeFortranCompiler.cmake.in index 9b951fc..ae7b73a 100644 --- a/Modules/CMakeFortranCompiler.cmake.in +++ b/Modules/CMakeFortranCompiler.cmake.in @@ -61,6 +61,7 @@ endif() @CMAKE_Fortran_SYSROOT_FLAG_CODE@ @CMAKE_Fortran_OSX_DEPLOYMENT_TARGET_FLAG_CODE@ +set(CMAKE_Fortran_IMPLICIT_INCLUDE_DIRECTORIES "@CMAKE_Fortran_IMPLICIT_INCLUDE_DIRECTORIES@") set(CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES "@CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES@") set(CMAKE_Fortran_IMPLICIT_LINK_DIRECTORIES "@CMAKE_Fortran_IMPLICIT_LINK_DIRECTORIES@") set(CMAKE_Fortran_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_Fortran_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES@") diff --git a/Modules/CMakeParseImplicitIncludeInfo.cmake b/Modules/CMakeParseImplicitIncludeInfo.cmake index 6603e1c..211406d 100644 --- a/Modules/CMakeParseImplicitIncludeInfo.cmake +++ b/Modules/CMakeParseImplicitIncludeInfo.cmake @@ -13,8 +13,8 @@ function(cmake_parse_implicit_include_line line lang id_var log_var state_var) # Cray compiler (from cray wrapper, via PrgEnv-cray) if("${CMAKE_${lang}_COMPILER_ID}" STREQUAL "Cray" AND - "${line}" MATCHES "^/" AND "${line}" MATCHES "/ccfe " AND - "${line}" MATCHES "-isystem") + "${line}" MATCHES "^/" AND "${line}" MATCHES "/ccfe |/ftnfe " AND + "${line}" MATCHES " -isystem| -I") string(REGEX MATCHALL " (-I ?|-isystem )([^ ]*)" incs "${line}") foreach(inc IN LISTS incs) string(REGEX REPLACE " (-I ?|-isystem )([^ ]*)" "\\2" idir "${inc}") @@ -46,10 +46,16 @@ function(cmake_parse_implicit_include_line line lang id_var log_var state_var) endif() endif() - # XL C/CXX compiler - if("${CMAKE_${lang}_COMPILER_ID}" STREQUAL "XL" AND - "${line}" MATCHES "^/" AND "${line}" MATCHES "/xlcentry |/xlCentry " AND - "${line}" MATCHES " -qosvar=") + # XL compiler + if("${CMAKE_${lang}_COMPILER_ID}" STREQUAL "XL" AND "${line}" MATCHES "^/" + AND ( ("${lang}" STREQUAL "Fortran" AND + "${line}" MATCHES "/xl[fF]entry " AND + "${line}" MATCHES "OSVAR\\([^ ]+\\)") + OR + ( ("${lang}" STREQUAL "C" OR "${lang}" STREQUAL "CXX") AND + "${line}" MATCHES "/xl[cC]entry " AND + "${line}" MATCHES " -qosvar=") + ) ) # -qnostdinc cancels other stdinc flags, even if present string(FIND "${line}" " -qnostdinc" nostd) if(NOT ${nostd} EQUAL -1) diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake b/Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake index 9bf00f8..a9029dc 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake @@ -10,17 +10,18 @@ project(Minimal NONE) # set(targets aix-C-XL-13.1.3 aix-CXX-XL-13.1.3 - craype-C-Cray-8.7 craype-CXX-Cray-8.7 - craype-C-GNU-7.3.0 craype-CXX-GNU-7.3.0 + craype-C-Cray-8.7 craype-CXX-Cray-8.7 craype-Fortran-Cray-8.7 + craype-C-GNU-7.3.0 craype-CXX-GNU-7.3.0 craype-Fortran-GNU-7.3.0 craype-C-Intel-18.0.2.20180210 craype-CXX-Intel-18.0.2.20180210 + craype-Fortran-Intel-18.0.2.20180210 darwin-C-AppleClang-8.0.0.8000042 darwin-CXX-AppleClang-8.0.0.8000042 darwin_nostdinc-C-AppleClang-8.0.0.8000042 darwin_nostdinc-CXX-AppleClang-8.0.0.8000042 empty-C empty-CXX - freebsd-C-Clang-3.3.0 freebsd-CXX-Clang-3.3.0 - linux-C-GNU-7.3.0 linux-CXX-GNU-7.3.0 + freebsd-C-Clang-3.3.0 freebsd-CXX-Clang-3.3.0 freebsd-Fortran-GNU-4.6.4 + linux-C-GNU-7.3.0 linux-CXX-GNU-7.3.0 linux-Fortran-GNU-7.3.0 linux-C-Intel-18.0.0.20170811 linux-CXX-Intel-18.0.0.20170811 - linux-C-XL-12.1.0 linux-CXX-XL-12.1.0 + linux-C-XL-12.1.0 linux-CXX-XL-12.1.0 linux-Fortran-XL-14.1.0 linux_nostdinc-C-XL-12.1.0 linux_nostdinc-CXX-XL-12.1.0 linux_nostdinc_i-C-XL-12.1.0 linux_nostdinc-CXX-XL-12.1.0 linux-C-XL-16.1.0.0 linux-CXX-XL-16.1.0.0 diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/CMakeLists.txt b/Tests/RunCMake/ParseImplicitIncludeInfo/data/CMakeLists.txt index fb4e57b..b854e2e 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/CMakeLists.txt +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/CMakeLists.txt @@ -34,6 +34,8 @@ foreach(lang IN ITEMS ${LANGUAGES}) set(file ${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp) elseif("${lang}" STREQUAL "CUDA") set(file ${CMAKE_ROOT}/Modules/CMakeCUDACompilerABI.cu) + elseif("${lang}" STREQUAL "Fortran") + set(file ${CMAKE_ROOT}/Modules/CMakeFortranCompilerABI.F) else() message(FATAL_ERROR "unknown language ${lang}") endif() diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/README b/Tests/RunCMake/ParseImplicitIncludeInfo/data/README index 9d1246a..4f19b3c 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/README +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/README @@ -5,7 +5,9 @@ directories parser for testing. For each configuration there is one To generate ".input" files for a system, create a temporary build directory and chdir to it. Then run cmake pointing to this directory. The CMakeLists.txt file here will generate ".input" files in your -build directory. +build directory. The default set of languages is C and CXX. This +can be changed with -DLANGUAGES=language_list. For example: +-DLANGUAGES=Fortran will generate Fortran parser input. The ".output" files should be generated by hand from the input files. The test will compare the parser output to the manually generated diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-Fortran-Cray-8.7.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-Fortran-Cray-8.7.input new file mode 100644 index 0000000..4c4e2f4 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-Fortran-Cray-8.7.input @@ -0,0 +1,52 @@ +CMAKE_LANG=Fortran +CMAKE_Fortran_COMPILER_ABI=ELF +CMAKE_Fortran_COMPILER_AR= +CMAKE_Fortran_COMPILER_ARCHITECTURE_ID= +CMAKE_Fortran_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_Fortran_COMPILER_ID=Cray +CMAKE_Fortran_COMPILER_LAUNCHER= +CMAKE_Fortran_COMPILER_LOADED=1 +CMAKE_Fortran_COMPILER_RANLIB= +CMAKE_Fortran_COMPILER_TARGET= +CMAKE_Fortran_COMPILER_VERSION=8.7 +CMAKE_Fortran_COMPILER_VERSION_INTERAL= +Change Dir: /tmp/ii/CMakeFiles/CMakeTmp + +Run Build Command:"/usr/bin/gmake" "cmTC_9c3ab/fast" +/usr/bin/gmake -f CMakeFiles/cmTC_9c3ab.dir/build.make CMakeFiles/cmTC_9c3ab.dir/build +gmake[1]: Entering directory '/tmp/ii/CMakeFiles/CMakeTmp' +Building Fortran object CMakeFiles/cmTC_9c3ab.dir/CMakeFortranCompilerABI.F.o +/opt/cray/pe/craype/2.5.15/bin/ftn -em -J. -v -c /usr/projects/hpcsoft/cle6.0/common/cmake/3.10.2/share/cmake-3.10/Modules/CMakeFortranCompilerABI.F -o CMakeFiles/cmTC_9c3ab.dir/CMakeFortranCompilerABI.F.o + +/opt/cray/pe/cce/8.7.4/cce/x86_64/bin/ftnfe -h cpu=haswell -D__CRAYXC -D__CRAY_HASWELL -D__CRAYXT_COMPUTE_LINUX_TARGET -h network=aries -em -J. -I/opt/cray/pe/cce/8.7.4/cce/x86_64/include/craylibs -I/usr/include -I/usr/include -I/opt/cray/pe/libsci/18.07.1/CRAY/8.6/x86_64/include -I/opt/cray/pe/mpt/7.7.3/gni/mpich-cray/8.6/include -I/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include -I/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include -I/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include -I/opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include -I/opt/cray/dmapp/7.1.1-6.0.5.0_49.8__g1125556.ari/include -I/opt/cray/pe/pmi/5.0.14/include -I/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include -I/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include -I/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include -I/opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include -I/opt/cray-hss-devel/8.0.0/include -hpl=/tmp/pe_32428//pldir -usystem_mod=/opt/cray/pe/cce/8.7.4/cce/x86_64/lib/libmodules.a -usystem_mod=/opt/cray/pe/cce/8.7.4/cce/x86_64/lib/libomp.a -usystem_mod=/opt/cray/pe/cce/8.7.4/cce/x86_64/lib/omp_lib.a -usystem_mod=/opt/cray/pe/cce/8.7.4/cce/x86_64/lib/libopenacc.a -usystem_mod=/opt/cray/pe/libsci/18.07.1/CRAY/8.6/x86_64/include -usystem_mod=/opt/cray/pe/mpt/7.7.3/gni/mpich-cray/8.6/include -usystem_mod=/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include -usystem_mod=/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include -usystem_mod=/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include -usystem_mod=/opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include -usystem_mod=/opt/cray/dmapp/7.1.1-6.0.5.0_49.8__g1125556.ari/include -usystem_mod=/opt/cray/pe/pmi/5.0.14/include -usystem_mod=/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include -usystem_mod=/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include -usystem_mod=/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include -usystem_mod=/opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include -usystem_mod=/opt/cray-hss-devel/8.0.0/include -ux=x8503 -udv=87000 -ffixed -CZ/tmp/pe_32428/CMakeFortranCompilerABI.T -Cx -CX/tmp/pe_32428/CMakeFortranCompilerABI.xml -hdecompile=/tmp/ii/CMakeFiles/CMakeTmp/CMakeFiles/cmTC_9c3ab.dir/CMakeFortranCompilerABI. -S /tmp/pe_32428/CMakeFortranCompilerABI_1.s -Oipa3 -uo=/tmp/ii/CMakeFiles/CMakeTmp/CMakeFiles/cmTC_9c3ab.dir/CMakeFortranCompilerABI.F.o -ufile_id=1 /usr/projects/hpcsoft/cle6.0/common/cmake/3.10.2/share/cmake-3.10/Modules/CMakeFortranCompilerABI.F + +/opt/cray/pe/cce/8.7.4/cce/x86_64/bin/optcg /tmp/pe_32428//pldir 1 + +/opt/cray/pe/cce/8.7.4/binutils/x86_64/x86_64-pc-linux-gnu/bin/as -o CMakeFiles/cmTC_9c3ab.dir/CMakeFortranCompilerABI.F.o --64 /tmp/pe_32428/CMakeFortranCompilerABI_1.s +rm /tmp/pe_32428/CMakeFortranCompilerABI_1.s +rm /tmp/pe_32428//pldir/PL_path +rm /tmp/pe_32428//pldir/iline_1 +rm /tmp/pe_32428//pldir/gline_1 +rm /tmp/pe_32428//pldir/PL_global_data +rm /tmp/pe_32428//pldir/PL_module_list +rm /tmp/pe_32428//pldir/CMakeFortranCompilerABI_1.inl +rmdir /tmp/pe_32428//pldir +rm /tmp/pe_32428//CMakeFortranCompilerABI_1.xml.Ttmp +rm /tmp/pe_32428//CMakeFortranCompilerABI.T +rm /tmp/pe_32428//CMakeFortranCompilerABI_1.cif.Ttmp +rm /tmp/pe_32428//CMakeFortranCompilerABI.Tfe +rm /tmp/pe_32428//CMakeFortranCompilerABI.xml +rmdir /tmp/pe_32428/ +Linking Fortran executable cmTC_9c3ab +/usr/projects/hpcsoft/cle6.0/common/cmake/3.10.2/bin/cmake -E cmake_link_script CMakeFiles/cmTC_9c3ab.dir/link.txt --verbose=1 +/opt/cray/pe/craype/2.5.15/bin/ftn -v -dynamic CMakeFiles/cmTC_9c3ab.dir/CMakeFortranCompilerABI.F.o -o cmTC_9c3ab + +/opt/cray/pe/cce/8.7.4/binutils/x86_64/x86_64-pc-linux-gnu/bin/ld --eh-frame-hdr -m elf_x86_64 --enable-new-dtags --dynamic-linker /lib64/ld-linux-x86-64.so.2 /usr/lib64//crt1.o /usr/lib64//crti.o /opt/gcc/6.1.0/snos/lib/gcc/x86_64-suse-linux/6.1.0//crtbegin.o /opt/gcc/6.1.0/snos/lib/gcc/x86_64-suse-linux/6.1.0//crtfastmath.o /opt/cray/pe/cce/8.7.4/cce/x86_64/lib/no_mmap.o CMakeFiles/cmTC_9c3ab.dir/CMakeFortranCompilerABI.F.o -Bdynamic -rpath=/opt/cray/pe/cce/8.7.4/cce/x86_64/lib -L/opt/gcc/6.1.0/snos/lib64 -rpath=/opt/cray/pe/gcc-libs -L/opt/cray/pe/libsci/18.07.1/CRAY/8.6/x86_64/lib -L/opt/cray/dmapp/default/lib64 -L/opt/cray/pe/mpt/7.7.3/gni/mpich-cray/8.6/lib -L/opt/cray/dmapp/default/lib64 -L/opt/cray/pe/mpt/7.7.3/gni/mpich-cray/8.6/lib -L/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/lib64 -L/opt/cray/pe/atp/2.1.3/libApp -L/opt/cray/pe/cce/8.7.4/cce/x86_64/lib/pkgconfig/../ --no-as-needed -lAtpSigHandler -lAtpSigHCommData --undefined=_ATP_Data_Globals --undefined=__atpHandlerInstall -L/usr/lib64 -L/lib64 -rpath=/usr/lib64 -rpath=/lib64 -lrca --as-needed -lsci_cray_mpi_mp --no-as-needed --as-needed -lsci_cray_mp --no-as-needed --as-needed -lmpich_cray --no-as-needed --as-needed -lmpichf90_cray --no-as-needed --as-needed -lpgas-dmapp --no-as-needed -lquadmath -lomp -lcraymp -lmodules -lfi -lcraymath -lf -lu -lcsup --as-needed -latomic --no-as-needed --as-needed -lgfortran --no-as-needed --whole-archive -ltcmalloc_minimal --no-whole-archive -lstdc++ -lpthread --start-group -lc -lcsup -lgcc_eh -lm -lgcc --end-group -L /opt/gcc/6.1.0/snos/lib/gcc/x86_64-suse-linux/6.1.0 -L /opt/cray/pe/cce/8.7.4/binutils/x86_64/x86_64-pc-linux-gnu/..//x86_64-unknown-linux-gnu/lib -EL -o cmTC_9c3ab /opt/gcc/6.1.0/snos/lib/gcc/x86_64-suse-linux/6.1.0//crtend.o /usr/lib64//crtn.o + +/opt/cray/pe/cce/8.7.4/binutils/x86_64/bin/objcopy --remove-section=.note.ftn_module_data cmTC_9c3ab +rm /tmp/pe_32450//pldir/PL_path +rm /tmp/pe_32450//pldir/PL_global_data +rm /tmp/pe_32450//pldir/PL_module_list +rmdir /tmp/pe_32450//pldir +rmdir /tmp/pe_32450/ +gmake[1]: Leaving directory '/tmp/ii/CMakeFiles/CMakeTmp' diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-Fortran-Cray-8.7.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-Fortran-Cray-8.7.output new file mode 100644 index 0000000..d57439c --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-Fortran-Cray-8.7.output @@ -0,0 +1 @@ +/opt/cray/pe/cce/8.7.4/cce/x86_64/include/craylibs;/usr/include;/usr/include;/opt/cray/pe/libsci/18.07.1/CRAY/8.6/x86_64/include;/opt/cray/pe/mpt/7.7.3/gni/mpich-cray/8.6/include;/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include;/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include;/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include;/opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include;/opt/cray/dmapp/7.1.1-6.0.5.0_49.8__g1125556.ari/include;/opt/cray/pe/pmi/5.0.14/include;/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include;/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include;/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include;/opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include;/opt/cray-hss-devel/8.0.0/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-Fortran-GNU-7.3.0.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-Fortran-GNU-7.3.0.input new file mode 100644 index 0000000..bee298c --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-Fortran-GNU-7.3.0.input @@ -0,0 +1,83 @@ +CMAKE_LANG=Fortran +CMAKE_Fortran_COMPILER_ABI= +CMAKE_Fortran_COMPILER_AR=/usr/bin/gcc-ar +CMAKE_Fortran_COMPILER_ARCHITECTURE_ID= +CMAKE_Fortran_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_Fortran_COMPILER_ID=GNU +CMAKE_Fortran_COMPILER_LAUNCHER= +CMAKE_Fortran_COMPILER_LOADED=1 +CMAKE_Fortran_COMPILER_RANLIB=/usr/bin/gcc-ranlib +CMAKE_Fortran_COMPILER_TARGET= +CMAKE_Fortran_COMPILER_VERSION=7.3.0 +CMAKE_Fortran_COMPILER_VERSION_INTERAL= +Change Dir: /tmp/ii/CMakeFiles/CMakeTmp + +Run Build Command:"/usr/bin/gmake" "cmTC_390ef/fast" +/usr/bin/gmake -f CMakeFiles/cmTC_390ef.dir/build.make CMakeFiles/cmTC_390ef.dir/build +gmake[1]: Entering directory '/tmp/ii/CMakeFiles/CMakeTmp' +Building Fortran object CMakeFiles/cmTC_390ef.dir/CMakeFortranCompilerABI.F.o +/opt/cray/pe/craype/2.5.15/bin/ftn -v -c /usr/projects/hpcsoft/cle6.0/common/cmake/3.10.2/share/cmake-3.10/Modules/CMakeFortranCompilerABI.F -o CMakeFiles/cmTC_390ef.dir/CMakeFortranCompilerABI.F.o +Using built-in specs. +COLLECT_GCC=/opt/gcc/7.3.0/bin/../snos/bin/gfortran +Target: x86_64-suse-linux +Configured with: ../cray-gcc-7.3.0-201801270210.d61239fc6000b/configure --prefix=/opt/gcc/7.3.0/snos --disable-nls --libdir=/opt/gcc/7.3.0/snos/lib --enable-languages=c,c++,fortran --with-gxx-include-dir=/opt/gcc/7.3.0/snos/include/g++ --with-slibdir=/opt/gcc/7.3.0/snos/lib --with-system-zlib --enable-shared --enable-__cxa_atexit --build=x86_64-suse-linux --with-ppl --with-cloog --disable-multilib +Thread model: posix +gcc version 7.3.0 20180125 (Cray Inc.) (GCC) +COLLECT_GCC_OPTIONS='-march=core-avx2' '-D' '__CRAYXC' '-D' '__CRAY_HASWELL' '-D' '__CRAYXT_COMPUTE_LINUX_TARGET' '-D' '__TARGET_LINUX__' '-v' '-c' '-o' 'CMakeFiles/cmTC_390ef.dir/CMakeFortranCompilerABI.F.o' '-I' '/opt/cray/pe/libsci/18.07.1/GNU/7.1/x86_64/include' '-I' '/opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/include' '-I' '/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include' '-I' '/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include' '-I' '/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include' '-I' '/opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include' '-I' '/opt/cray/pe/pmi/5.0.14/include' '-I' '/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include' '-I' '/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include' '-I' '/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include' '-I' '/opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include' '-I' '/opt/cray-hss-devel/8.0.0/include' + /opt/gcc/7.3.0/snos/libexec/gcc/x86_64-suse-linux/7.3.0/f951 /usr/projects/hpcsoft/cle6.0/common/cmake/3.10.2/share/cmake-3.10/Modules/CMakeFortranCompilerABI.F -ffixed-form -cpp=/tmp/ccxLli6i.f90 -quiet -v -I /opt/cray/pe/libsci/18.07.1/GNU/7.1/x86_64/include -I /opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/include -I /opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include -I /opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include -I /opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include -I /opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include -I /opt/cray/pe/pmi/5.0.14/include -I /opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include -I /opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include -I /opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include -I /opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include -I /opt/cray-hss-devel/8.0.0/include -D __CRAYXC -D __CRAY_HASWELL -D __CRAYXT_COMPUTE_LINUX_TARGET -D __TARGET_LINUX__ /usr/projects/hpcsoft/cle6.0/common/cmake/3.10.2/share/cmake-3.10/Modules/CMakeFortranCompilerABI.F -quiet -dumpbase CMakeFortranCompilerABI.F -march=core-avx2 -auxbase-strip CMakeFiles/cmTC_390ef.dir/CMakeFortranCompilerABI.F.o -version -fintrinsic-modules-path /opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/finclude -o /tmp/ccqY0cGk.s +GNU Fortran (GCC) version 7.3.0 20180125 (Cray Inc.) (x86_64-suse-linux) + compiled by GNU C version 7.3.0 20180125 (Cray Inc.), GMP version 6.0.0, MPFR version 3.1.3, MPC version 1.0.3, isl version isl-0.15-GMP + +GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 +ignoring nonexistent directory "/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/../../../../x86_64-suse-linux/include" +#include "..." search starts here: +#include <...> search starts here: + /opt/cray/pe/libsci/18.07.1/GNU/7.1/x86_64/include + /opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/include + /opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include + /opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include + /opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include + /opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include + /opt/cray/pe/pmi/5.0.14/include + /opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include + /opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include + /opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include + /opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include + /opt/cray-hss-devel/8.0.0/include + /opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/finclude + /opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/include + /usr/local/include + /opt/gcc/7.3.0/snos/include + /opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/include-fixed + /usr/include +End of search list. +GNU Fortran2008 (GCC) version 7.3.0 20180125 (Cray Inc.) (x86_64-suse-linux) + compiled by GNU C version 7.3.0 20180125 (Cray Inc.), GMP version 6.0.0, MPFR version 3.1.3, MPC version 1.0.3, isl version isl-0.15-GMP + +GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 +COLLECT_GCC_OPTIONS='-march=core-avx2' '-D' '__CRAYXC' '-D' '__CRAY_HASWELL' '-D' '__CRAYXT_COMPUTE_LINUX_TARGET' '-D' '__TARGET_LINUX__' '-v' '-c' '-o' 'CMakeFiles/cmTC_390ef.dir/CMakeFortranCompilerABI.F.o' '-I' '/opt/cray/pe/libsci/18.07.1/GNU/7.1/x86_64/include' '-I' '/opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/include' '-I' '/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include' '-I' '/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include' '-I' '/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include' '-I' '/opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include' '-I' '/opt/cray/pe/pmi/5.0.14/include' '-I' '/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include' '-I' '/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include' '-I' '/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include' '-I' '/opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include' '-I' '/opt/cray-hss-devel/8.0.0/include' + as -v -I /opt/cray/pe/libsci/18.07.1/GNU/7.1/x86_64/include -I /opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/include -I /opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include -I /opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include -I /opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include -I /opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include -I /opt/cray/pe/pmi/5.0.14/include -I /opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include -I /opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include -I /opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include -I /opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include -I /opt/cray-hss-devel/8.0.0/include --64 -o CMakeFiles/cmTC_390ef.dir/CMakeFortranCompilerABI.F.o /tmp/ccqY0cGk.s +GNU assembler version 2.31.1 (x86_64-suse-linux) using BFD version (GNU Binutils SUSE Linux Enterprise 12) 2.31.1.20180828-9.26 +COMPILER_PATH=/opt/gcc/7.3.0/snos/libexec/gcc/x86_64-suse-linux/7.3.0/:/opt/gcc/7.3.0/snos/libexec/gcc/x86_64-suse-linux/7.3.0/:/opt/gcc/7.3.0/snos/libexec/gcc/x86_64-suse-linux/:/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/:/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/ +LIBRARY_PATH=/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/:/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/../../../:/lib/:/usr/lib/ +COLLECT_GCC_OPTIONS='-march=core-avx2' '-D' '__CRAYXC' '-D' '__CRAY_HASWELL' '-D' '__CRAYXT_COMPUTE_LINUX_TARGET' '-D' '__TARGET_LINUX__' '-v' '-c' '-o' 'CMakeFiles/cmTC_390ef.dir/CMakeFortranCompilerABI.F.o' '-I' '/opt/cray/pe/libsci/18.07.1/GNU/7.1/x86_64/include' '-I' '/opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/include' '-I' '/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include' '-I' '/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include' '-I' '/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include' '-I' '/opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include' '-I' '/opt/cray/pe/pmi/5.0.14/include' '-I' '/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include' '-I' '/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include' '-I' '/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include' '-I' '/opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include' '-I' '/opt/cray-hss-devel/8.0.0/include' +Linking Fortran executable cmTC_390ef +/usr/projects/hpcsoft/cle6.0/common/cmake/3.10.2/bin/cmake -E cmake_link_script CMakeFiles/cmTC_390ef.dir/link.txt --verbose=1 +/opt/cray/pe/craype/2.5.15/bin/ftn -v -dynamic CMakeFiles/cmTC_390ef.dir/CMakeFortranCompilerABI.F.o -o cmTC_390ef +Driving: /opt/gcc/7.3.0/bin/../snos/bin/gfortran -march=core-avx2 -D__CRAYXC -D__CRAY_HASWELL -D__CRAYXT_COMPUTE_LINUX_TARGET -D__TARGET_LINUX__ -v CMakeFiles/cmTC_390ef.dir/CMakeFortranCompilerABI.F.o -o cmTC_390ef -Wl,-rpath=/opt/cray/pe/gcc-libs -Wl,-Bdynamic -I/opt/cray/pe/libsci/18.07.1/GNU/7.1/x86_64/include -I/opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/include -I/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include -I/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include -I/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include -I/opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include -I/opt/cray/pe/pmi/5.0.14/include -I/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include -I/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include -I/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include -I/opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include -I/opt/cray-hss-devel/8.0.0/include -L/opt/cray/pe/libsci/18.07.1/GNU/7.1/x86_64/lib -L/opt/cray/dmapp/default/lib64 -L/opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/lib -L/opt/cray/dmapp/default/lib64 -L/opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/lib -L/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/lib64 -L/opt/cray/pe/atp/2.1.3/libApp -Wl,--no-as-needed,-lAtpSigHandler,-lAtpSigHCommData -Wl,--undefined=_ATP_Data_Globals -Wl,--undefined=__atpHandlerInstall -lrca -Wl,--as-needed,-lsci_gnu_71_mpi,--no-as-needed -Wl,--as-needed,-lsci_gnu_71,--no-as-needed -Wl,--as-needed,-lmpich_gnu_71,--no-as-needed -Wl,--as-needed,-lmpichf90_gnu_71,--no-as-needed -Wl,--as-needed,-lgfortran,-lquadmath,--no-as-needed -Wl,--as-needed,-lpthread,--no-as-needed -l gfortran -l m -shared-libgcc +Using built-in specs. +COLLECT_GCC=/opt/gcc/7.3.0/bin/../snos/bin/gfortran +COLLECT_LTO_WRAPPER=/opt/gcc/7.3.0/snos/libexec/gcc/x86_64-suse-linux/7.3.0/lto-wrapper +Target: x86_64-suse-linux +Configured with: ../cray-gcc-7.3.0-201801270210.d61239fc6000b/configure --prefix=/opt/gcc/7.3.0/snos --disable-nls --libdir=/opt/gcc/7.3.0/snos/lib --enable-languages=c,c++,fortran --with-gxx-include-dir=/opt/gcc/7.3.0/snos/include/g++ --with-slibdir=/opt/gcc/7.3.0/snos/lib --with-system-zlib --enable-shared --enable-__cxa_atexit --build=x86_64-suse-linux --with-ppl --with-cloog --disable-multilib +Thread model: posix +gcc version 7.3.0 20180125 (Cray Inc.) (GCC) +Reading specs from /opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/../../../../lib64/libgfortran.spec +rename spec lib to liborig +COLLECT_GCC_OPTIONS='-march=core-avx2' '-D' '__CRAYXC' '-D' '__CRAY_HASWELL' '-D' '__CRAYXT_COMPUTE_LINUX_TARGET' '-D' '__TARGET_LINUX__' '-v' '-o' 'cmTC_390ef' '-I' '/opt/cray/pe/libsci/18.07.1/GNU/7.1/x86_64/include' '-I' '/opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/include' '-I' '/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include' '-I' '/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include' '-I' '/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include' '-I' '/opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include' '-I' '/opt/cray/pe/pmi/5.0.14/include' '-I' '/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include' '-I' '/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include' '-I' '/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include' '-I' '/opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include' '-I' '/opt/cray-hss-devel/8.0.0/include' '-L/opt/cray/pe/libsci/18.07.1/GNU/7.1/x86_64/lib' '-L/opt/cray/dmapp/default/lib64' '-L/opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/lib' '-L/opt/cray/dmapp/default/lib64' '-L/opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/lib' '-L/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/lib64' '-L/opt/cray/pe/atp/2.1.3/libApp' '-shared-libgcc' +COMPILER_PATH=/opt/gcc/7.3.0/snos/libexec/gcc/x86_64-suse-linux/7.3.0/:/opt/gcc/7.3.0/snos/libexec/gcc/x86_64-suse-linux/7.3.0/:/opt/gcc/7.3.0/snos/libexec/gcc/x86_64-suse-linux/:/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/:/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/ +LIBRARY_PATH=/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/:/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/../../../:/lib/:/usr/lib/ +COLLECT_GCC_OPTIONS='-march=core-avx2' '-D' '__CRAYXC' '-D' '__CRAY_HASWELL' '-D' '__CRAYXT_COMPUTE_LINUX_TARGET' '-D' '__TARGET_LINUX__' '-v' '-o' 'cmTC_390ef' '-I' '/opt/cray/pe/libsci/18.07.1/GNU/7.1/x86_64/include' '-I' '/opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/include' '-I' '/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include' '-I' '/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include' '-I' '/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include' '-I' '/opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include' '-I' '/opt/cray/pe/pmi/5.0.14/include' '-I' '/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include' '-I' '/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include' '-I' '/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include' '-I' '/opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include' '-I' '/opt/cray-hss-devel/8.0.0/include' '-L/opt/cray/pe/libsci/18.07.1/GNU/7.1/x86_64/lib' '-L/opt/cray/dmapp/default/lib64' '-L/opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/lib' '-L/opt/cray/dmapp/default/lib64' '-L/opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/lib' '-L/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/lib64' '-L/opt/cray/pe/atp/2.1.3/libApp' '-shared-libgcc' + /opt/gcc/7.3.0/snos/libexec/gcc/x86_64-suse-linux/7.3.0/collect2 -plugin /opt/gcc/7.3.0/snos/libexec/gcc/x86_64-suse-linux/7.3.0/liblto_plugin.so -plugin-opt=/opt/gcc/7.3.0/snos/libexec/gcc/x86_64-suse-linux/7.3.0/lto-wrapper -plugin-opt=-fresolution=/tmp/cc1AyzSl.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lquadmath -plugin-opt=-pass-through=-lm -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o cmTC_390ef /usr/lib/../lib64/crt1.o /usr/lib/../lib64/crti.o /opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/crtbegin.o -L/opt/cray/pe/libsci/18.07.1/GNU/7.1/x86_64/lib -L/opt/cray/dmapp/default/lib64 -L/opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/lib -L/opt/cray/dmapp/default/lib64 -L/opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/lib -L/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/lib64 -L/opt/cray/pe/atp/2.1.3/libApp -L/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0 -L/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/../../.. CMakeFiles/cmTC_390ef.dir/CMakeFortranCompilerABI.F.o -rpath=/opt/cray/pe/gcc-libs -Bdynamic --no-as-needed -lAtpSigHandler -lAtpSigHCommData --undefined=_ATP_Data_Globals --undefined=__atpHandlerInstall -lrca --as-needed -lsci_gnu_71_mpi --no-as-needed --as-needed -lsci_gnu_71 --no-as-needed --as-needed -lmpich_gnu_71 --no-as-needed --as-needed -lmpichf90_gnu_71 --no-as-needed --as-needed -lgfortran -lquadmath --no-as-needed --as-needed -lpthread --no-as-needed -lgfortran -lm -lgcc_s -lgcc -lquadmath -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/crtend.o /usr/lib/../lib64/crtn.o +COLLECT_GCC_OPTIONS='-march=core-avx2' '-D' '__CRAYXC' '-D' '__CRAY_HASWELL' '-D' '__CRAYXT_COMPUTE_LINUX_TARGET' '-D' '__TARGET_LINUX__' '-v' '-o' 'cmTC_390ef' '-I' '/opt/cray/pe/libsci/18.07.1/GNU/7.1/x86_64/include' '-I' '/opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/include' '-I' '/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include' '-I' '/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include' '-I' '/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include' '-I' '/opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include' '-I' '/opt/cray/pe/pmi/5.0.14/include' '-I' '/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include' '-I' '/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include' '-I' '/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include' '-I' '/opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include' '-I' '/opt/cray-hss-devel/8.0.0/include' '-L/opt/cray/pe/libsci/18.07.1/GNU/7.1/x86_64/lib' '-L/opt/cray/dmapp/default/lib64' '-L/opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/lib' '-L/opt/cray/dmapp/default/lib64' '-L/opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/lib' '-L/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/lib64' '-L/opt/cray/pe/atp/2.1.3/libApp' '-shared-libgcc' +gmake[1]: Leaving directory '/tmp/ii/CMakeFiles/CMakeTmp' diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-Fortran-GNU-7.3.0.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-Fortran-GNU-7.3.0.output new file mode 100644 index 0000000..5b96c9d --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-Fortran-GNU-7.3.0.output @@ -0,0 +1 @@ +/opt/cray/pe/libsci/18.07.1/GNU/7.1/x86_64/include;/opt/cray/pe/mpt/7.7.3/gni/mpich-gnu/7.1/include;/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include;/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include;/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include;/opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include;/opt/cray/pe/pmi/5.0.14/include;/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include;/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include;/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include;/opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include;/opt/cray-hss-devel/8.0.0/include;/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/finclude;/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/include;/usr/local/include;/opt/gcc/7.3.0/snos/include;/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0/include-fixed;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-Fortran-Intel-18.0.2.20180210.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-Fortran-Intel-18.0.2.20180210.input new file mode 100644 index 0000000..4cdff74 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-Fortran-Intel-18.0.2.20180210.input @@ -0,0 +1,80 @@ +CMAKE_LANG=Fortran +CMAKE_Fortran_COMPILER_ABI=ELF +CMAKE_Fortran_COMPILER_AR= +CMAKE_Fortran_COMPILER_ARCHITECTURE_ID= +CMAKE_Fortran_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_Fortran_COMPILER_ID=Intel +CMAKE_Fortran_COMPILER_LAUNCHER= +CMAKE_Fortran_COMPILER_LOADED=1 +CMAKE_Fortran_COMPILER_RANLIB= +CMAKE_Fortran_COMPILER_TARGET= +CMAKE_Fortran_COMPILER_VERSION=18.0.2.20180210 +CMAKE_Fortran_COMPILER_VERSION_INTERAL= +Change Dir: /tmp/ii/CMakeFiles/CMakeTmp + +Run Build Command:"/usr/bin/gmake" "cmTC_7523d/fast" +/usr/bin/gmake -f CMakeFiles/cmTC_7523d.dir/build.make CMakeFiles/cmTC_7523d.dir/build +gmake[1]: Entering directory '/tmp/ii/CMakeFiles/CMakeTmp' +Building Fortran object CMakeFiles/cmTC_7523d.dir/CMakeFortranCompilerABI.F.o +/opt/cray/pe/craype/2.5.15/bin/ftn -v -c /usr/share/cmake/Modules/CMakeFortranCompilerABI.F -o CMakeFiles/cmTC_7523d.dir/CMakeFortranCompilerABI.F.o +ifort version 18.0.2 +/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/bin/intel64/fpp -D__INTEL_COMPILER=1800 -D__INTEL_COMPILER_UPDATE=2 -D__unix__ -D__unix -D__linux__ -D__linux -D__gnu_linux__ -Dunix -Dlinux -D__ELF__ -D__x86_64 -D__x86_64__ -D__amd64 -D__amd64__ -D__INTEL_COMPILER_BUILD_DATE=20180210 -D__INTEL_OFFLOAD -D__pentium4 -D__pentium4__ -D__tune_pentium4__ -D__SSE2__ -D__SSE2_MATH__ -D__SSE3__ -D__SSSE3__ -D__SSE4_1__ -D__SSE4_2__ -D__SSE__ -D__SSE_MATH__ -D__MMX__ -D__AVX__ -D__AVX_I__ -D__AVX2__ -D__FMA__ -D__CRAYXC -D__CRAY_HASWELL -D__CRAYXT_COMPUTE_LINUX_TARGET -I. -I/opt/cray/pe/libsci/18.07.1/INTEL/16.0/x86_64/include -I/opt/cray/pe/mpt/7.7.3/gni/mpich-intel/16.0/include -I/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include -I/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include -I/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include -I/opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include -I/opt/cray/pe/pmi/5.0.14/include -I/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include -I/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include -I/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include -I/opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include -I/opt/cray-hss-devel/8.0.0/include -I/opt/intel/2018.2.199/compilers_and_libraries_2018/linux/mkl/include -I/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/include/intel64 -I/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/include/icc -I/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/include -I/usr/local/include -I/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/include -I/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/include-fixed -I/opt/gcc/6.3.0/snos/include/ -I/usr/include -fixed -4Ycpp -4Ncvf -f_com=yes -MX /usr/share/cmake/Modules/CMakeFortranCompilerABI.F /tmp/ifortjocHCJ.i +#include "..." search starts here: +#include <...> search starts here: + . + /opt/cray/pe/libsci/18.07.1/INTEL/16.0/x86_64/include + /opt/cray/pe/mpt/7.7.3/gni/mpich-intel/16.0/include + /opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include + /opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include + /opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include + /opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include + /opt/cray/pe/pmi/5.0.14/include + /opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include + /opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include + /opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include + /opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include + /opt/cray-hss-devel/8.0.0/include + /opt/intel/2018.2.199/compilers_and_libraries_2018/linux/mkl/include + /opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/include/intel64 + /opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/include/icc + /opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/include + /usr/local/include + /opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/include + /opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/include-fixed + /opt/gcc/6.3.0/snos/include/ + /usr/include +End of search list. +/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/bin/intel64/fortcom -D__INTEL_COMPILER=1800 -D__INTEL_COMPILER_UPDATE=2 -D__unix__ -D__unix -D__linux__ -D__linux -D__gnu_linux__ -Dunix -Dlinux -D__ELF__ -D__x86_64 -D__x86_64__ -D__amd64 -D__amd64__ -D__INTEL_COMPILER_BUILD_DATE=20180210 -D__INTEL_OFFLOAD -D__pentium4 -D__pentium4__ -D__tune_pentium4__ -D__SSE2__ -D__SSE2_MATH__ -D__SSE3__ -D__SSSE3__ -D__SSE4_1__ -D__SSE4_2__ -D__SSE__ -D__SSE_MATH__ -D__MMX__ -D__AVX__ -D__AVX_I__ -D__AVX2__ -D__FMA__ -mGLOB_pack_sort_init_list -I/usr/share/cmake/Modules -I. -I/opt/cray/pe/libsci/18.07.1/INTEL/16.0/x86_64/include -I/opt/cray/pe/mpt/7.7.3/gni/mpich-intel/16.0/include -I/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include -I/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include -I/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include -I/opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include -I/opt/cray/pe/pmi/5.0.14/include -I/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include -I/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include -I/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include -I/opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include -I/opt/cray-hss-devel/8.0.0/include -I/opt/intel/2018.2.199/compilers_and_libraries_2018/linux/mkl/include -I/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/include/intel64 -I/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/include/icc -I/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/include -I/usr/local/include -I/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/include -I/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/include-fixed -I/opt/gcc/6.3.0/snos/include/ -I/usr/include -D__CRAYXC -D__CRAY_HASWELL -D__CRAYXT_COMPUTE_LINUX_TARGET -O2 "-reentrancy none" -simd -offload_host -mGLOB_em64t=TRUE -mP1OPT_version=18.0-intel64 -mGLOB_diag_file=CMakeFiles/cmTC_7523d.dir/CMakeFortranCompilerABI.F.diag -mGLOB_long_size_64 -mGLOB_routine_pointer_size_64 -mGLOB_source_language=GLOB_SOURCE_LANGUAGE_F90 -mP2OPT_static_promotion -mP1OPT_print_version=FALSE -mCG_use_gas_got_workaround=F -mP2OPT_align_option_used=TRUE -mGLOB_gcc_version=630 "-mGLOB_options_string=-I/opt/cray/pe/libsci/18.07.1/INTEL/16.0/x86_64/include -I/opt/cray/pe/mpt/7.7.3/gni/mpich-intel/16.0/include -I/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include -I/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include -I/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include -I/opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include -I/opt/cray/pe/pmi/5.0.14/include -I/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include -I/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include -I/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include -I/opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include -I/opt/cray-hss-devel/8.0.0/include -xCORE-AVX2 -static -D__CRAYXC -D__CRAY_HASWELL -D__CRAYXT_COMPUTE_LINUX_TARGET -v -c -o CMakeFiles/cmTC_7523d.dir/CMakeFortranCompilerABI.F.o" -mGLOB_cxx_limited_range=FALSE -mCG_extend_parms=FALSE -mGLOB_compiler_bin_directory=/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/bin/intel64 -mGLOB_as_output_backup_file_name=/tmp/ifortYH2Bi3as_.s -mIPOPT_activate -mIPOPT_lite -mGLOB_instruction_tuning=0x0 -mGLOB_uarch_tuning=0x0 -mGLOB_product_id_code=0x22006d90 -mCG_bnl_movbe=T -mGLOB_extended_instructions=0x4000 -mGLOB_advanced_optim=TRUE -mP3OPT_use_mspp_call_convention -mP2OPT_subs_out_of_bound=FALSE -mP2OPT_disam_type_based_disam=2 -mGLOB_ansi_alias -mPGOPTI_value_profile_use=T -mP2OPT_il0_array_sections=TRUE -mGLOB_offload_mode=1 -mP2OPT_offload_unique_var_string=ifort0690104118gDFZUy -mP2OPT_hlo_level=2 -mP2OPT_hlo -mP2OPT_hpo_rtt_control=0 -mIPOPT_args_in_regs=0 -mP2OPT_disam_assume_nonstd_intent_in=FALSE -mGLOB_imf_mapping_library=/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/bin/intel64/libiml_attr.so -mPGOPTI_gen_threadsafe_level=0 -mIPOPT_lto_object_enabled -mIPOPT_lto_object_value=1 -mIPOPT_obj_output_file_name=CMakeFiles/cmTC_7523d.dir/CMakeFortranCompilerABI.F.o -mIPOPT_whole_archive_fixup_file_name=/tmp/ifortwarch8cLx6A -mGLOB_linker_version=2.31.1.20180828 -mGLOB_driver_tempfile_name=/tmp/iforttempfiledtmF0m -mP3OPT_asm_target=P3OPT_ASM_TARGET_GAS -mGLOB_async_unwind_tables=TRUE -mGLOB_obj_output_file=CMakeFiles/cmTC_7523d.dir/CMakeFortranCompilerABI.F.o -mGLOB_source_dialect=GLOB_SOURCE_DIALECT_FORTRAN -mP1OPT_source_file_name=/usr/share/cmake/Modules/CMakeFortranCompilerABI.F -mP1OPT_full_source_file_name=/usr/share/cmake/Modules/CMakeFortranCompilerABI.F -mP2OPT_symtab_type_copy=true /tmp/ifortjocHCJ.i +#include "..." search starts here: +#include <...> search starts here: + /usr/share/cmake/Modules + . + /opt/cray/pe/libsci/18.07.1/INTEL/16.0/x86_64/include + /opt/cray/pe/mpt/7.7.3/gni/mpich-intel/16.0/include + /opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include + /opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include + /opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include + /opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include + /opt/cray/pe/pmi/5.0.14/include + /opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include + /opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include + /opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include + /opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include + /opt/cray-hss-devel/8.0.0/include + /opt/intel/2018.2.199/compilers_and_libraries_2018/linux/mkl/include + /opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/include/intel64 + /opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/include/icc + /opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/include + /usr/local/include + /opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/include + /opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/include-fixed + /opt/gcc/6.3.0/snos/include/ + /usr/include +End of search list. +Linking Fortran executable cmTC_7523d +/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_7523d.dir/link.txt --verbose=1 +/opt/cray/pe/craype/2.5.15/bin/ftn -v CMakeFiles/cmTC_7523d.dir/CMakeFortranCompilerABI.F.o -o cmTC_7523d +ifort version 18.0.2 +/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/bin/intel64/fortcom -mGLOB_em64t=TRUE -mP1OPT_version=18.0-intel64 -mGLOB_diag_file=CMakeFiles/cmTC_7523d.dir/CMakeFortranCompilerABI.F.diag -mGLOB_long_size_64 -mGLOB_routine_pointer_size_64 -mGLOB_source_language=GLOB_SOURCE_LANGUAGE_F90 -mP2OPT_static_promotion -mP1OPT_print_version=FALSE -mCG_use_gas_got_workaround=F -mP2OPT_align_option_used=TRUE -mGLOB_gcc_version=630 "-mGLOB_options_string=-I/opt/cray/pe/libsci/18.07.1/INTEL/16.0/x86_64/include -I/opt/cray/pe/mpt/7.7.3/gni/mpich-intel/16.0/include -I/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include -I/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include -I/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include -I/opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include -I/opt/cray/pe/pmi/5.0.14/include -I/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include -I/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include -I/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include -I/opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include -I/opt/cray-hss-devel/8.0.0/include -xCORE-AVX2 -static -D__CRAYXC -D__CRAY_HASWELL -D__CRAYXT_COMPUTE_LINUX_TARGET -v -o cmTC_7523d -L/opt/cray/pe/libsci/18.07.1/INTEL/16.0/x86_64/lib -L/opt/cray/dmapp/default/lib64 -L/opt/cray/pe/mpt/7.7.3/gni/mpich-intel/16.0/lib -L/opt/cray/dmapp/default/lib64 -L/opt/cray/pe/mpt/7.7.3/gni/mpich-intel/16.0/lib -L/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/lib64 -L/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/lib64 -L/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/lib64 -L/opt/cray/pe/pmi/5.0.14/lib64 -L/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/lib64 -L/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/lib64 -L/opt/cray/pe/atp/2.1.3/libApp -L/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/lib64 -Wl,-Ttext-segment=0x20000000,-zmax-page-size=0x20000000 -Wl,--whole-archive,-lhugetlbfs,--no-whole-archive -Wl,--no-as-needed,-lAtpSigHandler,-lAtpSigHCommData -Wl,--undefined=_ATP_Data_Globals -Wl,--undefined=__atpHandlerInstall -lpthread -lmpichf90_intel -lrt -lugni -lpmi -lm -lpthread -ldl -lsci_intel_mpi -lsci_intel -lm -ldl -lmpich_intel -lrt -lugni -lpthread -lpmi -lm -ldl -lpmi -lpthread -lalpslli -lpthread -lwlm_detect -lalpsutil -lpthread -lrca -lxpmem -lugni -lpthread -ludreg -lsci_intel -lm -lpthread -ldl -lhugetlbfs -Wl,--as-needed,-limf,--no-as-needed -Wl,--as-needed,-lm,--no-as-needed -Wl,--as-needed,-lpthread,--no-as-needed" -mGLOB_cxx_limited_range=FALSE -mCG_extend_parms=FALSE -mGLOB_compiler_bin_directory=/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/bin/intel64 -mGLOB_as_output_backup_file_name=/tmp/ifort3JZMSVas_.s -mGLOB_dashboard_use_source_name -mIPOPT_activate -mGLOB_product_id_code=0x22006d90 -mGLOB_extended_instructions=0x4000 -mGLOB_advanced_optim=TRUE -mP3OPT_use_mspp_call_convention -mP2OPT_subs_out_of_bound=FALSE -mP2OPT_disam_type_based_disam=2 -mGLOB_ansi_alias -mPGOPTI_value_profile_use=T -mGLOB_opt_report_use_source_name -mP2OPT_il0_array_sections=TRUE -mGLOB_offload_mode=1 -mP2OPT_offload_unique_var_string=ifort0690373519HAIHNw -mP2OPT_hlo -mP2OPT_hpo_rtt_control=0 -mIPOPT_args_in_regs=0 -mP2OPT_disam_assume_nonstd_intent_in=FALSE -mGLOB_imf_mapping_library=/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/bin/intel64/libiml_attr.so -mPGOPTI_gen_threadsafe_level=0 -mIPOPT_link -mIPOPT_ipo_activate -mIPOPT_mo_activate -mIPOPT_source_files_list=/tmp/ifortslis6v0DlA -mIPOPT_mo_global_data -mIPOPT_link_script_file=/tmp/ifortscriptsKB8Qm "-mIPOPT_cmdline_link="/usr/lib/../lib64/crt1.o" "/usr/lib/../lib64/crti.o" "/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/crtbeginT.o" "--build-id" "-static" "-m" "elf_x86_64" "-L/opt/cray/pe/libsci/18.07.1/INTEL/16.0/x86_64/lib" "-L/opt/cray/dmapp/default/lib64" "-L/opt/cray/pe/mpt/7.7.3/gni/mpich-intel/16.0/lib" "-L/opt/cray/dmapp/default/lib64" "-L/opt/cray/pe/mpt/7.7.3/gni/mpich-intel/16.0/lib" "-L/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/lib64" "-L/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/lib64" "-L/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/lib64" "-L/opt/cray/pe/pmi/5.0.14/lib64" "-L/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/lib64" "-L/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/lib64" "-L/opt/cray/pe/atp/2.1.3/libApp" "-L/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/lib64" "-o" "cmTC_7523d" "/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/lib/intel64_lin/for_main.o" "-L/opt/intel/2018.2.199/compilers_and_libraries_2018/linux/mkl/lib/intel64" "-L/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/lib/intel64_lin" "-L/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/" "-L/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/../../../../lib64" "-L/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/../../../../lib64/" "-L/lib/../lib64" "-L/lib/../lib64/" "-L/usr/lib/../lib64" "-L/usr/lib/../lib64/" "-L/opt/intel/2018.2.199/compilers_and_libraries_2018/linux/mkl/lib/intel64/" "-L/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/../../../" "-L/lib64" "-L/lib/" "-L/usr/lib64" "-L/usr/lib" "CMakeFiles/cmTC_7523d.dir/CMakeFortranCompilerABI.F.o" "-Ttext-segment=0x20000000" "-zmax-page-size=0x20000000" "--whole-archive" "-lhugetlbfs" "--no-whole-archive" "--no-as-needed" "-lAtpSigHandler" "-lAtpSigHCommData" "--undefined=_ATP_Data_Globals" "--undefined=__atpHandlerInstall" "-lpthread" "-lmpichf90_intel" "-lrt" "-lugni" "-lpmi" "-L/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/lib/intel64_lin" "-limf" "-lm" "-lpthread" "-ldl" "-lsci_intel_mpi" "-lsci_intel" "-L/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/lib/intel64_lin" "-limf" "-lm" "-ldl" "-lmpich_intel" "-lrt" "-lugni" "-lpthread" "-lpmi" "-L/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/lib/intel64_lin" "-limf" "-lm" "-ldl" "-lpmi" "-lpthread" "-lalpslli" "-lpthread" "-lwlm_detect" "-lalpsutil" "-lpthread" "-lrca" "-lxpmem" "-lugni" "-lpthread" "-ludreg" "-lsci_intel" "-L/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/lib/intel64_lin" "-limf" "-lm" "-lpthread" "-ldl" "-lhugetlbfs" "--as-needed" "-limf" "--no-as-needed" "--as-needed" "-lm" "--no-as-needed" "--as-needed" "-lpthread" "--no-as-needed" "-lifport" "-lifcore" "-limf" "-lsvml" "-lm" "-lipgo" "-lirc" "-lsvml" "-lc" "-lgcc" "-lgcc_eh" "-lirc_s" "-ldl" "-lc" "/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/crtend.o" "/usr/lib/../lib64/crtn.o"" -mIPOPT_il_in_obj -mIPOPT_ipo_activate_warn=FALSE -mIPOPT_obj_output_file_name=/tmp/ipo_ifort5KgIiT.o -mIPOPT_whole_archive_fixup_file_name=/tmp/ifortwarchltBXsh -mGLOB_linker_version=2.31.1.20180828 -mGLOB_driver_tempfile_name=/tmp/iforttempfilesugt03 -mP3OPT_asm_target=P3OPT_ASM_TARGET_GAS -mGLOB_async_unwind_tables=TRUE -mGLOB_obj_output_file=/tmp/ipo_ifort5KgIiT.o -mGLOB_source_dialect=GLOB_SOURCE_DIALECT_NONE -mP1OPT_source_file_name=ipo_out.f -mP2OPT_symtab_type_copy=true CMakeFiles/cmTC_7523d.dir/CMakeFortranCompilerABI.F.o -mIPOPT_object_files=T -mIPOPT_assembly_files=/tmp/ifortalisCY2Fjs -mIPOPT_generated_tempfiles=/tmp/ifortelisXEqaPe -mIPOPT_embedded_object_base_name=/tmp/iforteobjRoVEk1 -mIPOPT_cmdline_link_new_name=/tmp/ifortllisJHg9PN +ld /usr/lib/../lib64/crt1.o /usr/lib/../lib64/crti.o /opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/crtbeginT.o --build-id -static -m elf_x86_64 -L/opt/cray/pe/libsci/18.07.1/INTEL/16.0/x86_64/lib -L/opt/cray/dmapp/default/lib64 -L/opt/cray/pe/mpt/7.7.3/gni/mpich-intel/16.0/lib -L/opt/cray/dmapp/default/lib64 -L/opt/cray/pe/mpt/7.7.3/gni/mpich-intel/16.0/lib -L/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/lib64 -L/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/lib64 -L/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/lib64 -L/opt/cray/pe/pmi/5.0.14/lib64 -L/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/lib64 -L/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/lib64 -L/opt/cray/pe/atp/2.1.3/libApp -L/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/lib64 -o cmTC_7523d /opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/lib/intel64_lin/for_main.o -L/opt/intel/2018.2.199/compilers_and_libraries_2018/linux/mkl/lib/intel64 -L/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/lib/intel64_lin -L/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/ -L/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/../../../../lib64 -L/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/../../../../lib64/ -L/lib/../lib64 -L/lib/../lib64/ -L/usr/lib/../lib64 -L/usr/lib/../lib64/ -L/opt/intel/2018.2.199/compilers_and_libraries_2018/linux/mkl/lib/intel64/ -L/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/../../../ -L/lib64 -L/lib/ -L/usr/lib64 -L/usr/lib CMakeFiles/cmTC_7523d.dir/CMakeFortranCompilerABI.F.o -Ttext-segment=0x20000000 -zmax-page-size=0x20000000 --whole-archive -lhugetlbfs --no-whole-archive --no-as-needed -lAtpSigHandler -lAtpSigHCommData --undefined=_ATP_Data_Globals --undefined=__atpHandlerInstall -lpthread -lmpichf90_intel -lrt -lugni -lpmi -L/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/lib/intel64_lin -limf -lm -lpthread -ldl -lsci_intel_mpi -lsci_intel -L/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/lib/intel64_lin -limf -lm -ldl -lmpich_intel -lrt -lugni -lpthread -lpmi -L/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/lib/intel64_lin -limf -lm -ldl -lpmi -lpthread -lalpslli -lpthread -lwlm_detect -lalpsutil -lpthread -lrca -lxpmem -lugni -lpthread -ludreg -lsci_intel -L/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/lib/intel64_lin -limf -lm -lpthread -ldl -lhugetlbfs --as-needed -limf --no-as-needed --as-needed -lm --no-as-needed --as-needed -lpthread --no-as-needed -lifport -lifcore -limf -lsvml -lm -lipgo -lirc -lsvml -lc -lgcc -lgcc_eh -lirc_s -ldl -lc /opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/crtend.o /usr/lib/../lib64/crtn.o +gmake[1]: Leaving directory '/tmp/ii/CMakeFiles/CMakeTmp' diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-Fortran-Intel-18.0.2.20180210.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-Fortran-Intel-18.0.2.20180210.output new file mode 100644 index 0000000..c3915b6 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-Fortran-Intel-18.0.2.20180210.output @@ -0,0 +1 @@ +.;/opt/cray/pe/libsci/18.07.1/INTEL/16.0/x86_64/include;/opt/cray/pe/mpt/7.7.3/gni/mpich-intel/16.0/include;/opt/cray/rca/2.2.16-6.0.5.0_15.34__g5e09e6d.ari/include;/opt/cray/alps/6.5.28-6.0.5.0_18.6__g13a91b6.ari/include;/opt/cray/xpmem/2.2.4-6.0.5.1_8.26__g35d5e73.ari/include;/opt/cray/gni-headers/5.0.12-6.0.5.0_2.15__g2ef1ebc.ari/include;/opt/cray/pe/pmi/5.0.14/include;/opt/cray/ugni/6.0.14-6.0.5.0_16.9__g19583bb.ari/include;/opt/cray/udreg/2.3.2-6.0.5.0_13.12__ga14955a.ari/include;/opt/cray/wlm_detect/1.3.2-6.0.5.0_3.1__g388ccd5.ari/include;/opt/cray/krca/2.2.2-6.0.5.1_13.47__g4614cf3.ari/include;/opt/cray-hss-devel/8.0.0/include;/opt/intel/2018.2.199/compilers_and_libraries_2018/linux/mkl/include;/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/include/intel64;/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/include/icc;/opt/intel/2018.2.199/compilers_and_libraries_2018.2.199/linux/compiler/include;/usr/local/include;/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/include;/opt/gcc/6.3.0/snos/lib/gcc/x86_64-suse-linux/6.3.0/include-fixed;/opt/gcc/6.3.0/snos/include/;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/freebsd-Fortran-GNU-4.6.4.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/freebsd-Fortran-GNU-4.6.4.input new file mode 100644 index 0000000..8a5d741 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/freebsd-Fortran-GNU-4.6.4.input @@ -0,0 +1,78 @@ +CMAKE_LANG=Fortran +CMAKE_Fortran_COMPILER_ABI= +CMAKE_Fortran_COMPILER_AR= +CMAKE_Fortran_COMPILER_ARCHITECTURE_ID= +CMAKE_Fortran_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_Fortran_COMPILER_ID=GNU +CMAKE_Fortran_COMPILER_LAUNCHER= +CMAKE_Fortran_COMPILER_LOADED=1 +CMAKE_Fortran_COMPILER_RANLIB= +CMAKE_Fortran_COMPILER_TARGET= +CMAKE_Fortran_COMPILER_VERSION=4.6.4 +CMAKE_Fortran_COMPILER_VERSION_INTERAL= +Change Dir: /tmp/ii/CMakeFiles/CMakeTmp + +Run Build Command:"/usr/local/bin/gmake" "cmTC_9ec75/fast" +/usr/local/bin/gmake -f CMakeFiles/cmTC_9ec75.dir/build.make CMakeFiles/cmTC_9ec75.dir/build +gmake[1]: Entering directory `/tmp/ii/CMakeFiles/CMakeTmp' +Building Fortran object CMakeFiles/cmTC_9ec75.dir/CMakeFortranCompilerABI.F.o +/usr/local/bin/gfortran46 -v -c /usr/local/share/cmake-3.7/Modules/CMakeFortranCompilerABI.F -o CMakeFiles/cmTC_9ec75.dir/CMakeFortranCompilerABI.F.o +Using built-in specs. +COLLECT_GCC=/usr/local/bin/gfortran46 +COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc46/gcc/x86_64-portbld-freebsd10.0/4.6.4/lto-wrapper +Target: x86_64-portbld-freebsd10.0 +Configured with: ./../gcc-4.6.4/configure --disable-bootstrap --disable-nls --libdir=/usr/local/lib/gcc46 --libexecdir=/usr/local/libexec/gcc46 --program-suffix=46 --with-as=/usr/local/bin/as --with-gmp=/usr/local --with-gxx-include-dir=/usr/local/lib/gcc46/include/c++/ --with-ld=/usr/local/bin/ld --with-pkgversion='FreeBSD Ports Collection' --with-system-zlib --disable-libgcj --enable-languages=c,c++,objc,fortran --prefix=/usr/local --mandir=/usr/local/man --infodir=/usr/local/info/gcc46 --build=x86_64-portbld-freebsd10.0 +Thread model: posix +gcc version 4.6.4 (FreeBSD Ports Collection) +COLLECT_GCC_OPTIONS='-v' '-c' '-o' 'CMakeFiles/cmTC_9ec75.dir/CMakeFortranCompilerABI.F.o' '-mtune=generic' '-march=x86-64' + /usr/local/libexec/gcc46/gcc/x86_64-portbld-freebsd10.0/4.6.4/f951 /usr/local/share/cmake-3.7/Modules/CMakeFortranCompilerABI.F -ffixed-form -cpp=/tmp//ccp5PsLd.f90 -quiet -v /usr/local/share/cmake-3.7/Modules/CMakeFortranCompilerABI.F -quiet -dumpbase CMakeFortranCompilerABI.F -mtune=generic -march=x86-64 -auxbase-strip CMakeFiles/cmTC_9ec75.dir/CMakeFortranCompilerABI.F.o -version -fintrinsic-modules-path /usr/local/lib/gcc46/gcc/x86_64-portbld-freebsd10.0/4.6.4/finclude -o /tmp//ccGWxrQ5.s +GNU Fortran (FreeBSD Ports Collection) version 4.6.4 (x86_64-portbld-freebsd10.0) + compiled by GNU C version 4.2.1 Compatible FreeBSD Clang 3.3 (tags/RELEASE_33/final 183502), GMP version 5.1.3, MPFR version 3.1.2, MPC version 1.0.1 +GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 +ignoring nonexistent directory "/usr/local/lib/gcc46/gcc/x86_64-portbld-freebsd10.0/4.6.4/../../../../../x86_64-portbld-freebsd10.0/include" +#include "..." search starts here: +#include <...> search starts here: + /usr/local/lib/gcc46/gcc/x86_64-portbld-freebsd10.0/4.6.4/finclude + /usr/local/lib/gcc46/gcc/x86_64-portbld-freebsd10.0/4.6.4/include + /usr/local/include + /usr/local/lib/gcc46/gcc/x86_64-portbld-freebsd10.0/4.6.4/include-fixed + /usr/include +End of search list. +GNU Fortran (FreeBSD Ports Collection) version 4.6.4 (x86_64-portbld-freebsd10.0) + compiled by GNU C version 4.2.1 Compatible FreeBSD Clang 3.3 (tags/RELEASE_33/final 183502), GMP version 5.1.3, MPFR version 3.1.2, MPC version 1.0.1 +GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 +COLLECT_GCC_OPTIONS='-v' '-c' '-o' 'CMakeFiles/cmTC_9ec75.dir/CMakeFortranCompilerABI.F.o' '-mtune=generic' '-march=x86-64' + /usr/local/bin/as -v -o CMakeFiles/cmTC_9ec75.dir/CMakeFortranCompilerABI.F.o /tmp//ccGWxrQ5.s +GNU assembler version 2.23.2 (x86_64-portbld-freebsd10.0) using BFD version (GNU Binutils) 2.23.2 +COMPILER_PATH=/usr/local/libexec/gcc46/gcc/x86_64-portbld-freebsd10.0/4.6.4/:/usr/local/libexec/gcc46/gcc/x86_64-portbld-freebsd10.0/4.6.4/:/usr/local/libexec/gcc46/gcc/x86_64-portbld-freebsd10.0/:/usr/local/lib/gcc46/gcc/x86_64-portbld-freebsd10.0/4.6.4/:/usr/local/lib/gcc46/gcc/x86_64-portbld-freebsd10.0/:/usr/local/lib/gcc46/gcc/x86_64-portbld-freebsd10.0/4.6.4/../../../../../x86_64-portbld-freebsd10.0/bin/ +LIBRARY_PATH=/usr/local/lib/gcc46/gcc/x86_64-portbld-freebsd10.0/4.6.4/:/usr/local/lib/gcc46/gcc/x86_64-portbld-freebsd10.0/4.6.4/../../../../../x86_64-portbld-freebsd10.0/lib/:/usr/local/lib/gcc46/gcc/x86_64-portbld-freebsd10.0/4.6.4/../../../:/lib/:/usr/lib/ +COLLECT_GCC_OPTIONS='-v' '-c' '-o' 'CMakeFiles/cmTC_9ec75.dir/CMakeFortranCompilerABI.F.o' '-mtune=generic' '-march=x86-64' +Linking Fortran executable cmTC_9ec75 +/usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTC_9ec75.dir/link.txt --verbose=1 +/usr/local/bin/gfortran46 -v CMakeFiles/cmTC_9ec75.dir/CMakeFortranCompilerABI.F.o -o cmTC_9ec75 +Driving: /usr/local/bin/gfortran46 -v CMakeFiles/cmTC_9ec75.dir/CMakeFortranCompilerABI.F.o -o cmTC_9ec75 -l gfortran -l m -shared-libgcc +Using built-in specs. +COLLECT_GCC=/usr/local/bin/gfortran46 +COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc46/gcc/x86_64-portbld-freebsd10.0/4.6.4/lto-wrapper +Target: x86_64-portbld-freebsd10.0 +Configured with: ./../gcc-4.6.4/configure --disable-bootstrap --disable-nls --libdir=/usr/local/lib/gcc46 --libexecdir=/usr/local/libexec/gcc46 --program-suffix=46 --with-as=/usr/local/bin/as --with-gmp=/usr/local --with-gxx-include-dir=/usr/local/lib/gcc46/include/c++/ --with-ld=/usr/local/bin/ld --with-pkgversion='FreeBSD Ports Collection' --with-system-zlib --disable-libgcj --enable-languages=c,c++,objc,fortran --prefix=/usr/local --mandir=/usr/local/man --infodir=/usr/local/info/gcc46 --build=x86_64-portbld-freebsd10.0 +Thread model: posix +gcc version 4.6.4 (FreeBSD Ports Collection) +Reading specs from /usr/local/lib/gcc46/gcc/x86_64-portbld-freebsd10.0/4.6.4/../../../libgfortran.spec +rename spec lib to liborig +COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_9ec75' '-shared-libgcc' '-mtune=generic' '-march=x86-64' +COMPILER_PATH=/usr/local/libexec/gcc46/gcc/x86_64-portbld-freebsd10.0/4.6.4/:/usr/local/libexec/gcc46/gcc/x86_64-portbld-freebsd10.0/4.6.4/:/usr/local/libexec/gcc46/gcc/x86_64-portbld-freebsd10.0/:/usr/local/lib/gcc46/gcc/x86_64-portbld-freebsd10.0/4.6.4/:/usr/local/lib/gcc46/gcc/x86_64-portbld-freebsd10.0/:/usr/local/lib/gcc46/gcc/x86_64-portbld-freebsd10.0/4.6.4/../../../../../x86_64-portbld-freebsd10.0/bin/ +LIBRARY_PATH=/usr/local/lib/gcc46/gcc/x86_64-portbld-freebsd10.0/4.6.4/:/usr/local/lib/gcc46/gcc/x86_64-portbld-freebsd10.0/4.6.4/../../../../../x86_64-portbld-freebsd10.0/lib/:/usr/local/lib/gcc46/gcc/x86_64-portbld-freebsd10.0/4.6.4/../../../:/lib/:/usr/lib/ +COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_9ec75' '-shared-libgcc' '-mtune=generic' '-march=x86-64' + /usr/local/libexec/gcc46/gcc/x86_64-portbld-freebsd10.0/4.6.4/collect2 --eh-frame-hdr -V -dynamic-linker /libexec/ld-elf.so.1 -o cmTC_9ec75 /usr/lib/crt1.o /usr/lib/crti.o /usr/local/lib/gcc46/gcc/x86_64-portbld-freebsd10.0/4.6.4/crtbegin.o -L/usr/local/lib/gcc46/gcc/x86_64-portbld-freebsd10.0/4.6.4 -L/usr/local/lib/gcc46/gcc/x86_64-portbld-freebsd10.0/4.6.4/../../../../../x86_64-portbld-freebsd10.0/lib -L/usr/local/lib/gcc46/gcc/x86_64-portbld-freebsd10.0/4.6.4/../../.. CMakeFiles/cmTC_9ec75.dir/CMakeFortranCompilerABI.F.o -lgfortran -lm -lgcc_s -lgcc -lquadmath -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/local/lib/gcc46/gcc/x86_64-portbld-freebsd10.0/4.6.4/crtend.o /usr/lib/crtn.o +GNU ld (GNU Binutils) 2.23.2 + Supported emulations: + elf_x86_64_fbsd + elf_i386_fbsd + elf_x86_64 + elf_i386 + elf_l1om + elf_l1om_fbsd + elf_k1om + elf_k1om_fbsd +gmake[1]: Leaving directory `/tmp/ii/CMakeFiles/CMakeTmp' diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/freebsd-Fortran-GNU-4.6.4.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/freebsd-Fortran-GNU-4.6.4.output new file mode 100644 index 0000000..c0aee11 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/freebsd-Fortran-GNU-4.6.4.output @@ -0,0 +1 @@ +/usr/local/lib/gcc46/gcc/x86_64-portbld-freebsd10.0/4.6.4/finclude;/usr/local/lib/gcc46/gcc/x86_64-portbld-freebsd10.0/4.6.4/include;/usr/local/include;/usr/local/lib/gcc46/gcc/x86_64-portbld-freebsd10.0/4.6.4/include-fixed;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-Fortran-GNU-7.3.0.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-Fortran-GNU-7.3.0.input new file mode 100644 index 0000000..4582433 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-Fortran-GNU-7.3.0.input @@ -0,0 +1,76 @@ +CMAKE_LANG=Fortran +CMAKE_Fortran_COMPILER_ABI= +CMAKE_Fortran_COMPILER_AR=/usr/bin/gcc-ar-7 +CMAKE_Fortran_COMPILER_ARCHITECTURE_ID= +CMAKE_Fortran_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_Fortran_COMPILER_ID=GNU +CMAKE_Fortran_COMPILER_LAUNCHER= +CMAKE_Fortran_COMPILER_LOADED=1 +CMAKE_Fortran_COMPILER_RANLIB=/usr/bin/gcc-ranlib-7 +CMAKE_Fortran_COMPILER_TARGET= +CMAKE_Fortran_COMPILER_VERSION=7.3.0 +CMAKE_Fortran_COMPILER_VERSION_INTERAL= +Change Dir: /tmp/ii/CMakeFiles/CMakeTmp + +Run Build Command:"/usr/bin/make" "cmTC_1cf45/fast" +/usr/bin/make -f CMakeFiles/cmTC_1cf45.dir/build.make CMakeFiles/cmTC_1cf45.dir/build +make[1]: Entering directory '/tmp/ii/CMakeFiles/CMakeTmp' +Building Fortran object CMakeFiles/cmTC_1cf45.dir/CMakeFortranCompilerABI.F.o +/usr/bin/f95 -v -c /proj/TableFS/data/chuck/cmake/f/share/cmake-3.13/Modules/CMakeFortranCompilerABI.F -o CMakeFiles/cmTC_1cf45.dir/CMakeFortranCompilerABI.F.o +Using built-in specs. +COLLECT_GCC=/usr/bin/f95 +OFFLOAD_TARGET_NAMES=nvptx-none +OFFLOAD_TARGET_DEFAULT=1 +Target: x86_64-linux-gnu +Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.3.0-27ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu +Thread model: posix +gcc version 7.3.0 (Ubuntu 7.3.0-27ubuntu1~18.04) +COLLECT_GCC_OPTIONS='-v' '-c' '-o' 'CMakeFiles/cmTC_1cf45.dir/CMakeFortranCompilerABI.F.o' '-mtune=generic' '-march=x86-64' + /usr/lib/gcc/x86_64-linux-gnu/7/f951 /proj/TableFS/data/chuck/cmake/f/share/cmake-3.13/Modules/CMakeFortranCompilerABI.F -ffixed-form -cpp=/tmp/cc9yADLU.f90 -quiet -v -imultiarch x86_64-linux-gnu /proj/TableFS/data/chuck/cmake/f/share/cmake-3.13/Modules/CMakeFortranCompilerABI.F -quiet -dumpbase CMakeFortranCompilerABI.F -mtune=generic -march=x86-64 -auxbase-strip CMakeFiles/cmTC_1cf45.dir/CMakeFortranCompilerABI.F.o -version -fintrinsic-modules-path /usr/lib/gcc/x86_64-linux-gnu/7/finclude -o /tmp/ccH7qQQk.s +GNU Fortran (Ubuntu 7.3.0-27ubuntu1~18.04) version 7.3.0 (x86_64-linux-gnu) + compiled by GNU C version 7.3.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version isl-0.19-GMP + +GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 +ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu" +ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/7/../../../../x86_64-linux-gnu/include" +#include "..." search starts here: +#include <...> search starts here: + /usr/lib/gcc/x86_64-linux-gnu/7/finclude + /usr/lib/gcc/x86_64-linux-gnu/7/include + /usr/local/include + /usr/lib/gcc/x86_64-linux-gnu/7/include-fixed + /usr/include/x86_64-linux-gnu + /usr/include +End of search list. +GNU Fortran2008 (Ubuntu 7.3.0-27ubuntu1~18.04) version 7.3.0 (x86_64-linux-gnu) + compiled by GNU C version 7.3.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version isl-0.19-GMP + +GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 +COLLECT_GCC_OPTIONS='-v' '-c' '-o' 'CMakeFiles/cmTC_1cf45.dir/CMakeFortranCompilerABI.F.o' '-mtune=generic' '-march=x86-64' + as -v --64 -o CMakeFiles/cmTC_1cf45.dir/CMakeFortranCompilerABI.F.o /tmp/ccH7qQQk.s +GNU assembler version 2.30 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.30 +COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/ +LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/7/../../../:/lib/:/usr/lib/ +COLLECT_GCC_OPTIONS='-v' '-c' '-o' 'CMakeFiles/cmTC_1cf45.dir/CMakeFortranCompilerABI.F.o' '-mtune=generic' '-march=x86-64' +Linking Fortran executable cmTC_1cf45 +/proj/TableFS/data/chuck/cmake/f/bin/cmake -E cmake_link_script CMakeFiles/cmTC_1cf45.dir/link.txt --verbose=1 +/usr/bin/f95 -v CMakeFiles/cmTC_1cf45.dir/CMakeFortranCompilerABI.F.o -o cmTC_1cf45 +Driving: /usr/bin/f95 -v CMakeFiles/cmTC_1cf45.dir/CMakeFortranCompilerABI.F.o -o cmTC_1cf45 -l gfortran -l m -shared-libgcc +Using built-in specs. +COLLECT_GCC=/usr/bin/f95 +COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper +OFFLOAD_TARGET_NAMES=nvptx-none +OFFLOAD_TARGET_DEFAULT=1 +Target: x86_64-linux-gnu +Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.3.0-27ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu +Thread model: posix +gcc version 7.3.0 (Ubuntu 7.3.0-27ubuntu1~18.04) +Reading specs from /usr/lib/gcc/x86_64-linux-gnu/7/libgfortran.spec +rename spec lib to liborig +COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_1cf45' '-shared-libgcc' '-mtune=generic' '-march=x86-64' +COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/ +LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/7/../../../:/lib/:/usr/lib/ +COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_1cf45' '-shared-libgcc' '-mtune=generic' '-march=x86-64' + /usr/lib/gcc/x86_64-linux-gnu/7/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/7/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper -plugin-opt=-fresolution=/tmp/ccS0UYIY.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lquadmath -plugin-opt=-pass-through=-lm -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --sysroot=/ --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o cmTC_1cf45 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/7/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/7 -L/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/7/../../.. CMakeFiles/cmTC_1cf45.dir/CMakeFortranCompilerABI.F.o -lgfortran -lm -lgcc_s -lgcc -lquadmath -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/7/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crtn.o +COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_1cf45' '-shared-libgcc' '-mtune=generic' '-march=x86-64' +make[1]: Leaving directory '/tmp/ii/CMakeFiles/CMakeTmp' diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-Fortran-GNU-7.3.0.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-Fortran-GNU-7.3.0.output new file mode 100644 index 0000000..d84842b --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-Fortran-GNU-7.3.0.output @@ -0,0 +1 @@ +/usr/lib/gcc/x86_64-linux-gnu/7/finclude;/usr/lib/gcc/x86_64-linux-gnu/7/include;/usr/local/include;/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed;/usr/include/x86_64-linux-gnu;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-Fortran-XL-14.1.0.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-Fortran-XL-14.1.0.input new file mode 100644 index 0000000..d80cede --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-Fortran-XL-14.1.0.input @@ -0,0 +1,50 @@ +CMAKE_LANG=Fortran +CMAKE_Fortran_COMPILER_ABI=ELF +CMAKE_Fortran_COMPILER_AR= +CMAKE_Fortran_COMPILER_ARCHITECTURE_ID= +CMAKE_Fortran_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_Fortran_COMPILER_ID=XL +CMAKE_Fortran_COMPILER_LAUNCHER= +CMAKE_Fortran_COMPILER_LOADED=1 +CMAKE_Fortran_COMPILER_RANLIB= +CMAKE_Fortran_COMPILER_TARGET= +CMAKE_Fortran_COMPILER_VERSION=14.1.0 +CMAKE_Fortran_COMPILER_VERSION_INTERAL= +Change Dir: /tmp/ii/CMakeFiles/CMakeTmp + +Run Build Command:"/usr/bin/gmake" "cmTC_d05a9/fast" +/usr/bin/gmake -f CMakeFiles/cmTC_d05a9.dir/build.make CMakeFiles/cmTC_d05a9.dir/build +gmake[1]: Entering directory `/tmp/ii/CMakeFiles/CMakeTmp' +Building Fortran object CMakeFiles/cmTC_d05a9.dir/CMakeFortranCompilerABI.F.o +/soft/compilers/ibmcmp-oct2017/xlf/bg/14.1/bin/xlf -qthreaded -qhalt=e -V -c /soft/buildtools/cmake/3.5.2/share/cmake-3.5/Modules/CMakeFortranCompilerABI.F -o CMakeFiles/cmTC_d05a9.dir/CMakeFortranCompilerABI.F.o +export XL_CONFIG=/soft/compilers/ibmcmp-oct2017/xlf/bg/14.1/etc/xlf.cfg.rhel6.9.gcc447:xlf +export XLF_USR_CONFIG=/soft/compilers/ibmcmp-oct2017/xlf/bg/14.1/etc/V1R2M4.xlf.cfg.rhel6.9.gcc447 +export "XL_DIS=/soft/compilers/ibmcmp-oct2017/xlf/bg/14.1/exe/dis -o "CMakeFiles/cmTC_d05a9.dir/CMakeFortranCompilerABI.F.o" "CMakeFortranCompilerABI.o"" +/soft/compilers/ibmcmp-oct2017/xlf/bg/14.1/exe/cpp /soft/buildtools/cmake/3.5.2/share/cmake-3.5/Modules/CMakeFortranCompilerABI.F /tmp/F841970obBXFf -C -I/soft/compilers/ibmcmp-oct2017/xlmass/bg/7.3/include -I/soft/compilers/ibmcmp-oct2017/xlf/bg/14.1/include +/soft/compilers/ibmcmp-oct2017/xlf/bg/14.1/exe/xlfentry /tmp/F841970obBXFf /tmp/F841970QXWvB4 /tmp/F841970QXWvB4F.lst xlfsmsg.cat xlfmsg.cat /soft/buildtools/cmake/3.5.2/share/cmake-3.5/Modules/CMakeFortranCompilerABI.F "OSVAR(rhel.6.9)" NOZEROSIZE SAVE "ALIAS(intptr)" "POSITION(appendold)" "XLF90(noautodealloc,nosignedzero,oldpad)" "XLF77(intarg,intxor,persistent,noleadzero,gedit77,noblankpad,oldboz,softeof)" "XLF2003(nopolymorphic,nobozlitargs,nostopexcept,novolatile,noautorealloc,oldnaninf)" "XLF2008(nocheckpresence)" 64 "GNU_VERSION(4.4.7)" "SAVEOPTFILE(/tmp/optf.41970mydp8V)" "SAVEVERSIONFILE(/tmp/version.41970sjsfYH)" THREADED "HALT(e)" "WSTREAMS(/tmp/F8419704oFzOth1,/tmp/F8419704oFzOtb1,/tmp/F8419704oFzOts1)" "DEFMSG(/soft/compilers/ibmcmp-oct2017/xlf/bg/14.1/msg/en_US)" -I/soft/compilers/ibmcmp-oct2017/xlmass/bg/7.3/include -I/soft/compilers/ibmcmp-oct2017/xlf/bg/14.1/include +COMMAND LINE 1520-061 (W) The XLF77(PERSISTENT) option stores entities in static storage. This may affect the thread safety of your code. +COMMAND LINE 1520-061 (W) The SAVE option stores entities in static storage. This may affect the thread safety of your code. +** cmakefortrancompilerabi === End of Compilation 1 === +rm /tmp/F841970obBXFf +export XL_FRONTEND=/soft/compilers/ibmcmp-oct2017/xlf/bg/14.1/exe/xlfentry +export XL_ASTI=/soft/compilers/ibmcmp-oct2017/xlf/bg/14.1/exe/xlfhot +export XL_BACKEND=/soft/compilers/ibmcmp-oct2017/xlf/bg/14.1/exe/xlfcode +export XL_LINKER=/usr/bin/ld +export XL_BOLT=/soft/compilers/ibmcmp-oct2017/xlf/bg/14.1/exe/bolt +/soft/compilers/ibmcmp-oct2017/xlf/bg/14.1/exe/xlfhot /tmp/F8419704oFzOth1 /tmp/F8419704oFzOth2 /tmp/F8419704oFzOtb1 /tmp/F8419704oFzOtb2 /tmp/F8419704oFzOts1 /tmp/F8419704oFzOts2 /tmp/F841970QXWvB4 /tmp/F841970QXWvB4A.lst +export XL_FRONTEND=/soft/compilers/ibmcmp-oct2017/xlf/bg/14.1/exe/xlfentry +export XL_ASTI=/soft/compilers/ibmcmp-oct2017/xlf/bg/14.1/exe/xlfhot +export XL_BACKEND=/soft/compilers/ibmcmp-oct2017/xlf/bg/14.1/exe/xlfcode +export XL_LINKER=/usr/bin/ld +export XL_BOLT=/soft/compilers/ibmcmp-oct2017/xlf/bg/14.1/exe/bolt +/soft/compilers/ibmcmp-oct2017/xlf/bg/14.1/exe/xlfcode /tmp/F8419704oFzOth2 /tmp/F8419704oFzOtb2 CMakeFiles/cmTC_d05a9.dir/CMakeFortranCompilerABI.F.o /tmp/F841970QXWvB4B.lst /tmp/F8419704oFzOts2 +1501-510 Compilation successful for file CMakeFortranCompilerABI.F. +rm /tmp/optf.41970mydp8V +Linking Fortran executable cmTC_d05a9 +/soft/buildtools/cmake/3.5.2/bin/cmake -E cmake_link_script CMakeFiles/cmTC_d05a9.dir/link.txt --verbose=1 +/soft/compilers/ibmcmp-oct2017/xlf/bg/14.1/bin/xlf -V -qthreaded -qhalt=e CMakeFiles/cmTC_d05a9.dir/CMakeFortranCompilerABI.F.o -o cmTC_d05a9 -Wl,-export-dynamic +export XL_CONFIG=/soft/compilers/ibmcmp-oct2017/xlf/bg/14.1/etc/xlf.cfg.rhel6.9.gcc447:xlf +export XLF_USR_CONFIG=/soft/compilers/ibmcmp-oct2017/xlf/bg/14.1/etc/V1R2M4.xlf.cfg.rhel6.9.gcc447 +/usr/bin/ld --eh-frame-hdr -Qy -melf64ppc /usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../../../lib64/crt1.o /usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../../../lib64/crti.o /usr/lib/gcc/ppc64-redhat-linux/4.4.7/crtbegin.o -L/soft/compilers/ibmcmp-oct2017/xlsmp/bg/3.1/lib64 -L/soft/compilers/ibmcmp-oct2017/xlmass/bg/7.3/lib64 -L/soft/compilers/ibmcmp-oct2017/xlf/bg/14.1/lib64 -R/soft/compilers/ibmcmp-oct2017/lib64/bg -L/usr/lib/gcc/ppc64-redhat-linux/4.4.7 -L/usr/lib/gcc/ppc64-redhat-linux/4.4.7 -L/usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../.. CMakeFiles/cmTC_d05a9.dir/CMakeFortranCompilerABI.F.o -o cmTC_d05a9 -export-dynamic -dynamic-linker /lib64/ld64.so.1 -lxlf90 -lxlopt -lxlomp_ser -lxl -lxlfmath -lgcc_s -ldl -lrt -lpthread -lgcc -lm -lc -lgcc_s -lgcc /usr/lib/gcc/ppc64-redhat-linux/4.4.7/crtend.o /usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../../../lib64/crtn.o +rm /tmp/optf.419839KEged +gmake[1]: Leaving directory `/tmp/ii/CMakeFiles/CMakeTmp' diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-Fortran-XL-14.1.0.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-Fortran-XL-14.1.0.output new file mode 100644 index 0000000..39a28a4 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-Fortran-XL-14.1.0.output @@ -0,0 +1 @@ +/soft/compilers/ibmcmp-oct2017/xlmass/bg/7.3/include;/soft/compilers/ibmcmp-oct2017/xlf/bg/14.1/include https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=568343767e5852f0e5751341a3aa44ab6feffb8a commit 568343767e5852f0e5751341a3aa44ab6feffb8a Author: Chuck Cranor AuthorDate: Thu Jan 24 08:30:03 2019 -0700 Commit: Chuck Cranor CommitDate: Fri Jan 25 07:48:00 2019 -0700 ParseImplicitIncludeInfo: handle/add SunPro, XL, and -nostdinc test cases Add parser code for compiler IDs SunPro and XL. For SunPro, /usr/include appears to be hardwired in and it does not have a -nostdinc-type flag. For XL, the "xlc" and "xlC" commands determine if you are C or C++ based on input filename. So compiling x.c with "xlC" reverts to C and compiling x.cc with "xlc" upgrades to CXX. System include paths are specified by: -qc_stdinc=[path] and -qgcc_c_stdinc=[path] (for C) -qcpp_stdinc=[path] and -qgcc_cpp_stdinc=[path] (for CXX) If you specify "-qnostdinc" then the above flags are ignored. Specifying an empty path reverts the value to the default path (e.g. "-qgcc_c_stdinc=" reverts that to the default). Adjust the code to handle parsing the case where the user specifies additional compiler include flags via CMAKE_C_FLAGS/CMAKE_CXX_FLAGS. For example: "-DCMAKE_C_FLAGS=-nostdinc" ... note that gcc and clang output slightly differ when -nostdinc is specified (clang skips printing 'search starts here:' with the angle brackets, gcc always prints it). Enable sunos-{C,CXX}-SunPro test cases and add XL test cases. Also add a few -nostdinc style tests. diff --git a/Modules/CMakeParseImplicitIncludeInfo.cmake b/Modules/CMakeParseImplicitIncludeInfo.cmake index 9901fea..6603e1c 100644 --- a/Modules/CMakeParseImplicitIncludeInfo.cmake +++ b/Modules/CMakeParseImplicitIncludeInfo.cmake @@ -11,8 +11,9 @@ function(cmake_parse_implicit_include_line line lang id_var log_var state_var) unset(rv) set(log "") - # ccfe: cray compiler front end (PrgEnv-cray) + # Cray compiler (from cray wrapper, via PrgEnv-cray) if("${CMAKE_${lang}_COMPILER_ID}" STREQUAL "Cray" AND + "${line}" MATCHES "^/" AND "${line}" MATCHES "/ccfe " AND "${line}" MATCHES "-isystem") string(REGEX MATCHALL " (-I ?|-isystem )([^ ]*)" incs "${line}") foreach(inc IN LISTS incs) @@ -26,10 +27,78 @@ function(cmake_parse_implicit_include_line line lang id_var log_var state_var) endif() endif() + # SunPro compiler + if("${CMAKE_${lang}_COMPILER_ID}" STREQUAL "SunPro" AND + "${line}" MATCHES "-D__SUNPRO_C") + string(REGEX MATCHALL " (-I ?)([^ ]*)" incs "${line}") + foreach(inc IN LISTS incs) + string(REGEX REPLACE " (-I ?)([^ ]*)" "\\2" idir "${inc}") + if(NOT "${idir}" STREQUAL "-xbuiltin") + list(APPEND rv "${idir}") + endif() + endforeach() + if(rv) + # /usr/include appears to be hardwired in + list(APPEND rv "/usr/include") + string(APPEND log " got implicit includes via sunpro parser!\n") + else() + string(APPEND log " warning: sunpro parse failed!\n") + endif() + endif() + + # XL C/CXX compiler + if("${CMAKE_${lang}_COMPILER_ID}" STREQUAL "XL" AND + "${line}" MATCHES "^/" AND "${line}" MATCHES "/xlcentry |/xlCentry " AND + "${line}" MATCHES " -qosvar=") + # -qnostdinc cancels other stdinc flags, even if present + string(FIND "${line}" " -qnostdinc" nostd) + if(NOT ${nostd} EQUAL -1) + set(rv "") # defined but empty + string(APPEND log " got implicit includes via XL parser (nostdinc)\n") + else() + if("${lang}" STREQUAL "CXX") + string(REGEX MATCHALL " -qcpp_stdinc=([^ ]*)" std "${line}") + string(REGEX MATCHALL " -qgcc_cpp_stdinc=([^ ]*)" gcc_std "${line}") + else() + string(REGEX MATCHALL " -qc_stdinc=([^ ]*)" std "${line}") + string(REGEX MATCHALL " -qgcc_c_stdinc=([^ ]*)" gcc_std "${line}") + endif() + set(xlstd ${std} ${gcc_std}) + foreach(inc IN LISTS xlstd) + string(REGEX REPLACE " -q(cpp|gcc_cpp|c|gcc_c)_stdinc=([^ ]*)" "\\2" + ipath "${inc}") + string(REPLACE ":" ";" ipath "${ipath}") + list(APPEND rv ${ipath}) + endforeach() + endif() + # user can add -I flags via CMAKE_{C,CXX}_FLAGS, look for that too + string(REGEX MATCHALL " (-I ?)([^ ]*)" incs "${line}") + unset(urv) + foreach(inc IN LISTS incs) + string(REGEX REPLACE " (-I ?)([^ ]*)" "\\2" idir "${inc}") + list(APPEND urv "${idir}") + endforeach() + if(urv) + if ("${rv}" STREQUAL "") + set(rv ${urv}) + else() + list(APPEND rv ${urv}) + endif() + endif() + + if(DEFINED rv) + string(APPEND log " got implicit includes via XL parser!\n") + else() + string(APPEND log " warning: XL parse failed!\n") + endif() + endif() + if(log) set(${log_var} "${log}" PARENT_SCOPE) + else() + unset(${log_var} PARENT_SCOPE) endif() - if(rv) + if(DEFINED rv) set(${id_var} "${rv}" PARENT_SCOPE) set(${state_var} "done" PARENT_SCOPE) endif() @@ -48,10 +117,11 @@ function(cmake_parse_implicit_include_info text lang dir_var log_var state_var) string(REGEX REPLACE "\r?\n" ";" output_lines "${text}") foreach(line IN LISTS output_lines) if(state STREQUAL start) - string(FIND "${line}" "#include <...> search starts here:" rv) + string(FIND "${line}" "#include \"...\" search starts here:" rv) if(rv GREATER -1) set(state loading) - string(APPEND log " found start of implicit include info\n") + set(preload 1) # looking for include <...> now + string(APPEND log " found start of include info\n") else() cmake_parse_implicit_include_line("${line}" "${lang}" implicit_dirs_tmp linelog state) @@ -68,15 +138,24 @@ function(cmake_parse_implicit_include_info text lang dir_var log_var state_var) set(state done) string(APPEND log " end of search list found\n") break() - else() - string(STRIP "${line}" path) # remove leading/trailing spaces - if ("${path}" MATCHES " \\(framework directory\\)$") - continue() # frameworks are handled elsewhere, ignore them here + endif() + if(preload) + string(FIND "${line}" "#include <...> search starts here:" rv) + if(rv GREATER -1) + set(preload 0) + string(APPEND log " found start of implicit include info\n") endif() - string(REPLACE "\\" "/" path "${path}") - list(APPEND implicit_dirs_tmp "${path}") - string(APPEND log " add: [${path}]\n") + continue() + endif() + if("${line}" MATCHES "^ ") + string(SUBSTRING "${line}" 1 -1 line) # remove leading space + endif() + if ("${line}" MATCHES " \\(framework directory\\)$") + continue() # frameworks are handled elsewhere, ignore them here endif() + string(REPLACE "\\" "/" path "${line}") + list(APPEND implicit_dirs_tmp "${path}") + string(APPEND log " add: [${path}]\n") endif() endforeach() diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake b/Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake index 21d4df2..9bf00f8 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/ParseImplicitIncludeInfo.cmake @@ -9,20 +9,27 @@ project(Minimal NONE) # has special handling (it should not parse). # set(targets + aix-C-XL-13.1.3 aix-CXX-XL-13.1.3 craype-C-Cray-8.7 craype-CXX-Cray-8.7 craype-C-GNU-7.3.0 craype-CXX-GNU-7.3.0 craype-C-Intel-18.0.2.20180210 craype-CXX-Intel-18.0.2.20180210 darwin-C-AppleClang-8.0.0.8000042 darwin-CXX-AppleClang-8.0.0.8000042 + darwin_nostdinc-C-AppleClang-8.0.0.8000042 + darwin_nostdinc-CXX-AppleClang-8.0.0.8000042 empty-C empty-CXX freebsd-C-Clang-3.3.0 freebsd-CXX-Clang-3.3.0 linux-C-GNU-7.3.0 linux-CXX-GNU-7.3.0 linux-C-Intel-18.0.0.20170811 linux-CXX-Intel-18.0.0.20170811 + linux-C-XL-12.1.0 linux-CXX-XL-12.1.0 + linux_nostdinc-C-XL-12.1.0 linux_nostdinc-CXX-XL-12.1.0 + linux_nostdinc_i-C-XL-12.1.0 linux_nostdinc-CXX-XL-12.1.0 + linux-C-XL-16.1.0.0 linux-CXX-XL-16.1.0.0 linux-CUDA-NVIDIA-9.2.148 mingw.org-C-GNU-4.9.3 mingw.org-CXX-GNU-4.9.3 netbsd-C-GNU-4.8.5 netbsd-CXX-GNU-4.8.5 + netbsd_nostdinc-C-GNU-4.8.5 netbsd_nostdinc-CXX-GNU-4.8.5 openbsd-C-Clang-5.0.1 openbsd-CXX-Clang-5.0.1 - #FIXME: The parser does not handle SunPro yet. - #sunos-C-SunPro-5.13.0 sunos-CXX-SunPro-5.13.0 + sunos-C-SunPro-5.13.0 sunos-CXX-SunPro-5.13.0 ) include(${CMAKE_ROOT}/Modules/CMakeParseImplicitIncludeInfo.cmake) diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/README b/Tests/RunCMake/ParseImplicitIncludeInfo/data/README index 489c787..9d1246a 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/README +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/README @@ -10,3 +10,14 @@ build directory. The ".output" files should be generated by hand from the input files. The test will compare the parser output to the manually generated ".output" file. The two should match. + +For compilers that support "-nostdinc"-like flags, you can generate +a test for this with a command like: +cmake -DUNAME=netbsd_nostdinc \ + -DCMAKE_C_FLAGS=-nostdinc -DCMAKE_CXX_FLAGS=-nostdinc . + +Here is an example for testing the XL compiler with both -I and nostdinc: + +env CC=xlc CXX=xlC cmake -DUNAME=linux_nostdinc_i \ + -DCMAKE_C_FLAGS='-qnostdinc -I/tmp/ii/test_c' \ + -DCMAKE_CXX_FLAGS='-qnostdinc -I/tmp/ii/test_c -I/tmp/ii/test_cxx' . diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/aix-C-XL-13.1.3.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/aix-C-XL-13.1.3.input new file mode 100644 index 0000000..14517c5 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/aix-C-XL-13.1.3.input @@ -0,0 +1,40 @@ +CMAKE_LANG=C +CMAKE_C_COMPILER_ABI= +CMAKE_C_COMPILER_AR= +CMAKE_C_COMPILER_ARCHITECTURE_ID= +CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_C_COMPILER_ID=XL +CMAKE_C_COMPILER_LAUNCHER= +CMAKE_C_COMPILER_LOADED=1 +CMAKE_C_COMPILER_RANLIB= +CMAKE_C_COMPILER_TARGET= +CMAKE_C_COMPILER_VERSION=13.1.3 +CMAKE_C_COMPILER_VERSION_INTERAL= +Change Dir: /tmp/ii/CMakeFiles/CMakeTmp + +Run Build Command:"/usr/bin/gmake" "cmTC_424d1/fast" +/usr/bin/gmake -f CMakeFiles/cmTC_424d1.dir/build.make CMakeFiles/cmTC_424d1.dir/build +gmake[1]: Entering directory '/tmp/ii/CMakeFiles/CMakeTmp' +Building C object CMakeFiles/cmTC_424d1.dir/CMakeCCompilerABI.c.o +/opt/IBM/xlc/13.1.3/bin/xlc -qthreaded -qhalt=e -V -o CMakeFiles/cmTC_424d1.dir/CMakeCCompilerABI.c.o -c /tmp/CMake/Modules/CMakeCCompilerABI.c +export XL_CONFIG=/opt/IBM/xlc/13.1.3/etc/xlc.cfg.72:xlc +export XL_ASMOBJFILES=/tmp/xlcASvf7aid +export "XL_DIS=/opt/IBM/xlc/13.1.3/exe/dis -o "CMakeFiles/cmTC_424d1.dir/CMakeCCompilerABI.c.o" "CMakeCCompilerABI.o"" +/opt/IBM/xlc/13.1.3/exe/xlcentry -qosvar=aix.7.2 -qlanglvl=extc99 -qcpluscmt -qkeyword=inline -qalias=ansi -D_AIX -D_AIX32 -D_AIX41 -D_AIX43 -D_AIX50 -D_AIX51 -D_AIX52 -D_AIX53 -D_AIX61 -D_AIX71 -D_AIX72 -D_IBMR2 -D_POWER -qthreaded -qhalt=e -qasm_as=/bin/as -qc_stdinc=/opt/IBM/xlc/13.1.3/include:/opt/IBM/xlmass/8.1.3/include:/usr/include -qvac_include_path=/opt/IBM/xlc/13.1.3/include -oCMakeFiles/cmTC_424d1.dir/CMakeCCompilerABI.c.o /tmp/CMake/Modules/CMakeCCompilerABI.c /tmp/xlcW0uR7aia /tmp/xlcW1uV7aib /dev/null /tmp/xlcLvj7aieF.lst /dev/null /tmp/xlcW2vb7aic +export XL_BACKEND=/opt/IBM/xlc/13.1.3/exe/xlCcode +export XL_LINKER=/bin/ld +/opt/IBM/xlc/13.1.3/exe/xlCcode -qlanglvl=extc99 -qcpluscmt -qkeyword=inline -qalias=ansi -qthreaded -qhalt=e /tmp/xlcW0uR7aia /tmp/xlcW1uV7aib CMakeFiles/cmTC_424d1.dir/CMakeCCompilerABI.c.o /tmp/xlcLvj7aieB.lst /tmp/xlcW2vb7aic +rm /tmp/xlcASvf7aid +rm /tmp/xlcLvj7aie +rm /tmp/xlcW0uR7aia +rm /tmp/xlcW1uV7aib +rm /tmp/xlcW2vb7aic +Linking C executable cmTC_424d1 +/tmp/CMake/bin/cmake -E cmake_link_script CMakeFiles/cmTC_424d1.dir/link.txt --verbose=1 +/opt/IBM/xlc/13.1.3/bin/xlc -qthreaded -qhalt=e -Wl,-bnoipath -Wl,-brtl -V -Wl,-bexpall CMakeFiles/cmTC_424d1.dir/CMakeCCompilerABI.c.o -o cmTC_424d1 -Wl,-blibpath:/usr/lib:/lib +export XL_CONFIG=/opt/IBM/xlc/13.1.3/etc/xlc.cfg.72:xlc +/bin/ld -b32 /lib/crt0.o -bpT:0x10000000 -bpD:0x20000000 -bnoipath -brtl -bexpall CMakeFiles/cmTC_424d1.dir/CMakeCCompilerABI.c.o -o cmTC_424d1 -blibpath:/usr/lib:/lib -L/opt/IBM/xlmass/8.1.3/lib/aix61 -L/opt/IBM/xlc/13.1.3/lib -lxlopt -lxlipa -lxl -lc +rm /tmp/xlcW0wn7aia +rm /tmp/xlcW1wr7aib +rm /tmp/xlcW2wz7aic +gmake[1]: Leaving directory '/tmp/ii/CMakeFiles/CMakeTmp' diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/aix-C-XL-13.1.3.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/aix-C-XL-13.1.3.output new file mode 100644 index 0000000..91b35ad --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/aix-C-XL-13.1.3.output @@ -0,0 +1 @@ +/opt/IBM/xlc/13.1.3/include;/opt/IBM/xlmass/8.1.3/include;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/aix-CXX-XL-13.1.3.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/aix-CXX-XL-13.1.3.input new file mode 100644 index 0000000..5aec849 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/aix-CXX-XL-13.1.3.input @@ -0,0 +1,44 @@ +CMAKE_LANG=CXX +CMAKE_CXX_COMPILER_ABI= +CMAKE_CXX_COMPILER_AR= +CMAKE_CXX_COMPILER_ARCHITECTURE_ID= +CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_CXX_COMPILER_ID=XL +CMAKE_CXX_COMPILER_LAUNCHER= +CMAKE_CXX_COMPILER_LOADED=1 +CMAKE_CXX_COMPILER_RANLIB= +CMAKE_CXX_COMPILER_TARGET= +CMAKE_CXX_COMPILER_VERSION=13.1.3 +CMAKE_CXX_COMPILER_VERSION_INTERAL= +Change Dir: /tmp/ii/CMakeFiles/CMakeTmp + +Run Build Command:"/usr/bin/gmake" "cmTC_e8f3a/fast" +/usr/bin/gmake -f CMakeFiles/cmTC_e8f3a.dir/build.make CMakeFiles/cmTC_e8f3a.dir/build +gmake[1]: Entering directory '/tmp/ii/CMakeFiles/CMakeTmp' +Building CXX object CMakeFiles/cmTC_e8f3a.dir/CMakeCXXCompilerABI.cpp.o +/opt/IBM/xlC/13.1.3/bin/xlC -+ -qthreaded -qhalt=s -V -o CMakeFiles/cmTC_e8f3a.dir/CMakeCXXCompilerABI.cpp.o -c /tmp/CMake/Modules/CMakeCXXCompilerABI.cpp +export XL_CONFIG=/opt/IBM/xlc/13.1.3/etc/xlc.cfg.72:xlC +export XL_XLCMP_PATH=/opt/IBM/xlc/13.1.3:/opt/IBM/xlC/13.1.3 +export XL_COMPILER=xlc++ +export XL_ASMOBJFILES=/tmp/xlcAS3F7aid +export "XL_DIS=/opt/IBM/xlc/13.1.3/exe/dis -o "CMakeFiles/cmTC_e8f3a.dir/CMakeCXXCompilerABI.cpp.o" "CMakeCXXCompilerABI.o"" +/opt/IBM/xlC/13.1.3/exe/xlCentry -qosvar=aix.7.2 -qalias=ansi -D_AIX -D_AIX32 -D_AIX41 -D_AIX43 -D_AIX50 -D_AIX51 -D_AIX52 -D_AIX53 -D_AIX61 -D_AIX71 -D_AIX72 -D_IBMR2 -D_POWER -qthreaded -qhalt=s -qasm_as=/bin/as -qcpp_stdinc=/opt/IBM/xlC/13.1.3/include:/opt/IBM/xlmass/8.1.3/include:/usr/include -qc_stdinc=/opt/IBM/xlc/13.1.3/include:/opt/IBM/xlmass/8.1.3/include:/usr/include -oCMakeFiles/cmTC_e8f3a.dir/CMakeCXXCompilerABI.cpp.o /tmp/CMake/Modules/CMakeCXXCompilerABI.cpp /tmp/xlcW03r7aia /tmp/xlcW1347aib /dev/null /tmp/xlcL3J7aieF.lst /dev/null /tmp/xlcW2387aic +export XL_BACKEND=/opt/IBM/xlc/13.1.3/exe/xlCcode +export XL_LINKER=/bin/ld +/opt/IBM/xlc/13.1.3/exe/xlCcode -qalias=ansi -qthreaded -qhalt=s /tmp/xlcW03r7aia /tmp/xlcW1347aib CMakeFiles/cmTC_e8f3a.dir/CMakeCXXCompilerABI.cpp.o /tmp/xlcL3J7aieB.lst /tmp/xlcW2387aic +rm /tmp/xlcAS3F7aid +rm /tmp/xlcL3J7aie +rm /tmp/xlcW03r7aia +rm /tmp/xlcW1347aib +rm /tmp/xlcW2387aic +Linking CXX executable cmTC_e8f3a +/tmp/CMake/bin/cmake -E cmake_link_script CMakeFiles/cmTC_e8f3a.dir/link.txt --verbose=1 +/opt/IBM/xlC/13.1.3/bin/xlC -qthreaded -qhalt=s -Wl,-bnoipath -Wl,-brtl -V -Wl,-bexpall CMakeFiles/cmTC_e8f3a.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_e8f3a -Wl,-blibpath:/usr/lib:/lib +export XL_CONFIG=/opt/IBM/xlc/13.1.3/etc/xlc.cfg.72:xlC +/bin/ld -b32 /lib/crt0.o /lib/crti.o -bpT:0x10000000 -bpD:0x20000000 -bnoipath -brtl -bexpall CMakeFiles/cmTC_e8f3a.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_e8f3a -blibpath:/usr/lib:/lib -bcdtors:all:0:s -btmplrename -L/opt/IBM/xlmass/8.1.3/lib/aix61 -L/opt/IBM/xlc/13.1.3/lib -lxlopt -lxlipa -lxl -L/opt/IBM/xlC/13.1.3/lib -lC -lm -lc | +/opt/IBM/xlC/13.1.3/bin/c++filt -S | +/bin/sed '/317.*::virtual-fn-table-ptr$/ s/^\(.*: \)*{*\([^}]*\)\(}*.*\)::virtual-fn-table-ptr$/\1Virtual table for class "\2": Some possible causes are: first non-inline virtual function in "\2" is not defined or the class is a template instantiation and an explicit instantiation definition of the class is missing./' +rm /tmp/xlcW04Jtaea +rm /tmp/xlcW14Vtaeb +rm /tmp/xlcW24Vtaec +gmake[1]: Leaving directory '/tmp/ii/CMakeFiles/CMakeTmp' diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/aix-CXX-XL-13.1.3.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/aix-CXX-XL-13.1.3.output new file mode 100644 index 0000000..264e4fe --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/aix-CXX-XL-13.1.3.output @@ -0,0 +1 @@ +/opt/IBM/xlC/13.1.3/include;/opt/IBM/xlmass/8.1.3/include;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/darwin_nostdinc-C-AppleClang-8.0.0.8000042.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/darwin_nostdinc-C-AppleClang-8.0.0.8000042.input new file mode 100644 index 0000000..effaedf --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/darwin_nostdinc-C-AppleClang-8.0.0.8000042.input @@ -0,0 +1,44 @@ +CMAKE_LANG=C +CMAKE_C_COMPILER_ABI= +CMAKE_C_COMPILER_AR= +CMAKE_C_COMPILER_ARCHITECTURE_ID= +CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_C_COMPILER_ID=AppleClang +CMAKE_C_COMPILER_LAUNCHER= +CMAKE_C_COMPILER_LOADED=1 +CMAKE_C_COMPILER_RANLIB= +CMAKE_C_COMPILER_TARGET= +CMAKE_C_COMPILER_VERSION=8.0.0.8000042 +CMAKE_C_COMPILER_VERSION_INTERAL= +Change Dir: /tmp/ii/CMakeFiles/CMakeTmp + +Run Build Command:"/usr/bin/make" "cmTC_ba7aa/fast" +/Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_ba7aa.dir/build.make CMakeFiles/cmTC_ba7aa.dir/build +Building C object CMakeFiles/cmTC_ba7aa.dir/CMakeCCompilerABI.c.o +/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -nostdinc -v -Wl,-v -o CMakeFiles/cmTC_ba7aa.dir/CMakeCCompilerABI.c.o -c /usr/local/pkg.1804/share/cmake-3.10/Modules/CMakeCCompilerABI.c +Apple LLVM version 8.0.0 (clang-800.0.42.1) +Target: x86_64-apple-darwin15.6.0 +Thread model: posix +InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin +clang: warning: -Wl,-v: 'linker' input unused + "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.11.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name CMakeCCompilerABI.c -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 274.2 -v -dwarf-column-info -debugger-tuning=lldb -coverage-file /private/tmp/ii/CMakeFiles/CMakeTmp/CMakeFiles/cmTC_ba7aa.dir/CMakeCCompilerABI.c.o -nostdsysteminc -nobuiltininc -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0 -fdebug-compilation-dir /private/tmp/ii/CMakeFiles/CMakeTmp -ferror-limit 19 -fmessage-length 0 -stack-protector 1 -fblocks -fobjc-runtime=macosx-10.11.0 -fencode-extended-block-signature -fmax-type-align=16 -fdiagnostics-show-option -o CMakeFiles/cmTC_ba7aa.dir/CMakeCCompilerABI.c.o -x c /usr/local/pkg.1804/share/cmake-3.10/Modules/CMakeCCompilerABI.c +clang -cc1 version 8.0.0 (clang-800.0.42.1) default target x86_64-apple-darwin15.6.0 +#include "..." search starts here: +End of search list. +Linking C executable cmTC_ba7aa +/usr/local/pkg.1804/bin/cmake -E cmake_link_script CMakeFiles/cmTC_ba7aa.dir/link.txt --verbose=1 +/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -nostdinc -v -Wl,-v -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/cmTC_ba7aa.dir/CMakeCCompilerABI.c.o -o cmTC_ba7aa +Apple LLVM version 8.0.0 (clang-800.0.42.1) +Target: x86_64-apple-darwin15.6.0 +Thread model: posix +InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin +clang: warning: argument unused during compilation: '-nostdinc' + "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.11.0 -o cmTC_ba7aa -v -search_paths_first -headerpad_max_install_names CMakeFiles/cmTC_ba7aa.dir/CMakeCCompilerABI.c.o -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0/lib/darwin/libclang_rt.osx.a +@(#)PROGRAM:ld PROJECT:ld64-274.2 +configured to support archs: armv6 armv7 armv7s arm64 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em (tvOS) +Library search paths: + /usr/lib + /usr/local/lib +Framework search paths: + /Library/Frameworks/ + /System/Library/Frameworks/ diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/sunos-CXX-SunPro-5.13.0.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/darwin_nostdinc-C-AppleClang-8.0.0.8000042.output similarity index 100% copy from Tests/RunCMake/ParseImplicitIncludeInfo/data/sunos-CXX-SunPro-5.13.0.output copy to Tests/RunCMake/ParseImplicitIncludeInfo/data/darwin_nostdinc-C-AppleClang-8.0.0.8000042.output diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/darwin_nostdinc-CXX-AppleClang-8.0.0.8000042.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/darwin_nostdinc-CXX-AppleClang-8.0.0.8000042.input new file mode 100644 index 0000000..5504e94 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/darwin_nostdinc-CXX-AppleClang-8.0.0.8000042.input @@ -0,0 +1,44 @@ +CMAKE_LANG=CXX +CMAKE_CXX_COMPILER_ABI= +CMAKE_CXX_COMPILER_AR= +CMAKE_CXX_COMPILER_ARCHITECTURE_ID= +CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_CXX_COMPILER_ID=AppleClang +CMAKE_CXX_COMPILER_LAUNCHER= +CMAKE_CXX_COMPILER_LOADED=1 +CMAKE_CXX_COMPILER_RANLIB= +CMAKE_CXX_COMPILER_TARGET= +CMAKE_CXX_COMPILER_VERSION=8.0.0.8000042 +CMAKE_CXX_COMPILER_VERSION_INTERAL= +Change Dir: /tmp/ii/CMakeFiles/CMakeTmp + +Run Build Command:"/usr/bin/make" "cmTC_638bd/fast" +/Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_638bd.dir/build.make CMakeFiles/cmTC_638bd.dir/build +Building CXX object CMakeFiles/cmTC_638bd.dir/CMakeCXXCompilerABI.cpp.o +/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -nostdinc -v -Wl,-v -o CMakeFiles/cmTC_638bd.dir/CMakeCXXCompilerABI.cpp.o -c /usr/local/pkg.1804/share/cmake-3.10/Modules/CMakeCXXCompilerABI.cpp +Apple LLVM version 8.0.0 (clang-800.0.42.1) +Target: x86_64-apple-darwin15.6.0 +Thread model: posix +InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin +clang: warning: -Wl,-v: 'linker' input unused + "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.11.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name CMakeCXXCompilerABI.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 274.2 -v -dwarf-column-info -debugger-tuning=lldb -coverage-file /private/tmp/ii/CMakeFiles/CMakeTmp/CMakeFiles/cmTC_638bd.dir/CMakeCXXCompilerABI.cpp.o -nostdsysteminc -nobuiltininc -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0 -stdlib=libc++ -fdeprecated-macro -fdebug-compilation-dir /private/tmp/ii/CMakeFiles/CMakeTmp -ferror-limit 19 -fmessage-length 0 -stack-protector 1 -fblocks -fobjc-runtime=macosx-10.11.0 -fencode-extended-block-signature -fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option -o CMakeFiles/cmTC_638bd.dir/CMakeCXXCompilerABI.cpp.o -x c++ /usr/local/pkg.1804/share/cmake-3.10/Modules/CMakeCXXCompilerABI.cpp +clang -cc1 version 8.0.0 (clang-800.0.42.1) default target x86_64-apple-darwin15.6.0 +#include "..." search starts here: +End of search list. +Linking CXX executable cmTC_638bd +/usr/local/pkg.1804/bin/cmake -E cmake_link_script CMakeFiles/cmTC_638bd.dir/link.txt --verbose=1 +/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -nostdinc -v -Wl,-v -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/cmTC_638bd.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_638bd +Apple LLVM version 8.0.0 (clang-800.0.42.1) +Target: x86_64-apple-darwin15.6.0 +Thread model: posix +InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin +clang: warning: argument unused during compilation: '-nostdinc' + "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.11.0 -o cmTC_638bd -v -search_paths_first -headerpad_max_install_names CMakeFiles/cmTC_638bd.dir/CMakeCXXCompilerABI.cpp.o -lc++ -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0/lib/darwin/libclang_rt.osx.a +@(#)PROGRAM:ld PROJECT:ld64-274.2 +configured to support archs: armv6 armv7 armv7s arm64 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em (tvOS) +Library search paths: + /usr/lib + /usr/local/lib +Framework search paths: + /Library/Frameworks/ + /System/Library/Frameworks/ diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/sunos-CXX-SunPro-5.13.0.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/darwin_nostdinc-CXX-AppleClang-8.0.0.8000042.output similarity index 100% copy from Tests/RunCMake/ParseImplicitIncludeInfo/data/sunos-CXX-SunPro-5.13.0.output copy to Tests/RunCMake/ParseImplicitIncludeInfo/data/darwin_nostdinc-CXX-AppleClang-8.0.0.8000042.output diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-C-XL-12.1.0.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-C-XL-12.1.0.input new file mode 100644 index 0000000..a6d9e5a --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-C-XL-12.1.0.input @@ -0,0 +1,42 @@ +CMAKE_LANG=C +CMAKE_C_COMPILER_ABI=ELF +CMAKE_C_COMPILER_AR= +CMAKE_C_COMPILER_ARCHITECTURE_ID= +CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_C_COMPILER_ID=XL +CMAKE_C_COMPILER_LAUNCHER= +CMAKE_C_COMPILER_LOADED=1 +CMAKE_C_COMPILER_RANLIB= +CMAKE_C_COMPILER_TARGET= +CMAKE_C_COMPILER_VERSION=12.1.0 +CMAKE_C_COMPILER_VERSION_INTERAL= +Change Dir: /tmp/ii/CMakeFiles/CMakeTmp + +Run Build Command:"/usr/bin/gmake" "cmTC_79cdf/fast" +/usr/bin/gmake -f CMakeFiles/cmTC_79cdf.dir/build.make CMakeFiles/cmTC_79cdf.dir/build +gmake[1]: Entering directory `/tmp/ii/CMakeFiles/CMakeTmp' +Building C object CMakeFiles/cmTC_79cdf.dir/CMakeCCompilerABI.c.o +/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/bin/xlc -qthreaded -qhalt=e -V -o CMakeFiles/cmTC_79cdf.dir/CMakeCCompilerABI.c.o -c /soft/buildtools/cmake/3.5.2/share/cmake-3.5/Modules/CMakeCCompilerABI.c +export XL_CONFIG=/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/etc/vac.cfg.rhel6.9.gcc447:xlc +export XLC_USR_CONFIG=/soft/compilers/ibmcmp-oct2017/vacpp/bg/12.1/etc/V1R2M4.vac.cfg.rhel6.9.gcc447 +export XL_ASMOBJFILES=/tmp/xlcASgBamaX +export "XL_DIS=/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/exe/dis -o "CMakeFiles/cmTC_79cdf.dir/CMakeCCompilerABI.c.o" "CMakeCCompilerABI.o"" +/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/exe/xlcentry -qosvar=rhel.6.9 -qlanglvl=extc99 -qcpluscmt -qkeyword=inline -qalias=ansi -qtls -D_CALL_SYSV -D__null=0 -D__NO_MATH_INLINES -qtls -q64 -qgnu_version=4.4.7 -qthreaded -qhalt=e -qasm_as=/usr/bin/as -qc_stdinc=/soft/compilers/ibmcmp-oct2017/xlsmp/bg/3.1/include:/soft/compilers/ibmcmp-oct2017/xlmass/bg/7.3/include:/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/include -qgcc_c_stdinc=/usr/local/include:/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/crt/include:/usr/include -qcomplexgccincl=/soft/compilers/ibmcmp-oct2017/xlsmp/bg/3.1/include:/soft/compilers/ibmcmp-oct2017/xlmass/bg/7.3/include:/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/include:/usr/local/include:/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/crt/include:/usr/include -qvac_include_path=/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/include -oCMakeFiles/cmTC_79cdf.dir/CMakeCCompilerABI.c.o /soft/buildtools/cmake/3.5.2/share/cmake-3.5/Modules/CMakeCCompilerABI.c /tmp/xlcW06RQxFR /tmp/xlcW1Og9D2y /dev/null /tmp/xlcLUravVDF.lst /dev/null /tmp/xlcW2kTjRpg +export XL_BACKEND=/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/exe/xlCcode +export XL_LINKER=/usr/bin/ld +/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/exe/xlCcode -qlanglvl=extc99 -qcpluscmt -qkeyword=inline -qalias=ansi -qtls -qtls -qthreaded -qhalt=e /tmp/xlcW06RQxFR /tmp/xlcW1Og9D2y CMakeFiles/cmTC_79cdf.dir/CMakeCCompilerABI.c.o /tmp/xlcLUravVDB.lst /tmp/xlcW2kTjRpg +rm /tmp/xlcASgBamaX +rm /tmp/xlcLUravVD +rm /tmp/xlcW06RQxFR +rm /tmp/xlcW1Og9D2y +rm /tmp/xlcW2kTjRpg +Linking C executable cmTC_79cdf +/soft/buildtools/cmake/3.5.2/bin/cmake -E cmake_link_script CMakeFiles/cmTC_79cdf.dir/link.txt --verbose=1 +/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/bin/xlc -qthreaded -qhalt=e -V CMakeFiles/cmTC_79cdf.dir/CMakeCCompilerABI.c.o -o cmTC_79cdf -Wl,-export-dynamic +export XL_CONFIG=/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/etc/vac.cfg.rhel6.9.gcc447:xlc +export XLC_USR_CONFIG=/soft/compilers/ibmcmp-oct2017/vacpp/bg/12.1/etc/V1R2M4.vac.cfg.rhel6.9.gcc447 +/usr/bin/ld --eh-frame-hdr -Qy -melf64ppc /usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../../../lib64/crt1.o /usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../../../lib64/crti.o /usr/lib/gcc/ppc64-redhat-linux/4.4.7/crtbegin.o -L/soft/compilers/ibmcmp-oct2017/xlsmp/bg/3.1/lib64 -L/soft/compilers/ibmcmp-oct2017/xlmass/bg/7.3/lib64 -L/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/lib64 -L/soft/compilers/ibmcmp-oct2017/vacpp/bg/12.1/lib64 -R/soft/compilers/ibmcmp-oct2017/lib64/bg -L/usr/lib/gcc/ppc64-redhat-linux/4.4.7 -L/usr/lib/gcc/ppc64-redhat-linux/4.4.7 -L/usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../.. CMakeFiles/cmTC_79cdf.dir/CMakeCCompilerABI.c.o -o cmTC_79cdf -export-dynamic -dynamic-linker /lib64/ld64.so.1 -lxlopt -lxl -ldl -lgcc_s -lgcc -lm -lc -lgcc_s -lgcc /usr/lib/gcc/ppc64-redhat-linux/4.4.7/crtend.o /usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../../../lib64/crtn.o +rm /tmp/xlcW0JVPZO4 +rm /tmp/xlcW1cwDxtZ +rm /tmp/xlcW2j5Va8T +gmake[1]: Leaving directory `/tmp/ii/CMakeFiles/CMakeTmp' diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-C-XL-12.1.0.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-C-XL-12.1.0.output new file mode 100644 index 0000000..eceacf9 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-C-XL-12.1.0.output @@ -0,0 +1 @@ +/soft/compilers/ibmcmp-oct2017/xlsmp/bg/3.1/include;/soft/compilers/ibmcmp-oct2017/xlmass/bg/7.3/include;/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/include;/usr/local/include;/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/crt/include;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-C-XL-16.1.0.0.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-C-XL-16.1.0.0.input new file mode 100644 index 0000000..97fa28b --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-C-XL-16.1.0.0.input @@ -0,0 +1,40 @@ +CMAKE_LANG=C +CMAKE_C_COMPILER_ABI=ELF +CMAKE_C_COMPILER_AR= +CMAKE_C_COMPILER_ARCHITECTURE_ID= +CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_C_COMPILER_ID=XL +CMAKE_C_COMPILER_LAUNCHER= +CMAKE_C_COMPILER_LOADED=1 +CMAKE_C_COMPILER_RANLIB= +CMAKE_C_COMPILER_TARGET= +CMAKE_C_COMPILER_VERSION=16.1.0.0 +CMAKE_C_COMPILER_VERSION_INTERAL= +Change Dir: /tmp/ii/CMakeFiles/CMakeTmp + +Run Build Command:"/usr/bin/gmake" "cmTC_56ad1/fast" +/usr/bin/gmake -f CMakeFiles/cmTC_56ad1.dir/build.make CMakeFiles/cmTC_56ad1.dir/build +gmake[1]: Entering directory `/tmp/ii/CMakeFiles/CMakeTmp' +Building C object CMakeFiles/cmTC_56ad1.dir/CMakeCCompilerABI.c.o +/opt/ibm/xlC/16.1.0/bin/xlc -qthreaded -V -o CMakeFiles/cmTC_56ad1.dir/CMakeCCompilerABI.c.o -c "/tmp/CMake/Modules/CMakeCCompilerABI.c" +export XL_CONFIG=/opt/ibm/xlC/16.1.0/etc/xlc.cfg.centos.7.gcc.4.8.5:xlc +export XL_ASMOBJFILES=/tmp/xlcASSb1cI4 +export "XL_DIS=/opt/ibm/xlC/16.1.0/exe/dis -o "CMakeFiles/cmTC_56ad1.dir/CMakeCCompilerABI.c.o" "CMakeCCompilerABI.o"" +/opt/ibm/xlC/16.1.0/exe/xlCentry -qosvar=centos.7.0 -qlanglvl=extc99 -qalias=ansi -qthreaded -D_REENTRANT -D__VACPP_MULTI__ -qtls -q64 -D_CALL_SYSV -D__NO_MATH_INLINES -D_CALL_ELF=2 -Wno-parentheses -Wno-unused-value -maltivec -qtls -q64 -qgnu_version=4.8.5 -qthreaded -qasm_as=/usr/bin/as -qc_stdinc=/opt/ibm/xlsmp/5.1.0/include:/opt/ibm/xlsmp/5.1.0/include:/opt/ibm/xlmass/9.1.0/include:/opt/ibm/xlC/16.1.0/include -qgcc_c_stdinc=/opt/ibm/xlC/16.1.0/include:/usr/local/include:/opt/ibm/xlC/16.1.0/include:/usr/include -qcomplexgccincl=/opt/ibm/xlsmp/5.1.0/include:/opt/ibm/xlmass/9.1.0/include:/opt/ibm/xlC/16.1.0/include:/opt/ibm/xlC/16.1.0/include:/usr/local/include:/opt/ibm/xlC/16.1.0/include:/usr/include -qvac_include_path=/opt/ibm/xlC/16.1.0/include -oCMakeFiles/cmTC_56ad1.dir/CMakeCCompilerABI.c.o "/tmp/CMake/Modules/CMakeCCompilerABI.c" /tmp/xlcW0T1FYwj /tmp/xlcW1fu4lVT /dev/null /tmp/xlcLWBpG6EF.lst /dev/null /tmp/xlcW2TKQJju +export XL_BACKEND=/opt/ibm/xlC/16.1.0/exe/xlCcode +export XL_LINKER=/usr/bin/ld +/opt/ibm/xlC/16.1.0/exe/xlCcode -qlanglvl=extc99 -qalias=ansi -qthreaded -qtls -maltivec -qtls -qthreaded /tmp/xlcW0T1FYwj /tmp/xlcW1fu4lVT CMakeFiles/cmTC_56ad1.dir/CMakeCCompilerABI.c.o /tmp/xlcLWBpG6EB.lst /tmp/xlcW2TKQJju +rm /tmp/xlcASSb1cI4 +rm /tmp/xlcLWBpG6E +rm /tmp/xlcW0T1FYwj +rm /tmp/xlcW1fu4lVT +rm /tmp/xlcW2TKQJju +Linking C executable cmTC_56ad1 +"/tmp/CMake/bin/cmake" -E cmake_link_script CMakeFiles/cmTC_56ad1.dir/link.txt --verbose=1 +/opt/ibm/xlC/16.1.0/bin/xlc -qthreaded -V -Wl,-export-dynamic CMakeFiles/cmTC_56ad1.dir/CMakeCCompilerABI.c.o -o cmTC_56ad1 +export XL_CONFIG=/opt/ibm/xlC/16.1.0/etc/xlc.cfg.centos.7.gcc.4.8.5:xlc +/usr/bin/ld --eh-frame-hdr -Qy -melf64lppc -dynamic-linker /lib64/ld64.so.2 --enable-new-dtags /usr/lib/gcc/ppc64le-redhat-linux/4.8.5/../../../../lib64/crt1.o /usr/lib/gcc/ppc64le-redhat-linux/4.8.5/../../../../lib64/crti.o /usr/lib/gcc/ppc64le-redhat-linux/4.8.5/crtbegin.o -L/opt/ibm/xlsmp/5.1.0/lib -L/opt/ibm/xlmass/9.1.0/lib -L/opt/ibm/xlC/16.1.0/lib -R/opt/ibm/lib -L/usr/lib/gcc/ppc64le-redhat-linux/4.8.5 -L/usr/lib/gcc/ppc64le-redhat-linux/4.8.5/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/ppc64le-redhat-linux/4.8.5/../../.. -export-dynamic CMakeFiles/cmTC_56ad1.dir/CMakeCCompilerABI.c.o -o cmTC_56ad1 -lxlopt -lxl --as-needed -ldl --no-as-needed -lgcc_s --as-needed -lpthread --no-as-needed -lgcc -lm -lc -lgcc_s -lgcc /usr/lib/gcc/ppc64le-redhat-linux/4.8.5/crtend.o /usr/lib/gcc/ppc64le-redhat-linux/4.8.5/../../../../lib64/crtn.o +rm /tmp/xlcW0S2fv6n +rm /tmp/xlcW11wDdxY +rm /tmp/xlcW2JqnWXy +gmake[1]: Leaving directory `/tmp/ii/CMakeFiles/CMakeTmp' diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-C-XL-16.1.0.0.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-C-XL-16.1.0.0.output new file mode 100644 index 0000000..2a89b17 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-C-XL-16.1.0.0.output @@ -0,0 +1 @@ +/opt/ibm/xlsmp/5.1.0/include;/opt/ibm/xlsmp/5.1.0/include;/opt/ibm/xlmass/9.1.0/include;/opt/ibm/xlC/16.1.0/include;/opt/ibm/xlC/16.1.0/include;/usr/local/include;/opt/ibm/xlC/16.1.0/include;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-XL-12.1.0.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-XL-12.1.0.input new file mode 100644 index 0000000..494b45c --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-XL-12.1.0.input @@ -0,0 +1,42 @@ +CMAKE_LANG=CXX +CMAKE_CXX_COMPILER_ABI=ELF +CMAKE_CXX_COMPILER_AR= +CMAKE_CXX_COMPILER_ARCHITECTURE_ID= +CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_CXX_COMPILER_ID=XL +CMAKE_CXX_COMPILER_LAUNCHER= +CMAKE_CXX_COMPILER_LOADED=1 +CMAKE_CXX_COMPILER_RANLIB= +CMAKE_CXX_COMPILER_TARGET= +CMAKE_CXX_COMPILER_VERSION=12.1.0 +CMAKE_CXX_COMPILER_VERSION_INTERAL= +Change Dir: /tmp/ii/CMakeFiles/CMakeTmp + +Run Build Command:"/usr/bin/gmake" "cmTC_a9a18/fast" +/usr/bin/gmake -f CMakeFiles/cmTC_a9a18.dir/build.make CMakeFiles/cmTC_a9a18.dir/build +gmake[1]: Entering directory `/tmp/ii/CMakeFiles/CMakeTmp' +Building CXX object CMakeFiles/cmTC_a9a18.dir/CMakeCXXCompilerABI.cpp.o +/soft/compilers/ibmcmp-oct2017/vacpp/bg/12.1/bin/xlc++ -+ -qthreaded -qhalt=e -V -o CMakeFiles/cmTC_a9a18.dir/CMakeCXXCompilerABI.cpp.o -c /soft/buildtools/cmake/3.5.2/share/cmake-3.5/Modules/CMakeCXXCompilerABI.cpp +export XL_CONFIG=/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/etc/vac.cfg.rhel6.9.gcc447:xlc++ +export XLC_USR_CONFIG=/soft/compilers/ibmcmp-oct2017/vacpp/bg/12.1/etc/V1R2M4.vac.cfg.rhel6.9.gcc447 +export XL_ASMOBJFILES=/tmp/xlcAS0adOWz +export "XL_DIS=/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/exe/dis -o "CMakeFiles/cmTC_a9a18.dir/CMakeCXXCompilerABI.cpp.o" "CMakeCXXCompilerABI.o"" +/soft/compilers/ibmcmp-oct2017/vacpp/bg/12.1/exe/xlCentry -qosvar=rhel.6.9 -qalias=ansi -qtls -D_CALL_SYSV -D__null=0 -D__NO_MATH_INLINES -qtls -q64 -qgnu_version=4.4.7 -qthreaded -qhalt=e -qasm_as=/usr/bin/as -qcpp_stdinc=/soft/compilers/ibmcmp-oct2017/xlsmp/bg/3.1/include:/soft/compilers/ibmcmp-oct2017/xlmass/bg/7.3/include:/soft/compilers/ibmcmp-oct2017/vacpp/bg/12.1/include -qc_stdinc=/soft/compilers/ibmcmp-oct2017/xlsmp/bg/3.1/include:/soft/compilers/ibmcmp-oct2017/xlmass/bg/7.3/include:/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/include -qgcc_cpp_stdinc=/usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../../../include/c++/4.4.7:/usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/ppc64-redhat-linux:/usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/backward:/usr/local/include:/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/crt/include:/usr/include -qgcc_c_stdinc=/usr/local/include:/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/crt/include:/usr/include -qcomplexgccincl=/soft/compilers/ibmcmp-oct2017/xlsmp/bg/3.1/include:/soft/compilers/ibmcmp-oct2017/xlmass/bg/7.3/include:/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/include:/usr/local/include:/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/crt/include:/usr/include -oCMakeFiles/cmTC_a9a18.dir/CMakeCXXCompilerABI.cpp.o /soft/buildtools/cmake/3.5.2/share/cmake-3.5/Modules/CMakeCXXCompilerABI.cpp /tmp/xlcW0C4fVNg /tmp/xlcW1gn9wsn /dev/null /tmp/xlcLo7QvMFF.lst /dev/null /tmp/xlcW2svId7t +export XL_BACKEND=/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/exe/xlCcode +export XL_LINKER=/usr/bin/ld +/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/exe/xlCcode -qalias=ansi -qtls -qtls -qthreaded -qhalt=e /tmp/xlcW0C4fVNg /tmp/xlcW1gn9wsn CMakeFiles/cmTC_a9a18.dir/CMakeCXXCompilerABI.cpp.o /tmp/xlcLo7QvMFB.lst /tmp/xlcW2svId7t +rm /tmp/xlcAS0adOWz +rm /tmp/xlcLo7QvMF +rm /tmp/xlcW0C4fVNg +rm /tmp/xlcW1gn9wsn +rm /tmp/xlcW2svId7t +Linking CXX executable cmTC_a9a18 +/soft/buildtools/cmake/3.5.2/bin/cmake -E cmake_link_script CMakeFiles/cmTC_a9a18.dir/link.txt --verbose=1 +/soft/compilers/ibmcmp-oct2017/vacpp/bg/12.1/bin/xlc++ -qthreaded -qhalt=e -V CMakeFiles/cmTC_a9a18.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_a9a18 -Wl,-export-dynamic +export XL_CONFIG=/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/etc/vac.cfg.rhel6.9.gcc447:xlc++ +export XLC_USR_CONFIG=/soft/compilers/ibmcmp-oct2017/vacpp/bg/12.1/etc/V1R2M4.vac.cfg.rhel6.9.gcc447 +/usr/bin/ld --eh-frame-hdr -Qy -melf64ppc /usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../../../lib64/crt1.o /usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../../../lib64/crti.o /usr/lib/gcc/ppc64-redhat-linux/4.4.7/crtbegin.o -L/soft/compilers/ibmcmp-oct2017/xlsmp/bg/3.1/lib64 -L/soft/compilers/ibmcmp-oct2017/xlmass/bg/7.3/lib64 -L/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/lib64 -L/soft/compilers/ibmcmp-oct2017/vacpp/bg/12.1/lib64 -R/soft/compilers/ibmcmp-oct2017/lib64/bg -L/usr/lib/gcc/ppc64-redhat-linux/4.4.7 -L/usr/lib/gcc/ppc64-redhat-linux/4.4.7 -L/usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../.. -L/usr/lib/gcc/ppc64-redhat-linux/4.4.7 -L/usr/lib/gcc/ppc64-redhat-linux/4.4.7 -L/usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../.. CMakeFiles/cmTC_a9a18.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_a9a18 -export-dynamic -dynamic-linker /lib64/ld64.so.1 -lxlopt -lxl -libmc++ -lxlopt -lxl -lstdc++ -lm -ldl -lgcc_s -lgcc -lm -lc -lgcc_s -lgcc -ldl -lgcc_s -lgcc -lm -lc -lgcc_s -lgcc /usr/lib/gcc/ppc64-redhat-linux/4.4.7/crtend.o /usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../../../lib64/crtn.o +rm /tmp/xlcW0zyCKVs +rm /tmp/xlcW1UOt3GL +rm /tmp/xlcW2lKGvs4 +gmake[1]: Leaving directory `/tmp/ii/CMakeFiles/CMakeTmp' diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-XL-12.1.0.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-XL-12.1.0.output new file mode 100644 index 0000000..1c545e0 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-XL-12.1.0.output @@ -0,0 +1 @@ +/soft/compilers/ibmcmp-oct2017/xlsmp/bg/3.1/include;/soft/compilers/ibmcmp-oct2017/xlmass/bg/7.3/include;/soft/compilers/ibmcmp-oct2017/vacpp/bg/12.1/include;/usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../../../include/c++/4.4.7;/usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/ppc64-redhat-linux;/usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/backward;/usr/local/include;/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/crt/include;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-XL-16.1.0.0.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-XL-16.1.0.0.input new file mode 100644 index 0000000..37aa450 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-XL-16.1.0.0.input @@ -0,0 +1,40 @@ +CMAKE_LANG=CXX +CMAKE_CXX_COMPILER_ABI=ELF +CMAKE_CXX_COMPILER_AR= +CMAKE_CXX_COMPILER_ARCHITECTURE_ID= +CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_CXX_COMPILER_ID=XL +CMAKE_CXX_COMPILER_LAUNCHER= +CMAKE_CXX_COMPILER_LOADED=1 +CMAKE_CXX_COMPILER_RANLIB= +CMAKE_CXX_COMPILER_TARGET= +CMAKE_CXX_COMPILER_VERSION=16.1.0.0 +CMAKE_CXX_COMPILER_VERSION_INTERAL= +Change Dir: /tmp/ii/CMakeFiles/CMakeTmp + +Run Build Command:"/usr/bin/gmake" "cmTC_f0c9c/fast" +/usr/bin/gmake -f CMakeFiles/cmTC_f0c9c.dir/build.make CMakeFiles/cmTC_f0c9c.dir/build +gmake[1]: Entering directory `/tmp/ii/CMakeFiles/CMakeTmp' +Building CXX object CMakeFiles/cmTC_f0c9c.dir/CMakeCXXCompilerABI.cpp.o +/opt/ibm/xlC/16.1.0/bin/xlc++ -+ -qthreaded -V -o CMakeFiles/cmTC_f0c9c.dir/CMakeCXXCompilerABI.cpp.o -c "/tmp/CMake/Modules/CMakeCXXCompilerABI.cpp" +export XL_CONFIG=/opt/ibm/xlC/16.1.0/etc/xlc.cfg.centos.7.gcc.4.8.5:xlc++ +export XL_ASMOBJFILES=/tmp/xlcASfU5Npd +export "XL_DIS=/opt/ibm/xlC/16.1.0/exe/dis -o "CMakeFiles/cmTC_f0c9c.dir/CMakeCXXCompilerABI.cpp.o" "CMakeCXXCompilerABI.o"" +/opt/ibm/xlC/16.1.0/exe/xlCentry -qosvar=centos.7.0 -qalias=ansi -qthreaded -D_REENTRANT -D__VACPP_MULTI__ -qtls -q64 -D_CALL_SYSV -D__NO_MATH_INLINES -D_CALL_ELF=2 -Wno-parentheses -Wno-unused-value -maltivec -qtls -q64 -qgnu_version=4.8.5 -qthreaded -xc++ -qasm_as=/usr/bin/as -qcpp_stdinc=/opt/ibm/xlsmp/5.1.0/include:/opt/ibm/xlmass/9.1.0/include:/opt/ibm/xlC/16.1.0/include -qc_stdinc=/opt/ibm/xlsmp/5.1.0/include:/opt/ibm/xlsmp/5.1.0/include:/opt/ibm/xlmass/9.1.0/include:/opt/ibm/xlC/16.1.0/include -qgcc_cpp_stdinc=/usr/lib/gcc/ppc64le-redhat-linux/4.8.5/../../../../include/c++/4.8.5:/usr/lib/gcc/ppc64le-redhat-linux/4.8.5/../../../../include/c++/4.8.5/ppc64le-redhat-linux:/usr/lib/gcc/ppc64le-redhat-linux/4.8.5/../../../../include/c++/4.8.5/backward:/opt/ibm/xlC/16.1.0/include:/usr/local/include:/opt/ibm/xlC/16.1.0/include:/usr/include -qgcc_c_stdinc=/opt/ibm/xlC/16.1.0/include:/usr/local/include:/opt/ibm/xlC/16.1.0/include:/usr/include -qcomplexgccincl=/opt/ibm/xlsmp/5.1.0/include:/opt/ibm/xlmass/9.1.0/include:/opt/ibm/xlC/16.1.0/include:/opt/ibm/xlC/16.1.0/include:/usr/local/include:/opt/ibm/xlC/16.1.0/include:/usr/include -oCMakeFiles/cmTC_f0c9c.dir/CMakeCXXCompilerABI.cpp.o "/tmp/CMake/Modules/CMakeCXXCompilerABI.cpp" /tmp/xlcW02F8mZr /tmp/xlcW1xG0Ns2 /dev/null /tmp/xlcLI57mTNF.lst /dev/null /tmp/xlcW2qVifWC +export XL_BACKEND=/opt/ibm/xlC/16.1.0/exe/xlCcode +export XL_LINKER=/usr/bin/ld +/opt/ibm/xlC/16.1.0/exe/xlCcode -qalias=ansi -qthreaded -qtls -maltivec -qtls -qthreaded /tmp/xlcW02F8mZr /tmp/xlcW1xG0Ns2 CMakeFiles/cmTC_f0c9c.dir/CMakeCXXCompilerABI.cpp.o /tmp/xlcLI57mTNB.lst /tmp/xlcW2qVifWC +rm /tmp/xlcASfU5Npd +rm /tmp/xlcLI57mTN +rm /tmp/xlcW02F8mZr +rm /tmp/xlcW1xG0Ns2 +rm /tmp/xlcW2qVifWC +Linking CXX executable cmTC_f0c9c +"/tmp/CMake/bin/cmake" -E cmake_link_script CMakeFiles/cmTC_f0c9c.dir/link.txt --verbose=1 +/opt/ibm/xlC/16.1.0/bin/xlc++ -qthreaded -V -Wl,-export-dynamic CMakeFiles/cmTC_f0c9c.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_f0c9c +export XL_CONFIG=/opt/ibm/xlC/16.1.0/etc/xlc.cfg.centos.7.gcc.4.8.5:xlc++ +/usr/bin/ld --eh-frame-hdr -Qy -melf64lppc -dynamic-linker /lib64/ld64.so.2 --enable-new-dtags /usr/lib/gcc/ppc64le-redhat-linux/4.8.5/../../../../lib64/crt1.o /usr/lib/gcc/ppc64le-redhat-linux/4.8.5/../../../../lib64/crti.o /usr/lib/gcc/ppc64le-redhat-linux/4.8.5/crtbegin.o -L/opt/ibm/xlsmp/5.1.0/lib -L/opt/ibm/xlmass/9.1.0/lib -L/opt/ibm/xlC/16.1.0/lib -R/opt/ibm/lib -L/usr/lib/gcc/ppc64le-redhat-linux/4.8.5 -L/usr/lib/gcc/ppc64le-redhat-linux/4.8.5/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/ppc64le-redhat-linux/4.8.5/../../.. -export-dynamic CMakeFiles/cmTC_f0c9c.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_f0c9c -lxlopt -lxl -libmc++ -lstdc++ -lm -ldl -lgcc_s -lgcc --as-needed -lpthread --no-as-needed -lm -lc -lgcc_s -lgcc /usr/lib/gcc/ppc64le-redhat-linux/4.8.5/crtend.o /usr/lib/gcc/ppc64le-redhat-linux/4.8.5/../../../../lib64/crtn.o +rm /tmp/xlcW0HSoDlw +rm /tmp/xlcW1dUcwR6 +rm /tmp/xlcW25pPonH +gmake[1]: Leaving directory `/tmp/ii/CMakeFiles/CMakeTmp' diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-XL-16.1.0.0.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-XL-16.1.0.0.output new file mode 100644 index 0000000..a34973c --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-XL-16.1.0.0.output @@ -0,0 +1 @@ +/opt/ibm/xlsmp/5.1.0/include;/opt/ibm/xlmass/9.1.0/include;/opt/ibm/xlC/16.1.0/include;/usr/lib/gcc/ppc64le-redhat-linux/4.8.5/../../../../include/c++/4.8.5;/usr/lib/gcc/ppc64le-redhat-linux/4.8.5/../../../../include/c++/4.8.5/ppc64le-redhat-linux;/usr/lib/gcc/ppc64le-redhat-linux/4.8.5/../../../../include/c++/4.8.5/backward;/opt/ibm/xlC/16.1.0/include;/usr/local/include;/opt/ibm/xlC/16.1.0/include;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux_nostdinc-C-XL-12.1.0.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux_nostdinc-C-XL-12.1.0.input new file mode 100644 index 0000000..8b1e286 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux_nostdinc-C-XL-12.1.0.input @@ -0,0 +1,42 @@ +CMAKE_LANG=C +CMAKE_C_COMPILER_ABI=ELF +CMAKE_C_COMPILER_AR= +CMAKE_C_COMPILER_ARCHITECTURE_ID= +CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_C_COMPILER_ID=XL +CMAKE_C_COMPILER_LAUNCHER= +CMAKE_C_COMPILER_LOADED=1 +CMAKE_C_COMPILER_RANLIB= +CMAKE_C_COMPILER_TARGET= +CMAKE_C_COMPILER_VERSION=12.1.0 +CMAKE_C_COMPILER_VERSION_INTERAL= +Change Dir: /tmp/ii/CMakeFiles/CMakeTmp + +Run Build Command:"/usr/bin/gmake" "cmTC_b8c4a/fast" +/usr/bin/gmake -f CMakeFiles/cmTC_b8c4a.dir/build.make CMakeFiles/cmTC_b8c4a.dir/build +gmake[1]: Entering directory `/tmp/ii/CMakeFiles/CMakeTmp' +Building C object CMakeFiles/cmTC_b8c4a.dir/CMakeCCompilerABI.c.o +/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/bin/xlc -qnostdinc -V -o CMakeFiles/cmTC_b8c4a.dir/CMakeCCompilerABI.c.o -c /soft/buildtools/cmake/3.5.2/share/cmake-3.5/Modules/CMakeCCompilerABI.c +export XL_CONFIG=/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/etc/vac.cfg.rhel6.9.gcc447:xlc +export XLC_USR_CONFIG=/soft/compilers/ibmcmp-oct2017/vacpp/bg/12.1/etc/V1R2M4.vac.cfg.rhel6.9.gcc447 +export XL_ASMOBJFILES=/tmp/xlcASEFMkoN +export "XL_DIS=/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/exe/dis -o "CMakeFiles/cmTC_b8c4a.dir/CMakeCCompilerABI.c.o" "CMakeCCompilerABI.o"" +/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/exe/xlcentry -qosvar=rhel.6.9 -qlanglvl=extc99 -qcpluscmt -qkeyword=inline -qalias=ansi -qtls -D_CALL_SYSV -D__null=0 -D__NO_MATH_INLINES -qtls -q64 -qgnu_version=4.4.7 -qnostdinc -qasm_as=/usr/bin/as -qc_stdinc=/soft/compilers/ibmcmp-oct2017/xlsmp/bg/3.1/include:/soft/compilers/ibmcmp-oct2017/xlmass/bg/7.3/include:/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/include -qgcc_c_stdinc=/usr/local/include:/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/crt/include:/usr/include -qcomplexgccincl=/soft/compilers/ibmcmp-oct2017/xlsmp/bg/3.1/include:/soft/compilers/ibmcmp-oct2017/xlmass/bg/7.3/include:/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/include:/usr/local/include:/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/crt/include:/usr/include -qvac_include_path=/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/include -oCMakeFiles/cmTC_b8c4a.dir/CMakeCCompilerABI.c.o /soft/buildtools/cmake/3.5.2/share/cmake-3.5/Modules/CMakeCCompilerABI.c /tmp/xlcW0cUFNRj /tmp/xlcW1YJsgzt /dev/null /tmp/xlcLI4MvwXF.lst /dev/null /tmp/xlcW2sIonhD +export XL_BACKEND=/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/exe/xlCcode +export XL_LINKER=/usr/bin/ld +/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/exe/xlCcode -qlanglvl=extc99 -qcpluscmt -qkeyword=inline -qalias=ansi -qtls -qtls -qnostdinc /tmp/xlcW0cUFNRj /tmp/xlcW1YJsgzt CMakeFiles/cmTC_b8c4a.dir/CMakeCCompilerABI.c.o /tmp/xlcLI4MvwXB.lst /tmp/xlcW2sIonhD +rm /tmp/xlcASEFMkoN +rm /tmp/xlcLI4MvwX +rm /tmp/xlcW0cUFNRj +rm /tmp/xlcW1YJsgzt +rm /tmp/xlcW2sIonhD +Linking C executable cmTC_b8c4a +/soft/buildtools/cmake/3.5.2/bin/cmake -E cmake_link_script CMakeFiles/cmTC_b8c4a.dir/link.txt --verbose=1 +/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/bin/xlc -qnostdinc -V CMakeFiles/cmTC_b8c4a.dir/CMakeCCompilerABI.c.o -o cmTC_b8c4a -Wl,-export-dynamic +export XL_CONFIG=/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/etc/vac.cfg.rhel6.9.gcc447:xlc +export XLC_USR_CONFIG=/soft/compilers/ibmcmp-oct2017/vacpp/bg/12.1/etc/V1R2M4.vac.cfg.rhel6.9.gcc447 +/usr/bin/ld --eh-frame-hdr -Qy -melf64ppc /usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../../../lib64/crt1.o /usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../../../lib64/crti.o /usr/lib/gcc/ppc64-redhat-linux/4.4.7/crtbegin.o -L/soft/compilers/ibmcmp-oct2017/xlsmp/bg/3.1/lib64 -L/soft/compilers/ibmcmp-oct2017/xlmass/bg/7.3/lib64 -L/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/lib64 -L/soft/compilers/ibmcmp-oct2017/vacpp/bg/12.1/lib64 -R/soft/compilers/ibmcmp-oct2017/lib64/bg -L/usr/lib/gcc/ppc64-redhat-linux/4.4.7 -L/usr/lib/gcc/ppc64-redhat-linux/4.4.7 -L/usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../.. CMakeFiles/cmTC_b8c4a.dir/CMakeCCompilerABI.c.o -o cmTC_b8c4a -export-dynamic -dynamic-linker /lib64/ld64.so.1 -lxlopt -lxl -ldl -lgcc_s -lgcc -lm -lc -lgcc_s -lgcc /usr/lib/gcc/ppc64-redhat-linux/4.4.7/crtend.o /usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../../../lib64/crtn.o +rm /tmp/xlcW03gDCly +rm /tmp/xlcW1oa6XxW +rm /tmp/xlcW2fQXnKk +gmake[1]: Leaving directory `/tmp/ii/CMakeFiles/CMakeTmp' diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/sunos-CXX-SunPro-5.13.0.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux_nostdinc-C-XL-12.1.0.output similarity index 100% copy from Tests/RunCMake/ParseImplicitIncludeInfo/data/sunos-CXX-SunPro-5.13.0.output copy to Tests/RunCMake/ParseImplicitIncludeInfo/data/linux_nostdinc-C-XL-12.1.0.output diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux_nostdinc-CXX-XL-12.1.0.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux_nostdinc-CXX-XL-12.1.0.input new file mode 100644 index 0000000..f6b5d91 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux_nostdinc-CXX-XL-12.1.0.input @@ -0,0 +1,42 @@ +CMAKE_LANG=CXX +CMAKE_CXX_COMPILER_ABI=ELF +CMAKE_CXX_COMPILER_AR= +CMAKE_CXX_COMPILER_ARCHITECTURE_ID= +CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_CXX_COMPILER_ID=XL +CMAKE_CXX_COMPILER_LAUNCHER= +CMAKE_CXX_COMPILER_LOADED=1 +CMAKE_CXX_COMPILER_RANLIB= +CMAKE_CXX_COMPILER_TARGET= +CMAKE_CXX_COMPILER_VERSION=12.1.0 +CMAKE_CXX_COMPILER_VERSION_INTERAL= +Change Dir: /tmp/ii/CMakeFiles/CMakeTmp + +Run Build Command:"/usr/bin/gmake" "cmTC_98791/fast" +/usr/bin/gmake -f CMakeFiles/cmTC_98791.dir/build.make CMakeFiles/cmTC_98791.dir/build +gmake[1]: Entering directory `/tmp/ii/CMakeFiles/CMakeTmp' +Building CXX object CMakeFiles/cmTC_98791.dir/CMakeCXXCompilerABI.cpp.o +/soft/compilers/ibmcmp-oct2017/vacpp/bg/12.1/bin/xlC -+ -qnostdinc -V -o CMakeFiles/cmTC_98791.dir/CMakeCXXCompilerABI.cpp.o -c /soft/buildtools/cmake/3.5.2/share/cmake-3.5/Modules/CMakeCXXCompilerABI.cpp +export XL_CONFIG=/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/etc/vac.cfg.rhel6.9.gcc447:xlC +export XLC_USR_CONFIG=/soft/compilers/ibmcmp-oct2017/vacpp/bg/12.1/etc/V1R2M4.vac.cfg.rhel6.9.gcc447 +export XL_ASMOBJFILES=/tmp/xlcAS82INiZ +export "XL_DIS=/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/exe/dis -o "CMakeFiles/cmTC_98791.dir/CMakeCXXCompilerABI.cpp.o" "CMakeCXXCompilerABI.o"" +/soft/compilers/ibmcmp-oct2017/vacpp/bg/12.1/exe/xlCentry -qosvar=rhel.6.9 -qalias=ansi -qtls -D_CALL_SYSV -D__null=0 -D__NO_MATH_INLINES -qtls -q64 -qgnu_version=4.4.7 -qnostdinc -qasm_as=/usr/bin/as -qcpp_stdinc=/soft/compilers/ibmcmp-oct2017/xlsmp/bg/3.1/include:/soft/compilers/ibmcmp-oct2017/xlmass/bg/7.3/include:/soft/compilers/ibmcmp-oct2017/vacpp/bg/12.1/include -qc_stdinc=/soft/compilers/ibmcmp-oct2017/xlsmp/bg/3.1/include:/soft/compilers/ibmcmp-oct2017/xlmass/bg/7.3/include:/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/include -qgcc_cpp_stdinc=/usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../../../include/c++/4.4.7:/usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/ppc64-redhat-linux:/usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/backward:/usr/local/include:/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/crt/include:/usr/include -qgcc_c_stdinc=/usr/local/include:/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/crt/include:/usr/include -qcomplexgccincl=/soft/compilers/ibmcmp-oct2017/xlsmp/bg/3.1/include:/soft/compilers/ibmcmp-oct2017/xlmass/bg/7.3/include:/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/include:/usr/local/include:/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/crt/include:/usr/include -oCMakeFiles/cmTC_98791.dir/CMakeCXXCompilerABI.cpp.o /soft/buildtools/cmake/3.5.2/share/cmake-3.5/Modules/CMakeCXXCompilerABI.cpp /tmp/xlcW0SEqGeR /tmp/xlcW1AfQ1jy /dev/null /tmp/xlcLmUAPcJF.lst /dev/null /tmp/xlcW2OCErpf +export XL_BACKEND=/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/exe/xlCcode +export XL_LINKER=/usr/bin/ld +/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/exe/xlCcode -qalias=ansi -qtls -qtls -qnostdinc /tmp/xlcW0SEqGeR /tmp/xlcW1AfQ1jy CMakeFiles/cmTC_98791.dir/CMakeCXXCompilerABI.cpp.o /tmp/xlcLmUAPcJB.lst /tmp/xlcW2OCErpf +rm /tmp/xlcAS82INiZ +rm /tmp/xlcLmUAPcJ +rm /tmp/xlcW0SEqGeR +rm /tmp/xlcW1AfQ1jy +rm /tmp/xlcW2OCErpf +Linking CXX executable cmTC_98791 +/soft/buildtools/cmake/3.5.2/bin/cmake -E cmake_link_script CMakeFiles/cmTC_98791.dir/link.txt --verbose=1 +/soft/compilers/ibmcmp-oct2017/vacpp/bg/12.1/bin/xlC -qnostdinc -V CMakeFiles/cmTC_98791.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_98791 -Wl,-export-dynamic +export XL_CONFIG=/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/etc/vac.cfg.rhel6.9.gcc447:xlC +export XLC_USR_CONFIG=/soft/compilers/ibmcmp-oct2017/vacpp/bg/12.1/etc/V1R2M4.vac.cfg.rhel6.9.gcc447 +/usr/bin/ld --eh-frame-hdr -Qy -melf64ppc /usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../../../lib64/crt1.o /usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../../../lib64/crti.o /usr/lib/gcc/ppc64-redhat-linux/4.4.7/crtbegin.o -L/soft/compilers/ibmcmp-oct2017/xlsmp/bg/3.1/lib64 -L/soft/compilers/ibmcmp-oct2017/xlmass/bg/7.3/lib64 -L/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/lib64 -L/soft/compilers/ibmcmp-oct2017/vacpp/bg/12.1/lib64 -R/soft/compilers/ibmcmp-oct2017/lib64/bg -L/usr/lib/gcc/ppc64-redhat-linux/4.4.7 -L/usr/lib/gcc/ppc64-redhat-linux/4.4.7 -L/usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../.. -L/usr/lib/gcc/ppc64-redhat-linux/4.4.7 -L/usr/lib/gcc/ppc64-redhat-linux/4.4.7 -L/usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../.. CMakeFiles/cmTC_98791.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_98791 -export-dynamic -dynamic-linker /lib64/ld64.so.1 -lxlopt -lxl -libmc++ -lxlopt -lxl -lstdc++ -lm -ldl -lgcc_s -lgcc -lm -lc -lgcc_s -lgcc -ldl -lgcc_s -lgcc -lm -lc -lgcc_s -lgcc /usr/lib/gcc/ppc64-redhat-linux/4.4.7/crtend.o /usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../../../lib64/crtn.o +rm /tmp/xlcW0DcBWi8 +rm /tmp/xlcW14NqGs6 +rm /tmp/xlcW2Z8nuC4 +gmake[1]: Leaving directory `/tmp/ii/CMakeFiles/CMakeTmp' diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/sunos-CXX-SunPro-5.13.0.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux_nostdinc-CXX-XL-12.1.0.output similarity index 100% copy from Tests/RunCMake/ParseImplicitIncludeInfo/data/sunos-CXX-SunPro-5.13.0.output copy to Tests/RunCMake/ParseImplicitIncludeInfo/data/linux_nostdinc-CXX-XL-12.1.0.output diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux_nostdinc_i-C-XL-12.1.0.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux_nostdinc_i-C-XL-12.1.0.input new file mode 100644 index 0000000..a552d70 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux_nostdinc_i-C-XL-12.1.0.input @@ -0,0 +1,42 @@ +CMAKE_LANG=C +CMAKE_C_COMPILER_ABI=ELF +CMAKE_C_COMPILER_AR= +CMAKE_C_COMPILER_ARCHITECTURE_ID= +CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_C_COMPILER_ID=XL +CMAKE_C_COMPILER_LAUNCHER= +CMAKE_C_COMPILER_LOADED=1 +CMAKE_C_COMPILER_RANLIB= +CMAKE_C_COMPILER_TARGET= +CMAKE_C_COMPILER_VERSION=12.1.0 +CMAKE_C_COMPILER_VERSION_INTERAL= +Change Dir: /tmp/ii/CMakeFiles/CMakeTmp + +Run Build Command:"/usr/bin/gmake" "cmTC_76ec2/fast" +/usr/bin/gmake -f CMakeFiles/cmTC_76ec2.dir/build.make CMakeFiles/cmTC_76ec2.dir/build +gmake[1]: Entering directory `/tmp/ii/CMakeFiles/CMakeTmp' +Building C object CMakeFiles/cmTC_76ec2.dir/CMakeCCompilerABI.c.o +/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/bin/xlc -qnostdinc -I/tmp/ii/test_c -V -o CMakeFiles/cmTC_76ec2.dir/CMakeCCompilerABI.c.o -c /soft/buildtools/cmake/3.5.2/share/cmake-3.5/Modules/CMakeCCompilerABI.c +export XL_CONFIG=/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/etc/vac.cfg.rhel6.9.gcc447:xlc +export XLC_USR_CONFIG=/soft/compilers/ibmcmp-oct2017/vacpp/bg/12.1/etc/V1R2M4.vac.cfg.rhel6.9.gcc447 +export XL_ASMOBJFILES=/tmp/xlcASknvctJ +export "XL_DIS=/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/exe/dis -o "CMakeFiles/cmTC_76ec2.dir/CMakeCCompilerABI.c.o" "CMakeCCompilerABI.o"" +/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/exe/xlcentry -qosvar=rhel.6.9 -qlanglvl=extc99 -qcpluscmt -qkeyword=inline -qalias=ansi -qtls -D_CALL_SYSV -D__null=0 -D__NO_MATH_INLINES -qtls -q64 -qgnu_version=4.4.7 -qnostdinc -I/tmp/ii/test_c -qasm_as=/usr/bin/as -qc_stdinc=/soft/compilers/ibmcmp-oct2017/xlsmp/bg/3.1/include:/soft/compilers/ibmcmp-oct2017/xlmass/bg/7.3/include:/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/include -qgcc_c_stdinc=/usr/local/include:/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/crt/include:/usr/include -qcomplexgccincl=/soft/compilers/ibmcmp-oct2017/xlsmp/bg/3.1/include:/soft/compilers/ibmcmp-oct2017/xlmass/bg/7.3/include:/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/include:/usr/local/include:/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/crt/include:/usr/include -qvac_include_path=/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/include -oCMakeFiles/cmTC_76ec2.dir/CMakeCCompilerABI.c.o /soft/buildtools/cmake/3.5.2/share/cmake-3.5/Modules/CMakeCCompilerABI.c /tmp/xlcW0buijl3 /tmp/xlcW1Cx9kxW /dev/null /tmp/xlcLVbqvUBF.lst /dev/null /tmp/xlcW2hWVoJP +export XL_BACKEND=/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/exe/xlCcode +export XL_LINKER=/usr/bin/ld +/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/exe/xlCcode -qlanglvl=extc99 -qcpluscmt -qkeyword=inline -qalias=ansi -qtls -qtls -qnostdinc /tmp/xlcW0buijl3 /tmp/xlcW1Cx9kxW CMakeFiles/cmTC_76ec2.dir/CMakeCCompilerABI.c.o /tmp/xlcLVbqvUBB.lst /tmp/xlcW2hWVoJP +rm /tmp/xlcASknvctJ +rm /tmp/xlcLVbqvUB +rm /tmp/xlcW0buijl3 +rm /tmp/xlcW1Cx9kxW +rm /tmp/xlcW2hWVoJP +Linking C executable cmTC_76ec2 +/soft/buildtools/cmake/3.5.2/bin/cmake -E cmake_link_script CMakeFiles/cmTC_76ec2.dir/link.txt --verbose=1 +/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/bin/xlc -qnostdinc -I/tmp/ii/test_c -V CMakeFiles/cmTC_76ec2.dir/CMakeCCompilerABI.c.o -o cmTC_76ec2 -Wl,-export-dynamic +export XL_CONFIG=/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/etc/vac.cfg.rhel6.9.gcc447:xlc +export XLC_USR_CONFIG=/soft/compilers/ibmcmp-oct2017/vacpp/bg/12.1/etc/V1R2M4.vac.cfg.rhel6.9.gcc447 +/usr/bin/ld --eh-frame-hdr -Qy -melf64ppc /usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../../../lib64/crt1.o /usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../../../lib64/crti.o /usr/lib/gcc/ppc64-redhat-linux/4.4.7/crtbegin.o -L/soft/compilers/ibmcmp-oct2017/xlsmp/bg/3.1/lib64 -L/soft/compilers/ibmcmp-oct2017/xlmass/bg/7.3/lib64 -L/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/lib64 -L/soft/compilers/ibmcmp-oct2017/vacpp/bg/12.1/lib64 -R/soft/compilers/ibmcmp-oct2017/lib64/bg -L/usr/lib/gcc/ppc64-redhat-linux/4.4.7 -L/usr/lib/gcc/ppc64-redhat-linux/4.4.7 -L/usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../.. CMakeFiles/cmTC_76ec2.dir/CMakeCCompilerABI.c.o -o cmTC_76ec2 -export-dynamic -dynamic-linker /lib64/ld64.so.1 -lxlopt -lxl -ldl -lgcc_s -lgcc -lm -lc -lgcc_s -lgcc /usr/lib/gcc/ppc64-redhat-linux/4.4.7/crtend.o /usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../../../lib64/crtn.o +rm /tmp/xlcW0ka8GHg +rm /tmp/xlcW1k1R1fn +rm /tmp/xlcW2s4HnOt +gmake[1]: Leaving directory `/tmp/ii/CMakeFiles/CMakeTmp' diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux_nostdinc_i-C-XL-12.1.0.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux_nostdinc_i-C-XL-12.1.0.output new file mode 100644 index 0000000..38f0b37 --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux_nostdinc_i-C-XL-12.1.0.output @@ -0,0 +1 @@ +/tmp/ii/test_c diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux_nostdinc_i-CXX-XL-12.1.0.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux_nostdinc_i-CXX-XL-12.1.0.input new file mode 100644 index 0000000..4b20f2e --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux_nostdinc_i-CXX-XL-12.1.0.input @@ -0,0 +1,42 @@ +CMAKE_LANG=CXX +CMAKE_CXX_COMPILER_ABI=ELF +CMAKE_CXX_COMPILER_AR= +CMAKE_CXX_COMPILER_ARCHITECTURE_ID= +CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_CXX_COMPILER_ID=XL +CMAKE_CXX_COMPILER_LAUNCHER= +CMAKE_CXX_COMPILER_LOADED=1 +CMAKE_CXX_COMPILER_RANLIB= +CMAKE_CXX_COMPILER_TARGET= +CMAKE_CXX_COMPILER_VERSION=12.1.0 +CMAKE_CXX_COMPILER_VERSION_INTERAL= +Change Dir: /tmp/ii/CMakeFiles/CMakeTmp + +Run Build Command:"/usr/bin/gmake" "cmTC_026f6/fast" +/usr/bin/gmake -f CMakeFiles/cmTC_026f6.dir/build.make CMakeFiles/cmTC_026f6.dir/build +gmake[1]: Entering directory `/tmp/ii/CMakeFiles/CMakeTmp' +Building CXX object CMakeFiles/cmTC_026f6.dir/CMakeCXXCompilerABI.cpp.o +/soft/compilers/ibmcmp-oct2017/vacpp/bg/12.1/bin/xlC -+ -qnostdinc -I/tmp/ii/test_c -I/tmp/ii/test_cxx -V -o CMakeFiles/cmTC_026f6.dir/CMakeCXXCompilerABI.cpp.o -c /soft/buildtools/cmake/3.5.2/share/cmake-3.5/Modules/CMakeCXXCompilerABI.cpp +export XL_CONFIG=/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/etc/vac.cfg.rhel6.9.gcc447:xlC +export XLC_USR_CONFIG=/soft/compilers/ibmcmp-oct2017/vacpp/bg/12.1/etc/V1R2M4.vac.cfg.rhel6.9.gcc447 +export XL_ASMOBJFILES=/tmp/xlcAS6jiX2k +export "XL_DIS=/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/exe/dis -o "CMakeFiles/cmTC_026f6.dir/CMakeCXXCompilerABI.cpp.o" "CMakeCXXCompilerABI.o"" +/soft/compilers/ibmcmp-oct2017/vacpp/bg/12.1/exe/xlCentry -qosvar=rhel.6.9 -qalias=ansi -qtls -D_CALL_SYSV -D__null=0 -D__NO_MATH_INLINES -qtls -q64 -qgnu_version=4.4.7 -qnostdinc -I/tmp/ii/test_c -I/tmp/ii/test_cxx -qasm_as=/usr/bin/as -qcpp_stdinc=/soft/compilers/ibmcmp-oct2017/xlsmp/bg/3.1/include:/soft/compilers/ibmcmp-oct2017/xlmass/bg/7.3/include:/soft/compilers/ibmcmp-oct2017/vacpp/bg/12.1/include -qc_stdinc=/soft/compilers/ibmcmp-oct2017/xlsmp/bg/3.1/include:/soft/compilers/ibmcmp-oct2017/xlmass/bg/7.3/include:/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/include -qgcc_cpp_stdinc=/usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../../../include/c++/4.4.7:/usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/ppc64-redhat-linux:/usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/backward:/usr/local/include:/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/crt/include:/usr/include -qgcc_c_stdinc=/usr/local/include:/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/crt/include:/usr/include -qcomplexgccincl=/soft/compilers/ibmcmp-oct2017/xlsmp/bg/3.1/include:/soft/compilers/ibmcmp-oct2017/xlmass/bg/7.3/include:/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/include:/usr/local/include:/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/crt/include:/usr/include -oCMakeFiles/cmTC_026f6.dir/CMakeCXXCompilerABI.cpp.o /soft/buildtools/cmake/3.5.2/share/cmake-3.5/Modules/CMakeCXXCompilerABI.cpp /tmp/xlcW00ICris /tmp/xlcW1eYwBrK /dev/null /tmp/xlcLG2pVwDF.lst /dev/null /tmp/xlcW2YVJhA2 +export XL_BACKEND=/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/exe/xlCcode +export XL_LINKER=/usr/bin/ld +/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/exe/xlCcode -qalias=ansi -qtls -qtls -qnostdinc /tmp/xlcW00ICris /tmp/xlcW1eYwBrK CMakeFiles/cmTC_026f6.dir/CMakeCXXCompilerABI.cpp.o /tmp/xlcLG2pVwDB.lst /tmp/xlcW2YVJhA2 +rm /tmp/xlcAS6jiX2k +rm /tmp/xlcLG2pVwD +rm /tmp/xlcW00ICris +rm /tmp/xlcW1eYwBrK +rm /tmp/xlcW2YVJhA2 +Linking CXX executable cmTC_026f6 +/soft/buildtools/cmake/3.5.2/bin/cmake -E cmake_link_script CMakeFiles/cmTC_026f6.dir/link.txt --verbose=1 +/soft/compilers/ibmcmp-oct2017/vacpp/bg/12.1/bin/xlC -qnostdinc -I/tmp/ii/test_c -I/tmp/ii/test_cxx -V CMakeFiles/cmTC_026f6.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_026f6 -Wl,-export-dynamic +export XL_CONFIG=/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/etc/vac.cfg.rhel6.9.gcc447:xlC +export XLC_USR_CONFIG=/soft/compilers/ibmcmp-oct2017/vacpp/bg/12.1/etc/V1R2M4.vac.cfg.rhel6.9.gcc447 +/usr/bin/ld --eh-frame-hdr -Qy -melf64ppc /usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../../../lib64/crt1.o /usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../../../lib64/crti.o /usr/lib/gcc/ppc64-redhat-linux/4.4.7/crtbegin.o -L/soft/compilers/ibmcmp-oct2017/xlsmp/bg/3.1/lib64 -L/soft/compilers/ibmcmp-oct2017/xlmass/bg/7.3/lib64 -L/soft/compilers/ibmcmp-oct2017/vac/bg/12.1/lib64 -L/soft/compilers/ibmcmp-oct2017/vacpp/bg/12.1/lib64 -R/soft/compilers/ibmcmp-oct2017/lib64/bg -L/usr/lib/gcc/ppc64-redhat-linux/4.4.7 -L/usr/lib/gcc/ppc64-redhat-linux/4.4.7 -L/usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../.. -L/usr/lib/gcc/ppc64-redhat-linux/4.4.7 -L/usr/lib/gcc/ppc64-redhat-linux/4.4.7 -L/usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../.. CMakeFiles/cmTC_026f6.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_026f6 -export-dynamic -dynamic-linker /lib64/ld64.so.1 -lxlopt -lxl -libmc++ -lxlopt -lxl -lstdc++ -lm -ldl -lgcc_s -lgcc -lm -lc -lgcc_s -lgcc -ldl -lgcc_s -lgcc -lm -lc -lgcc_s -lgcc /usr/lib/gcc/ppc64-redhat-linux/4.4.7/crtend.o /usr/lib/gcc/ppc64-redhat-linux/4.4.7/../../../../lib64/crtn.o +rm /tmp/xlcW0rO54CG +rm /tmp/xlcW1Q6xB5c +rm /tmp/xlcW2TnvdyJ +gmake[1]: Leaving directory `/tmp/ii/CMakeFiles/CMakeTmp' diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux_nostdinc_i-CXX-XL-12.1.0.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux_nostdinc_i-CXX-XL-12.1.0.output new file mode 100644 index 0000000..727afdb --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/linux_nostdinc_i-CXX-XL-12.1.0.output @@ -0,0 +1 @@ +/tmp/ii/test_c;/tmp/ii/test_cxx diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/netbsd_nostdinc-C-GNU-4.8.5.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/netbsd_nostdinc-C-GNU-4.8.5.input new file mode 100644 index 0000000..cd5845a --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/netbsd_nostdinc-C-GNU-4.8.5.input @@ -0,0 +1,58 @@ +CMAKE_LANG=C +CMAKE_C_COMPILER_ABI=ELF +CMAKE_C_COMPILER_AR=CMAKE_C_COMPILER_AR-NOTFOUND +CMAKE_C_COMPILER_ARCHITECTURE_ID= +CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_C_COMPILER_ID=GNU +CMAKE_C_COMPILER_LAUNCHER= +CMAKE_C_COMPILER_LOADED=1 +CMAKE_C_COMPILER_RANLIB=CMAKE_C_COMPILER_RANLIB-NOTFOUND +CMAKE_C_COMPILER_TARGET= +CMAKE_C_COMPILER_VERSION=4.8.5 +CMAKE_C_COMPILER_VERSION_INTERAL= +Change Dir: /tmp/ii/CMakeFiles/CMakeTmp + +Run Build Command:"/usr/pkg/bin/gmake" "cmTC_b8d65/fast" +/usr/pkg/bin/gmake -f CMakeFiles/cmTC_b8d65.dir/build.make CMakeFiles/cmTC_b8d65.dir/build +gmake[1]: Entering directory '/tmp/ii/CMakeFiles/CMakeTmp' +Building C object CMakeFiles/cmTC_b8d65.dir/CMakeCCompilerABI.c.o +/usr/bin/cc -nostdinc -v -o CMakeFiles/cmTC_b8d65.dir/CMakeCCompilerABI.c.o -c /usr/pkg/share/cmake-3.9/Modules/CMakeCCompilerABI.c +Using built-in specs. +COLLECT_GCC=/usr/bin/cc +Target: i486--netbsdelf +Configured with: /usr/7/src/tools/gcc/../../external/gpl3/gcc/dist/configure --target=i486--netbsdelf --enable-long-long --enable-threads --with-bugurl=http://www.NetBSD.org/Misc/send-pr.html --with-pkgversion='NetBSD nb2 20150115' --with-system-zlib --enable-__cxa_atexit --enable-libstdcxx-threads --with-arch=i486 --with-tune=nocona --enable-libstdcxx-time=rt --enable-lto --with-mpc-lib=/var/obj/mknative/i386/usr/7/src/external/lgpl3/mpc/lib/libmpc --with-mpfr-lib=/var/obj/mknative/i386/usr/7/src/external/lgpl3/mpfr/lib/libmpfr --with-gmp-lib=/var/obj/mknative/i386/usr/7/src/external/lgpl3/gmp/lib/libgmp --with-mpc-include=/usr/7/src/external/lgpl3/mpc/dist/src --with-mpfr-include=/usr/7/src/external/lgpl3/mpfr/dist/src --with-gmp-include=/usr/7/src/external/lgpl3/gmp/lib/libgmp/arch/i386 --enable-tls --disable-multilib --disable-symvers --disable-libstdcxx-pch --build=x86_64-unknown-netbsd6.0. --host=i486--netbsdelf --with-sysroot=/var/obj/mknative/i386/usr/7/src/destdir.i386 +Thread model: posix +gcc version 4.8.5 (nb2 20150115) +COLLECT_GCC_OPTIONS='-nostdinc' '-v' '-o' 'CMakeFiles/cmTC_b8d65.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=nocona' '-march=i486' + /usr/libexec/cc1 -quiet -nostdinc -v /usr/pkg/share/cmake-3.9/Modules/CMakeCCompilerABI.c -quiet -dumpbase CMakeCCompilerABI.c -mtune=nocona -march=i486 -auxbase-strip CMakeFiles/cmTC_b8d65.dir/CMakeCCompilerABI.c.o -version -o /var/tmp//ccPEfYnQ.s +GNU C (nb2 20150115) version 4.8.5 (i486--netbsdelf) + compiled by GNU C version 4.8.5, GMP version 5.1.3, MPFR version 3.1.2, MPC version 1.0.1 +GGC heuristics: --param ggc-min-expand=73 --param ggc-min-heapsize=81803 +#include "..." search starts here: +#include <...> search starts here: +End of search list. +GNU C (nb2 20150115) version 4.8.5 (i486--netbsdelf) + compiled by GNU C version 4.8.5, GMP version 5.1.3, MPFR version 3.1.2, MPC version 1.0.1 +GGC heuristics: --param ggc-min-expand=73 --param ggc-min-heapsize=81803 +Compiler executable checksum: 468b91b49af5cfeb6bb696ad20c66c1c +COLLECT_GCC_OPTIONS='-nostdinc' '-v' '-o' 'CMakeFiles/cmTC_b8d65.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=nocona' '-march=i486' + as -v -o CMakeFiles/cmTC_b8d65.dir/CMakeCCompilerABI.c.o /var/tmp//ccPEfYnQ.s +GNU assembler version 2.23.2 (i486--netbsdelf) using BFD version (NetBSD Binutils nb1) 2.23.2 +COMPILER_PATH=/usr/libexec/ +LIBRARY_PATH=/usr/lib/ +COLLECT_GCC_OPTIONS='-nostdinc' '-v' '-o' 'CMakeFiles/cmTC_b8d65.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=nocona' '-march=i486' +Linking C executable cmTC_b8d65 +/usr/pkg/bin/cmake -E cmake_link_script CMakeFiles/cmTC_b8d65.dir/link.txt --verbose=1 +/usr/bin/cc -nostdinc -v CMakeFiles/cmTC_b8d65.dir/CMakeCCompilerABI.c.o -o cmTC_b8d65 +Using built-in specs. +COLLECT_GCC=/usr/bin/cc +COLLECT_LTO_WRAPPER=/usr/libexec/lto-wrapper +Target: i486--netbsdelf +Configured with: /usr/7/src/tools/gcc/../../external/gpl3/gcc/dist/configure --target=i486--netbsdelf --enable-long-long --enable-threads --with-bugurl=http://www.NetBSD.org/Misc/send-pr.html --with-pkgversion='NetBSD nb2 20150115' --with-system-zlib --enable-__cxa_atexit --enable-libstdcxx-threads --with-arch=i486 --with-tune=nocona --enable-libstdcxx-time=rt --enable-lto --with-mpc-lib=/var/obj/mknative/i386/usr/7/src/external/lgpl3/mpc/lib/libmpc --with-mpfr-lib=/var/obj/mknative/i386/usr/7/src/external/lgpl3/mpfr/lib/libmpfr --with-gmp-lib=/var/obj/mknative/i386/usr/7/src/external/lgpl3/gmp/lib/libgmp --with-mpc-include=/usr/7/src/external/lgpl3/mpc/dist/src --with-mpfr-include=/usr/7/src/external/lgpl3/mpfr/dist/src --with-gmp-include=/usr/7/src/external/lgpl3/gmp/lib/libgmp/arch/i386 --enable-tls --disable-multilib --disable-symvers --disable-libstdcxx-pch --build=x86_64-unknown-netbsd6.0. --host=i486--netbsdelf --with-sysroot=/var/obj/mknative/i386/usr/7/src/destdir.i386 +Thread model: posix +gcc version 4.8.5 (nb2 20150115) +COMPILER_PATH=/usr/libexec/ +LIBRARY_PATH=/usr/lib/ +COLLECT_GCC_OPTIONS='-nostdinc' '-v' '-o' 'cmTC_b8d65' '-mtune=nocona' '-march=i486' + ld --eh-frame-hdr -dc -dp -e __start -dynamic-linker /usr/libexec/ld.elf_so -o cmTC_b8d65 /usr/lib/crt0.o /usr/lib/crti.o /usr/lib/crtbegin.o CMakeFiles/cmTC_b8d65.dir/CMakeCCompilerABI.c.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/crtend.o /usr/lib/crtn.o +gmake[1]: Leaving directory '/tmp/ii/CMakeFiles/CMakeTmp' diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/sunos-CXX-SunPro-5.13.0.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/netbsd_nostdinc-C-GNU-4.8.5.output similarity index 100% copy from Tests/RunCMake/ParseImplicitIncludeInfo/data/sunos-CXX-SunPro-5.13.0.output copy to Tests/RunCMake/ParseImplicitIncludeInfo/data/netbsd_nostdinc-C-GNU-4.8.5.output diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/netbsd_nostdinc-CXX-GNU-4.8.5.input b/Tests/RunCMake/ParseImplicitIncludeInfo/data/netbsd_nostdinc-CXX-GNU-4.8.5.input new file mode 100644 index 0000000..b9a585c --- /dev/null +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/netbsd_nostdinc-CXX-GNU-4.8.5.input @@ -0,0 +1,58 @@ +CMAKE_LANG=CXX +CMAKE_CXX_COMPILER_ABI=ELF +CMAKE_CXX_COMPILER_AR=CMAKE_CXX_COMPILER_AR-NOTFOUND +CMAKE_CXX_COMPILER_ARCHITECTURE_ID= +CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN= +CMAKE_CXX_COMPILER_ID=GNU +CMAKE_CXX_COMPILER_LAUNCHER= +CMAKE_CXX_COMPILER_LOADED=1 +CMAKE_CXX_COMPILER_RANLIB=CMAKE_CXX_COMPILER_RANLIB-NOTFOUND +CMAKE_CXX_COMPILER_TARGET= +CMAKE_CXX_COMPILER_VERSION=4.8.5 +CMAKE_CXX_COMPILER_VERSION_INTERAL= +Change Dir: /tmp/ii/CMakeFiles/CMakeTmp + +Run Build Command:"/usr/pkg/bin/gmake" "cmTC_bbb1e/fast" +/usr/pkg/bin/gmake -f CMakeFiles/cmTC_bbb1e.dir/build.make CMakeFiles/cmTC_bbb1e.dir/build +gmake[1]: Entering directory '/tmp/ii/CMakeFiles/CMakeTmp' +Building CXX object CMakeFiles/cmTC_bbb1e.dir/CMakeCXXCompilerABI.cpp.o +/usr/bin/c++ -nostdinc -v -o CMakeFiles/cmTC_bbb1e.dir/CMakeCXXCompilerABI.cpp.o -c /usr/pkg/share/cmake-3.9/Modules/CMakeCXXCompilerABI.cpp +Using built-in specs. +COLLECT_GCC=/usr/bin/c++ +Target: i486--netbsdelf +Configured with: /usr/7/src/tools/gcc/../../external/gpl3/gcc/dist/configure --target=i486--netbsdelf --enable-long-long --enable-threads --with-bugurl=http://www.NetBSD.org/Misc/send-pr.html --with-pkgversion='NetBSD nb2 20150115' --with-system-zlib --enable-__cxa_atexit --enable-libstdcxx-threads --with-arch=i486 --with-tune=nocona --enable-libstdcxx-time=rt --enable-lto --with-mpc-lib=/var/obj/mknative/i386/usr/7/src/external/lgpl3/mpc/lib/libmpc --with-mpfr-lib=/var/obj/mknative/i386/usr/7/src/external/lgpl3/mpfr/lib/libmpfr --with-gmp-lib=/var/obj/mknative/i386/usr/7/src/external/lgpl3/gmp/lib/libgmp --with-mpc-include=/usr/7/src/external/lgpl3/mpc/dist/src --with-mpfr-include=/usr/7/src/external/lgpl3/mpfr/dist/src --with-gmp-include=/usr/7/src/external/lgpl3/gmp/lib/libgmp/arch/i386 --enable-tls --disable-multilib --disable-symvers --disable-libstdcxx-pch --build=x86_64-unknown-netbsd6.0. --host=i486--netbsdelf --with-sysroot=/var/obj/mknative/i386/usr/7/src/destdir.i386 +Thread model: posix +gcc version 4.8.5 (nb2 20150115) +COLLECT_GCC_OPTIONS='-nostdinc' '-v' '-o' 'CMakeFiles/cmTC_bbb1e.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=nocona' '-march=i486' + /usr/libexec/cc1plus -quiet -nostdinc -v /usr/pkg/share/cmake-3.9/Modules/CMakeCXXCompilerABI.cpp -quiet -dumpbase CMakeCXXCompilerABI.cpp -mtune=nocona -march=i486 -auxbase-strip CMakeFiles/cmTC_bbb1e.dir/CMakeCXXCompilerABI.cpp.o -version -o /var/tmp//cclVebp0.s +GNU C++ (nb2 20150115) version 4.8.5 (i486--netbsdelf) + compiled by GNU C version 4.8.5, GMP version 5.1.3, MPFR version 3.1.2, MPC version 1.0.1 +GGC heuristics: --param ggc-min-expand=73 --param ggc-min-heapsize=81803 +#include "..." search starts here: +#include <...> search starts here: +End of search list. +GNU C++ (nb2 20150115) version 4.8.5 (i486--netbsdelf) + compiled by GNU C version 4.8.5, GMP version 5.1.3, MPFR version 3.1.2, MPC version 1.0.1 +GGC heuristics: --param ggc-min-expand=73 --param ggc-min-heapsize=81803 +Compiler executable checksum: 961550adc452c84b614bf799df00d02b +COLLECT_GCC_OPTIONS='-nostdinc' '-v' '-o' 'CMakeFiles/cmTC_bbb1e.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=nocona' '-march=i486' + as -v -o CMakeFiles/cmTC_bbb1e.dir/CMakeCXXCompilerABI.cpp.o /var/tmp//cclVebp0.s +GNU assembler version 2.23.2 (i486--netbsdelf) using BFD version (NetBSD Binutils nb1) 2.23.2 +COMPILER_PATH=/usr/libexec/ +LIBRARY_PATH=/usr/lib/ +COLLECT_GCC_OPTIONS='-nostdinc' '-v' '-o' 'CMakeFiles/cmTC_bbb1e.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=nocona' '-march=i486' +Linking CXX executable cmTC_bbb1e +/usr/pkg/bin/cmake -E cmake_link_script CMakeFiles/cmTC_bbb1e.dir/link.txt --verbose=1 +/usr/bin/c++ -nostdinc -v CMakeFiles/cmTC_bbb1e.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_bbb1e +Using built-in specs. +COLLECT_GCC=/usr/bin/c++ +COLLECT_LTO_WRAPPER=/usr/libexec/lto-wrapper +Target: i486--netbsdelf +Configured with: /usr/7/src/tools/gcc/../../external/gpl3/gcc/dist/configure --target=i486--netbsdelf --enable-long-long --enable-threads --with-bugurl=http://www.NetBSD.org/Misc/send-pr.html --with-pkgversion='NetBSD nb2 20150115' --with-system-zlib --enable-__cxa_atexit --enable-libstdcxx-threads --with-arch=i486 --with-tune=nocona --enable-libstdcxx-time=rt --enable-lto --with-mpc-lib=/var/obj/mknative/i386/usr/7/src/external/lgpl3/mpc/lib/libmpc --with-mpfr-lib=/var/obj/mknative/i386/usr/7/src/external/lgpl3/mpfr/lib/libmpfr --with-gmp-lib=/var/obj/mknative/i386/usr/7/src/external/lgpl3/gmp/lib/libgmp --with-mpc-include=/usr/7/src/external/lgpl3/mpc/dist/src --with-mpfr-include=/usr/7/src/external/lgpl3/mpfr/dist/src --with-gmp-include=/usr/7/src/external/lgpl3/gmp/lib/libgmp/arch/i386 --enable-tls --disable-multilib --disable-symvers --disable-libstdcxx-pch --build=x86_64-unknown-netbsd6.0. --host=i486--netbsdelf --with-sysroot=/var/obj/mknative/i386/usr/7/src/destdir.i386 +Thread model: posix +gcc version 4.8.5 (nb2 20150115) +COMPILER_PATH=/usr/libexec/ +LIBRARY_PATH=/usr/lib/ +COLLECT_GCC_OPTIONS='-nostdinc' '-v' '-o' 'cmTC_bbb1e' '-shared-libgcc' '-mtune=nocona' '-march=i486' + ld --eh-frame-hdr -dc -dp -e __start -dynamic-linker /usr/libexec/ld.elf_so -o cmTC_bbb1e /usr/lib/crt0.o /usr/lib/crti.o /usr/lib/crtbegin.o CMakeFiles/cmTC_bbb1e.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm --as-needed -lgcc_s --no-as-needed -lgcc -lc --as-needed -lgcc_s --no-as-needed -lgcc /usr/lib/crtend.o /usr/lib/crtn.o +gmake[1]: Leaving directory '/tmp/ii/CMakeFiles/CMakeTmp' diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/sunos-CXX-SunPro-5.13.0.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/netbsd_nostdinc-CXX-GNU-4.8.5.output similarity index 100% copy from Tests/RunCMake/ParseImplicitIncludeInfo/data/sunos-CXX-SunPro-5.13.0.output copy to Tests/RunCMake/ParseImplicitIncludeInfo/data/netbsd_nostdinc-CXX-GNU-4.8.5.output diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/sunos-C-SunPro-5.13.0.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/sunos-C-SunPro-5.13.0.output index e69de29..27c452d 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/sunos-C-SunPro-5.13.0.output +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/sunos-C-SunPro-5.13.0.output @@ -0,0 +1 @@ +/opt/solarisstudio12.4/lib/compilers/include/cc;/usr/include diff --git a/Tests/RunCMake/ParseImplicitIncludeInfo/data/sunos-CXX-SunPro-5.13.0.output b/Tests/RunCMake/ParseImplicitIncludeInfo/data/sunos-CXX-SunPro-5.13.0.output index e69de29..be851c2 100644 --- a/Tests/RunCMake/ParseImplicitIncludeInfo/data/sunos-CXX-SunPro-5.13.0.output +++ b/Tests/RunCMake/ParseImplicitIncludeInfo/data/sunos-CXX-SunPro-5.13.0.output @@ -0,0 +1 @@ +/opt/solarisstudio12.4/lib/compilers/include/CC/Cstd;/opt/solarisstudio12.4/lib/compilers/include/CC;/opt/solarisstudio12.4/lib/compilers/include/cc;/usr/include https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b9e6d04558bdafab67aa392052d7136cdc4a7be2 commit b9e6d04558bdafab67aa392052d7136cdc4a7be2 Author: Lucy Phipps AuthorDate: Thu Jan 24 15:32:19 2019 +0000 Commit: Brad King CommitDate: Fri Jan 25 09:14:51 2019 -0500 Reduce size of PNG images Use FileOptimizer 13.50.2431 (x86) and ZopfliPNG 1.0.2. Update expected file hashes in tests. diff --git a/Modules/CPack.background.png.in b/Modules/CPack.background.png.in index 3fa92b5..a32ab37 100644 Binary files a/Modules/CPack.background.png.in and b/Modules/CPack.background.png.in differ diff --git a/Source/QtDialog/CMakeSetup128.png b/Source/QtDialog/CMakeSetup128.png index 728ef02..32984e1 100644 Binary files a/Source/QtDialog/CMakeSetup128.png and b/Source/QtDialog/CMakeSetup128.png differ diff --git a/Source/QtDialog/CMakeSetup32.png b/Source/QtDialog/CMakeSetup32.png index 1c36b31..78df82f 100644 Binary files a/Source/QtDialog/CMakeSetup32.png and b/Source/QtDialog/CMakeSetup32.png differ diff --git a/Source/QtDialog/CMakeSetup64.png b/Source/QtDialog/CMakeSetup64.png index 44eb171..5c2dbf5 100644 Binary files a/Source/QtDialog/CMakeSetup64.png and b/Source/QtDialog/CMakeSetup64.png differ diff --git a/Source/QtDialog/Delete16.png b/Source/QtDialog/Delete16.png index 16989fee..9d2f2b7 100644 Binary files a/Source/QtDialog/Delete16.png and b/Source/QtDialog/Delete16.png differ diff --git a/Source/QtDialog/Plus16.png b/Source/QtDialog/Plus16.png index 552f6f0..1c33bc7 100644 Binary files a/Source/QtDialog/Plus16.png and b/Source/QtDialog/Plus16.png differ diff --git a/Templates/Windows/ApplicationIcon.png b/Templates/Windows/ApplicationIcon.png index 7d95d4e..c715e1b 100644 Binary files a/Templates/Windows/ApplicationIcon.png and b/Templates/Windows/ApplicationIcon.png differ diff --git a/Templates/Windows/Logo.png b/Templates/Windows/Logo.png index e26771c..65f91ac 100644 Binary files a/Templates/Windows/Logo.png and b/Templates/Windows/Logo.png differ diff --git a/Templates/Windows/SmallLogo.png b/Templates/Windows/SmallLogo.png index 1eb0d9d..460c022 100644 Binary files a/Templates/Windows/SmallLogo.png and b/Templates/Windows/SmallLogo.png differ diff --git a/Templates/Windows/SmallLogo44x44.png b/Templates/Windows/SmallLogo44x44.png index 28810b7..c237458 100644 Binary files a/Templates/Windows/SmallLogo44x44.png and b/Templates/Windows/SmallLogo44x44.png differ diff --git a/Templates/Windows/SplashScreen.png b/Templates/Windows/SplashScreen.png index c951e03..8342565 100644 Binary files a/Templates/Windows/SplashScreen.png and b/Templates/Windows/SplashScreen.png differ diff --git a/Templates/Windows/StoreLogo.png b/Templates/Windows/StoreLogo.png index dcb6727..508c8a8 100644 Binary files a/Templates/Windows/StoreLogo.png and b/Templates/Windows/StoreLogo.png differ diff --git a/Tests/CMakeTests/FileDownloadInput.png b/Tests/CMakeTests/FileDownloadInput.png index 7bbcee4..9ab565a 100644 Binary files a/Tests/CMakeTests/FileDownloadInput.png and b/Tests/CMakeTests/FileDownloadInput.png differ diff --git a/Tests/CMakeTests/FileDownloadTest.cmake.in b/Tests/CMakeTests/FileDownloadTest.cmake.in index f6d9ad9..3935449 100644 --- a/Tests/CMakeTests/FileDownloadTest.cmake.in +++ b/Tests/CMakeTests/FileDownloadTest.cmake.in @@ -32,7 +32,7 @@ file(DOWNLOAD ${url} ${dir}/file3.png TIMEOUT 2 - EXPECTED_MD5 d16778650db435bda3a8c3435c3ff5d1 + EXPECTED_MD5 dbd330d52f4dbd60115d4191904ded92 ) message(STATUS "FileDownload:4") @@ -41,7 +41,7 @@ file(DOWNLOAD ${dir}/file3.png TIMEOUT 2 STATUS status - EXPECTED_HASH SHA1=50c614fc28b39c1281d0517bb6d5858b4359c9b7 + EXPECTED_HASH SHA1=67eee17f79d9ac557284fc0b8ad19f25723fb578 ) message(STATUS "FileDownload:5") @@ -50,7 +50,7 @@ file(DOWNLOAD ${dir}/file3.png TIMEOUT 2 STATUS status - EXPECTED_HASH SHA224=73cd5f442b04e8320e4f907f8e1b21d4befff98b5bd77bc32526ea68 + EXPECTED_HASH SHA224=ba283726bbb602776818b463943189afd91836cb7ee5dd6e2c7b5ae4 ) message(STATUS "FileDownload:6") @@ -59,7 +59,7 @@ file(DOWNLOAD ${dir}/file3.png TIMEOUT 2 STATUS status - EXPECTED_HASH SHA256=2e067f6c09cbc7cd619c8fbcc44eb64cd6b45a95e4cddb3a585eee1f731c4da9 + EXPECTED_HASH SHA256=cf3334b1275071e1da6e8c396ccb72cf1b2388d8c937526f3af26230affb9423 ) message(STATUS "FileDownload:7") @@ -68,7 +68,7 @@ file(DOWNLOAD ${dir}/file3.png TIMEOUT 2 STATUS status - EXPECTED_HASH SHA384=398bf41902a7251c30e522b307e3e41e3fb617c765b3feaa99b2f7d063894708ad399267ccc25d877437a10e5e890d35 + EXPECTED_HASH SHA384=43a5d13978d97c660db44481aee0604cb4ff6ca0775cd5c2cd68cd8000e107e507c4caf6c228941231041e282ffb8950 ) message(STATUS "FileDownload:8") @@ -77,7 +77,7 @@ file(DOWNLOAD ${dir}/file3.png TIMEOUT 2 STATUS status - EXPECTED_HASH SHA512=c51854d21052713968b849c2b4263cf54be03bc3a7e9847a6c71c6c8d1d13cd805fe1b9fa95f9ba1d0a5631513974f6fae21e34ab5b171d94bad48df5f073e48 + EXPECTED_HASH SHA512=6984e0909a1018030ccaa418e3be1654223cdccff0fe6adc745f9aea7e377f178be53b9fc7d54a6f81c2b62ef9ddcd38ba1978fedf4c5e7139baaf355eefad5b ) message(STATUS "FileDownload:9") file(DOWNLOAD @@ -85,7 +85,7 @@ file(DOWNLOAD ${dir}/file3.png TIMEOUT 2 STATUS status - EXPECTED_HASH MD5=d16778650db435bda3a8c3435c3ff5d1 + EXPECTED_HASH MD5=dbd330d52f4dbd60115d4191904ded92 ) message(STATUS "FileDownload:10") @@ -94,7 +94,7 @@ file(DOWNLOAD ${dir}/file3.png TIMEOUT 2 STATUS status - EXPECTED_MD5 d16778650db435bda3a8c3435c3ff5d1 + EXPECTED_MD5 dbd330d52f4dbd60115d4191904ded92 ) message(STATUS "${status}") diff --git a/Tests/CMakeTests/FileUploadTest.cmake.in b/Tests/CMakeTests/FileUploadTest.cmake.in index 9e22909..0e6f080 100644 --- a/Tests/CMakeTests/FileUploadTest.cmake.in +++ b/Tests/CMakeTests/FileUploadTest.cmake.in @@ -35,7 +35,7 @@ execute_process(COMMAND ${CMAKE_COMMAND} -E md5sum "@CMAKE_CURRENT_BINARY_DIR@/uploads/file1.png" OUTPUT_VARIABLE sum1 OUTPUT_STRIP_TRAILING_WHITESPACE) -if(NOT sum1 MATCHES "^d16778650db435bda3a8c3435c3ff5d1 .*/uploads/file1.png$") +if(NOT sum1 MATCHES "^dbd330d52f4dbd60115d4191904ded92 .*/uploads/file1.png$") message(FATAL_ERROR "file1.png did not upload correctly (sum1='${sum1}')") endif() @@ -43,7 +43,7 @@ execute_process(COMMAND ${CMAKE_COMMAND} -E md5sum "@CMAKE_CURRENT_BINARY_DIR@/uploads/file2.png" OUTPUT_VARIABLE sum2 OUTPUT_STRIP_TRAILING_WHITESPACE) -if(NOT sum2 MATCHES "^d16778650db435bda3a8c3435c3ff5d1 .*/uploads/file2.png$") +if(NOT sum2 MATCHES "^dbd330d52f4dbd60115d4191904ded92 .*/uploads/file2.png$") message(FATAL_ERROR "file2.png did not upload correctly (sum2='${sum2}')") endif() diff --git a/Tests/VSWinStorePhone/Direct3DApp1/Assets/ApplicationIcon.png b/Tests/VSWinStorePhone/Direct3DApp1/Assets/ApplicationIcon.png index 7d95d4e..c715e1b 100644 Binary files a/Tests/VSWinStorePhone/Direct3DApp1/Assets/ApplicationIcon.png and b/Tests/VSWinStorePhone/Direct3DApp1/Assets/ApplicationIcon.png differ diff --git a/Tests/VSWinStorePhone/Direct3DApp1/Assets/Logo.png b/Tests/VSWinStorePhone/Direct3DApp1/Assets/Logo.png index e26771c..65f91ac 100644 Binary files a/Tests/VSWinStorePhone/Direct3DApp1/Assets/Logo.png and b/Tests/VSWinStorePhone/Direct3DApp1/Assets/Logo.png differ diff --git a/Tests/VSWinStorePhone/Direct3DApp1/Assets/SmallLogo.png b/Tests/VSWinStorePhone/Direct3DApp1/Assets/SmallLogo.png index 1eb0d9d..460c022 100644 Binary files a/Tests/VSWinStorePhone/Direct3DApp1/Assets/SmallLogo.png and b/Tests/VSWinStorePhone/Direct3DApp1/Assets/SmallLogo.png differ diff --git a/Tests/VSWinStorePhone/Direct3DApp1/Assets/SmallLogo44x44.png b/Tests/VSWinStorePhone/Direct3DApp1/Assets/SmallLogo44x44.png index 28810b7..c237458 100644 Binary files a/Tests/VSWinStorePhone/Direct3DApp1/Assets/SmallLogo44x44.png and b/Tests/VSWinStorePhone/Direct3DApp1/Assets/SmallLogo44x44.png differ diff --git a/Tests/VSWinStorePhone/Direct3DApp1/Assets/SplashScreen.png b/Tests/VSWinStorePhone/Direct3DApp1/Assets/SplashScreen.png index c951e03..8342565 100644 Binary files a/Tests/VSWinStorePhone/Direct3DApp1/Assets/SplashScreen.png and b/Tests/VSWinStorePhone/Direct3DApp1/Assets/SplashScreen.png differ diff --git a/Tests/VSWinStorePhone/Direct3DApp1/Assets/StoreLogo.png b/Tests/VSWinStorePhone/Direct3DApp1/Assets/StoreLogo.png index dcb6727..508c8a8 100644 Binary files a/Tests/VSWinStorePhone/Direct3DApp1/Assets/StoreLogo.png and b/Tests/VSWinStorePhone/Direct3DApp1/Assets/StoreLogo.png differ diff --git a/Tests/VSWinStorePhone/Direct3DApp1/Assets/Tiles/FlipCycleTileLarge.png b/Tests/VSWinStorePhone/Direct3DApp1/Assets/Tiles/FlipCycleTileLarge.png index e0c59ac..fcdbaf4 100644 Binary files a/Tests/VSWinStorePhone/Direct3DApp1/Assets/Tiles/FlipCycleTileLarge.png and b/Tests/VSWinStorePhone/Direct3DApp1/Assets/Tiles/FlipCycleTileLarge.png differ diff --git a/Tests/VSWinStorePhone/Direct3DApp1/Assets/Tiles/FlipCycleTileMedium.png b/Tests/VSWinStorePhone/Direct3DApp1/Assets/Tiles/FlipCycleTileMedium.png index e93b89d..06425c4 100644 Binary files a/Tests/VSWinStorePhone/Direct3DApp1/Assets/Tiles/FlipCycleTileMedium.png and b/Tests/VSWinStorePhone/Direct3DApp1/Assets/Tiles/FlipCycleTileMedium.png differ diff --git a/Tests/VSWinStorePhone/Direct3DApp1/Assets/Tiles/FlipCycleTileSmall.png b/Tests/VSWinStorePhone/Direct3DApp1/Assets/Tiles/FlipCycleTileSmall.png index 550b1b5..4cef0eb 100644 Binary files a/Tests/VSWinStorePhone/Direct3DApp1/Assets/Tiles/FlipCycleTileSmall.png and b/Tests/VSWinStorePhone/Direct3DApp1/Assets/Tiles/FlipCycleTileSmall.png differ diff --git a/Tests/VSWinStorePhone/Direct3DApp1/Assets/Tiles/IconicTileMediumLarge.png b/Tests/VSWinStorePhone/Direct3DApp1/Assets/Tiles/IconicTileMediumLarge.png index 686e6b5..253503f 100644 Binary files a/Tests/VSWinStorePhone/Direct3DApp1/Assets/Tiles/IconicTileMediumLarge.png and b/Tests/VSWinStorePhone/Direct3DApp1/Assets/Tiles/IconicTileMediumLarge.png differ diff --git a/Tests/VSWinStorePhone/Direct3DApp1/Assets/Tiles/IconicTileSmall.png b/Tests/VSWinStorePhone/Direct3DApp1/Assets/Tiles/IconicTileSmall.png index d4b5ede..2ef050f 100644 Binary files a/Tests/VSWinStorePhone/Direct3DApp1/Assets/Tiles/IconicTileSmall.png and b/Tests/VSWinStorePhone/Direct3DApp1/Assets/Tiles/IconicTileSmall.png differ diff --git a/Tests/VSXaml/Assets/Logo.scale-100.png b/Tests/VSXaml/Assets/Logo.scale-100.png index e26771c..65f91ac 100644 Binary files a/Tests/VSXaml/Assets/Logo.scale-100.png and b/Tests/VSXaml/Assets/Logo.scale-100.png differ diff --git a/Tests/VSXaml/Assets/SmallLogo.scale-100.png b/Tests/VSXaml/Assets/SmallLogo.scale-100.png index 1eb0d9d..460c022 100644 Binary files a/Tests/VSXaml/Assets/SmallLogo.scale-100.png and b/Tests/VSXaml/Assets/SmallLogo.scale-100.png differ diff --git a/Tests/VSXaml/Assets/SplashScreen.scale-100.png b/Tests/VSXaml/Assets/SplashScreen.scale-100.png index c951e03..8342565 100644 Binary files a/Tests/VSXaml/Assets/SplashScreen.scale-100.png and b/Tests/VSXaml/Assets/SplashScreen.scale-100.png differ diff --git a/Tests/VSXaml/Assets/StoreLogo.scale-100.png b/Tests/VSXaml/Assets/StoreLogo.scale-100.png index dcb6727..508c8a8 100644 Binary files a/Tests/VSXaml/Assets/StoreLogo.scale-100.png and b/Tests/VSXaml/Assets/StoreLogo.scale-100.png differ diff --git a/Utilities/Sphinx/static/cmake-logo-16.png b/Utilities/Sphinx/static/cmake-logo-16.png index 9c95b75..db9458d 100644 Binary files a/Utilities/Sphinx/static/cmake-logo-16.png and b/Utilities/Sphinx/static/cmake-logo-16.png differ https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=880e38059939f3259b42f4ed3cd9c6142d73437f commit 880e38059939f3259b42f4ed3cd9c6142d73437f Author: Lucy Phipps AuthorDate: Thu Jan 24 15:32:19 2019 +0000 Commit: Brad King CommitDate: Fri Jan 25 09:04:35 2019 -0500 CPack: Replace corrupted background png with original The `Modules/CPack.background.png.in` file was originally added by commit f2c0dbd164 (ENH: More work on the packaging. Add Applicaitons, add icons, etc, 2007-02-13, v2.6.0~2217). Then it was removed accidentally by commit 5308afa3f7 (ENH: remove unused file, 2009-03-03, v2.8.0~963) and restored by commit f9dd6a38c5 (ENH: add file back bug use cmake image, 2009-03-04, v2.8.0~958) but with corruption. Restore the original image file and add a Git attribute to prevent newline conversion as we do for other `.png` files. diff --git a/.gitattributes b/.gitattributes index d6fd5d6..24fd9c2 100644 --- a/.gitattributes +++ b/.gitattributes @@ -21,6 +21,7 @@ configure eol=lf *.pfx -text *.png -text +*.png.in -text *.c our-c-style *.cc our-c-style diff --git a/Modules/CPack.background.png.in b/Modules/CPack.background.png.in index 9339e7c..3fa92b5 100644 Binary files a/Modules/CPack.background.png.in and b/Modules/CPack.background.png.in differ https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=626c51f47be79c5438cc349f51ba1b4973194bfc commit 626c51f47be79c5438cc349f51ba1b4973194bfc Author: Brad King AuthorDate: Thu Jan 24 11:19:18 2019 -0500 Commit: Brad King CommitDate: Thu Jan 24 13:49:25 2019 -0500 VS: Update for Visual Studio 2019 Preview 2 The toolset is now called `v142`. Use matching flag tables. Fixes: #18834 diff --git a/Help/release/dev/vs2019.rst b/Help/release/dev/vs2019.rst index 1ffdeec..2072147 100644 --- a/Help/release/dev/vs2019.rst +++ b/Help/release/dev/vs2019.rst @@ -2,7 +2,7 @@ vs2019 ------ * The :generator:`Visual Studio 16 2019` generator was added. This is - experimental and based on "Visual Studio 2019 Preview 1.1" because this + experimental and based on "Visual Studio 2019 Preview 2" because this version of VS has not been released. The VS 2019 generator differs from generators for earlier versions diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx index 31f585c..a83cc78 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx +++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx @@ -72,8 +72,7 @@ static const char* VSVersionToToolset( case cmGlobalVisualStudioGenerator::VS15: return "v141"; case cmGlobalVisualStudioGenerator::VS16: - // FIXME: VS 2019 Preview 1.1 uses v141 but preview 2 will use v142. - return "v141"; + return "v142"; } return ""; } diff --git a/Source/cmVSSetupHelper.cxx b/Source/cmVSSetupHelper.cxx index 9187c29..91a0e15 100644 --- a/Source/cmVSSetupHelper.cxx +++ b/Source/cmVSSetupHelper.cxx @@ -188,8 +188,16 @@ bool cmVSSetupAPIHelper::GetVSInstanceInfo( // Check if a compiler is installed with this instance. { std::string const vcRoot = vsInstanceInfo.GetInstallLocation(); - std::string const vcToolsVersionFile = + std::string vcToolsVersionFile = vcRoot + "/VC/Auxiliary/Build/Microsoft.VCToolsVersion.default.txt"; + if (!cmSystemTools::PathExists(vcToolsVersionFile)) { + // FIXME: VS 2019 Preview 2 installs the v142 toolset and does not + // provide the plain `Microsoft.VCToolsVersion.default.txt` that v141 + // does. This should be fixed in preview 3 and this workaround can + // be dropped. Otherwise, we may need to switch to globbing. + vcToolsVersionFile = vcRoot + + "/VC/Auxiliary/Build/Microsoft.VCToolsVersion.v142.default.txt"; + } std::string vcToolsVersion; cmsys::ifstream fin(vcToolsVersionFile.c_str()); if (!fin || !cmSystemTools::GetLineFromStream(fin, vcToolsVersion)) { diff --git a/Source/cmVisualStudio10ToolsetOptions.cxx b/Source/cmVisualStudio10ToolsetOptions.cxx index 39063ed..a490e03 100644 --- a/Source/cmVisualStudio10ToolsetOptions.cxx +++ b/Source/cmVisualStudio10ToolsetOptions.cxx @@ -11,7 +11,9 @@ std::string cmVisualStudio10ToolsetOptions::GetClFlagTableName( { std::string const useToolset = this->GetToolsetName(name, toolset); - if (toolset == "v141") { + if (toolset == "v142") { + return "v142"; + } else if (toolset == "v141") { return "v141"; } else if (useToolset == "v140") { return "v140"; @@ -31,7 +33,10 @@ std::string cmVisualStudio10ToolsetOptions::GetCSharpFlagTableName( { std::string const useToolset = this->GetToolsetName(name, toolset); - if ((useToolset == "v141")) { + if (useToolset == "v142") { + // FIXME: Add CSharp flag table for v142. + return "v141"; + } else if (useToolset == "v141") { return "v141"; } else if (useToolset == "v140") { return "v140"; @@ -51,7 +56,8 @@ std::string cmVisualStudio10ToolsetOptions::GetRcFlagTableName( { std::string const useToolset = this->GetToolsetName(name, toolset); - if ((useToolset == "v140") || (useToolset == "v141")) { + if ((useToolset == "v140") || (useToolset == "v141") || + (useToolset == "v142")) { return "v14"; } else if (useToolset == "v120") { return "v12"; @@ -69,7 +75,8 @@ std::string cmVisualStudio10ToolsetOptions::GetLibFlagTableName( { std::string const useToolset = this->GetToolsetName(name, toolset); - if ((useToolset == "v140") || (useToolset == "v141")) { + if ((useToolset == "v140") || (useToolset == "v141") || + (useToolset == "v142")) { return "v14"; } else if (useToolset == "v120") { return "v12"; @@ -87,7 +94,9 @@ std::string cmVisualStudio10ToolsetOptions::GetLinkFlagTableName( { std::string const useToolset = this->GetToolsetName(name, toolset); - if (useToolset == "v141") { + if (useToolset == "v142") { + return "v142"; + } else if (useToolset == "v141") { return "v141"; } else if (useToolset == "v140") { return "v140"; @@ -107,7 +116,8 @@ std::string cmVisualStudio10ToolsetOptions::GetMasmFlagTableName( { std::string const useToolset = this->GetToolsetName(name, toolset); - if ((useToolset == "v140") || (useToolset == "v141")) { + if ((useToolset == "v140") || (useToolset == "v141") || + (useToolset == "v142")) { return "v14"; } else if (useToolset == "v120") { return "v12"; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fd45cbf40ee809d6b900f22247fef06e3d349c78 commit fd45cbf40ee809d6b900f22247fef06e3d349c78 Author: Brad King AuthorDate: Thu Jan 24 13:15:49 2019 -0500 Commit: Brad King CommitDate: Thu Jan 24 13:19:57 2019 -0500 VS: Fix `/MANIFESTUAC:` link flag mapping for v142 Apply the change from commit 454b47ba0b (VS: Fix MANIFESTUAC link flag map to .vcxproj elements, 2018-11-21) to the v142 flag table. Add special parsing of the flags given in `/MANIFESTUAC:"..."` in order to map them correctly to `.vcxproj` elements. Keep the old incorrect flag table entries for `uiAccess` and `level` flags for compatibility even though they do not really exist. diff --git a/Templates/MSBuild/FlagTables/v142_Link.json b/Templates/MSBuild/FlagTables/v142_Link.json index d5144c8..66ee76f 100644 --- a/Templates/MSBuild/FlagTables/v142_Link.json +++ b/Templates/MSBuild/FlagTables/v142_Link.json @@ -646,20 +646,13 @@ }, { "name": "EnableUAC", - "switch": "MANIFESTUAC:NO", - "comment": "Enable User Account Control (UAC)", - "value": "false", - "flags": [] - }, - { - "name": "EnableUAC", "switch": "MANIFESTUAC:", - "comment": "Enable User Account Control (UAC)", - "value": "true", + "comment": "", + "value": "", "flags": [ "UserValue", - "UserIgnored", - "Continue" + "UserRequired", + "SpaceAppendable" ] }, { @@ -674,16 +667,6 @@ }, { "name": "UACUIAccess", - "switch": "MANIFESTUAC:", - "comment": "UAC Bypass UI Protection", - "value": "true", - "flags": [ - "UserValue", - "UserRequired" - ] - }, - { - "name": "UACUIAccess", "switch": "uiAccess='false'", "comment": "UAC Bypass UI Protection", "value": "false", https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=db35e3cfd606a156cbb518af19603da7f22c26d8 commit db35e3cfd606a156cbb518af19603da7f22c26d8 Author: Brad King AuthorDate: Thu Jan 24 13:11:14 2019 -0500 Commit: Brad King CommitDate: Thu Jan 24 13:19:55 2019 -0500 VS: Fix support for '/guard:cf' linker flag for v142 Apply the change from commit 57a78b5526 (VS: Fix support for '/guard:cf' linker flag, 2018-11-21) to the v142 flag table. Although `$(VCTargetsPath)/1033/link.xml` contains an entry for `LinkControlFlowGuard`, it does not work when used in a `.vcxproj` file (at least as of v140 and v141). Drop our link flag table entries for these toolsets so that the flag will be passed via `AdditionalOptions`. diff --git a/Templates/MSBuild/FlagTables/v142_Link.json b/Templates/MSBuild/FlagTables/v142_Link.json index c4fd8e3..d5144c8 100644 --- a/Templates/MSBuild/FlagTables/v142_Link.json +++ b/Templates/MSBuild/FlagTables/v142_Link.json @@ -547,13 +547,6 @@ "flags": [] }, { - "name": "LinkControlFlowGuard", - "switch": "guard:cf", - "comment": "Enable Security Check with Guard", - "value": "Guard", - "flags": [] - }, - { "name": "LinkIncremental", "switch": "INCREMENTAL:NO", "comment": "Enable Incremental Linking", https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=533f95c8479c6c04ec23263244671bd81a98ea39 commit 533f95c8479c6c04ec23263244671bd81a98ea39 Author: Brad King AuthorDate: Thu Jan 24 13:03:53 2019 -0500 Commit: Brad King CommitDate: Thu Jan 24 13:19:54 2019 -0500 VS: Map the link `/debug` flag for v142 Apply the changes from commit a5d9aa5063 (VS: Map the link `/debug` to its IDE property, 2018-11-21) and commit f77320c12a (VS: Add v140 and v141 flag table entries for /DEBUG:NONE and /DEBUG:FULL, 2018-11-21) to the v142 flag table. See commit ae44496e2b (VS: Fix GenerateDebugInformation values for v140 and v141 toolsets, 2017-06-27, v3.9.0-rc6~15^2~1) for explanation. diff --git a/Templates/MSBuild/FlagTables/v142_Link.json b/Templates/MSBuild/FlagTables/v142_Link.json index 481468e..c4fd8e3 100644 --- a/Templates/MSBuild/FlagTables/v142_Link.json +++ b/Templates/MSBuild/FlagTables/v142_Link.json @@ -120,31 +120,39 @@ }, { "name": "GenerateDebugInformation", - "switch": "", - "comment": "No", - "value": "false", - "flags": [] - }, - { - "name": "GenerateDebugInformation", "switch": "DEBUG", "comment": "Generate Debug Information", "value": "true", - "flags": [] + "flags": [ + "CaseInsensitive" + ] }, { "name": "GenerateDebugInformation", "switch": "DEBUG:FASTLINK", "comment": "Generate Debug Information optimized for faster links", "value": "DebugFastLink", - "flags": [] + "flags": [ + "CaseInsensitive" + ] }, { "name": "GenerateDebugInformation", "switch": "DEBUG:FULL", "comment": "Generate Debug Information optimized for sharing and publishing", "value": "DebugFull", - "flags": [] + "flags": [ + "CaseInsensitive" + ] + }, + { + "name": "GenerateDebugInformation", + "switch": "DEBUG:NONE", + "comment": "Produces no debugging information", + "value": "false", + "flags": [ + "CaseInsensitive" + ] }, { "name": "SubSystem", https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d2fcc6748aa2a7888fc1d0d8366f19141c2cf2c0 commit d2fcc6748aa2a7888fc1d0d8366f19141c2cf2c0 Author: Brad King AuthorDate: Thu Jan 24 13:01:30 2019 -0500 Commit: Brad King CommitDate: Thu Jan 24 13:19:53 2019 -0500 VS: Fix `/MANIFESTUAC:NO` link flag mapping for v142 Apply the change from commit 1d00fd7702 (VS: Fix /MANIFESTUAC:NO linker option mapping, 2018-11-21) to the v142 flag table. There are no versions of `/MANIFESTUAC:NO` where addition values are appended. Remove both of the `MANIFESTUAC:NO` entries from our flag tables and replace them with one which would set `EnableUAC` to false and immediately stop processing the `/MANIFESTUAC:NO` option. diff --git a/Templates/MSBuild/FlagTables/v142_Link.json b/Templates/MSBuild/FlagTables/v142_Link.json index acdb5ac..481468e 100644 --- a/Templates/MSBuild/FlagTables/v142_Link.json +++ b/Templates/MSBuild/FlagTables/v142_Link.json @@ -648,11 +648,7 @@ "switch": "MANIFESTUAC:NO", "comment": "Enable User Account Control (UAC)", "value": "false", - "flags": [ - "UserValue", - "UserIgnored", - "Continue" - ] + "flags": [] }, { "name": "EnableUAC", https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a7973ccb5310b24acdc9176555b458bad6000a43 commit a7973ccb5310b24acdc9176555b458bad6000a43 Author: Brad King AuthorDate: Thu Jan 24 12:56:52 2019 -0500 Commit: Brad King CommitDate: Thu Jan 24 13:19:52 2019 -0500 VS: Populate `/permissive` flag table entry for v142 Apply the change from commit e0d6d01e52 (VS: Add flag table entry for "permissive" flag to disable conformance mode, 2018-12-10) to the v142 flag table. diff --git a/Templates/MSBuild/FlagTables/v142_CL.json b/Templates/MSBuild/FlagTables/v142_CL.json index 479df03..95b9d14 100644 --- a/Templates/MSBuild/FlagTables/v142_CL.json +++ b/Templates/MSBuild/FlagTables/v142_CL.json @@ -833,11 +833,18 @@ { "name": "ConformanceMode", "switch": "permissive-", - "comment": "Conformance mode", + "comment": "Conformance mode enabled", "value": "true", "flags": [] }, { + "name": "ConformanceMode", + "switch": "permissive", + "comment": "Conformance mode disabled", + "value": "false", + "flags": [] + }, + { "name": "TreatWChar_tAsBuiltInType", "switch": "Zc:wchar_t-", "comment": "Treat WChar_t As Built in Type", https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=049410c0b61aa1894cab8b3885c78d59fdcbcd9e commit 049410c0b61aa1894cab8b3885c78d59fdcbcd9e Author: Brad King AuthorDate: Thu Jan 24 12:52:49 2019 -0500 Commit: Brad King CommitDate: Thu Jan 24 13:19:50 2019 -0500 VS: Populate `/JMC-` flag table entry for v142 Add the negative form of the option. diff --git a/Templates/MSBuild/FlagTables/v142_CL.json b/Templates/MSBuild/FlagTables/v142_CL.json index d3d7f72..479df03 100644 --- a/Templates/MSBuild/FlagTables/v142_CL.json +++ b/Templates/MSBuild/FlagTables/v142_CL.json @@ -597,6 +597,13 @@ }, { "name": "SupportJustMyCode", + "switch": "JMC-", + "comment": "Support Just My Code Debugging", + "value": "false", + "flags": [] + }, + { + "name": "SupportJustMyCode", "switch": "JMC", "comment": "Support Just My Code Debugging", "value": "true", https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=43aa632f57bb31514719b7f0d629a9285147f7f8 commit 43aa632f57bb31514719b7f0d629a9285147f7f8 Author: Brad King AuthorDate: Thu Jan 24 12:43:40 2019 -0500 Commit: Brad King CommitDate: Thu Jan 24 13:19:49 2019 -0500 VS: Populate `-Qspectre-` flag table entry for v142 Rather than the change from commit 584ad067ba (VS: Fix flag table entry for -Qspectre, 2018-11-26), update the v142 flag table with an actual flag for the negative form of the flag. Switch the entry order so that the longer negative form is first. diff --git a/Templates/MSBuild/FlagTables/v142_CL.json b/Templates/MSBuild/FlagTables/v142_CL.json index 70d20c5..d3d7f72 100644 --- a/Templates/MSBuild/FlagTables/v142_CL.json +++ b/Templates/MSBuild/FlagTables/v142_CL.json @@ -421,16 +421,16 @@ }, { "name": "SpectreMitigation", - "switch": "Qspectre", - "comment": "Enabled", - "value": "Spectre", + "switch": "Qspectre-", + "comment": "Spectre mitigations disabled", + "value": "false", "flags": [] }, { "name": "SpectreMitigation", - "switch": "", - "comment": "Disabled", - "value": "false", + "switch": "Qspectre", + "comment": "Spectre mitigations enabled", + "value": "Spectre", "flags": [] }, { https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=460a146e2b8da5355e4638706002715aed85acbc commit 460a146e2b8da5355e4638706002715aed85acbc Author: Brad King AuthorDate: Thu Jan 24 12:39:50 2019 -0500 Commit: Brad King CommitDate: Thu Jan 24 13:19:48 2019 -0500 VS: Populate `/Y-` flag table entry for v142 Apply the change from commit 8df25f9400 (VS: connect /Y- compiler option with "Not Using Precompiled Headers", 2018-11-26) to the v142 flag table. diff --git a/Templates/MSBuild/FlagTables/v142_CL.json b/Templates/MSBuild/FlagTables/v142_CL.json index eff5dec..70d20c5 100644 --- a/Templates/MSBuild/FlagTables/v142_CL.json +++ b/Templates/MSBuild/FlagTables/v142_CL.json @@ -478,7 +478,7 @@ }, { "name": "PrecompiledHeader", - "switch": "", + "switch": "Y-", "comment": "Not Using Precompiled Headers", "value": "NotUsing", "flags": [] https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0df37903715d900fa5cfa3c51176649ed69d7d50 commit 0df37903715d900fa5cfa3c51176649ed69d7d50 Author: Brad King AuthorDate: Thu Jan 24 11:53:26 2019 -0500 Commit: Brad King CommitDate: Thu Jan 24 13:19:47 2019 -0500 VS: Add `-Zc:inline[-]` flag table entry for v142 Apply the change from commit f1223e34c6 (VS: Add v140 flag table entries for `-Zc:inline[-]`, 2018-11-26) to the v142 flag table. The documentation of this option [1] claims that the default is off, but VS seems to use `-Zc:inline` by default if `RemoveUnreferencedCodeData` does not appear in the `.vcxproj` file. Add the flag table entry to allow use of the flag to be configured. [1] https://msdn.microsoft.com/en-us/library/dn642448.aspx diff --git a/Templates/MSBuild/FlagTables/v142_CL.json b/Templates/MSBuild/FlagTables/v142_CL.json index 437b711..eff5dec 100644 --- a/Templates/MSBuild/FlagTables/v142_CL.json +++ b/Templates/MSBuild/FlagTables/v142_CL.json @@ -860,6 +860,13 @@ }, { "name": "RemoveUnreferencedCodeData", + "switch": "Zc:inline-", + "comment": "Remove unreferenced code and data", + "value": "false", + "flags": [] + }, + { + "name": "RemoveUnreferencedCodeData", "switch": "Zc:inline", "comment": "Remove unreferenced code and data", "value": "true", https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fb2e418c64d915b4d75f55f815e67923216def62 commit fb2e418c64d915b4d75f55f815e67923216def62 Author: Brad King AuthorDate: Thu Jan 24 11:48:10 2019 -0500 Commit: Brad King CommitDate: Thu Jan 24 13:19:46 2019 -0500 VS: Fix `/analyze:log` flag mapping for v142 Apply the change from commit 44dc9fc48a (VS: Fix /analyze:log flag mapping, 2018-11-26) to the v142 flag table. The `/analyze:log` argument requires a value in the following argument. Also drop the general `/analyze:` flag table entry so that such flags will be passed through as plain additional options. This is necessary because some such options have following values and some do not but not all have `.vcxproj` elements to hold the values. diff --git a/Templates/MSBuild/FlagTables/v142_CL.json b/Templates/MSBuild/FlagTables/v142_CL.json index db85dd8..437b711 100644 --- a/Templates/MSBuild/FlagTables/v142_CL.json +++ b/Templates/MSBuild/FlagTables/v142_CL.json @@ -1056,13 +1056,12 @@ ] }, { - "name": "PREfastAdditionalOptions", - "switch": "analyze:", - "comment": "Additional Code Analysis Native options", + "name": "PREfastLog", + "switch": "analyze:log", + "comment": "Code Analysis Log", "value": "", "flags": [ - "UserValue", - "SemicolonAppendable" + "UserFollowing" ] }, { @@ -1180,15 +1179,6 @@ ] }, { - "name": "PREfastLog", - "switch": "analyze:log", - "comment": "Code Analysis Log", - "value": "", - "flags": [ - "UserValue" - ] - }, - { "name": "ProcessorNumber", "switch": "MP", "comment": "Number of processors", https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=20922d673375e6b819eba32e84471922b008b8a9 commit 20922d673375e6b819eba32e84471922b008b8a9 Author: Brad King AuthorDate: Thu Jan 24 11:39:37 2019 -0500 Commit: Brad King CommitDate: Thu Jan 24 13:19:44 2019 -0500 VS: Add v142 flag tables for cl and link tools Convert from MSBuild `.xml` files: python cmConvertMSBuildXMLToJSON.py -t v142 .../2019/Preview/MSBuild/Microsoft/VC/v160/1033/cl.xml python cmConvertMSBuildXMLToJSON.py -t v142 .../2019/Preview/MSBuild/Microsoft/VC/v160/1033/link.xml diff --git a/Templates/MSBuild/FlagTables/v142_CL.json b/Templates/MSBuild/FlagTables/v142_CL.json new file mode 100644 index 0000000..db85dd8 --- /dev/null +++ b/Templates/MSBuild/FlagTables/v142_CL.json @@ -0,0 +1,1201 @@ +[ + { + "name": "DebugInformationFormat", + "switch": "", + "comment": "None", + "value": "None", + "flags": [] + }, + { + "name": "DebugInformationFormat", + "switch": "Z7", + "comment": "C7 compatible", + "value": "OldStyle", + "flags": [] + }, + { + "name": "DebugInformationFormat", + "switch": "Zi", + "comment": "Program Database", + "value": "ProgramDatabase", + "flags": [] + }, + { + "name": "DebugInformationFormat", + "switch": "ZI", + "comment": "Program Database for Edit And Continue", + "value": "EditAndContinue", + "flags": [] + }, + { + "name": "CompileAsManaged", + "switch": "", + "comment": "No Common Language RunTime Support", + "value": "false", + "flags": [] + }, + { + "name": "CompileAsManaged", + "switch": "clr", + "comment": "Common Language RunTime Support", + "value": "true", + "flags": [] + }, + { + "name": "CompileAsManaged", + "switch": "clr:pure", + "comment": "Pure MSIL Common Language RunTime Support", + "value": "Pure", + "flags": [] + }, + { + "name": "CompileAsManaged", + "switch": "clr:safe", + "comment": "Safe MSIL Common Language RunTime Support", + "value": "Safe", + "flags": [] + }, + { + "name": "WarningLevel", + "switch": "W0", + "comment": "Turn Off All Warnings", + "value": "TurnOffAllWarnings", + "flags": [] + }, + { + "name": "WarningLevel", + "switch": "W1", + "comment": "Level1", + "value": "Level1", + "flags": [] + }, + { + "name": "WarningLevel", + "switch": "W2", + "comment": "Level2", + "value": "Level2", + "flags": [] + }, + { + "name": "WarningLevel", + "switch": "W3", + "comment": "Level3", + "value": "Level3", + "flags": [] + }, + { + "name": "WarningLevel", + "switch": "W4", + "comment": "Level4", + "value": "Level4", + "flags": [] + }, + { + "name": "WarningLevel", + "switch": "Wall", + "comment": "EnableAllWarnings", + "value": "EnableAllWarnings", + "flags": [] + }, + { + "name": "DiagnosticsFormat", + "switch": "diagnostics:caret", + "comment": "Caret", + "value": "Caret", + "flags": [] + }, + { + "name": "DiagnosticsFormat", + "switch": "diagnostics:column", + "comment": "Column Info", + "value": "Column", + "flags": [] + }, + { + "name": "DiagnosticsFormat", + "switch": "diagnostics:classic", + "comment": "Classic", + "value": "Classic", + "flags": [] + }, + { + "name": "Optimization", + "switch": "", + "comment": "Custom", + "value": "Custom", + "flags": [] + }, + { + "name": "Optimization", + "switch": "Od", + "comment": "Disabled", + "value": "Disabled", + "flags": [] + }, + { + "name": "Optimization", + "switch": "O1", + "comment": "Maximum Optimization (Favor Size)", + "value": "MinSpace", + "flags": [] + }, + { + "name": "Optimization", + "switch": "O2", + "comment": "Maximum Optimization (Favor Speed)", + "value": "MaxSpeed", + "flags": [] + }, + { + "name": "Optimization", + "switch": "Ox", + "comment": "Optimizations (Favor Speed)", + "value": "Full", + "flags": [] + }, + { + "name": "InlineFunctionExpansion", + "switch": "", + "comment": "Default", + "value": "Default", + "flags": [] + }, + { + "name": "InlineFunctionExpansion", + "switch": "Ob0", + "comment": "Disabled", + "value": "Disabled", + "flags": [] + }, + { + "name": "InlineFunctionExpansion", + "switch": "Ob1", + "comment": "Only __inline", + "value": "OnlyExplicitInline", + "flags": [] + }, + { + "name": "InlineFunctionExpansion", + "switch": "Ob2", + "comment": "Any Suitable", + "value": "AnySuitable", + "flags": [] + }, + { + "name": "FavorSizeOrSpeed", + "switch": "Os", + "comment": "Favor small code", + "value": "Size", + "flags": [] + }, + { + "name": "FavorSizeOrSpeed", + "switch": "Ot", + "comment": "Favor fast code", + "value": "Speed", + "flags": [] + }, + { + "name": "FavorSizeOrSpeed", + "switch": "", + "comment": "Neither", + "value": "Neither", + "flags": [] + }, + { + "name": "ExceptionHandling", + "switch": "EHa", + "comment": "Yes with SEH Exceptions", + "value": "Async", + "flags": [] + }, + { + "name": "ExceptionHandling", + "switch": "EHsc", + "comment": "Yes", + "value": "Sync", + "flags": [] + }, + { + "name": "ExceptionHandling", + "switch": "EHs", + "comment": "Yes with Extern C functions", + "value": "SyncCThrow", + "flags": [] + }, + { + "name": "ExceptionHandling", + "switch": "", + "comment": "No", + "value": "false", + "flags": [] + }, + { + "name": "BasicRuntimeChecks", + "switch": "RTCs", + "comment": "Stack Frames", + "value": "StackFrameRuntimeCheck", + "flags": [] + }, + { + "name": "BasicRuntimeChecks", + "switch": "RTCu", + "comment": "Uninitialized variables", + "value": "UninitializedLocalUsageCheck", + "flags": [] + }, + { + "name": "BasicRuntimeChecks", + "switch": "RTC1", + "comment": "Both (/RTC1, equiv. to /RTCsu)", + "value": "EnableFastChecks", + "flags": [] + }, + { + "name": "BasicRuntimeChecks", + "switch": "", + "comment": "Default", + "value": "Default", + "flags": [] + }, + { + "name": "RuntimeLibrary", + "switch": "MT", + "comment": "Multi-threaded", + "value": "MultiThreaded", + "flags": [] + }, + { + "name": "RuntimeLibrary", + "switch": "MTd", + "comment": "Multi-threaded Debug", + "value": "MultiThreadedDebug", + "flags": [] + }, + { + "name": "RuntimeLibrary", + "switch": "MD", + "comment": "Multi-threaded DLL", + "value": "MultiThreadedDLL", + "flags": [] + }, + { + "name": "RuntimeLibrary", + "switch": "MDd", + "comment": "Multi-threaded Debug DLL", + "value": "MultiThreadedDebugDLL", + "flags": [] + }, + { + "name": "StructMemberAlignment", + "switch": "Zp1", + "comment": "1 Byte", + "value": "1Byte", + "flags": [] + }, + { + "name": "StructMemberAlignment", + "switch": "Zp2", + "comment": "2 Bytes", + "value": "2Bytes", + "flags": [] + }, + { + "name": "StructMemberAlignment", + "switch": "Zp4", + "comment": "4 Byte", + "value": "4Bytes", + "flags": [] + }, + { + "name": "StructMemberAlignment", + "switch": "Zp8", + "comment": "8 Bytes", + "value": "8Bytes", + "flags": [] + }, + { + "name": "StructMemberAlignment", + "switch": "Zp16", + "comment": "16 Bytes", + "value": "16Bytes", + "flags": [] + }, + { + "name": "StructMemberAlignment", + "switch": "", + "comment": "Default", + "value": "Default", + "flags": [] + }, + { + "name": "BufferSecurityCheck", + "switch": "GS-", + "comment": "Disable Security Check", + "value": "false", + "flags": [] + }, + { + "name": "BufferSecurityCheck", + "switch": "GS", + "comment": "Enable Security Check", + "value": "true", + "flags": [] + }, + { + "name": "ControlFlowGuard", + "switch": "guard:cf", + "comment": "Yes", + "value": "Guard", + "flags": [] + }, + { + "name": "ControlFlowGuard", + "switch": "", + "comment": "No", + "value": "false", + "flags": [] + }, + { + "name": "EnableEnhancedInstructionSet", + "switch": "arch:SSE", + "comment": "Streaming SIMD Extensions", + "value": "StreamingSIMDExtensions", + "flags": [] + }, + { + "name": "EnableEnhancedInstructionSet", + "switch": "arch:SSE2", + "comment": "Streaming SIMD Extensions 2", + "value": "StreamingSIMDExtensions2", + "flags": [] + }, + { + "name": "EnableEnhancedInstructionSet", + "switch": "arch:AVX", + "comment": "Advanced Vector Extensions", + "value": "AdvancedVectorExtensions", + "flags": [] + }, + { + "name": "EnableEnhancedInstructionSet", + "switch": "arch:AVX2", + "comment": "Advanced Vector Extensions 2", + "value": "AdvancedVectorExtensions2", + "flags": [] + }, + { + "name": "EnableEnhancedInstructionSet", + "switch": "arch:IA32", + "comment": "No Enhanced Instructions", + "value": "NoExtensions", + "flags": [] + }, + { + "name": "EnableEnhancedInstructionSet", + "switch": "", + "comment": "Not Set", + "value": "NotSet", + "flags": [] + }, + { + "name": "FloatingPointModel", + "switch": "fp:precise", + "comment": "Precise", + "value": "Precise", + "flags": [] + }, + { + "name": "FloatingPointModel", + "switch": "fp:strict", + "comment": "Strict", + "value": "Strict", + "flags": [] + }, + { + "name": "FloatingPointModel", + "switch": "fp:fast", + "comment": "Fast", + "value": "Fast", + "flags": [] + }, + { + "name": "SpectreMitigation", + "switch": "Qspectre", + "comment": "Enabled", + "value": "Spectre", + "flags": [] + }, + { + "name": "SpectreMitigation", + "switch": "", + "comment": "Disabled", + "value": "false", + "flags": [] + }, + { + "name": "LanguageStandard", + "switch": "std:c++14", + "comment": "ISO C++14 Standard", + "value": "stdcpp14", + "flags": [] + }, + { + "name": "LanguageStandard", + "switch": "std:c++17", + "comment": "ISO C++17 Standard", + "value": "stdcpp17", + "flags": [] + }, + { + "name": "LanguageStandard", + "switch": "std:c++latest", + "comment": "Preview - Features from the Latest C++ Working Draft", + "value": "stdcpplatest", + "flags": [] + }, + { + "name": "PrecompiledHeader", + "switch": "Yc", + "comment": "Create", + "value": "Create", + "flags": [ + "UserValue", + "UserIgnored", + "Continue" + ] + }, + { + "name": "PrecompiledHeader", + "switch": "Yu", + "comment": "Use", + "value": "Use", + "flags": [ + "UserValue", + "UserIgnored", + "Continue" + ] + }, + { + "name": "PrecompiledHeader", + "switch": "", + "comment": "Not Using Precompiled Headers", + "value": "NotUsing", + "flags": [] + }, + { + "name": "AssemblerOutput", + "switch": "", + "comment": "No Listing", + "value": "NoListing", + "flags": [] + }, + { + "name": "AssemblerOutput", + "switch": "FA", + "comment": "Assembly-Only Listing", + "value": "AssemblyCode", + "flags": [] + }, + { + "name": "AssemblerOutput", + "switch": "FAc", + "comment": "Assembly With Machine Code", + "value": "AssemblyAndMachineCode", + "flags": [] + }, + { + "name": "AssemblerOutput", + "switch": "FAs", + "comment": "Assembly With Source Code", + "value": "AssemblyAndSourceCode", + "flags": [] + }, + { + "name": "AssemblerOutput", + "switch": "FAcs", + "comment": "Assembly, Machine Code and Source", + "value": "All", + "flags": [] + }, + { + "name": "CallingConvention", + "switch": "Gd", + "comment": "__cdecl", + "value": "Cdecl", + "flags": [] + }, + { + "name": "CallingConvention", + "switch": "Gr", + "comment": "__fastcall", + "value": "FastCall", + "flags": [] + }, + { + "name": "CallingConvention", + "switch": "Gz", + "comment": "__stdcall", + "value": "StdCall", + "flags": [] + }, + { + "name": "CallingConvention", + "switch": "Gv", + "comment": "__vectorcall", + "value": "VectorCall", + "flags": [] + }, + { + "name": "CompileAs", + "switch": "", + "comment": "Default", + "value": "Default", + "flags": [] + }, + { + "name": "CompileAs", + "switch": "TC", + "comment": "Compile as C Code", + "value": "CompileAsC", + "flags": [] + }, + { + "name": "CompileAs", + "switch": "TP", + "comment": "Compile as C++ Code", + "value": "CompileAsCpp", + "flags": [] + }, + { + "name": "ErrorReporting", + "switch": "errorReport:none", + "comment": "Do Not Send Report", + "value": "None", + "flags": [] + }, + { + "name": "ErrorReporting", + "switch": "errorReport:prompt", + "comment": "Prompt Immediately", + "value": "Prompt", + "flags": [] + }, + { + "name": "ErrorReporting", + "switch": "errorReport:queue", + "comment": "Queue For Next Login", + "value": "Queue", + "flags": [] + }, + { + "name": "ErrorReporting", + "switch": "errorReport:send", + "comment": "Send Automatically", + "value": "Send", + "flags": [] + }, + { + "name": "SupportJustMyCode", + "switch": "JMC", + "comment": "Support Just My Code Debugging", + "value": "true", + "flags": [] + }, + { + "name": "CompileAsWinRT", + "switch": "ZW", + "comment": "Consume Windows Runtime Extension", + "value": "true", + "flags": [] + }, + { + "name": "WinRTNoStdLib", + "switch": "ZW:nostdlib", + "comment": "No Standard WinRT Libraries", + "value": "true", + "flags": [] + }, + { + "name": "SuppressStartupBanner", + "switch": "nologo", + "comment": "Suppress Startup Banner", + "value": "true", + "flags": [] + }, + { + "name": "TreatWarningAsError", + "switch": "WX-", + "comment": "Treat Warnings As Errors", + "value": "false", + "flags": [] + }, + { + "name": "TreatWarningAsError", + "switch": "WX", + "comment": "Treat Warnings As Errors", + "value": "true", + "flags": [] + }, + { + "name": "SDLCheck", + "switch": "sdl-", + "comment": "SDL checks", + "value": "false", + "flags": [] + }, + { + "name": "SDLCheck", + "switch": "sdl", + "comment": "SDL checks", + "value": "true", + "flags": [] + }, + { + "name": "MultiProcessorCompilation", + "switch": "MP", + "comment": "Multi-processor Compilation", + "value": "true", + "flags": [ + "UserValue", + "UserIgnored", + "Continue" + ] + }, + { + "name": "IntrinsicFunctions", + "switch": "Oi", + "comment": "Enable Intrinsic Functions", + "value": "true", + "flags": [] + }, + { + "name": "OmitFramePointers", + "switch": "Oy-", + "comment": "Omit Frame Pointers", + "value": "false", + "flags": [] + }, + { + "name": "OmitFramePointers", + "switch": "Oy", + "comment": "Omit Frame Pointers", + "value": "true", + "flags": [] + }, + { + "name": "EnableFiberSafeOptimizations", + "switch": "GT", + "comment": "Enable Fiber-Safe Optimizations", + "value": "true", + "flags": [] + }, + { + "name": "WholeProgramOptimization", + "switch": "GL", + "comment": "Whole Program Optimization", + "value": "true", + "flags": [] + }, + { + "name": "UndefineAllPreprocessorDefinitions", + "switch": "u", + "comment": "Undefine All Preprocessor Definitions", + "value": "true", + "flags": [] + }, + { + "name": "IgnoreStandardIncludePath", + "switch": "X", + "comment": "Ignore Standard Include Paths", + "value": "true", + "flags": [] + }, + { + "name": "PreprocessToFile", + "switch": "P", + "comment": "Preprocess to a File", + "value": "true", + "flags": [] + }, + { + "name": "PreprocessSuppressLineNumbers", + "switch": "EP", + "comment": "Preprocess Suppress Line Numbers", + "value": "true", + "flags": [] + }, + { + "name": "PreprocessKeepComments", + "switch": "C", + "comment": "Keep Comments", + "value": "true", + "flags": [] + }, + { + "name": "StringPooling", + "switch": "GF-", + "comment": "Enable String Pooling", + "value": "false", + "flags": [] + }, + { + "name": "StringPooling", + "switch": "GF", + "comment": "Enable String Pooling", + "value": "true", + "flags": [] + }, + { + "name": "MinimalRebuild", + "switch": "Gm-", + "comment": "Enable Minimal Rebuild", + "value": "false", + "flags": [] + }, + { + "name": "MinimalRebuild", + "switch": "Gm", + "comment": "Enable Minimal Rebuild", + "value": "true", + "flags": [] + }, + { + "name": "SmallerTypeCheck", + "switch": "RTCc", + "comment": "Smaller Type Check", + "value": "true", + "flags": [] + }, + { + "name": "FunctionLevelLinking", + "switch": "Gy-", + "comment": "Enable Function-Level Linking", + "value": "false", + "flags": [] + }, + { + "name": "FunctionLevelLinking", + "switch": "Gy", + "comment": "Enable Function-Level Linking", + "value": "true", + "flags": [] + }, + { + "name": "EnableParallelCodeGeneration", + "switch": "Qpar-", + "comment": "Enable Parallel Code Generation", + "value": "false", + "flags": [] + }, + { + "name": "EnableParallelCodeGeneration", + "switch": "Qpar", + "comment": "Enable Parallel Code Generation", + "value": "true", + "flags": [] + }, + { + "name": "FloatingPointExceptions", + "switch": "fp:except-", + "comment": "Enable Floating Point Exceptions", + "value": "false", + "flags": [] + }, + { + "name": "FloatingPointExceptions", + "switch": "fp:except", + "comment": "Enable Floating Point Exceptions", + "value": "true", + "flags": [] + }, + { + "name": "CreateHotpatchableImage", + "switch": "hotpatch", + "comment": "Create Hotpatchable Image", + "value": "true", + "flags": [] + }, + { + "name": "DisableLanguageExtensions", + "switch": "Za", + "comment": "Disable Language Extensions", + "value": "true", + "flags": [] + }, + { + "name": "ConformanceMode", + "switch": "permissive-", + "comment": "Conformance mode", + "value": "true", + "flags": [] + }, + { + "name": "TreatWChar_tAsBuiltInType", + "switch": "Zc:wchar_t-", + "comment": "Treat WChar_t As Built in Type", + "value": "false", + "flags": [] + }, + { + "name": "TreatWChar_tAsBuiltInType", + "switch": "Zc:wchar_t", + "comment": "Treat WChar_t As Built in Type", + "value": "true", + "flags": [] + }, + { + "name": "ForceConformanceInForLoopScope", + "switch": "Zc:forScope-", + "comment": "Force Conformance in For Loop Scope", + "value": "false", + "flags": [] + }, + { + "name": "ForceConformanceInForLoopScope", + "switch": "Zc:forScope", + "comment": "Force Conformance in For Loop Scope", + "value": "true", + "flags": [] + }, + { + "name": "RemoveUnreferencedCodeData", + "switch": "Zc:inline", + "comment": "Remove unreferenced code and data", + "value": "true", + "flags": [] + }, + { + "name": "EnforceTypeConversionRules", + "switch": "Zc:rvalueCast-", + "comment": "Enforce type conversion rules", + "value": "false", + "flags": [] + }, + { + "name": "EnforceTypeConversionRules", + "switch": "Zc:rvalueCast", + "comment": "Enforce type conversion rules", + "value": "true", + "flags": [] + }, + { + "name": "RuntimeTypeInfo", + "switch": "GR-", + "comment": "Enable Run-Time Type Information", + "value": "false", + "flags": [] + }, + { + "name": "RuntimeTypeInfo", + "switch": "GR", + "comment": "Enable Run-Time Type Information", + "value": "true", + "flags": [] + }, + { + "name": "OpenMPSupport", + "switch": "openmp-", + "comment": "Open MP Support", + "value": "false", + "flags": [] + }, + { + "name": "OpenMPSupport", + "switch": "openmp", + "comment": "Open MP Support", + "value": "true", + "flags": [] + }, + { + "name": "EnableModules", + "switch": "experimental:module", + "comment": "Enable C++ Modules (experimental)", + "value": "true", + "flags": [] + }, + { + "name": "ExpandAttributedSource", + "switch": "Fx", + "comment": "Expand Attributed Source", + "value": "true", + "flags": [] + }, + { + "name": "UseUnicodeForAssemblerListing", + "switch": "FAu", + "comment": "Use Unicode For Assembler Listing", + "value": "true", + "flags": [] + }, + { + "name": "GenerateXMLDocumentationFiles", + "switch": "doc", + "comment": "Generate XML Documentation Files", + "value": "true", + "flags": [ + "UserValue", + "UserIgnored", + "Continue" + ] + }, + { + "name": "BrowseInformation", + "switch": "FR", + "comment": "Enable Browse Information", + "value": "true", + "flags": [ + "UserValue", + "UserIgnored", + "Continue" + ] + }, + { + "name": "ShowIncludes", + "switch": "showIncludes", + "comment": "Show Includes", + "value": "true", + "flags": [] + }, + { + "name": "EnablePREfast", + "switch": "analyze-", + "comment": "Enable Code Analysis", + "value": "false", + "flags": [] + }, + { + "name": "EnablePREfast", + "switch": "analyze", + "comment": "Enable Code Analysis", + "value": "true", + "flags": [] + }, + { + "name": "UseFullPaths", + "switch": "FC", + "comment": "Use Full Paths", + "value": "true", + "flags": [] + }, + { + "name": "OmitDefaultLibName", + "switch": "Zl", + "comment": "Omit Default Library Name", + "value": "true", + "flags": [] + }, + { + "name": "AdditionalIncludeDirectories", + "switch": "I", + "comment": "Additional Include Directories", + "value": "", + "flags": [ + "UserValue", + "SemicolonAppendable" + ] + }, + { + "name": "AdditionalUsingDirectories", + "switch": "AI", + "comment": "Additional #using Directories", + "value": "", + "flags": [ + "UserValue", + "SemicolonAppendable" + ] + }, + { + "name": "PreprocessorDefinitions", + "switch": "D", + "comment": "Preprocessor Definitions", + "value": "", + "flags": [ + "UserValue", + "SemicolonAppendable" + ] + }, + { + "name": "UndefinePreprocessorDefinitions", + "switch": "U", + "comment": "Undefine Preprocessor Definitions", + "value": "", + "flags": [ + "UserValue", + "SemicolonAppendable" + ] + }, + { + "name": "DisableSpecificWarnings", + "switch": "wd", + "comment": "Disable Specific Warnings", + "value": "", + "flags": [ + "UserValue", + "SemicolonAppendable" + ] + }, + { + "name": "ForcedIncludeFiles", + "switch": "FI", + "comment": "Forced Include File", + "value": "", + "flags": [ + "UserValue", + "SemicolonAppendable" + ] + }, + { + "name": "ForcedUsingFiles", + "switch": "FU", + "comment": "Forced #using File", + "value": "", + "flags": [ + "UserValue", + "SemicolonAppendable" + ] + }, + { + "name": "PREfastAdditionalOptions", + "switch": "analyze:", + "comment": "Additional Code Analysis Native options", + "value": "", + "flags": [ + "UserValue", + "SemicolonAppendable" + ] + }, + { + "name": "PREfastAdditionalPlugins", + "switch": "analyze:plugin", + "comment": "Additional Code Analysis Native plugins", + "value": "", + "flags": [ + "UserValue", + "SemicolonAppendable" + ] + }, + { + "name": "TreatSpecificWarningsAsErrors", + "switch": "we", + "comment": "Treat Specific Warnings As Errors", + "value": "", + "flags": [ + "UserValue", + "SemicolonAppendable" + ] + }, + { + "name": "WarningVersion", + "switch": "Wv:", + "comment": "Warning Version", + "value": "", + "flags": [ + "UserValue" + ] + }, + { + "name": "PreprocessOutputPath", + "switch": "Fi", + "comment": "Preprocess Output Path", + "value": "", + "flags": [ + "UserValue" + ] + }, + { + "name": "PrecompiledHeaderFile", + "switch": "Yu", + "comment": "Precompiled Header File", + "value": "", + "flags": [ + "UserValue", + "UserRequired" + ] + }, + { + "name": "PrecompiledHeaderFile", + "switch": "Yc", + "comment": "Precompiled Header File", + "value": "", + "flags": [ + "UserValue", + "UserRequired" + ] + }, + { + "name": "PrecompiledHeaderOutputFile", + "switch": "Fp", + "comment": "Precompiled Header Output File", + "value": "", + "flags": [ + "UserValue" + ] + }, + { + "name": "AssemblerListingLocation", + "switch": "Fa", + "comment": "ASM List Location", + "value": "", + "flags": [ + "UserValue" + ] + }, + { + "name": "ObjectFileName", + "switch": "Fo", + "comment": "Object File Name", + "value": "", + "flags": [ + "UserValue" + ] + }, + { + "name": "ProgramDataBaseFileName", + "switch": "Fd", + "comment": "Program Database File Name", + "value": "", + "flags": [ + "UserValue" + ] + }, + { + "name": "XMLDocumentationFileName", + "switch": "doc", + "comment": "XML Documentation File Name", + "value": "", + "flags": [ + "UserValue", + "UserRequired" + ] + }, + { + "name": "BrowseInformationFile", + "switch": "FR", + "comment": "Browse Information File", + "value": "", + "flags": [ + "UserValue", + "UserRequired" + ] + }, + { + "name": "PREfastLog", + "switch": "analyze:log", + "comment": "Code Analysis Log", + "value": "", + "flags": [ + "UserValue" + ] + }, + { + "name": "ProcessorNumber", + "switch": "MP", + "comment": "Number of processors", + "value": "", + "flags": [ + "UserValue", + "UserRequired" + ] + } +] diff --git a/Templates/MSBuild/FlagTables/v142_Link.json b/Templates/MSBuild/FlagTables/v142_Link.json new file mode 100644 index 0000000..acdb5ac --- /dev/null +++ b/Templates/MSBuild/FlagTables/v142_Link.json @@ -0,0 +1,1343 @@ +[ + { + "name": "ShowProgress", + "switch": "", + "comment": "Not Set", + "value": "NotSet", + "flags": [] + }, + { + "name": "ShowProgress", + "switch": "VERBOSE", + "comment": "Display all progress messages", + "value": "LinkVerbose", + "flags": [] + }, + { + "name": "ShowProgress", + "switch": "VERBOSE:Lib", + "comment": "For Libraries Searched", + "value": "LinkVerboseLib", + "flags": [] + }, + { + "name": "ShowProgress", + "switch": "VERBOSE:ICF", + "comment": "About COMDAT folding during optimized linking", + "value": "LinkVerboseICF", + "flags": [] + }, + { + "name": "ShowProgress", + "switch": "VERBOSE:REF", + "comment": "About data removed during optimized linking", + "value": "LinkVerboseREF", + "flags": [] + }, + { + "name": "ShowProgress", + "switch": "VERBOSE:SAFESEH", + "comment": "About Modules incompatible with SEH", + "value": "LinkVerboseSAFESEH", + "flags": [] + }, + { + "name": "ShowProgress", + "switch": "VERBOSE:CLR", + "comment": "About linker activity related to managed code", + "value": "LinkVerboseCLR", + "flags": [] + }, + { + "name": "ForceFileOutput", + "switch": "FORCE", + "comment": "Enabled", + "value": "Enabled", + "flags": [] + }, + { + "name": "ForceFileOutput", + "switch": "FORCE:MULTIPLE", + "comment": "Multiply Defined Symbol Only", + "value": "MultiplyDefinedSymbolOnly", + "flags": [] + }, + { + "name": "ForceFileOutput", + "switch": "FORCE:UNRESOLVED", + "comment": "Undefined Symbol Only", + "value": "UndefinedSymbolOnly", + "flags": [] + }, + { + "name": "CreateHotPatchableImage", + "switch": "FUNCTIONPADMIN", + "comment": "Enabled", + "value": "Enabled", + "flags": [] + }, + { + "name": "CreateHotPatchableImage", + "switch": "FUNCTIONPADMIN:5", + "comment": "X86 Image Only", + "value": "X86Image", + "flags": [] + }, + { + "name": "CreateHotPatchableImage", + "switch": "FUNCTIONPADMIN:6", + "comment": "X64 Image Only", + "value": "X64Image", + "flags": [] + }, + { + "name": "CreateHotPatchableImage", + "switch": "FUNCTIONPADMIN:16", + "comment": "Itanium Image Only", + "value": "ItaniumImage", + "flags": [] + }, + { + "name": "UACExecutionLevel", + "switch": "level='asInvoker'", + "comment": "asInvoker", + "value": "AsInvoker", + "flags": [] + }, + { + "name": "UACExecutionLevel", + "switch": "level='highestAvailable'", + "comment": "highestAvailable", + "value": "HighestAvailable", + "flags": [] + }, + { + "name": "UACExecutionLevel", + "switch": "level='requireAdministrator'", + "comment": "requireAdministrator", + "value": "RequireAdministrator", + "flags": [] + }, + { + "name": "GenerateDebugInformation", + "switch": "", + "comment": "No", + "value": "false", + "flags": [] + }, + { + "name": "GenerateDebugInformation", + "switch": "DEBUG", + "comment": "Generate Debug Information", + "value": "true", + "flags": [] + }, + { + "name": "GenerateDebugInformation", + "switch": "DEBUG:FASTLINK", + "comment": "Generate Debug Information optimized for faster links", + "value": "DebugFastLink", + "flags": [] + }, + { + "name": "GenerateDebugInformation", + "switch": "DEBUG:FULL", + "comment": "Generate Debug Information optimized for sharing and publishing", + "value": "DebugFull", + "flags": [] + }, + { + "name": "SubSystem", + "switch": "", + "comment": "Not Set", + "value": "NotSet", + "flags": [] + }, + { + "name": "SubSystem", + "switch": "SUBSYSTEM:CONSOLE", + "comment": "Console", + "value": "Console", + "flags": [] + }, + { + "name": "SubSystem", + "switch": "SUBSYSTEM:WINDOWS", + "comment": "Windows", + "value": "Windows", + "flags": [] + }, + { + "name": "SubSystem", + "switch": "SUBSYSTEM:NATIVE", + "comment": "Native", + "value": "Native", + "flags": [] + }, + { + "name": "SubSystem", + "switch": "SUBSYSTEM:EFI_APPLICATION", + "comment": "EFI Application", + "value": "EFI Application", + "flags": [] + }, + { + "name": "SubSystem", + "switch": "SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER", + "comment": "EFI Boot Service Driver", + "value": "EFI Boot Service Driver", + "flags": [] + }, + { + "name": "SubSystem", + "switch": "SUBSYSTEM:EFI_ROM", + "comment": "EFI ROM", + "value": "EFI ROM", + "flags": [] + }, + { + "name": "SubSystem", + "switch": "SUBSYSTEM:EFI_RUNTIME_DRIVER", + "comment": "EFI Runtime", + "value": "EFI Runtime", + "flags": [] + }, + { + "name": "SubSystem", + "switch": "SUBSYSTEM:POSIX", + "comment": "POSIX", + "value": "POSIX", + "flags": [] + }, + { + "name": "Driver", + "switch": "", + "comment": "Not Set", + "value": "NotSet", + "flags": [] + }, + { + "name": "Driver", + "switch": "Driver", + "comment": "Driver", + "value": "Driver", + "flags": [] + }, + { + "name": "Driver", + "switch": "DRIVER:UPONLY", + "comment": "UP Only", + "value": "UpOnly", + "flags": [] + }, + { + "name": "Driver", + "switch": "DRIVER:WDM", + "comment": "WDM", + "value": "WDM", + "flags": [] + }, + { + "name": "LinkTimeCodeGeneration", + "switch": "", + "comment": "Default", + "value": "Default", + "flags": [] + }, + { + "name": "LinkTimeCodeGeneration", + "switch": "LTCG:incremental", + "comment": "Use Fast Link Time Code Generation", + "value": "UseFastLinkTimeCodeGeneration", + "flags": [] + }, + { + "name": "LinkTimeCodeGeneration", + "switch": "LTCG", + "comment": "Use Link Time Code Generation", + "value": "UseLinkTimeCodeGeneration", + "flags": [] + }, + { + "name": "LinkTimeCodeGeneration", + "switch": "LTCG:PGInstrument", + "comment": "Profile Guided Optimization - Instrument", + "value": "PGInstrument", + "flags": [] + }, + { + "name": "LinkTimeCodeGeneration", + "switch": "LTCG:PGOptimize", + "comment": "Profile Guided Optimization - Optimization", + "value": "PGOptimization", + "flags": [] + }, + { + "name": "LinkTimeCodeGeneration", + "switch": "LTCG:PGUpdate", + "comment": "Profile Guided Optimization - Update", + "value": "PGUpdate", + "flags": [] + }, + { + "name": "GenerateWindowsMetadata", + "switch": "WINMD", + "comment": "Yes", + "value": "true", + "flags": [] + }, + { + "name": "GenerateWindowsMetadata", + "switch": "WINMD:NO", + "comment": "No", + "value": "false", + "flags": [] + }, + { + "name": "WindowsMetadataSignHash", + "switch": "WINMDSIGNHASH:SHA1", + "comment": "SHA1", + "value": "SHA1", + "flags": [] + }, + { + "name": "WindowsMetadataSignHash", + "switch": "WINMDSIGNHASH:SHA256", + "comment": "SHA256", + "value": "SHA256", + "flags": [] + }, + { + "name": "WindowsMetadataSignHash", + "switch": "WINMDSIGNHASH:SHA384", + "comment": "SHA384", + "value": "SHA384", + "flags": [] + }, + { + "name": "WindowsMetadataSignHash", + "switch": "WINMDSIGNHASH:SHA512", + "comment": "SHA512", + "value": "SHA512", + "flags": [] + }, + { + "name": "TargetMachine", + "switch": "", + "comment": "Not Set", + "value": "NotSet", + "flags": [] + }, + { + "name": "TargetMachine", + "switch": "MACHINE:ARM", + "comment": "MachineARM", + "value": "MachineARM", + "flags": [] + }, + { + "name": "TargetMachine", + "switch": "MACHINE:ARM64", + "comment": "MachineARM64", + "value": "MachineARM64", + "flags": [] + }, + { + "name": "TargetMachine", + "switch": "MACHINE:EBC", + "comment": "MachineEBC", + "value": "MachineEBC", + "flags": [] + }, + { + "name": "TargetMachine", + "switch": "MACHINE:IA64", + "comment": "MachineIA64", + "value": "MachineIA64", + "flags": [] + }, + { + "name": "TargetMachine", + "switch": "MACHINE:MIPS", + "comment": "MachineMIPS", + "value": "MachineMIPS", + "flags": [] + }, + { + "name": "TargetMachine", + "switch": "MACHINE:MIPS16", + "comment": "MachineMIPS16", + "value": "MachineMIPS16", + "flags": [] + }, + { + "name": "TargetMachine", + "switch": "MACHINE:MIPSFPU", + "comment": "MachineMIPSFPU", + "value": "MachineMIPSFPU", + "flags": [] + }, + { + "name": "TargetMachine", + "switch": "MACHINE:MIPSFPU16", + "comment": "MachineMIPSFPU16", + "value": "MachineMIPSFPU16", + "flags": [] + }, + { + "name": "TargetMachine", + "switch": "MACHINE:SH4", + "comment": "MachineSH4", + "value": "MachineSH4", + "flags": [] + }, + { + "name": "TargetMachine", + "switch": "MACHINE:THUMB", + "comment": "MachineTHUMB", + "value": "MachineTHUMB", + "flags": [] + }, + { + "name": "TargetMachine", + "switch": "MACHINE:X64", + "comment": "MachineX64", + "value": "MachineX64", + "flags": [] + }, + { + "name": "TargetMachine", + "switch": "MACHINE:X86", + "comment": "MachineX86", + "value": "MachineX86", + "flags": [] + }, + { + "name": "CLRThreadAttribute", + "switch": "CLRTHREADATTRIBUTE:MTA", + "comment": "MTA threading attribute", + "value": "MTAThreadingAttribute", + "flags": [] + }, + { + "name": "CLRThreadAttribute", + "switch": "CLRTHREADATTRIBUTE:STA", + "comment": "STA threading attribute", + "value": "STAThreadingAttribute", + "flags": [] + }, + { + "name": "CLRThreadAttribute", + "switch": "CLRTHREADATTRIBUTE:NONE", + "comment": "Default threading attribute", + "value": "DefaultThreadingAttribute", + "flags": [] + }, + { + "name": "CLRImageType", + "switch": "CLRIMAGETYPE:IJW", + "comment": "Force IJW image", + "value": "ForceIJWImage", + "flags": [] + }, + { + "name": "CLRImageType", + "switch": "CLRIMAGETYPE:PURE", + "comment": "Force Pure IL Image", + "value": "ForcePureILImage", + "flags": [] + }, + { + "name": "CLRImageType", + "switch": "CLRIMAGETYPE:SAFE", + "comment": "Force Safe IL Image", + "value": "ForceSafeILImage", + "flags": [] + }, + { + "name": "CLRImageType", + "switch": "", + "comment": "Default image type", + "value": "Default", + "flags": [] + }, + { + "name": "SignHash", + "switch": "CLRSIGNHASH:SHA1", + "comment": "SHA1", + "value": "SHA1", + "flags": [] + }, + { + "name": "SignHash", + "switch": "CLRSIGNHASH:SHA256", + "comment": "SHA256", + "value": "SHA256", + "flags": [] + }, + { + "name": "SignHash", + "switch": "CLRSIGNHASH:SHA384", + "comment": "SHA384", + "value": "SHA384", + "flags": [] + }, + { + "name": "SignHash", + "switch": "CLRSIGNHASH:SHA512", + "comment": "SHA512", + "value": "SHA512", + "flags": [] + }, + { + "name": "LinkErrorReporting", + "switch": "ERRORREPORT:PROMPT", + "comment": "PromptImmediately", + "value": "PromptImmediately", + "flags": [] + }, + { + "name": "LinkErrorReporting", + "switch": "ERRORREPORT:QUEUE", + "comment": "Queue For Next Login", + "value": "QueueForNextLogin", + "flags": [] + }, + { + "name": "LinkErrorReporting", + "switch": "ERRORREPORT:SEND", + "comment": "Send Error Report", + "value": "SendErrorReport", + "flags": [] + }, + { + "name": "LinkErrorReporting", + "switch": "ERRORREPORT:NONE", + "comment": "No Error Report", + "value": "NoErrorReport", + "flags": [] + }, + { + "name": "CLRSupportLastError", + "switch": "CLRSupportLastError", + "comment": "Enabled", + "value": "Enabled", + "flags": [] + }, + { + "name": "CLRSupportLastError", + "switch": "CLRSupportLastError:NO", + "comment": "Disabled", + "value": "Disabled", + "flags": [] + }, + { + "name": "CLRSupportLastError", + "switch": "CLRSupportLastError:SYSTEMDLL", + "comment": "System Dlls Only", + "value": "SystemDlls", + "flags": [] + }, + { + "name": "LinkControlFlowGuard", + "switch": "guard:cf", + "comment": "Enable Security Check with Guard", + "value": "Guard", + "flags": [] + }, + { + "name": "LinkIncremental", + "switch": "INCREMENTAL:NO", + "comment": "Enable Incremental Linking", + "value": "false", + "flags": [] + }, + { + "name": "LinkIncremental", + "switch": "INCREMENTAL", + "comment": "Enable Incremental Linking", + "value": "true", + "flags": [] + }, + { + "name": "SuppressStartupBanner", + "switch": "NOLOGO", + "comment": "Suppress Startup Banner", + "value": "true", + "flags": [] + }, + { + "name": "LinkStatus", + "switch": "LTCG:NOSTATUS", + "comment": "Link Status", + "value": "false", + "flags": [] + }, + { + "name": "LinkStatus", + "switch": "LTCG:STATUS", + "comment": "Link Status", + "value": "true", + "flags": [] + }, + { + "name": "PreventDllBinding", + "switch": "ALLOWBIND:NO", + "comment": "Prevent Dll Binding", + "value": "false", + "flags": [] + }, + { + "name": "PreventDllBinding", + "switch": "ALLOWBIND", + "comment": "Prevent Dll Binding", + "value": "true", + "flags": [] + }, + { + "name": "TreatLinkerWarningAsErrors", + "switch": "WX:NO", + "comment": "Treat Linker Warning As Errors", + "value": "false", + "flags": [] + }, + { + "name": "TreatLinkerWarningAsErrors", + "switch": "WX", + "comment": "Treat Linker Warning As Errors", + "value": "true", + "flags": [] + }, + { + "name": "IgnoreAllDefaultLibraries", + "switch": "NODEFAULTLIB", + "comment": "Ignore All Default Libraries", + "value": "true", + "flags": [] + }, + { + "name": "GenerateManifest", + "switch": "MANIFEST:NO", + "comment": "Generate Manifest", + "value": "false", + "flags": [] + }, + { + "name": "GenerateManifest", + "switch": "MANIFEST", + "comment": "Generate Manifest", + "value": "true", + "flags": [] + }, + { + "name": "AllowIsolation", + "switch": "ALLOWISOLATION:NO", + "comment": "Allow Isolation", + "value": "false", + "flags": [] + }, + { + "name": "AllowIsolation", + "switch": "", + "comment": "Allow Isolation", + "value": "true", + "flags": [] + }, + { + "name": "EnableUAC", + "switch": "MANIFESTUAC:NO", + "comment": "Enable User Account Control (UAC)", + "value": "false", + "flags": [ + "UserValue", + "UserIgnored", + "Continue" + ] + }, + { + "name": "EnableUAC", + "switch": "MANIFESTUAC:", + "comment": "Enable User Account Control (UAC)", + "value": "true", + "flags": [ + "UserValue", + "UserIgnored", + "Continue" + ] + }, + { + "name": "UACUIAccess", + "switch": "uiAccess='false'", + "comment": "UAC Bypass UI Protection", + "value": "false", + "flags": [ + "UserValue", + "UserRequired" + ] + }, + { + "name": "UACUIAccess", + "switch": "MANIFESTUAC:", + "comment": "UAC Bypass UI Protection", + "value": "true", + "flags": [ + "UserValue", + "UserRequired" + ] + }, + { + "name": "UACUIAccess", + "switch": "uiAccess='false'", + "comment": "UAC Bypass UI Protection", + "value": "false", + "flags": [] + }, + { + "name": "UACUIAccess", + "switch": "uiAccess='true'", + "comment": "UAC Bypass UI Protection", + "value": "true", + "flags": [] + }, + { + "name": "ManifestEmbed", + "switch": "manifest:embed", + "comment": "Embed Manifest", + "value": "true", + "flags": [] + }, + { + "name": "GenerateMapFile", + "switch": "MAP", + "comment": "Generate Map File", + "value": "true", + "flags": [ + "UserValue", + "UserIgnored", + "Continue" + ] + }, + { + "name": "MapExports", + "switch": "MAPINFO:EXPORTS", + "comment": "Map Exports", + "value": "true", + "flags": [] + }, + { + "name": "AssemblyDebug", + "switch": "ASSEMBLYDEBUG:DISABLE", + "comment": "Debuggable Assembly", + "value": "false", + "flags": [] + }, + { + "name": "AssemblyDebug", + "switch": "ASSEMBLYDEBUG", + "comment": "Debuggable Assembly", + "value": "true", + "flags": [] + }, + { + "name": "LargeAddressAware", + "switch": "LARGEADDRESSAWARE:NO", + "comment": "Enable Large Addresses", + "value": "false", + "flags": [] + }, + { + "name": "LargeAddressAware", + "switch": "LARGEADDRESSAWARE", + "comment": "Enable Large Addresses", + "value": "true", + "flags": [] + }, + { + "name": "TerminalServerAware", + "switch": "TSAWARE:NO", + "comment": "Terminal Server", + "value": "false", + "flags": [] + }, + { + "name": "TerminalServerAware", + "switch": "TSAWARE", + "comment": "Terminal Server", + "value": "true", + "flags": [] + }, + { + "name": "SwapRunFromCD", + "switch": "SWAPRUN:CD", + "comment": "Swap Run From CD", + "value": "true", + "flags": [] + }, + { + "name": "SwapRunFromNET", + "switch": "SWAPRUN:NET", + "comment": "Swap Run From Network", + "value": "true", + "flags": [] + }, + { + "name": "OptimizeReferences", + "switch": "OPT:NOREF", + "comment": "References", + "value": "false", + "flags": [] + }, + { + "name": "OptimizeReferences", + "switch": "OPT:REF", + "comment": "References", + "value": "true", + "flags": [] + }, + { + "name": "EnableCOMDATFolding", + "switch": "OPT:NOICF", + "comment": "Enable COMDAT Folding", + "value": "false", + "flags": [] + }, + { + "name": "EnableCOMDATFolding", + "switch": "OPT:ICF", + "comment": "Enable COMDAT Folding", + "value": "true", + "flags": [] + }, + { + "name": "IgnoreEmbeddedIDL", + "switch": "IGNOREIDL", + "comment": "Ignore Embedded IDL", + "value": "true", + "flags": [] + }, + { + "name": "AppContainer", + "switch": "APPCONTAINER", + "comment": "", + "value": "true", + "flags": [] + }, + { + "name": "WindowsMetadataLinkDelaySign", + "switch": "WINMDDELAYSIGN:NO", + "comment": "Windows Metadata Delay Sign", + "value": "false", + "flags": [] + }, + { + "name": "WindowsMetadataLinkDelaySign", + "switch": "WINMDDELAYSIGN", + "comment": "Windows Metadata Delay Sign", + "value": "true", + "flags": [] + }, + { + "name": "NoEntryPoint", + "switch": "NOENTRY", + "comment": "No Entry Point", + "value": "true", + "flags": [] + }, + { + "name": "SetChecksum", + "switch": "RELEASE", + "comment": "Set Checksum", + "value": "true", + "flags": [] + }, + { + "name": "RandomizedBaseAddress", + "switch": "DYNAMICBASE:NO", + "comment": "Randomized Base Address", + "value": "false", + "flags": [] + }, + { + "name": "RandomizedBaseAddress", + "switch": "DYNAMICBASE", + "comment": "Randomized Base Address", + "value": "true", + "flags": [] + }, + { + "name": "FixedBaseAddress", + "switch": "FIXED:NO", + "comment": "Fixed Base Address", + "value": "false", + "flags": [] + }, + { + "name": "FixedBaseAddress", + "switch": "FIXED", + "comment": "Fixed Base Address", + "value": "true", + "flags": [] + }, + { + "name": "DataExecutionPrevention", + "switch": "NXCOMPAT:NO", + "comment": "Data Execution Prevention (DEP)", + "value": "false", + "flags": [] + }, + { + "name": "DataExecutionPrevention", + "switch": "NXCOMPAT", + "comment": "Data Execution Prevention (DEP)", + "value": "true", + "flags": [] + }, + { + "name": "TurnOffAssemblyGeneration", + "switch": "NOASSEMBLY", + "comment": "Turn Off Assembly Generation", + "value": "true", + "flags": [] + }, + { + "name": "SupportUnloadOfDelayLoadedDLL", + "switch": "DELAY:UNLOAD", + "comment": "Unload delay loaded DLL", + "value": "true", + "flags": [] + }, + { + "name": "SupportNobindOfDelayLoadedDLL", + "switch": "DELAY:NOBIND", + "comment": "Nobind delay loaded DLL", + "value": "true", + "flags": [] + }, + { + "name": "Profile", + "switch": "PROFILE", + "comment": "Profile", + "value": "true", + "flags": [] + }, + { + "name": "LinkDelaySign", + "switch": "DELAYSIGN:NO", + "comment": "Delay Sign", + "value": "false", + "flags": [] + }, + { + "name": "LinkDelaySign", + "switch": "DELAYSIGN", + "comment": "Delay Sign", + "value": "true", + "flags": [] + }, + { + "name": "CLRUnmanagedCodeCheck", + "switch": "CLRUNMANAGEDCODECHECK:NO", + "comment": "CLR Unmanaged Code Check", + "value": "false", + "flags": [] + }, + { + "name": "CLRUnmanagedCodeCheck", + "switch": "CLRUNMANAGEDCODECHECK", + "comment": "CLR Unmanaged Code Check", + "value": "true", + "flags": [] + }, + { + "name": "DetectOneDefinitionRule", + "switch": "ODR", + "comment": "Detect One Definition Rule violations", + "value": "true", + "flags": [] + }, + { + "name": "ImageHasSafeExceptionHandlers", + "switch": "SAFESEH:NO", + "comment": "Image Has Safe Exception Handlers", + "value": "false", + "flags": [] + }, + { + "name": "ImageHasSafeExceptionHandlers", + "switch": "SAFESEH", + "comment": "Image Has Safe Exception Handlers", + "value": "true", + "flags": [] + }, + { + "name": "LinkDLL", + "switch": "DLL", + "comment": "", + "value": "true", + "flags": [] + }, + { + "name": "AdditionalLibraryDirectories", + "switch": "LIBPATH:", + "comment": "Additional Library Directories", + "value": "", + "flags": [ + "UserValue", + "SemicolonAppendable" + ] + }, + { + "name": "Natvis", + "switch": "NATVIS:", + "comment": "Natvis files", + "value": "", + "flags": [ + "UserValue", + "SemicolonAppendable" + ] + }, + { + "name": "IgnoreSpecificDefaultLibraries", + "switch": "NODEFAULTLIB:", + "comment": "Ignore Specific Default Libraries", + "value": "", + "flags": [ + "UserValue", + "SemicolonAppendable" + ] + }, + { + "name": "AddModuleNamesToAssembly", + "switch": "ASSEMBLYMODULE:", + "comment": "Add Module to Assembly", + "value": "", + "flags": [ + "UserValue", + "SemicolonAppendable" + ] + }, + { + "name": "EmbedManagedResourceFile", + "switch": "ASSEMBLYRESOURCE:", + "comment": "Embed Managed Resource File", + "value": "", + "flags": [ + "UserValue", + "SemicolonAppendable" + ] + }, + { + "name": "ForceSymbolReferences", + "switch": "INCLUDE:", + "comment": "Force Symbol References", + "value": "", + "flags": [ + "UserValue", + "SemicolonAppendable" + ] + }, + { + "name": "DelayLoadDLLs", + "switch": "DELAYLOAD:", + "comment": "Delay Loaded Dlls", + "value": "", + "flags": [ + "UserValue", + "SemicolonAppendable" + ] + }, + { + "name": "AssemblyLinkResource", + "switch": "ASSEMBLYLINKRESOURCE:", + "comment": "Assembly Link Resource", + "value": "", + "flags": [ + "UserValue", + "SemicolonAppendable" + ] + }, + { + "name": "AdditionalManifestDependencies", + "switch": "MANIFESTDEPENDENCY:", + "comment": "Additional Manifest Dependencies", + "value": "", + "flags": [ + "UserValue", + "SemicolonAppendable" + ] + }, + { + "name": "ManifestInput", + "switch": "manifestinput:", + "comment": "Manifest Input", + "value": "", + "flags": [ + "UserValue", + "SemicolonAppendable" + ] + }, + { + "name": "OutputFile", + "switch": "OUT:", + "comment": "Output File", + "value": "", + "flags": [ + "UserValue" + ] + }, + { + "name": "Version", + "switch": "VERSION:", + "comment": "Version", + "value": "", + "flags": [ + "UserValue" + ] + }, + { + "name": "SpecifySectionAttributes", + "switch": "SECTION:", + "comment": "Specify Section Attributes", + "value": "", + "flags": [ + "UserValue" + ] + }, + { + "name": "MSDOSStubFileName", + "switch": "STUB:", + "comment": "MS-DOS Stub File Name", + "value": "", + "flags": [ + "UserValue" + ] + }, + { + "name": "ModuleDefinitionFile", + "switch": "DEF:", + "comment": "Module Definition File", + "value": "", + "flags": [ + "UserValue" + ] + }, + { + "name": "ManifestFile", + "switch": "ManifestFile:", + "comment": "Manifest File", + "value": "", + "flags": [ + "UserValue" + ] + }, + { + "name": "ProgramDatabaseFile", + "switch": "PDB:", + "comment": "Generate Program Database File", + "value": "", + "flags": [ + "UserValue" + ] + }, + { + "name": "StripPrivateSymbols", + "switch": "PDBSTRIPPED:", + "comment": "Strip Private Symbols", + "value": "", + "flags": [ + "UserValue" + ] + }, + { + "name": "MapFileName", + "switch": "MAP:", + "comment": "Map File Name", + "value": "", + "flags": [ + "UserValue", + "UserRequired" + ] + }, + { + "name": "HeapReserveSize", + "switch": "HEAP:", + "comment": "Heap Reserve Size", + "value": "", + "flags": [ + "UserValue" + ] + }, + { + "name": "HeapCommitSize", + "switch": "HEAP", + "comment": "Heap Commit Size", + "value": "", + "flags": [ + "UserValue", + "UserRequired" + ] + }, + { + "name": "StackReserveSize", + "switch": "STACK:", + "comment": "Stack Reserve Size", + "value": "", + "flags": [ + "UserValue" + ] + }, + { + "name": "StackCommitSize", + "switch": "STACK", + "comment": "Stack Commit Size", + "value": "", + "flags": [ + "UserValue", + "UserRequired" + ] + }, + { + "name": "FunctionOrder", + "switch": "ORDER:@", + "comment": "Function Order", + "value": "", + "flags": [ + "UserValue" + ] + }, + { + "name": "ProfileGuidedDatabase", + "switch": "PGD:", + "comment": "Profile Guided Database", + "value": "", + "flags": [ + "UserValue" + ] + }, + { + "name": "MidlCommandFile", + "switch": "MIDL:@", + "comment": "MIDL Commands", + "value": "", + "flags": [ + "UserValue" + ] + }, + { + "name": "MergedIDLBaseFileName", + "switch": "IDLOUT:", + "comment": "Merged IDL Base File Name", + "value": "", + "flags": [ + "UserValue" + ] + }, + { + "name": "TypeLibraryFile", + "switch": "TLBOUT:", + "comment": "Type Library", + "value": "", + "flags": [ + "UserValue" + ] + }, + { + "name": "WindowsMetadataFile", + "switch": "WINMDFILE:", + "comment": "Windows Metadata File", + "value": "", + "flags": [ + "UserValue" + ] + }, + { + "name": "WindowsMetadataLinkKeyFile", + "switch": "WINMDKEYFILE:", + "comment": "Windows Metadata Key File", + "value": "", + "flags": [ + "UserValue" + ] + }, + { + "name": "WindowsMetadataKeyContainer", + "switch": "WINMDKEYCONTAINER:", + "comment": "Windows Metadata Key Container", + "value": "", + "flags": [ + "UserValue" + ] + }, + { + "name": "EntryPointSymbol", + "switch": "ENTRY:", + "comment": "Entry Point", + "value": "", + "flags": [ + "UserValue" + ] + }, + { + "name": "BaseAddress", + "switch": "BASE:", + "comment": "Base Address", + "value": "", + "flags": [ + "UserValue" + ] + }, + { + "name": "ImportLibrary", + "switch": "IMPLIB:", + "comment": "Import Library", + "value": "", + "flags": [ + "UserValue" + ] + }, + { + "name": "MergeSections", + "switch": "MERGE:", + "comment": "Merge Sections", + "value": "", + "flags": [ + "UserValue" + ] + }, + { + "name": "LinkKeyFile", + "switch": "KEYFILE:", + "comment": "Key File", + "value": "", + "flags": [ + "UserValue" + ] + }, + { + "name": "KeyContainer", + "switch": "KEYCONTAINER:", + "comment": "Key Container", + "value": "", + "flags": [ + "UserValue" + ] + }, + { + "name": "TypeLibraryResourceID", + "switch": "TLBID:", + "comment": "TypeLib Resource ID", + "value": "", + "flags": [ + "UserValue" + ] + }, + { + "name": "SectionAlignment", + "switch": "ALIGN:", + "comment": "SectionAlignment", + "value": "", + "flags": [ + "UserValue" + ] + } +] ----------------------------------------------------------------------- Summary of changes: .gitattributes | 1 + Help/release/dev/vs2019.rst | 2 +- Modules/CMakeFortranCompiler.cmake.in | 1 + Modules/CMakeParseImplicitIncludeInfo.cmake | 109 +- Modules/CPack.background.png.in | Bin 47076 -> 44108 bytes Source/QtDialog/CMakeSetup128.png | Bin 10944 -> 7981 bytes Source/QtDialog/CMakeSetup32.png | Bin 2097 -> 1632 bytes Source/QtDialog/CMakeSetup64.png | Bin 4676 -> 3566 bytes Source/QtDialog/Delete16.png | Bin 731 -> 538 bytes Source/QtDialog/Plus16.png | Bin 358 -> 207 bytes Source/cmGlobalVisualStudioVersionedGenerator.cxx | 3 +- Source/cmVSSetupHelper.cxx | 10 +- Source/cmVisualStudio10ToolsetOptions.cxx | 22 +- Templates/MSBuild/FlagTables/v142_CL.json | 1212 ++++++++++++++++++++ .../FlagTables/{v141_Link.json => v142_Link.json} | 0 Templates/Windows/ApplicationIcon.png | Bin 3392 -> 2335 bytes Templates/Windows/Logo.png | Bin 801 -> 488 bytes Templates/Windows/SmallLogo.png | Bin 329 -> 167 bytes Templates/Windows/SmallLogo44x44.png | Bin 554 -> 265 bytes Templates/Windows/SplashScreen.png | Bin 2146 -> 909 bytes Templates/Windows/StoreLogo.png | Bin 429 -> 227 bytes Tests/CMakeTests/FileDownloadInput.png | Bin 358 -> 194 bytes Tests/CMakeTests/FileDownloadTest.cmake.in | 16 +- Tests/CMakeTests/FileUploadTest.cmake.in | 4 +- .../ParseImplicitIncludeInfo.cmake | 20 +- .../ParseImplicitIncludeInfo/data/CMakeLists.txt | 2 + .../RunCMake/ParseImplicitIncludeInfo/data/README | 15 +- .../data/aix-C-XL-13.1.3.input | 40 + .../data/aix-C-XL-13.1.3.output | 1 + .../data/aix-CXX-XL-13.1.3.input | 44 + .../data/aix-CXX-XL-13.1.3.output | 1 + .../data/craype-Fortran-Cray-8.7.input | 52 + .../data/craype-Fortran-Cray-8.7.output | 1 + .../data/craype-Fortran-GNU-7.3.0.input | 83 ++ .../data/craype-Fortran-GNU-7.3.0.output | 1 + .../craype-Fortran-Intel-18.0.2.20180210.input | 80 ++ .../craype-Fortran-Intel-18.0.2.20180210.output | 1 + ...arwin_nostdinc-C-AppleClang-8.0.0.8000042.input | 44 + ...win_nostdinc-C-AppleClang-8.0.0.8000042.output} | 0 ...win_nostdinc-CXX-AppleClang-8.0.0.8000042.input | 44 + ...n_nostdinc-CXX-AppleClang-8.0.0.8000042.output} | 0 .../data/freebsd-Fortran-GNU-4.6.4.input | 78 ++ .../data/freebsd-Fortran-GNU-4.6.4.output | 1 + .../data/linux-C-XL-12.1.0.input | 42 + .../data/linux-C-XL-12.1.0.output | 1 + .../data/linux-C-XL-16.1.0.0.input | 40 + .../data/linux-C-XL-16.1.0.0.output | 1 + .../data/linux-CXX-XL-12.1.0.input | 42 + .../data/linux-CXX-XL-12.1.0.output | 1 + .../data/linux-CXX-XL-16.1.0.0.input | 40 + .../data/linux-CXX-XL-16.1.0.0.output | 1 + .../data/linux-Fortran-GNU-7.3.0.input | 76 ++ .../data/linux-Fortran-GNU-7.3.0.output | 1 + .../data/linux-Fortran-XL-14.1.0.input | 50 + .../data/linux-Fortran-XL-14.1.0.output | 1 + .../data/linux_nostdinc-C-XL-12.1.0.input | 42 + .../data/linux_nostdinc-C-XL-12.1.0.output} | 0 .../data/linux_nostdinc-CXX-XL-12.1.0.input | 42 + .../data/linux_nostdinc-CXX-XL-12.1.0.output} | 0 .../data/linux_nostdinc_i-C-XL-12.1.0.input | 42 + .../data/linux_nostdinc_i-C-XL-12.1.0.output | 1 + .../data/linux_nostdinc_i-CXX-XL-12.1.0.input | 42 + .../data/linux_nostdinc_i-CXX-XL-12.1.0.output | 1 + .../data/netbsd_nostdinc-C-GNU-4.8.5.input | 58 + .../data/netbsd_nostdinc-C-GNU-4.8.5.output} | 0 .../data/netbsd_nostdinc-CXX-GNU-4.8.5.input | 58 + .../data/netbsd_nostdinc-CXX-GNU-4.8.5.output} | 0 .../data/sunos-C-SunPro-5.13.0.output | 1 + .../data/sunos-CXX-SunPro-5.13.0.output | 1 + .../Direct3DApp1/Assets/ApplicationIcon.png | Bin 3392 -> 2335 bytes Tests/VSWinStorePhone/Direct3DApp1/Assets/Logo.png | Bin 801 -> 488 bytes .../Direct3DApp1/Assets/SmallLogo.png | Bin 329 -> 167 bytes .../Direct3DApp1/Assets/SmallLogo44x44.png | Bin 554 -> 265 bytes .../Direct3DApp1/Assets/SplashScreen.png | Bin 2146 -> 909 bytes .../Direct3DApp1/Assets/StoreLogo.png | Bin 429 -> 227 bytes .../Assets/Tiles/FlipCycleTileLarge.png | Bin 9930 -> 2953 bytes .../Assets/Tiles/FlipCycleTileMedium.png | Bin 9070 -> 2767 bytes .../Assets/Tiles/FlipCycleTileSmall.png | Bin 3674 -> 1397 bytes .../Assets/Tiles/IconicTileMediumLarge.png | Bin 4937 -> 893 bytes .../Direct3DApp1/Assets/Tiles/IconicTileSmall.png | Bin 3724 -> 516 bytes Tests/VSXaml/Assets/Logo.scale-100.png | Bin 801 -> 488 bytes Tests/VSXaml/Assets/SmallLogo.scale-100.png | Bin 329 -> 167 bytes Tests/VSXaml/Assets/SplashScreen.scale-100.png | Bin 2146 -> 909 bytes Tests/VSXaml/Assets/StoreLogo.scale-100.png | Bin 429 -> 227 bytes Utilities/Sphinx/static/cmake-logo-16.png | Bin 893 -> 692 bytes 85 files changed, 2433 insertions(+), 39 deletions(-) create mode 100644 Templates/MSBuild/FlagTables/v142_CL.json copy Templates/MSBuild/FlagTables/{v141_Link.json => v142_Link.json} (100%) create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/aix-C-XL-13.1.3.input create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/aix-C-XL-13.1.3.output create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/aix-CXX-XL-13.1.3.input create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/aix-CXX-XL-13.1.3.output create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-Fortran-Cray-8.7.input create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-Fortran-Cray-8.7.output create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-Fortran-GNU-7.3.0.input create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-Fortran-GNU-7.3.0.output create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-Fortran-Intel-18.0.2.20180210.input create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/craype-Fortran-Intel-18.0.2.20180210.output create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/darwin_nostdinc-C-AppleClang-8.0.0.8000042.input copy Tests/{Wrapping/vtkIncluded.cxx => RunCMake/ParseImplicitIncludeInfo/data/darwin_nostdinc-C-AppleClang-8.0.0.8000042.output} (100%) create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/darwin_nostdinc-CXX-AppleClang-8.0.0.8000042.input copy Tests/{Wrapping/vtkIncluded.cxx => RunCMake/ParseImplicitIncludeInfo/data/darwin_nostdinc-CXX-AppleClang-8.0.0.8000042.output} (100%) create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/freebsd-Fortran-GNU-4.6.4.input create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/freebsd-Fortran-GNU-4.6.4.output create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-C-XL-12.1.0.input create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-C-XL-12.1.0.output create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-C-XL-16.1.0.0.input create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-C-XL-16.1.0.0.output create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-XL-12.1.0.input create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-XL-12.1.0.output create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-XL-16.1.0.0.input create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-CXX-XL-16.1.0.0.output create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-Fortran-GNU-7.3.0.input create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-Fortran-GNU-7.3.0.output create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-Fortran-XL-14.1.0.input create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/linux-Fortran-XL-14.1.0.output create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/linux_nostdinc-C-XL-12.1.0.input copy Tests/{Wrapping/vtkIncluded.cxx => RunCMake/ParseImplicitIncludeInfo/data/linux_nostdinc-C-XL-12.1.0.output} (100%) create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/linux_nostdinc-CXX-XL-12.1.0.input copy Tests/{Wrapping/vtkIncluded.cxx => RunCMake/ParseImplicitIncludeInfo/data/linux_nostdinc-CXX-XL-12.1.0.output} (100%) create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/linux_nostdinc_i-C-XL-12.1.0.input create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/linux_nostdinc_i-C-XL-12.1.0.output create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/linux_nostdinc_i-CXX-XL-12.1.0.input create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/linux_nostdinc_i-CXX-XL-12.1.0.output create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/netbsd_nostdinc-C-GNU-4.8.5.input copy Tests/{Wrapping/vtkIncluded.cxx => RunCMake/ParseImplicitIncludeInfo/data/netbsd_nostdinc-C-GNU-4.8.5.output} (100%) create mode 100644 Tests/RunCMake/ParseImplicitIncludeInfo/data/netbsd_nostdinc-CXX-GNU-4.8.5.input copy Tests/{Wrapping/vtkIncluded.cxx => RunCMake/ParseImplicitIncludeInfo/data/netbsd_nostdinc-CXX-GNU-4.8.5.output} (100%) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jan 28 08:13:03 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 28 Jan 2019 08:13:03 -0500 (EST) Subject: [Cmake-commits] CMake branch, release, updated. v3.13.3-7-g27eb8cc Message-ID: <20190128131303.8EC5A125D5E@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, release has been updated via 27eb8cc6ba96ae856c3ad12cfe0503e3d822482e (commit) via fc40bca5902e6c29197696438211265e22efa84f (commit) from 329cf7f3e3ef4d64b4bdd274ad2b6cc376a6cb0e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Modules/Compiler/Intel-CXX-FeatureTests.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jan 28 08:23:03 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 28 Jan 2019 08:23:03 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-1149-g1593e16 Message-ID: <20190128132303.A6F911276F3@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 1593e16d881bf74fd8981e1290d20f28191f1f0e (commit) via 2a9220c34d26d33b5733ba41a25c44e02c8cdb3a (commit) via edda30d0f5c7230b7854d8d714159ad68a2344ef (commit) via 7a25ef326bc53293f2dd288a7c092b4080658821 (commit) via e50a36df488be05dfbc85005c88ec8d4c5314a76 (commit) from dc752c9d2d4bc2c0ad047689bd01bb75aa8f8fb9 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1593e16d881bf74fd8981e1290d20f28191f1f0e commit 1593e16d881bf74fd8981e1290d20f28191f1f0e Merge: dc752c9 2a9220c Author: Brad King AuthorDate: Mon Jan 28 13:21:32 2019 +0000 Commit: Kitware Robot CommitDate: Mon Jan 28 08:21:50 2019 -0500 Merge topic 'get_filename_component_last_ext' 2a9220c34d Help: Add notes for topic 'get_filename_component_last_ext' edda30d0f5 Tests: Add tests for LAST_EXT and NAME_WLE 7a25ef326b Help: Add documentation for new get_filename_component components e50a36df48 cmGetFilenameComponentCommand: Add more components Acked-by: Kitware Robot Merge-request: !2853 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2a9220c34d26d33b5733ba41a25c44e02c8cdb3a commit 2a9220c34d26d33b5733ba41a25c44e02c8cdb3a Author: Brad King AuthorDate: Mon Jan 28 08:20:24 2019 -0500 Commit: Brad King CommitDate: Mon Jan 28 08:20:24 2019 -0500 Help: Add notes for topic 'get_filename_component_last_ext' diff --git a/Help/release/dev/get_filename_component_last_ext.rst b/Help/release/dev/get_filename_component_last_ext.rst new file mode 100644 index 0000000..2487dbc --- /dev/null +++ b/Help/release/dev/get_filename_component_last_ext.rst @@ -0,0 +1,6 @@ +get_filename_component_last_ext +------------------------------- + +* The :command:`get_filename_component` command gained new + ``LAST_EXT`` and ``NAME_WLE`` variants to work with the + extension after the last ``.`` in the name. https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=edda30d0f5c7230b7854d8d714159ad68a2344ef commit edda30d0f5c7230b7854d8d714159ad68a2344ef Author: Tushar Maheshwari AuthorDate: Thu Jan 24 22:42:09 2019 +0530 Commit: Tushar Maheshwari CommitDate: Thu Jan 24 22:42:42 2019 +0530 Tests: Add tests for LAST_EXT and NAME_WLE diff --git a/Tests/RunCMake/get_filename_component/KnownComponents.cmake b/Tests/RunCMake/get_filename_component/KnownComponents.cmake index ac77ac3..54b858f 100644 --- a/Tests/RunCMake/get_filename_component/KnownComponents.cmake +++ b/Tests/RunCMake/get_filename_component/KnownComponents.cmake @@ -11,8 +11,10 @@ set(expect_DIRECTORY "/path/to") set(expect_NAME "filename.ext.in") set(expect_EXT ".ext.in") set(expect_NAME_WE "filename") +set(expect_LAST_EXT ".in") +set(expect_NAME_WLE "filename.ext") set(expect_PATH "/path/to") -foreach(c DIRECTORY NAME EXT NAME_WE PATH) +foreach(c DIRECTORY NAME EXT NAME_WE LAST_EXT NAME_WLE PATH) get_filename_component(actual_${c} "${filename}" ${c}) check("${c}" "${actual_${c}}" "${expect_${c}}") list(APPEND non_cache_vars actual_${c}) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7a25ef326bc53293f2dd288a7c092b4080658821 commit 7a25ef326bc53293f2dd288a7c092b4080658821 Author: Tushar Maheshwari AuthorDate: Thu Jan 24 22:41:22 2019 +0530 Commit: Tushar Maheshwari CommitDate: Thu Jan 24 22:41:22 2019 +0530 Help: Add documentation for new get_filename_component components diff --git a/Help/command/get_filename_component.rst b/Help/command/get_filename_component.rst index 3e3c9c3..f55499a 100644 --- a/Help/command/get_filename_component.rst +++ b/Help/command/get_filename_component.rst @@ -15,6 +15,8 @@ Sets ```` 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 + LAST_EXT = File name last extention (.c from d/a.b.c) + NAME_WLE = File name without directory or last extension PATH = Legacy alias for DIRECTORY (use for CMake <= 2.8.11) Paths are returned with forward slashes and have no trailing slashes. https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e50a36df488be05dfbc85005c88ec8d4c5314a76 commit e50a36df488be05dfbc85005c88ec8d4c5314a76 Author: Tushar Maheshwari AuthorDate: Thu Jan 24 22:38:52 2019 +0530 Commit: Tushar Maheshwari CommitDate: Thu Jan 24 22:38:52 2019 +0530 cmGetFilenameComponentCommand: Add more components LAST_EXT: gets last extension from filename with multiple periods NAME_WLE: gets the name without the last extension diff --git a/Source/cmGetFilenameComponentCommand.cxx b/Source/cmGetFilenameComponentCommand.cxx index ffb895e..163b4c8 100644 --- a/Source/cmGetFilenameComponentCommand.cxx +++ b/Source/cmGetFilenameComponentCommand.cxx @@ -88,6 +88,10 @@ bool cmGetFilenameComponentCommand::InitialPass( result = cmSystemTools::GetFilenameExtension(filename); } else if (args[2] == "NAME_WE") { result = cmSystemTools::GetFilenameWithoutExtension(filename); + } else if (args[2] == "LAST_EXT") { + result = cmSystemTools::GetFilenameLastExtension(filename); + } else if (args[2] == "NAME_WLE") { + result = cmSystemTools::GetFilenameWithoutLastExtension(filename); } else if (args[2] == "ABSOLUTE" || args[2] == "REALPATH") { // If the path given is relative, evaluate it relative to the // current source directory unless the user passes a different ----------------------------------------------------------------------- Summary of changes: Help/command/get_filename_component.rst | 2 ++ Help/release/dev/get_filename_component_last_ext.rst | 6 ++++++ Source/cmGetFilenameComponentCommand.cxx | 4 ++++ Tests/RunCMake/get_filename_component/KnownComponents.cmake | 4 +++- 4 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 Help/release/dev/get_filename_component_last_ext.rst hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jan 28 08:33:03 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 28 Jan 2019 08:33:03 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-1155-gf677a3d Message-ID: <20190128133303.9BEBF125698@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via f677a3d7defdb82d79bca2faf09da6d9338773b3 (commit) via c1922c9660298bb0e70204e66d596adb3d104ac0 (commit) via f4547578aa365164f1ef48c4f546828752cf4835 (commit) via a844c7248d7cfca9569ea8aa6a2147f564a5b2f1 (commit) via a5098cad94c152e397b258be69ae152eb1bda3df (commit) via e81fd5d5ba24e46a3a27c6a4e061932cf2022ef2 (commit) from 1593e16d881bf74fd8981e1290d20f28191f1f0e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f677a3d7defdb82d79bca2faf09da6d9338773b3 commit f677a3d7defdb82d79bca2faf09da6d9338773b3 Merge: c1922c9 f454757 Author: Brad King AuthorDate: Mon Jan 28 08:30:30 2019 -0500 Commit: Brad King CommitDate: Mon Jan 28 08:30:30 2019 -0500 Merge branch 'release-3.13' https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c1922c9660298bb0e70204e66d596adb3d104ac0 commit c1922c9660298bb0e70204e66d596adb3d104ac0 Merge: a844c72 e81fd5d Author: Brad King AuthorDate: Mon Jan 28 13:30:00 2019 +0000 Commit: Kitware Robot CommitDate: Mon Jan 28 08:30:07 2019 -0500 Merge topic 'doxygen-escaping' e81fd5d5ba FindDoxygen: Escape backslashes in default values Acked-by: Kitware Robot Acked-by: Julien Schueller Merge-request: !2867 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a844c7248d7cfca9569ea8aa6a2147f564a5b2f1 commit a844c7248d7cfca9569ea8aa6a2147f564a5b2f1 Merge: 1593e16 a5098ca Author: Brad King AuthorDate: Mon Jan 28 13:26:45 2019 +0000 Commit: Kitware Robot CommitDate: Mon Jan 28 08:27:03 2019 -0500 Merge topic 'cmake-E-compare_files-eol' a5098cad94 cmake: Add --ignore-eol option to `-E compare_files` command Acked-by: Kitware Robot Merge-request: !2778 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a5098cad94c152e397b258be69ae152eb1bda3df commit a5098cad94c152e397b258be69ae152eb1bda3df Author: Taylor Braun-Jones AuthorDate: Wed Jan 9 13:02:47 2019 -0500 Commit: Brad King CommitDate: Mon Jan 28 08:24:50 2019 -0500 cmake: Add --ignore-eol option to `-E compare_files` command Fixes: #13007 diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst index 915e0d4..eaf57a0 100644 --- a/Help/manual/cmake.1.rst +++ b/Help/manual/cmake.1.rst @@ -373,9 +373,10 @@ Available commands are: ``chdir [...]`` Change the current working directory and run a command. -``compare_files `` +``compare_files [--ignore-eol] `` Check if ```` is same as ````. If files are the same, - then returns 0, if not it returns 1. + then returns 0, if not it returns 1. The ``--ignore-eol`` option + implies line-wise comparison and ignores LF/CRLF differences. ``copy ... `` Copy files to ```` (either file or directory). diff --git a/Help/release/dev/compare_files-ignore-eol.rst b/Help/release/dev/compare_files-ignore-eol.rst new file mode 100644 index 0000000..bc32921 --- /dev/null +++ b/Help/release/dev/compare_files-ignore-eol.rst @@ -0,0 +1,6 @@ +compare_files-ignore-eol +------------------------ + +* The :manual:`cmake(1)` ``-E compare_files`` command learned a new + ``--ignore-eol`` option to specify that end-of-line differences (e.g. LF vs + CRLF) should be ignored when comparing files. diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index ce3691d..0ad9b88 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -78,7 +78,8 @@ void CMakeCommandUsage(const char* program) << " capabilities - Report capabilities built into cmake " "in JSON format\n" << " chdir dir cmd [args...] - run command in a given directory\n" - << " compare_files file1 file2 - check if file1 is same as file2\n" + << " compare_files [--ignore-eol] file1 file2\n" + << " - check if file1 is same as file2\n" << " copy ... destination - copy files to destination " "(either file or directory)\n" << " copy_directory ... destination - copy content of ... " @@ -540,10 +541,20 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) } // Compare files - if (args[1] == "compare_files" && args.size() == 4) { - if (cmSystemTools::FilesDiffer(args[2], args[3])) { - std::cerr << "Files \"" << args[2] << "\" to \"" << args[3] - << "\" are different.\n"; + if (args[1] == "compare_files" && (args.size() == 4 || args.size() == 5)) { + bool filesDiffer; + if (args.size() == 4) { + filesDiffer = cmSystemTools::FilesDiffer(args[2], args[3]); + } else if (args[2] == "--ignore-eol") { + filesDiffer = cmsys::SystemTools::TextFilesDiffer(args[3], args[4]); + } else { + ::CMakeCommandUsage(args[0].c_str()); + return 1; + } + + if (filesDiffer) { + std::cerr << "Files \"" << args[args.size() - 2] << "\" to \"" + << args[args.size() - 1] << "\" are different.\n"; return 1; } return 0; diff --git a/Tests/RunCMake/CommandLine/E_compare_files-different-eol-result.txt b/Tests/RunCMake/CommandLine/E_compare_files-different-eol-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_compare_files-different-eol-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_compare_files-different-eol-stderr.txt b/Tests/RunCMake/CommandLine/E_compare_files-different-eol-stderr.txt new file mode 100644 index 0000000..4729ccb --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_compare_files-different-eol-stderr.txt @@ -0,0 +1 @@ +^Files ".*/compare_files/lf" to ".*/compare_files/crlf" are different.$ diff --git a/Tests/RunCMake/CommandLine/E_compare_files-ignore-eol-nonexistent-result.txt b/Tests/RunCMake/CommandLine/E_compare_files-ignore-eol-nonexistent-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_compare_files-ignore-eol-nonexistent-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_compare_files-ignore-eol-nonexistent-stderr.txt b/Tests/RunCMake/CommandLine/E_compare_files-ignore-eol-nonexistent-stderr.txt new file mode 100644 index 0000000..8a9ca81 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_compare_files-ignore-eol-nonexistent-stderr.txt @@ -0,0 +1 @@ +^Files "nonexistent_a" to "nonexistent_b" are different.$ diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index c1aaf0d..23fb9ef 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -18,6 +18,10 @@ run_cmake_command(Uno-src ${CMAKE_COMMAND} -B DummyBuildDir -UVAR) run_cmake_command(E-no-arg ${CMAKE_COMMAND} -E) run_cmake_command(E_capabilities ${CMAKE_COMMAND} -E capabilities) run_cmake_command(E_capabilities-arg ${CMAKE_COMMAND} -E capabilities --extra-arg) +run_cmake_command(E_compare_files-different-eol ${CMAKE_COMMAND} -E compare_files ${RunCMake_SOURCE_DIR}/compare_files/lf ${RunCMake_SOURCE_DIR}/compare_files/crlf) +run_cmake_command(E_compare_files-ignore-eol-same ${CMAKE_COMMAND} -E compare_files --ignore-eol ${RunCMake_SOURCE_DIR}/compare_files/lf ${RunCMake_SOURCE_DIR}/compare_files/crlf) +run_cmake_command(E_compare_files-ignore-eol-empty ${CMAKE_COMMAND} -E compare_files --ignore-eol ${RunCMake_SOURCE_DIR}/compare_files/empty1 ${RunCMake_SOURCE_DIR}/compare_files/empty2) +run_cmake_command(E_compare_files-ignore-eol-nonexistent ${CMAKE_COMMAND} -E compare_files --ignore-eol nonexistent_a nonexistent_b) run_cmake_command(E_echo_append ${CMAKE_COMMAND} -E echo_append) run_cmake_command(E_rename-no-arg ${CMAKE_COMMAND} -E rename) run_cmake_command(E_server-arg ${CMAKE_COMMAND} -E server --extra-arg) diff --git a/Tests/RunCMake/CommandLine/compare_files/.gitattributes b/Tests/RunCMake/CommandLine/compare_files/.gitattributes new file mode 100644 index 0000000..91d5c10 --- /dev/null +++ b/Tests/RunCMake/CommandLine/compare_files/.gitattributes @@ -0,0 +1,2 @@ +crlf eol=crlf +lf eol=lf diff --git a/Tests/RunCMake/CommandLine/compare_files/crlf b/Tests/RunCMake/CommandLine/compare_files/crlf new file mode 100644 index 0000000..a29bdeb --- /dev/null +++ b/Tests/RunCMake/CommandLine/compare_files/crlf @@ -0,0 +1 @@ +line1 diff --git a/Tests/RunCMake/CommandLine/compare_files/empty1 b/Tests/RunCMake/CommandLine/compare_files/empty1 new file mode 100644 index 0000000..e69de29 diff --git a/Tests/RunCMake/CommandLine/compare_files/empty2 b/Tests/RunCMake/CommandLine/compare_files/empty2 new file mode 100644 index 0000000..e69de29 diff --git a/Tests/RunCMake/CommandLine/compare_files/lf b/Tests/RunCMake/CommandLine/compare_files/lf new file mode 100644 index 0000000..a29bdeb --- /dev/null +++ b/Tests/RunCMake/CommandLine/compare_files/lf @@ -0,0 +1 @@ +line1 ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake.1.rst | 5 +++-- Help/release/dev/compare_files-ignore-eol.rst | 6 ++++++ Modules/FindDoxygen.cmake | 4 +++- Source/cmcmd.cxx | 21 ++++++++++++++++----- .../E_compare_files-different-eol-result.txt} | 0 .../E_compare_files-different-eol-stderr.txt | 1 + ...compare_files-ignore-eol-nonexistent-result.txt} | 0 ..._compare_files-ignore-eol-nonexistent-stderr.txt | 1 + Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 4 ++++ .../CommandLine/compare_files/.gitattributes | 2 ++ Tests/RunCMake/CommandLine/compare_files/crlf | 1 + .../CommandLine/compare_files/empty1} | 0 .../CommandLine/compare_files/empty2} | 0 Tests/RunCMake/CommandLine/compare_files/lf | 1 + 14 files changed, 38 insertions(+), 8 deletions(-) create mode 100644 Help/release/dev/compare_files-ignore-eol.rst copy Tests/RunCMake/{while/MissingArgument-result.txt => CommandLine/E_compare_files-different-eol-result.txt} (100%) create mode 100644 Tests/RunCMake/CommandLine/E_compare_files-different-eol-stderr.txt copy Tests/RunCMake/{while/MissingArgument-result.txt => CommandLine/E_compare_files-ignore-eol-nonexistent-result.txt} (100%) create mode 100644 Tests/RunCMake/CommandLine/E_compare_files-ignore-eol-nonexistent-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/compare_files/.gitattributes create mode 100644 Tests/RunCMake/CommandLine/compare_files/crlf copy Tests/{Wrapping/vtkIncluded.cxx => RunCMake/CommandLine/compare_files/empty1} (100%) copy Tests/{Wrapping/vtkIncluded.cxx => RunCMake/CommandLine/compare_files/empty2} (100%) create mode 100644 Tests/RunCMake/CommandLine/compare_files/lf hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jan 28 08:33:03 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 28 Jan 2019 08:33:03 -0500 (EST) Subject: [Cmake-commits] CMake branch, release, updated. v3.13.3-9-gf454757 Message-ID: <20190128133303.AB3E01276F3@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, release has been updated via f4547578aa365164f1ef48c4f546828752cf4835 (commit) via e81fd5d5ba24e46a3a27c6a4e061932cf2022ef2 (commit) from 27eb8cc6ba96ae856c3ad12cfe0503e3d822482e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Modules/FindDoxygen.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jan 28 08:43:03 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 28 Jan 2019 08:43:03 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-1157-g8e49533 Message-ID: <20190128134303.3BD0D1276F3@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 8e495333c0914a0684d6d82e2cc15327c9f811f3 (commit) via ad0853b3d41bc8e0eae4f0baafab457ad52a9a7b (commit) from f677a3d7defdb82d79bca2faf09da6d9338773b3 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8e495333c0914a0684d6d82e2cc15327c9f811f3 commit 8e495333c0914a0684d6d82e2cc15327c9f811f3 Merge: f677a3d ad0853b Author: Brad King AuthorDate: Mon Jan 28 13:36:51 2019 +0000 Commit: Kitware Robot CommitDate: Mon Jan 28 08:36:58 2019 -0500 Merge topic 'cmake-gui-s-b' ad0853b3d4 QtDialog: Clean up and document -S and -B options Acked-by: Kitware Robot Acked-by: Robert Maynard Merge-request: !2863 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ad0853b3d41bc8e0eae4f0baafab457ad52a9a7b commit ad0853b3d41bc8e0eae4f0baafab457ad52a9a7b Author: Kyle Edwards AuthorDate: Fri Jan 25 10:53:18 2019 -0500 Commit: Kyle Edwards CommitDate: Fri Jan 25 16:23:56 2019 -0500 QtDialog: Clean up and document -S and -B options diff --git a/Help/manual/cmake-gui.1.rst b/Help/manual/cmake-gui.1.rst index 9322e33..856aa2f 100644 --- a/Help/manual/cmake-gui.1.rst +++ b/Help/manual/cmake-gui.1.rst @@ -10,6 +10,7 @@ Synopsis cmake-gui [] cmake-gui [] { | } + cmake-gui [] -S -B Description =========== @@ -27,6 +28,14 @@ native tool on their platform. Options ======= +``-S `` + Path to root directory of the CMake project to build. + +``-B `` + Path to directory which CMake will use as the root of build directory. + + If the directory doesn't already exist CMake will make it. + .. include:: OPTIONS_HELP.txt See Also diff --git a/Help/release/dev/cmake-gui-s-b.rst b/Help/release/dev/cmake-gui-s-b.rst new file mode 100644 index 0000000..9447eb3 --- /dev/null +++ b/Help/release/dev/cmake-gui-s-b.rst @@ -0,0 +1,5 @@ +cmake-gui-s-b +------------- + +* The :manual:`cmake-gui(1)` dialog gained new ``-S`` and ``-B`` arguments to + explicitly specify source and build directories. diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx index 9f4e48e..cd30ad5 100644 --- a/Source/QtDialog/CMakeSetup.cxx +++ b/Source/QtDialog/CMakeSetup.cxx @@ -30,7 +30,8 @@ static const char* cmDocumentationUsage[][2] = { { nullptr, " cmake-gui [options]\n" " cmake-gui [options] \n" - " cmake-gui [options] " }, + " cmake-gui [options] \n" + " cmake-gui [options] -S -B \n" }, { nullptr, nullptr } }; @@ -142,23 +143,53 @@ int main(int argc, char** argv) CMakeSetupDialog dialog; dialog.show(); - cmsys::CommandLineArguments arg; - arg.Initialize(argc2, argv2); + QStringList args = QApplication::arguments(); std::string binaryDirectory; std::string sourceDirectory; - typedef cmsys::CommandLineArguments argT; - arg.AddArgument("-B", argT::CONCAT_ARGUMENT, &binaryDirectory, - "Binary Directory"); - arg.AddArgument("-S", argT::CONCAT_ARGUMENT, &sourceDirectory, - "Source Directory"); - // do not complain about unknown options - arg.StoreUnusedArguments(true); - arg.Parse(); + for (int i = 1; i < args.size(); ++i) { + const QString& arg = args[i]; + if (arg.startsWith("-S")) { + QString path = arg.mid(2); + if (path.isEmpty()) { + ++i; + if (i >= args.size()) { + std::cerr << "No source directory specified for -S" << std::endl; + return 1; + } + path = args[i]; + if (path[0] == '-') { + std::cerr << "No source directory specified for -S" << std::endl; + return 1; + } + } + + sourceDirectory = + cmSystemTools::CollapseFullPath(path.toLocal8Bit().data()); + cmSystemTools::ConvertToUnixSlashes(sourceDirectory); + } else if (arg.startsWith("-B")) { + QString path = arg.mid(2); + if (path.isEmpty()) { + ++i; + if (i >= args.size()) { + std::cerr << "No build directory specified for -B" << std::endl; + return 1; + } + path = args[i]; + if (path[0] == '-') { + std::cerr << "No build directory specified for -B" << std::endl; + return 1; + } + } + + binaryDirectory = + cmSystemTools::CollapseFullPath(path.toLocal8Bit().data()); + cmSystemTools::ConvertToUnixSlashes(binaryDirectory); + } + } if (!sourceDirectory.empty() && !binaryDirectory.empty()) { dialog.setSourceDirectory(QString::fromLocal8Bit(sourceDirectory.c_str())); dialog.setBinaryDirectory(QString::fromLocal8Bit(binaryDirectory.c_str())); } else { - QStringList args = QApplication::arguments(); if (args.count() == 2) { std::string filePath = cmSystemTools::CollapseFullPath(args[1].toLocal8Bit().data()); ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-gui.1.rst | 9 +++++++ Help/release/dev/cmake-gui-s-b.rst | 5 ++++ Source/QtDialog/CMakeSetup.cxx | 55 +++++++++++++++++++++++++++++--------- 3 files changed, 57 insertions(+), 12 deletions(-) create mode 100644 Help/release/dev/cmake-gui-s-b.rst hooks/post-receive -- CMake From kwrobot at kitware.com Mon Jan 28 08:53:02 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 28 Jan 2019 08:53:02 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-1159-gfc96aa0 Message-ID: <20190128135302.E7833125D5E@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via fc96aa03f8a3d3133aaddab27bfc0b684594558b (commit) via 939dc9a58c5667ea18809c3a5e97ef1b60eb746c (commit) from 8e495333c0914a0684d6d82e2cc15327c9f811f3 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fc96aa03f8a3d3133aaddab27bfc0b684594558b commit fc96aa03f8a3d3133aaddab27bfc0b684594558b Merge: 8e49533 939dc9a Author: Brad King AuthorDate: Mon Jan 28 13:45:17 2019 +0000 Commit: Kitware Robot CommitDate: Mon Jan 28 08:45:24 2019 -0500 Merge topic 'commit-ref-in-prose' 939dc9a58c Help: prefer commit hashes in commit references Acked-by: Kitware Robot Merge-request: !2854 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=939dc9a58c5667ea18809c3a5e97ef1b60eb746c commit 939dc9a58c5667ea18809c3a5e97ef1b60eb746c Author: Ben Boeckel AuthorDate: Thu Jan 24 13:31:37 2019 -0500 Commit: Ben Boeckel CommitDate: Fri Jan 25 12:10:10 2019 -0500 Help: prefer commit hashes in commit references The logic is that the describe output is readily available using `git tag --contains` locally. In addition, for a hypothetical commit which landed in both v3.9.4 and v3.10.1, there is no "better" tag to refer to. since v3.10.0's relation to such a commit is unclear either way. Also mention that a `Fixes` trailer is preferred if the mention is just to indicate a commit which introduced an error rather than writing a complete sentence about it. diff --git a/Help/dev/review.rst b/Help/dev/review.rst index 0c4eded..1d664c4 100644 --- a/Help/dev/review.rst +++ b/Help/dev/review.rst @@ -238,12 +238,10 @@ Referencing Commits in Commit Messages ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The preferred form for references to other commits is -``commit (, )``, where: +``commit (, )``, where: -* ````: - If available, a tag-relative name of the commit produced by - ``git describe --contains ``. Otherwise, the first - 8-10 characters of the commit ````. +* ````: + The abbreviated hash of the commit. * ````: The first line of the commit message. @@ -252,6 +250,17 @@ The preferred form for references to other commits is The author date of the commit, in its original time zone, formatted as ``CCYY-MM-DD``. ``git-log(1)`` shows the original time zone by default. +This may be generated with +``git show -s --date=short --pretty="format:%h (%s, %ad)" ``. + +If the commit is a fix for the mentioned commit, consider using a ``Fixes:`` +trailer in the commit message with the specified format. This trailer should +not be word-wrapped. Note that if there is also an issue for what is being +fixed, it is preferrable to link to the issue instead. + +If relevant, add the first release tag of CMake containing the commit after +the ````, i.e., ``commit (, , )``. + Alternatively, the full commit ```` may be used. Revising Commit Messages ----------------------------------------------------------------------- Summary of changes: Help/dev/review.rst | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Tue Jan 29 00:03:05 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 29 Jan 2019 00:03:05 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-1160-g62c0b1a Message-ID: <20190129050305.62FB1128264@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 62c0b1aebb827fc8a133cedfa343322d28714501 (commit) from fc96aa03f8a3d3133aaddab27bfc0b684594558b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=62c0b1aebb827fc8a133cedfa343322d28714501 commit 62c0b1aebb827fc8a133cedfa343322d28714501 Author: Kitware Robot AuthorDate: Tue Jan 29 00:01:06 2019 -0500 Commit: Kitware Robot CommitDate: Tue Jan 29 00:01:06 2019 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 69c2ed0..0362d52 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 13) -set(CMake_VERSION_PATCH 20190128) +set(CMake_VERSION_PATCH 20190129) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Tue Jan 29 09:03:06 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 29 Jan 2019 09:03:06 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-1166-geeb3423 Message-ID: <20190129140306.CC85D11D5B2@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via eeb34232fc2b76dc8b9bde25b2ca696d91b51b5a (commit) via bcb1297faf4e4f7bab665b80bc49b8bbabf33a9f (commit) via 475e78d9071b34690617a85853433a9fc15da057 (commit) via 03dbb62d31d4a115fed09049cf6995ce89d2fabe (commit) via 5f34bdc7f9f1fd8cca69757b06b3de8fdb4930b7 (commit) via f16dfdf71f8f81e1be9c3ea18652d8d87c1cb265 (commit) from 62c0b1aebb827fc8a133cedfa343322d28714501 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=eeb34232fc2b76dc8b9bde25b2ca696d91b51b5a commit eeb34232fc2b76dc8b9bde25b2ca696d91b51b5a Merge: bcb1297 475e78d Author: Brad King AuthorDate: Tue Jan 29 13:59:32 2019 +0000 Commit: Kitware Robot CommitDate: Tue Jan 29 08:59:59 2019 -0500 Merge topic 'add-missing-macos-framework' 475e78d907 macOS: Add missing explicit dependency on CoreServices framework Acked-by: Kitware Robot Merge-request: !2873 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bcb1297faf4e4f7bab665b80bc49b8bbabf33a9f commit bcb1297faf4e4f7bab665b80bc49b8bbabf33a9f Merge: 62c0b1a 03dbb62 Author: Brad King AuthorDate: Tue Jan 29 13:58:59 2019 +0000 Commit: Kitware Robot CommitDate: Tue Jan 29 08:59:06 2019 -0500 Merge topic 'autogen_reenable_implicit_include_dirs' 03dbb62d31 Autogen: Reenable passing compiler implicit include directories to moc 5f34bdc7f9 cmLocalGenerator: Refactor `GetIncludeDirectoriesImplicit` method f16dfdf71f cmLocalGenerator: Simplify `GetIncludeDirectories` Acked-by: Kitware Robot Merge-request: !2864 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=475e78d9071b34690617a85853433a9fc15da057 commit 475e78d9071b34690617a85853433a9fc15da057 Author: Chuck Atkins AuthorDate: Mon Jan 28 16:28:28 2019 -0500 Commit: Brad King CommitDate: Tue Jan 29 06:59:24 2019 -0500 macOS: Add missing explicit dependency on CoreServices framework On Apple, the implementation of cmGlobalXCodeGenerator::Open uses LSOpenCFURLRef from CoreServices. This get's transitively pulled in from CMake's libuv build but ends up generating a linker error when using an external libuv. This explicitly adds the appropriate dependency. diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 311f3f4..8aff8f6 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -791,9 +791,10 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR MATCHES "sparc" endif() endif() -# On Apple we need CoreFoundation +# On Apple we need CoreFoundation and CoreServices if(APPLE) target_link_libraries(CMakeLib "-framework CoreFoundation") + target_link_libraries(CMakeLib "-framework CoreServices") endif() if(WIN32 AND NOT UNIX) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=03dbb62d31d4a115fed09049cf6995ce89d2fabe commit 03dbb62d31d4a115fed09049cf6995ce89d2fabe Author: Sebastian Holtermann AuthorDate: Fri Jan 25 19:09:45 2019 +0100 Commit: Brad King CommitDate: Mon Jan 28 08:41:37 2019 -0500 Autogen: Reenable passing compiler implicit include directories to moc Since commit 5990ecb741 (Compute implicit include directories from compiler output, 2018-12-07) we now have compiler implicit include directory computation for gcc and clang. It should be safe now to pass these to `moc`. This patch re-enables passing the compiler implicit include directories to `moc`, which was disabled due to issue #18669. Fixes: #18041 Issue: #18669 diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index 817f0b7..1d7f6d1 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -520,13 +520,10 @@ bool cmQtAutoGenInitializer::InitMoc() // Moc includes { - // We need to disable this until we have all implicit includes available. - // See issue #18669. - // bool const appendImplicit = (this->QtVersion.Major >= 5); - + bool const appendImplicit = (this->QtVersion.Major >= 5); auto GetIncludeDirs = - [this, localGen](std::string const& cfg) -> std::vector { - bool const appendImplicit = false; + [this, localGen, + appendImplicit](std::string const& cfg) -> std::vector { // Get the include dirs for this target, without stripping the implicit // include dirs off, see // https://gitlab.kitware.com/cmake/cmake/issues/13667 diff --git a/Tests/QtAutogen/MocOsMacros/TestClass.cpp b/Tests/QtAutogen/MocOsMacros/TestClass.cpp index 340d130..13f8fd9 100644 --- a/Tests/QtAutogen/MocOsMacros/TestClass.cpp +++ b/Tests/QtAutogen/MocOsMacros/TestClass.cpp @@ -1,6 +1,11 @@ #include "TestClass.hpp" #include +void TestClass::open() +{ + std::cout << "open\n"; +} + // -- Mac #ifndef Q_OS_MAC void TestClass::MacNotDef() diff --git a/Tests/QtAutogen/MocOsMacros/TestClass.hpp b/Tests/QtAutogen/MocOsMacros/TestClass.hpp index 53000aa..87fd494 100644 --- a/Tests/QtAutogen/MocOsMacros/TestClass.hpp +++ b/Tests/QtAutogen/MocOsMacros/TestClass.hpp @@ -3,12 +3,17 @@ #include #include +// include qplatformdefs.h for #18669 +#include class TestClass : public QObject { Q_OBJECT public Q_SLOTS: + // Method named "open" to test if #18669 is fixed + void open(); + // -- Mac #ifndef Q_OS_MAC void MacNotDef(); diff --git a/Tests/QtAutogen/Tests.cmake b/Tests/QtAutogen/Tests.cmake index c53fb4f..096d5e3 100644 --- a/Tests/QtAutogen/Tests.cmake +++ b/Tests/QtAutogen/Tests.cmake @@ -39,8 +39,7 @@ endif() # Qt5 only tests if(QT_TEST_VERSION GREATER 4) ADD_AUTOGEN_TEST(MocMacroName mocMacroName) - # Disabled for issue #18669 - #ADD_AUTOGEN_TEST(MocOsMacros) + ADD_AUTOGEN_TEST(MocOsMacros) ADD_AUTOGEN_TEST(RerunMocPlugin) if(APPLE) ADD_AUTOGEN_TEST(MacOsFW) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5f34bdc7f9f1fd8cca69757b06b3de8fdb4930b7 commit 5f34bdc7f9f1fd8cca69757b06b3de8fdb4930b7 Author: Sebastian Holtermann AuthorDate: Fri Jan 25 18:21:35 2019 +0100 Commit: Brad King CommitDate: Mon Jan 28 08:41:28 2019 -0500 cmLocalGenerator: Refactor `GetIncludeDirectoriesImplicit` method Use a dedicated `std::set` for implicit include directories instead of (ab)using the emitted variable. This in combination with lambdas makes it easier to comprehend which paths are emitted. For the implicit include directories we used to omit the `CMAKE_SYSROOT_COMPILE`/`CMAKE_SYSROOT` prefix. This has been changed and the implicit paths are returned prefixed. Implicit include directory returning is only ever used by QtAutoGen which requires prefixed paths. QtAutoGen passes the (implicit) include paths to the `moc` which isn't aware of `CMAKE_SYSROOT_COMPILE`/`CMAKE_SYSROOT`. diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index da72d9d..1122924 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -887,10 +887,21 @@ std::vector> cmLocalGenerator::GetIncludeDirectoriesImplicit( bool appendAllImplicitDirs) const { std::vector> result; - // Do not repeat an include path. std::set emitted; + auto emitDir = [&result, &emitted](std::string const& dir) { + if (emitted.insert(dir).second) { + result.emplace_back(dir); + } + }; + + auto emitBT = [&result, &emitted](BT const& dir) { + if (emitted.insert(dir.Value).second) { + result.emplace_back(dir); + } + }; + // When automatic include directories are requested for a build then // include the source and binary directories at the beginning of the // include path to approximate include file behavior for an @@ -900,21 +911,9 @@ std::vector> cmLocalGenerator::GetIncludeDirectoriesImplicit( // per-source-file include paths. if (this->Makefile->IsOn("CMAKE_INCLUDE_CURRENT_DIR")) { // Current binary directory - { - std::string binDir = - this->StateSnapshot.GetDirectory().GetCurrentBinary(); - if (emitted.insert(binDir).second) { - result.emplace_back(std::move(binDir)); - } - } + emitDir(this->StateSnapshot.GetDirectory().GetCurrentBinary()); // Current source directory - { - std::string srcDir = - this->StateSnapshot.GetDirectory().GetCurrentSource(); - if (emitted.insert(srcDir).second) { - result.emplace_back(std::move(srcDir)); - } - } + emitDir(this->StateSnapshot.GetDirectory().GetCurrentSource()); } if (!target) { @@ -923,6 +922,11 @@ std::vector> cmLocalGenerator::GetIncludeDirectoriesImplicit( // Implicit include directories std::vector implicitDirs; + std::set implicitSet; + // Checks if this is not an implicit include directory + auto notImplicit = [&implicitSet](std::string const& dir) { + return (implicitSet.find(dir) == implicitSet.end()); + }; { std::string rootPath; if (const char* sysrootCompile = @@ -932,6 +936,7 @@ std::vector> cmLocalGenerator::GetIncludeDirectoriesImplicit( rootPath = this->Makefile->GetSafeDefinition("CMAKE_SYSROOT"); } + // Raw list of implicit include directories std::vector impDirVec; // Get platform-wide implicit directories. @@ -949,12 +954,11 @@ std::vector> cmLocalGenerator::GetIncludeDirectoriesImplicit( } for (std::string const& i : impDirVec) { - { - std::string d = rootPath + i; - cmSystemTools::ConvertToUnixSlashes(d); - emitted.insert(std::move(d)); + std::string imd = rootPath + i; + cmSystemTools::ConvertToUnixSlashes(imd); + if (implicitSet.insert(imd).second) { + implicitDirs.emplace_back(std::move(imd)); } - implicitDirs.push_back(i); } } @@ -967,30 +971,31 @@ std::vector> cmLocalGenerator::GetIncludeDirectoriesImplicit( if (this->Makefile->IsOn("CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE")) { std::string const &topSourceDir = this->GetState()->GetSourceDirectory(), &topBinaryDir = this->GetState()->GetBinaryDirectory(); - for (BT const& i : userDirs) { + for (BT const& udr : userDirs) { // Emit this directory only if it is a subdirectory of the // top-level source or binary tree. - if (cmSystemTools::ComparePath(i.Value, topSourceDir) || - cmSystemTools::ComparePath(i.Value, topBinaryDir) || - cmSystemTools::IsSubDirectory(i.Value, topSourceDir) || - cmSystemTools::IsSubDirectory(i.Value, topBinaryDir)) { - if (emitted.insert(i.Value).second) { - result.push_back(i); + if (cmSystemTools::ComparePath(udr.Value, topSourceDir) || + cmSystemTools::ComparePath(udr.Value, topBinaryDir) || + cmSystemTools::IsSubDirectory(udr.Value, topSourceDir) || + cmSystemTools::IsSubDirectory(udr.Value, topBinaryDir)) { + if (notImplicit(udr.Value)) { + emitBT(udr); } } } } - // Construct the final ordered include directory list. - for (BT const& i : userDirs) { - if (emitted.insert(i.Value).second) { - result.push_back(i); + // Emit remaining non implicit user direcories. + for (BT const& udr : userDirs) { + if (notImplicit(udr.Value)) { + emitBT(udr); } } + // Sort result MoveSystemIncludesToEnd(result, config, lang, target); - // Add standard include directories for this language. + // Append standard include directories for this language. { std::vector userStandardDirs; { @@ -1001,26 +1006,27 @@ std::vector> cmLocalGenerator::GetIncludeDirectoriesImplicit( cmSystemTools::ExpandListArgument(value, userStandardDirs); } userDirs.reserve(userDirs.size() + userStandardDirs.size()); - for (std::string& d : userStandardDirs) { - cmSystemTools::ConvertToUnixSlashes(d); - result.emplace_back(d); - userDirs.emplace_back(std::move(d)); + for (std::string& usd : userStandardDirs) { + cmSystemTools::ConvertToUnixSlashes(usd); + if (notImplicit(usd)) { + emitDir(usd); + } + userDirs.emplace_back(std::move(usd)); } } + // Append compiler implicit include directories if (!stripImplicitDirs) { - // Append only implicit directories that were requested by the user - for (std::string const& i : implicitDirs) { - if (std::find(userDirs.begin(), userDirs.end(), i) != userDirs.end()) { - result.emplace_back(i); + // Append implicit directories that were requested by the user only + for (BT const& udr : userDirs) { + if (!notImplicit(udr.Value)) { + emitBT(udr); } } - // Append remaining implicit directories on demand + // Append remaining implicit directories (on demand) if (appendAllImplicitDirs) { - for (std::string const& i : implicitDirs) { - if (std::find(result.begin(), result.end(), i) == result.end()) { - result.emplace_back(i); - } + for (std::string& imd : implicitDirs) { + emitDir(imd); } } } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f16dfdf71f8f81e1be9c3ea18652d8d87c1cb265 commit f16dfdf71f8f81e1be9c3ea18652d8d87c1cb265 Author: Sebastian Holtermann AuthorDate: Fri Jan 25 15:03:31 2019 +0100 Commit: Brad King CommitDate: Mon Jan 28 08:41:28 2019 -0500 cmLocalGenerator: Simplify `GetIncludeDirectories` This patch strips the `stripImplicitDirs` and `appendAllImplicitDirs` parameters from the `cmLocalGenerator::GetIncludeDirectories` method and makes it a wrapper into the new `cmLocalGenerator::GetIncludeDirectoriesImplicit` method. `cmLocalGenerator::GetIncludeDirectoriesImplicit` is the renamed old implementation of `cmLocalGenerator::GetIncludeDirectories` and still accepts `stripImplicitDirs` and `appendAllImplicitDirs`. The motivation is that there's only *one* case where `cmLocalGenerator::GetIncludeDirectories` is called with the `stripImplicitDirs` parameter being `false` (QtAutoGen), but many other places where it is called using the `true` default value. QtAutoGen is modified to use `cmLocalGenerator::GetIncludeDirectoriesImplicit` directly. In two use cases of `cmLocalGenerator::GetIncludeDirectories` the manually set `true` value for `stripImplicitDirs` is removed. diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx index 3363c9b..4597d4f 100644 --- a/Source/cmFileAPICodemodel.cxx +++ b/Source/cmFileAPICodemodel.cxx @@ -727,7 +727,7 @@ void Target::ProcessLanguage(std::string const& lang) lg->GetTargetDefines(this->GT, this->Config, lang); cd.SetDefines(defines); std::vector> includePathList = - lg->GetIncludeDirectories(this->GT, lang, this->Config, true); + lg->GetIncludeDirectories(this->GT, lang, this->Config); for (BT const& i : includePathList) { cd.Includes.emplace_back( i, this->GT->IsSystemIncludeDirectory(i.Value, this->Config, lang)); diff --git a/Source/cmJsonObjects.cxx b/Source/cmJsonObjects.cxx index 135fd25..4b6b4d5 100644 --- a/Source/cmJsonObjects.cxx +++ b/Source/cmJsonObjects.cxx @@ -578,7 +578,7 @@ static Json::Value DumpTarget(cmGeneratorTarget* target, lg->GetTargetDefines(target, config, lang, defines); ld.SetDefines(defines); std::vector includePathList; - lg->GetIncludeDirectories(includePathList, target, lang, config, true); + lg->GetIncludeDirectories(includePathList, target, lang, config); for (std::string const& i : includePathList) { ld.IncludePathList.emplace_back( i, target->IsSystemIncludeDirectory(i, config, lang)); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 62aff99..da72d9d 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -881,22 +881,7 @@ void cmLocalGenerator::AddCompileOptions(std::string& flags, this->AddCompilerRequirementFlag(flags, target, lang); } -void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, - cmGeneratorTarget const* target, - const std::string& lang, - const std::string& config, - bool stripImplicitDirs, - bool appendAllImplicitDirs) const -{ - std::vector> tmp = this->GetIncludeDirectories( - target, lang, config, stripImplicitDirs, appendAllImplicitDirs); - dirs.reserve(tmp.size()); - for (BT& v : tmp) { - dirs.emplace_back(std::move(v.Value)); - } -} - -std::vector> cmLocalGenerator::GetIncludeDirectories( +std::vector> cmLocalGenerator::GetIncludeDirectoriesImplicit( cmGeneratorTarget const* target, std::string const& lang, std::string const& config, bool stripImplicitDirs, bool appendAllImplicitDirs) const @@ -1043,6 +1028,34 @@ std::vector> cmLocalGenerator::GetIncludeDirectories( return result; } +void cmLocalGenerator::GetIncludeDirectoriesImplicit( + std::vector& dirs, cmGeneratorTarget const* target, + const std::string& lang, const std::string& config, bool stripImplicitDirs, + bool appendAllImplicitDirs) const +{ + std::vector> tmp = this->GetIncludeDirectoriesImplicit( + target, lang, config, stripImplicitDirs, appendAllImplicitDirs); + dirs.reserve(dirs.size() + tmp.size()); + for (BT& v : tmp) { + dirs.emplace_back(std::move(v.Value)); + } +} + +std::vector> cmLocalGenerator::GetIncludeDirectories( + cmGeneratorTarget const* target, std::string const& lang, + std::string const& config) const +{ + return this->GetIncludeDirectoriesImplicit(target, lang, config); +} + +void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, + cmGeneratorTarget const* target, + const std::string& lang, + const std::string& config) const +{ + this->GetIncludeDirectoriesImplicit(dirs, target, lang, config); +} + void cmLocalGenerator::GetStaticLibraryFlags(std::string& flags, std::string const& config, std::string const& linkLanguage, diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index ebc613b..7cc7e37 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -239,22 +239,46 @@ public: return true; } - /** @brief Get the include directories for the current makefile and language. + /** @brief Get the include directories for the current makefile and language + * and optional the compiler implicit include directories. + * * @arg stripImplicitDirs Strip all directories found in * CMAKE__IMPLICIT_INCLUDE_DIRECTORIES from the result. * @arg appendAllImplicitDirs Append all directories found in * CMAKE__IMPLICIT_INCLUDE_DIRECTORIES to the result. */ + std::vector> GetIncludeDirectoriesImplicit( + cmGeneratorTarget const* target, std::string const& lang = "C", + std::string const& config = "", bool stripImplicitDirs = true, + bool appendAllImplicitDirs = false) const; + + /** @brief Get the include directories for the current makefile and language + * and optional the compiler implicit include directories. + * + * @arg dirs Directories are appended to this list + */ + void GetIncludeDirectoriesImplicit(std::vector& dirs, + cmGeneratorTarget const* target, + const std::string& lang = "C", + const std::string& config = "", + bool stripImplicitDirs = true, + bool appendAllImplicitDirs = false) const; + + /** @brief Get the include directories for the current makefile and language. + * @arg dirs Include directories are appended to this list + */ void GetIncludeDirectories(std::vector& dirs, cmGeneratorTarget const* target, const std::string& lang = "C", - const std::string& config = "", - bool stripImplicitDirs = true, - bool appendAllImplicitDirs = false) const; + const std::string& config = "") const; + + /** @brief Get the include directories for the current makefile and language. + * @return The include directory list + */ std::vector> GetIncludeDirectories( cmGeneratorTarget const* target, std::string const& lang = "C", - std::string const& config = "", bool stripImplicitDirs = true, - bool appendAllImplicitDirs = false) const; + std::string const& config = "") const; + void AddCompileOptions(std::string& flags, cmGeneratorTarget* target, const std::string& lang, const std::string& config); diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index e0795d2..817f0b7 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -531,8 +531,8 @@ bool cmQtAutoGenInitializer::InitMoc() // include dirs off, see // https://gitlab.kitware.com/cmake/cmake/issues/13667 std::vector dirs; - localGen->GetIncludeDirectories(dirs, this->Target, "CXX", cfg, false, - appendImplicit); + localGen->GetIncludeDirectoriesImplicit(dirs, this->Target, "CXX", cfg, + false, appendImplicit); return dirs; }; ----------------------------------------------------------------------- Summary of changes: Source/CMakeLists.txt | 3 +- Source/cmFileAPICodemodel.cxx | 2 +- Source/cmJsonObjects.cxx | 2 +- Source/cmLocalGenerator.cxx | 141 +++++++++++++++++------------- Source/cmLocalGenerator.h | 36 ++++++-- Source/cmQtAutoGenInitializer.cxx | 13 ++- Tests/QtAutogen/MocOsMacros/TestClass.cpp | 5 ++ Tests/QtAutogen/MocOsMacros/TestClass.hpp | 5 ++ Tests/QtAutogen/Tests.cmake | 3 +- 9 files changed, 130 insertions(+), 80 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Tue Jan 29 09:13:04 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 29 Jan 2019 09:13:04 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-1171-gfa7077e Message-ID: <20190129141304.2DF0111EB52@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via fa7077e7411f4f85724deae3427acb29be729567 (commit) via 0fd742a6ffa637b8ccac3b61b42bd10b2c3a87cc (commit) via 17cef3806d958bd03ec08b925fe585a0cfa204fa (commit) via bf774e521b0a08dd8e09a93f76471cad593db3c6 (commit) via 142e67eac64613a836dd21542963878104c9b088 (commit) from eeb34232fc2b76dc8b9bde25b2ca696d91b51b5a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fa7077e7411f4f85724deae3427acb29be729567 commit fa7077e7411f4f85724deae3427acb29be729567 Merge: eeb3423 0fd742a Author: Brad King AuthorDate: Tue Jan 29 14:05:44 2019 +0000 Commit: Kitware Robot CommitDate: Tue Jan 29 09:05:51 2019 -0500 Merge topic 'vs-host-arch' 0fd742a6ff VS: Teach VS 2019 generator to select host tools matching host arch 17cef3806d VS: Add support for explicit 32-bit toolset selection via host=x86 bf774e521b VS: Remove stray semicolons from VS 2019 implementation 142e67eac6 VS: Use internal abstraction for VCTargetsPath host arch Acked-by: Kitware Robot Merge-request: !2870 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0fd742a6ffa637b8ccac3b61b42bd10b2c3a87cc commit 0fd742a6ffa637b8ccac3b61b42bd10b2c3a87cc Author: Brad King AuthorDate: Mon Jan 28 10:49:16 2019 -0500 Commit: Brad King CommitDate: Mon Jan 28 12:58:21 2019 -0500 VS: Teach VS 2019 generator to select host tools matching host arch This generator is new so we can introduce the long-desired behavior of selecting ``host=x64`` tools by default on x64 hosts. diff --git a/Help/generator/Visual Studio 16 2019.rst b/Help/generator/Visual Studio 16 2019.rst index 9d3da8b..b456554 100644 --- a/Help/generator/Visual Studio 16 2019.rst +++ b/Help/generator/Visual Studio 16 2019.rst @@ -47,6 +47,7 @@ default. The :variable:`CMAKE_GENERATOR_TOOLSET` option may be set, perhaps via the :manual:`cmake(1)` ``-T`` option, to specify another toolset. .. |VS_TOOLSET_HOST_ARCH_DEFAULT| replace:: - By default this generator uses the 32-bit variant even on a 64-bit host. + By default this generator uses the 64-bit variant on x64 hosts and + the 32-bit variant otherwise. .. include:: VS_TOOLSET_HOST_ARCH.txt diff --git a/Help/release/dev/vs2019.rst b/Help/release/dev/vs2019.rst index 2072147..ee9a2f2 100644 --- a/Help/release/dev/vs2019.rst +++ b/Help/release/dev/vs2019.rst @@ -10,4 +10,5 @@ vs2019 in the generator name. Instead :variable:`CMAKE_GENERATOR_PLATFORM` must be used, e.g. through the ``-A`` command-line option. Furthermore, the default target platform (architecture) is now based on the *host* - platform. + platform. The VS host toolset selection is now based on the host + architecture as well. diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 4dae479..99e9173 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -607,10 +607,26 @@ cmGlobalVisualStudio10Generator::GetPlatformToolsetVersionString() const const char* cmGlobalVisualStudio10Generator::GetPlatformToolsetHostArchitecture() const { + std::string const& hostArch = + this->GetPlatformToolsetHostArchitectureString(); + if (hostArch.empty()) { + return nullptr; + } + return hostArch.c_str(); +} + +std::string const& +cmGlobalVisualStudio10Generator::GetPlatformToolsetHostArchitectureString() + const +{ if (!this->GeneratorToolsetHostArchitecture.empty()) { - return this->GeneratorToolsetHostArchitecture.c_str(); + return this->GeneratorToolsetHostArchitecture; } - return nullptr; + if (!this->DefaultPlatformToolsetHostArchitecture.empty()) { + return this->DefaultPlatformToolsetHostArchitecture; + } + static std::string const empty; + return empty; } const char* cmGlobalVisualStudio10Generator::GetPlatformToolsetCuda() const diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 7c8918a..f496357 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -58,6 +58,7 @@ public: /** The toolset host architecture name (e.g. x64 for 64-bit host tools). */ const char* GetPlatformToolsetHostArchitecture() const; + std::string const& GetPlatformToolsetHostArchitectureString() const; /** The cuda toolset version. */ const char* GetPlatformToolsetCuda() const; @@ -152,6 +153,7 @@ protected: std::string GeneratorToolsetHostArchitecture; std::string GeneratorToolsetCuda; std::string DefaultPlatformToolset; + std::string DefaultPlatformToolsetHostArchitecture; std::string WindowsTargetPlatformVersion; std::string SystemName; std::string SystemVersion; diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx index b019f39..bc6b453 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx +++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx @@ -11,10 +11,13 @@ #if defined(_M_ARM64) # define HOST_PLATFORM_NAME "ARM64" +# define HOST_TOOLS_ARCH "" #elif defined(_M_ARM) # define HOST_PLATFORM_NAME "ARM" +# define HOST_TOOLS_ARCH "" #elif defined(_M_IA64) # define HOST_PLATFORM_NAME "Itanium" +# define HOST_TOOLS_ARCH "" #else # include "cmsys/SystemInformation.hxx" #endif @@ -33,6 +36,20 @@ static std::string VSHostPlatformName() #endif } +static std::string VSHostArchitecture() +{ +#ifdef HOST_TOOLS_ARCH + return HOST_TOOLS_ARCH; +#else + cmsys::SystemInformation info; + if (info.Is64Bits()) { + return "x64"; + } else { + return "x86"; + } +#endif +} + static unsigned int VSVersionToMajor( cmGlobalVisualStudioGenerator::VSVersion v) { @@ -262,6 +279,7 @@ cmGlobalVisualStudioVersionedGenerator::cmGlobalVisualStudioVersionedGenerator( this->DefaultLinkFlagTableName = VSVersionToToolset(this->Version); if (this->Version >= cmGlobalVisualStudioGenerator::VS16) { this->DefaultPlatformName = VSHostPlatformName(); + this->DefaultPlatformToolsetHostArchitecture = VSHostArchitecture(); } } diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchNone-stdout.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchNone-stdout.txt index 576b40c..e5e6c8d 100644 --- a/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchNone-stdout.txt +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchNone-stdout.txt @@ -1,2 +1,2 @@ -- CMAKE_VS_PLATFORM_TOOLSET='Test Toolset' --- CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE='' +-- CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE='.*' diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchNone.cmake b/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchNone.cmake index 26926f9..085bb6b 100644 --- a/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchNone.cmake +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchNone.cmake @@ -1,2 +1,15 @@ message(STATUS "CMAKE_VS_PLATFORM_TOOLSET='${CMAKE_VS_PLATFORM_TOOLSET}'") message(STATUS "CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE='${CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE}'") + +if(CMAKE_GENERATOR MATCHES "Visual Studio 1[6]") + cmake_host_system_information(RESULT is_64_bit QUERY IS_64BIT) + if(is_64_bit) + if(NOT "${CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE}" STREQUAL "x64") + message(FATAL_ERROR "CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE is not 'x64' as expected.") + endif() + endif() +else() + if(NOT "${CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE}" STREQUAL "") + message(FATAL_ERROR "CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE is not empty as expected.") + endif() +endif() https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=17cef3806d958bd03ec08b925fe585a0cfa204fa commit 17cef3806d958bd03ec08b925fe585a0cfa204fa Author: Brad King AuthorDate: Mon Jan 28 10:44:51 2019 -0500 Commit: Brad King CommitDate: Mon Jan 28 11:22:50 2019 -0500 VS: Add support for explicit 32-bit toolset selection via host=x86 Generalize the ``host=x64`` option in `CMAKE_GENERATOR_TOOLSET` to also support ``host=x86``. diff --git a/Help/generator/VS_TOOLSET_HOST_ARCH.txt b/Help/generator/VS_TOOLSET_HOST_ARCH.txt index 5d13e77..4eb900f 100644 --- a/Help/generator/VS_TOOLSET_HOST_ARCH.txt +++ b/Help/generator/VS_TOOLSET_HOST_ARCH.txt @@ -1,6 +1,7 @@ For each toolset that comes with this version of Visual Studio, there are variants that are themselves compiled for 32-bit (x86) and 64-bit (x64) hosts -(independent of the architecture they target). By default Visual Studio -chooses the 32-bit variant even on a 64-bit host. One may request use of the -64-bit host tools by adding a ``host=x64`` option to the toolset specification. +(independent of the architecture they target). +|VS_TOOLSET_HOST_ARCH_DEFAULT| +One may explicitly request use of either the 32-bit or 64-bit host tools +by adding either ``host=x86`` or ``host=x64`` to the toolset specification. See the :variable:`CMAKE_GENERATOR_TOOLSET` variable for details. diff --git a/Help/generator/Visual Studio 12 2013.rst b/Help/generator/Visual Studio 12 2013.rst index d342c53..fb8e021 100644 --- a/Help/generator/Visual Studio 12 2013.rst +++ b/Help/generator/Visual Studio 12 2013.rst @@ -42,4 +42,7 @@ The ``v120`` toolset that comes with Visual Studio 12 2013 is selected by default. The :variable:`CMAKE_GENERATOR_TOOLSET` option may be set, perhaps via the :manual:`cmake(1)` ``-T`` option, to specify another toolset. +.. |VS_TOOLSET_HOST_ARCH_DEFAULT| replace:: + By default this generator uses the 32-bit variant even on a 64-bit host. + .. include:: VS_TOOLSET_HOST_ARCH.txt diff --git a/Help/generator/Visual Studio 14 2015.rst b/Help/generator/Visual Studio 14 2015.rst index 106b7c5..7383f7a 100644 --- a/Help/generator/Visual Studio 14 2015.rst +++ b/Help/generator/Visual Studio 14 2015.rst @@ -39,4 +39,7 @@ The ``v140`` toolset that comes with Visual Studio 14 2015 is selected by default. The :variable:`CMAKE_GENERATOR_TOOLSET` option may be set, perhaps via the :manual:`cmake(1)` ``-T`` option, to specify another toolset. +.. |VS_TOOLSET_HOST_ARCH_DEFAULT| replace:: + By default this generator uses the 32-bit variant even on a 64-bit host. + .. include:: VS_TOOLSET_HOST_ARCH.txt diff --git a/Help/generator/Visual Studio 15 2017.rst b/Help/generator/Visual Studio 15 2017.rst index 52c1fa0..7e6f0fb 100644 --- a/Help/generator/Visual Studio 15 2017.rst +++ b/Help/generator/Visual Studio 15 2017.rst @@ -56,4 +56,7 @@ The ``v141`` toolset that comes with Visual Studio 15 2017 is selected by default. The :variable:`CMAKE_GENERATOR_TOOLSET` option may be set, perhaps via the :manual:`cmake(1)` ``-T`` option, to specify another toolset. +.. |VS_TOOLSET_HOST_ARCH_DEFAULT| replace:: + By default this generator uses the 32-bit variant even on a 64-bit host. + .. include:: VS_TOOLSET_HOST_ARCH.txt diff --git a/Help/generator/Visual Studio 16 2019.rst b/Help/generator/Visual Studio 16 2019.rst index 6f2bc56..9d3da8b 100644 --- a/Help/generator/Visual Studio 16 2019.rst +++ b/Help/generator/Visual Studio 16 2019.rst @@ -46,4 +46,7 @@ The ``v142`` toolset that comes with Visual Studio 16 2019 is selected by default. The :variable:`CMAKE_GENERATOR_TOOLSET` option may be set, perhaps via the :manual:`cmake(1)` ``-T`` option, to specify another toolset. +.. |VS_TOOLSET_HOST_ARCH_DEFAULT| replace:: + By default this generator uses the 32-bit variant even on a 64-bit host. + .. include:: VS_TOOLSET_HOST_ARCH.txt diff --git a/Help/variable/CMAKE_GENERATOR_TOOLSET.rst b/Help/variable/CMAKE_GENERATOR_TOOLSET.rst index e9bc28b..e77f211 100644 --- a/Help/variable/CMAKE_GENERATOR_TOOLSET.rst +++ b/Help/variable/CMAKE_GENERATOR_TOOLSET.rst @@ -44,8 +44,8 @@ Supported pairs are: and above with the CUDA toolkit VS integration installed. See the :variable:`CMAKE_VS_PLATFORM_TOOLSET_CUDA` variable. -``host=x64`` - Request use of the native ``x64`` toolchain on ``x64`` hosts. +``host=`` + Specify the host tools architecture as ``x64`` or ``x86``. Supported by VS 2013 and above. See the :variable:`CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE` variable. diff --git a/Help/variable/CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE.rst b/Help/variable/CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE.rst index 9b59c52..99ac90d 100644 --- a/Help/variable/CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE.rst +++ b/Help/variable/CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE.rst @@ -3,8 +3,8 @@ CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE Visual Studio preferred tool architecture. -The :ref:`Visual Studio Generators` for VS 2013 and above support optional -selection of a 64-bit toolchain on 64-bit hosts by specifying a ``host=x64`` -value in the :variable:`CMAKE_GENERATOR_TOOLSET` option. CMake provides -the selected toolchain architecture preference in this variable (either -``x64`` or empty). +The :ref:`Visual Studio Generators` for VS 2013 and above support using +either the 32-bit or 64-bit host toolchains by specifying a ``host=x86`` +or ``host=x64`` value in the :variable:`CMAKE_GENERATOR_TOOLSET` option. +CMake provides the selected toolchain architecture preference in this +variable (``x86``, ``x64``, or empty). diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx index 8b50684..d9702c9 100644 --- a/Source/cmGlobalVisualStudio12Generator.cxx +++ b/Source/cmGlobalVisualStudio12Generator.cxx @@ -126,8 +126,8 @@ bool cmGlobalVisualStudio12Generator::MatchesGeneratorName( bool cmGlobalVisualStudio12Generator::ProcessGeneratorToolsetField( std::string const& key, std::string const& value) { - if (key == "host" && value == "x64") { - this->GeneratorToolsetHostArchitecture = "x64"; + if (key == "host" && (value == "x64" || value == "x86")) { + this->GeneratorToolsetHostArchitecture = value; return true; } return this->cmGlobalVisualStudio11Generator::ProcessGeneratorToolsetField( diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetHostArchTwice-stderr.txt b/Tests/RunCMake/GeneratorToolset/BadToolsetHostArchTwice-stderr.txt index 164d3aa..7067423 100644 --- a/Tests/RunCMake/GeneratorToolset/BadToolsetHostArchTwice-stderr.txt +++ b/Tests/RunCMake/GeneratorToolset/BadToolsetHostArchTwice-stderr.txt @@ -5,6 +5,6 @@ CMake Error at CMakeLists.txt:[0-9]+ \(project\): given toolset specification - Test Toolset,host=x64,host=x64 + Test Toolset,host=x64,host=x86 that contains duplicate field key 'host'\.$ diff --git a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake index ccf58b4..ef8fd25 100644 --- a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake @@ -16,14 +16,16 @@ if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[012456]") set(RunCMake_GENERATOR_TOOLSET "Test Toolset,host=x64") run_cmake(TestToolsetHostArchBoth) set(RunCMake_GENERATOR_TOOLSET ",host=x64") - run_cmake(TestToolsetHostArchOnly) + run_cmake(TestToolsetHostArchOnly_x64) set(RunCMake_GENERATOR_TOOLSET "host=x64") - run_cmake(TestToolsetHostArchOnly) + run_cmake(TestToolsetHostArchOnly_x64) + set(RunCMake_GENERATOR_TOOLSET "host=x86") + run_cmake(TestToolsetHostArchOnly_x86) set(RunCMake_GENERATOR_TOOLSET "Test Toolset") run_cmake(TestToolsetHostArchNone) set(RunCMake_GENERATOR_TOOLSET "Test Toolset,host=x65") run_cmake(BadToolsetHostArch) - set(RunCMake_GENERATOR_TOOLSET "Test Toolset,host=x64,host=x64") + set(RunCMake_GENERATOR_TOOLSET "Test Toolset,host=x64,host=x86") run_cmake(BadToolsetHostArchTwice) if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[56]") set(RunCMake_GENERATOR_TOOLSET "Test Toolset,version=Test Toolset Version") diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchOnly-stdout.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchOnly_x64-stdout.txt similarity index 100% rename from Tests/RunCMake/GeneratorToolset/TestToolsetHostArchOnly-stdout.txt rename to Tests/RunCMake/GeneratorToolset/TestToolsetHostArchOnly_x64-stdout.txt diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchOnly.cmake b/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchOnly_x64.cmake similarity index 100% copy from Tests/RunCMake/GeneratorToolset/TestToolsetHostArchOnly.cmake copy to Tests/RunCMake/GeneratorToolset/TestToolsetHostArchOnly_x64.cmake diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchOnly_x86-stdout.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchOnly_x86-stdout.txt new file mode 100644 index 0000000..c7293dc --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchOnly_x86-stdout.txt @@ -0,0 +1,2 @@ +-- CMAKE_VS_PLATFORM_TOOLSET='v[0-9]+' +-- CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE='x86' diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchOnly.cmake b/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchOnly_x86.cmake similarity index 100% rename from Tests/RunCMake/GeneratorToolset/TestToolsetHostArchOnly.cmake rename to Tests/RunCMake/GeneratorToolset/TestToolsetHostArchOnly_x86.cmake https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bf774e521b0a08dd8e09a93f76471cad593db3c6 commit bf774e521b0a08dd8e09a93f76471cad593db3c6 Author: Brad King AuthorDate: Mon Jan 28 11:21:23 2019 -0500 Commit: Brad King CommitDate: Mon Jan 28 11:22:31 2019 -0500 VS: Remove stray semicolons from VS 2019 implementation diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx index a83cc78..b019f39 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx +++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx @@ -10,11 +10,11 @@ #include "cmake.h" #if defined(_M_ARM64) -# define HOST_PLATFORM_NAME "ARM64"; +# define HOST_PLATFORM_NAME "ARM64" #elif defined(_M_ARM) -# define HOST_PLATFORM_NAME "ARM"; +# define HOST_PLATFORM_NAME "ARM" #elif defined(_M_IA64) -# define HOST_PLATFORM_NAME "Itanium"; +# define HOST_PLATFORM_NAME "Itanium" #else # include "cmsys/SystemInformation.hxx" #endif https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=142e67eac64613a836dd21542963878104c9b088 commit 142e67eac64613a836dd21542963878104c9b088 Author: Brad King AuthorDate: Mon Jan 28 10:32:06 2019 -0500 Commit: Brad King CommitDate: Mon Jan 28 11:16:02 2019 -0500 VS: Use internal abstraction for VCTargetsPath host arch Call our internal host architecture lookup method rather than directly accessing a member used by its implementation. diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 9a8014c..4dae479 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -786,10 +786,9 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf) } cmXMLElement(eprj, "Import") .Attribute("Project", "$(VCTargetsPath)\\Microsoft.Cpp.Default.props"); - if (!this->GeneratorToolsetHostArchitecture.empty()) { + if (const char* hostArch = this->GetPlatformToolsetHostArchitecture()) { cmXMLElement epg(eprj, "PropertyGroup"); - cmXMLElement(epg, "PreferredToolArchitecture") - .Content(this->GeneratorToolsetHostArchitecture); + cmXMLElement(epg, "PreferredToolArchitecture").Content(hostArch); } { cmXMLElement epg(eprj, "PropertyGroup"); ----------------------------------------------------------------------- Summary of changes: Help/generator/VS_TOOLSET_HOST_ARCH.txt | 7 +++--- Help/generator/Visual Studio 12 2013.rst | 3 +++ Help/generator/Visual Studio 14 2015.rst | 3 +++ Help/generator/Visual Studio 15 2017.rst | 3 +++ Help/generator/Visual Studio 16 2019.rst | 4 ++++ Help/release/dev/vs2019.rst | 3 ++- Help/variable/CMAKE_GENERATOR_TOOLSET.rst | 4 ++-- ...CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE.rst | 10 ++++----- Source/cmGlobalVisualStudio10Generator.cxx | 25 +++++++++++++++++----- Source/cmGlobalVisualStudio10Generator.h | 2 ++ Source/cmGlobalVisualStudio12Generator.cxx | 4 ++-- Source/cmGlobalVisualStudioVersionedGenerator.cxx | 24 ++++++++++++++++++--- .../BadToolsetHostArchTwice-stderr.txt | 2 +- Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake | 8 ++++--- .../TestToolsetHostArchNone-stdout.txt | 2 +- .../GeneratorToolset/TestToolsetHostArchNone.cmake | 13 +++++++++++ ....txt => TestToolsetHostArchOnly_x64-stdout.txt} | 0 ...nly.cmake => TestToolsetHostArchOnly_x64.cmake} | 0 .../TestToolsetHostArchOnly_x86-stdout.txt | 2 ++ ...nly.cmake => TestToolsetHostArchOnly_x86.cmake} | 0 20 files changed, 93 insertions(+), 26 deletions(-) rename Tests/RunCMake/GeneratorToolset/{TestToolsetHostArchOnly-stdout.txt => TestToolsetHostArchOnly_x64-stdout.txt} (100%) copy Tests/RunCMake/GeneratorToolset/{TestToolsetHostArchOnly.cmake => TestToolsetHostArchOnly_x64.cmake} (100%) create mode 100644 Tests/RunCMake/GeneratorToolset/TestToolsetHostArchOnly_x86-stdout.txt rename Tests/RunCMake/GeneratorToolset/{TestToolsetHostArchOnly.cmake => TestToolsetHostArchOnly_x86.cmake} (100%) hooks/post-receive -- CMake From kwrobot at kitware.com Tue Jan 29 09:23:04 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 29 Jan 2019 09:23:04 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-1188-g9620cb9 Message-ID: <20190129142304.D04F811E54D@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 9620cb935a49e7b4955f5b1d0ffa2e93b4327591 (commit) via 60c06620a690f0cbeeaa3fba762e19cd031669ca (commit) via 90ac5e6384735deb0ac523684010b2f4701d4f4d (commit) via e7be5638a04ad6e47aafaed29139c6382fdea1cb (commit) via 5134e11ee4291c1eb53aa5014af2af75a2e33f3b (commit) via 66801f4d40227c46904ad54848bd1da959604cbf (commit) via 439fe2e253410305ff7018416ff5ff26aa851d53 (commit) via 186d9b083db0e3fc77d9d92821e3cf45e06271da (commit) via 2fc69ba0b33e8f5f1b6301f37fc1479fba420b93 (commit) via 0e2cdacf7b51c915acd1a2a9e58a080d2667b4cb (commit) via f2ddedfa5802c8aece994bb643b5139212d87777 (commit) via 438651506a5417be70e71f54f4ed7add0c2604d3 (commit) via b6a957c9696706a338cdeef63540bf8a4c42d22d (commit) via 638667efa2b0e5fff5c63bf936748a60b602ae90 (commit) via 3ca44029668c057fb208c5f153c4d398bee954cb (commit) via cb6c233eccfbb600ec16716224062627df2ff2c0 (commit) via 1a45266cb544d73a7d7e46d6129ead1faf71fa85 (commit) from fa7077e7411f4f85724deae3427acb29be729567 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9620cb935a49e7b4955f5b1d0ffa2e93b4327591 commit 9620cb935a49e7b4955f5b1d0ffa2e93b4327591 Merge: 60c0662 66801f4 Author: Brad King AuthorDate: Tue Jan 29 14:19:31 2019 +0000 Commit: Kitware Robot CommitDate: Tue Jan 29 09:19:39 2019 -0500 Merge topic 'add_consistent_verbose_build_flag' 66801f4d40 cmake: Add tests for verbose output to --build mode 439fe2e253 cmake: Add options for verbose output to --build mode 638667efa2 cmake: cmcmd.cxx fix "The arguments are" comments 3ca4402966 ctest: Fix --build-and-test without --build-target on Xcode cb6c233ecc cmake: Add -hideShellScriptEnvironment xcodebuild option 1a45266cb5 cmGlobalGenerator: Add a class that represent the build command Acked-by: Kitware Robot Merge-request: !2708 diff --cc Source/cmGlobalUnixMakefileGenerator3.cxx index 3ca2b17,6989b51..dac6ea6 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@@ -531,11 -532,11 +537,11 @@@ void cmGlobalUnixMakefileGenerator3::Ge if (fast) { tname += "/fast"; } - cmOutputConverter conv(mf->GetStateSnapshot()); tname = - conv.ConvertToRelativePath(mf->GetState()->GetBinaryDirectory(), tname); + mf->GetStateSnapshot().GetDirectory().ConvertToRelPathIfNotContained( + mf->GetState()->GetBinaryDirectory(), tname); cmSystemTools::ConvertToOutputSlashes(tname); - makeCommand.push_back(std::move(tname)); + makeCommand.add(std::move(tname)); } } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=60c06620a690f0cbeeaa3fba762e19cd031669ca commit 60c06620a690f0cbeeaa3fba762e19cd031669ca Merge: 90ac5e6 b6a957c Author: Brad King AuthorDate: Tue Jan 29 14:17:13 2019 +0000 Commit: Kitware Robot CommitDate: Tue Jan 29 09:18:42 2019 -0500 Merge topic 'cmoutputconverter-simplify' b6a957c969 cmOutputConverter: move ConvertToRelativePath to cmStateDirectory. Acked-by: Kitware Robot Merge-request: !2831 diff --cc Source/cmGlobalUnixMakefileGenerator3.cxx index 792adc0,9d176c3..3ca2b17 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@@ -363,9 -367,10 +367,10 @@@ void cmGlobalUnixMakefileGenerator3::Wr for (cmLocalGenerator* localGen : this->LocalGenerators) { lg = static_cast(localGen); tmpStr = lg->GetCurrentBinaryDirectory(); - tmpStr += cmake::GetCMakeFilesDirectory(); + tmpStr += "/CMakeFiles"; tmpStr += "/CMakeDirectoryInformation.cmake"; - cmakefileStream << " \"" << lg->ConvertToRelativePath(binDir, tmpStr) + cmakefileStream << " \"" + << lg->MaybeConvertToRelativePath(binDir, tmpStr) << "\"\n"; } cmakefileStream << " )\n\n"; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=90ac5e6384735deb0ac523684010b2f4701d4f4d commit 90ac5e6384735deb0ac523684010b2f4701d4f4d Merge: e7be563 186d9b0 Author: Brad King AuthorDate: Tue Jan 29 14:16:56 2019 +0000 Commit: Kitware Robot CommitDate: Tue Jan 29 09:17:51 2019 -0500 Merge topic 'message-stdstring' 186d9b083d cmSystemTools::Message: Add overload accepting std::string Acked-by: Kitware Robot Merge-request: !2869 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e7be5638a04ad6e47aafaed29139c6382fdea1cb commit e7be5638a04ad6e47aafaed29139c6382fdea1cb Merge: 5134e11 2fc69ba Author: Brad King AuthorDate: Tue Jan 29 14:16:51 2019 +0000 Commit: Kitware Robot CommitDate: Tue Jan 29 09:16:58 2019 -0500 Merge topic 'ftc-string' 2fc69ba0b3 cmFileTimeComparison: use std::string arguments Acked-by: Kitware Robot Merge-request: !2868 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5134e11ee4291c1eb53aa5014af2af75a2e33f3b commit 5134e11ee4291c1eb53aa5014af2af75a2e33f3b Merge: fa7077e 0e2cdac Author: Brad King AuthorDate: Tue Jan 29 14:15:31 2019 +0000 Commit: Kitware Robot CommitDate: Tue Jan 29 09:15:44 2019 -0500 Merge topic 'update-tutorial' 0e2cdacf7b Tests: Update style of c++ code snippets in Tutorial directions f2ddedfa58 Tests: Update CMake tutorial 438651506a Tests: Make ExternalProjectLocal independent of Tutorial directory Acked-by: Kitware Robot Merge-request: !2731 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=66801f4d40227c46904ad54848bd1da959604cbf commit 66801f4d40227c46904ad54848bd1da959604cbf Author: Robert Maynard AuthorDate: Thu Jan 24 13:31:32 2019 -0500 Commit: Brad King CommitDate: Mon Jan 28 10:01:55 2019 -0500 cmake: Add tests for verbose output to --build mode diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index bf18efe..76dd997 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -123,7 +123,7 @@ if(NOT CMAKE_GENERATOR MATCHES "Visual Studio|Xcode") add_RunCMake_test(CMP0065) endif() if(CMAKE_GENERATOR MATCHES "Make") - add_RunCMake_test(Make) + add_RunCMake_test(Make -DMAKE_IS_GNU=${MAKE_IS_GNU}) endif() if(CMAKE_GENERATOR STREQUAL "Ninja") set(Ninja_ARGS diff --git a/Tests/RunCMake/Make/RunCMakeTest.cmake b/Tests/RunCMake/Make/RunCMakeTest.cmake index 3b2b8f5..82db6b7 100644 --- a/Tests/RunCMake/Make/RunCMakeTest.cmake +++ b/Tests/RunCMake/Make/RunCMakeTest.cmake @@ -16,5 +16,22 @@ run_TargetMessages(OFF) run_TargetMessages(VAR-ON -DCMAKE_TARGET_MESSAGES=ON) run_TargetMessages(VAR-OFF -DCMAKE_TARGET_MESSAGES=OFF) +function(run_VerboseBuild) + run_cmake(VerboseBuild) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/VerboseBuild-build) + if(RunCMake_GENERATOR STREQUAL "Watcom WMake") + # wmake does not actually show the verbose output. + set(RunCMake-stdout-file VerboseBuild-build-watcom-stdout.txt) + endif() + run_cmake_command(VerboseBuild-build ${CMAKE_COMMAND} --build . -v --clean-first) + unset(RunCMake-stdout-file) + if(MAKE_IS_GNU) + set(RunCMake-stdout-file VerboseBuild-nowork-gnu-stdout.txt) + endif() + run_cmake_command(VerboseBuild-nowork ${CMAKE_COMMAND} --build . --verbose) +endfunction() +run_VerboseBuild() + run_cmake(CustomCommandDepfile-ERROR) run_cmake(IncludeRegexSubdir) diff --git a/Tests/RunCMake/Make/VerboseBuild-build-stdout.txt b/Tests/RunCMake/Make/VerboseBuild-build-stdout.txt new file mode 100644 index 0000000..884bf95 --- /dev/null +++ b/Tests/RunCMake/Make/VerboseBuild-build-stdout.txt @@ -0,0 +1 @@ +.*DEFINE_FOR_VERBOSE_DETECTION.*hello.dir.* diff --git a/Tests/RunCMake/Make/VerboseBuild-build-watcom-stdout.txt b/Tests/RunCMake/Make/VerboseBuild-build-watcom-stdout.txt new file mode 100644 index 0000000..9c558e3 --- /dev/null +++ b/Tests/RunCMake/Make/VerboseBuild-build-watcom-stdout.txt @@ -0,0 +1 @@ +. diff --git a/Tests/RunCMake/Make/VerboseBuild-nowork-gnu-stdout.txt b/Tests/RunCMake/Make/VerboseBuild-nowork-gnu-stdout.txt new file mode 100644 index 0000000..3e65cd9 --- /dev/null +++ b/Tests/RunCMake/Make/VerboseBuild-nowork-gnu-stdout.txt @@ -0,0 +1 @@ +.*Nothing to be done for.*hello.* diff --git a/Tests/RunCMake/Make/VerboseBuild.cmake b/Tests/RunCMake/Make/VerboseBuild.cmake new file mode 100644 index 0000000..70a971d --- /dev/null +++ b/Tests/RunCMake/Make/VerboseBuild.cmake @@ -0,0 +1,8 @@ +enable_language(C) + +# Make sure compile command is not hidden in a temp file. +string(REPLACE "${CMAKE_START_TEMP_FILE}" "" CMAKE_C_COMPILE_OBJECT "${CMAKE_C_COMPILE_OBJECT}") +string(REPLACE "${CMAKE_END_TEMP_FILE}" "" CMAKE_C_COMPILE_OBJECT "${CMAKE_C_COMPILE_OBJECT}") + +add_executable(hello hello.c) +target_compile_definitions(hello PRIVATE "DEFINE_FOR_VERBOSE_DETECTION") diff --git a/Tests/RunCMake/Make/hello.c b/Tests/RunCMake/Make/hello.c new file mode 100644 index 0000000..aac8b4e --- /dev/null +++ b/Tests/RunCMake/Make/hello.c @@ -0,0 +1,7 @@ +#include + +int main(void) +{ + printf("Hello world!\n"); + return 0; +} diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake index 9e1e9a5..8fa650a 100644 --- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake +++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake @@ -30,6 +30,15 @@ function(run_NoWorkToDo) endfunction() run_NoWorkToDo() +function(run_VerboseBuild) + run_cmake(VerboseBuild) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/VerboseBuild-build) + run_cmake_command(VerboseBuild-build ${CMAKE_COMMAND} --build . -v --clean-first) + run_cmake_command(VerboseBuild-nowork ${CMAKE_COMMAND} --build . --verbose) +endfunction() +run_VerboseBuild() + function(run_CMP0058 case) # Use a single build tree for a few tests without cleaning. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CMP0058-${case}-build) diff --git a/Tests/RunCMake/Ninja/VerboseBuild-build-stdout.txt b/Tests/RunCMake/Ninja/VerboseBuild-build-stdout.txt new file mode 100644 index 0000000..884bf95 --- /dev/null +++ b/Tests/RunCMake/Ninja/VerboseBuild-build-stdout.txt @@ -0,0 +1 @@ +.*DEFINE_FOR_VERBOSE_DETECTION.*hello.dir.* diff --git a/Tests/RunCMake/Ninja/VerboseBuild-nowork-stdout.txt b/Tests/RunCMake/Ninja/VerboseBuild-nowork-stdout.txt new file mode 100644 index 0000000..60a9228 --- /dev/null +++ b/Tests/RunCMake/Ninja/VerboseBuild-nowork-stdout.txt @@ -0,0 +1 @@ +^ninja: no work to do diff --git a/Tests/RunCMake/Ninja/VerboseBuild.cmake b/Tests/RunCMake/Ninja/VerboseBuild.cmake new file mode 100644 index 0000000..424e54e --- /dev/null +++ b/Tests/RunCMake/Ninja/VerboseBuild.cmake @@ -0,0 +1,3 @@ +enable_language(C) +add_executable(hello hello.c) +target_compile_definitions(hello PRIVATE "DEFINE_FOR_VERBOSE_DETECTION") https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=439fe2e253410305ff7018416ff5ff26aa851d53 commit 439fe2e253410305ff7018416ff5ff26aa851d53 Author: Florian Maushart AuthorDate: Thu Jan 24 13:31:18 2019 -0500 Commit: Brad King CommitDate: Mon Jan 28 09:44:50 2019 -0500 cmake: Add options for verbose output to --build mode While we already support `VERBOSE` environment variable and `CMAKE_VERBOSE_MAKEFILE` cached variable, add `-v` and `--verbose` command line options to be able to activate verbose output directly from CMake's build tool mode command line. Also make `msbuild` honor the verbosity setting. `xcodebuild` still doesn't honor the verbosity setting as it will need a policy added and reworking of cmGlobalGenerator and cmsys to support multiple command invocation. diff --git a/Help/envvar/CMAKE_NO_VERBOSE.rst b/Help/envvar/CMAKE_NO_VERBOSE.rst new file mode 100644 index 0000000..149efbd --- /dev/null +++ b/Help/envvar/CMAKE_NO_VERBOSE.rst @@ -0,0 +1,8 @@ +CMAKE_NO_VERBOSE +---------------- + +Disables verbose output from CMake when :envvar:`VERBOSE` environment variable +is set. + +Only your build tool of choice will still print verbose output when you start +to actually build your project. diff --git a/Help/envvar/VERBOSE.rst b/Help/envvar/VERBOSE.rst new file mode 100644 index 0000000..2d775a5 --- /dev/null +++ b/Help/envvar/VERBOSE.rst @@ -0,0 +1,10 @@ +VERBOSE +------- + +Activates verbose output from CMake and your build tools of choice when +you start to actually build your project. + +Note that any given value is ignored. It's just checked for existence. + +See also :ref:`Build Tool Mode ` and +:envvar:`CMAKE_NO_VERBOSE` environment variable diff --git a/Help/manual/cmake-env-variables.7.rst b/Help/manual/cmake-env-variables.7.rst index edf80f4..c433412 100644 --- a/Help/manual/cmake-env-variables.7.rst +++ b/Help/manual/cmake-env-variables.7.rst @@ -24,11 +24,13 @@ Environment Variables that Control the Build /envvar/CMAKE_BUILD_PARALLEL_LEVEL /envvar/CMAKE_CONFIG_TYPE /envvar/CMAKE_MSVCIDE_RUN_PATH + /envvar/CMAKE_NO_VERBOSE /envvar/CMAKE_OSX_ARCHITECTURES /envvar/DESTDIR /envvar/LDFLAGS /envvar/MACOSX_DEPLOYMENT_TARGET /envvar/PackageName_ROOT + /envvar/VERBOSE Environment Variables for Languages =================================== diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst index 915e0d4..77178b8 100644 --- a/Help/manual/cmake.1.rst +++ b/Help/manual/cmake.1.rst @@ -289,6 +289,14 @@ following options: ``--use-stderr`` Ignored. Behavior is default in CMake >= 3.0. +``-v, --verbose`` + Enable verbose output - if supported - including the build commands to be + executed. + + This option can be omitted if :envvar:`VERBOSE` environment variable or + :variable:`CMAKE_VERBOSE_MAKEFILE` cached variable is set. + + ``--`` Pass remaining options to the native tool. diff --git a/Help/release/dev/cmake-build-verbose.rst b/Help/release/dev/cmake-build-verbose.rst new file mode 100644 index 0000000..dee212e --- /dev/null +++ b/Help/release/dev/cmake-build-verbose.rst @@ -0,0 +1,6 @@ +cmake-build-verbose +------------------- + +* The :manual:`cmake(1)` :ref:`Build Tool Mode` (``cmake --build``) gained + ``--verbose`` and ``-v`` options to specify verbose build output. Some + generators such as Xcode don't support this option currently. diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 9fc60e7..6989b51 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -493,7 +493,7 @@ void cmGlobalUnixMakefileGenerator3::GenerateBuildCommand( GeneratedMakeCommand& makeCommand, const std::string& makeProgram, const std::string& /*projectName*/, const std::string& /*projectDir*/, const std::string& targetName, const std::string& /*config*/, bool fast, - int jobs, bool /*verbose*/, std::vector const& makeOptions) + int jobs, bool verbose, std::vector const& makeOptions) { std::unique_ptr mfu; cmMakefile* mf; @@ -510,6 +510,13 @@ void cmGlobalUnixMakefileGenerator3::GenerateBuildCommand( mf = mfu.get(); } + // Make it possible to set verbosity also from command line + if (verbose) { + makeCommand.add(cmSystemTools::GetCMakeCommand()); + makeCommand.add("-E"); + makeCommand.add("env"); + makeCommand.add("VERBOSE=1"); + } makeCommand.add(this->SelectMakeProgram(makeProgram)); if (jobs != cmake::NO_BUILD_PARALLEL_LEVEL) { diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 051ef18..60b2258 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -961,6 +961,10 @@ void cmGlobalVisualStudio10Generator::GenerateBuildCommand( makeCommand.add("/p:CL_MPCount=1"); } + // Respect the verbosity: 'n' normal will show build commands + // 'm' minimal only the build step's title + makeCommand.add(std::string("/v:") + ((verbose) ? "n" : "m")); + makeCommand.add(makeOptions.begin(), makeOptions.end()); } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 914c3b0..411ba3a 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2539,7 +2539,8 @@ cmMessenger* cmake::GetMessenger() const int cmake::Build(int jobs, const std::string& dir, const std::string& target, const std::string& config, - const std::vector& nativeOptions, bool clean) + const std::vector& nativeOptions, bool clean, + bool verbose) { this->SetHomeDirectory(""); @@ -2592,11 +2593,11 @@ int cmake::Build(int jobs, const std::string& dir, const std::string& target, return 1; } projName = cachedProjectName; - bool verbose = false; + const char* cachedVerbose = this->State->GetCacheEntryValue("CMAKE_VERBOSE_MAKEFILE"); - if (cachedVerbose) { - verbose = cmSystemTools::IsOn(cachedVerbose); + if (cmSystemTools::IsOn(cachedVerbose)) { + verbose = true; } #ifdef CMAKE_HAVE_VS_GENERATORS diff --git a/Source/cmake.h b/Source/cmake.h index 9478ad0e..7ec1b64 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -430,7 +430,8 @@ public: ///! run the --build option int Build(int jobs, const std::string& dir, const std::string& target, const std::string& config, - const std::vector& nativeOptions, bool clean); + const std::vector& nativeOptions, bool clean, + bool verbose); ///! run the --open option bool Open(const std::string& dir, bool dryRun); diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 0c25498..0ec2552 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -68,6 +68,8 @@ static const char* cmDocumentationUsageNote[][2] = { " --clean-first = Build target 'clean' first, then build.\n" \ " (To clean only, use --target 'clean'.)\n" \ " --use-stderr = Ignored. Behavior is default in CMake >= 3.0.\n" \ + " -v --verbose = Enable verbose output - if supported - including\n" \ + " the build commands to be executed. \n" \ " -- = Pass remaining options to the native tool.\n" static const char* cmDocumentationOptions[][2] = { @@ -395,6 +397,7 @@ static int do_build(int ac, char const* const* av) std::string dir; std::vector nativeOptions; bool clean = false; + bool verbose = cmSystemTools::HasEnv("VERBOSE"); bool hasTarget = false; enum Doing @@ -435,6 +438,10 @@ static int do_build(int ac, char const* const* av) } else if (strcmp(av[i], "--clean-first") == 0) { clean = true; doing = DoingNone; + } else if ((strcmp(av[i], "--verbose") == 0) || + (strcmp(av[i], "-v") == 0)) { + verbose = true; + doing = DoingNone; } else if (strcmp(av[i], "--use-stderr") == 0) { /* tolerate legacy option */ } else if (strcmp(av[i], "--") == 0) { @@ -493,7 +500,7 @@ static int do_build(int ac, char const* const* av) cmake cm(cmake::RoleInternal, cmState::Unknown); cmSystemTools::SetMessageCallback(cmakemainMessageCallback, &cm); cm.SetProgressCallback(cmakemainProgressCallback, &cm); - return cm.Build(jobs, dir, target, config, nativeOptions, clean); + return cm.Build(jobs, dir, target, config, nativeOptions, clean, verbose); #endif } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=186d9b083db0e3fc77d9d92821e3cf45e06271da commit 186d9b083db0e3fc77d9d92821e3cf45e06271da Author: Vitaly Stakhovsky AuthorDate: Mon Jan 28 09:35:51 2019 -0500 Commit: Vitaly Stakhovsky CommitDate: Mon Jan 28 09:35:51 2019 -0500 cmSystemTools::Message: Add overload accepting std::string diff --git a/Source/cmCallVisualStudioMacro.cxx b/Source/cmCallVisualStudioMacro.cxx index ecfcfb9..ee5feee 100644 --- a/Source/cmCallVisualStudioMacro.cxx +++ b/Source/cmCallVisualStudioMacro.cxx @@ -46,7 +46,7 @@ static bool LogErrorsAsMessages; << std::endl; \ _hresult_oss.flags(std::ios::dec); \ _hresult_oss << __FILE__ << "(" << __LINE__ << ")"; \ - cmSystemTools::Message(_hresult_oss.str().c_str()); \ + cmSystemTools::Message(_hresult_oss.str()); \ } \ } @@ -446,7 +446,7 @@ int cmCallVisualStudioMacro::CallMacro(const std::string& slnFile, if (err && LogErrorsAsMessages) { std::ostringstream oss; oss << "cmCallVisualStudioMacro::CallMacro failed, err = " << err; - cmSystemTools::Message(oss.str().c_str()); + cmSystemTools::Message(oss.str()); } return 0; diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index c68bb21..3d61665 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -1282,7 +1282,7 @@ void cmComputeLinkInformation::DropDirectoryItem(std::string const& item) << "\" requests linking to directory \"" << item << "\". " << "Targets may link only to libraries. " << "CMake is dropping the item."; - cmSystemTools::Message(e.str().c_str()); + cmSystemTools::Message(e.str()); } void cmComputeLinkInformation::ComputeFrameworkInfo() diff --git a/Source/cmFLTKWrapUICommand.cxx b/Source/cmFLTKWrapUICommand.cxx index effb446..4b14d26 100644 --- a/Source/cmFLTKWrapUICommand.cxx +++ b/Source/cmFLTKWrapUICommand.cxx @@ -117,7 +117,7 @@ void cmFLTKWrapUICommand::FinalPass() msg += ". The problem was found while processing the source directory: "; msg += this->Makefile->GetCurrentSourceDirectory(); msg += ". This FLTK_WRAP_UI call will be ignored."; - cmSystemTools::Message(msg.c_str(), "Warning"); + cmSystemTools::Message(msg, "Warning"); return; } } diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index 19605e4..c253937 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -67,7 +67,7 @@ void cmGhsMultiTargetGenerator::Generate() case cmStateEnums::SHARED_LIBRARY: { std::string msg = "add_library( SHARED ...) not supported: "; msg += this->Name; - cmSystemTools::Message(msg.c_str()); + cmSystemTools::Message(msg); return; } case cmStateEnums::OBJECT_LIBRARY: { @@ -84,13 +84,13 @@ void cmGhsMultiTargetGenerator::Generate() case cmStateEnums::MODULE_LIBRARY: { std::string msg = "add_library( MODULE ...) not supported: "; msg += this->Name; - cmSystemTools::Message(msg.c_str()); + cmSystemTools::Message(msg); return; } case cmStateEnums::UTILITY: { std::string msg = "add_custom_target( ...) not supported: "; msg += this->Name; - cmSystemTools::Message(msg.c_str()); + cmSystemTools::Message(msg); return; } default: diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 04af013..58d0971 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1060,7 +1060,7 @@ void cmGlobalGenerator::SetLanguageEnabledMaps(const std::string& l, if (preference < 0) { std::string msg = linkerPrefVar; msg += " is negative, adjusting it to 0"; - cmSystemTools::Message(msg.c_str(), "Warning"); + cmSystemTools::Message(msg, "Warning"); preference = 0; } diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 7963c8a..bb8b772 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -70,7 +70,7 @@ bool cmGlobalGhsMultiGenerator::SetGeneratorToolset(std::string const& ts, "Green Hills MULTI: -T not specified; defaulting to \""; message += tsp; message += "\""; - cmSystemTools::Message(message.c_str()); + cmSystemTools::Message(message); /* store the full toolset for later use * -- already done if -T was specified diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index cbea3dd..e3dd2f9 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -268,7 +268,7 @@ void cmGlobalVisualStudioGenerator::ConfigureCMakeVisualStudioMacros() std::ostringstream oss; oss << "Could not copy from: " << src << std::endl; oss << " to: " << dst << std::endl; - cmSystemTools::Message(oss.str().c_str(), "Warning"); + cmSystemTools::Message(oss.str(), "Warning"); } } @@ -783,7 +783,7 @@ void RegisterVisualStudioMacros(const std::string& macrosFile, << "CMake needs to register Visual Studio macros when its macros" << " file is updated or when it detects that its current macros file" << " is no longer registered with Visual Studio." << std::endl; - cmSystemTools::Message(oss.str().c_str(), "Warning"); + cmSystemTools::Message(oss.str(), "Warning"); // Count them again now that the warning is over. In the case of a GUI // warning, the user may have gone to close Visual Studio and then come diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index c6f4064..8ef6441 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -712,7 +712,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector const& args) std::ostringstream e; e << "INSTALL TARGETS - target " << target.GetName() << " has " << "RESOURCE files but no RESOURCE DESTINATION."; - cmSystemTools::Message(e.str().c_str(), "Warning"); + cmSystemTools::Message(e.str(), "Warning"); } } } diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index d1d4316..3497814 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -51,7 +51,7 @@ void cmInstallTargetGenerator::GenerateScript(std::ostream& os) << "\" has EXCLUDE_FROM_ALL set and will not be built by default " << "but an install rule has been provided for it. CMake does " << "not define behavior for this case."; - cmSystemTools::Message(msg.str().c_str(), "Warning"); + cmSystemTools::Message(msg.str(), "Warning"); } // Perform the main install script generation. diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 62aff99..5b02823 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2752,7 +2752,7 @@ bool cmLocalGenerator::CheckDefinition(std::string const& define) const << "CMake is dropping a preprocessor definition: " << define << "\n" << "Consider defining the macro in a (configured) header file.\n"; /* clang-format on */ - cmSystemTools::Message(e.str().c_str()); + cmSystemTools::Message(e.str()); return false; } } @@ -2767,7 +2767,7 @@ bool cmLocalGenerator::CheckDefinition(std::string const& define) const << "CMake is dropping a preprocessor definition: " << define << "\n" << "Consider defining the macro in a (configured) header file.\n"; /* clang-format on */ - cmSystemTools::Message(e.str().c_str()); + cmSystemTools::Message(e.str()); return false; } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index b59a733..9bd3b01 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -322,7 +322,7 @@ void cmMakefile::PrintCommandTrace(const cmListFileFunction& lff) const msg << " "; } msg << ")"; - cmSystemTools::Message(msg.str().c_str()); + cmSystemTools::Message(msg.str()); } // Helper class to make sure the call stack is valid. @@ -1622,7 +1622,7 @@ void cmMakefile::ConfigureSubDirectory(cmMakefile* mf) if (this->GetCMakeInstance()->GetDebugOutput()) { std::string msg = " Entering "; msg += currentStart; - cmSystemTools::Message(msg.c_str()); + cmSystemTools::Message(msg); } std::string const currentStartFile = currentStart + "/CMakeLists.txt"; @@ -1665,7 +1665,7 @@ void cmMakefile::ConfigureSubDirectory(cmMakefile* mf) if (this->GetCMakeInstance()->GetDebugOutput()) { std::string msg = " Returning to "; msg += this->GetCurrentSourceDirectory(); - cmSystemTools::Message(msg.c_str()); + cmSystemTools::Message(msg); } } diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 0fad233..af34169 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -403,7 +403,7 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles( err << "Warning: Source file \"" << source.GetFullPath() << "\" is listed multiple times for target \"" << this->GeneratorTarget->GetName() << "\"."; - cmSystemTools::Message(err.str().c_str(), "Warning"); + cmSystemTools::Message(err.str(), "Warning"); return; } diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx index 4c26c66..95f5fcb 100644 --- a/Source/cmMessageCommand.cxx +++ b/Source/cmMessageCommand.cxx @@ -70,7 +70,7 @@ bool cmMessageCommand::InitialPass(std::vector const& args, if (status) { this->Makefile->DisplayStatus(message.c_str(), -1); } else { - cmSystemTools::Message(message.c_str()); + cmSystemTools::Message(message); } } if (fatal) { diff --git a/Source/cmMessenger.cxx b/Source/cmMessenger.cxx index 3d788f6..1d790e2 100644 --- a/Source/cmMessenger.cxx +++ b/Source/cmMessenger.cxx @@ -124,9 +124,9 @@ void displayMessage(MessageType t, std::ostringstream& msg) if (t == MessageType::FATAL_ERROR || t == MessageType::INTERNAL_ERROR || t == MessageType::DEPRECATION_ERROR || t == MessageType::AUTHOR_ERROR) { cmSystemTools::SetErrorOccured(); - cmSystemTools::Message(msg.str().c_str(), "Error"); + cmSystemTools::Message(msg.str(), "Error"); } else { - cmSystemTools::Message(msg.str().c_str(), "Warning"); + cmSystemTools::Message(msg.str(), "Warning"); } } diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index a16460f..f7de3aa 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -267,14 +267,14 @@ void cmSystemTools::Error(const char* m1, const char* m2, const char* m3, message += m4; } cmSystemTools::s_ErrorOccured = true; - cmSystemTools::Message(message.c_str(), "Error"); + cmSystemTools::Message(message, "Error"); } void cmSystemTools::Error(const std::string& m) { std::string message = "CMake Error: " + m; cmSystemTools::s_ErrorOccured = true; - cmSystemTools::Message(message.c_str(), "Error"); + cmSystemTools::Message(message, "Error"); } void cmSystemTools::SetInterruptCallback(InterruptCallback f, void* clientData) diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index b30e4f7..b1d5751 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -76,6 +76,10 @@ public: * Display a message. */ static void Message(const char* m, const char* title = nullptr); + static void Message(const std::string& m, const char* title = nullptr) + { + Message(m.c_str(), title); + } typedef void (*OutputCallback)(const char*, size_t length, void*); diff --git a/Source/cmUtilitySourceCommand.cxx b/Source/cmUtilitySourceCommand.cxx index f374626..231bca4 100644 --- a/Source/cmUtilitySourceCommand.cxx +++ b/Source/cmUtilitySourceCommand.cxx @@ -40,7 +40,7 @@ bool cmUtilitySourceCommand::InitialPass(std::vector const& args, msg += ". If your intention is to run this executable, you need to " "preload the cache with the full path to a version of that " "program, which runs on this build machine."; - cmSystemTools::Message(msg.c_str(), "Warning"); + cmSystemTools::Message(msg, "Warning"); } } else { cmState* state = this->Makefile->GetState(); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 744b8fc..cf4dfc4 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1252,7 +1252,7 @@ int cmake::HandleDeleteCacheVariables(const std::string& var) for (SaveCacheEntry const& i : saved) { this->AddCacheEntry(i.key, i.value.c_str(), i.help.c_str(), i.type); } - cmSystemTools::Message(warning.str().c_str()); + cmSystemTools::Message(warning.str()); // avoid reconfigure if there were errors if (!cmSystemTools::GetErrorOccuredFlag()) { // re-run configure https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2fc69ba0b33e8f5f1b6301f37fc1479fba420b93 commit 2fc69ba0b33e8f5f1b6301f37fc1479fba420b93 Author: Vitaly Stakhovsky AuthorDate: Mon Jan 28 09:00:28 2019 -0500 Commit: Vitaly Stakhovsky CommitDate: Mon Jan 28 09:09:59 2019 -0500 cmFileTimeComparison: use std::string arguments diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index d07bd21..948547f 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -513,8 +513,7 @@ public: // Order files by modification time. Use lexicographic order // among files with the same time. int result; - if (this->FTC->FileTimeCompare(l.c_str(), r.c_str(), &result) && - result != 0) { + if (this->FTC->FileTimeCompare(l, r, &result) && result != 0) { return result < 0; } return l < r; diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx index 976ba57..7d1d316 100644 --- a/Source/cmDepends.cxx +++ b/Source/cmDepends.cxx @@ -156,8 +156,8 @@ bool cmDepends::CheckDependencies( // * if the depender does not exist, but the dependee is newer than the // depends file bool regenerate = false; - const char* dependee = this->Dependee + 1; - const char* depender = this->Depender; + const std::string dependee(this->Dependee + 1); + const std::string depender(this->Depender); if (currentDependencies != nullptr) { currentDependencies->push_back(dependee); } @@ -195,8 +195,8 @@ bool cmDepends::CheckDependencies( // The dependee exists, but the depender doesn't. Regenerate if the // internalDepends file is older than the dependee. int result = 0; - if ((!this->FileComparison->FileTimeCompare( - internalDependsFileName.c_str(), dependee, &result) || + if ((!this->FileComparison->FileTimeCompare(internalDependsFileName, + dependee, &result) || result < 0)) { // The depends-file is older than the dependee. regenerate = true; diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index f6ac4f2..ea24f09 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -268,8 +268,7 @@ void cmDependsC::ReadCacheFile() haveFileName = true; int newer = 0; cmFileTimeComparison comp; - bool res = comp.FileTimeCompare(this->CacheFileName.c_str(), - line.c_str(), &newer); + bool res = comp.FileTimeCompare(this->CacheFileName, line, &newer); if (res && newer == 1) // cache is newer than the parsed file { diff --git a/Source/cmFileTimeComparison.cxx b/Source/cmFileTimeComparison.cxx index 8f6993d..8b3911e 100644 --- a/Source/cmFileTimeComparison.cxx +++ b/Source/cmFileTimeComparison.cxx @@ -21,9 +21,10 @@ class cmFileTimeComparisonInternal { public: // Internal comparison method. - inline bool FileTimeCompare(const char* f1, const char* f2, int* result); + inline bool FileTimeCompare(const std::string& f1, const std::string& f2, + int* result); - bool FileTimesDiffer(const char* f1, const char* f2); + bool FileTimesDiffer(const std::string& f1, const std::string& f2); private: typedef std::unordered_map @@ -31,14 +32,14 @@ private: FileStatsMap Files; // Internal methods to lookup and compare modification times. - inline bool Stat(const char* fname, cmFileTimeComparison_Type* st); + inline bool Stat(const std::string& fname, cmFileTimeComparison_Type* st); inline int Compare(cmFileTimeComparison_Type* st1, cmFileTimeComparison_Type* st2); inline bool TimesDiffer(cmFileTimeComparison_Type* st1, cmFileTimeComparison_Type* st2); }; -bool cmFileTimeComparisonInternal::Stat(const char* fname, +bool cmFileTimeComparisonInternal::Stat(const std::string& fname, cmFileTimeComparison_Type* st) { // Use the stored time if available. @@ -51,7 +52,7 @@ bool cmFileTimeComparisonInternal::Stat(const char* fname, #if !defined(_WIN32) || defined(__CYGWIN__) // POSIX version. Use the stat function. - int res = ::stat(fname, st); + int res = ::stat(fname.c_str(), st); if (res != 0) { return false; } @@ -83,13 +84,14 @@ cmFileTimeComparison::~cmFileTimeComparison() delete this->Internals; } -bool cmFileTimeComparison::FileTimeCompare(const char* f1, const char* f2, - int* result) +bool cmFileTimeComparison::FileTimeCompare(const std::string& f1, + const std::string& f2, int* result) { return this->Internals->FileTimeCompare(f1, f2, result); } -bool cmFileTimeComparison::FileTimesDiffer(const char* f1, const char* f2) +bool cmFileTimeComparison::FileTimesDiffer(const std::string& f1, + const std::string& f2) { return this->Internals->FileTimesDiffer(f1, f2); } @@ -199,8 +201,9 @@ bool cmFileTimeComparisonInternal::TimesDiffer(cmFileTimeComparison_Type* s1, #endif } -bool cmFileTimeComparisonInternal::FileTimeCompare(const char* f1, - const char* f2, int* result) +bool cmFileTimeComparisonInternal::FileTimeCompare(const std::string& f1, + const std::string& f2, + int* result) { // Get the modification time for each file. cmFileTimeComparison_Type s1; @@ -215,8 +218,8 @@ bool cmFileTimeComparisonInternal::FileTimeCompare(const char* f1, return false; } -bool cmFileTimeComparisonInternal::FileTimesDiffer(const char* f1, - const char* f2) +bool cmFileTimeComparisonInternal::FileTimesDiffer(const std::string& f1, + const std::string& f2) { // Get the modification time for each file. cmFileTimeComparison_Type s1; diff --git a/Source/cmFileTimeComparison.h b/Source/cmFileTimeComparison.h index 114989b..5f74e34 100644 --- a/Source/cmFileTimeComparison.h +++ b/Source/cmFileTimeComparison.h @@ -5,6 +5,8 @@ #include "cmConfigure.h" // IWYU pragma: keep +#include + class cmFileTimeComparisonInternal; /** \class cmFileTimeComparison @@ -24,13 +26,14 @@ public: * When true is returned, result has -1, 0, +1 for * f1 older, same, or newer than f2. */ - bool FileTimeCompare(const char* f1, const char* f2, int* result); + bool FileTimeCompare(const std::string& f1, const std::string& f2, + int* result); /** * Compare file modification times. Return true unless both files * exist and have modification times less than 1 second apart. */ - bool FileTimesDiffer(const char* f1, const char* f2); + bool FileTimesDiffer(const std::string& f1, const std::string& f2); protected: cmFileTimeComparisonInternal* Internals; diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 7cb98b9..173ac7a 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1278,8 +1278,7 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies( this->GlobalGenerator->GetCMakeInstance()->GetFileComparison(); { int result; - if (!ftc->FileTimeCompare(internalDependFile.c_str(), tgtInfo.c_str(), - &result) || + if (!ftc->FileTimeCompare(internalDependFile, tgtInfo, &result) || result < 0) { if (verbose) { std::ostringstream msg; @@ -1299,8 +1298,7 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies( dirInfoFile += "/CMakeDirectoryInformation.cmake"; { int result; - if (!ftc->FileTimeCompare(internalDependFile.c_str(), dirInfoFile.c_str(), - &result) || + if (!ftc->FileTimeCompare(internalDependFile, dirInfoFile, &result) || result < 0) { if (verbose) { std::ostringstream msg; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 744b8fc..10cbb6e 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2146,8 +2146,7 @@ int cmake::CheckBuildSystem() std::string dep_newest = *dep++; for (; dep != depends.end(); ++dep) { int result = 0; - if (this->FileComparison->FileTimeCompare(dep_newest.c_str(), dep->c_str(), - &result)) { + if (this->FileComparison->FileTimeCompare(dep_newest, *dep, &result)) { if (result < 0) { dep_newest = *dep; } @@ -2166,8 +2165,7 @@ int cmake::CheckBuildSystem() std::string out_oldest = *out++; for (; out != outputs.end(); ++out) { int result = 0; - if (this->FileComparison->FileTimeCompare(out_oldest.c_str(), out->c_str(), - &result)) { + if (this->FileComparison->FileTimeCompare(out_oldest, *out, &result)) { if (result > 0) { out_oldest = *out; } @@ -2184,8 +2182,8 @@ int cmake::CheckBuildSystem() // If any output is older than any dependency then rerun. { int result = 0; - if (!this->FileComparison->FileTimeCompare(out_oldest.c_str(), - dep_newest.c_str(), &result) || + if (!this->FileComparison->FileTimeCompare(out_oldest, dep_newest, + &result) || result < 0) { if (verbose) { std::ostringstream msg; @@ -2446,8 +2444,7 @@ static bool cmakeCheckStampFile(const std::string& stampName, bool verbose) while (cmSystemTools::GetLineFromStream(fin, dep)) { int result; if (!dep.empty() && dep[0] != '#' && - (!ftc.FileTimeCompare(stampDepends.c_str(), dep.c_str(), &result) || - result < 0)) { + (!ftc.FileTimeCompare(stampDepends, dep, &result) || result < 0)) { // The stamp depends file is older than this dependency. The // build system is really out of date. std::cout << "CMake is re-running because " << stampName https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0e2cdacf7b51c915acd1a2a9e58a080d2667b4cb commit 0e2cdacf7b51c915acd1a2a9e58a080d2667b4cb Author: Zack Galbreath AuthorDate: Fri Jan 11 11:31:12 2019 -0500 Commit: Betsy McPhail CommitDate: Sun Jan 27 16:03:00 2019 -0500 Tests: Update style of c++ code snippets in Tutorial directions diff --git a/Tests/Tutorial/Step1/directions.txt b/Tests/Tutorial/Step1/directions.txt index 10f2583..827d775 100644 --- a/Tests/Tutorial/Step1/directions.txt +++ b/Tests/Tutorial/Step1/directions.txt @@ -52,14 +52,13 @@ make use of the version numbers. The resulting source code is listed below. int main (int argc, char *argv[]) { - if (argc < 2) - { + if (argc < 2) { std::cout << argv[0] << " Version " << Tutorial_VERSION_MAJOR << "." << Tutorial_VERSION_MINOR << std::endl; std::cout << "Usage: " << argv[0] << " number" << std::endl; return 1; - } + } double inputValue = atof(argv[1]); diff --git a/Tests/Tutorial/Step6/directions.txt b/Tests/Tutorial/Step6/directions.txt index d3e7b05..42b9f06 100644 --- a/Tests/Tutorial/Step6/directions.txt +++ b/Tests/Tutorial/Step6/directions.txt @@ -16,24 +16,21 @@ MathFunctions subdirectory a new source file named MakeTable.cxx will do just th int main (int argc, char *argv[]) { // make sure we have enough arguments - if (argc < 2) - { + if (argc < 2) { return 1; - } + } std::ofstream fout(argv[1],std::ios_base::out); const bool fileOpen = fout.is_open(); - if(fileOpen) - { + if(fileOpen) { fout << "double sqrtTable[] = {" << std::endl; - for (int i = 0; i < 10; ++i) - { + for (int i = 0; i < 10; ++i) { fout << sqrt(static_cast(i)) << "," << std::endl; - } + } // close the table with a zero fout << "0};" << std::endl; fout.close(); - } + } return fileOpen ? 0 : 1; // return 0 if wrote the file } @@ -81,29 +78,25 @@ found and included by mysqrt.cxx. Now let's use the generated table. First, modify mysqrt.cxx to include Table.h. Next, we can rewrite the mysqrt function to use the table: - if (x <= 0) - { - return 0; - } + if (x <= 0) { + return 0; + } // use the table to help find an initial value double result = x; - if (x >= 1 && x < 10) - { + if (x >= 1 && x < 10) { result = sqrtTable[static_cast(x)]; - } + } // do ten iterations - for (int i = 0; i < 10; ++i) - { - if (result <= 0) - { + for (int i = 0; i < 10; ++i) { + if (result <= 0) { result = 0.1; - } + } double delta = x - (result*result); result = result + 0.5*delta/result; std::cout << "Computing sqrt of " << x << " to be " << result << std::endl; - } + } Run cmake or cmake-gui to configure the project and then build it with your chosen build tool. When this project is built it will first build the MakeTable https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f2ddedfa5802c8aece994bb643b5139212d87777 commit f2ddedfa5802c8aece994bb643b5139212d87777 Author: Betsy McPhail AuthorDate: Sun Jan 20 11:28:39 2019 -0500 Commit: Betsy McPhail CommitDate: Sun Jan 27 16:03:00 2019 -0500 Tests: Update CMake tutorial Latest material from data.kitware.com -> Collections -> Courses -> CMake. diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 0c6eabc..ed98d97 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1704,18 +1704,37 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release DEPENDS ExternalProjectUpdateSetup ) # do each of the tutorial steps - foreach(STP RANGE 1 7) - add_test(TutorialStep${STP} ${CMAKE_CTEST_COMMAND} + function(add_tutorial_test step_name use_mymath) + set(tutorial_test_name Tutorial${step_name}) + set(tutorial_build_dir "${CMake_BINARY_DIR}/Tests/Tutorial/${step_name}") + if (use_mymath) + set(tutorial_build_options "") + else() + set(tutorial_test_name ${tutorial_test_name}_MYMATH) + set(tutorial_build_dir "${tutorial_build_dir}_MYMATH") + set(tutorial_build_options -DUSE_MYMATH:BOOL=OFF) + endif() + add_test(${tutorial_test_name} ${CMAKE_CTEST_COMMAND} --build-and-test - "${CMake_SOURCE_DIR}/Tests/Tutorial/Step${STP}" - "${CMake_BINARY_DIR}/Tests/Tutorial/Step${STP}" - --build-two-config + "${CMake_SOURCE_DIR}/Tests/Tutorial/${step_name}" + ${tutorial_build_dir}_Build ${build_generator_args} --build-project Tutorial - --build-options ${build_options} + --build-options ${build_options} ${tutorial_build_options} --test-command Tutorial 25.0) - endforeach() - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Tutorial") + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/${tutorial_build_dir}_Build") + endfunction() + + if(NOT CMake_TEST_EXTERNAL_CMAKE) + foreach(STP RANGE 1 11) + add_tutorial_test(Step${STP} TRUE) + endforeach() + add_tutorial_test(Complete TRUE) + foreach(STP RANGE 3 11) + add_tutorial_test(Step${STP} FALSE) + endforeach() + add_tutorial_test(Complete FALSE) + endif() add_test(testing ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE} --build-and-test diff --git a/Tests/Tutorial/Complete/CMakeLists.txt b/Tests/Tutorial/Complete/CMakeLists.txt new file mode 100644 index 0000000..9658e65 --- /dev/null +++ b/Tests/Tutorial/Complete/CMakeLists.txt @@ -0,0 +1,116 @@ +cmake_minimum_required(VERSION 3.3) +project(Tutorial) + +# control where the static and shared libraries are built so that on windows +# we don't need to tinker with the path to run the executable +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") + +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED True) + +option(BUILD_SHARED_LIBS "Build using shared libraries" ON) + +# the version number. +set(Tutorial_VERSION_MAJOR 1) +set(Tutorial_VERSION_MINOR 0) + +if(APPLE) + set(CMAKE_INSTALL_RPATH "@executable_path/../lib") +elseif(UNIX) + set(CMAKE_INSTALL_RPATH "$ORIGIN/../lib") +endif() + +# configure a header file to pass the version number only +configure_file( + "${PROJECT_SOURCE_DIR}/TutorialConfig.h.in" + "${PROJECT_BINARY_DIR}/TutorialConfig.h" + ) + +# add the MathFunctions library +add_subdirectory(MathFunctions) + +# add the executable +add_executable(Tutorial tutorial.cxx) +target_link_libraries(Tutorial MathFunctions) + +# add the binary tree to the search path for include files +# so that we will find TutorialConfig.h +target_include_directories(Tutorial PUBLIC + "${PROJECT_BINARY_DIR}" + ) + +# add the install targets +install(TARGETS Tutorial DESTINATION bin) +install(FILES "${PROJECT_BINARY_DIR}/TutorialConfig.h" + DESTINATION include + ) + +# enable testing +enable_testing() + +# does the application run +add_test(NAME Runs COMMAND Tutorial 25) + +# does the usage message work? +add_test(NAME Usage COMMAND Tutorial) +set_tests_properties(Usage + PROPERTIES PASS_REGULAR_EXPRESSION "Usage:.*number" + ) + +# define a function to simplify adding tests +function(do_test target arg result) + add_test(NAME Comp${arg} COMMAND ${target} ${arg}) + set_tests_properties(Comp${arg} + PROPERTIES PASS_REGULAR_EXPRESSION ${result} + ) +endfunction(do_test) + +# do a bunch of result based tests +do_test(Tutorial 4 "4 is 2") +do_test(Tutorial 9 "9 is 3") +do_test(Tutorial 5 "5 is 2.236") +do_test(Tutorial 7 "7 is 2.645") +do_test(Tutorial 25 "25 is 5") +do_test(Tutorial -25 "-25 is [-nan|nan|0]") +do_test(Tutorial 0.0001 "0.0001 is 0.01") + +include(InstallRequiredSystemLibraries) +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/License.txt") +set(CPACK_PACKAGE_VERSION_MAJOR "${Tutorial_VERSION_MAJOR}") +set(CPACK_PACKAGE_VERSION_MINOR "${Tutorial_VERSION_MINOR}") +include(CPack) + +# install the configuration targets +install(EXPORT MathFunctionsTargets + FILE MathFunctionsTargets.cmake + DESTINATION lib/cmake/MathFunctions +) + +include(CMakePackageConfigHelpers) +# generate the config file that is includes the exports +configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in + "${CMAKE_CURRENT_BINARY_DIR}/MathFunctionsConfig.cmake" + INSTALL_DESTINATION "lib/cmake/example" + NO_SET_AND_CHECK_MACRO + NO_CHECK_REQUIRED_COMPONENTS_MACRO + ) +# generate the version file for the config file +write_basic_package_version_file( + "${CMAKE_CURRENT_BINARY_DIR}/MathFunctionsConfigVersion.cmake" + VERSION "${Tutorial_VERSION_MAJOR}.${Tutorial_VERSION_MINOR}" + COMPATIBILITY AnyNewerVersion +) + +# install the configuration file +install(FILES + ${CMAKE_CURRENT_BINARY_DIR}/MathFunctionsConfig.cmake + DESTINATION lib/cmake/MathFunctions + ) + +# generate the export targets for the build tree +# needs to be after the install(TARGETS ) command +export(EXPORT MathFunctionsTargets + FILE "${CMAKE_CURRENT_BINARY_DIR}/MathFunctionsTargets.cmake" +) diff --git a/Tests/Tutorial/Complete/Config.cmake.in b/Tests/Tutorial/Complete/Config.cmake.in new file mode 100644 index 0000000..17cbabd --- /dev/null +++ b/Tests/Tutorial/Complete/Config.cmake.in @@ -0,0 +1,4 @@ + + at PACKAGE_INIT@ + +include ( "${CMAKE_CURRENT_LIST_DIR}/MathFunctionsTargets.cmake" ) diff --git a/Tests/Tutorial/Step6/License.txt b/Tests/Tutorial/Complete/License.txt similarity index 64% copy from Tests/Tutorial/Step6/License.txt copy to Tests/Tutorial/Complete/License.txt index 673d724..c62d00b 100644 --- a/Tests/Tutorial/Step6/License.txt +++ b/Tests/Tutorial/Complete/License.txt @@ -1,2 +1,2 @@ This is the open source License.txt file introduced in -CMake/Tests/Tutorial/Step6... +CMake/Tutorial/Step7... diff --git a/Tests/Tutorial/Complete/MathFunctions/CMakeLists.txt b/Tests/Tutorial/Complete/MathFunctions/CMakeLists.txt new file mode 100644 index 0000000..161ad64 --- /dev/null +++ b/Tests/Tutorial/Complete/MathFunctions/CMakeLists.txt @@ -0,0 +1,68 @@ + +# add the library that runs +add_library(MathFunctions MathFunctions.cxx) + +# state that anybody linking to us needs to include the current source dir +# to find MathFunctions.h, while we don't. +target_include_directories(MathFunctions + INTERFACE + $ + $ + ) + +# should we use our own math functions +option(USE_MYMATH "Use tutorial provided math implementation" ON) +if(USE_MYMATH) + + # does this system provide the log and exp functions? + include(CheckSymbolExists) + set(CMAKE_REQUIRED_LIBRARIES "m") + check_symbol_exists(log "math.h" HAVE_LOG) + check_symbol_exists(exp "math.h" HAVE_EXP) + + # first we add the executable that generates the table + add_executable(MakeTable MakeTable.cxx) + + # add the command to generate the source code + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Table.h + COMMAND MakeTable ${CMAKE_CURRENT_BINARY_DIR}/Table.h + DEPENDS MakeTable + ) + + # library that just does sqrt + add_library(SqrtLibrary STATIC + mysqrt.cxx + ${CMAKE_CURRENT_BINARY_DIR}/Table.h + ) + + # state that we depend on our binary dir to find Table.h + target_include_directories(SqrtLibrary PRIVATE + ${CMAKE_CURRENT_BINARY_DIR} + ) + + set_target_properties(SqrtLibrary PROPERTIES + POSITION_INDEPENDENT_CODE ${BUILD_SHARED_LIBS} + ) + + target_compile_definitions(SqrtLibrary PRIVATE + "$<$:HAVE_LOG>" + "$<$:HAVE_EXP>" + ) + target_link_libraries(MathFunctions PRIVATE SqrtLibrary) +endif() + +target_compile_definitions(MathFunctions PRIVATE "$<$:USE_MYMATH>") + +# define the symbol stating we are using the declspec(dllexport) when +# building on windows +target_compile_definitions(MathFunctions PRIVATE "EXPORTING_MYMATH") + +# setup the version numbering +set_property(TARGET MathFunctions PROPERTY VERSION "1.0.0") +set_property(TARGET MathFunctions PROPERTY SOVERSION "1") + +install(TARGETS MathFunctions + DESTINATION lib + EXPORT MathFunctionsTargets) +install(FILES MathFunctions.h DESTINATION include) diff --git a/Tests/Tutorial/Complete/MathFunctions/MakeTable.cxx b/Tests/Tutorial/Complete/MathFunctions/MakeTable.cxx new file mode 100644 index 0000000..ee58556 --- /dev/null +++ b/Tests/Tutorial/Complete/MathFunctions/MakeTable.cxx @@ -0,0 +1,25 @@ +// A simple program that builds a sqrt table +#include +#include +#include + +int main(int argc, char* argv[]) +{ + // make sure we have enough arguments + if (argc < 2) { + return 1; + } + + std::ofstream fout(argv[1], std::ios_base::out); + const bool fileOpen = fout.is_open(); + if (fileOpen) { + fout << "double sqrtTable[] = {" << std::endl; + for (int i = 0; i < 10; ++i) { + fout << sqrt(static_cast(i)) << "," << std::endl; + } + // close the table with a zero + fout << "0};" << std::endl; + fout.close(); + } + return fileOpen ? 0 : 1; // return 0 if wrote the file +} diff --git a/Tests/Tutorial/Complete/MathFunctions/MathFunctions.cxx b/Tests/Tutorial/Complete/MathFunctions/MathFunctions.cxx new file mode 100644 index 0000000..5351184 --- /dev/null +++ b/Tests/Tutorial/Complete/MathFunctions/MathFunctions.cxx @@ -0,0 +1,18 @@ + +#include "MathFunctions.h" +#include + +#ifdef USE_MYMATH +# include "mysqrt.h" +#endif + +namespace mathfunctions { +double sqrt(double x) +{ +#ifdef USE_MYMATH + return detail::mysqrt(x); +#else + return std::sqrt(x); +#endif +} +} diff --git a/Tests/Tutorial/Complete/MathFunctions/MathFunctions.h b/Tests/Tutorial/Complete/MathFunctions/MathFunctions.h new file mode 100644 index 0000000..3fb547b --- /dev/null +++ b/Tests/Tutorial/Complete/MathFunctions/MathFunctions.h @@ -0,0 +1,14 @@ + +#if defined(_WIN32) +# if defined(EXPORTING_MYMATH) +# define DECLSPEC __declspec(dllexport) +# else +# define DECLSPEC __declspec(dllimport) +# endif +#else // non windows +# define DECLSPEC +#endif + +namespace mathfunctions { +double DECLSPEC sqrt(double x); +} diff --git a/Tests/Tutorial/Step5/MathFunctions/mysqrt.cxx b/Tests/Tutorial/Complete/MathFunctions/mysqrt.cxx similarity index 50% copy from Tests/Tutorial/Step5/MathFunctions/mysqrt.cxx copy to Tests/Tutorial/Complete/MathFunctions/mysqrt.cxx index 458ed63..96d9421 100644 --- a/Tests/Tutorial/Step5/MathFunctions/mysqrt.cxx +++ b/Tests/Tutorial/Complete/MathFunctions/mysqrt.cxx @@ -1,12 +1,13 @@ #include "MathFunctions.h" -#include "TutorialConfig.h" -#include +#include // include the generated table #include "Table.h" -#include +#include +namespace mathfunctions { +namespace detail { // a hack square root calculation using simple operations double mysqrt(double x) { @@ -14,27 +15,31 @@ double mysqrt(double x) return 0; } - double result; - // if we have both log and exp then use them - double delta; - +#if defined(HAVE_LOG) && defined(HAVE_EXP) + double result = exp(log(x) * 0.5); + std::cout << "Computing sqrt of " << x << " to be " << result << " using log" + << std::endl; +#else // use the table to help find an initial value - result = x; + double result = x; if (x >= 1 && x < 10) { result = sqrtTable[static_cast(x)]; } + // if we have both log and exp then use them + // do ten iterations - int i; - for (i = 0; i < 10; ++i) { + for (int i = 0; i < 10; ++i) { if (result <= 0) { result = 0.1; } - delta = x - (result * result); + double delta = x - (result * result); result = result + 0.5 * delta / result; - fprintf(stdout, "Computing sqrt of %g to be %g\n", x, result); + std::cout << "Computing sqrt of " << x << " to be " << result << std::endl; } - +#endif return result; } +} +} diff --git a/Tests/Tutorial/Complete/MathFunctions/mysqrt.h b/Tests/Tutorial/Complete/MathFunctions/mysqrt.h new file mode 100644 index 0000000..e1c42ef --- /dev/null +++ b/Tests/Tutorial/Complete/MathFunctions/mysqrt.h @@ -0,0 +1,6 @@ + +namespace mathfunctions { +namespace detail { +double mysqrt(double x); +} +} diff --git a/Tests/Tutorial/Step2/TutorialConfig.h.in b/Tests/Tutorial/Complete/TutorialConfig.h.in similarity index 59% copy from Tests/Tutorial/Step2/TutorialConfig.h.in copy to Tests/Tutorial/Complete/TutorialConfig.h.in index 25a0602..8cd2fc9 100644 --- a/Tests/Tutorial/Step2/TutorialConfig.h.in +++ b/Tests/Tutorial/Complete/TutorialConfig.h.in @@ -1,5 +1,3 @@ -// the configured options and settings for Tutorial +// the configured version number #define Tutorial_VERSION_MAJOR @Tutorial_VERSION_MAJOR@ #define Tutorial_VERSION_MINOR @Tutorial_VERSION_MINOR@ -#cmakedefine USE_MYMATH - diff --git a/Tests/Tutorial/Complete/tutorial.cxx b/Tests/Tutorial/Complete/tutorial.cxx new file mode 100644 index 0000000..443d195 --- /dev/null +++ b/Tests/Tutorial/Complete/tutorial.cxx @@ -0,0 +1,25 @@ +// A simple program that computes the square root of a number +#include +#include +#include + +#include "MathFunctions.h" +#include "TutorialConfig.h" + +int main(int argc, char* argv[]) +{ + if (argc < 2) { + std::cout << argv[0] << " Version " << Tutorial_VERSION_MAJOR << "." + << Tutorial_VERSION_MAJOR << std::endl; + std::cout << "Usage: " << argv[0] << " number" << std::endl; + return 1; + } + + double inputValue = std::stod(argv[1]); + + const double outputValue = mathfunctions::sqrt(inputValue); + + std::cout << "The square root of " << inputValue << " is " << outputValue + << std::endl; + return 0; +} diff --git a/Tests/Tutorial/Consumer/CMakeLists.txt b/Tests/Tutorial/Consumer/CMakeLists.txt new file mode 100644 index 0000000..4033b4d --- /dev/null +++ b/Tests/Tutorial/Consumer/CMakeLists.txt @@ -0,0 +1,51 @@ +cmake_minimum_required(VERSION 3.3) + +if(NOT DEFINED CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 11) + set(CMAKE_CXX_STANDARD_REQUIRED True) +endif() + + +function(find_external_dependency name) + set(${name}_ROOT "" CACHE PATH "Root directory to find ${name}") + mark_as_advanced(${name}_DIR) + find_package(${name} PATHS ${${name}_ROOT} REQUIRED) +endfunction() + + +project(Consumer) + +find_external_dependency(MathFunctions) + +add_library(consumer consumer.cxx) +target_link_libraries(consumer PUBLIC MathFunctions) + +# install the consumer library +install(TARGETS consumer DESTINATION bin EXPORT ConsumerTargets) + +# install the configuration targets +install(EXPORT ConsumerTargets + FILE ConsumerTargets.cmake + DESTINATION lib/cmake/Consumer +) + +include(CMakePackageConfigHelpers) +# generate the config file that is includes the exports +configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in + "${CMAKE_CURRENT_BINARY_DIR}/ConsumerConfig.cmake" + INSTALL_DESTINATION "lib/cmake/example" + NO_SET_AND_CHECK_MACRO + NO_CHECK_REQUIRED_COMPONENTS_MACRO + ) + +# install the configuration file +install(FILES + ${CMAKE_CURRENT_BINARY_DIR}/ConsumerConfig.cmake + DESTINATION lib/cmake/Consumer + ) + +# generate the export targets for the build tree +# needs to be after the install(TARGETS ) command +export(EXPORT ConsumerTargets + FILE "${CMAKE_CURRENT_BINARY_DIR}/ConsumerTargets.cmake" +) diff --git a/Tests/Tutorial/Consumer/Config.cmake.in b/Tests/Tutorial/Consumer/Config.cmake.in new file mode 100644 index 0000000..0b3f1e4 --- /dev/null +++ b/Tests/Tutorial/Consumer/Config.cmake.in @@ -0,0 +1,14 @@ + + at PACKAGE_INIT@ + +include(CMakeFindDependencyMacro) + +function(find_external_dependency name) + set(${name}_ROOT "" CACHE PATH "Root directory to find ${name}") + mark_as_advanced(${name}_DIR) + find_dependency(${name} PATHS ${${name}_ROOT} REQUIRED) +endfunction() + +find_external_dependency(MathFunctions) + +include ( "${CMAKE_CURRENT_LIST_DIR}/ConsumerTargets.cmake" ) diff --git a/Tests/Tutorial/Consumer/consumer.cxx b/Tests/Tutorial/Consumer/consumer.cxx new file mode 100644 index 0000000..ae7877b --- /dev/null +++ b/Tests/Tutorial/Consumer/consumer.cxx @@ -0,0 +1,11 @@ +// A simple function that computes the square root of a number +#include +#include +#include + +#include "MathFunctions.h" + +double string_square_root(std::string const& value) +{ + return mathfunctions::sqrt(std::stod(value)); +} diff --git a/Tests/Tutorial/Consumer/directions.txt b/Tests/Tutorial/Consumer/directions.txt new file mode 100644 index 0000000..6a70aab --- /dev/null +++ b/Tests/Tutorial/Consumer/directions.txt @@ -0,0 +1,6 @@ +# Import a CMake Project# + +This examples shows how a project can find other CMake packages that +generated Config.cmake files. + +It also shows how to state a projects external dependencies when generating a Config.cmake. diff --git a/Tests/Tutorial/MultiPackage/CMakeLists.txt b/Tests/Tutorial/MultiPackage/CMakeLists.txt new file mode 100644 index 0000000..067e807 --- /dev/null +++ b/Tests/Tutorial/MultiPackage/CMakeLists.txt @@ -0,0 +1,109 @@ +cmake_minimum_required(VERSION 3.3) +project(Tutorial) + +# control how we mark up Debug libraries compared to Release libraries +set(CMAKE_DEBUG_POSTFIX "-d") + +# control where the static and shared libraries are built so that on windows +# we don't need to tinker with the path to run the executable +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") + +option(BUILD_SHARED_LIBS "Build using shared libraries" ON) + +# the version number. +set(Tutorial_VERSION_MAJOR 1) +set(Tutorial_VERSION_MINOR 0) + +# configure a header file to pass the version number only +configure_file( + "${PROJECT_SOURCE_DIR}/TutorialConfig.h.in" + "${PROJECT_BINARY_DIR}/TutorialConfig.h" + ) + +# add the MathFunctions library +add_subdirectory(MathFunctions) + +# add the executable +add_executable(Tutorial tutorial.cxx) +target_link_libraries(Tutorial MathFunctions) + +# add the binary tree to the search path for include files +# so that we will find TutorialConfig.h +target_include_directories(Tutorial PUBLIC + "${PROJECT_BINARY_DIR}" + ) + +# add the install targets +install(TARGETS Tutorial DESTINATION bin) +install(FILES "${PROJECT_BINARY_DIR}/TutorialConfig.h" + DESTINATION include + ) + +# enable testing +enable_testing() + +# does the application run +add_test(NAME Runs COMMAND Tutorial 25) + +# does the usage message work? +add_test(NAME Usage COMMAND Tutorial) +set_tests_properties(Usage + PROPERTIES PASS_REGULAR_EXPRESSION "Usage:.*number" + ) + +# define a function to simplify adding tests +function(do_test target arg result) + add_test(NAME Comp${arg} COMMAND ${target} ${arg}) + set_tests_properties(Comp${arg} + PROPERTIES PASS_REGULAR_EXPRESSION ${result} + ) +endfunction(do_test) + +# do a bunch of result based tests +do_test(Tutorial 4 "4 is 2") +do_test(Tutorial 9 "9 is 3") +do_test(Tutorial 5 "5 is 2.236") +do_test(Tutorial 7 "7 is 2.645") +do_test(Tutorial 25 "25 is 5") +do_test(Tutorial -25 "-25 is [-nan|nan|0]") +do_test(Tutorial 0.0001 "0.0001 is 0.01") + +include(InstallRequiredSystemLibraries) +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/License.txt") +set(CPACK_PACKAGE_VERSION_MAJOR "${Tutorial_VERSION_MAJOR}") +set(CPACK_PACKAGE_VERSION_MINOR "${Tutorial_VERSION_MINOR}") +include(CPack) + +# install the configuration targets +install(EXPORT MathFunctionsTargets + FILE MathFunctionsTargets.cmake + DESTINATION lib/cmake/MathFunctions +) + +include(CMakePackageConfigHelpers) +# generate the config file that is includes the exports +configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in + "${CMAKE_CURRENT_BINARY_DIR}/MathFunctionsConfig.cmake" + INSTALL_DESTINATION "lib/cmake/example" + NO_SET_AND_CHECK_MACRO + NO_CHECK_REQUIRED_COMPONENTS_MACRO + ) +# generate the version file for the config file +write_basic_package_version_file( + "${CMAKE_CURRENT_BINARY_DIR}/MathFunctionsConfigVersion.cmake" + VERSION "${Tutorial_VERSION_MAJOR}.${Tutorial_VERSION_MINOR}" + COMPATIBILITY AnyNewerVersion +) + +# install the configuration file +install(FILES + ${CMAKE_CURRENT_BINARY_DIR}/MathFunctionsConfig.cmake + DESTINATION lib/cmake/MathFunctions + ) + +# generate the export targets for the build tree +# needs to be after the install(TARGETS ) command +export(EXPORT MathFunctionsTargets + FILE "${CMAKE_CURRENT_BINARY_DIR}/MathFunctionsTargets.cmake" +) diff --git a/Tests/Tutorial/MultiPackage/Config.cmake.in b/Tests/Tutorial/MultiPackage/Config.cmake.in new file mode 100644 index 0000000..17cbabd --- /dev/null +++ b/Tests/Tutorial/MultiPackage/Config.cmake.in @@ -0,0 +1,4 @@ + + at PACKAGE_INIT@ + +include ( "${CMAKE_CURRENT_LIST_DIR}/MathFunctionsTargets.cmake" ) diff --git a/Tests/Tutorial/Step6/License.txt b/Tests/Tutorial/MultiPackage/License.txt similarity index 64% copy from Tests/Tutorial/Step6/License.txt copy to Tests/Tutorial/MultiPackage/License.txt index 673d724..c62d00b 100644 --- a/Tests/Tutorial/Step6/License.txt +++ b/Tests/Tutorial/MultiPackage/License.txt @@ -1,2 +1,2 @@ This is the open source License.txt file introduced in -CMake/Tests/Tutorial/Step6... +CMake/Tutorial/Step7... diff --git a/Tests/Tutorial/MultiPackage/MathFunctions/CMakeLists.txt b/Tests/Tutorial/MultiPackage/MathFunctions/CMakeLists.txt new file mode 100644 index 0000000..161ad64 --- /dev/null +++ b/Tests/Tutorial/MultiPackage/MathFunctions/CMakeLists.txt @@ -0,0 +1,68 @@ + +# add the library that runs +add_library(MathFunctions MathFunctions.cxx) + +# state that anybody linking to us needs to include the current source dir +# to find MathFunctions.h, while we don't. +target_include_directories(MathFunctions + INTERFACE + $ + $ + ) + +# should we use our own math functions +option(USE_MYMATH "Use tutorial provided math implementation" ON) +if(USE_MYMATH) + + # does this system provide the log and exp functions? + include(CheckSymbolExists) + set(CMAKE_REQUIRED_LIBRARIES "m") + check_symbol_exists(log "math.h" HAVE_LOG) + check_symbol_exists(exp "math.h" HAVE_EXP) + + # first we add the executable that generates the table + add_executable(MakeTable MakeTable.cxx) + + # add the command to generate the source code + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Table.h + COMMAND MakeTable ${CMAKE_CURRENT_BINARY_DIR}/Table.h + DEPENDS MakeTable + ) + + # library that just does sqrt + add_library(SqrtLibrary STATIC + mysqrt.cxx + ${CMAKE_CURRENT_BINARY_DIR}/Table.h + ) + + # state that we depend on our binary dir to find Table.h + target_include_directories(SqrtLibrary PRIVATE + ${CMAKE_CURRENT_BINARY_DIR} + ) + + set_target_properties(SqrtLibrary PROPERTIES + POSITION_INDEPENDENT_CODE ${BUILD_SHARED_LIBS} + ) + + target_compile_definitions(SqrtLibrary PRIVATE + "$<$:HAVE_LOG>" + "$<$:HAVE_EXP>" + ) + target_link_libraries(MathFunctions PRIVATE SqrtLibrary) +endif() + +target_compile_definitions(MathFunctions PRIVATE "$<$:USE_MYMATH>") + +# define the symbol stating we are using the declspec(dllexport) when +# building on windows +target_compile_definitions(MathFunctions PRIVATE "EXPORTING_MYMATH") + +# setup the version numbering +set_property(TARGET MathFunctions PROPERTY VERSION "1.0.0") +set_property(TARGET MathFunctions PROPERTY SOVERSION "1") + +install(TARGETS MathFunctions + DESTINATION lib + EXPORT MathFunctionsTargets) +install(FILES MathFunctions.h DESTINATION include) diff --git a/Tests/Tutorial/MultiPackage/MathFunctions/MakeTable.cxx b/Tests/Tutorial/MultiPackage/MathFunctions/MakeTable.cxx new file mode 100644 index 0000000..ee58556 --- /dev/null +++ b/Tests/Tutorial/MultiPackage/MathFunctions/MakeTable.cxx @@ -0,0 +1,25 @@ +// A simple program that builds a sqrt table +#include +#include +#include + +int main(int argc, char* argv[]) +{ + // make sure we have enough arguments + if (argc < 2) { + return 1; + } + + std::ofstream fout(argv[1], std::ios_base::out); + const bool fileOpen = fout.is_open(); + if (fileOpen) { + fout << "double sqrtTable[] = {" << std::endl; + for (int i = 0; i < 10; ++i) { + fout << sqrt(static_cast(i)) << "," << std::endl; + } + // close the table with a zero + fout << "0};" << std::endl; + fout.close(); + } + return fileOpen ? 0 : 1; // return 0 if wrote the file +} diff --git a/Tests/Tutorial/MultiPackage/MathFunctions/MathFunctions.cxx b/Tests/Tutorial/MultiPackage/MathFunctions/MathFunctions.cxx new file mode 100644 index 0000000..5351184 --- /dev/null +++ b/Tests/Tutorial/MultiPackage/MathFunctions/MathFunctions.cxx @@ -0,0 +1,18 @@ + +#include "MathFunctions.h" +#include + +#ifdef USE_MYMATH +# include "mysqrt.h" +#endif + +namespace mathfunctions { +double sqrt(double x) +{ +#ifdef USE_MYMATH + return detail::mysqrt(x); +#else + return std::sqrt(x); +#endif +} +} diff --git a/Tests/Tutorial/MultiPackage/MathFunctions/MathFunctions.h b/Tests/Tutorial/MultiPackage/MathFunctions/MathFunctions.h new file mode 100644 index 0000000..3fb547b --- /dev/null +++ b/Tests/Tutorial/MultiPackage/MathFunctions/MathFunctions.h @@ -0,0 +1,14 @@ + +#if defined(_WIN32) +# if defined(EXPORTING_MYMATH) +# define DECLSPEC __declspec(dllexport) +# else +# define DECLSPEC __declspec(dllimport) +# endif +#else // non windows +# define DECLSPEC +#endif + +namespace mathfunctions { +double DECLSPEC sqrt(double x); +} diff --git a/Tests/Tutorial/Step5/MathFunctions/mysqrt.cxx b/Tests/Tutorial/MultiPackage/MathFunctions/mysqrt.cxx similarity index 50% copy from Tests/Tutorial/Step5/MathFunctions/mysqrt.cxx copy to Tests/Tutorial/MultiPackage/MathFunctions/mysqrt.cxx index 458ed63..96d9421 100644 --- a/Tests/Tutorial/Step5/MathFunctions/mysqrt.cxx +++ b/Tests/Tutorial/MultiPackage/MathFunctions/mysqrt.cxx @@ -1,12 +1,13 @@ #include "MathFunctions.h" -#include "TutorialConfig.h" -#include +#include // include the generated table #include "Table.h" -#include +#include +namespace mathfunctions { +namespace detail { // a hack square root calculation using simple operations double mysqrt(double x) { @@ -14,27 +15,31 @@ double mysqrt(double x) return 0; } - double result; - // if we have both log and exp then use them - double delta; - +#if defined(HAVE_LOG) && defined(HAVE_EXP) + double result = exp(log(x) * 0.5); + std::cout << "Computing sqrt of " << x << " to be " << result << " using log" + << std::endl; +#else // use the table to help find an initial value - result = x; + double result = x; if (x >= 1 && x < 10) { result = sqrtTable[static_cast(x)]; } + // if we have both log and exp then use them + // do ten iterations - int i; - for (i = 0; i < 10; ++i) { + for (int i = 0; i < 10; ++i) { if (result <= 0) { result = 0.1; } - delta = x - (result * result); + double delta = x - (result * result); result = result + 0.5 * delta / result; - fprintf(stdout, "Computing sqrt of %g to be %g\n", x, result); + std::cout << "Computing sqrt of " << x << " to be " << result << std::endl; } - +#endif return result; } +} +} diff --git a/Tests/Tutorial/MultiPackage/MathFunctions/mysqrt.h b/Tests/Tutorial/MultiPackage/MathFunctions/mysqrt.h new file mode 100644 index 0000000..e1c42ef --- /dev/null +++ b/Tests/Tutorial/MultiPackage/MathFunctions/mysqrt.h @@ -0,0 +1,6 @@ + +namespace mathfunctions { +namespace detail { +double mysqrt(double x); +} +} diff --git a/Tests/Tutorial/MultiPackage/MultiCPackConfig.cmake b/Tests/Tutorial/MultiPackage/MultiCPackConfig.cmake new file mode 100644 index 0000000..403b633 --- /dev/null +++ b/Tests/Tutorial/MultiPackage/MultiCPackConfig.cmake @@ -0,0 +1,7 @@ + +include("release/CPackConfig.cmake") + +set(CPACK_INSTALL_CMAKE_PROJECTS + "debug;Tutorial;ALL;/" + "release;Tutorial;ALL;/" + ) diff --git a/Tests/Tutorial/Step2/TutorialConfig.h.in b/Tests/Tutorial/MultiPackage/TutorialConfig.h.in similarity index 59% copy from Tests/Tutorial/Step2/TutorialConfig.h.in copy to Tests/Tutorial/MultiPackage/TutorialConfig.h.in index 25a0602..8cd2fc9 100644 --- a/Tests/Tutorial/Step2/TutorialConfig.h.in +++ b/Tests/Tutorial/MultiPackage/TutorialConfig.h.in @@ -1,5 +1,3 @@ -// the configured options and settings for Tutorial +// the configured version number #define Tutorial_VERSION_MAJOR @Tutorial_VERSION_MAJOR@ #define Tutorial_VERSION_MINOR @Tutorial_VERSION_MINOR@ -#cmakedefine USE_MYMATH - diff --git a/Tests/Tutorial/MultiPackage/directions.txt b/Tests/Tutorial/MultiPackage/directions.txt new file mode 100644 index 0000000..c3102bb --- /dev/null +++ b/Tests/Tutorial/MultiPackage/directions.txt @@ -0,0 +1,34 @@ +# Packaging Debug and Release # + +By default CMake is model is that a build directory only contains a single +configuration, be it Debug, Release, MinSizeRel, or RelWithDebInfo. + +But it is possible to setup CPack to bundle multiple build directories at the same +time to build a package that contains multiple configurations of the same project. + +First we need to ahead and construct a directory called 'multi_config' this +will contain all the builds that we want to package together. + +Second create a 'debug' and 'release' directory underneath 'multi_config'. At +the end you should have a layout that looks like: + +? multi_config + ??? debug + ??? release + +Now we need to setup debug and release builds, which would roughly entail +the following: + + cd debug + cmake -DCMAKE_BUILD_TYPE=Debug ../../MultiPackage/ + cmake --build . + cd ../release + cmake -DCMAKE_BUILD_TYPE=Release ../../MultiPackage/ + cmake --build . + cd .. + + +Now that both the debug and release builds are complete we can now use +the custom MultiCPackConfig to package both builds into a single release. + + cpack --config ../../MultiPackage/MultiCPackConfig.cmake diff --git a/Tests/Tutorial/MultiPackage/tutorial.cxx b/Tests/Tutorial/MultiPackage/tutorial.cxx new file mode 100644 index 0000000..443d195 --- /dev/null +++ b/Tests/Tutorial/MultiPackage/tutorial.cxx @@ -0,0 +1,25 @@ +// A simple program that computes the square root of a number +#include +#include +#include + +#include "MathFunctions.h" +#include "TutorialConfig.h" + +int main(int argc, char* argv[]) +{ + if (argc < 2) { + std::cout << argv[0] << " Version " << Tutorial_VERSION_MAJOR << "." + << Tutorial_VERSION_MAJOR << std::endl; + std::cout << "Usage: " << argv[0] << " number" << std::endl; + return 1; + } + + double inputValue = std::stod(argv[1]); + + const double outputValue = mathfunctions::sqrt(inputValue); + + std::cout << "The square root of " << inputValue << " is " << outputValue + << std::endl; + return 0; +} diff --git a/Tests/Tutorial/Readme.txt b/Tests/Tutorial/Readme.txt new file mode 100644 index 0000000..74eb01a --- /dev/null +++ b/Tests/Tutorial/Readme.txt @@ -0,0 +1,16 @@ + +Step 0: A Starting Point +Step 1: Configure a File and C++11 Controls +Step 2: Adding a Library +Step 3: Usage Requirements for Library +Step 4: Installing and Testing +Step 5: System Introspection +Step 6: Custom Command and Generated File +Step 7: Building an Installer +Step 8: CDash submission +Step 9: Mixing Static and Shared +Step 10: Generator Expressions +Step 11: Adding Export Configuration +Complete: End result of Step 11 +Consumer: Example of Import Packages +MultiPackage: How to package Debug and Release versions diff --git a/Tests/Tutorial/Step1/CMakeLists.txt b/Tests/Tutorial/Step1/CMakeLists.txt index e461d3c..141f0c2 100644 --- a/Tests/Tutorial/Step1/CMakeLists.txt +++ b/Tests/Tutorial/Step1/CMakeLists.txt @@ -1,20 +1,3 @@ -cmake_minimum_required (VERSION 2.6) -project (Tutorial) +project(Tutorial) -# The version number. -set (Tutorial_VERSION_MAJOR 1) -set (Tutorial_VERSION_MINOR 0) - -# configure a header file to pass some of the CMake settings -# to the source code -configure_file ( - "${PROJECT_SOURCE_DIR}/TutorialConfig.h.in" - "${PROJECT_BINARY_DIR}/TutorialConfig.h" - ) - -# add the binary tree to the search path for include files -# so that we will find TutorialConfig.h -include_directories("${PROJECT_BINARY_DIR}") - -# add the executable add_executable(Tutorial tutorial.cxx) diff --git a/Tests/Tutorial/Step1/directions.txt b/Tests/Tutorial/Step1/directions.txt new file mode 100644 index 0000000..10f2583 --- /dev/null +++ b/Tests/Tutorial/Step1/directions.txt @@ -0,0 +1,96 @@ +# Adding a Version Number and Configured Header File # + +The first feature we will add is to provide our executable and project with a +version number. While we could do this exclusively in the source code, using +CMakeLists provides more flexibility. + +To add a version number we modify the CMakeLists file as follows: + + cmake_minimum_required(VERSION 3.3) + project(Tutorial) + + # the version number. + set(Tutorial_VERSION_MAJOR 1) + set(Tutorial_VERSION_MINOR 0) + + # configure a header file to pass some of the CMake settings + # to the source code + configure_file( + "${PROJECT_SOURCE_DIR}/TutorialConfig.h.in" + "${PROJECT_BINARY_DIR}/TutorialConfig.h" + ) + + # add the executable + add_executable(Tutorial tutorial.cxx) + + # add the binary tree to the search path for include files + # so that we will find TutorialConfig.h + target_include_directories(Tutorial PUBLIC + "${PROJECT_BINARY_DIR}" + ) + + +We then create a TutorialConfig.h.in file in the source tree with the +following contents: + + // the configured options and settings for Tutorial + #define Tutorial_VERSION_MAJOR @Tutorial_VERSION_MAJOR@ + #define Tutorial_VERSION_MINOR @Tutorial_VERSION_MINOR@ + +When CMake configures this header file the values for @Tutorial_VERSION_MAJOR@ +and @Tutorial_VERSION_MINOR@ will be replaced by the values from the CMakeLists +file. Next we modify tutorial.cxx to include the configured header file and to +make use of the version numbers. The resulting source code is listed below. + + // A simple program that computes the square root of a number + #include + #include + #include + #include + + #include "TutorialConfig.h" + + int main (int argc, char *argv[]) + { + if (argc < 2) + { + std::cout << argv[0] << " Version " + << Tutorial_VERSION_MAJOR << "." << Tutorial_VERSION_MINOR + << std::endl; + std::cout << "Usage: " << argv[0] << " number" << std::endl; + return 1; + } + + double inputValue = atof(argv[1]); + + double outputValue = sqrt(inputValue); + std::cout << "The square root of " + << inputValue << " is " << outputValue << std::endl; + return 0; + } + +# Adding C++11 support # + +Let's add some C++11 features to our project. We will need to explicitly state +in the CMake code that it should use the correct flags. The easiest way to +enable C++11 support for CMake is by using the CMAKE_CXX_STANDARD +and CMAKE_CXX_STANDARD_REQUIRED variables. + +First, replace `atof` with `std::stod` in tutorial.cxx. + +Then, add the CMAKE_CXX_STANDARD and CMAKE_CXX_STANDARD_REQUIRED variables to +the CMakeLists file. The STANADARD value should be set to 11, and REQUIRED +should be set to True. + + +# Build and Test # + +Run cmake or cmake-gui to configure the project and then build it with your +chosen build tool + +cd to the directory where Tutorial was built (likely the make directory or +a Debug or Release build configuration subdirectory) and run these commands: + + Tutorial 4294967296 + Tutorial 10 + Tutorial diff --git a/Tests/Tutorial/Step1/tutorial.cxx b/Tests/Tutorial/Step1/tutorial.cxx index 7a13376..f8dd0c6 100644 --- a/Tests/Tutorial/Step1/tutorial.cxx +++ b/Tests/Tutorial/Step1/tutorial.cxx @@ -1,19 +1,20 @@ // A simple program that computes the square root of a number -#include "TutorialConfig.h" -#include -#include -#include +#include +#include +#include +#include int main(int argc, char* argv[]) { if (argc < 2) { - fprintf(stdout, "%s Version %d.%d\n", argv[0], Tutorial_VERSION_MAJOR, - Tutorial_VERSION_MINOR); - fprintf(stdout, "Usage: %s number\n", argv[0]); + std::cout << "Usage: " << argv[0] << " number" << std::endl; return 1; } + double inputValue = atof(argv[1]); + double outputValue = sqrt(inputValue); - fprintf(stdout, "The square root of %g is %g\n", inputValue, outputValue); + std::cout << "The square root of " << inputValue << " is " << outputValue + << std::endl; return 0; } diff --git a/Tests/Tutorial/Step10/CMakeLists.txt b/Tests/Tutorial/Step10/CMakeLists.txt new file mode 100644 index 0000000..b1d46c4 --- /dev/null +++ b/Tests/Tutorial/Step10/CMakeLists.txt @@ -0,0 +1,77 @@ +cmake_minimum_required(VERSION 3.3) +project(Tutorial) + +# control where the static and shared libraries are built so that on windows +# we don't need to tinker with the path to run the executable +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") + +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED True) + +option(BUILD_SHARED_LIBS "Build using shared libraries" ON) + +# the version number. +set(Tutorial_VERSION_MAJOR 1) +set(Tutorial_VERSION_MINOR 0) + +# configure a header file to pass the version number only +configure_file( + "${PROJECT_SOURCE_DIR}/TutorialConfig.h.in" + "${PROJECT_BINARY_DIR}/TutorialConfig.h" + ) + +# add the MathFunctions library +add_subdirectory(MathFunctions) + +# add the executable +add_executable(Tutorial tutorial.cxx) +target_link_libraries(Tutorial MathFunctions) + +# add the binary tree to the search path for include files +# so that we will find TutorialConfig.h +target_include_directories(Tutorial PUBLIC + "${PROJECT_BINARY_DIR}" + ) + +# add the install targets +install(TARGETS Tutorial DESTINATION bin) +install(FILES "${PROJECT_BINARY_DIR}/TutorialConfig.h" + DESTINATION include + ) + +# enable testing +enable_testing() + +# does the application run +add_test(NAME Runs COMMAND Tutorial 25) + +# does the usage message work? +add_test(NAME Usage COMMAND Tutorial) +set_tests_properties(Usage + PROPERTIES PASS_REGULAR_EXPRESSION "Usage:.*number" + ) + +# define a function to simplify adding tests +function(do_test target arg result) + add_test(NAME Comp${arg} COMMAND ${target} ${arg}) + set_tests_properties(Comp${arg} + PROPERTIES PASS_REGULAR_EXPRESSION ${result} + ) +endfunction(do_test) + +# do a bunch of result based tests +do_test(Tutorial 4 "4 is 2") +do_test(Tutorial 9 "9 is 3") +do_test(Tutorial 5 "5 is 2.236") +do_test(Tutorial 7 "7 is 2.645") +do_test(Tutorial 25 "25 is 5") +do_test(Tutorial -25 "-25 is [-nan|nan|0]") +do_test(Tutorial 0.0001 "0.0001 is 0.01") + +include(InstallRequiredSystemLibraries) +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/License.txt") +set(CPACK_PACKAGE_VERSION_MAJOR "${Tutorial_VERSION_MAJOR}") +set(CPACK_PACKAGE_VERSION_MINOR "${Tutorial_VERSION_MINOR}") +include(CPack) diff --git a/Tests/Tutorial/Step6/License.txt b/Tests/Tutorial/Step10/License.txt similarity index 64% copy from Tests/Tutorial/Step6/License.txt copy to Tests/Tutorial/Step10/License.txt index 673d724..c62d00b 100644 --- a/Tests/Tutorial/Step6/License.txt +++ b/Tests/Tutorial/Step10/License.txt @@ -1,2 +1,2 @@ This is the open source License.txt file introduced in -CMake/Tests/Tutorial/Step6... +CMake/Tutorial/Step7... diff --git a/Tests/Tutorial/Step10/MathFunctions/CMakeLists.txt b/Tests/Tutorial/Step10/MathFunctions/CMakeLists.txt new file mode 100644 index 0000000..7a23505 --- /dev/null +++ b/Tests/Tutorial/Step10/MathFunctions/CMakeLists.txt @@ -0,0 +1,61 @@ + +# add the library that runs +add_library(MathFunctions MathFunctions.cxx) + +# state that anybody linking to us needs to include the current source dir +# to find MathFunctions.h, while we don't. +target_include_directories(MathFunctions + INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} + ) + +# should we use our own math functions +option(USE_MYMATH "Use tutorial provided math implementation" ON) +if(USE_MYMATH) + + # does this system provide the log and exp functions? + include(CheckSymbolExists) + set(CMAKE_REQUIRED_LIBRARIES "m") + check_symbol_exists(log "math.h" HAVE_LOG) + check_symbol_exists(exp "math.h" HAVE_EXP) + + # first we add the executable that generates the table + add_executable(MakeTable MakeTable.cxx) + + # add the command to generate the source code + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Table.h + COMMAND MakeTable ${CMAKE_CURRENT_BINARY_DIR}/Table.h + DEPENDS MakeTable + ) + + # library that just does sqrt + add_library(SqrtLibrary STATIC + mysqrt.cxx + ${CMAKE_CURRENT_BINARY_DIR}/Table.h + ) + + # state that we depend on our binary dir to find Table.h + target_include_directories(SqrtLibrary PRIVATE + ${CMAKE_CURRENT_BINARY_DIR} + ) + + # state that SqrtLibrary need PIC when the default is shared libraries + set_target_properties(SqrtLibrary PROPERTIES + POSITION_INDEPENDENT_CODE ${BUILD_SHARED_LIBS} + ) + + target_compile_definitions(MathFunctions PRIVATE "USE_MYMATH") + if(HAVE_LOG AND HAVE_EXP) + target_compile_definitions(SqrtLibrary + PRIVATE "HAVE_LOG" "HAVE_EXP") + endif() + + target_link_libraries(MathFunctions PRIVATE SqrtLibrary) +endif() + +# define the symbol stating we are using the declspec(dllexport) when +# building on windows +target_compile_definitions(MathFunctions PRIVATE "EXPORTING_MYMATH") + +install(TARGETS MathFunctions DESTINATION lib) +install(FILES MathFunctions.h DESTINATION include) diff --git a/Tests/Tutorial/Step10/MathFunctions/MakeTable.cxx b/Tests/Tutorial/Step10/MathFunctions/MakeTable.cxx new file mode 100644 index 0000000..ee58556 --- /dev/null +++ b/Tests/Tutorial/Step10/MathFunctions/MakeTable.cxx @@ -0,0 +1,25 @@ +// A simple program that builds a sqrt table +#include +#include +#include + +int main(int argc, char* argv[]) +{ + // make sure we have enough arguments + if (argc < 2) { + return 1; + } + + std::ofstream fout(argv[1], std::ios_base::out); + const bool fileOpen = fout.is_open(); + if (fileOpen) { + fout << "double sqrtTable[] = {" << std::endl; + for (int i = 0; i < 10; ++i) { + fout << sqrt(static_cast(i)) << "," << std::endl; + } + // close the table with a zero + fout << "0};" << std::endl; + fout.close(); + } + return fileOpen ? 0 : 1; // return 0 if wrote the file +} diff --git a/Tests/Tutorial/Step10/MathFunctions/MathFunctions.cxx b/Tests/Tutorial/Step10/MathFunctions/MathFunctions.cxx new file mode 100644 index 0000000..5351184 --- /dev/null +++ b/Tests/Tutorial/Step10/MathFunctions/MathFunctions.cxx @@ -0,0 +1,18 @@ + +#include "MathFunctions.h" +#include + +#ifdef USE_MYMATH +# include "mysqrt.h" +#endif + +namespace mathfunctions { +double sqrt(double x) +{ +#ifdef USE_MYMATH + return detail::mysqrt(x); +#else + return std::sqrt(x); +#endif +} +} diff --git a/Tests/Tutorial/Step10/MathFunctions/MathFunctions.h b/Tests/Tutorial/Step10/MathFunctions/MathFunctions.h new file mode 100644 index 0000000..3fb547b --- /dev/null +++ b/Tests/Tutorial/Step10/MathFunctions/MathFunctions.h @@ -0,0 +1,14 @@ + +#if defined(_WIN32) +# if defined(EXPORTING_MYMATH) +# define DECLSPEC __declspec(dllexport) +# else +# define DECLSPEC __declspec(dllimport) +# endif +#else // non windows +# define DECLSPEC +#endif + +namespace mathfunctions { +double DECLSPEC sqrt(double x); +} diff --git a/Tests/Tutorial/Step5/MathFunctions/mysqrt.cxx b/Tests/Tutorial/Step10/MathFunctions/mysqrt.cxx similarity index 50% copy from Tests/Tutorial/Step5/MathFunctions/mysqrt.cxx copy to Tests/Tutorial/Step10/MathFunctions/mysqrt.cxx index 458ed63..96d9421 100644 --- a/Tests/Tutorial/Step5/MathFunctions/mysqrt.cxx +++ b/Tests/Tutorial/Step10/MathFunctions/mysqrt.cxx @@ -1,12 +1,13 @@ #include "MathFunctions.h" -#include "TutorialConfig.h" -#include +#include // include the generated table #include "Table.h" -#include +#include +namespace mathfunctions { +namespace detail { // a hack square root calculation using simple operations double mysqrt(double x) { @@ -14,27 +15,31 @@ double mysqrt(double x) return 0; } - double result; - // if we have both log and exp then use them - double delta; - +#if defined(HAVE_LOG) && defined(HAVE_EXP) + double result = exp(log(x) * 0.5); + std::cout << "Computing sqrt of " << x << " to be " << result << " using log" + << std::endl; +#else // use the table to help find an initial value - result = x; + double result = x; if (x >= 1 && x < 10) { result = sqrtTable[static_cast(x)]; } + // if we have both log and exp then use them + // do ten iterations - int i; - for (i = 0; i < 10; ++i) { + for (int i = 0; i < 10; ++i) { if (result <= 0) { result = 0.1; } - delta = x - (result * result); + double delta = x - (result * result); result = result + 0.5 * delta / result; - fprintf(stdout, "Computing sqrt of %g to be %g\n", x, result); + std::cout << "Computing sqrt of " << x << " to be " << result << std::endl; } - +#endif return result; } +} +} diff --git a/Tests/Tutorial/Step10/MathFunctions/mysqrt.h b/Tests/Tutorial/Step10/MathFunctions/mysqrt.h new file mode 100644 index 0000000..e1c42ef --- /dev/null +++ b/Tests/Tutorial/Step10/MathFunctions/mysqrt.h @@ -0,0 +1,6 @@ + +namespace mathfunctions { +namespace detail { +double mysqrt(double x); +} +} diff --git a/Tests/Tutorial/Step2/TutorialConfig.h.in b/Tests/Tutorial/Step10/TutorialConfig.h.in similarity index 59% copy from Tests/Tutorial/Step2/TutorialConfig.h.in copy to Tests/Tutorial/Step10/TutorialConfig.h.in index 25a0602..8cd2fc9 100644 --- a/Tests/Tutorial/Step2/TutorialConfig.h.in +++ b/Tests/Tutorial/Step10/TutorialConfig.h.in @@ -1,5 +1,3 @@ -// the configured options and settings for Tutorial +// the configured version number #define Tutorial_VERSION_MAJOR @Tutorial_VERSION_MAJOR@ #define Tutorial_VERSION_MINOR @Tutorial_VERSION_MINOR@ -#cmakedefine USE_MYMATH - diff --git a/Tests/Tutorial/Step10/directions.txt b/Tests/Tutorial/Step10/directions.txt new file mode 100644 index 0000000..5317b54 --- /dev/null +++ b/Tests/Tutorial/Step10/directions.txt @@ -0,0 +1,38 @@ +# Adding Generator Expressions # + +Generator expressions are evaluated during build system generation to produce +information specific to each build configuration. + +Generator expressions are allowed in the context of many target properties, such +as LINK_LIBRARIES, INCLUDE_DIRECTORIES, COMPILE_DEFINITIONS and others. They may +also be used when using commands to populate those properties, such as +target_link_libraries(), target_include_directories(), +target_compile_definitions() and others. + +Generator expressions may to used to enable conditional linking, conditional +definitions used when compiling, and conditional include directories and more. +The conditions may be based on the build configuration, target properties, +platform information or any other queryable information. + +There are different types of generator expressions including Logical, +Informational, and Output expressions. + +Logical expressions are used to create conditional output. The basic expressions +are the 0 and 1 expressions. A "$<0:...>" results in the empty string, and +"$<1:...>" results in the content of "...". They can also be nested. +For example: + + if(HAVE_LOG AND HAVE_EXP) + target_compile_definitions(SqrtLibrary + PRIVATE "HAVE_LOG" "HAVE_EXP") + endif() + +Can be rewritten with generator expressions: + + target_compile_definitions(SqrtLibrary PRIVATE + "$<$:HAVE_LOG>" + "$<$:HAVE_EXP>" + ) + +Note that "${HAVE_LOG}" is evaluated at CMake configure time while +"$<$:HAVE_LOG>" is evaluated at build system generation time. diff --git a/Tests/Tutorial/Step10/tutorial.cxx b/Tests/Tutorial/Step10/tutorial.cxx new file mode 100644 index 0000000..443d195 --- /dev/null +++ b/Tests/Tutorial/Step10/tutorial.cxx @@ -0,0 +1,25 @@ +// A simple program that computes the square root of a number +#include +#include +#include + +#include "MathFunctions.h" +#include "TutorialConfig.h" + +int main(int argc, char* argv[]) +{ + if (argc < 2) { + std::cout << argv[0] << " Version " << Tutorial_VERSION_MAJOR << "." + << Tutorial_VERSION_MAJOR << std::endl; + std::cout << "Usage: " << argv[0] << " number" << std::endl; + return 1; + } + + double inputValue = std::stod(argv[1]); + + const double outputValue = mathfunctions::sqrt(inputValue); + + std::cout << "The square root of " << inputValue << " is " << outputValue + << std::endl; + return 0; +} diff --git a/Tests/Tutorial/Step11/CMakeLists.txt b/Tests/Tutorial/Step11/CMakeLists.txt new file mode 100644 index 0000000..b1d46c4 --- /dev/null +++ b/Tests/Tutorial/Step11/CMakeLists.txt @@ -0,0 +1,77 @@ +cmake_minimum_required(VERSION 3.3) +project(Tutorial) + +# control where the static and shared libraries are built so that on windows +# we don't need to tinker with the path to run the executable +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") + +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED True) + +option(BUILD_SHARED_LIBS "Build using shared libraries" ON) + +# the version number. +set(Tutorial_VERSION_MAJOR 1) +set(Tutorial_VERSION_MINOR 0) + +# configure a header file to pass the version number only +configure_file( + "${PROJECT_SOURCE_DIR}/TutorialConfig.h.in" + "${PROJECT_BINARY_DIR}/TutorialConfig.h" + ) + +# add the MathFunctions library +add_subdirectory(MathFunctions) + +# add the executable +add_executable(Tutorial tutorial.cxx) +target_link_libraries(Tutorial MathFunctions) + +# add the binary tree to the search path for include files +# so that we will find TutorialConfig.h +target_include_directories(Tutorial PUBLIC + "${PROJECT_BINARY_DIR}" + ) + +# add the install targets +install(TARGETS Tutorial DESTINATION bin) +install(FILES "${PROJECT_BINARY_DIR}/TutorialConfig.h" + DESTINATION include + ) + +# enable testing +enable_testing() + +# does the application run +add_test(NAME Runs COMMAND Tutorial 25) + +# does the usage message work? +add_test(NAME Usage COMMAND Tutorial) +set_tests_properties(Usage + PROPERTIES PASS_REGULAR_EXPRESSION "Usage:.*number" + ) + +# define a function to simplify adding tests +function(do_test target arg result) + add_test(NAME Comp${arg} COMMAND ${target} ${arg}) + set_tests_properties(Comp${arg} + PROPERTIES PASS_REGULAR_EXPRESSION ${result} + ) +endfunction(do_test) + +# do a bunch of result based tests +do_test(Tutorial 4 "4 is 2") +do_test(Tutorial 9 "9 is 3") +do_test(Tutorial 5 "5 is 2.236") +do_test(Tutorial 7 "7 is 2.645") +do_test(Tutorial 25 "25 is 5") +do_test(Tutorial -25 "-25 is [-nan|nan|0]") +do_test(Tutorial 0.0001 "0.0001 is 0.01") + +include(InstallRequiredSystemLibraries) +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/License.txt") +set(CPACK_PACKAGE_VERSION_MAJOR "${Tutorial_VERSION_MAJOR}") +set(CPACK_PACKAGE_VERSION_MINOR "${Tutorial_VERSION_MINOR}") +include(CPack) diff --git a/Tests/Tutorial/Step6/License.txt b/Tests/Tutorial/Step11/License.txt similarity index 64% copy from Tests/Tutorial/Step6/License.txt copy to Tests/Tutorial/Step11/License.txt index 673d724..c62d00b 100644 --- a/Tests/Tutorial/Step6/License.txt +++ b/Tests/Tutorial/Step11/License.txt @@ -1,2 +1,2 @@ This is the open source License.txt file introduced in -CMake/Tests/Tutorial/Step6... +CMake/Tutorial/Step7... diff --git a/Tests/Tutorial/Step11/MathFunctions/CMakeLists.txt b/Tests/Tutorial/Step11/MathFunctions/CMakeLists.txt new file mode 100644 index 0000000..760d6a5 --- /dev/null +++ b/Tests/Tutorial/Step11/MathFunctions/CMakeLists.txt @@ -0,0 +1,60 @@ + +# add the library that runs +add_library(MathFunctions MathFunctions.cxx) + +# state that anybody linking to us needs to include the current source dir +# to find MathFunctions.h, while we don't. +target_include_directories(MathFunctions + INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} + ) + +# should we use our own math functions +option(USE_MYMATH "Use tutorial provided math implementation" ON) +if(USE_MYMATH) + + # does this system provide the log and exp functions? + include(CheckSymbolExists) + set(CMAKE_REQUIRED_LIBRARIES "m") + check_symbol_exists(log "math.h" HAVE_LOG) + check_symbol_exists(exp "math.h" HAVE_EXP) + + # first we add the executable that generates the table + add_executable(MakeTable MakeTable.cxx) + + # add the command to generate the source code + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Table.h + COMMAND MakeTable ${CMAKE_CURRENT_BINARY_DIR}/Table.h + DEPENDS MakeTable + ) + + # library that just does sqrt + add_library(SqrtLibrary STATIC + mysqrt.cxx + ${CMAKE_CURRENT_BINARY_DIR}/Table.h + ) + + # state that we depend on our binary dir to find Table.h + target_include_directories(SqrtLibrary PRIVATE + ${CMAKE_CURRENT_BINARY_DIR} + ) + + set_target_properties(SqrtLibrary PROPERTIES + POSITION_INDEPENDENT_CODE ${BUILD_SHARED_LIBS} + ) + + target_compile_definitions(SqrtLibrary PRIVATE + "$<$:HAVE_LOG>" + "$<$:HAVE_EXP>" + ) + target_link_libraries(MathFunctions PRIVATE SqrtLibrary) +endif() + +target_compile_definitions(MathFunctions PRIVATE "$<$:USE_MYMATH>") + +# define the symbol stating we are using the declspec(dllexport) when +#building on windows +target_compile_definitions(MathFunctions PRIVATE "EXPORTING_MYMATH") + +install(TARGETS MathFunctions DESTINATION lib) +install(FILES MathFunctions.h DESTINATION include) diff --git a/Tests/Tutorial/Step11/MathFunctions/MakeTable.cxx b/Tests/Tutorial/Step11/MathFunctions/MakeTable.cxx new file mode 100644 index 0000000..ee58556 --- /dev/null +++ b/Tests/Tutorial/Step11/MathFunctions/MakeTable.cxx @@ -0,0 +1,25 @@ +// A simple program that builds a sqrt table +#include +#include +#include + +int main(int argc, char* argv[]) +{ + // make sure we have enough arguments + if (argc < 2) { + return 1; + } + + std::ofstream fout(argv[1], std::ios_base::out); + const bool fileOpen = fout.is_open(); + if (fileOpen) { + fout << "double sqrtTable[] = {" << std::endl; + for (int i = 0; i < 10; ++i) { + fout << sqrt(static_cast(i)) << "," << std::endl; + } + // close the table with a zero + fout << "0};" << std::endl; + fout.close(); + } + return fileOpen ? 0 : 1; // return 0 if wrote the file +} diff --git a/Tests/Tutorial/Step11/MathFunctions/MathFunctions.cxx b/Tests/Tutorial/Step11/MathFunctions/MathFunctions.cxx new file mode 100644 index 0000000..5351184 --- /dev/null +++ b/Tests/Tutorial/Step11/MathFunctions/MathFunctions.cxx @@ -0,0 +1,18 @@ + +#include "MathFunctions.h" +#include + +#ifdef USE_MYMATH +# include "mysqrt.h" +#endif + +namespace mathfunctions { +double sqrt(double x) +{ +#ifdef USE_MYMATH + return detail::mysqrt(x); +#else + return std::sqrt(x); +#endif +} +} diff --git a/Tests/Tutorial/Step11/MathFunctions/MathFunctions.h b/Tests/Tutorial/Step11/MathFunctions/MathFunctions.h new file mode 100644 index 0000000..3fb547b --- /dev/null +++ b/Tests/Tutorial/Step11/MathFunctions/MathFunctions.h @@ -0,0 +1,14 @@ + +#if defined(_WIN32) +# if defined(EXPORTING_MYMATH) +# define DECLSPEC __declspec(dllexport) +# else +# define DECLSPEC __declspec(dllimport) +# endif +#else // non windows +# define DECLSPEC +#endif + +namespace mathfunctions { +double DECLSPEC sqrt(double x); +} diff --git a/Tests/Tutorial/Step5/MathFunctions/mysqrt.cxx b/Tests/Tutorial/Step11/MathFunctions/mysqrt.cxx similarity index 50% copy from Tests/Tutorial/Step5/MathFunctions/mysqrt.cxx copy to Tests/Tutorial/Step11/MathFunctions/mysqrt.cxx index 458ed63..96d9421 100644 --- a/Tests/Tutorial/Step5/MathFunctions/mysqrt.cxx +++ b/Tests/Tutorial/Step11/MathFunctions/mysqrt.cxx @@ -1,12 +1,13 @@ #include "MathFunctions.h" -#include "TutorialConfig.h" -#include +#include // include the generated table #include "Table.h" -#include +#include +namespace mathfunctions { +namespace detail { // a hack square root calculation using simple operations double mysqrt(double x) { @@ -14,27 +15,31 @@ double mysqrt(double x) return 0; } - double result; - // if we have both log and exp then use them - double delta; - +#if defined(HAVE_LOG) && defined(HAVE_EXP) + double result = exp(log(x) * 0.5); + std::cout << "Computing sqrt of " << x << " to be " << result << " using log" + << std::endl; +#else // use the table to help find an initial value - result = x; + double result = x; if (x >= 1 && x < 10) { result = sqrtTable[static_cast(x)]; } + // if we have both log and exp then use them + // do ten iterations - int i; - for (i = 0; i < 10; ++i) { + for (int i = 0; i < 10; ++i) { if (result <= 0) { result = 0.1; } - delta = x - (result * result); + double delta = x - (result * result); result = result + 0.5 * delta / result; - fprintf(stdout, "Computing sqrt of %g to be %g\n", x, result); + std::cout << "Computing sqrt of " << x << " to be " << result << std::endl; } - +#endif return result; } +} +} diff --git a/Tests/Tutorial/Step11/MathFunctions/mysqrt.h b/Tests/Tutorial/Step11/MathFunctions/mysqrt.h new file mode 100644 index 0000000..e1c42ef --- /dev/null +++ b/Tests/Tutorial/Step11/MathFunctions/mysqrt.h @@ -0,0 +1,6 @@ + +namespace mathfunctions { +namespace detail { +double mysqrt(double x); +} +} diff --git a/Tests/Tutorial/Step2/TutorialConfig.h.in b/Tests/Tutorial/Step11/TutorialConfig.h.in similarity index 59% copy from Tests/Tutorial/Step2/TutorialConfig.h.in copy to Tests/Tutorial/Step11/TutorialConfig.h.in index 25a0602..8cd2fc9 100644 --- a/Tests/Tutorial/Step2/TutorialConfig.h.in +++ b/Tests/Tutorial/Step11/TutorialConfig.h.in @@ -1,5 +1,3 @@ -// the configured options and settings for Tutorial +// the configured version number #define Tutorial_VERSION_MAJOR @Tutorial_VERSION_MAJOR@ #define Tutorial_VERSION_MINOR @Tutorial_VERSION_MINOR@ -#cmakedefine USE_MYMATH - diff --git a/Tests/Tutorial/Step11/directions.txt b/Tests/Tutorial/Step11/directions.txt new file mode 100644 index 0000000..ebb5def --- /dev/null +++ b/Tests/Tutorial/Step11/directions.txt @@ -0,0 +1,104 @@ +# Adding Export Configuration # + +During Step 4 of the tutorial we added the ability for CMake to install the +library and headers of the project. During Step 7 we added the ability +to package up this information so it could be distributed to other people. + +The next step is to add the necessary information so that other CMake projects +can use our project, be it from a build directory, a local install or when +packaged. + +The first step is to update our install(TARGETS) commands to not only specify +a DESTINATION but also an EXPORT. The EXPORT keyword generates and installs a +CMake file containing code to import all targets listed in the install command +from the installation tree. So let's go ahead and explicitly EXPORT the +MathFunctions library by updating the install command in +MathFunctions/CMakeLists.txt to look like: + + install(TARGETS MathFunctions DESTINATION lib EXPORT MathFunctionsTargets) + +Now that we have MathFunctions being exported, we also need to explicitly install +the generated MathFunctionsTargets.cmake file. This is done by adding +the following to the bottom of the top-level CMakeLists.txt: + + # install the configuration targets + install(EXPORT MathFunctionsTargets + FILE MathFunctionsTargets.cmake + DESTINATION lib/cmake/MathFunctions + ) + +At this point you should try and run CMake. If everything is setup properly +you will see that CMake will generate an error that looks like: + + Target "MathFunctions" INTERFACE_INCLUDE_DIRECTORIES property contains + path: + + "/Users/robert/Documents/CMakeClass/Tutorial/Step11/MathFunctions" + + which is prefixed in the source directory. + +What CMake is trying to say is that during generating the export information +it will export a path that is intrinsically tied to the current machine and +will not be valid on other machines. The solution to this is to update the +MathFunctions target_include_directories to understand that it needs different +INTERFACE locations when being used from within the build directory and from an +install / package. This means converting the target_include_directories +call for MathFunctions to look like: + + target_include_directories(MathFunctions + INTERFACE + $ + $ + ) + +Once this has been updated, we can re-run CMake and see verify that it doesn't +warn anymore. + +At this point, we have CMake properly packaging the target information that is +required but we will still need to generate a MathFunctionsConfig.cmake, so +that the CMake find_package command can find our project. So let's go ahead and +add a new file to the top-level of the project called Config.cmake.in with the +following contents: + + @PACKAGE_INIT@ + + include ( "${CMAKE_CURRENT_LIST_DIR}/MathFunctionsTargets.cmake" ) + +Then, to properly configure and install that file, add the following to the +bottom of the top-level CMakeLists: + + include(CMakePackageConfigHelpers) + # generate the config file that is includes the exports + configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in + "${CMAKE_CURRENT_BINARY_DIR}/MathFunctionsConfig.cmake" + INSTALL_DESTINATION "lib/cmake/example" + NO_SET_AND_CHECK_MACRO + NO_CHECK_REQUIRED_COMPONENTS_MACRO + ) + # generate the version file for the config file + write_basic_package_version_file( + "${CMAKE_CURRENT_BINARY_DIR}/MathFunctionsConfigVersion.cmake" + VERSION "${Tutorial_VERSION_MAJOR}.${Tutorial_VERSION_MINOR}" + COMPATIBILITY AnyNewerVersion + ) + + # install the configuration file + install(FILES + ${CMAKE_CURRENT_BINARY_DIR}/MathFunctionsConfig.cmake + DESTINATION lib/cmake/MathFunctions + ) + +At this point, we have generated a relocatable CMake Configuration for our project +that can be used after the project has been installed or packaged. If we want +our project to also be used from a build directory we only have to add +the following to the bottom of the top level CMakeLists: + + # generate the export targets for the build tree + # needs to be after the install(TARGETS ) command + export(EXPORT MathFunctionsTargets + FILE "${CMAKE_CURRENT_BINARY_DIR}/MathFunctionsTargets.cmake" + ) + +With this export call we now generate a Targets.cmake, allowing the configured +MathFunctionsConfig.cmake in the build directory to be used by other projects, +without needing it to be installed. diff --git a/Tests/Tutorial/Step11/tutorial.cxx b/Tests/Tutorial/Step11/tutorial.cxx new file mode 100644 index 0000000..3768855 --- /dev/null +++ b/Tests/Tutorial/Step11/tutorial.cxx @@ -0,0 +1,25 @@ +// A simple program that computes the square root of a number +#include +#include +#include + +#include "MathFunctions.h" +#include "TutorialConfig.h" + +int main(int argc, char* argv[]) +{ + if (argc < 2) { + std::cout << argv[0] << " Version " << Tutorial_VERSION_MAJOR << "." + << Tutorial_VERSION_MAJOR << std::endl; + std::cout << "Usage: " << argv[0] << " number" << std::endl; + return 1; + } + + double inputValue = std::stod(argv[1]); + + const double outputValue = mathfunctions::sqrt(inputValue); + + std::cout << "The square root of " << inputValue << " is " << outputValue + << std::endl; + return 0; +} diff --git a/Tests/Tutorial/Step2/CMakeLists.txt b/Tests/Tutorial/Step2/CMakeLists.txt index cf1d30e..48afaa3 100644 --- a/Tests/Tutorial/Step2/CMakeLists.txt +++ b/Tests/Tutorial/Step2/CMakeLists.txt @@ -1,31 +1,25 @@ -cmake_minimum_required (VERSION 2.6) -project (Tutorial) +cmake_minimum_required(VERSION 3.3) +project(Tutorial) -# The version number. -set (Tutorial_VERSION_MAJOR 1) -set (Tutorial_VERSION_MINOR 0) +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED True) -# should we use our own math functions -option(USE_MYMATH "Use tutorial provided math implementation" ON) +# the version number. +set(Tutorial_VERSION_MAJOR 1) +set(Tutorial_VERSION_MINOR 0) # configure a header file to pass some of the CMake settings # to the source code -configure_file ( +configure_file( "${PROJECT_SOURCE_DIR}/TutorialConfig.h.in" "${PROJECT_BINARY_DIR}/TutorialConfig.h" ) +# add the executable +add_executable(Tutorial tutorial.cxx) + # add the binary tree to the search path for include files # so that we will find TutorialConfig.h -include_directories ("${PROJECT_BINARY_DIR}") - -# add the MathFunctions library? -if (USE_MYMATH) - include_directories ("${PROJECT_SOURCE_DIR}/MathFunctions") - add_subdirectory (MathFunctions) - set (EXTRA_LIBS ${EXTRA_LIBS} MathFunctions) -endif () - -# add the executable -add_executable (Tutorial tutorial.cxx) -target_link_libraries (Tutorial ${EXTRA_LIBS}) +target_include_directories(Tutorial PUBLIC + "${PROJECT_BINARY_DIR}" + ) diff --git a/Tests/Tutorial/Step2/MathFunctions/mysqrt.cxx b/Tests/Tutorial/Step2/MathFunctions/mysqrt.cxx index 2710f92..7d9379e 100644 --- a/Tests/Tutorial/Step2/MathFunctions/mysqrt.cxx +++ b/Tests/Tutorial/Step2/MathFunctions/mysqrt.cxx @@ -1,5 +1,5 @@ #include "MathFunctions.h" -#include +#include // a hack square root calculation using simple operations double mysqrt(double x) @@ -8,19 +8,16 @@ double mysqrt(double x) return 0; } - double result; - double delta; - result = x; + double result = x; // do ten iterations - int i; - for (i = 0; i < 10; ++i) { + for (int i = 0; i < 10; ++i) { if (result <= 0) { result = 0.1; } - delta = x - (result * result); + double delta = x - (result * result); result = result + 0.5 * delta / result; - fprintf(stdout, "Computing sqrt of %g to be %g\n", x, result); + std::cout << "Computing sqrt of " << x << " to be " << result << std::endl; } return result; } diff --git a/Tests/Tutorial/Step2/TutorialConfig.h.in b/Tests/Tutorial/Step2/TutorialConfig.h.in index 25a0602..5395a06 100644 --- a/Tests/Tutorial/Step2/TutorialConfig.h.in +++ b/Tests/Tutorial/Step2/TutorialConfig.h.in @@ -1,5 +1,4 @@ // the configured options and settings for Tutorial #define Tutorial_VERSION_MAJOR @Tutorial_VERSION_MAJOR@ #define Tutorial_VERSION_MINOR @Tutorial_VERSION_MINOR@ -#cmakedefine USE_MYMATH diff --git a/Tests/Tutorial/Step2/directions.txt b/Tests/Tutorial/Step2/directions.txt new file mode 100644 index 0000000..bb6662c --- /dev/null +++ b/Tests/Tutorial/Step2/directions.txt @@ -0,0 +1,102 @@ +# Adding a Library # + +Now we will add a library to our project. This library will contain our own +implementation for computing the square root of a number. The executable can +then use this library instead of the standard square root function provided by +the compiler. + +For this tutorial we will put the library into a subdirectory +called MathFunctions. It will have the following one line CMakeLists file: + + add_library(MathFunctions mysqrt.cxx) + +The source file mysqrt.cxx has one function called mysqrt that provides similar +functionality to the compiler?s sqrt function. To make use of the new library +we add an add_subdirectory call in the top-level CMakeLists file so that the +library will get built. We add the new library to the executable, and add the +MathFunctions as an include directory so that mqsqrt.h header file can be +found. The last few lines of the top-level CMakeLists file now look like: + + + add_subdirectory(MathFunctions) + + #add the executable + add_executable(Tutorial tutorial.cxx) + + target_link_libraries(Tutorial ${EXTRA_LIBS}) + + +Now let us make the MathFunctions library optional. While for the tutorial +there really isn?t any need to do so, but with larger projects this is a common +occurrence. The first step is to add an option to the top-level CMakeLists file. + + option (USE_MYMATH + "Use tutorial provided math implementation" ON) + +This will show up in CMake GUI and ccmake with a default value of ON that can +be changed by the user. This setting will be stored so that the user does not +need to set the value each time they run CMake on this build directory. + +The next change is to make building and linking the MathFunctions library +conditional. To do this we change the top-level CMakeLists file to look like +the following: + + cmake_minimum_required(VERSION 3.3) + project(Tutorial) + + set(CMAKE_CXX_STANDARD 11) + set(CMAKE_CXX_STANDARD_REQUIRED True) + + # the version number. + set(Tutorial_VERSION_MAJOR 1) + set(Tutorial_VERSION_MINOR 0) + + # configure a header file to pass some of the CMake settings + # to the source code + configure_file( + "${PROJECT_SOURCE_DIR}/TutorialConfig.h.in" + "${PROJECT_BINARY_DIR}/TutorialConfig.h" + ) + + # should we use our own math functions + option(USE_MYMATH "Use tutorial provided math implementation" ON) + + # add the MathFunctions library? + if(USE_MYMATH) + add_subdirectory(MathFunctions) + list(APPEND EXTRA_LIBS MathFunctions) + list(APPEND EXTRA_INCLUDES "${PROJECT_SOURCE_DIR}/MathFunctions") + endif(USE_MYMATH) + + # add the executable + add_executable(Tutorial tutorial.cxx) + + target_link_libraries(Tutorial ${EXTRA_LIBS}) + + # add the binary tree to the search path for include files + # so that we will find TutorialConfig.h + target_include_directories(Tutorial PUBLIC + "${PROJECT_BINARY_DIR}" + ${EXTRA_INCLUDES} + ) + +Note the use of the variables EXTRA_LIBS, and EXTRA_INCLUDES to collect +up any optional libraries to later be linked into the executable. This is a +classic approach when dealing with many optional components, we will cover the +modern approach in the next step. For now the corresponding changes to the +source code are fairly straightforward and leave us with: + + #ifdef USE_MYMATH + double outputValue = mysqrt(inputValue); + #else + double outputValue = sqrt(inputValue); + #endif + +Since the source code now requires USE_MYMATH we can add it to the +TutorialConfig.h.in. Simply add the following line: + #cmakedefine USE_MYMATH + +Run cmake or cmake-gui to configure the project and then build it with your +chosen build tool and then run the built Tutorial executable. + +Which function gives better results, Step1?s sqrt or Step2?s mysqrt? diff --git a/Tests/Tutorial/Step2/tutorial.cxx b/Tests/Tutorial/Step2/tutorial.cxx index 37f6ac4..75b7d67 100644 --- a/Tests/Tutorial/Step2/tutorial.cxx +++ b/Tests/Tutorial/Step2/tutorial.cxx @@ -1,33 +1,23 @@ // A simple program that computes the square root of a number -#include "TutorialConfig.h" -#include -#include -#include +#include +#include +#include -#ifdef USE_MYMATH -# include "MathFunctions.h" -#endif +#include "TutorialConfig.h" int main(int argc, char* argv[]) { if (argc < 2) { - fprintf(stdout, "%s Version %d.%d\n", argv[0], Tutorial_VERSION_MAJOR, - Tutorial_VERSION_MINOR); - fprintf(stdout, "Usage: %s number\n", argv[0]); + std::cout << argv[0] << " Version " << Tutorial_VERSION_MAJOR << "." + << Tutorial_VERSION_MAJOR << std::endl; + std::cout << "Usage: " << argv[0] << " number" << std::endl; return 1; } - double inputValue = atof(argv[1]); - double outputValue = 0; - - if (inputValue >= 0) { -#ifdef USE_MYMATH - outputValue = mysqrt(inputValue); -#else - outputValue = sqrt(inputValue); -#endif - } + double inputValue = std::stod(argv[1]); - fprintf(stdout, "The square root of %g is %g\n", inputValue, outputValue); + double outputValue = sqrt(inputValue); + std::cout << "The square root of " << inputValue << " is " << outputValue + << std::endl; return 0; } diff --git a/Tests/Tutorial/Step3/CMakeLists.txt b/Tests/Tutorial/Step3/CMakeLists.txt index 762302b..f904ea7 100644 --- a/Tests/Tutorial/Step3/CMakeLists.txt +++ b/Tests/Tutorial/Step3/CMakeLists.txt @@ -1,68 +1,38 @@ -cmake_minimum_required (VERSION 2.6) -project (Tutorial) +cmake_minimum_required(VERSION 3.3) +project(Tutorial) -# The version number. -set (Tutorial_VERSION_MAJOR 1) -set (Tutorial_VERSION_MINOR 0) +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED True) # should we use our own math functions option(USE_MYMATH "Use tutorial provided math implementation" ON) +# the version number. +set(Tutorial_VERSION_MAJOR 1) +set(Tutorial_VERSION_MINOR 0) + # configure a header file to pass some of the CMake settings # to the source code -configure_file ( +configure_file( "${PROJECT_SOURCE_DIR}/TutorialConfig.h.in" "${PROJECT_BINARY_DIR}/TutorialConfig.h" ) -# add the binary tree to the search path for include files -# so that we will find TutorialConfig.h -include_directories ("${PROJECT_BINARY_DIR}") - # add the MathFunctions library? -if (USE_MYMATH) - include_directories ("${PROJECT_SOURCE_DIR}/MathFunctions") - add_subdirectory (MathFunctions) - set (EXTRA_LIBS ${EXTRA_LIBS} MathFunctions) -endif () +if(USE_MYMATH) + add_subdirectory(MathFunctions) + list(APPEND EXTRA_LIBS MathFunctions) + list(APPEND EXTRA_INCLUDES "${PROJECT_SOURCE_DIR}/MathFunctions") +endif(USE_MYMATH) # add the executable -add_executable (Tutorial tutorial.cxx) -target_link_libraries (Tutorial ${EXTRA_LIBS}) - -# add the install targets -install (TARGETS Tutorial DESTINATION bin) -install (FILES "${PROJECT_BINARY_DIR}/TutorialConfig.h" - DESTINATION include) - - -# enable testing -enable_testing () - -# does the application run -add_test (TutorialRuns Tutorial 25) +add_executable(Tutorial tutorial.cxx) -# does it sqrt of 25 -add_test (TutorialComp25 Tutorial 25) -set_tests_properties (TutorialComp25 - PROPERTIES PASS_REGULAR_EXPRESSION "25 is 5" - ) - -# does it handle negative numbers -add_test (TutorialNegative Tutorial -25) -set_tests_properties (TutorialNegative - PROPERTIES PASS_REGULAR_EXPRESSION "-25 is 0" - ) - -# does it handle small numbers -add_test (TutorialSmall Tutorial 0.0001) -set_tests_properties (TutorialSmall - PROPERTIES PASS_REGULAR_EXPRESSION "0.0001 is 0.01" - ) +target_link_libraries(Tutorial ${EXTRA_LIBS}) -# does the usage message work? -add_test (TutorialUsage Tutorial) -set_tests_properties (TutorialUsage - PROPERTIES - PASS_REGULAR_EXPRESSION "Usage:.*number" - ) +# add the binary tree to the search path for include files +# so that we will find TutorialConfig.h +target_include_directories(Tutorial PUBLIC + "${PROJECT_BINARY_DIR}" + ${EXTRA_INCLUDES} + ) diff --git a/Tests/Tutorial/Step3/MathFunctions/CMakeLists.txt b/Tests/Tutorial/Step3/MathFunctions/CMakeLists.txt index f386036..8b443a6 100644 --- a/Tests/Tutorial/Step3/MathFunctions/CMakeLists.txt +++ b/Tests/Tutorial/Step3/MathFunctions/CMakeLists.txt @@ -1,4 +1 @@ add_library(MathFunctions mysqrt.cxx) - -install (TARGETS MathFunctions DESTINATION bin) -install (FILES MathFunctions.h DESTINATION include) diff --git a/Tests/Tutorial/Step3/MathFunctions/mysqrt.cxx b/Tests/Tutorial/Step3/MathFunctions/mysqrt.cxx index 2710f92..7d9379e 100644 --- a/Tests/Tutorial/Step3/MathFunctions/mysqrt.cxx +++ b/Tests/Tutorial/Step3/MathFunctions/mysqrt.cxx @@ -1,5 +1,5 @@ #include "MathFunctions.h" -#include +#include // a hack square root calculation using simple operations double mysqrt(double x) @@ -8,19 +8,16 @@ double mysqrt(double x) return 0; } - double result; - double delta; - result = x; + double result = x; // do ten iterations - int i; - for (i = 0; i < 10; ++i) { + for (int i = 0; i < 10; ++i) { if (result <= 0) { result = 0.1; } - delta = x - (result * result); + double delta = x - (result * result); result = result + 0.5 * delta / result; - fprintf(stdout, "Computing sqrt of %g to be %g\n", x, result); + std::cout << "Computing sqrt of " << x << " to be " << result << std::endl; } return result; } diff --git a/Tests/Tutorial/Step3/directions.txt b/Tests/Tutorial/Step3/directions.txt new file mode 100644 index 0000000..54d0318 --- /dev/null +++ b/Tests/Tutorial/Step3/directions.txt @@ -0,0 +1,26 @@ +# Adding Usage Requirements for Library # + +Usage requirements allow for far better control over a library / executable's +link and include line. While also giving more control over the transitive +property of targets inside CMake. The primary commands that leverage usage +requirements are: + + - target_compile_definitions + - target_compile_options + - target_include_directories + - target_link_libraries + +First up is MathFunctions. We first state that anybody linking to MathFunctions +needs to include the current source directory, while MathFunctions itself +doesn't. So this can become an INTERFACE usage requirement. + +Remember INTERFACE means things that consumers require but the producer doesn't. + + target_include_directories(MathFunctions + INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) + +Now that we've specified usage requirements for MathFunctions we can safely remove +our uses of the EXTRA_INCLUDES variable. + +Run cmake or cmake-gui to configure the project and then build it with your +chosen build tool. diff --git a/Tests/Tutorial/Step3/tutorial.cxx b/Tests/Tutorial/Step3/tutorial.cxx index 37f6ac4..1d5742d 100644 --- a/Tests/Tutorial/Step3/tutorial.cxx +++ b/Tests/Tutorial/Step3/tutorial.cxx @@ -1,8 +1,9 @@ // A simple program that computes the square root of a number +#include +#include +#include + #include "TutorialConfig.h" -#include -#include -#include #ifdef USE_MYMATH # include "MathFunctions.h" @@ -11,23 +12,21 @@ int main(int argc, char* argv[]) { if (argc < 2) { - fprintf(stdout, "%s Version %d.%d\n", argv[0], Tutorial_VERSION_MAJOR, - Tutorial_VERSION_MINOR); - fprintf(stdout, "Usage: %s number\n", argv[0]); + std::cout << argv[0] << " Version " << Tutorial_VERSION_MAJOR << "." + << Tutorial_VERSION_MAJOR << std::endl; + std::cout << "Usage: " << argv[0] << " number" << std::endl; return 1; } - double inputValue = atof(argv[1]); - double outputValue = 0; + double inputValue = std::stod(argv[1]); - if (inputValue >= 0) { #ifdef USE_MYMATH - outputValue = mysqrt(inputValue); + double outputValue = mysqrt(inputValue); #else - outputValue = sqrt(inputValue); + double outputValue = sqrt(inputValue); #endif - } - fprintf(stdout, "The square root of %g is %g\n", inputValue, outputValue); + std::cout << "The square root of " << inputValue << " is " << outputValue + << std::endl; return 0; } diff --git a/Tests/Tutorial/Step4/CMakeLists.txt b/Tests/Tutorial/Step4/CMakeLists.txt index 6994aa1..34eab55 100644 --- a/Tests/Tutorial/Step4/CMakeLists.txt +++ b/Tests/Tutorial/Step4/CMakeLists.txt @@ -1,68 +1,36 @@ -cmake_minimum_required (VERSION 2.6) -project (Tutorial) +cmake_minimum_required(VERSION 3.3) +project(Tutorial) -# The version number. -set (Tutorial_VERSION_MAJOR 1) -set (Tutorial_VERSION_MINOR 0) - -# does this system provide the log and exp functions? -include (${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake) -check_function_exists (log HAVE_LOG) -check_function_exists (exp HAVE_EXP) +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED True) # should we use our own math functions option(USE_MYMATH "Use tutorial provided math implementation" ON) +# the version number. +set(Tutorial_VERSION_MAJOR 1) +set(Tutorial_VERSION_MINOR 0) + # configure a header file to pass some of the CMake settings # to the source code -configure_file ( +configure_file( "${PROJECT_SOURCE_DIR}/TutorialConfig.h.in" "${PROJECT_BINARY_DIR}/TutorialConfig.h" ) -# add the binary tree to the search path for include files -# so that we will find TutorialConfig.h -include_directories ("${PROJECT_BINARY_DIR}") - # add the MathFunctions library? -if (USE_MYMATH) - include_directories ("${PROJECT_SOURCE_DIR}/MathFunctions") - add_subdirectory (MathFunctions) - set (EXTRA_LIBS ${EXTRA_LIBS} MathFunctions) -endif () +if(USE_MYMATH) + add_subdirectory(MathFunctions) + list(APPEND EXTRA_LIBS MathFunctions) +endif(USE_MYMATH) # add the executable -add_executable (Tutorial tutorial.cxx) -target_link_libraries (Tutorial ${EXTRA_LIBS}) - -# add the install targets -install (TARGETS Tutorial DESTINATION bin) -install (FILES "${PROJECT_BINARY_DIR}/TutorialConfig.h" - DESTINATION include) - -# enable testing -enable_testing () +add_executable(Tutorial tutorial.cxx) -# does the application run -add_test (TutorialRuns Tutorial 25) - -# does the usage message work? -add_test (TutorialUsage Tutorial) -set_tests_properties (TutorialUsage - PROPERTIES - PASS_REGULAR_EXPRESSION "Usage:.*number" - ) - -#define a macro to simplify adding tests -macro (do_test arg result) - add_test (TutorialComp${arg} Tutorial ${arg}) - set_tests_properties (TutorialComp${arg} - PROPERTIES PASS_REGULAR_EXPRESSION ${result} - ) -endmacro () - -# do a bunch of result based tests -do_test (25 "25 is 5") -do_test (-25 "-25 is 0") -do_test (0.0001 "0.0001 is 0.01") +target_link_libraries(Tutorial PUBLIC ${EXTRA_LIBS}) +# add the binary tree to the search path for include files +# so that we will find TutorialConfig.h +target_include_directories(Tutorial PUBLIC + "${PROJECT_BINARY_DIR}" + ) diff --git a/Tests/Tutorial/Step4/MathFunctions/CMakeLists.txt b/Tests/Tutorial/Step4/MathFunctions/CMakeLists.txt index f386036..0515852 100644 --- a/Tests/Tutorial/Step4/MathFunctions/CMakeLists.txt +++ b/Tests/Tutorial/Step4/MathFunctions/CMakeLists.txt @@ -1,4 +1,7 @@ add_library(MathFunctions mysqrt.cxx) -install (TARGETS MathFunctions DESTINATION bin) -install (FILES MathFunctions.h DESTINATION include) +# state that anybody linking to us needs to include the current source dir +# to find MathFunctions.h, while we don't. +target_include_directories(MathFunctions + INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} + ) diff --git a/Tests/Tutorial/Step4/MathFunctions/mysqrt.cxx b/Tests/Tutorial/Step4/MathFunctions/mysqrt.cxx index 6ca264f..7d9379e 100644 --- a/Tests/Tutorial/Step4/MathFunctions/mysqrt.cxx +++ b/Tests/Tutorial/Step4/MathFunctions/mysqrt.cxx @@ -1,8 +1,5 @@ #include "MathFunctions.h" -#include "TutorialConfig.h" -#include - -#include +#include // a hack square root calculation using simple operations double mysqrt(double x) @@ -11,26 +8,16 @@ double mysqrt(double x) return 0; } - double result; - -// if we have both log and exp then use them -#if defined(HAVE_LOG) && defined(HAVE_EXP) - result = exp(log(x) * 0.5); - fprintf(stdout, "Computing sqrt of %g to be %g using log\n", x, result); -#else - double delta; - result = x; + double result = x; // do ten iterations - int i; - for (i = 0; i < 10; ++i) { + for (int i = 0; i < 10; ++i) { if (result <= 0) { result = 0.1; } - delta = x - (result * result); + double delta = x - (result * result); result = result + 0.5 * delta / result; - fprintf(stdout, "Computing sqrt of %g to be %g\n", x, result); + std::cout << "Computing sqrt of " << x << " to be " << result << std::endl; } -#endif return result; } diff --git a/Tests/Tutorial/Step4/TutorialConfig.h.in b/Tests/Tutorial/Step4/TutorialConfig.h.in index a091265..25a0602 100644 --- a/Tests/Tutorial/Step4/TutorialConfig.h.in +++ b/Tests/Tutorial/Step4/TutorialConfig.h.in @@ -3,7 +3,3 @@ #define Tutorial_VERSION_MINOR @Tutorial_VERSION_MINOR@ #cmakedefine USE_MYMATH -// does the platform provide exp and log functions? -#cmakedefine HAVE_LOG -#cmakedefine HAVE_EXP - diff --git a/Tests/Tutorial/Step4/directions.txt b/Tests/Tutorial/Step4/directions.txt new file mode 100644 index 0000000..91e4043 --- /dev/null +++ b/Tests/Tutorial/Step4/directions.txt @@ -0,0 +1,72 @@ +# Installing and Testing # + +Now we can start adding testing support and install rules to our project. + +The install rules are fairly simple; for MathFunctions we install the library +and header file, for the application we install the executable and configured +header. + +So to MathFunctions/CMakeLists.txt we add: + + install (TARGETS MathFunctions DESTINATION bin) + install (FILES MathFunctions.h DESTINATION include) + +And the to top-level CMakeLists.txt we add: + + install(TARGETS Tutorial DESTINATION bin) + install(FILES "${PROJECT_BINARY_DIR}/TutorialConfig.h" + DESTINATION include + ) + +That is all that is needed to create a basic local install of the tutorial. + +Run cmake or cmake-gui to configure the project and then build it with your +chosen build tool. Then build the ?install? target by typing 'make install' +from the command line or build the INSTALL target from an IDE. This will +install the appropriate header files, libraries, and executables. + +Verify that the installed Tutorial runs. Note: The CMake variable +CMAKE_INSTALL_PREFIX is used to determine the root of where the files will +be installed. + +Next let's test our application. Adding testing is an easy process. At the +end of the top-level CMakeLists file we can add a number of basic tests to +verify that the application is working correctly. + + # enable testing + enable_testing() + + # does the application run + add_test(NAME Runs COMMAND Tutorial 25) + + # does the usage message work? + add_test(NAME Usage COMMAND Tutorial) + set_tests_properties(Usage + PROPERTIES PASS_REGULAR_EXPRESSION "Usage:.*number" + ) + + # define a function to simplify adding tests + function(do_test target arg result) + add_test(NAME Comp${arg} COMMAND ${target} ${arg}) + set_tests_properties(Comp${arg} + PROPERTIES PASS_REGULAR_EXPRESSION ${result} + ) + endfunction(do_test) + + # do a bunch of result based tests + do_test(Tutorial 25 "25 is 5") + do_test(Tutorial -25 "-25 is [-nan|nan|0]") + do_test(Tutorial 0.0001 "0.0001 is 0.01") + +The first test simply verifies that the application runs, does not segfault or +otherwise crash, and has a zero return value. This is the basic form of a CTest +test. + +The Usage test uses a regular expression to verify that the usage message +is printed when an incorrect number of arguments are provided. + +Lastly, we have a function called do_test that simplifies running the +application and verifying that the computed square root is correct for given +input. + +To run tests, cd to the binary directory and run ?ctest -N? and ?ctest -VV?. diff --git a/Tests/Tutorial/Step4/tutorial.cxx b/Tests/Tutorial/Step4/tutorial.cxx index 37f6ac4..1d5742d 100644 --- a/Tests/Tutorial/Step4/tutorial.cxx +++ b/Tests/Tutorial/Step4/tutorial.cxx @@ -1,8 +1,9 @@ // A simple program that computes the square root of a number +#include +#include +#include + #include "TutorialConfig.h" -#include -#include -#include #ifdef USE_MYMATH # include "MathFunctions.h" @@ -11,23 +12,21 @@ int main(int argc, char* argv[]) { if (argc < 2) { - fprintf(stdout, "%s Version %d.%d\n", argv[0], Tutorial_VERSION_MAJOR, - Tutorial_VERSION_MINOR); - fprintf(stdout, "Usage: %s number\n", argv[0]); + std::cout << argv[0] << " Version " << Tutorial_VERSION_MAJOR << "." + << Tutorial_VERSION_MAJOR << std::endl; + std::cout << "Usage: " << argv[0] << " number" << std::endl; return 1; } - double inputValue = atof(argv[1]); - double outputValue = 0; + double inputValue = std::stod(argv[1]); - if (inputValue >= 0) { #ifdef USE_MYMATH - outputValue = mysqrt(inputValue); + double outputValue = mysqrt(inputValue); #else - outputValue = sqrt(inputValue); + double outputValue = sqrt(inputValue); #endif - } - fprintf(stdout, "The square root of %g is %g\n", inputValue, outputValue); + std::cout << "The square root of " << inputValue << " is " << outputValue + << std::endl; return 0; } diff --git a/Tests/Tutorial/Step5/CMakeLists.txt b/Tests/Tutorial/Step5/CMakeLists.txt index e40b676..63e5410 100644 --- a/Tests/Tutorial/Step5/CMakeLists.txt +++ b/Tests/Tutorial/Step5/CMakeLists.txt @@ -1,72 +1,70 @@ -cmake_minimum_required (VERSION 2.6) -project (Tutorial) +cmake_minimum_required(VERSION 3.3) +project(Tutorial) -# The version number. -set (Tutorial_VERSION_MAJOR 1) -set (Tutorial_VERSION_MINOR 0) - -# does this system provide the log and exp functions? -include (${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake) -check_function_exists (log HAVE_LOG) -check_function_exists (exp HAVE_EXP) +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED True) # should we use our own math functions option(USE_MYMATH "Use tutorial provided math implementation" ON) +# the version number. +set(Tutorial_VERSION_MAJOR 1) +set(Tutorial_VERSION_MINOR 0) + # configure a header file to pass some of the CMake settings # to the source code -configure_file ( +configure_file( "${PROJECT_SOURCE_DIR}/TutorialConfig.h.in" "${PROJECT_BINARY_DIR}/TutorialConfig.h" ) -# add the binary tree to the search path for include files -# so that we will find TutorialConfig.h -include_directories ("${PROJECT_BINARY_DIR}") - # add the MathFunctions library? -if (USE_MYMATH) - include_directories ("${PROJECT_SOURCE_DIR}/MathFunctions") - add_subdirectory (MathFunctions) - set (EXTRA_LIBS ${EXTRA_LIBS} MathFunctions) -endif () +if(USE_MYMATH) + add_subdirectory(MathFunctions) + list(APPEND EXTRA_LIBS MathFunctions) +endif() # add the executable -add_executable (Tutorial tutorial.cxx) -target_link_libraries (Tutorial ${EXTRA_LIBS}) +add_executable(Tutorial tutorial.cxx) +target_link_libraries(Tutorial PUBLIC ${EXTRA_LIBS}) + +# add the binary tree to the search path for include files +# so that we will find TutorialConfig.h +target_include_directories(Tutorial PUBLIC + "${PROJECT_BINARY_DIR}" + ) # add the install targets -install (TARGETS Tutorial DESTINATION bin) -install (FILES "${PROJECT_BINARY_DIR}/TutorialConfig.h" - DESTINATION include) +install(TARGETS Tutorial DESTINATION bin) +install(FILES "${PROJECT_BINARY_DIR}/TutorialConfig.h" + DESTINATION include + ) # enable testing -enable_testing () +enable_testing() # does the application run -add_test (TutorialRuns Tutorial 25) +add_test(NAME Runs COMMAND Tutorial 25) # does the usage message work? -add_test (TutorialUsage Tutorial) -set_tests_properties (TutorialUsage - PROPERTIES - PASS_REGULAR_EXPRESSION "Usage:.*number" +add_test(NAME Usage COMMAND Tutorial) +set_tests_properties(Usage + PROPERTIES PASS_REGULAR_EXPRESSION "Usage:.*number" ) -#define a macro to simplify adding tests -macro (do_test arg result) - add_test (TutorialComp${arg} Tutorial ${arg}) - set_tests_properties (TutorialComp${arg} +# define a function to simplify adding tests +function(do_test target arg result) + add_test(NAME Comp${arg} COMMAND ${target} ${arg}) + set_tests_properties(Comp${arg} PROPERTIES PASS_REGULAR_EXPRESSION ${result} ) -endmacro () +endfunction(do_test) # do a bunch of result based tests -do_test (4 "4 is 2") -do_test (9 "9 is 3") -do_test (5 "5 is 2.236") -do_test (7 "7 is 2.645") -do_test (25 "25 is 5") -do_test (-25 "-25 is 0") -do_test (0.0001 "0.0001 is 0.01") - +do_test(Tutorial 4 "4 is 2") +do_test(Tutorial 9 "9 is 3") +do_test(Tutorial 5 "5 is 2.236") +do_test(Tutorial 7 "7 is 2.645") +do_test(Tutorial 25 "25 is 5") +do_test(Tutorial -25 "-25 is [-nan|nan|0]") +do_test(Tutorial 0.0001 "0.0001 is 0.01") diff --git a/Tests/Tutorial/Step5/MathFunctions/CMakeLists.txt b/Tests/Tutorial/Step5/MathFunctions/CMakeLists.txt index 453a463..11cf412 100644 --- a/Tests/Tutorial/Step5/MathFunctions/CMakeLists.txt +++ b/Tests/Tutorial/Step5/MathFunctions/CMakeLists.txt @@ -1,17 +1,10 @@ -# first we add the executable that generates the table -# add the binary tree directory to the search path for include files -include_directories( ${CMAKE_CURRENT_BINARY_DIR} ) +add_library(MathFunctions mysqrt.cxx) -add_executable(MakeTable MakeTable.cxx ) -# add the command to generate the source code -add_custom_command ( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Table.h - COMMAND MakeTable ${CMAKE_CURRENT_BINARY_DIR}/Table.h - DEPENDS MakeTable - ) +# state that anybody linking to us needs to include the current source dir +# to find MathFunctions.h, while we don't. +target_include_directories(MathFunctions + INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} + ) -# add the main library -add_library(MathFunctions mysqrt.cxx ${CMAKE_CURRENT_BINARY_DIR}/Table.h ) - -install (TARGETS MathFunctions DESTINATION bin) -install (FILES MathFunctions.h DESTINATION include) +install(TARGETS MathFunctions DESTINATION lib) +install(FILES MathFunctions.h DESTINATION include) diff --git a/Tests/Tutorial/Step5/MathFunctions/MakeTable.cxx b/Tests/Tutorial/Step5/MathFunctions/MakeTable.cxx index cebd50f..ee58556 100644 --- a/Tests/Tutorial/Step5/MathFunctions/MakeTable.cxx +++ b/Tests/Tutorial/Step5/MathFunctions/MakeTable.cxx @@ -1,32 +1,25 @@ // A simple program that builds a sqrt table -#include -#include +#include +#include +#include int main(int argc, char* argv[]) { - int i; - double result; - // make sure we have enough arguments if (argc < 2) { return 1; } - // open the output file - FILE* fout = fopen(argv[1], "w"); - if (!fout) { - return 1; + std::ofstream fout(argv[1], std::ios_base::out); + const bool fileOpen = fout.is_open(); + if (fileOpen) { + fout << "double sqrtTable[] = {" << std::endl; + for (int i = 0; i < 10; ++i) { + fout << sqrt(static_cast(i)) << "," << std::endl; + } + // close the table with a zero + fout << "0};" << std::endl; + fout.close(); } - - // create a source file with a table of square roots - fprintf(fout, "double sqrtTable[] = {\n"); - for (i = 0; i < 10; ++i) { - result = sqrt(static_cast(i)); - fprintf(fout, "%g,\n", result); - } - - // close the table with a zero - fprintf(fout, "0};\n"); - fclose(fout); - return 0; + return fileOpen ? 0 : 1; // return 0 if wrote the file } diff --git a/Tests/Tutorial/Step5/MathFunctions/mysqrt.cxx b/Tests/Tutorial/Step5/MathFunctions/mysqrt.cxx index 458ed63..7d9379e 100644 --- a/Tests/Tutorial/Step5/MathFunctions/mysqrt.cxx +++ b/Tests/Tutorial/Step5/MathFunctions/mysqrt.cxx @@ -1,11 +1,5 @@ #include "MathFunctions.h" -#include "TutorialConfig.h" -#include - -// include the generated table -#include "Table.h" - -#include +#include // a hack square root calculation using simple operations double mysqrt(double x) @@ -14,27 +8,16 @@ double mysqrt(double x) return 0; } - double result; - - // if we have both log and exp then use them - double delta; - - // use the table to help find an initial value - result = x; - if (x >= 1 && x < 10) { - result = sqrtTable[static_cast(x)]; - } + double result = x; // do ten iterations - int i; - for (i = 0; i < 10; ++i) { + for (int i = 0; i < 10; ++i) { if (result <= 0) { result = 0.1; } - delta = x - (result * result); + double delta = x - (result * result); result = result + 0.5 * delta / result; - fprintf(stdout, "Computing sqrt of %g to be %g\n", x, result); + std::cout << "Computing sqrt of " << x << " to be " << result << std::endl; } - return result; } diff --git a/Tests/Tutorial/Step5/TutorialConfig.h.in b/Tests/Tutorial/Step5/TutorialConfig.h.in index a091265..25a0602 100644 --- a/Tests/Tutorial/Step5/TutorialConfig.h.in +++ b/Tests/Tutorial/Step5/TutorialConfig.h.in @@ -3,7 +3,3 @@ #define Tutorial_VERSION_MINOR @Tutorial_VERSION_MINOR@ #cmakedefine USE_MYMATH -// does the platform provide exp and log functions? -#cmakedefine HAVE_LOG -#cmakedefine HAVE_EXP - diff --git a/Tests/Tutorial/Step5/directions.txt b/Tests/Tutorial/Step5/directions.txt new file mode 100644 index 0000000..e6f5197 --- /dev/null +++ b/Tests/Tutorial/Step5/directions.txt @@ -0,0 +1,69 @@ +# Adding System Introspection # + +Let us consider adding some code to our project that depends on features the +target platform may not have. For this example, we will add some code that +depends on whether or not the target platform has the log and exp functions. Of +course almost every platform has these functions but for this tutorial assume +that they are not common. + +If the platform has log and exp then we will use them to compute the square +root in the mysqrt function. We first test for the availability of these +functions using the CheckSymbolExists.cmake macro in the top-level CMakeLists +file as follows: + + # does this system provide the log and exp functions? + include(CheckSymbolExists) + set(CMAKE_REQUIRED_LIBRARIES "m") + check_symbol_exists(log "math.h" HAVE_LOG) + check_symbol_exists(exp "math.h" HAVE_EXP) + +Now let's add these defines to TutorialConfig.h.in so that we can use them +from mysqrt.cxx: + + // does the platform provide exp and log functions? + #cmakedefine HAVE_LOG + #cmakedefine HAVE_EXP + +Modify mysqrt.cxx to include math.h. Next, in the mysqrt function we can +provide an alternate implementation based on log and exp if they are available +on the system using the following code: + + // if we have both log and exp then use them + #if defined(HAVE_LOG) && defined (HAVE_EXP) + double result = exp(log(x)*0.5); + std::cout << "Computing sqrt of " << x << " to be " << result << " using log" << std::endl; + #else + ... + +Run cmake or cmake-gui to configure the project and then build it with your +chosen build tool. + +You will notice that even though HAVE_LOG and HAVE_EXP are both defined mysqrt +isn't using them. We should realize quickly that we have forgotten to include +TutorialConfig.h in mysqrt.cxx. We will also need to update +MathFunctions/CMakeLists.txt with where it is located. + +So let's go ahead and update MathFunctions/CMakeLists.txt to look like: + + add_library(MathFunctions mysqrt.cxx) + + target_include_directories(MathFunctions + INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} + PRIVATE ${Tutorial_BINARY_DIR} + ) + + install(TARGETS MathFunctions DESTINATION lib) + install(FILES MathFunctions.h DESTINATION include) + +Now all we need to do is include TutorialConfig.h in mysqrt.cxx + +At this point you should go ahead and build the project again. + +Run the built Tutorial executable. Which function gives better results now, +Step1?s sqrt or Step5?s mysqrt? + +Exercise: Why is it important that we configure TutorialConfig.h.in after the +checks for HAVE_LOG and HAVE_EXP? What would happen if we inverted the two? + +Exercise: Is there a better place for us to save the HAVE_LOG and HAVE_EXP +values other than in TutorialConfig.h? diff --git a/Tests/Tutorial/Step5/tutorial.cxx b/Tests/Tutorial/Step5/tutorial.cxx index 37f6ac4..1d5742d 100644 --- a/Tests/Tutorial/Step5/tutorial.cxx +++ b/Tests/Tutorial/Step5/tutorial.cxx @@ -1,8 +1,9 @@ // A simple program that computes the square root of a number +#include +#include +#include + #include "TutorialConfig.h" -#include -#include -#include #ifdef USE_MYMATH # include "MathFunctions.h" @@ -11,23 +12,21 @@ int main(int argc, char* argv[]) { if (argc < 2) { - fprintf(stdout, "%s Version %d.%d\n", argv[0], Tutorial_VERSION_MAJOR, - Tutorial_VERSION_MINOR); - fprintf(stdout, "Usage: %s number\n", argv[0]); + std::cout << argv[0] << " Version " << Tutorial_VERSION_MAJOR << "." + << Tutorial_VERSION_MAJOR << std::endl; + std::cout << "Usage: " << argv[0] << " number" << std::endl; return 1; } - double inputValue = atof(argv[1]); - double outputValue = 0; + double inputValue = std::stod(argv[1]); - if (inputValue >= 0) { #ifdef USE_MYMATH - outputValue = mysqrt(inputValue); + double outputValue = mysqrt(inputValue); #else - outputValue = sqrt(inputValue); + double outputValue = sqrt(inputValue); #endif - } - fprintf(stdout, "The square root of %g is %g\n", inputValue, outputValue); + std::cout << "The square root of " << inputValue << " is " << outputValue + << std::endl; return 0; } diff --git a/Tests/Tutorial/Step6/CMakeLists.txt b/Tests/Tutorial/Step6/CMakeLists.txt index 0fb7cac..503a312 100644 --- a/Tests/Tutorial/Step6/CMakeLists.txt +++ b/Tests/Tutorial/Step6/CMakeLists.txt @@ -1,78 +1,76 @@ -cmake_minimum_required (VERSION 2.6) -project (Tutorial) +cmake_minimum_required(VERSION 3.3) +project(Tutorial) -# The version number. -set (Tutorial_VERSION_MAJOR 1) -set (Tutorial_VERSION_MINOR 0) +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED True) + +# the version number. +set(Tutorial_VERSION_MAJOR 1) +set(Tutorial_VERSION_MINOR 0) # does this system provide the log and exp functions? -include (${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake) -check_function_exists (log HAVE_LOG) -check_function_exists (exp HAVE_EXP) +include(CheckSymbolExists) +set(CMAKE_REQUIRED_LIBRARIES "m") +check_symbol_exists(log "math.h" HAVE_LOG) +check_symbol_exists(exp "math.h" HAVE_EXP) # should we use our own math functions option(USE_MYMATH "Use tutorial provided math implementation" ON) # configure a header file to pass some of the CMake settings # to the source code -configure_file ( +configure_file( "${PROJECT_SOURCE_DIR}/TutorialConfig.h.in" "${PROJECT_BINARY_DIR}/TutorialConfig.h" ) -# add the binary tree to the search path for include files -# so that we will find TutorialConfig.h -include_directories ("${PROJECT_BINARY_DIR}") - # add the MathFunctions library? -if (USE_MYMATH) - include_directories ("${PROJECT_SOURCE_DIR}/MathFunctions") - add_subdirectory (MathFunctions) - set (EXTRA_LIBS ${EXTRA_LIBS} MathFunctions) -endif () +if(USE_MYMATH) + add_subdirectory(MathFunctions) + list(APPEND EXTRA_LIBS MathFunctions) +endif() # add the executable -add_executable (Tutorial tutorial.cxx) -target_link_libraries (Tutorial ${EXTRA_LIBS}) +add_executable(Tutorial tutorial.cxx) +target_link_libraries(Tutorial PUBLIC ${EXTRA_LIBS}) + +# add the binary tree to the search path for include files +# so that we will find TutorialConfig.h +target_include_directories(Tutorial PUBLIC + "${PROJECT_BINARY_DIR}" + ) # add the install targets -install (TARGETS Tutorial DESTINATION bin) -install (FILES "${PROJECT_BINARY_DIR}/TutorialConfig.h" - DESTINATION include) +install(TARGETS Tutorial DESTINATION bin) +install(FILES "${PROJECT_BINARY_DIR}/TutorialConfig.h" + DESTINATION include + ) # enable testing -enable_testing () +enable_testing() # does the application run -add_test (TutorialRuns Tutorial 25) +add_test(NAME Runs COMMAND Tutorial 25) # does the usage message work? -add_test (TutorialUsage Tutorial) -set_tests_properties (TutorialUsage - PROPERTIES - PASS_REGULAR_EXPRESSION "Usage:.*number" +add_test(NAME Usage COMMAND Tutorial) +set_tests_properties(Usage + PROPERTIES PASS_REGULAR_EXPRESSION "Usage:.*number" ) -#define a macro to simplify adding tests -macro (do_test arg result) - add_test (TutorialComp${arg} Tutorial ${arg}) - set_tests_properties (TutorialComp${arg} +# define a function to simplify adding tests +function(do_test target arg result) + add_test(NAME Comp${arg} COMMAND ${target} ${arg}) + set_tests_properties(Comp${arg} PROPERTIES PASS_REGULAR_EXPRESSION ${result} ) -endmacro () +endfunction(do_test) # do a bunch of result based tests -do_test (4 "4 is 2") -do_test (9 "9 is 3") -do_test (5 "5 is 2.236") -do_test (7 "7 is 2.645") -do_test (25 "25 is 5") -do_test (-25 "-25 is 0") -do_test (0.0001 "0.0001 is 0.01") - -# build a CPack driven installer package -include (InstallRequiredSystemLibraries) -set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/License.txt") -set (CPACK_PACKAGE_VERSION_MAJOR "${Tutorial_VERSION_MAJOR}") -set (CPACK_PACKAGE_VERSION_MINOR "${Tutorial_VERSION_MINOR}") -include (CPack) +do_test(Tutorial 4 "4 is 2") +do_test(Tutorial 9 "9 is 3") +do_test(Tutorial 5 "5 is 2.236") +do_test(Tutorial 7 "7 is 2.645") +do_test(Tutorial 25 "25 is 5") +do_test(Tutorial -25 "-25 is [-nan|nan|0]") +do_test(Tutorial 0.0001 "0.0001 is 0.01") diff --git a/Tests/Tutorial/Step6/MathFunctions/CMakeLists.txt b/Tests/Tutorial/Step6/MathFunctions/CMakeLists.txt index 70a35f6..2946075 100644 --- a/Tests/Tutorial/Step6/MathFunctions/CMakeLists.txt +++ b/Tests/Tutorial/Step6/MathFunctions/CMakeLists.txt @@ -1,24 +1,14 @@ -# first we add the executable that generates the table -add_executable(MakeTable MakeTable.cxx) - -# add the command to generate the source code -add_custom_command ( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Table.h - DEPENDS MakeTable - COMMAND MakeTable - ARGS ${CMAKE_CURRENT_BINARY_DIR}/Table.h - ) - -set_source_files_properties ( - mysqrt.cxx PROPERTIES - OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/Table.h - ) +add_library(MathFunctions mysqrt.cxx) -# add the binary tree directory to the search path for include files -include_directories( ${CMAKE_CURRENT_BINARY_DIR} ) +# state that anybody linking to us needs to include the current source dir +# to find MathFunctions.h, while we don't. +# state that we depend on Tutorial_BINARY_DIR but consumers don't, as the +# TutorialConfig.h include is an implementation detail -# add the main library -add_library(MathFunctions mysqrt.cxx) +target_include_directories(MathFunctions + INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} + PRIVATE ${Tutorial_BINARY_DIR} + ) -install (TARGETS MathFunctions DESTINATION bin) -install (FILES MathFunctions.h DESTINATION include) +install(TARGETS MathFunctions DESTINATION lib) +install(FILES MathFunctions.h DESTINATION include) diff --git a/Tests/Tutorial/Step6/MathFunctions/MakeTable.cxx b/Tests/Tutorial/Step6/MathFunctions/MakeTable.cxx index cebd50f..ee58556 100644 --- a/Tests/Tutorial/Step6/MathFunctions/MakeTable.cxx +++ b/Tests/Tutorial/Step6/MathFunctions/MakeTable.cxx @@ -1,32 +1,25 @@ // A simple program that builds a sqrt table -#include -#include +#include +#include +#include int main(int argc, char* argv[]) { - int i; - double result; - // make sure we have enough arguments if (argc < 2) { return 1; } - // open the output file - FILE* fout = fopen(argv[1], "w"); - if (!fout) { - return 1; + std::ofstream fout(argv[1], std::ios_base::out); + const bool fileOpen = fout.is_open(); + if (fileOpen) { + fout << "double sqrtTable[] = {" << std::endl; + for (int i = 0; i < 10; ++i) { + fout << sqrt(static_cast(i)) << "," << std::endl; + } + // close the table with a zero + fout << "0};" << std::endl; + fout.close(); } - - // create a source file with a table of square roots - fprintf(fout, "double sqrtTable[] = {\n"); - for (i = 0; i < 10; ++i) { - result = sqrt(static_cast(i)); - fprintf(fout, "%g,\n", result); - } - - // close the table with a zero - fprintf(fout, "0};\n"); - fclose(fout); - return 0; + return fileOpen ? 0 : 1; // return 0 if wrote the file } diff --git a/Tests/Tutorial/Step6/MathFunctions/mysqrt.cxx b/Tests/Tutorial/Step6/MathFunctions/mysqrt.cxx index 458ed63..b9ad20a 100644 --- a/Tests/Tutorial/Step6/MathFunctions/mysqrt.cxx +++ b/Tests/Tutorial/Step6/MathFunctions/mysqrt.cxx @@ -1,11 +1,8 @@ #include "MathFunctions.h" #include "TutorialConfig.h" -#include +#include -// include the generated table -#include "Table.h" - -#include +#include // a hack square root calculation using simple operations double mysqrt(double x) @@ -14,27 +11,23 @@ double mysqrt(double x) return 0; } - double result; - // if we have both log and exp then use them - double delta; - - // use the table to help find an initial value - result = x; - if (x >= 1 && x < 10) { - result = sqrtTable[static_cast(x)]; - } +#if defined(HAVE_LOG) && defined(HAVE_EXP) + double result = exp(log(x) * 0.5); + std::cout << "Computing sqrt of " << x << " to be " << result << " using log" + << std::endl; +#else + double result = x; // do ten iterations - int i; - for (i = 0; i < 10; ++i) { + for (int i = 0; i < 10; ++i) { if (result <= 0) { result = 0.1; } - delta = x - (result * result); + double delta = x - (result * result); result = result + 0.5 * delta / result; - fprintf(stdout, "Computing sqrt of %g to be %g\n", x, result); + std::cout << "Computing sqrt of " << x << " to be " << result << std::endl; } - +#endif return result; } diff --git a/Tests/Tutorial/Step6/directions.txt b/Tests/Tutorial/Step6/directions.txt new file mode 100644 index 0000000..d3e7b05 --- /dev/null +++ b/Tests/Tutorial/Step6/directions.txt @@ -0,0 +1,111 @@ +# Adding a Custom Command and Generated File # + +In this section we will show how you can add a generated source file into the +build process of an application. For this example, we will create a table of +precomputed square roots as part of the build process, and then compile that +table into our application. + +To accomplish this, we first need a program that will generate the table. In the +MathFunctions subdirectory a new source file named MakeTable.cxx will do just that. + + // A simple program that builds a sqrt table + #include + #include + #include + + int main (int argc, char *argv[]) + { + // make sure we have enough arguments + if (argc < 2) + { + return 1; + } + + std::ofstream fout(argv[1],std::ios_base::out); + const bool fileOpen = fout.is_open(); + if(fileOpen) + { + fout << "double sqrtTable[] = {" << std::endl; + for (int i = 0; i < 10; ++i) + { + fout << sqrt(static_cast(i)) << "," << std::endl; + } + // close the table with a zero + fout << "0};" << std::endl; + fout.close(); + } + return fileOpen ? 0 : 1; // return 0 if wrote the file + } + +Note that the table is produced as valid C++ code and that the output filename +is passed in as an argument. + +The next step is to add the appropriate commands to MathFunctions? CMakeLists +file to build the MakeTable executable and then run it as part of the build +process. A few commands are needed to accomplish this, as shown below: + + # first we add the executable that generates the table + add_executable(MakeTable MakeTable.cxx) + + # add the command to generate the source code + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Table.h + COMMAND MakeTable ${CMAKE_CURRENT_BINARY_DIR}/Table.h + DEPENDS MakeTable + ) + + # add the main library + add_library(MathFunctions + mysqrt.cxx + ${CMAKE_CURRENT_BINARY_DIR}/Table.h + ) + + target_include_directories(MathFunctions + INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} + PUBLIC ${Tutorial_BINARY_DIR} + # add the binary tree directory to the search path for include files + ${CMAKE_CURRENT_BINARY_DIR} + ) + + install(TARGETS MathFunctions DESTINATION lib) + install(FILES MathFunctions.h DESTINATION include) + +First, the executable for MakeTable is added as any other executable would be +added. Then we add a custom command that specifies how to produce Table.h by +running MakeTable. Next we have to let CMake know that mysqrt.cxx depends on +the generated file Table.h. This is done by adding the generated Table.h to the +list of sources for the library MathFunctions. We also have to add the current +binary directory to the list of include directories so that Table.h can be +found and included by mysqrt.cxx. + +Now let's use the generated table. First, modify mysqrt.cxx to include Table.h. +Next, we can rewrite the mysqrt function to use the table: + + if (x <= 0) + { + return 0; + } + + // use the table to help find an initial value + double result = x; + if (x >= 1 && x < 10) + { + result = sqrtTable[static_cast(x)]; + } + + // do ten iterations + for (int i = 0; i < 10; ++i) + { + if (result <= 0) + { + result = 0.1; + } + double delta = x - (result*result); + result = result + 0.5*delta/result; + std::cout << "Computing sqrt of " << x << " to be " << result << std::endl; + } + +Run cmake or cmake-gui to configure the project and then build it with your +chosen build tool. When this project is built it will first build the MakeTable +executable. It will then run MakeTable to produce Table.h. Finally, it will +compile mysqrt.cxx which includes Table.h to produce the MathFunctions library. diff --git a/Tests/Tutorial/Step6/tutorial.cxx b/Tests/Tutorial/Step6/tutorial.cxx index 37f6ac4..1d5742d 100644 --- a/Tests/Tutorial/Step6/tutorial.cxx +++ b/Tests/Tutorial/Step6/tutorial.cxx @@ -1,8 +1,9 @@ // A simple program that computes the square root of a number +#include +#include +#include + #include "TutorialConfig.h" -#include -#include -#include #ifdef USE_MYMATH # include "MathFunctions.h" @@ -11,23 +12,21 @@ int main(int argc, char* argv[]) { if (argc < 2) { - fprintf(stdout, "%s Version %d.%d\n", argv[0], Tutorial_VERSION_MAJOR, - Tutorial_VERSION_MINOR); - fprintf(stdout, "Usage: %s number\n", argv[0]); + std::cout << argv[0] << " Version " << Tutorial_VERSION_MAJOR << "." + << Tutorial_VERSION_MAJOR << std::endl; + std::cout << "Usage: " << argv[0] << " number" << std::endl; return 1; } - double inputValue = atof(argv[1]); - double outputValue = 0; + double inputValue = std::stod(argv[1]); - if (inputValue >= 0) { #ifdef USE_MYMATH - outputValue = mysqrt(inputValue); + double outputValue = mysqrt(inputValue); #else - outputValue = sqrt(inputValue); + double outputValue = sqrt(inputValue); #endif - } - fprintf(stdout, "The square root of %g is %g\n", inputValue, outputValue); + std::cout << "The square root of " << inputValue << " is " << outputValue + << std::endl; return 0; } diff --git a/Tests/Tutorial/Step7/CMakeLists.txt b/Tests/Tutorial/Step7/CMakeLists.txt index d9a92fb..f2d3839 100644 --- a/Tests/Tutorial/Step7/CMakeLists.txt +++ b/Tests/Tutorial/Step7/CMakeLists.txt @@ -1,82 +1,76 @@ -cmake_minimum_required (VERSION 2.6) -project (Tutorial) +cmake_minimum_required(VERSION 3.3) +project(Tutorial) -# The version number. -set (Tutorial_VERSION_MAJOR 1) -set (Tutorial_VERSION_MINOR 0) +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED True) + +# the version number. +set(Tutorial_VERSION_MAJOR 1) +set(Tutorial_VERSION_MINOR 0) # does this system provide the log and exp functions? -include (${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake) -check_function_exists (log HAVE_LOG) -check_function_exists (exp HAVE_EXP) +include(CheckSymbolExists) +set(CMAKE_REQUIRED_LIBRARIES "m") +check_symbol_exists(log "math.h" HAVE_LOG) +check_symbol_exists(exp "math.h" HAVE_EXP) # should we use our own math functions option(USE_MYMATH "Use tutorial provided math implementation" ON) # configure a header file to pass some of the CMake settings # to the source code -configure_file ( +configure_file( "${PROJECT_SOURCE_DIR}/TutorialConfig.h.in" "${PROJECT_BINARY_DIR}/TutorialConfig.h" ) -# add the binary tree to the search path for include files -# so that we will find TutorialConfig.h -include_directories ("${PROJECT_BINARY_DIR}") - # add the MathFunctions library? -if (USE_MYMATH) - include_directories ("${PROJECT_SOURCE_DIR}/MathFunctions") - add_subdirectory (MathFunctions) - set (EXTRA_LIBS ${EXTRA_LIBS} MathFunctions) -endif () +if(USE_MYMATH) + add_subdirectory(MathFunctions) + list(APPEND EXTRA_LIBS MathFunctions) +endif(USE_MYMATH) # add the executable -add_executable (Tutorial tutorial.cxx) -target_link_libraries (Tutorial ${EXTRA_LIBS}) +add_executable(Tutorial tutorial.cxx) +target_link_libraries(Tutorial PUBLIC ${EXTRA_LIBS}) + +# add the binary tree to the search path for include files +# so that we will find TutorialConfig.h +target_include_directories(Tutorial PUBLIC + "${PROJECT_BINARY_DIR}" + ) # add the install targets -install (TARGETS Tutorial DESTINATION bin) -install (FILES "${PROJECT_BINARY_DIR}/TutorialConfig.h" - DESTINATION include) +install(TARGETS Tutorial DESTINATION bin) +install(FILES "${PROJECT_BINARY_DIR}/TutorialConfig.h" + DESTINATION include + ) # enable testing -enable_testing () +enable_testing() # does the application run -add_test (TutorialRuns Tutorial 25) +add_test(NAME Runs COMMAND Tutorial 25) # does the usage message work? -add_test (TutorialUsage Tutorial) -set_tests_properties (TutorialUsage - PROPERTIES - PASS_REGULAR_EXPRESSION "Usage:.*number" +add_test(NAME Usage COMMAND Tutorial) +set_tests_properties(Usage + PROPERTIES PASS_REGULAR_EXPRESSION "Usage:.*number" ) -#define a macro to simplify adding tests -macro (do_test arg result) - add_test (TutorialComp${arg} Tutorial ${arg}) - set_tests_properties (TutorialComp${arg} +# define a function to simplify adding tests +function(do_test target arg result) + add_test(NAME Comp${arg} COMMAND ${target} ${arg}) + set_tests_properties(Comp${arg} PROPERTIES PASS_REGULAR_EXPRESSION ${result} ) -endmacro () +endfunction(do_test) # do a bunch of result based tests -do_test (4 "4 is 2") -do_test (9 "9 is 3") -do_test (5 "5 is 2.236") -do_test (7 "7 is 2.645") -do_test (25 "25 is 5") -do_test (-25 "-25 is 0") -do_test (0.0001 "0.0001 is 0.01") - -# build a CPack driven installer package -include (InstallRequiredSystemLibraries) -set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/License.txt") -set (CPACK_PACKAGE_VERSION_MAJOR "${Tutorial_VERSION_MAJOR}") -set (CPACK_PACKAGE_VERSION_MINOR "${Tutorial_VERSION_MINOR}") -set (CPACK_PACKAGE_CONTACT "foo at bar.org") -include (CPack) - -# enable dashboard scripting -include (CTest) +do_test(Tutorial 4 "4 is 2") +do_test(Tutorial 9 "9 is 3") +do_test(Tutorial 5 "5 is 2.236") +do_test(Tutorial 7 "7 is 2.645") +do_test(Tutorial 25 "25 is 5") +do_test(Tutorial -25 "-25 is [-nan|nan|0]") +do_test(Tutorial 0.0001 "0.0001 is 0.01") diff --git a/Tests/Tutorial/Step7/License.txt b/Tests/Tutorial/Step7/License.txt index 673d724..c62d00b 100644 --- a/Tests/Tutorial/Step7/License.txt +++ b/Tests/Tutorial/Step7/License.txt @@ -1,2 +1,2 @@ This is the open source License.txt file introduced in -CMake/Tests/Tutorial/Step6... +CMake/Tutorial/Step7... diff --git a/Tests/Tutorial/Step7/MathFunctions/CMakeLists.txt b/Tests/Tutorial/Step7/MathFunctions/CMakeLists.txt index 70a35f6..dc3eb98 100644 --- a/Tests/Tutorial/Step7/MathFunctions/CMakeLists.txt +++ b/Tests/Tutorial/Step7/MathFunctions/CMakeLists.txt @@ -2,23 +2,28 @@ add_executable(MakeTable MakeTable.cxx) # add the command to generate the source code -add_custom_command ( +add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Table.h + COMMAND MakeTable ${CMAKE_CURRENT_BINARY_DIR}/Table.h DEPENDS MakeTable - COMMAND MakeTable - ARGS ${CMAKE_CURRENT_BINARY_DIR}/Table.h ) -set_source_files_properties ( - mysqrt.cxx PROPERTIES - OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/Table.h - ) - -# add the binary tree directory to the search path for include files -include_directories( ${CMAKE_CURRENT_BINARY_DIR} ) - # add the main library -add_library(MathFunctions mysqrt.cxx) +add_library(MathFunctions + mysqrt.cxx + ${CMAKE_CURRENT_BINARY_DIR}/Table.h + ) + +# state that anybody linking to us needs to include the current source dir +# to find MathFunctions.h, while we don't. +# state that we depend on Tutorial_BINARY_DIR but consumers don't, as the +# TutorialConfig.h include is an implementation detail +# state that we depend on our binary dir to find Table.h +target_include_directories(MathFunctions + INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} + PRIVATE ${Tutorial_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ) -install (TARGETS MathFunctions DESTINATION bin) -install (FILES MathFunctions.h DESTINATION include) +install(TARGETS MathFunctions DESTINATION lib) +install(FILES MathFunctions.h DESTINATION include) diff --git a/Tests/Tutorial/Step7/MathFunctions/MakeTable.cxx b/Tests/Tutorial/Step7/MathFunctions/MakeTable.cxx index cebd50f..ee58556 100644 --- a/Tests/Tutorial/Step7/MathFunctions/MakeTable.cxx +++ b/Tests/Tutorial/Step7/MathFunctions/MakeTable.cxx @@ -1,32 +1,25 @@ // A simple program that builds a sqrt table -#include -#include +#include +#include +#include int main(int argc, char* argv[]) { - int i; - double result; - // make sure we have enough arguments if (argc < 2) { return 1; } - // open the output file - FILE* fout = fopen(argv[1], "w"); - if (!fout) { - return 1; + std::ofstream fout(argv[1], std::ios_base::out); + const bool fileOpen = fout.is_open(); + if (fileOpen) { + fout << "double sqrtTable[] = {" << std::endl; + for (int i = 0; i < 10; ++i) { + fout << sqrt(static_cast(i)) << "," << std::endl; + } + // close the table with a zero + fout << "0};" << std::endl; + fout.close(); } - - // create a source file with a table of square roots - fprintf(fout, "double sqrtTable[] = {\n"); - for (i = 0; i < 10; ++i) { - result = sqrt(static_cast(i)); - fprintf(fout, "%g,\n", result); - } - - // close the table with a zero - fprintf(fout, "0};\n"); - fclose(fout); - return 0; + return fileOpen ? 0 : 1; // return 0 if wrote the file } diff --git a/Tests/Tutorial/Step7/MathFunctions/mysqrt.cxx b/Tests/Tutorial/Step7/MathFunctions/mysqrt.cxx index 458ed63..5272f56 100644 --- a/Tests/Tutorial/Step7/MathFunctions/mysqrt.cxx +++ b/Tests/Tutorial/Step7/MathFunctions/mysqrt.cxx @@ -1,11 +1,11 @@ #include "MathFunctions.h" #include "TutorialConfig.h" -#include +#include // include the generated table #include "Table.h" -#include +#include // a hack square root calculation using simple operations double mysqrt(double x) @@ -14,26 +14,20 @@ double mysqrt(double x) return 0; } - double result; - - // if we have both log and exp then use them - double delta; - // use the table to help find an initial value - result = x; + double result = x; if (x >= 1 && x < 10) { result = sqrtTable[static_cast(x)]; } // do ten iterations - int i; - for (i = 0; i < 10; ++i) { + for (int i = 0; i < 10; ++i) { if (result <= 0) { result = 0.1; } - delta = x - (result * result); + double delta = x - (result * result); result = result + 0.5 * delta / result; - fprintf(stdout, "Computing sqrt of %g to be %g\n", x, result); + std::cout << "Computing sqrt of " << x << " to be " << result << std::endl; } return result; diff --git a/Tests/Tutorial/Step7/directions.txt b/Tests/Tutorial/Step7/directions.txt new file mode 100644 index 0000000..7d7c2ea --- /dev/null +++ b/Tests/Tutorial/Step7/directions.txt @@ -0,0 +1,40 @@ +# Building an Installer # + +Next suppose that we want to distribute our project to other people so that they +can use it. We want to provide both binary and source distributions on a variety +of platforms. This is a little different from the install we did previously in +the Installing and Testing section (Step 4), where we were installing the +binaries that we had built from the source code. In this example we will be +building installation packages that support binary installations and package +management features. To accomplish this we will use CPack to create platform +specific installers. Specifically we need to add a few lines to the bottom of +our top-level CMakeLists.txt file. + + include(InstallRequiredSystemLibraries) + set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/License.txt") + set(CPACK_PACKAGE_VERSION_MAJOR "${Tutorial_VERSION_MAJOR}") + set(CPACK_PACKAGE_VERSION_MINOR "${Tutorial_VERSION_MINOR}") + include(CPack) + +That is all there is to it. We start by including InstallRequiredSystemLibraries. +This module will include any runtime libraries that are needed by the project +for the current platform. Next we set some CPack variables to where we have +stored the license and version information for this project. The version +information makes use of the variables we set earlier in this tutorial. Finally +we include the CPack module which will use these variables and some other +properties of the system you are on to setup an installer. + +The next step is to build the project in the usual manner and then run CPack +on it. To build a binary distribution you would run: + + cpack + +To create a source distribution you would type: + + cpack -C CPackSourceConfig.cmake + +Alternatively, run ?make package? or right click the Package target and +?Build Project? from an IDE. + +Run the installer executable found in the binary directory. Then run the +installed executable and verify that it works. diff --git a/Tests/Tutorial/Step7/tutorial.cxx b/Tests/Tutorial/Step7/tutorial.cxx index 37f6ac4..1d5742d 100644 --- a/Tests/Tutorial/Step7/tutorial.cxx +++ b/Tests/Tutorial/Step7/tutorial.cxx @@ -1,8 +1,9 @@ // A simple program that computes the square root of a number +#include +#include +#include + #include "TutorialConfig.h" -#include -#include -#include #ifdef USE_MYMATH # include "MathFunctions.h" @@ -11,23 +12,21 @@ int main(int argc, char* argv[]) { if (argc < 2) { - fprintf(stdout, "%s Version %d.%d\n", argv[0], Tutorial_VERSION_MAJOR, - Tutorial_VERSION_MINOR); - fprintf(stdout, "Usage: %s number\n", argv[0]); + std::cout << argv[0] << " Version " << Tutorial_VERSION_MAJOR << "." + << Tutorial_VERSION_MAJOR << std::endl; + std::cout << "Usage: " << argv[0] << " number" << std::endl; return 1; } - double inputValue = atof(argv[1]); - double outputValue = 0; + double inputValue = std::stod(argv[1]); - if (inputValue >= 0) { #ifdef USE_MYMATH - outputValue = mysqrt(inputValue); + double outputValue = mysqrt(inputValue); #else - outputValue = sqrt(inputValue); + double outputValue = sqrt(inputValue); #endif - } - fprintf(stdout, "The square root of %g is %g\n", inputValue, outputValue); + std::cout << "The square root of " << inputValue << " is " << outputValue + << std::endl; return 0; } diff --git a/Tests/Tutorial/Step8/CMakeLists.txt b/Tests/Tutorial/Step8/CMakeLists.txt new file mode 100644 index 0000000..c66bf96 --- /dev/null +++ b/Tests/Tutorial/Step8/CMakeLists.txt @@ -0,0 +1,82 @@ +cmake_minimum_required(VERSION 3.3) +project(Tutorial) + +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED True) + +# the version number. +set(Tutorial_VERSION_MAJOR 1) +set(Tutorial_VERSION_MINOR 0) + +# does this system provide the log and exp functions? +include(CheckSymbolExists) +set(CMAKE_REQUIRED_LIBRARIES "m") +check_symbol_exists(log "math.h" HAVE_LOG) +check_symbol_exists(exp "math.h" HAVE_EXP) + +# should we use our own math functions +option(USE_MYMATH "Use tutorial provided math implementation" ON) + +# configure a header file to pass some of the CMake settings +# to the source code +configure_file( + "${PROJECT_SOURCE_DIR}/TutorialConfig.h.in" + "${PROJECT_BINARY_DIR}/TutorialConfig.h" + ) + +# add the MathFunctions library? +if(USE_MYMATH) + add_subdirectory(MathFunctions) + list(APPEND EXTRA_LIBS MathFunctions) +endif(USE_MYMATH) + +# add the executable +add_executable(Tutorial tutorial.cxx) +target_link_libraries(Tutorial PUBLIC ${EXTRA_LIBS}) + +# add the binary tree to the search path for include files +# so that we will find TutorialConfig.h +target_include_directories(Tutorial PUBLIC + "${PROJECT_BINARY_DIR}" + ) + +# add the install targets +install(TARGETS Tutorial DESTINATION bin) +install(FILES "${PROJECT_BINARY_DIR}/TutorialConfig.h" + DESTINATION include + ) + +# enable testing +enable_testing() + +# does the application run +add_test(NAME Runs COMMAND Tutorial 25) + +# does the usage message work? +add_test(NAME Usage COMMAND Tutorial) +set_tests_properties(Usage + PROPERTIES PASS_REGULAR_EXPRESSION "Usage:.*number" + ) + +# define a function to simplify adding tests +function(do_test target arg result) +add_test(NAME Comp${arg} COMMAND ${target} ${arg}) + set_tests_properties(Comp${arg} + PROPERTIES PASS_REGULAR_EXPRESSION ${result} + ) +endfunction(do_test) + +# do a bunch of result based tests +do_test(Tutorial 4 "4 is 2") +do_test(Tutorial 9 "9 is 3") +do_test(Tutorial 5 "5 is 2.236") +do_test(Tutorial 7 "7 is 2.645") +do_test(Tutorial 25 "25 is 5") +do_test(Tutorial -25 "-25 is [-nan|nan|0]") +do_test(Tutorial 0.0001 "0.0001 is 0.01") + +include(InstallRequiredSystemLibraries) +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/License.txt") +set(CPACK_PACKAGE_VERSION_MAJOR "${Tutorial_VERSION_MAJOR}") +set(CPACK_PACKAGE_VERSION_MINOR "${Tutorial_VERSION_MINOR}") +include(CPack) diff --git a/Tests/Tutorial/Step6/License.txt b/Tests/Tutorial/Step8/License.txt similarity index 64% copy from Tests/Tutorial/Step6/License.txt copy to Tests/Tutorial/Step8/License.txt index 673d724..c62d00b 100644 --- a/Tests/Tutorial/Step6/License.txt +++ b/Tests/Tutorial/Step8/License.txt @@ -1,2 +1,2 @@ This is the open source License.txt file introduced in -CMake/Tests/Tutorial/Step6... +CMake/Tutorial/Step7... diff --git a/Tests/Tutorial/Step8/MathFunctions/CMakeLists.txt b/Tests/Tutorial/Step8/MathFunctions/CMakeLists.txt new file mode 100644 index 0000000..dc3eb98 --- /dev/null +++ b/Tests/Tutorial/Step8/MathFunctions/CMakeLists.txt @@ -0,0 +1,29 @@ +# first we add the executable that generates the table +add_executable(MakeTable MakeTable.cxx) + +# add the command to generate the source code +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Table.h + COMMAND MakeTable ${CMAKE_CURRENT_BINARY_DIR}/Table.h + DEPENDS MakeTable + ) + +# add the main library +add_library(MathFunctions + mysqrt.cxx + ${CMAKE_CURRENT_BINARY_DIR}/Table.h + ) + +# state that anybody linking to us needs to include the current source dir +# to find MathFunctions.h, while we don't. +# state that we depend on Tutorial_BINARY_DIR but consumers don't, as the +# TutorialConfig.h include is an implementation detail +# state that we depend on our binary dir to find Table.h +target_include_directories(MathFunctions + INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} + PRIVATE ${Tutorial_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ) + +install(TARGETS MathFunctions DESTINATION lib) +install(FILES MathFunctions.h DESTINATION include) diff --git a/Tests/Tutorial/Step8/MathFunctions/MakeTable.cxx b/Tests/Tutorial/Step8/MathFunctions/MakeTable.cxx new file mode 100644 index 0000000..ee58556 --- /dev/null +++ b/Tests/Tutorial/Step8/MathFunctions/MakeTable.cxx @@ -0,0 +1,25 @@ +// A simple program that builds a sqrt table +#include +#include +#include + +int main(int argc, char* argv[]) +{ + // make sure we have enough arguments + if (argc < 2) { + return 1; + } + + std::ofstream fout(argv[1], std::ios_base::out); + const bool fileOpen = fout.is_open(); + if (fileOpen) { + fout << "double sqrtTable[] = {" << std::endl; + for (int i = 0; i < 10; ++i) { + fout << sqrt(static_cast(i)) << "," << std::endl; + } + // close the table with a zero + fout << "0};" << std::endl; + fout.close(); + } + return fileOpen ? 0 : 1; // return 0 if wrote the file +} diff --git a/Tests/Tutorial/Step8/MathFunctions/MathFunctions.h b/Tests/Tutorial/Step8/MathFunctions/MathFunctions.h new file mode 100644 index 0000000..cd36bcc --- /dev/null +++ b/Tests/Tutorial/Step8/MathFunctions/MathFunctions.h @@ -0,0 +1 @@ +double mysqrt(double x); diff --git a/Tests/Tutorial/Step5/MathFunctions/mysqrt.cxx b/Tests/Tutorial/Step8/MathFunctions/mysqrt.cxx similarity index 54% copy from Tests/Tutorial/Step5/MathFunctions/mysqrt.cxx copy to Tests/Tutorial/Step8/MathFunctions/mysqrt.cxx index 458ed63..5b862fb 100644 --- a/Tests/Tutorial/Step5/MathFunctions/mysqrt.cxx +++ b/Tests/Tutorial/Step8/MathFunctions/mysqrt.cxx @@ -1,11 +1,11 @@ #include "MathFunctions.h" #include "TutorialConfig.h" -#include +#include // include the generated table #include "Table.h" -#include +#include // a hack square root calculation using simple operations double mysqrt(double x) @@ -14,27 +14,29 @@ double mysqrt(double x) return 0; } - double result; - // if we have both log and exp then use them - double delta; - +#if defined(HAVE_LOG) && defined(HAVE_EXP) + double result = exp(log(x) * 0.5); + std::cout << "Computing sqrt of " << x << " to be " << result << " using log" + << std::endl; +#else // use the table to help find an initial value - result = x; + double result = x; if (x >= 1 && x < 10) { result = sqrtTable[static_cast(x)]; } + // if we have both log and exp then use them + // do ten iterations - int i; - for (i = 0; i < 10; ++i) { + for (int i = 0; i < 10; ++i) { if (result <= 0) { result = 0.1; } - delta = x - (result * result); + double delta = x - (result * result); result = result + 0.5 * delta / result; - fprintf(stdout, "Computing sqrt of %g to be %g\n", x, result); + std::cout << "Computing sqrt of " << x << " to be " << result << std::endl; } - +#endif return result; } diff --git a/Tests/Tutorial/Step5/TutorialConfig.h.in b/Tests/Tutorial/Step8/TutorialConfig.h.in similarity index 99% copy from Tests/Tutorial/Step5/TutorialConfig.h.in copy to Tests/Tutorial/Step8/TutorialConfig.h.in index a091265..e97ce24 100644 --- a/Tests/Tutorial/Step5/TutorialConfig.h.in +++ b/Tests/Tutorial/Step8/TutorialConfig.h.in @@ -6,4 +6,3 @@ // does the platform provide exp and log functions? #cmakedefine HAVE_LOG #cmakedefine HAVE_EXP - diff --git a/Tests/Tutorial/Step8/directions.txt b/Tests/Tutorial/Step8/directions.txt new file mode 100644 index 0000000..588d9c6 --- /dev/null +++ b/Tests/Tutorial/Step8/directions.txt @@ -0,0 +1,38 @@ +# Adding Support for a Dashboard # + +Adding support for submitting our test results to a dashboard is very easy. We +already defined a number of tests for our project in the earlier steps of this +tutorial. We just have to run those tests and submit them to a dashboard. To +include support for dashboards we include the CTest module in our top-level +CMakeLists.txt. + +Replace: + # enable testing + enable_testing() + +With: + # enable dashboard scripting + include(CTest) + +The CTest module will automatically call enable_testing(), so +we can remove it from our CMake files. + +We will also need to create a CTestConfig.cmake file where we can specify the +name of the project and where to submit the dashboard. + + set(CTEST_PROJECT_NAME "CMakeTutorial") + set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC") + + set(CTEST_DROP_METHOD "http") + set(CTEST_DROP_SITE "my.cdash.org/") + set(CTEST_DROP_LOCATION "/submit.php?project=CMakeTutorial") + set(CTEST_DROP_SITE_CDASH TRUE) + +CTest will read in this file when it runs. To create a simple dashboard you can +run cmake or cmake-gui to configure the project, but do not build it yet. +Instead, change directory to the binary tree, and then run: + 'ctest [-VV] ?D Experimental'. On Windows, build the EXPERIMENTAL target. + +Ctest will build and test the project and submit results to the Kitware public +dashboard. The results of your dashboard will be uploaded to Kitware's public +dashboard here: https://my.cdash.org/index.php?project=CMakeTutorial. diff --git a/Tests/Tutorial/Step8/tutorial.cxx b/Tests/Tutorial/Step8/tutorial.cxx new file mode 100644 index 0000000..1d5742d --- /dev/null +++ b/Tests/Tutorial/Step8/tutorial.cxx @@ -0,0 +1,32 @@ +// A simple program that computes the square root of a number +#include +#include +#include + +#include "TutorialConfig.h" + +#ifdef USE_MYMATH +# include "MathFunctions.h" +#endif + +int main(int argc, char* argv[]) +{ + if (argc < 2) { + std::cout << argv[0] << " Version " << Tutorial_VERSION_MAJOR << "." + << Tutorial_VERSION_MAJOR << std::endl; + std::cout << "Usage: " << argv[0] << " number" << std::endl; + return 1; + } + + double inputValue = std::stod(argv[1]); + +#ifdef USE_MYMATH + double outputValue = mysqrt(inputValue); +#else + double outputValue = sqrt(inputValue); +#endif + + std::cout << "The square root of " << inputValue << " is " << outputValue + << std::endl; + return 0; +} diff --git a/Tests/Tutorial/Step9/CMakeLists.txt b/Tests/Tutorial/Step9/CMakeLists.txt new file mode 100644 index 0000000..309d513 --- /dev/null +++ b/Tests/Tutorial/Step9/CMakeLists.txt @@ -0,0 +1,81 @@ +cmake_minimum_required(VERSION 3.3) +project(Tutorial) + +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED True) + +# the version number. +set(Tutorial_VERSION_MAJOR 1) +set(Tutorial_VERSION_MINOR 0) + +# does this system provide the log and exp functions? +include(CheckSymbolExists) +set(CMAKE_REQUIRED_LIBRARIES "m") +check_symbol_exists(log "math.h" HAVE_LOG) +check_symbol_exists(exp "math.h" HAVE_EXP) + +# should we use our own math functions +option(USE_MYMATH "Use tutorial provided math implementation" ON) + +# configure a header file to pass the version number only +configure_file( + "${PROJECT_SOURCE_DIR}/TutorialConfig.h.in" + "${PROJECT_BINARY_DIR}/TutorialConfig.h" + ) + +# add the MathFunctions library? +if(USE_MYMATH) + add_subdirectory(MathFunctions) + list(APPEND EXTRA_LIBS MathFunctions) +endif() + +# add the executable +add_executable(Tutorial tutorial.cxx) +target_link_libraries(Tutorial PUBLIC ${EXTRA_LIBS}) + +# add the binary tree to the search path for include files +# so that we will find TutorialConfig.h +target_include_directories(Tutorial PUBLIC + "${PROJECT_BINARY_DIR}" + ) + +# add the install targets +install(TARGETS Tutorial DESTINATION bin) +install(FILES "${PROJECT_BINARY_DIR}/TutorialConfig.h" + DESTINATION include + ) + +# enable testing +include(CTest) + +# does the application run +add_test(NAME Runs COMMAND Tutorial 25) + +# does the usage message work? +add_test(NAME Usage COMMAND Tutorial) +set_tests_properties(Usage + PROPERTIES PASS_REGULAR_EXPRESSION "Usage:.*number" + ) + +# define a function to simplify adding tests +function(do_test target arg result) + add_test(NAME Comp${arg} COMMAND ${target} ${arg}) + set_tests_properties(Comp${arg} + PROPERTIES PASS_REGULAR_EXPRESSION ${result} + ) +endfunction(do_test) + +# do a bunch of result based tests +do_test(Tutorial 4 "4 is 2") +do_test(Tutorial 9 "9 is 3") +do_test(Tutorial 5 "5 is 2.236") +do_test(Tutorial 7 "7 is 2.645") +do_test(Tutorial 25 "25 is 5") +do_test(Tutorial -25 "-25 is [-nan|nan|0]") +do_test(Tutorial 0.0001 "0.0001 is 0.01") + +include(InstallRequiredSystemLibraries) +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/License.txt") +set(CPACK_PACKAGE_VERSION_MAJOR "${Tutorial_VERSION_MAJOR}") +set(CPACK_PACKAGE_VERSION_MINOR "${Tutorial_VERSION_MINOR}") +include(CPack) diff --git a/Tests/Tutorial/Step9/CTestConfig.cmake b/Tests/Tutorial/Step9/CTestConfig.cmake new file mode 100644 index 0000000..7a927ac --- /dev/null +++ b/Tests/Tutorial/Step9/CTestConfig.cmake @@ -0,0 +1,15 @@ +## This file should be placed in the root directory of your project. +## Then modify the CMakeLists.txt file in the root directory of your +## project to incorporate the testing dashboard. +## +## # The following are required to submit to the CDash dashboard: +## ENABLE_TESTING() +## INCLUDE(CTest) + +set(CTEST_PROJECT_NAME "CMakeTutorial") +set(CTEST_NIGHTLY_START_TIME "00:00:00 EST") + +set(CTEST_DROP_METHOD "http") +set(CTEST_DROP_SITE "my.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=CMakeTutorial") +set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/Tutorial/Step6/License.txt b/Tests/Tutorial/Step9/License.txt similarity index 64% rename from Tests/Tutorial/Step6/License.txt rename to Tests/Tutorial/Step9/License.txt index 673d724..c62d00b 100644 --- a/Tests/Tutorial/Step6/License.txt +++ b/Tests/Tutorial/Step9/License.txt @@ -1,2 +1,2 @@ This is the open source License.txt file introduced in -CMake/Tests/Tutorial/Step6... +CMake/Tutorial/Step7... diff --git a/Tests/Tutorial/Step9/MathFunctions/CMakeLists.txt b/Tests/Tutorial/Step9/MathFunctions/CMakeLists.txt new file mode 100644 index 0000000..e651a57 --- /dev/null +++ b/Tests/Tutorial/Step9/MathFunctions/CMakeLists.txt @@ -0,0 +1,35 @@ +# first we add the executable that generates the table +add_executable(MakeTable MakeTable.cxx) + +# add the command to generate the source code +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Table.h + COMMAND MakeTable ${CMAKE_CURRENT_BINARY_DIR}/Table.h + DEPENDS MakeTable + ) + +# add the main library +add_library(MathFunctions + mysqrt.cxx + ${CMAKE_CURRENT_BINARY_DIR}/Table.h + ) + +# state that anybody linking to us needs to include the current source dir +# to find MathFunctions.h, while we don't. +# state that we depend on our binary dir to find Table.h +target_include_directories(MathFunctions + INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} + PRIVATE ${CMAKE_CURRENT_BINARY_DIR} + ) + +# use compile definitions to state if we have enabled USE_MYMATH +# and that anything that links to use will get this define +target_compile_definitions(MathFunctions INTERFACE "USE_MYMATH") + +if(HAVE_LOG AND HAVE_EXP) + target_compile_definitions(MathFunctions + PRIVATE "HAVE_LOG" "HAVE_EXP") +endif() + +install(TARGETS MathFunctions DESTINATION lib) +install(FILES MathFunctions.h DESTINATION include) diff --git a/Tests/Tutorial/Step9/MathFunctions/MakeTable.cxx b/Tests/Tutorial/Step9/MathFunctions/MakeTable.cxx new file mode 100644 index 0000000..ee58556 --- /dev/null +++ b/Tests/Tutorial/Step9/MathFunctions/MakeTable.cxx @@ -0,0 +1,25 @@ +// A simple program that builds a sqrt table +#include +#include +#include + +int main(int argc, char* argv[]) +{ + // make sure we have enough arguments + if (argc < 2) { + return 1; + } + + std::ofstream fout(argv[1], std::ios_base::out); + const bool fileOpen = fout.is_open(); + if (fileOpen) { + fout << "double sqrtTable[] = {" << std::endl; + for (int i = 0; i < 10; ++i) { + fout << sqrt(static_cast(i)) << "," << std::endl; + } + // close the table with a zero + fout << "0};" << std::endl; + fout.close(); + } + return fileOpen ? 0 : 1; // return 0 if wrote the file +} diff --git a/Tests/Tutorial/Step9/MathFunctions/MathFunctions.cxx b/Tests/Tutorial/Step9/MathFunctions/MathFunctions.cxx new file mode 100644 index 0000000..5351184 --- /dev/null +++ b/Tests/Tutorial/Step9/MathFunctions/MathFunctions.cxx @@ -0,0 +1,18 @@ + +#include "MathFunctions.h" +#include + +#ifdef USE_MYMATH +# include "mysqrt.h" +#endif + +namespace mathfunctions { +double sqrt(double x) +{ +#ifdef USE_MYMATH + return detail::mysqrt(x); +#else + return std::sqrt(x); +#endif +} +} diff --git a/Tests/Tutorial/Step9/MathFunctions/MathFunctions.h b/Tests/Tutorial/Step9/MathFunctions/MathFunctions.h new file mode 100644 index 0000000..cd36bcc --- /dev/null +++ b/Tests/Tutorial/Step9/MathFunctions/MathFunctions.h @@ -0,0 +1 @@ +double mysqrt(double x); diff --git a/Tests/Tutorial/Step6/MathFunctions/mysqrt.cxx b/Tests/Tutorial/Step9/MathFunctions/mysqrt.cxx similarity index 52% copy from Tests/Tutorial/Step6/MathFunctions/mysqrt.cxx copy to Tests/Tutorial/Step9/MathFunctions/mysqrt.cxx index 458ed63..8b82141 100644 --- a/Tests/Tutorial/Step6/MathFunctions/mysqrt.cxx +++ b/Tests/Tutorial/Step9/MathFunctions/mysqrt.cxx @@ -1,11 +1,10 @@ #include "MathFunctions.h" -#include "TutorialConfig.h" -#include +#include // include the generated table #include "Table.h" -#include +#include // a hack square root calculation using simple operations double mysqrt(double x) @@ -14,27 +13,29 @@ double mysqrt(double x) return 0; } - double result; - // if we have both log and exp then use them - double delta; - +#if defined(HAVE_LOG) && defined(HAVE_EXP) + double result = exp(log(x) * 0.5); + std::cout << "Computing sqrt of " << x << " to be " << result << " using log" + << std::endl; +#else // use the table to help find an initial value - result = x; + double result = x; if (x >= 1 && x < 10) { result = sqrtTable[static_cast(x)]; } + // if we have both log and exp then use them + // do ten iterations - int i; - for (i = 0; i < 10; ++i) { + for (int i = 0; i < 10; ++i) { if (result <= 0) { result = 0.1; } - delta = x - (result * result); + double delta = x - (result * result); result = result + 0.5 * delta / result; - fprintf(stdout, "Computing sqrt of %g to be %g\n", x, result); + std::cout << "Computing sqrt of " << x << " to be " << result << std::endl; } - +#endif return result; } diff --git a/Tests/Tutorial/Step9/MathFunctions/mysqrt.h b/Tests/Tutorial/Step9/MathFunctions/mysqrt.h new file mode 100644 index 0000000..e1c42ef --- /dev/null +++ b/Tests/Tutorial/Step9/MathFunctions/mysqrt.h @@ -0,0 +1,6 @@ + +namespace mathfunctions { +namespace detail { +double mysqrt(double x); +} +} diff --git a/Tests/Tutorial/Step2/TutorialConfig.h.in b/Tests/Tutorial/Step9/TutorialConfig.h.in similarity index 59% copy from Tests/Tutorial/Step2/TutorialConfig.h.in copy to Tests/Tutorial/Step9/TutorialConfig.h.in index 25a0602..8cd2fc9 100644 --- a/Tests/Tutorial/Step2/TutorialConfig.h.in +++ b/Tests/Tutorial/Step9/TutorialConfig.h.in @@ -1,5 +1,3 @@ -// the configured options and settings for Tutorial +// the configured version number #define Tutorial_VERSION_MAJOR @Tutorial_VERSION_MAJOR@ #define Tutorial_VERSION_MINOR @Tutorial_VERSION_MINOR@ -#cmakedefine USE_MYMATH - diff --git a/Tests/Tutorial/Step9/directions.txt b/Tests/Tutorial/Step9/directions.txt new file mode 100644 index 0000000..8771637 --- /dev/null +++ b/Tests/Tutorial/Step9/directions.txt @@ -0,0 +1,166 @@ +# Mixing Static and Shared # + +In this section we will show how by using the BUILD_SHARED_LIBS variable we can +control the default behavior of add_library, and allow control over how +libraries without an explicit type ( STATIC/SHARED/MODULE/OBJECT ) are built. + +To accomplish this we need to add BUILD_SHARED_LIBS to the top level +CMakeLists.txt. We use the option command as it allows users to optionally +select if the value should be On or Off. + +Next we are going to refactor MathFunctions to become a real library that +encapsulates using mysqrt or sqrt, instead of requiring the calling code +to do this logic. This will also mean that USE_MYMATH will not control building +MathFuctions, but instead will control the behavior of this library. + +The first step is to update the starting section of the top level CMakeLists.txt +to look like: + + cmake_minimum_required(VERSION 3.3) + project(Tutorial) + + # control where the static and shared libraries are built so that on windows + # we don't need to tinker with the path to run the executable + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") + + set(CMAKE_CXX_STANDARD 11) + set(CMAKE_CXX_STANDARD_REQUIRED True) + + option(BUILD_SHARED_LIBS "Build using shared libraries" ON) + + # the version number. + set(Tutorial_VERSION_MAJOR 1) + set(Tutorial_VERSION_MINOR 0) + + # configure a header file to pass the version number only + configure_file( + "${PROJECT_SOURCE_DIR}/TutorialConfig.h.in" + "${PROJECT_BINARY_DIR}/TutorialConfig.h" + ) + + # add the MathFunctions library + add_subdirectory(MathFunctions) + + # add the executable + add_executable(Tutorial tutorial.cxx) + target_link_libraries(Tutorial PUBLIC MathFunctions) + +Now that we have made MathFunctions always be used, we will need to update +the logic of that library. So, in MathFunctions/CMakeLists.txt we need to +create a SqrtLibrary that will conditionally be built when USE_MYMATH is +enabled. Now, since this is a tutorial, we are going to explicitly require +that SqrtLibrary is built statically. + +The end result is that MathFunctions/CMakeLists.txt should look like: + + # add the library that runs + add_library(MathFunctions MathFunctions.cxx) + + # state that anybody linking to us needs to include the current source dir + # to find MathFunctions.h, while we don't. + target_include_directories(MathFunctions + INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} + ) + + # should we use our own math functions + option(USE_MYMATH "Use tutorial provided math implementation" ON) + if(USE_MYMATH) + + # does this system provide the log and exp functions? + include(CheckSymbolExists) + set(CMAKE_REQUIRED_LIBRARIES "m") + check_symbol_exists(log "math.h" HAVE_LOG) + check_symbol_exists(exp "math.h" HAVE_EXP) + + # first we add the executable that generates the table + add_executable(MakeTable MakeTable.cxx) + + # add the command to generate the source code + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Table.h + COMMAND MakeTable ${CMAKE_CURRENT_BINARY_DIR}/Table.h + DEPENDS MakeTable + ) + + # library that just does sqrt + add_library(SqrtLibrary STATIC + mysqrt.cxx + ${CMAKE_CURRENT_BINARY_DIR}/Table.h + ) + + # state that we depend on our binary dir to find Table.h + target_include_directories(SqrtLibrary PRIVATE + ${CMAKE_CURRENT_BINARY_DIR} + ) + + target_compile_definitions(MathFunctions PRIVATE "USE_MYMATH") + if(HAVE_LOG AND HAVE_EXP) + target_compile_definitions(SqrtLibrary + PRIVATE "HAVE_LOG" "HAVE_EXP") + endif() + + target_link_libraries(MathFunctions PRIVATE SqrtLibrary) + endif() + + # define the symbol stating we are using the declspec(dllexport) when + # building on windows + target_compile_definitions(MathFunctions PRIVATE "EXPORTING_MYMATH") + + install(TARGETS MathFunctions DESTINATION lib) + install(FILES MathFunctions.h DESTINATION include) + +Next, update MathFunctions/mysqrt.cxx to use the mathfunctions and detail namespaces: + + #include + #include "MathFunctions.h" + + // include the generated table + #include "Table.h" + + #include + + namespace mathfunctions { + namespace detail { + // a hack square root calculation using simple operations + double mysqrt(double x) + { + ... + + return result; + } + } + } + +We also need to make some changes in tutorial.cxx, so that it no longer uses USE_MYMATH: +1. Always include MathFunctions.h +2. Always use mathfunctions::sqrt + +Finally, update MathFunctions/MathFunctions.h to use dll export defines: + + #if defined(_WIN32) + #if defined(EXPORTING_MYMATH) + #define DECLSPEC __declspec(dllexport) + #else + #define DECLSPEC __declspec(dllimport) + #endif + #else //non windows + #define DECLSPEC + #endif + + namespace mathfunctions + { + double DECLSPEC sqrt(double x); + } + +At this point, if you build everything, you will notice that linking fails +as we are combining a static library without position enabled code with a +library that has position enabled code. This solution to this is to explicitly +set the POSITION_INDEPENDENT_CODE target property of SqrtLibrary to be True no +matter the build type. + +Exercise: We modified MathFunctions.h to use dll export defines. Using CMake +documentation can you find a helper module to simplify this? + +Exercise: Determine what command is enabling PIC for SqrtLibrary. +What happens if we remove said command? diff --git a/Tests/Tutorial/Step9/tutorial.cxx b/Tests/Tutorial/Step9/tutorial.cxx new file mode 100644 index 0000000..73e67a9 --- /dev/null +++ b/Tests/Tutorial/Step9/tutorial.cxx @@ -0,0 +1,33 @@ +// A simple program that computes the square root of a number +#include +#include +#include +#include + +#include "TutorialConfig.h" + +#ifdef USE_MYMATH +# include "MathFunctions.h" +#endif + +int main(int argc, char* argv[]) +{ + if (argc < 2) { + std::cout << argv[0] << " Version " << Tutorial_VERSION_MAJOR << "." + << Tutorial_VERSION_MAJOR << std::endl; + std::cout << "Usage: " << argv[0] << " number" << std::endl; + return 1; + } + + double inputValue = std::stod(argv[1]); + +#ifdef USE_MYMATH + double outputValue = mysqrt(inputValue); +#else + double outputValue = sqrt(inputValue); +#endif + + std::cout << "The square root of " << inputValue << " is " << outputValue + << std::endl; + return 0; +} https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=438651506a5417be70e71f54f4ed7add0c2604d3 commit 438651506a5417be70e71f54f4ed7add0c2604d3 Author: Betsy McPhail AuthorDate: Sun Jan 20 11:28:39 2019 -0500 Commit: Betsy McPhail CommitDate: Sun Jan 27 16:03:00 2019 -0500 Tests: Make ExternalProjectLocal independent of Tutorial directory Adopt a copy of the needed content so we can modify the original independent of this test. diff --git a/Tests/ExternalProjectLocal/CMakeLists.txt b/Tests/ExternalProjectLocal/CMakeLists.txt index 55fd713..1075a9d 100644 --- a/Tests/ExternalProjectLocal/CMakeLists.txt +++ b/Tests/ExternalProjectLocal/CMakeLists.txt @@ -20,71 +20,55 @@ set(binary_base "${base}/Build") set_property(DIRECTORY PROPERTY EP_BASE ${base}) set_property(DIRECTORY PROPERTY EP_STEP_TARGETS configure build test) -if(NOT DEFINED can_build_tutorial_step5) - set(can_build_tutorial_step5 1) - - # The ExternalProject builds of Tutorial Step5 cannot be built - # correctly 2nd and later times in an in-source build... - # (because the CMakeCache.txt from the real in-source build of - # the Tests/Tutorial/Step5 directory gets copied when we do - # the "source directory copy" step... but it still refers to - # its original path which yields a configure error.) So: - # - if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") - set(can_build_tutorial_step5 0) - endif() -endif() # Local DIR: # -if(can_build_tutorial_step5) - set(proj TutorialStep5-Local) - ExternalProject_Add(${proj} - URL "${CMAKE_CURRENT_SOURCE_DIR}/../Tutorial/Step5" - CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= - CMAKE_ARGS -G ${CMAKE_GENERATOR} - TEST_BEFORE_INSTALL 1 - LOG_INSTALL 1 - ) - set_property(TARGET ${proj} PROPERTY FOLDER "Local") - ExternalProject_Get_Property(${proj} install_dir) - set(TutorialStep5_install_dir ${install_dir}) - - set(proj TutorialStep5-Local-TestAfterInstall) - ExternalProject_Add(${proj} - URL "${CMAKE_CURRENT_SOURCE_DIR}/../Tutorial/Step5" - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= -G ${CMAKE_GENERATOR} - CMAKE_CACHE_DEFAULT_ARGS -DUSE_MYMATH:BOOL=OFF - TEST_AFTER_INSTALL 1 - LOG_TEST 1 - ) - set_property(TARGET ${proj} PROPERTY FOLDER "Local") - - set(proj TutorialStep5-Local-TestExcludeFromMainBefore) - ExternalProject_Add(${proj} - URL "${CMAKE_CURRENT_SOURCE_DIR}/../Tutorial/Step5" - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= -G ${CMAKE_GENERATOR} - CMAKE_CACHE_DEFAULT_ARGS -DUSE_MYMATH:BOOL=OFF - TEST_BEFORE_INSTALL 1 - TEST_EXCLUDE_FROM_MAIN 1 - STEP_TARGETS test - LOG_TEST 1 - ) - set_property(TARGET ${proj} PROPERTY FOLDER "Local") - - set(proj TutorialStep5-Local-TestExcludeFromMainAfter) - ExternalProject_Add(${proj} - URL "${CMAKE_CURRENT_SOURCE_DIR}/../Tutorial/Step5" - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= -G ${CMAKE_GENERATOR} - CMAKE_CACHE_DEFAULT_ARGS -DUSE_MYMATH:BOOL=OFF - TEST_AFTER_INSTALL 1 - TEST_EXCLUDE_FROM_MAIN 1 - STEP_TARGETS test - LOG_TEST 1 - ) - set_property(TARGET ${proj} PROPERTY FOLDER "Local") +set(proj TutorialStep5-Local) +ExternalProject_Add(${proj} +URL "${CMAKE_CURRENT_SOURCE_DIR}/Step5" +CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= +CMAKE_ARGS -G ${CMAKE_GENERATOR} +TEST_BEFORE_INSTALL 1 +LOG_INSTALL 1 +) +set_property(TARGET ${proj} PROPERTY FOLDER "Local") +ExternalProject_Get_Property(${proj} install_dir) +set(TutorialStep5_install_dir ${install_dir}) + +set(proj TutorialStep5-Local-TestAfterInstall) +ExternalProject_Add(${proj} +URL "${CMAKE_CURRENT_SOURCE_DIR}/Step5" +CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= -G ${CMAKE_GENERATOR} +CMAKE_CACHE_DEFAULT_ARGS -DUSE_MYMATH:BOOL=OFF +TEST_AFTER_INSTALL 1 +LOG_TEST 1 +) +set_property(TARGET ${proj} PROPERTY FOLDER "Local") + +set(proj TutorialStep5-Local-TestExcludeFromMainBefore) +ExternalProject_Add(${proj} +URL "${CMAKE_CURRENT_SOURCE_DIR}/Step5" +CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= -G ${CMAKE_GENERATOR} +CMAKE_CACHE_DEFAULT_ARGS -DUSE_MYMATH:BOOL=OFF +TEST_BEFORE_INSTALL 1 +TEST_EXCLUDE_FROM_MAIN 1 +STEP_TARGETS test +LOG_TEST 1 +) +set_property(TARGET ${proj} PROPERTY FOLDER "Local") + +set(proj TutorialStep5-Local-TestExcludeFromMainAfter) +ExternalProject_Add(${proj} +URL "${CMAKE_CURRENT_SOURCE_DIR}/Step5" +CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= -G ${CMAKE_GENERATOR} +CMAKE_CACHE_DEFAULT_ARGS -DUSE_MYMATH:BOOL=OFF +TEST_AFTER_INSTALL 1 +TEST_EXCLUDE_FROM_MAIN 1 +STEP_TARGETS test +LOG_TEST 1 +) +set_property(TARGET ${proj} PROPERTY FOLDER "Local") -endif() # Local TAR: @@ -209,12 +193,10 @@ enable_testing() # # BuildTree tests: # -if(can_build_tutorial_step5) - add_test(TutorialStep5-Local-BuildTreeTest - "${binary_base}/TutorialStep5-Local/Tutorial" 42) - set_property(TEST TutorialStep5-Local-BuildTreeTest - APPEND PROPERTY LABELS Step5 BuildTree) -endif() +add_test(TutorialStep5-Local-BuildTreeTest +"${binary_base}/TutorialStep5-Local/Tutorial" 42) +set_property(TEST TutorialStep5-Local-BuildTreeTest +APPEND PROPERTY LABELS Step5 BuildTree) add_test(TutorialStep1-LocalTAR-BuildTreeTest "${binary_base}/TutorialStep1-LocalTAR/EP-Tutorial" 36) @@ -234,12 +216,7 @@ add_test(TutorialStep1-LocalNoDirTGZ-BuildTreeTest # InstallTree tests: # -if(can_build_tutorial_step5) - add_test(TutorialStep5-InstallTreeTest - "${TutorialStep5_install_dir}/bin/Tutorial" 49) - set_property(TEST TutorialStep5-InstallTreeTest - APPEND PROPERTY LABELS Step5 InstallTree) -endif() - - -message(STATUS "can_build_tutorial_step5='${can_build_tutorial_step5}'") +add_test(TutorialStep5-InstallTreeTest +"${TutorialStep5_install_dir}/bin/Tutorial" 49) +set_property(TEST TutorialStep5-InstallTreeTest +APPEND PROPERTY LABELS Step5 InstallTree) diff --git a/Tests/ExternalProjectLocal/Step5/CMakeLists.txt b/Tests/ExternalProjectLocal/Step5/CMakeLists.txt new file mode 100644 index 0000000..93b3880 --- /dev/null +++ b/Tests/ExternalProjectLocal/Step5/CMakeLists.txt @@ -0,0 +1,71 @@ +cmake_minimum_required (VERSION 2.6) +project (Tutorial) + +# The version number. +set (Tutorial_VERSION_MAJOR 1) +set (Tutorial_VERSION_MINOR 0) + +# does this system provide the log and exp functions? +include (${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake) +check_function_exists (log HAVE_LOG) +check_function_exists (exp HAVE_EXP) + +# should we use our own math functions +option(USE_MYMATH "Use tutorial provided math implementation" ON) + +# configure a header file to pass some of the CMake settings +# to the source code +configure_file ( + "${PROJECT_SOURCE_DIR}/TutorialConfig.h.in" + "${PROJECT_BINARY_DIR}/TutorialConfig.h" + ) + +# add the binary tree to the search path for include files +# so that we will find TutorialConfig.h +include_directories ("${PROJECT_BINARY_DIR}") + +# add the MathFunctions library? +if (USE_MYMATH) + include_directories ("${PROJECT_SOURCE_DIR}/MathFunctions") + add_subdirectory (MathFunctions) + set (EXTRA_LIBS ${EXTRA_LIBS} MathFunctions) +endif () + +# add the executable +add_executable (Tutorial tutorial.cxx) +target_link_libraries (Tutorial ${EXTRA_LIBS}) + +# add the install targets +install (TARGETS Tutorial DESTINATION bin) +install (FILES "${PROJECT_BINARY_DIR}/TutorialConfig.h" + DESTINATION include) + +# enable testing +enable_testing () + +# does the application run +add_test (TutorialRuns Tutorial 25) + +# does the usage message work? +add_test (TutorialUsage Tutorial) +set_tests_properties (TutorialUsage + PROPERTIES + PASS_REGULAR_EXPRESSION "Usage:.*number" + ) + +#define a macro to simplify adding tests +macro (do_test arg result) + add_test (TutorialComp${arg} Tutorial ${arg}) + set_tests_properties (TutorialComp${arg} + PROPERTIES PASS_REGULAR_EXPRESSION ${result} + ) +endmacro () + +# do a bunch of result based tests +do_test (4 "4 is 2") +do_test (9 "9 is 3") +do_test (5 "5 is 2.236") +do_test (7 "7 is 2.645") +do_test (25 "25 is 5") +do_test (-25 "-25 is 0") +do_test (0.0001 "0.0001 is 0.01") diff --git a/Tests/ExternalProjectLocal/Step5/MathFunctions/CMakeLists.txt b/Tests/ExternalProjectLocal/Step5/MathFunctions/CMakeLists.txt new file mode 100644 index 0000000..453a463 --- /dev/null +++ b/Tests/ExternalProjectLocal/Step5/MathFunctions/CMakeLists.txt @@ -0,0 +1,17 @@ +# first we add the executable that generates the table +# add the binary tree directory to the search path for include files +include_directories( ${CMAKE_CURRENT_BINARY_DIR} ) + +add_executable(MakeTable MakeTable.cxx ) +# add the command to generate the source code +add_custom_command ( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Table.h + COMMAND MakeTable ${CMAKE_CURRENT_BINARY_DIR}/Table.h + DEPENDS MakeTable + ) + +# add the main library +add_library(MathFunctions mysqrt.cxx ${CMAKE_CURRENT_BINARY_DIR}/Table.h ) + +install (TARGETS MathFunctions DESTINATION bin) +install (FILES MathFunctions.h DESTINATION include) diff --git a/Tests/ExternalProjectLocal/Step5/MathFunctions/MakeTable.cxx b/Tests/ExternalProjectLocal/Step5/MathFunctions/MakeTable.cxx new file mode 100644 index 0000000..cebd50f --- /dev/null +++ b/Tests/ExternalProjectLocal/Step5/MathFunctions/MakeTable.cxx @@ -0,0 +1,32 @@ +// A simple program that builds a sqrt table +#include +#include + +int main(int argc, char* argv[]) +{ + int i; + double result; + + // make sure we have enough arguments + if (argc < 2) { + return 1; + } + + // open the output file + FILE* fout = fopen(argv[1], "w"); + if (!fout) { + return 1; + } + + // create a source file with a table of square roots + fprintf(fout, "double sqrtTable[] = {\n"); + for (i = 0; i < 10; ++i) { + result = sqrt(static_cast(i)); + fprintf(fout, "%g,\n", result); + } + + // close the table with a zero + fprintf(fout, "0};\n"); + fclose(fout); + return 0; +} diff --git a/Tests/ExternalProjectLocal/Step5/MathFunctions/MathFunctions.h b/Tests/ExternalProjectLocal/Step5/MathFunctions/MathFunctions.h new file mode 100644 index 0000000..cd36bcc --- /dev/null +++ b/Tests/ExternalProjectLocal/Step5/MathFunctions/MathFunctions.h @@ -0,0 +1 @@ +double mysqrt(double x); diff --git a/Tests/ExternalProjectLocal/Step5/MathFunctions/mysqrt.cxx b/Tests/ExternalProjectLocal/Step5/MathFunctions/mysqrt.cxx new file mode 100644 index 0000000..458ed63 --- /dev/null +++ b/Tests/ExternalProjectLocal/Step5/MathFunctions/mysqrt.cxx @@ -0,0 +1,40 @@ +#include "MathFunctions.h" +#include "TutorialConfig.h" +#include + +// include the generated table +#include "Table.h" + +#include + +// a hack square root calculation using simple operations +double mysqrt(double x) +{ + if (x <= 0) { + return 0; + } + + double result; + + // if we have both log and exp then use them + double delta; + + // use the table to help find an initial value + result = x; + if (x >= 1 && x < 10) { + result = sqrtTable[static_cast(x)]; + } + + // do ten iterations + int i; + for (i = 0; i < 10; ++i) { + if (result <= 0) { + result = 0.1; + } + delta = x - (result * result); + result = result + 0.5 * delta / result; + fprintf(stdout, "Computing sqrt of %g to be %g\n", x, result); + } + + return result; +} diff --git a/Tests/ExternalProjectLocal/Step5/TutorialConfig.h.in b/Tests/ExternalProjectLocal/Step5/TutorialConfig.h.in new file mode 100644 index 0000000..e97ce24 --- /dev/null +++ b/Tests/ExternalProjectLocal/Step5/TutorialConfig.h.in @@ -0,0 +1,8 @@ +// the configured options and settings for Tutorial +#define Tutorial_VERSION_MAJOR @Tutorial_VERSION_MAJOR@ +#define Tutorial_VERSION_MINOR @Tutorial_VERSION_MINOR@ +#cmakedefine USE_MYMATH + +// does the platform provide exp and log functions? +#cmakedefine HAVE_LOG +#cmakedefine HAVE_EXP diff --git a/Tests/ExternalProjectLocal/Step5/tutorial.cxx b/Tests/ExternalProjectLocal/Step5/tutorial.cxx new file mode 100644 index 0000000..37f6ac4 --- /dev/null +++ b/Tests/ExternalProjectLocal/Step5/tutorial.cxx @@ -0,0 +1,33 @@ +// A simple program that computes the square root of a number +#include "TutorialConfig.h" +#include +#include +#include + +#ifdef USE_MYMATH +# include "MathFunctions.h" +#endif + +int main(int argc, char* argv[]) +{ + if (argc < 2) { + fprintf(stdout, "%s Version %d.%d\n", argv[0], Tutorial_VERSION_MAJOR, + Tutorial_VERSION_MINOR); + fprintf(stdout, "Usage: %s number\n", argv[0]); + return 1; + } + + double inputValue = atof(argv[1]); + double outputValue = 0; + + if (inputValue >= 0) { +#ifdef USE_MYMATH + outputValue = mysqrt(inputValue); +#else + outputValue = sqrt(inputValue); +#endif + } + + fprintf(stdout, "The square root of %g is %g\n", inputValue, outputValue); + return 0; +} https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b6a957c9696706a338cdeef63540bf8a4c42d22d commit b6a957c9696706a338cdeef63540bf8a4c42d22d Author: Bruno Manganelli AuthorDate: Fri Nov 23 18:52:26 2018 +0000 Commit: Bruno Manganelli CommitDate: Sun Jan 27 15:48:57 2019 +0000 cmOutputConverter: move ConvertToRelativePath to cmStateDirectory. diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index a1df271..0414817 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -198,7 +198,7 @@ std::string cmCommonTargetGenerator::GetManifests() manifests.reserve(manifest_srcs.size()); for (cmSourceFile const* manifest_src : manifest_srcs) { manifests.push_back(this->LocalCommonGenerator->ConvertToOutputFormat( - this->LocalCommonGenerator->ConvertToRelativePath( + this->LocalCommonGenerator->MaybeConvertToRelativePath( this->LocalCommonGenerator->GetWorkingDirectory(), manifest_src->GetFullPath()), cmOutputConverter::SHELL)); diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index 072d116..dcf9cdf 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -100,7 +100,8 @@ bool cmDependsC::WriteDependencies(const std::set& sources, // Compute a path to the object file to write to the internal depend file. // Any existing content of the internal depend file has already been // loaded in ValidDeps with this path as a key. - std::string obj_i = this->LocalGenerator->ConvertToRelativePath(binDir, obj); + std::string obj_i = + this->LocalGenerator->MaybeConvertToRelativePath(binDir, obj); if (this->ValidDeps != nullptr) { std::map::const_iterator tmpIt = @@ -234,7 +235,8 @@ bool cmDependsC::WriteDependencies(const std::set& sources, for (std::string const& dep : dependencies) { makeDepends << obj_m << ": " << cmSystemTools::ConvertToOutputPath( - this->LocalGenerator->ConvertToRelativePath(binDir, dep)) + this->LocalGenerator->MaybeConvertToRelativePath(binDir, + dep)) << std::endl; internalDepends << " " << dep << std::endl; } diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 5833631..30067b7 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -899,7 +899,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const for (cmLocalGenerator* lgen : this->GlobalGenerator->GetLocalGenerators()) { const std::vector& targets = lgen->GetGeneratorTargets(); - std::string subdir = lgen->ConvertToRelativePath( + std::string subdir = lgen->MaybeConvertToRelativePath( this->HomeOutputDirectory, lgen->GetCurrentBinaryDirectory()); if (subdir == ".") { subdir.clear(); diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index 19605e4..3a65ecc 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -150,7 +150,8 @@ void cmGhsMultiTargetGenerator::WriteTargetSpecifics(std::ostream& fout, if (this->TagType != GhsMultiGpj::SUBPROJECT) { // set target binary file destination outpath = this->GeneratorTarget->GetDirectory(config); - outpath = this->LocalGenerator->ConvertToRelativePath(rootpath, outpath); + outpath = + this->LocalGenerator->MaybeConvertToRelativePath(rootpath, outpath); fout << " :binDirRelative=\"" << outpath << "\"" << std::endl; fout << " -o \"" << this->TargetNameReal << "\"" << std::endl; } @@ -550,7 +551,7 @@ void cmGhsMultiTargetGenerator::WriteReferences(std::ostream& fout) std::string tpath = t->LocalGenerator->GetCurrentBinaryDirectory(); std::string rootpath = this->LocalGenerator->GetCurrentBinaryDirectory(); std::string outpath = - this->LocalGenerator->ConvertToRelativePath(rootpath, tpath) + "/" + + this->LocalGenerator->MaybeConvertToRelativePath(rootpath, tpath) + "/" + tname + "REF" + cmGlobalGhsMultiGenerator::FILE_EXTENSION; fout << outpath; diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 2d36315..fff99b8 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -33,7 +33,6 @@ #include "cmMSVC60LinkLineComputer.h" #include "cmMakefile.h" #include "cmMessageType.h" -#include "cmOutputConverter.h" #include "cmPolicies.h" #include "cmSourceFile.h" #include "cmState.h" @@ -2804,8 +2803,9 @@ void cmGlobalGenerator::AddRuleHash(const std::vector& outputs, } // Shorten the output name (in expected use case). - cmOutputConverter converter(this->GetMakefiles()[0]->GetStateSnapshot()); - std::string fname = converter.ConvertToRelativePath( + cmStateDirectory cmDir = + this->GetMakefiles()[0]->GetStateSnapshot().GetDirectory(); + std::string fname = cmDir.ConvertToRelPathIfNotContained( this->GetMakefiles()[0]->GetState()->GetBinaryDirectory(), outputs[0]); // Associate the hash with this output. diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 557efec..ff4c3a3 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -297,7 +297,7 @@ void cmGlobalGhsMultiGenerator::WriteSubProjects( if (projName && projType) { cmLocalGenerator* lg = target->GetLocalGenerator(); std::string dir = lg->GetCurrentBinaryDirectory(); - dir = root->ConvertToRelativePath(rootBinaryDir, dir.c_str()); + dir = root->MaybeConvertToRelativePath(rootBinaryDir, dir.c_str()); if (dir == ".") { dir.clear(); } else { diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 23dbd76..8f09566 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -861,7 +861,7 @@ std::string const& cmGlobalNinjaGenerator::ConvertToNinjaPath( cmLocalNinjaGenerator* ng = static_cast(this->LocalGenerators[0]); std::string const& bin_dir = ng->GetState()->GetBinaryDirectory(); - std::string convPath = ng->ConvertToRelativePath(bin_dir, path); + std::string convPath = ng->MaybeConvertToRelativePath(bin_dir, path); convPath = this->NinjaOutputPath(convPath); #ifdef _WIN32 std::replace(convPath.begin(), convPath.end(), '/', '\\'); diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 52bb046..9d176c3 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -325,7 +325,8 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() << "set(CMAKE_MAKEFILE_DEPENDS\n" << " \"CMakeCache.txt\"\n"; for (std::string const& f : lfiles) { - cmakefileStream << " \"" << lg->ConvertToRelativePath(currentBinDir, f) + cmakefileStream << " \"" + << lg->MaybeConvertToRelativePath(currentBinDir, f) << "\"\n"; } cmakefileStream << " )\n\n"; @@ -339,9 +340,11 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() cmakefileStream << "# The corresponding makefile is:\n" << "set(CMAKE_MAKEFILE_OUTPUTS\n" << " \"" - << lg->ConvertToRelativePath(currentBinDir, makefileName) + << lg->MaybeConvertToRelativePath(currentBinDir, + makefileName) << "\"\n" - << " \"" << lg->ConvertToRelativePath(currentBinDir, check) + << " \"" + << lg->MaybeConvertToRelativePath(currentBinDir, check) << "\"\n"; cmakefileStream << " )\n\n"; @@ -354,7 +357,8 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() const std::vector& outfiles = lg->GetMakefile()->GetOutputFiles(); for (std::string const& outfile : outfiles) { - cmakefileStream << " \"" << lg->ConvertToRelativePath(binDir, outfile) + cmakefileStream << " \"" + << lg->MaybeConvertToRelativePath(binDir, outfile) << "\"\n"; } @@ -365,7 +369,8 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() tmpStr = lg->GetCurrentBinaryDirectory(); tmpStr += cmake::GetCMakeFilesDirectory(); tmpStr += "/CMakeDirectoryInformation.cmake"; - cmakefileStream << " \"" << lg->ConvertToRelativePath(binDir, tmpStr) + cmakefileStream << " \"" + << lg->MaybeConvertToRelativePath(binDir, tmpStr) << "\"\n"; } cmakefileStream << " )\n\n"; @@ -474,7 +479,7 @@ void cmGlobalUnixMakefileGenerator3::WriteDirectoryRules2( // Begin the directory-level rules section. std::string dir = - cmSystemTools::ConvertToOutputPath(lg->ConvertToRelativePath( + cmSystemTools::ConvertToOutputPath(lg->MaybeConvertToRelativePath( lg->GetBinaryDirectory(), lg->GetCurrentBinaryDirectory())); lg->WriteDivider(ruleFileStream); ruleFileStream << "# Directory level rules for directory " << dir << "\n\n"; @@ -526,9 +531,9 @@ void cmGlobalUnixMakefileGenerator3::GenerateBuildCommand( if (fast) { tname += "/fast"; } - cmOutputConverter conv(mf->GetStateSnapshot()); tname = - conv.ConvertToRelativePath(mf->GetState()->GetBinaryDirectory(), tname); + mf->GetStateSnapshot().GetDirectory().ConvertToRelPathIfNotContained( + mf->GetState()->GetBinaryDirectory(), tname); cmSystemTools::ConvertToOutputSlashes(tname); makeCommand.push_back(std::move(tname)); } diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index cae46e1..c267a7b 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -367,7 +367,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution( if (vcprojName) { cmLocalGenerator* lg = target->GetLocalGenerator(); std::string dir = lg->GetCurrentBinaryDirectory(); - dir = root->ConvertToRelativePath(rootBinaryDir, dir.c_str()); + dir = root->MaybeConvertToRelativePath(rootBinaryDir, dir.c_str()); if (dir == ".") { dir.clear(); // msbuild cannot handle ".\" prefix } diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 80ccd73..3d6f36e 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -3570,7 +3570,7 @@ std::string cmGlobalXCodeGenerator::RelativeToSource(const char* p) std::string cmGlobalXCodeGenerator::RelativeToBinary(const char* p) { - return this->CurrentLocalGenerator->ConvertToRelativePath( + return this->CurrentLocalGenerator->MaybeConvertToRelativePath( cmSystemTools::JoinPath(this->ProjectOutputDirectoryComponents), p); } diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index 9aa1f32..aa53552 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -5,8 +5,8 @@ #include "cmListFileLexer.h" #include "cmMessageType.h" #include "cmMessenger.h" -#include "cmOutputConverter.h" #include "cmState.h" +#include "cmStateDirectory.h" #include "cmSystemTools.h" #include @@ -390,9 +390,8 @@ void cmListFileBacktrace::PrintTitle(std::ostream& out) const } cmListFileContext lfc = this->TopEntry->Context; cmStateSnapshot bottom = this->GetBottom(); - cmOutputConverter converter(bottom); if (!bottom.GetState()->GetIsInTryCompile()) { - lfc.FilePath = converter.ConvertToRelativePath( + lfc.FilePath = bottom.GetDirectory().ConvertToRelPathIfNotContained( bottom.GetState()->GetSourceDirectory(), lfc.FilePath); } out << (lfc.Line ? " at " : " in ") << lfc; @@ -409,7 +408,6 @@ void cmListFileBacktrace::PrintCallStack(std::ostream& out) const bool first = true; cmStateSnapshot bottom = this->GetBottom(); - cmOutputConverter converter(bottom); for (Entry const* cur = this->TopEntry->Parent.get(); !cur->IsBottom(); cur = cur->Parent.get()) { if (cur->Context.Name.empty()) { @@ -423,7 +421,7 @@ void cmListFileBacktrace::PrintCallStack(std::ostream& out) const } cmListFileContext lfc = cur->Context; if (!bottom.GetState()->GetIsInTryCompile()) { - lfc.FilePath = converter.ConvertToRelativePath( + lfc.FilePath = bottom.GetDirectory().ConvertToRelPathIfNotContained( bottom.GetState()->GetSourceDirectory(), lfc.FilePath); } out << " " << lfc << "\n"; diff --git a/Source/cmLocalCommonGenerator.cxx b/Source/cmLocalCommonGenerator.cxx index 7ce2c82..ad89335 100644 --- a/Source/cmLocalCommonGenerator.cxx +++ b/Source/cmLocalCommonGenerator.cxx @@ -47,7 +47,7 @@ std::string cmLocalCommonGenerator::GetTargetFortranFlags( target->GetFortranModuleDirectory(this->WorkingDirectory); if (!mod_dir.empty()) { mod_dir = this->ConvertToOutputFormat( - this->ConvertToRelativePath(this->WorkingDirectory, mod_dir), + this->MaybeConvertToRelativePath(this->WorkingDirectory, mod_dir), cmOutputConverter::SHELL); } else { mod_dir = diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 97e684b..89ad96d 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -316,7 +316,7 @@ void cmLocalGenerator::GenerateTestFiles() for (cmStateSnapshot const& i : children) { // TODO: Use add_subdirectory instead? std::string outP = i.GetDirectory().GetCurrentBinary(); - outP = this->ConvertToRelativePath(parentBinDir, outP); + outP = this->MaybeConvertToRelativePath(parentBinDir, outP); outP = cmOutputConverter::EscapeForCMake(outP); fout << "subdirs(" << outP << ")" << std::endl; } @@ -2294,7 +2294,7 @@ std::string cmLocalGenerator::ConstructComment( std::string currentBinaryDir = this->GetCurrentBinaryDirectory(); for (std::string const& o : ccg.GetOutputs()) { comment += sep; - comment += this->ConvertToRelativePath(currentBinaryDir, o); + comment += this->MaybeConvertToRelativePath(currentBinaryDir, o); sep = ", "; } return comment; @@ -2551,15 +2551,15 @@ std::string cmLocalGenerator::GetObjectFileNameWithoutTarget( std::string const& fullPath = source.GetFullPath(); // Try referencing the source relative to the source tree. - std::string relFromSource = - this->ConvertToRelativePath(this->GetCurrentSourceDirectory(), fullPath); + std::string relFromSource = this->MaybeConvertToRelativePath( + this->GetCurrentSourceDirectory(), fullPath); assert(!relFromSource.empty()); bool relSource = !cmSystemTools::FileIsFullPath(relFromSource); bool subSource = relSource && relFromSource[0] != '.'; // Try referencing the source relative to the binary tree. - std::string relFromBinary = - this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), fullPath); + std::string relFromBinary = this->MaybeConvertToRelativePath( + this->GetCurrentBinaryDirectory(), fullPath); assert(!relFromBinary.empty()); bool relBinary = !cmSystemTools::FileIsFullPath(relFromBinary); bool subBinary = relBinary && relFromBinary[0] != '.'; @@ -2658,6 +2658,13 @@ std::string const& cmLocalGenerator::GetCurrentSourceDirectory() const return this->StateSnapshot.GetDirectory().GetCurrentSource(); } +std::string cmLocalGenerator::MaybeConvertToRelativePath( + std::string const& local_path, std::string const& remote_path) const +{ + return this->StateSnapshot.GetDirectory().ConvertToRelPathIfNotContained( + local_path, remote_path); +} + std::string cmLocalGenerator::GetTargetDirectory( const cmGeneratorTarget* /*unused*/) const { diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index dc54314..4be3905 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -302,6 +302,16 @@ public: std::string const& GetCurrentSourceDirectory() const; /** + * Convert the given remote path to a relative path with respect to + * the given local path. Both paths must use forward slashes and not + * already be escaped or quoted. + * The conversion is skipped if the paths are not both in the source + * or both in the binary tree. + */ + std::string MaybeConvertToRelativePath(std::string const& local_path, + std::string const& remote_path) const; + + /** * Generate a macOS application bundle Info.plist file. */ void GenerateAppleInfoPList(cmGeneratorTarget* target, diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index a8647b1..f252045 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -54,7 +54,7 @@ void cmLocalNinjaGenerator::Generate() { // Compute the path to use when referencing the current output // directory from the top output directory. - this->HomeRelativeOutputPath = this->ConvertToRelativePath( + this->HomeRelativeOutputPath = this->MaybeConvertToRelativePath( this->GetBinaryDirectory(), this->GetCurrentBinaryDirectory()); if (this->HomeRelativeOutputPath == ".") { this->HomeRelativeOutputPath.clear(); @@ -141,7 +141,8 @@ std::string cmLocalNinjaGenerator::ConvertToIncludeReference( format); } return this->ConvertToOutputFormat( - this->ConvertToRelativePath(this->GetBinaryDirectory(), path), format); + this->MaybeConvertToRelativePath(this->GetBinaryDirectory(), path), + format); } // Private methods. @@ -584,8 +585,8 @@ std::string cmLocalNinjaGenerator::MakeCustomLauncher( if (!outputs.empty()) { output = outputs[0]; if (ccg.GetWorkingDirectory().empty()) { - output = - this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), output); + output = this->MaybeConvertToRelativePath( + this->GetCurrentBinaryDirectory(), output); } output = this->ConvertToOutputFormat(output, cmOutputConverter::SHELL); } diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index e590e52..1d4793a 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -2088,12 +2088,3 @@ void cmLocalUnixMakefileGenerator3::CreateCDCommand( [&prefix](std::string const& s) { return prefix + s; }); } } - -std::string cmLocalUnixMakefileGenerator3::MaybeConvertToRelativePath( - std::string const& base, std::string const& path) -{ - if (!this->GetStateSnapshot().GetDirectory().ContainsBoth(base, path)) { - return path; - } - return cmSystemTools::ForceToRelativePath(base, path); -} diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index ee6b37b..b256fdc 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -183,9 +183,6 @@ public: // Eclipse generator. void GetIndividualFileTargets(std::vector& targets); - std::string MaybeConvertToRelativePath(std::string const& base, - std::string const& path); - protected: void WriteLocalMakefile(); diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 677d033..cd97dc4 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -803,8 +803,8 @@ void cmLocalVisualStudio7Generator::WriteConfiguration( target->GetProperty("Fortran_MODULE_DIRECTORY"); std::string modDir; if (target_mod_dir) { - modDir = this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), - target_mod_dir); + modDir = this->MaybeConvertToRelativePath( + this->GetCurrentBinaryDirectory(), target_mod_dir); } else { modDir = "."; } @@ -1306,7 +1306,7 @@ void cmLocalVisualStudio7GeneratorInternals::OutputLibraries( for (ItemVector::const_iterator l = libs.begin(); l != libs.end(); ++l) { if (l->IsPath) { std::string rel = - lg->ConvertToRelativePath(currentBinDir, l->Value.c_str()); + lg->MaybeConvertToRelativePath(currentBinDir, l->Value.c_str()); fout << lg->ConvertToXMLOutputPath(rel.c_str()) << " "; } else if (!l->Target || l->Target->GetType() != cmStateEnums::INTERFACE_LIBRARY) { @@ -1332,7 +1332,7 @@ void cmLocalVisualStudio7GeneratorInternals::OutputObjects( i != objs.end(); ++i) { if (!(*i)->GetObjectLibrary().empty()) { std::string const& objFile = (*i)->GetFullPath(); - std::string rel = lg->ConvertToRelativePath(currentBinDir, objFile); + std::string rel = lg->MaybeConvertToRelativePath(currentBinDir, objFile); fout << sep << lg->ConvertToXMLOutputPath(rel.c_str()); sep = " "; } @@ -1358,7 +1358,7 @@ void cmLocalVisualStudio7Generator::OutputLibraryDirectories( // Switch to a relative path specification if it is shorter. if (cmSystemTools::FileIsFullPath(dir.c_str())) { std::string rel = - this->ConvertToRelativePath(currentBinDir, dir.c_str()); + this->MaybeConvertToRelativePath(currentBinDir, dir.c_str()); if (rel.size() < dir.size()) { dir = rel; } diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index 2237da7..660729c 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -210,9 +210,10 @@ std::string cmLocalVisualStudioGenerator::ConstructScript( } if (workingDirectory.empty()) { - script += this->ConvertToOutputFormat( - this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), cmd), - cmOutputConverter::SHELL); + script += + this->ConvertToOutputFormat(this->MaybeConvertToRelativePath( + this->GetCurrentBinaryDirectory(), cmd), + cmOutputConverter::SHELL); } else { script += this->ConvertToOutputFormat(cmd.c_str(), SHELL); } diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index 011c7d8..7d88b08 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -10,7 +10,6 @@ #include #include "cmState.h" -#include "cmStateDirectory.h" #include "cmSystemTools.h" cmOutputConverter::cmOutputConverter(cmStateSnapshot const& snapshot) @@ -72,17 +71,6 @@ std::string cmOutputConverter::ConvertDirectorySeparatorsForShell( return result; } -std::string cmOutputConverter::ConvertToRelativePath( - std::string const& local_path, std::string const& remote_path) const -{ - if (!this->StateSnapshot.GetDirectory().ContainsBoth(local_path, - remote_path)) { - return remote_path; - } - - return cmSystemTools::ForceToRelativePath(local_path, remote_path); -} - static bool cmOutputConverterIsShellOperator(const std::string& str) { static std::set shellOperators; diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h index 5a4f879..6438c7b 100644 --- a/Source/cmOutputConverter.h +++ b/Source/cmOutputConverter.h @@ -91,16 +91,6 @@ public: }; static FortranFormat GetFortranFormat(const char* value); - /** - * Convert the given remote path to a relative path with respect to - * the given local path. Both paths must use forward slashes and not - * already be escaped or quoted. - * The conversion is skipped if the paths are not both in the source - * or both in the binary tree. - */ - std::string ConvertToRelativePath(std::string const& local_path, - std::string const& remote_path) const; - private: cmState* GetState() const; diff --git a/Source/cmStateDirectory.cxx b/Source/cmStateDirectory.cxx index 40f694c..6752743 100644 --- a/Source/cmStateDirectory.cxx +++ b/Source/cmStateDirectory.cxx @@ -155,6 +155,15 @@ bool cmStateDirectory::ContainsBoth(std::string const& local_path, return bothInBinary || bothInSource; } +std::string cmStateDirectory::ConvertToRelPathIfNotContained( + std::string const& local_path, std::string const& remote_path) const +{ + if (!this->ContainsBoth(local_path, remote_path)) { + return remote_path; + } + return cmSystemTools::ForceToRelativePath(local_path, remote_path); +} + cmStateDirectory::cmStateDirectory( cmLinkedTree::iterator iter, const cmStateSnapshot& snapshot) diff --git a/Source/cmStateDirectory.h b/Source/cmStateDirectory.h index c4b18ad..6956594 100644 --- a/Source/cmStateDirectory.h +++ b/Source/cmStateDirectory.h @@ -35,6 +35,9 @@ public: bool ContainsBoth(std::string const& local_path, std::string const& remote_path) const; + std::string ConvertToRelPathIfNotContained( + std::string const& local_path, std::string const& remote_path) const; + cmStringRange GetIncludeDirectoriesEntries() const; cmBacktraceRange GetIncludeDirectoriesEntryBacktraces() const; void AppendIncludeDirectoriesEntry(std::string const& vec, diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index fe48934..93cdd46 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -19,7 +19,6 @@ #include "cmMakefile.h" #include "cmMessageType.h" #include "cmMessenger.h" -#include "cmOutputConverter.h" #include "cmProperty.h" #include "cmSourceFile.h" #include "cmSourceFileLocation.h" @@ -747,11 +746,12 @@ void cmTarget::GetTllSignatureTraces(std::ostream& s, TLLSignature sig) const const char* sigString = (sig == cmTarget::KeywordTLLSignature ? "keyword" : "plain"); s << "The uses of the " << sigString << " signature are here:\n"; - cmOutputConverter converter(this->GetMakefile()->GetStateSnapshot()); + cmStateDirectory cmDir = + this->GetMakefile()->GetStateSnapshot().GetDirectory(); for (auto const& cmd : this->TLLCommands) { if (cmd.first == sig) { cmListFileContext lfc = cmd.second; - lfc.FilePath = converter.ConvertToRelativePath( + lfc.FilePath = cmDir.ConvertToRelPathIfNotContained( this->Makefile->GetState()->GetSourceDirectory(), lfc.FilePath); s << " * " << lfc << std::endl; } diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index ac4a4f5..9d7dd07 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -3584,8 +3584,8 @@ bool cmVisualStudio10TargetGenerator::ComputeLibOptions( this->LocalGenerator->GetCurrentBinaryDirectory(); for (cmComputeLinkInformation::Item const& l : libs) { if (l.IsPath && cmVS10IsTargetsFile(l.Value)) { - std::string path = - this->LocalGenerator->ConvertToRelativePath(currentBinDir, l.Value); + std::string path = this->LocalGenerator->MaybeConvertToRelativePath( + currentBinDir, l.Value); ConvertToWindowsSlash(path); this->AddTargetsFileAndConfigPair(path, config); } @@ -3668,8 +3668,8 @@ void cmVisualStudio10TargetGenerator::AddLibraries( } if (l.IsPath) { - std::string path = - this->LocalGenerator->ConvertToRelativePath(currentBinDir, l.Value); + std::string path = this->LocalGenerator->MaybeConvertToRelativePath( + currentBinDir, l.Value); ConvertToWindowsSlash(path); if (cmVS10IsTargetsFile(l.Value)) { vsTargetVec.push_back(path); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=638667efa2b0e5fff5c63bf936748a60b602ae90 commit 638667efa2b0e5fff5c63bf936748a60b602ae90 Author: Florian Maushart AuthorDate: Sun Jul 15 08:44:23 2018 +0200 Commit: Brad King CommitDate: Fri Jan 25 08:21:14 2019 -0500 cmake: cmcmd.cxx fix "The arguments are" comments Changed "argv" to "args" in comments to match parameter names diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 26f7509..5ae0ea4 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -1351,8 +1351,8 @@ static void cmcmdProgressReport(std::string const& dir, std::string const& num) int cmcmd::ExecuteEchoColor(std::vector& args) { // The arguments are - // argv[0] == - // argv[1] == cmake_echo_color + // args[0] == + // args[1] == cmake_echo_color bool enabled = true; int color = cmsysTerminal_Color_Normal; @@ -1409,10 +1409,10 @@ int cmcmd::ExecuteEchoColor(std::vector& args) int cmcmd::ExecuteLinkScript(std::vector& args) { // The arguments are - // argv[0] == - // argv[1] == cmake_link_script - // argv[2] == - // argv[3] == --verbose=? + // args[0] == + // args[1] == cmake_link_script + // args[2] == + // args[3] == --verbose=? bool verbose = false; if (args.size() >= 4) { if (args[3].find("--verbose=") == 0) { https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3ca44029668c057fb208c5f153c4d398bee954cb commit 3ca44029668c057fb208c5f153c4d398bee954cb Author: Florian Maushart AuthorDate: Tue Jun 26 21:24:19 2018 +0200 Commit: Brad King CommitDate: Fri Jan 25 08:21:13 2019 -0500 ctest: Fix --build-and-test without --build-target on Xcode diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index e9b82cf..97d8bdb 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -348,11 +348,13 @@ void cmGlobalXCodeGenerator::GenerateBuildCommand( makeCommand.add( this->SelectMakeProgram(makeProgram, this->GetXcodeBuildCommand())); - makeCommand.add("-project"); - std::string projectArg = projectName; - projectArg += ".xcode"; - projectArg += "proj"; - makeCommand.add(projectArg); + if (!projectName.empty()) { + makeCommand.add("-project"); + std::string projectArg = projectName; + projectArg += ".xcode"; + projectArg += "proj"; + makeCommand.add(projectArg); + } bool clean = false; std::string realTarget = targetName; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cb6c233eccfbb600ec16716224062627df2ff2c0 commit cb6c233eccfbb600ec16716224062627df2ff2c0 Author: Florian Maushart AuthorDate: Sun Jun 10 21:39:01 2018 +0200 Commit: Brad King CommitDate: Fri Jan 25 08:20:51 2019 -0500 cmake: Add -hideShellScriptEnvironment xcodebuild option For CMake's build tool mode add -hideShellScriptEnvironment if version is XCode 7.0 or above diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index b8aa5a6..e9b82cf 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -372,6 +372,9 @@ void cmGlobalXCodeGenerator::GenerateBuildCommand( } } + if (this->XcodeVersion >= 70) { + makeCommand.add("-hideShellScriptEnvironment"); + } makeCommand.add(makeOptions.begin(), makeOptions.end()); } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1a45266cb544d73a7d7e46d6129ead1faf71fa85 commit 1a45266cb544d73a7d7e46d6129ead1faf71fa85 Author: Robert Maynard AuthorDate: Tue Oct 30 16:13:33 2018 -0400 Commit: Brad King CommitDate: Fri Jan 25 08:20:02 2019 -0500 cmGlobalGenerator: Add a class that represent the build command This refactors a std::vector into a class so that we can extend the features to represent things such as multiple chained commands in the future. diff --git a/Source/cmGlobalBorlandMakefileGenerator.cxx b/Source/cmGlobalBorlandMakefileGenerator.cxx index 56714b1..c2eb583 100644 --- a/Source/cmGlobalBorlandMakefileGenerator.cxx +++ b/Source/cmGlobalBorlandMakefileGenerator.cxx @@ -54,7 +54,7 @@ void cmGlobalBorlandMakefileGenerator::GetDocumentation( } void cmGlobalBorlandMakefileGenerator::GenerateBuildCommand( - std::vector& makeCommand, const std::string& makeProgram, + GeneratedMakeCommand& makeCommand, const std::string& makeProgram, const std::string& projectName, const std::string& projectDir, const std::string& targetName, const std::string& config, bool fast, int /*jobs*/, bool verbose, std::vector const& makeOptions) diff --git a/Source/cmGlobalBorlandMakefileGenerator.h b/Source/cmGlobalBorlandMakefileGenerator.h index 27de6cc..ca04b7b 100644 --- a/Source/cmGlobalBorlandMakefileGenerator.h +++ b/Source/cmGlobalBorlandMakefileGenerator.h @@ -46,7 +46,7 @@ public: bool AllowDeleteOnError() const override { return false; } protected: - void GenerateBuildCommand(std::vector& makeCommand, + void GenerateBuildCommand(GeneratedMakeCommand& makeCommand, const std::string& makeProgram, const std::string& projectName, const std::string& projectDir, diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index b2b0e38..239b326 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1751,14 +1751,13 @@ int cmGlobalGenerator::TryCompile(int jobs, const std::string& srcdir, } void cmGlobalGenerator::GenerateBuildCommand( - std::vector& makeCommand, const std::string& /*unused*/, + GeneratedMakeCommand& makeCommand, const std::string& /*unused*/, const std::string& /*unused*/, const std::string& /*unused*/, const std::string& /*unused*/, const std::string& /*unused*/, bool /*unused*/, int /*unused*/, bool /*unused*/, std::vector const& /*unused*/) { - makeCommand.emplace_back( - "cmGlobalGenerator::GenerateBuildCommand not implemented"); + makeCommand.add("cmGlobalGenerator::GenerateBuildCommand not implemented"); } void cmGlobalGenerator::PrintBuildCommandAdvice(std::ostream& /*os*/, @@ -1802,31 +1801,29 @@ int cmGlobalGenerator::Build(int jobs, const std::string& /*unused*/, std::string outputBuffer; std::string* outputPtr = &outputBuffer; - std::vector makeCommand; + GeneratedMakeCommand makeCommand; this->GenerateBuildCommand(makeCommand, makeCommandCSTR, projectName, bindir, target, config, fast, jobs, verbose, nativeOptions); - // Workaround to convince VCExpress.exe to produce output. + // Workaround to convince some commands to produce output. if (outputflag == cmSystemTools::OUTPUT_PASSTHROUGH && - !makeCommand.empty() && - cmSystemTools::LowerCase( - cmSystemTools::GetFilenameName(makeCommand[0])) == "vcexpress.exe") { + makeCommand.RequiresOutputForward) { outputflag = cmSystemTools::OUTPUT_FORWARD; } // should we do a clean first? if (clean) { - std::vector cleanCommand; + GeneratedMakeCommand cleanCommand; this->GenerateBuildCommand(cleanCommand, makeCommandCSTR, projectName, bindir, "clean", config, fast, jobs, verbose); output += "\nRun Clean Command:"; - output += cmSystemTools::PrintSingleCommand(cleanCommand); + output += cleanCommand.printable(); output += "\n"; - if (!cmSystemTools::RunSingleCommand(cleanCommand, outputPtr, outputPtr, - &retVal, nullptr, outputflag, - timeout)) { + if (!cmSystemTools::RunSingleCommand(cleanCommand.PrimaryCommand, + outputPtr, outputPtr, &retVal, + nullptr, outputflag, timeout)) { cmSystemTools::SetRunCommandHideConsole(hideconsole); cmSystemTools::Error("Generator: execution of make clean failed."); output += *outputPtr; @@ -1838,13 +1835,13 @@ int cmGlobalGenerator::Build(int jobs, const std::string& /*unused*/, } // now build - std::string makeCommandStr = cmSystemTools::PrintSingleCommand(makeCommand); - output += "\nRun Build Command:"; + std::string makeCommandStr = makeCommand.printable(); + output += "\nRun Build Command(s):"; output += makeCommandStr; output += "\n"; - if (!cmSystemTools::RunSingleCommand(makeCommand, outputPtr, outputPtr, - &retVal, nullptr, outputflag, + if (!cmSystemTools::RunSingleCommand(makeCommand.PrimaryCommand, outputPtr, + outputPtr, &retVal, nullptr, outputflag, timeout)) { cmSystemTools::SetRunCommandHideConsole(hideconsole); cmSystemTools::Error( diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 36d3d10..ca5708b 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -41,6 +41,54 @@ class cmSourceFile; class cmStateDirectory; class cmake; +namespace detail { +inline void AppendStrs(std::vector&) +{ +} +template +inline void AppendStrs(std::vector& command, T&& s, Ts&&... ts) +{ + command.emplace_back(std::forward(s)); + AppendStrs(command, std::forward(ts)...); +} + +struct GeneratedMakeCommand +{ + // Add each argument as a separate element to the vector + template + void add(T&&... args) + { + // iterate the args and append each one + AppendStrs(PrimaryCommand, std::forward(args)...); + } + + // Add each value in the iterators as a separate element to the vector + void add(std::vector::const_iterator start, + std::vector::const_iterator end) + { + PrimaryCommand.insert(PrimaryCommand.end(), start, end); + } + + std::string printable() const + { + std::size_t size = PrimaryCommand.size(); + for (auto&& i : PrimaryCommand) { + size += i.size(); + } + std::string buffer; + buffer.reserve(size); + for (auto&& i : PrimaryCommand) { + buffer.append(i); + buffer.append(1, ' '); + } + return buffer; + } + + std::vector PrimaryCommand; + bool RequiresOutputForward = false; +}; +} + /** \class cmGlobalGenerator * \brief Responsible for overseeing the generation process for the entire tree * @@ -182,8 +230,12 @@ public: virtual bool Open(const std::string& bindir, const std::string& projectName, bool dryRun); + struct GeneratedMakeCommand final : public detail::GeneratedMakeCommand + { + }; + virtual void GenerateBuildCommand( - std::vector& makeCommand, const std::string& makeProgram, + GeneratedMakeCommand& makeCommand, const std::string& makeProgram, const std::string& projectName, const std::string& projectDir, const std::string& targetName, const std::string& config, bool fast, int jobs, bool verbose, diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 557efec..2a1506f 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -370,25 +370,23 @@ void cmGlobalGhsMultiGenerator::OutputTopLevelProject( } void cmGlobalGhsMultiGenerator::GenerateBuildCommand( - std::vector& makeCommand, const std::string& makeProgram, + GeneratedMakeCommand& makeCommand, const std::string& makeProgram, const std::string& projectName, const std::string& projectDir, const std::string& targetName, const std::string& /*config*/, bool /*fast*/, int jobs, bool /*verbose*/, std::vector const& makeOptions) { const char* gbuild = this->CMakeInstance->GetCacheDefinition("CMAKE_MAKE_PROGRAM"); - makeCommand.push_back( - this->SelectMakeProgram(makeProgram, (std::string)gbuild)); + makeCommand.add(this->SelectMakeProgram(makeProgram, (std::string)gbuild)); if (jobs != cmake::NO_BUILD_PARALLEL_LEVEL) { - makeCommand.push_back("-parallel"); + makeCommand.add("-parallel"); if (jobs != cmake::DEFAULT_BUILD_PARALLEL_LEVEL) { - makeCommand.push_back(std::to_string(jobs)); + makeCommand.add(std::to_string(jobs)); } } - makeCommand.insert(makeCommand.end(), makeOptions.begin(), - makeOptions.end()); + makeCommand.add(makeOptions.begin(), makeOptions.end()); /* determine which top-project file to use */ std::string proj = projectName + ".top" + FILE_EXTENSION; @@ -401,16 +399,15 @@ void cmGlobalGhsMultiGenerator::GenerateBuildCommand( } } - makeCommand.push_back("-top"); - makeCommand.push_back(proj); + makeCommand.add("-top", proj); if (!targetName.empty()) { if (targetName == "clean") { - makeCommand.push_back("-clean"); + makeCommand.add("-clean"); } else { if (targetName.compare(targetName.size() - 4, 4, ".gpj") == 0) { - makeCommand.push_back(targetName); + makeCommand.add(targetName); } else { - makeCommand.push_back(targetName + ".gpj"); + makeCommand.add(targetName + ".gpj"); } } } diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h index 9332567..bc2b199 100644 --- a/Source/cmGlobalGhsMultiGenerator.h +++ b/Source/cmGlobalGhsMultiGenerator.h @@ -88,7 +88,7 @@ public: protected: void Generate() override; - void GenerateBuildCommand(std::vector& makeCommand, + void GenerateBuildCommand(GeneratedMakeCommand& makeCommand, const std::string& makeProgram, const std::string& projectName, const std::string& projectDir, diff --git a/Source/cmGlobalJOMMakefileGenerator.cxx b/Source/cmGlobalJOMMakefileGenerator.cxx index 9c805a8..2b7f486 100644 --- a/Source/cmGlobalJOMMakefileGenerator.cxx +++ b/Source/cmGlobalJOMMakefileGenerator.cxx @@ -55,7 +55,7 @@ void cmGlobalJOMMakefileGenerator::PrintCompilerAdvice( } void cmGlobalJOMMakefileGenerator::GenerateBuildCommand( - std::vector& makeCommand, const std::string& makeProgram, + GeneratedMakeCommand& makeCommand, const std::string& makeProgram, const std::string& projectName, const std::string& projectDir, const std::string& targetName, const std::string& config, bool fast, int jobs, bool verbose, std::vector const& makeOptions) diff --git a/Source/cmGlobalJOMMakefileGenerator.h b/Source/cmGlobalJOMMakefileGenerator.h index bcf46d0..aa8b5fb 100644 --- a/Source/cmGlobalJOMMakefileGenerator.h +++ b/Source/cmGlobalJOMMakefileGenerator.h @@ -40,7 +40,7 @@ public: bool optional) override; protected: - void GenerateBuildCommand(std::vector& makeCommand, + void GenerateBuildCommand(GeneratedMakeCommand& makeCommand, const std::string& makeProgram, const std::string& projectName, const std::string& projectDir, diff --git a/Source/cmGlobalNMakeMakefileGenerator.cxx b/Source/cmGlobalNMakeMakefileGenerator.cxx index 5235be7..ffe95f9 100644 --- a/Source/cmGlobalNMakeMakefileGenerator.cxx +++ b/Source/cmGlobalNMakeMakefileGenerator.cxx @@ -55,7 +55,7 @@ void cmGlobalNMakeMakefileGenerator::PrintCompilerAdvice( } void cmGlobalNMakeMakefileGenerator::GenerateBuildCommand( - std::vector& makeCommand, const std::string& makeProgram, + GeneratedMakeCommand& makeCommand, const std::string& makeProgram, const std::string& projectName, const std::string& projectDir, const std::string& targetName, const std::string& config, bool fast, int /*jobs*/, bool verbose, std::vector const& makeOptions) diff --git a/Source/cmGlobalNMakeMakefileGenerator.h b/Source/cmGlobalNMakeMakefileGenerator.h index 62dea6e..06c48e2 100644 --- a/Source/cmGlobalNMakeMakefileGenerator.h +++ b/Source/cmGlobalNMakeMakefileGenerator.h @@ -45,7 +45,7 @@ public: bool optional) override; protected: - void GenerateBuildCommand(std::vector& makeCommand, + void GenerateBuildCommand(GeneratedMakeCommand& makeCommand, const std::string& makeProgram, const std::string& projectName, const std::string& projectDir, diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 23dbd76..abeecc7 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -673,31 +673,28 @@ void cmGlobalNinjaGenerator::EnableLanguage( // Called by: // cmGlobalGenerator::Build() void cmGlobalNinjaGenerator::GenerateBuildCommand( - std::vector& makeCommand, const std::string& makeProgram, + GeneratedMakeCommand& makeCommand, const std::string& makeProgram, const std::string& /*projectName*/, const std::string& /*projectDir*/, const std::string& targetName, const std::string& /*config*/, bool /*fast*/, int jobs, bool verbose, std::vector const& makeOptions) { - makeCommand.push_back(this->SelectMakeProgram(makeProgram)); + makeCommand.add(this->SelectMakeProgram(makeProgram)); if (verbose) { - makeCommand.emplace_back("-v"); + makeCommand.add("-v"); } if ((jobs != cmake::NO_BUILD_PARALLEL_LEVEL) && (jobs != cmake::DEFAULT_BUILD_PARALLEL_LEVEL)) { - makeCommand.emplace_back("-j"); - makeCommand.push_back(std::to_string(jobs)); + makeCommand.add("-j", std::to_string(jobs)); } - makeCommand.insert(makeCommand.end(), makeOptions.begin(), - makeOptions.end()); + makeCommand.add(makeOptions.begin(), makeOptions.end()); if (!targetName.empty()) { if (targetName == "clean") { - makeCommand.emplace_back("-t"); - makeCommand.emplace_back("clean"); + makeCommand.add("-t", "clean"); } else { - makeCommand.push_back(targetName); + makeCommand.add(targetName); } } } diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 00fa348..63b2f38 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -202,7 +202,7 @@ public: void EnableLanguage(std::vector const& languages, cmMakefile* mf, bool optional) override; - void GenerateBuildCommand(std::vector& makeCommand, + void GenerateBuildCommand(GeneratedMakeCommand& makeCommand, const std::string& makeProgram, const std::string& projectName, const std::string& projectDir, diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 52bb046..9fc60e7 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -490,7 +490,7 @@ void cmGlobalUnixMakefileGenerator3::WriteDirectoryRules2( } void cmGlobalUnixMakefileGenerator3::GenerateBuildCommand( - std::vector& makeCommand, const std::string& makeProgram, + GeneratedMakeCommand& makeCommand, const std::string& makeProgram, const std::string& /*projectName*/, const std::string& /*projectDir*/, const std::string& targetName, const std::string& /*config*/, bool fast, int jobs, bool /*verbose*/, std::vector const& makeOptions) @@ -510,17 +510,16 @@ void cmGlobalUnixMakefileGenerator3::GenerateBuildCommand( mf = mfu.get(); } - makeCommand.push_back(this->SelectMakeProgram(makeProgram)); + makeCommand.add(this->SelectMakeProgram(makeProgram)); if (jobs != cmake::NO_BUILD_PARALLEL_LEVEL) { - makeCommand.emplace_back("-j"); + makeCommand.add("-j"); if (jobs != cmake::DEFAULT_BUILD_PARALLEL_LEVEL) { - makeCommand.push_back(std::to_string(jobs)); + makeCommand.add(std::to_string(jobs)); } } - makeCommand.insert(makeCommand.end(), makeOptions.begin(), - makeOptions.end()); + makeCommand.add(makeOptions.begin(), makeOptions.end()); if (!targetName.empty()) { std::string tname = targetName; if (fast) { @@ -530,7 +529,7 @@ void cmGlobalUnixMakefileGenerator3::GenerateBuildCommand( tname = conv.ConvertToRelativePath(mf->GetState()->GetBinaryDirectory(), tname); cmSystemTools::ConvertToOutputSlashes(tname); - makeCommand.push_back(std::move(tname)); + makeCommand.add(std::move(tname)); } } diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index 6199586..9fd407f 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -127,7 +127,7 @@ public: std::string GetEmptyRuleHackDepends() { return this->EmptyRuleHackDepends; } // change the build command for speed - void GenerateBuildCommand(std::vector& makeCommand, + void GenerateBuildCommand(GeneratedMakeCommand& makeCommand, const std::string& makeProgram, const std::string& projectName, const std::string& projectDir, diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index dbe582b..051ef18 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -864,7 +864,7 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf) } void cmGlobalVisualStudio10Generator::GenerateBuildCommand( - std::vector& makeCommand, const std::string& makeProgram, + GeneratedMakeCommand& makeCommand, const std::string& makeProgram, const std::string& projectName, const std::string& projectDir, const std::string& targetName, const std::string& config, bool fast, int jobs, bool verbose, std::vector const& makeOptions) @@ -879,6 +879,10 @@ void cmGlobalVisualStudio10Generator::GenerateBuildCommand( bool useDevEnv = (makeProgramLower.find("devenv") != std::string::npos || makeProgramLower.find("vcexpress") != std::string::npos); + // Workaround to convince VCExpress.exe to produce output. + makeCommand.RequiresOutputForward = + (makeProgramLower.find("vcexpress") != std::string::npos); + // MSBuild is preferred (and required for VS Express), but if the .sln has // an Intel Fortran .vfproj then we have to use devenv. Parse it to find out. cmSlnData slnData; @@ -912,7 +916,7 @@ void cmGlobalVisualStudio10Generator::GenerateBuildCommand( return; } - makeCommand.push_back(makeProgramSelected); + makeCommand.add(makeProgramSelected); std::string realTarget = targetName; // msbuild.exe CxxOnly.sln /t:Build /p:Configuration=Debug /target:ALL_BUILD @@ -921,8 +925,8 @@ void cmGlobalVisualStudio10Generator::GenerateBuildCommand( realTarget = "ALL_BUILD"; } if (realTarget == "clean") { - makeCommand.push_back(std::string(projectName) + ".sln"); - makeCommand.push_back("/t:Clean"); + makeCommand.add(std::string(projectName) + ".sln"); + makeCommand.add("/t:Clean"); } else { std::string targetProject(realTarget); targetProject += ".vcxproj"; @@ -934,7 +938,7 @@ void cmGlobalVisualStudio10Generator::GenerateBuildCommand( cmSystemTools::ConvertToUnixSlashes(targetProject); } } - makeCommand.push_back(targetProject); + makeCommand.add(std::move(targetProject)); } std::string configArg = "/p:Configuration="; if (!config.empty()) { @@ -942,23 +946,22 @@ void cmGlobalVisualStudio10Generator::GenerateBuildCommand( } else { configArg += "Debug"; } - makeCommand.push_back(configArg); - makeCommand.push_back("/p:Platform=" + this->GetPlatformName()); - makeCommand.push_back(std::string("/p:VisualStudioVersion=") + - this->GetIDEVersion()); + makeCommand.add(configArg); + makeCommand.add(std::string("/p:Platform=") + this->GetPlatformName()); + makeCommand.add(std::string("/p:VisualStudioVersion=") + + this->GetIDEVersion()); if (jobs != cmake::NO_BUILD_PARALLEL_LEVEL) { if (jobs == cmake::DEFAULT_BUILD_PARALLEL_LEVEL) { - makeCommand.push_back("/m"); + makeCommand.add("/m"); } else { - makeCommand.push_back(std::string("/m:") + std::to_string(jobs)); + makeCommand.add(std::string("/m:") + std::to_string(jobs)); } // Having msbuild.exe and cl.exe using multiple jobs is discouraged - makeCommand.push_back("/p:CL_MPCount=1"); + makeCommand.add("/p:CL_MPCount=1"); } - makeCommand.insert(makeCommand.end(), makeOptions.begin(), - makeOptions.end()); + makeCommand.add(makeOptions.begin(), makeOptions.end()); } bool cmGlobalVisualStudio10Generator::Find64BitTools(cmMakefile* mf) diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 7c8918a..0b11569 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -22,7 +22,7 @@ public: bool SetGeneratorPlatform(std::string const& p, cmMakefile* mf) override; bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf) override; - void GenerateBuildCommand(std::vector& makeCommand, + void GenerateBuildCommand(GeneratedMakeCommand& makeCommand, const std::string& makeProgram, const std::string& projectName, const std::string& projectDir, diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index cae46e1..997d33f 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -191,7 +191,7 @@ const char* cmGlobalVisualStudio7Generator::ExternalProjectType( return "8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942"; } void cmGlobalVisualStudio7Generator::GenerateBuildCommand( - std::vector& makeCommand, const std::string& makeProgram, + GeneratedMakeCommand& makeCommand, const std::string& makeProgram, const std::string& projectName, const std::string& /*projectDir*/, const std::string& targetName, const std::string& config, bool /*fast*/, int /*jobs*/, bool /*verbose*/, std::vector const& makeOptions) @@ -209,35 +209,25 @@ void cmGlobalVisualStudio7Generator::GenerateBuildCommand( makeProgramSelected = this->GetDevEnvCommand(); } - makeCommand.push_back(makeProgramSelected); + // Workaround to convince VCExpress.exe to produce output. + makeCommand.RequiresOutputForward = + (makeProgramLower.find("vcexpress") != std::string::npos); - makeCommand.push_back(std::string(projectName) + ".sln"); + makeCommand.add(makeProgramSelected); + + makeCommand.add(std::string(projectName) + ".sln"); std::string realTarget = targetName; bool clean = false; if (realTarget == "clean") { clean = true; realTarget = "ALL_BUILD"; } - if (clean) { - makeCommand.push_back("/clean"); - } else { - makeCommand.push_back("/build"); - } - - if (!config.empty()) { - makeCommand.push_back(config); - } else { - makeCommand.push_back("Debug"); - } - makeCommand.push_back("/project"); - if (!realTarget.empty()) { - makeCommand.push_back(realTarget); - } else { - makeCommand.push_back("ALL_BUILD"); - } - makeCommand.insert(makeCommand.end(), makeOptions.begin(), - makeOptions.end()); + makeCommand.add((clean ? "/clean" : "/build")); + makeCommand.add((config.empty() ? "Debug" : config)); + makeCommand.add("/project"); + makeCommand.add((realTarget.empty() ? "ALL_BUILD" : realTarget)); + makeCommand.add(makeOptions.begin(), makeOptions.end()); } ///! Create a local generator appropriate to this Global Generator diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index d2a2a38..3f1c173 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -52,7 +52,7 @@ public: * Try running cmake and building a file. This is used for dynamically * loaded commands, not as part of the usual build process. */ - void GenerateBuildCommand(std::vector& makeCommand, + void GenerateBuildCommand(GeneratedMakeCommand& makeCommand, const std::string& makeProgram, const std::string& projectName, const std::string& projectDir, diff --git a/Source/cmGlobalWatcomWMakeGenerator.cxx b/Source/cmGlobalWatcomWMakeGenerator.cxx index 558ef15..c02c471 100644 --- a/Source/cmGlobalWatcomWMakeGenerator.cxx +++ b/Source/cmGlobalWatcomWMakeGenerator.cxx @@ -51,7 +51,7 @@ void cmGlobalWatcomWMakeGenerator::GetDocumentation( } void cmGlobalWatcomWMakeGenerator::GenerateBuildCommand( - std::vector& makeCommand, const std::string& makeProgram, + GeneratedMakeCommand& makeCommand, const std::string& makeProgram, const std::string& projectName, const std::string& projectDir, const std::string& targetName, const std::string& config, bool fast, int /*jobs*/, bool verbose, std::vector const& makeOptions) diff --git a/Source/cmGlobalWatcomWMakeGenerator.h b/Source/cmGlobalWatcomWMakeGenerator.h index 0d10d58..6680b19 100644 --- a/Source/cmGlobalWatcomWMakeGenerator.h +++ b/Source/cmGlobalWatcomWMakeGenerator.h @@ -50,7 +50,7 @@ public: bool AllowDeleteOnError() const override { return false; } protected: - void GenerateBuildCommand(std::vector& makeCommand, + void GenerateBuildCommand(GeneratedMakeCommand& makeCommand, const std::string& makeProgram, const std::string& projectName, const std::string& projectDir, diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 79d77e7..b8aa5a6 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -339,20 +339,20 @@ bool cmGlobalXCodeGenerator::Open(const std::string& bindir, } void cmGlobalXCodeGenerator::GenerateBuildCommand( - std::vector& makeCommand, const std::string& makeProgram, + GeneratedMakeCommand& makeCommand, const std::string& makeProgram, const std::string& projectName, const std::string& /*projectDir*/, const std::string& targetName, const std::string& config, bool /*fast*/, int jobs, bool /*verbose*/, std::vector const& makeOptions) { // now build the test - makeCommand.emplace_back( + makeCommand.add( this->SelectMakeProgram(makeProgram, this->GetXcodeBuildCommand())); - makeCommand.emplace_back("-project"); + makeCommand.add("-project"); std::string projectArg = projectName; projectArg += ".xcode"; projectArg += "proj"; - makeCommand.emplace_back(projectArg); + makeCommand.add(projectArg); bool clean = false; std::string realTarget = targetName; @@ -360,29 +360,19 @@ void cmGlobalXCodeGenerator::GenerateBuildCommand( clean = true; realTarget = "ALL_BUILD"; } - if (clean) { - makeCommand.emplace_back("clean"); - } else { - makeCommand.emplace_back("build"); - } - makeCommand.emplace_back("-target"); - if (!realTarget.empty()) { - makeCommand.emplace_back(realTarget); - } else { - makeCommand.emplace_back("ALL_BUILD"); - } - makeCommand.emplace_back("-configuration"); - makeCommand.emplace_back(!config.empty() ? config : "Debug"); + + makeCommand.add((clean ? "clean" : "build")); + makeCommand.add("-target", (realTarget.empty() ? "ALL_BUILD" : realTarget)); + makeCommand.add("-configuration", (config.empty() ? "Debug" : config)); if (jobs != cmake::NO_BUILD_PARALLEL_LEVEL) { - makeCommand.emplace_back("-jobs"); + makeCommand.add("-jobs"); if (jobs != cmake::DEFAULT_BUILD_PARALLEL_LEVEL) { - makeCommand.emplace_back(std::to_string(jobs)); + makeCommand.add(std::to_string(jobs)); } } - makeCommand.insert(makeCommand.end(), makeOptions.begin(), - makeOptions.end()); + makeCommand.add(makeOptions.begin(), makeOptions.end()); } ///! Create a local generator appropriate to this Global Generator diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 9b0d4fe..92ff258 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -66,7 +66,7 @@ public: * Try running cmake and building a file. This is used for dynalically * loaded commands, not as part of the usual build process. */ - void GenerateBuildCommand(std::vector& makeCommand, + void GenerateBuildCommand(GeneratedMakeCommand& makeCommand, const std::string& makeProgram, const std::string& projectName, const std::string& projectDir, ----------------------------------------------------------------------- Summary of changes: Help/envvar/CMAKE_NO_VERBOSE.rst | 8 + Help/envvar/VERBOSE.rst | 10 ++ Help/manual/cmake-env-variables.7.rst | 2 + Help/manual/cmake.1.rst | 8 + Help/release/dev/cmake-build-verbose.rst | 6 + Source/CTest/cmCTestBuildHandler.cxx | 3 +- Source/cmCallVisualStudioMacro.cxx | 4 +- Source/cmCommonTargetGenerator.cxx | 2 +- Source/cmComputeLinkInformation.cxx | 2 +- Source/cmDepends.cxx | 8 +- Source/cmDependsC.cxx | 9 +- Source/cmExtraEclipseCDT4Generator.cxx | 2 +- Source/cmFLTKWrapUICommand.cxx | 2 +- Source/cmFileTimeComparison.cxx | 27 ++-- Source/cmFileTimeComparison.h | 7 +- Source/cmGhsMultiTargetGenerator.cxx | 11 +- Source/cmGlobalBorlandMakefileGenerator.cxx | 2 +- Source/cmGlobalBorlandMakefileGenerator.h | 2 +- Source/cmGlobalGenerator.cxx | 39 +++-- Source/cmGlobalGenerator.h | 54 ++++++- Source/cmGlobalGhsMultiGenerator.cxx | 25 ++-- Source/cmGlobalGhsMultiGenerator.h | 2 +- Source/cmGlobalJOMMakefileGenerator.cxx | 2 +- Source/cmGlobalJOMMakefileGenerator.h | 2 +- Source/cmGlobalNMakeMakefileGenerator.cxx | 2 +- Source/cmGlobalNMakeMakefileGenerator.h | 2 +- Source/cmGlobalNinjaGenerator.cxx | 19 +-- Source/cmGlobalNinjaGenerator.h | 2 +- Source/cmGlobalUnixMakefileGenerator3.cxx | 43 ++++-- Source/cmGlobalUnixMakefileGenerator3.h | 2 +- Source/cmGlobalVisualStudio10Generator.cxx | 35 +++-- Source/cmGlobalVisualStudio10Generator.h | 2 +- Source/cmGlobalVisualStudio7Generator.cxx | 36 ++--- Source/cmGlobalVisualStudio7Generator.h | 2 +- Source/cmGlobalVisualStudioGenerator.cxx | 4 +- Source/cmGlobalWatcomWMakeGenerator.cxx | 2 +- Source/cmGlobalWatcomWMakeGenerator.h | 2 +- Source/cmGlobalXCodeGenerator.cxx | 45 +++--- Source/cmGlobalXCodeGenerator.h | 2 +- Source/cmInstallCommand.cxx | 2 +- Source/cmInstallTargetGenerator.cxx | 2 +- Source/cmListFileCache.cxx | 8 +- Source/cmLocalCommonGenerator.cxx | 2 +- Source/cmLocalGenerator.cxx | 23 ++- Source/cmLocalGenerator.h | 10 ++ Source/cmLocalNinjaGenerator.cxx | 9 +- Source/cmLocalUnixMakefileGenerator3.cxx | 15 +- Source/cmLocalUnixMakefileGenerator3.h | 3 - Source/cmLocalVisualStudio7Generator.cxx | 10 +- Source/cmLocalVisualStudioGenerator.cxx | 7 +- Source/cmMakefile.cxx | 6 +- Source/cmMakefileTargetGenerator.cxx | 2 +- Source/cmMessageCommand.cxx | 2 +- Source/cmMessenger.cxx | 4 +- Source/cmOutputConverter.cxx | 12 -- Source/cmOutputConverter.h | 10 -- Source/cmStateDirectory.cxx | 9 ++ Source/cmStateDirectory.h | 3 + Source/cmSystemTools.cxx | 4 +- Source/cmSystemTools.h | 4 + Source/cmTarget.cxx | 6 +- Source/cmUtilitySourceCommand.cxx | 2 +- Source/cmVisualStudio10TargetGenerator.cxx | 8 +- Source/cmake.cxx | 24 ++- Source/cmake.h | 3 +- Source/cmakemain.cxx | 9 +- Source/cmcmd.cxx | 12 +- Tests/CMakeLists.txt | 35 ++++- Tests/ExternalProjectLocal/CMakeLists.txt | 129 +++++++--------- .../Step5/CMakeLists.txt | 1 - .../Step5/MathFunctions/CMakeLists.txt | 0 .../Step5}/MathFunctions/MakeTable.cxx | 0 .../Step5}/MathFunctions/MathFunctions.h | 0 .../Step5}/MathFunctions/mysqrt.cxx | 0 .../Step5}/TutorialConfig.h.in | 1 - .../Step5}/tutorial.cxx | 0 Tests/RunCMake/CMakeLists.txt | 2 +- Tests/RunCMake/Make/RunCMakeTest.cmake | 17 +++ Tests/RunCMake/Make/VerboseBuild-build-stdout.txt | 1 + .../VerboseBuild-build-watcom-stdout.txt} | 0 .../Make/VerboseBuild-nowork-gnu-stdout.txt | 1 + Tests/RunCMake/Make/VerboseBuild.cmake | 8 + Tests/RunCMake/{Ninja => Make}/hello.c | 0 Tests/RunCMake/Ninja/RunCMakeTest.cmake | 9 ++ Tests/RunCMake/Ninja/VerboseBuild-build-stdout.txt | 1 + ...k-stdout.txt => VerboseBuild-nowork-stdout.txt} | 0 Tests/RunCMake/Ninja/VerboseBuild.cmake | 3 + Tests/Tutorial/Complete/CMakeLists.txt | 116 ++++++++++++++ Tests/Tutorial/Complete/Config.cmake.in | 4 + Tests/Tutorial/{Step6 => Complete}/License.txt | 2 +- .../Tutorial/Complete/MathFunctions/CMakeLists.txt | 68 +++++++++ .../Tutorial/Complete/MathFunctions/MakeTable.cxx | 25 ++++ .../Complete/MathFunctions/MathFunctions.cxx | 18 +++ .../Complete/MathFunctions/MathFunctions.h | 14 ++ .../{Step5 => Complete}/MathFunctions/mysqrt.cxx | 31 ++-- Tests/Tutorial/Complete/MathFunctions/mysqrt.h | 6 + .../{Step2 => Complete}/TutorialConfig.h.in | 4 +- Tests/Tutorial/Complete/tutorial.cxx | 25 ++++ Tests/Tutorial/Consumer/CMakeLists.txt | 51 +++++++ Tests/Tutorial/Consumer/Config.cmake.in | 14 ++ Tests/Tutorial/Consumer/consumer.cxx | 11 ++ Tests/Tutorial/Consumer/directions.txt | 6 + Tests/Tutorial/MultiPackage/CMakeLists.txt | 109 ++++++++++++++ Tests/Tutorial/MultiPackage/Config.cmake.in | 4 + Tests/Tutorial/{Step6 => MultiPackage}/License.txt | 2 +- .../MultiPackage/MathFunctions/CMakeLists.txt | 68 +++++++++ .../MultiPackage/MathFunctions/MakeTable.cxx | 25 ++++ .../MultiPackage/MathFunctions/MathFunctions.cxx | 18 +++ .../MultiPackage/MathFunctions/MathFunctions.h | 14 ++ .../MathFunctions/mysqrt.cxx | 31 ++-- Tests/Tutorial/MultiPackage/MathFunctions/mysqrt.h | 6 + Tests/Tutorial/MultiPackage/MultiCPackConfig.cmake | 7 + .../{Step2 => MultiPackage}/TutorialConfig.h.in | 4 +- Tests/Tutorial/MultiPackage/directions.txt | 34 +++++ Tests/Tutorial/MultiPackage/tutorial.cxx | 25 ++++ Tests/Tutorial/Readme.txt | 16 ++ Tests/Tutorial/Step1/CMakeLists.txt | 19 +-- Tests/Tutorial/Step1/directions.txt | 95 ++++++++++++ Tests/Tutorial/Step1/tutorial.cxx | 17 ++- Tests/Tutorial/Step10/CMakeLists.txt | 77 ++++++++++ Tests/Tutorial/{Step6 => Step10}/License.txt | 2 +- Tests/Tutorial/Step10/MathFunctions/CMakeLists.txt | 61 ++++++++ Tests/Tutorial/Step10/MathFunctions/MakeTable.cxx | 25 ++++ .../Step10/MathFunctions/MathFunctions.cxx | 18 +++ .../Tutorial/Step10/MathFunctions/MathFunctions.h | 14 ++ .../{Step5 => Step10}/MathFunctions/mysqrt.cxx | 31 ++-- Tests/Tutorial/Step10/MathFunctions/mysqrt.h | 6 + .../Tutorial/{Step2 => Step10}/TutorialConfig.h.in | 4 +- Tests/Tutorial/Step10/directions.txt | 38 +++++ Tests/Tutorial/Step10/tutorial.cxx | 25 ++++ Tests/Tutorial/Step11/CMakeLists.txt | 77 ++++++++++ Tests/Tutorial/{Step6 => Step11}/License.txt | 2 +- Tests/Tutorial/Step11/MathFunctions/CMakeLists.txt | 60 ++++++++ Tests/Tutorial/Step11/MathFunctions/MakeTable.cxx | 25 ++++ .../Step11/MathFunctions/MathFunctions.cxx | 18 +++ .../Tutorial/Step11/MathFunctions/MathFunctions.h | 14 ++ .../{Step5 => Step11}/MathFunctions/mysqrt.cxx | 31 ++-- Tests/Tutorial/Step11/MathFunctions/mysqrt.h | 6 + .../Tutorial/{Step2 => Step11}/TutorialConfig.h.in | 4 +- Tests/Tutorial/Step11/directions.txt | 104 +++++++++++++ Tests/Tutorial/Step11/tutorial.cxx | 25 ++++ Tests/Tutorial/Step2/CMakeLists.txt | 34 ++--- Tests/Tutorial/Step2/MathFunctions/mysqrt.cxx | 13 +- Tests/Tutorial/Step2/TutorialConfig.h.in | 1 - Tests/Tutorial/Step2/directions.txt | 102 +++++++++++++ Tests/Tutorial/Step2/tutorial.cxx | 32 ++-- Tests/Tutorial/Step3/CMakeLists.txt | 74 +++------ Tests/Tutorial/Step3/MathFunctions/CMakeLists.txt | 3 - Tests/Tutorial/Step3/MathFunctions/mysqrt.cxx | 13 +- Tests/Tutorial/Step3/directions.txt | 26 ++++ Tests/Tutorial/Step3/tutorial.cxx | 25 ++-- Tests/Tutorial/Step4/CMakeLists.txt | 72 +++------ Tests/Tutorial/Step4/MathFunctions/CMakeLists.txt | 7 +- Tests/Tutorial/Step4/MathFunctions/mysqrt.cxx | 23 +-- Tests/Tutorial/Step4/TutorialConfig.h.in | 4 - Tests/Tutorial/Step4/directions.txt | 72 +++++++++ Tests/Tutorial/Step4/tutorial.cxx | 25 ++-- Tests/Tutorial/Step5/CMakeLists.txt | 86 ++++++----- Tests/Tutorial/Step5/MathFunctions/CMakeLists.txt | 23 +-- Tests/Tutorial/Step5/MathFunctions/MakeTable.cxx | 35 ++--- Tests/Tutorial/Step5/MathFunctions/mysqrt.cxx | 27 +--- Tests/Tutorial/Step5/TutorialConfig.h.in | 4 - Tests/Tutorial/Step5/directions.txt | 69 +++++++++ Tests/Tutorial/Step5/tutorial.cxx | 25 ++-- Tests/Tutorial/Step6/CMakeLists.txt | 94 ++++++------ Tests/Tutorial/Step6/MathFunctions/CMakeLists.txt | 32 ++-- Tests/Tutorial/Step6/MathFunctions/MakeTable.cxx | 35 ++--- Tests/Tutorial/Step6/MathFunctions/mysqrt.cxx | 31 ++-- Tests/Tutorial/Step6/directions.txt | 104 +++++++++++++ Tests/Tutorial/Step6/tutorial.cxx | 25 ++-- Tests/Tutorial/Step7/CMakeLists.txt | 98 ++++++------ Tests/Tutorial/Step7/License.txt | 2 +- Tests/Tutorial/Step7/MathFunctions/CMakeLists.txt | 33 ++-- Tests/Tutorial/Step7/MathFunctions/MakeTable.cxx | 35 ++--- Tests/Tutorial/Step7/MathFunctions/mysqrt.cxx | 18 +-- Tests/Tutorial/Step7/directions.txt | 40 +++++ Tests/Tutorial/Step7/tutorial.cxx | 25 ++-- Tests/Tutorial/Step8/CMakeLists.txt | 82 ++++++++++ Tests/Tutorial/{Step6 => Step8}/License.txt | 2 +- Tests/Tutorial/Step8/MathFunctions/CMakeLists.txt | 29 ++++ Tests/Tutorial/Step8/MathFunctions/MakeTable.cxx | 25 ++++ .../{Step7 => Step8}/MathFunctions/MathFunctions.h | 0 .../{Step5 => Step8}/MathFunctions/mysqrt.cxx | 26 ++-- .../Tutorial/{Step4 => Step8}/TutorialConfig.h.in | 1 - Tests/Tutorial/Step8/directions.txt | 38 +++++ Tests/Tutorial/Step8/tutorial.cxx | 32 ++++ Tests/Tutorial/Step9/CMakeLists.txt | 81 ++++++++++ Tests/Tutorial/Step9/CTestConfig.cmake | 15 ++ Tests/Tutorial/{Step6 => Step9}/License.txt | 2 +- Tests/Tutorial/Step9/MathFunctions/CMakeLists.txt | 35 +++++ Tests/Tutorial/Step9/MathFunctions/MakeTable.cxx | 25 ++++ .../Tutorial/Step9/MathFunctions/MathFunctions.cxx | 18 +++ .../{Step7 => Step9}/MathFunctions/MathFunctions.h | 0 .../{Step6 => Step9}/MathFunctions/mysqrt.cxx | 27 ++-- Tests/Tutorial/Step9/MathFunctions/mysqrt.h | 6 + .../Tutorial/{Step2 => Step9}/TutorialConfig.h.in | 4 +- Tests/Tutorial/Step9/directions.txt | 166 +++++++++++++++++++++ Tests/Tutorial/Step9/tutorial.cxx | 33 ++++ 198 files changed, 3367 insertions(+), 1061 deletions(-) create mode 100644 Help/envvar/CMAKE_NO_VERBOSE.rst create mode 100644 Help/envvar/VERBOSE.rst create mode 100644 Help/release/dev/cmake-build-verbose.rst copy Tests/{Tutorial => ExternalProjectLocal}/Step5/CMakeLists.txt (99%) copy Tests/{Tutorial => ExternalProjectLocal}/Step5/MathFunctions/CMakeLists.txt (100%) copy Tests/{Tutorial/Step7 => ExternalProjectLocal/Step5}/MathFunctions/MakeTable.cxx (100%) copy Tests/{Tutorial/Step7 => ExternalProjectLocal/Step5}/MathFunctions/MathFunctions.h (100%) copy Tests/{Tutorial/Step7 => ExternalProjectLocal/Step5}/MathFunctions/mysqrt.cxx (100%) copy Tests/{Tutorial/Step4 => ExternalProjectLocal/Step5}/TutorialConfig.h.in (99%) copy Tests/{Tutorial/Step7 => ExternalProjectLocal/Step5}/tutorial.cxx (100%) create mode 100644 Tests/RunCMake/Make/VerboseBuild-build-stdout.txt copy Tests/RunCMake/{CTestCommandLine/TestOutputSize-result.txt => Make/VerboseBuild-build-watcom-stdout.txt} (100%) create mode 100644 Tests/RunCMake/Make/VerboseBuild-nowork-gnu-stdout.txt create mode 100644 Tests/RunCMake/Make/VerboseBuild.cmake copy Tests/RunCMake/{Ninja => Make}/hello.c (100%) create mode 100644 Tests/RunCMake/Ninja/VerboseBuild-build-stdout.txt copy Tests/RunCMake/Ninja/{NoWorkToDo-nowork-stdout.txt => VerboseBuild-nowork-stdout.txt} (100%) create mode 100644 Tests/RunCMake/Ninja/VerboseBuild.cmake create mode 100644 Tests/Tutorial/Complete/CMakeLists.txt create mode 100644 Tests/Tutorial/Complete/Config.cmake.in copy Tests/Tutorial/{Step6 => Complete}/License.txt (64%) create mode 100644 Tests/Tutorial/Complete/MathFunctions/CMakeLists.txt create mode 100644 Tests/Tutorial/Complete/MathFunctions/MakeTable.cxx create mode 100644 Tests/Tutorial/Complete/MathFunctions/MathFunctions.cxx create mode 100644 Tests/Tutorial/Complete/MathFunctions/MathFunctions.h copy Tests/Tutorial/{Step5 => Complete}/MathFunctions/mysqrt.cxx (50%) create mode 100644 Tests/Tutorial/Complete/MathFunctions/mysqrt.h copy Tests/Tutorial/{Step2 => Complete}/TutorialConfig.h.in (59%) create mode 100644 Tests/Tutorial/Complete/tutorial.cxx create mode 100644 Tests/Tutorial/Consumer/CMakeLists.txt create mode 100644 Tests/Tutorial/Consumer/Config.cmake.in create mode 100644 Tests/Tutorial/Consumer/consumer.cxx create mode 100644 Tests/Tutorial/Consumer/directions.txt create mode 100644 Tests/Tutorial/MultiPackage/CMakeLists.txt create mode 100644 Tests/Tutorial/MultiPackage/Config.cmake.in copy Tests/Tutorial/{Step6 => MultiPackage}/License.txt (64%) create mode 100644 Tests/Tutorial/MultiPackage/MathFunctions/CMakeLists.txt create mode 100644 Tests/Tutorial/MultiPackage/MathFunctions/MakeTable.cxx create mode 100644 Tests/Tutorial/MultiPackage/MathFunctions/MathFunctions.cxx create mode 100644 Tests/Tutorial/MultiPackage/MathFunctions/MathFunctions.h copy Tests/Tutorial/{Step5 => MultiPackage}/MathFunctions/mysqrt.cxx (50%) create mode 100644 Tests/Tutorial/MultiPackage/MathFunctions/mysqrt.h create mode 100644 Tests/Tutorial/MultiPackage/MultiCPackConfig.cmake copy Tests/Tutorial/{Step2 => MultiPackage}/TutorialConfig.h.in (59%) create mode 100644 Tests/Tutorial/MultiPackage/directions.txt create mode 100644 Tests/Tutorial/MultiPackage/tutorial.cxx create mode 100644 Tests/Tutorial/Readme.txt create mode 100644 Tests/Tutorial/Step1/directions.txt create mode 100644 Tests/Tutorial/Step10/CMakeLists.txt copy Tests/Tutorial/{Step6 => Step10}/License.txt (64%) create mode 100644 Tests/Tutorial/Step10/MathFunctions/CMakeLists.txt create mode 100644 Tests/Tutorial/Step10/MathFunctions/MakeTable.cxx create mode 100644 Tests/Tutorial/Step10/MathFunctions/MathFunctions.cxx create mode 100644 Tests/Tutorial/Step10/MathFunctions/MathFunctions.h copy Tests/Tutorial/{Step5 => Step10}/MathFunctions/mysqrt.cxx (50%) create mode 100644 Tests/Tutorial/Step10/MathFunctions/mysqrt.h copy Tests/Tutorial/{Step2 => Step10}/TutorialConfig.h.in (59%) create mode 100644 Tests/Tutorial/Step10/directions.txt create mode 100644 Tests/Tutorial/Step10/tutorial.cxx create mode 100644 Tests/Tutorial/Step11/CMakeLists.txt copy Tests/Tutorial/{Step6 => Step11}/License.txt (64%) create mode 100644 Tests/Tutorial/Step11/MathFunctions/CMakeLists.txt create mode 100644 Tests/Tutorial/Step11/MathFunctions/MakeTable.cxx create mode 100644 Tests/Tutorial/Step11/MathFunctions/MathFunctions.cxx create mode 100644 Tests/Tutorial/Step11/MathFunctions/MathFunctions.h copy Tests/Tutorial/{Step5 => Step11}/MathFunctions/mysqrt.cxx (50%) create mode 100644 Tests/Tutorial/Step11/MathFunctions/mysqrt.h copy Tests/Tutorial/{Step2 => Step11}/TutorialConfig.h.in (59%) create mode 100644 Tests/Tutorial/Step11/directions.txt create mode 100644 Tests/Tutorial/Step11/tutorial.cxx create mode 100644 Tests/Tutorial/Step2/directions.txt create mode 100644 Tests/Tutorial/Step3/directions.txt create mode 100644 Tests/Tutorial/Step4/directions.txt create mode 100644 Tests/Tutorial/Step5/directions.txt create mode 100644 Tests/Tutorial/Step6/directions.txt create mode 100644 Tests/Tutorial/Step7/directions.txt create mode 100644 Tests/Tutorial/Step8/CMakeLists.txt copy Tests/Tutorial/{Step6 => Step8}/License.txt (64%) create mode 100644 Tests/Tutorial/Step8/MathFunctions/CMakeLists.txt create mode 100644 Tests/Tutorial/Step8/MathFunctions/MakeTable.cxx copy Tests/Tutorial/{Step7 => Step8}/MathFunctions/MathFunctions.h (100%) copy Tests/Tutorial/{Step5 => Step8}/MathFunctions/mysqrt.cxx (54%) copy Tests/Tutorial/{Step4 => Step8}/TutorialConfig.h.in (99%) create mode 100644 Tests/Tutorial/Step8/directions.txt create mode 100644 Tests/Tutorial/Step8/tutorial.cxx create mode 100644 Tests/Tutorial/Step9/CMakeLists.txt create mode 100644 Tests/Tutorial/Step9/CTestConfig.cmake rename Tests/Tutorial/{Step6 => Step9}/License.txt (64%) create mode 100644 Tests/Tutorial/Step9/MathFunctions/CMakeLists.txt create mode 100644 Tests/Tutorial/Step9/MathFunctions/MakeTable.cxx create mode 100644 Tests/Tutorial/Step9/MathFunctions/MathFunctions.cxx copy Tests/Tutorial/{Step7 => Step9}/MathFunctions/MathFunctions.h (100%) copy Tests/Tutorial/{Step6 => Step9}/MathFunctions/mysqrt.cxx (52%) create mode 100644 Tests/Tutorial/Step9/MathFunctions/mysqrt.h copy Tests/Tutorial/{Step2 => Step9}/TutorialConfig.h.in (59%) create mode 100644 Tests/Tutorial/Step9/directions.txt create mode 100644 Tests/Tutorial/Step9/tutorial.cxx hooks/post-receive -- CMake From kwrobot at kitware.com Tue Jan 29 14:13:05 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 29 Jan 2019 14:13:05 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-1191-gd75fec5 Message-ID: <20190129191305.A806E11DE0E@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via d75fec5a88f81a8c16cdeab46766e92a14d1d3cf (commit) via 094f01d0f019147afbdfc1c18ad1a6ca232eb3b8 (commit) via 55671b41d2d182ce8d3201012ec55badd7116615 (commit) from 9620cb935a49e7b4955f5b1d0ffa2e93b4327591 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d75fec5a88f81a8c16cdeab46766e92a14d1d3cf commit d75fec5a88f81a8c16cdeab46766e92a14d1d3cf Merge: 9620cb9 094f01d Author: Brad King AuthorDate: Tue Jan 29 19:07:13 2019 +0000 Commit: Kitware Robot CommitDate: Tue Jan 29 14:07:24 2019 -0500 Merge topic 'tidy-use-equals-default' 094f01d0f0 cleanup: Prefer compiler provided special member functions 55671b41d2 clang-tidy: Use `= default` Acked-by: Kitware Robot Acked-by: Brad King Merge-request: !2841 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=094f01d0f019147afbdfc1c18ad1a6ca232eb3b8 commit 094f01d0f019147afbdfc1c18ad1a6ca232eb3b8 Author: Regina Pfeifer AuthorDate: Wed Jan 23 00:32:51 2019 +0100 Commit: Brad King CommitDate: Fri Jan 25 06:45:00 2019 -0500 cleanup: Prefer compiler provided special member functions diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx index c0225ea..210abe5 100644 --- a/Source/CTest/cmCTestGIT.cxx +++ b/Source/CTest/cmCTestGIT.cxx @@ -475,7 +475,6 @@ private: std::string EMail; unsigned long Time = 0; long TimeZone = 0; - Person() = default; }; void ParsePerson(const char* str, Person& person) diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index 2b17d03..bc1c3cb 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -44,7 +44,6 @@ public: : Handler(handler) { } - ~TestComparator() = default; // Sorts tests in descending order of cost bool operator()(int index1, int index2) const diff --git a/Source/CTest/cmCTestRunTest.h b/Source/CTest/cmCTestRunTest.h index c786413..918d5fa 100644 --- a/Source/CTest/cmCTestRunTest.h +++ b/Source/CTest/cmCTestRunTest.h @@ -27,8 +27,6 @@ class cmCTestRunTest public: explicit cmCTestRunTest(cmCTestMultiProcessHandler& multiHandler); - ~cmCTestRunTest() = default; - void SetNumberOfRuns(int n) { this->NumberOfRunsLeft = n; } void SetRunUntilFailOn() { this->RunUntilFail = true; } void SetTestProperties(cmCTestTestHandler::cmCTestTestProperties* prop) diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 1231f31..0fd0a77 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -53,8 +53,6 @@ struct cmListFileFunction; class cmCTestScriptFunctionBlocker : public cmFunctionBlocker { public: - cmCTestScriptFunctionBlocker() = default; - ~cmCTestScriptFunctionBlocker() override = default; bool IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile& mf, cmExecutionStatus& /*status*/) override; // virtual bool ShouldRemove(const cmListFileFunction& lff, cmMakefile &mf); diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 9e1f409..87112da 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -30,10 +30,6 @@ typedef std::vector cmCTestSubmitHandlerVectorOfChar; class cmCTestSubmitHandler::ResponseParser : public cmXMLParser { public: - ResponseParser() { this->Status = STATUS_OK; } - ~ResponseParser() override = default; - -public: enum StatusType { STATUS_OK, @@ -41,7 +37,7 @@ public: STATUS_ERROR }; - StatusType Status; + StatusType Status = STATUS_OK; std::string Filename; std::string MD5; std::string Message; diff --git a/Source/CTest/cmParseCoberturaCoverage.cxx b/Source/CTest/cmParseCoberturaCoverage.cxx index 1669b07..848a034 100644 --- a/Source/CTest/cmParseCoberturaCoverage.cxx +++ b/Source/CTest/cmParseCoberturaCoverage.cxx @@ -13,19 +13,12 @@ class cmParseCoberturaCoverage::XMLParser : public cmXMLParser { public: XMLParser(cmCTest* ctest, cmCTestCoverageHandlerContainer& cont) - : CTest(ctest) + : FilePaths{ cont.SourceDir, cont.BinaryDir } + , CTest(ctest) , Coverage(cont) { - this->InSources = false; - this->InSource = false; - this->SkipThisClass = false; - this->FilePaths.push_back(this->Coverage.SourceDir); - this->FilePaths.push_back(this->Coverage.BinaryDir); - this->CurFileName.clear(); } - ~XMLParser() override = default; - protected: void EndElement(const std::string& name) override { @@ -144,9 +137,9 @@ protected: } private: - bool InSources; - bool InSource; - bool SkipThisClass; + bool InSources = false; + bool InSource = false; + bool SkipThisClass = false; std::vector FilePaths; typedef cmCTestCoverageHandlerContainer::SingleFileCoverageVector FileLinesType; diff --git a/Source/CTest/cmParseJacocoCoverage.cxx b/Source/CTest/cmParseJacocoCoverage.cxx index b2d3b1b..61c5dcb 100644 --- a/Source/CTest/cmParseJacocoCoverage.cxx +++ b/Source/CTest/cmParseJacocoCoverage.cxx @@ -18,13 +18,8 @@ public: : CTest(ctest) , Coverage(cont) { - this->FilePath.clear(); - this->PackagePath.clear(); - this->PackageName.clear(); } - ~XMLParser() override = default; - protected: void EndElement(const std::string& /*name*/) override {} diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index f49df74..3427527 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -474,7 +474,6 @@ int CCONV cmGetTotalArgumentSize(int argc, char** argv) // API for source files. struct cmCPluginAPISourceFile { - cmCPluginAPISourceFile() = default; cmSourceFile* RealSourceFile = nullptr; std::string SourceName; std::string SourceExtension; diff --git a/Source/cmCTest.h b/Source/cmCTest.h index cdbd665..92a02c3 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -57,8 +57,6 @@ public: /** Representation of one part. */ struct PartInfo { - PartInfo() = default; - void SetName(const std::string& name) { this->Name = name; } const std::string& GetName() const { return this->Name; } diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index 1031d11..0c70ed2 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -42,7 +42,6 @@ private: void AppendProperty(const std::string& property, const char* value, bool asString = false); bool Initialized = false; - CacheEntry() = default; }; public: diff --git a/Source/cmCommandArgumentsHelper.h b/Source/cmCommandArgumentsHelper.h index 76d17ab..9579861 100644 --- a/Source/cmCommandArgumentsHelper.h +++ b/Source/cmCommandArgumentsHelper.h @@ -172,8 +172,6 @@ class cmCommandArgumentGroup friend class cmCommandArgument; public: - cmCommandArgumentGroup() = default; - /// All members of this group may follow the given argument void Follows(const cmCommandArgument* arg); diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h index a6bb49f..252f874 100644 --- a/Source/cmComputeLinkDepends.h +++ b/Source/cmComputeLinkDepends.h @@ -38,8 +38,6 @@ public: cmGeneratorTarget const* Target = nullptr; bool IsSharedDep = false; bool IsFlag = false; - LinkEntry() = default; - LinkEntry(LinkEntry const& r) = default; }; typedef std::vector EntryVector; diff --git a/Source/cmDependsC.h b/Source/cmDependsC.h index dab03f3..411458a 100644 --- a/Source/cmDependsC.h +++ b/Source/cmDependsC.h @@ -75,7 +75,6 @@ public: struct cmIncludeLines { - cmIncludeLines() = default; std::vector UnscannedEntries; bool Used = false; }; diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h index 1026064..cf74b80 100644 --- a/Source/cmDocumentation.h +++ b/Source/cmDocumentation.h @@ -115,7 +115,6 @@ private: struct RequestedHelpItem { - RequestedHelpItem() = default; cmDocumentationEnums::Type HelpType = None; std::string Filename; std::string Argument; diff --git a/Source/cmExecutionStatus.h b/Source/cmExecutionStatus.h index f9189f7..56199dd 100644 --- a/Source/cmExecutionStatus.h +++ b/Source/cmExecutionStatus.h @@ -11,8 +11,6 @@ class cmExecutionStatus { public: - cmExecutionStatus() = default; - void Clear() { this->ReturnInvoked = false; diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 0b404fe..1eb28fc 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -1102,7 +1102,6 @@ protected: { bool Exclude = false; mode_t Permissions = 0; - MatchProperties() = default; }; struct MatchRule { diff --git a/Source/cmFileMonitor.cxx b/Source/cmFileMonitor.cxx index 8287747..56ee739 100644 --- a/Source/cmFileMonitor.cxx +++ b/Source/cmFileMonitor.cxx @@ -19,7 +19,6 @@ void on_fs_close(uv_handle_t* handle); class cmIBaseWatcher { public: - cmIBaseWatcher() = default; virtual ~cmIBaseWatcher() = default; virtual void Trigger(const std::string& pathSegment, int events, @@ -150,8 +149,6 @@ public: p->AddChildWatcher(ps, this); } - ~cmRealDirectoryWatcher() override = default; - void StartWatching() final { if (!this->Handle) { diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index 3400b36..73d602d 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -202,7 +202,6 @@ struct cmFindLibraryHelper bool TryRaw = false; std::string Raw; cmsys::RegularExpression Regex; - Name() = default; }; std::vector Names; diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 0a5463b..f9ac310 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -1688,7 +1688,6 @@ private: class cmFileList { public: - cmFileList() = default; virtual ~cmFileList() = default; cmFileList& operator/(cmFileListGeneratorBase const& rhs) { diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index d2bf687..264a338 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -14,11 +14,6 @@ class cmFunctionHelperCommand : public cmCommand { public: - cmFunctionHelperCommand() = default; - - ///! clean up any memory allocated by the function - ~cmFunctionHelperCommand() override = default; - /** * This is a virtual constructor for the command. */ diff --git a/Source/cmFunctionCommand.h b/Source/cmFunctionCommand.h index 90f7d82..8b37df0 100644 --- a/Source/cmFunctionCommand.h +++ b/Source/cmFunctionCommand.h @@ -18,15 +18,13 @@ class cmMakefile; class cmFunctionFunctionBlocker : public cmFunctionBlocker { public: - cmFunctionFunctionBlocker() { this->Depth = 0; } - ~cmFunctionFunctionBlocker() override = default; bool IsFunctionBlocked(const cmListFileFunction&, cmMakefile& mf, cmExecutionStatus&) override; bool ShouldRemove(const cmListFileFunction&, cmMakefile& mf) override; std::vector Args; std::vector Functions; - int Depth; + int Depth = 0; }; /// Starts function() ... endfunction() block diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 8afb548..d72e051 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -111,7 +111,6 @@ public: std::set ExpectedXamlHeaders; std::set ExpectedXamlSources; bool Initialized = false; - KindedSources() = default; }; /** Get all sources needed for a configuration with kinds assigned. */ @@ -562,7 +561,6 @@ public: }; struct SourceFileFlags { - SourceFileFlags() = default; SourceFileType Type = SourceFileTypeNormal; const char* MacFolder = nullptr; // location inside Mac content folders }; @@ -750,7 +748,6 @@ private: struct CompatibleInterfaces : public CompatibleInterfacesBase { - CompatibleInterfaces() = default; bool Done = false; }; mutable std::map CompatibleInterfacesMap; @@ -764,7 +761,6 @@ private: struct LinkImplClosure : public std::vector { - LinkImplClosure() = default; bool Done = false; }; mutable std::map LinkImplClosureMap; @@ -784,7 +780,6 @@ private: // Cache import information from properties for each configuration. struct ImportInfo { - ImportInfo() = default; bool NoSOName = false; ManagedType Managed = Native; unsigned int Multiplicity = 0; diff --git a/Source/cmGlobVerificationManager.h b/Source/cmGlobVerificationManager.h index 1024328..f7146be 100644 --- a/Source/cmGlobVerificationManager.h +++ b/Source/cmGlobVerificationManager.h @@ -21,9 +21,6 @@ */ class cmGlobVerificationManager { -public: - cmGlobVerificationManager() = default; - protected: ///! Save verification script for given makefile. ///! Saves to output //VerifyGlobs.cmake @@ -73,7 +70,6 @@ private: bool Initialized = false; std::vector Files; std::vector> Backtraces; - CacheEntryValue() = default; }; typedef std::map CacheEntryMap; diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 3bf6309..da05a37 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -479,7 +479,6 @@ protected: std::vector Depends; std::string WorkingDir; bool UsesTerminal = false; - GlobalTargetInfo() = default; }; void CreateDefaultGlobalTargets(std::vector& targets); @@ -608,7 +607,6 @@ private: long LastDiskTime = -1; std::set All; std::set Generated; - DirectoryContent() = default; }; std::map DirectoryContentMap; diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index fb39b30..4ad7d24 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -183,8 +183,6 @@ public: return new cmGlobalGeneratorSimpleFactory(); } - ~cmGlobalNinjaGenerator() override = default; - cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf) override; std::string GetName() const override diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index a6b58e8..7d5be1a 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -217,7 +217,6 @@ protected: // Store per-target progress counters. struct TargetProgress { - TargetProgress() = default; unsigned long NumberOfActions = 0; std::string VariableFile; std::vector Marks; diff --git a/Source/cmIfCommand.h b/Source/cmIfCommand.h index c984976..d34ed02 100644 --- a/Source/cmIfCommand.h +++ b/Source/cmIfCommand.h @@ -19,13 +19,6 @@ class cmMakefile; class cmIfFunctionBlocker : public cmFunctionBlocker { public: - cmIfFunctionBlocker() - { - this->HasRun = false; - this->ElseSeen = false; - this->ScopeDepth = 0; - } - ~cmIfFunctionBlocker() override = default; bool IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile& mf, cmExecutionStatus&) override; bool ShouldRemove(const cmListFileFunction& lff, cmMakefile& mf) override; @@ -33,9 +26,9 @@ public: std::vector Args; std::vector Functions; bool IsBlocking; - bool HasRun; - bool ElseSeen; - unsigned int ScopeDepth; + bool HasRun = false; + bool ElseSeen = false; + unsigned int ScopeDepth = 0; }; /// Starts an if block diff --git a/Source/cmLinkItem.h b/Source/cmLinkItem.h index d50b5fc..5b635b5 100644 --- a/Source/cmLinkItem.h +++ b/Source/cmLinkItem.h @@ -77,13 +77,10 @@ struct cmLinkInterface : public cmLinkInterfaceLibraries std::vector WrongConfigLibraries; bool ImplementationIsInterface = false; - - cmLinkInterface() = default; }; struct cmOptionalLinkInterface : public cmLinkInterface { - cmOptionalLinkInterface() = default; bool LibrariesDone = false; bool AllDone = false; bool Exists = false; @@ -105,7 +102,6 @@ struct cmLinkImplementation : public cmLinkImplementationLibraries // Cache link implementation computation from each configuration. struct cmOptionalLinkImplementation : public cmLinkImplementation { - cmOptionalLinkImplementation() = default; bool LibrariesDone = false; bool LanguagesDone = false; bool HadHeadSensitiveCondition = false; diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h index e7b1c87..9457415 100644 --- a/Source/cmListFileCache.h +++ b/Source/cmListFileCache.h @@ -73,7 +73,6 @@ public: std::string Name; std::string FilePath; long Line = 0; - cmListFileContext() = default; static cmListFileContext FromCommandContext(cmCommandContext const& lfcc, std::string const& fileName) @@ -110,15 +109,6 @@ public: // indicated by the given valid snapshot. cmListFileBacktrace(cmStateSnapshot const& snapshot); - // Backtraces may be copied, moved, and assigned as values. - cmListFileBacktrace(cmListFileBacktrace const&) = default; - cmListFileBacktrace(cmListFileBacktrace&&) // NOLINT(clang-tidy) - noexcept = default; - cmListFileBacktrace& operator=(cmListFileBacktrace const&) = default; - cmListFileBacktrace& operator=(cmListFileBacktrace&&) // NOLINT(clang-tidy) - noexcept = default; - ~cmListFileBacktrace() = default; - cmStateSnapshot GetBottom() const; // Get a backtrace with the given file scope added to the top. diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index a3a0ddf..8fc0dad 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -279,7 +279,6 @@ private: bool HasSourceExtension = false; bool HasPreprocessRule = false; bool HasAssembleRule = false; - LocalObjectInfo() = default; }; void GetLocalObjectFiles( std::map& localObjectFiles); diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 1b94ab3..7279d5f 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -17,11 +17,6 @@ class cmMacroHelperCommand : public cmCommand { public: - cmMacroHelperCommand() = default; - - ///! clean up any memory allocated by the macro - ~cmMacroHelperCommand() override = default; - /** * This is a virtual constructor for the command. */ diff --git a/Source/cmMacroCommand.h b/Source/cmMacroCommand.h index 8f5f540..b54ed66 100644 --- a/Source/cmMacroCommand.h +++ b/Source/cmMacroCommand.h @@ -18,15 +18,13 @@ class cmMakefile; class cmMacroFunctionBlocker : public cmFunctionBlocker { public: - cmMacroFunctionBlocker() { this->Depth = 0; } - ~cmMacroFunctionBlocker() override = default; bool IsFunctionBlocked(const cmListFileFunction&, cmMakefile& mf, cmExecutionStatus&) override; bool ShouldRemove(const cmListFileFunction&, cmMakefile& mf) override; std::vector Args; std::vector Functions; - int Depth; + int Depth = 0; }; /// Starts macro() ... endmacro() block diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index fc8348f..1a1e11f 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2712,7 +2712,6 @@ typedef enum } t_domain; struct t_lookup { - t_lookup() = default; t_domain domain = NORMAL; size_t loc = 0; }; diff --git a/Source/cmQtAutoGenInitializer.h b/Source/cmQtAutoGenInitializer.h index 7359c76..10f0bf3 100644 --- a/Source/cmQtAutoGenInitializer.h +++ b/Source/cmQtAutoGenInitializer.h @@ -26,9 +26,6 @@ public: class Qrc { public: - Qrc() = default; - - public: std::string LockFile; std::string QrcFile; std::string QrcName; diff --git a/Source/cmQtAutoGenerator.h b/Source/cmQtAutoGenerator.h index 75143f5..2b9cbc6 100644 --- a/Source/cmQtAutoGenerator.h +++ b/Source/cmQtAutoGenerator.h @@ -206,9 +206,6 @@ public: bool MergedOutput = false; }; - // -- Constructor - ReadOnlyProcessT() = default; - // -- Const accessors const SetupT& Setup() const { return Setup_; } ProcessResultT* Result() const { return Setup_.Result; } diff --git a/Source/cmTimestamp.h b/Source/cmTimestamp.h index 6b6c4eb..d5fbdfd 100644 --- a/Source/cmTimestamp.h +++ b/Source/cmTimestamp.h @@ -15,8 +15,6 @@ class cmTimestamp { public: - cmTimestamp() = default; - std::string CurrentTime(const std::string& formatString, bool utcFlag); std::string FileModificationTime(const char* path, diff --git a/Source/cmVSSetupHelper.h b/Source/cmVSSetupHelper.h index 4748a7a..1bda54a 100644 --- a/Source/cmVSSetupHelper.h +++ b/Source/cmVSSetupHelper.h @@ -112,8 +112,6 @@ struct VSInstanceInfo bool IsWin10SDKInstalled = false; bool IsWin81SDKInstalled = false; - VSInstanceInfo() = default; - std::string GetInstallLocation() const; }; diff --git a/Source/cmVariableWatch.h b/Source/cmVariableWatch.h index d5d96ef..5855fed 100644 --- a/Source/cmVariableWatch.h +++ b/Source/cmVariableWatch.h @@ -66,7 +66,6 @@ protected: WatchMethod Method = nullptr; void* ClientData = nullptr; DeleteData DeleteDataCall = nullptr; - Pair() = default; ~Pair() { if (this->DeleteDataCall && this->ClientData) { https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=55671b41d2d182ce8d3201012ec55badd7116615 commit 55671b41d2d182ce8d3201012ec55badd7116615 Author: Regina Pfeifer AuthorDate: Tue Jan 22 23:44:50 2019 +0100 Commit: Brad King CommitDate: Fri Jan 25 06:44:32 2019 -0500 clang-tidy: Use `= default` Suppress some cases in `Source/cmGeneratorExpressionNode.cxx` and `Source/cmUVHandlePtr.h` where a few older compilers require a user-defined default constructor (with `{}`). diff --git a/.clang-tidy b/.clang-tidy index 626c754..dace6f1 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -14,7 +14,6 @@ modernize-*,\ -modernize-raw-string-literal,\ -modernize-return-braced-init-list,\ -modernize-use-auto,\ --modernize-use-equals-default,\ -modernize-use-equals-delete,\ -modernize-use-noexcept,\ -modernize-use-transparent-functors,\ diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx index 180c92e..9102e3e 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx +++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx @@ -21,9 +21,7 @@ cmCPackIFWGenerator::cmCPackIFWGenerator() this->Generator = this; } -cmCPackIFWGenerator::~cmCPackIFWGenerator() -{ -} +cmCPackIFWGenerator::~cmCPackIFWGenerator() = default; int cmCPackIFWGenerator::PackageFiles() { diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx index 8f492af..24d19d9 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx +++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx @@ -16,9 +16,7 @@ #include #include -cmCPackIFWInstaller::cmCPackIFWInstaller() -{ -} +cmCPackIFWInstaller::cmCPackIFWInstaller() = default; void cmCPackIFWInstaller::printSkippedOptionWarning( const std::string& optionName, const std::string& optionValue) diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx index c96b5d4..a1a52b1 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.cxx +++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx @@ -24,9 +24,7 @@ cmCPackIFWPackage::CompareStruct::CompareStruct() } //------------------------------------------------------- DependenceStruct --- -cmCPackIFWPackage::DependenceStruct::DependenceStruct() -{ -} +cmCPackIFWPackage::DependenceStruct::DependenceStruct() = default; cmCPackIFWPackage::DependenceStruct::DependenceStruct( const std::string& dependence) diff --git a/Source/CPack/cmCPack7zGenerator.cxx b/Source/CPack/cmCPack7zGenerator.cxx index f0c41a2..7413770 100644 --- a/Source/CPack/cmCPack7zGenerator.cxx +++ b/Source/CPack/cmCPack7zGenerator.cxx @@ -10,6 +10,4 @@ cmCPack7zGenerator::cmCPack7zGenerator() { } -cmCPack7zGenerator::~cmCPack7zGenerator() -{ -} +cmCPack7zGenerator::~cmCPack7zGenerator() = default; diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index 1756218..98fb29d 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -22,9 +22,7 @@ cmCPackArchiveGenerator::cmCPackArchiveGenerator(cmArchiveWrite::Compress t, this->ArchiveFormat = format; } -cmCPackArchiveGenerator::~cmCPackArchiveGenerator() -{ -} +cmCPackArchiveGenerator::~cmCPackArchiveGenerator() = default; std::string cmCPackArchiveGenerator::GetArchiveComponentFileName( const std::string& component, bool isGroupName) diff --git a/Source/CPack/cmCPackBundleGenerator.cxx b/Source/CPack/cmCPackBundleGenerator.cxx index f8fd108..3a476f4 100644 --- a/Source/CPack/cmCPackBundleGenerator.cxx +++ b/Source/CPack/cmCPackBundleGenerator.cxx @@ -8,13 +8,9 @@ #include "cmCPackLog.h" #include "cmSystemTools.h" -cmCPackBundleGenerator::cmCPackBundleGenerator() -{ -} +cmCPackBundleGenerator::cmCPackBundleGenerator() = default; -cmCPackBundleGenerator::~cmCPackBundleGenerator() -{ -} +cmCPackBundleGenerator::~cmCPackBundleGenerator() = default; int cmCPackBundleGenerator::InitializeInternal() { diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index 46a428f..635de49 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -432,13 +432,9 @@ bool DebGenerator::generateDeb() const } // end anonymous namespace -cmCPackDebGenerator::cmCPackDebGenerator() -{ -} +cmCPackDebGenerator::cmCPackDebGenerator() = default; -cmCPackDebGenerator::~cmCPackDebGenerator() -{ -} +cmCPackDebGenerator::~cmCPackDebGenerator() = default; int cmCPackDebGenerator::InitializeInternal() { diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx index be4a18e..80b9ef3 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.cxx +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx @@ -62,9 +62,7 @@ cmCPackDragNDropGenerator::cmCPackDragNDropGenerator() this->componentPackageMethod = ONE_PACKAGE; } -cmCPackDragNDropGenerator::~cmCPackDragNDropGenerator() -{ -} +cmCPackDragNDropGenerator::~cmCPackDragNDropGenerator() = default; int cmCPackDragNDropGenerator::InitializeInternal() { diff --git a/Source/CPack/cmCPackFreeBSDGenerator.cxx b/Source/CPack/cmCPackFreeBSDGenerator.cxx index 0ff0054..fcf8af1 100644 --- a/Source/CPack/cmCPackFreeBSDGenerator.cxx +++ b/Source/CPack/cmCPackFreeBSDGenerator.cxx @@ -31,9 +31,7 @@ int cmCPackFreeBSDGenerator::InitializeInternal() return this->Superclass::InitializeInternal(); } -cmCPackFreeBSDGenerator::~cmCPackFreeBSDGenerator() -{ -} +cmCPackFreeBSDGenerator::~cmCPackFreeBSDGenerator() = default; // This is a wrapper, for use only in stream-based output, // that will output a string in UCL escaped fashion (in particular, @@ -103,7 +101,7 @@ public: { } - virtual ~ManifestKey() {} + virtual ~ManifestKey() = default; // Output the value associated with this key to the stream @p s. // Format is to be decided by subclasses. diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index 4b865ca..37ea66e 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -30,9 +30,7 @@ cmCPackNSISGenerator::cmCPackNSISGenerator(bool nsis64) Nsis64 = nsis64; } -cmCPackNSISGenerator::~cmCPackNSISGenerator() -{ -} +cmCPackNSISGenerator::~cmCPackNSISGenerator() = default; int cmCPackNSISGenerator::PackageFiles() { diff --git a/Source/CPack/cmCPackOSXX11Generator.cxx b/Source/CPack/cmCPackOSXX11Generator.cxx index 1908c17..486633c 100644 --- a/Source/CPack/cmCPackOSXX11Generator.cxx +++ b/Source/CPack/cmCPackOSXX11Generator.cxx @@ -11,13 +11,9 @@ #include "cmSystemTools.h" #include "cm_sys_stat.h" -cmCPackOSXX11Generator::cmCPackOSXX11Generator() -{ -} +cmCPackOSXX11Generator::cmCPackOSXX11Generator() = default; -cmCPackOSXX11Generator::~cmCPackOSXX11Generator() -{ -} +cmCPackOSXX11Generator::~cmCPackOSXX11Generator() = default; int cmCPackOSXX11Generator::PackageFiles() { diff --git a/Source/CPack/cmCPackPKGGenerator.cxx b/Source/CPack/cmCPackPKGGenerator.cxx index 9401bca..ae227aa 100644 --- a/Source/CPack/cmCPackPKGGenerator.cxx +++ b/Source/CPack/cmCPackPKGGenerator.cxx @@ -15,9 +15,7 @@ cmCPackPKGGenerator::cmCPackPKGGenerator() this->componentPackageMethod = ONE_PACKAGE; } -cmCPackPKGGenerator::~cmCPackPKGGenerator() -{ -} +cmCPackPKGGenerator::~cmCPackPKGGenerator() = default; bool cmCPackPKGGenerator::SupportsComponentInstallation() const { diff --git a/Source/CPack/cmCPackPackageMakerGenerator.cxx b/Source/CPack/cmCPackPackageMakerGenerator.cxx index 28e0561..246178d 100644 --- a/Source/CPack/cmCPackPackageMakerGenerator.cxx +++ b/Source/CPack/cmCPackPackageMakerGenerator.cxx @@ -30,9 +30,7 @@ cmCPackPackageMakerGenerator::cmCPackPackageMakerGenerator() this->PackageCompatibilityVersion = getVersion(10, 4); } -cmCPackPackageMakerGenerator::~cmCPackPackageMakerGenerator() -{ -} +cmCPackPackageMakerGenerator::~cmCPackPackageMakerGenerator() = default; bool cmCPackPackageMakerGenerator::SupportsComponentInstallation() const { diff --git a/Source/CPack/cmCPackProductBuildGenerator.cxx b/Source/CPack/cmCPackProductBuildGenerator.cxx index e73d01f..a556e0c 100644 --- a/Source/CPack/cmCPackProductBuildGenerator.cxx +++ b/Source/CPack/cmCPackProductBuildGenerator.cxx @@ -17,9 +17,7 @@ cmCPackProductBuildGenerator::cmCPackProductBuildGenerator() this->componentPackageMethod = ONE_PACKAGE; } -cmCPackProductBuildGenerator::~cmCPackProductBuildGenerator() -{ -} +cmCPackProductBuildGenerator::~cmCPackProductBuildGenerator() = default; int cmCPackProductBuildGenerator::PackageFiles() { diff --git a/Source/CPack/cmCPackRPMGenerator.cxx b/Source/CPack/cmCPackRPMGenerator.cxx index 5834829..33ab62b 100644 --- a/Source/CPack/cmCPackRPMGenerator.cxx +++ b/Source/CPack/cmCPackRPMGenerator.cxx @@ -14,13 +14,9 @@ #include "cmCPackLog.h" #include "cmSystemTools.h" -cmCPackRPMGenerator::cmCPackRPMGenerator() -{ -} +cmCPackRPMGenerator::cmCPackRPMGenerator() = default; -cmCPackRPMGenerator::~cmCPackRPMGenerator() -{ -} +cmCPackRPMGenerator::~cmCPackRPMGenerator() = default; int cmCPackRPMGenerator::InitializeInternal() { diff --git a/Source/CPack/cmCPackSTGZGenerator.cxx b/Source/CPack/cmCPackSTGZGenerator.cxx index e55ea87..aba15d2 100644 --- a/Source/CPack/cmCPackSTGZGenerator.cxx +++ b/Source/CPack/cmCPackSTGZGenerator.cxx @@ -13,13 +13,9 @@ #include "cmSystemTools.h" #include "cm_sys_stat.h" -cmCPackSTGZGenerator::cmCPackSTGZGenerator() -{ -} +cmCPackSTGZGenerator::cmCPackSTGZGenerator() = default; -cmCPackSTGZGenerator::~cmCPackSTGZGenerator() -{ -} +cmCPackSTGZGenerator::~cmCPackSTGZGenerator() = default; int cmCPackSTGZGenerator::InitializeInternal() { diff --git a/Source/CPack/cmCPackTGZGenerator.cxx b/Source/CPack/cmCPackTGZGenerator.cxx index eaf8186..6f4676e 100644 --- a/Source/CPack/cmCPackTGZGenerator.cxx +++ b/Source/CPack/cmCPackTGZGenerator.cxx @@ -10,6 +10,4 @@ cmCPackTGZGenerator::cmCPackTGZGenerator() { } -cmCPackTGZGenerator::~cmCPackTGZGenerator() -{ -} +cmCPackTGZGenerator::~cmCPackTGZGenerator() = default; diff --git a/Source/CPack/cmCPackTXZGenerator.cxx b/Source/CPack/cmCPackTXZGenerator.cxx index e55e903..ccbccde 100644 --- a/Source/CPack/cmCPackTXZGenerator.cxx +++ b/Source/CPack/cmCPackTXZGenerator.cxx @@ -10,6 +10,4 @@ cmCPackTXZGenerator::cmCPackTXZGenerator() { } -cmCPackTXZGenerator::~cmCPackTXZGenerator() -{ -} +cmCPackTXZGenerator::~cmCPackTXZGenerator() = default; diff --git a/Source/CPack/cmCPackTarBZip2Generator.cxx b/Source/CPack/cmCPackTarBZip2Generator.cxx index c7a3dd4..85abeb1 100644 --- a/Source/CPack/cmCPackTarBZip2Generator.cxx +++ b/Source/CPack/cmCPackTarBZip2Generator.cxx @@ -10,6 +10,4 @@ cmCPackTarBZip2Generator::cmCPackTarBZip2Generator() { } -cmCPackTarBZip2Generator::~cmCPackTarBZip2Generator() -{ -} +cmCPackTarBZip2Generator::~cmCPackTarBZip2Generator() = default; diff --git a/Source/CPack/cmCPackTarCompressGenerator.cxx b/Source/CPack/cmCPackTarCompressGenerator.cxx index 0a7cd97..55a6de5 100644 --- a/Source/CPack/cmCPackTarCompressGenerator.cxx +++ b/Source/CPack/cmCPackTarCompressGenerator.cxx @@ -10,6 +10,4 @@ cmCPackTarCompressGenerator::cmCPackTarCompressGenerator() { } -cmCPackTarCompressGenerator::~cmCPackTarCompressGenerator() -{ -} +cmCPackTarCompressGenerator::~cmCPackTarCompressGenerator() = default; diff --git a/Source/CPack/cmCPackZIPGenerator.cxx b/Source/CPack/cmCPackZIPGenerator.cxx index 6b77c36..f06494c 100644 --- a/Source/CPack/cmCPackZIPGenerator.cxx +++ b/Source/CPack/cmCPackZIPGenerator.cxx @@ -10,6 +10,4 @@ cmCPackZIPGenerator::cmCPackZIPGenerator() { } -cmCPackZIPGenerator::~cmCPackZIPGenerator() -{ -} +cmCPackZIPGenerator::~cmCPackZIPGenerator() = default; diff --git a/Source/CTest/cmCTestBZR.cxx b/Source/CTest/cmCTestBZR.cxx index 365f267..b154caf 100644 --- a/Source/CTest/cmCTestBZR.cxx +++ b/Source/CTest/cmCTestBZR.cxx @@ -77,9 +77,7 @@ cmCTestBZR::cmCTestBZR(cmCTest* ct, std::ostream& log) cmSystemTools::PutEnv("BZR_PROGRESS_BAR=none"); } -cmCTestBZR::~cmCTestBZR() -{ -} +cmCTestBZR::~cmCTestBZR() = default; class cmCTestBZR::InfoParser : public cmCTestVC::LineParser { diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index d07bd21..3c96ebb 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -507,7 +507,7 @@ public: : FTC(ftc) { } - FragmentCompare() {} + FragmentCompare() = default; bool operator()(std::string const& l, std::string const& r) const { // Order files by modification time. Use lexicographic order diff --git a/Source/CTest/cmCTestCVS.cxx b/Source/CTest/cmCTestCVS.cxx index 6e1ada1..6e8f73f 100644 --- a/Source/CTest/cmCTestCVS.cxx +++ b/Source/CTest/cmCTestCVS.cxx @@ -16,9 +16,7 @@ cmCTestCVS::cmCTestCVS(cmCTest* ct, std::ostream& log) { } -cmCTestCVS::~cmCTestCVS() -{ -} +cmCTestCVS::~cmCTestCVS() = default; class cmCTestCVS::UpdateParser : public cmCTestVC::LineParser { diff --git a/Source/CTest/cmCTestConfigureHandler.cxx b/Source/CTest/cmCTestConfigureHandler.cxx index 5967b74..6b7601b 100644 --- a/Source/CTest/cmCTestConfigureHandler.cxx +++ b/Source/CTest/cmCTestConfigureHandler.cxx @@ -11,9 +11,7 @@ #include #include -cmCTestConfigureHandler::cmCTestConfigureHandler() -{ -} +cmCTestConfigureHandler::cmCTestConfigureHandler() = default; void cmCTestConfigureHandler::Initialize() { diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 6c68f46..1e99c75 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -112,9 +112,7 @@ private: cmDuration TimeOut; }; -cmCTestCoverageHandler::cmCTestCoverageHandler() -{ -} +cmCTestCoverageHandler::cmCTestCoverageHandler() = default; void cmCTestCoverageHandler::Initialize() { diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx index 4ede3d4..c0225ea 100644 --- a/Source/CTest/cmCTestGIT.cxx +++ b/Source/CTest/cmCTestGIT.cxx @@ -31,9 +31,7 @@ cmCTestGIT::cmCTestGIT(cmCTest* ct, std::ostream& log) this->CurrentGitVersion = 0; } -cmCTestGIT::~cmCTestGIT() -{ -} +cmCTestGIT::~cmCTestGIT() = default; class cmCTestGIT::OneLineParser : public cmCTestVC::LineParser { @@ -477,7 +475,7 @@ private: std::string EMail; unsigned long Time = 0; long TimeZone = 0; - Person() {} + Person() = default; }; void ParsePerson(const char* str, Person& person) diff --git a/Source/CTest/cmCTestGenericHandler.cxx b/Source/CTest/cmCTestGenericHandler.cxx index dc1bba0..d3020b5 100644 --- a/Source/CTest/cmCTestGenericHandler.cxx +++ b/Source/CTest/cmCTestGenericHandler.cxx @@ -18,9 +18,7 @@ cmCTestGenericHandler::cmCTestGenericHandler() this->TestLoad = 0; } -cmCTestGenericHandler::~cmCTestGenericHandler() -{ -} +cmCTestGenericHandler::~cmCTestGenericHandler() = default; void cmCTestGenericHandler::SetOption(const std::string& op, const char* value) { diff --git a/Source/CTest/cmCTestGlobalVC.cxx b/Source/CTest/cmCTestGlobalVC.cxx index d2714d9..a2d4d2c 100644 --- a/Source/CTest/cmCTestGlobalVC.cxx +++ b/Source/CTest/cmCTestGlobalVC.cxx @@ -15,9 +15,7 @@ cmCTestGlobalVC::cmCTestGlobalVC(cmCTest* ct, std::ostream& log) this->PriorRev = this->Unknown; } -cmCTestGlobalVC::~cmCTestGlobalVC() -{ -} +cmCTestGlobalVC::~cmCTestGlobalVC() = default; const char* cmCTestGlobalVC::LocalPath(std::string const& path) { diff --git a/Source/CTest/cmCTestHG.cxx b/Source/CTest/cmCTestHG.cxx index 9c6a80d..6fb99d8 100644 --- a/Source/CTest/cmCTestHG.cxx +++ b/Source/CTest/cmCTestHG.cxx @@ -18,9 +18,7 @@ cmCTestHG::cmCTestHG(cmCTest* ct, std::ostream& log) this->PriorRev = this->Unknown; } -cmCTestHG::~cmCTestHG() -{ -} +cmCTestHG::~cmCTestHG() = default; class cmCTestHG::IdentifyParser : public cmCTestVC::LineParser { diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index 320647a..2b17d03 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -44,7 +44,7 @@ public: : Handler(handler) { } - ~TestComparator() {} + ~TestComparator() = default; // Sorts tests in descending order of cost bool operator()(int index1, int index2) const @@ -70,9 +70,7 @@ cmCTestMultiProcessHandler::cmCTestMultiProcessHandler() this->SerialTestRunning = false; } -cmCTestMultiProcessHandler::~cmCTestMultiProcessHandler() -{ -} +cmCTestMultiProcessHandler::~cmCTestMultiProcessHandler() = default; // Set the tests void cmCTestMultiProcessHandler::SetTests(TestMap& tests, diff --git a/Source/CTest/cmCTestP4.cxx b/Source/CTest/cmCTestP4.cxx index c0bdc17..435be97 100644 --- a/Source/CTest/cmCTestP4.cxx +++ b/Source/CTest/cmCTestP4.cxx @@ -19,9 +19,7 @@ cmCTestP4::cmCTestP4(cmCTest* ct, std::ostream& log) this->PriorRev = this->Unknown; } -cmCTestP4::~cmCTestP4() -{ -} +cmCTestP4::~cmCTestP4() = default; class cmCTestP4::IdentifyParser : public cmCTestVC::LineParser { diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx index afde61c..3bf66ca 100644 --- a/Source/CTest/cmCTestSVN.cxx +++ b/Source/CTest/cmCTestSVN.cxx @@ -26,9 +26,7 @@ cmCTestSVN::cmCTestSVN(cmCTest* ct, std::ostream& log) this->PriorRev = this->Unknown; } -cmCTestSVN::~cmCTestSVN() -{ -} +cmCTestSVN::~cmCTestSVN() = default; void cmCTestSVN::CleanupImpl() { diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index f417f53..1231f31 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -53,8 +53,8 @@ struct cmListFileFunction; class cmCTestScriptFunctionBlocker : public cmFunctionBlocker { public: - cmCTestScriptFunctionBlocker() {} - ~cmCTestScriptFunctionBlocker() override {} + cmCTestScriptFunctionBlocker() = default; + ~cmCTestScriptFunctionBlocker() override = default; bool IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile& mf, cmExecutionStatus& /*status*/) override; // virtual bool ShouldRemove(const cmListFileFunction& lff, cmMakefile &mf); diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 5213bd3..9e1f409 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -31,7 +31,7 @@ class cmCTestSubmitHandler::ResponseParser : public cmXMLParser { public: ResponseParser() { this->Status = STATUS_OK; } - ~ResponseParser() override {} + ~ResponseParser() override = default; public: enum StatusType diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx index 57e40ce..e3b7e9e 100644 --- a/Source/CTest/cmCTestUpdateHandler.cxx +++ b/Source/CTest/cmCTestUpdateHandler.cxx @@ -34,9 +34,7 @@ static const char* cmCTestUpdateHandlerUpdateToString(int type) return cmCTestUpdateHandlerUpdateStrings[type]; } -cmCTestUpdateHandler::cmCTestUpdateHandler() -{ -} +cmCTestUpdateHandler::cmCTestUpdateHandler() = default; void cmCTestUpdateHandler::Initialize() { diff --git a/Source/CTest/cmCTestVC.cxx b/Source/CTest/cmCTestVC.cxx index 63bd0e6..374e73f 100644 --- a/Source/CTest/cmCTestVC.cxx +++ b/Source/CTest/cmCTestVC.cxx @@ -24,9 +24,7 @@ cmCTestVC::cmCTestVC(cmCTest* ct, std::ostream& log) this->Unknown.Rev = "Unknown"; } -cmCTestVC::~cmCTestVC() -{ -} +cmCTestVC::~cmCTestVC() = default; void cmCTestVC::SetCommandLineTool(std::string const& tool) { diff --git a/Source/CTest/cmParseBlanketJSCoverage.cxx b/Source/CTest/cmParseBlanketJSCoverage.cxx index 308e6f7..63d6a15 100644 --- a/Source/CTest/cmParseBlanketJSCoverage.cxx +++ b/Source/CTest/cmParseBlanketJSCoverage.cxx @@ -20,7 +20,7 @@ public: { } - virtual ~JSONParser() {} + virtual ~JSONParser() = default; std::string getValue(std::string const& line, int type) { diff --git a/Source/CTest/cmParseCoberturaCoverage.cxx b/Source/CTest/cmParseCoberturaCoverage.cxx index 5bb6424..1669b07 100644 --- a/Source/CTest/cmParseCoberturaCoverage.cxx +++ b/Source/CTest/cmParseCoberturaCoverage.cxx @@ -24,7 +24,7 @@ public: this->CurFileName.clear(); } - ~XMLParser() override {} + ~XMLParser() override = default; protected: void EndElement(const std::string& name) override diff --git a/Source/CTest/cmParseDelphiCoverage.cxx b/Source/CTest/cmParseDelphiCoverage.cxx index d99de06..9eda6f8 100644 --- a/Source/CTest/cmParseDelphiCoverage.cxx +++ b/Source/CTest/cmParseDelphiCoverage.cxx @@ -20,7 +20,7 @@ public: { } - virtual ~HTMLParser() {} + virtual ~HTMLParser() = default; bool initializeDelphiFile( std::string const& filename, diff --git a/Source/CTest/cmParseJacocoCoverage.cxx b/Source/CTest/cmParseJacocoCoverage.cxx index 31e7cd4..b2d3b1b 100644 --- a/Source/CTest/cmParseJacocoCoverage.cxx +++ b/Source/CTest/cmParseJacocoCoverage.cxx @@ -23,7 +23,7 @@ public: this->PackageName.clear(); } - ~XMLParser() override {} + ~XMLParser() override = default; protected: void EndElement(const std::string& /*name*/) override {} diff --git a/Source/CTest/cmParseMumpsCoverage.cxx b/Source/CTest/cmParseMumpsCoverage.cxx index 488d237..4a81ee4 100644 --- a/Source/CTest/cmParseMumpsCoverage.cxx +++ b/Source/CTest/cmParseMumpsCoverage.cxx @@ -18,9 +18,7 @@ cmParseMumpsCoverage::cmParseMumpsCoverage( { } -cmParseMumpsCoverage::~cmParseMumpsCoverage() -{ -} +cmParseMumpsCoverage::~cmParseMumpsCoverage() = default; bool cmParseMumpsCoverage::ReadCoverageFile(const char* file) { diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx index 7737f65..70ef8df 100644 --- a/Source/CTest/cmProcess.cxx +++ b/Source/CTest/cmProcess.cxx @@ -69,9 +69,7 @@ cmProcess::cmProcess(cmCTestRunTest& runner) this->StartTime = std::chrono::steady_clock::time_point(); } -cmProcess::~cmProcess() -{ -} +cmProcess::~cmProcess() = default; void cmProcess::SetCommand(const char* command) { diff --git a/Source/CursesDialog/cmCursesLabelWidget.cxx b/Source/CursesDialog/cmCursesLabelWidget.cxx index 1dfd4ce..83aea5a 100644 --- a/Source/CursesDialog/cmCursesLabelWidget.cxx +++ b/Source/CursesDialog/cmCursesLabelWidget.cxx @@ -14,9 +14,7 @@ cmCursesLabelWidget::cmCursesLabelWidget(int width, int height, int left, this->SetValue(name); } -cmCursesLabelWidget::~cmCursesLabelWidget() -{ -} +cmCursesLabelWidget::~cmCursesLabelWidget() = default; bool cmCursesLabelWidget::HandleInput(int& /*key*/, cmCursesMainForm* /*fm*/, WINDOW* /*w*/) diff --git a/Source/QtDialog/FirstConfigure.cxx b/Source/QtDialog/FirstConfigure.cxx index ae5179c..f28e1a8 100644 --- a/Source/QtDialog/FirstConfigure.cxx +++ b/Source/QtDialog/FirstConfigure.cxx @@ -86,9 +86,7 @@ QFrame* StartCompilerSetup::CreatePlatformWidgets() return frame; } -StartCompilerSetup::~StartCompilerSetup() -{ -} +StartCompilerSetup::~StartCompilerSetup() = default; void StartCompilerSetup::setGenerators( std::vector const& gens) @@ -237,9 +235,7 @@ NativeCompilerSetup::NativeCompilerSetup(QWidget* p) this->setupUi(c); } -NativeCompilerSetup::~NativeCompilerSetup() -{ -} +NativeCompilerSetup::~NativeCompilerSetup() = default; QString NativeCompilerSetup::getCCompiler() const { @@ -301,9 +297,7 @@ CrossCompilerSetup::CrossCompilerSetup(QWidget* p) this->registerField("systemName*", this->systemName); } -CrossCompilerSetup::~CrossCompilerSetup() -{ -} +CrossCompilerSetup::~CrossCompilerSetup() = default; QString CrossCompilerSetup::getCCompiler() const { @@ -414,9 +408,7 @@ ToolchainCompilerSetup::ToolchainCompilerSetup(QWidget* p) l->addWidget(this->ToolchainFile); } -ToolchainCompilerSetup::~ToolchainCompilerSetup() -{ -} +ToolchainCompilerSetup::~ToolchainCompilerSetup() = default; QString ToolchainCompilerSetup::toolchainFile() const { @@ -446,9 +438,7 @@ FirstConfigure::FirstConfigure() this->setPage(ToolchainSetup, this->mToolchainCompilerSetupPage); } -FirstConfigure::~FirstConfigure() -{ -} +FirstConfigure::~FirstConfigure() = default; void FirstConfigure::setGenerators( std::vector const& gens) diff --git a/Source/QtDialog/QCMakeCacheView.cxx b/Source/QtDialog/QCMakeCacheView.cxx index 821c3f4..78a2710 100644 --- a/Source/QtDialog/QCMakeCacheView.cxx +++ b/Source/QtDialog/QCMakeCacheView.cxx @@ -186,9 +186,7 @@ QCMakeCacheModel::QCMakeCacheModel(QObject* p) this->setHorizontalHeaderLabels(labels); } -QCMakeCacheModel::~QCMakeCacheModel() -{ -} +QCMakeCacheModel::~QCMakeCacheModel() = default; static uint qHash(const QCMakeProperty& p) { diff --git a/Source/cmBase32.cxx b/Source/cmBase32.cxx index 1dac212..80ada47 100644 --- a/Source/cmBase32.cxx +++ b/Source/cmBase32.cxx @@ -34,13 +34,9 @@ void Base32Encode5(const unsigned char src[5], char dst[8]) // -- Class methods -cmBase32Encoder::cmBase32Encoder() -{ -} +cmBase32Encoder::cmBase32Encoder() = default; -cmBase32Encoder::~cmBase32Encoder() -{ -} +cmBase32Encoder::~cmBase32Encoder() = default; std::string cmBase32Encoder::encodeString(const unsigned char* input, size_t len, bool padding) diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index 8ed43f9..f49df74 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -474,7 +474,7 @@ int CCONV cmGetTotalArgumentSize(int argc, char** argv) // API for source files. struct cmCPluginAPISourceFile { - cmCPluginAPISourceFile() {} + cmCPluginAPISourceFile() = default; cmSourceFile* RealSourceFile = nullptr; std::string SourceName; std::string SourceExtension; diff --git a/Source/cmCTest.h b/Source/cmCTest.h index a82f400..cdbd665 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -57,7 +57,7 @@ public: /** Representation of one part. */ struct PartInfo { - PartInfo() {} + PartInfo() = default; void SetName(const std::string& name) { this->Name = name; } const std::string& GetName() const { return this->Name; } diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index b39856e..1031d11 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -42,7 +42,7 @@ private: void AppendProperty(const std::string& property, const char* value, bool asString = false); bool Initialized = false; - CacheEntry() {} + CacheEntry() = default; }; public: diff --git a/Source/cmCommand.h b/Source/cmCommand.h index dfc3e78..07333bb 100644 --- a/Source/cmCommand.h +++ b/Source/cmCommand.h @@ -30,12 +30,12 @@ public: /** * Construct the command. By default it has no makefile. */ - cmCommand() {} + cmCommand() = default; /** * Need virtual destructor to destroy real command type. */ - virtual ~cmCommand() {} + virtual ~cmCommand() = default; /** * Specify the makefile. diff --git a/Source/cmCommandArgumentsHelper.h b/Source/cmCommandArgumentsHelper.h index c68e64c..76d17ab 100644 --- a/Source/cmCommandArgumentsHelper.h +++ b/Source/cmCommandArgumentsHelper.h @@ -39,7 +39,7 @@ class cmCommandArgument public: cmCommandArgument(cmCommandArgumentsHelper* args, const char* key, cmCommandArgumentGroup* group = nullptr); - virtual ~cmCommandArgument() {} + virtual ~cmCommandArgument() = default; /// this argument may follow after arg. 0 means it comes first. void Follows(const cmCommandArgument* arg); @@ -172,7 +172,7 @@ class cmCommandArgumentGroup friend class cmCommandArgument; public: - cmCommandArgumentGroup() {} + cmCommandArgumentGroup() = default; /// All members of this group may follow the given argument void Follows(const cmCommandArgument* arg); diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index a1df271..2046d26 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -29,9 +29,7 @@ cmCommonTargetGenerator::cmCommonTargetGenerator(cmGeneratorTarget* gt) { } -cmCommonTargetGenerator::~cmCommonTargetGenerator() -{ -} +cmCommonTargetGenerator::~cmCommonTargetGenerator() = default; std::string const& cmCommonTargetGenerator::GetConfigName() const { diff --git a/Source/cmComputeComponentGraph.cxx b/Source/cmComputeComponentGraph.cxx index 5820df6..113463f 100644 --- a/Source/cmComputeComponentGraph.cxx +++ b/Source/cmComputeComponentGraph.cxx @@ -18,9 +18,7 @@ cmComputeComponentGraph::cmComputeComponentGraph(Graph const& input) this->TransferEdges(); } -cmComputeComponentGraph::~cmComputeComponentGraph() -{ -} +cmComputeComponentGraph::~cmComputeComponentGraph() = default; void cmComputeComponentGraph::Tarjan() { diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h index 32a2a62..a6bb49f 100644 --- a/Source/cmComputeLinkDepends.h +++ b/Source/cmComputeLinkDepends.h @@ -38,14 +38,8 @@ public: cmGeneratorTarget const* Target = nullptr; bool IsSharedDep = false; bool IsFlag = false; - LinkEntry() {} - LinkEntry(LinkEntry const& r) - : Item(r.Item) - , Target(r.Target) - , IsSharedDep(r.IsSharedDep) - , IsFlag(r.IsFlag) - { - } + LinkEntry() = default; + LinkEntry(LinkEntry const& r) = default; }; typedef std::vector EntryVector; diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index 61fcf03..863639c 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -31,7 +31,7 @@ public: struct Item { - Item() {} + Item() = default; Item(std::string v, bool p, cmGeneratorTarget const* target = nullptr) : Value(std::move(v)) , IsPath(p) diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index fde9750..041ad4f 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -103,9 +103,7 @@ cmComputeTargetDepends::cmComputeTargetDepends(cmGlobalGenerator* gg) cm->GetState()->GetGlobalPropertyAsBool("GLOBAL_DEPENDS_NO_CYCLES"); } -cmComputeTargetDepends::~cmComputeTargetDepends() -{ -} +cmComputeTargetDepends::~cmComputeTargetDepends() = default; bool cmComputeTargetDepends::Compute() { diff --git a/Source/cmConnection.cxx b/Source/cmConnection.cxx index 50e1936..166426b 100644 --- a/Source/cmConnection.cxx +++ b/Source/cmConnection.cxx @@ -127,9 +127,7 @@ void cmEventBasedConnection::OnDisconnect(int onerror) } } -cmConnection::~cmConnection() -{ -} +cmConnection::~cmConnection() = default; bool cmConnection::OnConnectionShuttingDown() { diff --git a/Source/cmConnection.h b/Source/cmConnection.h index ce2d2dc..3a7f1b9 100644 --- a/Source/cmConnection.h +++ b/Source/cmConnection.h @@ -63,7 +63,7 @@ class cmConnection CM_DISABLE_COPY(cmConnection) public: - cmConnection() {} + cmConnection() = default; virtual void WriteData(const std::string& data) = 0; diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h index b2794fa..6c252be 100644 --- a/Source/cmDefinitions.h +++ b/Source/cmDefinitions.h @@ -47,7 +47,7 @@ private: typedef std::string std_string; public: - Def() {} + Def() = default; Def(const char* v) : std_string(v ? v : "") , Exists(v ? true : false) diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index f6ac4f2..049f840 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -19,9 +19,7 @@ #define INCLUDE_REGEX_COMPLAIN_MARKER "#IncludeRegexComplain: " #define INCLUDE_REGEX_TRANSFORM_MARKER "#IncludeRegexTransform: " -cmDependsC::cmDependsC() -{ -} +cmDependsC::cmDependsC() = default; cmDependsC::cmDependsC( cmLocalGenerator* lg, const std::string& targetDir, const std::string& lang, diff --git a/Source/cmDependsC.h b/Source/cmDependsC.h index af2b06e..dab03f3 100644 --- a/Source/cmDependsC.h +++ b/Source/cmDependsC.h @@ -75,7 +75,7 @@ public: struct cmIncludeLines { - cmIncludeLines() {} + cmIncludeLines() = default; std::vector UnscannedEntries; bool Used = false; }; diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index 6c5f647..cae3ff6 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -68,9 +68,7 @@ public: } }; -cmDependsFortran::cmDependsFortran() -{ -} +cmDependsFortran::cmDependsFortran() = default; cmDependsFortran::cmDependsFortran(cmLocalGenerator* lg) : cmDepends(lg) diff --git a/Source/cmDependsJava.cxx b/Source/cmDependsJava.cxx index b44b3a2..2485e15 100644 --- a/Source/cmDependsJava.cxx +++ b/Source/cmDependsJava.cxx @@ -4,13 +4,9 @@ #include "cmSystemTools.h" -cmDependsJava::cmDependsJava() -{ -} +cmDependsJava::cmDependsJava() = default; -cmDependsJava::~cmDependsJava() -{ -} +cmDependsJava::~cmDependsJava() = default; bool cmDependsJava::WriteDependencies(const std::set& sources, const std::string& /*obj*/, diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h index b2ff01a..1026064 100644 --- a/Source/cmDocumentation.h +++ b/Source/cmDocumentation.h @@ -115,7 +115,7 @@ private: struct RequestedHelpItem { - RequestedHelpItem() {} + RequestedHelpItem() = default; cmDocumentationEnums::Type HelpType = None; std::string Filename; std::string Argument; diff --git a/Source/cmDocumentationEntry.h b/Source/cmDocumentationEntry.h index ca323cc..afbca5e 100644 --- a/Source/cmDocumentationEntry.h +++ b/Source/cmDocumentationEntry.h @@ -13,7 +13,7 @@ struct cmDocumentationEntry std::string Name; std::string Brief; char CustomNamePrefix = ' '; - cmDocumentationEntry() {} + cmDocumentationEntry() = default; cmDocumentationEntry(const char* doc[2]) { if (doc[0]) { diff --git a/Source/cmDocumentationFormatter.cxx b/Source/cmDocumentationFormatter.cxx index e573c04..3e7f989 100644 --- a/Source/cmDocumentationFormatter.cxx +++ b/Source/cmDocumentationFormatter.cxx @@ -11,13 +11,9 @@ #include #include -cmDocumentationFormatter::cmDocumentationFormatter() -{ -} +cmDocumentationFormatter::cmDocumentationFormatter() = default; -cmDocumentationFormatter::~cmDocumentationFormatter() -{ -} +cmDocumentationFormatter::~cmDocumentationFormatter() = default; void cmDocumentationFormatter::PrintFormatted(std::ostream& os, const char* text) diff --git a/Source/cmDynamicLoader.cxx b/Source/cmDynamicLoader.cxx index 7da6ff5..0549cf9 100644 --- a/Source/cmDynamicLoader.cxx +++ b/Source/cmDynamicLoader.cxx @@ -24,9 +24,7 @@ private: cmDynamicLoaderCache* cmDynamicLoaderCache::Instance = nullptr; -cmDynamicLoaderCache::~cmDynamicLoaderCache() -{ -} +cmDynamicLoaderCache::~cmDynamicLoaderCache() = default; void cmDynamicLoaderCache::CacheFile(const char* path, cmsys::DynamicLoader::LibraryHandle p) diff --git a/Source/cmDynamicLoader.h b/Source/cmDynamicLoader.h index 61d3b46..e9fe97a 100644 --- a/Source/cmDynamicLoader.h +++ b/Source/cmDynamicLoader.h @@ -28,8 +28,8 @@ public: static void FlushCache(); protected: - cmDynamicLoader() {} - ~cmDynamicLoader() {} + cmDynamicLoader() = default; + ~cmDynamicLoader() = default; }; #endif diff --git a/Source/cmExecutionStatus.h b/Source/cmExecutionStatus.h index 1946231..f9189f7 100644 --- a/Source/cmExecutionStatus.h +++ b/Source/cmExecutionStatus.h @@ -11,7 +11,7 @@ class cmExecutionStatus { public: - cmExecutionStatus() {} + cmExecutionStatus() = default; void Clear() { diff --git a/Source/cmExpandedCommandArgument.cxx b/Source/cmExpandedCommandArgument.cxx index 00848a6..43f648b 100644 --- a/Source/cmExpandedCommandArgument.cxx +++ b/Source/cmExpandedCommandArgument.cxx @@ -4,9 +4,7 @@ #include -cmExpandedCommandArgument::cmExpandedCommandArgument() -{ -} +cmExpandedCommandArgument::cmExpandedCommandArgument() = default; cmExpandedCommandArgument::cmExpandedCommandArgument(std::string value, bool quoted) diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h index 41c6538..747503e 100644 --- a/Source/cmExportFileGenerator.h +++ b/Source/cmExportFileGenerator.h @@ -42,7 +42,7 @@ class cmExportFileGenerator { public: cmExportFileGenerator(); - virtual ~cmExportFileGenerator() {} + virtual ~cmExportFileGenerator() = default; /** Set the full path to the export file to generate. */ void SetExportFile(const char* mainFile); diff --git a/Source/cmExprParserHelper.cxx b/Source/cmExprParserHelper.cxx index 8d3dad7..80c78a3 100644 --- a/Source/cmExprParserHelper.cxx +++ b/Source/cmExprParserHelper.cxx @@ -18,9 +18,7 @@ cmExprParserHelper::cmExprParserHelper() this->Result = 0; } -cmExprParserHelper::~cmExprParserHelper() -{ -} +cmExprParserHelper::~cmExprParserHelper() = default; int cmExprParserHelper::ParseString(const char* str, int verb) { diff --git a/Source/cmExternalMakefileProjectGenerator.cxx b/Source/cmExternalMakefileProjectGenerator.cxx index 150995f..ac54811 100644 --- a/Source/cmExternalMakefileProjectGenerator.cxx +++ b/Source/cmExternalMakefileProjectGenerator.cxx @@ -41,9 +41,7 @@ cmExternalMakefileProjectGeneratorFactory:: } cmExternalMakefileProjectGeneratorFactory:: - ~cmExternalMakefileProjectGeneratorFactory() -{ -} + ~cmExternalMakefileProjectGeneratorFactory() = default; std::string cmExternalMakefileProjectGeneratorFactory::GetName() const { diff --git a/Source/cmExternalMakefileProjectGenerator.h b/Source/cmExternalMakefileProjectGenerator.h index 492987d..4438f28 100644 --- a/Source/cmExternalMakefileProjectGenerator.h +++ b/Source/cmExternalMakefileProjectGenerator.h @@ -26,7 +26,7 @@ class cmMakefile; class cmExternalMakefileProjectGenerator { public: - virtual ~cmExternalMakefileProjectGenerator() {} + virtual ~cmExternalMakefileProjectGenerator() = default; virtual void EnableLanguage(std::vector const& languages, cmMakefile*, bool optional); diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index d70352f..397508c 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -32,9 +32,7 @@ Discussion: http://forums.codeblocks.org/index.php/topic,6789.0.html */ -cmExtraCodeBlocksGenerator::cmExtraCodeBlocksGenerator() -{ -} +cmExtraCodeBlocksGenerator::cmExtraCodeBlocksGenerator() = default; cmExternalMakefileProjectGeneratorFactory* cmExtraCodeBlocksGenerator::GetFactory() diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx index a9ed7fe..e28a865 100644 --- a/Source/cmExtraKateGenerator.cxx +++ b/Source/cmExtraKateGenerator.cxx @@ -16,9 +16,7 @@ #include #include -cmExtraKateGenerator::cmExtraKateGenerator() -{ -} +cmExtraKateGenerator::cmExtraKateGenerator() = default; cmExternalMakefileProjectGeneratorFactory* cmExtraKateGenerator::GetFactory() { diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 999af54..0b404fe 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -1079,7 +1079,7 @@ struct cmFileCopier , Doing(DoingNone) { } - virtual ~cmFileCopier() {} + virtual ~cmFileCopier() = default; bool Run(std::vector const& args); @@ -1102,7 +1102,7 @@ protected: { bool Exclude = false; mode_t Permissions = 0; - MatchProperties() {} + MatchProperties() = default; }; struct MatchRule { diff --git a/Source/cmFileLockPool.cxx b/Source/cmFileLockPool.cxx index 5dc9243..d700a79 100644 --- a/Source/cmFileLockPool.cxx +++ b/Source/cmFileLockPool.cxx @@ -8,9 +8,7 @@ #include "cmFileLock.h" #include "cmFileLockResult.h" -cmFileLockPool::cmFileLockPool() -{ -} +cmFileLockPool::cmFileLockPool() = default; cmFileLockPool::~cmFileLockPool() { @@ -111,9 +109,7 @@ bool cmFileLockPool::IsAlreadyLocked(const std::string& filename) const return this->ProcessScope.IsAlreadyLocked(filename); } -cmFileLockPool::ScopePool::ScopePool() -{ -} +cmFileLockPool::ScopePool::ScopePool() = default; cmFileLockPool::ScopePool::~ScopePool() { diff --git a/Source/cmFileLockUnix.cxx b/Source/cmFileLockUnix.cxx index 9b653e8..1bf5013 100644 --- a/Source/cmFileLockUnix.cxx +++ b/Source/cmFileLockUnix.cxx @@ -8,9 +8,7 @@ #include // SEEK_SET #include -cmFileLock::cmFileLock() -{ -} +cmFileLock::cmFileLock() = default; cmFileLockResult cmFileLock::Release() { diff --git a/Source/cmFileMonitor.cxx b/Source/cmFileMonitor.cxx index b36ac78..8287747 100644 --- a/Source/cmFileMonitor.cxx +++ b/Source/cmFileMonitor.cxx @@ -150,10 +150,7 @@ public: p->AddChildWatcher(ps, this); } - ~cmRealDirectoryWatcher() override - { - // Handle is freed via uv_handle_close callback! - } + ~cmRealDirectoryWatcher() override = default; void StartWatching() final { diff --git a/Source/cmFilePathChecksum.cxx b/Source/cmFilePathChecksum.cxx index f84360e..2cffa7c 100644 --- a/Source/cmFilePathChecksum.cxx +++ b/Source/cmFilePathChecksum.cxx @@ -9,9 +9,7 @@ #include -cmFilePathChecksum::cmFilePathChecksum() -{ -} +cmFilePathChecksum::cmFilePathChecksum() = default; cmFilePathChecksum::cmFilePathChecksum(std::string const& currentSrcDir, std::string const& currentBinDir, diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx index 39051b9..78be64e 100644 --- a/Source/cmFindCommon.cxx +++ b/Source/cmFindCommon.cxx @@ -48,9 +48,7 @@ cmFindCommon::cmFindCommon() this->InitializeSearchPathGroups(); } -cmFindCommon::~cmFindCommon() -{ -} +cmFindCommon::~cmFindCommon() = default; void cmFindCommon::InitializeSearchPathGroups() { diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index bcf876d..3400b36 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -202,7 +202,7 @@ struct cmFindLibraryHelper bool TryRaw = false; std::string Raw; cmsys::RegularExpression Regex; - Name() {} + Name() = default; }; std::vector Names; diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index bec2af9..0a5463b 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -1671,7 +1671,7 @@ void cmFindPackageCommand::StoreVersionFound() class cmFileListGeneratorBase { public: - virtual ~cmFileListGeneratorBase() {} + virtual ~cmFileListGeneratorBase() = default; protected: bool Consider(std::string const& fullPath, cmFileList& listing); @@ -1688,8 +1688,8 @@ private: class cmFileList { public: - cmFileList() {} - virtual ~cmFileList() {} + cmFileList() = default; + virtual ~cmFileList() = default; cmFileList& operator/(cmFileListGeneratorBase const& rhs) { if (this->Last) { diff --git a/Source/cmFunctionBlocker.h b/Source/cmFunctionBlocker.h index b3450b3..cd6b05d 100644 --- a/Source/cmFunctionBlocker.h +++ b/Source/cmFunctionBlocker.h @@ -26,7 +26,7 @@ public: return false; } - virtual ~cmFunctionBlocker() {} + virtual ~cmFunctionBlocker() = default; /** Set/Get the context in which this blocker is created. */ void SetStartingContext(cmListFileContext const& lfc) diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index 67c9e9a..d2bf687 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -14,10 +14,10 @@ class cmFunctionHelperCommand : public cmCommand { public: - cmFunctionHelperCommand() {} + cmFunctionHelperCommand() = default; ///! clean up any memory allocated by the function - ~cmFunctionHelperCommand() override {} + ~cmFunctionHelperCommand() override = default; /** * This is a virtual constructor for the command. diff --git a/Source/cmFunctionCommand.h b/Source/cmFunctionCommand.h index 3352b92..90f7d82 100644 --- a/Source/cmFunctionCommand.h +++ b/Source/cmFunctionCommand.h @@ -19,7 +19,7 @@ class cmFunctionFunctionBlocker : public cmFunctionBlocker { public: cmFunctionFunctionBlocker() { this->Depth = 0; } - ~cmFunctionFunctionBlocker() override {} + ~cmFunctionFunctionBlocker() override = default; bool IsFunctionBlocked(const cmListFileFunction&, cmMakefile& mf, cmExecutionStatus&) override; bool ShouldRemove(const cmListFileFunction&, cmMakefile& mf) override; diff --git a/Source/cmGeneratedFileStream.cxx b/Source/cmGeneratedFileStream.cxx index bf53dbf..b55e786 100644 --- a/Source/cmGeneratedFileStream.cxx +++ b/Source/cmGeneratedFileStream.cxx @@ -102,9 +102,7 @@ void cmGeneratedFileStream::SetCompressionExtraExtension(bool ext) this->CompressExtraExtension = ext; } -cmGeneratedFileStreamBase::cmGeneratedFileStreamBase() -{ -} +cmGeneratedFileStreamBase::cmGeneratedFileStreamBase() = default; cmGeneratedFileStreamBase::cmGeneratedFileStreamBase(std::string const& name) { diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index f3f9771..175a26d 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -33,9 +33,7 @@ std::unique_ptr cmGeneratorExpression::Parse( return this->Parse(std::string(input ? input : "")); } -cmGeneratorExpression::~cmGeneratorExpression() -{ -} +cmGeneratorExpression::~cmGeneratorExpression() = default; const std::string& cmCompiledGeneratorExpression::Evaluate( cmLocalGenerator* lg, const std::string& config, bool quiet, diff --git a/Source/cmGeneratorExpressionEvaluator.h b/Source/cmGeneratorExpressionEvaluator.h index 0561799..0f553f2 100644 --- a/Source/cmGeneratorExpressionEvaluator.h +++ b/Source/cmGeneratorExpressionEvaluator.h @@ -16,8 +16,8 @@ struct cmGeneratorExpressionNode; struct cmGeneratorExpressionEvaluator { - cmGeneratorExpressionEvaluator() {} - virtual ~cmGeneratorExpressionEvaluator() {} + cmGeneratorExpressionEvaluator() = default; + virtual ~cmGeneratorExpressionEvaluator() = default; enum Type { diff --git a/Source/cmGeneratorExpressionLexer.cxx b/Source/cmGeneratorExpressionLexer.cxx index dd1e243..a7f090a 100644 --- a/Source/cmGeneratorExpressionLexer.cxx +++ b/Source/cmGeneratorExpressionLexer.cxx @@ -2,9 +2,7 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmGeneratorExpressionLexer.h" -cmGeneratorExpressionLexer::cmGeneratorExpressionLexer() -{ -} +cmGeneratorExpressionLexer::cmGeneratorExpressionLexer() = default; static void InsertText(const char* upto, const char* c, std::vector& result) diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 6a3f73d..eb66ed5 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -56,7 +56,7 @@ std::string cmGeneratorExpressionNode::EvaluateDependentExpression( static const struct ZeroNode : public cmGeneratorExpressionNode { - ZeroNode() {} + ZeroNode() {} // NOLINT(modernize-use-equals-default) bool GeneratesContent() const override { return false; } @@ -74,7 +74,7 @@ static const struct ZeroNode : public cmGeneratorExpressionNode static const struct OneNode : public cmGeneratorExpressionNode { - OneNode() {} + OneNode() {} // NOLINT(modernize-use-equals-default) bool AcceptsArbitraryContentParameter() const override { return true; } @@ -127,7 +127,7 @@ BOOLEAN_OP_NODE(orNode, OR, 0, 1) static const struct NotNode : public cmGeneratorExpressionNode { - NotNode() {} + NotNode() {} // NOLINT(modernize-use-equals-default) std::string Evaluate( const std::vector& parameters, @@ -147,7 +147,7 @@ static const struct NotNode : public cmGeneratorExpressionNode static const struct BoolNode : public cmGeneratorExpressionNode { - BoolNode() {} + BoolNode() {} // NOLINT(modernize-use-equals-default) int NumExpectedParameters() const override { return 1; } @@ -163,7 +163,7 @@ static const struct BoolNode : public cmGeneratorExpressionNode static const struct IfNode : public cmGeneratorExpressionNode { - IfNode() {} + IfNode() {} // NOLINT(modernize-use-equals-default) int NumExpectedParameters() const override { return 3; } @@ -184,7 +184,7 @@ static const struct IfNode : public cmGeneratorExpressionNode static const struct StrEqualNode : public cmGeneratorExpressionNode { - StrEqualNode() {} + StrEqualNode() {} // NOLINT(modernize-use-equals-default) int NumExpectedParameters() const override { return 2; } @@ -200,7 +200,7 @@ static const struct StrEqualNode : public cmGeneratorExpressionNode static const struct EqualNode : public cmGeneratorExpressionNode { - EqualNode() {} + EqualNode() {} // NOLINT(modernize-use-equals-default) int NumExpectedParameters() const override { return 2; } @@ -278,7 +278,7 @@ static const struct EqualNode : public cmGeneratorExpressionNode static const struct InListNode : public cmGeneratorExpressionNode { - InListNode() {} + InListNode() {} // NOLINT(modernize-use-equals-default) int NumExpectedParameters() const override { return 2; } @@ -328,7 +328,7 @@ static const struct InListNode : public cmGeneratorExpressionNode static const struct TargetExistsNode : public cmGeneratorExpressionNode { - TargetExistsNode() {} + TargetExistsNode() {} // NOLINT(modernize-use-equals-default) int NumExpectedParameters() const override { return 1; } @@ -359,7 +359,7 @@ static const struct TargetExistsNode : public cmGeneratorExpressionNode static const struct TargetNameIfExistsNode : public cmGeneratorExpressionNode { - TargetNameIfExistsNode() {} + TargetNameIfExistsNode() {} // NOLINT(modernize-use-equals-default) int NumExpectedParameters() const override { return 1; } @@ -393,7 +393,7 @@ static const struct TargetNameIfExistsNode : public cmGeneratorExpressionNode struct GenexEvaluator : public cmGeneratorExpressionNode { - GenexEvaluator() {} + GenexEvaluator() {} // NOLINT(modernize-use-equals-default) protected: std::string EvaluateExpression( @@ -430,7 +430,7 @@ protected: static const struct TargetGenexEvalNode : public GenexEvaluator { - TargetGenexEvalNode() {} + TargetGenexEvalNode() {} // NOLINT(modernize-use-equals-default) int NumExpectedParameters() const override { return 2; } @@ -476,7 +476,7 @@ static const struct TargetGenexEvalNode : public GenexEvaluator static const struct GenexEvalNode : public GenexEvaluator { - GenexEvalNode() {} + GenexEvalNode() {} // NOLINT(modernize-use-equals-default) int NumExpectedParameters() const override { return 1; } @@ -500,7 +500,7 @@ static const struct GenexEvalNode : public GenexEvaluator static const struct LowerCaseNode : public cmGeneratorExpressionNode { - LowerCaseNode() {} + LowerCaseNode() {} // NOLINT(modernize-use-equals-default) bool AcceptsArbitraryContentParameter() const override { return true; } @@ -516,7 +516,7 @@ static const struct LowerCaseNode : public cmGeneratorExpressionNode static const struct UpperCaseNode : public cmGeneratorExpressionNode { - UpperCaseNode() {} + UpperCaseNode() {} // NOLINT(modernize-use-equals-default) bool AcceptsArbitraryContentParameter() const override { return true; } @@ -532,7 +532,7 @@ static const struct UpperCaseNode : public cmGeneratorExpressionNode static const struct MakeCIdentifierNode : public cmGeneratorExpressionNode { - MakeCIdentifierNode() {} + MakeCIdentifierNode() {} // NOLINT(modernize-use-equals-default) bool AcceptsArbitraryContentParameter() const override { return true; } @@ -548,7 +548,7 @@ static const struct MakeCIdentifierNode : public cmGeneratorExpressionNode static const struct Angle_RNode : public cmGeneratorExpressionNode { - Angle_RNode() {} + Angle_RNode() {} // NOLINT(modernize-use-equals-default) int NumExpectedParameters() const override { return 0; } @@ -564,7 +564,7 @@ static const struct Angle_RNode : public cmGeneratorExpressionNode static const struct CommaNode : public cmGeneratorExpressionNode { - CommaNode() {} + CommaNode() {} // NOLINT(modernize-use-equals-default) int NumExpectedParameters() const override { return 0; } @@ -580,7 +580,7 @@ static const struct CommaNode : public cmGeneratorExpressionNode static const struct SemicolonNode : public cmGeneratorExpressionNode { - SemicolonNode() {} + SemicolonNode() {} // NOLINT(modernize-use-equals-default) int NumExpectedParameters() const override { return 0; } @@ -596,7 +596,7 @@ static const struct SemicolonNode : public cmGeneratorExpressionNode struct CompilerIdNode : public cmGeneratorExpressionNode { - CompilerIdNode() {} + CompilerIdNode() {} // NOLINT(modernize-use-equals-default) int NumExpectedParameters() const override { return OneOrZeroParameters; } @@ -650,7 +650,7 @@ struct CompilerIdNode : public cmGeneratorExpressionNode static const struct CCompilerIdNode : public CompilerIdNode { - CCompilerIdNode() {} + CCompilerIdNode() {} // NOLINT(modernize-use-equals-default) std::string Evaluate( const std::vector& parameters, @@ -672,7 +672,7 @@ static const struct CCompilerIdNode : public CompilerIdNode static const struct CXXCompilerIdNode : public CompilerIdNode { - CXXCompilerIdNode() {} + CXXCompilerIdNode() {} // NOLINT(modernize-use-equals-default) std::string Evaluate( const std::vector& parameters, @@ -694,7 +694,7 @@ static const struct CXXCompilerIdNode : public CompilerIdNode static const struct FortranCompilerIdNode : public CompilerIdNode { - FortranCompilerIdNode() {} + FortranCompilerIdNode() {} // NOLINT(modernize-use-equals-default) std::string Evaluate( const std::vector& parameters, @@ -716,7 +716,7 @@ static const struct FortranCompilerIdNode : public CompilerIdNode struct CompilerVersionNode : public cmGeneratorExpressionNode { - CompilerVersionNode() {} + CompilerVersionNode() {} // NOLINT(modernize-use-equals-default) int NumExpectedParameters() const override { return OneOrZeroParameters; } @@ -753,7 +753,7 @@ struct CompilerVersionNode : public cmGeneratorExpressionNode static const struct CCompilerVersionNode : public CompilerVersionNode { - CCompilerVersionNode() {} + CCompilerVersionNode() {} // NOLINT(modernize-use-equals-default) std::string Evaluate( const std::vector& parameters, @@ -775,7 +775,7 @@ static const struct CCompilerVersionNode : public CompilerVersionNode static const struct CxxCompilerVersionNode : public CompilerVersionNode { - CxxCompilerVersionNode() {} + CxxCompilerVersionNode() {} // NOLINT(modernize-use-equals-default) std::string Evaluate( const std::vector& parameters, @@ -797,7 +797,7 @@ static const struct CxxCompilerVersionNode : public CompilerVersionNode static const struct FortranCompilerVersionNode : public CompilerVersionNode { - FortranCompilerVersionNode() {} + FortranCompilerVersionNode() {} // NOLINT(modernize-use-equals-default) std::string Evaluate( const std::vector& parameters, @@ -819,7 +819,7 @@ static const struct FortranCompilerVersionNode : public CompilerVersionNode struct PlatformIdNode : public cmGeneratorExpressionNode { - PlatformIdNode() {} + PlatformIdNode() {} // NOLINT(modernize-use-equals-default) int NumExpectedParameters() const override { return OneOrZeroParameters; } @@ -848,7 +848,7 @@ struct PlatformIdNode : public cmGeneratorExpressionNode static const struct VersionGreaterNode : public cmGeneratorExpressionNode { - VersionGreaterNode() {} + VersionGreaterNode() {} // NOLINT(modernize-use-equals-default) int NumExpectedParameters() const override { return 2; } @@ -868,7 +868,7 @@ static const struct VersionGreaterNode : public cmGeneratorExpressionNode static const struct VersionGreaterEqNode : public cmGeneratorExpressionNode { - VersionGreaterEqNode() {} + VersionGreaterEqNode() {} // NOLINT(modernize-use-equals-default) int NumExpectedParameters() const override { return 2; } @@ -888,7 +888,7 @@ static const struct VersionGreaterEqNode : public cmGeneratorExpressionNode static const struct VersionLessNode : public cmGeneratorExpressionNode { - VersionLessNode() {} + VersionLessNode() {} // NOLINT(modernize-use-equals-default) int NumExpectedParameters() const override { return 2; } @@ -908,7 +908,7 @@ static const struct VersionLessNode : public cmGeneratorExpressionNode static const struct VersionLessEqNode : public cmGeneratorExpressionNode { - VersionLessEqNode() {} + VersionLessEqNode() {} // NOLINT(modernize-use-equals-default) int NumExpectedParameters() const override { return 2; } @@ -928,7 +928,7 @@ static const struct VersionLessEqNode : public cmGeneratorExpressionNode static const struct VersionEqualNode : public cmGeneratorExpressionNode { - VersionEqualNode() {} + VersionEqualNode() {} // NOLINT(modernize-use-equals-default) int NumExpectedParameters() const override { return 2; } @@ -948,7 +948,7 @@ static const struct VersionEqualNode : public cmGeneratorExpressionNode static const struct LinkOnlyNode : public cmGeneratorExpressionNode { - LinkOnlyNode() {} + LinkOnlyNode() {} // NOLINT(modernize-use-equals-default) std::string Evaluate( const std::vector& parameters, @@ -970,7 +970,7 @@ static const struct LinkOnlyNode : public cmGeneratorExpressionNode static const struct ConfigurationNode : public cmGeneratorExpressionNode { - ConfigurationNode() {} + ConfigurationNode() {} // NOLINT(modernize-use-equals-default) int NumExpectedParameters() const override { return 0; } @@ -987,7 +987,7 @@ static const struct ConfigurationNode : public cmGeneratorExpressionNode static const struct ConfigurationTestNode : public cmGeneratorExpressionNode { - ConfigurationTestNode() {} + ConfigurationTestNode() {} // NOLINT(modernize-use-equals-default) int NumExpectedParameters() const override { return OneOrZeroParameters; } @@ -1046,7 +1046,7 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode static const struct JoinNode : public cmGeneratorExpressionNode { - JoinNode() {} + JoinNode() {} // NOLINT(modernize-use-equals-default) int NumExpectedParameters() const override { return 2; } @@ -1066,7 +1066,7 @@ static const struct JoinNode : public cmGeneratorExpressionNode static const struct CompileLanguageNode : public cmGeneratorExpressionNode { - CompileLanguageNode() {} + CompileLanguageNode() {} // NOLINT(modernize-use-equals-default) int NumExpectedParameters() const override { return OneOrZeroParameters; } @@ -1146,7 +1146,7 @@ std::string getLinkedTargetsContent( static const struct TargetPropertyNode : public cmGeneratorExpressionNode { - TargetPropertyNode() {} + TargetPropertyNode() {} // NOLINT(modernize-use-equals-default) // This node handles errors on parameter count itself. int NumExpectedParameters() const override { return OneOrMoreParameters; } @@ -1442,7 +1442,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode static const struct TargetNameNode : public cmGeneratorExpressionNode { - TargetNameNode() {} + TargetNameNode() {} // NOLINT(modernize-use-equals-default) bool GeneratesContent() const override { return true; } @@ -1464,7 +1464,7 @@ static const struct TargetNameNode : public cmGeneratorExpressionNode static const struct TargetObjectsNode : public cmGeneratorExpressionNode { - TargetObjectsNode() {} + TargetObjectsNode() {} // NOLINT(modernize-use-equals-default) std::string Evaluate( const std::vector& parameters, @@ -1546,7 +1546,7 @@ static const struct TargetObjectsNode : public cmGeneratorExpressionNode static const struct CompileFeaturesNode : public cmGeneratorExpressionNode { - CompileFeaturesNode() {} + CompileFeaturesNode() {} // NOLINT(modernize-use-equals-default) int NumExpectedParameters() const override { return OneOrMoreParameters; } @@ -1671,7 +1671,7 @@ cmPolicies::PolicyID policyForString(const char* policy_id) static const struct TargetPolicyNode : public cmGeneratorExpressionNode { - TargetPolicyNode() {} + TargetPolicyNode() {} // NOLINT(modernize-use-equals-default) int NumExpectedParameters() const override { return 1; } @@ -1732,7 +1732,7 @@ static const struct TargetPolicyNode : public cmGeneratorExpressionNode static const struct InstallPrefixNode : public cmGeneratorExpressionNode { - InstallPrefixNode() {} + InstallPrefixNode() {} // NOLINT(modernize-use-equals-default) bool GeneratesContent() const override { return true; } int NumExpectedParameters() const override { return 0; } @@ -1953,7 +1953,7 @@ struct TargetFilesystemArtifactResultGetter template struct TargetFilesystemArtifact : public cmGeneratorExpressionNode { - TargetFilesystemArtifact() {} + TargetFilesystemArtifact() {} // NOLINT(modernize-use-equals-default) int NumExpectedParameters() const override { return 1; } @@ -2009,7 +2009,9 @@ struct TargetFilesystemArtifact : public cmGeneratorExpressionNode template struct TargetFilesystemArtifactNodeGroup { - TargetFilesystemArtifactNodeGroup() {} + TargetFilesystemArtifactNodeGroup() // NOLINT(modernize-use-equals-default) + { + } TargetFilesystemArtifact File; TargetFilesystemArtifact FileName; @@ -2037,7 +2039,7 @@ static const TargetFilesystemArtifact& parameters, diff --git a/Source/cmGeneratorExpressionNode.h b/Source/cmGeneratorExpressionNode.h index ece1c11..3dbfc6e 100644 --- a/Source/cmGeneratorExpressionNode.h +++ b/Source/cmGeneratorExpressionNode.h @@ -22,7 +22,7 @@ struct cmGeneratorExpressionNode OneOrMoreParameters = -1, OneOrZeroParameters = -2 }; - virtual ~cmGeneratorExpressionNode() {} + virtual ~cmGeneratorExpressionNode() = default; virtual bool GeneratesContent() const { return true; } diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index d9221f0..8afb548 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -111,7 +111,7 @@ public: std::set ExpectedXamlHeaders; std::set ExpectedXamlSources; bool Initialized = false; - KindedSources() {} + KindedSources() = default; }; /** Get all sources needed for a configuration with kinds assigned. */ @@ -562,7 +562,7 @@ public: }; struct SourceFileFlags { - SourceFileFlags() {} + SourceFileFlags() = default; SourceFileType Type = SourceFileTypeNormal; const char* MacFolder = nullptr; // location inside Mac content folders }; @@ -750,7 +750,7 @@ private: struct CompatibleInterfaces : public CompatibleInterfacesBase { - CompatibleInterfaces() {} + CompatibleInterfaces() = default; bool Done = false; }; mutable std::map CompatibleInterfacesMap; @@ -764,7 +764,7 @@ private: struct LinkImplClosure : public std::vector { - LinkImplClosure() {} + LinkImplClosure() = default; bool Done = false; }; mutable std::map LinkImplClosureMap; @@ -784,7 +784,7 @@ private: // Cache import information from properties for each configuration. struct ImportInfo { - ImportInfo() {} + ImportInfo() = default; bool NoSOName = false; ManagedType Managed = Native; unsigned int Multiplicity = 0; diff --git a/Source/cmGlobVerificationManager.h b/Source/cmGlobVerificationManager.h index c293a76..1024328 100644 --- a/Source/cmGlobVerificationManager.h +++ b/Source/cmGlobVerificationManager.h @@ -22,7 +22,7 @@ class cmGlobVerificationManager { public: - cmGlobVerificationManager() {} + cmGlobVerificationManager() = default; protected: ///! Save verification script for given makefile. @@ -73,7 +73,7 @@ private: bool Initialized = false; std::vector Files; std::vector> Backtraces; - CacheEntryValue() {} + CacheEntryValue() = default; }; typedef std::map CacheEntryMap; diff --git a/Source/cmGlobalCommonGenerator.cxx b/Source/cmGlobalCommonGenerator.cxx index 3b7de4b..bf992b4 100644 --- a/Source/cmGlobalCommonGenerator.cxx +++ b/Source/cmGlobalCommonGenerator.cxx @@ -9,6 +9,4 @@ cmGlobalCommonGenerator::cmGlobalCommonGenerator(cmake* cm) { } -cmGlobalCommonGenerator::~cmGlobalCommonGenerator() -{ -} +cmGlobalCommonGenerator::~cmGlobalCommonGenerator() = default; diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 36d3d10..3bf6309 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -479,7 +479,7 @@ protected: std::vector Depends; std::string WorkingDir; bool UsesTerminal = false; - GlobalTargetInfo() {} + GlobalTargetInfo() = default; }; void CreateDefaultGlobalTargets(std::vector& targets); @@ -608,7 +608,7 @@ private: long LastDiskTime = -1; std::set All; std::set Generated; - DirectoryContent() {} + DirectoryContent() = default; }; std::map DirectoryContentMap; diff --git a/Source/cmGlobalGeneratorFactory.h b/Source/cmGlobalGeneratorFactory.h index d4f772b..bb5f74c 100644 --- a/Source/cmGlobalGeneratorFactory.h +++ b/Source/cmGlobalGeneratorFactory.h @@ -20,7 +20,7 @@ struct cmDocumentationEntry; class cmGlobalGeneratorFactory { public: - virtual ~cmGlobalGeneratorFactory() {} + virtual ~cmGlobalGeneratorFactory() = default; /** Create a GlobalGenerator */ virtual cmGlobalGenerator* CreateGlobalGenerator(const std::string& n, diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 00fa348..fb39b30 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -183,7 +183,7 @@ public: return new cmGlobalGeneratorSimpleFactory(); } - ~cmGlobalNinjaGenerator() override {} + ~cmGlobalNinjaGenerator() override = default; cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf) override; diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index 6199586..a6b58e8 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -217,7 +217,7 @@ protected: // Store per-target progress counters. struct TargetProgress { - TargetProgress() {} + TargetProgress() = default; unsigned long NumberOfActions = 0; std::string VariableFile; std::vector Marks; diff --git a/Source/cmIfCommand.h b/Source/cmIfCommand.h index e3d30dd..c984976 100644 --- a/Source/cmIfCommand.h +++ b/Source/cmIfCommand.h @@ -25,7 +25,7 @@ public: this->ElseSeen = false; this->ScopeDepth = 0; } - ~cmIfFunctionBlocker() override {} + ~cmIfFunctionBlocker() override = default; bool IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile& mf, cmExecutionStatus&) override; bool ShouldRemove(const cmListFileFunction& lff, cmMakefile& mf) override; diff --git a/Source/cmInstallCommandArguments.cxx b/Source/cmInstallCommandArguments.cxx index 4f872f4..155f055 100644 --- a/Source/cmInstallCommandArguments.cxx +++ b/Source/cmInstallCommandArguments.cxx @@ -206,9 +206,7 @@ bool cmInstallCommandArguments::CheckPermissions( return false; } -cmInstallCommandIncludesArgument::cmInstallCommandIncludesArgument() -{ -} +cmInstallCommandIncludesArgument::cmInstallCommandIncludesArgument() = default; const std::vector& cmInstallCommandIncludesArgument::GetIncludeDirs() const diff --git a/Source/cmInstallDirectoryGenerator.cxx b/Source/cmInstallDirectoryGenerator.cxx index c9b50a3..a88c7af 100644 --- a/Source/cmInstallDirectoryGenerator.cxx +++ b/Source/cmInstallDirectoryGenerator.cxx @@ -39,9 +39,7 @@ cmInstallDirectoryGenerator::cmInstallDirectoryGenerator( } } -cmInstallDirectoryGenerator::~cmInstallDirectoryGenerator() -{ -} +cmInstallDirectoryGenerator::~cmInstallDirectoryGenerator() = default; void cmInstallDirectoryGenerator::Compute(cmLocalGenerator* lg) { diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx index 68e3f86..07094cb 100644 --- a/Source/cmInstallFilesGenerator.cxx +++ b/Source/cmInstallFilesGenerator.cxx @@ -38,9 +38,7 @@ cmInstallFilesGenerator::cmInstallFilesGenerator( } } -cmInstallFilesGenerator::~cmInstallFilesGenerator() -{ -} +cmInstallFilesGenerator::~cmInstallFilesGenerator() = default; void cmInstallFilesGenerator::Compute(cmLocalGenerator* lg) { diff --git a/Source/cmInstallGenerator.cxx b/Source/cmInstallGenerator.cxx index 2b23658..d139190 100644 --- a/Source/cmInstallGenerator.cxx +++ b/Source/cmInstallGenerator.cxx @@ -18,9 +18,7 @@ cmInstallGenerator::cmInstallGenerator( { } -cmInstallGenerator::~cmInstallGenerator() -{ -} +cmInstallGenerator::~cmInstallGenerator() = default; bool cmInstallGenerator::HaveInstall() { diff --git a/Source/cmInstallScriptGenerator.cxx b/Source/cmInstallScriptGenerator.cxx index 12e87c7..a513958 100644 --- a/Source/cmInstallScriptGenerator.cxx +++ b/Source/cmInstallScriptGenerator.cxx @@ -27,9 +27,7 @@ cmInstallScriptGenerator::cmInstallScriptGenerator(const char* script, } } -cmInstallScriptGenerator::~cmInstallScriptGenerator() -{ -} +cmInstallScriptGenerator::~cmInstallScriptGenerator() = default; void cmInstallScriptGenerator::Compute(cmLocalGenerator* lg) { diff --git a/Source/cmInstallSubdirectoryGenerator.cxx b/Source/cmInstallSubdirectoryGenerator.cxx index ca9f134..ad7121f 100644 --- a/Source/cmInstallSubdirectoryGenerator.cxx +++ b/Source/cmInstallSubdirectoryGenerator.cxx @@ -20,9 +20,7 @@ cmInstallSubdirectoryGenerator::cmInstallSubdirectoryGenerator( { } -cmInstallSubdirectoryGenerator::~cmInstallSubdirectoryGenerator() -{ -} +cmInstallSubdirectoryGenerator::~cmInstallSubdirectoryGenerator() = default; bool cmInstallSubdirectoryGenerator::HaveInstall() { diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 08f46aa..6922d53 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -39,9 +39,7 @@ cmInstallTargetGenerator::cmInstallTargetGenerator( this->NamelinkMode = NamelinkModeNone; } -cmInstallTargetGenerator::~cmInstallTargetGenerator() -{ -} +cmInstallTargetGenerator::~cmInstallTargetGenerator() = default; void cmInstallTargetGenerator::GenerateScript(std::ostream& os) { diff --git a/Source/cmInstalledFile.cxx b/Source/cmInstalledFile.cxx index 9f61e5b..537b4ec 100644 --- a/Source/cmInstalledFile.cxx +++ b/Source/cmInstalledFile.cxx @@ -9,18 +9,14 @@ #include -cmInstalledFile::cmInstalledFile() -{ -} +cmInstalledFile::cmInstalledFile() = default; cmInstalledFile::~cmInstalledFile() { delete NameExpression; } -cmInstalledFile::Property::Property() -{ -} +cmInstalledFile::Property::Property() = default; cmInstalledFile::Property::~Property() { diff --git a/Source/cmLinkItem.cxx b/Source/cmLinkItem.cxx index b035c8c..9b03ad0 100644 --- a/Source/cmLinkItem.cxx +++ b/Source/cmLinkItem.cxx @@ -6,9 +6,7 @@ #include // IWYU pragma: keep -cmLinkItem::cmLinkItem() -{ -} +cmLinkItem::cmLinkItem() = default; cmLinkItem::cmLinkItem(std::string n, cmListFileBacktrace bt) : String(std::move(n)) diff --git a/Source/cmLinkItem.h b/Source/cmLinkItem.h index d2459db..d50b5fc 100644 --- a/Source/cmLinkItem.h +++ b/Source/cmLinkItem.h @@ -78,12 +78,12 @@ struct cmLinkInterface : public cmLinkInterfaceLibraries bool ImplementationIsInterface = false; - cmLinkInterface() {} + cmLinkInterface() = default; }; struct cmOptionalLinkInterface : public cmLinkInterface { - cmOptionalLinkInterface() {} + cmOptionalLinkInterface() = default; bool LibrariesDone = false; bool AllDone = false; bool Exists = false; @@ -105,7 +105,7 @@ struct cmLinkImplementation : public cmLinkImplementationLibraries // Cache link implementation computation from each configuration. struct cmOptionalLinkImplementation : public cmLinkImplementation { - cmOptionalLinkImplementation() {} + cmOptionalLinkImplementation() = default; bool LibrariesDone = false; bool LanguagesDone = false; bool HadHeadSensitiveCondition = false; diff --git a/Source/cmLinkLineComputer.cxx b/Source/cmLinkLineComputer.cxx index 6643990..2a8bee6 100644 --- a/Source/cmLinkLineComputer.cxx +++ b/Source/cmLinkLineComputer.cxx @@ -23,9 +23,7 @@ cmLinkLineComputer::cmLinkLineComputer(cmOutputConverter* outputConverter, { } -cmLinkLineComputer::~cmLinkLineComputer() -{ -} +cmLinkLineComputer::~cmLinkLineComputer() = default; void cmLinkLineComputer::SetUseWatcomQuote(bool useWatcomQuote) { diff --git a/Source/cmLinkLineDeviceComputer.cxx b/Source/cmLinkLineDeviceComputer.cxx index a93ec12..a403dc9 100644 --- a/Source/cmLinkLineDeviceComputer.cxx +++ b/Source/cmLinkLineDeviceComputer.cxx @@ -21,9 +21,7 @@ cmLinkLineDeviceComputer::cmLinkLineDeviceComputer( { } -cmLinkLineDeviceComputer::~cmLinkLineDeviceComputer() -{ -} +cmLinkLineDeviceComputer::~cmLinkLineDeviceComputer() = default; static bool cmLinkItemValidForDevice(std::string const& item) { diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index 05b22cf..7c1076c 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -426,7 +426,7 @@ public: class TransformSelector { public: - virtual ~TransformSelector() {} + virtual ~TransformSelector() = default; std::string Tag; @@ -580,7 +580,7 @@ private: class TransformAction { public: - virtual ~TransformAction() {} + virtual ~TransformAction() = default; virtual std::string Transform(const std::string& input) = 0; }; diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h index 529c389..e7b1c87 100644 --- a/Source/cmListFileCache.h +++ b/Source/cmListFileCache.h @@ -29,12 +29,12 @@ struct cmCommandContext { std::string Lower; std::string Original; - cmCommandName() {} + cmCommandName() = default; cmCommandName(std::string const& name) { *this = name; } cmCommandName& operator=(std::string const& name); } Name; long Line = 0; - cmCommandContext() {} + cmCommandContext() = default; cmCommandContext(const char* name, int line) : Name(name) , Line(line) @@ -50,7 +50,7 @@ struct cmListFileArgument Quoted, Bracket }; - cmListFileArgument() {} + cmListFileArgument() = default; cmListFileArgument(std::string v, Delimiter d, long line) : Value(std::move(v)) , Delim(d) @@ -73,7 +73,7 @@ public: std::string Name; std::string FilePath; long Line = 0; - cmListFileContext() {} + cmListFileContext() = default; static cmListFileContext FromCommandContext(cmCommandContext const& lfcc, std::string const& fileName) diff --git a/Source/cmLocalCommonGenerator.cxx b/Source/cmLocalCommonGenerator.cxx index c6d2c58..c5fc325 100644 --- a/Source/cmLocalCommonGenerator.cxx +++ b/Source/cmLocalCommonGenerator.cxx @@ -26,9 +26,7 @@ cmLocalCommonGenerator::cmLocalCommonGenerator(cmGlobalGenerator* gg, } } -cmLocalCommonGenerator::~cmLocalCommonGenerator() -{ -} +cmLocalCommonGenerator::~cmLocalCommonGenerator() = default; std::string cmLocalCommonGenerator::GetTargetFortranFlags( cmGeneratorTarget const* target, std::string const& config) diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index a8647b1..2ffb8bd 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -46,9 +46,7 @@ cmLocalNinjaGenerator::CreateRulePlaceholderExpander() const return ret; } -cmLocalNinjaGenerator::~cmLocalNinjaGenerator() -{ -} +cmLocalNinjaGenerator::~cmLocalNinjaGenerator() = default; void cmLocalNinjaGenerator::Generate() { diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index c50dcb7..0954645 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -98,9 +98,7 @@ cmLocalUnixMakefileGenerator3::cmLocalUnixMakefileGenerator3( this->BorlandMakeCurlyHack = false; } -cmLocalUnixMakefileGenerator3::~cmLocalUnixMakefileGenerator3() -{ -} +cmLocalUnixMakefileGenerator3::~cmLocalUnixMakefileGenerator3() = default; void cmLocalUnixMakefileGenerator3::Generate() { diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 5268e6b..a3a0ddf 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -267,7 +267,7 @@ private: { cmGeneratorTarget* Target = nullptr; std::string Language; - LocalObjectEntry() {} + LocalObjectEntry() = default; LocalObjectEntry(cmGeneratorTarget* t, std::string lang) : Target(t) , Language(std::move(lang)) @@ -279,7 +279,7 @@ private: bool HasSourceExtension = false; bool HasPreprocessRule = false; bool HasAssembleRule = false; - LocalObjectInfo() {} + LocalObjectInfo() = default; }; void GetLocalObjectFiles( std::map& localObjectFiles); diff --git a/Source/cmLocalXCodeGenerator.cxx b/Source/cmLocalXCodeGenerator.cxx index 92c958d..9c36627 100644 --- a/Source/cmLocalXCodeGenerator.cxx +++ b/Source/cmLocalXCodeGenerator.cxx @@ -19,9 +19,7 @@ cmLocalXCodeGenerator::cmLocalXCodeGenerator(cmGlobalGenerator* gg, this->EmitUniversalBinaryFlags = false; } -cmLocalXCodeGenerator::~cmLocalXCodeGenerator() -{ -} +cmLocalXCodeGenerator::~cmLocalXCodeGenerator() = default; std::string cmLocalXCodeGenerator::GetTargetDirectory( cmGeneratorTarget const*) const diff --git a/Source/cmMachO.cxx b/Source/cmMachO.cxx index 7368812..d4af1e0 100644 --- a/Source/cmMachO.cxx +++ b/Source/cmMachO.cxx @@ -91,7 +91,7 @@ public: : Swap(_swap) { } - virtual ~cmMachOHeaderAndLoadCommands() {} + virtual ~cmMachOHeaderAndLoadCommands() = default; virtual bool read_mach_o(cmsys::ifstream& fin) = 0; diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 411c0c3..1b94ab3 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -17,10 +17,10 @@ class cmMacroHelperCommand : public cmCommand { public: - cmMacroHelperCommand() {} + cmMacroHelperCommand() = default; ///! clean up any memory allocated by the macro - ~cmMacroHelperCommand() override {} + ~cmMacroHelperCommand() override = default; /** * This is a virtual constructor for the command. diff --git a/Source/cmMacroCommand.h b/Source/cmMacroCommand.h index d967388..8f5f540 100644 --- a/Source/cmMacroCommand.h +++ b/Source/cmMacroCommand.h @@ -19,7 +19,7 @@ class cmMacroFunctionBlocker : public cmFunctionBlocker { public: cmMacroFunctionBlocker() { this->Depth = 0; } - ~cmMacroFunctionBlocker() override {} + ~cmMacroFunctionBlocker() override = default; bool IsFunctionBlocked(const cmListFileFunction&, cmMakefile& mf, cmExecutionStatus&) override; bool ShouldRemove(const cmListFileFunction&, cmMakefile& mf) override; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 500776e..fc8348f 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2712,7 +2712,7 @@ typedef enum } t_domain; struct t_lookup { - t_lookup() {} + t_lookup() = default; t_domain domain = NORMAL; size_t loc = 0; }; diff --git a/Source/cmNewLineStyle.cxx b/Source/cmNewLineStyle.cxx index 12c18ee..3f6523e 100644 --- a/Source/cmNewLineStyle.cxx +++ b/Source/cmNewLineStyle.cxx @@ -4,9 +4,7 @@ #include -cmNewLineStyle::cmNewLineStyle() -{ -} +cmNewLineStyle::cmNewLineStyle() = default; bool cmNewLineStyle::IsValid() const { diff --git a/Source/cmNinjaUtilityTargetGenerator.cxx b/Source/cmNinjaUtilityTargetGenerator.cxx index cc6d4b9..c707fd0 100644 --- a/Source/cmNinjaUtilityTargetGenerator.cxx +++ b/Source/cmNinjaUtilityTargetGenerator.cxx @@ -27,9 +27,7 @@ cmNinjaUtilityTargetGenerator::cmNinjaUtilityTargetGenerator( { } -cmNinjaUtilityTargetGenerator::~cmNinjaUtilityTargetGenerator() -{ -} +cmNinjaUtilityTargetGenerator::~cmNinjaUtilityTargetGenerator() = default; void cmNinjaUtilityTargetGenerator::Generate() { diff --git a/Source/cmOSXBundleGenerator.h b/Source/cmOSXBundleGenerator.h index ba5bee0..3dea6cc 100644 --- a/Source/cmOSXBundleGenerator.h +++ b/Source/cmOSXBundleGenerator.h @@ -31,7 +31,7 @@ public: struct MacOSXContentGeneratorType { - virtual ~MacOSXContentGeneratorType() {} + virtual ~MacOSXContentGeneratorType() = default; virtual void operator()(cmSourceFile const& source, const char* pkgloc) = 0; }; diff --git a/Source/cmOrderDirectories.cxx b/Source/cmOrderDirectories.cxx index 961e2b2..2c28fc0 100644 --- a/Source/cmOrderDirectories.cxx +++ b/Source/cmOrderDirectories.cxx @@ -48,7 +48,7 @@ public: this->FileName = cmSystemTools::GetFilenameName(file); } } - virtual ~cmOrderDirectoriesConstraint() {} + virtual ~cmOrderDirectoriesConstraint() = default; void AddDirectory() { diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx index ab1e699..b0255e0 100644 --- a/Source/cmOutputRequiredFilesCommand.cxx +++ b/Source/cmOutputRequiredFilesCommand.cxx @@ -28,7 +28,7 @@ public: * Construct with dependency generation marked not done; instance * not placed in cmMakefile's list. */ - cmDependInformation() {} + cmDependInformation() = default; /** * The set of files on which this one depends. diff --git a/Source/cmProcessOutput.cxx b/Source/cmProcessOutput.cxx index e4ca426..e80ea5c 100644 --- a/Source/cmProcessOutput.cxx +++ b/Source/cmProcessOutput.cxx @@ -48,9 +48,7 @@ cmProcessOutput::cmProcessOutput(Encoding encoding, unsigned int maxSize) #endif } -cmProcessOutput::~cmProcessOutput() -{ -} +cmProcessOutput::~cmProcessOutput() = default; bool cmProcessOutput::DecodeText(std::string raw, std::string& decoded, size_t id) diff --git a/Source/cmProcessTools.h b/Source/cmProcessTools.h index da3693d..7616316 100644 --- a/Source/cmProcessTools.h +++ b/Source/cmProcessTools.h @@ -34,7 +34,7 @@ public: return this->Process(data, static_cast(strlen(data))); } - virtual ~OutputParser() {} + virtual ~OutputParser() = default; protected: /** Implement in a subclass to process a chunk of data. It should diff --git a/Source/cmQtAutoGenGlobalInitializer.cxx b/Source/cmQtAutoGenGlobalInitializer.cxx index 431c5bc..95a297c 100644 --- a/Source/cmQtAutoGenGlobalInitializer.cxx +++ b/Source/cmQtAutoGenGlobalInitializer.cxx @@ -129,9 +129,7 @@ cmQtAutoGenGlobalInitializer::cmQtAutoGenGlobalInitializer( } } -cmQtAutoGenGlobalInitializer::~cmQtAutoGenGlobalInitializer() -{ -} +cmQtAutoGenGlobalInitializer::~cmQtAutoGenGlobalInitializer() = default; void cmQtAutoGenGlobalInitializer::GetOrCreateGlobalTarget( cmLocalGenerator* localGen, std::string const& name, diff --git a/Source/cmQtAutoGenInitializer.h b/Source/cmQtAutoGenInitializer.h index eefbaf0..7359c76 100644 --- a/Source/cmQtAutoGenInitializer.h +++ b/Source/cmQtAutoGenInitializer.h @@ -26,7 +26,7 @@ public: class Qrc { public: - Qrc() {} + Qrc() = default; public: std::string LockFile; diff --git a/Source/cmQtAutoGeneratorMocUic.cxx b/Source/cmQtAutoGeneratorMocUic.cxx index 068f65c..bc496ac 100644 --- a/Source/cmQtAutoGeneratorMocUic.cxx +++ b/Source/cmQtAutoGeneratorMocUic.cxx @@ -1144,9 +1144,7 @@ cmQtAutoGeneratorMocUic::cmQtAutoGeneratorMocUic() UVRequest().init(*UVLoop(), &cmQtAutoGeneratorMocUic::UVPollStage, this); } -cmQtAutoGeneratorMocUic::~cmQtAutoGeneratorMocUic() -{ -} +cmQtAutoGeneratorMocUic::~cmQtAutoGeneratorMocUic() = default; bool cmQtAutoGeneratorMocUic::Init(cmMakefile* makefile) { diff --git a/Source/cmQtAutoGeneratorRcc.cxx b/Source/cmQtAutoGeneratorRcc.cxx index 87c8d18..43ff172 100644 --- a/Source/cmQtAutoGeneratorRcc.cxx +++ b/Source/cmQtAutoGeneratorRcc.cxx @@ -20,9 +20,7 @@ cmQtAutoGeneratorRcc::cmQtAutoGeneratorRcc() UVRequest().init(*UVLoop(), &cmQtAutoGeneratorRcc::UVPollStage, this); } -cmQtAutoGeneratorRcc::~cmQtAutoGeneratorRcc() -{ -} +cmQtAutoGeneratorRcc::~cmQtAutoGeneratorRcc() = default; bool cmQtAutoGeneratorRcc::Init(cmMakefile* makefile) { diff --git a/Source/cmScriptGenerator.cxx b/Source/cmScriptGenerator.cxx index ae0a158..9182b41 100644 --- a/Source/cmScriptGenerator.cxx +++ b/Source/cmScriptGenerator.cxx @@ -16,9 +16,7 @@ cmScriptGenerator::cmScriptGenerator(std::string config_var, { } -cmScriptGenerator::~cmScriptGenerator() -{ -} +cmScriptGenerator::~cmScriptGenerator() = default; void cmScriptGenerator::Generate( std::ostream& os, const std::string& config, diff --git a/Source/cmScriptGenerator.h b/Source/cmScriptGenerator.h index 725cbc6..5792ba8 100644 --- a/Source/cmScriptGenerator.h +++ b/Source/cmScriptGenerator.h @@ -12,7 +12,7 @@ class cmScriptGeneratorIndent { public: - cmScriptGeneratorIndent() {} + cmScriptGeneratorIndent() = default; cmScriptGeneratorIndent(int level) : Level(level) { diff --git a/Source/cmSearchPath.cxx b/Source/cmSearchPath.cxx index 5dd4413..0f51e0e 100644 --- a/Source/cmSearchPath.cxx +++ b/Source/cmSearchPath.cxx @@ -16,9 +16,7 @@ cmSearchPath::cmSearchPath(cmFindCommon* findCmd) { } -cmSearchPath::~cmSearchPath() -{ -} +cmSearchPath::~cmSearchPath() = default; void cmSearchPath::ExtractWithout(const std::set& ignore, std::vector& outPaths, diff --git a/Source/cmServerConnection.cxx b/Source/cmServerConnection.cxx index 5caa019..844a858 100644 --- a/Source/cmServerConnection.cxx +++ b/Source/cmServerConnection.cxx @@ -119,9 +119,7 @@ cmServerStdIoConnection::cmServerStdIoConnection() { } -cmConnectionBufferStrategy::~cmConnectionBufferStrategy() -{ -} +cmConnectionBufferStrategy::~cmConnectionBufferStrategy() = default; void cmConnectionBufferStrategy::clear() { diff --git a/Source/cmSourceFileLocation.cxx b/Source/cmSourceFileLocation.cxx index 3dab638..13d2d7e 100644 --- a/Source/cmSourceFileLocation.cxx +++ b/Source/cmSourceFileLocation.cxx @@ -11,9 +11,7 @@ #include -cmSourceFileLocation::cmSourceFileLocation() -{ -} +cmSourceFileLocation::cmSourceFileLocation() = default; cmSourceFileLocation::cmSourceFileLocation(const cmSourceFileLocation& loc) : Makefile(loc.Makefile) diff --git a/Source/cmStringReplaceHelper.h b/Source/cmStringReplaceHelper.h index 5cebde7..b3e4704 100644 --- a/Source/cmStringReplaceHelper.h +++ b/Source/cmStringReplaceHelper.h @@ -48,7 +48,7 @@ private: : Number(n) { } - RegexReplacement() {} + RegexReplacement() = default; int Number; std::string Value; diff --git a/Source/cmTest.cxx b/Source/cmTest.cxx index 4d0cbaa..7d45cf5 100644 --- a/Source/cmTest.cxx +++ b/Source/cmTest.cxx @@ -14,9 +14,7 @@ cmTest::cmTest(cmMakefile* mf) this->OldStyle = true; } -cmTest::~cmTest() -{ -} +cmTest::~cmTest() = default; cmListFileBacktrace const& cmTest::GetBacktrace() const { diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx index 6032701..5102613 100644 --- a/Source/cmTestGenerator.cxx +++ b/Source/cmTestGenerator.cxx @@ -26,9 +26,7 @@ cmTestGenerator::cmTestGenerator( this->LG = nullptr; } -cmTestGenerator::~cmTestGenerator() -{ -} +cmTestGenerator::~cmTestGenerator() = default; void cmTestGenerator::Compute(cmLocalGenerator* lg) { diff --git a/Source/cmTimestamp.h b/Source/cmTimestamp.h index 2f75acb..6b6c4eb 100644 --- a/Source/cmTimestamp.h +++ b/Source/cmTimestamp.h @@ -15,7 +15,7 @@ class cmTimestamp { public: - cmTimestamp() {} + cmTimestamp() = default; std::string CurrentTime(const std::string& formatString, bool utcFlag); diff --git a/Source/cmUVHandlePtr.h b/Source/cmUVHandlePtr.h index 73ee334..d42969e 100644 --- a/Source/cmUVHandlePtr.h +++ b/Source/cmUVHandlePtr.h @@ -86,8 +86,8 @@ public: } // Dtor and ctor need to be inline defined like this for default ctors and - // dtors to work. - uv_handle_ptr_base_() {} + // dtors to work. Some compilers do not like '= default' here. + uv_handle_ptr_base_() {} // NOLINT(modernize-use-equals-default) uv_handle_ptr_base_(std::nullptr_t) {} ~uv_handle_ptr_base_() { reset(); } diff --git a/Source/cmVariableWatch.cxx b/Source/cmVariableWatch.cxx index bd5d19c..3df1420 100644 --- a/Source/cmVariableWatch.cxx +++ b/Source/cmVariableWatch.cxx @@ -19,13 +19,9 @@ const char* cmVariableWatch::GetAccessAsString(int access_type) return cmVariableWatchAccessStrings[access_type]; } -cmVariableWatch::cmVariableWatch() -{ -} +cmVariableWatch::cmVariableWatch() = default; -cmVariableWatch::~cmVariableWatch() -{ -} +cmVariableWatch::~cmVariableWatch() = default; bool cmVariableWatch::AddWatch(const std::string& variable, WatchMethod method, void* client_data /*=0*/, diff --git a/Source/cmVariableWatch.h b/Source/cmVariableWatch.h index 2f444ed..d5d96ef 100644 --- a/Source/cmVariableWatch.h +++ b/Source/cmVariableWatch.h @@ -66,7 +66,7 @@ protected: WatchMethod Method = nullptr; void* ClientData = nullptr; DeleteData DeleteDataCall = nullptr; - Pair() {} + Pair() = default; ~Pair() { if (this->DeleteDataCall && this->ClientData) { diff --git a/Source/cmVariableWatchCommand.cxx b/Source/cmVariableWatchCommand.cxx index 03e0059..0c227e1 100644 --- a/Source/cmVariableWatchCommand.cxx +++ b/Source/cmVariableWatchCommand.cxx @@ -84,9 +84,7 @@ static void deleteVariableWatchCallbackData(void* client_data) delete data; } -cmVariableWatchCommand::cmVariableWatchCommand() -{ -} +cmVariableWatchCommand::cmVariableWatchCommand() = default; cmVariableWatchCommand::~cmVariableWatchCommand() { diff --git a/Source/cm_codecvt.cxx b/Source/cm_codecvt.cxx index 9519f91..821c112 100644 --- a/Source/cm_codecvt.cxx +++ b/Source/cm_codecvt.cxx @@ -38,9 +38,7 @@ codecvt::codecvt(Encoding e) } } -codecvt::~codecvt() -{ -} +codecvt::~codecvt() = default; bool codecvt::do_always_noconv() const throw() { ----------------------------------------------------------------------- Summary of changes: .clang-tidy | 1 - Source/CPack/IFW/cmCPackIFWGenerator.cxx | 4 +- Source/CPack/IFW/cmCPackIFWInstaller.cxx | 4 +- Source/CPack/IFW/cmCPackIFWPackage.cxx | 4 +- Source/CPack/cmCPack7zGenerator.cxx | 4 +- Source/CPack/cmCPackArchiveGenerator.cxx | 4 +- Source/CPack/cmCPackBundleGenerator.cxx | 8 +-- Source/CPack/cmCPackDebGenerator.cxx | 8 +-- Source/CPack/cmCPackDragNDropGenerator.cxx | 4 +- Source/CPack/cmCPackFreeBSDGenerator.cxx | 6 +- Source/CPack/cmCPackNSISGenerator.cxx | 4 +- Source/CPack/cmCPackOSXX11Generator.cxx | 8 +-- Source/CPack/cmCPackPKGGenerator.cxx | 4 +- Source/CPack/cmCPackPackageMakerGenerator.cxx | 4 +- Source/CPack/cmCPackProductBuildGenerator.cxx | 4 +- Source/CPack/cmCPackRPMGenerator.cxx | 8 +-- Source/CPack/cmCPackSTGZGenerator.cxx | 8 +-- Source/CPack/cmCPackTGZGenerator.cxx | 4 +- Source/CPack/cmCPackTXZGenerator.cxx | 4 +- Source/CPack/cmCPackTarBZip2Generator.cxx | 4 +- Source/CPack/cmCPackTarCompressGenerator.cxx | 4 +- Source/CPack/cmCPackZIPGenerator.cxx | 4 +- Source/CTest/cmCTestBZR.cxx | 4 +- Source/CTest/cmCTestBuildHandler.cxx | 2 +- Source/CTest/cmCTestCVS.cxx | 4 +- Source/CTest/cmCTestConfigureHandler.cxx | 4 +- Source/CTest/cmCTestCoverageHandler.cxx | 4 +- Source/CTest/cmCTestGIT.cxx | 5 +- Source/CTest/cmCTestGenericHandler.cxx | 4 +- Source/CTest/cmCTestGlobalVC.cxx | 4 +- Source/CTest/cmCTestHG.cxx | 4 +- Source/CTest/cmCTestMultiProcessHandler.cxx | 5 +- Source/CTest/cmCTestP4.cxx | 4 +- Source/CTest/cmCTestRunTest.h | 2 - Source/CTest/cmCTestSVN.cxx | 4 +- Source/CTest/cmCTestScriptHandler.cxx | 2 - Source/CTest/cmCTestSubmitHandler.cxx | 6 +- Source/CTest/cmCTestUpdateHandler.cxx | 4 +- Source/CTest/cmCTestVC.cxx | 4 +- Source/CTest/cmParseBlanketJSCoverage.cxx | 2 +- Source/CTest/cmParseCoberturaCoverage.cxx | 17 ++--- Source/CTest/cmParseDelphiCoverage.cxx | 2 +- Source/CTest/cmParseJacocoCoverage.cxx | 5 -- Source/CTest/cmParseMumpsCoverage.cxx | 4 +- Source/CTest/cmProcess.cxx | 4 +- Source/CursesDialog/cmCursesLabelWidget.cxx | 4 +- Source/QtDialog/FirstConfigure.cxx | 20 ++---- Source/QtDialog/QCMakeCacheView.cxx | 4 +- Source/cmBase32.cxx | 8 +-- Source/cmCPluginAPI.cxx | 1 - Source/cmCTest.h | 2 - Source/cmCacheManager.h | 1 - Source/cmCommand.h | 4 +- Source/cmCommandArgumentsHelper.h | 4 +- Source/cmCommonTargetGenerator.cxx | 4 +- Source/cmComputeComponentGraph.cxx | 4 +- Source/cmComputeLinkDepends.h | 8 --- Source/cmComputeLinkInformation.h | 2 +- Source/cmComputeTargetDepends.cxx | 4 +- Source/cmConnection.cxx | 4 +- Source/cmConnection.h | 2 +- Source/cmDefinitions.h | 2 +- Source/cmDependsC.cxx | 4 +- Source/cmDependsC.h | 1 - Source/cmDependsFortran.cxx | 4 +- Source/cmDependsJava.cxx | 8 +-- Source/cmDocumentation.h | 1 - Source/cmDocumentationEntry.h | 2 +- Source/cmDocumentationFormatter.cxx | 8 +-- Source/cmDynamicLoader.cxx | 4 +- Source/cmDynamicLoader.h | 4 +- Source/cmExecutionStatus.h | 2 - Source/cmExpandedCommandArgument.cxx | 4 +- Source/cmExportFileGenerator.h | 2 +- Source/cmExprParserHelper.cxx | 4 +- Source/cmExternalMakefileProjectGenerator.cxx | 4 +- Source/cmExternalMakefileProjectGenerator.h | 2 +- Source/cmExtraCodeBlocksGenerator.cxx | 4 +- Source/cmExtraKateGenerator.cxx | 4 +- Source/cmFileCommand.cxx | 3 +- Source/cmFileLockPool.cxx | 8 +-- Source/cmFileLockUnix.cxx | 4 +- Source/cmFileMonitor.cxx | 6 -- Source/cmFilePathChecksum.cxx | 4 +- Source/cmFindCommon.cxx | 4 +- Source/cmFindLibraryCommand.cxx | 1 - Source/cmFindPackageCommand.cxx | 5 +- Source/cmFunctionBlocker.h | 2 +- Source/cmFunctionCommand.cxx | 5 -- Source/cmFunctionCommand.h | 4 +- Source/cmGeneratedFileStream.cxx | 4 +- Source/cmGeneratorExpression.cxx | 4 +- Source/cmGeneratorExpressionEvaluator.h | 4 +- Source/cmGeneratorExpressionLexer.cxx | 4 +- Source/cmGeneratorExpressionNode.cxx | 96 ++++++++++++++------------- Source/cmGeneratorExpressionNode.h | 2 +- Source/cmGeneratorTarget.h | 5 -- Source/cmGlobVerificationManager.h | 4 -- Source/cmGlobalCommonGenerator.cxx | 4 +- Source/cmGlobalGenerator.h | 2 - Source/cmGlobalGeneratorFactory.h | 2 +- Source/cmGlobalNinjaGenerator.h | 2 - Source/cmGlobalUnixMakefileGenerator3.h | 1 - Source/cmIfCommand.h | 13 +--- Source/cmInstallCommandArguments.cxx | 4 +- Source/cmInstallDirectoryGenerator.cxx | 4 +- Source/cmInstallFilesGenerator.cxx | 4 +- Source/cmInstallGenerator.cxx | 4 +- Source/cmInstallScriptGenerator.cxx | 4 +- Source/cmInstallSubdirectoryGenerator.cxx | 4 +- Source/cmInstallTargetGenerator.cxx | 4 +- Source/cmInstalledFile.cxx | 8 +-- Source/cmLinkItem.cxx | 4 +- Source/cmLinkItem.h | 4 -- Source/cmLinkLineComputer.cxx | 4 +- Source/cmLinkLineDeviceComputer.cxx | 4 +- Source/cmListCommand.cxx | 4 +- Source/cmListFileCache.h | 16 +---- Source/cmLocalCommonGenerator.cxx | 4 +- Source/cmLocalNinjaGenerator.cxx | 4 +- Source/cmLocalUnixMakefileGenerator3.cxx | 4 +- Source/cmLocalUnixMakefileGenerator3.h | 3 +- Source/cmLocalXCodeGenerator.cxx | 4 +- Source/cmMachO.cxx | 2 +- Source/cmMacroCommand.cxx | 5 -- Source/cmMacroCommand.h | 4 +- Source/cmMakefile.cxx | 1 - Source/cmNewLineStyle.cxx | 4 +- Source/cmNinjaUtilityTargetGenerator.cxx | 4 +- Source/cmOSXBundleGenerator.h | 2 +- Source/cmOrderDirectories.cxx | 2 +- Source/cmOutputRequiredFilesCommand.cxx | 2 +- Source/cmProcessOutput.cxx | 4 +- Source/cmProcessTools.h | 2 +- Source/cmQtAutoGenGlobalInitializer.cxx | 4 +- Source/cmQtAutoGenInitializer.h | 3 - Source/cmQtAutoGenerator.h | 3 - Source/cmQtAutoGeneratorMocUic.cxx | 4 +- Source/cmQtAutoGeneratorRcc.cxx | 4 +- Source/cmScriptGenerator.cxx | 4 +- Source/cmScriptGenerator.h | 2 +- Source/cmSearchPath.cxx | 4 +- Source/cmServerConnection.cxx | 4 +- Source/cmSourceFileLocation.cxx | 4 +- Source/cmStringReplaceHelper.h | 2 +- Source/cmTest.cxx | 4 +- Source/cmTestGenerator.cxx | 4 +- Source/cmTimestamp.h | 2 - Source/cmUVHandlePtr.h | 4 +- Source/cmVSSetupHelper.h | 2 - Source/cmVariableWatch.cxx | 8 +-- Source/cmVariableWatch.h | 1 - Source/cmVariableWatchCommand.cxx | 4 +- Source/cm_codecvt.cxx | 4 +- 154 files changed, 205 insertions(+), 529 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Wed Jan 30 00:03:06 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 30 Jan 2019 00:03:06 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-1192-gd21769d Message-ID: <20190130050306.507FA11F120@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via d21769d5ddad9a76c3f2c773b8be6961ad159af3 (commit) from d75fec5a88f81a8c16cdeab46766e92a14d1d3cf (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d21769d5ddad9a76c3f2c773b8be6961ad159af3 commit d21769d5ddad9a76c3f2c773b8be6961ad159af3 Author: Kitware Robot AuthorDate: Wed Jan 30 00:01:07 2019 -0500 Commit: Kitware Robot CommitDate: Wed Jan 30 00:01:07 2019 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 0362d52..9e64efa 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 13) -set(CMake_VERSION_PATCH 20190129) +set(CMake_VERSION_PATCH 20190130) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Wed Jan 30 08:13:09 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 30 Jan 2019 08:13:09 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-1203-gd366296 Message-ID: <20190130131309.2BFCFF961A@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via d36629661197b4255da2a1864ce7ec016b415d24 (commit) via c30f9b1cdefc2fa26d89bc692001a4f1050f6038 (commit) via bcec7d0778eb87ea58d720d9e20710dc2cdfdab6 (commit) via 8ec149003e756d4a40f86b9025acb15f7ff82136 (commit) via 340e8a9c3db63cfe62382adc746e192d792fc9c6 (commit) via f201c9257d4516fc4ff3f1e0fee0515b43a111dd (commit) via 8c92db829b41243790c7dcc5300227f591a727a8 (commit) via c31b6e616d5c2d697696540ca2e8faf14160d2b0 (commit) via bcee24aecc1eaf6615eac9f24ae06acdf38845d3 (commit) via a57fcfa3e0989a74d1e1c6c24132e285cdace2b1 (commit) via 95ef818c7df5f8f92130f11cad0e9b72d470dcdc (commit) from d21769d5ddad9a76c3f2c773b8be6961ad159af3 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d36629661197b4255da2a1864ce7ec016b415d24 commit d36629661197b4255da2a1864ce7ec016b415d24 Merge: c30f9b1 f201c92 Author: Brad King AuthorDate: Wed Jan 30 13:12:21 2019 +0000 Commit: Kitware Robot CommitDate: Wed Jan 30 08:12:27 2019 -0500 Merge topic 'vendor-docs' f201c9257d DOCS: put Flang in alphabetical order Acked-by: Kitware Robot Merge-request: !2879 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c30f9b1cdefc2fa26d89bc692001a4f1050f6038 commit c30f9b1cdefc2fa26d89bc692001a4f1050f6038 Merge: bcec7d0 8c92db8 Author: Brad King AuthorDate: Wed Jan 30 13:10:19 2019 +0000 Commit: Kitware Robot CommitDate: Wed Jan 30 08:10:27 2019 -0500 Merge topic 'functional-callbacks' 8c92db829b MessageCallback: Remove unused bool& argument bcee24aecc Use `std::function` for callbacks Acked-by: Kitware Robot Acked-by: vvs31415 Acked-by: Daniel Pfeifer Merge-request: !2872 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bcec7d0778eb87ea58d720d9e20710dc2cdfdab6 commit bcec7d0778eb87ea58d720d9e20710dc2cdfdab6 Merge: 8ec1490 c31b6e6 Author: Brad King AuthorDate: Wed Jan 30 13:08:53 2019 +0000 Commit: Kitware Robot CommitDate: Wed Jan 30 08:08:59 2019 -0500 Merge topic 'copyfile-stdstring' c31b6e616d cmSystemTools: copy file member functions accept std::string params Acked-by: Kitware Robot Merge-request: !2877 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8ec149003e756d4a40f86b9025acb15f7ff82136 commit 8ec149003e756d4a40f86b9025acb15f7ff82136 Merge: 340e8a9 95ef818 Author: Brad King AuthorDate: Wed Jan 30 13:07:14 2019 +0000 Commit: Kitware Robot CommitDate: Wed Jan 30 08:07:22 2019 -0500 Merge topic 'UseJava-if-cleanup' 95ef818c7d UseJava: clean-up if() expressions Acked-by: Kitware Robot Merge-request: !2871 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=340e8a9c3db63cfe62382adc746e192d792fc9c6 commit 340e8a9c3db63cfe62382adc746e192d792fc9c6 Merge: d21769d a57fcfa Author: Brad King AuthorDate: Wed Jan 30 08:05:10 2019 -0500 Commit: Brad King CommitDate: Wed Jan 30 08:05:10 2019 -0500 Merge branch 'release-3.13' https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f201c9257d4516fc4ff3f1e0fee0515b43a111dd commit f201c9257d4516fc4ff3f1e0fee0515b43a111dd Author: Michael Hirsch, Ph.D AuthorDate: Tue Jan 29 13:30:55 2019 -0500 Commit: Michael Hirsch, Ph.D CommitDate: Tue Jan 29 13:30:55 2019 -0500 DOCS: put Flang in alphabetical order diff --git a/Help/variable/CMAKE_LANG_COMPILER_ID.rst b/Help/variable/CMAKE_LANG_COMPILER_ID.rst index 033e81c..5323880 100644 --- a/Help/variable/CMAKE_LANG_COMPILER_ID.rst +++ b/Help/variable/CMAKE_LANG_COMPILER_ID.rst @@ -17,6 +17,7 @@ include: Clang = LLVM Clang (clang.llvm.org) Cray = Cray Compiler (cray.com) Embarcadero, Borland = Embarcadero (embarcadero.com) + Flang = Flang LLVM Fortran Compiler G95 = G95 Fortran (g95.org) GNU = GNU Compiler Collection (gcc.gnu.org) GHS = Green Hills Software (www.ghs.com) @@ -28,7 +29,6 @@ include: NVIDIA = NVIDIA CUDA Compiler (nvidia.com) OpenWatcom = Open Watcom (openwatcom.org) PGI = The Portland Group (pgroup.com) - Flang = Flang Fortran Compiler PathScale = PathScale (pathscale.com) SDCC = Small Device C Compiler (sdcc.sourceforge.net) SunPro = Oracle Solaris Studio (oracle.com) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8c92db829b41243790c7dcc5300227f591a727a8 commit 8c92db829b41243790c7dcc5300227f591a727a8 Author: Regina Pfeifer AuthorDate: Tue Jan 29 15:57:24 2019 +0100 Commit: Regina Pfeifer CommitDate: Tue Jan 29 16:35:53 2019 +0100 MessageCallback: Remove unused bool& argument diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index d6f0d18..38aa1b3 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -118,7 +118,7 @@ public: : CM(cm) { cmSystemTools::SetMessageCallback( - [&s](const char* msg, const char* /*unused*/, bool& /*unused*/) { + [&s](const char* msg, const char* /*unused*/) { s += msg; s += "\n"; }); diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx index 82295b7..f2982a6 100644 --- a/Source/CursesDialog/ccmake.cxx +++ b/Source/CursesDialog/ccmake.cxx @@ -150,7 +150,7 @@ int main(int argc, char const* const* argv) } cmSystemTools::SetMessageCallback( - [myform](const char* message, const char* title, bool& /*unused*/) { + [myform](const char* message, const char* title) { myform->AddError(message, title); }); diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index 8c71cc0..065d610 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -25,8 +25,8 @@ QCMake::QCMake(QObject* p) cmSystemTools::SetRunCommandHideConsole(true); cmSystemTools::SetMessageCallback( - [this](const char* msg, const char* title, bool& cancel) { - this->messageCallback(msg, title, cancel); + [this](const char* msg, const char* title) { + this->messageCallback(msg, title); }); cmSystemTools::SetStdoutCallback( [this](const char* msg, size_t len) { this->stdoutCallback(msg, len); }); @@ -359,8 +359,7 @@ void QCMake::progressCallback(const char* msg, float percent) QCoreApplication::processEvents(); } -void QCMake::messageCallback(const char* msg, const char* /*title*/, - bool& /*stop*/) +void QCMake::messageCallback(const char* msg, const char* /*title*/) { emit this->errorMessage(QString::fromLocal8Bit(msg)); QCoreApplication::processEvents(); diff --git a/Source/QtDialog/QCMake.h b/Source/QtDialog/QCMake.h index ad85630..4f22505 100644 --- a/Source/QtDialog/QCMake.h +++ b/Source/QtDialog/QCMake.h @@ -169,7 +169,7 @@ protected: bool interruptCallback(); void progressCallback(const char* msg, float percent); - void messageCallback(const char* msg, const char* title, bool&); + void messageCallback(const char* msg, const char* title); void stdoutCallback(const char* msg, size_t len); void stderrCallback(const char* msg, size_t len); diff --git a/Source/cmServer.cxx b/Source/cmServer.cxx index 44826fa..e740c05 100644 --- a/Source/cmServer.cxx +++ b/Source/cmServer.cxx @@ -97,8 +97,8 @@ void cmServer::ProcessRequest(cmConnection* connection, } cmSystemTools::SetMessageCallback( - [&request](const char* msg, const char* title, bool& cancel) { - reportMessage(msg, title, cancel, request); + [&request](const char* msg, const char* title) { + reportMessage(msg, title, request); }); if (this->Protocol) { @@ -166,7 +166,7 @@ void cmServer::reportProgress(const char* msg, float progress, } void cmServer::reportMessage(const char* msg, const char* title, - bool& /*cancel*/, const cmServerRequest& request) + const cmServerRequest& request) { assert(msg); std::string titleString; diff --git a/Source/cmServer.h b/Source/cmServer.h index 10588a0..bedf97f 100644 --- a/Source/cmServer.h +++ b/Source/cmServer.h @@ -120,7 +120,7 @@ public: private: static void reportProgress(const char* msg, float progress, const cmServerRequest& request); - static void reportMessage(const char* msg, const char* title, bool& cancel, + static void reportMessage(const char* msg, const char* title, const cmServerRequest& request); // Handle requests: diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index f660b39..7f00ba6 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -329,7 +329,7 @@ void cmSystemTools::Message(const char* m1, const char* title) return; } if (s_MessageCallback) { - s_MessageCallback(m1, title, s_DisableMessages); + s_MessageCallback(m1, title); return; } std::cerr << m1 << std::endl << std::flush; diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 754929d..bada4e3 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -56,12 +56,11 @@ public: */ static std::string TrimWhitespace(const std::string& s); - using MessageCallback = std::function; + using MessageCallback = std::function; /** * Set the function used by GUIs to display error messages * Function gets passed: message as a const char*, - * title as a const char*, and a reference to bool that when - * set to false, will disable further messages (cancel). + * title as a const char*. */ static void SetMessageCallback(MessageCallback f); diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index f1a223b..890b74e 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -143,7 +143,7 @@ static std::string cmakemainGetStack(cmake* cm) } static void cmakemainMessageCallback(const char* m, const char* /*unused*/, - bool& /*unused*/, cmake* cm) + cmake* cm) { std::cerr << m << cmakemainGetStack(cm) << std::endl << std::flush; } @@ -319,10 +319,9 @@ int do_cmake(int ac, char const* const* av) cmake cm(role, mode); cm.SetHomeDirectory(""); cm.SetHomeOutputDirectory(""); - cmSystemTools::SetMessageCallback( - [&cm](const char* msg, const char* title, bool& cancel) { - cmakemainMessageCallback(msg, title, cancel, &cm); - }); + cmSystemTools::SetMessageCallback([&cm](const char* msg, const char* title) { + cmakemainMessageCallback(msg, title, &cm); + }); cm.SetProgressCallback([&cm](const char* msg, float prog) { cmakemainProgressCallback(msg, prog, &cm); }); @@ -500,10 +499,9 @@ static int do_build(int ac, char const* const* av) } cmake cm(cmake::RoleInternal, cmState::Unknown); - cmSystemTools::SetMessageCallback( - [&cm](const char* msg, const char* title, bool& cancel) { - cmakemainMessageCallback(msg, title, cancel, &cm); - }); + cmSystemTools::SetMessageCallback([&cm](const char* msg, const char* title) { + cmakemainMessageCallback(msg, title, &cm); + }); cm.SetProgressCallback([&cm](const char* msg, float prog) { cmakemainProgressCallback(msg, prog, &cm); }); @@ -543,10 +541,9 @@ static int do_open(int ac, char const* const* av) } cmake cm(cmake::RoleInternal, cmState::Unknown); - cmSystemTools::SetMessageCallback( - [&cm](const char* msg, const char* title, bool& cancel) { - cmakemainMessageCallback(msg, title, cancel, &cm); - }); + cmSystemTools::SetMessageCallback([&cm](const char* msg, const char* title) { + cmakemainMessageCallback(msg, title, &cm); + }); cm.SetProgressCallback([&cm](const char* msg, float prog) { cmakemainProgressCallback(msg, prog, &cm); }); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c31b6e616d5c2d697696540ca2e8faf14160d2b0 commit c31b6e616d5c2d697696540ca2e8faf14160d2b0 Author: Vitaly Stakhovsky AuthorDate: Tue Jan 29 10:34:18 2019 -0500 Commit: Vitaly Stakhovsky CommitDate: Tue Jan 29 10:34:18 2019 -0500 cmSystemTools: copy file member functions accept std::string params Cleaned up `c_str()`s. `cmSystemTools::CopyFileIfDifferent()` removed as redundant. diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx index 8f492af..f12a452 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx +++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx @@ -288,8 +288,7 @@ protected: content = cmSystemTools::TrimWhitespace(content); std::string source = this->basePath + "/" + content; std::string destination = this->path + "/" + content; - if (!cmSystemTools::CopyFileIfDifferent(source.data(), - destination.data())) { + if (!cmSystemTools::CopyFileIfDifferent(source, destination)) { this->hasErrors = true; } } diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx index be4a18e..c55b148 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.cxx +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx @@ -212,8 +212,7 @@ int cmCPackDragNDropGenerator::PackageFiles() bool cmCPackDragNDropGenerator::CopyFile(std::ostringstream& source, std::ostringstream& target) { - if (!cmSystemTools::CopyFileIfDifferent(source.str().c_str(), - target.str().c_str())) { + if (!cmSystemTools::CopyFileIfDifferent(source.str(), target.str())) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Error copying " << source.str() << " to " << target.str() << std::endl); diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 4728f69..90d38fc 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -392,8 +392,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( std::move(inFileRelative)); } /* If it is not a symlink then do a plain copy */ - else if (!(cmSystemTools::CopyFileIfDifferent(inFile.c_str(), - filePath.c_str()) && + else if (!(cmSystemTools::CopyFileIfDifferent(inFile, filePath) && cmSystemTools::CopyFileTime(inFile.c_str(), filePath.c_str()))) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -1077,8 +1076,7 @@ int cmCPackGenerator::DoPackage() << (tempPackageFileName ? tempPackageFileName : "(NULL)") << " to " << (packageFileName ? packageFileName : "(NULL)") << std::endl); - if (!cmSystemTools::CopyFileIfDifferent(tempPackageFileName, - packageFileName)) { + if (!cmSystemTools::CopyFileIfDifferent(pkgFileName, tmpPF)) { cmCPackLogger( cmCPackLog::LOG_ERROR, "Problem copying the package: " diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index afb0b2a..76c5b9a 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -3759,8 +3759,7 @@ bool cmFileCommand::HandleCreateLinkCommand( // Check if copy-on-error is enabled in the arguments. if (!completed && copyOnErrorArg.IsEnabled()) { - completed = - cmSystemTools::cmCopyFile(fileName.c_str(), newFileName.c_str()); + completed = cmSystemTools::cmCopyFile(fileName, newFileName); if (!completed) { result = "Copy failed: " + cmSystemTools::GetLastSystemError(); } diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index e3dd2f9..77be592 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -262,9 +262,8 @@ void cmGlobalVisualStudioGenerator::ConfigureCMakeVisualStudioMacros() // purposes but newer versions distributed with CMake will replace // older versions in user directories. int res; - if (!cmSystemTools::FileTimeCompare(src.c_str(), dst.c_str(), &res) || - res > 0) { - if (!cmSystemTools::CopyFileAlways(src.c_str(), dst.c_str())) { + if (!cmSystemTools::FileTimeCompare(src, dst, &res) || res > 0) { + if (!cmSystemTools::CopyFileAlways(src, dst)) { std::ostringstream oss; oss << "Could not copy from: " << src << std::endl; oss << " to: " << dst << std::endl; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 9bd3b01..6b58f86 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3750,8 +3750,7 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile, } if (copyonly) { - if (!cmSystemTools::CopyFileIfDifferent(sinfile.c_str(), - soutfile.c_str())) { + if (!cmSystemTools::CopyFileIfDifferent(sinfile, soutfile)) { return 0; } } else { @@ -3802,8 +3801,7 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile, // close the files before attempting to copy fin.close(); fout.close(); - if (!cmSystemTools::CopyFileIfDifferent(tempOutputFile.c_str(), - soutfile.c_str())) { + if (!cmSystemTools::CopyFileIfDifferent(tempOutputFile, soutfile)) { res = 0; } else { cmSystemTools::SetPermissions(soutfile, perm); diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index f7de3aa..9c4afec 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -940,17 +940,12 @@ std::string cmSystemTools::FileExistsInParentDirectories(const char* fname, return ""; } -bool cmSystemTools::cmCopyFile(const char* source, const char* destination) +bool cmSystemTools::cmCopyFile(const std::string& source, + const std::string& destination) { return Superclass::CopyFileAlways(source, destination); } -bool cmSystemTools::CopyFileIfDifferent(const char* source, - const char* destination) -{ - return Superclass::CopyFileIfDifferent(source, destination); -} - #ifdef _WIN32 cmSystemTools::WindowsFileRetry cmSystemTools::GetWindowsFileRetry() { diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index b1d5751..98ada60 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -179,8 +179,8 @@ public: std::vector& files, int type = 0); ///! Copy a file. - static bool cmCopyFile(const char* source, const char* destination); - static bool CopyFileIfDifferent(const char* source, const char* destination); + static bool cmCopyFile(const std::string& source, + const std::string& destination); /** Rename a file or directory within a single disk volume (atomic if possible). */ diff --git a/Source/cmUseMangledMesaCommand.cxx b/Source/cmUseMangledMesaCommand.cxx index 01ef5cb..9648b21 100644 --- a/Source/cmUseMangledMesaCommand.cxx +++ b/Source/cmUseMangledMesaCommand.cxx @@ -100,6 +100,6 @@ void cmUseMangledMesaCommand::CopyAndFullPathMesaHeader(const char* source, // close the files before attempting to copy fin.close(); fout.close(); - cmSystemTools::CopyFileIfDifferent(tempOutputFile.c_str(), outFile.c_str()); + cmSystemTools::CopyFileIfDifferent(tempOutputFile, outFile); cmSystemTools::RemoveFile(tempOutputFile); } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 70316f1..b03ffdb 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2358,7 +2358,7 @@ int cmake::GetSystemInformation(std::vector& args) outFile += "/CMakeLists.txt"; // Copy file - if (!cmSystemTools::cmCopyFile(inFile.c_str(), outFile.c_str())) { + if (!cmSystemTools::cmCopyFile(inFile, outFile)) { std::cerr << "Error copying file \"" << inFile << "\" to \"" << outFile << "\".\n"; return 1; diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 2a3aedd..d20c5d2 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -482,8 +482,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) // If error occurs we want to continue copying next files. bool return_value = false; for (std::string::size_type cc = 2; cc < args.size() - 1; cc++) { - if (!cmSystemTools::cmCopyFile(args[cc].c_str(), - args.back().c_str())) { + if (!cmSystemTools::cmCopyFile(args[cc], args.back())) { std::cerr << "Error copying file \"" << args[cc] << "\" to \"" << args.back() << "\".\n"; return_value = true; @@ -505,8 +504,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) // If error occurs we want to continue copying next files. bool return_value = false; for (std::string::size_type cc = 2; cc < args.size() - 1; cc++) { - if (!cmSystemTools::CopyFileIfDifferent(args[cc].c_str(), - args.back().c_str())) { + if (!cmSystemTools::CopyFileIfDifferent(args[cc], args.back())) { std::cerr << "Error copying file (if different) from \"" << args[cc] << "\" to \"" << args.back() << "\".\n"; return_value = true; @@ -1304,7 +1302,7 @@ bool cmcmd::SymlinkInternal(std::string const& file, std::string const& link) cmSystemTools::RemoveFile(link); } #if defined(_WIN32) && !defined(__CYGWIN__) - return cmSystemTools::CopyFileAlways(file.c_str(), link.c_str()); + return cmSystemTools::CopyFileAlways(file, link); #else std::string linktext = cmSystemTools::GetFilenameName(file); return cmSystemTools::CreateSymlink(linktext, link); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bcee24aecc1eaf6615eac9f24ae06acdf38845d3 commit bcee24aecc1eaf6615eac9f24ae06acdf38845d3 Author: Regina Pfeifer AuthorDate: Fri Jan 25 21:31:33 2019 +0100 Commit: Regina Pfeifer CommitDate: Tue Jan 29 16:32:52 2019 +0100 Use `std::function` for callbacks diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 4728f69..3309e1b 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -43,12 +43,6 @@ cmCPackGenerator::~cmCPackGenerator() this->MakefileMap = nullptr; } -void cmCPackGeneratorProgress(const char* msg, float prog, void* ptr) -{ - cmCPackGenerator* self = static_cast(ptr); - self->DisplayVerboseOutput(msg, prog); -} - void cmCPackGenerator::DisplayVerboseOutput(const char* msg, float progress) { (void)progress; @@ -696,7 +690,9 @@ int cmCPackGenerator::InstallCMakeProject( cm.SetHomeOutputDirectory(""); cm.GetCurrentSnapshot().SetDefaultDefinitions(); cm.AddCMakePaths(); - cm.SetProgressCallback(cmCPackGeneratorProgress, this); + cm.SetProgressCallback([this](const char* msg, float prog) { + this->DisplayVerboseOutput(msg, prog); + }); cm.SetTrace(this->Trace); cm.SetTraceExpand(this->TraceExpand); cmGlobalGenerator gg(&cm); diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index d4c867b..0413422 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -90,12 +90,8 @@ int cpackDefinitionArgument(const char* argument, const char* cValue, return 1; } -static void cpackProgressCallback(const char* message, float progress, - void* clientdata) +static void cpackProgressCallback(const char* message, float /*unused*/) { - (void)progress; - (void)clientdata; - std::cout << "-- " << message << std::endl; } @@ -212,7 +208,7 @@ int main(int argc, char const* const* argv) cmake cminst(cmake::RoleScript, cmState::CPack); cminst.SetHomeDirectory(""); cminst.SetHomeOutputDirectory(""); - cminst.SetProgressCallback(cpackProgressCallback, nullptr); + cminst.SetProgressCallback(cpackProgressCallback); cminst.GetCurrentSnapshot().SetDefaultDefinitions(); cmGlobalGenerator cmgg(&cminst); cmMakefile globalMF(&cmgg, cminst.GetCurrentSnapshot()); diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index 312d126..d6f0d18 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -109,27 +109,6 @@ int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring, return 0; } -void CMakeMessageCallback(const char* m, const char* /*unused*/, - bool& /*unused*/, void* s) -{ - std::string* out = static_cast(s); - *out += m; - *out += "\n"; -} - -void CMakeProgressCallback(const char* msg, float /*unused*/, void* s) -{ - std::string* out = static_cast(s); - *out += msg; - *out += "\n"; -} - -void CMakeOutputCallback(const char* m, size_t len, void* s) -{ - std::string* out = static_cast(s); - out->append(m, len); -} - class cmCTestBuildAndTestCaptureRAII { cmake& CM; @@ -138,17 +117,30 @@ public: cmCTestBuildAndTestCaptureRAII(cmake& cm, std::string& s) : CM(cm) { - cmSystemTools::SetMessageCallback(CMakeMessageCallback, &s); - cmSystemTools::SetStdoutCallback(CMakeOutputCallback, &s); - cmSystemTools::SetStderrCallback(CMakeOutputCallback, &s); - this->CM.SetProgressCallback(CMakeProgressCallback, &s); + cmSystemTools::SetMessageCallback( + [&s](const char* msg, const char* /*unused*/, bool& /*unused*/) { + s += msg; + s += "\n"; + }); + + cmSystemTools::SetStdoutCallback( + [&s](const char* m, size_t len) { s.append(m, len); }); + + cmSystemTools::SetStderrCallback( + [&s](const char* m, size_t len) { s.append(m, len); }); + + this->CM.SetProgressCallback([&s](const char* msg, float /*unused*/) { + s += msg; + s += "\n"; + }); } + ~cmCTestBuildAndTestCaptureRAII() { - this->CM.SetProgressCallback(nullptr, nullptr); - cmSystemTools::SetStderrCallback(nullptr, nullptr); - cmSystemTools::SetStdoutCallback(nullptr, nullptr); - cmSystemTools::SetMessageCallback(nullptr, nullptr); + this->CM.SetProgressCallback(nullptr); + cmSystemTools::SetStderrCallback(nullptr); + cmSystemTools::SetStdoutCallback(nullptr); + cmSystemTools::SetMessageCallback(nullptr); } }; diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index b949023..efc335a 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -265,15 +265,6 @@ int cmCTestScriptHandler::ExecuteScript(const std::string& total_script_arg) return retVal; } -static void ctestScriptProgressCallback(const char* m, float /*unused*/, - void* cd) -{ - cmCTest* ctest = static_cast(cd); - if (m && *m) { - cmCTestLog(ctest, HANDLER_OUTPUT, "-- " << m << std::endl); - } -} - void cmCTestScriptHandler::CreateCMake() { // create a cmake instance to read the configuration script @@ -299,7 +290,11 @@ void cmCTestScriptHandler::CreateCMake() this->ParentMakefile->GetRecursionDepth()); } - this->CMake->SetProgressCallback(ctestScriptProgressCallback, this->CTest); + this->CMake->SetProgressCallback([this](const char* m, float /*unused*/) { + if (m && *m) { + cmCTestLog(this->CTest, HANDLER_OUTPUT, "-- " << m << std::endl); + } + }); this->AddCTestCommand("ctest_build", new cmCTestBuildCommand); this->AddCTestCommand("ctest_configure", new cmCTestConfigureCommand); diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx index dbf4a28..82295b7 100644 --- a/Source/CursesDialog/ccmake.cxx +++ b/Source/CursesDialog/ccmake.cxx @@ -65,13 +65,6 @@ void onsig(int /*unused*/) } } -void CMakeMessageHandler(const char* message, const char* title, - bool& /*unused*/, void* clientData) -{ - cmCursesForm* self = static_cast(clientData); - self->AddError(message, title); -} - int main(int argc, char const* const* argv) { cmsys::Encoding::CommandLineArguments encoding_args = @@ -156,7 +149,10 @@ int main(int argc, char const* const* argv) return 1; } - cmSystemTools::SetMessageCallback(CMakeMessageHandler, myform); + cmSystemTools::SetMessageCallback( + [myform](const char* message, const char* title, bool& /*unused*/) { + myform->AddError(message, title); + }); cmCursesForm::CurrentForm = myform; diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index 188ad69..8ca7802 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -506,12 +506,8 @@ void cmCursesMainForm::UpdateStatusBar(const char* message) pos_form_cursor(this->Form); } -void cmCursesMainForm::UpdateProgress(const char* msg, float prog, void* vp) +void cmCursesMainForm::UpdateProgress(const char* msg, float prog) { - cmCursesMainForm* cm = static_cast(vp); - if (!cm) { - return; - } char tmp[1024]; const char* cmsg = tmp; if (prog >= 0) { @@ -519,8 +515,8 @@ void cmCursesMainForm::UpdateProgress(const char* msg, float prog, void* vp) } else { cmsg = msg; } - cm->UpdateStatusBar(cmsg); - cm->PrintKeys(1); + this->UpdateStatusBar(cmsg); + this->PrintKeys(1); curses_move(1, 1); touchwin(stdscr); refresh(); @@ -536,8 +532,8 @@ int cmCursesMainForm::Configure(int noconfigure) this->PrintKeys(1); touchwin(stdscr); refresh(); - this->CMakeInstance->SetProgressCallback(cmCursesMainForm::UpdateProgress, - this); + this->CMakeInstance->SetProgressCallback( + [this](const char* msg, float prog) { this->UpdateProgress(msg, prog); }); // always save the current gui values to disk this->FillCacheManagerFromUI(); @@ -560,7 +556,7 @@ int cmCursesMainForm::Configure(int noconfigure) } else { retVal = this->CMakeInstance->Configure(); } - this->CMakeInstance->SetProgressCallback(nullptr, nullptr); + this->CMakeInstance->SetProgressCallback(nullptr); keypad(stdscr, true); /* Use key symbols as KEY_DOWN */ @@ -606,8 +602,8 @@ int cmCursesMainForm::Generate() this->PrintKeys(1); touchwin(stdscr); refresh(); - this->CMakeInstance->SetProgressCallback(cmCursesMainForm::UpdateProgress, - this); + this->CMakeInstance->SetProgressCallback( + [this](const char* msg, float prog) { this->UpdateProgress(msg, prog); }); // Get rid of previous errors this->Errors = std::vector(); @@ -615,7 +611,7 @@ int cmCursesMainForm::Generate() // run the generate process int retVal = this->CMakeInstance->Generate(); - this->CMakeInstance->SetProgressCallback(nullptr, nullptr); + this->CMakeInstance->SetProgressCallback(nullptr); keypad(stdscr, true); /* Use key symbols as KEY_DOWN */ if (retVal != 0 || !this->Errors.empty()) { diff --git a/Source/CursesDialog/cmCursesMainForm.h b/Source/CursesDialog/cmCursesMainForm.h index 824025b..88864bc 100644 --- a/Source/CursesDialog/cmCursesMainForm.h +++ b/Source/CursesDialog/cmCursesMainForm.h @@ -101,8 +101,7 @@ public: /** * Progress callback */ - static void UpdateProgressOld(const char* msg, float prog, void*); - static void UpdateProgress(const char* msg, float prog, void*); + void UpdateProgress(const char* msg, float prog); protected: // Copy the cache values from the user interface to the actual diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index 2eecce6..8c71cc0 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -23,16 +23,26 @@ QCMake::QCMake(QObject* p) cmSystemTools::DisableRunCommandOutput(); cmSystemTools::SetRunCommandHideConsole(true); - cmSystemTools::SetMessageCallback(QCMake::messageCallback, this); - cmSystemTools::SetStdoutCallback(QCMake::stdoutCallback, this); - cmSystemTools::SetStderrCallback(QCMake::stderrCallback, this); + + cmSystemTools::SetMessageCallback( + [this](const char* msg, const char* title, bool& cancel) { + this->messageCallback(msg, title, cancel); + }); + cmSystemTools::SetStdoutCallback( + [this](const char* msg, size_t len) { this->stdoutCallback(msg, len); }); + cmSystemTools::SetStderrCallback( + [this](const char* msg, size_t len) { this->stderrCallback(msg, len); }); this->CMakeInstance = new cmake(cmake::RoleProject, cmState::Project); this->CMakeInstance->SetCMakeEditCommand( cmSystemTools::GetCMakeGUICommand()); - this->CMakeInstance->SetProgressCallback(QCMake::progressCallback, this); + this->CMakeInstance->SetProgressCallback( + [this](const char* msg, float percent) { + this->progressCallback(msg, percent); + }); - cmSystemTools::SetInterruptCallback(QCMake::interruptCallback, this); + cmSystemTools::SetInterruptCallback( + [this] { return this->interruptCallback(); }); std::vector generators; this->CMakeInstance->GetRegisteredGenerators( @@ -330,46 +340,41 @@ void QCMake::interrupt() this->InterruptFlag.ref(); } -bool QCMake::interruptCallback(void* cd) +bool QCMake::interruptCallback() { - QCMake* self = reinterpret_cast(cd); #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - return self->InterruptFlag; + return this->InterruptFlag; #else - return self->InterruptFlag.load(); + return this->InterruptFlag.load(); #endif } -void QCMake::progressCallback(const char* msg, float percent, void* cd) +void QCMake::progressCallback(const char* msg, float percent) { - QCMake* self = reinterpret_cast(cd); if (percent >= 0) { - emit self->progressChanged(QString::fromLocal8Bit(msg), percent); + emit this->progressChanged(QString::fromLocal8Bit(msg), percent); } else { - emit self->outputMessage(QString::fromLocal8Bit(msg)); + emit this->outputMessage(QString::fromLocal8Bit(msg)); } QCoreApplication::processEvents(); } void QCMake::messageCallback(const char* msg, const char* /*title*/, - bool& /*stop*/, void* cd) + bool& /*stop*/) { - QCMake* self = reinterpret_cast(cd); - emit self->errorMessage(QString::fromLocal8Bit(msg)); + emit this->errorMessage(QString::fromLocal8Bit(msg)); QCoreApplication::processEvents(); } -void QCMake::stdoutCallback(const char* msg, size_t len, void* cd) +void QCMake::stdoutCallback(const char* msg, size_t len) { - QCMake* self = reinterpret_cast(cd); - emit self->outputMessage(QString::fromLocal8Bit(msg, int(len))); + emit this->outputMessage(QString::fromLocal8Bit(msg, int(len))); QCoreApplication::processEvents(); } -void QCMake::stderrCallback(const char* msg, size_t len, void* cd) +void QCMake::stderrCallback(const char* msg, size_t len) { - QCMake* self = reinterpret_cast(cd); - emit self->outputMessage(QString::fromLocal8Bit(msg, int(len))); + emit this->outputMessage(QString::fromLocal8Bit(msg, int(len))); QCoreApplication::processEvents(); } diff --git a/Source/QtDialog/QCMake.h b/Source/QtDialog/QCMake.h index c84da58..ad85630 100644 --- a/Source/QtDialog/QCMake.h +++ b/Source/QtDialog/QCMake.h @@ -167,12 +167,12 @@ signals: protected: cmake* CMakeInstance; - static bool interruptCallback(void*); - static void progressCallback(const char* msg, float percent, void* cd); - static void messageCallback(const char* msg, const char* title, bool&, - void* cd); - static void stdoutCallback(const char* msg, size_t len, void* cd); - static void stderrCallback(const char* msg, size_t len, void* cd); + bool interruptCallback(); + void progressCallback(const char* msg, float percent); + void messageCallback(const char* msg, const char* title, bool&); + void stdoutCallback(const char* msg, size_t len); + void stderrCallback(const char* msg, size_t len); + bool WarnUninitializedMode; bool WarnUnusedMode; bool WarnUnusedAllMode; diff --git a/Source/cmServer.cxx b/Source/cmServer.cxx index f7d3879..44826fa 100644 --- a/Source/cmServer.cxx +++ b/Source/cmServer.cxx @@ -96,11 +96,16 @@ void cmServer::ProcessRequest(cmConnection* connection, return; } - cmSystemTools::SetMessageCallback(reportMessage, - const_cast(&request)); + cmSystemTools::SetMessageCallback( + [&request](const char* msg, const char* title, bool& cancel) { + reportMessage(msg, title, cancel, request); + }); + if (this->Protocol) { this->Protocol->CMakeInstance()->SetProgressCallback( - reportProgress, const_cast(&request)); + [&request](const char* msg, float prog) { + reportProgress(msg, prog, request); + }); this->WriteResponse(connection, this->Protocol->Process(request), debug.get()); } else { @@ -150,28 +155,25 @@ void cmServer::PrintHello(cmConnection* connection) const this->WriteJsonObject(connection, hello, nullptr); } -void cmServer::reportProgress(const char* msg, float progress, void* data) +void cmServer::reportProgress(const char* msg, float progress, + const cmServerRequest& request) { - const cmServerRequest* request = static_cast(data); - assert(request); if (progress < 0.0f || progress > 1.0f) { - request->ReportMessage(msg, ""); + request.ReportMessage(msg, ""); } else { - request->ReportProgress(0, static_cast(progress * 1000), 1000, msg); + request.ReportProgress(0, static_cast(progress * 1000), 1000, msg); } } void cmServer::reportMessage(const char* msg, const char* title, - bool& /* cancel */, void* data) + bool& /*cancel*/, const cmServerRequest& request) { - const cmServerRequest* request = static_cast(data); - assert(request); assert(msg); std::string titleString; if (title) { titleString = title; } - request->ReportMessage(std::string(msg), titleString); + request.ReportMessage(std::string(msg), titleString); } cmServerResponse cmServer::SetProtocolVersion(const cmServerRequest& request) diff --git a/Source/cmServer.h b/Source/cmServer.h index ca37ce2..10588a0 100644 --- a/Source/cmServer.h +++ b/Source/cmServer.h @@ -118,9 +118,10 @@ public: void OnConnected(cmConnection* connection) override; private: - static void reportProgress(const char* msg, float progress, void* data); + static void reportProgress(const char* msg, float progress, + const cmServerRequest& request); static void reportMessage(const char* msg, const char* title, bool& cancel, - void* data); + const cmServerRequest& request); // Handle requests: cmServerResponse SetProtocolVersion(const cmServerRequest& request); diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index f7de3aa..f660b39 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -76,6 +76,15 @@ # include /* for malloc/free on QNX */ #endif +namespace { + +cmSystemTools::InterruptCallback s_InterruptCallback; +cmSystemTools::MessageCallback s_MessageCallback; +cmSystemTools::OutputCallback s_StderrCallback; +cmSystemTools::OutputCallback s_StdoutCallback; + +} // namespace + static bool cm_isspace(char c) { return ((c & 0x80) == 0) && isspace(c); @@ -161,15 +170,6 @@ bool cmSystemTools::s_FatalErrorOccured = false; bool cmSystemTools::s_DisableMessages = false; bool cmSystemTools::s_ForceUnixPaths = false; -cmSystemTools::MessageCallback cmSystemTools::s_MessageCallback; -cmSystemTools::OutputCallback cmSystemTools::s_StdoutCallback; -cmSystemTools::OutputCallback cmSystemTools::s_StderrCallback; -cmSystemTools::InterruptCallback cmSystemTools::s_InterruptCallback; -void* cmSystemTools::s_MessageCallbackClientData; -void* cmSystemTools::s_StdoutCallbackClientData; -void* cmSystemTools::s_StderrCallbackClientData; -void* cmSystemTools::s_InterruptCallbackClientData; - // replace replace with with as many times as it shows up in source. // write the result into source. #if defined(_WIN32) && !defined(__CYGWIN__) @@ -277,42 +277,38 @@ void cmSystemTools::Error(const std::string& m) cmSystemTools::Message(message, "Error"); } -void cmSystemTools::SetInterruptCallback(InterruptCallback f, void* clientData) +void cmSystemTools::SetInterruptCallback(InterruptCallback f) { - s_InterruptCallback = f; - s_InterruptCallbackClientData = clientData; + s_InterruptCallback = std::move(f); } bool cmSystemTools::GetInterruptFlag() { if (s_InterruptCallback) { - return (*s_InterruptCallback)(s_InterruptCallbackClientData); + return s_InterruptCallback(); } return false; } -void cmSystemTools::SetMessageCallback(MessageCallback f, void* clientData) +void cmSystemTools::SetMessageCallback(MessageCallback f) { - s_MessageCallback = f; - s_MessageCallbackClientData = clientData; + s_MessageCallback = std::move(f); } -void cmSystemTools::SetStdoutCallback(OutputCallback f, void* clientData) +void cmSystemTools::SetStdoutCallback(OutputCallback f) { - s_StdoutCallback = f; - s_StdoutCallbackClientData = clientData; + s_StdoutCallback = std::move(f); } -void cmSystemTools::SetStderrCallback(OutputCallback f, void* clientData) +void cmSystemTools::SetStderrCallback(OutputCallback f) { - s_StderrCallback = f; - s_StderrCallbackClientData = clientData; + s_StderrCallback = std::move(f); } void cmSystemTools::Stderr(const std::string& s) { if (s_StderrCallback) { - (*s_StderrCallback)(s.c_str(), s.length(), s_StderrCallbackClientData); + s_StderrCallback(s.c_str(), s.length()); } else { std::cerr << s << std::flush; } @@ -321,7 +317,7 @@ void cmSystemTools::Stderr(const std::string& s) void cmSystemTools::Stdout(const std::string& s) { if (s_StdoutCallback) { - (*s_StdoutCallback)(s.c_str(), s.length(), s_StdoutCallbackClientData); + s_StdoutCallback(s.c_str(), s.length()); } else { std::cout << s << std::flush; } @@ -333,8 +329,7 @@ void cmSystemTools::Message(const char* m1, const char* title) return; } if (s_MessageCallback) { - (*s_MessageCallback)(m1, title, s_DisableMessages, - s_MessageCallbackClientData); + s_MessageCallback(m1, title, s_DisableMessages); return; } std::cerr << m1 << std::endl << std::flush; diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index b1d5751..754929d 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -10,6 +10,7 @@ #include "cmProcessOutput.h" #include "cmsys/Process.h" #include "cmsys/SystemTools.hxx" // IWYU pragma: export +#include #include #include #include @@ -55,15 +56,14 @@ public: */ static std::string TrimWhitespace(const std::string& s); - typedef void (*MessageCallback)(const char*, const char*, bool&, void*); + using MessageCallback = std::function; /** * Set the function used by GUIs to display error messages * Function gets passed: message as a const char*, * title as a const char*, and a reference to bool that when * set to false, will disable further messages (cancel). */ - static void SetMessageCallback(MessageCallback f, - void* clientData = nullptr); + static void SetMessageCallback(MessageCallback f); /** * Display an error message. @@ -81,19 +81,18 @@ public: Message(m.c_str(), title); } - typedef void (*OutputCallback)(const char*, size_t length, void*); + using OutputCallback = std::function; ///! Send a string to stdout static void Stdout(const std::string& s); - static void SetStdoutCallback(OutputCallback, void* clientData = nullptr); + static void SetStdoutCallback(OutputCallback f); ///! Send a string to stderr static void Stderr(const std::string& s); - static void SetStderrCallback(OutputCallback, void* clientData = nullptr); + static void SetStderrCallback(OutputCallback f); - typedef bool (*InterruptCallback)(void*); - static void SetInterruptCallback(InterruptCallback f, - void* clientData = nullptr); + using InterruptCallback = std::function; + static void SetInterruptCallback(InterruptCallback f); static bool GetInterruptFlag(); ///! Return true if there was an error at any point. @@ -548,14 +547,6 @@ private: static bool s_FatalErrorOccured; static bool s_DisableMessages; static bool s_DisableRunCommandOutput; - static MessageCallback s_MessageCallback; - static OutputCallback s_StdoutCallback; - static OutputCallback s_StderrCallback; - static InterruptCallback s_InterruptCallback; - static void* s_MessageCallbackClientData; - static void* s_StdoutCallbackClientData; - static void* s_StderrCallbackClientData; - static void* s_InterruptCallbackClientData; }; #endif diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 70316f1..787e769 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -157,8 +157,6 @@ cmake::cmake(Role role, cmState::Mode mode) #endif this->GlobalGenerator = nullptr; - this->ProgressCallback = nullptr; - this->ProgressCallbackClientData = nullptr; this->CurrentWorkingMode = NORMAL_MODE; #ifdef CMAKE_BUILD_WITH_CMAKE @@ -1922,17 +1920,15 @@ bool cmake::DeleteCache(const std::string& path) return this->State->DeleteCache(path); } -void cmake::SetProgressCallback(ProgressCallbackType f, void* cd) +void cmake::SetProgressCallback(ProgressCallbackType f) { - this->ProgressCallback = f; - this->ProgressCallbackClientData = cd; + this->ProgressCallback = std::move(f); } void cmake::UpdateProgress(const char* msg, float prog) { if (this->ProgressCallback && !this->State->GetIsInTryCompile()) { - (*this->ProgressCallback)(msg, prog, this->ProgressCallbackClientData); - return; + this->ProgressCallback(msg, prog); } } diff --git a/Source/cmake.h b/Source/cmake.h index c60fc33..afd4117 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -5,6 +5,7 @@ #include "cmConfigure.h" // IWYU pragma: keep +#include #include #include // IWYU pragma: keep #include @@ -271,7 +272,7 @@ public: ///! Parse command line arguments that might set cache values bool SetCacheArgs(const std::vector&); - typedef void (*ProgressCallbackType)(const char* msg, float progress, void*); + using ProgressCallbackType = std::function; /** * Set the function used by GUIs to receive progress updates * Function gets passed: message as a const char*, a progress @@ -279,7 +280,7 @@ public: * number provided may be negative in cases where a message is * to be displayed without any progress percentage. */ - void SetProgressCallback(ProgressCallbackType f, void* clientData = nullptr); + void SetProgressCallback(ProgressCallbackType f); ///! this is called by generators to update the progress void UpdateProgress(const char* msg, float prog); @@ -485,7 +486,6 @@ protected: private: ProgressCallbackType ProgressCallback; - void* ProgressCallbackClientData; bool InTryCompile; WorkingMode CurrentWorkingMode; bool DebugOutput; diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 0ec2552..f1a223b 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -117,9 +117,8 @@ int do_cmake(int ac, char const* const* av); static int do_build(int ac, char const* const* av); static int do_open(int ac, char const* const* av); -static cmMakefile* cmakemainGetMakefile(void* clientdata) +static cmMakefile* cmakemainGetMakefile(cmake* cm) { - cmake* cm = static_cast(clientdata); if (cm && cm->GetDebugOutput()) { cmGlobalGenerator* gg = cm->GetGlobalGenerator(); if (gg) { @@ -129,10 +128,10 @@ static cmMakefile* cmakemainGetMakefile(void* clientdata) return nullptr; } -static std::string cmakemainGetStack(void* clientdata) +static std::string cmakemainGetStack(cmake* cm) { std::string msg; - cmMakefile* mf = cmakemainGetMakefile(clientdata); + cmMakefile* mf = cmakemainGetMakefile(cm); if (mf) { msg = mf->FormatListFileStack(); if (!msg.empty()) { @@ -144,15 +143,14 @@ static std::string cmakemainGetStack(void* clientdata) } static void cmakemainMessageCallback(const char* m, const char* /*unused*/, - bool& /*unused*/, void* clientdata) + bool& /*unused*/, cmake* cm) { - std::cerr << m << cmakemainGetStack(clientdata) << std::endl << std::flush; + std::cerr << m << cmakemainGetStack(cm) << std::endl << std::flush; } -static void cmakemainProgressCallback(const char* m, float prog, - void* clientdata) +static void cmakemainProgressCallback(const char* m, float prog, cmake* cm) { - cmMakefile* mf = cmakemainGetMakefile(clientdata); + cmMakefile* mf = cmakemainGetMakefile(cm); std::string dir; if ((mf) && (strstr(m, "Configuring") == m) && (prog < 0)) { dir = " "; @@ -163,8 +161,7 @@ static void cmakemainProgressCallback(const char* m, float prog, } if ((prog < 0) || (!dir.empty())) { - std::cout << "-- " << m << dir << cmakemainGetStack(clientdata) - << std::endl; + std::cout << "-- " << m << dir << cmakemainGetStack(cm) << std::endl; } std::cout.flush(); @@ -322,8 +319,13 @@ int do_cmake(int ac, char const* const* av) cmake cm(role, mode); cm.SetHomeDirectory(""); cm.SetHomeOutputDirectory(""); - cmSystemTools::SetMessageCallback(cmakemainMessageCallback, &cm); - cm.SetProgressCallback(cmakemainProgressCallback, &cm); + cmSystemTools::SetMessageCallback( + [&cm](const char* msg, const char* title, bool& cancel) { + cmakemainMessageCallback(msg, title, cancel, &cm); + }); + cm.SetProgressCallback([&cm](const char* msg, float prog) { + cmakemainProgressCallback(msg, prog, &cm); + }); cm.SetWorkingMode(workingMode); int res = cm.Run(args, view_only); @@ -498,8 +500,13 @@ static int do_build(int ac, char const* const* av) } cmake cm(cmake::RoleInternal, cmState::Unknown); - cmSystemTools::SetMessageCallback(cmakemainMessageCallback, &cm); - cm.SetProgressCallback(cmakemainProgressCallback, &cm); + cmSystemTools::SetMessageCallback( + [&cm](const char* msg, const char* title, bool& cancel) { + cmakemainMessageCallback(msg, title, cancel, &cm); + }); + cm.SetProgressCallback([&cm](const char* msg, float prog) { + cmakemainProgressCallback(msg, prog, &cm); + }); return cm.Build(jobs, dir, target, config, nativeOptions, clean, verbose); #endif } @@ -536,8 +543,13 @@ static int do_open(int ac, char const* const* av) } cmake cm(cmake::RoleInternal, cmState::Unknown); - cmSystemTools::SetMessageCallback(cmakemainMessageCallback, &cm); - cm.SetProgressCallback(cmakemainProgressCallback, &cm); + cmSystemTools::SetMessageCallback( + [&cm](const char* msg, const char* title, bool& cancel) { + cmakemainMessageCallback(msg, title, cancel, &cm); + }); + cm.SetProgressCallback([&cm](const char* msg, float prog) { + cmakemainProgressCallback(msg, prog, &cm); + }); return cm.Open(dir, false) ? 0 : 1; #endif } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=95ef818c7df5f8f92130f11cad0e9b72d470dcdc commit 95ef818c7df5f8f92130f11cad0e9b72d470dcdc Author: Marc Chevrier AuthorDate: Mon Jan 28 18:43:50 2019 +0100 Commit: Marc Chevrier CommitDate: Mon Jan 28 18:43:50 2019 +0100 UseJava: clean-up if() expressions Fixes: #18836 diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake index 2bcd28e..5600b4c 100644 --- a/Modules/UseJava.cmake +++ b/Modules/UseJava.cmake @@ -446,7 +446,7 @@ function (__java_copy_file src dest comment) endfunction () function(__java_lcat VAR) - foreach(_line ${ARGN}) + foreach(_line IN LISTS ARGN) string(APPEND ${VAR} "${_line}\n") endforeach() @@ -568,7 +568,7 @@ function(add_jar _TARGET_NAME) set(CMAKE_JAVA_INCLUDE_FLAG_SEP ":") endif() - foreach (JAVA_INCLUDE_DIR ${CMAKE_JAVA_INCLUDE_PATH}) + foreach (JAVA_INCLUDE_DIR IN LISTS CMAKE_JAVA_INCLUDE_PATH) string(APPEND CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_FLAG_SEP}${JAVA_INCLUDE_DIR}") endforeach() @@ -592,7 +592,7 @@ function(add_jar _TARGET_NAME) set(_JAVA_COMPILE_DEPENDS) set(_JAVA_RESOURCE_FILES) set(_JAVA_RESOURCE_FILES_RELATIVE) - foreach(_JAVA_SOURCE_FILE ${_JAVA_SOURCE_FILES}) + foreach(_JAVA_SOURCE_FILE IN LISTS _JAVA_SOURCE_FILES) get_filename_component(_JAVA_EXT ${_JAVA_SOURCE_FILE} EXT) get_filename_component(_JAVA_FILE ${_JAVA_SOURCE_FILE} NAME_WE) get_filename_component(_JAVA_PATH ${_JAVA_SOURCE_FILE} PATH) @@ -607,7 +607,7 @@ function(add_jar _TARGET_NAME) file(RELATIVE_PATH _JAVA_REL_SOURCE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${_JAVA_FULL}) string(LENGTH ${_JAVA_REL_BINARY_PATH} _BIN_LEN) string(LENGTH ${_JAVA_REL_SOURCE_PATH} _SRC_LEN) - if (${_BIN_LEN} LESS ${_SRC_LEN}) + if (_BIN_LEN LESS _SRC_LEN) set(_JAVA_REL_PATH ${_JAVA_REL_BINARY_PATH}) else () set(_JAVA_REL_PATH ${_JAVA_REL_SOURCE_PATH}) @@ -637,7 +637,7 @@ function(add_jar _TARGET_NAME) endif () endforeach() - foreach(_JAVA_INCLUDE_JAR ${_add_jar_INCLUDE_JARS}) + foreach(_JAVA_INCLUDE_JAR IN LISTS _add_jar_INCLUDE_JARS) if (TARGET ${_JAVA_INCLUDE_JAR}) get_target_property(_JAVA_JAR_PATH ${_JAVA_INCLUDE_JAR} JAR_FILE) if (_JAVA_JAR_PATH) @@ -705,7 +705,7 @@ function(add_jar _TARGET_NAME) # create the jar file set(_JAVA_JAR_OUTPUT_PATH - ${_add_jar_OUTPUT_DIR}/${_JAVA_TARGET_OUTPUT_NAME}) + "${_add_jar_OUTPUT_DIR}/${_JAVA_TARGET_OUTPUT_NAME}") if (CMAKE_JNI_TARGET) add_custom_command( OUTPUT ${_JAVA_JAR_OUTPUT_PATH} @@ -903,15 +903,15 @@ function (find_jar VARIABLE) set(_state "name") - foreach (arg ${ARGN}) - if (${_state} STREQUAL "name") - if (${arg} STREQUAL "VERSIONS") + foreach (arg IN LISTS ARGN) + if (_state STREQUAL "name") + if (arg STREQUAL "VERSIONS") set(_state "versions") - elseif (${arg} STREQUAL "NAMES") + elseif (arg STREQUAL "NAMES") set(_state "names") - elseif (${arg} STREQUAL "PATHS") + elseif (arg STREQUAL "PATHS") set(_state "paths") - elseif (${arg} STREQUAL "DOC") + elseif (arg STREQUAL "DOC") set(_state "doc") else () set(_jar_names ${arg}) @@ -919,22 +919,22 @@ function (find_jar VARIABLE) set(_jar_doc "Finding ${arg} jar") endif () endif () - elseif (${_state} STREQUAL "versions") - if (${arg} STREQUAL "NAMES") + elseif (_state STREQUAL "versions") + if (arg STREQUAL "NAMES") set(_state "names") - elseif (${arg} STREQUAL "PATHS") + elseif (arg STREQUAL "PATHS") set(_state "paths") - elseif (${arg} STREQUAL "DOC") + elseif (arg STREQUAL "DOC") set(_state "doc") else () set(_jar_versions ${_jar_versions} ${arg}) endif () - elseif (${_state} STREQUAL "names") - if (${arg} STREQUAL "VERSIONS") + elseif (_state STREQUAL "names") + if (arg STREQUAL "VERSIONS") set(_state "versions") - elseif (${arg} STREQUAL "PATHS") + elseif (arg STREQUAL "PATHS") set(_state "paths") - elseif (${arg} STREQUAL "DOC") + elseif (arg STREQUAL "DOC") set(_state "doc") else () set(_jar_names ${_jar_names} ${arg}) @@ -942,22 +942,22 @@ function (find_jar VARIABLE) set(_jar_doc "Finding ${arg} jar") endif () endif () - elseif (${_state} STREQUAL "paths") - if (${arg} STREQUAL "VERSIONS") + elseif (_state STREQUAL "paths") + if (arg STREQUAL "VERSIONS") set(_state "versions") - elseif (${arg} STREQUAL "NAMES") + elseif (arg STREQUAL "NAMES") set(_state "names") - elseif (${arg} STREQUAL "DOC") + elseif (arg STREQUAL "DOC") set(_state "doc") else () set(_jar_paths ${_jar_paths} ${arg}) endif () - elseif (${_state} STREQUAL "doc") - if (${arg} STREQUAL "VERSIONS") + elseif (_state STREQUAL "doc") + if (arg STREQUAL "VERSIONS") set(_state "versions") - elseif (${arg} STREQUAL "NAMES") + elseif (arg STREQUAL "NAMES") set(_state "names") - elseif (${arg} STREQUAL "PATHS") + elseif (arg STREQUAL "PATHS") set(_state "paths") else () set(_jar_doc ${arg}) @@ -969,8 +969,8 @@ function (find_jar VARIABLE) message(FATAL_ERROR "find_jar: No name to search for given") endif () - foreach (jar_name ${_jar_names}) - foreach (version ${_jar_versions}) + foreach (jar_name IN LISTS _jar_names) + foreach (version IN LISTS _jar_versions) set(_jar_files ${_jar_files} ${jar_name}-${version}.jar) endforeach () set(_jar_files ${_jar_files} ${jar_name}.jar) @@ -997,252 +997,252 @@ function(create_javadoc _target) set(_state "package") - foreach (arg ${ARGN}) - if (${_state} STREQUAL "package") - if (${arg} STREQUAL "PACKAGES") + foreach (arg IN LISTS ARGN) + if (_state STREQUAL "package") + if (arg STREQUAL "PACKAGES") set(_state "packages") - elseif (${arg} STREQUAL "FILES") + elseif (arg STREQUAL "FILES") set(_state "files") - elseif (${arg} STREQUAL "SOURCEPATH") + elseif (arg STREQUAL "SOURCEPATH") set(_state "sourcepath") - elseif (${arg} STREQUAL "CLASSPATH") + elseif (arg STREQUAL "CLASSPATH") set(_state "classpath") - elseif (${arg} STREQUAL "INSTALLPATH") + elseif (arg STREQUAL "INSTALLPATH") set(_state "installpath") - elseif (${arg} STREQUAL "DOCTITLE") + elseif (arg STREQUAL "DOCTITLE") set(_state "doctitle") - elseif (${arg} STREQUAL "WINDOWTITLE") + elseif (arg STREQUAL "WINDOWTITLE") set(_state "windowtitle") - elseif (${arg} STREQUAL "AUTHOR") + elseif (arg STREQUAL "AUTHOR") set(_state "author") - elseif (${arg} STREQUAL "USE") + elseif (arg STREQUAL "USE") set(_state "use") - elseif (${arg} STREQUAL "VERSION") + elseif (arg STREQUAL "VERSION") set(_state "version") else () set(_javadoc_packages ${arg}) set(_state "packages") endif () - elseif (${_state} STREQUAL "packages") - if (${arg} STREQUAL "FILES") + elseif (_state STREQUAL "packages") + if (arg STREQUAL "FILES") set(_state "files") - elseif (${arg} STREQUAL "SOURCEPATH") + elseif (arg STREQUAL "SOURCEPATH") set(_state "sourcepath") - elseif (${arg} STREQUAL "CLASSPATH") + elseif (arg STREQUAL "CLASSPATH") set(_state "classpath") - elseif (${arg} STREQUAL "INSTALLPATH") + elseif (arg STREQUAL "INSTALLPATH") set(_state "installpath") - elseif (${arg} STREQUAL "DOCTITLE") + elseif (arg STREQUAL "DOCTITLE") set(_state "doctitle") - elseif (${arg} STREQUAL "WINDOWTITLE") + elseif (arg STREQUAL "WINDOWTITLE") set(_state "windowtitle") - elseif (${arg} STREQUAL "AUTHOR") + elseif (arg STREQUAL "AUTHOR") set(_state "author") - elseif (${arg} STREQUAL "USE") + elseif (arg STREQUAL "USE") set(_state "use") - elseif (${arg} STREQUAL "VERSION") + elseif (arg STREQUAL "VERSION") set(_state "version") else () list(APPEND _javadoc_packages ${arg}) endif () - elseif (${_state} STREQUAL "files") - if (${arg} STREQUAL "PACKAGES") + elseif (_state STREQUAL "files") + if (arg STREQUAL "PACKAGES") set(_state "packages") - elseif (${arg} STREQUAL "SOURCEPATH") + elseif (arg STREQUAL "SOURCEPATH") set(_state "sourcepath") - elseif (${arg} STREQUAL "CLASSPATH") + elseif (arg STREQUAL "CLASSPATH") set(_state "classpath") - elseif (${arg} STREQUAL "INSTALLPATH") + elseif (arg STREQUAL "INSTALLPATH") set(_state "installpath") - elseif (${arg} STREQUAL "DOCTITLE") + elseif (arg STREQUAL "DOCTITLE") set(_state "doctitle") - elseif (${arg} STREQUAL "WINDOWTITLE") + elseif (arg STREQUAL "WINDOWTITLE") set(_state "windowtitle") - elseif (${arg} STREQUAL "AUTHOR") + elseif (arg STREQUAL "AUTHOR") set(_state "author") - elseif (${arg} STREQUAL "USE") + elseif (arg STREQUAL "USE") set(_state "use") - elseif (${arg} STREQUAL "VERSION") + elseif (arg STREQUAL "VERSION") set(_state "version") else () list(APPEND _javadoc_files ${arg}) endif () - elseif (${_state} STREQUAL "sourcepath") - if (${arg} STREQUAL "PACKAGES") + elseif (_state STREQUAL "sourcepath") + if (arg STREQUAL "PACKAGES") set(_state "packages") - elseif (${arg} STREQUAL "FILES") + elseif (arg STREQUAL "FILES") set(_state "files") - elseif (${arg} STREQUAL "CLASSPATH") + elseif (arg STREQUAL "CLASSPATH") set(_state "classpath") - elseif (${arg} STREQUAL "INSTALLPATH") + elseif (arg STREQUAL "INSTALLPATH") set(_state "installpath") - elseif (${arg} STREQUAL "DOCTITLE") + elseif (arg STREQUAL "DOCTITLE") set(_state "doctitle") - elseif (${arg} STREQUAL "WINDOWTITLE") + elseif (arg STREQUAL "WINDOWTITLE") set(_state "windowtitle") - elseif (${arg} STREQUAL "AUTHOR") + elseif (arg STREQUAL "AUTHOR") set(_state "author") - elseif (${arg} STREQUAL "USE") + elseif (arg STREQUAL "USE") set(_state "use") - elseif (${arg} STREQUAL "VERSION") + elseif (arg STREQUAL "VERSION") set(_state "version") else () list(APPEND _javadoc_sourcepath ${arg}) endif () - elseif (${_state} STREQUAL "classpath") - if (${arg} STREQUAL "PACKAGES") + elseif (_state STREQUAL "classpath") + if (arg STREQUAL "PACKAGES") set(_state "packages") - elseif (${arg} STREQUAL "FILES") + elseif (arg STREQUAL "FILES") set(_state "files") - elseif (${arg} STREQUAL "SOURCEPATH") + elseif (arg STREQUAL "SOURCEPATH") set(_state "sourcepath") - elseif (${arg} STREQUAL "INSTALLPATH") + elseif (arg STREQUAL "INSTALLPATH") set(_state "installpath") - elseif (${arg} STREQUAL "DOCTITLE") + elseif (arg STREQUAL "DOCTITLE") set(_state "doctitle") - elseif (${arg} STREQUAL "WINDOWTITLE") + elseif (arg STREQUAL "WINDOWTITLE") set(_state "windowtitle") - elseif (${arg} STREQUAL "AUTHOR") + elseif (arg STREQUAL "AUTHOR") set(_state "author") - elseif (${arg} STREQUAL "USE") + elseif (arg STREQUAL "USE") set(_state "use") - elseif (${arg} STREQUAL "VERSION") + elseif (arg STREQUAL "VERSION") set(_state "version") else () list(APPEND _javadoc_classpath ${arg}) endif () - elseif (${_state} STREQUAL "installpath") - if (${arg} STREQUAL "PACKAGES") + elseif (_state STREQUAL "installpath") + if (arg STREQUAL "PACKAGES") set(_state "packages") - elseif (${arg} STREQUAL "FILES") + elseif (arg STREQUAL "FILES") set(_state "files") - elseif (${arg} STREQUAL "SOURCEPATH") + elseif (arg STREQUAL "SOURCEPATH") set(_state "sourcepath") - elseif (${arg} STREQUAL "DOCTITLE") + elseif (arg STREQUAL "DOCTITLE") set(_state "doctitle") - elseif (${arg} STREQUAL "WINDOWTITLE") + elseif (arg STREQUAL "WINDOWTITLE") set(_state "windowtitle") - elseif (${arg} STREQUAL "AUTHOR") + elseif (arg STREQUAL "AUTHOR") set(_state "author") - elseif (${arg} STREQUAL "USE") + elseif (arg STREQUAL "USE") set(_state "use") - elseif (${arg} STREQUAL "VERSION") + elseif (arg STREQUAL "VERSION") set(_state "version") else () set(_javadoc_installpath ${arg}) endif () - elseif (${_state} STREQUAL "doctitle") + elseif (_state STREQUAL "doctitle") if (${arg} STREQUAL "PACKAGES") set(_state "packages") - elseif (${arg} STREQUAL "FILES") + elseif (arg STREQUAL "FILES") set(_state "files") - elseif (${arg} STREQUAL "SOURCEPATH") + elseif (arg STREQUAL "SOURCEPATH") set(_state "sourcepath") - elseif (${arg} STREQUAL "INSTALLPATH") + elseif (arg STREQUAL "INSTALLPATH") set(_state "installpath") - elseif (${arg} STREQUAL "CLASSPATH") + elseif (arg STREQUAL "CLASSPATH") set(_state "classpath") - elseif (${arg} STREQUAL "WINDOWTITLE") + elseif (arg STREQUAL "WINDOWTITLE") set(_state "windowtitle") - elseif (${arg} STREQUAL "AUTHOR") + elseif (arg STREQUAL "AUTHOR") set(_state "author") - elseif (${arg} STREQUAL "USE") + elseif (arg STREQUAL "USE") set(_state "use") - elseif (${arg} STREQUAL "VERSION") + elseif (arg STREQUAL "VERSION") set(_state "version") else () set(_javadoc_doctitle ${arg}) endif () - elseif (${_state} STREQUAL "windowtitle") + elseif (_state STREQUAL "windowtitle") if (${arg} STREQUAL "PACKAGES") set(_state "packages") - elseif (${arg} STREQUAL "FILES") + elseif (arg STREQUAL "FILES") set(_state "files") - elseif (${arg} STREQUAL "SOURCEPATH") + elseif (arg STREQUAL "SOURCEPATH") set(_state "sourcepath") - elseif (${arg} STREQUAL "CLASSPATH") + elseif (arg STREQUAL "CLASSPATH") set(_state "classpath") - elseif (${arg} STREQUAL "INSTALLPATH") + elseif (arg STREQUAL "INSTALLPATH") set(_state "installpath") - elseif (${arg} STREQUAL "DOCTITLE") + elseif (arg STREQUAL "DOCTITLE") set(_state "doctitle") - elseif (${arg} STREQUAL "AUTHOR") + elseif (arg STREQUAL "AUTHOR") set(_state "author") - elseif (${arg} STREQUAL "USE") + elseif (arg STREQUAL "USE") set(_state "use") - elseif (${arg} STREQUAL "VERSION") + elseif (arg STREQUAL "VERSION") set(_state "version") else () set(_javadoc_windowtitle ${arg}) endif () - elseif (${_state} STREQUAL "author") - if (${arg} STREQUAL "PACKAGES") + elseif (_state STREQUAL "author") + if (arg STREQUAL "PACKAGES") set(_state "packages") - elseif (${arg} STREQUAL "FILES") + elseif (arg STREQUAL "FILES") set(_state "files") - elseif (${arg} STREQUAL "SOURCEPATH") + elseif (arg STREQUAL "SOURCEPATH") set(_state "sourcepath") - elseif (${arg} STREQUAL "CLASSPATH") + elseif (arg STREQUAL "CLASSPATH") set(_state "classpath") - elseif (${arg} STREQUAL "INSTALLPATH") + elseif (arg STREQUAL "INSTALLPATH") set(_state "installpath") - elseif (${arg} STREQUAL "DOCTITLE") + elseif (arg STREQUAL "DOCTITLE") set(_state "doctitle") - elseif (${arg} STREQUAL "WINDOWTITLE") + elseif (arg STREQUAL "WINDOWTITLE") set(_state "windowtitle") - elseif (${arg} STREQUAL "AUTHOR") + elseif (arg STREQUAL "AUTHOR") set(_state "author") - elseif (${arg} STREQUAL "USE") + elseif (arg STREQUAL "USE") set(_state "use") - elseif (${arg} STREQUAL "VERSION") + elseif (arg STREQUAL "VERSION") set(_state "version") else () set(_javadoc_author ${arg}) endif () - elseif (${_state} STREQUAL "use") - if (${arg} STREQUAL "PACKAGES") + elseif (_state STREQUAL "use") + if (arg STREQUAL "PACKAGES") set(_state "packages") - elseif (${arg} STREQUAL "FILES") + elseif (arg STREQUAL "FILES") set(_state "files") - elseif (${arg} STREQUAL "SOURCEPATH") + elseif (arg STREQUAL "SOURCEPATH") set(_state "sourcepath") - elseif (${arg} STREQUAL "CLASSPATH") + elseif (arg STREQUAL "CLASSPATH") set(_state "classpath") - elseif (${arg} STREQUAL "INSTALLPATH") + elseif (arg STREQUAL "INSTALLPATH") set(_state "installpath") - elseif (${arg} STREQUAL "DOCTITLE") + elseif (arg STREQUAL "DOCTITLE") set(_state "doctitle") - elseif (${arg} STREQUAL "WINDOWTITLE") + elseif (arg STREQUAL "WINDOWTITLE") set(_state "windowtitle") - elseif (${arg} STREQUAL "AUTHOR") + elseif (arg STREQUAL "AUTHOR") set(_state "author") - elseif (${arg} STREQUAL "USE") + elseif (arg STREQUAL "USE") set(_state "use") - elseif (${arg} STREQUAL "VERSION") + elseif (arg STREQUAL "VERSION") set(_state "version") else () set(_javadoc_use ${arg}) endif () - elseif (${_state} STREQUAL "version") - if (${arg} STREQUAL "PACKAGES") + elseif (_state STREQUAL "version") + if (arg STREQUAL "PACKAGES") set(_state "packages") - elseif (${arg} STREQUAL "FILES") + elseif (arg STREQUAL "FILES") set(_state "files") - elseif (${arg} STREQUAL "SOURCEPATH") + elseif (arg STREQUAL "SOURCEPATH") set(_state "sourcepath") - elseif (${arg} STREQUAL "CLASSPATH") + elseif (arg STREQUAL "CLASSPATH") set(_state "classpath") - elseif (${arg} STREQUAL "INSTALLPATH") + elseif (arg STREQUAL "INSTALLPATH") set(_state "installpath") - elseif (${arg} STREQUAL "DOCTITLE") + elseif (arg STREQUAL "DOCTITLE") set(_state "doctitle") - elseif (${arg} STREQUAL "WINDOWTITLE") + elseif (arg STREQUAL "WINDOWTITLE") set(_state "windowtitle") - elseif (${arg} STREQUAL "AUTHOR") + elseif (arg STREQUAL "AUTHOR") set(_state "author") - elseif (${arg} STREQUAL "USE") + elseif (arg STREQUAL "USE") set(_state "use") - elseif (${arg} STREQUAL "VERSION") + elseif (arg STREQUAL "VERSION") set(_state "version") else () set(_javadoc_version ${arg}) @@ -1255,7 +1255,7 @@ function(create_javadoc _target) if (_javadoc_sourcepath) set(_start TRUE) - foreach(_path ${_javadoc_sourcepath}) + foreach(_path IN LISTS _javadoc_sourcepath) if (_start) set(_sourcepath ${_path}) set(_start FALSE) @@ -1268,7 +1268,7 @@ function(create_javadoc _target) if (_javadoc_classpath) set(_start TRUE) - foreach(_path ${_javadoc_classpath}) + foreach(_path IN LISTS _javadoc_classpath) if (_start) set(_classpath ${_path}) set(_start FALSE) @@ -1435,7 +1435,7 @@ function(export_jars) # Set content of generated exports file string(REPLACE ";" " " __targets__ "${_export_jars_TARGETS}") set(__targetdefs__ "") - foreach(_target ${_export_jars_TARGETS}) + foreach(_target IN LISTS _export_jars_TARGETS) get_target_property(_jarpath ${_target} JAR_FILE) get_filename_component(_jarpath ${_jarpath} PATH) __java_export_jar(__targetdefs__ ${_target} "${_jarpath}") @@ -1473,7 +1473,7 @@ function(install_jar_exports) endif() # Determine relative path from installed export file to install prefix - if(IS_ABSOLUTE ${_install_jar_exports_DESTINATION}) + if(IS_ABSOLUTE "${_install_jar_exports_DESTINATION}") file(RELATIVE_PATH _relpath ${_install_jar_exports_DESTINATION} ${CMAKE_INSTALL_PREFIX} @@ -1492,7 +1492,7 @@ function(install_jar_exports) # Set content of generated exports file string(REPLACE ";" " " __targets__ "${_install_jar_exports_TARGETS}") set(__targetdefs__ "set(_prefix \${CMAKE_CURRENT_LIST_DIR}/${_relpath})\n\n") - foreach(_target ${_install_jar_exports_TARGETS}) + foreach(_target IN LISTS _install_jar_exports_TARGETS) get_target_property(_dir ${_target} INSTALL_DESTINATION) __java_export_jar(__targetdefs__ ${_target} "\${_prefix}/${_dir}") endforeach() ----------------------------------------------------------------------- Summary of changes: Help/variable/CMAKE_LANG_COMPILER_ID.rst | 2 +- Modules/UseJava.cmake | 294 ++++++++++++++-------------- Source/CPack/IFW/cmCPackIFWInstaller.cxx | 3 +- Source/CPack/cmCPackDragNDropGenerator.cxx | 3 +- Source/CPack/cmCPackGenerator.cxx | 16 +- Source/CPack/cpack.cxx | 8 +- Source/CTest/cmCTestBuildAndTestHandler.cxx | 50 ++--- Source/CTest/cmCTestScriptHandler.cxx | 15 +- Source/CursesDialog/ccmake.cxx | 12 +- Source/CursesDialog/cmCursesMainForm.cxx | 22 +-- Source/CursesDialog/cmCursesMainForm.h | 3 +- Source/QtDialog/QCMake.cxx | 50 ++--- Source/QtDialog/QCMake.h | 12 +- Source/cmFileCommand.cxx | 3 +- Source/cmGlobalVisualStudioGenerator.cxx | 5 +- Source/cmMakefile.cxx | 6 +- Source/cmServer.cxx | 26 +-- Source/cmServer.h | 7 +- Source/cmSystemTools.cxx | 56 +++--- Source/cmSystemTools.h | 32 ++- Source/cmUseMangledMesaCommand.cxx | 2 +- Source/cmake.cxx | 12 +- Source/cmake.h | 6 +- Source/cmakemain.cxx | 43 ++-- Source/cmcmd.cxx | 8 +- 25 files changed, 324 insertions(+), 372 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Wed Jan 30 08:13:09 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 30 Jan 2019 08:13:09 -0500 (EST) Subject: [Cmake-commits] CMake branch, release, updated. v3.13.3-11-ga57fcfa Message-ID: <20190130131309.4E3BEFA1AC@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, release has been updated via a57fcfa3e0989a74d1e1c6c24132e285cdace2b1 (commit) via 475e78d9071b34690617a85853433a9fc15da057 (commit) from f4547578aa365164f1ef48c4f546828752cf4835 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Source/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Wed Jan 30 08:23:03 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 30 Jan 2019 08:23:03 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-1210-g748d024 Message-ID: <20190130132303.EB920111D71@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 748d024551d8f447046363ad617fc72bdd977fd2 (commit) via d685a46f56b6f7ccf5763b87611bf383e3aa8cb7 (commit) via da402a081b6575b4813e5e8798105317b451ac1e (commit) via 147d36ce93d563df4ce1899facbb256e6bc9bbb2 (commit) via a94355c7b781378f73b70010ee97f9d5d6209e68 (commit) via 611d5274de677a42bdf744c48f0e4a29ea1bb1cd (commit) via 1a07e1b47d2c0a5b19013f359bbdaecfd17387b2 (commit) from d36629661197b4255da2a1864ce7ec016b415d24 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=748d024551d8f447046363ad617fc72bdd977fd2 commit 748d024551d8f447046363ad617fc72bdd977fd2 Merge: d685a46 a94355c Author: Brad King AuthorDate: Wed Jan 30 13:13:32 2019 +0000 Commit: Kitware Robot CommitDate: Wed Jan 30 08:13:42 2019 -0500 Merge topic 'fetchcontent-reduce-boilerplate' a94355c7b7 FetchContent: Add new command FetchContent_MakeAvailable() 611d5274de Sphinx: Add limited support for nested variables in docs 1a07e1b47d FetchContent: Trivial doc corrections Acked-by: Kitware Robot Merge-request: !2830 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d685a46f56b6f7ccf5763b87611bf383e3aa8cb7 commit d685a46f56b6f7ccf5763b87611bf383e3aa8cb7 Merge: d366296 da402a0 Author: Brad King AuthorDate: Wed Jan 30 13:12:44 2019 +0000 Commit: Kitware Robot CommitDate: Wed Jan 30 08:13:04 2019 -0500 Merge topic 'vs-msbuild-arch' da402a081b VS: Use MSBuild matching toolset host architecture 147d36ce93 Find native build tool after selecting a toolset Acked-by: Kitware Robot Merge-request: !2876 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=da402a081b6575b4813e5e8798105317b451ac1e commit da402a081b6575b4813e5e8798105317b451ac1e Author: Brad King AuthorDate: Mon Jan 28 13:33:32 2019 -0500 Commit: Brad King CommitDate: Tue Jan 29 09:11:00 2019 -0500 VS: Use MSBuild matching toolset host architecture VS 2017 and VS 2019 provide `amd64/MSBuild.exe` variants next to their `MSBuild.exe` tools. When the 64-bit host toolchain is selected (e.g. via `host=x64`), select the 64-bit MSBuild too. Fixes: #18219 diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx index bc6b453..12d9304 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx +++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx @@ -471,6 +471,18 @@ std::string cmGlobalVisualStudioVersionedGenerator::FindMSBuildCommand() // Ask Visual Studio Installer tool. std::string vs; if (vsSetupAPIHelper.GetVSInstanceInfo(vs)) { + std::string const& hostArch = + this->GetPlatformToolsetHostArchitectureString(); + if (hostArch == "x64") { + msbuild = vs + "/MSBuild/Current/Bin/amd64/MSBuild.exe"; + if (cmSystemTools::FileExists(msbuild)) { + return msbuild; + } + msbuild = vs + "/MSBuild/15.0/Bin/amd64/MSBuild.exe"; + if (cmSystemTools::FileExists(msbuild)) { + return msbuild; + } + } msbuild = vs + "/MSBuild/Current/Bin/MSBuild.exe"; if (cmSystemTools::FileExists(msbuild)) { return msbuild; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=147d36ce93d563df4ce1899facbb256e6bc9bbb2 commit 147d36ce93d563df4ce1899facbb256e6bc9bbb2 Author: Brad King AuthorDate: Mon Jan 28 13:31:01 2019 -0500 Commit: Brad King CommitDate: Tue Jan 29 09:09:18 2019 -0500 Find native build tool after selecting a toolset This will allow `CMAKE_GENERATOR_TOOLSET` to influence build tool selection. For reference, commit f8cb9944a1 (Find native build tool after determining the target system, 2017-09-26, v3.10.0-rc1~31^2) already delayed this step from where it was historically. diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 04af013..ccf7c73 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -568,11 +568,6 @@ void cmGlobalGenerator::EnableLanguage( return; } - // Find the native build tool for this generator. - if (!this->FindMakeProgram(mf)) { - return; - } - // Tell the generator about the target system. std::string system = mf->GetSafeDefinition("CMAKE_SYSTEM_NAME"); if (!this->SetSystemName(system, mf)) { @@ -593,6 +588,11 @@ void cmGlobalGenerator::EnableLanguage( cmSystemTools::SetFatalErrorOccured(); return; } + + // Find the native build tool for this generator. + if (!this->FindMakeProgram(mf)) { + return; + } } // Check that the languages are supported by the generator and its https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a94355c7b781378f73b70010ee97f9d5d6209e68 commit a94355c7b781378f73b70010ee97f9d5d6209e68 Author: Craig Scott AuthorDate: Sun Jan 20 19:53:27 2019 +1100 Commit: Craig Scott CommitDate: Sat Jan 26 16:49:15 2019 +1100 FetchContent: Add new command FetchContent_MakeAvailable() Relates: #18754 diff --git a/Help/release/dev/fetchcontent-reduce-boilerplate.rst b/Help/release/dev/fetchcontent-reduce-boilerplate.rst new file mode 100644 index 0000000..6157668 --- /dev/null +++ b/Help/release/dev/fetchcontent-reduce-boilerplate.rst @@ -0,0 +1,8 @@ +fetchcontent-reduce-boilerplate +------------------------------- + +* The FetchContent module gained a new :command:`FetchContent_MakeAvailable` + command. This new command accepts a list of dependency names, which it then + iterates over, populating and adding each one to the main build using the + canonical pattern. This significantly reduces the amount of boilerplate + needed in the project. diff --git a/Modules/FetchContent.cmake b/Modules/FetchContent.cmake index 8a7ac74..5716b01 100644 --- a/Modules/FetchContent.cmake +++ b/Modules/FetchContent.cmake @@ -20,9 +20,12 @@ configure step to use the content in commands like :command:`add_subdirectory`, :command:`include` or :command:`file` operations. Content population details would normally be defined separately from the -command that performs the actual population. Projects should also -check whether the content has already been populated somewhere else in the -project hierarchy. Typical usage would look something like this: +command that performs the actual population. This separation ensures that +all of the dependency details are defined before anything may try to use those +details to populate content. This is particularly important in more complex +project hierarchies where dependencies may be shared between multiple projects. + +The following shows a typical example of declaring content details: .. code-block:: cmake @@ -32,21 +35,37 @@ project hierarchy. Typical usage would look something like this: GIT_TAG release-1.8.0 ) +For most typical cases, populating the content can then be done with a single +command like so: + +.. code-block:: cmake + + FetchContent_MakeAvailable(googletest) + +The above command not only populates the content, it also adds it to the main +build (if possible) so that the main build can use the populated project's +targets, etc. In some cases, the main project may need to have more precise +control over the population or may be required to explicitly define the +population steps (e.g. if CMake versions earlier than 3.14 need to be +supported). The typical pattern of such custom steps looks like this: + +.. code-block:: cmake + FetchContent_GetProperties(googletest) if(NOT googletest_POPULATED) FetchContent_Populate(googletest) add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR}) endif() -When using the above pattern with a hierarchical project arrangement, -projects at higher levels in the hierarchy are able to define or override -the population details of content specified anywhere lower in the project -hierarchy. The ability to detect whether content has already been -populated ensures that even if multiple child projects want certain content -to be available, the first one to populate it wins. The other child project -can simply make use of the already available content instead of repeating -the population for itself. See the -:ref:`Examples ` section which demonstrates +Regardless of which population method is used, when using the +declare-populate pattern with a hierarchical project arrangement, projects at +higher levels in the hierarchy are able to override the population details of +content specified anywhere lower in the project hierarchy. The ability to +detect whether content has already been populated ensures that even if +multiple child projects want certain content to be available, the first one +to populate it wins. The other child project can simply make use of the +already available content instead of repeating the population for itself. +See the :ref:`Examples ` section which demonstrates this scenario. The ``FetchContent`` module also supports defining and populating @@ -113,6 +132,38 @@ Declaring Content Details Populating The Content ^^^^^^^^^^^^^^^^^^^^^^ +For most common scenarios, population means making content available to the +main build according to previously declared details for that dependency. +There are two main patterns for populating content, one based on calling +:command:`FetchContent_GetProperties` and +:command:`FetchContent_Populate` for more precise control and the other on +calling :command:`FetchContent_MakeAvailable` for a simpler, more automated +approach. The former generally follows this canonical pattern: + +.. _`fetch-content-canonical-pattern`: + +.. code-block:: cmake + + # Check if population has already been performed + FetchContent_GetProperties() + string(TOLOWER "" lcName) + if(NOT ${lcName}_POPULATED) + # Fetch the content using previously declared details + FetchContent_Populate() + + # Set custom variables, policies, etc. + # ... + + # Bring the populated content into the build + add_subdirectory(${${lcName}_SOURCE_DIR} ${${lcName}_BINARY_DIR}) + endif() + +The above is such a common pattern that, where no custom steps are needed +between the calls to :command:`FetchContent_Populate` and +:command:`add_subdirectory`, equivalent logic can be obtained by calling +:command:`FetchContent_MakeAvailable` instead (and should be preferred where +it meets the needs of the project). + .. command:: FetchContent_Populate .. code-block:: cmake @@ -309,9 +360,6 @@ Populating The Content on the command line invoking the script. -Retrieve Population Properties -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - .. command:: FetchContent_GetProperties When using saved content details, a call to :command:`FetchContent_Populate` @@ -343,28 +391,65 @@ Retrieve Population Properties FetchContent_GetProperties(foobar) if(NOT foobar_POPULATED) FetchContent_Populate(foobar) - - # Set any custom variables, etc. here, then - # populate the content as part of this build - - add_subdirectory(${foobar_SOURCE_DIR} ${foobar_BINARY_DIR}) + ... endif() The above pattern allows other parts of the overall project hierarchy to re-use the same content and ensure that it is only populated once. +.. command:: FetchContent_MakeAvailable + + .. code-block:: cmake + + FetchContent_MakeAvailable( [...] ) + + This command implements the common pattern typically needed for most + dependencies. It iterates over each of the named dependencies in turn + and for each one it loosely follows the same + :ref:`canonical pattern ` as + presented at the beginning of this section. One small difference to + that pattern is that it will only call :command:`add_subdirectory` on the + populated content if there is a ``CMakeLists.txt`` file in its top level + source directory. This allows the command to be used for dependencies + that make downloaded content available at a known location but which do + not need or support being added directly to the build. + + .. _`fetch-content-examples`: Examples ^^^^^^^^ -Consider a project hierarchy where ``projA`` is the top level project and it -depends on projects ``projB`` and ``projC``. Both ``projB`` and ``projC`` -can be built standalone and they also both depend on another project -``projD``. For simplicity, this example will assume that all four projects -are available on a company git server. The ``CMakeLists.txt`` of each project -might have sections like the following: +This first fairly straightforward example ensures that some popular testing +frameworks are available to the main build: + +.. code-block:: cmake + + include(FetchContent) + FetchContent_Declare( + googletest + GIT_REPOSITORY https://github.com/google/googletest.git + GIT_TAG release-1.8.0 + ) + FetchContent_Declare( + Catch2 + GIT_REPOSITORY https://github.com/catchorg/Catch2.git + GIT_TAG v2.5.0 + ) + + # After the following call, the CMake targets defined by googletest and + # Catch2 will be defined and available to the rest of the build + FetchContent_MakeAvailable(googletest Catch2) + + +In more complex project hierarchies, the dependency relationships can be more +complicated. Consider a hierarchy where ``projA`` is the top level project and +it depends directly on projects ``projB`` and ``projC``. Both ``projB`` and +``projC`` can be built standalone and they also both depend on another project +``projD``. ``projB`` additionally depends on ``projE``. This example assumes +that all five projects are available on a company git server. The +``CMakeLists.txt`` of each project might have sections like the following: *projA*: @@ -386,18 +471,14 @@ might have sections like the following: GIT_REPOSITORY git at mycompany.com:git/projD.git GIT_TAG origin/integrationBranch ) + FetchContent_Declare( + projE + GIT_REPOSITORY git at mycompany.com:git/projE.git + GIT_TAG origin/release/2.3-rc1 + ) - FetchContent_GetProperties(projB) - if(NOT projb_POPULATED) - FetchContent_Populate(projB) - add_subdirectory(${projb_SOURCE_DIR} ${projb_BINARY_DIR}) - endif() - - FetchContent_GetProperties(projC) - if(NOT projc_POPULATED) - FetchContent_Populate(projC) - add_subdirectory(${projc_SOURCE_DIR} ${projc_BINARY_DIR}) - endif() + # Order is important, see notes in the discussion further below + FetchContent_MakeAvailable(projD projB projC) *projB*: @@ -409,13 +490,13 @@ might have sections like the following: GIT_REPOSITORY git at mycompany.com:git/projD.git GIT_TAG 20b415f9034bbd2a2e8216e9a5c9e632 ) + FetchContent_Declare( + projE + GIT_REPOSITORY git at mycompany.com:git/projE.git + GIT_TAG 68e20f674a48be38d60e129f600faf7d + ) - FetchContent_GetProperties(projD) - if(NOT projd_POPULATED) - FetchContent_Populate(projD) - add_subdirectory(${projd_SOURCE_DIR} ${projd_BINARY_DIR}) - endif() - + FetchContent_MakeAvailable(projD projE) *projC*: @@ -428,44 +509,73 @@ might have sections like the following: GIT_TAG 7d9a17ad2c962aa13e2fbb8043fb6b8a ) + # This particular version of projD requires workarounds FetchContent_GetProperties(projD) if(NOT projd_POPULATED) FetchContent_Populate(projD) + + # Copy an additional/replacement file into the populated source + file(COPY someFile.c DESTINATION ${projd_SOURCE_DIR}/src) + add_subdirectory(${projd_SOURCE_DIR} ${projd_BINARY_DIR}) endif() A few key points should be noted in the above: - ``projB`` and ``projC`` define different content details for ``projD``, - but ``projA`` also defines a set of content details for ``projD`` and - because ``projA`` will define them first, the details from ``projB`` and + but ``projA`` also defines a set of content details for ``projD``. + Because ``projA`` will define them first, the details from ``projB`` and ``projC`` will not be used. The override details defined by ``projA`` are not required to match either of those from ``projB`` or ``projC``, but it is up to the higher level project to ensure that the details it does define still make sense for the child projects. -- While ``projA`` defined content details for ``projD``, it did not need - to explicitly call ``FetchContent_Populate(projD)`` itself. Instead, it - leaves that to a child project to do (in this case it will be ``projB`` - since it is added to the build ahead of ``projC``). If ``projA`` needed to - customize how the ``projD`` content was brought into the build as well - (e.g. define some CMake variables before calling - :command:`add_subdirectory` after populating), it would do the call to - ``FetchContent_Populate()``, etc. just as it did for the ``projB`` and - ``projC`` content. For higher level projects, it is usually enough to - just define the override content details and leave the actual population - to the child projects. This saves repeating the same thing at each level - of the project hierarchy unnecessarily. -- Even though ``projA`` is the top level project in this example, it still - checks whether ``projB`` and ``projC`` have already been populated before - going ahead to do those populations. This makes ``projA`` able to be more - easily incorporated as a child of some other higher level project in the - future if required. Always protect a call to - :command:`FetchContent_Populate` with a check to - :command:`FetchContent_GetProperties`, even in what may be considered a top - level project at the time. - - -The following example demonstrates how one might download and unpack a +- In the ``projA`` call to :command:`FetchContent_MakeAvailable`, ``projD`` + is listed ahead of ``projB`` and ``projC`` to ensure that ``projA`` is in + control of how ``projD`` is populated. +- While ``projA`` defines content details for ``projE``, it does not need + to explicitly call ``FetchContent_MakeAvailable(projE)`` or + ``FetchContent_Populate(projD)`` itself. Instead, it leaves that to the + child ``projB``. For higher level projects, it is often enough to just + define the override content details and leave the actual population to the + child projects. This saves repeating the same thing at each level of the + project hierarchy unnecessarily. + + +Projects don't always need to add the populated content to the build. +Sometimes the project just wants to make the downloaded content available at +a predictable location. The next example ensures that a set of standard +company toolchain files (and potentially even the toolchain binaries +themselves) is available early enough to be used for that same build. + +.. code-block:: cmake + + cmake_minimum_required(VERSION 3.14) + + include(FetchContent) + FetchContent_Declare( + mycom_toolchains + URL https://intranet.mycompany.com//toolchains_1.3.2.tar.gz + ) + FetchContent_MakeAvailable(mycom_toolchains) + + project(CrossCompileExample) + +The project could be configured to use one of the downloaded toolchains like +so: + +.. code-block:: shell + + cmake -DCMAKE_TOOLCHAIN_FILE=_deps/mycom_toolchains-src/toolchain_arm.cmake /path/to/src + +When CMake processes the ``CMakeLists.txt`` file, it will download and unpack +the tarball into ``_deps/mycompany_toolchains-src`` relative to the build +directory. The :variable:`CMAKE_TOOLCHAIN_FILE` variable is not used until +the :command:`project` command is reached, at which point CMake looks for the +named toolchain file relative to the build directory. Because the tarball has +already been downloaded and unpacked by then, the toolchain file will be in +place, even the very first time that ``cmake`` is run in the build directory. + +Lastly, the following example demonstrates how one might download and unpack a firmware tarball using CMake's :manual:`script mode `. The call to :command:`FetchContent_Populate` specifies all the content details and the unpacked firmware will be placed in a ``firmware`` directory below the @@ -921,3 +1031,31 @@ function(FetchContent_Populate contentName) set(${contentNameLower}_POPULATED True PARENT_SCOPE) endfunction() + +# Arguments are assumed to be the names of dependencies that have been +# declared previously and should be populated. It is not an error if +# any of them have already been populated (they will just be skipped in +# that case). The command is implemented as a macro so that the variables +# defined by the FetchContent_GetProperties() and FetchContent_Populate() +# calls will be available to the caller. +macro(FetchContent_MakeAvailable) + + foreach(contentName IN ITEMS ${ARGV}) + string(TOLOWER ${contentName} contentNameLower) + FetchContent_GetProperties(${contentName}) + if(NOT ${contentNameLower}_POPULATED) + FetchContent_Populate(${contentName}) + + # Only try to call add_subdirectory() if the populated content + # can be treated that way. Protecting the call with the check + # allows this function to be used for projects that just want + # to ensure the content exists, such as to provide content at + # a known location. + if(EXISTS ${${contentNameLower}_SOURCE_DIR}/CMakeLists.txt) + add_subdirectory(${${contentNameLower}_SOURCE_DIR} + ${${contentNameLower}_BINARY_DIR}) + endif() + endif() + endforeach() + +endmacro() diff --git a/Tests/RunCMake/FetchContent/MakeAvailable-stdout.txt b/Tests/RunCMake/FetchContent/MakeAvailable-stdout.txt new file mode 100644 index 0000000..6e6c730 --- /dev/null +++ b/Tests/RunCMake/FetchContent/MakeAvailable-stdout.txt @@ -0,0 +1,2 @@ +Confirmation project has been added +.*Confirmation script has been called diff --git a/Tests/RunCMake/FetchContent/MakeAvailable.cmake b/Tests/RunCMake/FetchContent/MakeAvailable.cmake new file mode 100644 index 0000000..a93f1f7 --- /dev/null +++ b/Tests/RunCMake/FetchContent/MakeAvailable.cmake @@ -0,0 +1,20 @@ +include(FetchContent) + +FetchContent_Declare( + WithProject + SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/WithProject +) +FetchContent_Declare( + WithoutProject + SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/WithoutProject +) + +# Order is important and will be verified by test output +FetchContent_MakeAvailable(WithProject WithoutProject) + +get_property(addedWith GLOBAL PROPERTY FetchWithProject SET) +if(NOT addedWith) + message(SEND_ERROR "Subdir with CMakeLists.txt not added") +endif() + +include(${withoutproject_SOURCE_DIR}/confirmMessage.cmake) diff --git a/Tests/RunCMake/FetchContent/MakeAvailableTwice-stdout.txt b/Tests/RunCMake/FetchContent/MakeAvailableTwice-stdout.txt new file mode 100644 index 0000000..8d3b7c0 --- /dev/null +++ b/Tests/RunCMake/FetchContent/MakeAvailableTwice-stdout.txt @@ -0,0 +1,4 @@ +-- Before first[ + ]+-- Confirmation project has been added[ + ]+-- Between both[ + ]+-- After last diff --git a/Tests/RunCMake/FetchContent/MakeAvailableTwice.cmake b/Tests/RunCMake/FetchContent/MakeAvailableTwice.cmake new file mode 100644 index 0000000..a9af020 --- /dev/null +++ b/Tests/RunCMake/FetchContent/MakeAvailableTwice.cmake @@ -0,0 +1,12 @@ +include(FetchContent) + +FetchContent_Declare( + WithProject + SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/WithProject +) + +message(STATUS "Before first") +FetchContent_MakeAvailable(WithProject) +message(STATUS "Between both") +FetchContent_MakeAvailable(WithProject) +message(STATUS "After last") diff --git a/Tests/RunCMake/FetchContent/MakeAvailableUndeclared-result.txt b/Tests/RunCMake/FetchContent/MakeAvailableUndeclared-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/FetchContent/MakeAvailableUndeclared-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/FetchContent/MakeAvailableUndeclared-stderr.txt b/Tests/RunCMake/FetchContent/MakeAvailableUndeclared-stderr.txt new file mode 100644 index 0000000..9715b78 --- /dev/null +++ b/Tests/RunCMake/FetchContent/MakeAvailableUndeclared-stderr.txt @@ -0,0 +1 @@ +No content details recorded for NoDetails diff --git a/Tests/RunCMake/FetchContent/MakeAvailableUndeclared.cmake b/Tests/RunCMake/FetchContent/MakeAvailableUndeclared.cmake new file mode 100644 index 0000000..bd57cbe --- /dev/null +++ b/Tests/RunCMake/FetchContent/MakeAvailableUndeclared.cmake @@ -0,0 +1,3 @@ +include(FetchContent) + +FetchContent_MakeAvailable(NoDetails) diff --git a/Tests/RunCMake/FetchContent/RunCMakeTest.cmake b/Tests/RunCMake/FetchContent/RunCMakeTest.cmake index 9c1ab66..e28ae96 100644 --- a/Tests/RunCMake/FetchContent/RunCMakeTest.cmake +++ b/Tests/RunCMake/FetchContent/RunCMakeTest.cmake @@ -11,6 +11,9 @@ run_cmake(VarDefinitions) run_cmake(GetProperties) run_cmake(DirOverrides) run_cmake(UsesTerminalOverride) +run_cmake(MakeAvailable) +run_cmake(MakeAvailableTwice) +run_cmake(MakeAvailableUndeclared) # We need to pass through CMAKE_GENERATOR and CMAKE_MAKE_PROGRAM # to ensure the test can run on machines where the build tool diff --git a/Tests/RunCMake/FetchContent/WithProject/CMakeLists.txt b/Tests/RunCMake/FetchContent/WithProject/CMakeLists.txt new file mode 100644 index 0000000..b6a3750 --- /dev/null +++ b/Tests/RunCMake/FetchContent/WithProject/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 3.13) +project(WithProject LANGUAGES NONE) + +set_property(GLOBAL PROPERTY FetchWithProject YES) +message(STATUS "Confirmation project has been added") diff --git a/Tests/RunCMake/FetchContent/WithoutProject/confirmMessage.cmake b/Tests/RunCMake/FetchContent/WithoutProject/confirmMessage.cmake new file mode 100644 index 0000000..a2f5c61 --- /dev/null +++ b/Tests/RunCMake/FetchContent/WithoutProject/confirmMessage.cmake @@ -0,0 +1 @@ +message(STATUS "Confirmation script has been called") https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=611d5274de677a42bdf744c48f0e4a29ea1bb1cd commit 611d5274de677a42bdf744c48f0e4a29ea1bb1cd Author: Craig Scott AuthorDate: Sat Jan 26 16:48:57 2019 +1100 Commit: Craig Scott CommitDate: Sat Jan 26 16:49:15 2019 +1100 Sphinx: Add limited support for nested variables in docs This is needed to allow example code to contain content like `${some_${foo}_bar}`. diff --git a/Utilities/Sphinx/cmake.py b/Utilities/Sphinx/cmake.py index 882cdc1..d903dbe 100644 --- a/Utilities/Sphinx/cmake.py +++ b/Utilities/Sphinx/cmake.py @@ -21,6 +21,8 @@ from pygments.lexer import bygroups # - Unix paths are recognized by '/'; support for Windows paths may be added if needed # - (\\.) allows for \-escapes (used in manual/cmake-language.7) # - $<..$<..$>..> nested occurence in cmake-buildsystem +# - Nested variable evaluations are only supported in a limited capacity. Only +# one level of nesting is supported and at most one nested variable can be present. CMakeLexer.tokens["root"] = [ (r'\b(\w+)([ \t]*)(\()', bygroups(Name.Function, Text, Name.Function), '#push'), # fctn( @@ -34,7 +36,8 @@ CMakeLexer.tokens["root"] = [ (r'[<>]=', Punctuation), # used in FindPkgConfig.cmake (r'\$<', Operator, '#push'), # $<...> (r'<[^<|]+?>(\w*\.\.\.)?', Name.Variable), # - (r'(\$\w*\{)(.+?)(\})', bygroups(Operator, Name.Tag, Operator)), # ${..} $ENV{..} + (r'(\$\w*\{)([^\}\$]*)?(?:(\$\w*\{)([^\}]+?)(\}))?([^\}]*?)(\})', # ${..} $ENV{..}, possibly nested + bygroups(Operator, Name.Tag, Operator, Name.Tag, Operator, Name.Tag, Operator)), (r'([A-Z]+\{)(.+?)(\})', bygroups(Operator, Name.Tag, Operator)), # DATA{ ...} (r'[a-z]+(@|(://))((\\.)|[\w.+-:/\\])+', Name.Attribute), # URL, git@, ... (r'/\w[\w\.\+-/\\]*', Name.Attribute), # absolute path https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1a07e1b47d2c0a5b19013f359bbdaecfd17387b2 commit 1a07e1b47d2c0a5b19013f359bbdaecfd17387b2 Author: Craig Scott AuthorDate: Sun Jan 20 17:21:51 2019 +1100 Commit: Craig Scott CommitDate: Sun Jan 20 17:21:51 2019 +1100 FetchContent: Trivial doc corrections diff --git a/Modules/FetchContent.cmake b/Modules/FetchContent.cmake index c65ae9e..8a7ac74 100644 --- a/Modules/FetchContent.cmake +++ b/Modules/FetchContent.cmake @@ -360,7 +360,7 @@ Examples ^^^^^^^^ Consider a project hierarchy where ``projA`` is the top level project and it -depends on projects ``projB`` and ``projC``. Both ``projB`` and ``projC`` +depends on projects ``projB`` and ``projC``. Both ``projB`` and ``projC`` can be built standalone and they also both depend on another project ``projD``. For simplicity, this example will assume that all four projects are available on a company git server. The ``CMakeLists.txt`` of each project @@ -373,17 +373,17 @@ might have sections like the following: include(FetchContent) FetchContent_Declare( projB - GIT_REPOSITORY git at mycompany.com/git/projB.git + GIT_REPOSITORY git at mycompany.com:git/projB.git GIT_TAG 4a89dc7e24ff212a7b5167bef7ab079d ) FetchContent_Declare( projC - GIT_REPOSITORY git at mycompany.com/git/projC.git + GIT_REPOSITORY git at mycompany.com:git/projC.git GIT_TAG 4ad4016bd1d8d5412d135cf8ceea1bb9 ) FetchContent_Declare( projD - GIT_REPOSITORY git at mycompany.com/git/projD.git + GIT_REPOSITORY git at mycompany.com:git/projD.git GIT_TAG origin/integrationBranch ) @@ -406,7 +406,7 @@ might have sections like the following: include(FetchContent) FetchContent_Declare( projD - GIT_REPOSITORY git at mycompany.com/git/projD.git + GIT_REPOSITORY git at mycompany.com:git/projD.git GIT_TAG 20b415f9034bbd2a2e8216e9a5c9e632 ) @@ -424,7 +424,7 @@ might have sections like the following: include(FetchContent) FetchContent_Declare( projD - GIT_REPOSITORY git at mycompany.com/git/projD.git + GIT_REPOSITORY git at mycompany.com:git/projD.git GIT_TAG 7d9a17ad2c962aa13e2fbb8043fb6b8a ) ----------------------------------------------------------------------- Summary of changes: .../dev/fetchcontent-reduce-boilerplate.rst | 8 + Modules/FetchContent.cmake | 284 +++++++++++++++------ Source/cmGlobalGenerator.cxx | 10 +- Source/cmGlobalVisualStudioVersionedGenerator.cxx | 12 + .../RunCMake/FetchContent/MakeAvailable-stdout.txt | 2 + Tests/RunCMake/FetchContent/MakeAvailable.cmake | 20 ++ .../FetchContent/MakeAvailableTwice-stdout.txt | 4 + .../RunCMake/FetchContent/MakeAvailableTwice.cmake | 12 + .../MakeAvailableUndeclared-result.txt} | 0 .../MakeAvailableUndeclared-stderr.txt | 1 + .../FetchContent/MakeAvailableUndeclared.cmake | 3 + Tests/RunCMake/FetchContent/RunCMakeTest.cmake | 3 + .../FetchContent/WithProject/CMakeLists.txt | 5 + .../WithoutProject/confirmMessage.cmake | 1 + Utilities/Sphinx/cmake.py | 5 +- 15 files changed, 291 insertions(+), 79 deletions(-) create mode 100644 Help/release/dev/fetchcontent-reduce-boilerplate.rst create mode 100644 Tests/RunCMake/FetchContent/MakeAvailable-stdout.txt create mode 100644 Tests/RunCMake/FetchContent/MakeAvailable.cmake create mode 100644 Tests/RunCMake/FetchContent/MakeAvailableTwice-stdout.txt create mode 100644 Tests/RunCMake/FetchContent/MakeAvailableTwice.cmake copy Tests/RunCMake/{while/MissingArgument-result.txt => FetchContent/MakeAvailableUndeclared-result.txt} (100%) create mode 100644 Tests/RunCMake/FetchContent/MakeAvailableUndeclared-stderr.txt create mode 100644 Tests/RunCMake/FetchContent/MakeAvailableUndeclared.cmake create mode 100644 Tests/RunCMake/FetchContent/WithProject/CMakeLists.txt create mode 100644 Tests/RunCMake/FetchContent/WithoutProject/confirmMessage.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Wed Jan 30 14:03:07 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 30 Jan 2019 14:03:07 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-1212-geb2c238 Message-ID: <20190130190307.037C111F4BA@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via eb2c23868fe712a0c79b3afe6618e20507c0f9f5 (commit) via b05b778a2dfbcb6978d652dfa27bd52cc649f736 (commit) from 748d024551d8f447046363ad617fc72bdd977fd2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=eb2c23868fe712a0c79b3afe6618e20507c0f9f5 commit eb2c23868fe712a0c79b3afe6618e20507c0f9f5 Merge: 748d024 b05b778 Author: Brad King AuthorDate: Wed Jan 30 19:00:47 2019 +0000 Commit: Kitware Robot CommitDate: Wed Jan 30 14:00:58 2019 -0500 Merge topic 'tidy-use-equals-delete' b05b778a2d clang-tidy: Use `= delete` Acked-by: Kitware Robot Rejected-by: vvs31415 Merge-request: !2848 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b05b778a2dfbcb6978d652dfa27bd52cc649f736 commit b05b778a2dfbcb6978d652dfa27bd52cc649f736 Author: Regina Pfeifer AuthorDate: Wed Jan 23 20:30:01 2019 +0100 Commit: Brad King CommitDate: Tue Jan 29 14:09:21 2019 -0500 clang-tidy: Use `= delete` diff --git a/.clang-tidy b/.clang-tidy index dace6f1..470add6 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -14,7 +14,6 @@ modernize-*,\ -modernize-raw-string-literal,\ -modernize-return-braced-init-list,\ -modernize-use-auto,\ --modernize-use-equals-delete,\ -modernize-use-noexcept,\ -modernize-use-transparent-functors,\ -modernize-use-using,\ diff --git a/Help/dev/source.rst b/Help/dev/source.rst index 6697d38..47baff4 100644 --- a/Help/dev/source.rst +++ b/Help/dev/source.rst @@ -30,16 +30,6 @@ building on older toolchains some constructs need to be handled with care: The ``std::auto_ptr`` template is deprecated in C++11. Use ``std::unique_ptr``. -* Use ``CM_DISABLE_COPY(Class)`` to mark classes as non-copyable. - - The ``CM_DISABLE_COPY`` macro should be used in the private section of a - class to make sure that attempts to copy or assign an instance of the class - lead to compiler errors even if the compiler does not support *deleted* - functions. As a guideline, all polymorphic classes should be made - non-copyable in order to avoid slicing. Classes that are composed of or - derived from non-copyable classes must also be made non-copyable explicitly - with ``CM_DISABLE_COPY``. - Source Tree Layout ================== diff --git a/Source/CursesDialog/cmCursesBoolWidget.h b/Source/CursesDialog/cmCursesBoolWidget.h index cdb9478..8c96256 100644 --- a/Source/CursesDialog/cmCursesBoolWidget.h +++ b/Source/CursesDialog/cmCursesBoolWidget.h @@ -12,11 +12,12 @@ class cmCursesMainForm; class cmCursesBoolWidget : public cmCursesWidget { - CM_DISABLE_COPY(cmCursesBoolWidget) - public: cmCursesBoolWidget(int width, int height, int left, int top); + cmCursesBoolWidget(cmCursesBoolWidget const&) = delete; + cmCursesBoolWidget& operator=(cmCursesBoolWidget const&) = delete; + // Description: // Handle user input. Called by the container of this widget // when this widget has focus. Returns true if the input was diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.h b/Source/CursesDialog/cmCursesCacheEntryComposite.h index 54b2f1f..0a69d3a 100644 --- a/Source/CursesDialog/cmCursesCacheEntryComposite.h +++ b/Source/CursesDialog/cmCursesCacheEntryComposite.h @@ -13,14 +13,17 @@ class cmake; class cmCursesCacheEntryComposite { - CM_DISABLE_COPY(cmCursesCacheEntryComposite) - public: cmCursesCacheEntryComposite(const std::string& key, int labelwidth, int entrywidth); cmCursesCacheEntryComposite(const std::string& key, cmake* cm, bool isNew, int labelwidth, int entrywidth); ~cmCursesCacheEntryComposite(); + + cmCursesCacheEntryComposite(cmCursesCacheEntryComposite const&) = delete; + cmCursesCacheEntryComposite& operator=(cmCursesCacheEntryComposite const&) = + delete; + const char* GetValue(); friend class cmCursesMainForm; diff --git a/Source/CursesDialog/cmCursesDummyWidget.h b/Source/CursesDialog/cmCursesDummyWidget.h index c509ae7..07b7288 100644 --- a/Source/CursesDialog/cmCursesDummyWidget.h +++ b/Source/CursesDialog/cmCursesDummyWidget.h @@ -12,11 +12,12 @@ class cmCursesMainForm; class cmCursesDummyWidget : public cmCursesWidget { - CM_DISABLE_COPY(cmCursesDummyWidget) - public: cmCursesDummyWidget(int width, int height, int left, int top); + cmCursesDummyWidget(cmCursesDummyWidget const&) = delete; + cmCursesDummyWidget& operator=(cmCursesDummyWidget const&) = delete; + // Description: // Handle user input. Called by the container of this widget // when this widget has focus. Returns true if the input was diff --git a/Source/CursesDialog/cmCursesFilePathWidget.h b/Source/CursesDialog/cmCursesFilePathWidget.h index 0a30402..3f71259 100644 --- a/Source/CursesDialog/cmCursesFilePathWidget.h +++ b/Source/CursesDialog/cmCursesFilePathWidget.h @@ -9,10 +9,11 @@ class cmCursesFilePathWidget : public cmCursesPathWidget { - CM_DISABLE_COPY(cmCursesFilePathWidget) - public: cmCursesFilePathWidget(int width, int height, int left, int top); + + cmCursesFilePathWidget(cmCursesFilePathWidget const&) = delete; + cmCursesFilePathWidget& operator=(cmCursesFilePathWidget const&) = delete; }; #endif // cmCursesFilePathWidget_h diff --git a/Source/CursesDialog/cmCursesForm.h b/Source/CursesDialog/cmCursesForm.h index 249b349..ddb67de 100644 --- a/Source/CursesDialog/cmCursesForm.h +++ b/Source/CursesDialog/cmCursesForm.h @@ -11,12 +11,13 @@ class cmCursesForm { - CM_DISABLE_COPY(cmCursesForm) - public: cmCursesForm(); virtual ~cmCursesForm(); + cmCursesForm(cmCursesForm const&) = delete; + cmCursesForm& operator=(cmCursesForm const&) = delete; + // Description: // Handle user input. virtual void HandleInput() = 0; diff --git a/Source/CursesDialog/cmCursesLabelWidget.h b/Source/CursesDialog/cmCursesLabelWidget.h index aab559b..2ee9cfc 100644 --- a/Source/CursesDialog/cmCursesLabelWidget.h +++ b/Source/CursesDialog/cmCursesLabelWidget.h @@ -14,13 +14,14 @@ class cmCursesMainForm; class cmCursesLabelWidget : public cmCursesWidget { - CM_DISABLE_COPY(cmCursesLabelWidget) - public: cmCursesLabelWidget(int width, int height, int left, int top, const std::string& name); ~cmCursesLabelWidget() override; + cmCursesLabelWidget(cmCursesLabelWidget const&) = delete; + cmCursesLabelWidget& operator=(cmCursesLabelWidget const&) = delete; + // Description: // Handle user input. Called by the container of this widget // when this widget has focus. Returns true if the input was diff --git a/Source/CursesDialog/cmCursesLongMessageForm.h b/Source/CursesDialog/cmCursesLongMessageForm.h index 2bcc15a..466b4e1 100644 --- a/Source/CursesDialog/cmCursesLongMessageForm.h +++ b/Source/CursesDialog/cmCursesLongMessageForm.h @@ -13,13 +13,14 @@ class cmCursesLongMessageForm : public cmCursesForm { - CM_DISABLE_COPY(cmCursesLongMessageForm) - public: cmCursesLongMessageForm(std::vector const& messages, const char* title); ~cmCursesLongMessageForm() override; + cmCursesLongMessageForm(cmCursesLongMessageForm const&) = delete; + cmCursesLongMessageForm& operator=(cmCursesLongMessageForm const&) = delete; + // Description: // Handle user input. void HandleInput() override; diff --git a/Source/CursesDialog/cmCursesMainForm.h b/Source/CursesDialog/cmCursesMainForm.h index 824025b..63dbc1b 100644 --- a/Source/CursesDialog/cmCursesMainForm.h +++ b/Source/CursesDialog/cmCursesMainForm.h @@ -23,12 +23,13 @@ class cmake; */ class cmCursesMainForm : public cmCursesForm { - CM_DISABLE_COPY(cmCursesMainForm) - public: cmCursesMainForm(std::vector args, int initwidth); ~cmCursesMainForm() override; + cmCursesMainForm(cmCursesMainForm const&) = delete; + cmCursesMainForm& operator=(cmCursesMainForm const&) = delete; + /** * Set the widgets which represent the cache entries. */ diff --git a/Source/CursesDialog/cmCursesOptionsWidget.h b/Source/CursesDialog/cmCursesOptionsWidget.h index 3e50e2d..0128d6a 100644 --- a/Source/CursesDialog/cmCursesOptionsWidget.h +++ b/Source/CursesDialog/cmCursesOptionsWidget.h @@ -15,11 +15,12 @@ class cmCursesMainForm; class cmCursesOptionsWidget : public cmCursesWidget { - CM_DISABLE_COPY(cmCursesOptionsWidget) - public: cmCursesOptionsWidget(int width, int height, int left, int top); + cmCursesOptionsWidget(cmCursesOptionsWidget const&) = delete; + cmCursesOptionsWidget& operator=(cmCursesOptionsWidget const&) = delete; + // Description: // Handle user input. Called by the container of this widget // when this widget has focus. Returns true if the input was diff --git a/Source/CursesDialog/cmCursesPathWidget.h b/Source/CursesDialog/cmCursesPathWidget.h index bfa0ea3..1eace03 100644 --- a/Source/CursesDialog/cmCursesPathWidget.h +++ b/Source/CursesDialog/cmCursesPathWidget.h @@ -14,11 +14,12 @@ class cmCursesMainForm; class cmCursesPathWidget : public cmCursesStringWidget { - CM_DISABLE_COPY(cmCursesPathWidget) - public: cmCursesPathWidget(int width, int height, int left, int top); + cmCursesPathWidget(cmCursesPathWidget const&) = delete; + cmCursesPathWidget& operator=(cmCursesPathWidget const&) = delete; + /** * This method is called when different keys are pressed. The * subclass can have a special implementation handler for this. diff --git a/Source/CursesDialog/cmCursesStringWidget.h b/Source/CursesDialog/cmCursesStringWidget.h index 90310f6..021515b 100644 --- a/Source/CursesDialog/cmCursesStringWidget.h +++ b/Source/CursesDialog/cmCursesStringWidget.h @@ -20,11 +20,12 @@ class cmCursesMainForm; class cmCursesStringWidget : public cmCursesWidget { - CM_DISABLE_COPY(cmCursesStringWidget) - public: cmCursesStringWidget(int width, int height, int left, int top); + cmCursesStringWidget(cmCursesStringWidget const&) = delete; + cmCursesStringWidget& operator=(cmCursesStringWidget const&) = delete; + /** * Handle user input. Called by the container of this widget * when this widget has focus. Returns true if the input was diff --git a/Source/CursesDialog/cmCursesWidget.h b/Source/CursesDialog/cmCursesWidget.h index a44c5e6..f761f6d 100644 --- a/Source/CursesDialog/cmCursesWidget.h +++ b/Source/CursesDialog/cmCursesWidget.h @@ -14,12 +14,13 @@ class cmCursesMainForm; class cmCursesWidget { - CM_DISABLE_COPY(cmCursesWidget) - public: cmCursesWidget(int width, int height, int left, int top); virtual ~cmCursesWidget(); + cmCursesWidget(cmCursesWidget const&) = delete; + cmCursesWidget& operator=(cmCursesWidget const&) = delete; + /** * Handle user input. Called by the container of this widget * when this widget has focus. Returns true if the input was diff --git a/Source/cmCLocaleEnvironmentScope.h b/Source/cmCLocaleEnvironmentScope.h index ec81cb9..93032c1 100644 --- a/Source/cmCLocaleEnvironmentScope.h +++ b/Source/cmCLocaleEnvironmentScope.h @@ -10,12 +10,14 @@ class cmCLocaleEnvironmentScope { - CM_DISABLE_COPY(cmCLocaleEnvironmentScope) - public: cmCLocaleEnvironmentScope(); ~cmCLocaleEnvironmentScope(); + cmCLocaleEnvironmentScope(cmCLocaleEnvironmentScope const&) = delete; + cmCLocaleEnvironmentScope& operator=(cmCLocaleEnvironmentScope const&) = + delete; + private: std::string GetEnv(std::string const& key); void SetEnv(std::string const& key, std::string const& value); diff --git a/Source/cmCPackPropertiesGenerator.h b/Source/cmCPackPropertiesGenerator.h index e580e04..ad943c5 100644 --- a/Source/cmCPackPropertiesGenerator.h +++ b/Source/cmCPackPropertiesGenerator.h @@ -20,13 +20,15 @@ class cmLocalGenerator; */ class cmCPackPropertiesGenerator : public cmScriptGenerator { - CM_DISABLE_COPY(cmCPackPropertiesGenerator) - public: cmCPackPropertiesGenerator(cmLocalGenerator* lg, cmInstalledFile const& installedFile, std::vector const& configurations); + cmCPackPropertiesGenerator(cmCPackPropertiesGenerator const&) = delete; + cmCPackPropertiesGenerator& operator=(cmCPackPropertiesGenerator const&) = + delete; + protected: void GenerateScriptForConfig(std::ostream& os, const std::string& config, Indent indent) override; diff --git a/Source/cmCommand.h b/Source/cmCommand.h index 07333bb..9ccd773 100644 --- a/Source/cmCommand.h +++ b/Source/cmCommand.h @@ -24,8 +24,6 @@ struct cmListFileArgument; */ class cmCommand { - CM_DISABLE_COPY(cmCommand) - public: /** * Construct the command. By default it has no makefile. @@ -37,6 +35,9 @@ public: */ virtual ~cmCommand() = default; + cmCommand(cmCommand const&) = delete; + cmCommand& operator=(cmCommand const&) = delete; + /** * Specify the makefile. */ diff --git a/Source/cmCommandArgumentParserHelper.h b/Source/cmCommandArgumentParserHelper.h index 4dc238e..25e6892 100644 --- a/Source/cmCommandArgumentParserHelper.h +++ b/Source/cmCommandArgumentParserHelper.h @@ -12,8 +12,6 @@ class cmMakefile; class cmCommandArgumentParserHelper { - CM_DISABLE_COPY(cmCommandArgumentParserHelper) - public: struct ParserType { @@ -23,6 +21,10 @@ public: cmCommandArgumentParserHelper(); ~cmCommandArgumentParserHelper(); + cmCommandArgumentParserHelper(cmCommandArgumentParserHelper const&) = delete; + cmCommandArgumentParserHelper& operator=( + cmCommandArgumentParserHelper const&) = delete; + int ParseString(const char* str, int verb); // For the lexer: diff --git a/Source/cmCommandArgumentsHelper.h b/Source/cmCommandArgumentsHelper.h index 9579861..dc934be 100644 --- a/Source/cmCommandArgumentsHelper.h +++ b/Source/cmCommandArgumentsHelper.h @@ -103,7 +103,6 @@ private: std::vector Vector; unsigned int DataStart; const char* Ignore; - cmCAStringVector(); bool DoConsume(const std::string& arg, unsigned int index) override; void DoReset() override; }; @@ -125,7 +124,6 @@ private: unsigned int DataStart; bool DoConsume(const std::string& arg, unsigned int index) override; void DoReset() override; - cmCAString(); }; /** cmCAEnabler is to be used for options which are off by default and can be @@ -143,7 +141,6 @@ private: bool Enabled; bool DoConsume(const std::string& arg, unsigned int index) override; void DoReset() override; - cmCAEnabler(); }; /** cmCADisable is to be used for options which are on by default and can be @@ -161,7 +158,6 @@ private: bool Enabled; bool DoConsume(const std::string& arg, unsigned int index) override; void DoReset() override; - cmCADisabler(); }; /** Group of arguments, needed for ordering. E.g. WIN32, EXCLUDE_FROM_ALL and diff --git a/Source/cmConfigure.cmake.h.in b/Source/cmConfigure.cmake.h.in index 9d00c21..19b1cd4 100644 --- a/Source/cmConfigure.cmake.h.in +++ b/Source/cmConfigure.cmake.h.in @@ -26,8 +26,4 @@ #define CM_FALLTHROUGH cmsys_FALLTHROUGH -#define CM_DISABLE_COPY(Class) \ - Class(Class const&) = delete; \ - Class& operator=(Class const&) = delete; - #endif diff --git a/Source/cmConnection.h b/Source/cmConnection.h index 3a7f1b9..092b913 100644 --- a/Source/cmConnection.h +++ b/Source/cmConnection.h @@ -60,11 +60,12 @@ public: class cmConnection { - CM_DISABLE_COPY(cmConnection) - public: cmConnection() = default; + cmConnection(cmConnection const&) = delete; + cmConnection& operator=(cmConnection const&) = delete; + virtual void WriteData(const std::string& data) = 0; virtual ~cmConnection(); diff --git a/Source/cmCryptoHash.h b/Source/cmCryptoHash.h index 1f2a1b5..b712f09 100644 --- a/Source/cmCryptoHash.h +++ b/Source/cmCryptoHash.h @@ -15,8 +15,6 @@ */ class cmCryptoHash { - CM_DISABLE_COPY(cmCryptoHash) - public: enum Algo { @@ -35,6 +33,9 @@ public: cmCryptoHash(Algo algo); ~cmCryptoHash(); + cmCryptoHash(cmCryptoHash const&) = delete; + cmCryptoHash& operator=(cmCryptoHash const&) = delete; + /// @brief Returns a new hash generator of the requested type /// @arg algo Hash type name. Supported hash types are /// MD5, SHA1, SHA224, SHA256, SHA384, SHA512, diff --git a/Source/cmDepends.h b/Source/cmDepends.h index c5e1d5b..20c91ca 100644 --- a/Source/cmDepends.h +++ b/Source/cmDepends.h @@ -24,13 +24,14 @@ class cmLocalGenerator; */ class cmDepends { - CM_DISABLE_COPY(cmDepends) - public: /** Instances need to know the build directory name and the relative path from the build directory to the target file. */ cmDepends(cmLocalGenerator* lg = nullptr, std::string targetDir = ""); + cmDepends(cmDepends const&) = delete; + cmDepends& operator=(cmDepends const&) = delete; + /** Set the local generator for the directory in which we are scanning dependencies. This is not a full local generator; it has been setup to do relative path conversions for the current diff --git a/Source/cmDependsC.h b/Source/cmDependsC.h index 411458a..eee5ae1 100644 --- a/Source/cmDependsC.h +++ b/Source/cmDependsC.h @@ -22,8 +22,6 @@ class cmLocalGenerator; */ class cmDependsC : public cmDepends { - CM_DISABLE_COPY(cmDependsC) - public: /** Checking instances need to know the build directory name and the relative path from the build directory to the target file. */ @@ -35,6 +33,9 @@ public: /** Virtual destructor to cleanup subclasses properly. */ ~cmDependsC() override; + cmDependsC(cmDependsC const&) = delete; + cmDependsC& operator=(cmDependsC const&) = delete; + protected: // Implement writing/checking methods required by superclass. bool WriteDependencies(const std::set& sources, diff --git a/Source/cmDependsFortran.h b/Source/cmDependsFortran.h index f5f5be2..bf09904 100644 --- a/Source/cmDependsFortran.h +++ b/Source/cmDependsFortran.h @@ -21,8 +21,6 @@ class cmLocalGenerator; */ class cmDependsFortran : public cmDepends { - CM_DISABLE_COPY(cmDependsFortran) - public: /** Checking instances need to know the build directory name and the relative path from the build directory to the target file. */ @@ -37,6 +35,9 @@ public: /** Virtual destructor to cleanup subclasses properly. */ ~cmDependsFortran() override; + cmDependsFortran(cmDependsFortran const&) = delete; + cmDependsFortran& operator=(cmDependsFortran const&) = delete; + /** Callback from build system after a .mod file has been generated by a Fortran90 compiler to copy the .mod file to the corresponding stamp file. */ diff --git a/Source/cmDependsJava.h b/Source/cmDependsJava.h index 1928c51..109ef13 100644 --- a/Source/cmDependsJava.h +++ b/Source/cmDependsJava.h @@ -17,8 +17,6 @@ */ class cmDependsJava : public cmDepends { - CM_DISABLE_COPY(cmDependsJava) - public: /** Checking instances need to know the build directory name and the relative path from the build directory to the target file. */ @@ -27,6 +25,9 @@ public: /** Virtual destructor to cleanup subclasses properly. */ ~cmDependsJava() override; + cmDependsJava(cmDependsJava const&) = delete; + cmDependsJava& operator=(cmDependsJava const&) = delete; + protected: // Implement writing/checking methods required by superclass. bool WriteDependencies(const std::set& sources, diff --git a/Source/cmDynamicLoader.h b/Source/cmDynamicLoader.h index e9fe97a..4b89388 100644 --- a/Source/cmDynamicLoader.h +++ b/Source/cmDynamicLoader.h @@ -14,8 +14,6 @@ class cmDynamicLoader { - CM_DISABLE_COPY(cmDynamicLoader) - public: // Description: // Load a dynamic library into the current process. diff --git a/Source/cmFileLock.h b/Source/cmFileLock.h index 491a40b..2130d65 100644 --- a/Source/cmFileLock.h +++ b/Source/cmFileLock.h @@ -21,12 +21,13 @@ class cmFileLockResult; */ class cmFileLock { - CM_DISABLE_COPY(cmFileLock) - public: cmFileLock(); ~cmFileLock(); + cmFileLock(cmFileLock const&) = delete; + cmFileLock& operator=(cmFileLock const&) = delete; + /** * @brief Lock the file. * @param timeoutSec Lock timeout. If -1 try until success or fatal error. diff --git a/Source/cmFileLockPool.h b/Source/cmFileLockPool.h index 0197354..41203ba 100644 --- a/Source/cmFileLockPool.h +++ b/Source/cmFileLockPool.h @@ -13,12 +13,13 @@ class cmFileLockResult; class cmFileLockPool { - CM_DISABLE_COPY(cmFileLockPool) - public: cmFileLockPool(); ~cmFileLockPool(); + cmFileLockPool(cmFileLockPool const&) = delete; + cmFileLockPool& operator=(cmFileLockPool const&) = delete; + //@{ /** * @brief Function scope control. @@ -58,12 +59,13 @@ private: class ScopePool { - CM_DISABLE_COPY(ScopePool) - public: ScopePool(); ~ScopePool(); + ScopePool(ScopePool const&) = delete; + ScopePool& operator=(ScopePool const&) = delete; + cmFileLockResult Lock(const std::string& filename, unsigned long timeoutSec); cmFileLockResult Release(const std::string& filename); diff --git a/Source/cmFileMonitor.h b/Source/cmFileMonitor.h index 632e751..7ffc929 100644 --- a/Source/cmFileMonitor.h +++ b/Source/cmFileMonitor.h @@ -14,12 +14,14 @@ class cmRootWatcher; class cmFileMonitor { - CM_DISABLE_COPY(cmFileMonitor) public: cmFileMonitor(uv_loop_t* l); ~cmFileMonitor(); + cmFileMonitor(cmFileMonitor const&) = delete; + cmFileMonitor& operator=(cmFileMonitor const&) = delete; + using Callback = std::function; void MonitorPaths(const std::vector& paths, Callback const& cb); void StopMonitoring(); diff --git a/Source/cmGeneratedFileStream.h b/Source/cmGeneratedFileStream.h index fd11889..5b1eb51 100644 --- a/Source/cmGeneratedFileStream.h +++ b/Source/cmGeneratedFileStream.h @@ -97,6 +97,8 @@ public: */ ~cmGeneratedFileStream() override; + cmGeneratedFileStream(cmGeneratedFileStream const&) = delete; + /** * Open an output file by name. This should be used only with a * non-open stream. It automatically generates a name for the @@ -134,9 +136,6 @@ public: * the output file to be changed during the use of cmGeneratedFileStream. */ void SetName(const std::string& fname); - -private: - cmGeneratedFileStream(cmGeneratedFileStream const&); // not implemented }; #endif diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index e5463a7..fd36c4b 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -32,13 +32,14 @@ struct cmGeneratorExpressionEvaluator; */ class cmGeneratorExpression { - CM_DISABLE_COPY(cmGeneratorExpression) - public: /** Construct. */ cmGeneratorExpression(cmListFileBacktrace backtrace = cmListFileBacktrace()); ~cmGeneratorExpression(); + cmGeneratorExpression(cmGeneratorExpression const&) = delete; + cmGeneratorExpression& operator=(cmGeneratorExpression const&) = delete; + std::unique_ptr Parse( std::string const& input); std::unique_ptr Parse(const char* input); @@ -78,9 +79,13 @@ private: class cmCompiledGeneratorExpression { - CM_DISABLE_COPY(cmCompiledGeneratorExpression) - public: + ~cmCompiledGeneratorExpression(); + + cmCompiledGeneratorExpression(cmCompiledGeneratorExpression const&) = delete; + cmCompiledGeneratorExpression& operator=( + cmCompiledGeneratorExpression const&) = delete; + const std::string& Evaluate( cmLocalGenerator* lg, const std::string& config, bool quiet = false, cmGeneratorTarget const* headTarget = nullptr, @@ -109,8 +114,6 @@ public: return this->AllTargetsSeen; } - ~cmCompiledGeneratorExpression(); - std::string const& GetInput() const { return this->Input; } cmListFileBacktrace GetBacktrace() const { return this->Backtrace; } @@ -165,8 +168,6 @@ private: class cmGeneratorExpressionInterpreter { - CM_DISABLE_COPY(cmGeneratorExpressionInterpreter) - public: cmGeneratorExpressionInterpreter(cmLocalGenerator* localGenerator, std::string config, @@ -179,6 +180,11 @@ public: { } + cmGeneratorExpressionInterpreter(cmGeneratorExpressionInterpreter const&) = + delete; + cmGeneratorExpressionInterpreter& operator=( + cmGeneratorExpressionInterpreter const&) = delete; + const std::string& Evaluate(const char* expression, const std::string& property); const std::string& Evaluate(const std::string& expression, diff --git a/Source/cmGeneratorExpressionEvaluator.h b/Source/cmGeneratorExpressionEvaluator.h index 0f553f2..4530152 100644 --- a/Source/cmGeneratorExpressionEvaluator.h +++ b/Source/cmGeneratorExpressionEvaluator.h @@ -19,6 +19,11 @@ struct cmGeneratorExpressionEvaluator cmGeneratorExpressionEvaluator() = default; virtual ~cmGeneratorExpressionEvaluator() = default; + cmGeneratorExpressionEvaluator(cmGeneratorExpressionEvaluator const&) = + delete; + cmGeneratorExpressionEvaluator& operator=( + cmGeneratorExpressionEvaluator const&) = delete; + enum Type { Text, @@ -29,9 +34,6 @@ struct cmGeneratorExpressionEvaluator virtual std::string Evaluate(cmGeneratorExpressionContext* context, cmGeneratorExpressionDAGChecker*) const = 0; - -private: - CM_DISABLE_COPY(cmGeneratorExpressionEvaluator) }; struct TextContent : public cmGeneratorExpressionEvaluator diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index d72e051..59d38af 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -27,12 +27,13 @@ class cmTarget; class cmGeneratorTarget { - CM_DISABLE_COPY(cmGeneratorTarget) - public: cmGeneratorTarget(cmTarget*, cmLocalGenerator* lg); ~cmGeneratorTarget(); + cmGeneratorTarget(cmGeneratorTarget const&) = delete; + cmGeneratorTarget& operator=(cmGeneratorTarget const&) = delete; + cmLocalGenerator* GetLocalGenerator() const; cmGlobalGenerator* GetGlobalGenerator() const; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 6d15b8c..9c0c18b 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -752,8 +752,6 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFileFromPath( class XCodeGeneratorExpressionInterpreter : public cmGeneratorExpressionInterpreter { - CM_DISABLE_COPY(XCodeGeneratorExpressionInterpreter) - public: XCodeGeneratorExpressionInterpreter(cmSourceFile* sourceFile, cmLocalGenerator* localGenerator, @@ -765,6 +763,11 @@ public: { } + XCodeGeneratorExpressionInterpreter( + XCodeGeneratorExpressionInterpreter const&) = delete; + XCodeGeneratorExpressionInterpreter& operator=( + XCodeGeneratorExpressionInterpreter const&) = delete; + using cmGeneratorExpressionInterpreter::Evaluate; const std::string& Evaluate(const char* expression, diff --git a/Source/cmInstallCommandArguments.h b/Source/cmInstallCommandArguments.h index 8e974af..9c0d417 100644 --- a/Source/cmInstallCommandArguments.h +++ b/Source/cmInstallCommandArguments.h @@ -45,7 +45,6 @@ public: cmCommandArgumentGroup ArgumentGroup; private: - cmInstallCommandArguments(); // disabled cmCAString Destination; cmCAString Component; cmCAString NamelinkComponent; diff --git a/Source/cmInstallGenerator.h b/Source/cmInstallGenerator.h index e5b88c3..9bd7ac3 100644 --- a/Source/cmInstallGenerator.h +++ b/Source/cmInstallGenerator.h @@ -21,8 +21,6 @@ class cmMakefile; */ class cmInstallGenerator : public cmScriptGenerator { - CM_DISABLE_COPY(cmInstallGenerator) - public: enum MessageLevel { @@ -38,6 +36,9 @@ public: bool exclude_from_all); ~cmInstallGenerator() override; + cmInstallGenerator(cmInstallGenerator const&) = delete; + cmInstallGenerator& operator=(cmInstallGenerator const&) = delete; + virtual bool HaveInstall(); virtual void CheckCMP0082(bool& haveSubdirectoryInstall, bool& haveInstallAfterSubdirectory); diff --git a/Source/cmLinkLineComputer.h b/Source/cmLinkLineComputer.h index a016358..2355c32 100644 --- a/Source/cmLinkLineComputer.h +++ b/Source/cmLinkLineComputer.h @@ -16,13 +16,14 @@ class cmOutputConverter; class cmLinkLineComputer { - CM_DISABLE_COPY(cmLinkLineComputer) - public: cmLinkLineComputer(cmOutputConverter* outputConverter, cmStateDirectory const& stateDir); virtual ~cmLinkLineComputer(); + cmLinkLineComputer(cmLinkLineComputer const&) = delete; + cmLinkLineComputer& operator=(cmLinkLineComputer const&) = delete; + void SetUseWatcomQuote(bool useWatcomQuote); void SetForResponse(bool forResponse); void SetRelink(bool relink); diff --git a/Source/cmLinkLineDeviceComputer.h b/Source/cmLinkLineDeviceComputer.h index 81b48b3..cf66f64 100644 --- a/Source/cmLinkLineDeviceComputer.h +++ b/Source/cmLinkLineDeviceComputer.h @@ -18,13 +18,15 @@ class cmStateDirectory; class cmLinkLineDeviceComputer : public cmLinkLineComputer { - CM_DISABLE_COPY(cmLinkLineDeviceComputer) - public: cmLinkLineDeviceComputer(cmOutputConverter* outputConverter, cmStateDirectory const& stateDir); ~cmLinkLineDeviceComputer() override; + cmLinkLineDeviceComputer(cmLinkLineDeviceComputer const&) = delete; + cmLinkLineDeviceComputer& operator=(cmLinkLineDeviceComputer const&) = + delete; + std::string ComputeLinkLibraries(cmComputeLinkInformation& cli, std::string const& stdLibString) override; @@ -34,13 +36,15 @@ public: class cmNinjaLinkLineDeviceComputer : public cmLinkLineDeviceComputer { - CM_DISABLE_COPY(cmNinjaLinkLineDeviceComputer) - public: cmNinjaLinkLineDeviceComputer(cmOutputConverter* outputConverter, cmStateDirectory const& stateDir, cmGlobalNinjaGenerator const* gg); + cmNinjaLinkLineDeviceComputer(cmNinjaLinkLineDeviceComputer const&) = delete; + cmNinjaLinkLineDeviceComputer& operator=( + cmNinjaLinkLineDeviceComputer const&) = delete; + std::string ConvertToLinkReference(std::string const& input) const override; private: diff --git a/Source/cmLocale.h b/Source/cmLocale.h index 174f0f0..3580ec8 100644 --- a/Source/cmLocale.h +++ b/Source/cmLocale.h @@ -10,16 +10,18 @@ class cmLocaleRAII { - CM_DISABLE_COPY(cmLocaleRAII) - public: cmLocaleRAII() : OldLocale(setlocale(LC_CTYPE, nullptr)) { setlocale(LC_CTYPE, ""); } + ~cmLocaleRAII() { setlocale(LC_CTYPE, this->OldLocale.c_str()); } + cmLocaleRAII(cmLocaleRAII const&) = delete; + cmLocaleRAII& operator=(cmLocaleRAII const&) = delete; + private: std::string OldLocale; }; diff --git a/Source/cmMSVC60LinkLineComputer.h b/Source/cmMSVC60LinkLineComputer.h index 31223ec..d767914 100644 --- a/Source/cmMSVC60LinkLineComputer.h +++ b/Source/cmMSVC60LinkLineComputer.h @@ -15,12 +15,14 @@ class cmStateDirectory; class cmMSVC60LinkLineComputer : public cmLinkLineComputer { - CM_DISABLE_COPY(cmMSVC60LinkLineComputer) - public: cmMSVC60LinkLineComputer(cmOutputConverter* outputConverter, cmStateDirectory const& stateDir); + cmMSVC60LinkLineComputer(cmMSVC60LinkLineComputer const&) = delete; + cmMSVC60LinkLineComputer& operator=(cmMSVC60LinkLineComputer const&) = + delete; + std::string ConvertToLinkReference(std::string const& input) const override; }; diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 2bd44e2..70a5689 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -65,8 +65,6 @@ public: */ class cmMakefile { - CM_DISABLE_COPY(cmMakefile) - public: /* Mark a variable as used */ void MarkVariableAsUsed(const std::string& var); @@ -84,6 +82,9 @@ public: */ ~cmMakefile(); + cmMakefile(cmMakefile const&) = delete; + cmMakefile& operator=(cmMakefile const&) = delete; + cmDirectoryId GetDirectoryId() const; bool ReadListFile(const std::string& filename); @@ -780,15 +781,18 @@ public: /** Helper class to push and pop scopes automatically. */ class ScopePushPop { - CM_DISABLE_COPY(ScopePushPop) public: ScopePushPop(cmMakefile* m) : Makefile(m) { this->Makefile->PushScope(); } + ~ScopePushPop() { this->Makefile->PopScope(); } + ScopePushPop(ScopePushPop const&) = delete; + ScopePushPop& operator=(ScopePushPop const&) = delete; + private: cmMakefile* Makefile; }; diff --git a/Source/cmNinjaLinkLineComputer.h b/Source/cmNinjaLinkLineComputer.h index 0ed53f4..b2b2e84 100644 --- a/Source/cmNinjaLinkLineComputer.h +++ b/Source/cmNinjaLinkLineComputer.h @@ -16,13 +16,14 @@ class cmStateDirectory; class cmNinjaLinkLineComputer : public cmLinkLineComputer { - CM_DISABLE_COPY(cmNinjaLinkLineComputer) - public: cmNinjaLinkLineComputer(cmOutputConverter* outputConverter, cmStateDirectory const& stateDir, cmGlobalNinjaGenerator const* gg); + cmNinjaLinkLineComputer(cmNinjaLinkLineComputer const&) = delete; + cmNinjaLinkLineComputer& operator=(cmNinjaLinkLineComputer const&) = delete; + std::string ConvertToLinkReference(std::string const& input) const override; private: diff --git a/Source/cmQtAutoGenerator.h b/Source/cmQtAutoGenerator.h index 2b9cbc6..9956a99 100644 --- a/Source/cmQtAutoGenerator.h +++ b/Source/cmQtAutoGenerator.h @@ -24,7 +24,6 @@ class cmMakefile; /// @brief Base class for QtAutoGen gernerators class cmQtAutoGenerator : public cmQtAutoGen { - CM_DISABLE_COPY(cmQtAutoGenerator) public: // -- Types @@ -245,6 +244,9 @@ public: cmQtAutoGenerator(); virtual ~cmQtAutoGenerator(); + cmQtAutoGenerator(cmQtAutoGenerator const&) = delete; + cmQtAutoGenerator& operator=(cmQtAutoGenerator const&) = delete; + // -- Run bool Run(std::string const& infoFile, std::string const& config); diff --git a/Source/cmQtAutoGeneratorMocUic.h b/Source/cmQtAutoGeneratorMocUic.h index 0df2cff..32a6006 100644 --- a/Source/cmQtAutoGeneratorMocUic.h +++ b/Source/cmQtAutoGeneratorMocUic.h @@ -28,11 +28,13 @@ class cmMakefile; // @brief AUTOMOC and AUTOUIC generator class cmQtAutoGeneratorMocUic : public cmQtAutoGenerator { - CM_DISABLE_COPY(cmQtAutoGeneratorMocUic) public: cmQtAutoGeneratorMocUic(); ~cmQtAutoGeneratorMocUic() override; + cmQtAutoGeneratorMocUic(cmQtAutoGeneratorMocUic const&) = delete; + cmQtAutoGeneratorMocUic& operator=(cmQtAutoGeneratorMocUic const&) = delete; + public: // -- Types class WorkerT; @@ -63,7 +65,6 @@ public: /// class BaseSettingsT { - CM_DISABLE_COPY(BaseSettingsT) public: // -- Volatile methods BaseSettingsT(FileSystem* fileSystem) @@ -75,6 +76,9 @@ public: { } + BaseSettingsT(BaseSettingsT const&) = delete; + BaseSettingsT& operator=(BaseSettingsT const&) = delete; + // -- Const methods std::string AbsoluteBuildPath(std::string const& relativePath) const; bool FindHeader(std::string& header, @@ -103,13 +107,15 @@ public: /// class MocSettingsT { - CM_DISABLE_COPY(MocSettingsT) public: MocSettingsT(FileSystem* fileSys) : FileSys(fileSys) { } + MocSettingsT(MocSettingsT const&) = delete; + MocSettingsT& operator=(MocSettingsT const&) = delete; + // -- Const methods bool skipped(std::string const& fileName) const; std::string FindMacro(std::string const& content) const; @@ -145,9 +151,12 @@ public: /// class UicSettingsT { - CM_DISABLE_COPY(UicSettingsT) public: UicSettingsT() = default; + + UicSettingsT(UicSettingsT const&) = delete; + UicSettingsT& operator=(UicSettingsT const&) = delete; + // -- Const methods bool skipped(std::string const& fileName) const; @@ -166,10 +175,13 @@ public: /// class JobT { - CM_DISABLE_COPY(JobT) public: JobT() = default; virtual ~JobT() = default; + + JobT(JobT const&) = delete; + JobT& operator=(JobT const&) = delete; + // -- Abstract processing interface virtual void Process(WorkerT& wrk) = 0; }; @@ -293,11 +305,13 @@ public: /// class WorkerT { - CM_DISABLE_COPY(WorkerT) public: WorkerT(cmQtAutoGeneratorMocUic* gen, uv_loop_t* uvLoop); ~WorkerT(); + WorkerT(WorkerT const&) = delete; + WorkerT& operator=(WorkerT const&) = delete; + // -- Const accessors cmQtAutoGeneratorMocUic& Gen() const { return *Gen_; } Logger& Log() const { return Gen_->Log(); } diff --git a/Source/cmQtAutoGeneratorRcc.h b/Source/cmQtAutoGeneratorRcc.h index 1148071..1ec1c4a 100644 --- a/Source/cmQtAutoGeneratorRcc.h +++ b/Source/cmQtAutoGeneratorRcc.h @@ -17,11 +17,13 @@ class cmMakefile; // @brief AUTORCC generator class cmQtAutoGeneratorRcc : public cmQtAutoGenerator { - CM_DISABLE_COPY(cmQtAutoGeneratorRcc) public: cmQtAutoGeneratorRcc(); ~cmQtAutoGeneratorRcc() override; + cmQtAutoGeneratorRcc(cmQtAutoGeneratorRcc const&) = delete; + cmQtAutoGeneratorRcc& operator=(cmQtAutoGeneratorRcc const&) = delete; + private: // -- Types diff --git a/Source/cmScriptGenerator.h b/Source/cmScriptGenerator.h index 5792ba8..e334d5b 100644 --- a/Source/cmScriptGenerator.h +++ b/Source/cmScriptGenerator.h @@ -44,13 +44,14 @@ inline std::ostream& operator<<(std::ostream& os, */ class cmScriptGenerator { - CM_DISABLE_COPY(cmScriptGenerator) - public: cmScriptGenerator(std::string config_var, std::vector configurations); virtual ~cmScriptGenerator(); + cmScriptGenerator(cmScriptGenerator const&) = delete; + cmScriptGenerator& operator=(cmScriptGenerator const&) = delete; + void Generate(std::ostream& os, const std::string& config, std::vector const& configurationTypes); diff --git a/Source/cmServer.h b/Source/cmServer.h index ca37ce2..d2ffbb3 100644 --- a/Source/cmServer.h +++ b/Source/cmServer.h @@ -88,14 +88,15 @@ protected: class cmServer : public cmServerBase { - CM_DISABLE_COPY(cmServer) - public: class DebugInfo; cmServer(cmConnection* conn, bool supportExperimental); ~cmServer() override; + cmServer(cmServer const&) = delete; + cmServer& operator=(cmServer const&) = delete; + bool Serve(std::string* errorMessage) override; cmFileMonitor* FileMonitor() const; diff --git a/Source/cmServerProtocol.h b/Source/cmServerProtocol.h index 2d1507b..2f55a20 100644 --- a/Source/cmServerProtocol.h +++ b/Source/cmServerProtocol.h @@ -71,12 +71,13 @@ private: class cmServerProtocol { - CM_DISABLE_COPY(cmServerProtocol) - public: cmServerProtocol() = default; virtual ~cmServerProtocol() = default; + cmServerProtocol(cmServerProtocol const&) = delete; + cmServerProtocol& operator=(cmServerProtocol const&) = delete; + virtual std::pair ProtocolVersion() const = 0; virtual bool IsExperimental() const = 0; virtual const cmServerResponse Process(const cmServerRequest& request) = 0; diff --git a/Source/cmSourceFileLocation.h b/Source/cmSourceFileLocation.h index 82747ba..cb35703 100644 --- a/Source/cmSourceFileLocation.h +++ b/Source/cmSourceFileLocation.h @@ -34,6 +34,8 @@ public: cmSourceFileLocation(); cmSourceFileLocation(const cmSourceFileLocation& loc); + cmSourceFileLocation& operator=(cmSourceFileLocation const&) = delete; + /** * Return whether the given source file location could refers to the * same source file as this location given the level of ambiguity in @@ -94,8 +96,6 @@ private: // Update the location with additional knowledge. void Update(cmSourceFileLocation const& loc); void UpdateExtension(const std::string& name); - - cmSourceFileLocation& operator=(const cmSourceFileLocation& loc) = delete; }; #endif diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index b1d5751..851e77f 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -410,11 +410,13 @@ public: original environment. */ class SaveRestoreEnvironment { - CM_DISABLE_COPY(SaveRestoreEnvironment) public: SaveRestoreEnvironment(); ~SaveRestoreEnvironment(); + SaveRestoreEnvironment(SaveRestoreEnvironment const&) = delete; + SaveRestoreEnvironment& operator=(SaveRestoreEnvironment const&) = delete; + private: std::vector Env; }; diff --git a/Source/cmTestGenerator.h b/Source/cmTestGenerator.h index f26d2ff..8b9cf78 100644 --- a/Source/cmTestGenerator.h +++ b/Source/cmTestGenerator.h @@ -20,14 +20,15 @@ class cmTest; */ class cmTestGenerator : public cmScriptGenerator { - CM_DISABLE_COPY(cmTestGenerator) - public: cmTestGenerator(cmTest* test, std::vector const& configurations = std::vector()); ~cmTestGenerator() override; + cmTestGenerator(cmTestGenerator const&) = delete; + cmTestGenerator& operator=(cmTestGenerator const&) = delete; + void Compute(cmLocalGenerator* lg); /** Test if this generator installs the test for a given configuration. */ diff --git a/Source/cmUVHandlePtr.h b/Source/cmUVHandlePtr.h index d42969e..992c429 100644 --- a/Source/cmUVHandlePtr.h +++ b/Source/cmUVHandlePtr.h @@ -61,7 +61,8 @@ protected: void allocate(void* data = nullptr); public: - CM_DISABLE_COPY(uv_handle_ptr_base_) + uv_handle_ptr_base_(uv_handle_ptr_base_ const&) = delete; + uv_handle_ptr_base_& operator=(uv_handle_ptr_base_ const&) = delete; uv_handle_ptr_base_(uv_handle_ptr_base_&&) noexcept; uv_handle_ptr_base_& operator=(uv_handle_ptr_base_&&) noexcept; diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index 7d24e88..5901004 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -25,12 +25,16 @@ class cmVS10GeneratorOptions; class cmVisualStudio10TargetGenerator { - CM_DISABLE_COPY(cmVisualStudio10TargetGenerator) - public: cmVisualStudio10TargetGenerator(cmGeneratorTarget* target, cmGlobalVisualStudio10Generator* gg); ~cmVisualStudio10TargetGenerator(); + + cmVisualStudio10TargetGenerator(cmVisualStudio10TargetGenerator const&) = + delete; + cmVisualStudio10TargetGenerator& operator=( + cmVisualStudio10TargetGenerator const&) = delete; + void Generate(); private: diff --git a/Source/cmXMLWriter.h b/Source/cmXMLWriter.h index b080654..1df8a09 100644 --- a/Source/cmXMLWriter.h +++ b/Source/cmXMLWriter.h @@ -16,12 +16,13 @@ class cmXMLWriter { - CM_DISABLE_COPY(cmXMLWriter) - public: cmXMLWriter(std::ostream& output, std::size_t level = 0); ~cmXMLWriter(); + cmXMLWriter(cmXMLWriter const&) = delete; + cmXMLWriter& operator=(cmXMLWriter const&) = delete; + void StartDocument(const char* encoding = "UTF-8"); void EndDocument(); diff --git a/Source/cm_thread.hxx b/Source/cm_thread.hxx index 84e6a5c..b1f0645 100644 --- a/Source/cm_thread.hxx +++ b/Source/cm_thread.hxx @@ -11,18 +11,18 @@ namespace cm { class shared_mutex { uv_rwlock_t _M_; - CM_DISABLE_COPY(shared_mutex) public: shared_mutex() { uv_rwlock_init(&_M_); } ~shared_mutex() { uv_rwlock_destroy(&_M_); } - void lock() { uv_rwlock_wrlock(&_M_); } + shared_mutex(shared_mutex const&) = delete; + shared_mutex& operator=(shared_mutex const&) = delete; + void lock() { uv_rwlock_wrlock(&_M_); } void unlock() { uv_rwlock_wrunlock(&_M_); } void lock_shared() { uv_rwlock_rdlock(&_M_); } - void unlock_shared() { uv_rwlock_rdunlock(&_M_); } }; @@ -30,7 +30,6 @@ template class shared_lock { T& _mutex; - CM_DISABLE_COPY(shared_lock) public: shared_lock(T& m) @@ -38,7 +37,12 @@ public: { _mutex.lock_shared(); } + ~shared_lock() { _mutex.unlock_shared(); } + + shared_lock(shared_lock const&) = delete; + shared_lock& operator=(shared_lock const&) = delete; }; } + #endif diff --git a/Source/cmake.h b/Source/cmake.h index c60fc33..93a31db 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -59,8 +59,6 @@ struct cmDocumentationEntry; class cmake { - CM_DISABLE_COPY(cmake) - public: enum Role { @@ -119,6 +117,9 @@ public: /// Destructor ~cmake(); + cmake(cmake const&) = delete; + cmake& operator=(cmake const&) = delete; + #if defined(CMAKE_BUILD_WITH_CMAKE) Json::Value ReportVersionJson() const; Json::Value ReportCapabilitiesJson(bool haveServerMode) const; diff --git a/bootstrap b/bootstrap index f185ea8..26c5212 100755 --- a/bootstrap +++ b/bootstrap @@ -1317,7 +1317,6 @@ cmake_report cmConfigure.h${_tmp} "#define CMAKE_BIN_DIR \"/bootstrap-not-insall cmake_report cmConfigure.h${_tmp} "#define CMAKE_DATA_DIR \"/bootstrap-not-insalled\"" cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP" cmake_report cmConfigure.h${_tmp} "#define CM_FALLTHROUGH" -cmake_report cmConfigure.h${_tmp} "#define CM_DISABLE_COPY(Class)" # Regenerate configured headers for h in Configure VersionConfig; do ----------------------------------------------------------------------- Summary of changes: .clang-tidy | 1 - Help/dev/source.rst | 10 --------- Source/CursesDialog/cmCursesBoolWidget.h | 5 +++-- Source/CursesDialog/cmCursesCacheEntryComposite.h | 7 ++++-- Source/CursesDialog/cmCursesDummyWidget.h | 5 +++-- Source/CursesDialog/cmCursesFilePathWidget.h | 5 +++-- Source/CursesDialog/cmCursesForm.h | 5 +++-- Source/CursesDialog/cmCursesLabelWidget.h | 5 +++-- Source/CursesDialog/cmCursesLongMessageForm.h | 5 +++-- Source/CursesDialog/cmCursesMainForm.h | 5 +++-- Source/CursesDialog/cmCursesOptionsWidget.h | 5 +++-- Source/CursesDialog/cmCursesPathWidget.h | 5 +++-- Source/CursesDialog/cmCursesStringWidget.h | 5 +++-- Source/CursesDialog/cmCursesWidget.h | 5 +++-- Source/cmCLocaleEnvironmentScope.h | 6 ++++-- Source/cmCPackPropertiesGenerator.h | 6 ++++-- Source/cmCommand.h | 5 +++-- Source/cmCommandArgumentParserHelper.h | 6 ++++-- Source/cmCommandArgumentsHelper.h | 4 ---- Source/cmConfigure.cmake.h.in | 4 ---- Source/cmConnection.h | 5 +++-- Source/cmCryptoHash.h | 5 +++-- Source/cmDepends.h | 5 +++-- Source/cmDependsC.h | 5 +++-- Source/cmDependsFortran.h | 5 +++-- Source/cmDependsJava.h | 5 +++-- Source/cmDynamicLoader.h | 2 -- Source/cmFileLock.h | 5 +++-- Source/cmFileLockPool.h | 10 +++++---- Source/cmFileMonitor.h | 4 +++- Source/cmGeneratedFileStream.h | 5 ++--- Source/cmGeneratorExpression.h | 22 ++++++++++++------- Source/cmGeneratorExpressionEvaluator.h | 8 ++++--- Source/cmGeneratorTarget.h | 5 +++-- Source/cmGlobalXCodeGenerator.cxx | 7 ++++-- Source/cmInstallCommandArguments.h | 1 - Source/cmInstallGenerator.h | 5 +++-- Source/cmLinkLineComputer.h | 5 +++-- Source/cmLinkLineDeviceComputer.h | 12 +++++++---- Source/cmLocale.h | 6 ++++-- Source/cmMSVC60LinkLineComputer.h | 6 ++++-- Source/cmMakefile.h | 10 ++++++--- Source/cmNinjaLinkLineComputer.h | 5 +++-- Source/cmQtAutoGenerator.h | 4 +++- Source/cmQtAutoGeneratorMocUic.h | 26 +++++++++++++++++------ Source/cmQtAutoGeneratorRcc.h | 4 +++- Source/cmScriptGenerator.h | 5 +++-- Source/cmServer.h | 5 +++-- Source/cmServerProtocol.h | 5 +++-- Source/cmSourceFileLocation.h | 4 ++-- Source/cmSystemTools.h | 4 +++- Source/cmTestGenerator.h | 5 +++-- Source/cmUVHandlePtr.h | 3 ++- Source/cmVisualStudio10TargetGenerator.h | 8 +++++-- Source/cmXMLWriter.h | 5 +++-- Source/cm_thread.hxx | 12 +++++++---- Source/cmake.h | 5 +++-- bootstrap | 1 - 58 files changed, 209 insertions(+), 139 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Jan 31 00:03:06 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 31 Jan 2019 00:03:06 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-1213-gde7eb1a Message-ID: <20190131050306.3466111D9A4@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via de7eb1a3d0e1389437a37513f566244344032c1e (commit) from eb2c23868fe712a0c79b3afe6618e20507c0f9f5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=de7eb1a3d0e1389437a37513f566244344032c1e commit de7eb1a3d0e1389437a37513f566244344032c1e Author: Kitware Robot AuthorDate: Thu Jan 31 00:01:06 2019 -0500 Commit: Kitware Robot CommitDate: Thu Jan 31 00:01:06 2019 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 9e64efa..3f37c95 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 13) -set(CMake_VERSION_PATCH 20190130) +set(CMake_VERSION_PATCH 20190131) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Jan 31 09:33:06 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 31 Jan 2019 09:33:06 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-1215-g8ea30a4 Message-ID: <20190131143306.AAC7E10F17E@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 8ea30a44d38057fed134532f6d3b6e8626a1ccff (commit) via ea9a376085b22a6e19bb4c6334e186052db51f16 (commit) from de7eb1a3d0e1389437a37513f566244344032c1e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8ea30a44d38057fed134532f6d3b6e8626a1ccff commit 8ea30a44d38057fed134532f6d3b6e8626a1ccff Merge: de7eb1a ea9a376 Author: Brad King AuthorDate: Thu Jan 31 14:26:58 2019 +0000 Commit: Kitware Robot CommitDate: Thu Jan 31 09:27:06 2019 -0500 Merge topic 'unused-members' ea9a376085 Remove unused 'class cmake' members Acked-by: Kitware Robot Merge-request: !2895 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ea9a376085b22a6e19bb4c6334e186052db51f16 commit ea9a376085b22a6e19bb4c6334e186052db51f16 Author: Brad King AuthorDate: Thu Jan 31 07:15:35 2019 -0500 Commit: Brad King CommitDate: Thu Jan 31 07:15:55 2019 -0500 Remove unused 'class cmake' members * The `InTryCompile` member has been unused since commit 62854e9966 (cmState: Move try_compile state from cmake class., 2015-04-11, v3.3.0-rc1~196^2~9). * The `ConvertMessageType` and `IsMessageTypeVisible` members have been unused since commit 421012a330 (cmMessenger: Extract from cmake class, 2016-01-28, v3.7.0-rc1~222^2~1). * The `InitializeProperties` member has been unused since commit de722d7d63 (Move property initialization to cmState., 2015-04-06, v3.3.0-rc1~196^2~1). Co-Author: Vitaly Stakhovsky diff --git a/Source/cmake.h b/Source/cmake.h index afd4117..dd7ce42 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -443,7 +443,6 @@ public: protected: void RunCheckForUnusedVariables(); - void InitializeProperties(); int HandleDeleteCacheVariables(const std::string& var); typedef std::vector RegisteredGeneratorsVector; @@ -486,7 +485,6 @@ protected: private: ProgressCallbackType ProgressCallback; - bool InTryCompile; WorkingMode CurrentWorkingMode; bool DebugOutput; bool Trace; @@ -534,18 +532,6 @@ private: void AppendGlobalGeneratorsDocumentation(std::vector&); void AppendExtraGeneratorsDocumentation(std::vector&); - - /** - * Convert a message type between a warning and an error, based on the state - * of the error output CMake variables, in the cache. - */ - MessageType ConvertMessageType(MessageType t) const; - - /* - * Check if messages of this type should be output, based on the state of the - * warning and error output CMake variables, in the cache. - */ - bool IsMessageTypeVisible(MessageType t) const; }; #define CMAKE_STANDARD_OPTIONS_TABLE \ ----------------------------------------------------------------------- Summary of changes: Source/cmake.h | 14 -------------- 1 file changed, 14 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Jan 31 10:53:05 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 31 Jan 2019 10:53:05 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-1221-g5107a84 Message-ID: <20190131155305.143251138C0@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 5107a84d46ad245221843adbef092118649e6dc7 (commit) via 9329e1e30ef4de637d0e71950933f1725f28b475 (commit) via 0779bc9393efeaf1bb3bbf35619617d317d37308 (commit) via f64099cf5e5a659340cf221dd32a6cfa8bfe47d3 (commit) via 95210d027a03192532fcf2c71c98c79fd4cc0fd1 (commit) via d9dd68cb60ed09e32cbda8bbd3e31c86a8778e66 (commit) from 8ea30a44d38057fed134532f6d3b6e8626a1ccff (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5107a84d46ad245221843adbef092118649e6dc7 commit 5107a84d46ad245221843adbef092118649e6dc7 Merge: 9329e1e f64099c Author: Brad King AuthorDate: Thu Jan 31 15:50:31 2019 +0000 Commit: Kitware Robot CommitDate: Thu Jan 31 10:50:38 2019 -0500 Merge topic 'restore-install-late-framework' f64099cf5e Merge branch 'backport-restore-install-late-framework' 95210d027a macOS: Restore compatibility for setting FRAMEWORK after install() d9dd68cb60 macOS: Restore compatibility for setting FRAMEWORK after install() Acked-by: Kitware Robot Acked-by: Kyle Edwards Merge-request: !2878 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9329e1e30ef4de637d0e71950933f1725f28b475 commit 9329e1e30ef4de637d0e71950933f1725f28b475 Merge: 8ea30a4 0779bc9 Author: Brad King AuthorDate: Thu Jan 31 15:45:50 2019 +0000 Commit: Kitware Robot CommitDate: Thu Jan 31 10:45:56 2019 -0500 Merge topic 'readlistfile-stdstring' 0779bc9393 ReadListFile: Accept std::string argument Acked-by: Kitware Robot Merge-request: !2889 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0779bc9393efeaf1bb3bbf35619617d317d37308 commit 0779bc9393efeaf1bb3bbf35619617d317d37308 Author: Vitaly Stakhovsky AuthorDate: Wed Jan 30 12:19:22 2019 -0500 Commit: Brad King CommitDate: Thu Jan 31 09:27:54 2019 -0500 ReadListFile: Accept std::string argument diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index f9ac310..c2e0712 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -693,7 +693,7 @@ bool cmFindPackageCommand::FindModule(bool& found) std::string var = this->Name; var += "_FIND_MODULE"; this->Makefile->AddDefinition(var, "1"); - bool result = this->ReadListFile(mfile.c_str(), DoPolicyScope); + bool result = this->ReadListFile(mfile, DoPolicyScope); this->Makefile->RemoveDefinition(var); return result; } @@ -776,7 +776,7 @@ bool cmFindPackageCommand::HandlePackageMode() this->StoreVersionFound(); // Parse the configuration file. - if (this->ReadListFile(this->FileFound.c_str(), DoPolicyScope)) { + if (this->ReadListFile(this->FileFound, DoPolicyScope)) { // The package has been found. found = true; @@ -1036,7 +1036,8 @@ bool cmFindPackageCommand::FindAppBundleConfig() return false; } -bool cmFindPackageCommand::ReadListFile(const char* f, PolicyScopeRule psr) +bool cmFindPackageCommand::ReadListFile(const std::string& f, + PolicyScopeRule psr) { const bool noPolicyScope = !this->PolicyScope || psr == NoPolicyScope; if (this->Makefile->ReadDependentFile(f, noPolicyScope)) { @@ -1590,7 +1591,7 @@ bool cmFindPackageCommand::CheckVersionFile(std::string const& version_file, // Load the version check file. Pass NoPolicyScope because we do // our own policy push/pop independent of CMP0011. bool suitable = false; - if (this->ReadListFile(version_file.c_str(), NoPolicyScope)) { + if (this->ReadListFile(version_file, NoPolicyScope)) { // Check the output variables. bool okay = this->Makefile->IsOn("PACKAGE_VERSION_EXACT"); bool unsuitable = this->Makefile->IsOn("PACKAGE_VERSION_UNSUITABLE"); diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h index 83d8431..a11d253 100644 --- a/Source/cmFindPackageCommand.h +++ b/Source/cmFindPackageCommand.h @@ -110,7 +110,7 @@ private: NoPolicyScope, DoPolicyScope }; - bool ReadListFile(const char* f, PolicyScopeRule psr); + bool ReadListFile(const std::string& f, PolicyScopeRule psr); void StoreVersionFound(); void ComputePrefixes(); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 2b627ff..8023298 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -437,7 +437,7 @@ bool cmake::SetCacheArgs(const std::vector& args) } } std::cout << "loading initial cache file " << path << "\n"; - this->ReadListFile(args, path.c_str()); + this->ReadListFile(args, path); } else if (arg.find("-P", 0) == 0) { i++; if (i >= args.size()) { @@ -451,7 +451,7 @@ bool cmake::SetCacheArgs(const std::vector& args) } // Register fake project commands that hint misuse in script mode. GetProjectCommandsInScriptMode(this->State); - this->ReadListFile(args, path.c_str()); + this->ReadListFile(args, path); } else if (arg.find("--find-package", 0) == 0) { findPackageMode = true; } @@ -465,7 +465,7 @@ bool cmake::SetCacheArgs(const std::vector& args) } void cmake::ReadListFile(const std::vector& args, - const char* path) + const std::string& path) { // if a generator was not yet created, temporarily create one cmGlobalGenerator* gg = this->GetGlobalGenerator(); @@ -478,7 +478,7 @@ void cmake::ReadListFile(const std::vector& args, } // read in the list file to fill the cache - if (path) { + if (!path.empty()) { this->CurrentSnapshot = this->State->Reset(); std::string homeDir = this->GetHomeDirectory(); std::string homeOutputDir = this->GetHomeOutputDirectory(); @@ -499,7 +499,7 @@ void cmake::ReadListFile(const std::vector& args, mf.SetArgcArgv(args); } if (!mf.ReadListFile(path)) { - cmSystemTools::Error("Error processing file: ", path); + cmSystemTools::Error("Error processing file: " + path); } this->SetHomeDirectory(homeDir); this->SetHomeOutputDirectory(homeOutputDir); @@ -1606,14 +1606,14 @@ void cmake::PreLoadCMakeFiles() if (!pre_load.empty()) { pre_load += "/PreLoad.cmake"; if (cmSystemTools::FileExists(pre_load)) { - this->ReadListFile(args, pre_load.c_str()); + this->ReadListFile(args, pre_load); } } pre_load = this->GetHomeOutputDirectory(); if (!pre_load.empty()) { pre_load += "/PreLoad.cmake"; if (cmSystemTools::FileExists(pre_load)) { - this->ReadListFile(args, pre_load.c_str()); + this->ReadListFile(args, pre_load); } } } @@ -2613,7 +2613,7 @@ int cmake::Build(int jobs, const std::string& dir, const std::string& target, cachePath + "/" + "CMakeFiles/" + "VerifyGlobs.cmake"; if (cmSystemTools::FileExists(globVerifyScript)) { std::vector args; - this->ReadListFile(args, globVerifyScript.c_str()); + this->ReadListFile(args, globVerifyScript); } } diff --git a/Source/cmake.h b/Source/cmake.h index af51616..53d44f1 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -463,7 +463,8 @@ protected: std::string GeneratorToolset; ///! read in a cmake list file to initialize the cache - void ReadListFile(const std::vector& args, const char* path); + void ReadListFile(const std::vector& args, + const std::string& path); bool FindPackage(const std::vector& args); ///! Check if CMAKE_CACHEFILE_DIR is set. If it is not, delete the log file. https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f64099cf5e5a659340cf221dd32a6cfa8bfe47d3 commit f64099cf5e5a659340cf221dd32a6cfa8bfe47d3 Merge: 95210d0 d9dd68c Author: Brad King AuthorDate: Tue Jan 29 12:54:21 2019 -0500 Commit: Brad King CommitDate: Wed Jan 30 08:00:23 2019 -0500 Merge branch 'backport-restore-install-late-framework' https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=95210d027a03192532fcf2c71c98c79fd4cc0fd1 commit 95210d027a03192532fcf2c71c98c79fd4cc0fd1 Author: Brad King AuthorDate: Tue Jan 29 11:54:46 2019 -0500 Commit: Brad King CommitDate: Wed Jan 30 08:00:06 2019 -0500 macOS: Restore compatibility for setting FRAMEWORK after install() The `FRAMEWORK` target property affects the way the `install()` command treats the target and so should be set first. Our implementation assumed that this was always the case and led to an assertion failure. Prior to CMake 3.12 this was visible only when using an explicit `LIBRARY ... NAMELINK_ONLY` option, but commit 0212d7c762 (install: add NAMELINK_COMPONENT argument, 2018-04-18, v3.12.0-rc1~139^2~3) made it possible with a simple `LIBRARY DESTINATION`. Fully supporting out-of-order specification will require non-trivial refactoring to defer install generator creation to generate time. For now simply restore the old behavior of installing the framework to the library destination and warn about the case. Fixes: #18848 diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index d1d4316..61e5979 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -19,6 +19,7 @@ #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmTarget.h" +#include "cmake.h" cmInstallTargetGenerator::cmInstallTargetGenerator( std::string targetName, const char* dest, bool implib, @@ -211,8 +212,34 @@ void cmInstallTargetGenerator::GenerateScriptForConfig( // An import library looks like a static library. type = cmInstallType_STATIC_LIBRARY; } else if (this->Target->IsFrameworkOnApple()) { - // There is a bug in cmInstallCommand if this fails. - assert(this->NamelinkMode == NamelinkModeNone); + // FIXME: In principle we should be able to + // assert(this->NamelinkMode == NamelinkModeNone); + // but since the current install() command implementation checks + // the FRAMEWORK property immediately instead of delaying until + // generate time, it is possible for project code to set the + // property after calling install(). In such a case, the install() + // command will use the LIBRARY code path and create two install + // generators, one for the namelink component (NamelinkModeOnly) + // and one for the primary artifact component (NamelinkModeSkip). + // Historically this was not diagnosed and resulted in silent + // installation of a framework to the LIBRARY destination. + // Retain that behavior and warn about the case. + switch (this->NamelinkMode) { + case NamelinkModeNone: + // Normal case. + break; + case NamelinkModeOnly: + // Assume the NamelinkModeSkip instance will warn and install. + return; + case NamelinkModeSkip: { + std::string e = "Target '" + this->Target->GetName() + + "' was changed to a FRAMEWORK sometime after install(). " + "This may result in the wrong install DESTINATION. " + "Set the FRAMEWORK property earlier."; + this->Target->GetGlobalGenerator()->GetCMakeInstance()->IssueMessage( + MessageType::AUTHOR_WARNING, e, this->GetBacktrace()); + } break; + } // Install the whole framework directory. type = cmInstallType_DIRECTORY; diff --git a/Tests/RunCMake/Framework/InstallBeforeFramework-stderr.txt b/Tests/RunCMake/Framework/InstallBeforeFramework-stderr.txt new file mode 100644 index 0000000..a3a7c6c --- /dev/null +++ b/Tests/RunCMake/Framework/InstallBeforeFramework-stderr.txt @@ -0,0 +1,7 @@ +^CMake Warning \(dev\) at InstallBeforeFramework.cmake:4 \(install\): + Target 'foo' was changed to a FRAMEWORK sometime after install\(\). This may + result in the wrong install DESTINATION. Set the FRAMEWORK property + earlier. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/Framework/InstallBeforeFramework.cmake b/Tests/RunCMake/Framework/InstallBeforeFramework.cmake new file mode 100644 index 0000000..3791dac --- /dev/null +++ b/Tests/RunCMake/Framework/InstallBeforeFramework.cmake @@ -0,0 +1,5 @@ +enable_language(C) + +add_library(foo SHARED foo.c) +install(TARGETS foo LIBRARY DESTINATION lib) +set_property(TARGET foo PROPERTY FRAMEWORK TRUE) diff --git a/Tests/RunCMake/Framework/RunCMakeTest.cmake b/Tests/RunCMake/Framework/RunCMakeTest.cmake index 4fc83f8..e705a31 100644 --- a/Tests/RunCMake/Framework/RunCMakeTest.cmake +++ b/Tests/RunCMake/Framework/RunCMakeTest.cmake @@ -1,5 +1,7 @@ include(RunCMake) +run_cmake(InstallBeforeFramework) + function(framework_layout_test Name Toolchain Type) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${Toolchain}${Type}FrameworkLayout-build) set(RunCMake_TEST_NO_CLEAN 1) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d9dd68cb60ed09e32cbda8bbd3e31c86a8778e66 commit d9dd68cb60ed09e32cbda8bbd3e31c86a8778e66 Author: Brad King AuthorDate: Tue Jan 29 11:54:46 2019 -0500 Commit: Brad King CommitDate: Tue Jan 29 12:49:53 2019 -0500 macOS: Restore compatibility for setting FRAMEWORK after install() The `FRAMEWORK` target property affects the way the `install()` command treats the target and so should be set first. Our implementation assumed that this was always the case and led to an assertion failure. Prior to CMake 3.12 this was visible only when using an explicit `LIBRARY ... NAMELINK_ONLY` option, but commit 0212d7c762 (install: add NAMELINK_COMPONENT argument, 2018-04-18, v3.12.0-rc1~139^2~3) made it possible with a simple `LIBRARY DESTINATION`. Fully supporting out-of-order specification will require non-trivial refactoring to defer install generator creation to generate time. For now simply restore the old behavior of installing the framework to the library destination. Fixes: #18848 diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 8b8f79b..bf0217a 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -210,8 +210,29 @@ void cmInstallTargetGenerator::GenerateScriptForConfig( // An import library looks like a static library. type = cmInstallType_STATIC_LIBRARY; } else if (this->Target->IsFrameworkOnApple()) { - // There is a bug in cmInstallCommand if this fails. - assert(this->NamelinkMode == NamelinkModeNone); + // FIXME: In principle we should be able to + // assert(this->NamelinkMode == NamelinkModeNone); + // but since the current install() command implementation checks + // the FRAMEWORK property immediately instead of delaying until + // generate time, it is possible for project code to set the + // property after calling install(). In such a case, the install() + // command will use the LIBRARY code path and create two install + // generators, one for the namelink component (NamelinkModeOnly) + // and one for the primary artifact component (NamelinkModeSkip). + // Historically this was not diagnosed and resulted in silent + // installation of a framework to the LIBRARY destination. + // Retain that behavior. + switch (this->NamelinkMode) { + case NamelinkModeNone: + // Normal case. + break; + case NamelinkModeOnly: + // Assume the NamelinkModeSkip instance will install. + return; + case NamelinkModeSkip: { + // Proceed to install in the LIBRARY destination for compatibility. + } break; + } // Install the whole framework directory. type = cmInstallType_DIRECTORY; diff --git a/Tests/RunCMake/Framework/InstallBeforeFramework.cmake b/Tests/RunCMake/Framework/InstallBeforeFramework.cmake new file mode 100644 index 0000000..3791dac --- /dev/null +++ b/Tests/RunCMake/Framework/InstallBeforeFramework.cmake @@ -0,0 +1,5 @@ +enable_language(C) + +add_library(foo SHARED foo.c) +install(TARGETS foo LIBRARY DESTINATION lib) +set_property(TARGET foo PROPERTY FRAMEWORK TRUE) diff --git a/Tests/RunCMake/Framework/RunCMakeTest.cmake b/Tests/RunCMake/Framework/RunCMakeTest.cmake index 4fc83f8..e705a31 100644 --- a/Tests/RunCMake/Framework/RunCMakeTest.cmake +++ b/Tests/RunCMake/Framework/RunCMakeTest.cmake @@ -1,5 +1,7 @@ include(RunCMake) +run_cmake(InstallBeforeFramework) + function(framework_layout_test Name Toolchain Type) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${Toolchain}${Type}FrameworkLayout-build) set(RunCMake_TEST_NO_CLEAN 1) ----------------------------------------------------------------------- Summary of changes: Source/cmFindPackageCommand.cxx | 9 ++++--- Source/cmFindPackageCommand.h | 2 +- Source/cmInstallTargetGenerator.cxx | 31 ++++++++++++++++++++-- Source/cmake.cxx | 16 +++++------ Source/cmake.h | 3 ++- .../Framework/InstallBeforeFramework-stderr.txt | 7 +++++ .../Framework/InstallBeforeFramework.cmake | 5 ++++ Tests/RunCMake/Framework/RunCMakeTest.cmake | 2 ++ 8 files changed, 59 insertions(+), 16 deletions(-) create mode 100644 Tests/RunCMake/Framework/InstallBeforeFramework-stderr.txt create mode 100644 Tests/RunCMake/Framework/InstallBeforeFramework.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Thu Jan 31 11:03:03 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 31 Jan 2019 11:03:03 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-1231-g591899b Message-ID: <20190131160303.CD2CA113532@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 591899bc9643881610f665ac2e8787774a6b78b0 (commit) via cba5b22db34c73c32653894d39888b44b9f25558 (commit) via 6f5e4a53bca7ce5c15b1d030ef99bb2b3a1b0d2e (commit) via 9eaa6aa599ebc4f380fbc36e352fd5ad25c5bcd7 (commit) via bb735025dea634285a43b32b98af7ac25c5f8e76 (commit) via 91d98542d26318d8f51c434e689ccf6cddc2d3d0 (commit) via 062d21c36a57ad9c7528ea3f490595492853f1f8 (commit) via 17ac7c4024147386bd059523eff12951f3c0ef7d (commit) via 2df6d69014c8f8c0191dbf30d8c406225edbef3e (commit) via b598dfb65edd75e0da763d36dcdc3d19016a8d27 (commit) from 5107a84d46ad245221843adbef092118649e6dc7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=591899bc9643881610f665ac2e8787774a6b78b0 commit 591899bc9643881610f665ac2e8787774a6b78b0 Merge: 9eaa6aa cba5b22 Author: Brad King AuthorDate: Thu Jan 31 16:01:35 2019 +0000 Commit: Kitware Robot CommitDate: Thu Jan 31 11:01:41 2019 -0500 Merge topic 'FindLAPACK-typo' cba5b22db3 Merge branch 'backport-FindLAPACK-typo' 6f5e4a53bc FindLAPACK: Distinguish check result variable name from FindBLAS bb735025de Find{BLAS,LAPACK}: Drop unnecessary mark_as_advanced calls Acked-by: Kitware Robot Merge-request: !2897 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cba5b22db34c73c32653894d39888b44b9f25558 commit cba5b22db34c73c32653894d39888b44b9f25558 Merge: bb73502 6f5e4a5 Author: Brad King AuthorDate: Thu Jan 31 09:17:30 2019 -0500 Commit: Brad King CommitDate: Thu Jan 31 10:59:53 2019 -0500 Merge branch 'backport-FindLAPACK-typo' Use the `-s ours` merge strategy to avoid conflicts. Our side was already fixed by commit 8b63265ea5 (FindLAPACK: Unify internal variables related to MKL, 2018-11-18) as part of other work. https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6f5e4a53bca7ce5c15b1d030ef99bb2b3a1b0d2e commit 6f5e4a53bca7ce5c15b1d030ef99bb2b3a1b0d2e Author: Brad King AuthorDate: Thu Jan 31 08:59:37 2019 -0500 Commit: Brad King CommitDate: Thu Jan 31 10:59:25 2019 -0500 FindLAPACK: Distinguish check result variable name from FindBLAS Since commit 192a9182f8 (FindLAPACK: MKL clean up and fix for windows, 2013-10-08, v3.0.0-rc1~538^2), FindLAPACK accidentally used FindBLAS's `BLAS_` prefix for some of its check results. Since commit 5b8f69ebe9 (FindBLAS: Detect implicitly linked BLAS library, 2018-08-28, v3.13.0-rc1~150^2~2), FindBLAS stores a check result in a plain `BLAS_WORKS` variable. The typo in FindLAPACK happens to cause a collision with that name. The typo was already fixed in post-3.13 development as part of other work in commit 8b63265ea5 (FindLAPACK: Unify internal variables related to MKL, 2018-11-18). Fix the typo in the 3.13 version of FindLAPACK to avoid the collision. Otherwise it could cause FindLAPACK to incorrectly determine that a certain library combination does not work (or incrrectly that it works). Fixes: #18860 diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake index 2c6145a..dc94079 100644 --- a/Modules/FindLAPACK.cmake +++ b/Modules/FindLAPACK.cmake @@ -316,7 +316,7 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") if (NOT ${_LIBRARIES}) check_lapack_libraries( ${_LIBRARIES} - BLAS + LAPACK ${LAPACK_mkl_SEARCH_SYMBOL} "" "" @@ -329,7 +329,7 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") if (NOT ${_LIBRARIES}) check_lapack_libraries( ${_LIBRARIES} - BLAS + LAPACK ${LAPACK_mkl_SEARCH_SYMBOL} "" "${IT}" https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9eaa6aa599ebc4f380fbc36e352fd5ad25c5bcd7 commit 9eaa6aa599ebc4f380fbc36e352fd5ad25c5bcd7 Merge: 5107a84 91d9854 Author: Brad King AuthorDate: Thu Jan 31 15:58:15 2019 +0000 Commit: Kitware Robot CommitDate: Thu Jan 31 10:58:23 2019 -0500 Merge topic 'autogen-qt-version-from-dirprops' 91d98542d2 Merge branch 'autogen-qt-version-from-dirprops-release' into autogen-qt-version-from-dirprops-master 062d21c36a Autogen: Read the Qt version from directory properties as well 17ac7c4024 Tests: add cases for providing Qt5Core_VERSION manually 2df6d69014 AutoGen: query Qt5 version from directory properties b598dfb65e Tests: add cases for providing Qt5Core_VERSION manually Acked-by: Kitware Robot Merge-request: !2883 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bb735025dea634285a43b32b98af7ac25c5f8e76 commit bb735025dea634285a43b32b98af7ac25c5f8e76 Author: Brad King AuthorDate: Thu Jan 31 08:58:47 2019 -0500 Commit: Brad King CommitDate: Thu Jan 31 09:11:03 2019 -0500 Find{BLAS,LAPACK}: Drop unnecessary mark_as_advanced calls Cache entries created by `try_compile` are already `INTERNAL`. diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index b6348fd..33cc024 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -167,7 +167,6 @@ macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread) check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS) endif() set(CMAKE_REQUIRED_LIBRARIES) - mark_as_advanced(${_prefix}${_combined_name}_WORKS) set(_libraries_work ${${_prefix}${_combined_name}_WORKS}) endif() if(_libraries_work) diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake index 7619664..7b5f527 100644 --- a/Modules/FindLAPACK.cmake +++ b/Modules/FindLAPACK.cmake @@ -142,7 +142,6 @@ if(_libraries_work) check_fortran_function_exists(${_name} ${_prefix}${_combined_name}_WORKS) endif () set(CMAKE_REQUIRED_LIBRARIES) - mark_as_advanced(${_prefix}${_combined_name}_WORKS) set(_libraries_work ${${_prefix}${_combined_name}_WORKS}) #message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}") endif() https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=91d98542d26318d8f51c434e689ccf6cddc2d3d0 commit 91d98542d26318d8f51c434e689ccf6cddc2d3d0 Merge: 062d21c 2df6d69 Author: Ben Boeckel AuthorDate: Wed Jan 30 11:30:26 2019 -0500 Commit: Ben Boeckel CommitDate: Wed Jan 30 11:30:26 2019 -0500 Merge branch 'autogen-qt-version-from-dirprops-release' into autogen-qt-version-from-dirprops-master * autogen-qt-version-from-dirprops-release: AutoGen: query Qt5 version from directory properties Tests: add cases for providing Qt5Core_VERSION manually https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=062d21c36a57ad9c7528ea3f490595492853f1f8 commit 062d21c36a57ad9c7528ea3f490595492853f1f8 Author: Sebastian Holtermann AuthorDate: Wed Jan 30 17:01:02 2019 +0100 Commit: Ben Boeckel CommitDate: Wed Jan 30 11:30:18 2019 -0500 Autogen: Read the Qt version from directory properties as well This lets AUTOGEN read the Qt version from directory properties as a fallback when the Qt version variables are empty or unset. diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index 1d7f6d1..caeed15 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -1370,7 +1370,7 @@ void cmQtAutoGenInitializer::AddGeneratedSource(std::string const& filename, this->Target->AddSource(filename, prepend); } -static unsigned int CharPtrToInt(const char* const input) +static unsigned int CharPtrToUInt(const char* const input) { unsigned long tmp = 0; if (input != nullptr && cmSystemTools::StringToULong(input, &tmp)) { @@ -1379,36 +1379,43 @@ static unsigned int CharPtrToInt(const char* const input) return 0; } -static unsigned int StringToInt(const std::string& input) -{ - return input.empty() ? 0 : CharPtrToInt(input.c_str()); -} - -static std::vector GetKnownQtVersions( +static std::vector GetKnownQtVersions( cmGeneratorTarget const* target) { cmMakefile* makefile = target->Target->GetMakefile(); - - std::vector result; - for (const std::string& prefix : - std::vector({ "Qt6Core", "Qt5Core", "QT" })) { - auto tmp = cmQtAutoGenInitializer::IntegerVersion( - StringToInt(makefile->GetSafeDefinition(prefix + "_VERSION_MAJOR")), - StringToInt(makefile->GetSafeDefinition(prefix + "_VERSION_MINOR"))); - if (tmp.Major != 0) { - result.push_back(tmp); + std::vector result; + // Adds a version to the result (nullptr safe) + auto addVersion = [&result](const char* major, const char* minor) { + cmQtAutoGen::IntegerVersion ver(CharPtrToUInt(major), + CharPtrToUInt(minor)); + if (ver.Major != 0) { + result.emplace_back(ver); } + }; + // Qt version variable prefixes + std::array const prefixes{ { "Qt6Core", "Qt5Core", "QT" } }; + + // Read versions from variables + for (const std::string& prefix : prefixes) { + addVersion(makefile->GetDefinition(prefix + "_VERSION_MAJOR"), + makefile->GetDefinition(prefix + "_VERSION_MINOR")); + } + + // Read versions from directory properties + for (const std::string& prefix : prefixes) { + addVersion(makefile->GetProperty(prefix + "_VERSION_MAJOR"), + makefile->GetProperty(prefix + "_VERSION_MINOR")); } return result; } -std::pair +std::pair cmQtAutoGenInitializer::GetQtVersion(cmGeneratorTarget const* target) { std::pair res( IntegerVersion(), - CharPtrToInt(target->GetLinkInterfaceDependentStringProperty( + CharPtrToUInt(target->GetLinkInterfaceDependentStringProperty( "QT_MAJOR_VERSION", ""))); auto knownQtVersions = GetKnownQtVersions(target); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=17ac7c4024147386bd059523eff12951f3c0ef7d commit 17ac7c4024147386bd059523eff12951f3c0ef7d Author: Ben Boeckel AuthorDate: Wed Jan 30 10:45:41 2019 -0500 Commit: Ben Boeckel CommitDate: Wed Jan 30 11:30:18 2019 -0500 Tests: add cases for providing Qt5Core_VERSION manually diff --git a/Tests/RunCMake/Autogen/QtInFunction.cmake b/Tests/RunCMake/Autogen/QtInFunction.cmake new file mode 100644 index 0000000..a44bc5a --- /dev/null +++ b/Tests/RunCMake/Autogen/QtInFunction.cmake @@ -0,0 +1,13 @@ +enable_language(CXX) + +function (use_autogen target) + find_package(Qt5 REQUIRED COMPONENTS Core Widgets) + set(Qt5Core_VERSION_MAJOR "${Qt5Core_VERSION_MAJOR}" PARENT_SCOPE) + set(Qt5Core_VERSION_MINOR "${Qt5Core_VERSION_MINOR}" PARENT_SCOPE) + set_property(TARGET "${target}" PROPERTY AUTOMOC 1) + set_property(TARGET "${target}" PROPERTY AUTORCC 1) + set_property(TARGET "${target}" PROPERTY AUTOUIC 1) +endfunction () + +add_executable(main empty.cpp) +use_autogen(main) diff --git a/Tests/RunCMake/Autogen/QtInFunctionNested-stderr.txt b/Tests/RunCMake/Autogen/QtInFunctionNested-stderr.txt new file mode 100644 index 0000000..1c6660a --- /dev/null +++ b/Tests/RunCMake/Autogen/QtInFunctionNested-stderr.txt @@ -0,0 +1,8 @@ +^CMake Warning \(dev\) in CMakeLists.txt: + AUTOGEN: No valid Qt version found for target main. AUTOMOC, AUTOUIC and + AUTORCC disabled. Consider adding: + + find_package\(Qt COMPONENTS Widgets\) + + to your CMakeLists.txt file. +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/Autogen/QtInFunctionNested.cmake b/Tests/RunCMake/Autogen/QtInFunctionNested.cmake new file mode 100644 index 0000000..5421ba0 --- /dev/null +++ b/Tests/RunCMake/Autogen/QtInFunctionNested.cmake @@ -0,0 +1,17 @@ +enable_language(CXX) + +function (use_autogen target) + find_package(Qt5 REQUIRED COMPONENTS Core Widgets) + set(Qt5Core_VERSION_MAJOR "${Qt5Core_VERSION_MAJOR}" PARENT_SCOPE) + set(Qt5Core_VERSION_MINOR "${Qt5Core_VERSION_MINOR}" PARENT_SCOPE) + set_property(TARGET "${target}" PROPERTY AUTOMOC 1) + set_property(TARGET "${target}" PROPERTY AUTORCC 1) + set_property(TARGET "${target}" PROPERTY AUTOUIC 1) +endfunction () + +function (wrap_autogen target) + use_autogen("${target}") +endfunction () + +add_executable(main empty.cpp) +wrap_autogen(main) diff --git a/Tests/RunCMake/Autogen/QtInFunctionProperty.cmake b/Tests/RunCMake/Autogen/QtInFunctionProperty.cmake new file mode 100644 index 0000000..35f1cd1 --- /dev/null +++ b/Tests/RunCMake/Autogen/QtInFunctionProperty.cmake @@ -0,0 +1,21 @@ +enable_language(CXX) + +function (use_autogen target) + find_package(Qt5 REQUIRED COMPONENTS Core Widgets) + set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + PROPERTY + Qt5Core_VERSION_MAJOR "${Qt5Core_VERSION_MAJOR}") + set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + PROPERTY + Qt5Core_VERSION_MINOR "${Qt5Core_VERSION_MINOR}") + set_property(TARGET "${target}" PROPERTY AUTOMOC 1) + set_property(TARGET "${target}" PROPERTY AUTORCC 1) + set_property(TARGET "${target}" PROPERTY AUTOUIC 1) +endfunction () + +function (wrap_autogen target) + use_autogen("${target}") +endfunction () + +add_executable(main empty.cpp) +wrap_autogen(main) diff --git a/Tests/RunCMake/Autogen/RunCMakeTest.cmake b/Tests/RunCMake/Autogen/RunCMakeTest.cmake index e52f28d..a31b67c 100644 --- a/Tests/RunCMake/Autogen/RunCMakeTest.cmake +++ b/Tests/RunCMake/Autogen/RunCMakeTest.cmake @@ -1,3 +1,8 @@ include(RunCMake) run_cmake(NoQt) +if (with_qt5) + run_cmake(QtInFunction) + run_cmake(QtInFunctionNested) + run_cmake(QtInFunctionProperty) +endif () diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 2de90e7..1f3e5c3 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -150,7 +150,14 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE) endif() add_RunCMake_test(AndroidTestUtilities) -add_RunCMake_test(Autogen) +set(autogen_with_qt5 FALSE) +if(CMake_TEST_Qt5) + find_package(Qt5Widgets QUIET NO_MODULE) +endif() +if(CMake_TEST_Qt5 AND Qt5Widgets_FOUND) + set(autogen_with_qt5 TRUE) +endif () +add_RunCMake_test(Autogen -Dwith_qt5=${autogen_with_qt5}) add_RunCMake_test(BuildDepends) if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja") add_RunCMake_test(Byproducts) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2df6d69014c8f8c0191dbf30d8c406225edbef3e commit 2df6d69014c8f8c0191dbf30d8c406225edbef3e Author: Ben Boeckel AuthorDate: Wed Jan 30 09:16:40 2019 -0500 Commit: Ben Boeckel CommitDate: Wed Jan 30 10:46:40 2019 -0500 AutoGen: query Qt5 version from directory properties This allows functions which enable AutoGen to make the version variables available at generate time. See: #18732 diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index f9c8c7f..9011180 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -1281,6 +1281,12 @@ cmQtAutoGenInitializer::IntegerVersion cmQtAutoGenInitializer::GetQtVersion( if (qtMajor.empty()) { qtMajor = makefile->GetSafeDefinition("Qt5Core_VERSION_MAJOR"); } + if (qtMajor.empty()) { + const char* dirprop = makefile->GetProperty("Qt5Core_VERSION_MAJOR"); + if (dirprop) { + qtMajor = dirprop; + } + } { const char* targetQtVersion = target->GetLinkInterfaceDependentStringProperty("QT_MAJOR_VERSION", ""); @@ -1294,6 +1300,12 @@ cmQtAutoGenInitializer::IntegerVersion cmQtAutoGenInitializer::GetQtVersion( if (!qtMajor.empty()) { if (qtMajor == "5") { qtMinor = makefile->GetSafeDefinition("Qt5Core_VERSION_MINOR"); + if (qtMinor.empty()) { + const char* dirprop = makefile->GetProperty("Qt5Core_VERSION_MINOR"); + if (dirprop) { + qtMinor = dirprop; + } + } } if (qtMinor.empty()) { qtMinor = makefile->GetSafeDefinition("QT_VERSION_MINOR"); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b598dfb65edd75e0da763d36dcdc3d19016a8d27 commit b598dfb65edd75e0da763d36dcdc3d19016a8d27 Author: Ben Boeckel AuthorDate: Wed Jan 30 10:45:41 2019 -0500 Commit: Ben Boeckel CommitDate: Wed Jan 30 10:46:40 2019 -0500 Tests: add cases for providing Qt5Core_VERSION manually diff --git a/Tests/RunCMake/Autogen/QtInFunction.cmake b/Tests/RunCMake/Autogen/QtInFunction.cmake new file mode 100644 index 0000000..a44bc5a --- /dev/null +++ b/Tests/RunCMake/Autogen/QtInFunction.cmake @@ -0,0 +1,13 @@ +enable_language(CXX) + +function (use_autogen target) + find_package(Qt5 REQUIRED COMPONENTS Core Widgets) + set(Qt5Core_VERSION_MAJOR "${Qt5Core_VERSION_MAJOR}" PARENT_SCOPE) + set(Qt5Core_VERSION_MINOR "${Qt5Core_VERSION_MINOR}" PARENT_SCOPE) + set_property(TARGET "${target}" PROPERTY AUTOMOC 1) + set_property(TARGET "${target}" PROPERTY AUTORCC 1) + set_property(TARGET "${target}" PROPERTY AUTOUIC 1) +endfunction () + +add_executable(main empty.cpp) +use_autogen(main) diff --git a/Tests/RunCMake/Autogen/QtInFunctionNested-stderr.txt b/Tests/RunCMake/Autogen/QtInFunctionNested-stderr.txt new file mode 100644 index 0000000..6b4a933 --- /dev/null +++ b/Tests/RunCMake/Autogen/QtInFunctionNested-stderr.txt @@ -0,0 +1,8 @@ +^CMake Warning \(dev\) in CMakeLists.txt: + AUTOGEN: No valid Qt version found for target main. AUTOMOC, AUTOUIC, + AUTORCC disabled. Consider adding: + + find_package\(Qt5 COMPONENTS Widgets\) + + to your CMakeLists.txt file. +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/Autogen/QtInFunctionNested.cmake b/Tests/RunCMake/Autogen/QtInFunctionNested.cmake new file mode 100644 index 0000000..5421ba0 --- /dev/null +++ b/Tests/RunCMake/Autogen/QtInFunctionNested.cmake @@ -0,0 +1,17 @@ +enable_language(CXX) + +function (use_autogen target) + find_package(Qt5 REQUIRED COMPONENTS Core Widgets) + set(Qt5Core_VERSION_MAJOR "${Qt5Core_VERSION_MAJOR}" PARENT_SCOPE) + set(Qt5Core_VERSION_MINOR "${Qt5Core_VERSION_MINOR}" PARENT_SCOPE) + set_property(TARGET "${target}" PROPERTY AUTOMOC 1) + set_property(TARGET "${target}" PROPERTY AUTORCC 1) + set_property(TARGET "${target}" PROPERTY AUTOUIC 1) +endfunction () + +function (wrap_autogen target) + use_autogen("${target}") +endfunction () + +add_executable(main empty.cpp) +wrap_autogen(main) diff --git a/Tests/RunCMake/Autogen/QtInFunctionProperty.cmake b/Tests/RunCMake/Autogen/QtInFunctionProperty.cmake new file mode 100644 index 0000000..35f1cd1 --- /dev/null +++ b/Tests/RunCMake/Autogen/QtInFunctionProperty.cmake @@ -0,0 +1,21 @@ +enable_language(CXX) + +function (use_autogen target) + find_package(Qt5 REQUIRED COMPONENTS Core Widgets) + set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + PROPERTY + Qt5Core_VERSION_MAJOR "${Qt5Core_VERSION_MAJOR}") + set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + PROPERTY + Qt5Core_VERSION_MINOR "${Qt5Core_VERSION_MINOR}") + set_property(TARGET "${target}" PROPERTY AUTOMOC 1) + set_property(TARGET "${target}" PROPERTY AUTORCC 1) + set_property(TARGET "${target}" PROPERTY AUTOUIC 1) +endfunction () + +function (wrap_autogen target) + use_autogen("${target}") +endfunction () + +add_executable(main empty.cpp) +wrap_autogen(main) diff --git a/Tests/RunCMake/Autogen/RunCMakeTest.cmake b/Tests/RunCMake/Autogen/RunCMakeTest.cmake index e52f28d..a31b67c 100644 --- a/Tests/RunCMake/Autogen/RunCMakeTest.cmake +++ b/Tests/RunCMake/Autogen/RunCMakeTest.cmake @@ -1,3 +1,8 @@ include(RunCMake) run_cmake(NoQt) +if (with_qt5) + run_cmake(QtInFunction) + run_cmake(QtInFunctionNested) + run_cmake(QtInFunctionProperty) +endif () diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 89102dd..27413dd 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -142,7 +142,14 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE) endif() add_RunCMake_test(AndroidTestUtilities) -add_RunCMake_test(Autogen) +set(autogen_with_qt5 FALSE) +if(CMake_TEST_Qt5) + find_package(Qt5Widgets QUIET NO_MODULE) +endif() +if(CMake_TEST_Qt5 AND Qt5Widgets_FOUND) + set(autogen_with_qt5 TRUE) +endif () +add_RunCMake_test(Autogen -Dwith_qt5=${autogen_with_qt5}) add_RunCMake_test(BuildDepends) if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja") add_RunCMake_test(Byproducts) ----------------------------------------------------------------------- Summary of changes: Modules/FindBLAS.cmake | 1 - Modules/FindLAPACK.cmake | 1 - Source/cmQtAutoGenInitializer.cxx | 43 +++++++++++++--------- Tests/RunCMake/Autogen/QtInFunction.cmake | 13 +++++++ ...Qt-stderr.txt => QtInFunctionNested-stderr.txt} | 0 Tests/RunCMake/Autogen/QtInFunctionNested.cmake | 17 +++++++++ Tests/RunCMake/Autogen/QtInFunctionProperty.cmake | 21 +++++++++++ Tests/RunCMake/Autogen/RunCMakeTest.cmake | 5 +++ Tests/RunCMake/CMakeLists.txt | 9 ++++- 9 files changed, 89 insertions(+), 21 deletions(-) create mode 100644 Tests/RunCMake/Autogen/QtInFunction.cmake copy Tests/RunCMake/Autogen/{NoQt-stderr.txt => QtInFunctionNested-stderr.txt} (100%) create mode 100644 Tests/RunCMake/Autogen/QtInFunctionNested.cmake create mode 100644 Tests/RunCMake/Autogen/QtInFunctionProperty.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Thu Jan 31 11:13:03 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 31 Jan 2019 11:13:03 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-1245-g24bee42 Message-ID: <20190131161303.48965113532@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 24bee427b5da710c5f9941f5cddb455df1a2ea82 (commit) via 9aef4a732ba6b0d20c9953d171514fa4c0daaddf (commit) via 1b3b0fa43a51aed03f38b98f30d9383bc6d377d6 (commit) via 74cba6a3fde29649a924bc54269ed3449743eb5f (commit) via a37614667d2a1d7d3e4db5e1ec8df644bfbe39fa (commit) via e3b26f0004e20c11818e8c6cdd6c778c379d8c67 (commit) via c22e373a3077a90a4f1ed509774412a0ab82d992 (commit) via ec027aa64a8f5ee59d4962673cc8e8ec1abd5d85 (commit) via be7b30f67e7e5c8b0186ba622dc06ce8ffe2df4e (commit) via b323407235a3671eb11c7a039ce1c2f134025c73 (commit) via 9d20fe014f3b81fa7d7a3b7d203b58abe6fd5ce6 (commit) via dfb2d6178e68379683a012c7c9306b851c1350a6 (commit) via ba30b94435bc621767fb887d081a257cdec8a633 (commit) via 9c4cdc43f68c46984cbf7ce7d5f22aadcdde1a00 (commit) from 591899bc9643881610f665ac2e8787774a6b78b0 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=24bee427b5da710c5f9941f5cddb455df1a2ea82 commit 24bee427b5da710c5f9941f5cddb455df1a2ea82 Merge: 9aef4a7 a376146 Author: Brad King AuthorDate: Thu Jan 31 16:10:44 2019 +0000 Commit: Kitware Robot CommitDate: Thu Jan 31 11:12:27 2019 -0500 Merge topic 'update-kwsys' a37614667d Configure KWSys to honor CMake_NO_CXX_STANDARD e3b26f0004 Merge branch 'upstream-KWSys' into update-kwsys c22e373a30 KWSys 2019-01-30 (ce89cada) Acked-by: Kitware Robot Merge-request: !2886 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9aef4a732ba6b0d20c9953d171514fa4c0daaddf commit 9aef4a732ba6b0d20c9953d171514fa4c0daaddf Merge: 1b3b0fa 9d20fe0 Author: Brad King AuthorDate: Thu Jan 31 16:09:54 2019 +0000 Commit: Kitware Robot CommitDate: Thu Jan 31 11:11:28 2019 -0500 Merge topic 'variables1' 9d20fe014f Help: moved 7 variables to "internal" section dfb2d6178e Help: "internal variables" instead of "obsolete", with some explanatory prose 9c4cdc43f6 Help: declare CMAKE_HOME_DIRECTORY obsolete Acked-by: Kitware Robot Merge-request: !2881 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1b3b0fa43a51aed03f38b98f30d9383bc6d377d6 commit 1b3b0fa43a51aed03f38b98f30d9383bc6d377d6 Merge: 74cba6a ec027aa Author: Brad King AuthorDate: Thu Jan 31 16:09:46 2019 +0000 Commit: Kitware Robot CommitDate: Thu Jan 31 11:10:03 2019 -0500 Merge topic 'msys_docs' ec027aa64a Help: Add documentation for MSYS variable Acked-by: Kitware Robot Merge-request: !2882 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=74cba6a3fde29649a924bc54269ed3449743eb5f commit 74cba6a3fde29649a924bc54269ed3449743eb5f Merge: 591899b be7b30f Author: Brad King AuthorDate: Thu Jan 31 16:08:09 2019 +0000 Commit: Kitware Robot CommitDate: Thu Jan 31 11:08:19 2019 -0500 Merge topic 'lapack-docs' be7b30f67e Find{BLAS,LAPACK}: Add note and example for using Intel MKL b323407235 Find{BLAS,LAPACK}: Update docs to use modern conventions ba30b94435 FindLAPACK: Remove extra indentation from a line Acked-by: Kitware Robot Merge-request: !2880 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a37614667d2a1d7d3e4db5e1ec8df644bfbe39fa commit a37614667d2a1d7d3e4db5e1ec8df644bfbe39fa Author: Brad King AuthorDate: Wed Jan 30 10:39:41 2019 -0500 Commit: Brad King CommitDate: Wed Jan 30 10:39:41 2019 -0500 Configure KWSys to honor CMake_NO_CXX_STANDARD KWSys now computes a default `CMAKE_CXX_STANDARD` value if it is not told what standard to use. When `CMake_NO_CXX_STANDARD` is enabled, tell KWSys not to do that. diff --git a/CMakeLists.txt b/CMakeLists.txt index 75a0b52..bd130ec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -332,6 +332,9 @@ macro (CMAKE_BUILD_UTILITIES) set(KWSYS_USE_ConsoleBuf 1) set(KWSYS_HEADER_ROOT ${CMake_BINARY_DIR}/Source) set(KWSYS_INSTALL_DOC_DIR "${CMAKE_DOC_DIR}") + if(CMake_NO_CXX_STANDARD) + set(KWSYS_CXX_STANDARD "") + endif() add_subdirectory(Source/kwsys) set(kwsys_folder "Utilities/KWSys") CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE} "${kwsys_folder}") https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e3b26f0004e20c11818e8c6cdd6c778c379d8c67 commit e3b26f0004e20c11818e8c6cdd6c778c379d8c67 Merge: 748d024 c22e373 Author: Brad King AuthorDate: Wed Jan 30 10:36:24 2019 -0500 Commit: Brad King CommitDate: Wed Jan 30 10:36:24 2019 -0500 Merge branch 'upstream-KWSys' into update-kwsys * upstream-KWSys: KWSys 2019-01-30 (ce89cada) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c22e373a3077a90a4f1ed509774412a0ab82d992 commit c22e373a3077a90a4f1ed509774412a0ab82d992 Author: KWSys Upstream AuthorDate: Wed Jan 30 10:35:38 2019 -0500 Commit: Brad King CommitDate: Wed Jan 30 10:36:23 2019 -0500 KWSys 2019-01-30 (ce89cada) Code extracted from: https://gitlab.kitware.com/utils/kwsys.git at commit ce89cada1c48be31e6294a984b15c2c75b66eab0 (master). Upstream Shortlog ----------------- Brad King (2): 5d92e8d9 Require CMake 3.1 or higher for KWSys 6db3c607 Require C++11 or higher to compile KWSys diff --git a/CMakeLists.txt b/CMakeLists.txt index b33aa80..e7da994 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,6 +42,10 @@ # SET(KWSYS_HEADER_ROOT ${PROJECT_BINARY_DIR}) # INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR}) # +# KWSYS_CXX_STANDARD = A value for CMAKE_CXX_STANDARD within KWSys. +# Set to empty string to use no default value. +# KWSYS_CXX_COMPILE_FEATURES = target_compile_features arguments for KWSys. +# # Optional settings to setup install rules are as follows: # # KWSYS_INSTALL_BIN_DIR = The installation target directories into @@ -82,25 +86,17 @@ # any outside mailing list and no documentation of the change will be # written. -CMAKE_MINIMUM_REQUIRED(VERSION 2.6.3 FATAL_ERROR) +CMAKE_MINIMUM_REQUIRED(VERSION 3.1 FATAL_ERROR) FOREACH(p - CMP0022 # CMake 2.8, Define link interface - required by android_mk export - CMP0025 # CMake 3.0, Compiler id for Apple Clang is now AppleClang. - CMP0042 # CMake 3.0, MACOSX_RPATH is enabled by default. - CMP0048 # CMake 3.0, Let the project command manage version variables. CMP0056 # CMake 3.2, Honor link flags in try_compile() source-file signature. CMP0063 # CMake 3.3, Honor visibility properties for all target types. + CMP0067 # CMake 3.8, Honor language standard in try_compile source-file signature. CMP0069 # CMake 3.9, INTERPROCEDURAL_OPTIMIZATION is enforced when enabled. ) IF(POLICY ${p}) CMAKE_POLICY(SET ${p} NEW) ENDIF() ENDFOREACH() -SET(CMAKE_LEGACY_CYGWIN_WIN32 0) - -IF(CMAKE_VERSION VERSION_LESS 3.0) - SET(KWSYS_SPLIT_OBJECTS_FROM_INTERFACE 0) -ENDIF() #----------------------------------------------------------------------------- # If a namespace is not specified, use "kwsys" and enable testing. @@ -121,6 +117,12 @@ SET_PROPERTY(DIRECTORY "KWSYS_HEADER(%)=<${KWSYS_NAMESPACE}/%>" ) +if(KWSYS_CXX_STANDARD) + set(CMAKE_CXX_STANDARD "${KWSYS_CXX_STANDARD}") +elseif(NOT DEFINED CMAKE_CXX_STANDARD AND NOT DEFINED KWSYS_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 11) +endif() + # Select library components. IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR) SET(KWSYS_ENABLE_C 1) @@ -884,6 +886,8 @@ IF(KWSYS_C_SRCS OR KWSYS_CXX_SRCS) ${KWSYS_TARGET_INTERFACE}) TARGET_SOURCES(${KWSYS_TARGET_LINK} INTERFACE $) + target_compile_features(${KWSYS_TARGET_OBJECT} PRIVATE ${KWSYS_CXX_COMPILE_FEATURES}) + target_compile_features(${KWSYS_TARGET_INTERFACE} INTERFACE ${KWSYS_CXX_COMPILE_FEATURES}) ELSE() SET(KWSYS_TARGET_INTERFACE ${KWSYS_NAMESPACE}) SET(KWSYS_TARGET_OBJECT ${KWSYS_NAMESPACE}) @@ -892,6 +896,7 @@ IF(KWSYS_C_SRCS OR KWSYS_CXX_SRCS) SET(KWSYS_LINK_DEPENDENCY PUBLIC) ADD_LIBRARY(${KWSYS_TARGET_INTERFACE} ${KWSYS_LIBRARY_TYPE} ${KWSYS_C_SRCS} ${KWSYS_CXX_SRCS}) + target_compile_features(${KWSYS_TARGET_INTERFACE} PUBLIC ${KWSYS_CXX_COMPILE_FEATURES}) ENDIF() if (KWSYS_ALIAS_TARGET) add_library(${KWSYS_ALIAS_TARGET} ALIAS ${KWSYS_TARGET_INTERFACE}) diff --git a/kwsysPlatformTests.cmake b/kwsysPlatformTests.cmake index 5386a49..28d3f68 100644 --- a/kwsysPlatformTests.cmake +++ b/kwsysPlatformTests.cmake @@ -7,11 +7,16 @@ SET(KWSYS_PLATFORM_TEST_FILE_CXX kwsysPlatformTestsCXX.cxx) MACRO(KWSYS_PLATFORM_TEST lang var description invert) IF(NOT DEFINED ${var}_COMPILED) MESSAGE(STATUS "${description}") + set(maybe_cxx_standard "") + if(CMAKE_VERSION VERSION_LESS 3.8 AND CMAKE_CXX_STANDARD) + set(maybe_cxx_standard "-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}") + endif() TRY_COMPILE(${var}_COMPILED ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${KWSYS_PLATFORM_TEST_FILE_${lang}} COMPILE_DEFINITIONS -DTEST_${var} ${KWSYS_PLATFORM_TEST_DEFINES} ${KWSYS_PLATFORM_TEST_EXTRA_FLAGS} CMAKE_FLAGS "-DLINK_LIBRARIES:STRING=${KWSYS_PLATFORM_TEST_LINK_LIBRARIES}" + ${maybe_cxx_standard} OUTPUT_VARIABLE OUTPUT) IF(${var}_COMPILED) FILE(APPEND https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ec027aa64a8f5ee59d4962673cc8e8ec1abd5d85 commit ec027aa64a8f5ee59d4962673cc8e8ec1abd5d85 Author: Harry Mallon AuthorDate: Wed Jan 30 13:16:02 2019 +0000 Commit: Brad King CommitDate: Wed Jan 30 10:20:59 2019 -0500 Help: Add documentation for MSYS variable diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index de4ce3d..5a16795 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -276,6 +276,7 @@ Variables that Describe the System /variable/MSVC_IDE /variable/MSVC_TOOLSET_VERSION /variable/MSVC_VERSION + /variable/MSYS /variable/UNIX /variable/WIN32 /variable/WINCE diff --git a/Help/variable/MSYS.rst b/Help/variable/MSYS.rst new file mode 100644 index 0000000..25ddc7f --- /dev/null +++ b/Help/variable/MSYS.rst @@ -0,0 +1,4 @@ +MSYS +---- + +``True`` when using the :generator:`MSYS Makefiles` generator. https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=be7b30f67e7e5c8b0186ba622dc06ce8ffe2df4e commit be7b30f67e7e5c8b0186ba622dc06ce8ffe2df4e Author: Michael Hirsch, Ph.D AuthorDate: Tue Jan 29 14:31:01 2019 -0500 Commit: Brad King CommitDate: Wed Jan 30 10:16:08 2019 -0500 Find{BLAS,LAPACK}: Add note and example for using Intel MKL diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index 3fc30c4..b246ae5 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -72,6 +72,17 @@ This module defines the following variables: to use BLAS95 interface ``BLAS95_FOUND`` library implementing the BLAS95 interface is found + +.. note:: + + C or CXX must be enabled to use Intel MKL + + For example, to use Intel MKL libraries and/or Intel compiler: + + .. code-block:: cmake + + set(BLA_VENDOR Intel10_64lp) + find_package(BLAS) #]=======================================================================] include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake) diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake index 69eed9a..7f8d5a1 100644 --- a/Modules/FindLAPACK.cmake +++ b/Modules/FindLAPACK.cmake @@ -59,6 +59,17 @@ This module defines the following variables: to use LAPACK95 ``LAPACK95_FOUND`` library implementing the LAPACK95 interface is found + +.. note:: + + C or CXX must be enabled to use Intel MKL + + For example, to use Intel MKL libraries and/or Intel compiler: + + .. code-block:: cmake + + set(BLA_VENDOR Intel10_64lp) + find_package(LAPACK) #]=======================================================================] set(_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b323407235a3671eb11c7a039ce1c2f134025c73 commit b323407235a3671eb11c7a039ce1c2f134025c73 Author: Michael Hirsch, Ph.D AuthorDate: Tue Jan 29 14:31:01 2019 -0500 Commit: Brad King CommitDate: Wed Jan 30 10:15:00 2019 -0500 Find{BLAS,LAPACK}: Update docs to use modern conventions diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index b6348fd..3fc30c4 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -13,62 +13,65 @@ list of libraries searched for is taken from the autoconf macro file, acx_blas.m4 (distributed at http://ac-archive.sourceforge.net/ac-archive/acx_blas.html). -This module sets the following variables: - -:: - - BLAS_FOUND - set to true if a library implementing the BLAS interface - is found - BLAS_LINKER_FLAGS - uncached list of required linker flags (excluding -l - and -L). - BLAS_LIBRARIES - uncached list of libraries (using full path name) to - link against to use BLAS (may be empty if compiler implicitly links - BLAS) - BLAS95_LIBRARIES - uncached list of libraries (using full path name) - to link against to use BLAS95 interface - BLAS95_FOUND - set to true if a library implementing the BLAS f95 interface - is found - -The following variables can be used to control this module: - -:: - - BLA_STATIC if set on this determines what kind of linkage we do (static) - BLA_VENDOR if set checks only the specified vendor, if not set checks - all the possibilities - BLA_F95 if set on tries to find the f95 interfaces for BLAS/LAPACK - BLA_PREFER_PKGCONFIG if set pkg-config will be used to search for a BLAS - library first and if one is found that is preferred - -List of vendors (BLA_VENDOR) valid in this module: - -* Goto -* OpenBLAS -* FLAME -* ATLAS PhiPACK -* CXML -* DXML -* SunPerf -* SCSL -* SGIMATH -* IBMESSL -* Intel10_32 (intel mkl v10 32 bit) -* Intel10_64lp (intel mkl v10+ 64 bit, threaded code, lp64 model) -* Intel10_64lp_seq (intel mkl v10+ 64 bit, sequential code, lp64 model) -* Intel10_64ilp (intel mkl v10+ 64 bit, threaded code, ilp64 model) -* Intel10_64ilp_seq (intel mkl v10+ 64 bit, sequential code, ilp64 model) -* Intel (older versions of mkl 32 and 64 bit) -* ACML -* ACML_MP -* ACML_GPU -* Apple -* NAS -* Generic - -.. note:: - - C/CXX should be enabled to use Intel mkl - +Input Variables +^^^^^^^^^^^^^^^ + +The following variables may be set to influence this module's behavior: + +``BLA_STATIC`` + if ``ON`` use static linkage + +``BLA_VENDOR`` + If set, checks only the specified vendor, if not set checks all the + possibilities. List of vendors valid in this module: + + * Goto + * OpenBLAS + * FLAME + * ATLAS PhiPACK + * CXML + * DXML + * SunPerf + * SCSL + * SGIMATH + * IBMESSL + * Intel10_32 (intel mkl v10 32 bit) + * Intel10_64lp (intel mkl v10+ 64 bit, threaded code, lp64 model) + * Intel10_64lp_seq (intel mkl v10+ 64 bit, sequential code, lp64 model) + * Intel10_64ilp (intel mkl v10+ 64 bit, threaded code, ilp64 model) + * Intel10_64ilp_seq (intel mkl v10+ 64 bit, sequential code, ilp64 model) + * Intel (obsolete versions of mkl 32 and 64 bit) + * ACML + * ACML_MP + * ACML_GPU + * Apple + * NAS + * Generic + +``BLA_F95`` + if ``ON`` tries to find the BLAS95 interfaces + +``BLA_PREFER_PKGCONFIG`` + if set pkg-config will be used to search for a BLAS library first + and if one is found that is preferred + +Result Variables +^^^^^^^^^^^^^^^^ + +This module defines the following variables: + +``BLAS_FOUND`` + library implementing the BLAS interface is found +``BLAS_LINKER_FLAGS`` + uncached list of required linker flags (excluding -l and -L). +``BLAS_LIBRARIES`` + uncached list of libraries (using full path name) to link against + to use BLAS (may be empty if compiler implicitly links BLAS) +``BLAS95_LIBRARIES`` + uncached list of libraries (using full path name) to link against + to use BLAS95 interface +``BLAS95_FOUND`` + library implementing the BLAS95 interface is found #]=======================================================================] include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake) diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake index dbd943b..69eed9a 100644 --- a/Modules/FindLAPACK.cmake +++ b/Modules/FindLAPACK.cmake @@ -14,35 +14,51 @@ The approach follows that taken for the autoconf macro file, acx_lapack.m4 (distributed at http://ac-archive.sourceforge.net/ac-archive/acx_lapack.html). -This module sets the following variables: - -:: - - LAPACK_FOUND - set to true if a library implementing the LAPACK interface - is found - LAPACK_LINKER_FLAGS - uncached list of required linker flags (excluding -l - and -L). - LAPACK_LIBRARIES - uncached list of libraries (using full path name) to - link against to use LAPACK - LAPACK95_LIBRARIES - uncached list of libraries (using full path name) to - link against to use LAPACK95 - LAPACK95_FOUND - set to true if a library implementing the LAPACK f95 - interface is found - BLA_STATIC if set on this determines what kind of linkage we do (static) - BLA_VENDOR if set checks only the specified vendor, if not set checks - all the possibilities - BLA_F95 if set on tries to find the f95 interfaces for BLAS/LAPACK - -List of vendors (BLA_VENDOR) valid in this module: - -* Intel(mkl) -* OpenBLAS -* FLAME -* ACML -* Apple -* NAS -* Generic - +Input Variables +^^^^^^^^^^^^^^^ + +The following variables may be set to influence this module's behavior: + +``BLA_STATIC`` + if ``ON`` use static linkage + +``BLA_VENDOR`` + If set, checks only the specified vendor, if not set checks all the + possibilities. List of vendors valid in this module: + + * ``Intel10_32`` (intel mkl v10 32 bit) + * ``Intel10_64lp`` (intel mkl v10+ 64 bit, threaded code, lp64 model) + * ``Intel10_64lp_seq`` (intel mkl v10+ 64 bit, sequential code, lp64 model) + * ``Intel10_64ilp`` (intel mkl v10+ 64 bit, threaded code, ilp64 model) + * ``Intel10_64ilp_seq`` (intel mkl v10+ 64 bit, sequential code, ilp64 model) + * ``Intel`` (obsolete versions of mkl 32 and 64 bit) + * ``OpenBLAS`` + * ``FLAME`` + * ``ACML`` + * ``Apple`` + * ``NAS`` + * ``Generic`` + +``BLA_F95`` + if ``ON`` tries to find BLAS95/LAPACK95 + +Result Variables +^^^^^^^^^^^^^^^^ + +This module defines the following variables: + +``LAPACK_FOUND`` + library implementing the LAPACK interface is found +``LAPACK_LINKER_FLAGS`` + uncached list of required linker flags (excluding -l and -L). +``LAPACK_LIBRARIES`` + uncached list of libraries (using full path name) to link against + to use LAPACK +``LAPACK95_LIBRARIES`` + uncached list of libraries (using full path name) to link against + to use LAPACK95 +``LAPACK95_FOUND`` + library implementing the LAPACK95 interface is found #]=======================================================================] set(_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9d20fe014f3b81fa7d7a3b7d203b58abe6fd5ce6 commit 9d20fe014f3b81fa7d7a3b7d203b58abe6fd5ce6 Author: Joachim Wuttke (o) AuthorDate: Wed Jan 30 16:11:16 2019 +0100 Commit: Joachim Wuttke (o) CommitDate: Wed Jan 30 16:13:13 2019 +0100 Help: moved 7 variables to "internal" section diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index a4bbdb3..0e4653d 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -102,7 +102,6 @@ Variables that Provide Information /variable/CMAKE_VERBOSE_MAKEFILE /variable/CMAKE_VERSION /variable/CMAKE_VS_DEVENV_COMMAND - /variable/CMAKE_VS_INTEL_Fortran_PROJECT_VERSION /variable/CMAKE_VS_MSBUILD_COMMAND /variable/CMAKE_VS_NsightTegra_VERSION /variable/CMAKE_VS_PLATFORM_NAME @@ -191,7 +190,6 @@ Variables that Change Behavior /variable/CMAKE_MFC_FLAG /variable/CMAKE_MAXIMUM_RECURSION_DEPTH /variable/CMAKE_MODULE_PATH - /variable/CMAKE_NOT_USING_CONFIG_FLAGS /variable/CMAKE_POLICY_DEFAULT_CMPNNNN /variable/CMAKE_POLICY_WARNING_CMPNNNN /variable/CMAKE_PREFIX_PATH @@ -450,7 +448,6 @@ Variables for Languages /variable/CMAKE_Fortran_MODDIR_DEFAULT /variable/CMAKE_Fortran_MODDIR_FLAG /variable/CMAKE_Fortran_MODOUT_FLAG - /variable/CMAKE_INTERNAL_PLATFORM_ABI /variable/CMAKE_LANG_ANDROID_TOOLCHAIN_MACHINE /variable/CMAKE_LANG_ANDROID_TOOLCHAIN_PREFIX /variable/CMAKE_LANG_ANDROID_TOOLCHAIN_SUFFIX @@ -458,15 +455,12 @@ Variables for Languages /variable/CMAKE_LANG_ARCHIVE_CREATE /variable/CMAKE_LANG_ARCHIVE_FINISH /variable/CMAKE_LANG_COMPILER - /variable/CMAKE_LANG_COMPILER_ABI - /variable/CMAKE_LANG_COMPILER_ARCHITECTURE_ID /variable/CMAKE_LANG_COMPILER_EXTERNAL_TOOLCHAIN /variable/CMAKE_LANG_COMPILER_ID /variable/CMAKE_LANG_COMPILER_LOADED /variable/CMAKE_LANG_COMPILER_PREDEFINES_COMMAND /variable/CMAKE_LANG_COMPILER_TARGET /variable/CMAKE_LANG_COMPILER_VERSION - /variable/CMAKE_LANG_COMPILER_VERSION_INTERNAL /variable/CMAKE_LANG_COMPILE_OBJECT /variable/CMAKE_LANG_CREATE_SHARED_LIBRARY /variable/CMAKE_LANG_CREATE_SHARED_MODULE @@ -495,7 +489,6 @@ Variables for Languages /variable/CMAKE_LANG_LINKER_WRAPPER_FLAG_SEP /variable/CMAKE_LANG_LINK_EXECUTABLE /variable/CMAKE_LANG_OUTPUT_EXTENSION - /variable/CMAKE_LANG_PLATFORM_ID /variable/CMAKE_LANG_SIMULATE_ID /variable/CMAKE_LANG_SIMULATE_VERSION /variable/CMAKE_LANG_SIZEOF_DATA_PTR @@ -620,3 +613,10 @@ are subject to change, and not recommended for use in project code. :maxdepth: 1 /variable/CMAKE_HOME_DIRECTORY + /variable/CMAKE_INTERNAL_PLATFORM_ABI + /variable/CMAKE_LANG_COMPILER_ABI + /variable/CMAKE_LANG_COMPILER_ARCHITECTURE_ID + /variable/CMAKE_LANG_COMPILER_VERSION_INTERNAL + /variable/CMAKE_LANG_PLATFORM_ID + /variable/CMAKE_NOT_USING_CONFIG_FLAGS + /variable/CMAKE_VS_INTEL_Fortran_PROJECT_VERSION https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dfb2d6178e68379683a012c7c9306b851c1350a6 commit dfb2d6178e68379683a012c7c9306b851c1350a6 Author: Joachim Wuttke (o) AuthorDate: Wed Jan 30 16:06:26 2019 +0100 Commit: Joachim Wuttke (o) CommitDate: Wed Jan 30 16:13:10 2019 +0100 Help: "internal variables" instead of "obsolete", with some explanatory prose diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 83a1ccd..a4bbdb3 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -608,9 +608,14 @@ Variable Expansion Operators /variable/CACHE /variable/ENV -Obsolete Variables +Internal Variables ================== +CMake has many internal variables. Most of them are undocumented. +Some of them, however, were at some point described as normal +variables, and therefore may be encountered in legacy code. They +are subject to change, and not recommended for use in project code. + .. toctree:: :maxdepth: 1 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ba30b94435bc621767fb887d081a257cdec8a633 commit ba30b94435bc621767fb887d081a257cdec8a633 Author: Michael Hirsch, Ph.D AuthorDate: Tue Jan 29 14:31:01 2019 -0500 Commit: Brad King CommitDate: Wed Jan 30 08:20:10 2019 -0500 FindLAPACK: Remove extra indentation from a line diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake index 7619664..dbd943b 100644 --- a/Modules/FindLAPACK.cmake +++ b/Modules/FindLAPACK.cmake @@ -113,7 +113,7 @@ foreach(_library ${_list}) set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) endif () else () - if (CMAKE_SYSTEM_NAME STREQUAL "Linux") + if (CMAKE_SYSTEM_NAME STREQUAL "Linux") # for ubuntu's libblas3gf and liblapack3gf packages set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf) endif () https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9c4cdc43f68c46984cbf7ce7d5f22aadcdde1a00 commit 9c4cdc43f68c46984cbf7ce7d5f22aadcdde1a00 Author: Joachim Wuttke (o) AuthorDate: Wed Jan 30 13:04:56 2019 +0100 Commit: Joachim Wuttke (o) CommitDate: Wed Jan 30 13:04:56 2019 +0100 Help: declare CMAKE_HOME_DIRECTORY obsolete diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index de4ce3d..83a1ccd 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -55,7 +55,6 @@ Variables that Provide Information /variable/CMAKE_GENERATOR_INSTANCE /variable/CMAKE_GENERATOR_PLATFORM /variable/CMAKE_GENERATOR_TOOLSET - /variable/CMAKE_HOME_DIRECTORY /variable/CMAKE_IMPORT_LIBRARY_PREFIX /variable/CMAKE_IMPORT_LIBRARY_SUFFIX /variable/CMAKE_JOB_POOL_COMPILE @@ -608,3 +607,11 @@ Variable Expansion Operators /variable/CACHE /variable/ENV + +Obsolete Variables +================== + +.. toctree:: + :maxdepth: 1 + + /variable/CMAKE_HOME_DIRECTORY diff --git a/Help/variable/CMAKE_HOME_DIRECTORY.rst b/Help/variable/CMAKE_HOME_DIRECTORY.rst index fdc5d81..b03d956 100644 --- a/Help/variable/CMAKE_HOME_DIRECTORY.rst +++ b/Help/variable/CMAKE_HOME_DIRECTORY.rst @@ -1,6 +1,9 @@ CMAKE_HOME_DIRECTORY -------------------- -Path to top of source tree. +Path to top of source tree. Same as :variable:`CMAKE_SOURCE_DIR`. -This is the path to the top level of the source tree. +This is an internal cache entry used to locate the source directory +when loading a ``CMakeCache.txt`` from a build tree. It should not +be used in project code. The variable :variable:`CMAKE_SOURCE_DIR` +has the same value and should be preferred. ----------------------------------------------------------------------- Summary of changes: CMakeLists.txt | 3 + Help/manual/cmake-variables.7.rst | 29 +++++--- Help/variable/CMAKE_HOME_DIRECTORY.rst | 7 +- Help/variable/MSYS.rst | 4 ++ Modules/FindBLAS.cmake | 118 ++++++++++++++++++--------------- Modules/FindLAPACK.cmake | 87 +++++++++++++++--------- Source/kwsys/CMakeLists.txt | 25 ++++--- Source/kwsys/kwsysPlatformTests.cmake | 5 ++ 8 files changed, 176 insertions(+), 102 deletions(-) create mode 100644 Help/variable/MSYS.rst hooks/post-receive -- CMake From kwrobot at kitware.com Thu Jan 31 11:23:04 2019 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 31 Jan 2019 11:23:04 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.13.3-1264-gd526327 Message-ID: <20190131162304.8DA13125224@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via d526327079e23748dd2a87acd4d9b4b1174725bf (commit) via 29368abde7d5b4d3d6f734aa530e82dd9f4ee739 (commit) via 1b46f2f12a368e6e4049b814d0b8499394fa442e (commit) via ca0310b919cb389618d480cbdc0124609051866a (commit) via a2dc420cd4946eb3b17fcdcc6c32dafc7c679ad5 (commit) via 0933707d5c8b18401834e0787157e2de68f98e51 (commit) via dc9f4f9eca3ee046bbb2f974ab9ae9af7ffc46cf (commit) via fb823855158855b6c967ef8dc7947762c097f914 (commit) via 20291e8e7293fd0ba0f5c66fe57388ee20381ccb (commit) via a624a3e1b3105e94ad30722e3053679a3b7d5b7e (commit) via f4f3b6b9af13366b16ce5a3be7af6c2b68c8be09 (commit) via 699cd032128afcda78e12a76b227faa6c1f6a258 (commit) via 1180fc87803b39cc03e503e4d08fa7d68656da8a (commit) via 3f9822ff6d2e38ef9aedc54d654e3afc635596fd (commit) via 198650ae7399cc086c49e58b0a9e03e9efb86235 (commit) via 8a7f93d000f1676d6051027b0608ca7658c8f00e (commit) via eff9c69740d5d4a26025a89f517a612e446077c0 (commit) via c68465f7908336a29c48539cb9ac0dcb32310abb (commit) via d6fbd438c4ca89a4e5e7eec612b142f8e86faa17 (commit) from 24bee427b5da710c5f9941f5cddb455df1a2ea82 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d526327079e23748dd2a87acd4d9b4b1174725bf commit d526327079e23748dd2a87acd4d9b4b1174725bf Merge: 29368ab a624a3e Author: Brad King AuthorDate: Thu Jan 31 16:19:33 2019 +0000 Commit: Kitware Robot CommitDate: Thu Jan 31 11:19:38 2019 -0500 Merge topic 'ninja-intel-depfile' a624a3e1b3 Ninja: Use deps=gcc for Intel Compiler on Windows f4f3b6b9af Ninja: Detect when ninja is new enough to support a multi-line depfile 699cd03212 Ninja: Drop unnecessary deptype customization infrastructure Acked-by: Kitware Robot Merge-request: !2893 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=29368abde7d5b4d3d6f734aa530e82dd9f4ee739 commit 29368abde7d5b4d3d6f734aa530e82dd9f4ee739 Merge: 1b46f2f 20291e8 Author: Brad King AuthorDate: Thu Jan 31 16:18:34 2019 +0000 Commit: Kitware Robot CommitDate: Thu Jan 31 11:18:40 2019 -0500 Merge topic 'install-strip-macos' 20291e8e72 install: Fix stripping on macOS Acked-by: Kitware Robot Merge-request: !2892 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1b46f2f12a368e6e4049b814d0b8499394fa442e commit 1b46f2f12a368e6e4049b814d0b8499394fa442e Merge: ca0310b 8a7f93d Author: Brad King AuthorDate: Thu Jan 31 16:17:35 2019 +0000 Commit: Kitware Robot CommitDate: Thu Jan 31 11:17:40 2019 -0500 Merge topic 'xcode-object-dir' 8a7f93d000 Xcode: Fix object library builds with sanitizers enabled eff9c69740 Xcode: Place object library artifacts outside Objects-normal directory Acked-by: Kitware Robot Merge-request: !2885 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ca0310b919cb389618d480cbdc0124609051866a commit ca0310b919cb389618d480cbdc0124609051866a Merge: a2dc420 198650a Author: Brad King AuthorDate: Thu Jan 31 16:15:34 2019 +0000 Commit: Kitware Robot CommitDate: Thu Jan 31 11:16:53 2019 -0500 Merge topic 'set-validate-cache-type' 198650ae73 set: warn if CACHE type is not recognized Acked-by: Kitware Robot Merge-request: !2874 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a2dc420cd4946eb3b17fcdcc6c32dafc7c679ad5 commit a2dc420cd4946eb3b17fcdcc6c32dafc7c679ad5 Merge: 0933707 c68465f Author: Brad King AuthorDate: Thu Jan 31 16:14:42 2019 +0000 Commit: Kitware Robot CommitDate: Thu Jan 31 11:16:04 2019 -0500 Merge topic 'xerces-xalan-header-checking' c68465f790 FindXercesC, FindXalanC: Don't examine non-existent version headers Acked-by: Kitware Robot Merge-request: !2884 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0933707d5c8b18401834e0787157e2de68f98e51 commit 0933707d5c8b18401834e0787157e2de68f98e51 Merge: dc9f4f9 d6fbd43 Author: Brad King AuthorDate: Thu Jan 31 16:14:30 2019 +0000 Commit: Kitware Robot CommitDate: Thu Jan 31 11:15:11 2019 -0500 Merge topic 'autogen-std-bind-to-lambdas' d6fbd438c4 Autogen: Refactor std::bind calls to lambdas Acked-by: Kitware Robot Merge-request: !2766 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dc9f4f9eca3ee046bbb2f974ab9ae9af7ffc46cf commit dc9f4f9eca3ee046bbb2f974ab9ae9af7ffc46cf Merge: fb82385 3f9822f Author: Brad King AuthorDate: Thu Jan 31 16:13:41 2019 +0000 Commit: Kitware Robot CommitDate: Thu Jan 31 11:14:21 2019 -0500 Merge topic 'tidy-use-equals-default-fix' 3f9822ff6d clang-tidy: Silence use-equals-default warning Acked-by: Kitware Robot Merge-request: !2887 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fb823855158855b6c967ef8dc7947762c097f914 commit fb823855158855b6c967ef8dc7947762c097f914 Merge: 24bee42 1180fc8 Author: Brad King AuthorDate: Thu Jan 31 16:13:27 2019 +0000 Commit: Kitware Robot CommitDate: Thu Jan 31 11:13:34 2019 -0500 Merge topic 'std-string-callback' 1180fc8780 OutputCallback: Accept std::string argument Acked-by: Kitware Robot Acked-by: vvs31415 Merge-request: !2891 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=20291e8e7293fd0ba0f5c66fe57388ee20381ccb commit 20291e8e7293fd0ba0f5c66fe57388ee20381ccb Author: Harry Mallon AuthorDate: Wed Jan 30 17:28:11 2019 +0000 Commit: Harry Mallon CommitDate: Wed Jan 30 22:00:16 2019 +0000 install: Fix stripping on macOS On macOS the `strip` tool requires special arguments depending on the type of binary to be stripped. Fixes: #11367 Fixes: #16499 diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 10df70b..2f59de8 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -765,10 +765,22 @@ void cmInstallTargetGenerator::AddStripRule(std::ostream& os, Indent indent, return; } + std::string stripArgs; + + // macOS 'strip' is picky, executables need '-u -r' and dylibs need '-x'. + if (this->Target->Target->GetMakefile()->IsOn("APPLE")) { + if (this->Target->GetType() == cmStateEnums::SHARED_LIBRARY || + this->Target->GetType() == cmStateEnums::MODULE_LIBRARY) { + stripArgs = "-x "; + } else if (this->Target->GetType() == cmStateEnums::EXECUTABLE) { + stripArgs = "-u -r "; + } + } + os << indent << "if(CMAKE_INSTALL_DO_STRIP)\n"; os << indent << " execute_process(COMMAND \"" << this->Target->Target->GetMakefile()->GetDefinition("CMAKE_STRIP") - << "\" \"" << toDestDirPath << "\")\n"; + << "\" " << stripArgs << "\"" << toDestDirPath << "\")\n"; os << indent << "endif()\n"; } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a624a3e1b3105e94ad30722e3053679a3b7d5b7e commit a624a3e1b3105e94ad30722e3053679a3b7d5b7e Author: Brad King AuthorDate: Wed Jan 30 14:25:56 2019 -0500 Commit: Brad King CommitDate: Wed Jan 30 14:59:23 2019 -0500 Ninja: Use deps=gcc for Intel Compiler on Windows Ninja 1.9 supports the depfile format generated by this compiler. Use `deps = gcc` when the version of Ninja is new enough. Unfortunately the Intel Compiler for Windows does not properly escape spaces in paths written to a depfile so if there is a space in the path we must still fall back to `deps = msvc`. Fixes: #18855 diff --git a/Modules/Platform/Windows-Intel-C.cmake b/Modules/Platform/Windows-Intel-C.cmake index 767fec5..06d8f50 100644 --- a/Modules/Platform/Windows-Intel-C.cmake +++ b/Modules/Platform/Windows-Intel-C.cmake @@ -1,2 +1,4 @@ include(Platform/Windows-Intel) __windows_compiler_intel(C) +set(CMAKE_NINJA_DEPTYPE_C intel) # special value handled by CMake +set(CMAKE_DEPFILE_FLAGS_C "-QMMD -QMT -QMF ") diff --git a/Modules/Platform/Windows-Intel-CXX.cmake b/Modules/Platform/Windows-Intel-CXX.cmake index 84cd303..666de6e 100644 --- a/Modules/Platform/Windows-Intel-CXX.cmake +++ b/Modules/Platform/Windows-Intel-CXX.cmake @@ -1,3 +1,5 @@ include(Platform/Windows-Intel) set(_COMPILE_CXX " /TP") __windows_compiler_intel(CXX) +set(CMAKE_NINJA_DEPTYPE_CXX intel) # special value handled by CMake +set(CMAKE_DEPFILE_FLAGS_CXX "-QMMD -QMT -QMF ") diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index c85a6f7..c29c657 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -173,8 +173,28 @@ void cmNinjaTargetGenerator::AddIncludeFlags(std::string& languageFlags, bool cmNinjaTargetGenerator::NeedDepTypeMSVC(const std::string& lang) const { - return (this->GetMakefile()->GetSafeDefinition("CMAKE_NINJA_DEPTYPE_" + - lang) == "msvc"); + std::string const& deptype = + this->GetMakefile()->GetSafeDefinition("CMAKE_NINJA_DEPTYPE_" + lang); + if (deptype == "msvc") { + return true; + } + if (deptype == "intel") { + // Ninja does not really define "intel", but we use it to switch based + // on whether this environment supports "gcc" or "msvc" deptype. + if (!this->GetGlobalGenerator()->SupportsMultilineDepfile()) { + // This ninja version is too old to support the Intel depfile format. + // Fall back to msvc deptype. + return true; + } + if ((this->Makefile->GetHomeDirectory().find(' ') != std::string::npos) || + (this->Makefile->GetHomeOutputDirectory().find(' ') != + std::string::npos)) { + // The Intel compiler does not properly escape spaces in a depfile. + // Fall back to msvc deptype. + return true; + } + } + return false; } // TODO: Refactor with https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f4f3b6b9af13366b16ce5a3be7af6c2b68c8be09 commit f4f3b6b9af13366b16ce5a3be7af6c2b68c8be09 Author: Brad King AuthorDate: Wed Jan 30 14:55:34 2019 -0500 Commit: Brad King CommitDate: Wed Jan 30 14:58:21 2019 -0500 Ninja: Detect when ninja is new enough to support a multi-line depfile Ninja 1.9 supports the multi-line depfile format generated by the Intel Compiler for Windows. Teach the global generator to detect when the version is new enough to support this. diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 4fd0673..6498024 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -454,6 +454,7 @@ cmGlobalNinjaGenerator::cmGlobalNinjaGenerator(cmake* cm) , NinjaSupportsConsolePool(false) , NinjaSupportsImplicitOuts(false) , NinjaSupportsManifestRestat(false) + , NinjaSupportsMultilineDepfile(false) , NinjaSupportsDyndeps(0) { #ifdef _WIN32 @@ -581,6 +582,9 @@ void cmGlobalNinjaGenerator::CheckNinjaFeatures() this->NinjaSupportsManifestRestat = !cmSystemTools::VersionCompare( cmSystemTools::OP_LESS, this->NinjaVersion.c_str(), RequiredNinjaVersionForManifestRestat().c_str()); + this->NinjaSupportsMultilineDepfile = !cmSystemTools::VersionCompare( + cmSystemTools::OP_LESS, this->NinjaVersion.c_str(), + RequiredNinjaVersionForMultilineDepfile().c_str()); { // Our ninja branch adds ".dyndep-#" to its version number, // where '#' is a feature-specific version number. Extract it. @@ -1478,6 +1482,11 @@ bool cmGlobalNinjaGenerator::SupportsManifestRestat() const return this->NinjaSupportsManifestRestat; } +bool cmGlobalNinjaGenerator::SupportsMultilineDepfile() const +{ + return this->NinjaSupportsMultilineDepfile; +} + void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os) { WriteRule(*this->RulesFileStream, "CLEAN", ninjaCmd() + " -t clean", diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index b3aa88f..c619e67 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -345,9 +345,14 @@ public: static std::string RequiredNinjaVersionForConsolePool() { return "1.5"; } static std::string RequiredNinjaVersionForImplicitOuts() { return "1.7"; } static std::string RequiredNinjaVersionForManifestRestat() { return "1.8"; } + static std::string RequiredNinjaVersionForMultilineDepfile() + { + return "1.9"; + } bool SupportsConsolePool() const; bool SupportsImplicitOuts() const; bool SupportsManifestRestat() const; + bool SupportsMultilineDepfile() const; std::string NinjaOutputPath(std::string const& path) const; bool HasOutputPathPrefix() const { return !this->OutputPathPrefix.empty(); } @@ -461,6 +466,7 @@ private: bool NinjaSupportsConsolePool; bool NinjaSupportsImplicitOuts; bool NinjaSupportsManifestRestat; + bool NinjaSupportsMultilineDepfile; unsigned long NinjaSupportsDyndeps; private: https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=699cd032128afcda78e12a76b227faa6c1f6a258 commit 699cd032128afcda78e12a76b227faa6c1f6a258 Author: Brad King AuthorDate: Wed Jan 30 14:54:09 2019 -0500 Commit: Brad King CommitDate: Wed Jan 30 14:54:35 2019 -0500 Ninja: Drop unnecessary deptype customization infrastructure Do not pass `CMAKE_NINJA_DEPTYPE_` in place of `deps = gcc`. If Ninja ever introduces a new dependency type we will likely need to update CMake for it anyway. diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index edb0ef3..c85a6f7 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -630,10 +630,6 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang) } } else { deptype = "gcc"; - const char* langdeptype = mf->GetDefinition("CMAKE_NINJA_DEPTYPE_" + lang); - if (langdeptype) { - deptype = langdeptype; - } depfile = "$DEP_FILE"; const std::string flagsName = "CMAKE_DEPFILE_FLAGS_" + lang; std::string depfileFlags = mf->GetSafeDefinition(flagsName); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1180fc87803b39cc03e503e4d08fa7d68656da8a commit 1180fc87803b39cc03e503e4d08fa7d68656da8a Author: Regina Pfeifer AuthorDate: Wed Jan 30 18:33:58 2019 +0100 Commit: Regina Pfeifer CommitDate: Wed Jan 30 18:33:58 2019 +0100 OutputCallback: Accept std::string argument diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index 38aa1b3..2fd4c7a 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -123,11 +123,8 @@ public: s += "\n"; }); - cmSystemTools::SetStdoutCallback( - [&s](const char* m, size_t len) { s.append(m, len); }); - - cmSystemTools::SetStderrCallback( - [&s](const char* m, size_t len) { s.append(m, len); }); + cmSystemTools::SetStdoutCallback([&s](std::string const& m) { s += m; }); + cmSystemTools::SetStderrCallback([&s](std::string const& m) { s += m; }); this->CM.SetProgressCallback([&s](const char* msg, float /*unused*/) { s += msg; diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index 065d610..a073c30 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -29,9 +29,9 @@ QCMake::QCMake(QObject* p) this->messageCallback(msg, title); }); cmSystemTools::SetStdoutCallback( - [this](const char* msg, size_t len) { this->stdoutCallback(msg, len); }); + [this](std::string const& msg) { this->stdoutCallback(msg); }); cmSystemTools::SetStderrCallback( - [this](const char* msg, size_t len) { this->stderrCallback(msg, len); }); + [this](std::string const& msg) { this->stderrCallback(msg); }); this->CMakeInstance = new cmake(cmake::RoleProject, cmState::Project); this->CMakeInstance->SetCMakeEditCommand( @@ -365,15 +365,15 @@ void QCMake::messageCallback(const char* msg, const char* /*title*/) QCoreApplication::processEvents(); } -void QCMake::stdoutCallback(const char* msg, size_t len) +void QCMake::stdoutCallback(std::string const& msg) { - emit this->outputMessage(QString::fromLocal8Bit(msg, int(len))); + emit this->outputMessage(QString::fromStdString(msg)); QCoreApplication::processEvents(); } -void QCMake::stderrCallback(const char* msg, size_t len) +void QCMake::stderrCallback(std::string const& msg) { - emit this->outputMessage(QString::fromLocal8Bit(msg, int(len))); + emit this->outputMessage(QString::fromStdString(msg)); QCoreApplication::processEvents(); } diff --git a/Source/QtDialog/QCMake.h b/Source/QtDialog/QCMake.h index 4f22505..ef4d2a1 100644 --- a/Source/QtDialog/QCMake.h +++ b/Source/QtDialog/QCMake.h @@ -170,8 +170,8 @@ protected: bool interruptCallback(); void progressCallback(const char* msg, float percent); void messageCallback(const char* msg, const char* title); - void stdoutCallback(const char* msg, size_t len); - void stderrCallback(const char* msg, size_t len); + void stdoutCallback(std::string const& msg); + void stderrCallback(std::string const& msg); bool WarnUninitializedMode; bool WarnUnusedMode; diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index a9cf0c6..5d8c079 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -308,7 +308,7 @@ void cmSystemTools::SetStderrCallback(OutputCallback f) void cmSystemTools::Stderr(const std::string& s) { if (s_StderrCallback) { - s_StderrCallback(s.c_str(), s.length()); + s_StderrCallback(s); } else { std::cerr << s << std::flush; } @@ -317,7 +317,7 @@ void cmSystemTools::Stderr(const std::string& s) void cmSystemTools::Stdout(const std::string& s) { if (s_StdoutCallback) { - s_StdoutCallback(s.c_str(), s.length()); + s_StdoutCallback(s); } else { std::cout << s << std::flush; } diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 990c932..f39da64 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -80,7 +80,7 @@ public: Message(m.c_str(), title); } - using OutputCallback = std::function; + using OutputCallback = std::function; ///! Send a string to stdout static void Stdout(const std::string& s); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3f9822ff6d2e38ef9aedc54d654e3afc635596fd commit 3f9822ff6d2e38ef9aedc54d654e3afc635596fd Author: Regina Pfeifer AuthorDate: Wed Jan 30 17:51:07 2019 +0100 Commit: Regina Pfeifer CommitDate: Wed Jan 30 17:51:07 2019 +0100 clang-tidy: Silence use-equals-default warning clang-tidy 7 has an option to suppress this warning in macros which defaults to '1'. Set the option to '0' and silence the warning explicitly. diff --git a/.clang-tidy b/.clang-tidy index dace6f1..a41ab64 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -34,4 +34,6 @@ HeaderFilterRegex: 'Source/cm[^/]*\.(h|hxx|cxx)$' CheckOptions: - key: modernize-use-default-member-init.UseAssignment value: '1' + - key: modernize-use-equals-default.IgnoreMacros + value: '0' ... diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index eb66ed5..aac188e 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -95,7 +95,7 @@ static const struct ZeroNode installInterfaceNode; #define BOOLEAN_OP_NODE(OPNAME, OP, SUCCESS_VALUE, FAILURE_VALUE) \ static const struct OP##Node : public cmGeneratorExpressionNode \ { \ - OP##Node() {} \ + OP##Node() {} /* NOLINT(modernize-use-equals-default) */ \ virtual int NumExpectedParameters() const { return OneOrMoreParameters; } \ \ std::string Evaluate(const std::vector& parameters, \ https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=198650ae7399cc086c49e58b0a9e03e9efb86235 commit 198650ae7399cc086c49e58b0a9e03e9efb86235 Author: Taylor Holberton AuthorDate: Mon Jan 28 21:06:38 2019 -0500 Commit: Brad King CommitDate: Wed Jan 30 10:47:24 2019 -0500 set: warn if CACHE type is not recognized diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx index 1a2d1c6..b09e3ca 100644 --- a/Source/cmSetCommand.cxx +++ b/Source/cmSetCommand.cxx @@ -4,6 +4,7 @@ #include "cmAlgorithms.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmState.h" #include "cmStateTypes.h" #include "cmSystemTools.h" @@ -112,7 +113,15 @@ bool cmSetCommand::InitialPass(std::vector const& args, if (cache) { std::string::size_type cacheStart = args.size() - 3 - (force ? 1 : 0); - type = cmState::StringToCacheEntryType(args[cacheStart + 1].c_str()); + if (!cmState::StringToCacheEntryType(args[cacheStart + 1].c_str(), type)) { + std::string m = "implicitly converting '" + args[cacheStart + 1] + + "' to 'STRING' type."; + this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, m); + // Setting this may not be required, since it's + // initialized as a string. Keeping this here to + // ensure that the type is actually converting to a string. + type = cmStateEnums::STRING; + } docstring = args[cacheStart + 2].c_str(); } diff --git a/Source/cmState.cxx b/Source/cmState.cxx index fdd7b3d..a08e9b8 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -75,14 +75,23 @@ const char* cmState::CacheEntryTypeToString(cmStateEnums::CacheEntryType type) cmStateEnums::CacheEntryType cmState::StringToCacheEntryType(const char* s) { + cmStateEnums::CacheEntryType type = cmStateEnums::STRING; + StringToCacheEntryType(s, type); + return type; +} + +bool cmState::StringToCacheEntryType(const char* s, + cmStateEnums::CacheEntryType& type) +{ int i = 0; while (cmCacheEntryTypes[i]) { if (strcmp(s, cmCacheEntryTypes[i]) == 0) { - return static_cast(i); + type = static_cast(i); + return true; } ++i; } - return cmStateEnums::STRING; + return false; } bool cmState::IsCacheEntryType(std::string const& key) diff --git a/Source/cmState.h b/Source/cmState.h index e447485..f755f83 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -65,6 +65,8 @@ public: cmStateSnapshot Pop(cmStateSnapshot const& originSnapshot); static cmStateEnums::CacheEntryType StringToCacheEntryType(const char*); + static bool StringToCacheEntryType(const char*, + cmStateEnums::CacheEntryType& type); static const char* CacheEntryTypeToString(cmStateEnums::CacheEntryType); static bool IsCacheEntryType(std::string const& key); diff --git a/Tests/RunCMake/set/RunCMakeTest.cmake b/Tests/RunCMake/set/RunCMakeTest.cmake index b8e8cf1..ea63d0b 100644 --- a/Tests/RunCMake/set/RunCMakeTest.cmake +++ b/Tests/RunCMake/set/RunCMakeTest.cmake @@ -3,3 +3,4 @@ include(RunCMake) run_cmake(ParentScope) run_cmake(ParentPulling) run_cmake(ParentPullingRecursive) +run_cmake(UnknownCacheType) diff --git a/Tests/RunCMake/set/UnknownCacheType-stderr.txt b/Tests/RunCMake/set/UnknownCacheType-stderr.txt new file mode 100644 index 0000000..6e1c811 --- /dev/null +++ b/Tests/RunCMake/set/UnknownCacheType-stderr.txt @@ -0,0 +1,5 @@ +CMake Warning \(dev\) at UnknownCacheType.cmake:1 \(set\): + implicitly converting 'unknown_type_sample' to 'STRING' type. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/set/UnknownCacheType.cmake b/Tests/RunCMake/set/UnknownCacheType.cmake new file mode 100644 index 0000000..f2b5d05 --- /dev/null +++ b/Tests/RunCMake/set/UnknownCacheType.cmake @@ -0,0 +1 @@ +set (sample_key sample_value CACHE unknown_type_sample "sample doc") https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8a7f93d000f1676d6051027b0608ca7658c8f00e commit 8a7f93d000f1676d6051027b0608ca7658c8f00e Author: Brad King AuthorDate: Wed Jan 30 09:42:02 2019 -0500 Commit: Brad King CommitDate: Wed Jan 30 10:28:40 2019 -0500 Xcode: Fix object library builds with sanitizers enabled Using `xcodebuild -enableAddressSanitizer YES ...` causes object files to be placed in a different directory name. Xcode provides a placeholder for this that we can use in `OTHER_LDFLAGS` to reference object files for linking the dependents of object libraries. However, CMake's features for installing and exporting object libraries depend on knowing the real path with no placeholders. For these cases, use the default object directory. Users will then have to choose between sanitizers and the installation and export features, but both will work individually. Fixes: #16289 diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 86f10dc..78040c3 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -3859,6 +3859,13 @@ std::string cmGeneratorTarget::GetObjectDirectory( // find and replace $(PROJECT_NAME) xcode placeholder const std::string projectName = this->LocalGenerator->GetProjectName(); cmSystemTools::ReplaceString(obj_dir, "$(PROJECT_NAME)", projectName); + // Replace Xcode's placeholder for the object file directory since + // installation and export scripts need to know the real directory. + // Xcode has build-time settings (e.g. for sanitizers) that affect this, + // but we use the default here. Users that want to enable sanitizers + // will do so at the cost of object library installation and export. + cmSystemTools::ReplaceString(obj_dir, "$(OBJECT_FILE_DIR_normal:base)", + "Objects-normal"); #endif return obj_dir; } diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index cc5ddb8..0bd0580 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -510,6 +510,7 @@ void cmGlobalXCodeGenerator::AddExtraTargets( makeHelper.push_back(dir); makeHelper.push_back("-f"); makeHelper.push_back(this->CurrentXCodeHackMakefile); + makeHelper.push_back("OBJDIR=$(OBJDIR)"); makeHelper.push_back(""); // placeholder, see below // Add ZERO_CHECK @@ -1662,6 +1663,7 @@ void cmGlobalXCodeGenerator::AddCommandsToBuildPhase( makecmd += cdir; makecmd += " -f "; makecmd += this->ConvertToRelativeForMake((makefile + "$CONFIGURATION")); + makecmd += " OBJDIR=$(basename \"$OBJECT_FILE_DIR_normal\")"; makecmd += " all"; buildphase->AddAttribute("shellScript", this->CreateString(makecmd)); buildphase->AddAttribute("showEnvVarsInLog", this->CreateString("0")); @@ -3359,7 +3361,7 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( // then remove those executables as well if (this->Architectures.size() > 1) { std::string universal = this->GetObjectsDirectory( - this->CurrentProject, configName, gt, "Objects-normal/"); + this->CurrentProject, configName, gt, "$(OBJDIR)/"); for (const auto& architecture : this->Architectures) { std::string universalFile = universal; universalFile += architecture; @@ -3763,8 +3765,8 @@ void cmGlobalXCodeGenerator::ComputeTargetObjectDirectory( cmGeneratorTarget* gt) const { std::string configName = this->GetCMakeCFGIntDir(); - std::string dir = this->GetObjectsDirectory("$(PROJECT_NAME)", configName, - gt, "Objects-normal/"); + std::string dir = this->GetObjectsDirectory( + "$(PROJECT_NAME)", configName, gt, "$(OBJECT_FILE_DIR_normal:base)/"); dir += this->ObjectDirArch; dir += "/"; gt->ObjectDirectory = dir; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=eff9c69740d5d4a26025a89f517a612e446077c0 commit eff9c69740d5d4a26025a89f517a612e446077c0 Author: Brad King AuthorDate: Wed Jan 30 09:33:35 2019 -0500 Commit: Brad King CommitDate: Wed Jan 30 10:28:05 2019 -0500 Xcode: Place object library artifacts outside Objects-normal directory The `CONFIGURATION_BUILD_DIR` value in the Xcode project file specifies where to place the library artifact. For object libraries we've used the `Objects-normal` directory to hide away the `.a` that we otherwise cannot stop Xcode from producing. The parent of this directory is also specific to the target and does not vary with Xcode's sanitizer features, so move the artifact there. Issue: #16289 diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 6d15b8c..cc5ddb8 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -485,6 +485,7 @@ std::string cmGlobalXCodeGenerator::PostBuildMakeTarget( } #define CMAKE_CHECK_BUILD_SYSTEM_TARGET "ZERO_CHECK" +#define OBJECT_LIBRARY_ARTIFACT_DIR std::string() void cmGlobalXCodeGenerator::AddExtraTargets( cmLocalGenerator* root, std::vector& gens) @@ -1968,8 +1969,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, pnbase = gtgt->GetName(); pnsuffix = ".a"; - std::string pncdir = - this->GetObjectsNormalDirectory(this->CurrentProject, configName, gtgt); + std::string pncdir = this->GetObjectsDirectory( + this->CurrentProject, configName, gtgt, OBJECT_LIBRARY_ARTIFACT_DIR); buildSettings->AddAttribute("CONFIGURATION_BUILD_DIR", this->CreateString(pncdir)); } @@ -3199,9 +3200,9 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects( return true; } -std::string cmGlobalXCodeGenerator::GetObjectsNormalDirectory( +std::string cmGlobalXCodeGenerator::GetObjectsDirectory( const std::string& projName, const std::string& configName, - const cmGeneratorTarget* t) const + const cmGeneratorTarget* t, const std::string& variant) const { std::string dir = t->GetLocalGenerator()->GetCurrentBinaryDirectory(); dir += "/"; @@ -3210,8 +3211,8 @@ std::string cmGlobalXCodeGenerator::GetObjectsNormalDirectory( dir += configName; dir += "/"; dir += t->GetName(); - dir += ".build/Objects-normal/"; - + dir += ".build/"; + dir += variant; return dir; } @@ -3338,8 +3339,9 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( for (auto objLib : objlibs) { const std::string objLibName = objLib->GetName(); - std::string d = this->GetObjectsNormalDirectory(this->CurrentProject, - configName, objLib); + std::string d = + this->GetObjectsDirectory(this->CurrentProject, configName, objLib, + OBJECT_LIBRARY_ARTIFACT_DIR); d += "lib"; d += objLibName; d += ".a"; @@ -3356,8 +3358,8 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( // if building for more than one architecture // then remove those executables as well if (this->Architectures.size() > 1) { - std::string universal = this->GetObjectsNormalDirectory( - this->CurrentProject, configName, gt); + std::string universal = this->GetObjectsDirectory( + this->CurrentProject, configName, gt, "Objects-normal/"); for (const auto& architecture : this->Architectures) { std::string universalFile = universal; universalFile += architecture; @@ -3761,8 +3763,8 @@ void cmGlobalXCodeGenerator::ComputeTargetObjectDirectory( cmGeneratorTarget* gt) const { std::string configName = this->GetCMakeCFGIntDir(); - std::string dir = - this->GetObjectsNormalDirectory("$(PROJECT_NAME)", configName, gt); + std::string dir = this->GetObjectsDirectory("$(PROJECT_NAME)", configName, + gt, "Objects-normal/"); dir += this->ObjectDirArch; dir += "/"; gt->ObjectDirectory = dir; diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 92ff258..e1e412d 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -264,9 +264,10 @@ private: { } - std::string GetObjectsNormalDirectory(const std::string& projName, - const std::string& configName, - const cmGeneratorTarget* t) const; + std::string GetObjectsDirectory(const std::string& projName, + const std::string& configName, + const cmGeneratorTarget* t, + const std::string& variant) const; static std::string GetDeploymentPlatform(const cmMakefile* mf); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c68465f7908336a29c48539cb9ac0dcb32310abb commit c68465f7908336a29c48539cb9ac0dcb32310abb Author: Roger Leigh AuthorDate: Wed Jan 30 14:20:06 2019 +0000 Commit: Roger Leigh CommitDate: Wed Jan 30 14:20:06 2019 +0000 FindXercesC, FindXalanC: Don't examine non-existent version headers diff --git a/Modules/FindXalanC.cmake b/Modules/FindXalanC.cmake index 0eba3d9..3adaa44 100644 --- a/Modules/FindXalanC.cmake +++ b/Modules/FindXalanC.cmake @@ -76,7 +76,7 @@ find_path(XalanC_INCLUDE_DIR DOC "Xalan-C++ include directory") mark_as_advanced(XalanC_INCLUDE_DIR) -if(XalanC_INCLUDE_DIR) +if(XalanC_INCLUDE_DIR AND EXISTS "${XalanC_INCLUDE_DIR}/xalanc/Include/XalanVersion.hpp") _XalanC_GET_VERSION("${XalanC_INCLUDE_DIR}/xalanc/Include/XalanVersion.hpp") endif() diff --git a/Modules/FindXercesC.cmake b/Modules/FindXercesC.cmake index 085fafc..47bfd62 100644 --- a/Modules/FindXercesC.cmake +++ b/Modules/FindXercesC.cmake @@ -74,7 +74,7 @@ find_path(XercesC_INCLUDE_DIR DOC "Xerces-C++ include directory") mark_as_advanced(XercesC_INCLUDE_DIR) -if(XercesC_INCLUDE_DIR) +if(XercesC_INCLUDE_DIR AND EXISTS "${XercesC_INCLUDE_DIR}/xercesc/util/XercesVersion.hpp") _XercesC_GET_VERSION("${XercesC_INCLUDE_DIR}/xercesc/util/XercesVersion.hpp") endif() https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d6fbd438c4ca89a4e5e7eec612b142f8e86faa17 commit d6fbd438c4ca89a4e5e7eec612b142f8e86faa17 Author: Artur Ryt AuthorDate: Tue Jan 29 20:51:12 2019 +0100 Commit: Artur Ryt CommitDate: Tue Jan 29 20:51:12 2019 +0100 Autogen: Refactor std::bind calls to lambdas diff --git a/Source/cmQtAutoGeneratorMocUic.cxx b/Source/cmQtAutoGeneratorMocUic.cxx index bc496ac..0ba5224 100644 --- a/Source/cmQtAutoGeneratorMocUic.cxx +++ b/Source/cmQtAutoGeneratorMocUic.cxx @@ -1111,8 +1111,7 @@ void cmQtAutoGeneratorMocUic::WorkerT::UVProcessStart(uv_async_t* handle) { std::lock_guard lock(wrk.ProcessMutex_); if (wrk.Process_ && !wrk.Process_->IsStarted()) { - wrk.Process_->start(handle->loop, - std::bind(&WorkerT::UVProcessFinished, &wrk)); + wrk.Process_->start(handle->loop, [&wrk] { wrk.UVProcessFinished(); }); } } } diff --git a/Source/cmQtAutoGeneratorRcc.cxx b/Source/cmQtAutoGeneratorRcc.cxx index 43ff172..021a15f 100644 --- a/Source/cmQtAutoGeneratorRcc.cxx +++ b/Source/cmQtAutoGeneratorRcc.cxx @@ -10,8 +10,6 @@ #include "cmSystemTools.h" #include "cmUVHandlePtr.h" -#include - // -- Class methods cmQtAutoGeneratorRcc::cmQtAutoGeneratorRcc() @@ -662,8 +660,7 @@ bool cmQtAutoGeneratorRcc::StartProcess( Process_ = cm::make_unique(); Process_->setup(&ProcessResult_, mergedOutput, command, workingDirectory); // Start process - if (!Process_->start(UVLoop(), - std::bind(&cm::uv_async_ptr::send, &UVRequest()))) { + if (!Process_->start(UVLoop(), [this] { UVRequest().send(); })) { Log().ErrorFile(GeneratorT::RCC, QrcFile_, ProcessResult_.ErrorMessage); Error_ = true; // Clean up ----------------------------------------------------------------------- Summary of changes: .clang-tidy | 2 ++ Modules/FindXalanC.cmake | 2 +- Modules/FindXercesC.cmake | 2 +- Modules/Platform/Windows-Intel-C.cmake | 2 ++ Modules/Platform/Windows-Intel-CXX.cmake | 2 ++ Source/CTest/cmCTestBuildAndTestHandler.cxx | 7 ++---- Source/QtDialog/QCMake.cxx | 12 +++++----- Source/QtDialog/QCMake.h | 4 ++-- Source/cmGeneratorExpressionNode.cxx | 2 +- Source/cmGeneratorTarget.cxx | 7 ++++++ Source/cmGlobalNinjaGenerator.cxx | 9 +++++++ Source/cmGlobalNinjaGenerator.h | 6 +++++ Source/cmGlobalXCodeGenerator.cxx | 28 ++++++++++++---------- Source/cmGlobalXCodeGenerator.h | 7 +++--- Source/cmInstallTargetGenerator.cxx | 14 ++++++++++- Source/cmNinjaTargetGenerator.cxx | 28 +++++++++++++++++----- Source/cmQtAutoGeneratorMocUic.cxx | 3 +-- Source/cmQtAutoGeneratorRcc.cxx | 5 +--- Source/cmSetCommand.cxx | 11 ++++++++- Source/cmState.cxx | 13 ++++++++-- Source/cmState.h | 2 ++ Source/cmSystemTools.cxx | 4 ++-- Source/cmSystemTools.h | 2 +- Tests/RunCMake/set/RunCMakeTest.cmake | 1 + .../UnknownCacheType-stderr.txt} | 4 ++-- Tests/RunCMake/set/UnknownCacheType.cmake | 1 + 26 files changed, 128 insertions(+), 52 deletions(-) copy Tests/RunCMake/{include/EmptyString-stderr.txt => set/UnknownCacheType-stderr.txt} (53%) create mode 100644 Tests/RunCMake/set/UnknownCacheType.cmake hooks/post-receive -- CMake