diff --git a/cmake/ftxui_set_options.cmake b/cmake/ftxui_set_options.cmake index ad4acaae056ecf8ce9b9631062c8f4c0767e77ed..6e5a8e0083f95620b75c23d90e236e73b5059ee1 100644 --- a/cmake/ftxui_set_options.cmake +++ b/cmake/ftxui_set_options.cmake @@ -49,6 +49,12 @@ function(ftxui_set_options library) target_compile_options(${library} PUBLIC "/utf-8") endif() + # CMake does automatically add -fPIC when linking a shared library, but it + # does not add it when linking a static library. This is a problem when the + # static library is later linked into a shared library. + # Doing it helps some users. + set_property(TARGET ${library} PROPERTY POSITION_INDEPENDENT_CODE ON) + # Add as many warning as possible: if (WIN32) if (MSVC)