diff options
author | Brad King <brad.king@kitware.com> | 2023-01-18 19:33:39 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-01-18 21:40:19 (GMT) |
commit | 95976514f605e83c4db5e1dd176398653b0d42cd (patch) | |
tree | 2224ace15f0f84096ecc1fd941e4373003e5ceda | |
parent | 20bbd5f3d3b63fcf1f62e1df3ec8ce3ba30d288b (diff) | |
download | CMake-95976514f605e83c4db5e1dd176398653b0d42cd.zip CMake-95976514f605e83c4db5e1dd176398653b0d42cd.tar.gz CMake-95976514f605e83c4db5e1dd176398653b0d42cd.tar.bz2 |
Tests: Avoid using CMake{Output,Error}.log files
These log files will soon go away, so avoid using them in tests.
-rw-r--r-- | Tests/CheckFortran.cmake | 1 | ||||
-rw-r--r-- | Tests/CheckSwift.cmake | 1 | ||||
-rw-r--r-- | Tests/FortranOnly/CMakeLists.txt | 22 | ||||
-rw-r--r-- | Tests/RunCMake/CTestCommandExpandLists/multipleExpandOptions-stdout.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/try_compile/CMP0128-common.cmake | 23 | ||||
-rw-r--r-- | Tests/SystemInformation/DumpInformation.cxx | 4 |
6 files changed, 35 insertions, 17 deletions
diff --git a/Tests/CheckFortran.cmake b/Tests/CheckFortran.cmake index 36293f5..1e943a1 100644 --- a/Tests/CheckFortran.cmake +++ b/Tests/CheckFortran.cmake @@ -33,6 +33,7 @@ file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\" RESULT_VARIABLE result ) include(${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CheckFortran/result.cmake OPTIONAL) + # FIXME: Replace with message(CONFIGURE_LOG) when CMake version is high enough. if(CMAKE_Fortran_COMPILER AND "${result}" STREQUAL "0") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "${_desc} passed with the following output:\n" diff --git a/Tests/CheckSwift.cmake b/Tests/CheckSwift.cmake index 099c298..86ea603 100644 --- a/Tests/CheckSwift.cmake +++ b/Tests/CheckSwift.cmake @@ -42,6 +42,7 @@ file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\" include(${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CheckSwift/result.cmake OPTIONAL) + # FIXME: Replace with message(CONFIGURE_LOG) when CMake version is high enough. if(CMAKE_Swift_COMPILER AND "${result}" STREQUAL "0") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "${_desc} passed with the following output:\n" diff --git a/Tests/FortranOnly/CMakeLists.txt b/Tests/FortranOnly/CMakeLists.txt index b07c214..fc71a18 100644 --- a/Tests/FortranOnly/CMakeLists.txt +++ b/Tests/FortranOnly/CMakeLists.txt @@ -56,8 +56,6 @@ add_custom_target(checksayhello ALL ) add_dependencies(checksayhello sayhello) -set(err_log ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log) -file(REMOVE "${err_log}") include(CheckFortranSourceCompiles) unset(HAVE_PRINT CACHE) CHECK_Fortran_SOURCE_COMPILES([[ @@ -66,10 +64,24 @@ CHECK_Fortran_SOURCE_COMPILES([[ END ]] HAVE_PRINT) if(NOT HAVE_PRINT) - if(EXISTS "${err_log}") - file(READ "${err_log}" err) + set(configure_log "${CMAKE_BINARY_DIR}/CMakeFiles/CMakeConfigureLog.yaml") + if(EXISTS "${configure_log}") + file(READ "${configure_log}" log_content) + else() + set(log_content "") + endif() + if(log_content MATCHES [[( - + kind: "try_compile-v1"( ++ [^ +]+)+ + checks: + - "Performing Test HAVE_PRINT"( ++ [^ +]+)+)]]) + set(err "${CMAKE_MATCH_1}") + else() + set(err "") endif() - string(REPLACE "\n" "\n " err " ${err}") message(SEND_ERROR "CHECK_Fortran_SOURCE_COMPILES for HAVE_PRINT failed:\n" "${err}") endif() diff --git a/Tests/RunCMake/CTestCommandExpandLists/multipleExpandOptions-stdout.txt b/Tests/RunCMake/CTestCommandExpandLists/multipleExpandOptions-stdout.txt index 55bb894..da548a6 100644 --- a/Tests/RunCMake/CTestCommandExpandLists/multipleExpandOptions-stdout.txt +++ b/Tests/RunCMake/CTestCommandExpandLists/multipleExpandOptions-stdout.txt @@ -1,2 +1 @@ -- Configuring incomplete, errors occurred! -See also ".*/Tests/RunCMake/CTestCommandExpandLists/multipleExpandOptions-build/CMakeFiles/CMakeOutput\.log". diff --git a/Tests/RunCMake/try_compile/CMP0128-common.cmake b/Tests/RunCMake/try_compile/CMP0128-common.cmake index 0b8a12b..64b1a77 100644 --- a/Tests/RunCMake/try_compile/CMP0128-common.cmake +++ b/Tests/RunCMake/try_compile/CMP0128-common.cmake @@ -1,10 +1,6 @@ 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) @@ -24,8 +20,21 @@ int main() } " SRC_COMPILED) if(NOT SRC_COMPILED) - if(EXISTS "${CMakeError_log}") - file(READ "${CMakeError_log}" err_log) + message("Check failed to compile:") + set(configure_log "${CMAKE_BINARY_DIR}/CMakeFiles/CMakeConfigureLog.yaml") + if(EXISTS "${configure_log}") + file(READ "${configure_log}" log_content) + else() + set(log_content "") + endif() + if(log_content MATCHES [[( - + kind: "try_compile-v1"( ++ [^ +]+)+ + checks: + - "Performing Test SRC_COMPILED"( ++ [^ +]+)+)]]) + message("${configure_log} contains:\n${CMAKE_MATCH_1}") endif() - message("${err_log}") endif() diff --git a/Tests/SystemInformation/DumpInformation.cxx b/Tests/SystemInformation/DumpInformation.cxx index 4328675..e50db40 100644 --- a/Tests/SystemInformation/DumpInformation.cxx +++ b/Tests/SystemInformation/DumpInformation.cxx @@ -63,13 +63,9 @@ int main(int, char* []) DumpInformation_BINARY_DIR "/OtherProperties.txt", DumpInformation_BINARY_DIR "/../../Source/cmConfigure.h", DumpInformation_BINARY_DIR "/../../CMakeCache.txt", - DumpInformation_BINARY_DIR "/../../CMakeFiles/CMakeOutput.log", - DumpInformation_BINARY_DIR "/../../CMakeFiles/CMakeError.log", DumpInformation_BINARY_DIR "/../../Bootstrap.cmk/cmake_bootstrap.log", DumpInformation_BINARY_DIR "/../../Source/cmsys/Configure.hxx", DumpInformation_BINARY_DIR "/../../Source/cmsys/Configure.h", - DumpInformation_BINARY_DIR "/CMakeFiles/CMakeOutput.log", - DumpInformation_BINARY_DIR "/CMakeFiles/CMakeError.log", 0 }; |