Move the checking of WITH_GPU and WITH_TESTING into cc_test and nv_test
Created by: wangkuiyi
It seems that if we make CMake functions cc_test and nv_test, defined in cmake/generic.cmake, to check the value of CMake variables WITH_GPU and WITH_TESTING, we would be able to simplify the following CMakeLists.txt snippet:
if(WITH_TESTING)
cc_test(ddim_test SRCS ddim/ddim_test.cc DEPS ddim)
cc_test(place_test SRCS place/place_test.cc DEPS place)
if(WITH_GPU)
nv_test(cuda_test SRCS cuda_test/cuda_test.cu)
nv_test(dim_test SRCS ddim/dim_test.cu DEPS ddim)
endif()
endif()
into
cc_test(ddim_test SRCS ddim/ddim_test.cc DEPS ddim)
cc_test(place_test SRCS place/place_test.cc DEPS place)
nv_test(cuda_test SRCS cuda_test/cuda_test.cu)
nv_test(dim_test SRCS ddim/dim_test.cu DEPS ddim)