Skip to content

Commit 311e710

Browse files
committed
Fix windows builds
1 parent 1b989f3 commit 311e710

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

.github/workflows/cmake_windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747

4848
- name: Build
4949
shell: bash
50-
run: cmake --build --preset conan-${{ env.BUILD_TYPE_LOWERCASE }}
50+
run: cmake --build --preset conan-${{ env.BUILD_TYPE_LOWERCASE }}
5151

5252
- name: run test (Windows)
5353
working-directory: ${{github.workspace}}/build

tests/CMakeLists.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,16 @@ else()
5454
GTest::gtest
5555
GTest::gtest_main)
5656

57-
gtest_discover_tests(behaviortree_cpp_test)
57+
# gtest_discover_tests queries the test executable for available tests and registers them on ctest individually
58+
# On Windows it needs a little help to find the shared libraries
59+
if(WIN32)
60+
gtest_discover_tests(behaviortree_cpp_test
61+
DISCOVERY_MODE PRE_TEST
62+
DISCOVERY_ENVIRONMENT "PATH=$<TARGET_FILE_DIR:behaviortree_cpp_test>;$ENV{PATH}"
63+
)
64+
else()
65+
gtest_discover_tests(behaviortree_cpp_test)
66+
endif()
5867

5968
endif()
6069

0 commit comments

Comments
 (0)