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

mk,cmake: add backtrace support and fix linking on OpenBSD #254

Merged
merged 1 commit into from
Mar 2, 2022
Merged
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
16 changes: 13 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ endif()
# Module/Package Includes
#
include(CheckIncludeFile)
find_package(Backtrace)
find_package(Threads)
find_package(OpenSSL)

Expand Down Expand Up @@ -68,6 +69,10 @@ if(HAVE_UNISTD_H)
add_definitions(-DHAVE_UNISTD_H)
endif()

if(Backtrace_FOUND)
add_definitions(-DHAVE_EXECINFO)
endif()

if(CMAKE_USE_PTHREADS_INIT)
add_definitions(-DHAVE_PTHREAD)
set(HAVE_PTHREAD ON)
Expand Down Expand Up @@ -457,10 +462,15 @@ if(WIN32)
iphlpapi
wsock32
ws2_32
${CMAKE_THREAD_LIBS_INIT}
)
else()
target_link_libraries(re-shared
PRIVATE -L/opt/local/lib ${OPENSSL_LIBRARIES} -lpthread)
target_link_libraries(re-shared PRIVATE
-L/opt/local/lib
${OPENSSL_LIBRARIES}
${Backtrace_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
)
endif()

set_target_properties(re-shared PROPERTIES PUBLIC_HEADER include/re.h)
Expand All @@ -482,7 +492,7 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
)
endif()
target_link_libraries(re-static
PUBLIC ${OPENSSL_LIBRARIES} -lpthread
PUBLIC ${OPENSSL_LIBRARIES} ${Backtrace_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}
PRIVATE -L/opt/local/lib
)

Expand Down
3 changes: 3 additions & 0 deletions mk/re.mk
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,9 @@ endif
HAVE_EXECINFO := $(shell $(call CC_TEST,execinfo.h))
ifneq ($(HAVE_EXECINFO),)
CFLAGS += -DHAVE_EXECINFO
ifeq ($(OS),openbsd)
LFLAGS += -lexecinfo
endif
endif

CFLAGS += -DHAVE_FORK
Expand Down