diff options
Diffstat (limited to 'Tests')
6 files changed, 60 insertions, 0 deletions
diff --git a/Tests/CMakeOnly/CMakeLists.txt b/Tests/CMakeOnly/CMakeLists.txt index a41b44e..30cabf1 100644 --- a/Tests/CMakeOnly/CMakeLists.txt +++ b/Tests/CMakeOnly/CMakeLists.txt @@ -25,6 +25,13 @@ add_CMakeOnly_test(CheckCXXSymbolExists) add_CMakeOnly_test(CheckCXXCompilerFlag) add_CMakeOnly_test(CheckLanguage) +if (CMake_TEST_HIP) + set_property(TEST CMakeOnly.CheckLanguage APPEND PROPERTY LABELS "HIP") + add_CMakeOnly_test(CheckLanguageHIPPlatform) + set_property(TEST CMakeOnly.CheckLanguageHIPPlatform APPEND PROPERTY LABELS "HIP") + add_CMakeOnly_test(CheckLanguageHIPPlatform2) + set_property(TEST CMakeOnly.CheckLanguageHIPPlatform2 APPEND PROPERTY LABELS "HIP") +endif() add_CMakeOnly_test(CheckStructHasMember) diff --git a/Tests/CMakeOnly/CheckLanguageHIPPlatform/CMakeLists.txt b/Tests/CMakeOnly/CheckLanguageHIPPlatform/CMakeLists.txt new file mode 100644 index 0000000..03b8aa0 --- /dev/null +++ b/Tests/CMakeOnly/CheckLanguageHIPPlatform/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required (VERSION 3.28) +project(CheckLanguageHIPPlatform NONE) +include(CheckLanguage) + +check_language(HIP) + +if(NOT DEFINED CMAKE_HIP_COMPILER) + message(FATAL_ERROR "check_language did not set result") +endif() + +if (NOT CMAKE_HIP_COMPILER) + message(FATAL_ERROR "check_language should not fail!") +endif() + +if (NOT DEFINED CMAKE_HIP_PLATFORM) + message(FATAL_ERROR "check_language did not set CMAKE_HIP_PLATFORM!") +endif() diff --git a/Tests/CMakeOnly/CheckLanguageHIPPlatform2/CMakeLists.txt b/Tests/CMakeOnly/CheckLanguageHIPPlatform2/CMakeLists.txt new file mode 100644 index 0000000..f251c49 --- /dev/null +++ b/Tests/CMakeOnly/CheckLanguageHIPPlatform2/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required (VERSION 3.28) +project(CheckLanguageHIPPlatform2 NONE) +include(CheckLanguage) + +set(CMAKE_HIP_PLATFORM "not-a-hip-platform" CACHE STRING "") +check_language(HIP) + +if(NOT DEFINED CMAKE_HIP_COMPILER) + message(FATAL_ERROR "check_language did not set result") +endif() + +if (CMAKE_HIP_COMPILER) + message(FATAL_ERROR "check_language should have failed") +endif() diff --git a/Tests/RunCMake/BuildDepends/CustomCommandDepfile.cmake b/Tests/RunCMake/BuildDepends/CustomCommandDepfile.cmake index 19c09c8..c3725a4 100644 --- a/Tests/RunCMake/BuildDepends/CustomCommandDepfile.cmake +++ b/Tests/RunCMake/BuildDepends/CustomCommandDepfile.cmake @@ -24,6 +24,17 @@ add_library(toplib STATIC toplib.c) add_subdirectory(DepfileSubdir) +set(TEST_SPACE 1) +if(CMAKE_GENERATOR STREQUAL "Unix Makefiles") + execute_process(COMMAND "${CMAKE_MAKE_PROGRAM}" no_such_target --version RESULT_VARIABLE res OUTPUT_VARIABLE out ERROR_VARIABLE out) + if(NOT res EQUAL 0 OR NOT out MATCHES "GNU") + set(TEST_SPACE 0) + endif() +endif() +if(TEST_SPACE) + add_subdirectory(DepfileSubdirWithSpace) +endif() + add_custom_command( OUTPUT toplib2.c DEPFILE toplib2.c.d diff --git a/Tests/RunCMake/BuildDepends/DepfileSubdirWithSpace/CMakeLists.txt b/Tests/RunCMake/BuildDepends/DepfileSubdirWithSpace/CMakeLists.txt new file mode 100644 index 0000000..204f740 --- /dev/null +++ b/Tests/RunCMake/BuildDepends/DepfileSubdirWithSpace/CMakeLists.txt @@ -0,0 +1,2 @@ + +add_subdirectory("path with space") diff --git a/Tests/RunCMake/BuildDepends/DepfileSubdirWithSpace/path with space/CMakeLists.txt b/Tests/RunCMake/BuildDepends/DepfileSubdirWithSpace/path with space/CMakeLists.txt new file mode 100644 index 0000000..37c0a57 --- /dev/null +++ b/Tests/RunCMake/BuildDepends/DepfileSubdirWithSpace/path with space/CMakeLists.txt @@ -0,0 +1,9 @@ + +add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/dummy.txt" + COMMAND ${CMAKE_COMMAND} -E touch "${CMAKE_CURRENT_BINARY_DIR}/dummy.txt" + DEPFILE dummy.txt.d +) + +add_custom_target(subdir_space ALL + DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/dummy.txt" +) |