View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015919CMakeCMakepublic2016-01-14 10:112016-06-10 14:21
Reporterqiv 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformPCOSUbuntuOS Version15.04
Product VersionCMake 3.0.2 
Target VersionCMake 3.5Fixed in VersionCMake 3.5 
Summary0015919: Building CUDA files fails when source path contains parenthesis
DescriptionWhen working in a source path containing "()" I get the following error upon building CUDA files:

15:13 sandbox$ make
[ 6%] Building NVCC (Device) object CMakeFiles/githash.dir//./githash_generated_float3.cu.o
/bin/sh: 1: Syntax error: "(" unexpected
CMakeFiles/githash.dir/build.make:167: recipe for target 'CMakeFiles/githash.dir/./githash_generated_float3.cu.o' failed
make[2]: *** [CMakeFiles/githash.dir/./githash_generated_float3.cu.o] Error 2
CMakeFiles/Makefile2:60: recipe for target 'CMakeFiles/githash.dir/all' failed
make[1]: *** [CMakeFiles/githash.dir/all] Error 2
Makefile:76: recipe for target 'all' failed
make: *** [all] Error 2


The following fix provided by ngladitz in #cmake solves the issue on my machine:

diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
index ada5b8a..fe2647a 100644
--- a/Modules/FindCUDA.cmake
+++ b/Modules/FindCUDA.cmake
@@ -1474,6 +1474,7 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
           -P "${custom_target_script}"
         WORKING_DIRECTORY "${cuda_compile_intermediate_directory}"
         COMMENT "${cuda_build_comment_string}"
+ VERBATIM
         )
 
       # Make sure the build system knows the file is generated.
Steps To Reproduce16:06 sandbox$ cat CMakeLists.txt
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(githash)

FIND_PACKAGE(CUDA REQUIRED)
# FIND_PACKAGE(MPI REQUIRED)

INCLUDE(FindCUDA)

# INCLUDE_DIRECTORIES(/usr/local/cuda/include ${MPI_INCLUDE_PATH})

FILE(GLOB SOURCES "*.cu" "*.cpp" "*.c" "*.h")
CUDA_ADD_EXECUTABLE(githash ${SOURCES})

LIST(APPEND CMAKE_CXX_FLAGS "-std=c++0x -O3 -ffast-math -Wall")

LIST(APPEND CUDA_NVCC_FLAGS --compiler-options -fno-strict-aliasing -lineinfo -use_fast_math -Xptxas -dlcm=cg)
# LIST(APPEND CUDA_NVCC_FLAGS -gencode arch=compute_20,code=sm_20)
LIST(APPEND CUDA_NVCC_FLAGS -gencode arch=compute_30,code=sm_30)
# LIST(APPEND CUDA_NVCC_FLAGS -gencode arch=compute_35,code=sm_35)

# TARGET_LINK_LIBRARIES(githash /usr/local/cuda/lib64/libcudart.so ${MPI_LIBRARIES})


15:13 sandbox$ cmake .
-- Configuring done
-- Generating done
-- Build files have been written to: /home/.../Dropbox (CRG)/.../sandbox
TagsCMake, CUDA, FindCUDA
Attached Files

 Relationships

  Notes
(0040234)
qiv (reporter)
2016-01-14 10:19

Sorry, I forgot to give credit to http://bikulov.org/blog/2013/12/24/example-of-cmake-file-for-cuda-plus-cpp-code/ [^] for the CMakeLists.txt!
(0040246)
Brad King (manager)
2016-01-15 08:47

Thanks. Please try this fix:

 FindCUDA: Support special characters in path
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6ccc3070 [^]
(0040247)
qiv (reporter)
2016-01-15 10:11

Does work for me.

Actually the first VERBATIM is enough to get it running. However my file is not identically to the one in the fix, the line numbers differ and some neighbouring ones as well.
(0040501)
Brad King (manager)
2016-02-17 15:29

The change in 0015919:0040246 introduced a regression discussed here:

 FindCUDA.cmake regression in 3.5.0-rc2
 http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/15827 [^]

The fix for now is to revert use of VERBATIM with Visual Studio generators, but that will not affect the use case posted here.
(0041248)
Kitware Robot (administrator)
2016-06-10 14:21

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2016-01-14 10:11 qiv New Issue
2016-01-14 10:13 qiv Tag Attached: CMake
2016-01-14 10:13 qiv Tag Attached: CUDA
2016-01-14 10:13 qiv Tag Attached: FindCUDA
2016-01-14 10:19 qiv Note Added: 0040234
2016-01-15 08:47 Brad King Note Added: 0040246
2016-01-15 10:11 qiv Note Added: 0040247
2016-01-19 10:44 Brad King Status new => resolved
2016-01-19 10:44 Brad King Resolution open => fixed
2016-01-19 10:44 Brad King Fixed in Version => CMake 3.5
2016-01-19 10:44 Brad King Target Version => CMake 3.5
2016-02-17 15:29 Brad King Note Added: 0040501
2016-06-10 14:21 Kitware Robot Note Added: 0041248
2016-06-10 14:21 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team