if (WIN32)
    find_library(OPENCL_LIBRARY OpenCL
	"c:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v4.0/lib/x64"
	)
    find_path(OPENCL_INCLUDE CL/opencl.h
	"c:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v4.0/include"
	)
    include_directories(${OPENCL_INCLUDE})
else (WIN32)
    find_library(OPENCL_LIBRARY OpenCL)
endif (WIN32)

include_directories(${CMAKE_SOURCE_DIR})

set(EXAMPLES
    benchmark
    cg
    devlist
    utests
    vector
    exclusive
    )

find_path(ODEINT boost/numeric/odeint.hpp)
if (ODEINT)
    include_directories(${ODEINT})
    set(EXAMPLES ${EXAMPLES} symbolic)
endif (ODEINT)

foreach(example ${EXAMPLES})
    add_executable(${example} ${example}.cpp)
    target_link_libraries(${example} ${OPENCL_LIBRARY})

    if (NOT WIN32)
	set_target_properties(${example} PROPERTIES
	    COMPILE_FLAGS -std=c++0x
	    )
    endif (NOT WIN32)
endforeach(example)


if (WIN32)
    find_library(OPENCL_LIBRARY OpenCL
	"c:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v4.0/lib/x64"
	)
    find_path(OPENCL_INCLUDE CL/opencl.h
	"c:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v4.0/include"
	)
    include_directories(${OPENCL_INCLUDE})
else (WIN32)
    find_library(OPENCL_LIBRARY OpenCL)
endif (WIN32)

include_directories(${CMAKE_SOURCE_DIR})

set(EXAMPLES
    benchmark
    cg
    devlist
    utests
    vector
    exclusive
    )

find_path(ODEINT boost/numeric/odeint.hpp)
if (ODEINT)
    include_directories(${ODEINT})
    set(EXAMPLES ${EXAMPLES} symbolic)
endif (ODEINT)

foreach(example ${EXAMPLES})
    add_executable(${example} ${example}.cpp)
    target_link_libraries(${example} ${OPENCL_LIBRARY})

    if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
    endif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")

    if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -stdlib=libc++")
    endif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
endforeach(example)


Use libc++ with clang by default
Use libc++ with clang by default
