title: Compile CUDA C++ using CMAKE- More than one compilation phase specified
body: <p>I am trying to compile a cuda application (on OSX Yosemite) using CMake. I have the compilation working with a Makefile:</p>
  
  <pre><code>CXX = nvcc
  CXX_FLAGS = -c -O3 -arch=sm_21
  CXX_LIBS = 
  BIN = md5_gpu.o
  
  main:
      $(CXX) $(CXX_FLAGS) md5_gpu.cu -o $(BIN) $(CXX_LIBS)
  </code></pre>
  
  <p>This makefile works, and I've tried to port it to CMake. Here is my attempt at making a CMakeLists.txt for the project:</p>
  
  <pre><code>### CMakeLists.txt for CUDA
  
  cmake_minimum_required(VERSION 2.8)
  find_package(CUDA QUIET REQUIRED)
  
  # Pass options to NVCC
  set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-c -O3 -arch=sm_21)
  
  cuda_compile(md5 md5_gpu.cu)
  
  cuda_add_executable(md5Build ${md5})
  </code></pre>
  
  <p>However, when I attempt to compile this with Cmake (Cmake -> make) an error is thrown that reads:</p>
  
  <pre><code>nvcc fatal   : More than one compilation phase specified
  CMake Error at cuda_compile_generated_md5_gpu.cu.o.cmake:206
  </code></pre>