diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-10-08 09:13:57 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-10-08 09:13:57 +0900 |
commit | 1fd56c03f6f5d75d53d86fa76ed27ac9afd78a04 (patch) | |
tree | ac6f47364c64c52e953ae6ca2b18cc9ec3a55d97 | |
parent | d59bf9db28c0f44bf4f61028963b4ef324d36c3b (diff) | |
download | cmake-1fd56c03f6f5d75d53d86fa76ed27ac9afd78a04.tar.gz cmake-1fd56c03f6f5d75d53d86fa76ed27ac9afd78a04.tar.bz2 cmake-1fd56c03f6f5d75d53d86fa76ed27ac9afd78a04.zip |
Imported Upstream version 3.14.5upstream/3.14.5
-rw-r--r-- | Help/release/3.14.rst | 8 | ||||
-rw-r--r-- | Modules/FindBoost.cmake | 10 | ||||
-rw-r--r-- | Modules/FindThreads.cmake | 3 | ||||
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 28 | ||||
-rw-r--r-- | Source/cmLocalGenerator.h | 2 | ||||
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 62 | ||||
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.h | 3 | ||||
-rw-r--r-- | Tests/CMakeLists.txt | 18 | ||||
-rw-r--r-- | Tests/IncludeDirectoriesCPATH/CMakeLists.txt | 22 | ||||
-rw-r--r-- | Tests/IncludeDirectoriesCPATH/consumer.cpp | 6 | ||||
-rw-r--r-- | Tests/IncludeDirectoriesCPATH/viacpath/systemlib.h | 15 | ||||
-rw-r--r-- | Tests/RunCMake/CTestCommandLine/show_only_json_check.pyc | bin | 1829 -> 1829 bytes | |||
-rw-r--r-- | Tests/RunCMake/FileAPI/check_index.pyc | bin | 8146 -> 8146 bytes | |||
-rw-r--r-- | Utilities/cmlibarchive/libarchive/archive_write_add_filter_b64encode.c | 10 |
15 files changed, 157 insertions, 32 deletions
diff --git a/Help/release/3.14.rst b/Help/release/3.14.rst index 8a251bd18..e3a7a62fb 100644 --- a/Help/release/3.14.rst +++ b/Help/release/3.14.rst @@ -412,3 +412,11 @@ Changes made since CMake 3.14.0 include the following. incorrectly propagate usage requirements of those dependencies to dependents that link the static library. This has been fixed. The bug also existed in 3.13.0 through 3.13.4 and is fixed in 3.13.5. + +3.14.5 +------ + +* Entries of the ``CPATH`` environment variable are no longer excluded + from explicit use via :command:`include_directories` and + :command:`target_include_directories` as they were in CMake 3.14.0 + through 3.14.4. diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 552c2fd6f..6a59dffc8 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -1075,6 +1075,16 @@ function(_Boost_COMPILER_FEATURES component _ret) # Compiler feature for `context` same as for `fiber`. set(_Boost_CONTEXT_COMPILER_FEATURES ${_Boost_FIBER_COMPILER_FEATURES}) endif() + + # Boost Contract library available in >= 1.67 + if(NOT Boost_VERSION_STRING VERSION_LESS 1.67.0) + # From `libs/contract/build/boost_contract_build.jam` + set(_Boost_CONTRACT_COMPILER_FEATURES + cxx_lambdas + cxx_variadic_templates + ) + endif() + string(TOUPPER ${component} uppercomponent) set(${_ret} ${_Boost_${uppercomponent}_COMPILER_FEATURES} PARENT_SCOPE) endfunction() diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake index 919392ab9..36b55c274 100644 --- a/Modules/FindThreads.cmake +++ b/Modules/FindThreads.cmake @@ -32,9 +32,6 @@ caller can set 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) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 34dcc7994..46a172250 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 14) -set(CMake_VERSION_PATCH 4) +set(CMake_VERSION_PATCH 5) #set(CMake_VERSION_RC 0) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 7e1523456..f6962d160 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -88,6 +88,19 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, cmMakefile* makefile) this->ComputeObjectMaxPath(); + // Canonicalize entries of the CPATH environment variable the same + // way detection of CMAKE_<LANG>_IMPLICIT_INCLUDE_DIRECTORIES does. + { + std::vector<std::string> cpath; + cmSystemTools::GetPath(cpath, "CPATH"); + for (std::string& cp : cpath) { + if (cmSystemTools::FileIsFullPath(cp)) { + cp = cmSystemTools::CollapseFullPath(cp); + this->EnvCPATH.emplace(std::move(cp)); + } + } + } + std::vector<std::string> enabledLanguages = this->GetState()->GetEnabledLanguages(); @@ -988,9 +1001,18 @@ std::vector<BT<std::string>> cmLocalGenerator::GetIncludeDirectoriesImplicit( } // Checks if this is not an excluded (implicit) include directory. - auto notExcluded = [&implicitSet, &implicitExclude](std::string const& dir) { - return ((implicitSet.find(dir) == implicitSet.end()) && - (implicitExclude.find(dir) == implicitExclude.end())); + auto notExcluded = [this, &implicitSet, &implicitExclude, + &lang](std::string const& dir) { + return ( + // Do not exclude directories that are not in an excluded set. + ((implicitSet.find(dir) == implicitSet.end()) && + (implicitExclude.find(dir) == implicitExclude.end())) + // Do not exclude entries of the CPATH environment variable even though + // they are implicitly searched by the compiler. They are meant to be + // user-specified directories that can be re-ordered or converted to + // -isystem without breaking real compiler builtin headers. + || ((lang == "C" || lang == "CXX") && + (this->EnvCPATH.find(dir) != this->EnvCPATH.end()))); }; // Get the target-specific include directories. diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index f9839f6c1..9521ec5b8 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -429,6 +429,8 @@ protected: std::string::size_type ObjectPathMax; std::set<std::string> ObjectMaxPathViolations; + std::set<std::string> EnvCPATH; + typedef std::unordered_map<std::string, cmGeneratorTarget*> GeneratorTargetMap; GeneratorTargetMap GeneratorTargetSearchIndex; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 7736e593b..f2f5e3f63 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -18,6 +18,7 @@ #include <iterator> #include <memory> // IWYU pragma: keep +#include <set> static void ConvertToWindowsSlash(std::string& s); @@ -1353,46 +1354,69 @@ void cmVisualStudio10TargetGenerator::WriteCustomRule( comment = cmVS10EscapeComment(comment); std::string script = lg->ConstructScript(ccg); // input files for custom command - std::stringstream inputs; - inputs << source->GetFullPath(); - for (std::string const& d : ccg.GetDepends()) { - std::string dep; - if (lg->GetRealDependency(d, c, dep)) { - ConvertToWindowsSlash(dep); - inputs << ";" << dep; + std::stringstream additional_inputs; + { + const char* sep = ""; + if (this->ProjectType == csproj) { + // csproj files do not attach the command to a specific file + // so the primary input must be listed explicitly. + additional_inputs << source->GetFullPath(); + sep = ";"; + } + + // Avoid listing an input more than once. + std::set<std::string> unique_inputs; + // The source is either implicit an input or has been added above. + unique_inputs.insert(source->GetFullPath()); + + for (std::string const& d : ccg.GetDepends()) { + std::string dep; + if (lg->GetRealDependency(d, c, dep)) { + if (!unique_inputs.insert(dep).second) { + // already listed + continue; + } + ConvertToWindowsSlash(dep); + additional_inputs << sep << dep; + sep = ";"; + } + } + if (this->ProjectType != csproj) { + additional_inputs << sep << "%(AdditionalInputs)"; } } // output files for custom command std::stringstream outputs; - const char* sep = ""; - for (std::string const& o : ccg.GetOutputs()) { - std::string out = o; - ConvertToWindowsSlash(out); - outputs << sep << out; - sep = ";"; + { + const char* sep = ""; + for (std::string const& o : ccg.GetOutputs()) { + std::string out = o; + ConvertToWindowsSlash(out); + outputs << sep << out; + sep = ";"; + } } if (this->ProjectType == csproj) { std::string name = "CustomCommand_" + c + "_" + cmSystemTools::ComputeStringMD5(sourcePath); - this->WriteCustomRuleCSharp(e0, c, name, script, inputs.str(), + this->WriteCustomRuleCSharp(e0, c, name, script, additional_inputs.str(), outputs.str(), comment); } else { - this->WriteCustomRuleCpp(*spe2, c, script, inputs.str(), outputs.str(), - comment); + this->WriteCustomRuleCpp(*spe2, c, script, additional_inputs.str(), + outputs.str(), comment); } } } void cmVisualStudio10TargetGenerator::WriteCustomRuleCpp( Elem& e2, std::string const& config, std::string const& script, - std::string const& inputs, std::string const& outputs, + std::string const& additional_inputs, std::string const& outputs, std::string const& comment) { const std::string cond = this->CalcCondition(config); e2.WritePlatformConfigTag("Message", cond, comment); e2.WritePlatformConfigTag("Command", cond, script); - e2.WritePlatformConfigTag("AdditionalInputs", cond, - inputs + ";%(AdditionalInputs)"); + e2.WritePlatformConfigTag("AdditionalInputs", cond, additional_inputs); e2.WritePlatformConfigTag("Outputs", cond, outputs); if (this->LocalGenerator->GetVersion() > cmGlobalVisualStudioGenerator::VS10) { diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index 590100496..68db332e1 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -135,7 +135,8 @@ private: void WriteCustomRule(Elem& e0, cmSourceFile const* source, cmCustomCommand const& command); void WriteCustomRuleCpp(Elem& e2, std::string const& config, - std::string const& script, std::string const& inputs, + std::string const& script, + std::string const& additional_inputs, std::string const& outputs, std::string const& comment); void WriteCustomRuleCSharp(Elem& e0, std::string const& config, diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 431a4921e..588c8e0d2 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -3620,6 +3620,24 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release --test-command IncludeDirectories) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/IncludeDirectories") + if(CMAKE_GENERATOR MATCHES "^((Unix|MSYS) Makefiles|Ninja)$" AND + ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.4) + OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") + OR (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang"))) + add_test(IncludeDirectoriesCPATH ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/IncludeDirectoriesCPATH" + "${CMake_BINARY_DIR}/Tests/IncludeDirectoriesCPATH" + --build-two-config + ${build_generator_args} + --build-project IncludeDirectoriesCPATH + --build-options ${build_options}) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/IncludeDirectoriesCPATH") + set_tests_properties(IncludeDirectoriesCPATH + PROPERTIES + ENVIRONMENT "CPATH=${CMAKE_CURRENT_SOURCE_DIR}/IncludeDirectoriesCPATH/viacpath") + endif() + add_test(InterfaceLinkLibraries ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/InterfaceLinkLibraries" diff --git a/Tests/IncludeDirectoriesCPATH/CMakeLists.txt b/Tests/IncludeDirectoriesCPATH/CMakeLists.txt new file mode 100644 index 000000000..31cbc3680 --- /dev/null +++ b/Tests/IncludeDirectoriesCPATH/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required (VERSION 3.14) +project(IncludeDirectoriesCPATH CXX) +message(STATUS "ENV{CPATH}: '$ENV{CPATH}'") +message(STATUS "CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES: '${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}'") + +include(CheckCXXCompilerFlag) +check_cxx_compiler_flag(-Wunused-variable run_sys_includes_test) +if(run_sys_includes_test) + # The Bullseye wrapper appears to break the -isystem effect. + execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version OUTPUT_VARIABLE out ERROR_VARIABLE out) + if("x${out}" MATCHES "Bullseye") + set(run_sys_includes_test 0) + endif() +endif() +if (NOT run_sys_includes_test) + return() +endif() + +add_library(consumer consumer.cpp) +add_library(consumer_system consumer.cpp) +target_compile_options(consumer_system PRIVATE -Werror=unused-variable) +target_include_directories(consumer_system SYSTEM PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/viacpath") diff --git a/Tests/IncludeDirectoriesCPATH/consumer.cpp b/Tests/IncludeDirectoriesCPATH/consumer.cpp new file mode 100644 index 000000000..59608dada --- /dev/null +++ b/Tests/IncludeDirectoriesCPATH/consumer.cpp @@ -0,0 +1,6 @@ +#include "systemlib.h" + +int consumer() +{ + return systemlib(); +} diff --git a/Tests/IncludeDirectoriesCPATH/viacpath/systemlib.h b/Tests/IncludeDirectoriesCPATH/viacpath/systemlib.h new file mode 100644 index 000000000..1aaafa9f4 --- /dev/null +++ b/Tests/IncludeDirectoriesCPATH/viacpath/systemlib.h @@ -0,0 +1,15 @@ +#ifndef SYSTEMLIB_H +#define SYSTEMLIB_H + +int systemlib() +{ + return 0; +} + +int unusedFunc() +{ + int unused; + return systemlib(); +} + +#endif diff --git a/Tests/RunCMake/CTestCommandLine/show_only_json_check.pyc b/Tests/RunCMake/CTestCommandLine/show_only_json_check.pyc Binary files differindex 532a609e6..da8cb1d92 100644 --- a/Tests/RunCMake/CTestCommandLine/show_only_json_check.pyc +++ b/Tests/RunCMake/CTestCommandLine/show_only_json_check.pyc diff --git a/Tests/RunCMake/FileAPI/check_index.pyc b/Tests/RunCMake/FileAPI/check_index.pyc Binary files differindex f88b57333..be8951f22 100644 --- a/Tests/RunCMake/FileAPI/check_index.pyc +++ b/Tests/RunCMake/FileAPI/check_index.pyc diff --git a/Utilities/cmlibarchive/libarchive/archive_write_add_filter_b64encode.c b/Utilities/cmlibarchive/libarchive/archive_write_add_filter_b64encode.c index 85eb087b0..b46b19a0c 100644 --- a/Utilities/cmlibarchive/libarchive/archive_write_add_filter_b64encode.c +++ b/Utilities/cmlibarchive/libarchive/archive_write_add_filter_b64encode.c @@ -60,7 +60,7 @@ static int archive_filter_b64encode_write(struct archive_write_filter *, const void *, size_t); static int archive_filter_b64encode_close(struct archive_write_filter *); static int archive_filter_b64encode_free(struct archive_write_filter *); -static void b64_encode(struct archive_string *, const unsigned char *, size_t); +static void la_b64_encode(struct archive_string *, const unsigned char *, size_t); static int64_t atol8(const char *, size_t); static const char base64[] = { @@ -180,7 +180,7 @@ archive_filter_b64encode_open(struct archive_write_filter *f) } static void -b64_encode(struct archive_string *as, const unsigned char *p, size_t len) +la_b64_encode(struct archive_string *as, const unsigned char *p, size_t len) { int c; @@ -234,12 +234,12 @@ archive_filter_b64encode_write(struct archive_write_filter *f, const void *buff, } if (state->hold_len < LBYTES) return (ret); - b64_encode(&state->encoded_buff, state->hold, LBYTES); + la_b64_encode(&state->encoded_buff, state->hold, LBYTES); state->hold_len = 0; } for (; length >= LBYTES; length -= LBYTES, p += LBYTES) - b64_encode(&state->encoded_buff, p, LBYTES); + la_b64_encode(&state->encoded_buff, p, LBYTES); /* Save remaining bytes. */ if (length > 0) { @@ -270,7 +270,7 @@ archive_filter_b64encode_close(struct archive_write_filter *f) /* Flush remaining bytes. */ if (state->hold_len != 0) - b64_encode(&state->encoded_buff, state->hold, state->hold_len); + la_b64_encode(&state->encoded_buff, state->hold, state->hold_len); archive_string_sprintf(&state->encoded_buff, "====\n"); /* Write the last block */ archive_write_set_bytes_in_last_block(f->archive, 1); |