mirror of
https://github.com/Z3Prover/z3
synced 2025-04-28 11:25:51 +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:
parent
ac85c68ccb
commit
28493622c2
3 changed files with 49 additions and 0 deletions
|
@ -24,3 +24,19 @@ message(STATUS "Z3_DIR: ${Z3_DIR}")
|
|||
add_executable(c_example test_capi.c)
|
||||
target_include_directories(c_example PRIVATE ${Z3_C_INCLUDE_DIRS})
|
||||
target_link_libraries(c_example 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 c_example
|
||||
POST_BUILD
|
||||
COMMAND
|
||||
${CMAKE_COMMAND} -E copy_if_different
|
||||
$<TARGET_FILE:${z3_lib}>
|
||||
$<TARGET_FILE_DIR:c_example>
|
||||
)
|
||||
endforeach()
|
||||
endif()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue