summaryrefslogtreecommitdiff
path: root/Tests/RunCMake
diff options
context:
space:
mode:
authorJinWang An <jinwang.an@samsung.com>2022-12-27 17:20:23 +0900
committerJinWang An <jinwang.an@samsung.com>2022-12-27 17:20:23 +0900
commitdf9806c0f5714ed294007ad149c001a983d1a73f (patch)
treead55c43bacec0d510b5cec3ffc2ce0d50e8c96e1 /Tests/RunCMake
parent2ca550cb40ebd920ba5862dd9c53fc30650ffa02 (diff)
downloadcmake-df9806c0f5714ed294007ad149c001a983d1a73f.tar.gz
cmake-df9806c0f5714ed294007ad149c001a983d1a73f.tar.bz2
cmake-df9806c0f5714ed294007ad149c001a983d1a73f.zip
Imported Upstream version 3.24.3upstream/3.24.3
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r--Tests/RunCMake/Framework/FrameworkMultiConfigPostfix.cmake5
-rw-r--r--Tests/RunCMake/Ninja/Intl-build-check.cmake5
-rw-r--r--Tests/RunCMake/Ninja/Intl-common.cmake1
-rw-r--r--Tests/RunCMake/Ninja/Intl.cmake7
-rw-r--r--Tests/RunCMake/Ninja/RunCMakeTest.cmake9
-rw-r--r--Tests/RunCMake/ParseImplicitData/linux-Fortran-LLVMFlang-15.0.0.input43
-rw-r--r--Tests/RunCMake/ParseImplicitLinkInfo/ParseImplicitLinkInfo.cmake1
-rw-r--r--Tests/RunCMake/ParseImplicitLinkInfo/results/linux-Fortran-LLVMFlang-15.0.0.output2
-rw-r--r--Tests/RunCMake/XcodeProject/RunCMakeTest.cmake45
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined-install-check.cmake11
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake10
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch-install-check.cmake6
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake10
-rw-r--r--Tests/RunCMake/ctest_build/CMakeLists.txt.in2
-rw-r--r--Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-check.cmake23
-rw-r--r--Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-result.txt1
-rw-r--r--Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-stderr.txt1
-rw-r--r--Tests/RunCMake/ctest_build/RunCMakeTest.cmake16
-rw-r--r--Tests/RunCMake/ctest_build/error.c1
-rw-r--r--Tests/RunCMake/try_compile/CMP0128-NEW.cmake7
-rw-r--r--Tests/RunCMake/try_compile/CMP0128-WARN.cmake7
-rw-r--r--Tests/RunCMake/try_compile/CMP0128-common.cmake31
-rw-r--r--Tests/RunCMake/try_compile/Inspect.cmake4
-rw-r--r--Tests/RunCMake/try_compile/RunCMakeTest.cmake18
24 files changed, 236 insertions, 30 deletions
diff --git a/Tests/RunCMake/Framework/FrameworkMultiConfigPostfix.cmake b/Tests/RunCMake/Framework/FrameworkMultiConfigPostfix.cmake
index 51e627d6d..3afda4d7b 100644
--- a/Tests/RunCMake/Framework/FrameworkMultiConfigPostfix.cmake
+++ b/Tests/RunCMake/Framework/FrameworkMultiConfigPostfix.cmake
@@ -23,3 +23,8 @@ string(APPEND content
"set(target_file_name ${target_name})\n")
file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/FrameworkMultiConfigPostfixInfo.cmake
CONTENT "${content}")
+
+
+# Try to link this framework to ensure postfix is correctly handled
+add_library(otherlib SHARED foo.c)
+target_link_libraries(otherlib PRIVATE ${target_name})
diff --git a/Tests/RunCMake/Ninja/Intl-build-check.cmake b/Tests/RunCMake/Ninja/Intl-build-check.cmake
new file mode 100644
index 000000000..77f013c7e
--- /dev/null
+++ b/Tests/RunCMake/Ninja/Intl-build-check.cmake
@@ -0,0 +1,5 @@
+include(${RunCMake_SOURCE_DIR}/Intl-common.cmake)
+set(output "${RunCMake_TEST_BINARY_DIR}/${intl}-output.txt")
+if(NOT EXISTS "${output}")
+ set(RunCMake_TEST_FAILED "Expected output does not exist:\n ${output}")
+endif()
diff --git a/Tests/RunCMake/Ninja/Intl-common.cmake b/Tests/RunCMake/Ninja/Intl-common.cmake
new file mode 100644
index 000000000..770397681
--- /dev/null
+++ b/Tests/RunCMake/Ninja/Intl-common.cmake
@@ -0,0 +1 @@
+set(intl "intl-ë®")
diff --git a/Tests/RunCMake/Ninja/Intl.cmake b/Tests/RunCMake/Ninja/Intl.cmake
new file mode 100644
index 000000000..50e4ee41e
--- /dev/null
+++ b/Tests/RunCMake/Ninja/Intl.cmake
@@ -0,0 +1,7 @@
+include(Intl-common.cmake)
+set(input "${CMAKE_CURRENT_BINARY_DIR}/${intl}-input.txt")
+set(output "${CMAKE_CURRENT_BINARY_DIR}/${intl}-output.txt")
+file(WRITE "${input}" "${intl}\n")
+add_custom_command(OUTPUT "${output}"
+ COMMAND ${CMAKE_COMMAND} -E copy "${input}" "${output}")
+add_custom_target(drive ALL DEPENDS "${output}")
diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
index 2a5b55620..0825666a0 100644
--- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
@@ -33,6 +33,15 @@ function(run_NinjaToolMissing)
endfunction()
run_NinjaToolMissing()
+function(run_Intl)
+ run_cmake(Intl)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Intl-build)
+ set(RunCMake_TEST_OUTPUT_MERGE 1)
+ run_cmake_command(Intl-build ${CMAKE_COMMAND} --build .)
+endfunction()
+run_Intl()
+
function(run_NoWorkToDo)
run_cmake(NoWorkToDo)
set(RunCMake_TEST_NO_CLEAN 1)
diff --git a/Tests/RunCMake/ParseImplicitData/linux-Fortran-LLVMFlang-15.0.0.input b/Tests/RunCMake/ParseImplicitData/linux-Fortran-LLVMFlang-15.0.0.input
new file mode 100644
index 000000000..5a53c882a
--- /dev/null
+++ b/Tests/RunCMake/ParseImplicitData/linux-Fortran-LLVMFlang-15.0.0.input
@@ -0,0 +1,43 @@
+CMAKE_LANG=Fortran
+CMAKE_LINKER=/usr/bin/ld
+CMAKE_Fortran_COMPILER_ABI=
+CMAKE_Fortran_COMPILER_AR=
+CMAKE_Fortran_COMPILER_ARCHITECTURE_ID=
+CMAKE_Fortran_COMPILER_EXTERNAL_TOOLCHAIN=
+CMAKE_Fortran_COMPILER_ID=LLVMFlang
+CMAKE_Fortran_COMPILER_LAUNCHER=
+CMAKE_Fortran_COMPILER_LOADED=1
+CMAKE_Fortran_COMPILER_RANLIB=
+CMAKE_Fortran_COMPILER_TARGET=
+CMAKE_Fortran_COMPILER_VERSION=15.0.0
+CMAKE_Fortran_COMPILER_VERSION_INTERAL=
+Change Dir: /tmp/ii/CMakeFiles/CMakeTmp
+
+Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_2e9b9/fast && /usr/bin/gmake -f CMakeFiles/cmTC_2e9b9.dir/build.make CMakeFiles/cmTC_2e9b9.dir/build
+gmake[1]: Entering directory '/tmp/ii/CMakeFiles/CMakeTmp'
+Building Fortran object CMakeFiles/cmTC_2e9b9.dir/CMakeFortranCompilerABI.F.o
+/usr/bin/flang-new -v -c /tmp/CMake/Modules/CMakeFortranCompilerABI.F -o CMakeFiles/cmTC_2e9b9.dir/CMakeFortranCompilerABI.F.o
+flang-new version 15.0.0 (Fedora 15.0.0-4.fc38)
+Target: x86_64-redhat-linux-gnu
+Thread model: posix
+InstalledDir: /usr/bin
+Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-redhat-linux/12
+Selected GCC installation: /usr/bin/../lib/gcc/x86_64-redhat-linux/12
+Candidate multilib: .@m64
+Candidate multilib: 32@m32
+Selected multilib: .@m64
+ "/usr/bin/flang-new" -fc1 -triple x86_64-redhat-linux-gnu -emit-obj -o CMakeFiles/cmTC_2e9b9.dir/CMakeFortranCompilerABI.F.o -x f95-cpp-input /tmp/CMake/Modules/CMakeFortranCompilerABI.F
+Linking Fortran executable cmTC_2e9b9
+/tmp/CMake/bin/cmake -E cmake_link_script CMakeFiles/cmTC_2e9b9.dir/link.txt --verbose=1
+/usr/bin/flang-new -v CMakeFiles/cmTC_2e9b9.dir/CMakeFortranCompilerABI.F.o -o cmTC_2e9b9
+flang-new version 15.0.0 (Fedora 15.0.0-4.fc38)
+Target: x86_64-redhat-linux-gnu
+Thread model: posix
+InstalledDir: /usr/bin
+Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-redhat-linux/12
+Selected GCC installation: /usr/bin/../lib/gcc/x86_64-redhat-linux/12
+Candidate multilib: .@m64
+Candidate multilib: 32@m32
+Selected multilib: .@m64
+ "/usr/bin/ld" --hash-style=gnu --build-id --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o cmTC_2e9b9 /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../lib64/crt1.o /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../lib64/crti.o /usr/bin/../lib/gcc/x86_64-redhat-linux/12/crtbegin.o -L/usr/bin/../lib/gcc/x86_64-redhat-linux/12 -L/usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/lib -L/usr/lib CMakeFiles/cmTC_2e9b9.dir/CMakeFortranCompilerABI.F.o -lFortran_main -lFortranRuntime -lFortranDecimal -lm -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/bin/../lib/gcc/x86_64-redhat-linux/12/crtend.o /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../lib64/crtn.o
+gmake[1]: Leaving directory '/tmp/ii/CMakeFiles/CMakeTmp'
diff --git a/Tests/RunCMake/ParseImplicitLinkInfo/ParseImplicitLinkInfo.cmake b/Tests/RunCMake/ParseImplicitLinkInfo/ParseImplicitLinkInfo.cmake
index 51c88325f..1410eae78 100644
--- a/Tests/RunCMake/ParseImplicitLinkInfo/ParseImplicitLinkInfo.cmake
+++ b/Tests/RunCMake/ParseImplicitLinkInfo/ParseImplicitLinkInfo.cmake
@@ -38,6 +38,7 @@ set(targets
linux-C-XL-16.1.0.0 linux-CXX-XL-16.1.0.0
linux-CUDA-NVIDIA-10.1.168-CLANG linux-CUDA-NVIDIA-10.1.168-XLClang-v
linux-CUDA-NVIDIA-9.2.148-GCC
+ linux-Fortran-LLVMFlang-15.0.0
linux-custom_clang-C-Clang-13.0.0 linux-custom_clang-CXX-Clang-13.0.0
mingw.org-C-GNU-4.9.3 mingw.org-CXX-GNU-4.9.3
netbsd-C-GNU-4.8.5 netbsd-CXX-GNU-4.8.5
diff --git a/Tests/RunCMake/ParseImplicitLinkInfo/results/linux-Fortran-LLVMFlang-15.0.0.output b/Tests/RunCMake/ParseImplicitLinkInfo/results/linux-Fortran-LLVMFlang-15.0.0.output
new file mode 100644
index 000000000..cea8a687b
--- /dev/null
+++ b/Tests/RunCMake/ParseImplicitLinkInfo/results/linux-Fortran-LLVMFlang-15.0.0.output
@@ -0,0 +1,2 @@
+libs=Fortran_main;FortranRuntime;FortranDecimal;m;gcc;gcc_s;c;gcc;gcc_s
+dirs=/usr/lib/gcc/x86_64-redhat-linux/12;/usr/lib64;/lib64;/lib;/usr/lib
diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
index d20f5a61a..128a9dcab 100644
--- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
+++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
@@ -290,30 +290,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 53b885d29..60bc0d8fc 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 19f8e2fb4..8426148b8 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 3c11ae0ee..db8f869f3 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 974ae47eb..5177ec2c8 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/ctest_build/CMakeLists.txt.in b/Tests/RunCMake/ctest_build/CMakeLists.txt.in
index 133ae3662..4a067fa50 100644
--- a/Tests/RunCMake/ctest_build/CMakeLists.txt.in
+++ b/Tests/RunCMake/ctest_build/CMakeLists.txt.in
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.1)
@CASE_CMAKELISTS_PREFIX_CODE@
-project(CTestBuild@CASE_NAME@ NONE)
+project(CTestBuild@CASE_NAME@ @LANG@)
include(CTest)
add_test(NAME RunCMakeVersion COMMAND "${CMAKE_COMMAND}" --version)
@CASE_CMAKELISTS_SUFFIX_CODE@
diff --git a/Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-check.cmake b/Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-check.cmake
new file mode 100644
index 000000000..7089d7000
--- /dev/null
+++ b/Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-check.cmake
@@ -0,0 +1,23 @@
+file(GLOB build_xml_file "${RunCMake_TEST_BINARY_DIR}/Testing/*/Build.xml")
+if(build_xml_file)
+ file(READ "${build_xml_file}" build_xml LIMIT 8192)
+ string(FIND "${build_xml}" [[This should not be compiled]] expected_failure_pos)
+ if(expected_failure_pos EQUAL "-1")
+ string(REPLACE "\n" "\n " build_xml " ${build_xml}")
+ set(RunCMake_TEST_FAILED
+ "Build.xml does not have expected error message:\n${build_xml}"
+ )
+ else()
+ string(SUBSTRING "${build_xml}" "${expected_failure_pos}" -1 remaining_xml)
+ string(FIND "${remaining_xml}" [[<Failure type="Error">]] unexpected_failure_pos)
+ if(NOT unexpected_failure_pos EQUAL "-1")
+ string(SUBSTRING "${remaining_xml}" "${unexpected_failure_pos}" -1 error_msg_xml)
+ string(REPLACE "\n" "\n " error_msg_xml " ${error_msg_xml}")
+ set(RunCMake_TEST_FAILED
+ "Build.xml contains unexpected extra <Failure> elements:\n${error_msg_xml}"
+ )
+ endif()
+ endif()
+else()
+ set(RunCMake_TEST_FAILED "Build.xml not found")
+endif()
diff --git a/Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-result.txt b/Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-result.txt
new file mode 100644
index 000000000..b57e2deb7
--- /dev/null
+++ b/Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-result.txt
@@ -0,0 +1 @@
+(-1|255)
diff --git a/Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-stderr.txt b/Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-stderr.txt
new file mode 100644
index 000000000..bbe9410a1
--- /dev/null
+++ b/Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-stderr.txt
@@ -0,0 +1 @@
+^Error\(s\) when building project
diff --git a/Tests/RunCMake/ctest_build/RunCMakeTest.cmake b/Tests/RunCMake/ctest_build/RunCMakeTest.cmake
index e94a55d27..6f1b4b6f4 100644
--- a/Tests/RunCMake/ctest_build/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ctest_build/RunCMakeTest.cmake
@@ -1,5 +1,6 @@
include(RunCTest)
+set(LANG NONE)
set(CASE_CTEST_BUILD_ARGS "")
set(RunCMake_USE_LAUNCHERS TRUE)
set(RunCMake_USE_CUSTOM_BUILD_COMMAND FALSE)
@@ -70,3 +71,18 @@ set(RunCMake_USE_LAUNCHERS FALSE)
set(RunCMake_BUILD_COMMAND "${COLOR_WARNING}")
run_ctest(IgnoreColor)
unset(RunCMake_BUILD_COMMAND)
+
+set(RunCMake_USE_CUSTOM_BUILD_COMMAND FALSE)
+if(RunCMake_GENERATOR MATCHES "Ninja")
+ function(run_NinjaLauncherSingleBuildFailure)
+ set(LANG C)
+ set(RunCMake_USE_LAUNCHERS TRUE)
+ set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/NinjaLauncherSingleBuildFailure")
+ configure_file("${RunCMake_SOURCE_DIR}/error.c" "${RunCMake_TEST_SOURCE_DIR}/error.c" COPYONLY)
+ set(CASE_CMAKELISTS_SUFFIX_CODE [=[
+ add_executable(error error.c)
+ ]=])
+ run_ctest(NinjaLauncherSingleBuildFailure)
+ endfunction()
+ run_NinjaLauncherSingleBuildFailure()
+endif()
diff --git a/Tests/RunCMake/ctest_build/error.c b/Tests/RunCMake/ctest_build/error.c
new file mode 100644
index 000000000..f10e68700
--- /dev/null
+++ b/Tests/RunCMake/ctest_build/error.c
@@ -0,0 +1 @@
+#error "This should not be compiled"
diff --git a/Tests/RunCMake/try_compile/CMP0128-NEW.cmake b/Tests/RunCMake/try_compile/CMP0128-NEW.cmake
new file mode 100644
index 000000000..20e389a7d
--- /dev/null
+++ b/Tests/RunCMake/try_compile/CMP0128-NEW.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0128 NEW)
+set(check_cxx_std "
+#if __cplusplus > 199711L && __cplusplus <= 201103L
+# error Compiler is incorrectly in C++11 mode.
+#endif
+")
+include(CMP0128-common.cmake)
diff --git a/Tests/RunCMake/try_compile/CMP0128-WARN.cmake b/Tests/RunCMake/try_compile/CMP0128-WARN.cmake
new file mode 100644
index 000000000..266bd22ae
--- /dev/null
+++ b/Tests/RunCMake/try_compile/CMP0128-WARN.cmake
@@ -0,0 +1,7 @@
+
+set(check_cxx_std "
+#if __cplusplus <= 199711L || __cplusplus > 201103L
+# error Compiler is incorrectly not in C++11 mode.
+#endif
+")
+include(CMP0128-common.cmake)
diff --git a/Tests/RunCMake/try_compile/CMP0128-common.cmake b/Tests/RunCMake/try_compile/CMP0128-common.cmake
new file mode 100644
index 000000000..0b8a12bc5
--- /dev/null
+++ b/Tests/RunCMake/try_compile/CMP0128-common.cmake
@@ -0,0 +1,31 @@
+cmake_policy(SET CMP0067 NEW)
+enable_language(CXX)
+
+# Isolate the one try_compile below in the error log.
+set(CMakeError_log "${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log")
+file(REMOVE "${CMakeError_log}")
+
+# Add our own -std= flag to the try_compile check.
+set(CMAKE_REQUIRED_FLAGS -std=c++11)
+
+# Tell CMP0128 NEW behavior to append a -std= flag (after ours).
+if(CMAKE_CXX_EXTENSIONS_DEFAULT)
+ set(CMAKE_CXX_EXTENSIONS OFF)
+else()
+ set(CMAKE_CXX_EXTENSIONS ON)
+endif()
+
+include(CheckSourceCompiles)
+check_source_compiles(CXX "
+${check_cxx_std}
+int main()
+{
+ return 0;
+}
+" SRC_COMPILED)
+if(NOT SRC_COMPILED)
+ if(EXISTS "${CMakeError_log}")
+ file(READ "${CMakeError_log}" err_log)
+ endif()
+ message("${err_log}")
+endif()
diff --git a/Tests/RunCMake/try_compile/Inspect.cmake b/Tests/RunCMake/try_compile/Inspect.cmake
new file mode 100644
index 000000000..added410b
--- /dev/null
+++ b/Tests/RunCMake/try_compile/Inspect.cmake
@@ -0,0 +1,4 @@
+enable_language(CXX)
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/info.cmake" "
+set(CMAKE_CXX_EXTENSIONS_DEFAULT \"${CMAKE_CXX_EXTENSIONS_DEFAULT}\")
+")
diff --git a/Tests/RunCMake/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
index eca7bf485..3cfbfbff7 100644
--- a/Tests/RunCMake/try_compile/RunCMakeTest.cmake
+++ b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
@@ -116,6 +116,24 @@ if(RunCMake_GENERATOR MATCHES "Make|Ninja")
unset(RunCMake_TEST_NO_CLEAN)
endif()
+# Lookup CMAKE_CXX_EXTENSIONS_DEFAULT.
+# FIXME: Someday we could move this to the top of the file and use it in
+# place of some of the values passed by 'Tests/RunCMake/CMakeLists.txt'.
+run_cmake(Inspect)
+include("${RunCMake_BINARY_DIR}/Inspect-build/info.cmake")
+
+# FIXME: Support more compilers and default standard levels.
+if (DEFINED CMAKE_CXX_STANDARD_DEFAULT AND
+ DEFINED CMAKE_CXX_EXTENSIONS_DEFAULT AND (
+ (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 4.7) OR
+ (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
+ ))
+ run_cmake(CMP0128-WARN)
+ if(NOT CMAKE_CXX_STANDARD_DEFAULT EQUAL 11)
+ run_cmake(CMP0128-NEW)
+ endif()
+endif()
+
if(UNIX)
run_cmake(CleanupNoFollowSymlink)
endif()