From d34e066483382dc3df5012d3824f7f0120705597 Mon Sep 17 00:00:00 2001 From: Frederik Carlier Date: Fri, 29 Dec 2023 12:49:05 +0100 Subject: [PATCH] Tests: Append CMAKE_BINARY_DIR to PATH on Windows Avoids copying objc.dll to the tests directory. --- .github/workflows/main.yml | 1 - README.windows | 6 ------ Test/CMakeLists.txt | 3 +++ 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1d53680..16bce57 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -174,7 +174,6 @@ jobs: shell: cmd working-directory: build run: | - copy /y objc.dll Test ctest -j 4 --output-on-failure -T test diff --git a/README.windows b/README.windows index 9b62bee..6341fca 100644 --- a/README.windows +++ b/README.windows @@ -9,9 +9,3 @@ The runtime can build on Windows with Ninja: > cmake .. -G Ninja -DCMAKE_C_COMPILER=path/to/clang.exe -DCMAKE_CXX_COMPILER=path/to/clang.exe > ninja ``` - -Debugging ---------- - -The tests will all fail on Windows because they will not find objc.dll. -To fix this, copy objc.dll into the `Tests` build directory. diff --git a/Test/CMakeLists.txt b/Test/CMakeLists.txt index 6f818a4..92f25d7 100644 --- a/Test/CMakeLists.txt +++ b/Test/CMakeLists.txt @@ -127,6 +127,9 @@ function(addtest_flags TEST_NAME FLAGS TEST_SOURCE) set_property(TEST ${TEST_NAME} PROPERTY ENVIRONMENT "LD_LIBRARY_PATH=" "LLVM_PROFILE_FILE=${TEST_NAME}.profraw" ) + if(WIN32) + set_property(TEST ${TEST_NAME} PROPERTY ENVIRONMENT_MODIFICATION "PATH=path_list_append:${CMAKE_BINARY_DIR}") + endif() target_link_libraries(${TEST_NAME} objc) endfunction(addtest_flags)