Skip to content

Commit

Permalink
cmake: dont use rt and pthread for Android
Browse files Browse the repository at this point in the history
  • Loading branch information
jtattermusch committed Mar 2, 2018
1 parent 4d77449 commit c35e52e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ if(UNIX)
set(_gRPC_PLATFORM_LINUX ON)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(_gRPC_PLATFORM_MAC ON)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Android")
set(_gRPC_PLATFORM_ANDROID ON)
else()
set(_gRPC_PLATFORM_POSIX ON)
endif()
Expand Down Expand Up @@ -120,6 +122,8 @@ endif()

if(_gRPC_PLATFORM_MAC)
set(_gRPC_ALLTARGETS_LIBRARIES ${CMAKE_DL_LIBS} m pthread)
elseif(_gRPC_PLATFORM_ANDROID)
set(_gRPC_ALLTARGETS_LIBRARIES ${CMAKE_DL_LIBS} m)
elseif(UNIX)
set(_gRPC_ALLTARGETS_LIBRARIES ${CMAKE_DL_LIBS} rt m pthread)
endif()
Expand Down
4 changes: 4 additions & 0 deletions templates/CMakeLists.txt.template
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@
set(_gRPC_PLATFORM_LINUX ON)
elseif(<%text>${CMAKE_SYSTEM_NAME}</%text> MATCHES "Darwin")
set(_gRPC_PLATFORM_MAC ON)
elseif(<%text>${CMAKE_SYSTEM_NAME}</%text> MATCHES "Android")
set(_gRPC_PLATFORM_ANDROID ON)
else()
set(_gRPC_PLATFORM_POSIX ON)
endif()
Expand Down Expand Up @@ -168,6 +170,8 @@

if(_gRPC_PLATFORM_MAC)
set(_gRPC_ALLTARGETS_LIBRARIES <%text>${CMAKE_DL_LIBS}</%text> m pthread)
elseif(_gRPC_PLATFORM_ANDROID)
set(_gRPC_ALLTARGETS_LIBRARIES <%text>${CMAKE_DL_LIBS}</%text> m)
elseif(UNIX)
set(_gRPC_ALLTARGETS_LIBRARIES <%text>${CMAKE_DL_LIBS}</%text> rt m pthread)
endif()
Expand Down

0 comments on commit c35e52e

Please sign in to comment.