ExternalProject_Add -> vcpkg or Conan. I have more experience with vcpkg and the steps are:
1) declare your dependencies in a vcpkg.json file (similar to npm's package.json). Example:
{ ... "dependencies": [ "openssl" ] }
2) Add it to your CMakeLists.txt file. Example:
find_package(OpenSSL REQUIRED)
target_link_libraries(main PRIVATE OpenSSL::SSL OpenSSL::Crypto)