You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
1.6 KiB

3 months ago
  1. ExternalProject_Add(
  2. GTest-EP
  3. URL https://github.com/google/googletest/archive/release-${GTEST_VERSION}.zip
  4. URL_MD5 ${GTEST_ZIPHASH}
  5. DOWNLOAD_NO_PROGRESS 1
  6. UPDATE_COMMAND ""
  7. BUILD_COMMAND cmake --build . --config ${CMAKE_BUILD_TYPE} --target gtest
  8. COMMAND cmake --build . --config ${CMAKE_BUILD_TYPE} --target gtest_main
  9. INSTALL_COMMAND ""
  10. BUILD_BYPRODUCTS ${CMAKE_BINARY_DIR}/resources/src/GTest-EP-build/googlemock/gtest/${CMAKE_FIND_LIBRARY_PREFIXES}gtest${STATIC_EXT} ${CMAKE_BINARY_DIR}/resources/src/GTest-EP-build/googlemock/gtest/${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main${STATIC_EXT}
  11. )
  12. ExternalProject_Get_Property(GTest-EP source_dir)
  13. ExternalProject_Get_Property(GTest-EP binary_dir)
  14. if(WIN32)
  15. add_imported_library(GTESTCORE STATIC "${binary_dir}/googlemock/gtest/${CMAKE_BUILD_TYPE}/${CMAKE_FIND_LIBRARY_PREFIXES}gtest${STATIC_EXT}" "${source_dir}/googletest/include")
  16. add_imported_library(GTESTMAIN STATIC "${binary_dir}/googlemock/gtest/${CMAKE_BUILD_TYPE}/${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main${STATIC_EXT}" "${source_dir}/googletest/include")
  17. set(GTEST_LIBRARIES GTESTCORE_STATIC GTESTMAIN_STATIC)
  18. else()
  19. add_imported_library(GTESTCORE STATIC "${binary_dir}/googlemock/gtest/${CMAKE_FIND_LIBRARY_PREFIXES}gtest${STATIC_EXT}" "${source_dir}/googletest/include")
  20. add_imported_library(GTESTMAIN STATIC "${binary_dir}/googlemock/gtest/${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main${STATIC_EXT}" "${source_dir}/googletest/include")
  21. set(GTEST_LIBRARIES GTESTCORE_STATIC GTESTMAIN_STATIC pthread dl)
  22. endif()
  23. add_dependencies(GTESTCORE_STATIC GTest-EP)
  24. add_dependencies(GTESTMAIN_STATIC GTest-EP)