diff --git a/Help/prop_dir/TESTS.rst b/Help/prop_dir/TESTS.rst index c6e1d883e..91acd3e7e 100644 --- a/Help/prop_dir/TESTS.rst +++ b/Help/prop_dir/TESTS.rst @@ -4,4 +4,4 @@ TESTS List of tests. This read-only property holds a :ref:`;-list ` of tests -defined so far by the :command:`add_test` command. +defined so far, in the current directory, by the :command:`add_test` command. diff --git a/Help/variable/CMAKE_ANDROID_STL_TYPE.rst b/Help/variable/CMAKE_ANDROID_STL_TYPE.rst index cfb76aa04..d174575c8 100644 --- a/Help/variable/CMAKE_ANDROID_STL_TYPE.rst +++ b/Help/variable/CMAKE_ANDROID_STL_TYPE.rst @@ -30,7 +30,8 @@ set to specify the STL variant to be used. The value may be one of: ``stlport_shared`` STLport Shared -The default value is ``gnustl_static``. Note that this default differs from +The default value is ``gnustl_static`` on NDK versions that provide it +and otherwise ``c++_static``. Note that this default differs from the native NDK build system because CMake may be used to build projects for Android that are not natively implemented for it and use the C++ standard library. diff --git a/Help/variable/CMAKE_LANG_CLANG_TIDY.rst b/Help/variable/CMAKE_LANG_CLANG_TIDY.rst index d1fccbb4d..bd49de369 100644 --- a/Help/variable/CMAKE_LANG_CLANG_TIDY.rst +++ b/Help/variable/CMAKE_LANG_CLANG_TIDY.rst @@ -9,5 +9,5 @@ created. For example: .. code-block:: cmake - set(CMAKE_CXX_CLANG_TIDY clang-tidy checks=-*,readability-*) + set(CMAKE_CXX_CLANG_TIDY clang-tidy -checks=-*,readability-*) add_executable(foo foo.cxx) diff --git a/Modules/CMakeCUDAInformation.cmake b/Modules/CMakeCUDAInformation.cmake index 8e62941c1..43ae989e0 100644 --- a/Modules/CMakeCUDAInformation.cmake +++ b/Modules/CMakeCUDAInformation.cmake @@ -185,7 +185,7 @@ if(__IMPLICT_DLINK_DIRS) endif() set(__IMPLICT_DLINK_FLAGS ) foreach(dir ${__IMPLICT_DLINK_DIRS}) - if(EXISTS "${dir}/libcublas_device.a") + if(EXISTS "${dir}/libcurand_static.a") string(APPEND __IMPLICT_DLINK_FLAGS " -L\"${dir}\"") endif() endforeach() diff --git a/Modules/CheckIPOSupported.cmake b/Modules/CheckIPOSupported.cmake index d8297d91c..3344834cd 100644 --- a/Modules/CheckIPOSupported.cmake +++ b/Modules/CheckIPOSupported.cmake @@ -56,13 +56,14 @@ include(CMakeParseArguments) # cmake_parse_arguments # X_RESULT - name of the final result variable # X_OUTPUT - name of the variable with information about error macro(_ipo_not_supported output) - string(COMPARE EQUAL "${X_RESULT}" "" is_empty) - if(is_empty) + if(NOT X_RESULT) message(FATAL_ERROR "IPO is not supported (${output}).") endif() set("${X_RESULT}" NO PARENT_SCOPE) - set("${X_OUTPUT}" "${output}" PARENT_SCOPE) + if(X_OUTPUT) + set("${X_OUTPUT}" "${output}" PARENT_SCOPE) + endif() endmacro() # Run IPO/LTO test @@ -125,7 +126,13 @@ macro(_ipo_run_language_check language) ) if(NOT result) - _ipo_not_supported("${output}") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "${language} compiler IPO check failed with the following output:\n" + "${output}\n") + _ipo_not_supported("check failed to compile") + if(X_OUTPUT) + set("${X_OUTPUT}" "${output}" PARENT_SCOPE) + endif() return() endif() endmacro() diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 4e5c45db5..d5e701170 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -881,7 +881,11 @@ function(_Boost_COMPONENT_HEADERS component _hdrs) set(_Boost_CHRONO_HEADERS "boost/chrono.hpp") set(_Boost_CONTAINER_HEADERS "boost/container/container_fwd.hpp") set(_Boost_CONTRACT_HEADERS "boost/contract.hpp") - set(_Boost_CONTEXT_HEADERS "boost/context/detail/fcontext.hpp") + if(Boost_VERSION VERSION_LESS 106100) + set(_Boost_CONTEXT_HEADERS "boost/context/all.hpp") + else() + set(_Boost_CONTEXT_HEADERS "boost/context/detail/fcontext.hpp") + endif() set(_Boost_COROUTINE_HEADERS "boost/coroutine/all.hpp") set(_Boost_DATE_TIME_HEADERS "boost/date_time/date.hpp") set(_Boost_EXCEPTION_HEADERS "boost/exception/exception.hpp") diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 21cace37f..1650e55a7 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -971,7 +971,8 @@ if(NOT CUDA_VERSION VERSION_LESS "3.2") find_cuda_helper_libs(nvcuvid) endif() endif() -if(CUDA_VERSION VERSION_GREATER "5.0") +if(CUDA_VERSION VERSION_GREATER "5.0" AND CUDA_VERSION VERSION_LESS "9.2") + # In CUDA 9.2 cublas_device was deprecated find_cuda_helper_libs(cublas_device) endif() diff --git a/Modules/FindDoxygen.cmake b/Modules/FindDoxygen.cmake index 945ee0ed1..2ed944980 100644 --- a/Modules/FindDoxygen.cmake +++ b/Modules/FindDoxygen.cmake @@ -370,6 +370,9 @@ Deprecated Hint Variables #]=======================================================================] +cmake_policy(PUSH) +cmake_policy(SET CMP0057 NEW) # if IN_LIST + # For backwards compatibility support if(Doxygen_FIND_QUIETLY) set(DOXYGEN_FIND_QUIETLY TRUE) @@ -1108,3 +1111,5 @@ doxygen_add_docs() for target ${targetName}") ) endfunction() + +cmake_policy(POP) diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake index 75c4441ca..bfcd87660 100644 --- a/Modules/FindMPI.cmake +++ b/Modules/FindMPI.cmake @@ -1680,7 +1680,7 @@ foreach(LANG IN ITEMS C CXX Fortran) set(MPI_${LANG}_INCLUDE_PATH "${MPI_${LANG}_INCLUDE_DIRS}") unset(MPI_${LANG}_COMPILE_FLAGS) if(MPI_${LANG}_COMPILE_OPTIONS) - set(MPI_${LANG}_COMPILE_FLAGS "${MPI_${LANG}_COMPILE_OPTIONS}") + list(JOIN MPI_${LANG}_COMPILE_FLAGS " " MPI_${LANG}_COMPILE_OPTIONS) endif() if(MPI_${LANG}_COMPILE_DEFINITIONS) foreach(_MPI_DEF IN LISTS MPI_${LANG}_COMPILE_DEFINITIONS) diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake index 54e62db74..2d04b84dd 100644 --- a/Modules/FindMatlab.cmake +++ b/Modules/FindMatlab.cmake @@ -1216,21 +1216,6 @@ function(_Matlab_find_instances_win32 matlab_roots) extract_matlab_versions_from_registry_brute_force(_matlab_versions_from_registry) endif() - # filtering the results with the registry keys - matlab_get_all_valid_matlab_roots_from_registry("${_matlab_versions_from_registry}" _matlab_possible_roots) - unset(_matlab_versions_from_registry) - - set(_matlab_versions_from_registry) - matlab_extract_all_installed_versions_from_registry(CMAKE_CL_64 _matlab_versions_from_registry) - - # the returned list is empty, doing the search on all known versions - if(NOT _matlab_versions_from_registry) - if(MATLAB_FIND_DEBUG) - message(STATUS "[MATLAB] Search for Matlab from the registry unsuccessful, testing all supported versions") - endif() - extract_matlab_versions_from_registry_brute_force(_matlab_versions_from_registry) - endif() - # filtering the results with the registry keys matlab_get_all_valid_matlab_roots_from_registry("${_matlab_versions_from_registry}" _matlab_possible_roots) set(${matlab_roots} ${_matlab_possible_roots} PARENT_SCOPE) diff --git a/Modules/Platform/Android-Common.cmake b/Modules/Platform/Android-Common.cmake index 80a8f410d..f8b934693 100644 --- a/Modules/Platform/Android-Common.cmake +++ b/Modules/Platform/Android-Common.cmake @@ -32,8 +32,10 @@ if(CMAKE_ANDROID_NDK) ) endif() unset(_ANDROID_STL_TYPE_FOUND) - else() + elseif(IS_DIRECTORY ${CMAKE_ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++) set(CMAKE_ANDROID_STL_TYPE "gnustl_static") + else() + set(CMAKE_ANDROID_STL_TYPE "c++_static") endif() unset(_ANDROID_STL_TYPES) diff --git a/Modules/Platform/Android/Determine-Compiler-NDK.cmake b/Modules/Platform/Android/Determine-Compiler-NDK.cmake index 064992514..5f2cc524e 100644 --- a/Modules/Platform/Android/Determine-Compiler-NDK.cmake +++ b/Modules/Platform/Android/Determine-Compiler-NDK.cmake @@ -35,7 +35,18 @@ elseif(CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION) endif() set(_ANDROID_TOOL_PATTERNS "*-${CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION}") else() - set(_ANDROID_TOOL_PATTERNS "*-[0-9].[0-9]") + # If we can find any gcc toolchains then use one by default. + # Otherwise we look for clang toolchains (e.g. NDK r18+). + file(GLOB _ANDROID_CONFIG_MKS_FOR_GCC + "${CMAKE_ANDROID_NDK}/build/core/toolchains/*-[0-9].[0-9]/config.mk" + "${CMAKE_ANDROID_NDK}/toolchains/*-[0-9].[0-9]/config.mk" + ) + if(_ANDROID_CONFIG_MKS_FOR_GCC) + set(_ANDROID_TOOL_PATTERNS "*-[0-9].[0-9]") + else() + set(_ANDROID_TOOL_PATTERNS "*-clang") + endif() + unset(_ANDROID_CONFIG_MKS_FOR_GCC) endif() set(_ANDROID_CONFIG_MK_PATTERNS) foreach(base "build/core/toolchains" "toolchains") diff --git a/Modules/Platform/Windows-NVIDIA-CUDA.cmake b/Modules/Platform/Windows-NVIDIA-CUDA.cmake index f1c1f2df1..ba1638f87 100644 --- a/Modules/Platform/Windows-NVIDIA-CUDA.cmake +++ b/Modules/Platform/Windows-NVIDIA-CUDA.cmake @@ -44,7 +44,7 @@ if(__IMPLICT_DLINK_DIRS) endif() set(__IMPLICT_DLINK_FLAGS ) foreach(dir ${__IMPLICT_DLINK_DIRS}) - if(EXISTS "${dir}/cublas_device.lib") + if(EXISTS "${dir}/curand_static.lib") string(APPEND __IMPLICT_DLINK_FLAGS " -L\"${dir}\"") endif() endforeach() diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index a1343ae19..4978bd6ca 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 12) -set(CMake_VERSION_PATCH 1) +set(CMake_VERSION_PATCH 3) #set(CMake_VERSION_RC 0) diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index dcef8a037..322da23d4 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -5,7 +5,6 @@ #include "cmAffinity.h" #include "cmCTest.h" #include "cmCTestRunTest.h" -#include "cmCTestScriptHandler.h" #include "cmCTestTestHandler.h" #include "cmSystemTools.h" #include "cmWorkingDirectory.h" @@ -53,6 +52,7 @@ cmCTestMultiProcessHandler::cmCTestMultiProcessHandler() { this->ParallelLevel = 1; this->TestLoad = 0; + this->FakeLoadForTesting = 0; this->Completed = 0; this->RunningCount = 0; this->ProcessorsAvailable = cmAffinity::GetProcessorsAvailable(); @@ -97,6 +97,16 @@ void cmCTestMultiProcessHandler::SetParallelLevel(size_t level) void cmCTestMultiProcessHandler::SetTestLoad(unsigned long load) { this->TestLoad = load; + + std::string fake_load_value; + if (cmSystemTools::GetEnv("__CTEST_FAKE_LOAD_AVERAGE_FOR_TESTING", + fake_load_value)) { + if (!cmSystemTools::StringToULong(fake_load_value.c_str(), + &this->FakeLoadForTesting)) { + cmSystemTools::Error("Failed to parse fake load value: ", + fake_load_value.c_str()); + } + } } void cmCTestMultiProcessHandler::RunTests() @@ -259,12 +269,19 @@ bool cmCTestMultiProcessHandler::StartTest(int test) void cmCTestMultiProcessHandler::StartNextTests() { - size_t numToStart = 0; + if (this->TestLoadRetryTimer.get() != nullptr) { + // This timer may be waiting to call StartNextTests again. + // Since we have been called it is no longer needed. + uv_timer_stop(this->TestLoadRetryTimer); + } if (this->Tests.empty()) { + this->TestLoadRetryTimer.reset(); return; } + size_t numToStart = 0; + if (this->RunningCount < this->ParallelLevel) { numToStart = this->ParallelLevel - this->RunningCount; } @@ -280,7 +297,6 @@ void cmCTestMultiProcessHandler::StartNextTests() } bool allTestsFailedTestLoadCheck = false; - bool usedFakeLoadForTesting = false; size_t minProcessorsRequired = this->ParallelLevel; std::string testWithMinProcessors; @@ -293,15 +309,11 @@ void cmCTestMultiProcessHandler::StartNextTests() allTestsFailedTestLoadCheck = true; // Check for a fake load average value used in testing. - std::string fake_load_value; - if (cmSystemTools::GetEnv("__CTEST_FAKE_LOAD_AVERAGE_FOR_TESTING", - fake_load_value)) { - usedFakeLoadForTesting = true; - if (!cmSystemTools::StringToULong(fake_load_value.c_str(), - &systemLoad)) { - cmSystemTools::Error("Failed to parse fake load value: ", - fake_load_value.c_str()); - } + if (this->FakeLoadForTesting > 0) { + systemLoad = this->FakeLoadForTesting; + // Drop the fake load for the next iteration to a value low enough + // that the next iteration will start tests. + this->FakeLoadForTesting = 1; } // If it's not set, look up the true load average. else { @@ -385,18 +397,25 @@ void cmCTestMultiProcessHandler::StartNextTests() } cmCTestLog(this->CTest, HANDLER_OUTPUT, "*****" << std::endl); - if (usedFakeLoadForTesting) { - // Break out of the infinite loop of waiting for our fake load - // to come down. - this->StopTimePassed = true; - } else { - // Wait between 1 and 5 seconds before trying again. - cmCTestScriptHandler::SleepInSeconds(cmSystemTools::RandomSeed() % 5 + - 1); + // Wait between 1 and 5 seconds before trying again. + unsigned int milliseconds = (cmSystemTools::RandomSeed() % 5 + 1) * 1000; + if (this->FakeLoadForTesting) { + milliseconds = 10; + } + if (this->TestLoadRetryTimer.get() == nullptr) { + this->TestLoadRetryTimer.init(this->Loop, this); } + this->TestLoadRetryTimer.start( + &cmCTestMultiProcessHandler::OnTestLoadRetryCB, milliseconds, 0); } } +void cmCTestMultiProcessHandler::OnTestLoadRetryCB(uv_timer_t* timer) +{ + auto self = static_cast(timer->data); + self->StartNextTests(); +} + void cmCTestMultiProcessHandler::FinishTestProcess(cmCTestRunTest* runner, bool started) { diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h index 203170e13..07a5fe78a 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.h +++ b/Source/CTest/cmCTestMultiProcessHandler.h @@ -12,6 +12,7 @@ #include #include +#include "cmUVHandlePtr.h" #include "cm_uv.h" class cmCTest; @@ -101,6 +102,8 @@ protected: void EraseTest(int index); void FinishTestProcess(cmCTestRunTest* runner, bool started); + static void OnTestLoadRetryCB(uv_timer_t* timer); + void RemoveTest(int index); // Check if we need to resume an interrupted test set void CheckResume(); @@ -135,7 +138,9 @@ protected: std::vector* TestResults; size_t ParallelLevel; // max number of process that can be run at once unsigned long TestLoad; + unsigned long FakeLoadForTesting; uv_loop_t Loop; + cm::uv_timer_ptr TestLoadRetryTimer; cmCTestTestHandler* TestHandler; cmCTest* CTest; bool HasCycles; diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index d0e668d4d..bcb754a94 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -478,11 +478,13 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command) tag.clear(); } std::string track; - if (cmSystemTools::GetLineFromStream(tfin, track)) { + if (cmSystemTools::GetLineFromStream(tfin, track) && + !this->Parts[PartStart] && !command) { this->SpecificTrack = track; } std::string model; - if (cmSystemTools::GetLineFromStream(tfin, model)) { + if (cmSystemTools::GetLineFromStream(tfin, model) && + !this->Parts[PartStart] && !command) { this->TestModel = GetTestModelFromString(model.c_str()); } tfin.close(); diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 5f615714b..9e6560fa9 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -1143,6 +1143,11 @@ bool cmExportFileGenerator::PopulateExportProperties( return false; } auto propertyValue = targetProperties.GetPropertyValue(prop); + if (propertyValue == nullptr) { + // Asked to export a property that isn't defined on the target. Do not + // consider this an error, there's just nothing to export. + continue; + } std::string evaluatedValue = cmGeneratorExpression::Preprocess( propertyValue, cmGeneratorExpression::StripAllGeneratorExpressions); if (evaluatedValue != propertyValue) { diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index b223c5eed..8aab1beef 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -5227,10 +5227,14 @@ bool cmGeneratorTarget::HasLanguage(std::string const& language, { std::set languages; this->GetLanguages(languages, config); + // The "exclusive" check applies only to source files and not + // the linker language which may be affected by dependencies. + if (exclusive && languages.size() > 1) { + return false; + } // add linker language (if it is different from compiler languages) languages.insert(this->GetLinkerLanguage(config)); - return (languages.size() == 1 || !exclusive) && - languages.count(language) > 0; + return languages.count(language) > 0; } void cmGeneratorTarget::ComputeLinkImplementationLanguages( diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 2132b15a0..281088767 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -366,7 +366,7 @@ public: // Evaluate if the target uses the given language for compilation // and/or linking. If 'exclusive' is true, 'language' is expected - // to be the only language used for the target. + // to be the only language used in source files for the target. bool HasLanguage(std::string const& language, std::string const& config, bool exclusive = true) const; diff --git a/Source/cmGlobVerificationManager.cxx b/Source/cmGlobVerificationManager.cxx index e23b6eaea..189b517a0 100644 --- a/Source/cmGlobVerificationManager.cxx +++ b/Source/cmGlobVerificationManager.cxx @@ -170,3 +170,10 @@ void cmGlobVerificationManager::AddCacheEntry( value.Backtraces.emplace_back(variable, backtrace); } } + +void cmGlobVerificationManager::Reset() +{ + this->Cache.clear(); + this->VerifyScript.clear(); + this->VerifyStamp.clear(); +} diff --git a/Source/cmGlobVerificationManager.h b/Source/cmGlobVerificationManager.h index 4508602fe..cf04c97c7 100644 --- a/Source/cmGlobVerificationManager.h +++ b/Source/cmGlobVerificationManager.h @@ -37,6 +37,9 @@ protected: const std::string& variable, const cmListFileBacktrace& bt); + ///! Clear the glob cache for state reset. + void Reset(); + ///! Check targets should be written in generated build system. bool DoWriteVerifyTarget() const; diff --git a/Source/cmState.cxx b/Source/cmState.cxx index a57be4db6..b2f609172 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -267,6 +267,7 @@ cmStateSnapshot cmState::Reset() { this->GlobalProperties.clear(); this->PropertyDefinitions.clear(); + this->GlobVerificationManager->Reset(); cmStateDetail::PositionType pos = this->SnapshotData.Truncate(); this->ExecutionListFiles.Truncate(); diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index eff915b47..b8b04ae0b 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1207,7 +1207,11 @@ void cmVisualStudio10TargetGenerator::WriteCustomCommands(Elem& e0) this->GeneratorTarget->GetName() != CMAKE_CHECK_BUILD_SYSTEM_TARGET) { if (cmSourceFile const* sf = this->LocalGenerator->CreateVCProjBuildRule()) { - this->WriteCustomCommand(e0, sf); + // Write directly rather than through WriteCustomCommand because + // we do not want the de-duplication and it has no dependencies. + if (cmCustomCommand const* command = sf->GetCustomCommand()) { + this->WriteCustomRule(e0, sf, *command); + } } } } @@ -2409,10 +2413,12 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( } // Choose a language whose flags to use for ClCompile. - static const char* clLangs[] = { "CXX", "C", "Fortran", "CSharp" }; + static const char* clLangs[] = { "CXX", "C", "Fortran" }; std::string langForClCompile; - if (std::find(cm::cbegin(clLangs), cm::cend(clLangs), linkLanguage) != - cm::cend(clLangs)) { + if (this->ProjectType == csproj) { + langForClCompile = "CSharp"; + } else if (std::find(cm::cbegin(clLangs), cm::cend(clLangs), linkLanguage) != + cm::cend(clLangs)) { langForClCompile = linkLanguage; } else { std::set languages; diff --git a/Tests/CSharpLinkToCxx/CMakeLists.txt b/Tests/CSharpLinkToCxx/CMakeLists.txt index 153c57c90..a3067afa2 100644 --- a/Tests/CSharpLinkToCxx/CMakeLists.txt +++ b/Tests/CSharpLinkToCxx/CMakeLists.txt @@ -21,3 +21,9 @@ target_link_libraries(CSharpLinkToCxx CLIApp) # because it is unmanaged add_library(CppNativeApp SHARED cpp_native.hpp cpp_native.cpp) target_link_libraries(CSharpLinkToCxx CppNativeApp) + +# Link a static C++ library into the CSharp executable. +# We do not actually use any symbols but this helps cover +# link language selection. +add_library(CppStaticLib STATIC cpp_static.cpp) +target_link_libraries(CSharpLinkToCxx CppStaticLib) diff --git a/Tests/CSharpLinkToCxx/cpp_static.cpp b/Tests/CSharpLinkToCxx/cpp_static.cpp new file mode 100644 index 000000000..9af2b6ea3 --- /dev/null +++ b/Tests/CSharpLinkToCxx/cpp_static.cpp @@ -0,0 +1,3 @@ +void cpp_static() +{ +} diff --git a/Tests/CudaOnly/LinkSystemDeviceLibraries/main.cu b/Tests/CudaOnly/LinkSystemDeviceLibraries/main.cu index 7eecec114..2c7c3887b 100644 --- a/Tests/CudaOnly/LinkSystemDeviceLibraries/main.cu +++ b/Tests/CudaOnly/LinkSystemDeviceLibraries/main.cu @@ -3,6 +3,9 @@ #include #include +// this test only makes sense for versions of CUDA that ships +// static libraries that have separable compilation device symbols +#if __CUDACC_VER_MAJOR__ <= 9 __global__ void deviceCublasSgemm(int n, float alpha, float beta, const float* d_A, const float* d_B, float* d_C) @@ -22,6 +25,7 @@ __global__ void deviceCublasSgemm(int n, float alpha, float beta, cublasDestroy(cnpHandle); } +#endif int choose_cuda_device() { @@ -63,6 +67,7 @@ int main(int argc, char** argv) return 0; } +#if __CUDACC_VER_MAJOR__ <= 9 // initial values that will make sure that the cublasSgemm won't actually // do any work int n = 0; @@ -72,6 +77,7 @@ int main(int argc, char** argv) float* d_B = nullptr; float* d_C = nullptr; deviceCublasSgemm<<<1, 1>>>(n, alpha, beta, d_A, d_B, d_C); +#endif return 0; } diff --git a/Tests/RunCMake/Android/RunCMakeTest.cmake b/Tests/RunCMake/Android/RunCMakeTest.cmake index 2027c4f91..45798ce59 100644 --- a/Tests/RunCMake/Android/RunCMakeTest.cmake +++ b/Tests/RunCMake/Android/RunCMakeTest.cmake @@ -61,8 +61,12 @@ foreach(ndk IN LISTS TEST_ANDROID_NDK) list(APPEND _abis_${_version} ${_abis}) endif() endforeach() - set(_abis_ ${_abis_${_latest_gcc}}) set(_abis_clang ${_abis_${_latest_clang}}) + if(_latest_gcc) + set(_abis_ ${_abis_${_latest_gcc}}) + else() + set(_abis_ ${_abis_clang}) + endif() if(_versions MATCHES "clang") set(_versions "clang" ${_versions}) endif() @@ -132,10 +136,11 @@ foreach(ndk IN LISTS TEST_ANDROID_NDK) set(stl_types none system - gnustl_static - gnustl_shared ) + if(IS_DIRECTORY "${ndk}/sources/cxx-stl/gnu-libstdc++") + list(APPEND stl_types gnustl_static gnustl_shared) + endif() if(IS_DIRECTORY "${ndk}/sources/cxx-stl/gabi++/libs") list(APPEND stl_types gabi++_static gabi++_shared) endif() diff --git a/Tests/RunCMake/Android/common.cmake b/Tests/RunCMake/Android/common.cmake index f931be1f8..aaa7c8919 100644 --- a/Tests/RunCMake/Android/common.cmake +++ b/Tests/RunCMake/Android/common.cmake @@ -8,7 +8,6 @@ endif() foreach(f "${CMAKE_C_ANDROID_TOOLCHAIN_PREFIX}gcc${CMAKE_C_ANDROID_TOOLCHAIN_SUFFIX}" "${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}g++${CMAKE_CXX_ANDROID_TOOLCHAIN_SUFFIX}" - "${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}cpp${CMAKE_CXX_ANDROID_TOOLCHAIN_SUFFIX}" "${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}ar${CMAKE_CXX_ANDROID_TOOLCHAIN_SUFFIX}" "${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}ld${CMAKE_CXX_ANDROID_TOOLCHAIN_SUFFIX}" ) @@ -61,10 +60,12 @@ execute_process( if(NOT _res EQUAL 0) message(SEND_ERROR "Failed to run 'gcc -dumpmachine':\n ${_res}") endif() -if(NOT _out STREQUAL "${CMAKE_C_ANDROID_TOOLCHAIN_MACHINE}") +string(REPLACE "--" "-" _out_check "${_out}") +if(NOT _out_check STREQUAL "${CMAKE_C_ANDROID_TOOLCHAIN_MACHINE}" + AND NOT (_out STREQUAL "arm--linux-android" AND CMAKE_C_ANDROID_TOOLCHAIN_MACHINE STREQUAL "arm-linux-androideabi")) message(SEND_ERROR "'gcc -dumpmachine' produced:\n" " ${_out}\n" - "which is not equal to CMAKE_C_ANDROID_TOOLCHAIN_MACHINE:\n" + "which does not match CMAKE_C_ANDROID_TOOLCHAIN_MACHINE:\n" " ${CMAKE_C_ANDROID_TOOLCHAIN_MACHINE}" ) endif() diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index 3033c9c39..9e8d050a5 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -111,8 +111,8 @@ endfunction() set(ENV{__CTEST_FAKE_LOAD_AVERAGE_FOR_TESTING} 5) # Verify that new tests are not started when the load average exceeds -# our threshold. -run_TestLoad(test-load-fail 2) +# our threshold and that they then run once the load average drops. +run_TestLoad(test-load-wait 3) # Verify that warning message is displayed but tests still start when # an invalid argument is given. diff --git a/Tests/RunCMake/CTestCommandLine/test-load-fail-stderr.txt b/Tests/RunCMake/CTestCommandLine/test-load-fail-stderr.txt deleted file mode 100644 index eafba1c69..000000000 --- a/Tests/RunCMake/CTestCommandLine/test-load-fail-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -No tests were found!!! diff --git a/Tests/RunCMake/CTestCommandLine/test-load-fail-stdout.txt b/Tests/RunCMake/CTestCommandLine/test-load-fail-stdout.txt deleted file mode 100644 index 153da09fb..000000000 --- a/Tests/RunCMake/CTestCommandLine/test-load-fail-stdout.txt +++ /dev/null @@ -1,2 +0,0 @@ -^Test project .*/Tests/RunCMake/CTestCommandLine/TestLoad -\*\*\*\*\* WAITING, System Load: 5, Max Allowed Load: 2, Smallest test TestLoad[1-2] requires 1\*\*\*\*\* diff --git a/Tests/RunCMake/CTestCommandLine/test-load-pass-stderr.txt b/Tests/RunCMake/CTestCommandLine/test-load-pass-stderr.txt deleted file mode 100644 index 10f32932e..000000000 --- a/Tests/RunCMake/CTestCommandLine/test-load-pass-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^$ diff --git a/Tests/RunCMake/CTestCommandLine/test-load-wait-stdout.txt b/Tests/RunCMake/CTestCommandLine/test-load-wait-stdout.txt new file mode 100644 index 000000000..11a768a9c --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/test-load-wait-stdout.txt @@ -0,0 +1,8 @@ +^Test project .*/Tests/RunCMake/CTestCommandLine/TestLoad +\*\*\*\*\* WAITING, System Load: 5, Max Allowed Load: 3, Smallest test TestLoad[1-2] requires 1\*\*\*\*\* + Start 1: TestLoad1 + Start 2: TestLoad2 +1/2 Test #[1-2]: TestLoad[1-2] ........................ Passed +[0-9.]+ sec +2/2 Test #[1-2]: TestLoad[1-2] ........................ Passed +[0-9.]+ sec ++ +100% tests passed, 0 tests failed out of 2 diff --git a/Tests/RunCMake/ctest_start/NoAppendDifferentTrack-stdout.txt b/Tests/RunCMake/ctest_start/NoAppendDifferentTrack-stdout.txt new file mode 100644 index 000000000..4a6f1e989 --- /dev/null +++ b/Tests/RunCMake/ctest_start/NoAppendDifferentTrack-stdout.txt @@ -0,0 +1,8 @@ +Run dashboard with model Experimental + Source directory: .*/Tests/RunCMake/ctest_start/NoAppendDifferentTrack + Build directory: .*/Tests/RunCMake/ctest_start/NoAppendDifferentTrack-build + Track: ExperimentalDifferent + Reading ctest configuration file: .*/Tests/RunCMake/ctest_start/NoAppendDifferentTrack/CTestConfig.cmake + Site: test-site + Build name: test-build-name + Use ExperimentalDifferent tag: [0-9-]+ diff --git a/Tests/RunCMake/ctest_start/RunCMakeTest.cmake b/Tests/RunCMake/ctest_start/RunCMakeTest.cmake index 2e8aa750b..9b57b1be6 100644 --- a/Tests/RunCMake/ctest_start/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_start/RunCMakeTest.cmake @@ -30,6 +30,7 @@ run_ctest_start(AppendSameModel Continuous APPEND) run_ctest_start(AppendDifferentModel Experimental APPEND) run_ctest_start(AppendNoModel APPEND) run_ctest_start(AppendDifferentTrack TRACK ExperimentalDifferent APPEND) +run_ctest_start(NoAppendDifferentTrack Experimental TRACK ExperimentalDifferent) run_ctest_start(AppendNoMatchingTrack Continuous APPEND) run_ctest_start(AppendOldContinuous Continuous APPEND) run_ctest_start(AppendOldNoModel APPEND) diff --git a/Tests/RunCMake/ctest_start/test.cmake.in b/Tests/RunCMake/ctest_start/test.cmake.in index 172baf710..8cd3cff5a 100644 --- a/Tests/RunCMake/ctest_start/test.cmake.in +++ b/Tests/RunCMake/ctest_start/test.cmake.in @@ -14,7 +14,7 @@ function(setup_tests) ctest_start(${ctest_start_args}) endfunction() -if("@CASE_NAME@" MATCHES "^Append") +if("@CASE_NAME@" MATCHES "^(No)?Append") if("@CASE_NAME@" MATCHES "^AppendNoMatchingTrack$") file(WRITE "${CTEST_BINARY_DIRECTORY}/Testing/TAG" "19551112-2204\nSomeWeirdTrackName\n") else() diff --git a/Tests/RunCMake/ctest_test/CTestTestLoadFail-result.txt b/Tests/RunCMake/ctest_test/CTestTestLoadFail-result.txt deleted file mode 100644 index b57e2deb7..000000000 --- a/Tests/RunCMake/ctest_test/CTestTestLoadFail-result.txt +++ /dev/null @@ -1 +0,0 @@ -(-1|255) diff --git a/Tests/RunCMake/ctest_test/CTestTestLoadFail-stderr.txt b/Tests/RunCMake/ctest_test/CTestTestLoadFail-stderr.txt deleted file mode 100644 index eafba1c69..000000000 --- a/Tests/RunCMake/ctest_test/CTestTestLoadFail-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -No tests were found!!! diff --git a/Tests/RunCMake/ctest_test/CTestTestLoadFail-stdout.txt b/Tests/RunCMake/ctest_test/CTestTestLoadFail-stdout.txt deleted file mode 100644 index e203c10c1..000000000 --- a/Tests/RunCMake/ctest_test/CTestTestLoadFail-stdout.txt +++ /dev/null @@ -1,2 +0,0 @@ -Test project .*/Tests/RunCMake/ctest_test/CTestTestLoadFail-build -\*\*\*\*\* WAITING, System Load: 5, Max Allowed Load: 4, Smallest test RunCMakeVersion requires 1\*\*\*\*\*$ diff --git a/Tests/RunCMake/ctest_test/CTestTestLoadWait-stdout.txt b/Tests/RunCMake/ctest_test/CTestTestLoadWait-stdout.txt new file mode 100644 index 000000000..2af3838ed --- /dev/null +++ b/Tests/RunCMake/ctest_test/CTestTestLoadWait-stdout.txt @@ -0,0 +1,8 @@ +Test project .*/Tests/RunCMake/ctest_test/CTestTestLoadWait-build +\*\*\*\*\* WAITING, System Load: 5, Max Allowed Load: 4, Smallest test RunCMakeVersion requires 1\*\*\*\*\* + Start 1: RunCMakeVersion +1/1 Test #1: RunCMakeVersion .................. Passed +[0-9.]+ sec ++ +100% tests passed, 0 tests failed out of 1 ++ +Total Test time \(real\) = +[0-9.]+ sec$ diff --git a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake index 1b3172676..6877e6a87 100644 --- a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake @@ -21,8 +21,8 @@ set(ENV{__CTEST_FAKE_LOAD_AVERAGE_FOR_TESTING} 5) run_ctest_test(TestLoadPass TEST_LOAD 6) # Verify that new tests are not started when the load average exceeds -# our threshold. -run_ctest_test(TestLoadFail TEST_LOAD 2) +# our threshold and that they then run once the load average drops. +run_ctest_test(TestLoadWait TEST_LOAD 2) # Verify that when an invalid "TEST_LOAD" value is given, a warning # message is displayed and the value is ignored. @@ -34,9 +34,9 @@ set(CASE_CTEST_TEST_LOAD 7) run_ctest_test(CTestTestLoadPass) # Verify that new tests are not started when the load average exceeds -# our threshold. +# our threshold and that they then run once the load average drops. set(CASE_CTEST_TEST_LOAD 4) -run_ctest_test(CTestTestLoadFail) +run_ctest_test(CTestTestLoadWait) # Verify that when an invalid "CTEST_TEST_LOAD" value is given, # a warning message is displayed and the value is ignored. diff --git a/Tests/RunCMake/ctest_test/TestLoadFail-result.txt b/Tests/RunCMake/ctest_test/TestLoadFail-result.txt deleted file mode 100644 index b57e2deb7..000000000 --- a/Tests/RunCMake/ctest_test/TestLoadFail-result.txt +++ /dev/null @@ -1 +0,0 @@ -(-1|255) diff --git a/Tests/RunCMake/ctest_test/TestLoadFail-stderr.txt b/Tests/RunCMake/ctest_test/TestLoadFail-stderr.txt deleted file mode 100644 index eafba1c69..000000000 --- a/Tests/RunCMake/ctest_test/TestLoadFail-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -No tests were found!!! diff --git a/Tests/RunCMake/ctest_test/TestLoadFail-stdout.txt b/Tests/RunCMake/ctest_test/TestLoadFail-stdout.txt deleted file mode 100644 index 4d7ce48a4..000000000 --- a/Tests/RunCMake/ctest_test/TestLoadFail-stdout.txt +++ /dev/null @@ -1,2 +0,0 @@ -Test project .*/Tests/RunCMake/ctest_test/TestLoadFail-build -\*\*\*\*\* WAITING, System Load: 5, Max Allowed Load: 2, Smallest test RunCMakeVersion requires 1\*\*\*\*\*$ diff --git a/Tests/RunCMake/ctest_test/TestLoadWait-stdout.txt b/Tests/RunCMake/ctest_test/TestLoadWait-stdout.txt new file mode 100644 index 000000000..07f4ed361 --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestLoadWait-stdout.txt @@ -0,0 +1,8 @@ +Test project .*/Tests/RunCMake/ctest_test/TestLoadWait-build +\*\*\*\*\* WAITING, System Load: 5, Max Allowed Load: 2, Smallest test RunCMakeVersion requires 1\*\*\*\*\* + Start 1: RunCMakeVersion +1/1 Test #1: RunCMakeVersion .................. Passed +[0-9.]+ sec ++ +100% tests passed, 0 tests failed out of 1 ++ +Total Test time \(real\) = +[0-9.]+ sec$ diff --git a/Tests/RunCMake/export/ExportPropertiesUndefined.cmake b/Tests/RunCMake/export/ExportPropertiesUndefined.cmake new file mode 100644 index 000000000..aa529f29a --- /dev/null +++ b/Tests/RunCMake/export/ExportPropertiesUndefined.cmake @@ -0,0 +1,11 @@ +enable_language(CXX) +add_library(foo empty.cpp) +set_target_properties(foo PROPERTIES + EXPORT_PROPERTIES "NotDefinedProp" +) +export(TARGETS foo FILE "${CMAKE_CURRENT_BINARY_DIR}/foo.cmake") +install(TARGETS foo EXPORT fooExport + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) diff --git a/Tests/RunCMake/export/RunCMakeTest.cmake b/Tests/RunCMake/export/RunCMakeTest.cmake index 10ced9006..46bb1fca3 100644 --- a/Tests/RunCMake/export/RunCMakeTest.cmake +++ b/Tests/RunCMake/export/RunCMakeTest.cmake @@ -8,3 +8,4 @@ run_cmake(NoExportSet) run_cmake(ForbiddenToExportInterfaceProperties) run_cmake(ForbiddenToExportImportedProperties) run_cmake(ForbiddenToExportPropertyWithGenExp) +run_cmake(ExportPropertiesUndefined) diff --git a/Utilities/cmlibarchive/libarchive/archive_openssl_hmac_private.h b/Utilities/cmlibarchive/libarchive/archive_openssl_hmac_private.h index 59f95b80a..921249bb9 100644 --- a/Utilities/cmlibarchive/libarchive/archive_openssl_hmac_private.h +++ b/Utilities/cmlibarchive/libarchive/archive_openssl_hmac_private.h @@ -28,7 +28,8 @@ #include #include -#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) +#if OPENSSL_VERSION_NUMBER < 0x10100000L || \ + (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20700000L) #include /* malloc, free */ #include /* memset */ static inline HMAC_CTX *HMAC_CTX_new(void) diff --git a/Utilities/cmlibuv/src/unix/fs.c b/Utilities/cmlibuv/src/unix/fs.c index 4545168f2..a6cc6dbd1 100644 --- a/Utilities/cmlibuv/src/unix/fs.c +++ b/Utilities/cmlibuv/src/unix/fs.c @@ -425,19 +425,22 @@ 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; } @@ -446,7 +449,28 @@ static ssize_t uv__fs_readlink(uv_fs_t* req) { ssize_t len; char* buf; +#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; + + /* 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); +#else len = uv__fs_pathmax_size(req->path); +#endif + buf = uv__malloc(len + 1); if (buf == NULL) { @@ -473,9 +497,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); @@ -488,6 +518,7 @@ static ssize_t uv__fs_realpath(uv_fs_t* req) { uv__free(buf); return -1; } +#endif req->ptr = buf;