Skip to content

Commit

Permalink
Let CMake pass -pthread for us.
Browse files Browse the repository at this point in the history
Change-Id: Iac5278ba5de916aa7a5cb5c97a9103aa7e140562
Reviewed-on: https://code-review.googlesource.com/c/re2/+/58611
Reviewed-by: Paul Wankadia <[email protected]>
  • Loading branch information
junyer committed May 19, 2021
1 parent 1d56d78 commit ae1e294
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ if(WIN32)
add_definitions(-DUNICODE -D_UNICODE -DSTRICT -DNOMINMAX)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS)
elseif(UNIX)
add_compile_options(-pthread)
list(APPEND EXTRA_TARGET_LINK_LIBRARIES -pthread)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
endif()

if(USEPCRE)
Expand Down Expand Up @@ -86,6 +86,10 @@ target_include_directories(re2 PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_D
set_target_properties(re2 PROPERTIES SOVERSION ${SONAME} VERSION ${SONAME}.0.0)
add_library(re2::re2 ALIAS re2)

if(UNIX)
target_link_libraries(re2 PUBLIC Threads::Threads)
endif()

if(RE2_BUILD_TESTING)
set(TESTING_SOURCES
re2/testing/backtrack.cc
Expand Down

0 comments on commit ae1e294

Please sign in to comment.