Handle copying libcpptrace.dll better for findpackage integration

This commit is contained in:
Jeremy 2024-02-12 22:14:03 -06:00
parent ddf155b122
commit 3cd8e92e66
No known key found for this signature in database
GPG Key ID: BE03111EB7ED6E2E
2 changed files with 9 additions and 6 deletions

View File

@ -167,9 +167,6 @@ jobs:
cd findpackage-integration/build
cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH=C:/foo "-GUnix Makefiles"
make
if("${{matrix.shared}}" -eq "On") {
cp C:/foo/bin/libcpptrace.dll .
}
./main
test-mingw-add_subdirectory:
runs-on: windows-2022
@ -235,9 +232,6 @@ jobs:
cd findpackage-integration/build
cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH=C:/foo
msbuild demo_project.sln
if("${{matrix.shared}}" -eq "On") {
cp C:/foo/bin/cpptrace.dll .
}
.\Debug\main.exe
test-windows-add_subdirectory:
runs-on: windows-2022

View File

@ -7,3 +7,12 @@ add_executable(main main.cpp)
find_package(cpptrace REQUIRED)
target_link_libraries(main cpptrace::cpptrace)
target_compile_features(main PRIVATE cxx_std_11)
if(WIN32)
add_custom_command(
TARGET main POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
$<TARGET_FILE:cpptrace::cpptrace>
$<TARGET_FILE_DIR:main>
)
endif()