From 41e777274a68bbaaec47a5e7def20144fbf5601d Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 29 May 2024 13:40:30 -0400 Subject: [PATCH] Tests: Update BuildDepends test for VS 17.10 The test project now rebuilds `link_depends_no_shared_exe` in `Debug` builds. MSBuild `-v:diag` shows: Source compilation required: input C:\...\DEBUG\LINK_DEPENDS_NO_SHARED_LIB.PDB is newer than output C:\...\DEBUG\LINK_DEPENDS_NO_SHARED_EXE.EXE. Use the `Release` configuration instead. --- Tests/BuildDepends/CMakeLists.txt | 35 +++++++++++++++++++------------ 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/Tests/BuildDepends/CMakeLists.txt b/Tests/BuildDepends/CMakeLists.txt index 99418df365..2fa2bc5c04 100644 --- a/Tests/BuildDepends/CMakeLists.txt +++ b/Tests/BuildDepends/CMakeLists.txt @@ -12,6 +12,15 @@ project(BuildDepends) # project is built. set(CMAKE_SUPPRESS_REGENERATION 1) +if(CMAKE_GENERATOR MATCHES "Visual Studio" AND CMAKE_VS_PLATFORM_TOOLSET MATCHES "^(v90|v100|v110|v120|v140)$") + # These toolsets update 'link_depends_no_shared_lib.lib' during rebuild in Release mode. + set(config Debug) +else() + # Some toolsets update 'link_depends_no_shared_lib.pdb' during rebuild in Debug mode. + set(config Release) +endif() +set(CMAKE_TRY_COMPILE_CONFIGURATION "${config}") + # Xcode needs some help with the fancy dependencies in this test. if(XCODE AND XCODE_VERSION VERSION_LESS 5) set(HELP_XCODE 1) @@ -117,10 +126,10 @@ endif() # find and save the ninjadep executable set(ninjadep ${BuildDepends_BINARY_DIR}/Project/ninjadep${CMAKE_EXECUTABLE_SUFFIX}) if(EXISTS - "${BuildDepends_BINARY_DIR}/Project/Debug/ninjadep${CMAKE_EXECUTABLE_SUFFIX}" ) - message("found debug") + "${BuildDepends_BINARY_DIR}/Project/${config}/ninjadep${CMAKE_EXECUTABLE_SUFFIX}" ) + message("found ${config}/ninjadep${CMAKE_EXECUTABLE_SUFFIX}") set(ninjadep - "${BuildDepends_BINARY_DIR}/Project/Debug/ninjadep${CMAKE_EXECUTABLE_SUFFIX}") + "${BuildDepends_BINARY_DIR}/Project/${config}/ninjadep${CMAKE_EXECUTABLE_SUFFIX}") endif() message("Running ${ninjadep} ") execute_process(COMMAND ${ninjadep} OUTPUT_VARIABLE out RESULT_VARIABLE runResult) @@ -136,17 +145,17 @@ endif() set(bar ${BuildDepends_BINARY_DIR}/Project/bar${CMAKE_EXECUTABLE_SUFFIX}) if(EXISTS - "${BuildDepends_BINARY_DIR}/Project/Debug/bar${CMAKE_EXECUTABLE_SUFFIX}" ) - message("found debug") + "${BuildDepends_BINARY_DIR}/Project/${config}/bar${CMAKE_EXECUTABLE_SUFFIX}" ) + message("found ${config}/bar${CMAKE_EXECUTABLE_SUFFIX}") set(bar - "${BuildDepends_BINARY_DIR}/Project/Debug/bar${CMAKE_EXECUTABLE_SUFFIX}") + "${BuildDepends_BINARY_DIR}/Project/${config}/bar${CMAKE_EXECUTABLE_SUFFIX}") endif() set(zot ${BuildDepends_BINARY_DIR}/Project/zot${CMAKE_EXECUTABLE_SUFFIX}) if(EXISTS - "${BuildDepends_BINARY_DIR}/Project/Debug/zot${CMAKE_EXECUTABLE_SUFFIX}" ) - message("found debug") + "${BuildDepends_BINARY_DIR}/Project/${config}/zot${CMAKE_EXECUTABLE_SUFFIX}" ) + message("found ${config}/zot${CMAKE_EXECUTABLE_SUFFIX}") set(zot - "${BuildDepends_BINARY_DIR}/Project/Debug/zot${CMAKE_EXECUTABLE_SUFFIX}") + "${BuildDepends_BINARY_DIR}/Project/${config}/zot${CMAKE_EXECUTABLE_SUFFIX}") endif() message("Running ${bar} ") @@ -305,12 +314,12 @@ if(NOT RESULT) message(SEND_ERROR "Could not build test project (2)!") endif() if(EXISTS - "${BuildDepends_BINARY_DIR}/Project/Debug/bar${CMAKE_EXECUTABLE_SUFFIX}" ) - message("found debug") + "${BuildDepends_BINARY_DIR}/Project/${config}/bar${CMAKE_EXECUTABLE_SUFFIX}" ) + message("found ${config}/bar${CMAKE_EXECUTABLE_SUFFIX}") endif() if(EXISTS - "${BuildDepends_BINARY_DIR}/Project/Debug/zot${CMAKE_EXECUTABLE_SUFFIX}" ) - message("found debug") + "${BuildDepends_BINARY_DIR}/Project/${config}/zot${CMAKE_EXECUTABLE_SUFFIX}" ) + message("found ${config}/zot${CMAKE_EXECUTABLE_SUFFIX}") endif() message("Running ${ninjadep} ")