diff options
Diffstat (limited to 'Tests/RunCMake')
24 files changed, 116 insertions, 35 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 428bbff..6c5ab7f 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -298,7 +298,16 @@ add_RunCMake_test(CompilerNotFound) if (APPLE AND CMAKE_C_COMPILER_ID MATCHES "Clang|GNU") list(APPEND CompilerTest_ARGS -DCMake_TEST_OBJC=1) endif() +if(CMAKE_Fortran_COMPILER) + list(APPEND CompilerTest_ARGS -DCMake_TEST_Fortran=1) +endif() +foreach(lang IN ITEMS CUDA HIP ISPC) + if(CMake_TEST_${lang}) + list(APPEND CompilerTest_ARGS -DCMake_TEST_${lang}=1) + endif() +endforeach() add_RunCMake_test(CompilerTest) +set_property(TEST RunCMake.CompilerTest APPEND PROPERTY LABELS "CUDA" "HIP" "ISPC") add_RunCMake_test(Configure -DMSVC_IDE=${MSVC_IDE}) add_RunCMake_test(DisallowedCommands) if("${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja") diff --git a/Tests/RunCMake/CompilerTest/CUDA-stdout.txt b/Tests/RunCMake/CompilerTest/CUDA-stdout.txt new file mode 100644 index 0000000..00d35df --- /dev/null +++ b/Tests/RunCMake/CompilerTest/CUDA-stdout.txt @@ -0,0 +1,2 @@ +-- Check for working CUDA compiler: [^ +]* - works diff --git a/Tests/RunCMake/CompilerTest/CUDA.cmake b/Tests/RunCMake/CompilerTest/CUDA.cmake new file mode 100644 index 0000000..e8c19a0 --- /dev/null +++ b/Tests/RunCMake/CompilerTest/CUDA.cmake @@ -0,0 +1,3 @@ +# Pretend the ABI check failed in order to force the fall-back test to run. +set(CMAKE_CUDA_ABI_COMPILED FALSE) +enable_language(CUDA) diff --git a/Tests/RunCMake/CompilerTest/Fortran-stdout.txt b/Tests/RunCMake/CompilerTest/Fortran-stdout.txt new file mode 100644 index 0000000..d871fea --- /dev/null +++ b/Tests/RunCMake/CompilerTest/Fortran-stdout.txt @@ -0,0 +1,2 @@ +-- Check for working Fortran compiler: [^ +]* - works diff --git a/Tests/RunCMake/CompilerTest/Fortran.cmake b/Tests/RunCMake/CompilerTest/Fortran.cmake new file mode 100644 index 0000000..8c83bd7 --- /dev/null +++ b/Tests/RunCMake/CompilerTest/Fortran.cmake @@ -0,0 +1,3 @@ +# Pretend the ABI check failed in order to force the fall-back test to run. +set(CMAKE_Fortran_ABI_COMPILED FALSE) +enable_language(Fortran) diff --git a/Tests/RunCMake/CompilerTest/HIP-stdout.txt b/Tests/RunCMake/CompilerTest/HIP-stdout.txt new file mode 100644 index 0000000..8b3baa7 --- /dev/null +++ b/Tests/RunCMake/CompilerTest/HIP-stdout.txt @@ -0,0 +1,2 @@ +-- Check for working HIP compiler: [^ +]* - works diff --git a/Tests/RunCMake/CompilerTest/HIP.cmake b/Tests/RunCMake/CompilerTest/HIP.cmake new file mode 100644 index 0000000..e56b77a --- /dev/null +++ b/Tests/RunCMake/CompilerTest/HIP.cmake @@ -0,0 +1,3 @@ +# Pretend the ABI check failed in order to force the fall-back test to run. +set(CMAKE_HIP_ABI_COMPILED FALSE) +enable_language(HIP) diff --git a/Tests/RunCMake/CompilerTest/ISPC-stdout.txt b/Tests/RunCMake/CompilerTest/ISPC-stdout.txt new file mode 100644 index 0000000..7e45c91 --- /dev/null +++ b/Tests/RunCMake/CompilerTest/ISPC-stdout.txt @@ -0,0 +1,3 @@ +-- The ISPC compiler identification is [^ +]* +-- Configuring done diff --git a/Tests/RunCMake/CompilerTest/ISPC.cmake b/Tests/RunCMake/CompilerTest/ISPC.cmake new file mode 100644 index 0000000..3ce7b28 --- /dev/null +++ b/Tests/RunCMake/CompilerTest/ISPC.cmake @@ -0,0 +1,3 @@ +# Pretend the ABI check failed in order to force the fall-back test to run. +set(CMAKE_ISPC_ABI_COMPILED FALSE) +enable_language(ISPC) diff --git a/Tests/RunCMake/CompilerTest/RunCMakeTest.cmake b/Tests/RunCMake/CompilerTest/RunCMakeTest.cmake index 995296a..2dd9c7f 100644 --- a/Tests/RunCMake/CompilerTest/RunCMakeTest.cmake +++ b/Tests/RunCMake/CompilerTest/RunCMakeTest.cmake @@ -3,6 +3,22 @@ include(RunCMake) run_cmake(C) run_cmake(CXX) +if(CMake_TEST_CUDA) + run_cmake(CUDA) +endif() + +if(CMake_TEST_Fortran) + run_cmake(Fortran) +endif() + +if(CMake_TEST_HIP) + run_cmake(HIP) +endif() + +if(CMake_TEST_ISPC) + run_cmake(ISPC) +endif() + if(CMake_TEST_OBJC) run_cmake(OBJC) run_cmake(OBJCXX) diff --git a/Tests/RunCMake/XcodeProject/Clean.cmake b/Tests/RunCMake/XcodeProject/Clean.cmake new file mode 100644 index 0000000..1ab7e10 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/Clean.cmake @@ -0,0 +1,2 @@ +enable_language(C) +add_subdirectory(Clean) diff --git a/Tests/RunCMake/XcodeProject/Clean/CMakeLists.txt b/Tests/RunCMake/XcodeProject/Clean/CMakeLists.txt new file mode 100644 index 0000000..59e62cb --- /dev/null +++ b/Tests/RunCMake/XcodeProject/Clean/CMakeLists.txt @@ -0,0 +1 @@ +add_library(empty empty.c) diff --git a/Tests/RunCMake/XcodeProject/Clean/empty.c b/Tests/RunCMake/XcodeProject/Clean/empty.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/Clean/empty.c diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake index d20f5a6..d97807b 100644 --- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -1,5 +1,13 @@ include(RunCMake) +function(RunClean) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Clean-build) + run_cmake(Clean) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(Clean-build xcodebuild clean) +endfunction() +RunClean() + run_cmake(ExplicitCMakeLists) run_cmake(ImplicitCMakeLists) run_cmake(InterfaceLibSources) @@ -290,30 +298,33 @@ if(XCODE_VERSION VERSION_GREATER_EQUAL 6) unset(RunCMake_TEST_OPTIONS) # XcodeIOSInstallCombinedPrune - set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeIOSInstallCombinedPrune-build) - set(RunCMake_TEST_NO_CLEAN 1) - set(RunCMake_TEST_OPTIONS - "-DCMAKE_SYSTEM_NAME=iOS" - "-DCMAKE_IOS_INSTALL_COMBINED=YES" - "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install") + # FIXME(#24011): Xcode 14 removed support for older architectures the test needs. + if(XCODE_VERSION VERSION_LESS 14) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeIOSInstallCombinedPrune-build) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_OPTIONS + "-DCMAKE_SYSTEM_NAME=iOS" + "-DCMAKE_IOS_INSTALL_COMBINED=YES" + "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install") - file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") - file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") - run_cmake(XcodeIOSInstallCombinedPrune) - run_cmake_command(XcodeIOSInstallCombinedPrune-build ${CMAKE_COMMAND} --build .) - if(XCODE_VERSION VERSION_LESS 12) - run_cmake_command(XcodeIOSInstallCombinedPrune-install ${CMAKE_COMMAND} --build . --target install) + run_cmake(XcodeIOSInstallCombinedPrune) + run_cmake_command(XcodeIOSInstallCombinedPrune-build ${CMAKE_COMMAND} --build .) + if(XCODE_VERSION VERSION_LESS 12) + run_cmake_command(XcodeIOSInstallCombinedPrune-install ${CMAKE_COMMAND} --build . --target install) + endif() + # --build defaults to Debug, --install defaults to Release, so we have to + # specify the configuration explicitly + run_cmake_command(XcodeIOSInstallCombinedPrune-cmakeinstall + ${CMAKE_COMMAND} --install . --config Debug + ) + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) + unset(RunCMake_TEST_OPTIONS) endif() - # --build defaults to Debug, --install defaults to Release, so we have to - # specify the configuration explicitly - run_cmake_command(XcodeIOSInstallCombinedPrune-cmakeinstall - ${CMAKE_COMMAND} --install . --config Debug - ) - - unset(RunCMake_TEST_BINARY_DIR) - unset(RunCMake_TEST_NO_CLEAN) - unset(RunCMake_TEST_OPTIONS) # XcodeIOSInstallCombinedSingleArch set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeIOSInstallCombinedSingleArch-build) diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined-install-check.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined-install-check.cmake index 53b885d..60bc0d8 100644 --- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined-install-check.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined-install-check.cmake @@ -9,11 +9,18 @@ function(verify_architectures file) return() endif() - string(REGEX MATCHALL "\narchitecture [^ \n\t()]+" architectures ${otool_out}) + string(REGEX MATCHALL "\narchitecture [^ \n\t()]+" architectures "${otool_out}") string(REPLACE "\narchitecture " "" actual "${architectures}") list(SORT actual) - set(expected arm64 armv7 i386 x86_64) + if(XCODE_VERSION VERSION_LESS 14) + set(maybe_armv7 armv7) + set(maybe_i386 i386) + else() + set(maybe_armv7 "") + set(maybe_i386 "") + endif() + set(expected arm64 ${maybe_armv7} ${maybe_i386} x86_64) if(NOT actual STREQUAL expected) message(SEND_ERROR diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake index 19f8e2f..8426148 100644 --- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake @@ -2,7 +2,13 @@ cmake_minimum_required(VERSION 3.3) project(IOSInstallCombined CXX) -if(XCODE_VERSION VERSION_GREATER_EQUAL 9) +set(maybe_armv7 armv7) +set(maybe_i386 i386) +if(XCODE_VERSION VERSION_GREATER_EQUAL 14) + set(CMAKE_OSX_DEPLOYMENT_TARGET 16) + set(maybe_armv7 "") + set(maybe_i386 "") +elseif(XCODE_VERSION VERSION_GREATER_EQUAL 9) set(CMAKE_OSX_DEPLOYMENT_TARGET 10) endif() @@ -16,7 +22,7 @@ set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf") set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO") -set(CMAKE_OSX_ARCHITECTURES "armv7;arm64;i386;x86_64") +set(CMAKE_OSX_ARCHITECTURES ${maybe_armv7} arm64 ${maybe_i386} x86_64) add_executable(foo_app MACOSX_BUNDLE main.cpp) install(TARGETS foo_app BUNDLE DESTINATION bin) diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch-install-check.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch-install-check.cmake index 3c11ae0..db8f869 100644 --- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch-install-check.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch-install-check.cmake @@ -12,7 +12,11 @@ function(verify_architecture file) string(REGEX MATCHALL "is architecture: [^ \n\t]+" architecture "${lipo_out}") string(REGEX REPLACE "is architecture: " "" actual "${architecture}") - set(expected armv7) + if(XCODE_VERSION VERSION_GREATER_EQUAL 14) + set(expected arm64) + else() + set(expected armv7) + endif() if(NOT actual STREQUAL expected) message(SEND_ERROR diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake index 974ae47..5177ec2 100644 --- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake @@ -2,7 +2,11 @@ cmake_minimum_required(VERSION 3.3) project(XcodeIOSInstallCombinedSingleArch CXX) -if(XCODE_VERSION VERSION_GREATER_EQUAL 9) +set(iphoneos_arch armv7) +if(XCODE_VERSION VERSION_GREATER_EQUAL 14) + set(CMAKE_OSX_DEPLOYMENT_TARGET 16) + set(iphoneos_arch arm64) +elseif(XCODE_VERSION VERSION_GREATER_EQUAL 9) set(CMAKE_OSX_DEPLOYMENT_TARGET 10) endif() @@ -17,8 +21,8 @@ install(TARGETS foo DESTINATION lib) set_target_properties( foo PROPERTIES - XCODE_ATTRIBUTE_ARCHS[sdk=iphoneos*] armv7 - XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphoneos*] armv7 + XCODE_ATTRIBUTE_ARCHS[sdk=iphoneos*] ${iphoneos_arch} + XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphoneos*] ${iphoneos_arch} XCODE_ATTRIBUTE_ARCHS[sdk=iphonesimulator*] "" XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphonesimulator*] "" ) diff --git a/Tests/RunCMake/try_compile/SourceFromBadName-stderr.txt b/Tests/RunCMake/try_compile/SourceFromBadName-stderr.txt index ef6847c..041f3f1 100644 --- a/Tests/RunCMake/try_compile/SourceFromBadName-stderr.txt +++ b/Tests/RunCMake/try_compile/SourceFromBadName-stderr.txt @@ -1,4 +1,4 @@ CMake Error at SourceFromBadName.cmake:[0-9]+ \(try_compile\): - SOURCES_FROM_ARG given invalid filename "bad/name.c" + SOURCE_FROM_CONTENT given invalid filename "bad/name.c" Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/SourceFromBadName.cmake b/Tests/RunCMake/try_compile/SourceFromBadName.cmake index e53a73f..44d92fd 100644 --- a/Tests/RunCMake/try_compile/SourceFromBadName.cmake +++ b/Tests/RunCMake/try_compile/SourceFromBadName.cmake @@ -1 +1 @@ -try_compile(RESULT SOURCE_FROM_ARG bad/name.c "int main();") +try_compile(RESULT SOURCE_FROM_CONTENT bad/name.c "int main();") diff --git a/Tests/RunCMake/try_compile/SourceFromOneArg-stderr.txt b/Tests/RunCMake/try_compile/SourceFromOneArg-stderr.txt index bebe8bb..8b2248a 100644 --- a/Tests/RunCMake/try_compile/SourceFromOneArg-stderr.txt +++ b/Tests/RunCMake/try_compile/SourceFromOneArg-stderr.txt @@ -1,4 +1,4 @@ CMake Error at SourceFromOneArg.cmake:[0-9]+ \(try_compile\): - SOURCE_FROM_ARG requires exactly two arguments + SOURCE_FROM_CONTENT requires exactly two arguments Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/SourceFromOneArg.cmake b/Tests/RunCMake/try_compile/SourceFromOneArg.cmake index 39ca11e..5a50499 100644 --- a/Tests/RunCMake/try_compile/SourceFromOneArg.cmake +++ b/Tests/RunCMake/try_compile/SourceFromOneArg.cmake @@ -1 +1 @@ -try_compile(RESULT SOURCE_FROM_ARG test.c) +try_compile(RESULT SOURCE_FROM_CONTENT test.c) diff --git a/Tests/RunCMake/try_compile/SourceFromThreeArgs-stderr.txt b/Tests/RunCMake/try_compile/SourceFromThreeArgs-stderr.txt index 2cf201d..5f2ff61 100644 --- a/Tests/RunCMake/try_compile/SourceFromThreeArgs-stderr.txt +++ b/Tests/RunCMake/try_compile/SourceFromThreeArgs-stderr.txt @@ -1,4 +1,4 @@ CMake Error at SourceFromThreeArgs.cmake:[0-9]+ \(try_compile\): - SOURCE_FROM_ARG requires exactly two arguments + SOURCE_FROM_CONTENT requires exactly two arguments Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/SourceFromThreeArgs.cmake b/Tests/RunCMake/try_compile/SourceFromThreeArgs.cmake index af6340d..196851a 100644 --- a/Tests/RunCMake/try_compile/SourceFromThreeArgs.cmake +++ b/Tests/RunCMake/try_compile/SourceFromThreeArgs.cmake @@ -1 +1 @@ -try_compile(RESULT SOURCE_FROM_ARG test.c "int" "main();") +try_compile(RESULT SOURCE_FROM_CONTENT test.c "int" "main();") |