[cmake-developers] [CMake 0015919]: Building CUDA files fails when source path contains parenthesis
Mantis Bug Tracker
mantis at public.kitware.com
Thu Jan 14 10:11:51 EST 2016
The following issue has been SUBMITTED.
======================================================================
https://cmake.org/Bug/view.php?id=15919
======================================================================
Reported By: qiv
Assigned To:
======================================================================
Project: CMake
Issue ID: 15919
Category: CMake
Reproducibility: always
Severity: minor
Priority: normal
Status: new
======================================================================
Date Submitted: 2016-01-14 10:11 EST
Last Modified: 2016-01-14 10:11 EST
======================================================================
Summary: Building CUDA files fails when source path contains
parenthesis
Description:
When 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 Reproduce:
16: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
======================================================================
Issue History
Date Modified Username Field Change
======================================================================
2016-01-14 10:11 qiv New Issue
======================================================================
More information about the cmake-developers
mailing list