Skip to content

Commit

Permalink
Try to work around pthread related static linking problem (#1761)
Browse files Browse the repository at this point in the history
  • Loading branch information
skef committed Nov 15, 2024
1 parent 0b58858 commit 886847d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
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)

0 comments on commit 886847d

Please sign in to comment.