mirror of
https://github.com/Z3Prover/z3
synced 2025-04-06 01:24:08 +00:00
Use Position Independent Code flag on Static library builds (#4043)
Not compiling libz3 with `-fPIC` may lead to errors when using it in his static flavor from a shared library. Related https://github.com/Z3Prover/z3/issues/4038
This commit is contained in:
parent
5ec04f7fd2
commit
53c14bd554
|
@ -374,17 +374,16 @@ endif()
|
|||
# Position independent code
|
||||
################################################################################
|
||||
# This is required because code built in the components will end up in a shared
|
||||
# library. If not building a shared library ``-fPIC`` isn't needed and would add
|
||||
# unnecessary overhead.
|
||||
if (Z3_BUILD_LIBZ3_SHARED)
|
||||
# Avoid adding -fPIC compiler switch if we compile with MSVC (which does not
|
||||
# support the flag) or if we target Windows, which generally does not use
|
||||
# position independent code for native code shared libraries (DLLs).
|
||||
if (NOT (MSVC OR MINGW OR WIN32))
|
||||
z3_add_cxx_flag("-fPIC" REQUIRED)
|
||||
endif()
|
||||
# library.
|
||||
|
||||
# Avoid adding -fPIC compiler switch if we compile with MSVC (which does not
|
||||
# support the flag) or if we target Windows, which generally does not use
|
||||
# position independent code for native code shared libraries (DLLs).
|
||||
if (NOT (MSVC OR MINGW OR WIN32))
|
||||
z3_add_cxx_flag("-fPIC" REQUIRED)
|
||||
endif()
|
||||
|
||||
|
||||
################################################################################
|
||||
# Link time optimization
|
||||
################################################################################
|
||||
|
|
Loading…
Reference in a new issue