Skip to content

Commit

Permalink
vendor: CMakeLists: Fix cmake pthread use
Browse files Browse the repository at this point in the history
Let cmake use -pthread instead of -lpthread, to fix build error on RISC-V.
  • Loading branch information
Xeonacid committed Jan 6, 2022
1 parent adfa152 commit 8d839f8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion vendor/CMakeLists.adb.txt
Expand Up @@ -191,7 +191,7 @@ target_link_libraries(adb
brotlidec
brotlienc
lz4
pthread
Threads::Threads
usb-1.0
z
zstd)
2 changes: 1 addition & 1 deletion vendor/CMakeLists.fastboot.txt
Expand Up @@ -135,4 +135,4 @@ target_compile_definitions(fastboot PRIVATE
target_link_libraries(fastboot
libsparse libzip libcutils liblog libfsmgr libutil
libbase libext4 libselinux libsepol libdiagnoseusb crypto
z pcre2-8 pthread dl)
z pcre2-8 Threads::Threads dl)
2 changes: 1 addition & 1 deletion vendor/CMakeLists.mke2fs.txt
Expand Up @@ -113,6 +113,6 @@ add_executable("${ANDROID_MKE2FS_NAME}"
e2fsprogs/misc/util.c)

target_link_libraries("${ANDROID_MKE2FS_NAME}"
libext2fs libsparse libbase libzip liblog libutil pthread z)
libext2fs libsparse libbase libzip liblog libutil Threads::Threads z)
target_include_directories("${ANDROID_MKE2FS_NAME}" PRIVATE
e2fsprogs/lib)
4 changes: 4 additions & 0 deletions vendor/CMakeLists.txt
Expand Up @@ -36,7 +36,11 @@ endif()

add_subdirectory(boringssl EXCLUDE_FROM_ALL)
add_subdirectory(fmtlib EXCLUDE_FROM_ALL)

find_package(Protobuf REQUIRED)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)

include_directories(${PROTOBUF_INCLUDE_DIRS})
include_directories(${CMAKE_CURRENT_BINARY_DIR})

Expand Down

0 comments on commit 8d839f8

Please sign in to comment.