Doug
Doug

Reputation: 3003

Has my CUDA_NVCC_FLAGS been set

I'd like cmake to tell me if my CUDA_NVCC_FLAGS contains "-arch sm_??". That is, I'd like cmake to tell me if the CC info has been set.

How do I do this w/ cmake?
How can I get cmake to do a string search? Do I need to use a regExp?

Somthing like this:

IF(${CUDA_NVCC_FLAGS} contains "-arch sm_")
  MESSAGE("-arch flag has been set"
ELSE()
  MESSAGE(" CUDA_NVCC_FLAGS: ${CUDA_NVCC_FLAGS}")
  MESSAGE(FATAL_ERROR "Please set the CUDA_NVCC_FLAGS, CC level: -arch sm_??"
ENDIF()

Upvotes: 1

Views: 740

Answers (1)

Fraser
Fraser

Reputation: 78330

You want the if(<variable|string> MATCHES regex) command; that does a regex match:

IF(${CUDA_NVCC_FLAGS} MATCHES "-arch sm_")

Upvotes: 1

Related Questions