macro(set_and_check _var _file)
  set(${_var} "${_file}")
  if(NOT EXISTS "${_file}")
    message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !")
  endif()
endmacro()

# change the following options as needed
set(OpenBLAS_VERSION "1.0.0")

if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Darwin")
  set_and_check(OpenBLAS_INC_DIR "/usr/local/include")
  set_and_check(OpenBLAS_INCLUDE_DIRS "/usr/local/include")
  set_and_check(OpenBLAS_LIB_DIR "/usr/local/lib")
  set_and_check(OpenBLAS_LIBRARY_DIRS "/usr/local/lib")

elseif(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux")
  set_and_check(OpenBLAS_INC_DIR "/usr/include/x86_64-linux-gnu")
  set_and_check(OpenBLAS_INCLUDE_DIRS "/usr/include/x86_64-linux-gnu")
  set_and_check(OpenBLAS_LIB_DIR "/usr/lib/x86_64-linux-gnu")
  set_and_check(OpenBLAS_LIBRARY_DIRS "/usr/lib/x86_64-linux-gnu")

else()
  message(FATAL_ERROR "Unset operation system for OpenBLAS. Please edit the OpenBLASConfig.cmake file.")
endif()

set(OpenBLAS_LIB openblas)
set(OpenBLAS_LIBRARIES openblas)