From 43ce3524146e8b0570c7b2261b956c8a7eb6f16a Mon Sep 17 00:00:00 2001 From: Daniel McCarney Date: Wed, 4 Dec 2024 10:41:03 -0500 Subject: [PATCH] cmake: use $ for binaries Rather than handle the difference in output binaries per-platform on our own, rely on the target artifact generator expression[0] cmake already provides. [0]: https://cmake.org/cmake/help/latest/manual/cmake-generator-expressions.7.html#target-artifacts --- cmake/rust.cmake | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/cmake/rust.cmake b/cmake/rust.cmake index d0e1f5c5..b6db603d 100644 --- a/cmake/rust.cmake +++ b/cmake/rust.cmake @@ -30,16 +30,6 @@ add_custom_target( WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" ) -# The location/names of the example binaries change based on platform, and -# in the case of WIN32, by the Config. -if(WIN32) - set(CLIENT_BINARY "${CMAKE_BINARY_DIR}\\tests\\$\\client.exe") - set(SERVER_BINARY "${CMAKE_BINARY_DIR}\\tests\\$\\server.exe") -else() - set(CLIENT_BINARY "${CMAKE_BINARY_DIR}/tests/client") - set(SERVER_BINARY "${CMAKE_BINARY_DIR}/tests/server") -endif() - add_custom_target(connect-test DEPENDS client) # For WIN32 when using dynamic linking we need to put the .dll @@ -58,8 +48,8 @@ add_custom_command( TARGET connect-test POST_BUILD COMMAND - ${CMAKE_COMMAND} -E env RUSTLS_PLATFORM_VERIFIER=1 ${CLIENT_BINARY} - example.com 443 / + ${CMAKE_COMMAND} -E env RUSTLS_PLATFORM_VERIFIER=1 + "$" example.com 443 / WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" ) @@ -79,9 +69,9 @@ add_custom_command( TARGET integration-test POST_BUILD COMMAND - ${CMAKE_COMMAND} -E env CLIENT_BINARY=${CLIENT_BINARY} ${CMAKE_COMMAND} - -E env SERVER_BINARY=${SERVER_BINARY} cargo test --locked - ${CARGO_FEATURES} "$,--release,>" --test + ${CMAKE_COMMAND} -E env CLIENT_BINARY="$" + ${CMAKE_COMMAND} -E env SERVER_BINARY="$" cargo test + --locked ${CARGO_FEATURES} "$,--release,>" --test client_server client_server_integration -- --ignored --exact WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" )