Index: polly/trunk/CMakeLists.txt =================================================================== --- polly/trunk/CMakeLists.txt +++ polly/trunk/CMakeLists.txt @@ -97,14 +97,17 @@ SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) option(POLLY_ENABLE_GPGPU_CODEGEN "Enable GPGPU code generation feature" OFF) +set(GPU_CODEGEN FALSE) if (POLLY_ENABLE_GPGPU_CODEGEN) # Do not require CUDA/OpenCL, as GPU code generation test cases can be run # without a CUDA/OpenCL library. - FIND_PACKAGE(CUDA) - FIND_PACKAGE(OpenCL) - set(GPU_CODEGEN TRUE) -else(POLLY_ENABLE_GPGPU_CODEGEN) - set(GPU_CODEGEN FALSE) + if ("NVPTX" IN_LIST LLVM_TARGETS_TO_BUILD) + FIND_PACKAGE(CUDA) + FIND_PACKAGE(OpenCL) + set(GPU_CODEGEN TRUE) + else() + message(WARNING "The LLVM NVPTX target is required for GPU code generation") + endif() endif(POLLY_ENABLE_GPGPU_CODEGEN)