diff options
author | Brad King <brad.king@kitware.com> | 2021-06-28 13:25:55 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2021-06-28 13:26:02 (GMT) |
commit | c8d2e81e095627d4155347252dda064b3dd972f6 (patch) | |
tree | 33795267024617b448b30df720d75ca438bb1e35 /Tests | |
parent | c6223262a38e5dd0629897e01b2d85d97e3acc3e (diff) | |
parent | a3cafa4237930d1ec1bcbdddc8a9c592e32458ca (diff) | |
download | CMake-c8d2e81e095627d4155347252dda064b3dd972f6.zip CMake-c8d2e81e095627d4155347252dda064b3dd972f6.tar.gz CMake-c8d2e81e095627d4155347252dda064b3dd972f6.tar.bz2 |
Merge topic 'target_compile_features-only-apply-to-enabled-languages'
a3cafa4237 compile_features: Ignore features that map to languages that aren't enabled
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6255
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/Cuda/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Tests/Cuda/ConsumeCompileFeatures/CMakeLists.txt | 16 | ||||
-rw-r--r-- | Tests/Cuda/ConsumeCompileFeatures/main.cu | 20 | ||||
-rw-r--r-- | Tests/Cuda/ConsumeCompileFeatures/static.cpp | 10 | ||||
-rw-r--r-- | Tests/Cuda/ConsumeCompileFeatures/static.cu | 9 | ||||
-rw-r--r-- | Tests/RunCMake/target_compile_features/cxx_not_enabled-stderr.txt | 6 |
6 files changed, 2 insertions, 60 deletions
diff --git a/Tests/Cuda/CMakeLists.txt b/Tests/Cuda/CMakeLists.txt index be5ccac..669c412 100644 --- a/Tests/Cuda/CMakeLists.txt +++ b/Tests/Cuda/CMakeLists.txt @@ -4,7 +4,6 @@ macro (add_cuda_test_macro name) PROPERTY LABELS "CUDA") endmacro () -add_cuda_test_macro(Cuda.ConsumeCompileFeatures CudaConsumeCompileFeatures) add_cuda_test_macro(Cuda.CXXStandardSetTwice CXXStandardSetTwice) add_cuda_test_macro(Cuda.ObjectLibrary CudaObjectLibrary) add_cuda_test_macro(Cuda.MixedStandardLevels1 MixedStandardLevels1) diff --git a/Tests/Cuda/ConsumeCompileFeatures/CMakeLists.txt b/Tests/Cuda/ConsumeCompileFeatures/CMakeLists.txt deleted file mode 100644 index b01b9d7..0000000 --- a/Tests/Cuda/ConsumeCompileFeatures/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -cmake_minimum_required(VERSION 3.18) -project(ConsumeCompileFeatures CXX CUDA) -#Goal for this example: - -#build a c++11 library that express a c++11 public compile feature -#link a cuda library and verify it builds with c++11 enabled - -#build a standalone c++/cuda mixed executable where we express a c++11 -#compile feature. - - -add_library(CudaConsumeLib STATIC static.cpp static.cu) -target_compile_features(CudaConsumeLib PUBLIC cxx_nullptr) - -add_executable(CudaConsumeCompileFeatures main.cu) -target_link_libraries(CudaConsumeCompileFeatures PRIVATE CudaConsumeLib) diff --git a/Tests/Cuda/ConsumeCompileFeatures/main.cu b/Tests/Cuda/ConsumeCompileFeatures/main.cu deleted file mode 100644 index bc32450..0000000 --- a/Tests/Cuda/ConsumeCompileFeatures/main.cu +++ /dev/null @@ -1,20 +0,0 @@ - -#include <iostream> - -int static_cxx11_func(int); - -void test_functions() -{ - auto x = static_cxx11_func(int(42)); - std::cout << x << std::endl; -} - -int main(int argc, char** argv) -{ - test_functions(); - std::cout - << "this executable doesn't use cuda code, just call methods defined" - << std::endl; - std::cout << "in libraries that have cuda code" << std::endl; - return 0; -} diff --git a/Tests/Cuda/ConsumeCompileFeatures/static.cpp b/Tests/Cuda/ConsumeCompileFeatures/static.cpp deleted file mode 100644 index 565d52e..0000000 --- a/Tests/Cuda/ConsumeCompileFeatures/static.cpp +++ /dev/null @@ -1,10 +0,0 @@ - - -#include <type_traits> - -int static_cuda11_func(int); - -int static_cxx11_func(int x) -{ - return static_cuda11_func(x) + std::integral_constant<int, 32>::value; -} diff --git a/Tests/Cuda/ConsumeCompileFeatures/static.cu b/Tests/Cuda/ConsumeCompileFeatures/static.cu deleted file mode 100644 index 73e43a8..0000000 --- a/Tests/Cuda/ConsumeCompileFeatures/static.cu +++ /dev/null @@ -1,9 +0,0 @@ - -#include <type_traits> - -using tt = std::true_type; -using ft = std::false_type; -int __host__ static_cuda11_func(int x) -{ - return x * x + std::integral_constant<int, 17>::value; -} diff --git a/Tests/RunCMake/target_compile_features/cxx_not_enabled-stderr.txt b/Tests/RunCMake/target_compile_features/cxx_not_enabled-stderr.txt index 5b4761c..cf4c540 100644 --- a/Tests/RunCMake/target_compile_features/cxx_not_enabled-stderr.txt +++ b/Tests/RunCMake/target_compile_features/cxx_not_enabled-stderr.txt @@ -1,4 +1,2 @@ -^CMake Error at cxx_not_enabled.cmake:[0-9]+ \(target_compile_features\): - target_compile_features cannot use features from non-enabled language CXX -Call Stack \(most recent call first\): - CMakeLists\.txt:[0-9]+ \(include\)$ +^CMake Error:.*CMake can not determine linker language for target: main.* +CMake Generate step failed. Build files cannot be regenerated correctly.$ |