Пытаюсь добавить авто сборку зависимости googlebenchmark с помощью ExternalProject_add, стартует все вроде удачно, но под конец выкидывает не понятную мне ошибку
[ 95%] Built target internal_threading_test
[ 97%] Built target benchmark_gtest
[100%] Built target commandlineflags_gtest
[ 33%] No install step for 'googlebenchmark'
[ 40%] Completed 'googlebenchmark'
[ 53%] Built target googlebenchmark
[ 60%] Linking CXX executable benchmark
/usr/bin/ld: googlebenchmark-build/src/libbenchmark.a(benchmark_runner.cc.o): в функции «std::thread::thread<void (*)(benchmark::internal::BenchmarkInstance const*, unsigned long, int, benchmark::internal::ThreadManager*), benchmark::internal::BenchmarkInstance const*, unsigned long&, int, benchmark::internal::ThreadManager*, void>(void (*&&)(benchmark::internal::BenchmarkInstance const*, unsigned long, int, benchmark::internal::ThreadManager*), benchmark::internal::BenchmarkInstance const*&&, unsigned long&, int&&, benchmark::internal::ThreadManager*&&)»:
benchmark_runner.cc:(.text._ZNSt6threadC2IPFvPKN9benchmark8internal17BenchmarkInstanceEmiPNS2_13ThreadManagerEEJS5_RmiS7_EvEEOT_DpOT0_[_ZNSt6threadC5IPFvPKN9benchmark8internal17BenchmarkInstanceEmiPNS2_13ThreadManagerEEJS5_RmiS7_EvEEOT_DpOT0_]+0x45): неопределённая ссылка на «pthread_create»
collect2: ошибка: выполнение ld завершилось с кодом возврата 1
make[2]: *** [CMakeFiles/benchmark.dir/build.make:179: benchmark] Ошибка 1
make[1]: *** [CMakeFiles/Makefile2:97: CMakeFiles/benchmark.dir/all] Ошибка 2
make: *** [Makefile:103: all] Ошибка 2
мой
ExternalProject.cmake
include(ExternalProject)
ExternalProject_Add(googlebenchmark
GIT_REPOSITORY https://github.com/google/benchmark.git
GIT_TAG master
SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/googlebenchmark-src"
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/googlebenchmark-build"
CONFIGURE_COMMAND ${CMAKE_COMMAND} -B ${CMAKE_CURRENT_BINARY_DIR}/googlebenchmark-build -S ${CMAKE_CURRENT_BINARY_DIR}/googlebenchmark-src -DBENCHMARK_DOWNLOAD_DEPENDENCIES=ON
BUILD_COMMAND ${CMAKE_COMMAND} --build ${CMAKE_CURRENT_BINARY_DIR}/googlebenchmark-build --config Release
INSTALL_COMMAND ""
)
ExternalProject_Get_Property(googlebenchmark source_dir)
set(GBENCHMARK_INCLUDE_DIRS ${source_dir}/include)
set(GMOCK_INCLUDE_DIRS ${source_dir}/googlemock/include)
file(MAKE_DIRECTORY ${GBENCHMARK_INCLUDE_DIRS})
file(MAKE_DIRECTORY ${GMOCK_INCLUDE_DIRS})
ExternalProject_Get_Property(googlebenchmark binary_dir)
if(UNIX)
set(GBENCHMARK_LIBRARY_PATH ${binary_dir}/src/${CMAKE_FIND_LIBRARY_PREFIXES}benchmark.a)
else ()
set(GBENCHMARK_LIBRARY_PATH ${binary_dir}/src/${CMAKE_FIND_LIBRARY_PREFIXES}/Debug/benchmarkd.lib)
endif ()
set(GBENCHMARK_LIBRARY Benchmark)
include_directories(SOURCE_DIR/include)
add_library(${GBENCHMARK_LIBRARY} UNKNOWN IMPORTED)
set_target_properties(${GBENCHMARK_LIBRARY} PROPERTIES
"IMPORTED_LOCATION" "${GBENCHMARK_LIBRARY_PATH}"
"IMPORTED_LINK_INTERFACE_LIBRARIES" "${CMAKE_THREAD_LIBS_INIT}"
"INTERFACE_INCLUDE_DIRECTORIES" "${GBENCHMARK_INCLUDE_DIRS}")
add_dependencies(${GBENCHMARK_LIBRARY} googlebenchmark)
Возможно я забыл добавить какое то правило? Несколько раз перепроверил, вроде пути прописал правильно