3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-28 19:35:50 +00:00

[CMake] On Windows when building the examples copy the Z3 library

into the directory of the example executable so that it works "out
of the box".
This commit is contained in:
Dan Liew 2017-03-13 12:37:29 +00:00
parent ac85c68ccb
commit 28493622c2
3 changed files with 49 additions and 0 deletions

View file

@ -20,3 +20,20 @@ message(STATUS "Z3_DIR: ${Z3_DIR}")
add_executable(z3_tptp5 tptp5.cpp tptp5.lex.cpp)
target_include_directories(z3_tptp5 PRIVATE ${Z3_CXX_INCLUDE_DIRS})
target_link_libraries(z3_tptp5 PRIVATE ${Z3_LIBRARIES})
if ("${CMAKE_SYSTEM_NAME}" MATCHES "[Ww]indows")
# On Windows we need to copy the Z3 libraries
# into the same directory as the executable
# so that they can be found.
foreach (z3_lib ${Z3_LIBRARIES})
message(STATUS "Adding copy rule for ${z3_lib}")
add_custom_command(TARGET z3_tptp5
POST_BUILD
COMMAND
${CMAKE_COMMAND} -E copy_if_different
$<TARGET_FILE:${z3_lib}>
$<TARGET_FILE_DIR:z3_tptp5>
)
endforeach()
endif()