macro(CHECK_CUDA_VERSION CUDA_MIN_VERSION CUDA_MAX_VERSION)
    if(NOT CUDA_VERSION)
        set(CUDA_VERSION ${CUDAToolkit_MAJOR_VERSION})
        message(STATUS "Set CUDA version to ${CUDA_VERSION}")
    endif()
    
    if(CUDA_VERSION LESS CUDA_MIN_VERSION)
        message(FATAL_ERROR "CUDA ${CUDA_MIN_VERSION}-${CUDA_MAX_VERSION} required, found ${CUDA_VERSION} which is less than ${CUDA_MIN_VERSION}")
    endif()
    if(CUDA_VERSION GREATER CUDA_MAX_MAJOR_VERSION)
        message(FATAL_ERROR "CUDA ${CUDA_MIN_VERSION}-${CUDA_MAX_VERSION} required, found ${CUDA_VERSION} which is greater than ${CUDA_MAX_VERSION}")
    endif()
endmacro()

macro(SET_CONSISTENT_STANDARD STANDARD)
    set(CMAKE_CXX_STANDARD ${STANDARD})
    set(CMAKE_CUDA_STANDARD ${STANDARD})
    set(CMAKE_CUDA_STANDARD_REQUIRED ON)
endmacro()

macro(SETUP_CONAN)
    message(STATUS "USING ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION} standard ${CMAKE_CXX_STANDARD}")

    if(NOT USING_CONAN)
        message(STATUS "Running conan install -s build_type=${CMAKE_BUILD_TYPE} ${CMAKE_SOURCE_DIR} -if ${CMAKE_BINARY_DIR} --build=missing")
        execute_process(
            COMMAND conan install -s compiler.libcxx=libstdc++11 -s build_type=${CMAKE_BUILD_TYPE} ${CMAKE_SOURCE_DIR} -if ${CMAKE_BINARY_DIR} --build=missing
            RESULT_VARIABLE conan_code)
        if(NOT "${conan_code}" STREQUAL "0")
            message(FATAL_ERROR "Conan failed ${conan_code}")
        endif()
    endif()
    include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
    conan_basic_setup()
endmacro()
