2 # Find Thrust header files
3 # based on a source from ryuuta@gmail.com
5 find_path( THRUST_INCLUDE_DIR
6 HINTS /usr/include/cuda /usr/local/include ${CUDA_INCLUDE_DIRS}
12 file( STRINGS ${THRUST_INCLUDE_DIR}/thrust/version.h
14 REGEX "#define THRUST_VERSION[ \t]+([0-9x]+)"
17 string( REGEX REPLACE "#define THRUST_VERSION[ \t]+" "" version ${version} )
18 string( REGEX MATCH "^[0-9]" major ${version} )
19 string( REGEX REPLACE "^${major}00" "" version ${version} )
20 string( REGEX MATCH "^[0-9]" minor ${version} )
21 string( REGEX REPLACE "^${minor}0" "" version ${version} )
22 set( THRUST_VERSION "${major}.${minor}.${version}")
24 # Check for required components
25 set( THRUST_FOUND TRUE )
27 find_package_handle_standard_args( Thrust REQUIRED_VARS THRUST_INCLUDE_DIR THRUST_VERSION )