message: pull libmolgrid from git if it isn't already installed (mostly works)
diff: -cmake_minimum_required(VERSION 3.10)
  +cmake_minimum_required(VERSION 3.12)
  project (gnina C CXX CUDA)
  #disable parts of caffe we don't need
  @@ -16,8 +16,26 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
  set(CMAKE_CUDA_SEPARABLE_COMPILATION ON)
  find_package(CUDA 9.0 REQUIRED)
  -find_package(libmolgrid REQUIRED)
  -include_directories($LIBMOLGRID_INCLUDE_DIR)
  +
  +if(NOT ${CUDA_cublas_device_LIBRARY}) #workaround for oldercmake/newer cuda issue
  + set(CUDA_cublas_device_LIBRARY "")
  +endif()
  +
  +find_package(libmolgrid)
  +if(NOT LIBMOLGRID_LIBRARY)
  + message("libmolgrid will be fetched from git")
  + include(ExternalProject)
  + find_package(Git REQUIRED)
  + set(EXTERNAL_INSTALL_LOCATION ${CMAKE_BINARY_DIR}/external)
  + ExternalProject_Add(libmolgrid
  + GIT_REPOSITORY https://github.com/gnina/libmolgrid
  + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LOCATION}
  + )
  + set(LIBMOLGRID_INCLUDE_DIR ${EXTERNAL_INSTALL_LOCATION}/include)
  + set(LIBMOLGRID_LIBRARY ${EXTERNAL_INSTALL_LOCATION}/lib/libmolgrid.so)
  +endif()
  +
  +include_directories(${LIBMOLGRID_INCLUDE_DIR})
  include(caffe/cmake/Utils.cmake)
  