summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/command/find_package.rst2
-rw-r--r--Help/variable/CMAKE_CUDA_HOST_COMPILER.rst25
-rw-r--r--Modules/CMakeDetermineCUDACompiler.cmake4
-rw-r--r--Modules/CheckLanguage.cmake2
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmSetPropertyCommand.cxx16
-rw-r--r--Tests/Properties/CMakeLists.txt19
7 files changed, 58 insertions, 12 deletions
diff --git a/Help/command/find_package.rst b/Help/command/find_package.rst
index dcc0225..857de78 100644
--- a/Help/command/find_package.rst
+++ b/Help/command/find_package.rst
@@ -59,7 +59,7 @@ for finding the package, checking the version, and producing any needed
messages. Some find-modules provide limited or no support for versioning;
check the module documentation.
-If the ``MODULE`` option is not specfied in the above signature,
+If the ``MODULE`` option is not specified in the above signature,
CMake first searches for the package using Module mode. Then, if the
package is not found, it searches again using Config mode. A user
may set the variable :variable:`CMAKE_FIND_PACKAGE_PREFER_CONFIG` to
diff --git a/Help/variable/CMAKE_CUDA_HOST_COMPILER.rst b/Help/variable/CMAKE_CUDA_HOST_COMPILER.rst
index 34512b4..07342b5 100644
--- a/Help/variable/CMAKE_CUDA_HOST_COMPILER.rst
+++ b/Help/variable/CMAKE_CUDA_HOST_COMPILER.rst
@@ -3,8 +3,23 @@ CMAKE_CUDA_HOST_COMPILER
.. versionadded:: 3.10
-Executable to use when compiling host code when compiling ``CUDA`` language
-files. Maps to the ``nvcc -ccbin`` option. Will only be used by CMake on the first
-configuration to determine a valid host compiler for ``CUDA``. After a valid
-host compiler has been found, this value is read-only. This variable takes
-priority over the :envvar:`CUDAHOSTCXX` environment variable.
+When :variable:`CMAKE_CUDA_COMPILER <CMAKE_<LANG>_COMPILER>` is set to
+NVIDIA ``nvcc``, ``CMAKE_CUDA_HOST_COMPILER`` selects the compiler
+executable to use when compiling host code for ``CUDA`` language files.
+This maps to the ``nvcc -ccbin`` option.
+
+The ``CMAKE_CUDA_HOST_COMPILER`` variable may be set explicitly before CUDA is
+first enabled by a :command:`project` or :command:`enable_language` command.
+This can be done via ``-DCMAKE_CUDA_HOST_COMPILER=...`` on the command line
+or in a :ref:`toolchain file <Cross Compiling Toolchain>`. Or, one may set
+the :envvar:`CUDAHOSTCXX` environment variable to provide a default value.
+
+Once the CUDA language is enabled, the ``CMAKE_CUDA_HOST_COMPILER`` variable
+is read-only and changes to it are undefined behavior.
+
+.. note::
+
+ Since ``CMAKE_CUDA_HOST_COMPILER`` is meaningful only when the
+ ``CMAKE_CUDA_COMPILER`` is ``nvcc``, it does not make sense to
+ set ``CMAKE_CUDA_HOST_COMPILER`` explicitly without also setting
+ ``CMAKE_CUDA_COMPILER`` explicitly to be sure it is ``nvcc``.
diff --git a/Modules/CMakeDetermineCUDACompiler.cmake b/Modules/CMakeDetermineCUDACompiler.cmake
index 692ce20..fa497cd 100644
--- a/Modules/CMakeDetermineCUDACompiler.cmake
+++ b/Modules/CMakeDetermineCUDACompiler.cmake
@@ -188,7 +188,7 @@ if(NOT CMAKE_CUDA_COMPILER_ID_RUN)
if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
set(nvcc_test_flags "--keep --keep-dir tmp")
if(CMAKE_CUDA_HOST_COMPILER)
- string(APPEND nvcc_test_flags " -ccbin=${CMAKE_CUDA_HOST_COMPILER}")
+ string(APPEND nvcc_test_flags " -ccbin=\"${CMAKE_CUDA_HOST_COMPILER}\"")
endif()
elseif(CMAKE_CUDA_COMPILER_ID STREQUAL "Clang")
if(WIN32)
@@ -456,7 +456,7 @@ elseif(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
"Parsed CUDA nvcc implicit link information from above output:\n${_nvcc_log}\n${log}\n\n")
else()
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
- "Failed to parsed CUDA nvcc implicit link information:\n${_nvcc_log}\n\n")
+ "Failed to parse CUDA nvcc implicit link information:\n${_nvcc_log}\n\n")
message(FATAL_ERROR "Failed to extract nvcc implicit link line.")
endif()
endif()
diff --git a/Modules/CheckLanguage.cmake b/Modules/CheckLanguage.cmake
index d67d8d3..44387d4 100644
--- a/Modules/CheckLanguage.cmake
+++ b/Modules/CheckLanguage.cmake
@@ -20,7 +20,7 @@ test project. The result is cached in :variable:`CMAKE_<LANG>_COMPILER`
as the compiler that was found, or ``NOTFOUND`` if the language cannot be
enabled. For CUDA which can have an explicit host compiler, the cache
:variable:`CMAKE_CUDA_HOST_COMPILER` variable will be set if it was required
-for compilation.
+for compilation (and cleared if it was not).
Example:
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index b7dcd98..e3931ce 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,7 +1,7 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 18)
-set(CMake_VERSION_PATCH 20200714)
+set(CMake_VERSION_PATCH 20200715)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx
index 51509fd..6ca763b 100644
--- a/Source/cmSetPropertyCommand.cxx
+++ b/Source/cmSetPropertyCommand.cxx
@@ -4,6 +4,7 @@
#include <set>
#include <sstream>
+#include <unordered_set>
#include "cmExecutionStatus.h"
#include "cmGlobalGenerator.h"
@@ -82,6 +83,8 @@ bool HandleSourceFileDirectoryScopes(
std::vector<std::string>& source_file_target_directories,
std::vector<cmMakefile*>& directory_makefiles)
{
+ std::unordered_set<cmMakefile*> directory_makefiles_set;
+
cmMakefile* current_dir_mf = &status.GetMakefile();
if (!source_file_directories.empty()) {
for (const std::string& dir_path : source_file_directories) {
@@ -94,7 +97,11 @@ bool HandleSourceFileDirectoryScopes(
status.SetError(cmStrCat("given non-existent DIRECTORY ", dir_path));
return false;
}
- directory_makefiles.push_back(dir_mf);
+ if (directory_makefiles_set.find(dir_mf) ==
+ directory_makefiles_set.end()) {
+ directory_makefiles.push_back(dir_mf);
+ directory_makefiles_set.insert(dir_mf);
+ }
}
}
@@ -110,7 +117,12 @@ bool HandleSourceFileDirectoryScopes(
cmMakefile* target_dir_mf =
status.GetMakefile().GetGlobalGenerator()->FindMakefile(
*target_source_dir);
- directory_makefiles.push_back(target_dir_mf);
+
+ if (directory_makefiles_set.find(target_dir_mf) ==
+ directory_makefiles_set.end()) {
+ directory_makefiles.push_back(target_dir_mf);
+ directory_makefiles_set.insert(target_dir_mf);
+ }
}
}
diff --git a/Tests/Properties/CMakeLists.txt b/Tests/Properties/CMakeLists.txt
index 74d99fa..162a178 100644
--- a/Tests/Properties/CMakeLists.txt
+++ b/Tests/Properties/CMakeLists.txt
@@ -261,6 +261,25 @@ function(check_get_property_value expected)
endif()
endfunction()
+# Check that source file directory scopes are deduplicated.
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/src32.cpp"
+ DIRECTORY SubDir2 SubDir2 SubDir2
+ TARGET_DIRECTORY set_prop_lib_3 set_prop_lib_3 set_prop_lib_3
+ APPEND
+ PROPERTY NON_DUPLICATED_CUSTOM_PROP 1
+)
+
+get_property(actual
+ SOURCE "${CMAKE_CURRENT_BINARY_DIR}/src32.cpp"
+ DIRECTORY SubDir2
+ PROPERTY NON_DUPLICATED_CUSTOM_PROP)
+check_get_property_value("1")
+
+get_source_file_property(actual "${CMAKE_CURRENT_BINARY_DIR}/src32.cpp"
+ TARGET_DIRECTORY set_prop_lib_3
+ NON_DUPLICATED_CUSTOM_PROP)
+check_get_property_value("1")
+
# Get property + target directory
get_property(actual
SOURCE "${src_prefix}/src1.cpp"