diff options
-rwxr-xr-x | .gitlab/ci/sccache.ps1 | 22 | ||||
-rw-r--r-- | Modules/CMakeDetermineCUDACompiler.cmake | 12 | ||||
-rw-r--r-- | Modules/CPackIFW.cmake | 2 | ||||
-rw-r--r-- | Modules/Compiler/Clang-CUDA.cmake | 3 | ||||
-rw-r--r-- | Modules/FindCUDAToolkit.cmake | 8 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 2 | ||||
-rw-r--r-- | Tests/RunCMake/VS10Project/VsPackageReferences-check.cmake | 22 | ||||
-rw-r--r-- | Tests/RunCMake/VS10Project/VsPackageReferences.cmake | 9 |
8 files changed, 50 insertions, 30 deletions
diff --git a/.gitlab/ci/sccache.ps1 b/.gitlab/ci/sccache.ps1 deleted file mode 100755 index 6231c72..0000000 --- a/.gitlab/ci/sccache.ps1 +++ /dev/null @@ -1,22 +0,0 @@ -$erroractionpreference = "stop" - -# 0.2.13 is unavailable right now. -# https://github.com/mozilla/sccache/issues/677 -$version = "0.2.12" -$sha256sum = "FD05E91C59B9497D4EBAE311B47A982F2A6EB942DCA3C9C314CC1FB36F8BC64D" -$filename = "sccache-$version-x86_64-pc-windows-msvc" -$tarball = "$filename.tar.gz" - -$outdir = $pwd.Path -$outdir = "$outdir\.gitlab" -Invoke-WebRequest -Uri "https://github.com/mozilla/sccache/releases/download/$version/$tarball" -OutFile "$outdir\$tarball" -$hash = Get-FileHash "$outdir\$tarball" -Algorithm SHA256 -if ($hash.Hash -ne $sha256sum) { - exit 1 -} - -$curdir = $pwd.Path -Set-Location -Path "$outdir" -cmake -E tar xzf "$outdir\$tarball" -Move-Item -Path "$outdir\$filename\sccache.exe" -Destination "$outdir\sccache.exe" -Set-Location -Path "$curdir" diff --git a/Modules/CMakeDetermineCUDACompiler.cmake b/Modules/CMakeDetermineCUDACompiler.cmake index 1601e83..5ae3908 100644 --- a/Modules/CMakeDetermineCUDACompiler.cmake +++ b/Modules/CMakeDetermineCUDACompiler.cmake @@ -89,6 +89,7 @@ if(NOT CMAKE_CUDA_COMPILER_ID_RUN) string(REGEX MATCH "[0-9]+" arch_name "${arch}") string(APPEND clang_archs " --cuda-gpu-arch=sm_${arch_name}") string(APPEND nvcc_archs " -gencode=arch=compute_${arch_name},code=sm_${arch_name}") + list(APPEND tested_architectures "${arch_name}") endforeach() list(APPEND CMAKE_CUDA_COMPILER_ID_TEST_FLAGS_FIRST "${clang_archs}") @@ -349,6 +350,8 @@ if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA") endif() endif() +# If the user didn't set the architectures, then set them to a default. +# If the user did, then make sure those architectures worked. if(DEFINED detected_architecture) set(CMAKE_CUDA_ARCHITECTURES "${detected_architecture}" CACHE STRING "CUDA architectures") @@ -357,10 +360,15 @@ if(DEFINED detected_architecture) endif() elseif(architectures) # Sort since order mustn't matter. - list(SORT CMAKE_CUDA_ARCHITECTURES) list(SORT architectures) + list(SORT tested_architectures) - if(NOT "${architectures}" STREQUAL "${CMAKE_CUDA_ARCHITECTURES}") + # We don't distinguish real/virtual architectures during testing. + # For "70-real;70-virtual" we detect "70" as working and tested_architectures is "70;70". + # Thus we need to remove duplicates before checking if they're equal. + list(REMOVE_DUPLICATES tested_architectures) + + if(NOT "${architectures}" STREQUAL "${tested_architectures}") message(FATAL_ERROR "The CMAKE_CUDA_ARCHITECTURES:\n" " ${CMAKE_CUDA_ARCHITECTURES}\n" diff --git a/Modules/CPackIFW.cmake b/Modules/CPackIFW.cmake index f58f9ef..9bf0049 100644 --- a/Modules/CPackIFW.cmake +++ b/Modules/CPackIFW.cmake @@ -59,7 +59,7 @@ The module defines the following commands: ``FORCED_INSTALLATION`` if set, then the component must always be installed. - It is a equivalent of the ``REQUARED`` option from the + It is a equivalent of the ``REQUIRED`` option from the :command:`cpack_add_component` command. ``REQUIRES_ADMIN_RIGHTS`` diff --git a/Modules/Compiler/Clang-CUDA.cmake b/Modules/Compiler/Clang-CUDA.cmake index a970985..336827b 100644 --- a/Modules/Compiler/Clang-CUDA.cmake +++ b/Modules/Compiler/Clang-CUDA.cmake @@ -1,6 +1,9 @@ include(Compiler/Clang) __compiler_clang(CUDA) +# Set explicitly, because __compiler_clang() doesn't set this if we're simulating MSVC. +set(CMAKE_DEPFILE_FLAGS_CUDA "-MD -MT <OBJECT> -MF <DEPFILE>") + # C++03 isn't supported for CXX, but is for CUDA, so we need to set these manually. # Do this before __compiler_clang_cxx_standards() since that adds the feature. set(CMAKE_CUDA03_STANDARD_COMPILE_OPTION "-std=c++03") diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake index b28892e..7d4e168 100644 --- a/Modules/FindCUDAToolkit.cmake +++ b/Modules/FindCUDAToolkit.cmake @@ -498,10 +498,6 @@ else() unset(NVCC_OUT) endif() -if(NOT CUDA_CUDART AND NOT CUDAToolkit_FIND_QUIETLY) - message(STATUS "Unable to find cudart library.") -endif() - # Find the CUDA Runtime Library libcudart find_library(CUDA_CUDART NAMES cudart @@ -514,6 +510,10 @@ if(NOT CUDA_CUDART) ) endif() +if(NOT CUDA_CUDART AND NOT CUDAToolkit_FIND_QUIETLY) + message(STATUS "Unable to find cudart library.") +endif() + unset(CUDAToolkit_ROOT_DIR) if(_CUDAToolkit_Pop_Prefix) list(REMOVE_AT CMAKE_PREFIX_PATH -1) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 4bb48fb..36e1ad5 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -533,7 +533,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, initProp("JOB_POOL_PRECOMPILE_HEADER"); } - if (impl->TargetType <= cmStateEnums::UTILITY) { + if (impl->TargetType <= cmStateEnums::GLOBAL_TARGET) { initProp("DOTNET_TARGET_FRAMEWORK"); initProp("DOTNET_TARGET_FRAMEWORK_VERSION"); } diff --git a/Tests/RunCMake/VS10Project/VsPackageReferences-check.cmake b/Tests/RunCMake/VS10Project/VsPackageReferences-check.cmake index 512a1c9..9c0f6e6 100644 --- a/Tests/RunCMake/VS10Project/VsPackageReferences-check.cmake +++ b/Tests/RunCMake/VS10Project/VsPackageReferences-check.cmake @@ -4,6 +4,12 @@ if(NOT EXISTS "${vcProjectFile}") return() endif() +set(installProjectFile "${RunCMake_TEST_BINARY_DIR}/INSTALL.vcxproj") +if(NOT EXISTS "${installProjectFile}") + set(RunCMake_TEST_FAILED "Install file INSTALL.vcxproj does not exist.") + return() +endif() + set(test1Library "boost") set(test1Version "1.7.0") @@ -37,3 +43,19 @@ if(NOT Library1Found OR NOT Library2Found) set(RunCMake_TEST_FAILED "Failed to find package references") return() endif() + +set(DOT_NET_FRAMEWORK_VERSION_FOUND FALSE) + +file(STRINGS "${installProjectFile}" installlines) +foreach(line IN LISTS lines) + if(line MATCHES "^ *<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>$") + set(DOT_NET_FRAMEWORK_VERSION_FOUND TRUE) + message(STATUS "The install target contains the correct TargetFrameworkVersion.") + break() + endif() +endforeach() + +if(NOT DOT_NET_FRAMEWORK_VERSION_FOUND) + set(RunCMake_TEST_FAILED "Failed to find TargetFrameworkVersion in the install target") + return() +endif() diff --git a/Tests/RunCMake/VS10Project/VsPackageReferences.cmake b/Tests/RunCMake/VS10Project/VsPackageReferences.cmake index 224ab18..30e8fd4 100644 --- a/Tests/RunCMake/VS10Project/VsPackageReferences.cmake +++ b/Tests/RunCMake/VS10Project/VsPackageReferences.cmake @@ -1,4 +1,13 @@ enable_language(CXX) +set(CMAKE_DOTNET_TARGET_FRAMEWORK_VERSION "v4.7.2") + add_library(foo foo.cpp) set_property(TARGET foo PROPERTY VS_PACKAGE_REFERENCES "boost_1.7.0;SFML_2.2.0") + +# install and export the targets to test the correct behavior +# nuget restore will only work with an install target when the correct +# target framework version is set +set(INSTALL_CMAKE_DIR CMake) +install(TARGETS foo EXPORT foo_Export_Target) +install(EXPORT foo_Export_Target DESTINATION ${INSTALL_CMAKE_DIR} FILE fooConfig.cmake) |