mirror of
https://github.com/Z3Prover/z3
synced 2025-06-12 17:06:14 +00:00
[TravisCI][CMake] Add Z3_C_EXAMPLES_FORCE_CXX_LINKER
CMake option
and propagate its value into the C API examples. This flag forces the C API examples to use the C++ compiler as the linker rather than the C compiler. This a workaround to avoid linking errors when building with UBSan.
This commit is contained in:
parent
64ee9f168d
commit
a9fcfc531b
5 changed files with 52 additions and 2 deletions
|
@ -22,6 +22,17 @@ message(STATUS "Found Z3 ${Z3_VERSION_STRING}")
|
|||
message(STATUS "Z3_DIR: ${Z3_DIR}")
|
||||
|
||||
add_executable(c_example test_capi.c)
|
||||
|
||||
option(FORCE_CXX_LINKER "Force linker with C++ linker" OFF)
|
||||
if (FORCE_CXX_LINKER)
|
||||
# This is a hack for avoiding UBSan linking errors
|
||||
message(STATUS "Forcing use of C++ linker")
|
||||
set_target_properties(c_example
|
||||
PROPERTIES
|
||||
LINKER_LANGUAGE CXX
|
||||
)
|
||||
endif()
|
||||
|
||||
target_include_directories(c_example PRIVATE ${Z3_C_INCLUDE_DIRS})
|
||||
target_link_libraries(c_example PRIVATE ${Z3_LIBRARIES})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue