Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to work around pthread related static linking problem (#1761) #1763

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ set(ANTLR4_WITH_STATIC_CRT OFF)
set(ANTLR4_TAG tags/4.13.2)
include(ExternalAntlr4Cpp)

# None of AFDKO's c-sources are multithreaded, but we need to add
# -pthreads to makeotfexe on Linux to make ANTLR happy
set (THREADS_PREFER_PTHREAD_FLAG ON)
find_package (Threads REQUIRED)

if (DEFINED ENV{FORCE_BUILD_LIBXML2})
set(BUILD_STATIC_LIBXML2 TRUE)
Expand Down
5 changes: 5 additions & 0 deletions c/makeotf/source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,15 @@ if (HAVE_M_LIB)
target_link_libraries(makeotfexe PRIVATE m)
endif ()

if (CMAKE_USE_PTHREADS_INIT)
target_link_libraries(makeotfexe PRIVATE Threads::Threads)
endif ()

target_link_libraries(makeotfexe PUBLIC ${CHOSEN_LIBXML2_LIBRARY})

target_compile_definitions(makeotfexe PRIVATE MAKEOTFLIB_EXPORTS=1)

# set_target_properties(makeotfexe PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")


install(TARGETS makeotfexe DESTINATION bin)
Loading