[CMake] CMake CUDA 3.8+/9 support as a first class language with out Visual Studio Support... err what?

Brian Davis bitminer at gmail.com
Sun Aug 20 18:54:25 EDT 2017


Now that I have working machines and can create CUDA app (simple)
successfully that will run

​While trying:

message( "GPU_ARCH = ${GPU_ARCH}" )

target_compile_options(
    ${SOME_LIB_NAME}
    PRIVATE
    $<$<COMPILE_LANGUAGE:CUDA>:${GPU_ARCH}>
)

with output of:

GPU_ARCH =  -gencode arch=compute_30,code="sm_30,compute_30" -gencode
arch=compute_35,code="sm_35,compute_35" -gencode
arch=compute_50,code="sm_50,compute_50"
Configuring done
CMake Error at subprojects/4d_fluro_prototype/endoscopic_view/src/CMakeLists.txt:92
(target_compile_options):
  Error evaluating generator expression:

    $<COMPILE_LANGUAGE:CUDA>

  $<COMPILE_LANGUAGE:...> may not be used with Visual Studio generators.

I think I may becoming fully aware of the meaning of these statements from
CMake doc and from initial post of this thread:

--snip--
CMake learned to support CUDA as a first-class language that can be enabled
via the project() and enable_language() commands.
CUDA is currently supported by the Makefile Generators and the Ninja
generator on Linux, macOS, and Windows. *Support for the Visual Studio IDE
is under development but not included in this release.*
The NVIDIA CUDA Toolkit compiler (nvcc) is supported.
--snip--

Or did I try and misuse and abuse CMake again.  I am trying to learn the
"new way" of doing things and converting my projects accordingly, but the
doc leaves much to be desired.

I can get CMAKE_CUDA_FLAGS (well actually it duplicates the args twice but
at least they change in VS) to work but the bit about "Deprecate CMake
Variables" here:

https://github.com/boostcon/cppnow_presentations_2017/blob/
master/05-19-2017_friday/effective_cmake__daniel_pfeifer__
cppnow_05-19-2017.pdf

as "Variables are so CMake 2.8.12  Modern CMake is about Targets and
Properties!", I assume as emphasized in the true The Black Eyed Peas
style... I am sure I am "so 2017 late" to upgrading my CMake... err well if
only it was fully supportive of what I need... maybe it is... not that I
have any hope on learning how it does ( from doc)... I think I am gonna
blame "them Chickens jackin' my style"  as there ain't nobody here but us
chickens.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20170820/477039b1/attachment.html>


More information about the CMake mailing list