mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-05 21:39:19 +08:00
8f9a8d83e4
Signed-off-by: shengjh <1572099106@qq.com>
46 lines
1.8 KiB
CMake
46 lines
1.8 KiB
CMake
########################### GTEST
|
|
# Enable ExternalProject CMake module
|
|
INCLUDE(ExternalProject)
|
|
|
|
# Set default ExternalProject root directory
|
|
SET_DIRECTORY_PROPERTIES(PROPERTIES EP_PREFIX ${CMAKE_BINARY_DIR}/third_party)
|
|
|
|
# Add gtest
|
|
# http://stackoverflow.com/questions/9689183/cmake-googletest
|
|
ExternalProject_Add(
|
|
googletest
|
|
URL http://ss2.fluorinedog.com/data/gtest_v1.10.x.zip
|
|
# TIMEOUT 10
|
|
# # Force separate output paths for debug and release builds to allow easy
|
|
# # identification of correct lib in subsequent TARGET_LINK_LIBRARIES commands
|
|
# CMAKE_ARGS -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG:PATH=DebugLibs
|
|
# -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE:PATH=ReleaseLibs
|
|
# -Dgtest_force_shared_crt=ON
|
|
# Disable install step
|
|
INSTALL_COMMAND ""
|
|
# Wrap download, configure and build steps in a script to log output
|
|
LOG_DOWNLOAD ON
|
|
LOG_CONFIGURE ON
|
|
LOG_BUILD ON)
|
|
|
|
# Specify include dir
|
|
ExternalProject_Get_Property(googletest source_dir)
|
|
set(GTEST_INCLUDE_DIR ${source_dir}/include)
|
|
|
|
# Library
|
|
ExternalProject_Get_Property(googletest binary_dir)
|
|
|
|
# set(GTEST_LIBRARY_PATH ${binary_dir}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gtest.a)
|
|
# set(GTEST_LIBRARY gtest)
|
|
# add_library(${GTEST_LIBRARY} UNKNOWN IMPORTED)
|
|
# set_property(TARGET ${GTEST_LIBRARY} PROPERTY IMPORTED_LOCATION
|
|
# ${GTEST_LIBRARY_PATH} )
|
|
# add_dependencies(${GTEST_LIBRARY} googletest)
|
|
set(GTEST_LIBRARY_PATH ${binary_dir}/lib)
|
|
add_library(gtest UNKNOWN IMPORTED)
|
|
add_library(gtest_main UNKNOWN IMPORTED)
|
|
set_property(TARGET gtest PROPERTY IMPORTED_LOCATION ${GTEST_LIBRARY_PATH}/libgtest.a)
|
|
set_property(TARGET gtest_main PROPERTY IMPORTED_LOCATION ${GTEST_LIBRARY_PATH}/libgtest_main.a)
|
|
add_dependencies(gtest googletest)
|
|
add_dependencies(gtest_main googletest)
|