cmake_minimum_required (VERSION 3.9 FATAL_ERROR)

SET(name "prefixSum")
project(${name} LANGUAGES CXX CUDA)

if(WIN32)
    # Replace default warning level W3 with W4, this is like -Wall for GCC
    string(REPLACE "W3" "W4" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
endif()

if(UNIX)
    # warnings
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
endif()

add_executable(${name}
  helper_functions.h
  helper_string.h
  prefixSum.cu
  exception.h
  helper_image.h
  helper_timer.h)

target_compile_features(${name} PUBLIC cxx_std_11)


if(CMAKE_CUDA_COMPILER_VERSION VERSION_LESS "13.0")
    set_property(TARGET ${name} PROPERTY CUDA_ARCHITECTURES 50 61 72 75)
else()
    set_property(TARGET ${name} PROPERTY CUDA_ARCHITECTURES 75)
endif()


