diff options
author | Brad King <brad.king@kitware.com> | 2017-11-20 14:45:52 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2017-11-20 14:45:58 (GMT) |
commit | 1da5a6ea39d77a13f0ef15aa2fc0e78b452cb4ef (patch) | |
tree | a421125819a0d854923fe00980de5d736822360b | |
parent | 967ba2e18055943faabf6eec39703bcad95a7551 (diff) | |
parent | 00e13993fde86d3674882aa9e63c46b4e1041462 (diff) | |
download | CMake-1da5a6ea39d77a13f0ef15aa2fc0e78b452cb4ef.zip CMake-1da5a6ea39d77a13f0ef15aa2fc0e78b452cb4ef.tar.gz CMake-1da5a6ea39d77a13f0ef15aa2fc0e78b452cb4ef.tar.bz2 |
Merge topic 'cuda-sep-comp-var'
00e13993 CUDA: Add CMAKE_CUDA_SEPARABLE_COMPILATION variable
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Alexander Korsunsky <a.korsunsky@gmail.com>
Merge-request: !1495
-rw-r--r-- | Help/manual/cmake-variables.7.rst | 1 | ||||
-rw-r--r-- | Help/prop_tgt/CUDA_SEPARABLE_COMPILATION.rst | 4 | ||||
-rw-r--r-- | Help/release/dev/cuda-sep-comp-var.rst | 6 | ||||
-rw-r--r-- | Help/variable/CMAKE_CUDA_SEPARABLE_COMPILATION.rst | 6 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 1 | ||||
-rw-r--r-- | Tests/CudaOnly/SeparateCompilation/CMakeLists.txt | 6 |
6 files changed, 24 insertions, 0 deletions
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 1927c37..0451466 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -290,6 +290,7 @@ Variables that Control the Build /variable/CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY /variable/CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG /variable/CMAKE_CONFIG_POSTFIX + /variable/CMAKE_CUDA_SEPARABLE_COMPILATION /variable/CMAKE_DEBUG_POSTFIX /variable/CMAKE_ENABLE_EXPORTS /variable/CMAKE_EXE_LINKER_FLAGS diff --git a/Help/prop_tgt/CUDA_SEPARABLE_COMPILATION.rst b/Help/prop_tgt/CUDA_SEPARABLE_COMPILATION.rst index 1c7dd80..d306d7f 100644 --- a/Help/prop_tgt/CUDA_SEPARABLE_COMPILATION.rst +++ b/Help/prop_tgt/CUDA_SEPARABLE_COMPILATION.rst @@ -11,3 +11,7 @@ For instance: .. code-block:: cmake set_property(TARGET myexe PROPERTY CUDA_SEPARABLE_COMPILATION ON) + +This property is initialized by the value of the +:variable:`CMAKE_CUDA_SEPARABLE_COMPILATION` variable if it is set when a +target is created. diff --git a/Help/release/dev/cuda-sep-comp-var.rst b/Help/release/dev/cuda-sep-comp-var.rst new file mode 100644 index 0000000..23536ef --- /dev/null +++ b/Help/release/dev/cuda-sep-comp-var.rst @@ -0,0 +1,6 @@ +cuda-sep-comp-var +----------------- + +* A :variable:`CMAKE_CUDA_SEPARABLE_COMPILATION` variable was added to + initialize the :prop_tgt:`CUDA_SEPARABLE_COMPILATION` target property + on targets when they are created. diff --git a/Help/variable/CMAKE_CUDA_SEPARABLE_COMPILATION.rst b/Help/variable/CMAKE_CUDA_SEPARABLE_COMPILATION.rst new file mode 100644 index 0000000..eef92fb --- /dev/null +++ b/Help/variable/CMAKE_CUDA_SEPARABLE_COMPILATION.rst @@ -0,0 +1,6 @@ +CMAKE_CUDA_SEPARABLE_COMPILATION +-------------------------------- + +Default value for :prop_tgt:`CUDA_SEPARABLE_COMPILATION` target property. +This variable is used to initialize the property on each target as it is +created. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 9cf835c..bf36074 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -279,6 +279,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, this->SetPropertyDefault("CUDA_STANDARD_REQUIRED", nullptr); this->SetPropertyDefault("CUDA_EXTENSIONS", nullptr); this->SetPropertyDefault("CUDA_COMPILER_LAUNCHER", nullptr); + this->SetPropertyDefault("CUDA_SEPARABLE_COMPILATION", nullptr); this->SetPropertyDefault("LINK_SEARCH_START_STATIC", nullptr); this->SetPropertyDefault("LINK_SEARCH_END_STATIC", nullptr); } diff --git a/Tests/CudaOnly/SeparateCompilation/CMakeLists.txt b/Tests/CudaOnly/SeparateCompilation/CMakeLists.txt index 7ef626f..cfca823 100644 --- a/Tests/CudaOnly/SeparateCompilation/CMakeLists.txt +++ b/Tests/CudaOnly/SeparateCompilation/CMakeLists.txt @@ -13,7 +13,13 @@ string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=compute_30") set(CMAKE_CXX_STANDARD 11) set(CMAKE_CUDA_STANDARD 11) +set(CMAKE_CUDA_SEPARABLE_COMPILATION ON) add_library(CUDASeparateLibA STATIC file1.cu file2.cu file3.cu) +get_property(sep_comp TARGET CUDASeparateLibA PROPERTY CUDA_SEPARABLE_COMPILATION) +if(NOT sep_comp) + message(FATAL_ERROR "CUDA_SEPARABLE_COMPILATION not initialized") +endif() +unset(CMAKE_CUDA_SEPARABLE_COMPILATION) if(CMAKE_CUDA_SIMULATE_ID STREQUAL "MSVC") # Test adding a flag that is not in our CUDA flag table for VS. |