Skip to content

Commit a4ffdf3

Browse files
authored
gflags (#12928)
1 parent 669304f commit a4ffdf3

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

cmake/external/gflags.cmake

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ SET(GFLAGS_SOURCES_DIR ${THIRD_PARTY_PATH}/gflags)
1818
SET(GFLAGS_INSTALL_DIR ${THIRD_PARTY_PATH}/install/gflags)
1919
SET(GFLAGS_INCLUDE_DIR "${GFLAGS_INSTALL_DIR}/include" CACHE PATH "gflags include directory." FORCE)
2020
IF(WIN32)
21-
set(GFLAGS_LIBRARIES "${GFLAGS_INSTALL_DIR}/lib/gflags.lib" CACHE FILEPATH "GFLAGS_LIBRARIES" FORCE)
21+
set(GFLAGS_LIBRARIES "${GFLAGS_INSTALL_DIR}/lib/libgflags.lib" CACHE FILEPATH "GFLAGS_LIBRARIES" FORCE)
2222
ELSE(WIN32)
2323
set(GFLAGS_LIBRARIES "${GFLAGS_INSTALL_DIR}/lib/libgflags.a" CACHE FILEPATH "GFLAGS_LIBRARIES" FORCE)
2424
ENDIF(WIN32)
@@ -45,7 +45,13 @@ ExternalProject_Add(
4545
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON
4646
-DCMAKE_BUILD_TYPE:STRING=${THIRD_PARTY_BUILD_TYPE}
4747
)
48-
48+
IF(WIN32)
49+
IF(NOT EXISTS "${GFLAGS_INSTALL_DIR}/lib/libgflags.lib")
50+
add_custom_command(TARGET extern_gflags POST_BUILD
51+
COMMAND cmake -E rename ${GFLAGS_INSTALL_DIR}/lib/gflags_static.lib ${GFLAGS_INSTALL_DIR}/lib/libgflags.lib
52+
)
53+
ENDIF()
54+
ENDIF(WIN32)
4955
ADD_LIBRARY(gflags STATIC IMPORTED GLOBAL)
5056
SET_PROPERTY(TARGET gflags PROPERTY IMPORTED_LOCATION ${GFLAGS_LIBRARIES})
5157
ADD_DEPENDENCIES(gflags extern_gflags)
@@ -60,3 +66,4 @@ IF(WITH_C_API)
6066
INSTALL(FILES ${GFLAGS_LIBRARIES} DESTINATION third_party/gflags/lib)
6167
ENDIF()
6268
ENDIF()
69+

0 commit comments

Comments
 (0)