Skip to content

Commit ae2026e

Browse files
authored
Fix building error of missing end-group for Android. (#8680)
1 parent 9fbe2e3 commit ae2026e

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,11 @@ include_directories("${CMAKE_CURRENT_BINARY_DIR}/proto")
166166
include_directories("${CMAKE_CURRENT_BINARY_DIR}/go/pserver/client/c")
167167

168168
set(EXTERNAL_LIBS
169-
${GFLAGS_LIBRARIES}
170-
${GLOG_LIBRARIES}
171-
${CBLAS_LIBRARIES}
172-
${PROTOBUF_LIBRARY}
173-
${ZLIB_LIBRARIES}
169+
gflags
170+
glog
171+
cblas
172+
protobuf
173+
zlib
174174
${PYTHON_LIBRARIES}
175175
)
176176

cmake/external/zlib.cmake

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ ENDIF(WIN32)
2828
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
2929

3030
ExternalProject_Add(
31-
zlib
31+
extern_zlib
3232
${EXTERNAL_PROJECT_LOG_ARGS}
3333
GIT_REPOSITORY "https://github.com/madler/zlib.git"
3434
GIT_TAG "v1.2.8"
@@ -49,9 +49,11 @@ ExternalProject_Add(
4949
-DCMAKE_BUILD_TYPE:STRING=${THIRD_PARTY_BUILD_TYPE}
5050
)
5151

52+
ADD_LIBRARY(zlib STATIC IMPORTED GLOBAL)
53+
SET_PROPERTY(TARGET zlib PROPERTY IMPORTED_LOCATION ${ZLIB_LIBRARIES})
54+
ADD_DEPENDENCIES(zlib extern_zlib)
55+
5256
LIST(APPEND external_project_dependencies zlib)
53-
ADD_LIBRARY(zlib_target STATIC IMPORTED GLOBAL)
54-
SET_PROPERTY(TARGET zlib_target PROPERTY IMPORTED_LOCATION ${ZLIB_LIBRARIES})
5557

5658
IF(WITH_C_API)
5759
INSTALL(DIRECTORY ${ZLIB_INCLUDE_DIR} DESTINATION third_party/zlib)

cmake/generic.cmake

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@ function(merge_static_libs TARGET_NAME)
104104
foreach(lib ${libs})
105105
list(APPEND libs_deps ${${lib}_LIB_DEPENDS})
106106
endforeach()
107-
list(REMOVE_DUPLICATES libs_deps)
107+
if(libs_deps)
108+
list(REMOVE_DUPLICATES libs_deps)
109+
endif()
108110

109111
# To produce a library we need at least one source file.
110112
# It is created by add_custom_command below and will helps
@@ -191,10 +193,13 @@ function(cc_library TARGET_NAME)
191193
list(REMOVE_ITEM cc_library_DEPS warpctc)
192194
add_dependencies(${TARGET_NAME} warpctc)
193195
endif()
194-
# Support linking flags: --whole-archive (Linux) / -force_load (MacOS)
195-
target_circle_link_libraries(${TARGET_NAME} ${cc_library_DEPS})
196196
if("${cc_library_DEPS}" MATCHES "ARCHIVE_START")
197+
# Support linking flags: --whole-archive (Linux) / -force_load (MacOS).
198+
# WARNING: Please don't use ARCHIVE_START&ARCHIVE_END if TARGET_NAME will be linked by other libraries.
199+
target_circle_link_libraries(${TARGET_NAME} ${cc_library_DEPS})
197200
list(REMOVE_ITEM cc_library_DEPS ARCHIVE_START ARCHIVE_END)
201+
else()
202+
target_link_libraries(${TARGET_NAME} ${cc_library_DEPS})
198203
endif()
199204
add_dependencies(${TARGET_NAME} ${cc_library_DEPS})
200205
endif()

0 commit comments

Comments
 (0)